@rokkit/ui 1.1.17 → 1.1.19

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 (125) hide show
  1. package/dist/MarkdownRenderer.svelte.d.ts +15 -0
  2. package/dist/components/AlertList.svelte.d.ts +4 -0
  3. package/dist/components/Avatar.svelte.d.ts +4 -0
  4. package/dist/components/Badge.svelte.d.ts +4 -0
  5. package/dist/components/BreadCrumbs.svelte.d.ts +4 -0
  6. package/dist/components/Button.svelte.d.ts +4 -0
  7. package/dist/components/ButtonGroup.svelte.d.ts +4 -0
  8. package/dist/components/Card.svelte.d.ts +4 -0
  9. package/dist/components/Carousel.svelte.d.ts +4 -0
  10. package/dist/components/Code.svelte.d.ts +7 -0
  11. package/dist/components/CodeBlock.svelte.d.ts +4 -0
  12. package/dist/components/CodeGroup.svelte.d.ts +4 -0
  13. package/dist/components/CommandPalette.svelte.d.ts +7 -0
  14. package/dist/components/Connector.svelte.d.ts +4 -0
  15. package/dist/components/Divider.svelte.d.ts +4 -0
  16. package/dist/components/Dropdown.svelte.d.ts +22 -0
  17. package/dist/components/FloatingAction.svelte.d.ts +7 -0
  18. package/dist/components/FloatingNavigation.svelte.d.ts +7 -0
  19. package/dist/components/Frame.svelte.d.ts +17 -0
  20. package/dist/components/Grid.svelte.d.ts +45 -0
  21. package/dist/components/ItemContent.svelte.d.ts +4 -0
  22. package/dist/components/LazyTree.svelte.d.ts +30 -0
  23. package/dist/components/List.svelte.d.ts +49 -0
  24. package/dist/components/Menu.svelte.d.ts +68 -0
  25. package/dist/components/Message.svelte.d.ts +4 -0
  26. package/dist/components/MultiSelect.svelte.d.ts +25 -0
  27. package/dist/components/NavContent.svelte.d.ts +4 -0
  28. package/dist/components/PaletteManager.svelte.d.ts +4 -0
  29. package/dist/components/Pill.svelte.d.ts +4 -0
  30. package/dist/components/ProgressBar.svelte.d.ts +4 -0
  31. package/dist/components/Range.svelte.d.ts +7 -0
  32. package/dist/components/Rating.svelte.d.ts +4 -0
  33. package/dist/components/ResponsiveGrid.svelte.d.ts +4 -0
  34. package/dist/components/Reveal.svelte.d.ts +4 -0
  35. package/dist/components/SearchFilter.svelte.d.ts +7 -0
  36. package/dist/components/Select.svelte.d.ts +26 -0
  37. package/dist/components/Shine.svelte.d.ts +4 -0
  38. package/dist/components/Stack.svelte.d.ts +4 -0
  39. package/dist/components/StatusList.svelte.d.ts +4 -0
  40. package/dist/components/Stepper.svelte.d.ts +4 -0
  41. package/dist/components/Swatch.svelte.d.ts +30 -0
  42. package/dist/components/Switch.svelte.d.ts +4 -0
  43. package/dist/components/Table.svelte.d.ts +4 -0
  44. package/dist/components/Tabs.svelte.d.ts +26 -0
  45. package/dist/components/Tilt.svelte.d.ts +4 -0
  46. package/dist/components/Timeline.svelte.d.ts +4 -0
  47. package/dist/components/Toggle.svelte.d.ts +7 -0
  48. package/dist/components/Toolbar.svelte.d.ts +8 -0
  49. package/dist/components/ToolbarGroup.svelte.d.ts +4 -0
  50. package/dist/components/Tooltip.svelte.d.ts +17 -0
  51. package/dist/components/Tree.svelte.d.ts +31 -0
  52. package/dist/components/TreeTable.svelte.d.ts +4 -0
  53. package/dist/components/UploadFileStatus.svelte.d.ts +19 -0
  54. package/dist/components/UploadProgress.svelte.d.ts +7 -0
  55. package/dist/components/UploadTarget.svelte.d.ts +7 -0
  56. package/dist/components/index.d.ts +54 -0
  57. package/dist/index.d.ts +6 -0
  58. package/dist/markdown-plugin.d.ts +13 -0
  59. package/dist/types/alert-list.d.ts +19 -0
  60. package/dist/types/avatar.d.ts +30 -0
  61. package/dist/types/badge.d.ts +29 -0
  62. package/dist/types/breadcrumbs.d.ts +34 -0
  63. package/dist/types/button.d.ts +63 -0
  64. package/dist/types/card.d.ts +29 -0
  65. package/dist/types/carousel.d.ts +35 -0
  66. package/dist/types/code.d.ts +118 -0
  67. package/dist/types/connector.d.ts +18 -0
  68. package/dist/types/divider.d.ts +16 -0
  69. package/dist/types/floating-action.d.ts +89 -0
  70. package/dist/types/floating-navigation.d.ts +66 -0
  71. package/dist/types/frame.d.ts +24 -0
  72. package/dist/types/index.d.ts +44 -0
  73. package/dist/types/item-content.d.ts +22 -0
  74. package/dist/types/list.d.ts +128 -0
  75. package/dist/types/menu.d.ts +53 -0
  76. package/dist/types/message.d.ts +42 -0
  77. package/dist/types/nav-content.d.ts +23 -0
  78. package/dist/types/palette.d.ts +98 -0
  79. package/dist/types/pill.d.ts +33 -0
  80. package/dist/types/progress-bar.d.ts +16 -0
  81. package/dist/types/range.d.ts +35 -0
  82. package/dist/types/rating.d.ts +33 -0
  83. package/dist/types/responsive-grid.d.ts +19 -0
  84. package/dist/types/reveal.d.ts +37 -0
  85. package/dist/types/search-filter.d.ts +43 -0
  86. package/dist/types/select.d.ts +114 -0
  87. package/dist/types/shine.d.ts +28 -0
  88. package/dist/types/stack.d.ts +29 -0
  89. package/dist/types/status-list.d.ts +35 -0
  90. package/dist/types/stepper.d.ts +56 -0
  91. package/dist/types/switch.d.ts +46 -0
  92. package/dist/types/table.d.ts +148 -0
  93. package/dist/types/tabs.d.ts +68 -0
  94. package/dist/types/tilt.d.ts +22 -0
  95. package/dist/types/timeline.d.ts +30 -0
  96. package/dist/types/toggle.d.ts +54 -0
  97. package/dist/types/toolbar.d.ts +109 -0
  98. package/dist/types/tooltip.d.ts +15 -0
  99. package/dist/types/tree-table.d.ts +79 -0
  100. package/dist/types/tree.d.ts +183 -0
  101. package/dist/types/upload-file-status.d.ts +31 -0
  102. package/dist/types/upload-progress.d.ts +71 -0
  103. package/dist/types/upload-target.d.ts +46 -0
  104. package/dist/utils/palette.d.ts +100 -0
  105. package/dist/utils/shiki.d.ts +20 -0
  106. package/dist/utils/upload.d.ts +21 -0
  107. package/package.json +14 -11
  108. package/src/MarkdownRenderer.svelte +6 -4
  109. package/src/components/Button.svelte +7 -1
  110. package/src/components/CommandPalette.svelte +8 -6
  111. package/src/components/LazyTree.svelte +3 -4
  112. package/src/components/List.svelte +1 -1
  113. package/src/components/MultiSelect.svelte +3 -3
  114. package/src/components/Pill.svelte +10 -5
  115. package/src/components/Select.svelte +3 -3
  116. package/src/components/Swatch.svelte +35 -8
  117. package/src/components/Table.svelte +2 -1
  118. package/src/components/Tabs.svelte +1 -2
  119. package/src/components/Toggle.svelte +2 -2
  120. package/src/components/Tree.svelte +1 -2
  121. package/src/components/TreeTable.svelte +2 -1
  122. package/src/components/UploadTarget.svelte +2 -1
  123. package/src/types/button.ts +8 -2
  124. package/src/types/tabs.ts +4 -4
  125. package/src/types/toggle.ts +3 -2
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Toolbar Component Types
3
+ *
4
+ * Provides types for the data-driven Toolbar component.
5
+ * Field mapping and data access is handled by ProxyItem from @rokkit/states.
6
+ */
7
+ /**
8
+ * Field mapping configuration for toolbar data.
9
+ * Maps custom data field names to the component's expected properties.
10
+ */
11
+ export interface ToolbarFields {
12
+ /** Field for display text/tooltip - default: 'text' */
13
+ text?: string;
14
+ /** Field for the value to emit on click - default: 'value' */
15
+ value?: string;
16
+ /** Field for icon class name - default: 'icon' */
17
+ icon?: string;
18
+ /** Field for disabled state - default: 'disabled' */
19
+ disabled?: string;
20
+ /** Field for active/pressed state - default: 'active' */
21
+ active?: string;
22
+ /** Field for item type (button, toggle, separator, spacer, custom) - default: 'type' */
23
+ type?: string;
24
+ /** Field for custom snippet name - default: 'snippet' */
25
+ snippet?: string;
26
+ /** Field for aria-label override - default: 'label' */
27
+ label?: string;
28
+ /** Field for keyboard shortcut display - default: 'shortcut' */
29
+ shortcut?: string;
30
+ }
31
+ /**
32
+ * Default field mapping values
33
+ */
34
+ export declare const defaultToolbarFields: Required<ToolbarFields>;
35
+ /**
36
+ * Generic toolbar item - can be any object with mapped fields
37
+ */
38
+ export type ToolbarItem = Record<string, unknown>;
39
+ /**
40
+ * Built-in toolbar item types
41
+ */
42
+ export type ToolbarItemType = 'button' | 'toggle' | 'separator' | 'spacer' | 'custom';
43
+ /**
44
+ * Handlers passed to custom item snippets
45
+ */
46
+ export interface ToolbarItemHandlers {
47
+ /** Call to trigger item action */
48
+ onclick: () => void;
49
+ /** Forward keyboard events for accessibility */
50
+ onkeydown: (event: KeyboardEvent) => void;
51
+ }
52
+ /**
53
+ * Snippet type for rendering toolbar items
54
+ */
55
+ export type ToolbarItemSnippet = import('svelte').Snippet<[
56
+ ToolbarItem,
57
+ ToolbarFields,
58
+ ToolbarItemHandlers
59
+ ]>;
60
+ /**
61
+ * Props for the Toolbar component
62
+ */
63
+ export interface ToolbarProps {
64
+ /** Array of toolbar items */
65
+ items?: ToolbarItem[];
66
+ /** Field mapping configuration */
67
+ fields?: ToolbarFields;
68
+ /** Position of toolbar - affects border and sticky positioning */
69
+ position?: 'top' | 'bottom' | 'left' | 'right';
70
+ /** Size variant */
71
+ size?: 'sm' | 'md' | 'lg';
72
+ /** Width behaviour: full stretches to container, fit sizes to content */
73
+ width?: 'full' | 'fit';
74
+ /** Whether toolbar should stick to its position */
75
+ sticky?: boolean;
76
+ /** Compact mode with reduced padding */
77
+ compact?: boolean;
78
+ /** Show dividers between sections */
79
+ showDividers?: boolean;
80
+ /** Whether the entire toolbar is disabled */
81
+ disabled?: boolean;
82
+ /** Called when an item is clicked */
83
+ onclick?: (value: unknown, item: ToolbarItem) => void;
84
+ /** Additional CSS classes */
85
+ class?: string;
86
+ /** Custom snippet for rendering toolbar items */
87
+ item?: ToolbarItemSnippet;
88
+ /** Slot for start section content */
89
+ start?: import('svelte').Snippet;
90
+ /** Slot for center section content */
91
+ center?: import('svelte').Snippet;
92
+ /** Slot for end section content */
93
+ end?: import('svelte').Snippet;
94
+ /** Default slot for children */
95
+ children?: import('svelte').Snippet;
96
+ }
97
+ /**
98
+ * Props for the ToolbarGroup component
99
+ */
100
+ export interface ToolbarGroupProps {
101
+ /** Accessibility label for the group */
102
+ label?: string;
103
+ /** Gap between items in the group */
104
+ gap?: 'none' | 'sm' | 'md' | 'lg';
105
+ /** Additional CSS classes */
106
+ class?: string;
107
+ /** Group content */
108
+ children?: import('svelte').Snippet;
109
+ }
@@ -0,0 +1,15 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface TooltipProps {
3
+ /** Tooltip text (alternative: use tooltipContent snippet for rich content) */
4
+ content?: string;
5
+ /** Preferred position — auto-flips when the preferred side overflows the viewport */
6
+ position?: 'top' | 'bottom' | 'left' | 'right';
7
+ /** Show delay in ms (default: 300) */
8
+ delay?: number;
9
+ /** Additional CSS classes on the root wrapper */
10
+ class?: string;
11
+ /** Trigger element(s) */
12
+ children?: Snippet;
13
+ /** Rich tooltip content — overrides the content string */
14
+ tooltipContent?: Snippet;
15
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * TreeTable Component Types
3
+ *
4
+ * Hierarchical analog of Table — accepts nested rows (each row may
5
+ * carry a `children: []` array) and renders the hierarchy in one
6
+ * designated column with chevron + indent + tree connectors.
7
+ *
8
+ * Reuses the column / sort / cell types from Table.
9
+ */
10
+ import type { Snippet } from 'svelte';
11
+ import type { TableColumn, TableSortIcons, SortState, TableFields } from './table.js';
12
+ /**
13
+ * Column definition for TreeTable — adds an optional `hierarchy` flag
14
+ * to mark which column renders the chevron + indent connectors. When
15
+ * no column is flagged, the first column is treated as the hierarchy
16
+ * column by default.
17
+ */
18
+ export interface TreeTableColumn extends TableColumn {
19
+ /** Render chevron + tree connectors in this column. Defaults to the first column. */
20
+ hierarchy?: boolean;
21
+ }
22
+ export type TreeTableHeaderSnippet = Snippet<[TreeTableColumn[], SortState[]]>;
23
+ export type TreeTableRowSnippet = Snippet<[
24
+ Record<string, unknown>,
25
+ TreeTableColumn[],
26
+ number,
27
+ boolean
28
+ ]>;
29
+ export type TreeTableCellSnippet = Snippet<[
30
+ unknown,
31
+ TreeTableColumn,
32
+ Record<string, unknown>
33
+ ]>;
34
+ export type TreeTableEmptySnippet = Snippet<[]>;
35
+ export interface TreeTableProps {
36
+ /** Nested row data — each row may carry a `children: []` array. */
37
+ data?: Record<string, unknown>[];
38
+ /** Column definitions (auto-derived from the first row if not provided). */
39
+ columns?: TreeTableColumn[];
40
+ /** Currently selected row value (single-select) */
41
+ value?: unknown;
42
+ /** Currently selected row values (multi-select, bindable) */
43
+ values?: unknown[];
44
+ /** Selection mode: 'single' (default), 'multi', or false (no selection) */
45
+ selectable?: 'single' | 'multi' | false;
46
+ /** Table caption for accessibility */
47
+ caption?: string;
48
+ /** Size variant */
49
+ size?: 'sm' | 'md' | 'lg';
50
+ /** Enable alternating row colors */
51
+ striped?: boolean;
52
+ /** Whether the entire table is disabled */
53
+ disabled?: boolean;
54
+ /** Tree connector line style — same options as the Tree component */
55
+ lineStyle?: 'none' | 'solid' | 'dashed' | 'dotted';
56
+ /** Row-level field mapping (incl. the `children` field name). */
57
+ fields?: TableFields & {
58
+ children?: string;
59
+ };
60
+ /** Called when a row is selected */
61
+ onselect?: (value: unknown, row: Record<string, unknown>) => void;
62
+ /** Called when sort state changes */
63
+ onsort?: (sortState: SortState[]) => void;
64
+ /** Additional CSS classes */
65
+ class?: string;
66
+ /** Sort indicator icons */
67
+ icons?: TableSortIcons & {
68
+ opened?: string;
69
+ closed?: string;
70
+ };
71
+ /** Custom header snippet */
72
+ header?: TreeTableHeaderSnippet;
73
+ /** Custom row snippet */
74
+ row?: TreeTableRowSnippet;
75
+ /** Custom cell snippet */
76
+ cell?: TreeTableCellSnippet;
77
+ /** Empty state snippet */
78
+ empty?: TreeTableEmptySnippet;
79
+ }
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Tree Component Types
3
+ *
4
+ * Provides types for the data-driven Tree component.
5
+ * Supports hierarchical data with expand/collapse, tree lines, and custom icons.
6
+ * Field mapping and data access is handled by ProxyItem from @rokkit/states.
7
+ */
8
+ import type { Snippet } from 'svelte';
9
+ /**
10
+ * Field mapping configuration for tree data — what the consumer passes
11
+ * to the Tree component. Both `expanded` and `level` are optional here
12
+ * because Tree falls back to `defaultTreeFields` for any field the
13
+ * consumer omits.
14
+ *
15
+ * Inside Tree the fields are merged with `defaultTreeFields` to produce
16
+ * a `ResolvedTreeFields` value where every key is guaranteed present.
17
+ * Downstream code that needs string field names without null-guards
18
+ * should use `ResolvedTreeFields` rather than `TreeFields`.
19
+ */
20
+ export interface TreeFields {
21
+ [field: string]: string | undefined;
22
+ /**
23
+ * Name of the field on each tree item that holds its expanded state.
24
+ * The value at that field is expected to be a `boolean`.
25
+ *
26
+ * Optional — falls back to the default field name `'expanded'`. After
27
+ * `resolveTreeFields` is applied the resolved key is guaranteed present
28
+ * (see {@link ResolvedTreeFields}).
29
+ */
30
+ expanded?: string;
31
+ /**
32
+ * Name of the field on each tree item that holds its depth in the tree.
33
+ * The value at that field is expected to be a `number`.
34
+ *
35
+ * Optional — falls back to the default field name `'level'`. After
36
+ * `resolveTreeFields` is applied the resolved key is guaranteed present
37
+ * (see {@link ResolvedTreeFields}).
38
+ */
39
+ level?: string;
40
+ }
41
+ /**
42
+ * Tree fields after defaults have been applied — every field name is a
43
+ * non-null string. Use this type for any function or store that needs
44
+ * to read a field name without re-applying defaults.
45
+ *
46
+ * Construct from a `TreeFields` via `resolveTreeFields(fields)` (or by
47
+ * spreading `defaultTreeFields` first, e.g.
48
+ * `{ ...defaultTreeFields, ...userFields }`).
49
+ */
50
+ export type ResolvedTreeFields = Required<TreeFields>;
51
+ /**
52
+ * Default field mapping values for tree
53
+ */
54
+ export declare const defaultTreeFields: Required<Omit<TreeFields, 'fields'>>;
55
+ /**
56
+ * Merge consumer-provided field overrides with the default field
57
+ * mapping so every key resolves to a string. Tree calls this once on
58
+ * its `fields` prop before passing the result to ProxyTree / line
59
+ * builders.
60
+ */
61
+ export declare function resolveTreeFields(fields?: TreeFields): ResolvedTreeFields;
62
+ /**
63
+ * Generic tree item - can be any object with mapped fields
64
+ */
65
+ export type TreeItem = Record<string, unknown>;
66
+ /**
67
+ * Types of tree line connectors
68
+ */
69
+ export type TreeLineType = 'child' | 'last' | 'sibling' | 'empty' | 'icon';
70
+ /**
71
+ * Connector types (without 'icon' which is handled separately)
72
+ */
73
+ export type ConnectorType = 'child' | 'last' | 'sibling' | 'empty';
74
+ /**
75
+ * Icons configuration for tree expand/collapse states.
76
+ * Keys match the naming convention in @rokkit/core DEFAULT_STATE_ICONS.
77
+ */
78
+ export interface TreeStateIcons {
79
+ /** Icon class for expanded/opened state */
80
+ opened?: string;
81
+ /** Icon class for collapsed/closed state */
82
+ closed?: string;
83
+ }
84
+ /**
85
+ * Default state icons — uses semantic names from @rokkit/core
86
+ * that get resolved to actual icon classes via UnoCSS shortcuts.
87
+ */
88
+ export declare const defaultTreeStateIcons: TreeStateIcons;
89
+ /**
90
+ * Handlers passed to custom item snippets
91
+ */
92
+ export interface TreeItemHandlers {
93
+ /** Call to trigger item selection */
94
+ onclick: () => void;
95
+ /** Call to toggle expand/collapse */
96
+ ontoggle: () => void;
97
+ /** Forward keyboard events for accessibility */
98
+ onkeydown: (event: KeyboardEvent) => void;
99
+ }
100
+ /**
101
+ * Snippet type for rendering tree nodes.
102
+ * Parameters: item, fields, handlers, isActive, isExpanded, level
103
+ */
104
+ export type TreeItemSnippet = Snippet<[
105
+ TreeItem,
106
+ TreeFields,
107
+ TreeItemHandlers,
108
+ boolean,
109
+ boolean,
110
+ number
111
+ ]>;
112
+ /**
113
+ * Snippet type for rendering the expand/collapse icon
114
+ * Parameters: isExpanded, hasChildren, icons
115
+ */
116
+ export type TreeToggleSnippet = Snippet<[boolean, boolean, TreeStateIcons]>;
117
+ /**
118
+ * Snippet type for rendering tree line connectors
119
+ * Parameters: lineType
120
+ */
121
+ export type TreeConnectorSnippet = Snippet<[TreeLineType]>;
122
+ /**
123
+ * Props for the Tree component
124
+ */
125
+ export interface TreeProps {
126
+ /** Array of tree items (hierarchical) */
127
+ items?: TreeItem[];
128
+ /** Field mapping configuration */
129
+ fields?: TreeFields;
130
+ /** Currently selected value */
131
+ value?: unknown;
132
+ /** Size variant */
133
+ size?: 'sm' | 'md' | 'lg';
134
+ /** Tree line connector style — 'none' hides lines, 'solid'|'dashed'|'dotted' set the line style */
135
+ lineStyle?: 'none' | 'solid' | 'dashed' | 'dotted';
136
+ /** Enable multiple item selection (Ctrl+click toggle, Shift+click range) */
137
+ multiselect?: boolean;
138
+ /** Which nodes are expanded (bindable) - keyed by node value */
139
+ expanded?: Record<string, boolean>;
140
+ /** Selected items array (bindable) - populated in multiselect mode */
141
+ selected?: unknown[];
142
+ /** Expand all nodes by default */
143
+ expandAll?: boolean;
144
+ /** Active item value - Tree looks up item by this value to highlight it */
145
+ active?: unknown;
146
+ /** Icons for expand/collapse states */
147
+ icons?: TreeStateIcons;
148
+ /** Called when an item is selected */
149
+ onselect?: (value: unknown, item: TreeItem) => void;
150
+ /** Called when selected items change in multiselect mode */
151
+ onselectedchange?: (selected: unknown[]) => void;
152
+ /** Called when expanded state changes */
153
+ onexpandedchange?: (expanded: Record<string, boolean>) => void;
154
+ /** Called when a node is toggled */
155
+ ontoggle?: (value: unknown, item: TreeItem, isExpanded: boolean) => void;
156
+ /** Called when expanding a node with unloaded children (children: true). Returns the children array. */
157
+ onloadchildren?: (value: unknown, item: TreeItem) => Promise<TreeItem[]>;
158
+ /** Additional CSS classes */
159
+ class?: string;
160
+ /** Custom snippet for rendering tree items */
161
+ item?: TreeItemSnippet;
162
+ /** Custom snippet for rendering expand/collapse toggle */
163
+ toggle?: TreeToggleSnippet;
164
+ /** Custom snippet for rendering tree line connectors */
165
+ connector?: TreeConnectorSnippet;
166
+ }
167
+ /**
168
+ * Constructs an array of line types for tree visualization.
169
+ * This determines what connectors to show at each depth level.
170
+ *
171
+ * Algorithm from @rokkit/core getLineTypes:
172
+ * - For all but the last parent type, convert to continuation type
173
+ * - For the last parent type, use the current node's position
174
+ * - Append 'icon' for nodes with children, 'empty' for leaf nodes
175
+ *
176
+ * @param hasChildren - Whether the node has children
177
+ * @param parentTypes - Line types from parent nodes
178
+ * @param position - Current position type ('child' or 'last')
179
+ * @returns Array of line types for rendering connectors
180
+ */
181
+ export declare function getLineTypes(hasChildren?: boolean, parentTypes?: TreeLineType[], position?: 'child' | 'last'): TreeLineType[];
182
+ export declare const getTreeLineTypes: typeof getLineTypes;
183
+ export { getSnippet } from './menu.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * UploadFileStatus Component Types
3
+ *
4
+ * Renders a single file's upload status with progress bar, action buttons
5
+ * (cancel/retry/remove), and file metadata (icon, name, size, status label).
6
+ * Action button visibility driven by cancelWhen/retryWhen/removeWhen arrays.
7
+ */
8
+ import type { ProxyItem } from '@rokkit/states';
9
+ /**
10
+ * Props for the UploadFileStatus component
11
+ */
12
+ export interface UploadFileStatusProps {
13
+ /** ProxyItem wrapping the file data */
14
+ proxy: ProxyItem;
15
+ /** Status values that show the cancel button */
16
+ cancelWhen?: string[];
17
+ /** Status values that show the retry button */
18
+ retryWhen?: string[];
19
+ /** Status values that show the remove button */
20
+ removeWhen?: string[];
21
+ /** Called when cancel is clicked */
22
+ oncancel?: (proxy: ProxyItem) => void;
23
+ /** Called when retry is clicked */
24
+ onretry?: (proxy: ProxyItem) => void;
25
+ /** Called when remove is clicked */
26
+ onremove?: (proxy: ProxyItem) => void;
27
+ /** Label overrides merged with messages.uploadProgress */
28
+ labels?: Record<string, string>;
29
+ /** Icon class overrides for action buttons (cancel, retry, remove) */
30
+ icons?: Record<string, string>;
31
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * UploadProgress Component Types
3
+ *
4
+ * File upload status orchestrator. Thin composition layer that renders
5
+ * a header + List or Grid layout. Default itemContent snippet renders
6
+ * UploadFileStatus for each file. Consumer can override with custom snippet.
7
+ */
8
+ import type { Snippet } from 'svelte';
9
+ import type { ProxyItem } from '@rokkit/states';
10
+ /**
11
+ * Generic upload file item — any object with mapped fields
12
+ */
13
+ export type UploadItem = Record<string, unknown>;
14
+ /**
15
+ * Field mapping for upload file data.
16
+ * Maps semantic field names to keys in the data objects.
17
+ */
18
+ export interface UploadFields {
19
+ /** Field for display text - default: 'text' */
20
+ label?: string;
21
+ /** Field for unique value - default: 'value' */
22
+ value?: string;
23
+ /** Field for icon class - default: 'icon' */
24
+ icon?: string;
25
+ /** Field for upload status key - default: 'status' */
26
+ status?: string;
27
+ /** Field for progress percentage (0-100) - default: 'progress' */
28
+ progress?: string;
29
+ /** Field for file size in bytes - default: 'size' */
30
+ size?: string;
31
+ /** Field for MIME type - default: 'type' */
32
+ type?: string;
33
+ /** Field for error message - default: 'error' */
34
+ error?: string;
35
+ }
36
+ /**
37
+ * Snippet for custom per-file rendering inside List/Grid.
38
+ * Receives the ProxyItem wrapping the file data.
39
+ */
40
+ export type UploadItemSnippet = Snippet<[proxy: ProxyItem]>;
41
+ /**
42
+ * Props for the UploadProgress component
43
+ */
44
+ export interface UploadProgressProps {
45
+ /** Array of file data objects */
46
+ files?: UploadItem[];
47
+ /** Field mapping configuration */
48
+ fields?: UploadFields;
49
+ /** Layout mode */
50
+ view?: 'list' | 'grid';
51
+ /** Status values that show the cancel button */
52
+ cancelWhen?: string[];
53
+ /** Status values that show the retry button */
54
+ retryWhen?: string[];
55
+ /** Status values that show the remove button */
56
+ removeWhen?: string[];
57
+ /** Called when cancel is clicked (receives raw file object) */
58
+ oncancel?: (file: UploadItem) => void;
59
+ /** Called when retry is clicked (receives raw file object) */
60
+ onretry?: (file: UploadItem) => void;
61
+ /** Called when remove is clicked (receives raw file object) */
62
+ onremove?: (file: UploadItem) => void;
63
+ /** Called when clear all is clicked */
64
+ onclear?: () => void;
65
+ /** Label overrides merged with messages.uploadProgress */
66
+ labels?: Record<string, string>;
67
+ /** Additional CSS classes */
68
+ class?: string;
69
+ /** Custom snippet for per-file rendering (overrides default UploadFileStatus) */
70
+ itemContent?: UploadItemSnippet;
71
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * UploadTarget Component Types
3
+ *
4
+ * Drop zone with file validation. Accepts drag-and-drop or click-to-browse.
5
+ * Validates files against accept (MIME/extension) and maxSize constraints.
6
+ */
7
+ import type { Snippet } from 'svelte';
8
+ /**
9
+ * File validation error returned via onerror callback
10
+ */
11
+ export interface UploadError {
12
+ /** The file that failed validation */
13
+ file: File;
14
+ /** Why the file was rejected */
15
+ reason: 'type' | 'size';
16
+ }
17
+ /**
18
+ * Snippet for custom drop zone content.
19
+ * Receives the current dragging state.
20
+ */
21
+ export type UploadTargetContentSnippet = Snippet<[dragging: boolean]>;
22
+ /**
23
+ * Props for the UploadTarget component
24
+ */
25
+ export interface UploadTargetProps {
26
+ /** Accepted file types (MIME types or extensions, comma-separated) */
27
+ accept?: string;
28
+ /** Maximum file size in bytes */
29
+ maxSize?: number;
30
+ /** Allow multiple file selection */
31
+ multiple?: boolean;
32
+ /** Disable the drop zone */
33
+ disabled?: boolean;
34
+ /** Label overrides merged with messages.uploadTarget */
35
+ labels?: Record<string, string>;
36
+ /** Called with validated files after drop or browse */
37
+ onfiles?: (files: File[]) => void;
38
+ /** Called for each file that fails validation */
39
+ onerror?: (err: UploadError) => void;
40
+ /** Size variant — full (default) fills available area; small shows only border + icon */
41
+ size?: 'full' | 'small';
42
+ /** Additional CSS classes */
43
+ class?: string;
44
+ /** Custom content snippet (replaces default drop zone UI) */
45
+ content?: UploadTargetContentSnippet;
46
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Palette Utilities
3
+ *
4
+ * Functions for color manipulation, shade generation, and runtime palette application.
5
+ */
6
+ export interface RGB {
7
+ r: number;
8
+ g: number;
9
+ b: number;
10
+ }
11
+ export interface HSL {
12
+ h: number;
13
+ s: number;
14
+ l: number;
15
+ }
16
+ export interface OKLCH {
17
+ L: number;
18
+ C: number;
19
+ H: number;
20
+ }
21
+ export type ColorSpace = 'rgb' | 'hsl' | 'oklch';
22
+ export type ShadeKey = '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | '950';
23
+ export type Shades = Record<ShadeKey, string>;
24
+ export type ColorRole = 'primary' | 'secondary' | 'accent' | 'surface' | 'success' | 'warning' | 'danger' | 'info';
25
+ /**
26
+ * Mapping of color roles to Tailwind color names or hex values
27
+ */
28
+ export type ColorMapping = Partial<Record<ColorRole, string>>;
29
+ /**
30
+ * Convert hex color to RGB
31
+ */
32
+ export declare function hexToRgb(hex: string): RGB;
33
+ /**
34
+ * Convert RGB to hex color
35
+ */
36
+ export declare function rgbToHex(rgb: RGB): string;
37
+ export declare function rgbToHsl(rgb: RGB): HSL;
38
+ /**
39
+ * Convert HSL to RGB
40
+ */
41
+ export declare function hslToRgb(hsl: HSL): RGB;
42
+ /**
43
+ * Convert hex to HSL
44
+ */
45
+ export declare function hexToHsl(hex: string): HSL;
46
+ /**
47
+ * Convert HSL to hex
48
+ */
49
+ export declare function hslToHex(hsl: HSL): string;
50
+ /**
51
+ * Convert RGB to OKLCH (via XYZ D65 for precision)
52
+ */
53
+ export declare function rgbToOklch(rgb: RGB): OKLCH;
54
+ /**
55
+ * Convert OKLCH to RGB (via XYZ D65 for precision)
56
+ */
57
+ export declare function oklchToRgb(oklch: OKLCH): RGB;
58
+ /**
59
+ * Convert hex to OKLCH
60
+ */
61
+ export declare function hexToOklch(hex: string): OKLCH;
62
+ /**
63
+ * Convert OKLCH to hex
64
+ */
65
+ export declare function oklchToHex(oklch: OKLCH): string;
66
+ /**
67
+ * Generate Tailwind-like shades from a base hex color
68
+ * The input color is used as the 500 shade
69
+ */
70
+ export declare function generateShades(hex: string): Shades;
71
+ /**
72
+ * Check if a string is a valid hex color
73
+ */
74
+ export declare function isHexColor(value: string): boolean;
75
+ export declare const tailwindColors: Record<string, Shades>;
76
+ /**
77
+ * Get shades for a color (either Tailwind preset or custom hex)
78
+ */
79
+ export declare function getShades(color: string): Shades;
80
+ /**
81
+ * Apply a color palette to the document root
82
+ * Sets CSS variables for each color role and shade
83
+ */
84
+ export declare function applyPalette(mapping: Partial<Record<ColorRole, string>>, element?: HTMLElement, colorSpace?: ColorSpace): void;
85
+ /**
86
+ * Remove custom palette CSS variables (reset to theme defaults)
87
+ */
88
+ export declare function resetPalette(roles?: ColorRole[], element?: HTMLElement): void;
89
+ /**
90
+ * Save palette to localStorage. SSR-safe.
91
+ */
92
+ export declare function savePalette(key: string, mapping: Partial<Record<ColorRole, string>>): void;
93
+ /**
94
+ * Load palette from localStorage. SSR-safe.
95
+ */
96
+ export declare function loadPalette(key: string): Partial<Record<ColorRole, string>> | null;
97
+ /**
98
+ * Get list of available Tailwind color names
99
+ */
100
+ export declare function getTailwindColorNames(): string[];
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Shiki syntax highlighting utility
3
+ */
4
+ import { type BundledLanguage, type BundledTheme } from 'shiki';
5
+ export interface HighlightOptions {
6
+ /** Language for syntax highlighting */
7
+ lang?: BundledLanguage | string;
8
+ /** Theme to use (defaults based on user preference) */
9
+ theme?: BundledTheme | 'light' | 'dark';
10
+ }
11
+ export declare function highlightCode(code: string, options?: HighlightOptions): Promise<string>;
12
+ /**
13
+ * Preload the syntax highlighter for faster initial rendering
14
+ * Errors are silently ignored since preloading is optional
15
+ */
16
+ export declare function preloadHighlighter(): Promise<void>;
17
+ /**
18
+ * Get list of supported languages
19
+ */
20
+ export declare function getSupportedLanguages(): readonly string[];
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Check if a file matches an accept string (comma-separated MIME types and extensions).
3
+ * @param {{ type: string, name: string }} file
4
+ * @param {string | null | undefined} accept - e.g. 'image/*,.pdf,application/json'
5
+ * @returns {boolean}
6
+ */
7
+ export function matchesAccept(file: {
8
+ type: string;
9
+ name: string;
10
+ }, accept: string | null | undefined): boolean;
11
+ export function validateFile(file: any, { accept, maxSize }?: {}): true | {
12
+ reason: string;
13
+ };
14
+ export function inferIcon(mimeType: any): string;
15
+ /**
16
+ * Format a byte count as a human-readable size string.
17
+ * @param {number} bytes
18
+ * @returns {string}
19
+ */
20
+ export function formatSize(bytes: number): string;
21
+ export function groupByPath(items: any, pathField: any, childrenField: any): any[];