@rokkit/ui 1.0.5 → 1.1.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 (59) hide show
  1. package/package.json +7 -6
  2. package/src/MarkdownRenderer.svelte +13 -1
  3. package/src/components/AlertList.svelte +1 -13
  4. package/src/components/Avatar.svelte +1 -18
  5. package/src/components/Badge.svelte +1 -16
  6. package/src/components/BreadCrumbs.svelte +2 -21
  7. package/src/components/Card.svelte +1 -18
  8. package/src/components/Carousel.svelte +2 -27
  9. package/src/components/CodeBlock.svelte +130 -0
  10. package/src/components/CodeGroup.svelte +408 -0
  11. package/src/components/Connector.svelte +2 -8
  12. package/src/components/Divider.svelte +1 -8
  13. package/src/components/Frame.svelte +30 -0
  14. package/src/components/ItemContent.svelte +4 -2
  15. package/src/components/Message.svelte +1 -22
  16. package/src/components/NavContent.svelte +1 -16
  17. package/src/components/Pill.svelte +1 -24
  18. package/src/components/ProgressBar.svelte +1 -8
  19. package/src/components/Rating.svelte +2 -22
  20. package/src/components/ResponsiveGrid.svelte +1 -14
  21. package/src/components/Reveal.svelte +1 -23
  22. package/src/components/Select.svelte +90 -9
  23. package/src/components/Shine.svelte +1 -19
  24. package/src/components/Stack.svelte +1 -16
  25. package/src/components/StatusList.svelte +3 -2
  26. package/src/components/Stepper.svelte +2 -41
  27. package/src/components/Tilt.svelte +1 -13
  28. package/src/components/Toggle.svelte +83 -33
  29. package/src/components/index.ts +3 -0
  30. package/src/index.ts +4 -0
  31. package/src/types/alert-list.ts +28 -0
  32. package/src/types/avatar.ts +41 -0
  33. package/src/types/badge.ts +37 -0
  34. package/src/types/breadcrumbs.ts +43 -0
  35. package/src/types/card.ts +38 -0
  36. package/src/types/carousel.ts +49 -0
  37. package/src/types/code.ts +102 -1
  38. package/src/types/connector.ts +22 -0
  39. package/src/types/divider.ts +20 -0
  40. package/src/types/frame.ts +29 -0
  41. package/src/types/index.ts +66 -0
  42. package/src/types/item-content.ts +26 -0
  43. package/src/types/message.ts +54 -0
  44. package/src/types/nav-content.ts +31 -0
  45. package/src/types/pill.ts +43 -0
  46. package/src/types/progress-bar.ts +19 -0
  47. package/src/types/rating.ts +43 -0
  48. package/src/types/responsive-grid.ts +25 -0
  49. package/src/types/reveal.ts +49 -0
  50. package/src/types/shine.ts +37 -0
  51. package/src/types/stack.ts +40 -0
  52. package/src/types/status-list.ts +42 -0
  53. package/src/types/stepper.ts +74 -0
  54. package/src/types/tilt.ts +28 -0
  55. package/src/types/toggle.ts +12 -0
  56. package/src/types/tree.ts +46 -4
  57. package/src/utils/palette.ts +4 -2
  58. package/src/utils/shiki.ts +22 -1
  59. package/src/utils/upload.js +8 -8
@@ -0,0 +1,49 @@
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
+ }
package/src/types/code.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Code component types
2
+ * Code component types — Code, CodeBlock, CodeGroup
3
3
  */
4
4
 
5
+ import type { Snippet } from 'svelte'
5
6
  import { DEFAULT_STATE_ICONS } from '@rokkit/core'
6
7
 
7
8
  /** Supported themes for code highlighting */
@@ -44,3 +45,103 @@ export interface CodeProps {
44
45
  /** Additional CSS class */
45
46
  class?: string
46
47
  }
48
+
49
+ /**
50
+ * Shiki theme mode for CodeBlock.
51
+ *
52
+ * `'auto'` follows `body[data-mode]` (light / dark). Pass `'light'` or
53
+ * `'dark'` to force a theme.
54
+ */
55
+ export type CodeBlockTheme = 'auto' | 'light' | 'dark'
56
+
57
+ /**
58
+ * Props for the CodeBlock component.
59
+ *
60
+ * Wraps a Shiki-highlighted code body in a Frame whose header carries the
61
+ * filename + language chip and optional action buttons.
62
+ */
63
+ export interface CodeBlockProps {
64
+ /** The code body. */
65
+ code: string
66
+
67
+ /** Language label shown as a chip in the header and used for highlighting. */
68
+ language?: string
69
+
70
+ /** Filename label shown in the header. */
71
+ filename?: string
72
+
73
+ /** Max height (CSS length) of the scrollable code area. No cap when unset. */
74
+ height?: string
75
+
76
+ /** Shiki theme mode. Default `'auto'`. */
77
+ theme?: CodeBlockTheme
78
+
79
+ /** Show the copy-to-clipboard button. Default `false`. */
80
+ allowCopy?: boolean
81
+
82
+ /** Show the download-as-file button. Default `false`. */
83
+ allowDownload?: boolean
84
+
85
+ /** Optional extra-actions slot rendered after copy / download. */
86
+ actions?: Snippet
87
+ }
88
+
89
+ /**
90
+ * One file in a CodeGroup.
91
+ *
92
+ * The `path` doubles as id and tree placement (e.g. `src/lib/Button.svelte`).
93
+ * Intermediate segments become folder nodes; the final segment becomes a
94
+ * file leaf.
95
+ */
96
+ export interface CodeGroupFile {
97
+ /** Full path used as id and for tree placement. */
98
+ path: string
99
+
100
+ /** Shiki language id. */
101
+ language: string
102
+
103
+ /** Source code. */
104
+ code: string
105
+
106
+ /** Display name override — defaults to the path's last segment. */
107
+ name?: string
108
+
109
+ /** File icon override (full icon class) — defaults to extension lookup. */
110
+ icon?: string
111
+ }
112
+
113
+ /**
114
+ * Icon overrides for the CodeGroup component, grouped by semantic category.
115
+ */
116
+ export interface CodeGroupIconOverrides {
117
+ doc?: Partial<typeof DEFAULT_STATE_ICONS.doc>
118
+ folder?: Partial<typeof DEFAULT_STATE_ICONS.folder>
119
+ view?: Partial<typeof DEFAULT_STATE_ICONS.view>
120
+ action?: Partial<typeof DEFAULT_STATE_ICONS.action>
121
+ }
122
+
123
+ /**
124
+ * Props for the CodeGroup component.
125
+ *
126
+ * Renders a hierarchical tree picker over multiple files with an optional
127
+ * collapsible preview panel.
128
+ */
129
+ export interface CodeGroupProps {
130
+ /** Files rendered in the group. */
131
+ files: CodeGroupFile[]
132
+
133
+ /** Path of the file selected on first render. Defaults to the first file. */
134
+ initialFile?: string
135
+
136
+ /** Additional CSS class. */
137
+ class?: string
138
+
139
+ /** Icon overrides per semantic category. */
140
+ icons?: CodeGroupIconOverrides
141
+
142
+ /** Optional preview content — toggled by a "Show preview" action. */
143
+ preview?: Snippet
144
+
145
+ /** Show the copy button on the inner CodeBlock. Default `true`. */
146
+ showCopyButton?: boolean
147
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Connector Component Types
3
+ *
4
+ * The `Connector` component renders tree-line connectors used by hierarchical
5
+ * visualizations (Tree, lists with indent guides). The underlying connector
6
+ * type values are defined in `./tree.ts` and re-exported here for ergonomics.
7
+ */
8
+
9
+ import type { ConnectorType } from './tree.js'
10
+
11
+ export type { ConnectorType } from './tree.js'
12
+
13
+ /**
14
+ * Props for the Connector component.
15
+ */
16
+ export interface ConnectorProps {
17
+ /** The type of connector to render. Default `'empty'`. */
18
+ type?: ConnectorType
19
+
20
+ /** Right-to-left layout support. */
21
+ rtl?: boolean
22
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Divider Component Types
3
+ */
4
+
5
+ /** Divider orientation. */
6
+ export type DividerOrientation = 'horizontal' | 'vertical'
7
+
8
+ /**
9
+ * Props for the Divider component.
10
+ */
11
+ export interface DividerProps {
12
+ /** Orientation of the divider. */
13
+ orientation?: DividerOrientation
14
+
15
+ /** Optional label text rendered inline with the divider. */
16
+ label?: string
17
+
18
+ /** Additional CSS class. */
19
+ class?: string
20
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Frame Component Types
3
+ *
4
+ * Generic header / body / footer container primitive — used by CodeBlock,
5
+ * PlotPlugin and other "card-shaped UI block" surfaces. For an interactive
6
+ * card (link / button) prefer `<Card/>`.
7
+ */
8
+
9
+ import type { Snippet } from 'svelte'
10
+
11
+ /**
12
+ * Props for the Frame component.
13
+ */
14
+ export interface FrameProps {
15
+ /** Top slot — title, action chips, status badges, etc. */
16
+ header?: Snippet
17
+
18
+ /** Main content. */
19
+ children?: Snippet
20
+
21
+ /** Bottom slot — metadata, actions, secondary controls. */
22
+ footer?: Snippet
23
+
24
+ /**
25
+ * When true the body slot has zero padding so the inner artifact
26
+ * (a chart, a `<pre>`, a table) controls its own padding.
27
+ */
28
+ flush?: boolean
29
+ }
@@ -56,3 +56,69 @@ export * from './upload-progress.js'
56
56
 
57
57
  // Tooltip Types
58
58
  export * from './tooltip.js'
59
+
60
+ // ItemContent Types
61
+ export * from './item-content.js'
62
+
63
+ // StatusList Types
64
+ export * from './status-list.js'
65
+
66
+ // AlertList Types
67
+ export * from './alert-list.js'
68
+
69
+ // Avatar Types
70
+ export * from './avatar.js'
71
+
72
+ // Badge Types
73
+ export * from './badge.js'
74
+
75
+ // BreadCrumbs Types
76
+ export * from './breadcrumbs.js'
77
+
78
+ // Card Types
79
+ export * from './card.js'
80
+
81
+ // Carousel Types
82
+ export * from './carousel.js'
83
+
84
+ // Connector Types
85
+ export * from './connector.js'
86
+
87
+ // Divider Types
88
+ export * from './divider.js'
89
+
90
+ // Frame Types
91
+ export * from './frame.js'
92
+
93
+ // Message Types
94
+ export * from './message.js'
95
+
96
+ // NavContent Types
97
+ export * from './nav-content.js'
98
+
99
+ // Pill Types
100
+ export * from './pill.js'
101
+
102
+ // ProgressBar Types
103
+ export * from './progress-bar.js'
104
+
105
+ // Rating Types
106
+ export * from './rating.js'
107
+
108
+ // ResponsiveGrid Types
109
+ export * from './responsive-grid.js'
110
+
111
+ // Reveal Types
112
+ export * from './reveal.js'
113
+
114
+ // Shine Types
115
+ export * from './shine.js'
116
+
117
+ // Stack Types
118
+ export * from './stack.js'
119
+
120
+ // Stepper Types
121
+ export * from './stepper.js'
122
+
123
+ // Tilt Types
124
+ export * from './tilt.js'
@@ -0,0 +1,26 @@
1
+ /**
2
+ * ItemContent Component Types
3
+ *
4
+ * Default inner content for List / Menu / Tree / Toolbar items.
5
+ * Renders avatar/icon, label + subtext, optional badge and shortcut from a
6
+ * ProxyItem wrapper that exposes field access and reactive state.
7
+ */
8
+
9
+ import type { ProxyItem } from '@rokkit/states'
10
+
11
+ /**
12
+ * Props for the ItemContent component.
13
+ */
14
+ export interface ItemContentProps {
15
+ /**
16
+ * ProxyItem wrapper around the underlying data — exposes `label`,
17
+ * `get(field)`, and the item's reactive selection / expansion state.
18
+ */
19
+ proxy: ProxyItem
20
+
21
+ /** Render the avatar / icon slot. Default: `true`. */
22
+ showIcon?: boolean
23
+
24
+ /** Render the description / subtext line under the label. Default: `true`. */
25
+ showSubtext?: boolean
26
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Message Component Types
3
+ */
4
+
5
+ import type { Snippet } from 'svelte'
6
+
7
+ /** Semantic message type — drives color treatment and the default icon. */
8
+ export type MessageType = 'error' | 'info' | 'success' | 'warning'
9
+
10
+ /**
11
+ * Icon overrides for the Message component, keyed by message type.
12
+ */
13
+ export interface MessageIcons {
14
+ error?: string
15
+ info?: string
16
+ success?: string
17
+ warning?: string
18
+ }
19
+
20
+ /**
21
+ * Props for the Message component.
22
+ */
23
+ export interface MessageProps {
24
+ /** Message type — controls color and the default icon. */
25
+ type?: MessageType
26
+
27
+ /** Icon class overrides per type. */
28
+ icons?: MessageIcons
29
+
30
+ /** Text content (shorthand). `children` takes precedence when both provided. */
31
+ text?: string
32
+
33
+ /** Show a dismiss button. */
34
+ dismissible?: boolean
35
+
36
+ /**
37
+ * Auto-dismiss after N milliseconds. Defaults to `4000` when not
38
+ * `dismissible`, otherwise persistent (no auto-dismiss). Pass `0`
39
+ * to disable auto-dismissal explicitly.
40
+ */
41
+ timeout?: number
42
+
43
+ /** Optional action buttons snippet. */
44
+ actions?: Snippet
45
+
46
+ /** Rich content (takes precedence over `text`). */
47
+ children?: Snippet
48
+
49
+ /** Called when dismissed — via button click or timeout. */
50
+ ondismiss?: () => void
51
+
52
+ /** Additional CSS class. */
53
+ class?: string
54
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * NavContent Component Types
3
+ */
4
+
5
+ import type { Snippet } from 'svelte'
6
+
7
+ /** Layout orientation. */
8
+ export type NavContentOrientation = 'horizontal' | 'vertical'
9
+
10
+ /**
11
+ * Props for the NavContent component.
12
+ */
13
+ export interface NavContentProps {
14
+ /** Layout orientation. */
15
+ orientation?: NavContentOrientation
16
+
17
+ /** Nav panel width (horizontal) or height (vertical) — CSS length value. */
18
+ navSize?: string
19
+
20
+ /** Collapse the nav panel on small screens. */
21
+ collapsible?: boolean
22
+
23
+ /** Nav panel snippet. */
24
+ nav: Snippet
25
+
26
+ /** Content panel snippet. */
27
+ content: Snippet
28
+
29
+ /** Additional CSS class. */
30
+ class?: string
31
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Pill Component Types
3
+ */
4
+
5
+ import type { Snippet } from 'svelte'
6
+ import type { ProxyItem } from '@rokkit/states'
7
+
8
+ /**
9
+ * Icon overrides for the Pill component.
10
+ */
11
+ export interface PillIcons {
12
+ /** Icon class for the remove button. */
13
+ remove?: string
14
+ }
15
+
16
+ /**
17
+ * Props for the Pill component.
18
+ */
19
+ export interface PillProps {
20
+ /** Item data — primitive (string / number) or an object. */
21
+ value: unknown
22
+
23
+ /** Custom field mappings used by the internal `ProxyItem`. */
24
+ fields?: Record<string, string>
25
+
26
+ /** Show the remove button (and enable Delete / Backspace shortcuts). */
27
+ removable?: boolean
28
+
29
+ /** Disabled state. */
30
+ disabled?: boolean
31
+
32
+ /** Custom icon overrides. */
33
+ icons?: PillIcons
34
+
35
+ /** Called when remove is triggered — via click or Delete / Backspace. */
36
+ onremove?: (value: unknown) => void
37
+
38
+ /** Custom content snippet — receives the pill's `ProxyItem`. */
39
+ content?: Snippet<[ProxyItem]>
40
+
41
+ /** Additional CSS class. */
42
+ class?: string
43
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * ProgressBar Component Types
3
+ */
4
+
5
+ /**
6
+ * Props for the ProgressBar component.
7
+ *
8
+ * Pass `value = null` (or omit it) to render in indeterminate state.
9
+ */
10
+ export interface ProgressBarProps {
11
+ /** Current progress value. `null` (or undefined) renders indeterminate. */
12
+ value?: number | null
13
+
14
+ /** Maximum value. Default `100`. */
15
+ max?: number
16
+
17
+ /** Additional CSS class. */
18
+ class?: string
19
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Rating Component Types
3
+ */
4
+
5
+ /**
6
+ * Icon overrides for the Rating component.
7
+ */
8
+ export interface RatingIcons {
9
+ /** Icon class for a filled star. */
10
+ filled?: string
11
+
12
+ /** Icon class for an empty star. */
13
+ empty?: string
14
+
15
+ /** Icon class for a half-filled star. */
16
+ half?: string
17
+ }
18
+
19
+ /**
20
+ * Props for the Rating component.
21
+ */
22
+ export interface RatingProps {
23
+ /** Current rating value (bindable). */
24
+ value?: number
25
+
26
+ /** Maximum number of stars. Default `5`. */
27
+ max?: number
28
+
29
+ /** Disabled state. */
30
+ disabled?: boolean
31
+
32
+ /** Accessible label for the surrounding radio group. */
33
+ label?: string
34
+
35
+ /** Custom icon overrides. */
36
+ icons?: RatingIcons
37
+
38
+ /** Called when the value changes. */
39
+ onchange?: (value: number) => void
40
+
41
+ /** Additional CSS class. */
42
+ class?: string
43
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * ResponsiveGrid Component Types
3
+ */
4
+
5
+ import type { Snippet } from 'svelte'
6
+
7
+ /**
8
+ * Props for the ResponsiveGrid component.
9
+ */
10
+ export interface ResponsiveGridProps {
11
+ /** Minimum column width — CSS length value. */
12
+ minWidth?: string
13
+
14
+ /** Gap between cells — CSS length value. */
15
+ gap?: string
16
+
17
+ /** Maximum number of columns. */
18
+ maxCols?: number
19
+
20
+ /** Grid children. */
21
+ children: Snippet
22
+
23
+ /** Additional CSS class. */
24
+ class?: string
25
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Reveal Component Types
3
+ */
4
+
5
+ import type { Snippet } from 'svelte'
6
+
7
+ /** Slide direction for the reveal animation. */
8
+ export type RevealDirection = 'up' | 'down' | 'left' | 'right' | 'none'
9
+
10
+ /**
11
+ * Props for the Reveal component.
12
+ *
13
+ * Wraps the `reveal` action so children animate in once they intersect the
14
+ * viewport.
15
+ */
16
+ export interface RevealProps {
17
+ /** Slide direction. Default `'up'`. */
18
+ direction?: RevealDirection
19
+
20
+ /** Slide distance — CSS length value. Default `'1.5rem'`. */
21
+ distance?: string
22
+
23
+ /** Transition duration in milliseconds. Default `600`. */
24
+ duration?: number
25
+
26
+ /** Delay before animation starts in milliseconds. Default `0`. */
27
+ delay?: number
28
+
29
+ /**
30
+ * Delay increment per direct child in milliseconds — used for staggered
31
+ * reveals. Default `0`.
32
+ */
33
+ stagger?: number
34
+
35
+ /** Animate only on first intersection. Default `true`. */
36
+ once?: boolean
37
+
38
+ /** IntersectionObserver threshold (0–1). Default `0.1`. */
39
+ threshold?: number
40
+
41
+ /** CSS easing function. */
42
+ easing?: string
43
+
44
+ /** Additional CSS class. */
45
+ class?: string
46
+
47
+ /** Content to reveal. */
48
+ children?: Snippet
49
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Shine Component Types
3
+ *
4
+ * Renders an SVG specular-lighting filter that tracks pointer position to
5
+ * give wrapped content a moving highlight.
6
+ */
7
+
8
+ import type { Snippet } from 'svelte'
9
+
10
+ /**
11
+ * Props for the Shine component.
12
+ */
13
+ export interface ShineProps {
14
+ /** Light color. Default `'rgb(var(--primary-500))'`. */
15
+ color?: string
16
+
17
+ /** Light source distance / height — controls highlight spread. Default `300`. */
18
+ radius?: number
19
+
20
+ /** Gaussian blur depth applied to the highlight. Default `1`. */
21
+ depth?: number
22
+
23
+ /** Surface height for the light filter. Default `2`. */
24
+ surfaceScale?: number
25
+
26
+ /** Reflection size — bigger = bigger reflection. Default `0.75`. */
27
+ specularConstant?: number
28
+
29
+ /** Light source focus — bigger = brighter. Default `120`. */
30
+ specularExponent?: number
31
+
32
+ /** Additional CSS class. */
33
+ class?: string
34
+
35
+ /** Content the highlight wraps. */
36
+ children?: Snippet
37
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Stack Component Types
3
+ */
4
+
5
+ import type { Snippet } from 'svelte'
6
+
7
+ /** Layout direction. */
8
+ export type StackDirection = 'vertical' | 'horizontal'
9
+
10
+ /** Gap size between children — maps to the theme's spacing scale. */
11
+ export type StackGap = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
12
+
13
+ /** Cross-axis alignment. */
14
+ export type StackAlign = 'start' | 'center' | 'end' | 'stretch'
15
+
16
+ /** Main-axis justification. */
17
+ export type StackJustify = 'start' | 'center' | 'end' | 'between' | 'around'
18
+
19
+ /**
20
+ * Props for the Stack component.
21
+ */
22
+ export interface StackProps {
23
+ /** Layout direction. */
24
+ direction?: StackDirection
25
+
26
+ /** Gap size between children. */
27
+ gap?: StackGap
28
+
29
+ /** Cross-axis alignment. */
30
+ align?: StackAlign
31
+
32
+ /** Main-axis justification. */
33
+ justify?: StackJustify
34
+
35
+ /** Stack children. */
36
+ children: Snippet
37
+
38
+ /** Additional CSS class. */
39
+ class?: string
40
+ }