@rokkit/ui 1.3.4 → 1.3.6

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/{src → dist}/components/List.svelte +12 -6
  2. package/dist/components/index.js +63 -0
  3. package/dist/index.js +8 -0
  4. package/dist/markdown-plugin.js +1 -0
  5. package/dist/types/alert-list.js +7 -0
  6. package/dist/types/avatar.js +4 -0
  7. package/dist/types/badge.js +4 -0
  8. package/dist/types/breadcrumbs.js +4 -0
  9. package/dist/types/button.js +7 -0
  10. package/dist/types/card.js +4 -0
  11. package/dist/types/carousel.js +4 -0
  12. package/dist/types/chat.js +1 -0
  13. package/dist/types/code.js +12 -0
  14. package/dist/types/connector.js +8 -0
  15. package/dist/types/divider.js +4 -0
  16. package/dist/types/floating-action.js +12 -0
  17. package/dist/types/floating-navigation.js +1 -0
  18. package/dist/types/frame.js +8 -0
  19. package/dist/types/index.js +93 -0
  20. package/dist/types/item-content.js +8 -0
  21. package/dist/types/item-switch.js +10 -0
  22. package/dist/types/item-toggle.js +12 -0
  23. package/dist/types/list.js +36 -0
  24. package/dist/types/lock-mode.js +1 -0
  25. package/dist/types/menu.js +25 -0
  26. package/dist/types/message.js +4 -0
  27. package/dist/types/nav-content.js +4 -0
  28. package/dist/types/palette.js +54 -0
  29. package/dist/types/pill.js +4 -0
  30. package/dist/types/progress-bar.js +4 -0
  31. package/dist/types/range.js +7 -0
  32. package/dist/types/rating.js +4 -0
  33. package/dist/types/responsive-grid.js +4 -0
  34. package/dist/types/reveal.js +4 -0
  35. package/dist/types/search-filter.js +7 -0
  36. package/dist/types/select.js +21 -0
  37. package/dist/types/shine.js +7 -0
  38. package/dist/types/stack.js +4 -0
  39. package/dist/types/status-list.js +7 -0
  40. package/dist/types/stepper.js +4 -0
  41. package/dist/types/switch.js +7 -0
  42. package/dist/types/table.js +23 -0
  43. package/dist/types/tabs.js +7 -0
  44. package/dist/types/tilt.js +4 -0
  45. package/dist/types/timeline.js +14 -0
  46. package/dist/types/toggle.js +7 -0
  47. package/dist/types/toolbar.js +20 -0
  48. package/dist/types/tooltip.js +1 -0
  49. package/dist/types/tree-table.js +10 -0
  50. package/dist/types/tree.js +94 -0
  51. package/dist/types/upload-file-status.js +8 -0
  52. package/dist/types/upload-progress.js +8 -0
  53. package/dist/types/upload-target.js +7 -0
  54. package/dist/utils/palette.js +641 -0
  55. package/dist/utils/relative-time.js +17 -0
  56. package/dist/utils/shiki.js +118 -0
  57. package/package.json +13 -14
  58. package/src/components/index.ts +0 -63
  59. package/src/index.ts +0 -75
  60. package/src/markdown-plugin.ts +0 -12
  61. package/src/types/alert-list.ts +0 -28
  62. package/src/types/avatar.ts +0 -41
  63. package/src/types/badge.ts +0 -37
  64. package/src/types/breadcrumbs.ts +0 -43
  65. package/src/types/button.ts +0 -92
  66. package/src/types/card.ts +0 -38
  67. package/src/types/carousel.ts +0 -49
  68. package/src/types/chat.ts +0 -81
  69. package/src/types/code.ts +0 -147
  70. package/src/types/connector.ts +0 -22
  71. package/src/types/divider.ts +0 -20
  72. package/src/types/floating-action.ts +0 -123
  73. package/src/types/floating-navigation.ts +0 -80
  74. package/src/types/frame.ts +0 -29
  75. package/src/types/index.ts +0 -137
  76. package/src/types/item-content.ts +0 -26
  77. package/src/types/item-switch.ts +0 -34
  78. package/src/types/item-toggle.ts +0 -52
  79. package/src/types/list.ts +0 -200
  80. package/src/types/lock-mode.ts +0 -16
  81. package/src/types/menu.ts +0 -95
  82. package/src/types/message.ts +0 -54
  83. package/src/types/nav-content.ts +0 -31
  84. package/src/types/palette.ts +0 -160
  85. package/src/types/pill.ts +0 -43
  86. package/src/types/progress-bar.ts +0 -19
  87. package/src/types/range.ts +0 -51
  88. package/src/types/rating.ts +0 -43
  89. package/src/types/responsive-grid.ts +0 -25
  90. package/src/types/reveal.ts +0 -49
  91. package/src/types/search-filter.ts +0 -67
  92. package/src/types/select.ts +0 -176
  93. package/src/types/shine.ts +0 -37
  94. package/src/types/stack.ts +0 -40
  95. package/src/types/status-list.ts +0 -42
  96. package/src/types/stepper.ts +0 -74
  97. package/src/types/switch.ts +0 -68
  98. package/src/types/table.ts +0 -219
  99. package/src/types/tabs.ts +0 -103
  100. package/src/types/tilt.ts +0 -28
  101. package/src/types/timeline.ts +0 -53
  102. package/src/types/toggle.ts +0 -81
  103. package/src/types/toolbar.ts +0 -167
  104. package/src/types/tooltip.ts +0 -21
  105. package/src/types/tree-table.ts +0 -103
  106. package/src/types/tree.ts +0 -302
  107. package/src/types/upload-file-status.ts +0 -45
  108. package/src/types/upload-progress.ts +0 -111
  109. package/src/types/upload-target.ts +0 -71
  110. package/src/utils/palette.ts +0 -750
  111. package/src/utils/relative-time.ts +0 -12
  112. package/src/utils/shiki.ts +0 -137
  113. /package/{src → dist}/MarkdownRenderer.svelte +0 -0
  114. /package/{src → dist}/components/AlertList.svelte +0 -0
  115. /package/{src → dist}/components/Avatar.svelte +0 -0
  116. /package/{src → dist}/components/Badge.svelte +0 -0
  117. /package/{src → dist}/components/BreadCrumbs.svelte +0 -0
  118. /package/{src → dist}/components/Button.svelte +0 -0
  119. /package/{src → dist}/components/ButtonGroup.svelte +0 -0
  120. /package/{src → dist}/components/Card.svelte +0 -0
  121. /package/{src → dist}/components/Carousel.svelte +0 -0
  122. /package/{src → dist}/components/ChatComposer.svelte +0 -0
  123. /package/{src → dist}/components/ChatHistory.svelte +0 -0
  124. /package/{src → dist}/components/ChatMessage.svelte +0 -0
  125. /package/{src → dist}/components/ChatShell.svelte +0 -0
  126. /package/{src → dist}/components/ChatTimeline.svelte +0 -0
  127. /package/{src → dist}/components/Code.svelte +0 -0
  128. /package/{src → dist}/components/CodeBlock.svelte +0 -0
  129. /package/{src → dist}/components/CodeGroup.svelte +0 -0
  130. /package/{src → dist}/components/CommandPalette.svelte +0 -0
  131. /package/{src → dist}/components/Connector.svelte +0 -0
  132. /package/{src → dist}/components/Divider.svelte +0 -0
  133. /package/{src → dist}/components/Dropdown.svelte +0 -0
  134. /package/{src → dist}/components/FloatingAction.svelte +0 -0
  135. /package/{src → dist}/components/FloatingNavigation.svelte +0 -0
  136. /package/{src → dist}/components/Frame.svelte +0 -0
  137. /package/{src → dist}/components/Grid.svelte +0 -0
  138. /package/{src → dist}/components/ItemContent.svelte +0 -0
  139. /package/{src → dist}/components/ItemSwitch.svelte +0 -0
  140. /package/{src → dist}/components/ItemToggle.svelte +0 -0
  141. /package/{src → dist}/components/LazyTree.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
@@ -1,12 +0,0 @@
1
- /** Format an ISO timestamp as a short relative label ("5m ago"), or a clock time when relative=false. */
2
- export function formatRelativeTime(timestamp: string, relative = true): string {
3
- const ms = new Date(timestamp).getTime()
4
- if (Number.isNaN(ms)) return ''
5
- if (!relative) return new Date(ms).toLocaleTimeString()
6
- const minutes = Math.round((Date.now() - ms) / 60000)
7
- if (minutes < 1) return 'just now'
8
- if (minutes < 60) return `${minutes}m ago`
9
- const hours = Math.round(minutes / 60)
10
- if (hours < 24) return `${hours}h ago`
11
- return `${Math.round(hours / 24)}d ago`
12
- }
@@ -1,137 +0,0 @@
1
- /**
2
- * Shiki syntax highlighting utility
3
- */
4
-
5
- import { createHighlighter, type Highlighter, type BundledLanguage, type BundledTheme } from 'shiki'
6
-
7
- let highlighter: Highlighter | null = null
8
- let isInitializing = false
9
- let initPromise: Promise<Highlighter> | null = null
10
-
11
- // Supported languages for the application
12
- const SUPPORTED_LANGUAGES: BundledLanguage[] = [
13
- 'svelte',
14
- 'javascript',
15
- 'typescript',
16
- 'css',
17
- 'html',
18
- 'json',
19
- 'bash',
20
- 'shell',
21
- 'markdown',
22
- 'yaml',
23
- 'sql'
24
- ]
25
-
26
- // Available themes
27
- const THEMES: BundledTheme[] = ['github-light', 'github-dark']
28
-
29
- /**
30
- * Initialize Shiki highlighter (singleton)
31
- */
32
- function initializeHighlighter(): Promise<Highlighter> {
33
- if (highlighter) return Promise.resolve(highlighter)
34
-
35
- if (isInitializing && initPromise) {
36
- return initPromise
37
- }
38
-
39
- isInitializing = true
40
-
41
- initPromise = createHighlighter({
42
- themes: THEMES,
43
- langs: SUPPORTED_LANGUAGES
44
- })
45
- .then((hl: Highlighter) => {
46
- highlighter = hl
47
- isInitializing = false
48
- return hl
49
- })
50
- .catch((error: Error) => {
51
- /* v8 ignore next 3 -- createHighlighter failure not reachable in test env (singleton already initialized) */
52
- isInitializing = false
53
- initPromise = null
54
- throw error
55
- })
56
-
57
- return initPromise
58
- }
59
-
60
- export interface HighlightOptions {
61
- /** Language for syntax highlighting */
62
- lang?: BundledLanguage | string
63
- /** Theme to use (defaults based on user preference) */
64
- theme?: BundledTheme | 'light' | 'dark'
65
- }
66
-
67
- /**
68
- * Highlight code using Shiki
69
- *
70
- * @param code - The code to highlight
71
- * @param options - Highlighting options
72
- * @returns The highlighted code as HTML
73
- */
74
- function resolveTheme(themeOption: string | undefined): BundledTheme {
75
- if (themeOption === 'light') return 'github-light'
76
- if (themeOption === 'dark' || !themeOption) return 'github-dark'
77
- return themeOption as BundledTheme
78
- }
79
-
80
- /**
81
- * Map fence languages (used by @rokkit/blocks plugins) to a Shiki-known
82
- * grammar. The fence is *semantic* (the renderer routes by language name),
83
- * but the body is plain JSON — highlight it as such instead of falling
84
- * back to unstyled text.
85
- */
86
- const LANGUAGE_ALIASES: Record<string, BundledLanguage> = {
87
- plot: 'json',
88
- table: 'json',
89
- form: 'json',
90
- list: 'json',
91
- stepper: 'json',
92
- sparkline: 'json',
93
- chart: 'json'
94
- }
95
-
96
- function resolveLang(input: string | undefined): BundledLanguage {
97
- if (!input) return 'text' as BundledLanguage
98
- return (LANGUAGE_ALIASES[input] ?? input) as BundledLanguage
99
- }
100
-
101
- function isValidCode(code: unknown): code is string {
102
- return Boolean(code) && typeof code === 'string'
103
- }
104
-
105
- export async function highlightCode(code: string, options: HighlightOptions = {}): Promise<string> {
106
- if (!isValidCode(code)) throw new Error('Invalid code provided for highlighting')
107
-
108
- const hl = await initializeHighlighter()
109
- const lang = resolveLang(options.lang as string | undefined)
110
- const theme = resolveTheme(options.theme)
111
- const loadedLangs = hl.getLoadedLanguages()
112
- const effectiveLang = loadedLangs.includes(lang) ? lang : 'text'
113
-
114
- return hl
115
- .codeToHtml(code, { lang: effectiveLang, theme })
116
- .replace(/(<pre[^>]+) style="[^"]*"/, '$1')
117
- }
118
-
119
- /**
120
- * Preload the syntax highlighter for faster initial rendering
121
- * Errors are silently ignored since preloading is optional
122
- */
123
- export async function preloadHighlighter(): Promise<void> {
124
- try {
125
- await initializeHighlighter()
126
- /* v8 ignore next 3 -- preload catch body unreachable in tests (singleton already initialized) */
127
- } catch {
128
- // Preload failures are non-critical - highlighting will still work on demand
129
- }
130
- }
131
-
132
- /**
133
- * Get list of supported languages
134
- */
135
- export function getSupportedLanguages(): readonly string[] {
136
- return SUPPORTED_LANGUAGES
137
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes