@adea-ai/ui 0.85.0 → 0.88.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.
- package/README.md +17 -1
- package/dist/NOTICE +34 -0
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +2 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/list-row/list-row.d.ts +6 -3
- package/dist/components/composites/list-row/list-row.d.ts.map +1 -1
- package/dist/components/composites/list-row/list-row.js +69 -7
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/settings/settings.d.ts +9 -11
- package/dist/components/composites/settings/settings.d.ts.map +1 -1
- package/dist/components/composites/settings/settings.js +48 -33
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/conversation/message-composer.js +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +95 -15
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/layout/app-shell/index.d.ts +1 -0
- package/dist/components/layout/app-shell/index.d.ts.map +1 -1
- package/dist/components/layout/app-shell/index.js +2 -1
- package/dist/components/layout/app-shell/skip-link.d.ts +11 -0
- package/dist/components/layout/app-shell/skip-link.d.ts.map +1 -0
- package/dist/components/layout/app-shell/skip-link.js +44 -0
- package/dist/components/layout/app-shell/skip-link.js.map +1 -0
- package/dist/components/layout/floating-preview/floating-preview.d.ts +12 -0
- package/dist/components/layout/floating-preview/floating-preview.d.ts.map +1 -0
- package/dist/components/layout/floating-preview/floating-preview.js +283 -0
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -0
- package/dist/components/layout/floating-preview/index.d.ts +3 -0
- package/dist/components/layout/floating-preview/index.d.ts.map +1 -0
- package/dist/components/layout/floating-preview/index.js +3 -0
- package/dist/components/layout/floating-preview/model.d.ts +74 -0
- package/dist/components/layout/floating-preview/model.d.ts.map +1 -0
- package/dist/components/layout/floating-preview/model.js +146 -0
- package/dist/components/layout/floating-preview/model.js.map +1 -0
- package/dist/components/layout/sidebar-nav/index.d.ts +1 -1
- package/dist/components/layout/sidebar-nav/index.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts +18 -2
- package/dist/components/layout/sidebar-nav/sidebar-nav.d.ts.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +42 -11
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/theme/index.d.ts +1 -0
- package/dist/components/theme/index.d.ts.map +1 -1
- package/dist/components/theme/index.js +2 -1
- package/dist/components/theme/theme-mode-toggle.d.ts +10 -0
- package/dist/components/theme/theme-mode-toggle.d.ts.map +1 -0
- package/dist/components/theme/theme-mode-toggle.js +82 -0
- package/dist/components/theme/theme-mode-toggle.js.map +1 -0
- package/dist/components/ui/checkbox/checkbox.d.ts +2 -0
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +24 -3
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.js +41 -4
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/index.d.ts +1 -0
- package/dist/components/ui/combobox/index.d.ts.map +1 -1
- package/dist/components/ui/combobox/index.js +2 -1
- package/dist/components/ui/combobox/value-combobox.d.ts +19 -0
- package/dist/components/ui/combobox/value-combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox/value-combobox.js +42 -0
- package/dist/components/ui/combobox/value-combobox.js.map +1 -0
- package/dist/components/ui/empty/empty-state.d.ts +15 -0
- package/dist/components/ui/empty/empty-state.d.ts.map +1 -0
- package/dist/components/ui/empty/empty-state.js +96 -0
- package/dist/components/ui/empty/empty-state.js.map +1 -0
- package/dist/components/ui/empty/index.d.ts +1 -0
- package/dist/components/ui/empty/index.d.ts.map +1 -1
- package/dist/components/ui/empty/index.js +2 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts +4 -1
- package/dist/components/ui/entity-icon/entity-icon.d.ts.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js +37 -13
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.d.ts +36 -13
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.js +146 -24
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/index.d.ts +3 -1
- package/dist/components/ui/field/index.d.ts.map +1 -1
- package/dist/components/ui/field/index.js +3 -2
- package/dist/components/ui/field/number-field.d.ts +19 -0
- package/dist/components/ui/field/number-field.d.ts.map +1 -0
- package/dist/components/ui/field/number-field.js +76 -0
- package/dist/components/ui/field/number-field.js.map +1 -0
- package/dist/components/ui/input/index.d.ts +1 -0
- package/dist/components/ui/input/index.d.ts.map +1 -1
- package/dist/components/ui/input/index.js +2 -1
- package/dist/components/ui/input/input-control.d.ts +11 -0
- package/dist/components/ui/input/input-control.d.ts.map +1 -0
- package/dist/components/ui/input/input-control.js +24 -0
- package/dist/components/ui/input/input-control.js.map +1 -0
- package/dist/components/ui/input/input.d.ts.map +1 -1
- package/dist/components/ui/input/input.js +56 -28
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/index.d.ts +1 -0
- package/dist/components/ui/input-group/index.d.ts.map +1 -1
- package/dist/components/ui/input-group/index.js +2 -1
- package/dist/components/ui/input-group/input-group.d.ts.map +1 -1
- package/dist/components/ui/input-group/input-group.js +42 -5
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.d.ts +11 -0
- package/dist/components/ui/input-group/secret-input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group/secret-input-group.js +67 -0
- package/dist/components/ui/input-group/secret-input-group.js.map +1 -0
- package/dist/components/ui/native-select/native-select.d.ts.map +1 -1
- package/dist/components/ui/native-select/native-select.js +39 -4
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/progress/progress.d.ts.map +1 -1
- package/dist/components/ui/progress/progress.js +30 -18
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +41 -4
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/switch/switch.d.ts +2 -0
- package/dist/components/ui/switch/switch.d.ts.map +1 -1
- package/dist/components/ui/switch/switch.js +24 -3
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +1 -1
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/index.d.ts +2 -0
- package/dist/components/ui/text-link/index.d.ts.map +1 -0
- package/dist/components/ui/text-link/index.js +2 -0
- package/dist/components/ui/text-link/text-link.d.ts +9 -0
- package/dist/components/ui/text-link/text-link.d.ts.map +1 -0
- package/dist/components/ui/text-link/text-link.js +30 -0
- package/dist/components/ui/text-link/text-link.js.map +1 -0
- package/dist/components/ui/textarea/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea/textarea.js +41 -4
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -7
- package/dist/lib/clipboard.d.ts +3 -0
- package/dist/lib/clipboard.d.ts.map +1 -0
- package/dist/lib/clipboard.js +35 -0
- package/dist/lib/clipboard.js.map +1 -0
- package/dist/lib/download.d.ts +3 -0
- package/dist/lib/download.d.ts.map +1 -0
- package/dist/lib/download.js +31 -0
- package/dist/lib/download.js.map +1 -0
- package/dist/lib/form-field.d.ts +37 -0
- package/dist/lib/form-field.d.ts.map +1 -0
- package/dist/lib/form-field.js +47 -0
- package/dist/lib/form-field.js.map +1 -0
- package/dist/r/app-shell.json +5 -0
- package/dist/r/combobox.json +5 -0
- package/dist/r/empty.json +10 -1
- package/dist/r/field.json +7 -0
- package/dist/r/floating-preview.json +30 -0
- package/dist/r/input-group.json +6 -0
- package/dist/r/input.json +5 -0
- package/dist/r/lib.json +15 -0
- package/dist/r/list-row.json +1 -0
- package/dist/r/registry.json +112 -1
- package/dist/r/src/components/composites/action-button/action-button.tsx +5 -1
- package/dist/r/src/components/composites/list-row/list-row.tsx +81 -8
- package/dist/r/src/components/composites/settings/settings.tsx +67 -37
- package/dist/r/src/components/conversation/scroll-follow.ts +109 -15
- package/dist/r/src/components/layout/app-shell/index.ts +1 -0
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +35 -0
- package/dist/r/src/components/layout/floating-preview/floating-preview.tsx +260 -0
- package/dist/r/src/components/layout/floating-preview/index.ts +2 -0
- package/dist/r/src/components/layout/floating-preview/model.ts +285 -0
- package/dist/r/src/components/layout/sidebar-nav/index.ts +2 -0
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +71 -16
- package/dist/r/src/components/theme/index.ts +1 -0
- package/dist/r/src/components/theme/theme-mode-toggle.tsx +56 -0
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +20 -3
- package/dist/r/src/components/ui/combobox/combobox.tsx +24 -1
- package/dist/r/src/components/ui/combobox/index.ts +1 -0
- package/dist/r/src/components/ui/combobox/value-combobox.tsx +38 -0
- package/dist/r/src/components/ui/empty/empty-state.tsx +71 -0
- package/dist/r/src/components/ui/empty/index.ts +1 -0
- package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +33 -2
- package/dist/r/src/components/ui/field/field.tsx +102 -5
- package/dist/r/src/components/ui/field/index.ts +5 -0
- package/dist/r/src/components/ui/field/number-field.tsx +71 -0
- package/dist/r/src/components/ui/input/index.ts +1 -0
- package/dist/r/src/components/ui/input/input-control.tsx +38 -0
- package/dist/r/src/components/ui/input/input.tsx +32 -20
- package/dist/r/src/components/ui/input-group/index.ts +1 -0
- package/dist/r/src/components/ui/input-group/input-group.tsx +25 -2
- package/dist/r/src/components/ui/input-group/secret-input-group.tsx +58 -0
- package/dist/r/src/components/ui/native-select/native-select.tsx +27 -1
- package/dist/r/src/components/ui/progress/progress.tsx +12 -8
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +30 -2
- package/dist/r/src/components/ui/switch/switch.tsx +20 -3
- package/dist/r/src/components/ui/tabs/tabs.tsx +1 -1
- package/dist/r/src/components/ui/text-link/index.ts +2 -0
- package/dist/r/src/components/ui/text-link/text-link.tsx +28 -0
- package/dist/r/src/components/ui/textarea/textarea.tsx +24 -1
- package/dist/r/src/lib/clipboard.ts +41 -0
- package/dist/r/src/lib/download.ts +29 -0
- package/dist/r/src/lib/form-field.ts +93 -0
- package/dist/r/text-link.json +22 -0
- package/dist/r/theming.json +6 -0
- package/package.json +1 -1
- package/registry.json +112 -1
- package/src/components/composites/action-button/action-button.tsx +5 -1
- package/src/components/composites/list-row/list-row.tsx +81 -8
- package/src/components/composites/settings/settings.tsx +67 -37
- package/src/components/conversation/scroll-follow.ts +109 -15
- package/src/components/layout/app-shell/index.ts +1 -0
- package/src/components/layout/app-shell/skip-link.tsx +35 -0
- package/src/components/layout/floating-preview/floating-preview.tsx +260 -0
- package/src/components/layout/floating-preview/index.ts +2 -0
- package/src/components/layout/floating-preview/model.ts +285 -0
- package/src/components/layout/sidebar-nav/index.ts +2 -0
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +71 -16
- package/src/components/theme/index.ts +1 -0
- package/src/components/theme/theme-mode-toggle.tsx +56 -0
- package/src/components/ui/checkbox/checkbox.tsx +20 -3
- package/src/components/ui/combobox/combobox.tsx +24 -1
- package/src/components/ui/combobox/index.ts +1 -0
- package/src/components/ui/combobox/value-combobox.tsx +38 -0
- package/src/components/ui/empty/empty-state.tsx +71 -0
- package/src/components/ui/empty/index.ts +1 -0
- package/src/components/ui/entity-icon/entity-icon.tsx +33 -2
- package/src/components/ui/field/field.tsx +102 -5
- package/src/components/ui/field/index.ts +5 -0
- package/src/components/ui/field/number-field.tsx +71 -0
- package/src/components/ui/input/index.ts +1 -0
- package/src/components/ui/input/input-control.tsx +38 -0
- package/src/components/ui/input/input.tsx +32 -20
- package/src/components/ui/input-group/index.ts +1 -0
- package/src/components/ui/input-group/input-group.tsx +25 -2
- package/src/components/ui/input-group/secret-input-group.tsx +58 -0
- package/src/components/ui/native-select/native-select.tsx +27 -1
- package/src/components/ui/progress/progress.tsx +12 -8
- package/src/components/ui/radio-group/radio-group.tsx +30 -2
- package/src/components/ui/switch/switch.tsx +20 -3
- package/src/components/ui/tabs/tabs.tsx +1 -1
- package/src/components/ui/text-link/index.ts +2 -0
- package/src/components/ui/text-link/text-link.tsx +28 -0
- package/src/components/ui/textarea/textarea.tsx +24 -1
- package/src/index.ts +3 -0
- package/src/lib/clipboard.ts +41 -0
- package/src/lib/download.ts +29 -0
- package/src/lib/form-field.ts +93 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/floating-preview/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FLOATING_PREVIEW_CORNER_RADIUS, FLOATING_PREVIEW_EDGE_GAP, NO_FLOATING_PREVIEW_OBSTACLES, NO_PREVIEW_MINI_PLAYER_OBSTACLES, PREVIEW_MINI_PLAYER_CORNER_RADIUS, PREVIEW_MINI_PLAYER_EDGE_GAP, clampFloatingPreviewPosition, clampPreviewMiniPlayerPosition, resizeFloatingPreview, resizePreviewMiniPlayer, resolveFloatingPreviewFrame, resolvePreviewMiniPlayerFrame } from "./model.js";
|
|
2
|
+
import { FloatingPreview } from "./floating-preview.js";
|
|
3
|
+
export { FLOATING_PREVIEW_CORNER_RADIUS, FLOATING_PREVIEW_EDGE_GAP, FloatingPreview, NO_FLOATING_PREVIEW_OBSTACLES, NO_PREVIEW_MINI_PLAYER_OBSTACLES, PREVIEW_MINI_PLAYER_CORNER_RADIUS, PREVIEW_MINI_PLAYER_EDGE_GAP, clampFloatingPreviewPosition, clampPreviewMiniPlayerPosition, resizeFloatingPreview, resizePreviewMiniPlayer, resolveFloatingPreviewFrame, resolvePreviewMiniPlayerFrame };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export declare const PREVIEW_MINI_PLAYER_EDGE_GAP = 12;
|
|
2
|
+
export declare const PREVIEW_MINI_PLAYER_CORNER_RADIUS = 12;
|
|
3
|
+
export interface PreviewMiniPlayerSize {
|
|
4
|
+
readonly width: number;
|
|
5
|
+
readonly height: number;
|
|
6
|
+
}
|
|
7
|
+
export interface PreviewMiniPlayerPosition {
|
|
8
|
+
readonly x: number;
|
|
9
|
+
readonly y: number;
|
|
10
|
+
}
|
|
11
|
+
export interface PreviewMiniPlayerFrame extends PreviewMiniPlayerPosition, PreviewMiniPlayerSize {
|
|
12
|
+
}
|
|
13
|
+
export type BrowserViewportResizeDirection = 'north' | 'south' | 'east' | 'west' | 'northwest' | 'northeast' | 'southwest' | 'southeast';
|
|
14
|
+
interface HorizontalSpan {
|
|
15
|
+
readonly left: number;
|
|
16
|
+
readonly right: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The composer stack docked to the bottom edge, in container coordinates. It
|
|
20
|
+
* only reserves the columns it covers, so the margins beside it stay open all
|
|
21
|
+
* the way down.
|
|
22
|
+
*/
|
|
23
|
+
export interface PreviewMiniPlayerObstacles {
|
|
24
|
+
readonly composer: (HorizontalSpan & {
|
|
25
|
+
readonly height: number;
|
|
26
|
+
}) | null;
|
|
27
|
+
}
|
|
28
|
+
export declare const NO_PREVIEW_MINI_PLAYER_OBSTACLES: PreviewMiniPlayerObstacles;
|
|
29
|
+
/**
|
|
30
|
+
* Keeps the player inside the container and off the composer. An overlapping
|
|
31
|
+
* player is pushed out along whichever side needs the smaller move, so a drag
|
|
32
|
+
* slides along the composer into the margin beside it instead of stopping at
|
|
33
|
+
* its top edge; when no side leaves it fully clear it sits above the composer.
|
|
34
|
+
*/
|
|
35
|
+
export declare function clampPreviewMiniPlayerPosition(position: PreviewMiniPlayerPosition, container: PreviewMiniPlayerSize, player: PreviewMiniPlayerSize, obstacles?: PreviewMiniPlayerObstacles): PreviewMiniPlayerPosition;
|
|
36
|
+
/**
|
|
37
|
+
* Resolves the on-screen frame from the stored width and position. Clamping
|
|
38
|
+
* happens here on every layout pass instead of being written back to the
|
|
39
|
+
* store, so a temporarily narrow container never destroys the user's chosen
|
|
40
|
+
* width. A player without a position sits in the top-right corner.
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolvePreviewMiniPlayerFrame(input: {
|
|
43
|
+
readonly width: number | null;
|
|
44
|
+
readonly position: PreviewMiniPlayerPosition | null;
|
|
45
|
+
readonly source: PreviewMiniPlayerSize;
|
|
46
|
+
readonly container: PreviewMiniPlayerSize;
|
|
47
|
+
readonly obstacles?: PreviewMiniPlayerObstacles;
|
|
48
|
+
}): PreviewMiniPlayerFrame;
|
|
49
|
+
/**
|
|
50
|
+
* Resizes from any edge or corner while holding the aspect ratio. The edge
|
|
51
|
+
* opposite the dragged one stays anchored, so growth stops at the container
|
|
52
|
+
* on that axis and the pointer keeps tracking the grabbed edge.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resizePreviewMiniPlayer(input: {
|
|
55
|
+
readonly start: PreviewMiniPlayerFrame;
|
|
56
|
+
readonly direction: BrowserViewportResizeDirection;
|
|
57
|
+
readonly delta: PreviewMiniPlayerPosition;
|
|
58
|
+
readonly source: PreviewMiniPlayerSize;
|
|
59
|
+
readonly container: PreviewMiniPlayerSize;
|
|
60
|
+
readonly obstacles?: PreviewMiniPlayerObstacles;
|
|
61
|
+
}): PreviewMiniPlayerFrame;
|
|
62
|
+
export type FloatingPreviewSize = PreviewMiniPlayerSize;
|
|
63
|
+
export type FloatingPreviewPosition = PreviewMiniPlayerPosition;
|
|
64
|
+
export type FloatingPreviewFrame = PreviewMiniPlayerFrame;
|
|
65
|
+
export type FloatingPreviewResizeDirection = BrowserViewportResizeDirection;
|
|
66
|
+
export type FloatingPreviewObstacles = PreviewMiniPlayerObstacles;
|
|
67
|
+
export declare const FLOATING_PREVIEW_EDGE_GAP = 12;
|
|
68
|
+
export declare const FLOATING_PREVIEW_CORNER_RADIUS = 12;
|
|
69
|
+
export declare const NO_FLOATING_PREVIEW_OBSTACLES: PreviewMiniPlayerObstacles;
|
|
70
|
+
export declare const resolveFloatingPreviewFrame: typeof resolvePreviewMiniPlayerFrame;
|
|
71
|
+
export declare const resizeFloatingPreview: typeof resizePreviewMiniPlayer;
|
|
72
|
+
export declare const clampFloatingPreviewPosition: typeof clampPreviewMiniPlayerPosition;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/floating-preview/model.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,4BAA4B,KAAK,CAAA;AAC9C,eAAO,MAAM,iCAAiC,KAAK,CAAA;AACnD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AACD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CACnB;AACD,MAAM,WAAW,sBAAuB,SAAQ,yBAAyB,EAAE,qBAAqB;CAAG;AAEnG,MAAM,MAAM,8BAA8B,GACtC,OAAO,GACP,OAAO,GACP,MAAM,GACN,MAAM,GACN,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,CAAA;AAKf,UAAU,cAAc;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QA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M,MAAM,wBAAwB,GAAG,0BAA0B,CAAA;AACjE,eAAO,MAAM,yBAAyB,KAA+B,CAAA;AACrE,eAAO,MAAM,8BAA8B,KAAoC,CAAA;AAC/E,eAAO,MAAM,6BAA6B,4BAAmC,CAAA;AAC7E,eAAO,MAAM,2BAA2B,sCAAgC,CAAA;AACxE,eAAO,MAAM,qBAAqB,gCAA0B,CAAA;AAC5D,eAAO,MAAM,4BAA4B,uCAAiC,CAAA"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
//#region src/components/layout/floating-preview/model.ts
|
|
2
|
+
var PREVIEW_MINI_PLAYER_EDGE_GAP = 12;
|
|
3
|
+
var PREVIEW_MINI_PLAYER_CORNER_RADIUS = 12;
|
|
4
|
+
var PREVIEW_MINI_PLAYER_DEFAULT_BOX = {
|
|
5
|
+
width: 320,
|
|
6
|
+
height: 320
|
|
7
|
+
};
|
|
8
|
+
var PREVIEW_MINI_PLAYER_MIN_SIZE = {
|
|
9
|
+
width: 240,
|
|
10
|
+
height: 150
|
|
11
|
+
};
|
|
12
|
+
var NO_PREVIEW_MINI_PLAYER_OBSTACLES = { composer: null };
|
|
13
|
+
var spanOf = (x, width) => ({
|
|
14
|
+
left: x,
|
|
15
|
+
right: x + width
|
|
16
|
+
});
|
|
17
|
+
var spansOverlap = (a, b) => a.left < b.right && a.right > b.left;
|
|
18
|
+
/** The lowest row (before the edge gap) open to a player covering these columns. */
|
|
19
|
+
function floorFor(span, container, obstacles) {
|
|
20
|
+
const { composer } = obstacles;
|
|
21
|
+
return composer && spansOverlap(span, composer) ? container.height - Math.max(0, composer.height) : container.height;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The box a stored size is fitted into. A player with a position keeps the
|
|
25
|
+
* rows its own columns have, so a tall frame parked beside the composer
|
|
26
|
+
* survives the next layout pass; without one it takes the rows above the
|
|
27
|
+
* composer, which every column has.
|
|
28
|
+
*/
|
|
29
|
+
var availableArea = (container, obstacles, span) => ({
|
|
30
|
+
width: container.width - 24,
|
|
31
|
+
height: (span ? floorFor(span, container, obstacles) : container.height - Math.max(0, obstacles.composer?.height ?? 0)) - 24
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Width is the player's only free dimension; height always follows the source
|
|
35
|
+
* aspect ratio so the content fills the box without letterboxing. The player
|
|
36
|
+
* never grows past the source's own size, and a tight container wins over the
|
|
37
|
+
* minimum.
|
|
38
|
+
*/
|
|
39
|
+
function fitPreviewMiniPlayerWidth(desiredWidth, source, max) {
|
|
40
|
+
const aspectRatio = source.width / source.height;
|
|
41
|
+
const width = Math.min(Math.max(desiredWidth, PREVIEW_MINI_PLAYER_MIN_SIZE.width, PREVIEW_MINI_PLAYER_MIN_SIZE.height * aspectRatio), source.width, Math.max(1, max.width), Math.max(1, max.height * aspectRatio));
|
|
42
|
+
return {
|
|
43
|
+
width: Math.round(width),
|
|
44
|
+
height: Math.round(width / aspectRatio)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function defaultPreviewMiniPlayerWidth(source) {
|
|
48
|
+
return Math.min(PREVIEW_MINI_PLAYER_DEFAULT_BOX.width, PREVIEW_MINI_PLAYER_DEFAULT_BOX.height * source.width / source.height);
|
|
49
|
+
}
|
|
50
|
+
var clampToContainer = (position, container, player, bottom = container.height) => ({
|
|
51
|
+
x: Math.min(Math.max(position.x, 12), Math.max(12, container.width - player.width - 12)),
|
|
52
|
+
y: Math.min(Math.max(position.y, 12), Math.max(12, bottom - player.height - 12))
|
|
53
|
+
});
|
|
54
|
+
var overlapsObstacle = (position, player, container, obstacles) => position.y + player.height > floorFor(spanOf(position.x, player.width), container, obstacles);
|
|
55
|
+
/**
|
|
56
|
+
* Keeps the player inside the container and off the composer. An overlapping
|
|
57
|
+
* player is pushed out along whichever side needs the smaller move, so a drag
|
|
58
|
+
* slides along the composer into the margin beside it instead of stopping at
|
|
59
|
+
* its top edge; when no side leaves it fully clear it sits above the composer.
|
|
60
|
+
*/
|
|
61
|
+
function clampPreviewMiniPlayerPosition(position, container, player, obstacles = NO_PREVIEW_MINI_PLAYER_OBSTACLES) {
|
|
62
|
+
const inside = clampToContainer(position, container, player);
|
|
63
|
+
const { composer } = obstacles;
|
|
64
|
+
if (!composer || !overlapsObstacle(inside, player, container, obstacles)) return inside;
|
|
65
|
+
const gap = 12;
|
|
66
|
+
const above = {
|
|
67
|
+
x: inside.x,
|
|
68
|
+
y: container.height - composer.height - gap - player.height
|
|
69
|
+
};
|
|
70
|
+
const beside = [{
|
|
71
|
+
x: composer.left - gap - player.width,
|
|
72
|
+
y: inside.y
|
|
73
|
+
}, {
|
|
74
|
+
x: composer.right + gap,
|
|
75
|
+
y: inside.y
|
|
76
|
+
}];
|
|
77
|
+
let best = clampToContainer(above, container, player);
|
|
78
|
+
let bestDistance = Math.abs(best.y - inside.y);
|
|
79
|
+
for (const candidate of beside) {
|
|
80
|
+
if (clampToContainer(candidate, container, player).x !== candidate.x || overlapsObstacle(candidate, player, container, obstacles)) continue;
|
|
81
|
+
const distance = Math.abs(candidate.x - inside.x);
|
|
82
|
+
if (distance < bestDistance) {
|
|
83
|
+
best = candidate;
|
|
84
|
+
bestDistance = distance;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return best;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Resolves the on-screen frame from the stored width and position. Clamping
|
|
91
|
+
* happens here on every layout pass instead of being written back to the
|
|
92
|
+
* store, so a temporarily narrow container never destroys the user's chosen
|
|
93
|
+
* width. A player without a position sits in the top-right corner.
|
|
94
|
+
*/
|
|
95
|
+
function resolvePreviewMiniPlayerFrame(input) {
|
|
96
|
+
const { width, position, source, container, obstacles = NO_PREVIEW_MINI_PLAYER_OBSTACLES } = input;
|
|
97
|
+
const size = fitPreviewMiniPlayerWidth(width ?? defaultPreviewMiniPlayerWidth(source), source, availableArea(container, obstacles, position && width ? spanOf(position.x, width) : null));
|
|
98
|
+
return {
|
|
99
|
+
...clampPreviewMiniPlayerPosition(position ?? {
|
|
100
|
+
x: container.width - 12 - size.width,
|
|
101
|
+
y: 12
|
|
102
|
+
}, container, size, obstacles),
|
|
103
|
+
...size
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resizes from any edge or corner while holding the aspect ratio. The edge
|
|
108
|
+
* opposite the dragged one stays anchored, so growth stops at the container
|
|
109
|
+
* on that axis and the pointer keeps tracking the grabbed edge.
|
|
110
|
+
*/
|
|
111
|
+
function resizePreviewMiniPlayer(input) {
|
|
112
|
+
const { start, direction, delta, source, container, obstacles = NO_PREVIEW_MINI_PLAYER_OBSTACLES } = input;
|
|
113
|
+
const east = direction.includes("east");
|
|
114
|
+
const west = direction.includes("west");
|
|
115
|
+
const north = direction.includes("north");
|
|
116
|
+
const south = direction.includes("south");
|
|
117
|
+
const right = start.x + start.width;
|
|
118
|
+
const bottom = start.y + start.height;
|
|
119
|
+
const floor = floorFor(spanOf(start.x, start.width), container, obstacles);
|
|
120
|
+
const max = {
|
|
121
|
+
width: west ? right - 12 : east ? container.width - 12 - start.x : container.width - 24,
|
|
122
|
+
height: north ? bottom - 12 : south ? floor - 12 - start.y : floor - 24
|
|
123
|
+
};
|
|
124
|
+
const desiredWidth = start.width + (east ? delta.x : west ? -delta.x : 0);
|
|
125
|
+
const desiredHeight = start.height + (south ? delta.y : north ? -delta.y : 0);
|
|
126
|
+
const horizontal = east || west;
|
|
127
|
+
const vertical = north || south;
|
|
128
|
+
const size = fitPreviewMiniPlayerWidth((horizontal && !vertical ? true : vertical && !horizontal ? false : Math.abs(desiredWidth - start.width) / start.width >= Math.abs(desiredHeight - start.height) / start.height) ? desiredWidth : desiredHeight * source.width / source.height, source, max);
|
|
129
|
+
return {
|
|
130
|
+
...clampPreviewMiniPlayerPosition({
|
|
131
|
+
x: west ? right - size.width : start.x,
|
|
132
|
+
y: north ? bottom - size.height : start.y
|
|
133
|
+
}, container, size, obstacles),
|
|
134
|
+
...size
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
var FLOATING_PREVIEW_EDGE_GAP = 12;
|
|
138
|
+
var FLOATING_PREVIEW_CORNER_RADIUS = 12;
|
|
139
|
+
var NO_FLOATING_PREVIEW_OBSTACLES = NO_PREVIEW_MINI_PLAYER_OBSTACLES;
|
|
140
|
+
var resolveFloatingPreviewFrame = resolvePreviewMiniPlayerFrame;
|
|
141
|
+
var resizeFloatingPreview = resizePreviewMiniPlayer;
|
|
142
|
+
var clampFloatingPreviewPosition = clampPreviewMiniPlayerPosition;
|
|
143
|
+
//#endregion
|
|
144
|
+
export { FLOATING_PREVIEW_CORNER_RADIUS, FLOATING_PREVIEW_EDGE_GAP, NO_FLOATING_PREVIEW_OBSTACLES, NO_PREVIEW_MINI_PLAYER_OBSTACLES, PREVIEW_MINI_PLAYER_CORNER_RADIUS, PREVIEW_MINI_PLAYER_EDGE_GAP, clampFloatingPreviewPosition, clampPreviewMiniPlayerPosition, resizeFloatingPreview, resizePreviewMiniPlayer, resolveFloatingPreviewFrame, resolvePreviewMiniPlayerFrame };
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","names":[],"sources":["../../../../src/components/layout/floating-preview/model.ts"],"sourcesContent":["/*\n * Copyright (c) 2026 Adea contributors\n * SPDX-License-Identifier: MIT\n * Geometry translated from t3code apps/web/src/components/preview/\n * previewMiniPlayerLayout.ts, issue #422, revision\n * 77bca8b2d76a1f42552e5eee7d277fcb1160347a (MIT). Runtime and device\n * behavior are excluded. See NOTICE.\n */\n\nexport const PREVIEW_MINI_PLAYER_EDGE_GAP = 12\nexport const PREVIEW_MINI_PLAYER_CORNER_RADIUS = 12\nexport interface PreviewMiniPlayerSize {\n readonly width: number\n readonly height: number\n}\nexport interface PreviewMiniPlayerPosition {\n readonly x: number\n readonly y: number\n}\nexport interface PreviewMiniPlayerFrame extends PreviewMiniPlayerPosition, PreviewMiniPlayerSize {}\n\nexport type BrowserViewportResizeDirection =\n | 'north'\n | 'south'\n | 'east'\n | 'west'\n | 'northwest'\n | 'northeast'\n | 'southwest'\n | 'southeast'\n\nconst PREVIEW_MINI_PLAYER_DEFAULT_BOX = { width: 320, height: 320 } as const\nconst PREVIEW_MINI_PLAYER_MIN_SIZE = { width: 240, height: 150 } as const\n\ninterface HorizontalSpan {\n readonly left: number\n readonly right: number\n}\n\n/**\n * The composer stack docked to the bottom edge, in container coordinates. It\n * only reserves the columns it covers, so the margins beside it stay open all\n * the way down.\n */\nexport interface PreviewMiniPlayerObstacles {\n readonly composer: (HorizontalSpan & { readonly height: number }) | null\n}\n\nexport const NO_PREVIEW_MINI_PLAYER_OBSTACLES: PreviewMiniPlayerObstacles = { composer: null }\n\nconst spanOf = (x: number, width: number): HorizontalSpan => ({ left: x, right: x + width })\n\nconst spansOverlap = (a: HorizontalSpan, b: HorizontalSpan) => a.left < b.right && a.right > b.left\n\n/** The lowest row (before the edge gap) open to a player covering these columns. */\nfunction floorFor(\n span: HorizontalSpan,\n container: PreviewMiniPlayerSize,\n obstacles: PreviewMiniPlayerObstacles\n): number {\n const { composer } = obstacles\n return composer && spansOverlap(span, composer)\n ? container.height - Math.max(0, composer.height)\n : container.height\n}\n\n/**\n * The box a stored size is fitted into. A player with a position keeps the\n * rows its own columns have, so a tall frame parked beside the composer\n * survives the next layout pass; without one it takes the rows above the\n * composer, which every column has.\n */\nconst availableArea = (\n container: PreviewMiniPlayerSize,\n obstacles: PreviewMiniPlayerObstacles,\n span: HorizontalSpan | null\n): PreviewMiniPlayerSize => ({\n width: container.width - PREVIEW_MINI_PLAYER_EDGE_GAP * 2,\n height:\n (span\n ? floorFor(span, container, obstacles)\n : container.height - Math.max(0, obstacles.composer?.height ?? 0)) -\n PREVIEW_MINI_PLAYER_EDGE_GAP * 2,\n})\n\n/**\n * Width is the player's only free dimension; height always follows the source\n * aspect ratio so the content fills the box without letterboxing. The player\n * never grows past the source's own size, and a tight container wins over the\n * minimum.\n */\nfunction fitPreviewMiniPlayerWidth(\n desiredWidth: number,\n source: PreviewMiniPlayerSize,\n max: PreviewMiniPlayerSize\n): PreviewMiniPlayerSize {\n const aspectRatio = source.width / source.height\n const width = Math.min(\n Math.max(\n desiredWidth,\n PREVIEW_MINI_PLAYER_MIN_SIZE.width,\n PREVIEW_MINI_PLAYER_MIN_SIZE.height * aspectRatio\n ),\n source.width,\n Math.max(1, max.width),\n Math.max(1, max.height * aspectRatio)\n )\n return { width: Math.round(width), height: Math.round(width / aspectRatio) }\n}\n\nfunction defaultPreviewMiniPlayerWidth(source: PreviewMiniPlayerSize): number {\n return Math.min(\n PREVIEW_MINI_PLAYER_DEFAULT_BOX.width,\n (PREVIEW_MINI_PLAYER_DEFAULT_BOX.height * source.width) / source.height\n )\n}\n\nconst clampToContainer = (\n position: PreviewMiniPlayerPosition,\n container: PreviewMiniPlayerSize,\n player: PreviewMiniPlayerSize,\n bottom = container.height\n): PreviewMiniPlayerPosition => ({\n x: Math.min(\n Math.max(position.x, PREVIEW_MINI_PLAYER_EDGE_GAP),\n Math.max(\n PREVIEW_MINI_PLAYER_EDGE_GAP,\n container.width - player.width - PREVIEW_MINI_PLAYER_EDGE_GAP\n )\n ),\n y: Math.min(\n Math.max(position.y, PREVIEW_MINI_PLAYER_EDGE_GAP),\n Math.max(PREVIEW_MINI_PLAYER_EDGE_GAP, bottom - player.height - PREVIEW_MINI_PLAYER_EDGE_GAP)\n ),\n})\n\nconst overlapsObstacle = (\n position: PreviewMiniPlayerPosition,\n player: PreviewMiniPlayerSize,\n container: PreviewMiniPlayerSize,\n obstacles: PreviewMiniPlayerObstacles\n): boolean =>\n position.y + player.height > floorFor(spanOf(position.x, player.width), container, obstacles)\n\n/**\n * Keeps the player inside the container and off the composer. An overlapping\n * player is pushed out along whichever side needs the smaller move, so a drag\n * slides along the composer into the margin beside it instead of stopping at\n * its top edge; when no side leaves it fully clear it sits above the composer.\n */\nexport function clampPreviewMiniPlayerPosition(\n position: PreviewMiniPlayerPosition,\n container: PreviewMiniPlayerSize,\n player: PreviewMiniPlayerSize,\n obstacles: PreviewMiniPlayerObstacles = NO_PREVIEW_MINI_PLAYER_OBSTACLES\n): PreviewMiniPlayerPosition {\n const inside = clampToContainer(position, container, player)\n const { composer } = obstacles\n if (!composer || !overlapsObstacle(inside, player, container, obstacles)) return inside\n const gap = PREVIEW_MINI_PLAYER_EDGE_GAP\n const above = { x: inside.x, y: container.height - composer.height - gap - player.height }\n const beside = [\n { x: composer.left - gap - player.width, y: inside.y },\n { x: composer.right + gap, y: inside.y },\n ]\n let best = clampToContainer(above, container, player)\n let bestDistance = Math.abs(best.y - inside.y)\n for (const candidate of beside) {\n const clamped = clampToContainer(candidate, container, player)\n if (clamped.x !== candidate.x || overlapsObstacle(candidate, player, container, obstacles)) {\n continue\n }\n const distance = Math.abs(candidate.x - inside.x)\n if (distance < bestDistance) {\n best = candidate\n bestDistance = distance\n }\n }\n return best\n}\n\n/**\n * Resolves the on-screen frame from the stored width and position. Clamping\n * happens here on every layout pass instead of being written back to the\n * store, so a temporarily narrow container never destroys the user's chosen\n * width. A player without a position sits in the top-right corner.\n */\nexport function resolvePreviewMiniPlayerFrame(input: {\n readonly width: number | null\n readonly position: PreviewMiniPlayerPosition | null\n readonly source: PreviewMiniPlayerSize\n readonly container: PreviewMiniPlayerSize\n readonly obstacles?: PreviewMiniPlayerObstacles\n}): PreviewMiniPlayerFrame {\n const { width, position, source, container, obstacles = NO_PREVIEW_MINI_PLAYER_OBSTACLES } = input\n const size = fitPreviewMiniPlayerWidth(\n width ?? defaultPreviewMiniPlayerWidth(source),\n source,\n availableArea(container, obstacles, position && width ? spanOf(position.x, width) : null)\n )\n const anchored = position ?? {\n x: container.width - PREVIEW_MINI_PLAYER_EDGE_GAP - size.width,\n y: PREVIEW_MINI_PLAYER_EDGE_GAP,\n }\n return { ...clampPreviewMiniPlayerPosition(anchored, container, size, obstacles), ...size }\n}\n\n/**\n * Resizes from any edge or corner while holding the aspect ratio. The edge\n * opposite the dragged one stays anchored, so growth stops at the container\n * on that axis and the pointer keeps tracking the grabbed edge.\n */\nexport function resizePreviewMiniPlayer(input: {\n readonly start: PreviewMiniPlayerFrame\n readonly direction: BrowserViewportResizeDirection\n readonly delta: PreviewMiniPlayerPosition\n readonly source: PreviewMiniPlayerSize\n readonly container: PreviewMiniPlayerSize\n readonly obstacles?: PreviewMiniPlayerObstacles\n}): PreviewMiniPlayerFrame {\n const {\n start,\n direction,\n delta,\n source,\n container,\n obstacles = NO_PREVIEW_MINI_PLAYER_OBSTACLES,\n } = input\n const east = direction.includes('east')\n const west = direction.includes('west')\n const north = direction.includes('north')\n const south = direction.includes('south')\n const right = start.x + start.width\n const bottom = start.y + start.height\n const floor = floorFor(spanOf(start.x, start.width), container, obstacles)\n const max = {\n width: west\n ? right - PREVIEW_MINI_PLAYER_EDGE_GAP\n : east\n ? container.width - PREVIEW_MINI_PLAYER_EDGE_GAP - start.x\n : container.width - PREVIEW_MINI_PLAYER_EDGE_GAP * 2,\n height: north\n ? bottom - PREVIEW_MINI_PLAYER_EDGE_GAP\n : south\n ? floor - PREVIEW_MINI_PLAYER_EDGE_GAP - start.y\n : floor - PREVIEW_MINI_PLAYER_EDGE_GAP * 2,\n }\n const desiredWidth = start.width + (east ? delta.x : west ? -delta.x : 0)\n const desiredHeight = start.height + (south ? delta.y : north ? -delta.y : 0)\n const horizontal = east || west\n const vertical = north || south\n const widthLeads =\n horizontal && !vertical\n ? true\n : vertical && !horizontal\n ? false\n : Math.abs(desiredWidth - start.width) / start.width >=\n Math.abs(desiredHeight - start.height) / start.height\n const size = fitPreviewMiniPlayerWidth(\n widthLeads ? desiredWidth : (desiredHeight * source.width) / source.height,\n source,\n max\n )\n const position = clampPreviewMiniPlayerPosition(\n { x: west ? right - size.width : start.x, y: north ? bottom - size.height : start.y },\n container,\n size,\n obstacles\n )\n return { ...position, ...size }\n}\n\n// Product-neutral names for new consumers. The PreviewMiniPlayer names stay\n// exported for Adea Dev Runtime's existing browser model API.\nexport type FloatingPreviewSize = PreviewMiniPlayerSize\nexport type FloatingPreviewPosition = PreviewMiniPlayerPosition\nexport type FloatingPreviewFrame = PreviewMiniPlayerFrame\nexport type FloatingPreviewResizeDirection = BrowserViewportResizeDirection\nexport type FloatingPreviewObstacles = PreviewMiniPlayerObstacles\nexport const FLOATING_PREVIEW_EDGE_GAP = PREVIEW_MINI_PLAYER_EDGE_GAP\nexport const FLOATING_PREVIEW_CORNER_RADIUS = PREVIEW_MINI_PLAYER_CORNER_RADIUS\nexport const NO_FLOATING_PREVIEW_OBSTACLES = NO_PREVIEW_MINI_PLAYER_OBSTACLES\nexport const resolveFloatingPreviewFrame = resolvePreviewMiniPlayerFrame\nexport const resizeFloatingPreview = resizePreviewMiniPlayer\nexport const clampFloatingPreviewPosition = clampPreviewMiniPlayerPosition\n"],"mappings":";AASA,IAAa,+BAA+B;AAC5C,IAAa,oCAAoC;AAqBjD,IAAM,kCAAkC;CAAE,OAAO;CAAK,QAAQ;AAAI;AAClE,IAAM,+BAA+B;CAAE,OAAO;CAAK,QAAQ;AAAI;AAgB/D,IAAa,mCAA+D,EAAE,UAAU,KAAK;AAE7F,IAAM,UAAU,GAAW,WAAmC;CAAE,MAAM;CAAG,OAAO,IAAI;AAAM;AAE1F,IAAM,gBAAgB,GAAmB,MAAsB,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE;;AAG/F,SAAS,SACP,MACA,WACA,WACQ;CACR,MAAM,EAAE,aAAa;CACrB,OAAO,YAAY,aAAa,MAAM,QAAQ,IAC1C,UAAU,SAAS,KAAK,IAAI,GAAG,SAAS,MAAM,IAC9C,UAAU;AAChB;;;;;;;AAQA,IAAM,iBACJ,WACA,WACA,UAC2B;CAC3B,OAAO,UAAU,QAAQ;CACzB,SACG,OACG,SAAS,MAAM,WAAW,SAAS,IACnC,UAAU,SAAS,KAAK,IAAI,GAAG,UAAU,UAAU,UAAU,CAAC,KAClE;AACJ;;;;;;;AAQA,SAAS,0BACP,cACA,QACA,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,KAAuC,MAAM,IACvD,UAAU,QAAQ;EACxB,QAAQ,QACJ,SAAA,KACA,QACE,QAAA,KAAuC,MAAM,IAC7C,QAAQ;CAChB;CACA,MAAM,eAAe,MAAM,SAAS,OAAO,MAAM,IAAI,OAAO,CAAC,MAAM,IAAI;CACvE,MAAM,gBAAgB,MAAM,UAAU,QAAQ,MAAM,IAAI,QAAQ,CAAC,MAAM,IAAI;CAC3E,MAAM,aAAa,QAAQ;CAC3B,MAAM,WAAW,SAAS;CAQ1B,MAAM,OAAO,2BANX,cAAc,CAAC,WACX,OACA,YAAY,CAAC,aACX,QACA,KAAK,IAAI,eAAe,MAAM,KAAK,IAAI,MAAM,SAC7C,KAAK,IAAI,gBAAgB,MAAM,MAAM,IAAI,MAAM,UAExC,eAAgB,gBAAgB,OAAO,QAAS,OAAO,QACpE,QACA,GACF;CAOA,OAAO;EAAE,GANQ,+BACf;GAAE,GAAG,OAAO,QAAQ,KAAK,QAAQ,MAAM;GAAG,GAAG,QAAQ,SAAS,KAAK,SAAS,MAAM;EAAE,GACpF,WACA,MACA,SAEU;EAAU,GAAG;CAAK;AAChC;AASA,IAAa,4BAAA;AACb,IAAa,iCAAA;AACb,IAAa,gCAAgC;AAC7C,IAAa,8BAA8B;AAC3C,IAAa,wBAAwB;AACrC,IAAa,+BAA+B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { SidebarNav, SidebarNavButton, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavItem, SidebarNavSection, SidebarNavTitle, sidebarNavItemClass, sidebarNavItemStateClass, type SidebarNavItemProps, type SidebarNavProps, type SidebarNavTitleProps, } from './sidebar-nav';
|
|
1
|
+
export { SidebarNav, SidebarNavButton, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavItem, SidebarNavSection, SidebarNavTitle, sidebarNavItemClass, sidebarNavItemStateClass, type SidebarNavItemProps, type SidebarNavProps, type SidebarNavSectionProps, type SidebarNavSectionTriggerProps, type SidebarNavTitleProps, } from './sidebar-nav';
|
|
2
2
|
export { SidebarNavResizeHandle, type SidebarNavResizeHandleProps, } from './sidebar-nav-resize-handle';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/sidebar-nav/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,6BAA6B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/sidebar-nav/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,6BAA6B,CAAA"}
|
|
@@ -30,23 +30,39 @@ export declare function SidebarNavTitle<T extends ValidComponent = 'div'>(props:
|
|
|
30
30
|
/** The scrolling middle of the sidebar. */
|
|
31
31
|
export declare function SidebarNavContent(props: ComponentProps<'div'>): JSX.Element;
|
|
32
32
|
export declare function SidebarNavFooter(props: ComponentProps<'div'>): JSX.Element;
|
|
33
|
+
/** Props forwarded to a collapsible section's disclosure button. */
|
|
34
|
+
export type SidebarNavSectionTriggerProps = Omit<ComponentProps<'button'>, 'type' | 'aria-expanded' | 'onClick' | 'onKeyDown' | 'children' | 'class' | 'style'> & {
|
|
35
|
+
/** Called for Alt+ArrowUp/Down; the host owns ordering and row identity. */
|
|
36
|
+
onReorder?: (direction: 'up' | 'down') => void;
|
|
37
|
+
/** Runs before the section toggle and may cancel it with `preventDefault()`. */
|
|
38
|
+
onClick?: ComponentProps<'button'>['onClick'];
|
|
39
|
+
/** Runs before shared Alt+Arrow handling and may cancel it with `preventDefault()`. */
|
|
40
|
+
onKeyDown?: ComponentProps<'button'>['onKeyDown'];
|
|
41
|
+
};
|
|
33
42
|
/**
|
|
34
43
|
* A titled, collapsible group. Collapsible because a list of projects
|
|
35
44
|
* inevitably outgrows the column, and the user needs to put the ones they are
|
|
36
45
|
* not using away *without* them disappearing into a menu.
|
|
37
46
|
*/
|
|
38
|
-
export
|
|
47
|
+
export type SidebarNavSectionProps = ComponentProps<'div'> & {
|
|
39
48
|
label: string;
|
|
40
49
|
/** Render a disclosure control instead of a plain heading. */
|
|
41
50
|
collapsible?: boolean;
|
|
42
51
|
defaultOpen?: boolean;
|
|
52
|
+
/** Controlled disclosure state. When supplied, the host owns changes. */
|
|
53
|
+
open?: boolean;
|
|
54
|
+
/** Called for user-initiated disclosure changes. */
|
|
55
|
+
onOpenChange?: (open: boolean) => void;
|
|
56
|
+
/** Native props and reorder callbacks for the disclosure control. */
|
|
57
|
+
triggerProps?: SidebarNavSectionTriggerProps;
|
|
43
58
|
/** Count shown beside the label. */
|
|
44
59
|
count?: number;
|
|
45
60
|
/** A control at the trailing edge of the heading row. */
|
|
46
61
|
action?: JSX.Element;
|
|
47
62
|
/** Semantic heading element for a host's section hierarchy. */
|
|
48
63
|
headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
49
|
-
}
|
|
64
|
+
};
|
|
65
|
+
export declare function SidebarNavSection(props: SidebarNavSectionProps): JSX.Element;
|
|
50
66
|
export type SidebarNavItemProps<T extends ValidComponent = 'a'> = PolymorphicProps<T, {
|
|
51
67
|
class?: string;
|
|
52
68
|
active?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-nav.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/sidebar-nav/sidebar-nav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAGjE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"sidebar-nav.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/sidebar-nav/sidebar-nav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAGjE,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAanE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,IAAI,gBAAgB,CAC9E,CAAC,EACD;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAC1C,CAAA;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,eAgBrF;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,eAS5D;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,IAAI,gBAAgB,CACnF,CAAC,EACD;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CACnB,CAAA;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,cAAc,GAAG,KAAK,EAAE,KAAK,EAAE,oBA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I,GAAG,IAAI,CAAA;CACpD,CAAA;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAuF9D;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,cAAc,GAAG,GAAG,IAAI,gBAAgB,CAChF,CAAC,EACD;IACE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CACF,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,QAKrB,CAAA;AAEX,eAAO,MAAM,wBAAwB;;;CAGpC,CAAA;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,cAAc,GAAG,GAAG,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA4B3F;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,eAiB/D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cn } from "../../../lib/utils.js";
|
|
2
|
-
import { createComponent,
|
|
2
|
+
import { createComponent, insert, memo, mergeProps, spread, template } from "solid-js/web";
|
|
3
3
|
import { ChevronRight } from "lucide-solid";
|
|
4
4
|
import { Show, createSignal, splitProps } from "solid-js";
|
|
5
5
|
import { Polymorphic } from "@kobalte/core/polymorphic";
|
|
@@ -9,12 +9,18 @@ var _tmpl$2 = /*#__PURE__*/ template(`<div data-slot=sidebar-nav-content>`);
|
|
|
9
9
|
var _tmpl$3 = /*#__PURE__*/ template(`<div data-slot=sidebar-nav-footer>`);
|
|
10
10
|
var _tmpl$4 = /*#__PURE__*/ template(`<span class="min-w-0 flex-1 truncate">`);
|
|
11
11
|
var _tmpl$5 = /*#__PURE__*/ template(`<span class="shrink-0 tabular-nums text-muted-foreground">`);
|
|
12
|
-
var _tmpl$6 = /*#__PURE__*/ template(`<button
|
|
12
|
+
var _tmpl$6 = /*#__PURE__*/ template(`<button>`);
|
|
13
13
|
var _tmpl$7 = /*#__PURE__*/ template(`<span class="shrink-0 opacity-0 transition-opacity ease-out group-hover/section-header:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100">`);
|
|
14
14
|
var _tmpl$8 = /*#__PURE__*/ template(`<div class="flex flex-col gap-0.5">`);
|
|
15
15
|
var _tmpl$9 = /*#__PURE__*/ template(`<div data-slot=sidebar-nav-section><div class="group/section-header flex items-center gap-1 rounded-md px-2 py-1.5 hover:bg-sidebar-accent/60">`);
|
|
16
16
|
var _tmpl$0 = /*#__PURE__*/ template(`<span class="ms-auto flex shrink-0 items-center gap-1">`);
|
|
17
17
|
var _tmpl$1 = /*#__PURE__*/ template(`<button type=button>`);
|
|
18
|
+
function invokeEventHandler(handler, event) {
|
|
19
|
+
if (Array.isArray(handler)) {
|
|
20
|
+
const [callback, data] = handler;
|
|
21
|
+
callback(data, event);
|
|
22
|
+
} else if (typeof handler === "function") handler(event);
|
|
23
|
+
}
|
|
18
24
|
function SidebarNav(props) {
|
|
19
25
|
const [local, rest] = splitProps(props, [
|
|
20
26
|
"class",
|
|
@@ -74,23 +80,31 @@ function SidebarNavFooter(props) {
|
|
|
74
80
|
return _el$3;
|
|
75
81
|
})();
|
|
76
82
|
}
|
|
77
|
-
/**
|
|
78
|
-
* A titled, collapsible group. Collapsible because a list of projects
|
|
79
|
-
* inevitably outgrows the column, and the user needs to put the ones they are
|
|
80
|
-
* not using away *without* them disappearing into a menu.
|
|
81
|
-
*/
|
|
82
83
|
function SidebarNavSection(props) {
|
|
83
84
|
const [local, rest] = splitProps(props, [
|
|
84
85
|
"class",
|
|
85
86
|
"label",
|
|
86
87
|
"collapsible",
|
|
87
88
|
"defaultOpen",
|
|
89
|
+
"open",
|
|
90
|
+
"onOpenChange",
|
|
91
|
+
"triggerProps",
|
|
88
92
|
"count",
|
|
89
93
|
"action",
|
|
90
94
|
"headingAs",
|
|
91
95
|
"children"
|
|
92
96
|
]);
|
|
93
|
-
const [
|
|
97
|
+
const [uncontrolledOpen, setUncontrolledOpen] = createSignal(local.defaultOpen ?? true);
|
|
98
|
+
const open = () => local.open ?? uncontrolledOpen();
|
|
99
|
+
const setOpen = (next) => {
|
|
100
|
+
if (local.open === void 0) setUncontrolledOpen(next);
|
|
101
|
+
local.onOpenChange?.(next);
|
|
102
|
+
};
|
|
103
|
+
const [trigger, triggerRest] = splitProps(local.triggerProps ?? {}, [
|
|
104
|
+
"onClick",
|
|
105
|
+
"onKeyDown",
|
|
106
|
+
"onReorder"
|
|
107
|
+
]);
|
|
94
108
|
const heading = [
|
|
95
109
|
createComponent(Show, {
|
|
96
110
|
get when() {
|
|
@@ -142,9 +156,27 @@ function SidebarNavSection(props) {
|
|
|
142
156
|
fallback: heading,
|
|
143
157
|
get children() {
|
|
144
158
|
var _el$8 = _tmpl$6();
|
|
145
|
-
_el$8
|
|
159
|
+
spread(_el$8, mergeProps(triggerRest, {
|
|
160
|
+
"type": "button",
|
|
161
|
+
get ["aria-expanded"]() {
|
|
162
|
+
return open();
|
|
163
|
+
},
|
|
164
|
+
"onClick": (event) => {
|
|
165
|
+
invokeEventHandler(trigger.onClick, event);
|
|
166
|
+
if (event.defaultPrevented) return;
|
|
167
|
+
setOpen(!open());
|
|
168
|
+
},
|
|
169
|
+
"onKeyDown": (event) => {
|
|
170
|
+
invokeEventHandler(trigger.onKeyDown, event);
|
|
171
|
+
if (event.defaultPrevented || !event.altKey) return;
|
|
172
|
+
if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
event.stopPropagation();
|
|
175
|
+
trigger.onReorder?.(event.key === "ArrowUp" ? "up" : "down");
|
|
176
|
+
},
|
|
177
|
+
"class": "flex min-w-0 flex-1 items-center gap-1.5 rounded-sm text-2xs font-medium tracking-wide text-sidebar-muted-foreground uppercase outline-none transition-colors ease-out hover:text-sidebar-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle"
|
|
178
|
+
}), false, true);
|
|
146
179
|
insert(_el$8, heading);
|
|
147
|
-
effect(() => setAttribute(_el$8, "aria-expanded", open()));
|
|
148
180
|
return _el$8;
|
|
149
181
|
}
|
|
150
182
|
});
|
|
@@ -228,7 +260,6 @@ function SidebarNavButton(props) {
|
|
|
228
260
|
return _el$10;
|
|
229
261
|
})();
|
|
230
262
|
}
|
|
231
|
-
delegateEvents(["click"]);
|
|
232
263
|
//#endregion
|
|
233
264
|
export { SidebarNav, SidebarNavButton, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavItem, SidebarNavSection, SidebarNavTitle, sidebarNavItemClass, sidebarNavItemStateClass };
|
|
234
265
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-nav.js","names":["PolymorphicProps","Polymorphic","ChevronRight","ComponentProps","JSX","ValidComponent","Show","createSignal","splitProps","cn","SidebarNavProps","T","class","SidebarNav","props","local","rest","_$createComponent","_$mergeProps","as","aria-label","children","SidebarNavHeader","_el$","_tmpl$","_$spread","SidebarNavTitleProps","SidebarNavTitle","SidebarNavContent","_el$2","_tmpl$2","SidebarNavFooter","_el$3","_tmpl$3","SidebarNavSection","label","collapsible","defaultOpen","count","action","Element","headingAs","open","setOpen","heading","when","_el$4","_tmpl$4","_$insert","undefined","_el$5","_tmpl$5","_el$6","_tmpl$9","_el$7","firstChild","_$memo","fallback","_el$8","_tmpl$6","$$click","value","_$effect","_$setAttribute","_el$9","_tmpl$7","_el$0","_tmpl$8","SidebarNavItemProps","active","nested","trailing","sidebarNavItemClass","join","sidebarNavItemStateClass","idle","SidebarNavItem","aria-current","data-active","_el$1","_tmpl$0","SidebarNavButton","_el$10","_tmpl$1","_$delegateEvents","_$createComponent","_$mergeProps","_$memo","_$setAttribute","_$delegateEvents"],"sources":["../../../../src/components/layout/sidebar-nav/sidebar-nav.tsx"],"sourcesContent":["import type { PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { Polymorphic } from '@kobalte/core/polymorphic'\nimport { ChevronRight } from 'lucide-solid'\nimport type { ComponentProps, JSX, ValidComponent } from 'solid-js'\nimport { Show, createSignal, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * SidebarNav.\n *\n * The secondary navigation column: the list of things inside the destination\n * the rail selected — projects, sessions, files, threads. It is a different\n * object from the rail, not a wider version of it, which is why it is a separate\n * component rather than the rail with labels on.\n *\n * Rows share one recipe with the rail's, so a row in a sidebar and a row in a\n * rail read as the same kind of thing at the same density. That recipe is\n * exactly KiroCrew's nav row: `text-sm font-medium`, `gap-2.5`, `px-3 py-2`,\n * `rounded-md`, `transition-colors`.\n *\n * The width comes from `--sidebar-width`. Sections collapse by default only when\n * the caller says so, because a section that starts collapsed and holds the\n * user's own work is a hidden default.\n */\nexport type SidebarNavProps<T extends ValidComponent = 'nav'> = PolymorphicProps<\n T,\n { class?: string; 'aria-label'?: string }\n>\n\nexport function SidebarNav<T extends ValidComponent = 'nav'>(props: SidebarNavProps<T>) {\n const [local, rest] = splitProps(props as SidebarNavProps, ['class', 'aria-label', 'children'])\n\n return (\n <Polymorphic\n as=\"nav\"\n aria-label={local['aria-label'] ?? 'Section'}\n class={cn(\n 'bg-sidebar text-sidebar-foreground flex h-full w-sidebar shrink-0 flex-col border-e border-sidebar-border',\n local.class\n )}\n {...(rest as ComponentProps<'nav'>)}\n >\n {local.children}\n </Polymorphic>\n )\n}\n\nexport function SidebarNavHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"sidebar-nav-header\"\n class={cn('flex h-topbar shrink-0 items-center justify-between gap-2 px-3', local.class)}\n {...rest}\n />\n )\n}\n\nexport type SidebarNavTitleProps<T extends ValidComponent = 'div'> = PolymorphicProps<\n T,\n { class?: string }\n>\n\nexport function SidebarNavTitle<T extends ValidComponent = 'div'>(props: SidebarNavTitleProps<T>) {\n const [local, rest] = splitProps(props as SidebarNavTitleProps, ['class'])\n return (\n <Polymorphic\n as=\"div\"\n data-slot=\"sidebar-nav-title\"\n class={cn('truncate text-sm font-semibold tracking-tight', local.class)}\n {...(rest as ComponentProps<'div'>)}\n />\n )\n}\n\n/** The scrolling middle of the sidebar. */\nexport function SidebarNavContent(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"sidebar-nav-content\"\n class={cn('flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 py-2', local.class)}\n {...rest}\n />\n )\n}\n\nexport function SidebarNavFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"sidebar-nav-footer\"\n class={cn('flex shrink-0 items-center gap-1 border-t border-sidebar-border p-2', local.class)}\n {...rest}\n />\n )\n}\n\n/**\n * A titled, collapsible group. Collapsible because a list of projects\n * inevitably outgrows the column, and the user needs to put the ones they are\n * not using away *without* them disappearing into a menu.\n */\nexport function SidebarNavSection(\n props: ComponentProps<'div'> & {\n label: string\n /** Render a disclosure control instead of a plain heading. */\n collapsible?: boolean\n defaultOpen?: boolean\n /** Count shown beside the label. */\n count?: number\n /** A control at the trailing edge of the heading row. */\n action?: JSX.Element\n /** Semantic heading element for a host's section hierarchy. */\n headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n }\n) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'label',\n 'collapsible',\n 'defaultOpen',\n 'count',\n 'action',\n 'headingAs',\n 'children',\n ])\n const [open, setOpen] = createSignal(local.defaultOpen ?? true)\n\n const heading = (\n <>\n <Show when={local.collapsible}>\n <ChevronRight\n aria-hidden=\"true\"\n class={cn('size-3.5 shrink-0 text-muted-foreground transition-transform ease-out', {\n 'rotate-90': open(),\n })}\n />\n </Show>\n <span class=\"min-w-0 flex-1 truncate\">{local.label}</span>\n <Show when={local.count !== undefined}>\n <span class=\"shrink-0 tabular-nums text-muted-foreground\">{local.count}</span>\n </Show>\n </>\n )\n\n return (\n <div data-slot=\"sidebar-nav-section\" class={cn('flex flex-col gap-0.5', local.class)} {...rest}>\n <div class=\"group/section-header flex items-center gap-1 rounded-md px-2 py-1.5 hover:bg-sidebar-accent/60\">\n <Polymorphic\n as={local.headingAs ?? 'div'}\n aria-label={local.headingAs ? local.label : undefined}\n class=\"flex min-w-0 flex-1 items-center gap-1.5 text-2xs font-medium tracking-wide text-sidebar-muted-foreground uppercase\"\n >\n <Show when={local.collapsible} fallback={heading}>\n <button\n type=\"button\"\n aria-expanded={open()}\n onClick={() => setOpen((value) => !value)}\n class=\"flex min-w-0 flex-1 items-center gap-1.5 rounded-sm text-2xs font-medium tracking-wide text-sidebar-muted-foreground uppercase outline-none transition-colors ease-out hover:text-sidebar-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n {heading}\n </button>\n </Show>\n </Polymorphic>\n <Show when={local.action}>\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/section-header:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100\">\n {local.action}\n </span>\n </Show>\n </div>\n <Show when={!local.collapsible || open()}>\n <div class=\"flex flex-col gap-0.5\">{local.children}</div>\n </Show>\n </div>\n )\n}\n\nexport type SidebarNavItemProps<T extends ValidComponent = 'a'> = PolymorphicProps<\n T,\n {\n class?: string\n active?: boolean\n /** Indent one level, for a child row such as a branch under a project. */\n nested?: boolean\n /** Trailing slot: a count, a status dot, a hover action. */\n trailing?: JSX.Element\n }\n>\n\n/** A sidebar row. Exported classes, so a caller's own element can match it. */\nexport const sidebarNavItemClass = [\n 'group/nav-item relative flex min-w-0 items-center gap-2.5 rounded-md px-3 py-2 text-sm font-medium',\n 'whitespace-nowrap transition-colors ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n '[&_svg]:size-4 [&_svg]:shrink-0',\n].join(' ')\n\nexport const sidebarNavItemStateClass = {\n active: 'bg-primary-subtle text-foreground',\n idle: 'text-muted-foreground hover:bg-surface-hover hover:text-foreground',\n}\n\nexport function SidebarNavItem<T extends ValidComponent = 'a'>(props: SidebarNavItemProps<T>) {\n const [local, rest] = splitProps(props as SidebarNavItemProps, [\n 'class',\n 'active',\n 'nested',\n 'trailing',\n 'children',\n ])\n\n return (\n <Polymorphic\n as=\"a\"\n aria-current={local.active ? 'page' : undefined}\n data-active={local.active ? '' : undefined}\n class={cn(\n sidebarNavItemClass,\n local.active ? sidebarNavItemStateClass.active : sidebarNavItemStateClass.idle,\n { 'ps-8': local.nested },\n local.class\n )}\n {...(rest as ComponentProps<'a'>)}\n >\n {local.children}\n <Show when={local.trailing}>\n <span class=\"ms-auto flex shrink-0 items-center gap-1\">{local.trailing}</span>\n </Show>\n </Polymorphic>\n )\n}\n\n/** A row that is a button rather than a destination — \"New project\". */\nexport function SidebarNavButton(props: ComponentProps<'button'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <button\n type=\"button\"\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'w-full disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </button>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,SAAgBa,WAA6CC,OAA2B;CACtF,MAAM,CAACC,OAAOC,QAAQR,WAAWM,OAA0B;EAAC;EAAS;EAAc;CAAU,CAAC;CAE9F,OAAAG,gBACGhB,aAAWiB,WAAA;EACVC,IAAE;EAAA,KAAA,gBAAA;GAAA,OACUJ,MAAM,iBAAiB;EAAS;EAAA,KAAA,WAAA;GAAA,OACrCN,GACL,6GACAM,MAAMH,KACR;EAAC;CAAA,GACII,MAA6B,EAAA,IAAAK,WAAA;EAAA,OAEjCN,MAAMM;CAAQ,EAAA,CAAA,CAAA;AAGrB;AAEA,SAAgBC,iBAAiBR,OAA8B;CAC7D,MAAM,CAACC,OAAOC,QAAQR,WAAW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AAO,GACvBvD,MAAMH,KACR;EAAC;CAAA,GACII,MAA2B,EAAA,IAAAK,WAAA;EAAA,OAAA,CAAAmC,WAE/BzC,MAAMM,QAAQ,GAAAJ,gBACdX,MAAI;GAAA,IAACuC,OAAI;IAAA,OAAE9B,MAAMwD;GAAQ;GAAA,IAAAlD,WAAA;IAAA,IAAA0D,QAAAC,QAAA;IAAAhC,OAAA+B,aACgChE,MAAMwD,QAAQ;IAAA,OAAAQ;GAAA;EAAA,CAAA,CAAA;CAAA,EAAA,CAAA,CAAA;AAI9E;;AAGA,SAAgBE,iBAAiBnE,OAAiC;CAChE,MAAM,CAACC,OAAOC,QAAQR,WAAWM,OAAO,CAAC,SAAS,UAAU,CAAC;CAE7D,cAAA;EAAA,IAAAoE,SAAAC,QAAA;EAAA1D,OAAAyD,QAAAhE,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWT,GACL+D,qBACAE,yBAAyBC,MACzB,2DACA5D,MAAMH,KACR;EAAC,EAAA,GACGI,IAAI,GAAA,OAAA,IAAA;EAAAgC,OAAAkC,cAEPnE,MAAMM,QAAQ;EAAA,OAAA6D;CAAA,EAAA,CAAA;AAGrB;AAACE,eAAA,CAAA,OAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"sidebar-nav.js","names":["PolymorphicProps","Polymorphic","ChevronRight","ComponentProps","JSX","ValidComponent","Show","createSignal","splitProps","cn","invokeEventHandler","handler","event","Event","Array","isArray","callback","data","SidebarNavProps","T","class","SidebarNav","props","local","rest","_$createComponent","_$mergeProps","as","aria-label","children","SidebarNavHeader","_el$","_tmpl$","_$spread","SidebarNavTitleProps","SidebarNavTitle","SidebarNavContent","_el$2","_tmpl$2","SidebarNavFooter","_el$3","_tmpl$3","SidebarNavSectionTriggerProps","Omit","onReorder","direction","onClick","onKeyDown","SidebarNavSectionProps","label","collapsible","defaultOpen","open","onOpenChange","triggerProps","count","action","Element","headingAs","SidebarNavSection","uncontrolledOpen","setUncontrolledOpen","setOpen","next","undefined","trigger","triggerRest","heading","when","_el$4","_tmpl$4","_$insert","_el$5","_tmpl$5","_el$6","_tmpl$9","_el$7","firstChild","_$memo","fallback","_el$8","_tmpl$6","aria-expanded","defaultPrevented","altKey","key","preventDefault","stopPropagation","_el$9","_tmpl$7","_el$0","_tmpl$8","SidebarNavItemProps","active","nested","trailing","sidebarNavItemClass","join","sidebarNavItemStateClass","idle","SidebarNavItem","aria-current","data-active","_el$1","_tmpl$0","SidebarNavButton","_el$10","_tmpl$1","_$createComponent","_$mergeProps","_$memo"],"sources":["../../../../src/components/layout/sidebar-nav/sidebar-nav.tsx"],"sourcesContent":["import type { PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { Polymorphic } from '@kobalte/core/polymorphic'\nimport { ChevronRight } from 'lucide-solid'\nimport type { ComponentProps, JSX, ValidComponent } from 'solid-js'\nimport { Show, createSignal, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\nfunction invokeEventHandler(handler: unknown, event: Event) {\n if (Array.isArray(handler)) {\n const [callback, data] = handler as [(data: unknown, event: Event) => void, unknown]\n callback(data, event)\n } else if (typeof handler === 'function') {\n ;(handler as (event: Event) => void)(event)\n }\n}\n\n/**\n * SidebarNav.\n *\n * The secondary navigation column: the list of things inside the destination\n * the rail selected — projects, sessions, files, threads. It is a different\n * object from the rail, not a wider version of it, which is why it is a separate\n * component rather than the rail with labels on.\n *\n * Rows share one recipe with the rail's, so a row in a sidebar and a row in a\n * rail read as the same kind of thing at the same density. That recipe is\n * exactly KiroCrew's nav row: `text-sm font-medium`, `gap-2.5`, `px-3 py-2`,\n * `rounded-md`, `transition-colors`.\n *\n * The width comes from `--sidebar-width`. Sections collapse by default only when\n * the caller says so, because a section that starts collapsed and holds the\n * user's own work is a hidden default.\n */\nexport type SidebarNavProps<T extends ValidComponent = 'nav'> = PolymorphicProps<\n T,\n { class?: string; 'aria-label'?: string }\n>\n\nexport function SidebarNav<T extends ValidComponent = 'nav'>(props: SidebarNavProps<T>) {\n const [local, rest] = splitProps(props as SidebarNavProps, ['class', 'aria-label', 'children'])\n\n return (\n <Polymorphic\n as=\"nav\"\n aria-label={local['aria-label'] ?? 'Section'}\n class={cn(\n 'bg-sidebar text-sidebar-foreground flex h-full w-sidebar shrink-0 flex-col border-e border-sidebar-border',\n local.class\n )}\n {...(rest as ComponentProps<'nav'>)}\n >\n {local.children}\n </Polymorphic>\n )\n}\n\nexport function SidebarNavHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"sidebar-nav-header\"\n class={cn('flex h-topbar shrink-0 items-center justify-between gap-2 px-3', local.class)}\n {...rest}\n />\n )\n}\n\nexport type SidebarNavTitleProps<T extends ValidComponent = 'div'> = PolymorphicProps<\n T,\n { class?: string }\n>\n\nexport function SidebarNavTitle<T extends ValidComponent = 'div'>(props: SidebarNavTitleProps<T>) {\n const [local, rest] = splitProps(props as SidebarNavTitleProps, ['class'])\n return (\n <Polymorphic\n as=\"div\"\n data-slot=\"sidebar-nav-title\"\n class={cn('truncate text-sm font-semibold tracking-tight', local.class)}\n {...(rest as ComponentProps<'div'>)}\n />\n )\n}\n\n/** The scrolling middle of the sidebar. */\nexport function SidebarNavContent(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"sidebar-nav-content\"\n class={cn('flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 py-2', local.class)}\n {...rest}\n />\n )\n}\n\nexport function SidebarNavFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"sidebar-nav-footer\"\n class={cn('flex shrink-0 items-center gap-1 border-t border-sidebar-border p-2', local.class)}\n {...rest}\n />\n )\n}\n\n/** Props forwarded to a collapsible section's disclosure button. */\nexport type SidebarNavSectionTriggerProps = Omit<\n ComponentProps<'button'>,\n 'type' | 'aria-expanded' | 'onClick' | 'onKeyDown' | 'children' | 'class' | 'style'\n> & {\n /** Called for Alt+ArrowUp/Down; the host owns ordering and row identity. */\n onReorder?: (direction: 'up' | 'down') => void\n /** Runs before the section toggle and may cancel it with `preventDefault()`. */\n onClick?: ComponentProps<'button'>['onClick']\n /** Runs before shared Alt+Arrow handling and may cancel it with `preventDefault()`. */\n onKeyDown?: ComponentProps<'button'>['onKeyDown']\n}\n\n/**\n * A titled, collapsible group. Collapsible because a list of projects\n * inevitably outgrows the column, and the user needs to put the ones they are\n * not using away *without* them disappearing into a menu.\n */\nexport type SidebarNavSectionProps = ComponentProps<'div'> & {\n label: string\n /** Render a disclosure control instead of a plain heading. */\n collapsible?: boolean\n defaultOpen?: boolean\n /** Controlled disclosure state. When supplied, the host owns changes. */\n open?: boolean\n /** Called for user-initiated disclosure changes. */\n onOpenChange?: (open: boolean) => void\n /** Native props and reorder callbacks for the disclosure control. */\n triggerProps?: SidebarNavSectionTriggerProps\n /** Count shown beside the label. */\n count?: number\n /** A control at the trailing edge of the heading row. */\n action?: JSX.Element\n /** Semantic heading element for a host's section hierarchy. */\n headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'\n}\n\nexport function SidebarNavSection(props: SidebarNavSectionProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'label',\n 'collapsible',\n 'defaultOpen',\n 'open',\n 'onOpenChange',\n 'triggerProps',\n 'count',\n 'action',\n 'headingAs',\n 'children',\n ])\n const [uncontrolledOpen, setUncontrolledOpen] = createSignal(local.defaultOpen ?? true)\n const open = () => local.open ?? uncontrolledOpen()\n const setOpen = (next: boolean) => {\n if (local.open === undefined) setUncontrolledOpen(next)\n local.onOpenChange?.(next)\n }\n\n const [trigger, triggerRest] = splitProps(local.triggerProps ?? {}, [\n 'onClick',\n 'onKeyDown',\n 'onReorder',\n ])\n\n const heading = (\n <>\n <Show when={local.collapsible}>\n <ChevronRight\n aria-hidden=\"true\"\n class={cn('size-3.5 shrink-0 text-muted-foreground transition-transform ease-out', {\n 'rotate-90': open(),\n })}\n />\n </Show>\n <span class=\"min-w-0 flex-1 truncate\">{local.label}</span>\n <Show when={local.count !== undefined}>\n <span class=\"shrink-0 tabular-nums text-muted-foreground\">{local.count}</span>\n </Show>\n </>\n )\n\n return (\n <div data-slot=\"sidebar-nav-section\" class={cn('flex flex-col gap-0.5', local.class)} {...rest}>\n <div class=\"group/section-header flex items-center gap-1 rounded-md px-2 py-1.5 hover:bg-sidebar-accent/60\">\n <Polymorphic\n as={local.headingAs ?? 'div'}\n aria-label={local.headingAs ? local.label : undefined}\n class=\"flex min-w-0 flex-1 items-center gap-1.5 text-2xs font-medium tracking-wide text-sidebar-muted-foreground uppercase\"\n >\n <Show when={local.collapsible} fallback={heading}>\n <button\n {...(triggerRest as ComponentProps<'button'>)}\n type=\"button\"\n aria-expanded={open()}\n onClick={(event) => {\n invokeEventHandler(trigger.onClick, event)\n if (event.defaultPrevented) return\n setOpen(!open())\n }}\n onKeyDown={(event) => {\n invokeEventHandler(trigger.onKeyDown, event)\n if (event.defaultPrevented || !event.altKey) return\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return\n event.preventDefault()\n event.stopPropagation()\n trigger.onReorder?.(event.key === 'ArrowUp' ? 'up' : 'down')\n }}\n class=\"flex min-w-0 flex-1 items-center gap-1.5 rounded-sm text-2xs font-medium tracking-wide text-sidebar-muted-foreground uppercase outline-none transition-colors ease-out hover:text-sidebar-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n {heading}\n </button>\n </Show>\n </Polymorphic>\n <Show when={local.action}>\n <span class=\"shrink-0 opacity-0 transition-opacity ease-out group-hover/section-header:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100\">\n {local.action}\n </span>\n </Show>\n </div>\n <Show when={!local.collapsible || open()}>\n <div class=\"flex flex-col gap-0.5\">{local.children}</div>\n </Show>\n </div>\n )\n}\n\nexport type SidebarNavItemProps<T extends ValidComponent = 'a'> = PolymorphicProps<\n T,\n {\n class?: string\n active?: boolean\n /** Indent one level, for a child row such as a branch under a project. */\n nested?: boolean\n /** Trailing slot: a count, a status dot, a hover action. */\n trailing?: JSX.Element\n }\n>\n\n/** A sidebar row. Exported classes, so a caller's own element can match it. */\nexport const sidebarNavItemClass = [\n 'group/nav-item relative flex min-w-0 items-center gap-2.5 rounded-md px-3 py-2 text-sm font-medium',\n 'whitespace-nowrap transition-colors ease-out outline-none select-none',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n '[&_svg]:size-4 [&_svg]:shrink-0',\n].join(' ')\n\nexport const sidebarNavItemStateClass = {\n active: 'bg-primary-subtle text-foreground',\n idle: 'text-muted-foreground hover:bg-surface-hover hover:text-foreground',\n}\n\nexport function SidebarNavItem<T extends ValidComponent = 'a'>(props: SidebarNavItemProps<T>) {\n const [local, rest] = splitProps(props as SidebarNavItemProps, [\n 'class',\n 'active',\n 'nested',\n 'trailing',\n 'children',\n ])\n\n return (\n <Polymorphic\n as=\"a\"\n aria-current={local.active ? 'page' : undefined}\n data-active={local.active ? '' : undefined}\n class={cn(\n sidebarNavItemClass,\n local.active ? sidebarNavItemStateClass.active : sidebarNavItemStateClass.idle,\n { 'ps-8': local.nested },\n local.class\n )}\n {...(rest as ComponentProps<'a'>)}\n >\n {local.children}\n <Show when={local.trailing}>\n <span class=\"ms-auto flex shrink-0 items-center gap-1\">{local.trailing}</span>\n </Show>\n </Polymorphic>\n )\n}\n\n/** A row that is a button rather than a destination — \"New project\". */\nexport function SidebarNavButton(props: ComponentProps<'button'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <button\n type=\"button\"\n class={cn(\n sidebarNavItemClass,\n sidebarNavItemStateClass.idle,\n 'w-full disabled:pointer-events-none disabled:opacity-50',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </button>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAOA,SAASU,mBAAmBC,SAAkBC,OAAc;CAC1D,IAAIE,MAAMC,QAAQJ,OAAO,GAAG;EAC1B,MAAM,CAAC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zE,MAAMsE,SAASK,yBAAyBL,SAASK,yBAAyBC,MAC1E,EAAE,QAAQ5E,MAAMuE,OAAO,GACvBvE,MAAMH,KACR;EAAC;CAAA,GACII,MAA2B,EAAA,IAAAK,WAAA;EAAA,OAAA,CAAAiD,WAE/BvD,MAAMM,QAAQ,GAAAJ,gBACdnB,MAAI;GAAA,IAAC8D,OAAI;IAAA,OAAE7C,MAAMwE;GAAQ;GAAA,IAAAlE,WAAA;IAAA,IAAA0E,QAAAC,QAAA;IAAAjC,OAAAgC,aACgChF,MAAMwE,QAAQ;IAAA,OAAAQ;GAAA;EAAA,CAAA,CAAA;CAAA,EAAA,CAAA,CAAA;AAI9E;;AAGA,SAAgBE,iBAAiBnF,OAAiC;CAChE,MAAM,CAACC,OAAOC,QAAQhB,WAAWc,OAAO,CAAC,SAAS,UAAU,CAAC;CAE7D,cAAA;EAAA,IAAAoF,SAAAC,QAAA;EAAA1E,OAAAyE,QAAAhF,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWjB,GACLuF,qBACAE,yBAAyBC,MACzB,2DACA5E,MAAMH,KACR;EAAC,EAAA,GACGI,IAAI,GAAA,OAAA,IAAA;EAAA+C,OAAAmC,cAEPnF,MAAMM,QAAQ;EAAA,OAAA6E;CAAA,EAAA,CAAA;AAGrB"}
|
|
@@ -2,4 +2,5 @@ export { AppearancePanel, type AppearancePanelProps } from './appearance-panel';
|
|
|
2
2
|
export { ThemePicker, ThemePreview, ThemeSwatch, type ThemePickerProps, type ThemePreviewProps, type ThemeSwatchProps, } from './theme-picker';
|
|
3
3
|
export { ThemeProvider, defaultThemeSelection, inlineScriptLiteral, resolvedDensity, themeScript, useTheme, type ThemeContextValue, type ThemeDensity, type ThemeProviderProps, type ThemeSelection, } from './theme-provider';
|
|
4
4
|
export { ThemeToggle, type ThemeToggleProps } from './theme-toggle';
|
|
5
|
+
export { ThemeModeToggle, type ThemeModeToggleProps } from './theme-mode-toggle';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -2,4 +2,5 @@ import { ThemePicker, ThemePreview, ThemeSwatch } from "./theme-picker.js";
|
|
|
2
2
|
import { ThemeProvider, defaultThemeSelection, inlineScriptLiteral, resolvedDensity, themeScript, useTheme } from "./theme-provider.js";
|
|
3
3
|
import { AppearancePanel } from "./appearance-panel.js";
|
|
4
4
|
import { ThemeToggle } from "./theme-toggle.js";
|
|
5
|
-
|
|
5
|
+
import { ThemeModeToggle } from "./theme-mode-toggle.js";
|
|
6
|
+
export { AppearancePanel, ThemeModeToggle, ThemePicker, ThemePreview, ThemeProvider, ThemeSwatch, ThemeToggle, defaultThemeSelection, inlineScriptLiteral, resolvedDensity, themeScript, useTheme };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentProps } from 'solid-js';
|
|
2
|
+
import { ToggleGroup } from '../ui/toggle-group/toggle-group';
|
|
3
|
+
/** Controlled appearance selection for hosts that own their preference storage. */
|
|
4
|
+
export type ThemeModeToggleProps = Omit<ComponentProps<typeof ToggleGroup>, 'children' | 'value' | 'onChange' | 'multiple'> & {
|
|
5
|
+
mode: 'light' | 'dark' | 'system';
|
|
6
|
+
onModeChange: (mode: 'light' | 'dark' | 'system') => void;
|
|
7
|
+
withLabels?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function ThemeModeToggle(props: ThemeModeToggleProps): import("solid-js").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=theme-mode-toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-mode-toggle.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-mode-toggle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAmB,MAAM,iCAAiC,CAAA;AAS9E,mFAAmF;AACnF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,cAAc,CAAC,OAAO,WAAW,CAAC,EAClC,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAC/C,GAAG;IACF,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACjC,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,KAAK,IAAI,CAAA;IACzD,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,kCAiC1D"}
|