@aegis-framework/pandora 0.6.2 → 0.7.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.
@@ -1,18 +1,28 @@
1
- import Component from './Component';
1
+ import Component from './Component.js';
2
+ /** The version of Pandora that's running, such as `'0.7.0'` (`'development'` when it runs from source). */
3
+ export declare const VERSION: string;
2
4
  type ComponentClass = typeof Component & {
3
5
  tag: string;
4
6
  _registered?: boolean;
5
7
  };
6
- type StateSubscriber<T = unknown> = (newValue: T, oldValue: T | undefined) => void;
7
- type LifecycleCallback = (component: Component, tag: string) => void;
8
- type ErrorCallback = (error: Error, component: Component, tag: string, lifecycle: string) => void;
9
- type MiddlewareType = 'render';
10
- type RenderType = 'string' | 'lit';
11
- type Middleware = (component: Component, value: unknown, renderType?: RenderType) => unknown;
12
- type ComponentLoader = () => Promise<ComponentClass | {
8
+ /** Receives `(newValue, oldValue)` whenever a subscribed state key changes. */
9
+ export type StateSubscriber<T = unknown> = (newValue: T, oldValue: T | undefined) => void;
10
+ /** Receives every component instance (and its tag) passed to `onMount()` / `onUnmount()`. */
11
+ export type LifecycleCallback = (component: Component, tag: string) => void;
12
+ /** Receives lifecycle errors routed through `onError()`. */
13
+ export type ErrorCallback = (error: Error, component: Component, tag: string, lifecycle: string) => void;
14
+ /** The middleware pipelines `use()` accepts. */
15
+ export type MiddlewareType = 'render';
16
+ /** Whether a render value is a plain string template or a lit-html result. */
17
+ export type RenderType = 'string' | 'lit';
18
+ /** Transforms a component's render output; return the (possibly new) value. */
19
+ export type Middleware = (component: Component, value: unknown, renderType?: RenderType) => unknown;
20
+ /** Resolves a lazy component's class, directly or as a module's `default` export. */
21
+ export type ComponentLoader = () => Promise<ComponentClass | {
13
22
  default: ComponentClass;
14
23
  }>;
15
- interface ComponentStats {
24
+ /** What `stats()` reports for a tag. */
25
+ export interface ComponentStats {
16
26
  tag: string;
17
27
  instanceCount: number;
18
28
  isRegistered: boolean;
@@ -33,7 +43,7 @@ interface ComponentStats {
33
43
  * to construct.
34
44
  *
35
45
  * @example
36
- * import Registry, { Component, Register } from '@aegis-framework/pandora';
46
+ * import { Registry, Component, Register } from '@aegis-framework/pandora';
37
47
  *
38
48
  * @Register('theme-toggle')
39
49
  * class ThemeToggle extends Component {
@@ -201,13 +211,13 @@ declare class Registry {
201
211
  * @returns A detached component instance ready to attach.
202
212
  *
203
213
  * @example
204
- * const avatar = Registry.instantiate('user-avatar', {
214
+ * const avatar = Registry.instantiate<UserAvatar>('user-avatar', {
205
215
  * userId: 'u_42',
206
216
  * size: 48
207
217
  * });
208
218
  * document.body.appendChild(avatar);
209
219
  */
210
- static instantiate(tag: string, props: Record<string, any>): Component;
220
+ static instantiate<T extends Component = Component>(tag: string, props?: Record<string, any>): T;
211
221
  /**
212
222
  * Checks whether any component is registered under the given tag.
213
223
  *
@@ -436,7 +446,8 @@ declare class Registry {
436
446
  * Registry.stats();
437
447
  * // [{ tag: 'my-button', ... }, { tag: 'theme-toggle', ... }]
438
448
  */
439
- static stats(tag?: string): ComponentStats | ComponentStats[];
449
+ static stats(tag: string): ComponentStats;
450
+ static stats(): ComponentStats[];
440
451
  /**
441
452
  * Observes every component mount across your app.
442
453
  *
@@ -662,5 +673,32 @@ declare class Registry {
662
673
  */
663
674
  static _hasMiddleware(type: MiddlewareType): boolean;
664
675
  }
676
+ /** What the first copy of Pandora leaves on `globalThis`. */
677
+ export interface RegisteredCopy {
678
+ version: string;
679
+ registry: unknown;
680
+ }
681
+ /**
682
+ * Registers this copy of Pandora on `scope`, and reports a different copy
683
+ * that's already there.
684
+ *
685
+ * Everything a component connects to lives in one module: the Registry's
686
+ * tags, global state, middleware and lifecycle hooks. When a page ends up
687
+ * with two copies of Pandora (two installed versions, the browser bundle
688
+ * next to a bundled build, or one import resolved to another file), each
689
+ * copy keeps its own, so nothing fails loudly: a component registered with
690
+ * one is unknown to the other, `@Subscribe` never hears the other's state,
691
+ * and a tag both define throws. Re-importing the same module never
692
+ * evaluates it again, so only a real second copy reports. It logs an error
693
+ * instead of throwing, because the page may still work.
694
+ *
695
+ * @param registry - The Registry of the copy being evaluated.
696
+ * @param version - That copy's version.
697
+ * @param scope - Where copies register; tests pass their own object.
698
+ * @returns `true` when this is the only copy, `false` when another one was found.
699
+ *
700
+ * @internal
701
+ */
702
+ export declare const registerCopy: (registry: unknown, version: string, scope?: object) => boolean;
665
703
  export default Registry;
666
704
  //# sourceMappingURL=Registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Registry.d.ts","sourceRoot":"","sources":["../../src/Registry.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAMpC,KAAK,cAAc,GAAG,OAAO,SAAS,GAAG;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,KAAK,eAAe,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,CAAC;AACnF,KAAK,iBAAiB,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AACrE,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;AAClG,KAAK,cAAc,GAAG,QAAQ,CAAC;AAC/B,KAAK,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC;AACnC,KAAK,UAAU,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,UAAU,KAAK,OAAO,CAAC;AAC7F,KAAK,eAAe,GAAG,MAAM,OAAO,CAAC,cAAc,GAAG;IAAE,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC,CAAC;AAEnF,UAAU,cAAc;IACtB,GAAG,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kB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC1D;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElC;IAED;;;;;;;;;;;;OAYG;IACH,OAAa,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/C;IAQD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,IAAI,CAKnE;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAYpH;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAEnD;CACF;AAQD,6DAA6D;AAC7D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,YAAY,aAAc,OAAO,WAAW,MAAM,UAAS,MAAM,KAAgB,OAyB7F,CAAC;eAIa,QAAQ"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * What a string render keeps from the markup it replaces: the element that
3
+ * had focus and the scroll positions of the elements inside the component.
4
+ *
5
+ * A string render rebuilds the component's content, so every element in it
6
+ * is new and the browser forgets which one had focus and how far each was
7
+ * scrolled. Before the render, Pandora notes how to find each of them again;
8
+ * after it, it finds the new element in the same place and gives it back its
9
+ * focus, text selection and scroll position. lit-html renders update the
10
+ * elements they already have, so they don't need this.
11
+ *
12
+ * An element is found again by its `data-key` attribute, then its `id`, then
13
+ * its position among its parent's children (checked against its tag name).
14
+ * Give elements whose position can change a `data-key`.
15
+ */
16
+ /**
17
+ * Notes the focused element and the scroll positions inside `root`, and
18
+ * returns a function that restores them once the render has replaced the
19
+ * markup. Focus is only given back when the render took it away, so a render
20
+ * never steals focus from elsewhere on the page.
21
+ *
22
+ * @param root - Where the component renders: the element itself, or its shadow root.
23
+ * @param scrolled - The elements inside `root` that have been scrolled.
24
+ * @returns A function to call right after the render.
25
+ *
26
+ * @internal
27
+ */
28
+ export declare const keepFocusAndScroll: (root: ParentNode, scrolled: Set<Element>) => (() => void);
29
+ //# sourceMappingURL=RenderState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderState.d.ts","sourceRoot":"","sources":["../../src/RenderState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA4GH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,SAAU,UAAU,YAAY,GAAG,CAAC,OAAO,CAAC,KAAG,CAAC,MAAM,IAAI,CAmDxF,CAAC"}
@@ -1,6 +1,6 @@
1
- import { TemplateResult, nothing } from 'lit-html';
2
- import Component from './Component';
3
- import { Style } from './Types';
1
+ import { nothing, type TemplateResult } from 'lit-html';
2
+ import Component from './Component.js';
3
+ import type { Style } from './Types.js';
4
4
  /**
5
5
  * Component subclass that renders into an open shadow root instead of the host
6
6
  * element. Pick it when you need style isolation or slot composition;
@@ -85,6 +85,11 @@ declare class ShadowComponent extends Component {
85
85
  * }
86
86
  */
87
87
  setStyle(style: Style | string, reset?: boolean): Style;
88
+ /**
89
+ * @internal
90
+ * Where a shadow component renders: its shadow root.
91
+ */
92
+ protected _renderRoot(): ParentNode;
88
93
  /**
89
94
  * @internal
90
95
  * Shadow-root variant of the lit-html render hook. Scopes the render target
@@ -92,6 +97,13 @@ declare class ShadowComponent extends Component {
92
97
  * against the component.
93
98
  */
94
99
  protected _applyLitRender(result: TemplateResult | typeof nothing): void;
100
+ /**
101
+ * @internal
102
+ * Shadow-root variant of the render-root reset. Clears the shadow tree and
103
+ * drops lit-html's cached root part so a switch between string and lit output
104
+ * re-initializes cleanly inside the shadow root.
105
+ */
106
+ protected _resetRenderRoot(): void;
95
107
  /**
96
108
  * @internal
97
109
  * Shadow-root variant of the string render hook. Wipes the existing shadow
@@ -1 +1 @@
1
- {"version":3,"file":"ShadowComponent.d.ts","sourceRoot":"","sources":["../../src/ShadowComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExE,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,cAAM,eAAgB,SAAQ,SAAS;IACrC;;;;OAIG;IACH,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAEjC;;;;;OAKG;IACH,iBAA0B,WAAW,EAAE,aAAa,GAAG,IAAI,CAAQ;IAEnE;;;OAGG;IACH,iBAA0B,YAAY,EAAE,KAAK,CAAM;IAEnD;;;;;;OAMG;;IAMH;;;;;;;;;;;;;;;;;;;;OAoBG;IACM,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,KAAK;IA2CvE;;;;;OAKG;cACgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,OAAO,GAAG,IAAI;IAIjF;;;;;OAKG;cACgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAezD;;;;;;;;;;;;;OAaG;IACH,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED,IAAI,UAAU,CAAC,MAAM,EAAE,UAAU,EAEhC;IAED;;;;;;;;;;;;;;;;OAgBG;IACM,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAIvE;;;;;;;;;;;;;;OAcG;IACM,QAAQ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SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAEtE;IAED;;;;;;;;;;;;;;OAcG;IACM,QAAQ,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAE9E;CACF;eAEc,eAAe"}
@@ -7,7 +7,7 @@
7
7
  * against stable DOM: wait for microtask renders to flush, mount a tag into
8
8
  * the document, and reset global Registry state between cases.
9
9
  */
10
- import Component from './Component';
10
+ import Component from './Component.js';
11
11
  /**
12
12
  * Flush pending microtask renders.
13
13
  *
@@ -24,13 +24,16 @@ import Component from './Component';
24
24
  * await flush();
25
25
  * expect(el.textContent).toContain('3');
26
26
  */
27
- export declare function flush(): Promise<void>;
27
+ export declare const flush: () => Promise<void>;
28
28
  /**
29
29
  * Wait until a component reports that it is ready.
30
30
  *
31
- * Resolves immediately if `element.isReady` is already `true`. Otherwise,
32
- * polls on `requestAnimationFrame` and rejects if the component does not
33
- * finish its first render within `timeout` milliseconds.
31
+ * Resolves immediately if `element.isReady` is already `true`. Otherwise it
32
+ * listens for the component's `pandora:ready` event and also polls on a short
33
+ * timer, rejecting if the component does not finish its first render within
34
+ * `timeout` milliseconds. It avoids `requestAnimationFrame`, whose callbacks
35
+ * are suspended when the page isn't painting (headless runs, background tabs),
36
+ * which would otherwise hang the wait even after the component became ready.
34
37
  *
35
38
  * @param element - The component element to observe.
36
39
  * @param timeout - How long to wait before rejecting, in milliseconds. Defaults to 5000.
@@ -40,7 +43,7 @@ export declare function flush(): Promise<void>;
40
43
  * const el = document.querySelector('user-avatar')!;
41
44
  * await whenReady(el);
42
45
  */
43
- export declare function whenReady(element: Element, timeout?: number): Promise<void>;
46
+ export declare const whenReady: (element: Element, timeout?: number) => Promise<void>;
44
47
  /**
45
48
  * Reset Registry state between tests.
46
49
  *
@@ -53,7 +56,7 @@ export declare function whenReady(element: Element, timeout?: number): Promise<v
53
56
  * resetRegistry();
54
57
  * });
55
58
  */
56
- export declare function resetRegistry(): void;
59
+ export declare const resetRegistry: () => void;
57
60
  /**
58
61
  * Create a component, append it to the DOM, and wait for it to be ready.
59
62
  *
@@ -67,8 +70,8 @@ export declare function resetRegistry(): void;
67
70
  * @returns The mounted component once it has finished its first render.
68
71
  *
69
72
  * @example
70
- * const el = await mount('my-greeting', document.body, '<span slot="name">Ada</span>');
73
+ * const el = await mount<MyGreeting>('my-greeting', document.body, '<span slot="name">Ada</span>');
71
74
  * expect(el.textContent).toContain('Ada');
72
75
  */
73
- export declare function mount(tagName: string, container?: Element, innerHTML?: string): Promise<Component>;
76
+ export declare const mount: <T extends Component = Component>(tagName: string, container?: Element, innerHTML?: string) => Promise<T>;
74
77
  //# sourceMappingURL=Testing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Testing.d.ts","sourceRoot":"","sources":["../../src/Testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAI3C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBjF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAIpC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAYxG"}
1
+ {"version":3,"file":"Testing.d.ts","sourceRoot":"","sources":["../../src/Testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAGvC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,KAAK,QAAa,OAAO,CAAC,IAAI,CAI1C,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS,YAAa,OAAO,YAAW,MAAM,KAAU,OAAO,CAAC,IAAI,CAkChF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,QAAO,IAIhC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,KAAK,GAAU,CAAC,SAAS,SAAS,GAAG,SAAS,WAAW,MAAM,cAAc,OAAO,cAAc,MAAM,KAAG,OAAO,CAAC,CAAC,CAYhI,CAAC"}
@@ -47,5 +47,5 @@ export interface TypedState<T> {
47
47
  * state.theme.set('dark');
48
48
  * const unsubscribe = state.user.subscribe(user => console.log(user));
49
49
  */
50
- export declare function createState<T>(key: string, defaultValue?: T): TypedState<T>;
50
+ export declare const createState: <T>(key: string, defaultValue?: T) => TypedState<T>;
51
51
  //# sourceMappingURL=TypedState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TypedState.d.ts","sourceRoot":"","sources":["../../src/TypedState.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,gGAAgG;IAChG,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAErB,oFAAoF;IACpF,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAE5F,sEAAsE;IACtE,GAAG,IAAI,OAAO,CAAC;IAEf,qFAAqF;IACrF,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAuB3E"}
1
+ {"version":3,"file":"TypedState.d.ts","sourceRoot":"","sources":["../../src/TypedState.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,gGAAgG;IAChG,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAErB,oFAAoF;IACpF,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAEpB;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAE5F,sEAAsE;IACtE,GAAG,IAAI,OAAO,CAAC;IAEf,qFAAqF;IACrF,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,OAAO,MAAM,iBAAiB,CAAC,KAAG,UAAU,CAAC,CAAC,CAuB1E,CAAC"}
@@ -1,4 +1,4 @@
1
- import { TemplateResult, nothing } from 'lit-html';
1
+ import type { nothing, TemplateResult } from 'lit-html';
2
2
  /**
3
3
  * A single CSS declaration value. Numbers are serialized as-is, so
4
4
  * unitless properties (`zIndex: 2`) and explicit units (`width: '2rem'`)
@@ -48,9 +48,11 @@ export type TemplateFunction = (context: any) => TemplateValue | Promise<Templat
48
48
  * Options accepted by the imperative `reactive()` helper when turning a
49
49
  * plain field into a tracked one.
50
50
  *
51
- * - `initialValue`: seed the field if it has no value yet.
51
+ * - `initialValue`: seed the field if it has no value yet. Without it, the
52
+ * field keeps whatever value it already holds (a class field initializer).
52
53
  * - `render`: set to `false` to opt out of auto-rerender on change.
53
54
  * - `onChange`: callback fired after each write, with new and old values.
55
+ * Unlike `@Watch`, it fires right away even inside `batch()`.
54
56
  * - `equals`: custom equality check; defaults to `===` (strict identity).
55
57
  */
56
58
  export interface ReactiveOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/Types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAMnD;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAC;CACrD;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC;AAM9B;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,OAAO,GAAG,IAAI,CAAC;AAE5E;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAMxF;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;CAC9C;AAMD;;;;;GAKG;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;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAMxF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;CAC9C;AAMD;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;CAC7C;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -1,5 +1,25 @@
1
- import { TemplateResult } from 'lit-html';
2
- import { CSSObject, DecoratorInstance, DecoratorEffect, ReactiveOptions } from './Types';
1
+ import type { TemplateResult } from 'lit-html';
2
+ import type { CSSObject, DecoratorEffect, DecoratorInstance, ReactiveOptions } from './Types.js';
3
+ /** Metadata slot: array of attribute names that `@Attribute` wants observed on the element. @internal */
4
+ export declare const PROP_ATTRIBUTES: unique symbol;
5
+ /** Metadata slot: per-instance effect functions to replay when a class is evolved or lazily registered. @internal */
6
+ export declare const DECORATOR_EFFECTS: unique symbol;
7
+ /** Metadata slot: teardown callbacks attached to an instance so the outgoing class can unwind before an evolve swap. @internal */
8
+ export declare const DECORATOR_TEARDOWNS: unique symbol;
9
+ /** Metadata slot: `@Watch` registrations pairing a watched property name with the handler method name. @internal */
10
+ export declare const WATCH_HANDLERS: unique symbol;
11
+ /** Metadata slot: set of property names declared reactive via `@State`, `@Attribute`, or `@Property` — used to validate `@Watch` targets. @internal */
12
+ export declare const REACTIVE_FIELDS: unique symbol;
13
+ /** Metadata slot: array of `@Listen` registrations describing event name, target resolver, and options. @internal */
14
+ export declare const LISTEN_HANDLERS: unique symbol;
15
+ /** Metadata slot: resolved `@Style` output (stylesheet text and encapsulation hints) attached by the style decorator. @internal */
16
+ export declare const STYLE_METADATA: unique symbol;
17
+ /** Metadata slot: map from observed attribute names to the handlers that sync them into the instance field. @internal */
18
+ export declare const ATTR_HANDLERS: unique symbol;
19
+ /** Metadata slot: per-field `@Subscribe` registrations that wire a store/observable into a property. @internal */
20
+ export declare const SUBSCRIBE_HANDLERS: unique symbol;
21
+ /** Instance slot: attribute writes that wait for the element to connect, keyed by attribute name. @internal */
22
+ export declare const PENDING_ATTRIBUTE_WRITES: unique symbol;
3
23
  /**
4
24
  * Invokes a callback and always returns a Promise, regardless of whether the
5
25
  * callback itself is sync or async. Lets hooks that may or may not be
@@ -7,7 +27,7 @@ import { CSSObject, DecoratorInstance, DecoratorEffect, ReactiveOptions } from '
7
27
  *
8
28
  * @internal
9
29
  */
10
- export declare function callAsync<T>(callable: (...args: any[]) => T, context: any, ...args: any[]): Promise<T>;
30
+ export declare const callAsync: <T>(callable: (...args: any[]) => T, context: any, ...args: any[]) => Promise<T>;
11
31
  /**
12
32
  * Duck-types a value as a lit-html `TemplateResult` by looking for its
13
33
  * `_$litType$` brand. We avoid `instanceof` so the check survives across
@@ -15,7 +35,7 @@ export declare function callAsync<T>(callable: (...args: any[]) => T, context: a
15
35
  *
16
36
  * @internal
17
37
  */
18
- export declare function isTemplateResult(value: unknown): value is TemplateResult;
38
+ export declare const isTemplateResult: (value: unknown) => value is TemplateResult;
19
39
  /**
20
40
  * Flattens a nested `CSSObject` into a CSS string for injection at render
21
41
  * time. When `encapsulation` is a tag selector (light-DOM mode), selectors
@@ -24,46 +44,35 @@ export declare function isTemplateResult(value: unknown): value is TemplateResul
24
44
  *
25
45
  * @internal
26
46
  */
27
- export declare function deserializeCSS(object: CSSObject, encapsulation?: string, level?: number): string;
28
- /** Metadata slot: array of attribute names that `@Attribute` wants observed on the element. @internal */
29
- export declare const PROP_ATTRIBUTES: unique symbol;
30
- /** Metadata slot: per-instance effect functions to replay when a class is evolved or lazily registered. @internal */
31
- export declare const DECORATOR_EFFECTS: unique symbol;
32
- /** Metadata slot: teardown callbacks attached to an instance so the outgoing class can unwind before an evolve swap. @internal */
33
- export declare const DECORATOR_TEARDOWNS: unique symbol;
34
- /** Metadata slot: `@Watch` registrations pairing a watched property name with the handler method name. @internal */
35
- export declare const WATCH_HANDLERS: unique symbol;
36
- /** Metadata slot: set of property names declared reactive via `@State`, `@Attribute`, or `@Property` — used to validate `@Watch` targets. @internal */
37
- export declare const REACTIVE_FIELDS: unique symbol;
38
- /** Metadata slot: array of `@Listen` registrations describing event name, target resolver, and options. @internal */
39
- export declare const LISTEN_HANDLERS: unique symbol;
40
- /** Metadata slot: resolved `@Style` output (stylesheet text and encapsulation hints) attached by the style decorator. @internal */
41
- export declare const STYLE_METADATA: unique symbol;
42
- /** Metadata slot: map from observed attribute names to the handlers that sync them into the instance field. @internal */
43
- export declare const ATTR_HANDLERS: unique symbol;
44
- /** Metadata slot: per-field `@Subscribe` registrations that wire a store/observable into a property. @internal */
45
- export declare const SUBSCRIBE_HANDLERS: unique symbol;
47
+ export declare const deserializeCSS: (object: CSSObject, encapsulation?: string, level?: number) => string;
46
48
  /**
47
- * Register a per-instance effect on a class's metadata.
49
+ * Register a per-instance effect to replay on hot swaps.
48
50
  *
49
- * Custom-decorator authors call this to attach work that should run once
50
- * for each component instance — typically during `connectedCallback`. The
51
- * Registry replays these effects when a class is evolved or lazily
52
- * registered, so your decorator keeps working across hot swaps.
51
+ * The Registry runs these effects on live instances when a class is swapped
52
+ * in with `Registry.evolve()` or a `Registry.lazy()` placeholder loads its
53
+ * real implementation, so a custom decorator keeps working across both.
54
+ * Effects do **not** run when an instance is first constructed: install the
55
+ * same behavior from `context.addInitializer` too, as shown below.
53
56
  *
54
57
  * @param meta - The decorator-context metadata object (`context.metadata`).
55
58
  * @param effect - A function that receives the component instance.
56
59
  *
57
60
  * @example
58
- * function LogMount(): ClassDecorator {
59
- * return (target, context) => {
60
- * addDecoratorEffect(context.metadata, (instance) => {
61
- * console.log(`${instance.tagName} mounted`);
62
- * });
61
+ * function Logged(_target: undefined, context: ClassFieldDecoratorContext) {
62
+ * const propertyKey = String(context.name);
63
+ * const install = (instance: DecoratorInstance) => {
64
+ * reactive(instance, propertyKey, { onChange: (value) => console.log(propertyKey, value) });
63
65
  * };
66
+ *
67
+ * // Replayed by evolve() / lazy() on live instances...
68
+ * addDecoratorEffect(context.metadata, install);
69
+ * // ...and run for every newly constructed instance.
70
+ * context.addInitializer(function () {
71
+ * install(this as DecoratorInstance);
72
+ * });
64
73
  * }
65
74
  */
66
- export declare function addDecoratorEffect(meta: Record<symbol, unknown>, effect: DecoratorEffect): void;
75
+ export declare const addDecoratorEffect: (meta: Record<symbol, unknown>, effect: DecoratorEffect) => void;
67
76
  /**
68
77
  * Register a teardown function for a reactive binding on a component instance.
69
78
  *
@@ -74,53 +83,101 @@ export declare function addDecoratorEffect(meta: Record<symbol, unknown>, effect
74
83
  *
75
84
  * Teardowns registered via this helper do NOT automatically run on
76
85
  * disconnect. If your decorator installs listeners or subscriptions that
77
- * must unwind on disconnect, register them in the decorator effect and
78
- * handle their removal explicitly in that effect's returned cleanup, or
79
- * through the component's own disconnect path.
86
+ * must unwind on disconnect, remove them from the component's own
87
+ * `willUnmount()` / `didUnmount()` path.
80
88
  *
81
89
  * @param instance - The component instance to attach the teardown to.
82
90
  * @param teardown - A function that releases any resources held by the decorator when the class is evolved or replaced.
83
91
  *
84
92
  * @example
85
- * function ResizeAware(): ClassDecorator {
86
- * return (target, context) => {
87
- * addDecoratorEffect(context.metadata, (instance) => {
88
- * const observer = new ResizeObserver(() => {});
89
- * observer.observe(instance);
90
- * // Runs when the class is evolved or lazily replaced, so the
91
- * // incoming implementation can install its own observer cleanly.
92
- * addTeardown(instance, () => observer.disconnect());
93
- * });
94
- * };
93
+ * function applyResizeAware(instance: DecoratorInstance) {
94
+ * const observer = new ResizeObserver(() => {});
95
+ * observer.observe(instance);
96
+ * // Runs when the class is evolved or lazily replaced, so the incoming
97
+ * // implementation can install its own observer cleanly.
98
+ * addTeardown(instance, () => observer.disconnect());
99
+ * }
100
+ */
101
+ export declare const addTeardown: (instance: DecoratorInstance, teardown: () => void) => void;
102
+ /**
103
+ * Writes the attributes an element couldn't have while it was constructed.
104
+ * `document.createElement()` throws when a new element already has
105
+ * attributes, so `@Attribute` and `@Property({ attribute })` defaults wait
106
+ * for `connectedCallback`, which calls this before the first render.
107
+ *
108
+ * @internal
109
+ */
110
+ export declare const writePendingAttributes: (instance: object) => void;
111
+ /**
112
+ * The names of a component class's reactive fields: the ones declared with
113
+ * `@State`, `@Property` or `@Attribute`, inherited ones included. Fields made
114
+ * reactive at runtime with `reactive()` aren't listed, since they belong to
115
+ * an instance, not to the class.
116
+ *
117
+ * Use it to check a class against a contract (does it declare `value`?),
118
+ * to build tooling, or to warn about a name before an instance exists.
119
+ *
120
+ * @param componentClass - A component class, decorated or not.
121
+ * @returns A new set of field names; empty when the class declares none.
122
+ *
123
+ * @example
124
+ * class Counter extends Component {
125
+ * @State() count = 0;
126
+ * @Attribute() step = 1;
95
127
  * }
128
+ *
129
+ * reactiveFields(Counter); // Set { 'count', 'step' }
96
130
  */
97
- export declare function addTeardown(instance: DecoratorInstance, teardown: () => void): void;
131
+ export declare const reactiveFields: (componentClass: abstract new (...args: any[]) => unknown) => Set<string>;
132
+ /**
133
+ * One reactive write recorded while a `batch()` is open.
134
+ *
135
+ * @internal
136
+ */
137
+ export interface BatchedChange {
138
+ property: string;
139
+ oldValue: unknown;
140
+ newValue: unknown;
141
+ shouldRender: boolean;
142
+ source: string;
143
+ }
144
+ /**
145
+ * Records a reactive write made inside `batch()` so its `@Watch` callbacks
146
+ * and `didChange` run once when the batch closes. Repeated writes to the
147
+ * same field collapse into a single first-to-last change. Returns `false`
148
+ * (recording nothing) when the instance isn't batching, so the caller
149
+ * notifies right away instead.
150
+ *
151
+ * @internal
152
+ */
153
+ export declare const recordBatchedChange: (instance: object, change: BatchedChange) => boolean;
98
154
  /**
99
155
  * Make a plain field on a component instance reactive at runtime.
100
156
  *
101
157
  * This is the imperative escape hatch for `@State`: use it when you cannot
102
158
  * reach for decorators (for example, in environments without decorator
103
159
  * support, or when wiring up a field from a constructor or custom
104
- * decorator). The field keeps its current value, but writes now trigger
105
- * `@Watch` handlers, `didChange`, and an auto-rerender unless you opt out.
160
+ * decorator). The field keeps its current value (unless you pass
161
+ * `initialValue`), but writes now trigger `@Watch` handlers, `didChange`,
162
+ * and an auto-rerender unless you opt out. Writes inside `batch()` defer
163
+ * `@Watch` and `didChange` until the batch closes, like decorated fields.
106
164
  *
107
165
  * @param instance - The component instance that owns the field.
108
166
  * @param propertyKey - The field name to make reactive.
109
167
  * @param options - Optional initial value, change callback, equality check, or `render: false` to skip auto-rerender.
110
168
  *
111
169
  * @example
112
- * // A custom field decorator that installs reactivity at runtime, so the
113
- * // author doesn't have to compose it with @State at every call site.
114
- * function Counter(initialValue: number = 0): (target: undefined, context: ClassFieldDecoratorContext) => void {
115
- * return (_target, context) => {
116
- * const propertyKey = String(context.name);
117
- * addDecoratorEffect(context.metadata, (instance) => {
118
- * reactive(instance, propertyKey, { initialValue });
119
- * });
120
- * };
170
+ * // Without decorators: make a plain field reactive from the constructor.
171
+ * class MyCounter extends Component {
172
+ * count = 0;
173
+ *
174
+ * constructor() {
175
+ * super();
176
+ * reactive(this, 'count'); // keeps the initial 0, re-renders on change
177
+ * }
121
178
  * }
122
179
  */
123
- export declare function reactive(instance: DecoratorInstance, propertyKey: string, options?: ReactiveOptions): void;
180
+ export declare const reactive: (instance: DecoratorInstance, propertyKey: string, options?: ReactiveOptions) => void;
124
181
  /**
125
182
  * Coerces a raw attribute string into its JavaScript value: `null` becomes
126
183
  * `undefined`, the empty string and `"true"` become `true`, `"false"` becomes
@@ -129,7 +186,7 @@ export declare function reactive(instance: DecoratorInstance, propertyKey: strin
129
186
  *
130
187
  * @internal
131
188
  */
132
- export declare function parseAttributeValue(value: string | null): unknown;
189
+ export declare const parseAttributeValue: (value: string | null) => unknown;
133
190
  /**
134
191
  * Resolves the `target` option of `@Listen` to an actual `EventTarget`. The
135
192
  * strings `"window"` and `"document"` map to their globals, `"self"` (or an
@@ -140,5 +197,5 @@ export declare function parseAttributeValue(value: string | null): unknown;
140
197
  *
141
198
  * @internal
142
199
  */
143
- export declare function resolveListenerTarget(host: HTMLElement, targetOption?: string, query?: (selector: string) => Element | null): EventTarget | null;
200
+ export declare const resolveListenerTarget: (host: HTMLElement, targetOption?: string, query?: (selector: string) => Element | null) => EventTarget | null;
144
201
  //# sourceMappingURL=Util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../src/Util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAA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mBAAmB,aAAc,MAAM,UAAU,aAAa,KAAG,OAoB7E,CAAC;AAqBF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,QAAQ,aACT,iBAAiB,eACd,MAAM,YACV,eAAe,KACvB,IAqEF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,KAAG,OAwB1D,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,SAC1B,WAAW,iBACF,MAAM,UACb,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,KAC3C,WAAW,GAAG,IAchB,CAAC"}
@@ -12,7 +12,7 @@
12
12
  * bundlers cannot yet expose an ESM module as a browser global on their
13
13
  * own; once/if Bun grows that capability, the file can go away.
14
14
  */
15
- import * as Pandora from './index';
15
+ import * as Pandora from './index.js';
16
16
  declare global {
17
17
  interface Window {
18
18
  Pandora: typeof Pandora;
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,OAAO,EAAE,OAAO,OAAO,CAAC;KACzB;CACF"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,OAAO,EAAE,OAAO,OAAO,CAAC;KACzB;CACF"}