@custardui/custardui 1.0.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 +31 -0
- package/dist/custardui.js +16552 -0
- package/dist/custardui.js.map +1 -0
- package/dist/custardui.min.js +7 -0
- package/dist/custardui.min.js.map +1 -0
- package/dist/types/src/browser.d.ts +7 -0
- package/dist/types/src/browser.d.ts.map +1 -0
- package/dist/types/src/lib/app/ui-manager.d.ts +55 -0
- package/dist/types/src/lib/app/ui-manager.d.ts.map +1 -0
- package/dist/types/src/lib/features/adaptation/adaptation-manager.d.ts +54 -0
- package/dist/types/src/lib/features/adaptation/adaptation-manager.d.ts.map +1 -0
- package/dist/types/src/lib/features/adaptation/stores/adaptation-store.svelte.d.ts +11 -0
- package/dist/types/src/lib/features/adaptation/stores/adaptation-store.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/features/adaptation/types.d.ts +13 -0
- package/dist/types/src/lib/features/adaptation/types.d.ts.map +1 -0
- package/dist/types/src/lib/features/focus/focus-logic.d.ts +31 -0
- package/dist/types/src/lib/features/focus/focus-logic.d.ts.map +1 -0
- package/dist/types/src/lib/features/focus/services/focus-service.svelte.d.ts +37 -0
- package/dist/types/src/lib/features/focus/services/focus-service.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/features/focus/stores/focus-store.svelte.d.ts +14 -0
- package/dist/types/src/lib/features/focus/stores/focus-store.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/features/highlight/highlight-logic.d.ts +29 -0
- package/dist/types/src/lib/features/highlight/highlight-logic.d.ts.map +1 -0
- package/dist/types/src/lib/features/highlight/services/highlight-service.svelte.d.ts +20 -0
- package/dist/types/src/lib/features/highlight/services/highlight-service.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/features/highlight/services/highlight-types.d.ts +10 -0
- package/dist/types/src/lib/features/highlight/services/highlight-types.d.ts.map +1 -0
- package/dist/types/src/lib/features/notifications/stores/toast-store.svelte.d.ts +15 -0
- package/dist/types/src/lib/features/notifications/stores/toast-store.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/features/placeholder/placeholder-binder.d.ts +64 -0
- package/dist/types/src/lib/features/placeholder/placeholder-binder.d.ts.map +1 -0
- package/dist/types/src/lib/features/placeholder/placeholder-manager.d.ts +38 -0
- package/dist/types/src/lib/features/placeholder/placeholder-manager.d.ts.map +1 -0
- package/dist/types/src/lib/features/placeholder/stores/placeholder-registry-store.svelte.d.ts +17 -0
- package/dist/types/src/lib/features/placeholder/stores/placeholder-registry-store.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/features/placeholder/types.d.ts +18 -0
- package/dist/types/src/lib/features/placeholder/types.d.ts.map +1 -0
- package/dist/types/src/lib/features/render/assets.d.ts +12 -0
- package/dist/types/src/lib/features/render/assets.d.ts.map +1 -0
- package/dist/types/src/lib/features/render/render.d.ts +3 -0
- package/dist/types/src/lib/features/render/render.d.ts.map +1 -0
- package/dist/types/src/lib/features/render/types.d.ts +19 -0
- package/dist/types/src/lib/features/render/types.d.ts.map +1 -0
- package/dist/types/src/lib/features/settings/intro-manager.svelte.d.ts +30 -0
- package/dist/types/src/lib/features/settings/intro-manager.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/features/settings/types.d.ts +61 -0
- package/dist/types/src/lib/features/settings/types.d.ts.map +1 -0
- package/dist/types/src/lib/features/share/constants.d.ts +4 -0
- package/dist/types/src/lib/features/share/constants.d.ts.map +1 -0
- package/dist/types/src/lib/features/share/share-logic.d.ts +36 -0
- package/dist/types/src/lib/features/share/share-logic.d.ts.map +1 -0
- package/dist/types/src/lib/features/share/stores/share-store.svelte.d.ts +24 -0
- package/dist/types/src/lib/features/share/stores/share-store.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/features/share/types.d.ts +8 -0
- package/dist/types/src/lib/features/share/types.d.ts.map +1 -0
- package/dist/types/src/lib/features/tabs/types.d.ts +31 -0
- package/dist/types/src/lib/features/tabs/types.d.ts.map +1 -0
- package/dist/types/src/lib/features/toggles/types.d.ts +16 -0
- package/dist/types/src/lib/features/toggles/types.d.ts.map +1 -0
- package/dist/types/src/lib/features/url/url-action-handler.d.ts +22 -0
- package/dist/types/src/lib/features/url/url-action-handler.d.ts.map +1 -0
- package/dist/types/src/lib/features/url/url-action-router.svelte.d.ts +26 -0
- package/dist/types/src/lib/features/url/url-action-router.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/features/url/url-state-manager.d.ts +67 -0
- package/dist/types/src/lib/features/url/url-state-manager.d.ts.map +1 -0
- package/dist/types/src/lib/registry.d.ts +8 -0
- package/dist/types/src/lib/registry.d.ts.map +1 -0
- package/dist/types/src/lib/runtime.svelte.d.ts +73 -0
- package/dist/types/src/lib/runtime.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/stores/active-state-store.svelte.d.ts +144 -0
- package/dist/types/src/lib/stores/active-state-store.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/stores/derived-store.svelte.d.ts +16 -0
- package/dist/types/src/lib/stores/derived-store.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/stores/element-store.svelte.d.ts +49 -0
- package/dist/types/src/lib/stores/element-store.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/stores/ui-store.svelte.d.ts +29 -0
- package/dist/types/src/lib/stores/ui-store.svelte.d.ts.map +1 -0
- package/dist/types/src/lib/types/config.d.ts +38 -0
- package/dist/types/src/lib/types/config.d.ts.map +1 -0
- package/dist/types/src/lib/types/index.d.ts +8 -0
- package/dist/types/src/lib/types/index.d.ts.map +1 -0
- package/dist/types/src/lib/types/state.d.ts +16 -0
- package/dist/types/src/lib/types/state.d.ts.map +1 -0
- package/dist/types/src/lib/utils/clipboard-utils.d.ts +7 -0
- package/dist/types/src/lib/utils/clipboard-utils.d.ts.map +1 -0
- package/dist/types/src/lib/utils/dom-element-locator.d.ts +30 -0
- package/dist/types/src/lib/utils/dom-element-locator.d.ts.map +1 -0
- package/dist/types/src/lib/utils/init-utils.d.ts +18 -0
- package/dist/types/src/lib/utils/init-utils.d.ts.map +1 -0
- package/dist/types/src/lib/utils/persistence.d.ts +34 -0
- package/dist/types/src/lib/utils/persistence.d.ts.map +1 -0
- package/dist/types/src/lib/utils/scroll-utils.d.ts +27 -0
- package/dist/types/src/lib/utils/scroll-utils.d.ts.map +1 -0
- package/dist/types/src/lib/utils/url-utils.d.ts +8 -0
- package/dist/types/src/lib/utils/url-utils.d.ts.map +1 -0
- package/dist/types/tests/functional/fingerprint-compatibility.test.d.ts +2 -0
- package/dist/types/tests/functional/fingerprint-compatibility.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/adaptation/adaptation-manager.test.d.ts +2 -0
- package/dist/types/tests/lib/features/adaptation/adaptation-manager.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/adaptation/stores/adaptation-store.test.d.ts +2 -0
- package/dist/types/tests/lib/features/adaptation/stores/adaptation-store.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/focus/focus-logic.test.d.ts +2 -0
- package/dist/types/tests/lib/features/focus/focus-logic.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/focus/focus-store.test.d.ts +2 -0
- package/dist/types/tests/lib/features/focus/focus-store.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/highlight/highlight-logic.test.d.ts +2 -0
- package/dist/types/tests/lib/features/highlight/highlight-logic.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/notifications/stores/toast-store.test.d.ts +2 -0
- package/dist/types/tests/lib/features/notifications/stores/toast-store.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/placeholder/placeholder-binder.test.d.ts +2 -0
- package/dist/types/tests/lib/features/placeholder/placeholder-binder.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/placeholder/placeholder-manager.test.d.ts +2 -0
- package/dist/types/tests/lib/features/placeholder/placeholder-manager.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/settings/intro-manager.test.d.ts +2 -0
- package/dist/types/tests/lib/features/settings/intro-manager.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/share/share-logic.test.d.ts +2 -0
- package/dist/types/tests/lib/features/share/share-logic.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/share/share-store.test.d.ts +2 -0
- package/dist/types/tests/lib/features/share/share-store.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/url/url-action-handler.test.d.ts +2 -0
- package/dist/types/tests/lib/features/url/url-action-handler.test.d.ts.map +1 -0
- package/dist/types/tests/lib/features/url/url-state-manager.test.d.ts +2 -0
- package/dist/types/tests/lib/features/url/url-state-manager.test.d.ts.map +1 -0
- package/dist/types/tests/lib/services/url-action-router.test.d.ts +2 -0
- package/dist/types/tests/lib/services/url-action-router.test.d.ts.map +1 -0
- package/dist/types/tests/lib/stores/active-state-store.test.d.ts +2 -0
- package/dist/types/tests/lib/stores/active-state-store.test.d.ts.map +1 -0
- package/dist/types/tests/lib/stores/element-store.test.d.ts +2 -0
- package/dist/types/tests/lib/stores/element-store.test.d.ts.map +1 -0
- package/dist/types/tests/lib/stores/ui-store.test.d.ts +2 -0
- package/dist/types/tests/lib/stores/ui-store.test.d.ts.map +1 -0
- package/dist/types/tests/lib/utils/dom-element-locator.test.d.ts +2 -0
- package/dist/types/tests/lib/utils/dom-element-locator.test.d.ts.map +1 -0
- package/dist/types/tests/lib/utils/persistence.test.d.ts +2 -0
- package/dist/types/tests/lib/utils/persistence.test.d.ts.map +1 -0
- package/dist/types/tests/lib/utils/scroll-utils.test.d.ts +2 -0
- package/dist/types/tests/lib/utils/scroll-utils.test.d.ts.map +1 -0
- package/dist/types/tests/lib/utils/url-utils.test.d.ts +2 -0
- package/dist/types/tests/lib/utils/url-utils.test.d.ts.map +1 -0
- package/dist/types/tests/setup.d.ts +2 -0
- package/dist/types/tests/setup.d.ts.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the settings widget panel.
|
|
3
|
+
*/
|
|
4
|
+
export interface WidgetPanelConfig {
|
|
5
|
+
/** Widget title */
|
|
6
|
+
title?: string;
|
|
7
|
+
/** Widget description text */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Whether to show tab groups section in widget (default: true) */
|
|
10
|
+
showTabGroups?: boolean;
|
|
11
|
+
/** Whether to show reset button */
|
|
12
|
+
showReset?: boolean;
|
|
13
|
+
/** Widget theme */
|
|
14
|
+
theme?: 'light' | 'dark';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for the widget callout message.
|
|
18
|
+
*/
|
|
19
|
+
export interface WidgetCalloutConfig {
|
|
20
|
+
/** Whether to show the callout (default: false) */
|
|
21
|
+
show?: boolean;
|
|
22
|
+
/** Message to display in the callout */
|
|
23
|
+
message?: string;
|
|
24
|
+
/** Whether to enable pulse animation */
|
|
25
|
+
enablePulse?: boolean;
|
|
26
|
+
/** Custom background color */
|
|
27
|
+
backgroundColor?: string | undefined;
|
|
28
|
+
/** Custom text color */
|
|
29
|
+
textColor?: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Configuration for the widget icon appearance.
|
|
33
|
+
*/
|
|
34
|
+
export interface WidgetIconConfig {
|
|
35
|
+
/** Widget position */
|
|
36
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'middle-left' | 'middle-right';
|
|
37
|
+
/** Custom icon color */
|
|
38
|
+
color?: string | undefined;
|
|
39
|
+
/** Custom background color */
|
|
40
|
+
backgroundColor?: string | undefined;
|
|
41
|
+
/** Custom opacity (0-1) */
|
|
42
|
+
opacity?: number | undefined;
|
|
43
|
+
/** Custom scale factor */
|
|
44
|
+
scale?: number;
|
|
45
|
+
/** Whether to show the icon (default: true) */
|
|
46
|
+
show?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Top-level settings for the widget.
|
|
50
|
+
*/
|
|
51
|
+
export interface WidgetSettings {
|
|
52
|
+
/** Whether the settings widget is enabled */
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
/** Settings panel configuration */
|
|
55
|
+
panel?: WidgetPanelConfig;
|
|
56
|
+
/** Callout configuration options */
|
|
57
|
+
callout?: WidgetCalloutConfig;
|
|
58
|
+
/** Custom icon styling options */
|
|
59
|
+
icon?: WidgetIconConfig;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/settings/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mCAAmC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mBAAmB;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sBAAsB;IACtB,QAAQ,CAAC,EACL,WAAW,GACX,UAAU,GACV,cAAc,GACd,aAAa,GACb,aAAa,GACb,cAAc,CAAC;IACnB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mCAAmC;IACnC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,oCAAoC;IACpC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,kCAAkC;IAClC,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/share/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,UAAiD,CAAC;AACpF,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAAO,CAAC;AACjD,eAAO,MAAM,yBAAyB,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
2
|
+
export declare const CV_CUSTOM_ELEMENTS = "cv-tabgroup, cv-toggle";
|
|
3
|
+
export declare const SHAREABLE_SELECTOR: string;
|
|
4
|
+
export declare const SELECTED_CLASS = "cv-share-selected";
|
|
5
|
+
export declare const HIGHLIGHT_TARGET_CLASS = "cv-highlight-target";
|
|
6
|
+
export declare const HIDE_SELECTED_CLASS = "cv-share-selected-hide";
|
|
7
|
+
export declare const HIDE_HIGHLIGHT_TARGET_CLASS = "cv-highlight-target-hide";
|
|
8
|
+
export declare const HIGHLIGHT_SELECTED_CLASS = "cv-share-selected-highlight";
|
|
9
|
+
export declare const HIGHLIGHT_TARGET_MODE_CLASS = "cv-highlight-target-mode";
|
|
10
|
+
export declare const GENERIC_WRAPPER_IDS: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Determines if an element is a generic div wrapper (like a div used for layout)
|
|
13
|
+
* that should effectively be "ignored" or treated transparently during selection.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isGenericWrapper(el: HTMLElement): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Calculates the new set of selected elements based on the current selection
|
|
18
|
+
* and the new element to toggle/select.
|
|
19
|
+
*
|
|
20
|
+
* Implements the logic:
|
|
21
|
+
* 1. If an ancestor is already selected, ignore the new selection (Scenario B).
|
|
22
|
+
* 2. If children of the new selection are already selected, remove them (Scenario A) and add the new one.
|
|
23
|
+
* 3. Otherwise, just add the new one.
|
|
24
|
+
*/
|
|
25
|
+
export declare function calculateNewSelection(currentSelection: SvelteSet<HTMLElement>, newElement: HTMLElement): {
|
|
26
|
+
updatedSelection: SvelteSet<HTMLElement>;
|
|
27
|
+
changesMade: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Checks if an element or any of its ancestors should be excluded from sharing.
|
|
31
|
+
* @param element The element to check
|
|
32
|
+
* @param excludedTags Set of tag names to exclude
|
|
33
|
+
* @param excludedIds Set of IDs to exclude
|
|
34
|
+
*/
|
|
35
|
+
export declare function isExcluded(element: HTMLElement | null, excludedTags?: Set<string>, excludedIds?: Set<string>): boolean;
|
|
36
|
+
//# sourceMappingURL=share-logic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share-logic.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/share/share-logic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAE3D,eAAO,MAAM,kBAAkB,QACgE,CAAC;AAEhG,eAAO,MAAM,cAAc,sBAAsB,CAAC;AAClD,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAC5D,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,2BAA2B,6BAA6B,CAAC;AACtE,eAAO,MAAM,wBAAwB,gCAAgC,CAAC;AACtE,eAAO,MAAM,2BAA2B,6BAA6B,CAAC;AAGtE,eAAO,MAAM,mBAAmB,UAA0C,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAiBzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,EACxC,UAAU,EAAE,WAAW,GACtB;IAAE,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CA2CpE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GACxB,OAAO,CAuBT"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
2
|
+
export type SelectionMode = 'show' | 'hide' | 'highlight';
|
|
3
|
+
export declare class ShareStore {
|
|
4
|
+
isActive: boolean;
|
|
5
|
+
selectionMode: SelectionMode;
|
|
6
|
+
selectedElements: SvelteSet<HTMLElement>;
|
|
7
|
+
currentHoverTarget: HTMLElement | null;
|
|
8
|
+
shareCount: number;
|
|
9
|
+
toggleActive(active?: boolean): void;
|
|
10
|
+
setSelectionMode(mode: SelectionMode): void;
|
|
11
|
+
updateBodyClass(): void;
|
|
12
|
+
setHoverTarget(target: HTMLElement | null): void;
|
|
13
|
+
toggleElementSelection(el: HTMLElement): void;
|
|
14
|
+
toggleMultipleElements(elements: HTMLElement[]): void;
|
|
15
|
+
clearAllSelections(): void;
|
|
16
|
+
private _addHighlightClass;
|
|
17
|
+
private _removeHighlightClass;
|
|
18
|
+
private _addSelectionClass;
|
|
19
|
+
private _removeSelectionClass;
|
|
20
|
+
generateLink(): void;
|
|
21
|
+
previewLink(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const shareStore: ShareStore;
|
|
24
|
+
//# sourceMappingURL=share-store.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share-store.svelte.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/features/share/stores/share-store.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAa9C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;AAE1D,qBAAa,UAAU;IACrB,QAAQ,UAAiB;IACzB,aAAa,gBAAiC;IAC9C,gBAAgB,yBAAgE;IAChF,kBAAkB,qBAAoC;IAEtD,UAAU,SAAwC;IAElD,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO;IAuB7B,gBAAgB,CAAC,IAAI,EAAE,aAAa;IAgBpC,eAAe;IASf,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAczC,sBAAsB,CAAC,EAAE,EAAE,WAAW;IAwBtC,sBAAsB,CAAC,QAAQ,EAAE,WAAW,EAAE;IAO9C,kBAAkB;IAKlB,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,qBAAqB;IAI7B,YAAY;IA4CZ,WAAW;CA2BZ;AAED,eAAO,MAAM,UAAU,YAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/share/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for a single tab within a tab group
|
|
3
|
+
*/
|
|
4
|
+
export interface TabConfig {
|
|
5
|
+
/** Tab identifier */
|
|
6
|
+
tabId: string;
|
|
7
|
+
/** Display label for the tab */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Value to set the placeholder to when this tab is active */
|
|
10
|
+
placeholderValue?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for a tab group
|
|
14
|
+
*/
|
|
15
|
+
export interface TabGroupConfig {
|
|
16
|
+
/** Group identifier (stable across the page) */
|
|
17
|
+
groupId: string;
|
|
18
|
+
/** Display name for widget/nav */
|
|
19
|
+
label?: string;
|
|
20
|
+
/** ID of the placeholder variable to bind this group's selection to */
|
|
21
|
+
placeholderId?: string;
|
|
22
|
+
/** Available tabs in this group */
|
|
23
|
+
tabs: TabConfig[];
|
|
24
|
+
/** Determines if the tab group is only shown on pages where it's used. */
|
|
25
|
+
isLocal?: boolean;
|
|
26
|
+
/** Optional description to display below label */
|
|
27
|
+
description?: string;
|
|
28
|
+
/** Default tab ID to select */
|
|
29
|
+
default?: string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/tabs/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for a single toggle.
|
|
3
|
+
*/
|
|
4
|
+
export interface ToggleConfig {
|
|
5
|
+
/** Toggle identifier */
|
|
6
|
+
toggleId: string;
|
|
7
|
+
/** Display label for the toggle */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Determines if the toggle is only shown on pages where it's used. */
|
|
10
|
+
isLocal?: boolean;
|
|
11
|
+
/** Optional description to display below functionality */
|
|
12
|
+
description?: string;
|
|
13
|
+
/** Default state for this toggle: 'show', 'hide', or 'peek' */
|
|
14
|
+
default?: 'show' | 'hide' | 'peek';
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/toggles/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CACpC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SelectionMode } from '$features/share/stores/share-store.svelte';
|
|
2
|
+
export type UrlActionType = 'OPEN_MODAL' | 'START_SHARE';
|
|
3
|
+
export interface UrlAction {
|
|
4
|
+
type: UrlActionType;
|
|
5
|
+
mode?: SelectionMode;
|
|
6
|
+
triggerKey: string;
|
|
7
|
+
triggerSource: 'query' | 'hash';
|
|
8
|
+
}
|
|
9
|
+
export declare class UrlActionHandler {
|
|
10
|
+
private static rules;
|
|
11
|
+
/**
|
|
12
|
+
* Pure function: Parses the URL and returns the detected action if any.
|
|
13
|
+
* Iterates through the registry of rules.
|
|
14
|
+
*/
|
|
15
|
+
static detectAction(location: Pick<Location, 'search' | 'hash'>): UrlAction | null;
|
|
16
|
+
/**
|
|
17
|
+
* Pure function: Returns the clean URL string after removing the action trigger.
|
|
18
|
+
* Delegates cleanup to the appropriate rule.
|
|
19
|
+
*/
|
|
20
|
+
static getCleanedUrl(location: Pick<Location, 'href' | 'search' | 'hash'>, action: UrlAction): string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=url-action-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-action-handler.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/url/url-action-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE/E,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,aAAa,CAAC;AAEzD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,GAAG,MAAM,CAAC;CACjC;AAkHD,qBAAa,gBAAgB;IAE3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAIlB;IAEF;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI;IAQlF;;;OAGG;IACH,MAAM,CAAC,aAAa,CAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC,EACpD,MAAM,EAAE,SAAS,GAChB,MAAM;CAQV"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SelectionMode } from '$features/share/stores/share-store.svelte';
|
|
2
|
+
export interface RouterOptions {
|
|
3
|
+
onOpenModal: () => void;
|
|
4
|
+
onStartShare: (mode?: SelectionMode) => void;
|
|
5
|
+
checkSettingsEnabled: () => boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* UrlActionRouter
|
|
9
|
+
*
|
|
10
|
+
* Responsibilities:
|
|
11
|
+
* - Listens for URL changes (popstate, hashchange) and initial page loads.
|
|
12
|
+
* - Detects "action triggers" in the URL (e.g., `?cv-open`, `?cv-share-show`) via `UrlActionHandler`.
|
|
13
|
+
* - Invokes the appropriate callbacks (open modal, start share) based on the detected action.
|
|
14
|
+
* - Cleans the URL after processing the action to prevent re-triggering on reload.
|
|
15
|
+
*
|
|
16
|
+
* This service acts as the bridge between browser URL state and the CustardUI UI state.
|
|
17
|
+
*/
|
|
18
|
+
export declare class UrlActionRouter {
|
|
19
|
+
private options;
|
|
20
|
+
private boundCheck;
|
|
21
|
+
constructor(options: RouterOptions);
|
|
22
|
+
init(): void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
private checkURLForAction;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=url-action-router.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-action-router.svelte.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/url/url-action-router.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE/E,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,oBAAoB,EAAE,MAAM,OAAO,CAAC;CACrC;AAED;;;;;;;;;;GAUG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,UAAU,CAAa;gBAEnB,OAAO,EAAE,aAAa;IAK3B,IAAI;IAMJ,OAAO;IAKd,OAAO,CAAC,iBAAiB;CAe1B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { State } from '$lib/types/index';
|
|
2
|
+
/** Parameters owned by FocusService — never touched by URLStateManager */
|
|
3
|
+
declare const FOCUS_PARAMS: string[];
|
|
4
|
+
declare const MANAGED_PARAMS: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Elements currently present and tracked on the page.
|
|
7
|
+
*/
|
|
8
|
+
export interface PageElements {
|
|
9
|
+
toggles: Iterable<string>;
|
|
10
|
+
tabGroups: Iterable<string>;
|
|
11
|
+
placeholders: Iterable<string>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* URL State Manager for CustardUI.
|
|
15
|
+
* Handles encoding/decoding of view states as human-readable URL parameters.
|
|
16
|
+
*
|
|
17
|
+
* URL Schema:
|
|
18
|
+
* ?t-show=A,B — toggle IDs to explicitly show
|
|
19
|
+
* ?t-peek=C — toggle IDs to explicitly peek
|
|
20
|
+
* ?t-hide=D — toggle IDs to explicitly hide
|
|
21
|
+
* ?tabs=g1:t1,g2:t2 — tab group selections (groupId:tabId pairs)
|
|
22
|
+
* ?ph=key:val — placeholder values (key:encodedValue pairs)
|
|
23
|
+
*
|
|
24
|
+
* Precedence model (applied by ActiveStateStore, not here):
|
|
25
|
+
* - Persisted state is loaded first as a base.
|
|
26
|
+
* - URL parameters act as a sparse override on top of persisted state.
|
|
27
|
+
* Only toggles/tabs/placeholders mentioned in the URL are affected.
|
|
28
|
+
* - Tab-group-derived placeholders are always re-derived from the active tab,
|
|
29
|
+
* so the `?tabs=` param is the sole source of truth for those values.
|
|
30
|
+
*
|
|
31
|
+
* `parseURL` is used on page load to read inbound link state.
|
|
32
|
+
* `generateShareableURL` is used to produce a link for the clipboard.
|
|
33
|
+
*
|
|
34
|
+
* Focus params (cv-show, cv-hide, cv-highlight) remain owned by FocusService.
|
|
35
|
+
*/
|
|
36
|
+
export declare class URLStateManager {
|
|
37
|
+
/**
|
|
38
|
+
* Parses the current page URL into a sparse delta state object.
|
|
39
|
+
* Only fields present in the URL are populated; the rest are omitted.
|
|
40
|
+
* Returns null if none of the managed parameters are present.
|
|
41
|
+
*/
|
|
42
|
+
static parseURL(): State | null;
|
|
43
|
+
/**
|
|
44
|
+
* Generates a shareable URL that encodes the full current state.
|
|
45
|
+
*
|
|
46
|
+
* Encodes every toggle on the page explicitly (shown, peeked, or hidden)
|
|
47
|
+
* so the recipient sees the exact same view regardless of their local settings.
|
|
48
|
+
*
|
|
49
|
+
* Tab-group-derived placeholders are omitted from the URL — they are implied
|
|
50
|
+
* by the `?tabs=` parameter and will be re-derived by the recipient's store.
|
|
51
|
+
*
|
|
52
|
+
* Toggles, tabs, and placeholders NOT present on the current page are omitted,
|
|
53
|
+
* preventing cross-page state pollution.
|
|
54
|
+
*
|
|
55
|
+
* @param currentState The full application state to encode.
|
|
56
|
+
* @param pageElements The active elements detected on the current page.
|
|
57
|
+
*/
|
|
58
|
+
static generateShareableURL(currentState: State | null | undefined, pageElements?: PageElements): string;
|
|
59
|
+
/**
|
|
60
|
+
* Clears all managed parameters from the current browser URL.
|
|
61
|
+
* This is called after parsing so that shared configurations don't stick around in
|
|
62
|
+
* the address bar when the user subsequently interacts with the page or refreshes.
|
|
63
|
+
*/
|
|
64
|
+
static clearURL(): void;
|
|
65
|
+
}
|
|
66
|
+
export { FOCUS_PARAMS, MANAGED_PARAMS };
|
|
67
|
+
//# sourceMappingURL=url-state-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-state-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/url/url-state-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAQ9C,0EAA0E;AAC1E,QAAA,MAAM,YAAY,UAAyC,CAAC;AAC5D,QAAA,MAAM,cAAc,UAAkF,CAAC;AAuLvG;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1B,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5B,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAChC;AA6ED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,eAAe;IAC1B;;;;OAIG;WACW,QAAQ,IAAI,KAAK,GAAG,IAAI;IAetC;;;;;;;;;;;;;;OAcG;WACW,oBAAoB,CAChC,YAAY,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EACtC,YAAY,GAAE,YAA+D,GAC5E,MAAM;IAgBT;;;;OAIG;WACW,QAAQ,IAAI,IAAI;CAiB/B;AAGD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '$features/toggles/components/Toggle.svelte';
|
|
2
|
+
import '$features/tabs/components/Tab.svelte';
|
|
3
|
+
import '$features/tabs/components/TabGroup.svelte';
|
|
4
|
+
import '$features/tabs/components/TabHeader.svelte';
|
|
5
|
+
import '$features/tabs/components/TabBody.svelte';
|
|
6
|
+
import '$features/placeholder/Placeholder.svelte';
|
|
7
|
+
import '$features/placeholder/PlaceholderInput.svelte';
|
|
8
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/lib/registry.ts"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAC;AACpD,OAAO,sCAAsC,CAAC;AAC9C,OAAO,2CAA2C,CAAC;AACnD,OAAO,4CAA4C,CAAC;AACpD,OAAO,0CAA0C,CAAC;AAElD,OAAO,0CAA0C,CAAC;AAClD,OAAO,+CAA+C,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ConfigFile } from '$lib/types/index';
|
|
2
|
+
import type { AssetsManager } from '$features/render/assets';
|
|
3
|
+
import type { AdaptationConfig } from '$features/adaptation/types';
|
|
4
|
+
export interface RuntimeOptions {
|
|
5
|
+
assetsManager: AssetsManager;
|
|
6
|
+
configFile: ConfigFile;
|
|
7
|
+
rootEl?: HTMLElement | undefined;
|
|
8
|
+
storageKey?: string | undefined;
|
|
9
|
+
adaptationConfig?: AdaptationConfig | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The reactive runtime for CustardUI. Manages the full lifecycle: initialization,
|
|
13
|
+
* state resolution, reactive side-effects (URL sync, persistence), DOM observation, and teardown.
|
|
14
|
+
* Components (Toggle, TabGroup) are self-contained and self-managing via the global store.
|
|
15
|
+
*/
|
|
16
|
+
export declare class AppRuntime {
|
|
17
|
+
private rootEl;
|
|
18
|
+
private persistenceManager;
|
|
19
|
+
private focusService;
|
|
20
|
+
private observer?;
|
|
21
|
+
private destroyEffectRoot?;
|
|
22
|
+
private onHashChange?;
|
|
23
|
+
constructor(opt: RuntimeOptions);
|
|
24
|
+
/**
|
|
25
|
+
* Initialize all stores with configuration from the config file.
|
|
26
|
+
* Populates the singleton sub-stores with real data.
|
|
27
|
+
*/
|
|
28
|
+
private initStores;
|
|
29
|
+
/**
|
|
30
|
+
* Resolves the starting application state by layering sources:
|
|
31
|
+
*
|
|
32
|
+
* 1. **Baseline**: `ActiveStateStore` initializes with defaults from the config file.
|
|
33
|
+
* 2. **Adaptation Defaults**: If an adaptation is active, its defaults are applied
|
|
34
|
+
* on top of the config defaults (before persisted state, so user choices can win).
|
|
35
|
+
* 3. **Persistence**: If local storage has a saved state, it replaces the baseline (`applyState`).
|
|
36
|
+
* 4. **URL Overrides**: If the URL contains parameters (`?t-show=X`), these are applied
|
|
37
|
+
* as **sparse overrides** (`applyDifferenceInState`). Toggles not mentioned in the URL
|
|
38
|
+
* retain their values from persistence/defaults.
|
|
39
|
+
*/
|
|
40
|
+
private resolveInitialState;
|
|
41
|
+
/**
|
|
42
|
+
* Starts the CustardUI execution engine.
|
|
43
|
+
*
|
|
44
|
+
* Components (Toggle, TabGroup) self-register during their mount lifecycle.
|
|
45
|
+
* This method starts the global observers for DOM changes and reactive state side-effects.
|
|
46
|
+
*/
|
|
47
|
+
start(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Performs an initial, non-reactive scan of the DOM for placeholders.
|
|
50
|
+
*/
|
|
51
|
+
private scanDOM;
|
|
52
|
+
/**
|
|
53
|
+
* Sets up global reactivity using `$effect.root` for persistence and placeholder binding.
|
|
54
|
+
*/
|
|
55
|
+
private startGlobalReactivity;
|
|
56
|
+
/**
|
|
57
|
+
* Sets up a MutationObserver to detect content added dynamically to the page
|
|
58
|
+
* (e.g. by other scripts, lazy loading, or client-side routing).
|
|
59
|
+
*/
|
|
60
|
+
private startComponentObserver;
|
|
61
|
+
/**
|
|
62
|
+
* Processes a newly added DOM node to check for and hydrate placeholders.
|
|
63
|
+
*/
|
|
64
|
+
private handleForPlaceholders;
|
|
65
|
+
resetToDefault(): void;
|
|
66
|
+
getIconPosition(): number | null;
|
|
67
|
+
saveIconPosition(offset: number): void;
|
|
68
|
+
clearIconPosition(): void;
|
|
69
|
+
isIntroSeen(): boolean;
|
|
70
|
+
markIntroSeen(): void;
|
|
71
|
+
destroy(): void;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=runtime.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/runtime.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAenE,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC5C;AAED;;;;GAIG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,YAAY,CAAe;IAEnC,OAAO,CAAC,QAAQ,CAAC,CAAmB;IACpC,OAAO,CAAC,iBAAiB,CAAC,CAAa;IACvC,OAAO,CAAC,YAAY,CAAC,CAAa;gBAEtB,GAAG,EAAE,cAAc;IAuB/B;;;OAGG;IACH,OAAO,CAAC,UAAU;IAsBlB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,mBAAmB;IA0B3B;;;;;OAKG;IACI,KAAK;IAQZ;;OAEG;IACH,OAAO,CAAC,OAAO;IAMf;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA0B7B;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAY9B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA6BtB,cAAc;IASd,eAAe,IAAI,MAAM,GAAG,IAAI;IAKhC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAItC,iBAAiB,IAAI,IAAI;IAMzB,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,IAAI;IAIrB,OAAO;CAQf"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Config, State } from '$lib/types/index';
|
|
2
|
+
import type { AdaptationConfig } from '$features/adaptation/types';
|
|
3
|
+
/**
|
|
4
|
+
* Store for managing the application's configuration and user state.
|
|
5
|
+
* Handles:
|
|
6
|
+
* - Loading and storing static configuration.
|
|
7
|
+
* - Managing mutable user state (toggles, tabs, placeholders).
|
|
8
|
+
* - Computing default states based on configuration.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ActiveStateStore {
|
|
11
|
+
/**
|
|
12
|
+
* Static configuration loaded at startup.
|
|
13
|
+
*/
|
|
14
|
+
config: Config;
|
|
15
|
+
/**
|
|
16
|
+
* Explicit order of sections derived from the initial configuration JSON.
|
|
17
|
+
*/
|
|
18
|
+
configSectionOrder: ("toggles" | "tabGroups" | "placeholders")[];
|
|
19
|
+
/**
|
|
20
|
+
* Mutable application state representing user choices.
|
|
21
|
+
* Use actions like `setPinnedTab` or `setToggles` to modify this.
|
|
22
|
+
*/
|
|
23
|
+
state: State;
|
|
24
|
+
constructor(initialConfig?: Config);
|
|
25
|
+
/**
|
|
26
|
+
* Initialize with real configuration.
|
|
27
|
+
*/
|
|
28
|
+
init(config: Config): void;
|
|
29
|
+
/**
|
|
30
|
+
* Set the pinned tab for a specific tab group.
|
|
31
|
+
* This syncs across all tab groups with the same ID.
|
|
32
|
+
* @param groupId The ID of the tab group.
|
|
33
|
+
* @param tabId The ID of the tab to pin.
|
|
34
|
+
*/
|
|
35
|
+
setPinnedTab(groupId: string, tabId: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Update the visibility of toggles.
|
|
38
|
+
* @param shown List of IDs for toggles in "Show" state.
|
|
39
|
+
* @param peek List of IDs for toggles in "Peek" state.
|
|
40
|
+
*/
|
|
41
|
+
setToggles(shown: string[], peek: string[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* Set a specific placeholder value.
|
|
44
|
+
* @param key The ID/name of the placeholder.
|
|
45
|
+
* @param value The value to set.
|
|
46
|
+
*/
|
|
47
|
+
setPlaceholder(key: string, value: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Replaces the full application state (e.g. from persistence).
|
|
50
|
+
*
|
|
51
|
+
* Precedence model:
|
|
52
|
+
* 1. Start from computed defaults (config-driven).
|
|
53
|
+
* 2. Layer in the incoming `newState`, sanitizing tabs and placeholders.
|
|
54
|
+
* 3. Sync any tab-group-derived placeholders that weren't explicitly set.
|
|
55
|
+
*
|
|
56
|
+
* @param newState The persisted state to restore.
|
|
57
|
+
*/
|
|
58
|
+
applyState(newState: State): void;
|
|
59
|
+
/**
|
|
60
|
+
* Applies a sparse delta on top of the current state (e.g. from URL parameters).
|
|
61
|
+
*
|
|
62
|
+
* Semantics:
|
|
63
|
+
* - Only toggles explicitly mentioned in the delta are affected;
|
|
64
|
+
* unmentioned toggles retain their current visibility.
|
|
65
|
+
* - Tab and placeholder entries in the delta are merged into (not replacing) current state.
|
|
66
|
+
* - Incoming tab IDs are validated against the config; invalid entries are dropped.
|
|
67
|
+
* - Incoming placeholder keys are validated against the registry; invalid keys are dropped.
|
|
68
|
+
* - After tab merges, tab-group-derived placeholders are automatically synced
|
|
69
|
+
* unless the delta explicitly provides a value for them.
|
|
70
|
+
*
|
|
71
|
+
* @param deltaState Partial state describing only the changes to apply.
|
|
72
|
+
*/
|
|
73
|
+
applyDifferenceInState(deltaState: State): void;
|
|
74
|
+
/**
|
|
75
|
+
* Applies adaptation defaults on top of the config defaults, before persisted state.
|
|
76
|
+
* User choices applied later via applyState() will override these.
|
|
77
|
+
*
|
|
78
|
+
* @param defaults The defaults section from the adaptation config
|
|
79
|
+
*/
|
|
80
|
+
applyAdaptationDefaults(defaults: AdaptationConfig['defaults']): void;
|
|
81
|
+
/**
|
|
82
|
+
* Resets the application state to the computed defaults.
|
|
83
|
+
*/
|
|
84
|
+
reset(): void;
|
|
85
|
+
computeDefaultState(): State;
|
|
86
|
+
/**
|
|
87
|
+
* Finds a toggle in the configuration using a case-insensitive ID match.
|
|
88
|
+
* @param toggleId The ID to search for.
|
|
89
|
+
* @returns The matched toggle configuration, or undefined if not found.
|
|
90
|
+
*/
|
|
91
|
+
private getToggleConfigFromConfig;
|
|
92
|
+
/**
|
|
93
|
+
* Applies a map of toggleId → visibility to the current state.
|
|
94
|
+
* Removes each mentioned toggle from both lists, then re-adds to the correct one.
|
|
95
|
+
* Warns and drops unknown IDs (consistent with filterValidToggles).
|
|
96
|
+
*/
|
|
97
|
+
private applyToggleMap;
|
|
98
|
+
/**
|
|
99
|
+
* Applies the toggle portion of a delta state.
|
|
100
|
+
* Toggles explicitly reassigned in the delta are moved to their new state;
|
|
101
|
+
* all others retain their current visibility.
|
|
102
|
+
*/
|
|
103
|
+
private applyToggleDelta;
|
|
104
|
+
/**
|
|
105
|
+
* Merges a tab delta into the current state.
|
|
106
|
+
* Validates each incoming groupId and tabId against the configuration.
|
|
107
|
+
* Invalid entries are dropped with a warning; valid entries override the current selection.
|
|
108
|
+
* After merging, tab-group-derived placeholders are synced.
|
|
109
|
+
*/
|
|
110
|
+
private applyTabsDelta;
|
|
111
|
+
/**
|
|
112
|
+
* Merges a placeholder delta into the current state.
|
|
113
|
+
* Only registered placeholder keys are accepted; others are dropped with a warning.
|
|
114
|
+
* Explicit placeholder values override any tab-derived value (winning over syncPlaceholdersFromTabs).
|
|
115
|
+
*/
|
|
116
|
+
private applyPlaceholdersDelta;
|
|
117
|
+
/**
|
|
118
|
+
* Validates an incoming tab record against the configuration.
|
|
119
|
+
* Drops any groupId that doesn't exist in `config.tabGroups`,
|
|
120
|
+
* and any tabId that doesn't exist within that group.
|
|
121
|
+
*
|
|
122
|
+
* @param incomingTabs Raw tab record (e.g. from a URL or persistence).
|
|
123
|
+
* @returns A filtered record containing only valid groupId → tabId pairs.
|
|
124
|
+
*/
|
|
125
|
+
private filterValidTabs;
|
|
126
|
+
/**
|
|
127
|
+
* Validates an incoming list of toggle IDs against the configuration.
|
|
128
|
+
* Invalid IDs are dropped with a warning.
|
|
129
|
+
*/
|
|
130
|
+
private filterValidToggles;
|
|
131
|
+
/**
|
|
132
|
+
* Recalculates tab-group-derived placeholders for any tab group that hasn't been
|
|
133
|
+
* explicitly overridden in the `explicitPlaceholders` map.
|
|
134
|
+
*
|
|
135
|
+
* Skip rules (to avoid overwriting intentional values):
|
|
136
|
+
* - If the placeholder was explicitly included in the incoming state, skip it.
|
|
137
|
+
* - If the placeholder is owned by `config` (not a tab group), skip it.
|
|
138
|
+
*
|
|
139
|
+
* @param explicitPlaceholders Placeholders that were explicitly set in the incoming state.
|
|
140
|
+
*/
|
|
141
|
+
private syncPlaceholdersFromTabs;
|
|
142
|
+
}
|
|
143
|
+
export declare const activeStateStore: ActiveStateStore;
|
|
144
|
+
//# sourceMappingURL=active-state-store.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-state-store.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/lib/stores/active-state-store.svelte.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAoB,KAAK,EAAgB,MAAM,kBAAkB,CAAC;AAEtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,MAAM,SAAsB;IAE5B;;OAEG;IACH,kBAAkB,+CAAkC;IAEpD;;;OAGG;IACH,KAAK,QAKF;gBAES,aAAa,GAAE,MAAW;IAQtC;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM;IAiBnB;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAU3C;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IAK1C;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAOzC;;;;;;;;;OASG;IACH,UAAU,CAAC,QAAQ,EAAE,KAAK;IAmB1B;;;;;;;;;;;;;OAaG;IACH,sBAAsB,CAAC,UAAU,EAAE,KAAK;IAMxC;;;;;OAKG;IACH,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,GAAG,IAAI;IAcrE;;OAEG;IACH,KAAK;IAKE,mBAAmB,IAAI,KAAK;IAqDnC;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAIjC;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAwBtB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAWtB;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAO9B;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAsBvB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAsB1B;;;;;;;;;OASG;IACH,OAAO,CAAC,wBAAwB;CAwBjC;AAED,eAAO,MAAM,gBAAgB,kBAAyB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AssetsManager } from '$features/render/assets';
|
|
2
|
+
/**
|
|
3
|
+
* Cross-cutting derived state that combines data from multiple sub-stores.
|
|
4
|
+
* Holds only computed/derived values and assetsManager — no mutable application state.
|
|
5
|
+
*/
|
|
6
|
+
declare class DerivedStateStore {
|
|
7
|
+
assetsManager: AssetsManager | undefined;
|
|
8
|
+
menuToggles: import("../types").ToggleConfig[];
|
|
9
|
+
menuTabGroups: import("../types").TabGroupConfig[];
|
|
10
|
+
hasVisiblePlaceholders: boolean;
|
|
11
|
+
hasMenuOptions: boolean;
|
|
12
|
+
setAssetsManager(manager: AssetsManager): void;
|
|
13
|
+
}
|
|
14
|
+
export declare const derivedStore: DerivedStateStore;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=derived-store.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derived-store.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/lib/stores/derived-store.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D;;;GAGG;AACH,cAAM,iBAAiB;IACrB,aAAa,4BAAgD;IAI7D,WAAW,oCAKR;IAEH,aAAa,sCAKV;IAEH,sBAAsB,UAQnB;IAEH,cAAc,UAIZ;IAEF,gBAAgB,CAAC,OAAO,EAAE,aAAa;CAGxC;AAED,eAAO,MAAM,YAAY,mBAA0B,CAAC"}
|