@rokkit/ui 1.4.2 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/components/CodeGroup.svelte +0 -1
  2. package/dist/components/CommandPalette.svelte +2 -1
  3. package/dist/components/CommandPalette.svelte.d.ts +2 -5
  4. package/dist/components/Dropdown.svelte +3 -22
  5. package/dist/components/Dropdown.svelte.d.ts +2 -20
  6. package/dist/components/FloatingAction.svelte +2 -2
  7. package/dist/components/FloatingAction.svelte.d.ts +2 -5
  8. package/dist/components/Grid.svelte +11 -15
  9. package/dist/components/Grid.svelte.d.ts +2 -43
  10. package/dist/components/LazyTree.svelte +11 -17
  11. package/dist/components/LazyTree.svelte.d.ts +2 -28
  12. package/dist/components/List.svelte +12 -21
  13. package/dist/components/List.svelte.d.ts +2 -47
  14. package/dist/components/Menu.svelte +12 -26
  15. package/dist/components/Menu.svelte.d.ts +2 -66
  16. package/dist/components/MultiSelect.svelte +12 -26
  17. package/dist/components/MultiSelect.svelte.d.ts +2 -23
  18. package/dist/components/Select.svelte +12 -27
  19. package/dist/components/Select.svelte.d.ts +2 -24
  20. package/dist/components/Swatch.svelte +1 -27
  21. package/dist/components/Swatch.svelte.d.ts +1 -27
  22. package/dist/components/Table.svelte +10 -3
  23. package/dist/components/Tabs.svelte +25 -7
  24. package/dist/components/Tabs.svelte.d.ts +9 -1
  25. package/dist/components/Toggle.svelte +14 -4
  26. package/dist/components/Toggle.svelte.d.ts +4 -1
  27. package/dist/components/Toolbar.svelte +2 -2
  28. package/dist/components/Toolbar.svelte.d.ts +1 -2
  29. package/dist/components/Tree.svelte +11 -14
  30. package/dist/components/Tree.svelte.d.ts +2 -29
  31. package/dist/components/UploadProgress.svelte +3 -4
  32. package/dist/components/UploadProgress.svelte.d.ts +1 -4
  33. package/dist/components/UploadTarget.svelte +2 -4
  34. package/dist/components/UploadTarget.svelte.d.ts +14 -4
  35. package/dist/types/chat.d.ts +15 -0
  36. package/dist/types/command-palette.d.ts +18 -0
  37. package/dist/types/command-palette.js +7 -0
  38. package/dist/types/floating-action.d.ts +5 -0
  39. package/dist/types/grid.d.ts +37 -0
  40. package/dist/types/grid.js +8 -0
  41. package/dist/types/index.d.ts +4 -0
  42. package/dist/types/index.js +8 -0
  43. package/dist/types/list.d.ts +22 -55
  44. package/dist/types/menu.d.ts +9 -2
  45. package/dist/types/select.d.ts +52 -62
  46. package/dist/types/snippets.d.ts +64 -0
  47. package/dist/types/snippets.js +16 -0
  48. package/dist/types/swatch.d.ts +39 -0
  49. package/dist/types/swatch.js +8 -0
  50. package/dist/types/table.d.ts +5 -0
  51. package/dist/types/toolbar.d.ts +5 -0
  52. package/dist/types/tree.d.ts +34 -66
  53. package/package.json +5 -5
@@ -43,12 +43,7 @@
43
43
  import { Navigator, Trigger } from '@rokkit/actions'
44
44
  import { DEFAULT_STATE_ICONS, resolveSnippet, ITEM_SNIPPET, GROUP_SNIPPET } from '@rokkit/core'
45
45
  import ItemContent from './ItemContent.svelte'
46
-
47
- interface SelectIcons {
48
- opened?: string
49
- closed?: string
50
- checked?: string
51
- }
46
+ import type { SelectProps, SelectStateIcons } from '../types/select.js'
52
47
 
53
48
  let {
54
49
  items = [],
@@ -63,28 +58,18 @@
63
58
  align = 'start',
64
59
  direction = 'down',
65
60
  maxRows = 8,
66
- icons: userIcons = {} as SelectIcons,
61
+ icons: userIcons = {} as SelectStateIcons,
67
62
  onchange,
68
63
  class: className = '',
69
- ...snippets
70
- }: {
71
- items?: unknown[]
72
- fields?: Record<string, string>
73
- value?: unknown
74
- selected?: unknown
75
- placeholder?: string
76
- size?: string
77
- disabled?: boolean
78
- filterable?: boolean
79
- filterPlaceholder?: string
80
- align?: 'start' | 'end'
81
- direction?: 'up' | 'down'
82
- maxRows?: number
83
- icons?: SelectIcons
84
- onchange?: (value: unknown, item: unknown) => void
85
- class?: string
86
- [key: string]: unknown
87
- } = $props()
64
+ itemContent,
65
+ groupContent,
66
+ snippets = {}
67
+ }: SelectProps = $props()
68
+
69
+ // What resolveSnippet searches: the per-item named snippets plus the two
70
+ // defaults it falls back to. Named snippets arrive as a declared `snippets`
71
+ // prop now, so a misspelled prop name is a type error rather than a no-op.
72
+ const snippetBag = $derived({ ...snippets, itemContent, groupContent })
88
73
 
89
74
  const icons = $derived({
90
75
  ...DEFAULT_STATE_ICONS.selector,
@@ -464,7 +449,7 @@
464
449
  {@const proxy = node.proxy}
465
450
  {@const sel = !node.hasChildren && proxy.value === value}
466
451
  {@const content = resolveSnippet(
467
- snippets as Record<string, unknown>,
452
+ snippetBag,
468
453
  proxy,
469
454
  node.hasChildren ? GROUP_SNIPPET : ITEM_SNIPPET
470
455
  )}
@@ -1,26 +1,4 @@
1
- interface SelectIcons {
2
- opened?: string;
3
- closed?: string;
4
- checked?: string;
5
- }
6
- type $$ComponentProps = {
7
- items?: unknown[];
8
- fields?: Record<string, string>;
9
- value?: unknown;
10
- selected?: unknown;
11
- placeholder?: string;
12
- size?: string;
13
- disabled?: boolean;
14
- filterable?: boolean;
15
- filterPlaceholder?: string;
16
- align?: 'start' | 'end';
17
- direction?: 'up' | 'down';
18
- maxRows?: number;
19
- icons?: SelectIcons;
20
- onchange?: (value: unknown, item: unknown) => void;
21
- class?: string;
22
- [key: string]: unknown;
23
- };
24
- declare const Select: import("svelte").Component<$$ComponentProps, {}, "value" | "selected">;
1
+ import type { SelectProps } from '../types/select.js';
2
+ declare const Select: import("svelte").Component<SelectProps, {}, "value" | "selected">;
25
3
  type Select = ReturnType<typeof Select>;
26
4
  export default Select;
@@ -1,34 +1,9 @@
1
1
  <script lang="ts">
2
- import type { Snippet } from 'svelte'
3
2
  import type { ProxyItem } from '@rokkit/states'
4
3
  import { Wrapper, ProxyTree } from '@rokkit/states'
5
4
  import { Navigator } from '@rokkit/actions'
5
+ import type { SwatchProps } from '../types/swatch.js'
6
6
 
7
- interface SwatchProps {
8
- /** Color options — primitives (hex/name strings) or objects with mapped fields */
9
- options?: Array<string | number | Record<string, unknown>>
10
- /** Field mapping for object options (value, fill, stroke, …) */
11
- fields?: Record<string, string>
12
- /** Selected value (bindable). Array when `multiple`. */
13
- value?: unknown
14
- /** Allow multiple selection */
15
- multiple?: boolean
16
- /** Swatch shape */
17
- shape?: 'square' | 'circle'
18
- /** Size variant */
19
- size?: 'sm' | 'md' | 'lg'
20
- /** Disable the whole group */
21
- disabled?: boolean
22
- /** Accessible group label */
23
- label?: string
24
- /** Additional CSS classes */
25
- class?: string
26
- /** Called when selection changes */
27
- onchange?: (value: unknown, item: unknown) => void
28
- /** Custom snippet for rendering a swatch (receives proxy + selected) */
29
- item?: Snippet<[ProxyItem, boolean]>
30
- [key: string]: unknown
31
- }
32
7
 
33
8
  let {
34
9
  options = [],
@@ -42,7 +17,6 @@
42
17
  class: className = '',
43
18
  onchange,
44
19
  item: itemSnippet,
45
- ..._rest
46
20
  }: SwatchProps = $props()
47
21
 
48
22
  const proxyTree = $derived(new ProxyTree(options, userFields))
@@ -1,30 +1,4 @@
1
- import type { Snippet } from 'svelte';
2
- import type { ProxyItem } from '@rokkit/states';
3
- interface SwatchProps {
4
- /** Color options — primitives (hex/name strings) or objects with mapped fields */
5
- options?: Array<string | number | Record<string, unknown>>;
6
- /** Field mapping for object options (value, fill, stroke, …) */
7
- fields?: Record<string, string>;
8
- /** Selected value (bindable). Array when `multiple`. */
9
- value?: unknown;
10
- /** Allow multiple selection */
11
- multiple?: boolean;
12
- /** Swatch shape */
13
- shape?: 'square' | 'circle';
14
- /** Size variant */
15
- size?: 'sm' | 'md' | 'lg';
16
- /** Disable the whole group */
17
- disabled?: boolean;
18
- /** Accessible group label */
19
- label?: string;
20
- /** Additional CSS classes */
21
- class?: string;
22
- /** Called when selection changes */
23
- onchange?: (value: unknown, item: unknown) => void;
24
- /** Custom snippet for rendering a swatch (receives proxy + selected) */
25
- item?: Snippet<[ProxyItem, boolean]>;
26
- [key: string]: unknown;
27
- }
1
+ import type { SwatchProps } from '../types/swatch.js';
28
2
  declare const Swatch: import("svelte").Component<SwatchProps, {}, "value">;
29
3
  type Swatch = ReturnType<typeof Swatch>;
30
4
  export default Swatch;
@@ -23,7 +23,8 @@
23
23
  header: headerSnippet,
24
24
  row: rowSnippet,
25
25
  cell: cellSnippet,
26
- empty: emptySnippet
26
+ empty: emptySnippet,
27
+ snippets = {}
27
28
  }: TableProps = $props()
28
29
 
29
30
  const icons = $derived<TableSortIcons>({ ...defaultTableSortIcons, ...userIcons })
@@ -172,9 +173,15 @@
172
173
  tabindex={isFocused ? 0 : -1}
173
174
  >
174
175
  {#each proxyTable.columns as column (column.name)}
175
- {#if cellSnippet}
176
+ <!-- A column that names a snippet is more specific than the blanket
177
+ `cell`, so it wins — the same precedence per-item named snippets
178
+ have over `itemContent` elsewhere. Naming one nobody passed falls
179
+ through to the default renderer rather than blanking the cell. -->
180
+ {@const namedCell = column.snippet ? snippets[column.snippet] : undefined}
181
+ {@const renderCell = namedCell ?? cellSnippet}
182
+ {#if renderCell}
176
183
  <td data-table-cell data-column={column.name} data-label={column.label ?? column.name} style:text-align={column.align}>
177
- {@render cellSnippet(getCellValue(row, column), column, row)}
184
+ {@render renderCell(getCellValue(row, column), column, row)}
178
185
  </td>
179
186
  {:else}
180
187
  {@const cellIcon = getCellIcon(row, column)}
@@ -22,6 +22,8 @@
22
22
  import { Wrapper, ProxyTree, messages } from '@rokkit/states'
23
23
  import { Navigator } from '@rokkit/actions'
24
24
  import { resolveSnippet, ITEM_SNIPPET, DEFAULT_STATE_ICONS } from '@rokkit/core'
25
+ import type { Snippet } from 'svelte'
26
+ import type { SelectableItemSnippet, ItemSnippet } from '../types/snippets.js'
25
27
 
26
28
  let {
27
29
  options = [],
@@ -40,8 +42,24 @@
40
42
  onselect,
41
43
  onadd,
42
44
  onremove,
43
- ...snippets
44
- }: TabsProps & { labels?: Record<string, string>; [key: string]: unknown } = $props()
45
+ itemContent,
46
+ empty,
47
+ tabPanel,
48
+ snippets = {}
49
+ }: TabsProps & {
50
+ labels?: Record<string, string>
51
+ // Tabs renders its content as content(proxy, selected).
52
+ itemContent?: SelectableItemSnippet
53
+ /** Shown when there are no tabs. */
54
+ empty?: Snippet<[]>
55
+ /** Panel body for the active tab. */
56
+ tabPanel?: ItemSnippet
57
+ /** Per-item named snippets, keyed by the item's `snippet` field. */
58
+ snippets?: Record<string, SelectableItemSnippet>
59
+ } = $props()
60
+
61
+ // See the note in List.svelte — named snippets are a declared prop now.
62
+ const snippetBag = $derived({ ...snippets, itemContent })
45
63
 
46
64
  const labels = $derived({ ...messages.tabs, ...userLabels })
47
65
 
@@ -135,8 +153,8 @@
135
153
  >
136
154
  {#if options.length === 0}
137
155
  <div data-tabs-empty>
138
- {#if snippets.empty}
139
- {@render snippets.empty()}
156
+ {#if empty}
157
+ {@render empty()}
140
158
  {:else}
141
159
  {@render defaultEmpty()}
142
160
  {/if}
@@ -146,7 +164,7 @@
146
164
  {#each wrapper.flatView as node (node.key)}
147
165
  {@const proxy = node.proxy}
148
166
  {@const sel = proxy.value === value}
149
- {@const content = resolveSnippet(snippets, proxy, ITEM_SNIPPET)}
167
+ {@const content = resolveSnippet(snippetBag, proxy, ITEM_SNIPPET)}
150
168
 
151
169
  <button
152
170
  type="button"
@@ -184,8 +202,8 @@
184
202
  id="tab-panel-{node.key}"
185
203
  aria-labelledby="tab-{node.key}"
186
204
  >
187
- {#if snippets.tabPanel}
188
- {@render snippets.tabPanel(proxy)}
205
+ {#if tabPanel}
206
+ {@render tabPanel(proxy)}
189
207
  {:else}
190
208
  {@render defaultPanel(proxy)}
191
209
  {/if}
@@ -17,9 +17,17 @@
17
17
  * receives data-panel-active. Navigator ignores panels (no data-path on them).
18
18
  */
19
19
  import type { TabsProps } from '../types/tabs.js';
20
+ import type { Snippet } from 'svelte';
21
+ import type { SelectableItemSnippet, ItemSnippet } from '../types/snippets.js';
20
22
  type $$ComponentProps = TabsProps & {
21
23
  labels?: Record<string, string>;
22
- [key: string]: unknown;
24
+ itemContent?: SelectableItemSnippet;
25
+ /** Shown when there are no tabs. */
26
+ empty?: Snippet<[]>;
27
+ /** Panel body for the active tab. */
28
+ tabPanel?: ItemSnippet;
29
+ /** Per-item named snippets, keyed by the item's `snippet` field. */
30
+ snippets?: Record<string, SelectableItemSnippet>;
23
31
  };
24
32
  declare const Tabs: import("svelte").Component<$$ComponentProps, {}, "value">;
25
33
  type Tabs = ReturnType<typeof Tabs>;
@@ -4,6 +4,7 @@
4
4
  import { Wrapper, ProxyTree, messages } from '@rokkit/states'
5
5
  import { Navigator } from '@rokkit/actions'
6
6
  import { resolveSnippet } from '@rokkit/core'
7
+ import type { SelectableItemSnippet } from '../types/snippets.js'
7
8
 
8
9
  let {
9
10
  variant = 'group',
@@ -16,8 +17,17 @@
16
17
  disabled = false,
17
18
  label = messages.toggle.label,
18
19
  class: className = '',
19
- ...snippets
20
- }: ToggleProps & { [key: string]: unknown } = $props()
20
+ itemContent,
21
+ snippets = {}
22
+ }: ToggleProps & {
23
+ // Toggle renders its content as content(proxy, selected).
24
+ itemContent?: SelectableItemSnippet
25
+ /** Per-item named snippets, keyed by the item's `snippet` field. */
26
+ snippets?: Record<string, SelectableItemSnippet>
27
+ } = $props()
28
+
29
+ // See the note in List.svelte — named snippets are a declared prop now.
30
+ const snippetBag = $derived({ ...snippets, itemContent })
21
31
 
22
32
  // ─── Wrapper ──────────────────────────────────────────────────────────────
23
33
 
@@ -71,7 +81,7 @@
71
81
 
72
82
  {#if variant === 'button'}
73
83
  {@const proxy = nextNode?.proxy}
74
- {@const content = proxy ? resolveSnippet(snippets, proxy) : null}
84
+ {@const content = proxy ? resolveSnippet(snippetBag, proxy) : null}
75
85
  <button
76
86
  type="button"
77
87
  data-toggle
@@ -114,7 +124,7 @@
114
124
  {#each wrapper.flatView as node (node.key)}
115
125
  {@const proxy = node.proxy}
116
126
  {@const sel = proxy.value === value}
117
- {@const content = resolveSnippet(snippets, proxy)}
127
+ {@const content = resolveSnippet(snippetBag, proxy)}
118
128
  <button
119
129
  type="button"
120
130
  data-toggle-option
@@ -1,6 +1,9 @@
1
1
  import type { ToggleProps } from '../types/toggle.js';
2
+ import type { SelectableItemSnippet } from '../types/snippets.js';
2
3
  type $$ComponentProps = ToggleProps & {
3
- [key: string]: unknown;
4
+ itemContent?: SelectableItemSnippet;
5
+ /** Per-item named snippets, keyed by the item's `snippet` field. */
6
+ snippets?: Record<string, SelectableItemSnippet>;
4
7
  };
5
8
  declare const Toggle: import("svelte").Component<$$ComponentProps, {}, "value">;
6
9
  type Toggle = ReturnType<typeof Toggle>;
@@ -27,8 +27,8 @@
27
27
  center,
28
28
  end,
29
29
  children,
30
- ...snippets
31
- }: ToolbarProps & { label?: string; [key: string]: ToolbarItemSnippet | unknown } = $props()
30
+ snippets = {}
31
+ }: ToolbarProps & { label?: string } = $props()
32
32
 
33
33
  /**
34
34
  * Create a ProxyItem for the given item
@@ -1,7 +1,6 @@
1
- import type { ToolbarProps, ToolbarItemSnippet } from '../types/toolbar.js';
1
+ import type { ToolbarProps } from '../types/toolbar.js';
2
2
  type $$ComponentProps = ToolbarProps & {
3
3
  label?: string;
4
- [key: string]: ToolbarItemSnippet | unknown;
5
4
  };
6
5
  declare const Toolbar: import("svelte").Component<$$ComponentProps, {}, "">;
7
6
  type Toolbar = ReturnType<typeof Toolbar>;
@@ -17,6 +17,7 @@
17
17
  import { DEFAULT_STATE_ICONS, resolveSnippet, ITEM_SNIPPET } from '@rokkit/core'
18
18
  import ItemContent from './ItemContent.svelte'
19
19
  import Connector from './Connector.svelte'
20
+ import type { TreeProps } from '../types/tree.js'
20
21
 
21
22
  let {
22
23
  items = [],
@@ -28,19 +29,15 @@
28
29
  icons: userIcons = {},
29
30
  onselect,
30
31
  class: className = '',
31
- ...snippets
32
- }: {
33
- items?: unknown[]
34
- fields?: Record<string, string>
35
- value?: unknown
36
- size?: string
37
- lineStyle?: 'none' | 'solid' | 'dashed' | 'dotted'
38
- labels?: Record<string, string>
39
- icons?: { opened?: string; closed?: string }
40
- onselect?: (value: unknown, proxy: ProxyItem) => void
41
- class?: string
42
- [key: string]: unknown
43
- } = $props()
32
+ itemContent,
33
+ groupContent,
34
+ snippets = {}
35
+ }: TreeProps = $props()
36
+
37
+ // What resolveSnippet searches: the per-item named snippets plus the two
38
+ // defaults it falls back to. Named snippets arrive as a declared `snippets`
39
+ // prop now, so a misspelled prop name is a type error rather than a no-op.
40
+ const snippetBag = $derived({ ...snippets, itemContent, groupContent })
44
41
 
45
42
  const labels = $derived({ ...messages.tree, ...userLabels })
46
43
 
@@ -91,7 +88,7 @@
91
88
  {#each wrapper.flatView as node (node.key)}
92
89
  {@const proxy = node.proxy}
93
90
  {@const isActive = proxy.value === value}
94
- {@const content = resolveSnippet(snippets, proxy, ITEM_SNIPPET)}
91
+ {@const content = resolveSnippet(snippetBag, proxy, ITEM_SNIPPET)}
95
92
 
96
93
  <div
97
94
  data-tree-node
@@ -1,31 +1,4 @@
1
- /**
2
- * Tree — Hierarchical data navigation with tree lines and keyboard navigation.
3
- *
4
- * Architecture:
5
- * LazyWrapper — owns focusedKey $state + flatView $derived (with lineTypes)
6
- * Navigator — attaches DOM event handlers, calls wrapper[action](path)
7
- * flatView — single flat {#each}, connectors rendered from node.lineTypes
8
- *
9
- * Default item content: icon + label + badge + shortcut (no avatar/description).
10
- * Parent nodes hide their icon by default (showIcon=false) so only the
11
- * expand/collapse chevron + label are shown, aligning with leaf icon + label.
12
- */
13
- import type { ProxyItem } from '@rokkit/states';
14
- type $$ComponentProps = {
15
- items?: unknown[];
16
- fields?: Record<string, string>;
17
- value?: unknown;
18
- size?: string;
19
- lineStyle?: 'none' | 'solid' | 'dashed' | 'dotted';
20
- labels?: Record<string, string>;
21
- icons?: {
22
- opened?: string;
23
- closed?: string;
24
- };
25
- onselect?: (value: unknown, proxy: ProxyItem) => void;
26
- class?: string;
27
- [key: string]: unknown;
28
- };
29
- declare const Tree: import("svelte").Component<$$ComponentProps, {}, "value">;
1
+ import type { TreeProps } from '../types/tree.js';
2
+ declare const Tree: import("svelte").Component<TreeProps, {}, "value">;
30
3
  type Tree = ReturnType<typeof Tree>;
31
4
  export default Tree;
@@ -15,7 +15,6 @@
15
15
  import type { ProxyItem } from '@rokkit/states'
16
16
  import type { UploadProgressProps, UploadItem } from '../types/upload-progress.js'
17
17
  import { messages } from '@rokkit/states'
18
- import { ITEM_SNIPPET } from '@rokkit/core'
19
18
  import List from './List.svelte'
20
19
  import Grid from './Grid.svelte'
21
20
  import UploadFileStatus from './UploadFileStatus.svelte'
@@ -33,8 +32,8 @@
33
32
  onclear,
34
33
  labels: userLabels = {} as Record<string, string>,
35
34
  class: className = '',
36
- ...snippets
37
- }: UploadProgressProps & { [key: string]: unknown } = $props()
35
+ itemContent
36
+ }: UploadProgressProps = $props()
38
37
 
39
38
  // ─── Labels ──────────────────────────────────────────────────────────────
40
39
 
@@ -71,7 +70,7 @@
71
70
 
72
71
  // ─── Snippet resolution ──────────────────────────────────────────────────
73
72
 
74
- let itemSnippet = $derived(snippets[ITEM_SNIPPET] as typeof defaultItemContent | undefined)
73
+ let itemSnippet = $derived(itemContent as typeof defaultItemContent | undefined)
75
74
 
76
75
  // ─── Action callbacks (unwrap proxy → raw item) ──────────────────────────
77
76
 
@@ -1,7 +1,4 @@
1
1
  import type { UploadProgressProps } from '../types/upload-progress.js';
2
- type $$ComponentProps = UploadProgressProps & {
3
- [key: string]: unknown;
4
- };
5
- declare const UploadProgress: import("svelte").Component<$$ComponentProps, {}, "">;
2
+ declare const UploadProgress: import("svelte").Component<UploadProgressProps, {}, "">;
6
3
  type UploadProgress = ReturnType<typeof UploadProgress>;
7
4
  export default UploadProgress;
@@ -12,7 +12,6 @@
12
12
  * data-dragging — present when files dragged over
13
13
  * data-disabled — when disabled
14
14
  */
15
- import type { Snippet } from 'svelte'
16
15
  import type { UploadTargetProps } from '../types/upload-target.js'
17
16
  import { messages } from '@rokkit/states'
18
17
  import { matchesAccept } from '../utils/upload.js'
@@ -27,10 +26,9 @@
27
26
  onfiles,
28
27
  onerror,
29
28
  class: className = '',
30
- ...snippets
31
- }: UploadTargetProps & { [key: string]: unknown } = $props()
29
+ content
30
+ }: UploadTargetProps = $props()
32
31
 
33
- const content = $derived(snippets.content as Snippet<[dragging: boolean]> | undefined)
34
32
 
35
33
  const resolvedLabels = $derived({
36
34
  ...messages.uploadTarget,
@@ -1,7 +1,17 @@
1
+ /**
2
+ * UploadTarget — Drop zone with file validation.
3
+ *
4
+ * Accepts drag-and-drop or click-to-browse. Validates files against
5
+ * accept (MIME/extension) and maxSize constraints via upload-utils.
6
+ *
7
+ * Data attributes:
8
+ * data-upload-target — root container / drop zone
9
+ * data-upload-icon — upload icon
10
+ * data-upload-button — browse button
11
+ * data-dragging — present when files dragged over
12
+ * data-disabled — when disabled
13
+ */
1
14
  import type { UploadTargetProps } from '../types/upload-target.js';
2
- type $$ComponentProps = UploadTargetProps & {
3
- [key: string]: unknown;
4
- };
5
- declare const UploadTarget: import("svelte").Component<$$ComponentProps, {}, "">;
15
+ declare const UploadTarget: import("svelte").Component<UploadTargetProps, {}, "">;
6
16
  type UploadTarget = ReturnType<typeof UploadTarget>;
7
17
  export default UploadTarget;
@@ -1,6 +1,16 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  export type ChatRole = 'user' | 'assistant' | 'system';
3
3
  export type ChatStatus = 'streaming' | 'error' | 'done';
4
+ /**
5
+ * A single message in a chat transcript.
6
+ *
7
+ * Also exported as `ChatMessageData`, which is the name consumers should import.
8
+ * The package entry exports a *component* called `ChatMessage` as well, and
9
+ * Svelte's generated component types contribute a type of that name — which
10
+ * shadows this interface, making `ChatMessage<T>` unreachable from outside the
11
+ * package. The alias is the reachable spelling; renaming either the component or
12
+ * this interface is a breaking change, so it waits for a major.
13
+ */
4
14
  export interface ChatMessage<T = unknown> {
5
15
  id: string;
6
16
  role: ChatRole;
@@ -12,6 +22,11 @@ export interface ChatMessage<T = unknown> {
12
22
  /** Arbitrary payload (parts/blocks/chart spec/form schema) the consumer's `message` snippet reads. */
13
23
  data?: T;
14
24
  }
25
+ /**
26
+ * Reachable alias for {@link ChatMessage} — see the note on that interface for
27
+ * why the bare name does not survive the package boundary.
28
+ */
29
+ export type ChatMessageData<T = unknown> = ChatMessage<T>;
15
30
  export interface ConversationSummary {
16
31
  id: string;
17
32
  title: string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * CommandPalette Component Types
3
+ *
4
+ * Overlay command launcher. It owns its own command source and filtering, so
5
+ * the public surface is just visibility and the search affordance's label.
6
+ */
7
+ /**
8
+ * Props for the CommandPalette component.
9
+ *
10
+ * `CommandPalette.svelte` annotates its own `$props()` with this interface, so
11
+ * the two cannot drift.
12
+ */
13
+ export interface CommandPaletteProps {
14
+ /** Whether the palette is open (bindable) */
15
+ open?: boolean;
16
+ /** Placeholder text for the search input */
17
+ placeholder?: string;
18
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * CommandPalette Component Types
3
+ *
4
+ * Overlay command launcher. It owns its own command source and filtering, so
5
+ * the public surface is just visibility and the search affordance's label.
6
+ */
7
+ export {};
@@ -85,5 +85,10 @@ export interface FloatingActionProps {
85
85
  class?: string;
86
86
  /** Custom snippet for rendering action items */
87
87
  item?: FloatingActionItemSnippet;
88
+ /**
89
+ * Per-item named snippets, selected via the item's `snippet` field. A declared
90
+ * prop rather than an index signature — see types/snippets.ts for why.
91
+ */
92
+ snippets?: Record<string, FloatingActionItemSnippet>;
88
93
  }
89
94
  export { getSnippet } from './menu.js';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Grid Component Types
3
+ *
4
+ * Data-driven grid of selectable cards. Same field-mapping and snippet
5
+ * contract as List — items are wrapped in a `ProxyItem` and rendered through
6
+ * `itemContent`, with the grid supplying only the track sizing.
7
+ */
8
+ import type { ProxyItem } from '@rokkit/states';
9
+ import type { ItemSnippets } from './snippets.js';
10
+ /**
11
+ * Props for the Grid component.
12
+ *
13
+ * `Grid.svelte` annotates its own `$props()` with this interface, so the two
14
+ * cannot drift.
15
+ */
16
+ export interface GridProps extends ItemSnippets {
17
+ /** Array of items to render as cells */
18
+ items?: unknown[];
19
+ /** Field mapping configuration */
20
+ fields?: Record<string, string>;
21
+ /** Selected value (bindable) */
22
+ value?: unknown;
23
+ /** Size variant */
24
+ size?: string;
25
+ /** Whether the entire grid is disabled */
26
+ disabled?: boolean;
27
+ /** Minimum track width, fed to `repeat(auto-fill, minmax(…))` */
28
+ minSize?: string;
29
+ /** Gap between cells */
30
+ gap?: string;
31
+ /** Accessible name for the grid */
32
+ label?: string;
33
+ /** Called when a cell is selected, with the item's `ProxyItem` */
34
+ onselect?: (value: unknown, proxy: ProxyItem) => void;
35
+ /** Additional CSS classes */
36
+ class?: string;
37
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Grid Component Types
3
+ *
4
+ * Data-driven grid of selectable cards. Same field-mapping and snippet
5
+ * contract as List — items are wrapped in a `ProxyItem` and rendered through
6
+ * `itemContent`, with the grid supplying only the track sizing.
7
+ */
8
+ export {};
@@ -46,3 +46,7 @@ export * from './stack.js';
46
46
  export * from './stepper.js';
47
47
  export * from './tilt.js';
48
48
  export * from './chat.js';
49
+ export * from './snippets.js';
50
+ export * from './grid.js';
51
+ export * from './command-palette.js';
52
+ export * from './swatch.js';