Commit Graph

19 Commits

Author SHA1 Message Date
Florian Schroedl
93edebf144 feat: add icon support to button, alert, badge, and form input
Button:
- :icon-left, :icon-right props for buttons with leading/trailing icons
- :icon prop for icon-only buttons (square padding via .btn-icon class)
- Icon size scales with button size (sm→sm, md/lg→sm/md)

Alert:
- Auto-assigns variant-specific icons (circle-check, alert-triangle,
  alert-circle, info) per variant
- :icon-name prop to override default, false to suppress
- Layout restructured with .alert-icon + .alert-content wrapper

Badge:
- :icon-name prop adds a leading icon before text
- .badge-icon CSS scales icon to match badge font size

Form input:
- :icon-left and :icon-right props on form-input
- Wraps input in .form-input-wrap with absolutely-positioned icon spans
- Padding adjusts automatically via .form-input--icon-left/right

All three dev targets (hiccup, replicant, squint) updated with demos.
2026-03-23 10:19:14 +01:00
Florian Schroedl
9d5db65746 feat: add CSS live reload for dev setup
Two-part solution for automatic CSS updates during development:

1. `bb watch-theme` — polls src/ui/*.css and tokens.edn every 500ms,
   rebuilds dist/theme.css and copies to dev targets on change.

2. `dev/css-live-reload.js` — browser-side script that polls /theme.css
   and hot-swaps the stylesheet without a full page reload (no FOUC).

The watcher runs automatically in the hiccup tmux pane when using
`bb dev-all`. It can also be run standalone with `bb watch-theme`.

The live-reload script is included in all three dev targets (hiccup,
replicant, squint) and copied by `bb build-theme`.
2026-03-11 18:46:20 +01:00
Florian Schroedl
e9e0b15e16 feat: add separator component
Horizontal and vertical separator (divider) with CSS classes, ARIA
role="none", and data-orientation attribute. Includes dark mode support,
unit tests, and demos in all three dev targets.
2026-03-11 18:38:20 +01:00
Florian Schroedl
64bf5e029c feat(card): add card-list component with full and inset dividers
Adds `card-list` and `card-list-item` to the card module for rendering
a list of items inside a single card background with border separators.

The `:divider` prop controls separator style:
- `:full` (default) — borders go edge-to-edge
- `:inset` — borders are inset from edges by `--size-4`h
2026-03-11 18:29:39 +01:00
Florian Schroedl
41811dba88 feat(dev): add live theme adapter panel for color customization
Floating panel in bottom-right of all dev targets lets you:
- Switch presets (Purple, Blue, Neutral, Warm, Rose, Emerald)
- Adjust gray hue/saturation and accent hue/saturation with sliders
- Preview color swatches in real-time
- Copy EDN config to paste into tokens.edn

State persists in localStorage. Panel collapses to a small toggle button.
Hiccup handler changed to use #'handler var for hot-reload.
2026-03-11 11:51:59 +01:00
Florian Schroedl
828d467226 chore: add bb check-dev script for pre-commit server verification
Babashka script that checks all ui-dev tmux panes for compile errors,
verifies hiccup serves content, ensures squint .mjs files aren't
truncated, and confirms replicant JS is compiled. Replaces the manual
tmux capture-pane + curl checks documented in AGENTS.md.
2026-03-05 19:20:27 +01:00
Florian Schroedl
e003e1c4a8 docs: add agent rules for dev server management and browser verification
- Section 6: Never start dev servers from the agent (prevents orphan
  processes and broken tmux panes)
- Section 7: Check tmux panes for compile errors (renumbered)
- Section 8: Verify compiled output in browser before committing
  (catches squint's silent empty-file failures)
2026-03-05 14:30:01 +01:00
Florian Schroedl
3976bac7c9 chore: rename "UI Framework" to "Clojure UI Framework" across dev targets
Update sidebar brand title and page title in all three dev targets
(hiccup, replicant, squint) and the index shell.
2026-03-05 13:33:50 +01:00
Florian Schroedl
d2395fda44 feat: persist theme across dev targets via ?theme= query param
Each target reads the theme from ?theme=dark|light on load and applies
it to data-theme before first paint. A MutationObserver syncs theme
changes back to the URL via replaceState, and a click handler appends
?theme= to cross-port navigation links automatically.

The outer iframe shell (dev/index.html) uses postMessage to track theme
changes from iframes and passes the param when switching tabs.

For hiccup, the server also reads ?theme= and sets data-theme on the
<html> element server-side to prevent any flash of wrong theme.
2026-03-05 13:29:01 +01:00
Florian Schroedl
7ef565e271 fix(squint): use removeAttribute instead of js-delete for theme toggle
js-delete inside an anonymous function produces `return return delete`
in squint output, causing a syntax error that breaks the entire app.
2026-03-05 13:19:57 +01:00
Florian Schroedl
425d00529e fix: disable CSS transitions during dark/light theme toggle
Add a `[data-no-transitions]` CSS rule that suppresses all transitions.
The theme toggle in all three dev targets (hiccup, replicant, squint)
sets this attribute before switching, then removes it on the next
animation frame, preventing the jarring animated color shift.
2026-03-05 13:16:07 +01:00
Florian Schroedl
cd49da661d feat: dogfood sidebar as app shell with multi-page nav and target switcher
Restructures all three dev targets (hiccup, replicant, squint) to use
the sidebar component as the actual app shell. The sidebar navigates
between three pages:

- Components — all UI component demos
- Icons — categorized gallery with all 50+ icons and size variants
- Sidebar — embedded sidebar example with dashboard layout

The sidebar includes a Targets section that links between all three dev
servers, with ports derived dynamically from the current port so they
stay correct when using a custom base port (bb dev-all 5000).

Port scheme: replicant=base+1, squint=base+2, hiccup=base+3.
2026-03-05 13:14:07 +01:00
Florian Schroedl
c857954845 feat: add icon component with 50+ Lucide-based SVG icons
Adds a general-purpose icon system (ui.icon) with inline SVG rendering:
- 50+ icons from the Lucide icon set (navigation, actions, objects, UI,
  status, dev/technical categories)
- Size variants: sm (--size-4), md (--size-5), lg (--size-6), xl (--size-8)
- Pure data approach: icon paths stored as hiccup vectors, rendered into
  SVG with stroke="currentColor" so icons inherit text color
- API: (icon/icon {:icon-name :home :size :lg :class "custom"})

Integrates icons into the sidebar component:
- sidebar-menu-item now accepts :icon-name prop
- Renders icon in a .sidebar-menu-item-icon wrapper at :sm size

All three dev targets updated with icon gallery demo and sidebar icons.
2026-03-05 12:49:22 +01:00
Florian Schroedl
1b4929224b fix(accordion): place children inside content div and add group wrapper
Children were appended to the outer <details> element instead of inside
the .accordion-content div, causing text to render outside the accordion
box. Also adds .accordion-group wrapper to eliminate parent gap between
stacked items, and styles content with smaller font and muted color.
2026-03-03 17:12:29 +01:00
Florian Schroedl
e4ee7b750e feat(button): add link variant and polymorphic <a> rendering
When :href is provided, the button renders as <a> instead of <button>,
enabling navigation links with full button styling.

New :link variant renders as a minimal text link (underlined, accent
color, no background/padding) — works as both <button> and <a>.

CSS includes reset styles for a.btn (removes default link decoration)
and preserves underline for a.btn-link.
2026-03-03 17:04:41 +01:00
Florian Schroedl
a9f4f4158c fix: align dev target inconsistencies across hiccup, replicant, squint
- Squint section helper: add missing inner flex-column wrapper div
  (was putting children directly in section, unlike hiccup/replicant)
- Hiccup accordion text: shorten to match replicant/squint wording
- Squint dialog ID: rename "demo-dialog-sq" → "demo-dialog" to match others
2026-03-03 11:41:14 +01:00
Florian Schroedl
18043cb150 feat: add 13 components adapted from Oat UI
Components (.cljc + .css + tests):
- Alert (success/warning/danger/info variants)
- Badge (primary/secondary/outline/success/warning/danger)
- Card (card/card-header/card-body/card-footer)
- Accordion (collapsible with open/closed state)
- Table (headers/rows, striped/bordered variants)
- Dialog (modal with header/body/footer sections)
- Breadcrumb (nav with active item)
- Pagination (current/total with prev/next)
- Progress (value bar with color variants)
- Spinner (sm/md/lg sizes)
- Skeleton (line/box/circle/heading placeholders)
- Switch (toggle with checked/disabled states)
- Tooltip (hover text via data-tooltip attr)

CSS-only additions:
- Form elements (inputs, selects, checkboxes, radios, range, groups)
- Grid (12-column system with offsets, responsive)
- Utilities (flex, spacing, alignment, sr-only)

Also adds warning/fg-on-warning tokens to light and dark themes.
All 3 dev targets updated with full component showcase.
40 tests, 213 assertions, all passing.
2026-03-03 11:37:05 +01:00
Florian Schroedl
6b4899f8bf refactor: centralize body base styles in theme.css
Move font-family, background, color, margin, and transition from
duplicated inline <style> blocks in each dev target into the CSS
generator (base-css). Dev pages now only set page-specific padding.

Also fixes hiccup target rendering the wrong font due to hiccup2
HTML-escaping quotes inside <style> tags, and adds missing <!DOCTYPE>.
2026-03-03 11:04:27 +01:00
Florian Schroedl
42ddb56d65 Init 2026-03-03 11:02:08 +01:00