@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.
- package/README.md +226 -27
- package/dist/pandora.browser.js +15 -26
- package/dist/pandora.browser.js.map +38 -37
- package/dist/pandora.js +15 -26
- package/dist/pandora.js.map +37 -36
- package/dist/types/Component.d.ts +226 -30
- package/dist/types/Component.d.ts.map +1 -1
- package/dist/types/Decorators.d.ts +47 -33
- package/dist/types/Decorators.d.ts.map +1 -1
- package/dist/types/Registry.d.ts +51 -13
- package/dist/types/Registry.d.ts.map +1 -1
- package/dist/types/RenderState.d.ts +29 -0
- package/dist/types/RenderState.d.ts.map +1 -0
- package/dist/types/ShadowComponent.d.ts +15 -3
- package/dist/types/ShadowComponent.d.ts.map +1 -1
- package/dist/types/Testing.d.ts +12 -9
- package/dist/types/Testing.d.ts.map +1 -1
- package/dist/types/TypedState.d.ts +1 -1
- package/dist/types/TypedState.d.ts.map +1 -1
- package/dist/types/Types.d.ts +4 -2
- package/dist/types/Types.d.ts.map +1 -1
- package/dist/types/Util.d.ts +119 -62
- package/dist/types/Util.d.ts.map +1 -1
- package/dist/types/browser.d.ts +1 -1
- package/dist/types/browser.d.ts.map +1 -1
- package/dist/types/index.d.ts +20 -17
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +31 -24
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { SubscribeHandler } from './Types';
|
|
3
|
-
import { Style, TemplateValue, TemplateFunction } from './Types';
|
|
1
|
+
import { nothing, type TemplateResult } from 'lit-html';
|
|
2
|
+
import type { Style, SubscribeHandler, TemplateFunction, TemplateValue } from './Types.js';
|
|
4
3
|
/**
|
|
5
4
|
* The base class every Pandora component extends.
|
|
6
5
|
*
|
|
@@ -31,6 +30,27 @@ import { Style, TemplateValue, TemplateFunction } from './Types';
|
|
|
31
30
|
* // <my-greeting></my-greeting>
|
|
32
31
|
*/
|
|
33
32
|
declare class Component extends HTMLElement {
|
|
33
|
+
/**
|
|
34
|
+
* Values the element was given before its class was defined. Declared
|
|
35
|
+
* first, so it's taken before any field initializer can hide them.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
private _valuesBeforeUpgrade;
|
|
40
|
+
/**
|
|
41
|
+
* The elements inside the component that have been scrolled, so a string
|
|
42
|
+
* render can scroll their replacements back to the same place.
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
protected _scrolledElements: Set<Element>;
|
|
47
|
+
/**
|
|
48
|
+
* The class this instance was counted under in `connectedInstances()`
|
|
49
|
+
* while it's connected.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
private _connectedAs?;
|
|
34
54
|
/**
|
|
35
55
|
* The inner HTML the component was mounted with, captured before the first
|
|
36
56
|
* render runs. Exposed publicly as `slotContent`.
|
|
@@ -84,6 +104,15 @@ declare class Component extends HTMLElement {
|
|
|
84
104
|
* @internal
|
|
85
105
|
*/
|
|
86
106
|
protected _renderQueued: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* The kind of output (`'string'` or `'lit'`) applied by the last render that
|
|
109
|
+
* actually wrote to the DOM. Lets `_render` detect a switch between string
|
|
110
|
+
* and lit-html output and reset the render root so the incoming renderer
|
|
111
|
+
* starts from a clean slate instead of inheriting the other's stale nodes.
|
|
112
|
+
*
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
protected _lastRenderType?: 'string' | 'lit';
|
|
87
116
|
/**
|
|
88
117
|
* The object-form style currently applied through `setStyle`. Persisted so
|
|
89
118
|
* that merge-mode updates can layer new rules on top of previous ones.
|
|
@@ -128,6 +157,25 @@ declare class Component extends HTMLElement {
|
|
|
128
157
|
* @internal
|
|
129
158
|
*/
|
|
130
159
|
protected static _template?: string | TemplateFunction;
|
|
160
|
+
/**
|
|
161
|
+
* Whether a string render gives back focus and scroll positions.
|
|
162
|
+
*
|
|
163
|
+
* A `render()` that returns a string replaces every element inside the
|
|
164
|
+
* component, so the browser loses which one had focus and how far each
|
|
165
|
+
* was scrolled. Turn this on and Pandora finds the replacement of the
|
|
166
|
+
* focused element and of each scrolled one, by its `data-key`, its `id`
|
|
167
|
+
* or its position, and restores them. lit-html renders keep their
|
|
168
|
+
* elements and don't need it.
|
|
169
|
+
*
|
|
170
|
+
* It's off by default because components that already move focus
|
|
171
|
+
* themselves after a render (in `didRender()`) expect it to be lost.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* class TrackList extends Component {
|
|
175
|
+
* static override keepFocusAndScroll = true;
|
|
176
|
+
* }
|
|
177
|
+
*/
|
|
178
|
+
static keepFocusAndScroll: boolean;
|
|
131
179
|
/**
|
|
132
180
|
* Backing storage for attributes registered manually through the
|
|
133
181
|
* `observedAttributes` setter. Merged with `@Attribute` / `@Property`
|
|
@@ -322,6 +370,45 @@ declare class Component extends HTMLElement {
|
|
|
322
370
|
* }
|
|
323
371
|
*/
|
|
324
372
|
constructor();
|
|
373
|
+
/**
|
|
374
|
+
* The instances of this class that are in the document right now, in the
|
|
375
|
+
* order they connected. Only instances of exactly this class: a subclass
|
|
376
|
+
* has its own set. Use it to reach every live instance without searching
|
|
377
|
+
* the DOM, including the ones inside other components' shadow roots.
|
|
378
|
+
*
|
|
379
|
+
* The set is live: it changes as instances connect and disconnect. Copy it
|
|
380
|
+
* (`[...Dialog.connectedInstances()]`) before iterating if what you do can
|
|
381
|
+
* add or remove components.
|
|
382
|
+
*
|
|
383
|
+
* @returns A read-only view of the connected instances.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* for (const dialog of Dialog.connectedInstances()) {
|
|
387
|
+
* dialog.close();
|
|
388
|
+
* }
|
|
389
|
+
*/
|
|
390
|
+
static connectedInstances<T extends typeof Component>(this: T): ReadonlySet<InstanceType<T>>;
|
|
391
|
+
/**
|
|
392
|
+
* Where the component renders: the element itself. `ShadowComponent`
|
|
393
|
+
* returns its shadow root.
|
|
394
|
+
*
|
|
395
|
+
* @internal
|
|
396
|
+
*/
|
|
397
|
+
protected _renderRoot(): ParentNode;
|
|
398
|
+
/**
|
|
399
|
+
* Notes the elements under `root` that the user (or code) scrolls. Scroll
|
|
400
|
+
* events don't bubble, so this listens in the capture phase.
|
|
401
|
+
*
|
|
402
|
+
* @internal
|
|
403
|
+
*/
|
|
404
|
+
protected _trackScrolling(root: EventTarget): void;
|
|
405
|
+
/**
|
|
406
|
+
* Assigns the values the element was given before its class was defined,
|
|
407
|
+
* through the class's own setters and reactive fields.
|
|
408
|
+
*
|
|
409
|
+
* @internal
|
|
410
|
+
*/
|
|
411
|
+
private _assignValuesBeforeUpgrade;
|
|
325
412
|
/**
|
|
326
413
|
* The original inner HTML the component was mounted with.
|
|
327
414
|
*
|
|
@@ -345,8 +432,9 @@ declare class Component extends HTMLElement {
|
|
|
345
432
|
/**
|
|
346
433
|
* Whether the component is currently attached to the DOM.
|
|
347
434
|
*
|
|
348
|
-
* Flips to `true`
|
|
349
|
-
* `
|
|
435
|
+
* Flips to `true` at the start of `connectedCallback()` and back to
|
|
436
|
+
* `false` at the start of `disconnectedCallback()`, matching the native
|
|
437
|
+
* `Node.isConnected` it shadows. Useful if you're running async work that
|
|
350
438
|
* should stop once the element is removed.
|
|
351
439
|
*
|
|
352
440
|
* @returns `true` while the element is in the document.
|
|
@@ -366,9 +454,11 @@ declare class Component extends HTMLElement {
|
|
|
366
454
|
* Prefer `ready()` when you want to run code once the component is ready;
|
|
367
455
|
* this getter is handy when you need a synchronous check — for example
|
|
368
456
|
* inside a parent component that wants to talk to a freshly inserted
|
|
369
|
-
* child.
|
|
457
|
+
* child. It drops back to `false` as soon as the element is removed, and
|
|
458
|
+
* turns `true` again once a reconnect finishes.
|
|
370
459
|
*
|
|
371
|
-
* @returns `true` after `didMount()` and the
|
|
460
|
+
* @returns `true` after `didMount()` (or `didReconnect()`) and the render
|
|
461
|
+
* before it have run.
|
|
372
462
|
*
|
|
373
463
|
* @example
|
|
374
464
|
* if (avatar.isReady) {
|
|
@@ -530,6 +620,18 @@ declare class Component extends HTMLElement {
|
|
|
530
620
|
* @internal
|
|
531
621
|
*/
|
|
532
622
|
protected _applyStringRender(html: string): void;
|
|
623
|
+
/**
|
|
624
|
+
* Resets the render root so the other renderer can take over cleanly when a
|
|
625
|
+
* component switches between string and lit-html output. A string render
|
|
626
|
+
* overwrites `innerHTML`, destroying the marker nodes lit-html tracks; its
|
|
627
|
+
* leftover cached part would then throw on the next lit render. We clear the
|
|
628
|
+
* host, drop the `data-lit-rendered` marker, and delete lit-html's cached
|
|
629
|
+
* root part (`_$litPart$`) so the next lit render re-initializes instead of
|
|
630
|
+
* reusing stale markers. `ShadowComponent` overrides this for its root.
|
|
631
|
+
*
|
|
632
|
+
* @internal
|
|
633
|
+
*/
|
|
634
|
+
protected _resetRenderRoot(): void;
|
|
533
635
|
/**
|
|
534
636
|
* Runs a single render cycle: resolves the template, applies middleware,
|
|
535
637
|
* writes to the DOM, and re-attaches `@Listen` handlers. Bumps `_renderId`
|
|
@@ -730,7 +832,7 @@ declare class Component extends HTMLElement {
|
|
|
730
832
|
* this.data = await fetch('/api/profile').then(r => r.json());
|
|
731
833
|
* }
|
|
732
834
|
*/
|
|
733
|
-
willMount(): Promise<void>;
|
|
835
|
+
willMount(): void | Promise<void>;
|
|
734
836
|
/**
|
|
735
837
|
* Runs after the component's first mount completes.
|
|
736
838
|
*
|
|
@@ -745,7 +847,7 @@ declare class Component extends HTMLElement {
|
|
|
745
847
|
* this.query('input')?.focus();
|
|
746
848
|
* }
|
|
747
849
|
*/
|
|
748
|
-
didMount(): Promise<void>;
|
|
850
|
+
didMount(): void | Promise<void>;
|
|
749
851
|
/**
|
|
750
852
|
* Runs after every render cycle.
|
|
751
853
|
*
|
|
@@ -761,7 +863,7 @@ declare class Component extends HTMLElement {
|
|
|
761
863
|
* this._chart = createChart(this.query('canvas'));
|
|
762
864
|
* }
|
|
763
865
|
*/
|
|
764
|
-
didRender(): Promise<void>;
|
|
866
|
+
didRender(): void | Promise<void>;
|
|
765
867
|
/**
|
|
766
868
|
* Runs when the component is re-attached to the DOM after being
|
|
767
869
|
* disconnected.
|
|
@@ -775,7 +877,7 @@ declare class Component extends HTMLElement {
|
|
|
775
877
|
* this._timer = setInterval(() => this.tick(), 1000);
|
|
776
878
|
* }
|
|
777
879
|
*/
|
|
778
|
-
didReconnect(): Promise<void>;
|
|
880
|
+
didReconnect(): void | Promise<void>;
|
|
779
881
|
/**
|
|
780
882
|
* Runs just before the component is removed from the DOM.
|
|
781
883
|
*
|
|
@@ -788,7 +890,7 @@ declare class Component extends HTMLElement {
|
|
|
788
890
|
* this._abort.abort();
|
|
789
891
|
* }
|
|
790
892
|
*/
|
|
791
|
-
willUnmount(): Promise<void>;
|
|
893
|
+
willUnmount(): void | Promise<void>;
|
|
792
894
|
/**
|
|
793
895
|
* Runs after the component has been removed from the DOM.
|
|
794
896
|
*
|
|
@@ -800,7 +902,7 @@ declare class Component extends HTMLElement {
|
|
|
800
902
|
* analytics.track('card-removed', { id: this.id });
|
|
801
903
|
* }
|
|
802
904
|
*/
|
|
803
|
-
didUnmount(): Promise<void>;
|
|
905
|
+
didUnmount(): void | Promise<void>;
|
|
804
906
|
/**
|
|
805
907
|
* Runs every time one of the component's reactive fields changes.
|
|
806
908
|
*
|
|
@@ -827,6 +929,19 @@ declare class Component extends HTMLElement {
|
|
|
827
929
|
* }
|
|
828
930
|
*/
|
|
829
931
|
didChange(_property: string, _oldValue: unknown, _newValue: unknown, _source?: string): void;
|
|
932
|
+
/**
|
|
933
|
+
* Adds the instance to its class's `connectedInstances()`.
|
|
934
|
+
*
|
|
935
|
+
* @internal
|
|
936
|
+
*/
|
|
937
|
+
private _countAsConnected;
|
|
938
|
+
/**
|
|
939
|
+
* Removes the instance from the `connectedInstances()` it was added to,
|
|
940
|
+
* even if `evolve()` has changed its class since.
|
|
941
|
+
*
|
|
942
|
+
* @internal
|
|
943
|
+
*/
|
|
944
|
+
private _stopCountingAsConnected;
|
|
830
945
|
/**
|
|
831
946
|
* The standard custom-elements hook Pandora uses to drive mounting.
|
|
832
947
|
*
|
|
@@ -848,11 +963,11 @@ declare class Component extends HTMLElement {
|
|
|
848
963
|
/**
|
|
849
964
|
* The standard custom-elements hook Pandora uses to drive unmounting.
|
|
850
965
|
*
|
|
851
|
-
* Pandora
|
|
852
|
-
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
966
|
+
* Pandora flips the component's connected and ready flags to `false`
|
|
967
|
+
* right away, tears down `@Subscribe` subscriptions and `@Listen` handlers,
|
|
968
|
+
* then calls `willUnmount()` and `didUnmount()`. Override the lifecycle
|
|
969
|
+
* methods in preference to this hook; if you do override, remember to call
|
|
970
|
+
* `super.disconnectedCallback()`.
|
|
856
971
|
*
|
|
857
972
|
* @example
|
|
858
973
|
* async disconnectedCallback() {
|
|
@@ -889,28 +1004,109 @@ declare class Component extends HTMLElement {
|
|
|
889
1004
|
*/
|
|
890
1005
|
attributeChangedCallback(property: string, _oldValue: string | null, newValue: string | null): void;
|
|
891
1006
|
/**
|
|
892
|
-
* The
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
*
|
|
896
|
-
*
|
|
1007
|
+
* The `@Listen` bindings currently wired up on this instance. We track them
|
|
1008
|
+
* explicitly so we can remove the exact `(target, event, handler, options)`
|
|
1009
|
+
* triples we registered. `dynamic` flags a binding whose target is a CSS
|
|
1010
|
+
* selector — a node a render can replace — so only those are re-cycled
|
|
1011
|
+
* between renders; `index` ties a binding back to its metadata entry so a
|
|
1012
|
+
* one-shot listener can be recorded as consumed.
|
|
897
1013
|
*
|
|
898
1014
|
* @internal
|
|
899
1015
|
*/
|
|
900
1016
|
private _activeListeners;
|
|
901
1017
|
/**
|
|
902
|
-
*
|
|
903
|
-
*
|
|
904
|
-
*
|
|
905
|
-
*
|
|
1018
|
+
* Whether the full `@Listen` set has been attached for the current
|
|
1019
|
+
* connection. Host, window, and document listeners are attached once per
|
|
1020
|
+
* connect and left in place across re-renders; only selector-targeted ones
|
|
1021
|
+
* are refreshed. Reset to `false` on disconnect.
|
|
1022
|
+
*
|
|
1023
|
+
* @internal
|
|
1024
|
+
*/
|
|
1025
|
+
private _listenersAttached;
|
|
1026
|
+
/**
|
|
1027
|
+
* Indices of `@Listen` entries whose `once` has already fired during the
|
|
1028
|
+
* current connection. Consulted before (re-)binding so a one-shot listener
|
|
1029
|
+
* is never re-armed by a subsequent re-render. Cleared on disconnect, so a
|
|
1030
|
+
* reconnect arms one-shot listeners afresh.
|
|
1031
|
+
*
|
|
1032
|
+
* @internal
|
|
1033
|
+
*/
|
|
1034
|
+
private _consumedOnceListeners;
|
|
1035
|
+
/**
|
|
1036
|
+
* Reads the `@Listen` metadata array for this instance's class, or
|
|
1037
|
+
* `undefined` when there are none (or metadata is unavailable).
|
|
1038
|
+
*
|
|
1039
|
+
* @internal
|
|
1040
|
+
*/
|
|
1041
|
+
protected _listenerMetadata(): Array<{
|
|
1042
|
+
event: string;
|
|
1043
|
+
methodName: string;
|
|
1044
|
+
options?: {
|
|
1045
|
+
target?: string;
|
|
1046
|
+
delegate?: string;
|
|
1047
|
+
capture?: boolean;
|
|
1048
|
+
passive?: boolean;
|
|
1049
|
+
once?: boolean;
|
|
1050
|
+
};
|
|
1051
|
+
}> | undefined;
|
|
1052
|
+
/**
|
|
1053
|
+
* Whether a listener targets a CSS selector — an element a render can
|
|
1054
|
+
* replace — rather than a stable target (the host, window, or document).
|
|
1055
|
+
* Only selector-targeted listeners are re-cycled between renders.
|
|
1056
|
+
*
|
|
1057
|
+
* @internal
|
|
1058
|
+
*/
|
|
1059
|
+
private static _isDynamicListenerTarget;
|
|
1060
|
+
/**
|
|
1061
|
+
* Binds a single `@Listen` entry to its resolved target and records it in
|
|
1062
|
+
* `_activeListeners`. Skips one-shot listeners already consumed this
|
|
1063
|
+
* connection, listeners whose method is missing, and selector targets not
|
|
1064
|
+
* yet in the DOM. Returns whether a binding was attached.
|
|
1065
|
+
*
|
|
1066
|
+
* @internal
|
|
1067
|
+
*/
|
|
1068
|
+
protected _bindListener(listener: {
|
|
1069
|
+
event: string;
|
|
1070
|
+
methodName: string;
|
|
1071
|
+
options?: {
|
|
1072
|
+
target?: string;
|
|
1073
|
+
delegate?: string;
|
|
1074
|
+
capture?: boolean;
|
|
1075
|
+
passive?: boolean;
|
|
1076
|
+
once?: boolean;
|
|
1077
|
+
};
|
|
1078
|
+
}, index: number): boolean;
|
|
1079
|
+
/**
|
|
1080
|
+
* Wires up every `@Listen` binding. Called once per connection (on the first
|
|
1081
|
+
* render). Selectors are resolved at attach time, not at decoration time,
|
|
1082
|
+
* because the target nodes may only exist after a render has populated the
|
|
1083
|
+
* component's subtree.
|
|
906
1084
|
*
|
|
907
1085
|
* @internal
|
|
908
1086
|
*/
|
|
909
1087
|
protected _attachListeners(): void;
|
|
910
1088
|
/**
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
* stale bindings
|
|
1089
|
+
* Re-cycles only the selector-targeted (`dynamic`) listeners after a
|
|
1090
|
+
* re-render. Their target nodes may have been replaced by the new markup, so
|
|
1091
|
+
* we detach the stale bindings and resolve fresh ones — while leaving host,
|
|
1092
|
+
* window, and document listeners (and any already-fired one-shots) in place.
|
|
1093
|
+
*
|
|
1094
|
+
* @internal
|
|
1095
|
+
*/
|
|
1096
|
+
protected _refreshDynamicListeners(): void;
|
|
1097
|
+
/**
|
|
1098
|
+
* Attaches `@Listen` bindings after a render: the full set on the first
|
|
1099
|
+
* render of a connection, and only the selector-targeted ones on later
|
|
1100
|
+
* re-renders (whose nodes the render may have replaced).
|
|
1101
|
+
*
|
|
1102
|
+
* @internal
|
|
1103
|
+
*/
|
|
1104
|
+
protected _syncListenersAfterRender(): void;
|
|
1105
|
+
/**
|
|
1106
|
+
* Removes every listener currently recorded in `_activeListeners`, clears the
|
|
1107
|
+
* tracking array, and resets the per-connection attach state. Called on
|
|
1108
|
+
* disconnect so no binding — or consumed-`once` record — outlives the
|
|
1109
|
+
* connection.
|
|
914
1110
|
*
|
|
915
1111
|
* @internal
|
|
916
1112
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/Component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../../src/Component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAG7E,OAAO,KAAK,EAAe,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA+CxG;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,cAAM,SAAU,SAAQ,WAAW;IACjC;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB,CAAmE;IAE/F;;;;;OAKG;IACH,SAAS,CAAC,iBAAiB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAa;IAEtD;;;;;OAKG;IACH,OAAO,CAAC,YAAY,CAAC,CAAS;IAE9B;;;;;OAKG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAE5B;;;;;;OAMG;IACH,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC;IAE9B;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE5B;;;;;;OAMG;IACH,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC;IAEnC;;;;;;;OAOG;IACH,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC;IAEnC;;;;;OAKG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAE5B;;;;;OAKG;IACH,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC;IAEjC;;;;;;;OAOG;IACH,SAAS,CAAC,eAAe,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;I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B,IAAI,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,CAAC;YAAC,IAAI,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAC,GAAG,SAAS,CAO9L;IAED;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAIvC;;;;;;;OAOG;IACH,SAAS,CAAC,aAAa,CACrB,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,CAAC;YAAC,IAAI,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,EACvJ,KAAK,EAAE,MAAM,GACZ,OAAO,CA4ET;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,gBAAgB,IAAI,IAAI,CAQjC;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,wBAAwB,IAAI,IAAI,CAwBzC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,yBAAyB,IAAI,IAAI,CAO1C;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,gBAAgB,IAAI,IAAI,CAQjC;CACF;eAEc,SAAS"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import Component from './Component';
|
|
2
|
-
import
|
|
1
|
+
import Component from './Component.js';
|
|
2
|
+
import type * as Types from './Types.js';
|
|
3
3
|
type ComponentConstructor = typeof Component & {
|
|
4
4
|
tag: string;
|
|
5
5
|
_registered?: boolean;
|
|
6
6
|
};
|
|
7
|
-
interface RegisterOptions {
|
|
7
|
+
export interface RegisterOptions {
|
|
8
|
+
/** Skip `customElements.define()`; call `Registry.define()` when ready. */
|
|
8
9
|
defer?: boolean;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
@@ -28,7 +29,7 @@ interface RegisterOptions {
|
|
|
28
29
|
*
|
|
29
30
|
* // <my-greeting></my-greeting>
|
|
30
31
|
*/
|
|
31
|
-
export declare
|
|
32
|
+
export declare const Register: (tagName: string, options?: RegisterOptions) => <T extends ComponentConstructor>(constructor: T, context: ClassDecoratorContext) => T;
|
|
32
33
|
/**
|
|
33
34
|
* Attaches scoped CSS to the component. Accepts either a raw CSS string or
|
|
34
35
|
* a structured `Style` object (selectors and declarations).
|
|
@@ -54,15 +55,16 @@ export declare function Register(tagName: string, options?: RegisterOptions): <T
|
|
|
54
55
|
* }
|
|
55
56
|
* }
|
|
56
57
|
*/
|
|
57
|
-
export declare
|
|
58
|
+
export declare const Style: (css: Types.Style | string) => <T extends ComponentConstructor>(constructor: T, context: ClassDecoratorContext) => T;
|
|
58
59
|
/**
|
|
59
60
|
* Runs the decorated method whenever the given reactive property changes,
|
|
60
61
|
* receiving the new and previous values.
|
|
61
62
|
*
|
|
62
|
-
* The watched property must be declared with `@State`,
|
|
63
|
-
* `@Property
|
|
64
|
-
* the
|
|
65
|
-
*
|
|
63
|
+
* The watched property must be reactive — declared with `@State`,
|
|
64
|
+
* `@Attribute`, `@Property`, or `@Subscribe`, or made reactive with
|
|
65
|
+
* `reactive()` in the constructor — otherwise you'll see a one-time dev
|
|
66
|
+
* warning explaining that the watcher will never fire. Watchers run
|
|
67
|
+
* synchronously on assignment, before the next render is queued.
|
|
66
68
|
*
|
|
67
69
|
* @param property - The name of the reactive field to observe.
|
|
68
70
|
*
|
|
@@ -81,8 +83,9 @@ export declare function Style(css: Style | string): <T extends ComponentConstruc
|
|
|
81
83
|
* }
|
|
82
84
|
* }
|
|
83
85
|
*/
|
|
84
|
-
export declare
|
|
85
|
-
interface StateOptions {
|
|
86
|
+
export declare const Watch: (property: string) => <T extends (...args: any[]) => any>(_target: T, context: ClassMethodDecoratorContext) => void;
|
|
87
|
+
export interface StateOptions {
|
|
88
|
+
/** Set to `false` to keep the field reactive without re-rendering. */
|
|
86
89
|
render?: boolean;
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
@@ -107,9 +110,14 @@ interface StateOptions {
|
|
|
107
110
|
* }
|
|
108
111
|
* }
|
|
109
112
|
*/
|
|
110
|
-
export declare
|
|
111
|
-
interface PropertyOptions {
|
|
112
|
-
|
|
113
|
+
export declare const State: (options?: StateOptions) => (_target: undefined, context: ClassFieldDecoratorContext) => void;
|
|
114
|
+
export interface PropertyOptions {
|
|
115
|
+
/**
|
|
116
|
+
* Mirror primitive values to an attribute: `true` uses the field name,
|
|
117
|
+
* a string names the attribute, and `false` (the default) skips it.
|
|
118
|
+
*/
|
|
119
|
+
attribute?: string | boolean;
|
|
120
|
+
/** Custom equality check; assignments it reports as equal are skipped. */
|
|
113
121
|
equals?: (a: unknown, b: unknown) => boolean;
|
|
114
122
|
}
|
|
115
123
|
/**
|
|
@@ -119,9 +127,9 @@ interface PropertyOptions {
|
|
|
119
127
|
* Properties are reactive (they fire `@Watch` handlers and run through
|
|
120
128
|
* `didChange`) but do not trigger re-renders on their own, so a parent can
|
|
121
129
|
* hand a child rich data without causing render thrash. Pass
|
|
122
|
-
* `{ attribute: 'some-name' }` to mirror the
|
|
123
|
-
* primitives, or provide a custom `equals`
|
|
124
|
-
* a deep-equal object is assigned.
|
|
130
|
+
* `{ attribute: true }` (or `{ attribute: 'some-name' }`) to mirror the
|
|
131
|
+
* value to an attribute for primitives, or provide a custom `equals`
|
|
132
|
+
* comparator to skip updates when a deep-equal object is assigned.
|
|
125
133
|
*
|
|
126
134
|
* @param options - `{ attribute, equals }` to control attribute sync and
|
|
127
135
|
* change detection.
|
|
@@ -142,8 +150,9 @@ interface PropertyOptions {
|
|
|
142
150
|
* // const el = document.querySelector('user-avatar');
|
|
143
151
|
* // el.user = { id: 'u_42', name: 'Ada Lovelace' };
|
|
144
152
|
*/
|
|
145
|
-
export declare
|
|
146
|
-
interface AttributeOptions {
|
|
153
|
+
export declare const Property: (options?: PropertyOptions) => (_target: undefined, context: ClassFieldDecoratorContext) => void;
|
|
154
|
+
export interface AttributeOptions {
|
|
155
|
+
/** Set to `false` to keep the field reactive without re-rendering. */
|
|
147
156
|
render?: boolean;
|
|
148
157
|
}
|
|
149
158
|
/**
|
|
@@ -172,7 +181,7 @@ interface AttributeOptions {
|
|
|
172
181
|
*
|
|
173
182
|
* // <my-greeting name="Ada"></my-greeting>
|
|
174
183
|
*/
|
|
175
|
-
export declare
|
|
184
|
+
export declare const Attribute: (attributeNameOrOptions?: string | AttributeOptions) => (_target: undefined, context: ClassFieldDecoratorContext) => void;
|
|
176
185
|
/**
|
|
177
186
|
* Subscribes a field to a shared state key on the global `Registry`. Reading
|
|
178
187
|
* the field returns the current registry value; assigning writes it back
|
|
@@ -201,7 +210,7 @@ export declare function Attribute(attributeNameOrOptions?: string | AttributeOpt
|
|
|
201
210
|
* }
|
|
202
211
|
* }
|
|
203
212
|
*/
|
|
204
|
-
export declare
|
|
213
|
+
export declare const Subscribe: (stateKey: string) => (_target: undefined, context: ClassFieldDecoratorContext) => void;
|
|
205
214
|
/**
|
|
206
215
|
* Turns a field into a live selector query against the component's rendered
|
|
207
216
|
* DOM. Each access re-runs the lookup, so the reference stays correct even
|
|
@@ -228,7 +237,7 @@ export declare function Subscribe(stateKey: string): (_target: undefined, contex
|
|
|
228
237
|
* }
|
|
229
238
|
* }
|
|
230
239
|
*/
|
|
231
|
-
export declare
|
|
240
|
+
export declare const Query: (selector: string) => (_target: undefined, context: ClassFieldDecoratorContext) => void;
|
|
232
241
|
/**
|
|
233
242
|
* Like `@Query`, but returns every matching element. Each access re-runs
|
|
234
243
|
* the lookup, so the list reflects the current DOM on every read.
|
|
@@ -255,7 +264,7 @@ export declare function Query(selector: string): (_target: undefined, context: C
|
|
|
255
264
|
* }
|
|
256
265
|
* }
|
|
257
266
|
*/
|
|
258
|
-
export declare
|
|
267
|
+
export declare const QueryAll: (selector: string) => (_target: undefined, context: ClassFieldDecoratorContext) => void;
|
|
259
268
|
/**
|
|
260
269
|
* Exposes a `<slot>` element from the shadow root as a field, so you can
|
|
261
270
|
* inspect projected children or call slot APIs like `assignedElements()`.
|
|
@@ -270,8 +279,8 @@ export declare function QueryAll(selector: string): (_target: undefined, context
|
|
|
270
279
|
* class MyCard extends ShadowComponent {
|
|
271
280
|
* @Slot('header') headerSlot!: HTMLSlotElement | null;
|
|
272
281
|
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
282
|
+
* async didMount() {
|
|
283
|
+
* // The slot exists once the first render has run.
|
|
275
284
|
* console.log('header children:', this.headerSlot?.assignedElements());
|
|
276
285
|
* }
|
|
277
286
|
*
|
|
@@ -285,12 +294,17 @@ export declare function QueryAll(selector: string): (_target: undefined, context
|
|
|
285
294
|
* }
|
|
286
295
|
* }
|
|
287
296
|
*/
|
|
288
|
-
export declare
|
|
289
|
-
interface ListenOptions {
|
|
290
|
-
|
|
297
|
+
export declare const Slot: (name?: string) => (_target: undefined, context: ClassFieldDecoratorContext) => void;
|
|
298
|
+
export interface ListenOptions {
|
|
299
|
+
/** Where to attach: the host (`'self'`, the default), `'window'`, `'document'`, or a CSS selector inside the component. */
|
|
300
|
+
target?: 'self' | 'window' | 'document' | (string & {});
|
|
301
|
+
/** Only fire when the event comes from a descendant matching this selector. */
|
|
291
302
|
delegate?: string;
|
|
303
|
+
/** Listen during the capture phase. */
|
|
292
304
|
capture?: boolean;
|
|
305
|
+
/** Mark the listener as passive. */
|
|
293
306
|
passive?: boolean;
|
|
307
|
+
/** Remove the listener after it first fires (after the first match, with `delegate`). */
|
|
294
308
|
once?: boolean;
|
|
295
309
|
}
|
|
296
310
|
/**
|
|
@@ -320,7 +334,7 @@ interface ListenOptions {
|
|
|
320
334
|
* }
|
|
321
335
|
* }
|
|
322
336
|
*/
|
|
323
|
-
export declare
|
|
337
|
+
export declare const Listen: (event: string, options?: ListenOptions) => <T extends (...args: any[]) => any>(_target: T, context: ClassMethodDecoratorContext) => void;
|
|
324
338
|
/**
|
|
325
339
|
* Turns a getter into a cached derived value. The result is computed once,
|
|
326
340
|
* reused on every read, and invalidated automatically whenever any of the
|
|
@@ -348,8 +362,8 @@ export declare function Listen(event: string, options?: ListenOptions): <T exten
|
|
|
348
362
|
* }
|
|
349
363
|
* }
|
|
350
364
|
*/
|
|
351
|
-
export declare
|
|
352
|
-
type ClassListMap = Record<string, string | ((instance: any) => boolean)>;
|
|
365
|
+
export declare const Computed: (...dependencies: string[]) => <T>(_target: T, context: ClassGetterDecoratorContext) => T;
|
|
366
|
+
export type ClassListMap = Record<string, string | ((instance: any) => boolean)>;
|
|
353
367
|
/**
|
|
354
368
|
* Declaratively toggles classes on the host element based on reactive state.
|
|
355
369
|
* Map a class name to a reactive field name (truthy → class on, falsy →
|
|
@@ -379,7 +393,7 @@ type ClassListMap = Record<string, string | ((instance: any) => boolean)>;
|
|
|
379
393
|
* }
|
|
380
394
|
* }
|
|
381
395
|
*/
|
|
382
|
-
export declare
|
|
396
|
+
export declare const ClassList: (map: ClassListMap) => <T extends ComponentConstructor>(constructor: T, context: ClassDecoratorContext) => T;
|
|
383
397
|
/**
|
|
384
398
|
* Installs a function on the component that dispatches a bubbling custom
|
|
385
399
|
* event with the given name. Call the field like a method, passing any
|
|
@@ -408,6 +422,6 @@ export declare function ClassList(map: ClassListMap): <T extends ComponentConstr
|
|
|
408
422
|
* // In a parent:
|
|
409
423
|
* // el.addEventListener('button-pressed', (e) => console.log(e.detail.at));
|
|
410
424
|
*/
|
|
411
|
-
export declare
|
|
425
|
+
export declare const Emitter: (eventName: string) => (_target: undefined, context: ClassFieldDecoratorContext) => void;
|
|
412
426
|
export {};
|
|
413
427
|
//# sourceMappingURL=Decorators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Decorators.d.ts","sourceRoot":"","sources":["../../src/Decorators.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"Decorators.d.ts","sourceRoot":"","sources":["../../src/Decorators.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAGvC,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAmEzC,KAAK,oBAAoB,GAAG,OAAO,SAAS,GAAG;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AA4BF,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ,YAAa,MAAM,YAAY,eAAe,MACzD,CAAC,SAAS,oBAAoB,eAAe,CAAC,WAAW,qBAAqB,KAAG,CAmC1F,CAAC;AAMF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,KAAK,QAAS,KAAK,CAAC,KAAK,GAAG,MAAM,MACrC,CAAC,SAAS,oBAAoB,eAAe,CAAC,WAAW,qBAAqB,KAAG,CAO1F,CAAC;AAWF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,KAAK,aAAc,MAAM,MAC5B,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,WAC9B,CAAC,WACD,2BAA2B,KACnC,IA2CJ,CAAC;AA+QF,MAAM,WAAW,YAAY;IAC3B,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAoED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,KAAK,aAAc,YAAY,eACzB,SAAS,WAAW,0BAA0B,SAiDhE,CAAC;AAMF,MAAM,WAAW,eAAe;IAC9B;;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