@rokkit/ui 1.3.4 → 1.3.5

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 (175) hide show
  1. package/dist/components/index.js +63 -0
  2. package/dist/index.js +8 -0
  3. package/dist/markdown-plugin.js +1 -0
  4. package/dist/types/alert-list.js +7 -0
  5. package/dist/types/avatar.js +4 -0
  6. package/dist/types/badge.js +4 -0
  7. package/dist/types/breadcrumbs.js +4 -0
  8. package/dist/types/button.js +7 -0
  9. package/dist/types/card.js +4 -0
  10. package/dist/types/carousel.js +4 -0
  11. package/dist/types/chat.js +1 -0
  12. package/dist/types/code.js +12 -0
  13. package/dist/types/connector.js +8 -0
  14. package/dist/types/divider.js +4 -0
  15. package/dist/types/floating-action.js +12 -0
  16. package/dist/types/floating-navigation.js +1 -0
  17. package/dist/types/frame.js +8 -0
  18. package/dist/types/index.js +93 -0
  19. package/dist/types/item-content.js +8 -0
  20. package/dist/types/item-switch.js +10 -0
  21. package/dist/types/item-toggle.js +12 -0
  22. package/dist/types/list.js +36 -0
  23. package/dist/types/lock-mode.js +1 -0
  24. package/dist/types/menu.js +25 -0
  25. package/dist/types/message.js +4 -0
  26. package/dist/types/nav-content.js +4 -0
  27. package/dist/types/palette.js +54 -0
  28. package/dist/types/pill.js +4 -0
  29. package/dist/types/progress-bar.js +4 -0
  30. package/dist/types/range.js +7 -0
  31. package/dist/types/rating.js +4 -0
  32. package/dist/types/responsive-grid.js +4 -0
  33. package/dist/types/reveal.js +4 -0
  34. package/dist/types/search-filter.js +7 -0
  35. package/dist/types/select.js +21 -0
  36. package/dist/types/shine.js +7 -0
  37. package/dist/types/stack.js +4 -0
  38. package/dist/types/status-list.js +7 -0
  39. package/dist/types/stepper.js +4 -0
  40. package/dist/types/switch.js +7 -0
  41. package/dist/types/table.js +23 -0
  42. package/dist/types/tabs.js +7 -0
  43. package/dist/types/tilt.js +4 -0
  44. package/dist/types/timeline.js +14 -0
  45. package/dist/types/toggle.js +7 -0
  46. package/dist/types/toolbar.js +20 -0
  47. package/dist/types/tooltip.js +1 -0
  48. package/dist/types/tree-table.js +10 -0
  49. package/dist/types/tree.js +94 -0
  50. package/dist/types/upload-file-status.js +8 -0
  51. package/dist/types/upload-progress.js +8 -0
  52. package/dist/types/upload-target.js +7 -0
  53. package/dist/utils/palette.js +641 -0
  54. package/dist/utils/relative-time.js +17 -0
  55. package/dist/utils/shiki.js +118 -0
  56. package/package.json +13 -14
  57. package/src/components/index.ts +0 -63
  58. package/src/index.ts +0 -75
  59. package/src/markdown-plugin.ts +0 -12
  60. package/src/types/alert-list.ts +0 -28
  61. package/src/types/avatar.ts +0 -41
  62. package/src/types/badge.ts +0 -37
  63. package/src/types/breadcrumbs.ts +0 -43
  64. package/src/types/button.ts +0 -92
  65. package/src/types/card.ts +0 -38
  66. package/src/types/carousel.ts +0 -49
  67. package/src/types/chat.ts +0 -81
  68. package/src/types/code.ts +0 -147
  69. package/src/types/connector.ts +0 -22
  70. package/src/types/divider.ts +0 -20
  71. package/src/types/floating-action.ts +0 -123
  72. package/src/types/floating-navigation.ts +0 -80
  73. package/src/types/frame.ts +0 -29
  74. package/src/types/index.ts +0 -137
  75. package/src/types/item-content.ts +0 -26
  76. package/src/types/item-switch.ts +0 -34
  77. package/src/types/item-toggle.ts +0 -52
  78. package/src/types/list.ts +0 -200
  79. package/src/types/lock-mode.ts +0 -16
  80. package/src/types/menu.ts +0 -95
  81. package/src/types/message.ts +0 -54
  82. package/src/types/nav-content.ts +0 -31
  83. package/src/types/palette.ts +0 -160
  84. package/src/types/pill.ts +0 -43
  85. package/src/types/progress-bar.ts +0 -19
  86. package/src/types/range.ts +0 -51
  87. package/src/types/rating.ts +0 -43
  88. package/src/types/responsive-grid.ts +0 -25
  89. package/src/types/reveal.ts +0 -49
  90. package/src/types/search-filter.ts +0 -67
  91. package/src/types/select.ts +0 -176
  92. package/src/types/shine.ts +0 -37
  93. package/src/types/stack.ts +0 -40
  94. package/src/types/status-list.ts +0 -42
  95. package/src/types/stepper.ts +0 -74
  96. package/src/types/switch.ts +0 -68
  97. package/src/types/table.ts +0 -219
  98. package/src/types/tabs.ts +0 -103
  99. package/src/types/tilt.ts +0 -28
  100. package/src/types/timeline.ts +0 -53
  101. package/src/types/toggle.ts +0 -81
  102. package/src/types/toolbar.ts +0 -167
  103. package/src/types/tooltip.ts +0 -21
  104. package/src/types/tree-table.ts +0 -103
  105. package/src/types/tree.ts +0 -302
  106. package/src/types/upload-file-status.ts +0 -45
  107. package/src/types/upload-progress.ts +0 -111
  108. package/src/types/upload-target.ts +0 -71
  109. package/src/utils/palette.ts +0 -750
  110. package/src/utils/relative-time.ts +0 -12
  111. package/src/utils/shiki.ts +0 -137
  112. /package/{src → dist}/MarkdownRenderer.svelte +0 -0
  113. /package/{src → dist}/components/AlertList.svelte +0 -0
  114. /package/{src → dist}/components/Avatar.svelte +0 -0
  115. /package/{src → dist}/components/Badge.svelte +0 -0
  116. /package/{src → dist}/components/BreadCrumbs.svelte +0 -0
  117. /package/{src → dist}/components/Button.svelte +0 -0
  118. /package/{src → dist}/components/ButtonGroup.svelte +0 -0
  119. /package/{src → dist}/components/Card.svelte +0 -0
  120. /package/{src → dist}/components/Carousel.svelte +0 -0
  121. /package/{src → dist}/components/ChatComposer.svelte +0 -0
  122. /package/{src → dist}/components/ChatHistory.svelte +0 -0
  123. /package/{src → dist}/components/ChatMessage.svelte +0 -0
  124. /package/{src → dist}/components/ChatShell.svelte +0 -0
  125. /package/{src → dist}/components/ChatTimeline.svelte +0 -0
  126. /package/{src → dist}/components/Code.svelte +0 -0
  127. /package/{src → dist}/components/CodeBlock.svelte +0 -0
  128. /package/{src → dist}/components/CodeGroup.svelte +0 -0
  129. /package/{src → dist}/components/CommandPalette.svelte +0 -0
  130. /package/{src → dist}/components/Connector.svelte +0 -0
  131. /package/{src → dist}/components/Divider.svelte +0 -0
  132. /package/{src → dist}/components/Dropdown.svelte +0 -0
  133. /package/{src → dist}/components/FloatingAction.svelte +0 -0
  134. /package/{src → dist}/components/FloatingNavigation.svelte +0 -0
  135. /package/{src → dist}/components/Frame.svelte +0 -0
  136. /package/{src → dist}/components/Grid.svelte +0 -0
  137. /package/{src → dist}/components/ItemContent.svelte +0 -0
  138. /package/{src → dist}/components/ItemSwitch.svelte +0 -0
  139. /package/{src → dist}/components/ItemToggle.svelte +0 -0
  140. /package/{src → dist}/components/LazyTree.svelte +0 -0
  141. /package/{src → dist}/components/List.svelte +0 -0
  142. /package/{src → dist}/components/LockMode.svelte +0 -0
  143. /package/{src → dist}/components/Menu.svelte +0 -0
  144. /package/{src → dist}/components/Message.svelte +0 -0
  145. /package/{src → dist}/components/MultiSelect.svelte +0 -0
  146. /package/{src → dist}/components/NavContent.svelte +0 -0
  147. /package/{src → dist}/components/PaletteManager.svelte +0 -0
  148. /package/{src → dist}/components/Pill.svelte +0 -0
  149. /package/{src → dist}/components/ProgressBar.svelte +0 -0
  150. /package/{src → dist}/components/Range.svelte +0 -0
  151. /package/{src → dist}/components/Rating.svelte +0 -0
  152. /package/{src → dist}/components/ResponsiveGrid.svelte +0 -0
  153. /package/{src → dist}/components/Reveal.svelte +0 -0
  154. /package/{src → dist}/components/SearchFilter.svelte +0 -0
  155. /package/{src → dist}/components/Select.svelte +0 -0
  156. /package/{src → dist}/components/Shine.svelte +0 -0
  157. /package/{src → dist}/components/Stack.svelte +0 -0
  158. /package/{src → dist}/components/StatusList.svelte +0 -0
  159. /package/{src → dist}/components/Stepper.svelte +0 -0
  160. /package/{src → dist}/components/Swatch.svelte +0 -0
  161. /package/{src → dist}/components/Switch.svelte +0 -0
  162. /package/{src → dist}/components/Table.svelte +0 -0
  163. /package/{src → dist}/components/Tabs.svelte +0 -0
  164. /package/{src → dist}/components/Tilt.svelte +0 -0
  165. /package/{src → dist}/components/Timeline.svelte +0 -0
  166. /package/{src → dist}/components/Toggle.svelte +0 -0
  167. /package/{src → dist}/components/Toolbar.svelte +0 -0
  168. /package/{src → dist}/components/ToolbarGroup.svelte +0 -0
  169. /package/{src → dist}/components/Tooltip.svelte +0 -0
  170. /package/{src → dist}/components/Tree.svelte +0 -0
  171. /package/{src → dist}/components/TreeTable.svelte +0 -0
  172. /package/{src → dist}/components/UploadFileStatus.svelte +0 -0
  173. /package/{src → dist}/components/UploadProgress.svelte +0 -0
  174. /package/{src → dist}/components/UploadTarget.svelte +0 -0
  175. /package/{src → dist}/utils/upload.js +0 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Shiki syntax highlighting utility
3
+ */
4
+ import { createHighlighter } from 'shiki';
5
+ let highlighter = null;
6
+ let isInitializing = false;
7
+ let initPromise = null;
8
+ // Supported languages for the application
9
+ const SUPPORTED_LANGUAGES = [
10
+ 'svelte',
11
+ 'javascript',
12
+ 'typescript',
13
+ 'css',
14
+ 'html',
15
+ 'json',
16
+ 'bash',
17
+ 'shell',
18
+ 'markdown',
19
+ 'yaml',
20
+ 'sql'
21
+ ];
22
+ // Available themes
23
+ const THEMES = ['github-light', 'github-dark'];
24
+ /**
25
+ * Initialize Shiki highlighter (singleton)
26
+ */
27
+ function initializeHighlighter() {
28
+ if (highlighter)
29
+ return Promise.resolve(highlighter);
30
+ if (isInitializing && initPromise) {
31
+ return initPromise;
32
+ }
33
+ isInitializing = true;
34
+ initPromise = createHighlighter({
35
+ themes: THEMES,
36
+ langs: SUPPORTED_LANGUAGES
37
+ })
38
+ .then((hl) => {
39
+ highlighter = hl;
40
+ isInitializing = false;
41
+ return hl;
42
+ })
43
+ .catch((error) => {
44
+ /* v8 ignore next 3 -- createHighlighter failure not reachable in test env (singleton already initialized) */
45
+ isInitializing = false;
46
+ initPromise = null;
47
+ throw error;
48
+ });
49
+ return initPromise;
50
+ }
51
+ /**
52
+ * Highlight code using Shiki
53
+ *
54
+ * @param code - The code to highlight
55
+ * @param options - Highlighting options
56
+ * @returns The highlighted code as HTML
57
+ */
58
+ function resolveTheme(themeOption) {
59
+ if (themeOption === 'light')
60
+ return 'github-light';
61
+ if (themeOption === 'dark' || !themeOption)
62
+ return 'github-dark';
63
+ return themeOption;
64
+ }
65
+ /**
66
+ * Map fence languages (used by @rokkit/blocks plugins) to a Shiki-known
67
+ * grammar. The fence is *semantic* (the renderer routes by language name),
68
+ * but the body is plain JSON — highlight it as such instead of falling
69
+ * back to unstyled text.
70
+ */
71
+ const LANGUAGE_ALIASES = {
72
+ plot: 'json',
73
+ table: 'json',
74
+ form: 'json',
75
+ list: 'json',
76
+ stepper: 'json',
77
+ sparkline: 'json',
78
+ chart: 'json'
79
+ };
80
+ function resolveLang(input) {
81
+ if (!input)
82
+ return 'text';
83
+ return (LANGUAGE_ALIASES[input] ?? input);
84
+ }
85
+ function isValidCode(code) {
86
+ return Boolean(code) && typeof code === 'string';
87
+ }
88
+ export async function highlightCode(code, options = {}) {
89
+ if (!isValidCode(code))
90
+ throw new Error('Invalid code provided for highlighting');
91
+ const hl = await initializeHighlighter();
92
+ const lang = resolveLang(options.lang);
93
+ const theme = resolveTheme(options.theme);
94
+ const loadedLangs = hl.getLoadedLanguages();
95
+ const effectiveLang = loadedLangs.includes(lang) ? lang : 'text';
96
+ return hl
97
+ .codeToHtml(code, { lang: effectiveLang, theme })
98
+ .replace(/(<pre[^>]+) style="[^"]*"/, '$1');
99
+ }
100
+ /**
101
+ * Preload the syntax highlighter for faster initial rendering
102
+ * Errors are silently ignored since preloading is optional
103
+ */
104
+ export async function preloadHighlighter() {
105
+ try {
106
+ await initializeHighlighter();
107
+ /* v8 ignore next 3 -- preload catch body unreachable in tests (singleton already initialized) */
108
+ }
109
+ catch {
110
+ // Preload failures are non-critical - highlighting will still work on demand
111
+ }
112
+ }
113
+ /**
114
+ * Get list of supported languages
115
+ */
116
+ export function getSupportedLanguages() {
117
+ return SUPPORTED_LANGUAGES;
118
+ }
package/package.json CHANGED
@@ -1,39 +1,38 @@
1
1
  {
2
2
  "name": "@rokkit/ui",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Data driven UI components for Rokkit applications",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/jerrythomas/rokkit.git"
8
8
  },
9
9
  "type": "module",
10
- "svelte": "./src/index.ts",
10
+ "svelte": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts",
12
12
  "exports": {
13
13
  ".": {
14
14
  "types": "./dist/index.d.ts",
15
- "svelte": "./src/index.ts",
16
- "default": "./src/index.ts"
15
+ "svelte": "./dist/index.js",
16
+ "default": "./dist/index.js"
17
17
  },
18
18
  "./types": {
19
19
  "types": "./dist/types/index.d.ts",
20
- "default": "./src/types/index.ts"
20
+ "default": "./dist/types/index.js"
21
21
  },
22
22
  "./utils/palette": {
23
23
  "types": "./dist/utils/palette.d.ts",
24
- "default": "./src/utils/palette.ts"
24
+ "default": "./dist/utils/palette.js"
25
25
  },
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "files": [
29
- "src",
30
- "dist/**/*.d.ts",
29
+ "dist",
31
30
  "README.md",
32
31
  "LICENSE"
33
32
  ],
34
33
  "scripts": {
35
- "prepublishOnly": "cp ../../LICENSE . && bun run build",
36
- "postpublish": "rm -f LICENSE",
34
+ "prepublishOnly": "cp ../../LICENSE . && bun run build && node ../../config/pack-repoint.mjs",
35
+ "postpublish": "node ../../config/pack-repoint.mjs --restore && rm -f LICENSE",
37
36
  "check": "svelte-check --tsconfig ./tsconfig.json",
38
37
  "build": "svelte-package -i src -o dist"
39
38
  },
@@ -45,10 +44,10 @@
45
44
  "dropdown"
46
45
  ],
47
46
  "dependencies": {
48
- "@rokkit/core": "1.3.4",
49
- "@rokkit/data": "1.3.4",
50
- "@rokkit/states": "1.3.4",
51
- "@rokkit/actions": "1.3.4",
47
+ "@rokkit/core": "1.3.5",
48
+ "@rokkit/data": "1.3.5",
49
+ "@rokkit/states": "1.3.5",
50
+ "@rokkit/actions": "1.3.5",
52
51
  "marked": "^15.0.0",
53
52
  "dompurify": "^3.0.0"
54
53
  },
@@ -1,63 +0,0 @@
1
- // UI Components
2
- export { default as Button } from './Button.svelte'
3
- export { default as ButtonGroup } from './ButtonGroup.svelte'
4
- export { default as Code } from './Code.svelte'
5
- export { default as CodeBlock } from './CodeBlock.svelte'
6
- export { default as CodeGroup } from './CodeGroup.svelte'
7
- export { default as Frame } from './Frame.svelte'
8
- export { default as Menu } from './Menu.svelte'
9
- export { default as Dropdown } from './Dropdown.svelte'
10
- export { default as Select } from './Select.svelte'
11
- export { default as MultiSelect } from './MultiSelect.svelte'
12
- export { default as Toolbar } from './Toolbar.svelte'
13
- export { default as ToolbarGroup } from './ToolbarGroup.svelte'
14
- export { default as Tabs } from './Tabs.svelte'
15
- export { default as Toggle } from './Toggle.svelte'
16
- export { default as Swatch } from './Swatch.svelte'
17
- export { default as List } from './List.svelte'
18
- export { default as LockMode } from './LockMode.svelte'
19
- export { default as Tree } from './Tree.svelte'
20
- export { default as LazyTree } from './LazyTree.svelte'
21
- export { default as Connector } from './Connector.svelte'
22
- export { default as ItemContent } from './ItemContent.svelte'
23
- export { default as ItemSwitch } from './ItemSwitch.svelte'
24
- export { default as ItemToggle } from './ItemToggle.svelte'
25
- export { default as FloatingAction } from './FloatingAction.svelte'
26
- export { default as PaletteManager } from './PaletteManager.svelte'
27
- export { default as Tilt } from './Tilt.svelte'
28
- export { default as Shine } from './Shine.svelte'
29
- export { default as BreadCrumbs } from './BreadCrumbs.svelte'
30
- export { default as Card } from './Card.svelte'
31
- export { default as ProgressBar } from './ProgressBar.svelte'
32
- export { default as Carousel } from './Carousel.svelte'
33
- export { default as CommandPalette } from './CommandPalette.svelte'
34
- export { default as Pill } from './Pill.svelte'
35
- export { default as Rating } from './Rating.svelte'
36
- export { default as Stepper } from './Stepper.svelte'
37
- export { default as Switch } from './Switch.svelte'
38
- export { default as Table } from './Table.svelte'
39
- export { default as TreeTable } from './TreeTable.svelte'
40
- export { default as SearchFilter } from './SearchFilter.svelte'
41
- export { default as Range } from './Range.svelte'
42
- export { default as Timeline } from './Timeline.svelte'
43
- export { default as Reveal } from './Reveal.svelte'
44
- export { default as Grid } from './Grid.svelte'
45
- export { default as UploadTarget } from './UploadTarget.svelte'
46
- export { default as UploadFileStatus } from './UploadFileStatus.svelte'
47
- export { default as UploadProgress } from './UploadProgress.svelte'
48
- export { default as FloatingNavigation } from './FloatingNavigation.svelte'
49
- export { default as StatusList } from './StatusList.svelte'
50
- export { default as Message } from './Message.svelte'
51
- export { default as AlertList } from './AlertList.svelte'
52
- export { default as Divider } from './Divider.svelte'
53
- export { default as Stack } from './Stack.svelte'
54
- export { default as Badge } from './Badge.svelte'
55
- export { default as Avatar } from './Avatar.svelte'
56
- export { default as Tooltip } from './Tooltip.svelte'
57
- export { default as NavContent } from './NavContent.svelte'
58
- export { default as ResponsiveGrid } from './ResponsiveGrid.svelte'
59
- export { default as ChatMessage } from './ChatMessage.svelte'
60
- export { default as ChatTimeline } from './ChatTimeline.svelte'
61
- export { default as ChatComposer } from './ChatComposer.svelte'
62
- export { default as ChatHistory } from './ChatHistory.svelte'
63
- export { default as ChatShell } from './ChatShell.svelte'
package/src/index.ts DELETED
@@ -1,75 +0,0 @@
1
- // Components
2
- export {
3
- Button,
4
- ButtonGroup,
5
- Code,
6
- CodeBlock,
7
- CodeGroup,
8
- Frame,
9
- Menu,
10
- Dropdown,
11
- Select,
12
- MultiSelect,
13
- Toolbar,
14
- ToolbarGroup,
15
- Tabs,
16
- Toggle,
17
- Swatch,
18
- List,
19
- Tree,
20
- LazyTree,
21
- LockMode,
22
- FloatingAction,
23
- FloatingNavigation,
24
- PaletteManager,
25
- Tilt,
26
- Shine,
27
- BreadCrumbs,
28
- Card,
29
- ProgressBar,
30
- Carousel,
31
- Pill,
32
- Rating,
33
- Connector,
34
- ItemContent,
35
- ItemSwitch,
36
- ItemToggle,
37
- Stepper,
38
- Switch,
39
- Table,
40
- TreeTable,
41
- SearchFilter,
42
- Range,
43
- Timeline,
44
- Reveal,
45
- Grid,
46
- UploadTarget,
47
- UploadFileStatus,
48
- UploadProgress,
49
- StatusList,
50
- Message,
51
- AlertList,
52
- Divider,
53
- Stack,
54
- Badge,
55
- Avatar,
56
- Tooltip,
57
- NavContent,
58
- ResponsiveGrid,
59
- CommandPalette,
60
- ChatMessage,
61
- ChatTimeline,
62
- ChatComposer,
63
- ChatHistory,
64
- ChatShell
65
- } from './components/index.js'
66
-
67
- export { default as MarkdownRenderer } from './MarkdownRenderer.svelte'
68
- export type { MarkdownPlugin } from './markdown-plugin.js'
69
-
70
- // Utilities
71
- export { highlightCode, preloadHighlighter, getSupportedLanguages } from './utils/shiki.js'
72
- export * from './utils/palette.js'
73
-
74
- // Types
75
- export * from './types/index.js'
@@ -1,12 +0,0 @@
1
- import type { Component } from 'svelte'
2
-
3
- /**
4
- * A plugin that renders a fenced code block as a Svelte component.
5
- * The component receives { code: string } as props.
6
- */
7
- export interface MarkdownPlugin {
8
- /** Fenced code block language to match (e.g. 'plot', 'table', 'sparkline') */
9
- language: string
10
- /** Svelte component to render the block. Receives { code: string } */
11
- component: Component<{ code: string }>
12
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * AlertList Component Types
3
- *
4
- * Renders a portalled toast stack at a screen-edge position, reading from
5
- * the shared `alerts` state.
6
- */
7
-
8
- /**
9
- * Screen position for the toast stack.
10
- */
11
- export type AlertListPosition =
12
- | 'top-right'
13
- | 'top-center'
14
- | 'top-left'
15
- | 'bottom-right'
16
- | 'bottom-center'
17
- | 'bottom-left'
18
-
19
- /**
20
- * Props for the AlertList component.
21
- */
22
- export interface AlertListProps {
23
- /** Screen position for the toast stack. */
24
- position?: AlertListPosition
25
-
26
- /** Additional CSS class. */
27
- class?: string
28
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * Avatar Component Types
3
- */
4
-
5
- /** Avatar size scale. */
6
- export type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'
7
-
8
- /** Avatar shape. */
9
- export type AvatarShape = 'circle' | 'square'
10
-
11
- /** Online presence status. */
12
- export type AvatarStatus = 'online' | 'offline' | 'away' | 'busy'
13
-
14
- /**
15
- * Props for the Avatar component.
16
- */
17
- export interface AvatarProps {
18
- /** Image source URL. */
19
- src?: string
20
-
21
- /** Alt text for the image. */
22
- alt?: string
23
-
24
- /** Explicit initials to display as fallback. */
25
- initials?: string
26
-
27
- /** Full name — auto-derives initials if `initials` prop not provided. */
28
- name?: string
29
-
30
- /** Size variant. */
31
- size?: AvatarSize
32
-
33
- /** Online presence status. */
34
- status?: AvatarStatus
35
-
36
- /** Shape variant. */
37
- shape?: AvatarShape
38
-
39
- /** Additional CSS class. */
40
- class?: string
41
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * Badge Component Types
3
- */
4
-
5
- import type { Snippet } from 'svelte'
6
-
7
- /** Semantic color variant for a badge. */
8
- export type BadgeVariant = 'default' | 'primary' | 'success' | 'warning' | 'error'
9
-
10
- /**
11
- * Props for the Badge component.
12
- *
13
- * Badge can be used standalone or wrapped around a child via the `children`
14
- * snippet, in which case it positions itself absolutely over the child.
15
- */
16
- export interface BadgeProps {
17
- /** Numeric count to display. */
18
- count?: number
19
-
20
- /** Maximum count before rendering as `${max}+`. Default `99`. */
21
- max?: number
22
-
23
- /** Visual variant. */
24
- variant?: BadgeVariant
25
-
26
- /** Render as a small dot without content. */
27
- dot?: boolean
28
-
29
- /**
30
- * Content to wrap. When provided, the badge positions absolutely over
31
- * the rendered child.
32
- */
33
- children?: Snippet
34
-
35
- /** Additional CSS class. */
36
- class?: string
37
- }
@@ -1,43 +0,0 @@
1
- /**
2
- * BreadCrumbs Component Types
3
- */
4
-
5
- import type { Snippet } from 'svelte'
6
- import type { ProxyItem } from '@rokkit/states'
7
-
8
- /**
9
- * Icon overrides for the BreadCrumbs component.
10
- */
11
- export interface BreadCrumbsIcons {
12
- /** Icon class used for the separator between crumbs. */
13
- separator?: string
14
- }
15
-
16
- /**
17
- * Props for the BreadCrumbs component.
18
- */
19
- export interface BreadCrumbsProps {
20
- /** Array of breadcrumb items. */
21
- items?: unknown[]
22
-
23
- /** Custom field mappings used by the internal `ProxyItem`. */
24
- fields?: Record<string, string>
25
-
26
- /** Accessible label for the surrounding `<nav>`. */
27
- label?: string
28
-
29
- /** Custom icon overrides. */
30
- icons?: BreadCrumbsIcons
31
-
32
- /** Called when a crumb is clicked. */
33
- onclick?: (value: unknown, item: unknown) => void
34
-
35
- /**
36
- * Custom snippet for rendering each crumb. Receives the crumb's
37
- * `ProxyItem` and a flag indicating whether it is the last (current) crumb.
38
- */
39
- crumb?: Snippet<[ProxyItem, boolean]>
40
-
41
- /** Additional CSS class. */
42
- class?: string
43
- }
@@ -1,92 +0,0 @@
1
- /**
2
- * Button Component Types
3
- *
4
- * Provides types for the Button and ButtonGroup components.
5
- * Supports variants, styles, sizes, loading state, link buttons, and custom content.
6
- */
7
-
8
- import type { Snippet } from 'svelte'
9
- import type { HTMLButtonAttributes } from 'svelte/elements'
10
-
11
- // =============================================================================
12
- // Variant & Style Types
13
- // =============================================================================
14
-
15
- /** Semantic color variant */
16
- export type ButtonVariant = 'default' | 'primary' | 'secondary' | 'accent' | 'danger'
17
-
18
- /** Visual style treatment */
19
- export type ButtonStyle = 'default' | 'outline' | 'ghost' | 'gradient' | 'link'
20
-
21
- // =============================================================================
22
- // Component Props Types
23
- // =============================================================================
24
-
25
- /**
26
- * Props for the Button component.
27
- *
28
- * Extends native `<button>` attributes so consumers can pass `aria-*`,
29
- * `onclick`, `title`, `name`, `form`, etc. The native `style` and `type`
30
- * keys are omitted because this component repurposes `style` (visual
31
- * treatment) and narrows `type` to the valid button types.
32
- */
33
- export interface ButtonProps extends Omit<HTMLButtonAttributes, 'style' | 'type'> {
34
- /** Semantic color variant */
35
- variant?: ButtonVariant
36
-
37
- /** Visual style treatment */
38
- style?: ButtonStyle
39
-
40
- /** Size variant */
41
- size?: 'sm' | 'md' | 'lg'
42
-
43
- /** HTML button type */
44
- type?: 'button' | 'submit' | 'reset'
45
-
46
- /** Button label text */
47
- label?: string
48
-
49
- /** Leading icon class */
50
- icon?: string
51
-
52
- /** Trailing icon class */
53
- iconRight?: string
54
-
55
- /** Navigates as link instead of button */
56
- href?: string
57
-
58
- /** Link target (when href is set) */
59
- target?: string
60
-
61
- /** Native tooltip shown on hover */
62
- title?: string
63
-
64
- /** Disabled state */
65
- disabled?: boolean
66
-
67
- /** Loading state — shows spinner, disables interaction */
68
- loading?: boolean
69
-
70
- /** Additional CSS classes */
71
- class?: string
72
-
73
- /** Click handler */
74
- onclick?: (event: MouseEvent) => void
75
-
76
- /** Custom content snippet */
77
- children?: Snippet
78
- }
79
-
80
- /**
81
- * Props for the ButtonGroup component
82
- */
83
- export interface ButtonGroupProps {
84
- /** Size applied to all buttons in the group */
85
- size?: 'sm' | 'md' | 'lg'
86
-
87
- /** Additional CSS classes */
88
- class?: string
89
-
90
- /** Content snippet (buttons) */
91
- children?: Snippet
92
- }
package/src/types/card.ts DELETED
@@ -1,38 +0,0 @@
1
- /**
2
- * Card Component Types
3
- */
4
-
5
- import type { Snippet } from 'svelte'
6
-
7
- /** Semantic color variant for a card. */
8
- export type CardVariant = 'default' | 'primary' | 'secondary' | 'tertiary'
9
-
10
- /**
11
- * Props for the Card component.
12
- *
13
- * When `href` is provided the card renders as an anchor. When `onclick` is
14
- * provided (and no `href`) it renders as a button. Otherwise it renders as
15
- * a plain container.
16
- */
17
- export interface CardProps {
18
- /** Optional href — renders the card as an `<a>` link. */
19
- href?: string
20
-
21
- /** Click handler — applies only when no `href` is provided. */
22
- onclick?: () => void
23
-
24
- /** Visual variant. */
25
- variant?: CardVariant
26
-
27
- /** Additional CSS class. */
28
- class?: string
29
-
30
- /** Card header snippet. */
31
- header?: Snippet
32
-
33
- /** Card footer snippet. */
34
- footer?: Snippet
35
-
36
- /** Card body content. */
37
- children?: Snippet
38
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * Carousel Component Types
3
- */
4
-
5
- import type { Snippet } from 'svelte'
6
-
7
- /** Transition effect between carousel slides. */
8
- export type CarouselTransition = 'slide' | 'fade' | 'none'
9
-
10
- /**
11
- * Props for the Carousel component.
12
- */
13
- export interface CarouselProps {
14
- /** Number of slides (required when using the `children` snippet). */
15
- count?: number
16
-
17
- /** Current slide index (bindable). */
18
- current?: number
19
-
20
- /** Auto-advance slides. */
21
- autoplay?: boolean
22
-
23
- /** Autoplay interval in milliseconds. Default `5000`. */
24
- interval?: number
25
-
26
- /** Wrap around at the ends. Default `true`. */
27
- loop?: boolean
28
-
29
- /** Show navigation dots. Default `true`. */
30
- showDots?: boolean
31
-
32
- /** Show prev / next arrow buttons. Default `true`. */
33
- showArrows?: boolean
34
-
35
- /** Transition effect. Default `'slide'`. */
36
- transition?: CarouselTransition
37
-
38
- /** Accessible label overrides for built-in controls. */
39
- labels?: Record<string, string>
40
-
41
- /** Additional CSS class. */
42
- class?: string
43
-
44
- /** Slide content — receives `(index, current)`. */
45
- slide?: Snippet<[number, number]>
46
-
47
- /** Children snippet (alternative to `slide`). */
48
- children?: Snippet
49
- }