@custardui/custardui 2.0.0 → 2.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/custardui.js +1296 -455
  2. package/dist/custardui.js.map +1 -1
  3. package/dist/custardui.min.js +2 -2
  4. package/dist/custardui.min.js.map +1 -1
  5. package/dist/types/src/lib/features/adaptation/adaptation-manager.d.ts +1 -1
  6. package/dist/types/src/lib/features/adaptation/adaptation-manager.d.ts.map +1 -1
  7. package/dist/types/src/lib/features/anchor/descriptor.d.ts +6 -0
  8. package/dist/types/src/lib/features/anchor/descriptor.d.ts.map +1 -0
  9. package/dist/types/src/lib/features/anchor/index.d.ts +5 -0
  10. package/dist/types/src/lib/features/anchor/index.d.ts.map +1 -0
  11. package/dist/types/src/lib/features/anchor/resolver.d.ts +8 -0
  12. package/dist/types/src/lib/features/anchor/resolver.d.ts.map +1 -0
  13. package/dist/types/src/lib/features/anchor/serializer.d.ts +21 -0
  14. package/dist/types/src/lib/features/anchor/serializer.d.ts.map +1 -0
  15. package/dist/types/src/lib/features/anchor/stable-text.d.ts +41 -0
  16. package/dist/types/src/lib/features/anchor/stable-text.d.ts.map +1 -0
  17. package/dist/types/src/lib/features/anchor/types.d.ts +17 -0
  18. package/dist/types/src/lib/features/anchor/types.d.ts.map +1 -0
  19. package/dist/types/src/lib/features/highlight/services/highlight-colors.d.ts.map +1 -1
  20. package/dist/types/src/lib/features/highlight/services/highlight-service.svelte.d.ts +1 -1
  21. package/dist/types/src/lib/features/highlight/services/highlight-service.svelte.d.ts.map +1 -1
  22. package/dist/types/src/lib/features/share/stores/share-store.svelte.d.ts.map +1 -1
  23. package/dist/types/src/lib/stores/active-state-store.svelte.d.ts +4 -4
  24. package/dist/types/src/lib/stores/active-state-store.svelte.d.ts.map +1 -1
  25. package/dist/types/src/lib/utils/scroll-utils.d.ts +43 -11
  26. package/dist/types/src/lib/utils/scroll-utils.d.ts.map +1 -1
  27. package/dist/types/tests/lib/features/anchor/anchor.test.d.ts +2 -0
  28. package/dist/types/tests/lib/features/anchor/anchor.test.d.ts.map +1 -0
  29. package/package.json +2 -2
  30. package/dist/types/src/lib/utils/dom-element-locator.d.ts +0 -35
  31. package/dist/types/src/lib/utils/dom-element-locator.d.ts.map +0 -1
  32. package/dist/types/tests/lib/utils/dom-element-locator.test.d.ts +0 -2
  33. package/dist/types/tests/lib/utils/dom-element-locator.test.d.ts.map +0 -1
@@ -14,7 +14,7 @@ export declare class AdaptationManager {
14
14
  *
15
15
  * Adaptation JSON files are resolved relative to the site's baseUrl:
16
16
  * `{baseUrl}/{id}/{id}.json`
17
- * e.g. baseUrl="/customviews", id="ntu" → "/customviews/ntu/ntu.json"
17
+ * e.g. baseUrl="/base", id="nus" → "/base/nus/nus.json"
18
18
  *
19
19
  * @param baseUrl The site's base URL (from data-base-url, default: '')
20
20
  * @param storageKey The project's unique storageKey prefix to use for saving preferences
@@ -1 +1 @@
1
- {"version":3,"file":"adaptation-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/adaptation/adaptation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKhD;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAW;IAC9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAQ;IAE3C;;;;;;;;;;;;;OAaG;WACU,IAAI,CAAC,OAAO,SAAK,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IA2DtF;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAiBtD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IA0BzB,OAAO,CAAC,MAAM,CAAC,aAAa;IAI5B,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAIlC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAUlC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAIlC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAIlC,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAKrC,OAAO,CAAC,MAAM,CAAC,gBAAgB;mBAKV,oBAAoB;CA4C1C"}
1
+ {"version":3,"file":"adaptation-manager.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/adaptation/adaptation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKhD;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAW;IAC9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAQ;IAE3C;;;;;;;;;;;;;OAaG;WACU,IAAI,CAAC,OAAO,SAAK,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAiEtF;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAqBtD;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IA0BzB,OAAO,CAAC,MAAM,CAAC,aAAa;IAI5B,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAIlC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAUlC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAIlC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAIlC,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAKrC,OAAO,CAAC,MAAM,CAAC,gBAAgB;mBAKV,oBAAoB;CA4C1C"}
@@ -0,0 +1,6 @@
1
+ import { type AnchorDescriptor } from './types';
2
+ /**
3
+ * Creates an AnchorDescriptor for a given DOM element.
4
+ */
5
+ export declare function createDescriptor(el: HTMLElement): AnchorDescriptor;
6
+ //# sourceMappingURL=descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/anchor/descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAiClE"}
@@ -0,0 +1,5 @@
1
+ export type { AnchorDescriptor } from './types';
2
+ export { createDescriptor } from './descriptor';
3
+ export { serialize, deserialize } from './serializer';
4
+ export { resolve } from './resolver';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/anchor/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type AnchorDescriptor } from './types';
2
+ /**
3
+ * Finds the best DOM element match(es) for a descriptor.
4
+ * Returns an array of elements. For specific descriptors, usually contains 0 or 1 element.
5
+ * For ID-only descriptors (tag='ANY'), may return multiple if duplicates exist.
6
+ */
7
+ export declare function resolve(root: HTMLElement, descriptor: AnchorDescriptor): HTMLElement[];
8
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/anchor/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAShD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,GAAG,WAAW,EAAE,CAoFtF"}
@@ -0,0 +1,21 @@
1
+ import { type AnchorDescriptor } from './types';
2
+ /**
3
+ * Serializes a list of AnchorDescriptors into a URL-safe string.
4
+ */
5
+ export declare function serialize(descriptors: AnchorDescriptor[]): string;
6
+ /**
7
+ * Deserializes a URL-safe string back into a list of AnchorDescriptors.
8
+ */
9
+ export declare function deserialize(encoded: string): AnchorDescriptor[];
10
+ /**
11
+ * Parses a space-separated, plus-separated, or comma-separated list of IDs into a list of AnchorDescriptors.
12
+ * Supports:
13
+ * "id" — ID only
14
+ * "id:color" — with color
15
+ * "id:color:corner" — color + corner, no note
16
+ * "id::corner" — corner only, no color, no note
17
+ * "id:color:corner:note" — with color + annotation (note is percent-encoded)
18
+ * "id::corner:note" — annotation, no color
19
+ */
20
+ export declare function parseIds(encoded: string): AnchorDescriptor[];
21
+ //# sourceMappingURL=serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/anchor/serializer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKhD;;GAEG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAoDjE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAqD/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAsD5D"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Generates a simple hash code for a string.
3
+ */
4
+ export declare function hashCode(str: string): number;
5
+ /**
6
+ * Matches raw (un-hydrated) placeholder tokens in text content, including
7
+ * escaped forms like \[[ name ]]:
8
+ * [[ name ]], [[ name : fallback ]], [[ name ? truthy : falsy ]], \[[ name ]]
9
+ * Captures the placeholder name in group 1. Used to normalize tokens before hashing.
10
+ *
11
+ * The optional `(?:\\)?` prefix intentionally consumes the leading backslash so that
12
+ * \[[ name ]] normalizes to [[name]] — the same canonical form that PlaceholderBinder
13
+ * emits for escaped tokens ([[ name ]] literal text). This keeps the hash stable
14
+ * across raw and hydrated DOM states.
15
+ */
16
+ export declare const RAW_PLACEHOLDER_RE: RegExp;
17
+ /**
18
+ * Recursively walks `node`, appending stable placeholder-canonical text to `parts`.
19
+ * - Text nodes: raw [[ ... ]] tokens are normalized to [[name]] before appending.
20
+ * - <cv-placeholder> elements: appends [[name]] from the `name` attribute; skips children
21
+ * (children hold the live resolved value, not the canonical template form).
22
+ * - All other elements: recurse into children.
23
+ */
24
+ export declare function collectStableText(node: Node, parts: string[]): void;
25
+ /**
26
+ * Returns the text content of an element with all <cv-placeholder> custom elements
27
+ * replaced by their canonical [[name]] template form.
28
+ *
29
+ * This produces a stable string regardless of the placeholder's current resolved value
30
+ * or whether it has been hydrated yet — enabling consistent hashing across share and load time.
31
+ *
32
+ * Without this, an element containing [[username]] resolved to "alice" would hash as
33
+ * "Hello alice!" at share-time but "Hello [[username]]!" at load-time, causing resolution to fail.
34
+ */
35
+ export declare function getStableTextContent(el: HTMLElement): string;
36
+ /**
37
+ * Combines getStableTextContent and normalizeText into a single call.
38
+ * Used wherever element text is computed for hashing or comparison.
39
+ */
40
+ export declare function getStableNormalizedText(el: HTMLElement): string;
41
+ //# sourceMappingURL=stable-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stable-text.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/anchor/stable-text.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAS5C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,QAA8C,CAAC;AAE9E;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAcnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAsB5D;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAE/D"}
@@ -0,0 +1,17 @@
1
+ import { type HighlightColorKey } from '$features/highlight/services/highlight-colors';
2
+ import { type AnnotationCorner } from '$features/highlight/services/highlight-annotations';
3
+ /**
4
+ * Descriptor for an anchor that represents a DOM element.
5
+ */
6
+ export interface AnchorDescriptor {
7
+ tag: string;
8
+ index: number;
9
+ parentId?: string;
10
+ textSnippet: string;
11
+ textHash: number;
12
+ elementId?: string;
13
+ color?: HighlightColorKey;
14
+ annotation?: string;
15
+ annotationCorner?: AnnotationCorner;
16
+ }
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/features/anchor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"highlight-colors.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/features/highlight/services/highlight-colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;EAMnB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAC9E,eAAO,MAAM,iBAAiB,EAAE,iBAA4B,CAAC"}
1
+ {"version":3,"file":"highlight-colors.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/features/highlight/services/highlight-colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;EAMnB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,CAAC;AAC9E,eAAO,MAAM,iBAAiB,EAAE,iBAAyB,CAAC"}
@@ -15,7 +15,7 @@ export declare class HighlightService {
15
15
  private onWindowResize;
16
16
  constructor(rootEl: HTMLElement);
17
17
  resolveTargets(encodedDescriptors: string): HTMLElement[];
18
- apply(encodedDescriptors: string): void;
18
+ applyEncodedHighlights(encodedDescriptors: string): void;
19
19
  exit(): void;
20
20
  private renderHighlightOverlay;
21
21
  private scrollToTarget;
@@ -1 +1 @@
1
- {"version":3,"file":"highlight-service.svelte.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/features/highlight/services/highlight-service.svelte.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAGxD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIlD,qBAAa,cAAc;IACzB,KAAK,aAA0B;CAChC;AAED,qBAAa,gBAAgB;IASf,OAAO,CAAC,MAAM;IAR1B,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,KAAK,CAAwB;IACrC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,YAAY,CAAkD;IACtE,OAAO,CAAC,iBAAiB,CAA2E;IACpG,OAAO,CAAC,cAAc,CAAgC;gBAElC,MAAM,EAAE,WAAW;IAMhC,cAAc,CAAC,kBAAkB,EAAE,MAAM,GAAG,WAAW,EAAE;IAWzD,KAAK,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI;IAuDvC,IAAI,IAAI,IAAI;IAkBnB,OAAO,CAAC,sBAAsB;YAwBhB,cAAc;IAiC5B,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,eAAe;CAqBxB"}
1
+ {"version":3,"file":"highlight-service.svelte.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/features/highlight/services/highlight-service.svelte.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAGxD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIlD,qBAAa,cAAc;IACzB,KAAK,aAA0B;CAChC;AAED,qBAAa,gBAAgB;IASf,OAAO,CAAC,MAAM;IAR1B,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,KAAK,CAAwB;IACrC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,YAAY,CAAkD;IACtE,OAAO,CAAC,iBAAiB,CAA2E;IACpG,OAAO,CAAC,cAAc,CAAgC;gBAElC,MAAM,EAAE,WAAW;IAMhC,cAAc,CAAC,kBAAkB,EAAE,MAAM,GAAG,WAAW,EAAE;IAWzD,sBAAsB,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI;IA0DxD,IAAI,IAAI,IAAI;IAkBnB,OAAO,CAAC,sBAAsB;YAwBhB,cAAc;IAiC5B,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,eAAe;CAqBxB"}
@@ -1 +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,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,KAAK,gBAAgB,EAAyB,MAAM,oDAAoD,CAAC;AAalH,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;IACtD,eAAe,4CAAmD;IAClE,oBAAoB;cAAsC,MAAM;gBAAU,gBAAgB;OAAM;IAEhG,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;IA0BtC,sBAAsB,CAAC,QAAQ,EAAE,WAAW,EAAE;IAO9C,kBAAkB;IAOlB,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB;IAYrE,iBAAiB,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB;IAI3D,qBAAqB,CAAC,KAAK,EAAE,iBAAiB;IAM9C,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,qBAAqB;IAI7B,YAAY;IA0CZ,WAAW;IA0BX,OAAO,CAAC,iBAAiB;CAe1B;AAED,eAAO,MAAM,UAAU,YAAmB,CAAC"}
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,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,KAAK,gBAAgB,EAAoD,MAAM,oDAAoD,CAAC;AAa7I,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;AAE1D,qBAAa,UAAU;IACrB,QAAQ,UAAiB;IACzB,aAAa,gBAAsC;IACnD,gBAAgB,yBAAgE;IAChF,kBAAkB,qBAAoC;IACtD,eAAe,4CAAmD;IAClE,oBAAoB;cAAsC,MAAM;gBAAU,gBAAgB;OAAM;IAEhG,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;IA0BtC,sBAAsB,CAAC,QAAQ,EAAE,WAAW,EAAE;IAO9C,kBAAkB;IAOlB,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB;IAgBrE,iBAAiB,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB;IAI3D,qBAAqB,CAAC,KAAK,EAAE,iBAAiB;IAM9C,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,qBAAqB;IAI7B,YAAY;IA0CZ,WAAW;IA0BX,OAAO,CAAC,iBAAiB;CAe1B;AAED,eAAO,MAAM,UAAU,YAAmB,CAAC"}
@@ -18,7 +18,7 @@ export declare class ActiveStateStore {
18
18
  configSectionOrder: ("toggles" | "tabGroups" | "placeholders")[];
19
19
  /**
20
20
  * Mutable application state representing user choices.
21
- * Use actions like `setPinnedTab` or `setToggles` to modify this.
21
+ * Use actions like `setMarkedTab` or `setToggles` to modify this.
22
22
  */
23
23
  state: State;
24
24
  constructor(initialConfig?: Config);
@@ -27,12 +27,12 @@ export declare class ActiveStateStore {
27
27
  */
28
28
  init(config: Config): void;
29
29
  /**
30
- * Set the pinned tab for a specific tab group.
30
+ * Set the marked tab for a specific tab group.
31
31
  * This syncs across all tab groups with the same ID.
32
32
  * @param groupId The ID of the tab group.
33
- * @param tabId The ID of the tab to pin.
33
+ * @param tabId The ID of the tab to mark.
34
34
  */
35
- setPinnedTab(groupId: string, tabId: string): void;
35
+ setMarkedTab(groupId: string, tabId: string): void;
36
36
  /**
37
37
  * Update the visibility of toggles.
38
38
  * @param shown List of IDs for toggles in "Show" state.
@@ -1 +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;;;;;OAKG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAanE;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAOzC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,QAAQ,EAAE,KAAK;IAqB1B;;;;;;;;;;;;;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"}
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;;;;;OAKG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAanE;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAOzC;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,QAAQ,EAAE,KAAK;IAqB1B;;;;;;;;;;;;;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;IAuDnC;;;;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"}
@@ -1,21 +1,53 @@
1
+ /**
2
+ * A captured scroll anchor — a snapshot of an element's viewport position before
3
+ * a layout-shifting operation. Pass to `restoreScrollAnchor` afterwards to compensate.
4
+ */
5
+ export interface ScrollAnchor {
6
+ element: HTMLElement;
7
+ /** The element's `getBoundingClientRect().top` at capture time. */
8
+ top: number;
9
+ }
10
+ /**
11
+ * Captures the current viewport-relative position of a given element.
12
+ * Call this *before* a layout-shifting operation, then pass the result to `restoreScrollAnchor`.
13
+ *
14
+ * @param element The element to anchor to.
15
+ * @returns A `ScrollAnchor` snapshot.
16
+ */
17
+ export declare function captureScrollAnchor(element: HTMLElement): ScrollAnchor;
1
18
  /**
2
19
  * Calculates the total height of fixed or sticky elements at the top of the viewport.
3
- * This includes the standard site header and any custom elements marked with [data-cv-scroll-offset].
4
- * Used to offset scroll positions so content isn't hidden behind these fixed elements.
20
+ * This includes the standard site header and any custom elements marked with
21
+ * `[data-cv-scroll-offset]`. Used to offset scroll positions so content isn't
22
+ * hidden behind these fixed elements.
5
23
  */
6
24
  export declare function getScrollTopOffset(): number;
7
25
  /**
8
- * Finds the highest element matching the selector that is currently in the viewport.
9
- * @param selector The CSS selector to match elements against.
10
- * @returns The HTMLElement of the highest visible element, or null if none are found.
26
+ * Returns the highest element matching a CSS selector that is visible in the
27
+ * current viewport (below any fixed/sticky header).
28
+ *
29
+ * @param selector CSS selector to match elements.
30
+ * @returns The highest visible matching element, or `null` if none found.
11
31
  */
12
32
  export declare function findHighestVisibleElement(selector: string): HTMLElement | null;
33
+ /** Function signature for requestAnimationFrame-like schedulers. */
34
+ export type FrameScheduler = (callback: FrameRequestCallback) => number;
13
35
  /**
14
- * Adjusts the scroll position to keep a specific element in the same visual location.
15
- * Useful when content additions/removals above might cause jumps.
36
+ * Allows tests to override the frame scheduler used by `restoreScrollAnchor`.
37
+ * Pass `null` to reset to the default implementation.
16
38
  */
17
- export declare function handleScrollAnchor(scrollAnchor: {
18
- element: HTMLElement;
19
- top: number;
20
- }): void;
39
+ export declare function setFrameScheduler(scheduler: FrameScheduler | null): void;
40
+ /**
41
+ * Restores the visual scroll position after a layout-shifting operation.
42
+ *
43
+ * Pass a `ScrollAnchor` captured *before* the layout change.
44
+ * Uses two `requestAnimationFrame` ticks to ensure the browser has fully
45
+ * reflowed the page before measuring and correcting.
46
+ *
47
+ * Note: When calling from a Svelte component, prefer using `tick()` before
48
+ * calling this function so Svelte's DOM updates are applied first.
49
+ *
50
+ * @param anchor A `ScrollAnchor` captured before the layout change.
51
+ */
52
+ export declare function restoreScrollAnchor(anchor: ScrollAnchor): void;
21
53
  //# sourceMappingURL=scroll-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/scroll-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CA0B3C;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAmC9E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkB5F"}
1
+ {"version":3,"file":"scroll-utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/scroll-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAoB3C;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAuB9E;AAED,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,oBAAoB,KAAK,MAAM,CAAC;AAmBxE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI,CAExE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAc9D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=anchor.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchor.test.d.ts","sourceRoot":"","sources":["../../../../../../tests/lib/features/anchor/anchor.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@custardui/custardui",
3
- "version": "2.0.0",
3
+ "version": "2.0.1-beta.0",
4
4
  "description": "A JavaScript dynamic custom views Library.",
5
5
  "type": "module",
6
6
  "main": "dist/custardui.min.js",
@@ -26,7 +26,7 @@
26
26
  "bump:patch": "npm version patch",
27
27
  "bump:minor": "npm version minor",
28
28
  "bump:major": "npm version major",
29
- "deploydocs:stable": "cd docs && markbind deploy -s stable-site.json",
29
+ "deploydocs:prod": "cd docs && markbind deploy -s prod-site.json",
30
30
  "deploydocs": "cd docs && markbind deploy -s site.json",
31
31
  "dev": "rollup -c -w",
32
32
  "watch": "rollup -c -w",
@@ -1,35 +0,0 @@
1
- import { type HighlightColorKey } from '$features/highlight/services/highlight-colors';
2
- import { type AnnotationCorner } from '$features/highlight/services/highlight-annotations';
3
- /**
4
- * Descriptor for an anchor that represents a DOM element.
5
- */
6
- export interface AnchorDescriptor {
7
- tag: string;
8
- index: number;
9
- parentId?: string;
10
- textSnippet: string;
11
- textHash: number;
12
- elementId?: string;
13
- color?: HighlightColorKey;
14
- annotation?: string;
15
- annotationCorner?: AnnotationCorner;
16
- }
17
- /**
18
- * Creates an AnchorDescriptor for a given DOM element.
19
- */
20
- export declare function createDescriptor(el: HTMLElement): AnchorDescriptor;
21
- /**
22
- * Serializes a list of AnchorDescriptors into a URL-safe string.
23
- */
24
- export declare function serialize(descriptors: AnchorDescriptor[]): string;
25
- /**
26
- * Deserializes a URL-safe string back into a list of AnchorDescriptors.
27
- */
28
- export declare function deserialize(encoded: string): AnchorDescriptor[];
29
- /**
30
- * Finds the best DOM element match(es) for a descriptor.
31
- * Returns an array of elements. For specific descriptors, usually contains 0 or 1 element.
32
- * For ID-only descriptors (tag='ANY'), may return multiple if duplicates exist.
33
- */
34
- export declare function resolve(root: HTMLElement, descriptor: AnchorDescriptor): HTMLElement[];
35
- //# sourceMappingURL=dom-element-locator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom-element-locator.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/dom-element-locator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,iBAAiB,EAAuC,MAAM,+CAA+C,CAAC;AAC5H,OAAO,EAAE,KAAK,gBAAgB,EAAiD,MAAM,oDAAoD,CAAC;AAE1I;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAuBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAkClE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAiDjE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAmD/D;AAsED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,GAAG,WAAW,EAAE,CA+EtF"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=dom-element-locator.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom-element-locator.test.d.ts","sourceRoot":"","sources":["../../../../../tests/lib/utils/dom-element-locator.test.ts"],"names":[],"mappings":""}