@e280/sly 0.3.0-1 → 0.3.0-10
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 +107 -65
- package/package.json +20 -26
- package/s/demo/demo.bundle.ts +5 -1
- package/s/demo/views/demo.ts +3 -0
- package/s/demo/views/loaders.ts +2 -2
- package/s/demo/views/time-light.ts +19 -0
- package/s/demo/views/time-shadow.ts +22 -0
- package/s/dom/attrs/attrs.ts +3 -3
- package/s/dom/attrs/parts/attr-spec.ts +17 -5
- package/s/dom/attrs/parts/on-attrs.ts +1 -1
- package/s/dom/dom.ts +1 -1
- package/s/index.ts +2 -2
- package/s/{loaders → loader}/index.barrel.ts +0 -1
- package/s/{loaders → loader}/index.ts +0 -1
- package/s/{loaders → loader}/types.ts +1 -1
- package/s/view/{parts → common}/sly-shadow.ts +6 -0
- package/s/view/elements/light.ts +14 -0
- package/s/view/elements/shadow.ts +52 -0
- package/s/view/hooks/use-attrs.ts +28 -0
- package/s/view/hooks/use-life.ts +2 -2
- package/s/view/hooks/use-op.ts +1 -1
- package/s/view/hooks/use-ref.ts +3 -3
- package/s/view/hooks/use-state.ts +4 -4
- package/s/view/index.ts +5 -0
- package/s/view/shadow.ts +12 -12
- package/x/demo/demo.bundle.js +4 -1
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +22 -15
- package/x/demo/demo.bundle.min.js.map +4 -4
- package/x/demo/views/demo.js +3 -0
- package/x/demo/views/demo.js.map +1 -1
- package/x/demo/views/loaders.js +2 -2
- package/x/demo/views/loaders.js.map +1 -1
- package/x/demo/views/time-light.d.ts +359 -0
- package/x/demo/views/time-light.js +16 -0
- package/x/demo/views/time-light.js.map +1 -0
- package/x/demo/views/time-shadow.d.ts +365 -0
- package/x/demo/views/time-shadow.js +18 -0
- package/x/demo/views/time-shadow.js.map +1 -0
- package/x/dom/attrs/attrs.d.ts +3 -2
- package/x/dom/attrs/attrs.js +2 -2
- package/x/dom/attrs/attrs.js.map +1 -1
- package/x/dom/attrs/parts/attr-spec.d.ts +5 -1
- package/x/dom/attrs/parts/attr-spec.js +12 -6
- package/x/dom/attrs/parts/attr-spec.js.map +1 -1
- package/x/dom/attrs/parts/on-attrs.d.ts +1 -1
- package/x/dom/attrs/parts/on-attrs.js.map +1 -1
- package/x/dom/dom.d.ts +1 -1
- package/x/dom/dom.js.map +1 -1
- package/x/index.d.ts +2 -2
- package/x/index.html +2 -2
- package/x/index.js +2 -2
- package/x/index.js.map +1 -1
- package/x/{loaders → loader}/index.barrel.d.ts +0 -1
- package/x/loader/index.barrel.js.map +1 -0
- package/x/{loaders → loader}/index.d.ts +0 -1
- package/x/loader/index.js.map +1 -0
- package/x/loader/make.js.map +1 -0
- package/x/loader/mock.js.map +1 -0
- package/x/loader/parts/anims.js.map +1 -0
- package/x/loader/parts/ascii-anim.js.map +1 -0
- package/x/loader/parts/error-display.js.map +1 -0
- package/x/{loaders → loader}/types.d.ts +1 -1
- package/x/{loaders → loader}/types.js.map +1 -1
- package/x/loot/drag-and-drops.d.ts +2 -2
- package/x/loot/drops.d.ts +1 -1
- package/x/op/index.js.map +1 -0
- package/x/op/op.js.map +1 -0
- package/x/op/podium.js.map +1 -0
- package/x/{ops → op}/types.js.map +1 -1
- package/x/{tests.test.js → test.js} +1 -1
- package/x/test.js.map +1 -0
- package/x/view/{parts → common}/sly-shadow.d.ts +1 -0
- package/x/view/{parts → common}/sly-shadow.js +4 -0
- package/x/view/common/sly-shadow.js.map +1 -0
- package/x/view/elements/light.d.ts +357 -0
- package/x/view/elements/light.js +10 -0
- package/x/view/elements/light.js.map +1 -0
- package/x/view/elements/shadow.d.ts +366 -0
- package/x/view/elements/shadow.js +42 -0
- package/x/view/elements/shadow.js.map +1 -0
- package/x/view/hooks/use-attrs.d.ts +2 -0
- package/x/view/hooks/use-attrs.js +23 -0
- package/x/view/hooks/use-attrs.js.map +1 -0
- package/x/view/hooks/use-life.js +2 -2
- package/x/view/hooks/use-life.js.map +1 -1
- package/x/view/hooks/use-op.d.ts +1 -1
- package/x/view/hooks/use-op.js +1 -1
- package/x/view/hooks/use-op.js.map +1 -1
- package/x/view/hooks/use-ref.d.ts +3 -3
- package/x/view/hooks/use-ref.js +5 -5
- package/x/view/hooks/use-ref.js.map +1 -1
- package/x/view/hooks/use-signal.d.ts +3 -3
- package/x/view/hooks/use-state.js +4 -4
- package/x/view/hooks/use-state.js.map +1 -1
- package/x/view/index.d.ts +4 -0
- package/x/view/index.js +4 -0
- package/x/view/index.js.map +1 -1
- package/x/view/shadow.d.ts +2 -2
- package/x/view/shadow.js +10 -11
- package/x/view/shadow.js.map +1 -1
- package/x/loaders/index.barrel.js.map +0 -1
- package/x/loaders/index.js.map +0 -1
- package/x/loaders/make.js.map +0 -1
- package/x/loaders/mock.js.map +0 -1
- package/x/loaders/parts/anims.js.map +0 -1
- package/x/loaders/parts/ascii-anim.js.map +0 -1
- package/x/loaders/parts/error-display.js.map +0 -1
- package/x/ops/index.js.map +0 -1
- package/x/ops/op.js.map +0 -1
- package/x/ops/podium.js.map +0 -1
- package/x/tests.test.js.map +0 -1
- package/x/view/parts/sly-shadow.js.map +0 -1
- /package/s/{loaders → loader}/make.ts +0 -0
- /package/s/{loaders → loader}/mock.ts +0 -0
- /package/s/{loaders → loader}/parts/anims.ts +0 -0
- /package/s/{loaders → loader}/parts/ascii-anim.ts +0 -0
- /package/s/{loaders → loader}/parts/error-display.ts +0 -0
- /package/s/{ops → op}/index.ts +0 -0
- /package/s/{ops → op}/op.ts +0 -0
- /package/s/{ops → op}/podium.ts +0 -0
- /package/s/{ops → op}/types.ts +0 -0
- /package/s/{tests.test.ts → test.ts} +0 -0
- /package/x/{loaders → loader}/index.barrel.js +0 -0
- /package/x/{loaders → loader}/index.js +0 -0
- /package/x/{loaders → loader}/make.d.ts +0 -0
- /package/x/{loaders → loader}/make.js +0 -0
- /package/x/{loaders → loader}/mock.d.ts +0 -0
- /package/x/{loaders → loader}/mock.js +0 -0
- /package/x/{loaders → loader}/parts/anims.d.ts +0 -0
- /package/x/{loaders → loader}/parts/anims.js +0 -0
- /package/x/{loaders → loader}/parts/ascii-anim.d.ts +0 -0
- /package/x/{loaders → loader}/parts/ascii-anim.js +0 -0
- /package/x/{loaders → loader}/parts/error-display.d.ts +0 -0
- /package/x/{loaders → loader}/parts/error-display.js +0 -0
- /package/x/{loaders → loader}/types.js +0 -0
- /package/x/{ops → op}/index.d.ts +0 -0
- /package/x/{ops → op}/index.js +0 -0
- /package/x/{ops → op}/op.d.ts +0 -0
- /package/x/{ops → op}/op.js +0 -0
- /package/x/{ops → op}/podium.d.ts +0 -0
- /package/x/{ops → op}/podium.js +0 -0
- /package/x/{ops → op}/types.d.ts +0 -0
- /package/x/{ops → op}/types.js +0 -0
- /package/x/{tests.test.d.ts → test.d.ts} +0 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { Content } from "../types.js";
|
|
2
|
+
import { ShadowCx } from "../parts/cx.js";
|
|
3
|
+
import { Reactivity } from "../parts/reactivity.js";
|
|
4
|
+
import { Hookscope } from "../hooks/plumbing/hookscope.js";
|
|
5
|
+
export declare function shadowElement(view: () => Content): {
|
|
6
|
+
new (): {
|
|
7
|
+
"__#private@#cx": ShadowCx;
|
|
8
|
+
"__#private@#hookscope": Hookscope;
|
|
9
|
+
"__#private@#reactivity": Reactivity;
|
|
10
|
+
"__#private@#shadow": ShadowRoot;
|
|
11
|
+
"__#private@#renderContent"(): Content;
|
|
12
|
+
render(): void;
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
disconnectedCallback(): void;
|
|
15
|
+
accessKey: string;
|
|
16
|
+
readonly accessKeyLabel: string;
|
|
17
|
+
autocapitalize: string;
|
|
18
|
+
autocorrect: boolean;
|
|
19
|
+
dir: string;
|
|
20
|
+
draggable: boolean;
|
|
21
|
+
hidden: boolean;
|
|
22
|
+
inert: boolean;
|
|
23
|
+
innerText: string;
|
|
24
|
+
lang: string;
|
|
25
|
+
readonly offsetHeight: number;
|
|
26
|
+
readonly offsetLeft: number;
|
|
27
|
+
readonly offsetParent: Element | null;
|
|
28
|
+
readonly offsetTop: number;
|
|
29
|
+
readonly offsetWidth: number;
|
|
30
|
+
outerText: string;
|
|
31
|
+
popover: string | null;
|
|
32
|
+
spellcheck: boolean;
|
|
33
|
+
title: string;
|
|
34
|
+
translate: boolean;
|
|
35
|
+
writingSuggestions: string;
|
|
36
|
+
attachInternals(): ElementInternals;
|
|
37
|
+
click(): void;
|
|
38
|
+
hidePopover(): void;
|
|
39
|
+
showPopover(): void;
|
|
40
|
+
togglePopover(options?: boolean): boolean;
|
|
41
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
42
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
43
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
44
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
45
|
+
readonly attributes: NamedNodeMap;
|
|
46
|
+
get classList(): DOMTokenList;
|
|
47
|
+
set classList(value: string);
|
|
48
|
+
className: string;
|
|
49
|
+
readonly clientHeight: number;
|
|
50
|
+
readonly clientLeft: number;
|
|
51
|
+
readonly clientTop: number;
|
|
52
|
+
readonly clientWidth: number;
|
|
53
|
+
readonly currentCSSZoom: number;
|
|
54
|
+
id: string;
|
|
55
|
+
innerHTML: string;
|
|
56
|
+
readonly localName: string;
|
|
57
|
+
readonly namespaceURI: string | null;
|
|
58
|
+
onfullscreenchange: ((this: Element, ev: Event) => any) | null;
|
|
59
|
+
onfullscreenerror: ((this: Element, ev: Event) => any) | null;
|
|
60
|
+
outerHTML: string;
|
|
61
|
+
readonly ownerDocument: Document;
|
|
62
|
+
get part(): DOMTokenList;
|
|
63
|
+
set part(value: string);
|
|
64
|
+
readonly prefix: string | null;
|
|
65
|
+
readonly scrollHeight: number;
|
|
66
|
+
scrollLeft: number;
|
|
67
|
+
scrollTop: number;
|
|
68
|
+
readonly scrollWidth: number;
|
|
69
|
+
readonly shadowRoot: ShadowRoot | null;
|
|
70
|
+
slot: string;
|
|
71
|
+
readonly tagName: string;
|
|
72
|
+
attachShadow(init: ShadowRootInit): ShadowRoot;
|
|
73
|
+
checkVisibility(options?: CheckVisibilityOptions): boolean;
|
|
74
|
+
closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
|
|
75
|
+
closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
|
|
76
|
+
closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;
|
|
77
|
+
closest<E extends Element = Element>(selectors: string): E | null;
|
|
78
|
+
computedStyleMap(): StylePropertyMapReadOnly;
|
|
79
|
+
getAttribute(qualifiedName: string): string | null;
|
|
80
|
+
getAttributeNS(namespace: string | null, localName: string): string | null;
|
|
81
|
+
getAttributeNames(): string[];
|
|
82
|
+
getAttributeNode(qualifiedName: string): Attr | null;
|
|
83
|
+
getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
|
|
84
|
+
getBoundingClientRect(): DOMRect;
|
|
85
|
+
getClientRects(): DOMRectList;
|
|
86
|
+
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
87
|
+
getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
|
|
88
|
+
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
|
|
89
|
+
getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
|
|
90
|
+
getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;
|
|
91
|
+
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
92
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
93
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
94
|
+
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
|
|
95
|
+
getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
|
|
96
|
+
getHTML(options?: GetHTMLOptions): string;
|
|
97
|
+
hasAttribute(qualifiedName: string): boolean;
|
|
98
|
+
hasAttributeNS(namespace: string | null, localName: string): boolean;
|
|
99
|
+
hasAttributes(): boolean;
|
|
100
|
+
hasPointerCapture(pointerId: number): boolean;
|
|
101
|
+
insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
|
|
102
|
+
insertAdjacentHTML(position: InsertPosition, string: string): void;
|
|
103
|
+
insertAdjacentText(where: InsertPosition, data: string): void;
|
|
104
|
+
matches(selectors: string): boolean;
|
|
105
|
+
releasePointerCapture(pointerId: number): void;
|
|
106
|
+
removeAttribute(qualifiedName: string): void;
|
|
107
|
+
removeAttributeNS(namespace: string | null, localName: string): void;
|
|
108
|
+
removeAttributeNode(attr: Attr): Attr;
|
|
109
|
+
requestFullscreen(options?: FullscreenOptions): Promise<void>;
|
|
110
|
+
requestPointerLock(options?: PointerLockOptions): Promise<void>;
|
|
111
|
+
scroll(options?: ScrollToOptions): void;
|
|
112
|
+
scroll(x: number, y: number): void;
|
|
113
|
+
scrollBy(options?: ScrollToOptions): void;
|
|
114
|
+
scrollBy(x: number, y: number): void;
|
|
115
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
|
116
|
+
scrollTo(options?: ScrollToOptions): void;
|
|
117
|
+
scrollTo(x: number, y: number): void;
|
|
118
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
119
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
120
|
+
setAttributeNode(attr: Attr): Attr | null;
|
|
121
|
+
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
122
|
+
setHTMLUnsafe(html: string): void;
|
|
123
|
+
setPointerCapture(pointerId: number): void;
|
|
124
|
+
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
|
|
125
|
+
webkitMatchesSelector(selectors: string): boolean;
|
|
126
|
+
get textContent(): string;
|
|
127
|
+
set textContent(value: string | null);
|
|
128
|
+
readonly baseURI: string;
|
|
129
|
+
readonly childNodes: NodeListOf<ChildNode>;
|
|
130
|
+
readonly firstChild: ChildNode | null;
|
|
131
|
+
readonly isConnected: boolean;
|
|
132
|
+
readonly lastChild: ChildNode | null;
|
|
133
|
+
readonly nextSibling: ChildNode | null;
|
|
134
|
+
readonly nodeName: string;
|
|
135
|
+
readonly nodeType: number;
|
|
136
|
+
nodeValue: string | null;
|
|
137
|
+
readonly parentElement: HTMLElement | null;
|
|
138
|
+
readonly parentNode: ParentNode | null;
|
|
139
|
+
readonly previousSibling: ChildNode | null;
|
|
140
|
+
appendChild<T extends Node>(node: T): T;
|
|
141
|
+
cloneNode(subtree?: boolean): Node;
|
|
142
|
+
compareDocumentPosition(other: Node): number;
|
|
143
|
+
contains(other: Node | null): boolean;
|
|
144
|
+
getRootNode(options?: GetRootNodeOptions): Node;
|
|
145
|
+
hasChildNodes(): boolean;
|
|
146
|
+
insertBefore<T extends Node>(node: T, child: Node | null): T;
|
|
147
|
+
isDefaultNamespace(namespace: string | null): boolean;
|
|
148
|
+
isEqualNode(otherNode: Node | null): boolean;
|
|
149
|
+
isSameNode(otherNode: Node | null): boolean;
|
|
150
|
+
lookupNamespaceURI(prefix: string | null): string | null;
|
|
151
|
+
lookupPrefix(namespace: string | null): string | null;
|
|
152
|
+
normalize(): void;
|
|
153
|
+
removeChild<T extends Node>(child: T): T;
|
|
154
|
+
replaceChild<T extends Node>(node: Node, child: T): T;
|
|
155
|
+
readonly ELEMENT_NODE: 1;
|
|
156
|
+
readonly ATTRIBUTE_NODE: 2;
|
|
157
|
+
readonly TEXT_NODE: 3;
|
|
158
|
+
readonly CDATA_SECTION_NODE: 4;
|
|
159
|
+
readonly ENTITY_REFERENCE_NODE: 5;
|
|
160
|
+
readonly ENTITY_NODE: 6;
|
|
161
|
+
readonly PROCESSING_INSTRUCTION_NODE: 7;
|
|
162
|
+
readonly COMMENT_NODE: 8;
|
|
163
|
+
readonly DOCUMENT_NODE: 9;
|
|
164
|
+
readonly DOCUMENT_TYPE_NODE: 10;
|
|
165
|
+
readonly DOCUMENT_FRAGMENT_NODE: 11;
|
|
166
|
+
readonly NOTATION_NODE: 12;
|
|
167
|
+
readonly DOCUMENT_POSITION_DISCONNECTED: 1;
|
|
168
|
+
readonly DOCUMENT_POSITION_PRECEDING: 2;
|
|
169
|
+
readonly DOCUMENT_POSITION_FOLLOWING: 4;
|
|
170
|
+
readonly DOCUMENT_POSITION_CONTAINS: 8;
|
|
171
|
+
readonly DOCUMENT_POSITION_CONTAINED_BY: 16;
|
|
172
|
+
readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
|
|
173
|
+
dispatchEvent(event: Event): boolean;
|
|
174
|
+
ariaActiveDescendantElement: Element | null;
|
|
175
|
+
ariaAtomic: string | null;
|
|
176
|
+
ariaAutoComplete: string | null;
|
|
177
|
+
ariaBrailleLabel: string | null;
|
|
178
|
+
ariaBrailleRoleDescription: string | null;
|
|
179
|
+
ariaBusy: string | null;
|
|
180
|
+
ariaChecked: string | null;
|
|
181
|
+
ariaColCount: string | null;
|
|
182
|
+
ariaColIndex: string | null;
|
|
183
|
+
ariaColIndexText: string | null;
|
|
184
|
+
ariaColSpan: string | null;
|
|
185
|
+
ariaControlsElements: ReadonlyArray<Element> | null;
|
|
186
|
+
ariaCurrent: string | null;
|
|
187
|
+
ariaDescribedByElements: ReadonlyArray<Element> | null;
|
|
188
|
+
ariaDescription: string | null;
|
|
189
|
+
ariaDetailsElements: ReadonlyArray<Element> | null;
|
|
190
|
+
ariaDisabled: string | null;
|
|
191
|
+
ariaErrorMessageElements: ReadonlyArray<Element> | null;
|
|
192
|
+
ariaExpanded: string | null;
|
|
193
|
+
ariaFlowToElements: ReadonlyArray<Element> | null;
|
|
194
|
+
ariaHasPopup: string | null;
|
|
195
|
+
ariaHidden: string | null;
|
|
196
|
+
ariaInvalid: string | null;
|
|
197
|
+
ariaKeyShortcuts: string | null;
|
|
198
|
+
ariaLabel: string | null;
|
|
199
|
+
ariaLabelledByElements: ReadonlyArray<Element> | null;
|
|
200
|
+
ariaLevel: string | null;
|
|
201
|
+
ariaLive: string | null;
|
|
202
|
+
ariaModal: string | null;
|
|
203
|
+
ariaMultiLine: string | null;
|
|
204
|
+
ariaMultiSelectable: string | null;
|
|
205
|
+
ariaOrientation: string | null;
|
|
206
|
+
ariaOwnsElements: ReadonlyArray<Element> | null;
|
|
207
|
+
ariaPlaceholder: string | null;
|
|
208
|
+
ariaPosInSet: string | null;
|
|
209
|
+
ariaPressed: string | null;
|
|
210
|
+
ariaReadOnly: string | null;
|
|
211
|
+
ariaRelevant: string | null;
|
|
212
|
+
ariaRequired: string | null;
|
|
213
|
+
ariaRoleDescription: string | null;
|
|
214
|
+
ariaRowCount: string | null;
|
|
215
|
+
ariaRowIndex: string | null;
|
|
216
|
+
ariaRowIndexText: string | null;
|
|
217
|
+
ariaRowSpan: string | null;
|
|
218
|
+
ariaSelected: string | null;
|
|
219
|
+
ariaSetSize: string | null;
|
|
220
|
+
ariaSort: string | null;
|
|
221
|
+
ariaValueMax: string | null;
|
|
222
|
+
ariaValueMin: string | null;
|
|
223
|
+
ariaValueNow: string | null;
|
|
224
|
+
ariaValueText: string | null;
|
|
225
|
+
role: string | null;
|
|
226
|
+
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation;
|
|
227
|
+
getAnimations(options?: GetAnimationsOptions): Animation[];
|
|
228
|
+
after(...nodes: (Node | string)[]): void;
|
|
229
|
+
before(...nodes: (Node | string)[]): void;
|
|
230
|
+
remove(): void;
|
|
231
|
+
replaceWith(...nodes: (Node | string)[]): void;
|
|
232
|
+
readonly nextElementSibling: Element | null;
|
|
233
|
+
readonly previousElementSibling: Element | null;
|
|
234
|
+
readonly childElementCount: number;
|
|
235
|
+
readonly children: HTMLCollection;
|
|
236
|
+
readonly firstElementChild: Element | null;
|
|
237
|
+
readonly lastElementChild: Element | null;
|
|
238
|
+
append(...nodes: (Node | string)[]): void;
|
|
239
|
+
prepend(...nodes: (Node | string)[]): void;
|
|
240
|
+
querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
|
|
241
|
+
querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
|
|
242
|
+
querySelector<K extends keyof MathMLElementTagNameMap>(selectors: K): MathMLElementTagNameMap[K] | null;
|
|
243
|
+
querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): HTMLElementDeprecatedTagNameMap[K] | null;
|
|
244
|
+
querySelector<E extends Element = Element>(selectors: string): E | null;
|
|
245
|
+
querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
|
|
246
|
+
querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
|
|
247
|
+
querySelectorAll<K extends keyof MathMLElementTagNameMap>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
|
|
248
|
+
querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
|
|
249
|
+
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
|
|
250
|
+
replaceChildren(...nodes: (Node | string)[]): void;
|
|
251
|
+
readonly assignedSlot: HTMLSlotElement | null;
|
|
252
|
+
readonly attributeStyleMap: StylePropertyMap;
|
|
253
|
+
get style(): CSSStyleDeclaration;
|
|
254
|
+
set style(cssText: string);
|
|
255
|
+
contentEditable: string;
|
|
256
|
+
enterKeyHint: string;
|
|
257
|
+
inputMode: string;
|
|
258
|
+
readonly isContentEditable: boolean;
|
|
259
|
+
onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
260
|
+
onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
261
|
+
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
262
|
+
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
263
|
+
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
|
|
264
|
+
onauxclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
265
|
+
onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
|
|
266
|
+
onbeforematch: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
267
|
+
onbeforetoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
|
|
268
|
+
onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
269
|
+
oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
270
|
+
oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
271
|
+
oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
272
|
+
onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
273
|
+
onclick: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
274
|
+
onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
275
|
+
oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
276
|
+
oncontextmenu: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
277
|
+
oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
278
|
+
oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
279
|
+
oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
280
|
+
oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
281
|
+
ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
282
|
+
ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
283
|
+
ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
284
|
+
ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
285
|
+
ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
286
|
+
ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
287
|
+
ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
288
|
+
ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
|
|
289
|
+
ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
290
|
+
onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
291
|
+
onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
292
|
+
onerror: OnErrorEventHandler;
|
|
293
|
+
onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
|
|
294
|
+
onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
|
|
295
|
+
ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
296
|
+
oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
297
|
+
oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
298
|
+
onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
299
|
+
onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
300
|
+
onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
|
|
301
|
+
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
302
|
+
onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
303
|
+
onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
304
|
+
onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
305
|
+
onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
306
|
+
onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
307
|
+
onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
308
|
+
onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
309
|
+
onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
310
|
+
onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
311
|
+
onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
312
|
+
onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
|
|
313
|
+
onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
|
|
314
|
+
onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
315
|
+
onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
316
|
+
onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
317
|
+
onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
318
|
+
onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
319
|
+
onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
320
|
+
onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
321
|
+
onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
322
|
+
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
323
|
+
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
324
|
+
onpointerrawupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
325
|
+
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
326
|
+
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
|
|
327
|
+
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
328
|
+
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
329
|
+
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
330
|
+
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
331
|
+
onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
332
|
+
onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
|
|
333
|
+
onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
334
|
+
onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
335
|
+
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
336
|
+
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
337
|
+
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
338
|
+
onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
339
|
+
onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
340
|
+
onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
|
|
341
|
+
onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
342
|
+
ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
343
|
+
ontoggle: ((this: GlobalEventHandlers, ev: ToggleEvent) => any) | null;
|
|
344
|
+
ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
345
|
+
ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
346
|
+
ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
347
|
+
ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
|
|
348
|
+
ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
349
|
+
ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
350
|
+
ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
351
|
+
ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
|
|
352
|
+
onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
353
|
+
onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
354
|
+
onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
355
|
+
onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
356
|
+
onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
357
|
+
onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
358
|
+
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
|
|
359
|
+
autofocus: boolean;
|
|
360
|
+
readonly dataset: DOMStringMap;
|
|
361
|
+
nonce?: string;
|
|
362
|
+
tabIndex: number;
|
|
363
|
+
blur(): void;
|
|
364
|
+
focus(options?: FocusOptions): void;
|
|
365
|
+
};
|
|
366
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { microbounce } from "@e280/stz";
|
|
2
|
+
import { render as litRender } from "lit";
|
|
3
|
+
import { ShadowCx } from "../parts/cx.js";
|
|
4
|
+
import { hooks } from "../hooks/plumbing/hooks.js";
|
|
5
|
+
import { Reactivity } from "../parts/reactivity.js";
|
|
6
|
+
import { Hookscope } from "../hooks/plumbing/hookscope.js";
|
|
7
|
+
export function shadowElement(view) {
|
|
8
|
+
return class extends HTMLElement {
|
|
9
|
+
#cx;
|
|
10
|
+
#hookscope;
|
|
11
|
+
#reactivity = new Reactivity();
|
|
12
|
+
#shadow = this.attachShadow({ mode: "open" });
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
const rerender = microbounce(() => {
|
|
16
|
+
if (!this.isConnected)
|
|
17
|
+
return;
|
|
18
|
+
const content = this.#renderContent();
|
|
19
|
+
litRender(content, this.#cx.shadow);
|
|
20
|
+
this.#cx.doneRender();
|
|
21
|
+
});
|
|
22
|
+
this.#cx = new ShadowCx(rerender, this, this.#shadow);
|
|
23
|
+
this.#hookscope = new Hookscope(this.#cx);
|
|
24
|
+
}
|
|
25
|
+
#renderContent() {
|
|
26
|
+
return this.#reactivity.observe(() => hooks.wrap(this.#hookscope, () => view()), this.#cx.render);
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
litRender(this.#renderContent(), this.#cx.shadow);
|
|
30
|
+
this.#cx.doneRender();
|
|
31
|
+
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
this.#hookscope.mounts.remountAll();
|
|
34
|
+
this.#cx.render();
|
|
35
|
+
}
|
|
36
|
+
disconnectedCallback() {
|
|
37
|
+
this.#hookscope.mounts.unmountAll();
|
|
38
|
+
this.#reactivity.clear();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=shadow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadow.js","sourceRoot":"","sources":["../../../s/view/elements/shadow.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAA;AACrC,OAAO,EAAC,MAAM,IAAI,SAAS,EAAC,MAAM,KAAK,CAAA;AAEvC,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAC,KAAK,EAAC,MAAM,4BAA4B,CAAA;AAChD,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAC,SAAS,EAAC,MAAM,gCAAgC,CAAA;AAExD,MAAM,UAAU,aAAa,CAAC,IAAmB;IAChD,OAAO,KAAM,SAAQ,WAAW;QAC/B,GAAG,CAAA;QACH,UAAU,CAAA;QACV,WAAW,GAAG,IAAI,UAAU,EAAE,CAAA;QAC9B,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;QAE3C;YACC,KAAK,EAAE,CAAA;YACP,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;gBACjC,IAAI,CAAC,IAAI,CAAC,WAAW;oBAAE,OAAM;gBAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;gBACrC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gBACnC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;YACtB,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,GAAG,GAAG,IAAI,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;YACrD,IAAI,CAAC,UAAU,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC1C,CAAC;QAED,cAAc;YACb,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAC9B,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,EAC/C,IAAI,CAAC,GAAG,CAAC,MAAM,CACf,CAAA;QACF,CAAC;QAED,MAAM;YACL,SAAS,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;YACjD,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;QACtB,CAAC;QAED,iBAAiB;YAChB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;YACnC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;QAClB,CAAC;QAED,oBAAoB;YACnB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;YACnC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAA;QACzB,CAAC;KACD,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useRef } from "./use-ref.js";
|
|
2
|
+
import { dom } from "../../dom/dom.js";
|
|
3
|
+
import { useOnce } from "./use-once.js";
|
|
4
|
+
import { useMount } from "./use-mount.js";
|
|
5
|
+
import { useHost, useRender, useRendered } from "./use-cx.js";
|
|
6
|
+
export function useAttrs(spec) {
|
|
7
|
+
const host = useHost();
|
|
8
|
+
const rerender = useRender();
|
|
9
|
+
const ourChanges = useRef(new Set());
|
|
10
|
+
useMount(() => dom.attrs(host).on(records => {
|
|
11
|
+
for (const record of records) {
|
|
12
|
+
if (ourChanges.current.has(record.attributeName))
|
|
13
|
+
continue;
|
|
14
|
+
rerender();
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
useRendered().then(() => ourChanges.current.clear());
|
|
19
|
+
return useOnce(() => dom.attrs(host).spec(spec, {
|
|
20
|
+
beforeSet: key => ourChanges.current.add(key),
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=use-attrs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-attrs.js","sourceRoot":"","sources":["../../../s/view/hooks/use-attrs.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AACnC,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAA;AACpC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,aAAa,CAAA;AAE3D,MAAM,UAAU,QAAQ,CAAqB,IAAO;IACnD,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IACtB,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAA;IAC5B,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,GAAG,EAAU,CAAC,CAAA;IAE5C,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE;QAC3C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC9B,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,aAAc,CAAC;gBAAE,SAAQ;YAC3D,QAAQ,EAAE,CAAA;YACV,MAAK;QACN,CAAC;IACF,CAAC,CAAC,CAAC,CAAA;IAEH,WAAW,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;IAEpD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;QAC/C,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;KAC7C,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/x/view/hooks/use-life.js
CHANGED
|
@@ -5,9 +5,9 @@ export function useLife(fn) {
|
|
|
5
5
|
const ref = useRef(undefined);
|
|
6
6
|
useMount(() => {
|
|
7
7
|
const [value, dispose] = fn();
|
|
8
|
-
ref.
|
|
8
|
+
ref.current = value;
|
|
9
9
|
return dispose;
|
|
10
10
|
});
|
|
11
|
-
return ref.
|
|
11
|
+
return ref.current;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=use-life.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-life.js","sourceRoot":"","sources":["../../../s/view/hooks/use-life.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AACnC,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAA;AAEvC,uDAAuD;AACvD,MAAM,UAAU,OAAO,CAAQ,EAA6C;IAC3E,MAAM,GAAG,GAAG,MAAM,CAAQ,SAAkB,CAAC,CAAA;IAE7C,QAAQ,CAAC,GAAG,EAAE;QACb,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAA;QAC7B,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"use-life.js","sourceRoot":"","sources":["../../../s/view/hooks/use-life.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AACnC,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAA;AAEvC,uDAAuD;AACvD,MAAM,UAAU,OAAO,CAAQ,EAA6C;IAC3E,MAAM,GAAG,GAAG,MAAM,CAAQ,SAAkB,CAAC,CAAA;IAE7C,QAAQ,CAAC,GAAG,EAAE;QACb,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAA;QAC7B,GAAG,CAAC,OAAO,GAAG,KAAK,CAAA;QACnB,OAAO,OAAO,CAAA;IACf,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAC,OAAO,CAAA;AACnB,CAAC"}
|
package/x/view/hooks/use-op.d.ts
CHANGED
package/x/view/hooks/use-op.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-op.js","sourceRoot":"","sources":["../../../s/view/hooks/use-op.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,EAAE,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"use-op.js","sourceRoot":"","sources":["../../../s/view/hooks/use-op.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,EAAE,EAAC,MAAM,gBAAgB,CAAA;AACjC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AAErC,MAAM,UAAU,KAAK,CAAQ,EAAwB;IACpD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,YAAY,CAAQ,OAAuB;IAC1D,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function useRef<Value>(
|
|
1
|
+
export declare function useRef<Value>(initial: Value): Ref<Value>;
|
|
2
2
|
export declare class Ref<Value> {
|
|
3
|
-
|
|
4
|
-
constructor(
|
|
3
|
+
current: Value;
|
|
4
|
+
constructor(current: Value);
|
|
5
5
|
}
|
package/x/view/hooks/use-ref.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useOnce } from "./use-once.js";
|
|
2
|
-
export function useRef(
|
|
3
|
-
return useOnce(() => new Ref(
|
|
2
|
+
export function useRef(initial) {
|
|
3
|
+
return useOnce(() => new Ref(initial));
|
|
4
4
|
}
|
|
5
5
|
export class Ref {
|
|
6
|
-
|
|
7
|
-
constructor(
|
|
8
|
-
this.
|
|
6
|
+
current;
|
|
7
|
+
constructor(current) {
|
|
8
|
+
this.current = current;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=use-ref.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-ref.js","sourceRoot":"","sources":["../../../s/view/hooks/use-ref.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AAErC,MAAM,UAAU,MAAM,CAAQ,
|
|
1
|
+
{"version":3,"file":"use-ref.js","sourceRoot":"","sources":["../../../s/view/hooks/use-ref.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AAErC,MAAM,UAAU,MAAM,CAAQ,OAAc;IAC3C,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;AACvC,CAAC;AAED,MAAM,OAAO,GAAG;IACI;IAAnB,YAAmB,OAAc;QAAd,YAAO,GAAP,OAAO,CAAO;IAAG,CAAC;CACrC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function useSignal<Value>(value: Value): import("@e280/strata").
|
|
2
|
-
export declare function useDerived<Value>(fn: () => Value): import("@e280/strata").
|
|
3
|
-
export declare function useLazy<Value>(fn: () => Value): import("@e280/strata").
|
|
1
|
+
export declare function useSignal<Value>(value: Value): import("@e280/strata").Signal<Value>;
|
|
2
|
+
export declare function useDerived<Value>(fn: () => Value): import("@e280/strata").Derived<Value>;
|
|
3
|
+
export declare function useLazy<Value>(fn: () => Value): import("@e280/strata").Lazy<Value>;
|
|
@@ -5,13 +5,13 @@ export function useState(value) {
|
|
|
5
5
|
const ref = useRef(value);
|
|
6
6
|
const set = (next) => {
|
|
7
7
|
const value = typeof next === "function"
|
|
8
|
-
? next(ref.
|
|
8
|
+
? next(ref.current)
|
|
9
9
|
: next;
|
|
10
|
-
if (Object.is(value, ref.
|
|
10
|
+
if (Object.is(value, ref.current))
|
|
11
11
|
return;
|
|
12
|
-
ref.
|
|
12
|
+
ref.current = value;
|
|
13
13
|
render();
|
|
14
14
|
};
|
|
15
|
-
return [ref.
|
|
15
|
+
return [ref.current, set];
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=use-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-state.js","sourceRoot":"","sources":["../../../s/view/hooks/use-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AAErC,MAAM,UAAU,QAAQ,CAAQ,KAAY;IAC3C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAEzB,MAAM,GAAG,GAAG,CAAC,IAAsC,EAAE,EAAE;QACtD,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,UAAU;YACvC,CAAC,CAAE,IAA+B,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"use-state.js","sourceRoot":"","sources":["../../../s/view/hooks/use-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAA;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAA;AAErC,MAAM,UAAU,QAAQ,CAAQ,KAAY;IAC3C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAEzB,MAAM,GAAG,GAAG,CAAC,IAAsC,EAAE,EAAE;QACtD,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,UAAU;YACvC,CAAC,CAAE,IAA+B,CAAC,GAAG,CAAC,OAAO,CAAC;YAC/C,CAAC,CAAC,IAAI,CAAA;QACP,IAAI,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC;YAAE,OAAM;QACzC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAA;QACnB,MAAM,EAAE,CAAA;IACT,CAAC,CAAA;IAED,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAU,CAAA;AACnC,CAAC"}
|
package/x/view/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from "./common/css-reset.js";
|
|
2
|
+
export * from "./common/sly-shadow.js";
|
|
3
|
+
export * from "./elements/light.js";
|
|
4
|
+
export * from "./elements/shadow.js";
|
|
5
|
+
export * from "./hooks/use-attrs.js";
|
|
2
6
|
export * from "./hooks/use-css.js";
|
|
3
7
|
export * from "./hooks/use-cx.js";
|
|
4
8
|
export * from "./hooks/use-life.js";
|
package/x/view/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from "./common/css-reset.js";
|
|
2
|
+
export * from "./common/sly-shadow.js";
|
|
3
|
+
export * from "./elements/light.js";
|
|
4
|
+
export * from "./elements/shadow.js";
|
|
5
|
+
export * from "./hooks/use-attrs.js";
|
|
2
6
|
export * from "./hooks/use-css.js";
|
|
3
7
|
export * from "./hooks/use-cx.js";
|
|
4
8
|
export * from "./hooks/use-life.js";
|
package/x/view/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../s/view/index.ts"],"names":[],"mappings":"AACA,cAAc,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../s/view/index.ts"],"names":[],"mappings":"AACA,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AAEtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AAEnC,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
package/x/view/shadow.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { View, ShadowSetup, ShadowView } from "./types.js";
|
|
2
|
+
export declare function shadowSetup(): ShadowSetup;
|
|
2
3
|
export declare function shadow<Props extends any[]>(view: View<Props>): ShadowView<Props>;
|
|
3
4
|
export declare namespace shadow {
|
|
4
|
-
var
|
|
5
|
+
var setup: (setup: () => ShadowSetup) => <Props extends any[]>(view: View<Props>) => ShadowView<Props>;
|
|
5
6
|
}
|
|
6
|
-
export declare function rawShadow<Props extends any[]>(setup: () => ShadowSetup, view: View<Props>): ShadowView<Props>;
|
package/x/view/shadow.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { microbounce } from "@e280/stz";
|
|
2
2
|
import { render as litRender } from "lit";
|
|
3
|
-
import { dom } from "../dom/dom.js";
|
|
4
3
|
import { ShadowCx } from "./parts/cx.js";
|
|
5
|
-
import { SlyShadow } from "./parts/sly-shadow.js";
|
|
6
4
|
import { hooks } from "./hooks/plumbing/hooks.js";
|
|
5
|
+
import { SlyShadow } from "./common/sly-shadow.js";
|
|
7
6
|
import { Reactivity } from "./parts/reactivity.js";
|
|
8
7
|
import { applyAttrs } from "./parts/apply-attrs.js";
|
|
9
8
|
import { Hookscope } from "./hooks/plumbing/hookscope.js";
|
|
10
9
|
import { AsyncDirective, directive } from "lit/async-directive.js";
|
|
10
|
+
export function shadowSetup() {
|
|
11
|
+
SlyShadow.register();
|
|
12
|
+
const host = document.createElement("sly-shadow");
|
|
13
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
14
|
+
return { host, shadow };
|
|
15
|
+
}
|
|
11
16
|
export function shadow(view) {
|
|
12
|
-
|
|
13
|
-
dom.register({ SlyShadow }, { soft: true });
|
|
14
|
-
const host = document.createElement("sly-shadow");
|
|
15
|
-
const shadow = host.attachShadow({ mode: "open" });
|
|
16
|
-
return { host, shadow };
|
|
17
|
-
};
|
|
18
|
-
return rawShadow(setupFn, view);
|
|
17
|
+
return rawShadow(shadowSetup, view);
|
|
19
18
|
}
|
|
20
|
-
shadow.
|
|
21
|
-
|
|
19
|
+
shadow.setup = (setup) => ((view) => (rawShadow(setup, view)));
|
|
20
|
+
function rawShadow(setup, view) {
|
|
22
21
|
const directiveFn = directive(class extends AsyncDirective {
|
|
23
22
|
#cx;
|
|
24
23
|
#hookscope;
|