@rokkit/ui 1.2.0 → 1.3.1
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.
- package/dist/components/LockMode.svelte.d.ts +4 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lock-mode.d.ts +12 -0
- package/package.json +5 -5
- package/src/components/LockMode.svelte +16 -0
- package/src/components/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/types/index.ts +3 -0
- package/src/types/lock-mode.ts +16 -0
- package/src/utils/shiki.ts +2 -0
|
@@ -14,6 +14,7 @@ export { default as Tabs } from './Tabs.svelte';
|
|
|
14
14
|
export { default as Toggle } from './Toggle.svelte';
|
|
15
15
|
export { default as Swatch } from './Swatch.svelte';
|
|
16
16
|
export { default as List } from './List.svelte';
|
|
17
|
+
export { default as LockMode } from './LockMode.svelte';
|
|
17
18
|
export { default as Tree } from './Tree.svelte';
|
|
18
19
|
export { default as LazyTree } from './LazyTree.svelte';
|
|
19
20
|
export { default as Connector } from './Connector.svelte';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Button, ButtonGroup, Code, CodeBlock, CodeGroup, Frame, Menu, Dropdown, Select, MultiSelect, Toolbar, ToolbarGroup, Tabs, Toggle, Swatch, List, Tree, LazyTree, FloatingAction, FloatingNavigation, PaletteManager, Tilt, Shine, BreadCrumbs, Card, ProgressBar, Carousel, Pill, Rating, Connector, ItemContent, Stepper, Switch, Table, TreeTable, SearchFilter, Range, Timeline, Reveal, Grid, UploadTarget, UploadFileStatus, UploadProgress, StatusList, Message, AlertList, Divider, Stack, Badge, Avatar, Tooltip, NavContent, ResponsiveGrid, CommandPalette } from './components/index.js';
|
|
1
|
+
export { Button, ButtonGroup, Code, CodeBlock, CodeGroup, Frame, Menu, Dropdown, Select, MultiSelect, Toolbar, ToolbarGroup, Tabs, Toggle, Swatch, List, Tree, LazyTree, LockMode, FloatingAction, FloatingNavigation, PaletteManager, Tilt, Shine, BreadCrumbs, Card, ProgressBar, Carousel, Pill, Rating, Connector, ItemContent, Stepper, Switch, Table, TreeTable, SearchFilter, Range, Timeline, Reveal, Grid, UploadTarget, UploadFileStatus, UploadProgress, StatusList, Message, AlertList, Divider, Stack, Badge, Avatar, Tooltip, NavContent, ResponsiveGrid, CommandPalette } from './components/index.js';
|
|
2
2
|
export { default as MarkdownRenderer } from './MarkdownRenderer.svelte';
|
|
3
3
|
export type { MarkdownPlugin } from './markdown-plugin.js';
|
|
4
4
|
export { highlightCode, preloadHighlighter, getSupportedLanguages } from './utils/shiki.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
/** The color mode a region can be locked to. */
|
|
3
|
+
export type LockedMode = 'dark' | 'light';
|
|
4
|
+
/** Props for the LockMode component. */
|
|
5
|
+
export interface LockModeProps {
|
|
6
|
+
/** Color mode to pin this subtree to, regardless of the document mode. */
|
|
7
|
+
mode: LockedMode;
|
|
8
|
+
/** Content rendered inside the locked region. */
|
|
9
|
+
children: Snippet;
|
|
10
|
+
/** Additional CSS class. */
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokkit/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Data driven UI components for Rokkit applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"dropdown"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@rokkit/core": "1.
|
|
49
|
-
"@rokkit/data": "1.
|
|
50
|
-
"@rokkit/states": "1.
|
|
51
|
-
"@rokkit/actions": "1.
|
|
48
|
+
"@rokkit/core": "1.3.1",
|
|
49
|
+
"@rokkit/data": "1.3.1",
|
|
50
|
+
"@rokkit/states": "1.3.1",
|
|
51
|
+
"@rokkit/actions": "1.3.1",
|
|
52
52
|
"marked": "^15.0.0",
|
|
53
53
|
"dompurify": "^3.0.0"
|
|
54
54
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { lockMode } from '@rokkit/actions'
|
|
3
|
+
import type { LockModeProps } from '../types/lock-mode.js'
|
|
4
|
+
|
|
5
|
+
const { mode, children, class: className = '' }: LockModeProps = $props()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<!--
|
|
9
|
+
`data-mode` is rendered statically so token vars + in-component `dark:`
|
|
10
|
+
utilities are correct on first (SSR) paint. `lockMode` then mirrors the
|
|
11
|
+
root's style/skin/density on hydration so @rokkit/themes component CSS
|
|
12
|
+
(which keys off [data-mode][data-style]) engages too.
|
|
13
|
+
-->
|
|
14
|
+
<div data-mode={mode} use:lockMode={mode} class={className || undefined}>
|
|
15
|
+
{@render children()}
|
|
16
|
+
</div>
|
package/src/components/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { default as Tabs } from './Tabs.svelte'
|
|
|
15
15
|
export { default as Toggle } from './Toggle.svelte'
|
|
16
16
|
export { default as Swatch } from './Swatch.svelte'
|
|
17
17
|
export { default as List } from './List.svelte'
|
|
18
|
+
export { default as LockMode } from './LockMode.svelte'
|
|
18
19
|
export { default as Tree } from './Tree.svelte'
|
|
19
20
|
export { default as LazyTree } from './LazyTree.svelte'
|
|
20
21
|
export { default as Connector } from './Connector.svelte'
|
package/src/index.ts
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
|
|
3
|
+
/** The color mode a region can be locked to. */
|
|
4
|
+
export type LockedMode = 'dark' | 'light'
|
|
5
|
+
|
|
6
|
+
/** Props for the LockMode component. */
|
|
7
|
+
export interface LockModeProps {
|
|
8
|
+
/** Color mode to pin this subtree to, regardless of the document mode. */
|
|
9
|
+
mode: LockedMode
|
|
10
|
+
|
|
11
|
+
/** Content rendered inside the locked region. */
|
|
12
|
+
children: Snippet
|
|
13
|
+
|
|
14
|
+
/** Additional CSS class. */
|
|
15
|
+
class?: string
|
|
16
|
+
}
|
package/src/utils/shiki.ts
CHANGED
|
@@ -48,6 +48,7 @@ function initializeHighlighter(): Promise<Highlighter> {
|
|
|
48
48
|
return hl
|
|
49
49
|
})
|
|
50
50
|
.catch((error: Error) => {
|
|
51
|
+
/* v8 ignore next 3 -- createHighlighter failure not reachable in test env (singleton already initialized) */
|
|
51
52
|
isInitializing = false
|
|
52
53
|
initPromise = null
|
|
53
54
|
throw error
|
|
@@ -122,6 +123,7 @@ export async function highlightCode(code: string, options: HighlightOptions = {}
|
|
|
122
123
|
export async function preloadHighlighter(): Promise<void> {
|
|
123
124
|
try {
|
|
124
125
|
await initializeHighlighter()
|
|
126
|
+
/* v8 ignore next 3 -- preload catch body unreachable in tests (singleton already initialized) */
|
|
125
127
|
} catch {
|
|
126
128
|
// Preload failures are non-critical - highlighting will still work on demand
|
|
127
129
|
}
|