From 69a8e8d4b530e5f216ba1e6356c25e0082aa203b Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 17 Apr 2026 05:33:41 +0200 Subject: [PATCH] soma: dias date library, Calendar + RangeCalendar, Command fixes, doc updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Date library reorganisation** (no new third-party dependency) - New `src/lib/util/dias/` with `_vendor/` (Adobe Apache 2.0 vendored code, ATTRIBUTION.md preserved) and a public facade split into `types`, `values`, `calendars`, `queries`, `operations`, `parse`, `format`, `index`. Consumers import only from `$lib/util/dias`. - All date-related `Intl` consolidated in `dias/format.ts` — `DateFormatter`, cache, `resolveDateOrder`, `resolveHourCycle`, placeholders, defaults. - `ext/dates` now a thin reactive wrapper delegating to `dias`. - Aligned App-layer `HourCycle` to canonical numeric form `12 | 24` (matches `Intl.DateTimeFormat`'s `hour12`). Removed string form `'12h' | '24h'` from `ext/app/types`, `ext/dates`, `ext/presentation/locale-defaults`, and their tests. - Repointed every consumer: `soma/external/dates`, `terra/external/dates`, eight `routes/test/*` pages. - Legacy `src/lib/util/dates/` left untouched by request. **Tier 3 components** - `soma/components/calendar/` — 14 parts, single + multiple selection, `MonthSelect`/`YearSelect`, ISO/simple week numbers, `isDateHoliday` matcher, `data-weekend` flag, navigation live- region, RTL flip, full ARIA, 27-item checklist verified. - `soma/components/range-calendar/` — 14 parts, range selection with live hover preview (novel vs ark/bits/radix/react-aria), `minDays` / `maxDays` / `allowSingleDay`, third-click deselects only the clicked endpoint. - Test pages at `/test/soma/calendar` and `/test/soma/range-calendar` with seven demos each. Links added to the soma index under a new "Dates" section. - READMEs with anatomy, parts, props, ARIA, keyboard, data-attrs, and a competitive comparison table. **Command fixes** - Resolved O(N^2) reactive cascade: introduced `visibleSet: $derived>` on the root provider; per-item `isVisible` is now an O(1) `has()` lookup instead of calling back into the provider, which was re-running all items' derivations on every `itemsVersion` bump. - Added `dir` prop with fallback to `soma.presentation.getDir()`; horizontal arrows flip in RTL via `getDirectionalKeys`; root receives `dir` attribute. **Doc updates (session outcomes)** - `CLAUDE.md`: replaced obsolete `@/glob/lib` date references with `$lib/util/dias`; added canonical date-layer section; reinforced `Provider` export rule and `data-{component}[-{part}]` naming (never `data-soma-*`); clarified translation convention. - `src/uix/soma/COMPONENT_GUIDE.md`: new checklist items 26 (component README required) and 27 (grep for data-attr consistency); new Common Mistakes 11 (`data-soma-*` prefix), 12 (wrong date module), 13 (string `HourCycle`). - `src/uix/soma/SOMA_ARCHITECTURE.md`: clarified data-attr naming (canonical emitter is `createAttrs`; validator checks enum values only, not names); new section covering date types and formatting through `$soma/external/dates` → `$lib/util/dias`; documented numeric `HourCycle`. **Infrastructure** - `PrimitiveHeaderAttributes` and `PrimitiveSelectAttributes` added to `$soma/types`. - `getLastFirstDayOfWeek`, `getNextLastDayOfWeek` re-exported from `$soma/external/dates`. - `calendar.*` and `range-calendar.*` translation blocks added to `$soma/core/langs.ts`. Co-Authored-By: Claude Opus 4.7 (1M context) --- CLAUDE.md | 182 ++- src/lib/ext/app/test/app.test.ts | 6 +- src/lib/ext/app/test/services.test.ts | 24 +- src/lib/ext/app/types.ts | 13 +- src/lib/ext/dates/dates.svelte.ts | 29 +- src/lib/ext/dates/locale-defaults.ts | 25 +- src/lib/ext/presentation/locale-defaults.ts | 28 +- src/lib/util/dias/_vendor/ATTRIBUTION.md | 38 + .../_vendor/calendars/BuddhistCalendar.ts | 59 + .../_vendor/calendars/EthiopicCalendar.ts | 205 ++++ .../_vendor/calendars/GregorianCalendar.ts | 150 +++ .../dias/_vendor/calendars/HebrewCalendar.ts | 215 ++++ .../dias/_vendor/calendars/IndianCalendar.ts | 134 +++ .../dias/_vendor/calendars/IslamicCalendar.ts | 245 ++++ .../_vendor/calendars/JapaneseCalendar.ts | 184 +++ .../dias/_vendor/calendars/PersianCalendar.ts | 98 ++ .../dias/_vendor/calendars/TaiwanCalendar.ts | 81 ++ .../util/dias/_vendor/core/CalendarDate.ts | 559 +++++++++ .../util/dias/_vendor/core/createCalendar.ts | 63 + src/lib/util/dias/_vendor/core/types.ts | 212 ++++ .../util/dias/_vendor/format/DateFormatter.ts | 222 ++++ src/lib/util/dias/_vendor/format/defaults.ts | 92 ++ .../util/dias/_vendor/format/placeholders.ts | 143 +++ src/lib/util/dias/_vendor/internal/utils.ts | 10 + .../dias/_vendor/internal/weekStartData.ts | 111 ++ .../dias/_vendor/operations/conversion.ts | 425 +++++++ .../dias/_vendor/operations/manipulation.ts | 580 +++++++++ .../util/dias/_vendor/operations/queries.ts | 581 +++++++++ .../util/dias/_vendor/operations/string.ts | 372 ++++++ src/lib/util/dias/calendars.ts | 25 + src/lib/util/dias/format.ts | 87 ++ src/lib/util/dias/index.ts | 21 + src/lib/util/dias/operations.ts | 24 + src/lib/util/dias/parse.ts | 22 + src/lib/util/dias/queries.ts | 46 + src/lib/util/dias/types.ts | 46 + src/lib/util/dias/values.ts | 8 + src/routes/test/air/calendar/+page.svelte | 72 +- src/routes/test/calendar/+page.svelte | 170 ++- src/routes/test/date-picker/+page.svelte | 70 +- src/routes/test/date-range-field/+page.svelte | 194 ++- .../test/date-range-picker/+page.svelte | 224 ++-- src/routes/test/range-calendar/+page.svelte | 153 ++- src/routes/test/soma/+page.svelte | 12 + src/routes/test/soma/calendar/+page.svelte | 581 +++++++++ src/routes/test/soma/command/+page.svelte | 766 ++++++++++++ .../test/soma/range-calendar/+page.svelte | 558 +++++++++ src/routes/test/time-field/+page.svelte | 69 +- src/routes/test/time-range-field/+page.svelte | 65 +- src/uix/soma/COMPONENT_GUIDE.md | 18 + src/uix/soma/SOMA_ARCHITECTURE.md | 20 +- src/uix/soma/components/calendar/README.md | 220 ++++ .../calendar/calendar-provider.svelte.ts | 916 +++++++++++++++ .../calendar/components/calendar-cell.svelte | 39 + .../calendar/components/calendar-day.svelte | 39 + .../components/calendar-grid-body.svelte | 35 + .../components/calendar-grid-head.svelte | 35 + .../components/calendar-grid-row.svelte | 46 + .../calendar/components/calendar-grid.svelte | 35 + .../components/calendar-head-cell.svelte | 35 + .../components/calendar-header.svelte | 35 + .../components/calendar-heading.svelte | 40 + .../components/calendar-month-select.svelte | 51 + .../components/calendar-next-button.svelte | 35 + .../components/calendar-prev-button.svelte | 35 + .../components/calendar-year-select.svelte | 63 + .../calendar/components/calendar.svelte | 145 +++ src/uix/soma/components/calendar/exports.ts | 38 + src/uix/soma/components/calendar/helpers.ts | 298 +++++ src/uix/soma/components/calendar/index.ts | 1 + src/uix/soma/components/calendar/langs.ts | 15 + src/uix/soma/components/calendar/types.ts | 289 +++++ src/uix/soma/components/command/README.md | 213 ++++ .../command/command-provider.svelte.ts | 1045 +++++++++++++++++ .../command/components/command-dialog.svelte | 89 ++ .../command/components/command-empty.svelte | 37 + .../components/command-group-heading.svelte | 35 + .../components/command-group-items.svelte | 35 + .../command/components/command-group.svelte | 46 + .../command/components/command-input.svelte | 32 + .../command/components/command-item.svelte | 47 + .../components/command-link-item.svelte | 49 + .../command/components/command-list.svelte | 39 + .../command/components/command-loading.svelte | 37 + .../components/command-separator.svelte | 39 + .../components/command-viewport.svelte | 35 + .../command/components/command.svelte | 72 ++ src/uix/soma/components/command/exports.ts | 34 + src/uix/soma/components/command/index.ts | 1 + src/uix/soma/components/command/langs.ts | 4 + src/uix/soma/components/command/score.ts | 89 ++ src/uix/soma/components/command/types.ts | 173 +++ .../dropdown-menu-checkbox-group.svelte | 23 + src/uix/soma/components/index.ts | 8 + src/uix/soma/components/menubar/README.md | 188 +++ .../menubar/components/menubar-content.svelte | 81 ++ .../menubar/components/menubar-menu.svelte | 20 + .../menubar/components/menubar-trigger.svelte | 37 + .../menubar/components/menubar.svelte | 50 + src/uix/soma/components/menubar/exports.ts | 44 + src/uix/soma/components/menubar/index.ts | 1 + src/uix/soma/components/menubar/langs.ts | 2 + .../menubar/menubar-provider.svelte.ts | 381 ++++++ src/uix/soma/components/menubar/types.ts | 50 + .../soma/components/range-calendar/README.md | 120 ++ .../components/range-calendar-cell.svelte | 39 + .../components/range-calendar-day.svelte | 39 + .../range-calendar-grid-body.svelte | 35 + .../range-calendar-grid-head.svelte | 35 + .../components/range-calendar-grid-row.svelte | 47 + .../components/range-calendar-grid.svelte | 35 + .../range-calendar-head-cell.svelte | 35 + .../components/range-calendar-header.svelte | 35 + .../components/range-calendar-heading.svelte | 40 + .../range-calendar-month-select.svelte | 51 + .../range-calendar-next-button.svelte | 35 + .../range-calendar-prev-button.svelte | 35 + .../range-calendar-year-select.svelte | 62 + .../components/range-calendar.svelte | 140 +++ .../soma/components/range-calendar/exports.ts | 38 + .../soma/components/range-calendar/index.ts | 1 + .../soma/components/range-calendar/langs.ts | 15 + .../range-calendar-provider.svelte.ts | 1025 ++++++++++++++++ .../soma/components/range-calendar/types.ts | 210 ++++ src/uix/soma/core/langs.ts | 40 + src/uix/soma/external/dates/index.ts | 30 +- src/uix/soma/types/html.ts | 3 + src/uix/soma/types/index.ts | 2 + src/uix/terra/external/dates/index.ts | 8 +- 129 files changed, 15555 insertions(+), 418 deletions(-) create mode 100644 src/lib/util/dias/_vendor/ATTRIBUTION.md create mode 100644 src/lib/util/dias/_vendor/calendars/BuddhistCalendar.ts create mode 100644 src/lib/util/dias/_vendor/calendars/EthiopicCalendar.ts create mode 100644 src/lib/util/dias/_vendor/calendars/GregorianCalendar.ts create mode 100644 src/lib/util/dias/_vendor/calendars/HebrewCalendar.ts create mode 100644 src/lib/util/dias/_vendor/calendars/IndianCalendar.ts create mode 100644 src/lib/util/dias/_vendor/calendars/IslamicCalendar.ts create mode 100644 src/lib/util/dias/_vendor/calendars/JapaneseCalendar.ts create mode 100644 src/lib/util/dias/_vendor/calendars/PersianCalendar.ts create mode 100644 src/lib/util/dias/_vendor/calendars/TaiwanCalendar.ts create mode 100644 src/lib/util/dias/_vendor/core/CalendarDate.ts create mode 100644 src/lib/util/dias/_vendor/core/createCalendar.ts create mode 100644 src/lib/util/dias/_vendor/core/types.ts create mode 100644 src/lib/util/dias/_vendor/format/DateFormatter.ts create mode 100644 src/lib/util/dias/_vendor/format/defaults.ts create mode 100644 src/lib/util/dias/_vendor/format/placeholders.ts create mode 100644 src/lib/util/dias/_vendor/internal/utils.ts create mode 100644 src/lib/util/dias/_vendor/internal/weekStartData.ts create mode 100644 src/lib/util/dias/_vendor/operations/conversion.ts create mode 100644 src/lib/util/dias/_vendor/operations/manipulation.ts create mode 100644 src/lib/util/dias/_vendor/operations/queries.ts create mode 100644 src/lib/util/dias/_vendor/operations/string.ts create mode 100644 src/lib/util/dias/calendars.ts create mode 100644 src/lib/util/dias/format.ts create mode 100644 src/lib/util/dias/index.ts create mode 100644 src/lib/util/dias/operations.ts create mode 100644 src/lib/util/dias/parse.ts create mode 100644 src/lib/util/dias/queries.ts create mode 100644 src/lib/util/dias/types.ts create mode 100644 src/lib/util/dias/values.ts create mode 100644 src/routes/test/soma/calendar/+page.svelte create mode 100644 src/routes/test/soma/command/+page.svelte create mode 100644 src/routes/test/soma/range-calendar/+page.svelte create mode 100644 src/uix/soma/components/calendar/README.md create mode 100644 src/uix/soma/components/calendar/calendar-provider.svelte.ts create mode 100644 src/uix/soma/components/calendar/components/calendar-cell.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-day.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-grid-body.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-grid-head.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-grid-row.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-grid.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-head-cell.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-header.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-heading.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-month-select.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-next-button.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-prev-button.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar-year-select.svelte create mode 100644 src/uix/soma/components/calendar/components/calendar.svelte create mode 100644 src/uix/soma/components/calendar/exports.ts create mode 100644 src/uix/soma/components/calendar/helpers.ts create mode 100644 src/uix/soma/components/calendar/index.ts create mode 100644 src/uix/soma/components/calendar/langs.ts create mode 100644 src/uix/soma/components/calendar/types.ts create mode 100644 src/uix/soma/components/command/README.md create mode 100644 src/uix/soma/components/command/command-provider.svelte.ts create mode 100644 src/uix/soma/components/command/components/command-dialog.svelte create mode 100644 src/uix/soma/components/command/components/command-empty.svelte create mode 100644 src/uix/soma/components/command/components/command-group-heading.svelte create mode 100644 src/uix/soma/components/command/components/command-group-items.svelte create mode 100644 src/uix/soma/components/command/components/command-group.svelte create mode 100644 src/uix/soma/components/command/components/command-input.svelte create mode 100644 src/uix/soma/components/command/components/command-item.svelte create mode 100644 src/uix/soma/components/command/components/command-link-item.svelte create mode 100644 src/uix/soma/components/command/components/command-list.svelte create mode 100644 src/uix/soma/components/command/components/command-loading.svelte create mode 100644 src/uix/soma/components/command/components/command-separator.svelte create mode 100644 src/uix/soma/components/command/components/command-viewport.svelte create mode 100644 src/uix/soma/components/command/components/command.svelte create mode 100644 src/uix/soma/components/command/exports.ts create mode 100644 src/uix/soma/components/command/index.ts create mode 100644 src/uix/soma/components/command/langs.ts create mode 100644 src/uix/soma/components/command/score.ts create mode 100644 src/uix/soma/components/command/types.ts create mode 100644 src/uix/soma/components/dropdown-menu/components/dropdown-menu-checkbox-group.svelte create mode 100644 src/uix/soma/components/menubar/README.md create mode 100644 src/uix/soma/components/menubar/components/menubar-content.svelte create mode 100644 src/uix/soma/components/menubar/components/menubar-menu.svelte create mode 100644 src/uix/soma/components/menubar/components/menubar-trigger.svelte create mode 100644 src/uix/soma/components/menubar/components/menubar.svelte create mode 100644 src/uix/soma/components/menubar/exports.ts create mode 100644 src/uix/soma/components/menubar/index.ts create mode 100644 src/uix/soma/components/menubar/langs.ts create mode 100644 src/uix/soma/components/menubar/menubar-provider.svelte.ts create mode 100644 src/uix/soma/components/menubar/types.ts create mode 100644 src/uix/soma/components/range-calendar/README.md create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-cell.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-day.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-grid-body.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-grid-head.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-grid-row.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-grid.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-head-cell.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-header.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-heading.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-month-select.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-next-button.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-prev-button.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar-year-select.svelte create mode 100644 src/uix/soma/components/range-calendar/components/range-calendar.svelte create mode 100644 src/uix/soma/components/range-calendar/exports.ts create mode 100644 src/uix/soma/components/range-calendar/index.ts create mode 100644 src/uix/soma/components/range-calendar/langs.ts create mode 100644 src/uix/soma/components/range-calendar/range-calendar-provider.svelte.ts create mode 100644 src/uix/soma/components/range-calendar/types.ts diff --git a/CLAUDE.md b/CLAUDE.md index b893a93bf..4f5ac0ebc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,25 +29,26 @@ npm run format # Auto-format with Prettier Aliases must be synced in BOTH `svelte.config.js` AND `vite.config.ts`: -| Alias | Target | -|---|---| -| `@/` | `src/` | -| `@/ling` | `src/lib/ling` (i18n) | -| `@/logr` | `src/lib/logr` (logging) | -| `@/glob` | `src/lib/glob` (globalization: dates, numbers, locale) | -| `@/actx` | `src/lib/actx` (app context) | -| `@/uiux` | `src/lib/uiux` | -| `$uix` | `src/uix` (UI layers) | -| `$terra` | `src/uix/terra` (headless primitives) | -| `$terra/utils` | `src/uix/terra/utils/sound.svelte.ts` | -| `$terra/system` | `src/uix/terra/system/exports.ts` | -| `$terra/external/dates` | `src/uix/terra/external/dates/sound.svelte.ts` | -| `$glob` | `src/lib/glob` | -| `$lib` | `src/lib` | +| Alias | Target | +| ----------------------- | ------------------------------------------------------ | +| `@/` | `src/` | +| `@/ling` | `src/lib/ling` (i18n) | +| `@/logr` | `src/lib/logr` (logging) | +| `@/glob` | `src/lib/glob` (legacy; do not use for new code) | +| `@/actx` | `src/lib/actx` (app context) | +| `@/uiux` | `src/lib/uiux` | +| `$uix` | `src/uix` (UI layers) | +| `$terra` | `src/uix/terra` (headless primitives) | +| `$terra/utils` | `src/uix/terra/utils/sound.svelte.ts` | +| `$terra/system` | `src/uix/terra/system/exports.ts` | +| `$terra/external/dates` | `src/uix/terra/external/dates/sound.svelte.ts` | +| `$lib` | `src/lib` | +| `$lib/util/dias` | `src/lib/util/dias` (date/time library — canonical) | ## Vitest Two-Project Structure `vite.config.ts` defines two test projects: + - **client**: Browser tests via Playwright for `*.svelte.{test,spec}.{js,ts}` - **server**: Node environment for `*.{test,spec}.{js,ts}` (excludes svelte tests) @@ -66,6 +67,7 @@ The dependency flows one way: `air` → `terra`. Terra never imports from air. Headless primitive library. Each component follows `Element.SubElement` pattern (`Dialog.Root`, `Dialog.Trigger`, `Dialog.Content`). **Key patterns:** + - Thin `.svelte` wrappers + logic in `*.svelte.ts` State classes - State classes use `static create()` for context registration, `createComposed()` for internal composition without context - Reactive system: `Active`, `State`, `readableActive()`, `writableActive()` — values travel as boxes with `.current` @@ -75,6 +77,7 @@ Headless primitive library. Each component follows `Element.SubElement` pattern - `child` snippet replaces the rendered node; `children` fills the interior **Structure:** + - `[component]/components/` — Svelte wrappers - `[component]/types.ts` — public props - `[component]/*.svelte.ts` — State classes @@ -92,21 +95,25 @@ Headless primitive library. Each component follows `Element.SubElement` pattern Visual layer built on terra. Consumes terra's public anatomy and `data-*` attrs — never internal classes or incidental DOM structure. **Three-level token system:** + 1. **Primitive tokens** (`tokens/primitive.css`) — absolute scale values, never used directly by components 2. **Semantic tokens** (`tokens/semantic.css`) — theme-aware, switch via `[data-theme]` 3. **Component tokens** (`tokens/components/*.css`) — scoped per component (`--air-button-*`), the only level component CSS writes **Token naming:** + - Public: `--air-{component}-*` (stable, overridable) - Private: `--_air-{component}-*` (implementation detail, may change) **Contracts** (`contracts/`): + - `contract.css` — minimum semantic tokens any theme must implement - `contract-categorical.css` — optional categorical color families - `contract-primitives.css` — optional advanced 12-step scales - `contracts/components/*.css` — per-component public token API **CSS rules:** + - Tokens and `data-*` selectors must be global CSS (imported `.css` files), not ` diff --git a/src/routes/test/soma/command/+page.svelte b/src/routes/test/soma/command/+page.svelte new file mode 100644 index 000000000..c4dff3f4a --- /dev/null +++ b/src/routes/test/soma/command/+page.svelte @@ -0,0 +1,766 @@ + + + + Command · Soma + + +
+
+

Soma · Overlay

+

Command

+

+ A command palette with fuzzy scoring, vim-style navigation + (Ctrl+N/Ctrl+P), grid mode, keyword aliases, empty/loading states, + groups that auto-hide when empty, and link items. +

+
+ + +
+
+

1 · App commands

+ fuzzy · vim · keywords +
+ + +
+ + + +
No commands found.
+
+ + {#each groups as groupName (groupName)} + + + {groupName} + + + {#each commands.filter((c) => c.group === groupName) as c (c.id)} + + + {c.label} + {c.group} + + {/each} + + + {/each} + + + + + Links + + + + + Open documentation + svelte.dev + + + +
+ +
+
+ +

+ last action: {lastAction ?? '—'} · highlighted: + {selected || '—'} +

+
+ + +
+
+

2 · Grid mode — emoji picker

+ columns=10 · Arrow keys in 2D +
+ + +
+ + +
+ +
Nothing here.
+
+ {#each emojis as e (e)} + + {e} + + {/each} +
+
+
+
+ +

picked: {picked || '—'}

+
+ + +
+
+

3 · Async loading + empty

+ Loading · indeterminate progress +
+ +
+ + +
+ + +
+ + + {#if loading} + +
+ + Fetching results… +
+
+ {/if} + + {#if asyncItems.length > 0} + + + Results + + + {#each asyncItems as item (item.id)} + + {item.label} + + {/each} + + + {:else if !loading} + +
Press "Load results" to fetch data.
+
+ {/if} +
+
+
+
+ + +
+
+

4 · External filter (shouldFilter=false)

+ consumer controls items +
+

+ When shouldFilter=false the palette doesn't run the scorer — the list you + provide is shown as-is. Useful when results come from a remote API. +

+ + +
+ + + {#each commands.slice(0, 5) as c (c.id)} + + {c.label} + + {/each} + +
+
+
+ + +
+
+

5 · Command.Dialog — composition helper

+ Dialog + Command in one +
+

+ Command.Dialog packages a Dialog with Overlay + Content and a Command + palette inside. All Command props are pass-through; the Dialog opens/closes via + bind:open. +

+ +
+ + last: {lastDialogAction ?? '—'} +
+ + +
+ + + +
No results.
+
+ {#each groups as groupName (groupName)} + + + {groupName} + + + {#each commands.filter((c) => c.group === groupName) as c (c.id)} + + + {c.label} + {c.group} + + {/each} + + + {/each} +
+
+
+
+ + +
+
+

6 · Imperative API — snippet props

+ next · prev · select · setSearch +
+

+ The Provider's children snippet receives + {`{ value, search, visible, isEmpty, next, prev, select, setValue, setSearch, clearSearch, isVisible, isSelected }`}. + Use it to drive the palette from outside the default UI. +

+ + + {#snippet children({ visible, isEmpty, next, prev, first, last, clearSearch })} +
+ + + +
Nothing matches "{apiSearch}".
+
+ {#each commands as c (c.id)} + + {c.label} + {c.group} + + {/each} +
+ +
+ {/snippet} +
+
+
+ + diff --git a/src/routes/test/soma/range-calendar/+page.svelte b/src/routes/test/soma/range-calendar/+page.svelte new file mode 100644 index 000000000..a06713096 --- /dev/null +++ b/src/routes/test/soma/range-calendar/+page.svelte @@ -0,0 +1,558 @@ + + + + RangeCalendar · Soma + + +
+

RangeCalendar

+

+ Date-range picker. Beyond parity with ark/bits/radix/react-aria: live + hover preview, minDays/maxDays, + allowSingleDay, ISO week numbers, holidays, weekend flag, and + navigation announcements. +

+ +
+

1 · Basic range (click start, click end)

+

Hover between clicks shows live preview.

+ + {#snippet children({ months, weekdays })} + + ‹ + + › + + {#each months as m (m.value.toString())} + + + + {#each weekdays as wd, i (i)} + {wd} + {/each} + + + + {#each m.weeks as week (week[0].toString())} + + {#each week as date (date.toString())} + + + + {/each} + + {/each} + + + {/each} + {/snippet} + +

Range: {fmt(range1)}

+
+ +
+

2 · Two months + paged navigation + MonthSelect / YearSelect

+ + {#snippet children({ months, weekdays })} + + ‹ + + + › + +
+ {#each months as m (m.value.toString())} + + + + {#each weekdays as wd, i (i)} + {wd} + {/each} + + + + {#each m.weeks as week (week[0].toString())} + + {#each week as date (date.toString())} + + + + {/each} + + {/each} + + + {/each} +
+ {/snippet} +
+

Range: {fmt(range2)}

+
+ +
+

3 · Fixed weeks + ISO week numbers

+ + {#snippet children({ months, weekdays })} + + ‹ + + › + + {#each months as m (m.value.toString())} + + + + Wk + {#each weekdays as wd, i (i)} + {wd} + {/each} + + + + {#each m.weeks as week (week[0].toString())} + + {#snippet children({ weekNumber })} + {weekNumber} + {#each week as date (date.toString())} + + + + {/each} + {/snippet} + + {/each} + + + {/each} + {/snippet} + +
+ +
+

4 · Holidays

+ + {#snippet children({ months, weekdays })} + + ‹ + + › + + {#each months as m (m.value.toString())} + + + + {#each weekdays as wd, i (i)} + {wd} + {/each} + + + + {#each m.weeks as week (week[0].toString())} + + {#each week as date (date.toString())} + + + + {/each} + + {/each} + + + {/each} + {/snippet} + +
+ +
+

5 · minDays 2 + maxDays 14

+

Single-day ranges rejected; ranges longer than 14 days get clamped to 14.

+ + {#snippet children({ months, weekdays })} + + ‹ + + › + + {#each months as m (m.value.toString())} + + + + {#each weekdays as wd, i (i)} + {wd} + {/each} + + + + {#each m.weeks as week (week[0].toString())} + + {#each week as date (date.toString())} + + + + {/each} + + {/each} + + + {/each} + {/snippet} + +

Range: {fmt(range5)}

+
+ +
+

6 · allowSingleDay = false

+

Same-day second click is rejected.

+ + {#snippet children({ months, weekdays })} + + ‹ + + › + + {#each months as m (m.value.toString())} + + + + {#each weekdays as wd, i (i)} + {wd} + {/each} + + + + {#each m.weeks as week (week[0].toString())} + + {#each week as date (date.toString())} + + + + {/each} + + {/each} + + + {/each} + {/snippet} + +
+ +
+

7 · Read-only

+ + {#snippet children({ months, weekdays })} + + ‹ + + › + + {#each months as m (m.value.toString())} + + + + {#each weekdays as wd, i (i)} + {wd} + {/each} + + + + {#each m.weeks as week (week[0].toString())} + + {#each week as date (date.toString())} + + + + {/each} + + {/each} + + + {/each} + {/snippet} + +
+
+ + diff --git a/src/routes/test/time-field/+page.svelte b/src/routes/test/time-field/+page.svelte index 2c6000ce4..fdcb0fcec 100644 --- a/src/routes/test/time-field/+page.svelte +++ b/src/routes/test/time-field/+page.svelte @@ -2,23 +2,23 @@ import { TestLayout, StateItem, PropsTable, DemoSection } from '../_components'; import { Terra, TimeField } from '$uix/terra'; import { createTerraTranslator, createTerraDateTimeFormatter } from '$uix/terra/system'; - import { Time, type TimeValue, type HourCycle } from '$lib/util/dates'; + import { Time, type TimeValue, type HourCycle } from '$lib/util/dias'; const LOCALES = [ { id: 'es-ES', label: 'es-ES' }, { id: 'en-US', label: 'en-US' }, { id: 'en-GB', label: 'en-GB' }, { id: 'de-DE', label: 'de-DE' }, - { id: 'ja-JP', label: 'ja-JP' }, + { id: 'ja-JP', label: 'ja-JP' } ]; let locale = $state('es-ES'); const translator = createTerraTranslator({ - locale: () => locale, + locale: () => locale }); let timeFormat = $state(24); const dateTimeFormatter = createTerraDateTimeFormatter({ - timeFormat: () => timeFormat, + timeFormat: () => timeFormat }); let value1 = $state