@leavepulse/ui 0.42.0 → 0.43.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/dist/assets/{LpCommandPalette-Esv0a-gS.css → LpCommandPalette-s_kKuCRf.css} +21 -21
- package/dist/chunks/{LpAddressInput-CMjaPQVw.js → LpAddressInput-B-Zvxsn7.js} +1 -1
- package/dist/chunks/{LpAppShell-Bcv6EhqU.js → LpAppShell-BGQVIY-3.js} +1 -1
- package/dist/chunks/{LpConfirmDialog-BNAvOR24.js → LpConfirmDialog-Q-bxff8z.js} +1 -1
- package/dist/chunks/{LpDrawer-DgaS2s2i.js → LpDrawer-BZ6k3hvo.js} +3 -3
- package/dist/chunks/{LpLightbox-oLqyjOln.js → LpLightbox-2sYVMY-S.js} +12 -4
- package/dist/chunks/{LpMediaGallery-Cid7PGYx.js → LpMediaGallery-FF-NquIo.js} +1 -1
- package/dist/chunks/{LpModal-8bja5bWS.js → LpModal-Bt0pQCI_.js} +2 -2
- package/dist/chunks/{LpModalNav-w9kfwHqO.js → LpModalNav-YaifHrXC.js} +2 -2
- package/dist/chunks/{LpSidebar-DlTn5nXc.js → LpSidebar-ClBUwoEz.js} +1 -1
- package/dist/components/LpAddressInput.vue.js +1 -1
- package/dist/components/LpAppShell.vue.js +1 -1
- package/dist/components/LpCommandPalette.vue.js +19 -72
- package/dist/components/LpConfirmDialog.vue.js +1 -1
- package/dist/components/LpDrawer.vue.js +1 -1
- package/dist/components/LpLightbox.vue.js +1 -1
- package/dist/components/LpMediaGallery.vue.js +1 -1
- package/dist/components/LpModal.vue.js +1 -1
- package/dist/components/LpModalNav.vue.js +1 -1
- package/dist/components/LpShortcutsDialog.vue.js +1 -1
- package/dist/components/LpSidebar.vue.js +1 -1
- package/dist/components/commandSearch.js +66 -0
- package/dist/components/modalDepth.js +3 -2
- package/dist/index.js +13 -9
- package/package.json +3 -3
- package/src/components/LpCommandPalette.vue +18 -110
- package/src/components/LpDrawer.vue +3 -3
- package/src/components/LpLightbox.vue +11 -5
- package/src/components/LpModal.vue +2 -2
- package/src/components/commandSearch.ts +92 -0
- package/src/components/modalDepth.ts +4 -48
- package/src/index.ts +2 -0
- package/src/tokens/tokens.css +13 -19
- package/dist/component-names.d.ts +0 -1
- package/dist/components/LayoutCanvas.vue.d.ts +0 -28
- package/dist/components/LayoutNode.vue.d.ts +0 -40
- package/dist/components/LpActionBar.vue.d.ts +0 -84
- package/dist/components/LpAddressInput.vue.d.ts +0 -70
- package/dist/components/LpAlert.vue.d.ts +0 -44
- package/dist/components/LpAppShell.vue.d.ts +0 -123
- package/dist/components/LpAutocomplete.vue.d.ts +0 -50
- package/dist/components/LpAvatar.vue.d.ts +0 -34
- package/dist/components/LpBadge.vue.d.ts +0 -20
- package/dist/components/LpBreadcrumbs.vue.d.ts +0 -32
- package/dist/components/LpButton.vue.d.ts +0 -113
- package/dist/components/LpCalendar.vue.d.ts +0 -29
- package/dist/components/LpCard.vue.d.ts +0 -60
- package/dist/components/LpChart.vue.d.ts +0 -130
- package/dist/components/LpCheckbox.vue.d.ts +0 -32
- package/dist/components/LpCodeBlock.vue.d.ts +0 -58
- package/dist/components/LpColorPicker.vue.d.ts +0 -124
- package/dist/components/LpCommandPalette.vue.d.ts +0 -206
- package/dist/components/LpConfirmDialog.vue.d.ts +0 -59
- package/dist/components/LpContextMenu.vue.d.ts +0 -44
- package/dist/components/LpDatePicker.vue.d.ts +0 -33
- package/dist/components/LpDisclosure.vue.d.ts +0 -47
- package/dist/components/LpDivider.vue.d.ts +0 -17
- package/dist/components/LpDrawer.vue.d.ts +0 -170
- package/dist/components/LpDropdownMenu.vue.d.ts +0 -23
- package/dist/components/LpDropzone.vue.d.ts +0 -90
- package/dist/components/LpEmptyState.vue.d.ts +0 -28
- package/dist/components/LpFileTree.vue.d.ts +0 -126
- package/dist/components/LpFileTreeNode.vue.d.ts +0 -62
- package/dist/components/LpFormField.vue.d.ts +0 -24
- package/dist/components/LpIcon.vue.d.ts +0 -8
- package/dist/components/LpImageEditor.vue.d.ts +0 -106
- package/dist/components/LpInfraNode.vue.d.ts +0 -65
- package/dist/components/LpInput.vue.d.ts +0 -80
- package/dist/components/LpLaneNode.vue.d.ts +0 -24
- package/dist/components/LpLightbox.vue.d.ts +0 -62
- package/dist/components/LpLink.vue.d.ts +0 -93
- package/dist/components/LpLogViewer.vue.d.ts +0 -153
- package/dist/components/LpMapPicker.vue.d.ts +0 -59
- package/dist/components/LpMediaGallery.vue.d.ts +0 -80
- package/dist/components/LpModal.vue.d.ts +0 -66
- package/dist/components/LpModalNav.vue.d.ts +0 -66
- package/dist/components/LpNotificationBell.vue.d.ts +0 -85
- package/dist/components/LpNumberField.vue.d.ts +0 -21
- package/dist/components/LpNumberFlow.vue.d.ts +0 -35
- package/dist/components/LpOtpInput.vue.d.ts +0 -39
- package/dist/components/LpPagination.vue.d.ts +0 -35
- package/dist/components/LpPasswordInput.vue.d.ts +0 -36
- package/dist/components/LpPhoneInput.vue.d.ts +0 -49
- package/dist/components/LpPie.vue.d.ts +0 -196
- package/dist/components/LpPopover.vue.d.ts +0 -34
- package/dist/components/LpProgress.vue.d.ts +0 -66
- package/dist/components/LpRadio.vue.d.ts +0 -18
- package/dist/components/LpRadioGroup.vue.d.ts +0 -26
- package/dist/components/LpRollingText.vue.d.ts +0 -33
- package/dist/components/LpScrollArea.vue.d.ts +0 -28
- package/dist/components/LpSection.vue.d.ts +0 -120
- package/dist/components/LpSegmented.vue.d.ts +0 -30
- package/dist/components/LpSelect.vue.d.ts +0 -47
- package/dist/components/LpServiceNode.vue.d.ts +0 -14
- package/dist/components/LpShift.vue.d.ts +0 -36
- package/dist/components/LpShortcutsDialog.vue.d.ts +0 -24
- package/dist/components/LpSidebar.vue.d.ts +0 -146
- package/dist/components/LpSidebarNav.vue.d.ts +0 -54
- package/dist/components/LpSkeleton.vue.d.ts +0 -16
- package/dist/components/LpSlider.vue.d.ts +0 -30
- package/dist/components/LpSparkline.vue.d.ts +0 -48
- package/dist/components/LpStat.vue.d.ts +0 -69
- package/dist/components/LpStepper.vue.d.ts +0 -36
- package/dist/components/LpSwitch.vue.d.ts +0 -42
- package/dist/components/LpTable.vue.d.ts +0 -124
- package/dist/components/LpTableOfContents.vue.d.ts +0 -19
- package/dist/components/LpTabs.vue.d.ts +0 -47
- package/dist/components/LpTextarea.vue.d.ts +0 -22
- package/dist/components/LpThemeSwitcher.vue.d.ts +0 -47
- package/dist/components/LpTilt.vue.d.ts +0 -31
- package/dist/components/LpTimeField.vue.d.ts +0 -24
- package/dist/components/LpToaster.vue.d.ts +0 -3
- package/dist/components/LpTooltip.vue.d.ts +0 -58
- package/dist/components/LpTopologyCanvas.vue.d.ts +0 -205
- package/dist/components/LpUptimeBar.vue.d.ts +0 -46
- package/dist/components/LpWaypointEdge.vue.d.ts +0 -21
- package/dist/components/actionBar.d.ts +0 -19
- package/dist/components/address.d.ts +0 -107
- package/dist/components/chart.d.ts +0 -180
- package/dist/components/codeHighlight.d.ts +0 -8
- package/dist/components/color.d.ts +0 -65
- package/dist/components/countries-data.d.ts +0 -2
- package/dist/components/countries.d.ts +0 -20
- package/dist/components/dropdown.d.ts +0 -29
- package/dist/components/fileTree.d.ts +0 -79
- package/dist/components/lightbox.d.ts +0 -24
- package/dist/components/modalDepth.d.ts +0 -15
- package/dist/components/sidebar.d.ts +0 -42
- package/dist/composables/easing.d.ts +0 -46
- package/dist/composables/useAsyncTask.d.ts +0 -18
- package/dist/composables/useClipboard.d.ts +0 -46
- package/dist/composables/useFormDraft.d.ts +0 -67
- package/dist/composables/useGlass.d.ts +0 -9
- package/dist/composables/useHotkeys.d.ts +0 -101
- package/dist/composables/useInputFilter.d.ts +0 -14
- package/dist/composables/useMergedClass.d.ts +0 -42
- package/dist/composables/usePillTransition.d.ts +0 -21
- package/dist/composables/useReveal.d.ts +0 -26
- package/dist/composables/useRovingFocus.d.ts +0 -49
- package/dist/composables/useSettled.d.ts +0 -26
- package/dist/composables/useShift.d.ts +0 -35
- package/dist/composables/useTilt.d.ts +0 -23
- package/dist/composables/useToast.d.ts +0 -41
- package/dist/composables/useZoomPan.d.ts +0 -58
- package/dist/icons.d.ts +0 -1
- package/dist/index.d.ts +0 -160
- package/dist/layout/registry.d.ts +0 -26
- package/dist/layout/tree.d.ts +0 -75
- package/dist/layout/useLayout.d.ts +0 -39
- package/dist/theme/backdrop.d.ts +0 -9
- package/dist/theme/config.d.ts +0 -16
- package/dist/theme/define.d.ts +0 -12
- package/dist/theme/presets.d.ts +0 -20
- package/dist/theme/tokens.d.ts +0 -75
- package/dist/theme/useTheme.d.ts +0 -46
package/dist/layout/tree.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export type Dir = "row" | "col";
|
|
2
|
-
export type Side = "left" | "right" | "top" | "bottom" | "center";
|
|
3
|
-
export interface Leaf {
|
|
4
|
-
kind: "leaf";
|
|
5
|
-
id: string;
|
|
6
|
-
/**
|
|
7
|
-
* Block ids stacked as tabs in this cell. A plain cell is a single-element
|
|
8
|
-
* stack; dropping onto a cell's center adds another tab. The consumer maps
|
|
9
|
-
* each id to content via the canvas slot.
|
|
10
|
-
*/
|
|
11
|
-
blocks: string[];
|
|
12
|
-
/** Index into `blocks` of the visible tab. */
|
|
13
|
-
active: number;
|
|
14
|
-
/** Flex fraction among siblings. */
|
|
15
|
-
size: number;
|
|
16
|
-
}
|
|
17
|
-
export interface Split {
|
|
18
|
-
kind: "split";
|
|
19
|
-
id: string;
|
|
20
|
-
dir: Dir;
|
|
21
|
-
size: number;
|
|
22
|
-
children: LayoutNode[];
|
|
23
|
-
}
|
|
24
|
-
export type LayoutNode = Leaf | Split;
|
|
25
|
-
/** Build a single-row layout from a flat list of block ids (one cell each). */
|
|
26
|
-
export declare function makeLayout(blocks: string[]): Split;
|
|
27
|
-
export declare function findParent(node: Split, childId: string): Split | null;
|
|
28
|
-
export declare function findLeaf(node: LayoutNode, id: string): Leaf | null;
|
|
29
|
-
export declare function countLeaves(node: LayoutNode): number;
|
|
30
|
-
/** Total blocks across all cells (a tabbed cell counts each of its tabs). */
|
|
31
|
-
export declare function countBlocks(node: LayoutNode): number;
|
|
32
|
-
/** Remove an entire cell (with all its tabs). */
|
|
33
|
-
export declare function removeLeaf(root: Split, id: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* Remove one tab from a cell. Removing the last tab removes the cell itself
|
|
36
|
-
* (unless it's the only block left in the whole layout, which is kept).
|
|
37
|
-
*/
|
|
38
|
-
export declare function removeBlock(root: Split, leafId: string, index: number): void;
|
|
39
|
-
export declare function addLeaf(root: Split, block: string, side?: Side): void;
|
|
40
|
-
/** Append a block as a new tab in the target cell and focus it. */
|
|
41
|
-
export declare function addTab(root: Split, leafId: string, block: string): void;
|
|
42
|
-
/** Switch the visible tab of a cell. */
|
|
43
|
-
export declare function setActiveTab(root: Split, leafId: string, index: number): void;
|
|
44
|
-
/**
|
|
45
|
-
* Reorder a tab within its cell, moving the block at `from` to `to`. The same
|
|
46
|
-
* block stays visible afterwards (active follows the moved block by identity,
|
|
47
|
-
* not by index). Always available — not gated by edit mode.
|
|
48
|
-
*/
|
|
49
|
-
export declare function reorderTab(root: Split, leafId: string, from: number, to: number): void;
|
|
50
|
-
/**
|
|
51
|
-
* Move an existing cell to a target. An edge side splits beside the target;
|
|
52
|
-
* `center` merges the moving cell's tabs into the target cell (and focuses
|
|
53
|
-
* the first moved tab).
|
|
54
|
-
*/
|
|
55
|
-
export declare function moveLeaf(root: Split, movingId: string, targetId: string, side: Side): void;
|
|
56
|
-
/** Splitter drag: redistribute size between two adjacent siblings. */
|
|
57
|
-
export declare function resizeAt(parent: Split, index: number, deltaFraction: number): void;
|
|
58
|
-
interface SerializedLeaf {
|
|
59
|
-
kind: "leaf";
|
|
60
|
-
blocks: string[];
|
|
61
|
-
active: number;
|
|
62
|
-
size: number;
|
|
63
|
-
/** Legacy single-block form (pre-tabs); hydrated into `blocks`. */
|
|
64
|
-
block?: string;
|
|
65
|
-
}
|
|
66
|
-
interface SerializedSplit {
|
|
67
|
-
kind: "split";
|
|
68
|
-
dir: Dir;
|
|
69
|
-
size: number;
|
|
70
|
-
children: SerializedNode[];
|
|
71
|
-
}
|
|
72
|
-
type SerializedNode = SerializedLeaf | SerializedSplit;
|
|
73
|
-
export declare function serializeLayout(root: Split): SerializedNode;
|
|
74
|
-
export declare function deserializeLayout(data: SerializedNode): Split;
|
|
75
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
import { Side, Split } from './tree';
|
|
3
|
-
export interface UseLayoutOptions {
|
|
4
|
-
/** Initial block ids, left-to-right, when no saved layout is loaded. */
|
|
5
|
-
initial: string[];
|
|
6
|
-
/** Max undo depth. */
|
|
7
|
-
historyLimit?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface UseLayout {
|
|
10
|
-
/** The live reactive tree to hand to <LayoutCanvas v-model>. */
|
|
11
|
-
layout: Ref<Split>;
|
|
12
|
-
/** Block count across all tabs, handy for "N blocks" labels and guards. */
|
|
13
|
-
count: Ref<number>;
|
|
14
|
-
canUndo: Ref<boolean>;
|
|
15
|
-
canRedo: Ref<boolean>;
|
|
16
|
-
/** Add a block: a new cell on an edge, or a tab on the last cell (center). */
|
|
17
|
-
add: (block: string, side?: Side) => void;
|
|
18
|
-
/** Add a block as a tab in a specific cell. */
|
|
19
|
-
addTab: (leafId: string, block: string) => void;
|
|
20
|
-
/** Switch the visible tab of a cell. */
|
|
21
|
-
setActive: (leafId: string, index: number) => void;
|
|
22
|
-
/** Reorder a tab within its cell (always available, not edit-gated). */
|
|
23
|
-
reorderTab: (leafId: string, from: number, to: number) => void;
|
|
24
|
-
/** Remove one tab (drops the cell when it was the last tab). */
|
|
25
|
-
removeBlock: (leafId: string, index: number) => void;
|
|
26
|
-
/** Remove an entire cell with all its tabs. */
|
|
27
|
-
remove: (leafId: string) => void;
|
|
28
|
-
move: (movingId: string, targetId: string, side: Side) => void;
|
|
29
|
-
resize: (parent: Split, index: number, deltaFraction: number) => void;
|
|
30
|
-
undo: () => void;
|
|
31
|
-
redo: () => void;
|
|
32
|
-
/** Replace the whole layout from a flat block list. */
|
|
33
|
-
reset: (blocks?: string[]) => void;
|
|
34
|
-
/** Serialize to JSON-safe data for persistence. */
|
|
35
|
-
serialize: () => unknown;
|
|
36
|
-
/** Replace the layout from previously serialized data. */
|
|
37
|
-
hydrate: (data: unknown) => void;
|
|
38
|
-
}
|
|
39
|
-
export declare function useLayout(options: UseLayoutOptions): UseLayout;
|
package/dist/theme/backdrop.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Set on <html> when backdrop-filter resolves but does not composite. */
|
|
2
|
-
export declare const NO_BACKDROP_ATTR = "data-lp-no-backdrop";
|
|
3
|
-
export declare function isBrokenBackdropEngine(nav?: Navigator): boolean;
|
|
4
|
-
/**
|
|
5
|
-
* Flag the document when backdrop-filter cannot be trusted, so the fallback
|
|
6
|
-
* rules in tokens.css can trade blur for opacity. Safe to call more than once
|
|
7
|
-
* and a no-op outside the browser.
|
|
8
|
-
*/
|
|
9
|
-
export declare function detectBackdropFilter(root?: HTMLElement): boolean;
|
package/dist/theme/config.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Split } from '../layout/tree';
|
|
2
|
-
import { TokenSet } from './tokens';
|
|
3
|
-
export declare const UI_CONFIG_VERSION = 1;
|
|
4
|
-
export interface UiConfig {
|
|
5
|
-
version: number;
|
|
6
|
-
theme: TokenSet;
|
|
7
|
-
/** Optional — apps without a composable layout omit it. */
|
|
8
|
-
layout?: Split;
|
|
9
|
-
}
|
|
10
|
-
export interface SerializedUiConfig {
|
|
11
|
-
version: number;
|
|
12
|
-
theme: TokenSet;
|
|
13
|
-
layout?: unknown;
|
|
14
|
-
}
|
|
15
|
-
export declare function serializeConfig(config: UiConfig): string;
|
|
16
|
-
export declare function parseConfig(json: string): UiConfig;
|
package/dist/theme/define.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { presets } from './presets';
|
|
2
|
-
import { ColorTokens, DensityTokens, FontTokens, ShapeTokens, SurfaceTokens, TokenSet } from './tokens';
|
|
3
|
-
export interface ThemeOverrides {
|
|
4
|
-
name?: string;
|
|
5
|
-
mode?: "dark" | "light";
|
|
6
|
-
colors?: Partial<ColorTokens>;
|
|
7
|
-
shape?: Partial<ShapeTokens>;
|
|
8
|
-
density?: Partial<DensityTokens>;
|
|
9
|
-
font?: Partial<FontTokens>;
|
|
10
|
-
surface?: Partial<SurfaceTokens>;
|
|
11
|
-
}
|
|
12
|
-
export declare function defineTheme(base: TokenSet | keyof typeof presets, overrides?: ThemeOverrides): TokenSet;
|
package/dist/theme/presets.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { TokenSet } from './tokens';
|
|
2
|
-
export declare const dark: TokenSet;
|
|
3
|
-
export declare const light: TokenSet;
|
|
4
|
-
export declare const lime: TokenSet;
|
|
5
|
-
export declare const leavepulse: TokenSet;
|
|
6
|
-
export declare const rose: TokenSet;
|
|
7
|
-
export declare const amber: TokenSet;
|
|
8
|
-
export declare const violet: TokenSet;
|
|
9
|
-
export declare const nord: TokenSet;
|
|
10
|
-
export declare const presets: {
|
|
11
|
-
readonly dark: TokenSet;
|
|
12
|
-
readonly light: TokenSet;
|
|
13
|
-
readonly lime: TokenSet;
|
|
14
|
-
readonly leavepulse: TokenSet;
|
|
15
|
-
readonly rose: TokenSet;
|
|
16
|
-
readonly amber: TokenSet;
|
|
17
|
-
readonly violet: TokenSet;
|
|
18
|
-
readonly nord: TokenSet;
|
|
19
|
-
};
|
|
20
|
-
export type PresetName = keyof typeof presets;
|
package/dist/theme/tokens.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export interface ColorTokens {
|
|
2
|
-
surface: string;
|
|
3
|
-
surfaceRaised: string;
|
|
4
|
-
surfaceSoft: string;
|
|
5
|
-
ink: string;
|
|
6
|
-
inkInverse: string;
|
|
7
|
-
muted: string;
|
|
8
|
-
mutedStrong: string;
|
|
9
|
-
brand: string;
|
|
10
|
-
brandHover: string;
|
|
11
|
-
brandSoft: string;
|
|
12
|
-
action: string;
|
|
13
|
-
actionHover: string;
|
|
14
|
-
actionSoft: string;
|
|
15
|
-
accent: string;
|
|
16
|
-
accentHover: string;
|
|
17
|
-
accentSoft: string;
|
|
18
|
-
danger: string;
|
|
19
|
-
dangerHover: string;
|
|
20
|
-
dangerSoft: string;
|
|
21
|
-
line: string;
|
|
22
|
-
lineStrong: string;
|
|
23
|
-
ring: string;
|
|
24
|
-
}
|
|
25
|
-
export interface ShapeTokens {
|
|
26
|
-
radiusControl: number;
|
|
27
|
-
radiusCard: number;
|
|
28
|
-
radiusPill: number;
|
|
29
|
-
}
|
|
30
|
-
export interface DensityTokens {
|
|
31
|
-
/** base spacing unit in px */
|
|
32
|
-
spacingUnit: number;
|
|
33
|
-
controlSm: number;
|
|
34
|
-
controlMd: number;
|
|
35
|
-
controlLg: number;
|
|
36
|
-
}
|
|
37
|
-
export interface FontTokens {
|
|
38
|
-
/** CSS font-family stack for UI text */
|
|
39
|
-
sans: string;
|
|
40
|
-
/** CSS font-family stack for numerals / code */
|
|
41
|
-
mono: string;
|
|
42
|
-
}
|
|
43
|
-
export interface SurfaceTokens {
|
|
44
|
-
/** Border width for panels/cards/controls (CSS length, e.g. "1px"). */
|
|
45
|
-
borderWidth: string;
|
|
46
|
-
/** backdrop-filter blur radius (CSS length; "0" disables glass blur). */
|
|
47
|
-
panelBlur: string;
|
|
48
|
-
/** backdrop-filter saturate (unitless or %, e.g. "100%" / "180%"). */
|
|
49
|
-
panelSaturate: string;
|
|
50
|
-
/** Overlay painted over a panel's base color ("none" or a gradient). */
|
|
51
|
-
panelOverlay: string;
|
|
52
|
-
/** Box-shadow for a raised panel (may be multi-layer for glass). */
|
|
53
|
-
panelShadow: string;
|
|
54
|
-
/** Inset highlight line for a panel ("none" or an inset box-shadow). */
|
|
55
|
-
panelInset: string;
|
|
56
|
-
}
|
|
57
|
-
export interface TokenSet {
|
|
58
|
-
/** human label, e.g. "Lime" */
|
|
59
|
-
name: string;
|
|
60
|
-
/** "dark" | "light" — drives `color-scheme` and the data-theme-mode hint */
|
|
61
|
-
mode: "dark" | "light";
|
|
62
|
-
colors: ColorTokens;
|
|
63
|
-
shape: ShapeTokens;
|
|
64
|
-
density: DensityTokens;
|
|
65
|
-
font: FontTokens;
|
|
66
|
-
/** Optional skin axis; older themes without it fall back to a flat default. */
|
|
67
|
-
surface?: SurfaceTokens;
|
|
68
|
-
}
|
|
69
|
-
/** camelCase token key → CSS custom property name. */
|
|
70
|
-
export declare const COLOR_VARS: Record<keyof ColorTokens, string>;
|
|
71
|
-
export declare const SHAPE_VARS: Record<keyof ShapeTokens, string>;
|
|
72
|
-
export declare const DENSITY_VARS: Record<keyof DensityTokens, string>;
|
|
73
|
-
export declare const FONT_VARS: Record<keyof FontTokens, string>;
|
|
74
|
-
export declare const SURFACE_VARS: Record<keyof SurfaceTokens, string>;
|
|
75
|
-
export declare const DEFAULT_SURFACE: SurfaceTokens;
|
package/dist/theme/useTheme.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ComputedRef, DeepReadonly, Ref } from 'vue';
|
|
2
|
-
import { TokenSet } from './tokens';
|
|
3
|
-
export declare function applyTheme(theme: TokenSet, root?: HTMLElement): void;
|
|
4
|
-
/** Point a circular theme reveal expands from (viewport px). */
|
|
5
|
-
export interface RevealOrigin {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
}
|
|
9
|
-
export declare function applyThemeWithTransition(theme: TokenSet, origin?: RevealOrigin, root?: HTMLElement, durationMs?: number): void;
|
|
10
|
-
export declare function serializeTheme(theme: TokenSet): string;
|
|
11
|
-
export declare function themeToCssVars(theme: TokenSet): string;
|
|
12
|
-
/** Render a theme as a complete CSS rule (default selector `:root`). */
|
|
13
|
-
export declare function themeToCssRule(theme: TokenSet, selector?: string): string;
|
|
14
|
-
/** Parse + shallow-validate a theme JSON; throws on a malformed shape. */
|
|
15
|
-
export declare function parseTheme(json: string): TokenSet;
|
|
16
|
-
export declare function bootstrapTheme(fallback: TokenSet): TokenSet;
|
|
17
|
-
export declare function cacheTheme(theme: TokenSet): void;
|
|
18
|
-
export declare const THEME_COOKIE = "lp-theme";
|
|
19
|
-
/**
|
|
20
|
-
* Resolve a theme name (as read from the `lp-theme` cookie) against a set of
|
|
21
|
-
* known themes. Returns `null` when the name is absent or unknown, so the caller
|
|
22
|
-
* can fall back to its own default.
|
|
23
|
-
*
|
|
24
|
-
* Server-side counterpart to `cacheTheme`: pair it with `themeToCssRule` to
|
|
25
|
-
* inline the right variables into `<head>` during SSR.
|
|
26
|
-
*/
|
|
27
|
-
export declare function themeFromCookie(cookieValue: string | null | undefined, themes: readonly TokenSet[]): TokenSet | null;
|
|
28
|
-
export interface UseTheme {
|
|
29
|
-
/** The active theme, kept in sync by the kit. Null until hydrated (SSR/first
|
|
30
|
-
* paint) — reactive, so a switcher binds straight to it. */
|
|
31
|
-
current: DeepReadonly<Ref<TokenSet | null>>;
|
|
32
|
-
/** The active theme's name (""="not yet hydrated"). */
|
|
33
|
-
currentName: ComputedRef<string>;
|
|
34
|
-
/** Set + persist a theme (with the circular reveal if `origin`/transition).
|
|
35
|
-
* This is the one call a switcher needs — it updates `current` too. */
|
|
36
|
-
setTheme: (theme: TokenSet, origin?: RevealOrigin) => void;
|
|
37
|
-
/** Seed the fallback (used when nothing is cached) and hydrate now. Call once
|
|
38
|
-
* at app start (client) — optional; the first useTheme() hydrates anyway. */
|
|
39
|
-
init: (fallback: TokenSet) => TokenSet;
|
|
40
|
-
apply: (theme: TokenSet) => void;
|
|
41
|
-
applyWithTransition: (theme: TokenSet, origin?: RevealOrigin) => void;
|
|
42
|
-
serialize: typeof serializeTheme;
|
|
43
|
-
parse: typeof parseTheme;
|
|
44
|
-
bootstrap: typeof bootstrapTheme;
|
|
45
|
-
}
|
|
46
|
-
export declare function useTheme(): UseTheme;
|