@bodil/dom 0.1.3 → 0.1.5
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/dist/component.d.ts +27 -9
- package/dist/component.js +40 -16
- package/dist/component.js.map +1 -1
- package/dist/component.test.js +67 -1
- package/dist/component.test.js.map +1 -1
- package/dist/emitter.d.ts +74 -1
- package/dist/emitter.js +40 -0
- package/dist/emitter.js.map +1 -1
- package/dist/slot.d.ts +2 -1
- package/dist/slot.js +5 -2
- package/dist/slot.js.map +1 -1
- package/package.json +9 -7
- package/src/component.test.ts +58 -11
- package/src/component.ts +87 -28
- package/src/decorators/attribute.test.ts +57 -8
- package/src/decorators/attribute.ts +14 -13
- package/src/decorators/require.test.ts +5 -5
- package/src/emitter.ts +76 -1
- package/src/slot.ts +6 -2
package/dist/component.d.ts
CHANGED
|
@@ -6,27 +6,24 @@ import { type AttributeConfig } from "./decorators/attribute";
|
|
|
6
6
|
import { EmitterElement } from "./emitter";
|
|
7
7
|
import { type QuerySlotOptions } from "./slot";
|
|
8
8
|
export type { ReactiveController, ReactiveControllerHost } from "lit";
|
|
9
|
-
export { attribute, attributeGetter, attributeSetter, type AttributeOptions, type AttributeGetterSetterOptions, } from "./decorators/attribute";
|
|
9
|
+
export { attribute, attributeGetter, attributeSetter, type AttributeOptions, type AttributeGetterSetterOptions, type AttributeType, } from "./decorators/attribute";
|
|
10
10
|
export { connect, connectEffect, type ConnectFunction, type ConnectFunctionReturnValue, } from "./decorators/connect";
|
|
11
11
|
export { reactive } from "./decorators/reactive";
|
|
12
12
|
export { require } from "./decorators/require";
|
|
13
|
+
export { EmitterElement } from "./emitter";
|
|
14
|
+
export type { CustomEventTypes, Emits, EmitsSuper, ElementEmits } from "./emitter";
|
|
13
15
|
export type { QuerySlotOptions } from "./slot";
|
|
14
|
-
export type { CustomEventTypes } from "./emitter";
|
|
15
16
|
export type UpdateConfig = {
|
|
16
17
|
viewTransition?: boolean;
|
|
17
18
|
};
|
|
18
19
|
declare const finalised: unique symbol;
|
|
19
20
|
export type Deps = Array<typeof HTMLElement>;
|
|
20
|
-
export type Declare<A extends keyof HTMLElementEventMap> = {
|
|
21
|
-
[K in A]: never;
|
|
22
|
-
};
|
|
23
|
-
export type ExtendSuper<C extends Component, A extends keyof HTMLElementEventMap> = {
|
|
24
|
-
[K in keyof C["emits"] | A]: never;
|
|
25
|
-
};
|
|
26
|
-
export type Emits<C> = C extends Component ? keyof C["emits"] : never;
|
|
27
21
|
export type CSSStyleSpec = CSSResult | CSSStyleSheet | string;
|
|
28
22
|
export type CSSStyleSpecArray = Array<CSSStyleSpec | CSSStyleSpecArray>;
|
|
29
23
|
export type CSSStyleSpecDeclaration = CSSStyleSpec | CSSStyleSpecArray;
|
|
24
|
+
export declare class ComponentUpdateLoopError extends Error {
|
|
25
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
26
|
+
}
|
|
30
27
|
export declare abstract class Component extends EmitterElement implements ReactiveControllerHost, Disposable {
|
|
31
28
|
#private;
|
|
32
29
|
static deps: Deps;
|
|
@@ -72,11 +69,32 @@ export declare abstract class Component extends EmitterElement implements Reacti
|
|
|
72
69
|
protected firstInitialised(): void;
|
|
73
70
|
protected render(): unknown;
|
|
74
71
|
[Symbol.dispose](): void;
|
|
72
|
+
/**
|
|
73
|
+
* Attach a {@link Disposable} to the component's connected/disconnected
|
|
74
|
+
* lifecycle state.
|
|
75
|
+
*
|
|
76
|
+
* This causes the {@link Disposable} to be disposed automatically when the
|
|
77
|
+
* component is disconnected. The common pattern for this is for resources,
|
|
78
|
+
* such as event listeners, allocated in {@link Component.connectedCallback}
|
|
79
|
+
* to be registered for automatic deallocation during
|
|
80
|
+
* {@link Component.disconnectedCallback}.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* protected override connectedCallback() {
|
|
84
|
+
* super.connectedCallback();
|
|
85
|
+
* this.useWhileConnected(this.on("click", this.handleClick.bind(this)));
|
|
86
|
+
* }
|
|
87
|
+
*/
|
|
75
88
|
useWhileConnected(disposifiable: undefined): undefined;
|
|
76
89
|
useWhileConnected(disposifiable: null): null;
|
|
77
90
|
useWhileConnected(disposifiable: Disposifiable): Disposable;
|
|
78
91
|
useWhileConnected(disposifiable: Disposifiable | undefined): Disposable | undefined;
|
|
79
92
|
useWhileConnected(disposifiable: Disposifiable | null | undefined): Disposable | null | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Attach an event listener to an event on this component.
|
|
95
|
+
*
|
|
96
|
+
* @returns A {@link Disposable} to subsequently detach the event listener.
|
|
97
|
+
*/
|
|
80
98
|
on<K extends keyof HTMLElementEventMap>(type: K, callback: (event: HTMLElementEventMap[K]) => void, options?: AddEventListenerOptions | boolean): Disposable;
|
|
81
99
|
/**
|
|
82
100
|
* If an element that is either inside this element's shadow root or is a
|
package/dist/component.js
CHANGED
|
@@ -11,19 +11,23 @@ import { childElements } from "./dom";
|
|
|
11
11
|
import { EmitterElement } from "./emitter";
|
|
12
12
|
import { eventListener } from "./event";
|
|
13
13
|
import { scheduler } from "./scheduler";
|
|
14
|
-
import { findSlot, getOrSetQuery, getOrSetSignal, SlotChangeController, } from "./slot";
|
|
14
|
+
import { findSlot, getOrSetQuery, getOrSetSignal, listsEqual, SlotChangeController, } from "./slot";
|
|
15
15
|
export { attribute, attributeGetter, attributeSetter, } from "./decorators/attribute";
|
|
16
16
|
export { connect, connectEffect, } from "./decorators/connect";
|
|
17
17
|
export { reactive } from "./decorators/reactive";
|
|
18
18
|
export { require } from "./decorators/require";
|
|
19
|
+
export { EmitterElement } from "./emitter";
|
|
19
20
|
Symbol.metadata ??= Symbol.for("Symbol.metadata");
|
|
20
|
-
function listsEqual(as, bs) {
|
|
21
|
-
return as.length === bs.length && as.every((a, index) => Object.is(a, bs[index]));
|
|
22
|
-
}
|
|
23
21
|
const finalised = Symbol("finalised");
|
|
24
22
|
function processCSSStyleSpec(spec) {
|
|
25
23
|
return getCompatibleStyle(typeof spec === "string" ? unsafeCSS(spec) : spec);
|
|
26
24
|
}
|
|
25
|
+
export class ComponentUpdateLoopError extends Error {
|
|
26
|
+
constructor(message, options) {
|
|
27
|
+
super(message, options);
|
|
28
|
+
this.name = "ComponentUpdateLoopError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
27
31
|
export class Component extends EmitterElement {
|
|
28
32
|
static { this.deps = []; }
|
|
29
33
|
static { this.shadowRootOptions = { mode: "open" }; }
|
|
@@ -37,6 +41,7 @@ export class Component extends EmitterElement {
|
|
|
37
41
|
static { this[_a] = true; }
|
|
38
42
|
#controllers;
|
|
39
43
|
#connectedContext;
|
|
44
|
+
#dirty;
|
|
40
45
|
#isUpdatePending;
|
|
41
46
|
#updateSignal;
|
|
42
47
|
#updateSignalWatcher;
|
|
@@ -106,6 +111,7 @@ export class Component extends EmitterElement {
|
|
|
106
111
|
this.renderOptions = { host: this };
|
|
107
112
|
this.#controllers = new Set();
|
|
108
113
|
this.#connectedContext = new DisposableContext();
|
|
114
|
+
this.#dirty = false;
|
|
109
115
|
this.#isUpdatePending = false;
|
|
110
116
|
this.#updateSignalWatcher = new Signal.subtle.Watcher(() => this.requestUpdate());
|
|
111
117
|
this.#updateResult = Promise.withResolvers();
|
|
@@ -218,6 +224,7 @@ export class Component extends EmitterElement {
|
|
|
218
224
|
return renderRoot;
|
|
219
225
|
}
|
|
220
226
|
requestUpdate(opts) {
|
|
227
|
+
this.#dirty = true;
|
|
221
228
|
if (opts?.viewTransition === true) {
|
|
222
229
|
this.#viewTransitionRequested = true;
|
|
223
230
|
}
|
|
@@ -245,6 +252,9 @@ export class Component extends EmitterElement {
|
|
|
245
252
|
return this.#hasRequiredProperties;
|
|
246
253
|
}
|
|
247
254
|
async performUpdate() {
|
|
255
|
+
if (!this.isConnected || !this.isUpdatePending) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
248
258
|
let didFirstUpdate = false;
|
|
249
259
|
const runUpdate = () => {
|
|
250
260
|
this.#controllers.forEach((c) => c.hostUpdate?.());
|
|
@@ -257,20 +267,29 @@ export class Component extends EmitterElement {
|
|
|
257
267
|
}
|
|
258
268
|
this.updated();
|
|
259
269
|
};
|
|
260
|
-
if (!this.isConnected || !this.isUpdatePending) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
270
|
try {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
this
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
+
let count = 0;
|
|
272
|
+
while (this.#dirty) {
|
|
273
|
+
// Retry this.update() until it runs without causing dirtiness.
|
|
274
|
+
// This is to allow render() to react to things like slot
|
|
275
|
+
// queries responding to slots being created.
|
|
276
|
+
this.#dirty = false;
|
|
277
|
+
count++;
|
|
278
|
+
// If it runs dirty too many times, that's an error.
|
|
279
|
+
if (count > 4) {
|
|
280
|
+
throw new ComponentUpdateLoopError(`Component.update() ran dirty ${count} times, ensure you're not accidentally triggering updates inside render()`);
|
|
281
|
+
}
|
|
282
|
+
if (this.#viewTransitionRequested &&
|
|
283
|
+
typeof document.startViewTransition === "function") {
|
|
284
|
+
this.#viewTransitionRequested = false;
|
|
285
|
+
await document.startViewTransition(runUpdate).finished;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
runUpdate();
|
|
289
|
+
}
|
|
271
290
|
}
|
|
272
|
-
this.#updateResult.resolve(true);
|
|
273
291
|
this.#isUpdatePending = false;
|
|
292
|
+
this.#updateResult.resolve(true);
|
|
274
293
|
if (didFirstUpdate) {
|
|
275
294
|
await this.stabilise();
|
|
276
295
|
this.stabilised();
|
|
@@ -278,8 +297,8 @@ export class Component extends EmitterElement {
|
|
|
278
297
|
}
|
|
279
298
|
}
|
|
280
299
|
catch (e) {
|
|
281
|
-
this.#updateResult.reject(e);
|
|
282
300
|
this.#isUpdatePending = false;
|
|
301
|
+
this.#updateResult.reject(e);
|
|
283
302
|
if (didFirstUpdate) {
|
|
284
303
|
this.#stabilised.reject(e);
|
|
285
304
|
}
|
|
@@ -348,6 +367,11 @@ export class Component extends EmitterElement {
|
|
|
348
367
|
this.#connectedContext.use(disposable);
|
|
349
368
|
return disposable;
|
|
350
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Attach an event listener to an event on this component.
|
|
372
|
+
*
|
|
373
|
+
* @returns A {@link Disposable} to subsequently detach the event listener.
|
|
374
|
+
*/
|
|
351
375
|
on(type, callback, options) {
|
|
352
376
|
return eventListener(this, type, callback, options);
|
|
353
377
|
}
|
package/dist/component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAsB,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EACH,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,SAAS,GAOZ,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,eAAe,EAAE,aAAa,EAAwB,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACH,QAAQ,EACR,aAAa,EACb,cAAc,EACd,oBAAoB,GAEvB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACH,SAAS,EACT,eAAe,EACf,eAAe,GAGlB,MAAM,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AG,EAAE;YACzC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;YAC1D,IAAI,CAAC,aAAa,CAAC,IAAI,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACrE,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACf,CAAC"}
|
package/dist/component.test.js
CHANGED
|
@@ -36,7 +36,7 @@ import { html } from "lit";
|
|
|
36
36
|
import { customElement } from "lit/decorators.js";
|
|
37
37
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
38
38
|
import { expect, expectTypeOf, test } from "vitest";
|
|
39
|
-
import { Component } from "./component";
|
|
39
|
+
import { Component, ComponentUpdateLoopError } from "./component";
|
|
40
40
|
test("Component.query", async () => {
|
|
41
41
|
let QueryTestClass = (() => {
|
|
42
42
|
let _classDecorators = [customElement("query-test-class")];
|
|
@@ -138,4 +138,70 @@ test("Component.querySlot", async () => {
|
|
|
138
138
|
expect(t.querySlot({ selector: "div.robert" })).deep.equal([robert]);
|
|
139
139
|
expectTypeOf(t.querySlot({ nodes: true })).toEqualTypeOf();
|
|
140
140
|
});
|
|
141
|
+
test("Component.querySlot signal in render() triggers update", async () => {
|
|
142
|
+
let QuerySlotSignalTestClass = (() => {
|
|
143
|
+
let _classDecorators = [customElement("query-slot-signal-test-class")];
|
|
144
|
+
let _classDescriptor;
|
|
145
|
+
let _classExtraInitializers = [];
|
|
146
|
+
let _classThis;
|
|
147
|
+
let _classSuper = Component;
|
|
148
|
+
var QuerySlotSignalTestClass = class extends _classSuper {
|
|
149
|
+
static { _classThis = this; }
|
|
150
|
+
static {
|
|
151
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
152
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
153
|
+
QuerySlotSignalTestClass = _classThis = _classDescriptor.value;
|
|
154
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
155
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
156
|
+
}
|
|
157
|
+
render() {
|
|
158
|
+
// This query will return empty on the first update, because the
|
|
159
|
+
// slot element hasn't been created yet. We expect render() to be
|
|
160
|
+
// re-run once the slot exists, inside the same update cycle.
|
|
161
|
+
if (this.querySlot({ reactive: true }).get().length === 0) {
|
|
162
|
+
return html `<slot></slot>
|
|
163
|
+
<div class="no-members">no members</div>`;
|
|
164
|
+
}
|
|
165
|
+
return html `<slot></slot>
|
|
166
|
+
<div class="has-members">has members</div>`;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
return QuerySlotSignalTestClass = _classThis;
|
|
170
|
+
})();
|
|
171
|
+
const t = document.createElement("query-slot-signal-test-class");
|
|
172
|
+
document.body.append(t);
|
|
173
|
+
const joe = document.createElement("div");
|
|
174
|
+
joe.classList.add("joe");
|
|
175
|
+
t.append(joe);
|
|
176
|
+
await t.updateComplete;
|
|
177
|
+
expect(t.querySlot({ reactive: true }).get()).deep.equal([joe]);
|
|
178
|
+
expect(t.query("div.has-members")).toBeInstanceOf(HTMLDivElement);
|
|
179
|
+
});
|
|
180
|
+
test("dirty render loop aborts", async () => {
|
|
181
|
+
let DirtyRenderLoopTestClass = (() => {
|
|
182
|
+
let _classDecorators = [customElement("dirty-render-loop-test-class")];
|
|
183
|
+
let _classDescriptor;
|
|
184
|
+
let _classExtraInitializers = [];
|
|
185
|
+
let _classThis;
|
|
186
|
+
let _classSuper = Component;
|
|
187
|
+
var DirtyRenderLoopTestClass = class extends _classSuper {
|
|
188
|
+
static { _classThis = this; }
|
|
189
|
+
static {
|
|
190
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
191
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
192
|
+
DirtyRenderLoopTestClass = _classThis = _classDescriptor.value;
|
|
193
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
194
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
195
|
+
}
|
|
196
|
+
render() {
|
|
197
|
+
this.requestUpdate();
|
|
198
|
+
return html `welp!`;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
return DirtyRenderLoopTestClass = _classThis;
|
|
202
|
+
})();
|
|
203
|
+
const t = document.createElement("dirty-render-loop-test-class");
|
|
204
|
+
document.body.append(t);
|
|
205
|
+
await expect(t.updateComplete).rejects.toThrowError(ComponentUpdateLoopError);
|
|
206
|
+
});
|
|
141
207
|
//# sourceMappingURL=component.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.test.js","sourceRoot":"","sources":["../src/component.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"component.test.js","sourceRoot":"","sources":["../src/component.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,IAAI,EAAE,MAAM,K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M,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AACtE,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;QAElC,wBAAwB;gCAD7B,aAAa,CAAC,8BAA8B,CAAC;;;;0BACP,SAAS;4CAAjB,SAAQ,WAAS;;;;gBAAhD,6KAKC;;;gBALK,uDAAwB;;YAC1B,MAAM;gBACF,IAAI,CAAC,aAAa,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAA,OAAO,CAAC;YACvB,CAAC;;;;IAGL,MAAM,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,8BAA8B,CAA6B,CAAC;IAC7F,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAExB,MAAM,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,wBAAwB,CAAC,CAAC;AAClF,CAAC,CAAC,CAAC"}
|
package/dist/emitter.d.ts
CHANGED
|
@@ -1,10 +1,83 @@
|
|
|
1
1
|
export type CustomEventTypes<T extends keyof HTMLElementEventMap> = {
|
|
2
2
|
[Key in T]: HTMLElementEventMap[Key] extends CustomEvent<infer D> ? D : never;
|
|
3
3
|
};
|
|
4
|
+
/**
|
|
5
|
+
* Declare the events that can be emitted.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* class MyElement extends EmitterElement {
|
|
9
|
+
* emits!: Emits<"keydown" | "keyup">;
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export type Emits<A extends keyof HTMLElementEventMap> = {
|
|
13
|
+
[K in A]: never;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Declare the events that can be emitted, including the events listed in the
|
|
17
|
+
* provided superclass.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* class MyElement extends MySuperclassElement {
|
|
21
|
+
* emits!: EmitsSuper<MySuperclassElement, "click">;
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
export type EmitsSuper<C extends EmitterElement, A extends keyof HTMLElementEventMap> = {
|
|
25
|
+
[K in keyof C["emits"] | A]: never;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Given an element type, extract the emitted events for that element.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* class MyElement extends EmitterElement {
|
|
32
|
+
* emits!: Emits<"click" | "change">;
|
|
33
|
+
* }
|
|
34
|
+
* type MyElementEvents = ElementEmits<MyElement>;
|
|
35
|
+
* // resolves to "click" | "change";
|
|
36
|
+
*/
|
|
37
|
+
export type ElementEmits<C> = C extends EmitterElement ? keyof C["emits"] : never;
|
|
38
|
+
/**
|
|
39
|
+
* A subclass of {@link HTMLElement} which declares what events can be emitted
|
|
40
|
+
* by it at the type level. Thus, calling `this.emit()` with an undeclared event
|
|
41
|
+
* name will be a type error.
|
|
42
|
+
*
|
|
43
|
+
* It also offers proper type checking of the data provided to
|
|
44
|
+
* {@link EmitterElement.emit} using the types declared in
|
|
45
|
+
* {@link HTMLElementEventMap}.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* declare global {
|
|
49
|
+
* interface HTMLElementEventMap {
|
|
50
|
+
* "my-event": { name: string; count: number; }
|
|
51
|
+
* }
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* class MyElement extends EmitterElement {
|
|
55
|
+
* emits!: Emits<"my-event">;
|
|
56
|
+
*
|
|
57
|
+
* handleMyEvent() {
|
|
58
|
+
* this.emit("my-event", { name: "Joe", count: 1337 });
|
|
59
|
+
* }
|
|
60
|
+
* }
|
|
61
|
+
*/
|
|
4
62
|
export declare class EmitterElement extends HTMLElement {
|
|
5
63
|
emits: {
|
|
6
64
|
[K in keyof HTMLElementEventMap]?: never;
|
|
7
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Emit a custom event with the given name and detail.
|
|
68
|
+
*
|
|
69
|
+
* Event init options default to `{ bubbles: true, composed: true }`.
|
|
70
|
+
*/
|
|
8
71
|
emit<M extends CustomEventTypes<keyof this["emits"] & keyof HTMLElementEventMap>, K extends Extract<keyof M, string>, D extends M[K]>(name: K, detail?: D, options?: EventInit): CustomEvent<D>;
|
|
9
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Construct an event using the provided name and constructor.
|
|
74
|
+
*
|
|
75
|
+
* The constructor will be called with the name as its first argument,
|
|
76
|
+
* followed by any subsequent arguments provided after the constructor.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* this.emitEvent("click", MouseEvent, { button: 2 });
|
|
80
|
+
* // emits: new MouseEvent("click", { button: 2 });
|
|
81
|
+
*/
|
|
82
|
+
emitEvent<K extends keyof this["emits"] & keyof HTMLElementEventMap, E extends HTMLElementEventMap[K], C extends new (type: string, ...args: Args) => E, Args extends Array<any>>(name: K, constructor: C, ...args: Args): E;
|
|
10
83
|
}
|
package/dist/emitter.js
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A subclass of {@link HTMLElement} which declares what events can be emitted
|
|
3
|
+
* by it at the type level. Thus, calling `this.emit()` with an undeclared event
|
|
4
|
+
* name will be a type error.
|
|
5
|
+
*
|
|
6
|
+
* It also offers proper type checking of the data provided to
|
|
7
|
+
* {@link EmitterElement.emit} using the types declared in
|
|
8
|
+
* {@link HTMLElementEventMap}.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* declare global {
|
|
12
|
+
* interface HTMLElementEventMap {
|
|
13
|
+
* "my-event": { name: string; count: number; }
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* class MyElement extends EmitterElement {
|
|
18
|
+
* emits!: Emits<"my-event">;
|
|
19
|
+
*
|
|
20
|
+
* handleMyEvent() {
|
|
21
|
+
* this.emit("my-event", { name: "Joe", count: 1337 });
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*/
|
|
1
25
|
export class EmitterElement extends HTMLElement {
|
|
26
|
+
/**
|
|
27
|
+
* Emit a custom event with the given name and detail.
|
|
28
|
+
*
|
|
29
|
+
* Event init options default to `{ bubbles: true, composed: true }`.
|
|
30
|
+
*/
|
|
2
31
|
emit(name, detail, options) {
|
|
3
32
|
const event = new CustomEvent(name, {
|
|
4
33
|
bubbles: true,
|
|
@@ -9,9 +38,20 @@ export class EmitterElement extends HTMLElement {
|
|
|
9
38
|
this.dispatchEvent(event);
|
|
10
39
|
return event;
|
|
11
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Construct an event using the provided name and constructor.
|
|
43
|
+
*
|
|
44
|
+
* The constructor will be called with the name as its first argument,
|
|
45
|
+
* followed by any subsequent arguments provided after the constructor.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* this.emitEvent("click", MouseEvent, { button: 2 });
|
|
49
|
+
* // emits: new MouseEvent("click", { button: 2 });
|
|
50
|
+
*/
|
|
12
51
|
emitEvent(name, constructor, ...args) {
|
|
13
52
|
const event = new constructor(name, ...args);
|
|
14
53
|
this.dispatchEvent(event);
|
|
54
|
+
return event;
|
|
15
55
|
}
|
|
16
56
|
}
|
|
17
57
|
//# sourceMappingURL=emitter.js.map
|
package/dist/emitter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAW;IAG3C;;;;OAIG;IACH,IAAI,CAIF,IAAO,EAAE,MAAU,EAAE,OAAmB;QACtC,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE;YAChC,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM;YACN,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;SACrB,CAAC,CAAC;QACH,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;;;;OASG;IACH,SAAS,CAKP,IAAO,EAAE,WAAc,EAAE,GAAG,IAAU;QACpC,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"}
|
package/dist/slot.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ export interface QuerySlotOptions extends AssignedNodesOptions {
|
|
|
14
14
|
/** Create a signal which will update with changes to the slot's contents. */
|
|
15
15
|
reactive?: boolean;
|
|
16
16
|
}
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function listsEqual<A>(as: Array<A>, bs: Array<A>): boolean;
|
|
18
|
+
export declare function findSlot(root: Component, name: string | undefined): HTMLSlotElement | null;
|
|
18
19
|
export declare class SlotChangeController implements ReactiveController {
|
|
19
20
|
private readonly host;
|
|
20
21
|
private readonly slot;
|
package/dist/slot.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { DisposableContext } from "@bodil/core/disposable";
|
|
2
2
|
import { eventListener } from "./event";
|
|
3
|
-
export function
|
|
4
|
-
|
|
3
|
+
export function listsEqual(as, bs) {
|
|
4
|
+
return as.length === bs.length && as.every((a, index) => Object.is(a, bs[index]));
|
|
5
|
+
}
|
|
6
|
+
export function findSlot(root, name) {
|
|
7
|
+
const slotSelector = `slot${name !== undefined ? `[name=${name}]` : ":not([name])"}`;
|
|
5
8
|
return root.renderRoot.querySelector(slotSelector);
|
|
6
9
|
}
|
|
7
10
|
export class SlotChangeController {
|
package/dist/slot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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AC;AACvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bodil/dom",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "DOM and web component tools",
|
|
5
5
|
"homepage": "https://codeberg.org/bodil/dom",
|
|
6
6
|
"repository": {
|
|
@@ -59,16 +59,17 @@
|
|
|
59
59
|
"@bodil/core": "^0.4.9",
|
|
60
60
|
"@bodil/opt": "^0.4.2",
|
|
61
61
|
"@bodil/signal": "^0.3.3",
|
|
62
|
-
"lit": "^3.3.
|
|
62
|
+
"lit": "^3.3.2",
|
|
63
63
|
"type-fest": "^5.3.1"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@eslint/eslintrc": "^3.3.3",
|
|
67
67
|
"@eslint/js": "^9.39.2",
|
|
68
68
|
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
|
|
69
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
70
|
-
"@typescript-eslint/parser": "^8.
|
|
71
|
-
"@vitest/
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
70
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
71
|
+
"@vitest/browser-playwright": "^4.0.16",
|
|
72
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
72
73
|
"eslint": "^9.39.2",
|
|
73
74
|
"eslint-config-prettier": "^10.1.8",
|
|
74
75
|
"eslint-plugin-jsdoc": "^54.7.0",
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
"typedoc-plugin-extras": "^4.0.1",
|
|
81
82
|
"typedoc-plugin-mdn-links": "^5.0.10",
|
|
82
83
|
"typescript": "^5.9.3",
|
|
83
|
-
"vitest": "^4.0.
|
|
84
|
+
"vitest": "^4.0.16"
|
|
84
85
|
},
|
|
85
86
|
"prettier": {
|
|
86
87
|
"editorconfig": true,
|
|
@@ -106,11 +107,12 @@
|
|
|
106
107
|
"scripts": {
|
|
107
108
|
"build": "tsc",
|
|
108
109
|
"test": "vitest --run",
|
|
110
|
+
"test:browser": "vitest --run --browser",
|
|
109
111
|
"check:eslint": "eslint src",
|
|
110
112
|
"check:tsc": "tsc --noEmit",
|
|
111
113
|
"check": "run-p check:tsc check:eslint",
|
|
112
114
|
"doc": "typedoc",
|
|
113
115
|
"doc:readthedocs": "typedoc --out $READTHEDOCS_OUTPUT/html",
|
|
114
|
-
"prepublish": "
|
|
116
|
+
"prepublish": "run-p check test:browser"
|
|
115
117
|
}
|
|
116
118
|
}
|
package/src/component.test.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { sleep } from "@bodil/core/async";
|
|
1
2
|
import type { Signal } from "@bodil/signal";
|
|
2
3
|
import { html } from "lit";
|
|
3
4
|
import { customElement } from "lit/decorators.js";
|
|
4
5
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
5
6
|
import { expect, expectTypeOf, test } from "vitest";
|
|
6
7
|
|
|
7
|
-
import { Component } from "./component";
|
|
8
|
+
import { Component, ComponentUpdateLoopError } from "./component";
|
|
8
9
|
|
|
9
10
|
test("Component.query", async () => {
|
|
10
11
|
@customElement("query-test-class")
|
|
@@ -63,28 +64,74 @@ test("Component.querySlot", async () => {
|
|
|
63
64
|
|
|
64
65
|
await t.updateComplete;
|
|
65
66
|
|
|
66
|
-
expect(t.querySlot()).
|
|
67
|
-
expect(t.querySlot({ slot: "fixes-the-bug" })).
|
|
67
|
+
expect(t.querySlot()).toEqual([joe, mike]);
|
|
68
|
+
expect(t.querySlot({ slot: "fixes-the-bug" })).toEqual([robert]);
|
|
68
69
|
|
|
69
70
|
const slot = t.querySlot({ slot: "fixes-the-bug", reactive: true });
|
|
70
71
|
expectTypeOf(slot).toEqualTypeOf<Signal.Computed<Array<Element>>>();
|
|
71
|
-
expect(slot.get()).
|
|
72
|
+
expect(slot.get()).toEqual([robert]);
|
|
72
73
|
joe.slot = "fixes-the-bug"; // for argument's sake
|
|
73
|
-
|
|
74
|
-
expect(
|
|
74
|
+
await sleep(1);
|
|
75
|
+
expect(slot.get()).toEqual([joe, robert]);
|
|
76
|
+
expect(t.querySlot()).toEqual([mike]);
|
|
75
77
|
robert.removeAttribute("slot");
|
|
76
|
-
|
|
77
|
-
expect(
|
|
78
|
+
await sleep(1);
|
|
79
|
+
expect(slot.get()).toEqual([joe]);
|
|
80
|
+
expect(t.querySlot()).toEqual([mike, robert]);
|
|
78
81
|
|
|
79
82
|
const divsByInstance = t.querySlot({ instanceOf: HTMLDivElement });
|
|
80
83
|
expectTypeOf(divsByInstance).toEqualTypeOf<Array<HTMLDivElement>>();
|
|
81
|
-
expect(divsByInstance).
|
|
84
|
+
expect(divsByInstance).toEqual([mike, robert]);
|
|
82
85
|
|
|
83
86
|
const divsBySelector = t.querySlot({ selector: "div" });
|
|
84
87
|
expectTypeOf(divsBySelector).toEqualTypeOf<Array<HTMLDivElement>>();
|
|
85
|
-
expect(divsBySelector).
|
|
88
|
+
expect(divsBySelector).toEqual([mike, robert]);
|
|
86
89
|
|
|
87
|
-
expect(t.querySlot({ selector: "div.robert" })).
|
|
90
|
+
expect(t.querySlot({ selector: "div.robert" })).toEqual([robert]);
|
|
88
91
|
|
|
89
92
|
expectTypeOf(t.querySlot({ nodes: true })).toEqualTypeOf<Array<Node>>();
|
|
90
93
|
});
|
|
94
|
+
|
|
95
|
+
test("Component.querySlot signal in render() triggers update", async () => {
|
|
96
|
+
@customElement("query-slot-signal-test-class")
|
|
97
|
+
class QuerySlotSignalTestClass extends Component {
|
|
98
|
+
render() {
|
|
99
|
+
// This query will return empty on the first update, because the
|
|
100
|
+
// slot element hasn't been created yet. We expect render() to be
|
|
101
|
+
// re-run once the slot exists, inside the same update cycle.
|
|
102
|
+
if (this.querySlot({ reactive: true }).get().length === 0) {
|
|
103
|
+
return html`<slot></slot>
|
|
104
|
+
<div class="no-members">no members</div>`;
|
|
105
|
+
}
|
|
106
|
+
return html`<slot></slot>
|
|
107
|
+
<div class="has-members">has members</div>`;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const t = document.createElement("query-slot-signal-test-class") as QuerySlotSignalTestClass;
|
|
112
|
+
document.body.append(t);
|
|
113
|
+
|
|
114
|
+
const joe = document.createElement("div");
|
|
115
|
+
joe.classList.add("joe");
|
|
116
|
+
t.append(joe);
|
|
117
|
+
|
|
118
|
+
await t.updateComplete;
|
|
119
|
+
|
|
120
|
+
expect(t.querySlot({ reactive: true }).get()).deep.equal([joe]);
|
|
121
|
+
expect(t.query("div.has-members")).toBeInstanceOf(HTMLDivElement);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test("dirty render loop aborts", async () => {
|
|
125
|
+
@customElement("dirty-render-loop-test-class")
|
|
126
|
+
class DirtyRenderLoopTestClass extends Component {
|
|
127
|
+
render() {
|
|
128
|
+
this.requestUpdate();
|
|
129
|
+
return html`welp!`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const t = document.createElement("dirty-render-loop-test-class") as DirtyRenderLoopTestClass;
|
|
134
|
+
document.body.append(t);
|
|
135
|
+
|
|
136
|
+
await expect(t.updateComplete).rejects.toThrowError(ComponentUpdateLoopError);
|
|
137
|
+
});
|
package/src/component.ts
CHANGED
|
@@ -16,7 +16,12 @@ import {
|
|
|
16
16
|
} from "lit";
|
|
17
17
|
import type { Constructor } from "type-fest";
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
attributeConfig,
|
|
21
|
+
fromAttribute,
|
|
22
|
+
toAttribute,
|
|
23
|
+
type AttributeConfig,
|
|
24
|
+
} from "./decorators/attribute";
|
|
20
25
|
import { connectedJobs } from "./decorators/connect";
|
|
21
26
|
import { reactiveFields, signalForObject } from "./decorators/reactive";
|
|
22
27
|
import { requiredProperties } from "./decorators/require";
|
|
@@ -28,6 +33,7 @@ import {
|
|
|
28
33
|
findSlot,
|
|
29
34
|
getOrSetQuery,
|
|
30
35
|
getOrSetSignal,
|
|
36
|
+
listsEqual,
|
|
31
37
|
SlotChangeController,
|
|
32
38
|
type QuerySlotOptions,
|
|
33
39
|
} from "./slot";
|
|
@@ -39,6 +45,7 @@ export {
|
|
|
39
45
|
attributeSetter,
|
|
40
46
|
type AttributeOptions,
|
|
41
47
|
type AttributeGetterSetterOptions,
|
|
48
|
+
type AttributeType,
|
|
42
49
|
} from "./decorators/attribute";
|
|
43
50
|
export {
|
|
44
51
|
connect,
|
|
@@ -48,8 +55,9 @@ export {
|
|
|
48
55
|
} from "./decorators/connect";
|
|
49
56
|
export { reactive } from "./decorators/reactive";
|
|
50
57
|
export { require } from "./decorators/require";
|
|
58
|
+
export { EmitterElement } from "./emitter";
|
|
59
|
+
export type { CustomEventTypes, Emits, EmitsSuper, ElementEmits } from "./emitter";
|
|
51
60
|
export type { QuerySlotOptions } from "./slot";
|
|
52
|
-
export type { CustomEventTypes } from "./emitter";
|
|
53
61
|
|
|
54
62
|
(Symbol as any).metadata ??= Symbol.for("Symbol.metadata");
|
|
55
63
|
|
|
@@ -57,22 +65,10 @@ export type UpdateConfig = {
|
|
|
57
65
|
viewTransition?: boolean;
|
|
58
66
|
};
|
|
59
67
|
|
|
60
|
-
function listsEqual<A>(as: Array<A>, bs: Array<A>): boolean {
|
|
61
|
-
return as.length === bs.length && as.every((a, index) => Object.is(a, bs[index]));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
68
|
const finalised = Symbol("finalised");
|
|
65
69
|
|
|
66
70
|
export type Deps = Array<typeof HTMLElement>;
|
|
67
71
|
|
|
68
|
-
export type Declare<A extends keyof HTMLElementEventMap> = { [K in A]: never };
|
|
69
|
-
|
|
70
|
-
export type ExtendSuper<C extends Component, A extends keyof HTMLElementEventMap> = {
|
|
71
|
-
[K in keyof C["emits"] | A]: never;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export type Emits<C> = C extends Component ? keyof C["emits"] : never;
|
|
75
|
-
|
|
76
72
|
export type CSSStyleSpec = CSSResult | CSSStyleSheet | string;
|
|
77
73
|
export type CSSStyleSpecArray = Array<CSSStyleSpec | CSSStyleSpecArray>;
|
|
78
74
|
export type CSSStyleSpecDeclaration = CSSStyleSpec | CSSStyleSpecArray;
|
|
@@ -81,6 +77,13 @@ function processCSSStyleSpec(spec: CSSStyleSpec) {
|
|
|
81
77
|
return getCompatibleStyle(typeof spec === "string" ? unsafeCSS(spec) : spec);
|
|
82
78
|
}
|
|
83
79
|
|
|
80
|
+
export class ComponentUpdateLoopError extends Error {
|
|
81
|
+
constructor(message?: string, options?: ErrorOptions) {
|
|
82
|
+
super(message, options);
|
|
83
|
+
this.name = "ComponentUpdateLoopError";
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
84
87
|
export abstract class Component
|
|
85
88
|
extends EmitterElement
|
|
86
89
|
implements ReactiveControllerHost, Disposable
|
|
@@ -103,6 +106,7 @@ export abstract class Component
|
|
|
103
106
|
|
|
104
107
|
readonly #controllers = new Set<ReactiveController>();
|
|
105
108
|
readonly #connectedContext = new DisposableContext();
|
|
109
|
+
#dirty = false;
|
|
106
110
|
#isUpdatePending = false;
|
|
107
111
|
#updateSignal?: Signal.Computed<void>;
|
|
108
112
|
readonly #updateSignalWatcher = new Signal.subtle.Watcher(() => this.requestUpdate());
|
|
@@ -207,6 +211,23 @@ export abstract class Component
|
|
|
207
211
|
|
|
208
212
|
this.#ignoreAttributeUpdates--;
|
|
209
213
|
this.#initialised = false;
|
|
214
|
+
|
|
215
|
+
// schedule a sync of all reflecting attributes
|
|
216
|
+
const reflectingAttributes = (this.constructor as typeof Component).attributeConfig
|
|
217
|
+
.values()
|
|
218
|
+
.filter((attr) => attr.reflect)
|
|
219
|
+
.toArray();
|
|
220
|
+
if (reflectingAttributes.length > 0) {
|
|
221
|
+
queueMicrotask(() => {
|
|
222
|
+
for (const attr of reflectingAttributes) {
|
|
223
|
+
const value = toAttribute((this as any)[attr.property], attr.type);
|
|
224
|
+
const current = this.getAttribute(attr.name);
|
|
225
|
+
if (value !== current) {
|
|
226
|
+
this.setAttributeQuietly(attr.name, value);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
210
231
|
}
|
|
211
232
|
|
|
212
233
|
protected connectedCallback() {
|
|
@@ -308,6 +329,8 @@ export abstract class Component
|
|
|
308
329
|
}
|
|
309
330
|
|
|
310
331
|
requestUpdate(opts?: UpdateConfig) {
|
|
332
|
+
this.#dirty = true;
|
|
333
|
+
|
|
311
334
|
if (opts?.viewTransition === true) {
|
|
312
335
|
this.#viewTransitionRequested = true;
|
|
313
336
|
}
|
|
@@ -339,6 +362,10 @@ export abstract class Component
|
|
|
339
362
|
}
|
|
340
363
|
|
|
341
364
|
protected async performUpdate() {
|
|
365
|
+
if (!this.isConnected || !this.isUpdatePending) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
|
|
342
369
|
let didFirstUpdate = false;
|
|
343
370
|
const runUpdate = () => {
|
|
344
371
|
this.#controllers.forEach((c) => c.hostUpdate?.());
|
|
@@ -351,30 +378,40 @@ export abstract class Component
|
|
|
351
378
|
}
|
|
352
379
|
this.updated();
|
|
353
380
|
};
|
|
354
|
-
|
|
355
|
-
if (!this.isConnected || !this.isUpdatePending) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
381
|
try {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
382
|
+
let count = 0;
|
|
383
|
+
while (this.#dirty) {
|
|
384
|
+
// Retry this.update() until it runs without causing dirtiness.
|
|
385
|
+
// This is to allow render() to react to things like slot
|
|
386
|
+
// queries responding to slots being created.
|
|
387
|
+
this.#dirty = false;
|
|
388
|
+
count++;
|
|
389
|
+
// If it runs dirty too many times, that's an error.
|
|
390
|
+
if (count > 4) {
|
|
391
|
+
throw new ComponentUpdateLoopError(
|
|
392
|
+
`Component.update() ran dirty ${count} times, ensure you're not accidentally triggering updates inside render()`,
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
if (
|
|
396
|
+
this.#viewTransitionRequested &&
|
|
397
|
+
typeof document.startViewTransition === "function"
|
|
398
|
+
) {
|
|
399
|
+
this.#viewTransitionRequested = false;
|
|
400
|
+
await document.startViewTransition(runUpdate).finished;
|
|
401
|
+
} else {
|
|
402
|
+
runUpdate();
|
|
403
|
+
}
|
|
367
404
|
}
|
|
368
|
-
this.#updateResult.resolve(true);
|
|
369
405
|
this.#isUpdatePending = false;
|
|
406
|
+
this.#updateResult.resolve(true);
|
|
370
407
|
if (didFirstUpdate) {
|
|
371
408
|
await this.stabilise();
|
|
372
409
|
this.stabilised();
|
|
373
410
|
this.#stabilised.resolve();
|
|
374
411
|
}
|
|
375
412
|
} catch (e) {
|
|
376
|
-
this.#updateResult.reject(e);
|
|
377
413
|
this.#isUpdatePending = false;
|
|
414
|
+
this.#updateResult.reject(e);
|
|
378
415
|
if (didFirstUpdate) {
|
|
379
416
|
this.#stabilised.reject(e);
|
|
380
417
|
}
|
|
@@ -448,6 +485,22 @@ export abstract class Component
|
|
|
448
485
|
this.remove();
|
|
449
486
|
}
|
|
450
487
|
|
|
488
|
+
/**
|
|
489
|
+
* Attach a {@link Disposable} to the component's connected/disconnected
|
|
490
|
+
* lifecycle state.
|
|
491
|
+
*
|
|
492
|
+
* This causes the {@link Disposable} to be disposed automatically when the
|
|
493
|
+
* component is disconnected. The common pattern for this is for resources,
|
|
494
|
+
* such as event listeners, allocated in {@link Component.connectedCallback}
|
|
495
|
+
* to be registered for automatic deallocation during
|
|
496
|
+
* {@link Component.disconnectedCallback}.
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* protected override connectedCallback() {
|
|
500
|
+
* super.connectedCallback();
|
|
501
|
+
* this.useWhileConnected(this.on("click", this.handleClick.bind(this)));
|
|
502
|
+
* }
|
|
503
|
+
*/
|
|
451
504
|
useWhileConnected(disposifiable: undefined): undefined;
|
|
452
505
|
useWhileConnected(disposifiable: null): null;
|
|
453
506
|
useWhileConnected(disposifiable: Disposifiable): Disposable;
|
|
@@ -466,6 +519,11 @@ export abstract class Component
|
|
|
466
519
|
return disposable;
|
|
467
520
|
}
|
|
468
521
|
|
|
522
|
+
/**
|
|
523
|
+
* Attach an event listener to an event on this component.
|
|
524
|
+
*
|
|
525
|
+
* @returns A {@link Disposable} to subsequently detach the event listener.
|
|
526
|
+
*/
|
|
469
527
|
on<K extends keyof HTMLElementEventMap>(
|
|
470
528
|
type: K,
|
|
471
529
|
callback: (event: HTMLElementEventMap[K]) => void,
|
|
@@ -551,6 +609,7 @@ export abstract class Component
|
|
|
551
609
|
options: QuerySlotOptions & { selector: El },
|
|
552
610
|
): Array<HTMLElementDeprecatedTagNameMap[El]>;
|
|
553
611
|
querySlot(options?: QuerySlotOptions): Array<Element>;
|
|
612
|
+
|
|
554
613
|
querySlot(
|
|
555
614
|
options?: QuerySlotOptions,
|
|
556
615
|
):
|
|
@@ -4,6 +4,7 @@ import { expect, test } from "vitest";
|
|
|
4
4
|
import { attribute, Component } from "../component";
|
|
5
5
|
import { Signal } from "@bodil/signal";
|
|
6
6
|
import { attributeGetter, attributeSetter } from "./attribute";
|
|
7
|
+
import { html, nothing } from "lit";
|
|
7
8
|
|
|
8
9
|
test("@attribute", async () => {
|
|
9
10
|
@customElement("attribute-test-class")
|
|
@@ -84,20 +85,19 @@ test("@attribute getter/setter", async () => {
|
|
|
84
85
|
@customElement("attribute-getter-test-class")
|
|
85
86
|
class AttributeGetterTestClass extends Component {
|
|
86
87
|
#value = "Mike";
|
|
87
|
-
@attributeGetter get value(): string {
|
|
88
|
+
@attributeGetter({ reflect: true }) get value(): string {
|
|
88
89
|
return this.#value;
|
|
89
90
|
}
|
|
90
|
-
@attributeSetter set value(value: string) {
|
|
91
|
+
@attributeSetter({ reflect: true }) set value(value: string) {
|
|
91
92
|
this.#value = value;
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
#synced = "Mike";
|
|
95
|
-
@attributeGetter
|
|
96
|
+
@attributeGetter get synced(): string {
|
|
96
97
|
return this.#synced;
|
|
97
98
|
}
|
|
98
|
-
@attributeSetter
|
|
99
|
+
@attributeSetter set synced(value: string) {
|
|
99
100
|
this.#synced = value;
|
|
100
|
-
this.setAttributeQuietly("synced", value);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -106,7 +106,7 @@ test("@attribute getter/setter", async () => {
|
|
|
106
106
|
await t.updateComplete;
|
|
107
107
|
|
|
108
108
|
expect(t.value).toBe("Mike");
|
|
109
|
-
expect(t.getAttribute("value")).
|
|
109
|
+
expect(t.getAttribute("value")).toBe("Mike");
|
|
110
110
|
|
|
111
111
|
t.setAttribute("value", "Joe");
|
|
112
112
|
expect(t.value).toBe("Joe");
|
|
@@ -114,7 +114,7 @@ test("@attribute getter/setter", async () => {
|
|
|
114
114
|
|
|
115
115
|
t.value = "Robert";
|
|
116
116
|
expect(t.value).toBe("Robert");
|
|
117
|
-
expect(t.getAttribute("value")).toBe("
|
|
117
|
+
expect(t.getAttribute("value")).toBe("Robert");
|
|
118
118
|
|
|
119
119
|
expect(t.synced).toBe("Mike");
|
|
120
120
|
expect(t.getAttribute("synced")).toBeNull();
|
|
@@ -125,7 +125,7 @@ test("@attribute getter/setter", async () => {
|
|
|
125
125
|
|
|
126
126
|
t.synced = "Robert";
|
|
127
127
|
expect(t.synced).toBe("Robert");
|
|
128
|
-
expect(t.getAttribute("synced")).toBe("
|
|
128
|
+
expect(t.getAttribute("synced")).toBe("Joe");
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
test("@attribute init ordering", async () => {
|
|
@@ -160,3 +160,52 @@ test("@attribute init ordering", async () => {
|
|
|
160
160
|
expect(t.wibble).toBe("Robert");
|
|
161
161
|
expect(t.getAttribute("wibble")).toBe("Robert");
|
|
162
162
|
});
|
|
163
|
+
|
|
164
|
+
test("subcomponent attributes are initialised properly", async () => {
|
|
165
|
+
@customElement("subcomp-init-root")
|
|
166
|
+
class SubcompInitRoot extends Component {
|
|
167
|
+
render() {
|
|
168
|
+
return html`
|
|
169
|
+
<subcomp-init-sub></subcomp-init-sub>
|
|
170
|
+
<subcomp-init-sub
|
|
171
|
+
attr1="Mike"
|
|
172
|
+
attr2="Mike"
|
|
173
|
+
attr3="Mike"
|
|
174
|
+
attr4="Mike"
|
|
175
|
+
></subcomp-init-sub>
|
|
176
|
+
`;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@customElement("subcomp-init-sub")
|
|
181
|
+
class SubcompInitSub extends Component {
|
|
182
|
+
@attribute({ reflect: true, reactive: true }) accessor attr1 = "Joe";
|
|
183
|
+
@attribute({ reflect: true, reactive: false }) accessor attr2 = "Joe";
|
|
184
|
+
@attribute({ reflect: false, reactive: true }) accessor attr3 = "Joe";
|
|
185
|
+
@attribute({ reflect: false, reactive: false }) accessor attr4 = "Joe";
|
|
186
|
+
|
|
187
|
+
render() {
|
|
188
|
+
return nothing;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const root = document.createElement("subcomp-init-root") as SubcompInitRoot;
|
|
193
|
+
document.body.append(root);
|
|
194
|
+
await root.updateComplete;
|
|
195
|
+
|
|
196
|
+
const subs = root.queryAll("subcomp-init-sub") as NodeListOf<SubcompInitSub>;
|
|
197
|
+
expect(subs.length).toBe(2);
|
|
198
|
+
|
|
199
|
+
expect(subs[0].attr1).toBe("Joe");
|
|
200
|
+
expect(subs[0].attr2).toBe("Joe");
|
|
201
|
+
expect(subs[0].attr3).toBe("Joe");
|
|
202
|
+
expect(subs[0].attr4).toBe("Joe");
|
|
203
|
+
expect(subs[0].outerHTML).toBe(`<subcomp-init-sub attr1="Joe" attr2="Joe"></subcomp-init-sub>`);
|
|
204
|
+
expect(subs[1].attr1).toBe("Mike");
|
|
205
|
+
expect(subs[1].attr2).toBe("Mike");
|
|
206
|
+
expect(subs[1].attr3).toBe("Mike");
|
|
207
|
+
expect(subs[1].attr4).toBe("Mike");
|
|
208
|
+
expect(subs[1].outerHTML).toBe(
|
|
209
|
+
`<subcomp-init-sub attr1="Mike" attr2="Mike" attr3="Mike" attr4="Mike"></subcomp-init-sub>`,
|
|
210
|
+
);
|
|
211
|
+
});
|
|
@@ -241,10 +241,8 @@ export function attribute<C extends Component, T extends string | number | boole
|
|
|
241
241
|
);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
if (
|
|
245
|
-
|
|
246
|
-
`Getter/setter attributes cannot be declared with reflect: true (on ${JSON.stringify(context.name)})`,
|
|
247
|
-
);
|
|
244
|
+
if (context.kind === "setter") {
|
|
245
|
+
return setter(options, value as ClassSetterDecoratorTarget<C, T>);
|
|
248
246
|
}
|
|
249
247
|
};
|
|
250
248
|
}
|
|
@@ -262,6 +260,18 @@ function syncAttribute<C extends Component, T>(
|
|
|
262
260
|
}
|
|
263
261
|
}
|
|
264
262
|
|
|
263
|
+
function setter<C extends Component, T>(
|
|
264
|
+
options: AttributeConfig,
|
|
265
|
+
setter: ClassSetterDecoratorTarget<C, T>,
|
|
266
|
+
): ClassSetterDecoratorResult<C, T> {
|
|
267
|
+
if (options.reflect) {
|
|
268
|
+
return function (this: C, value: T) {
|
|
269
|
+
setter.call(this, value);
|
|
270
|
+
syncAttribute(this, options, value);
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
265
275
|
function accessor<C extends Component, T>(
|
|
266
276
|
options: AttributeConfig,
|
|
267
277
|
context: ClassAccessorDecoratorContext<C, T>,
|
|
@@ -287,9 +297,6 @@ function accessor<C extends Component, T>(
|
|
|
287
297
|
},
|
|
288
298
|
init(this: C, value: T): T {
|
|
289
299
|
initValue = Some(value);
|
|
290
|
-
if (options.reflect) {
|
|
291
|
-
syncAttribute(this, options, value, true);
|
|
292
|
-
}
|
|
293
300
|
return value;
|
|
294
301
|
},
|
|
295
302
|
};
|
|
@@ -304,11 +311,5 @@ function accessor<C extends Component, T>(
|
|
|
304
311
|
syncAttribute(this, options, newValue);
|
|
305
312
|
}
|
|
306
313
|
},
|
|
307
|
-
init(this: C, value: T): T {
|
|
308
|
-
if (options.reflect) {
|
|
309
|
-
syncAttribute(this, options, value, true);
|
|
310
|
-
}
|
|
311
|
-
return value;
|
|
312
|
-
},
|
|
313
314
|
};
|
|
314
315
|
}
|
|
@@ -30,27 +30,27 @@ test("@require", async () => {
|
|
|
30
30
|
expect(inits).toBe(0);
|
|
31
31
|
expect(updates).toBe(0);
|
|
32
32
|
c.bar = "bar";
|
|
33
|
-
await sleep(
|
|
33
|
+
await sleep(50);
|
|
34
34
|
// foo and bar are both set, should cause an update
|
|
35
35
|
expect(inits).toBe(1);
|
|
36
36
|
expect(updates).toBe(1);
|
|
37
37
|
c.foo = undefined;
|
|
38
|
-
await sleep(
|
|
38
|
+
await sleep(50);
|
|
39
39
|
// foo has gone undefined, shouldn't update
|
|
40
40
|
expect(inits).toBe(1);
|
|
41
41
|
expect(updates).toBe(1);
|
|
42
42
|
c.foo = "wibble";
|
|
43
|
-
await sleep(
|
|
43
|
+
await sleep(50);
|
|
44
44
|
// foo has stopped being undefined, should update
|
|
45
45
|
expect(inits).toBe(2);
|
|
46
46
|
expect(updates).toBe(2);
|
|
47
47
|
c.bar = "bar";
|
|
48
|
-
await sleep(
|
|
48
|
+
await sleep(50);
|
|
49
49
|
// bar has been redeclared with the same value, shouldn't update
|
|
50
50
|
expect(inits).toBe(2);
|
|
51
51
|
expect(updates).toBe(2);
|
|
52
52
|
c.bar = "wibble";
|
|
53
|
-
await sleep(
|
|
53
|
+
await sleep(50);
|
|
54
54
|
// bar has a new value, should update
|
|
55
55
|
expect(inits).toBe(3);
|
|
56
56
|
expect(updates).toBe(3);
|
package/src/emitter.ts
CHANGED
|
@@ -2,9 +2,73 @@ export type CustomEventTypes<T extends keyof HTMLElementEventMap> = {
|
|
|
2
2
|
[Key in T]: HTMLElementEventMap[Key] extends CustomEvent<infer D> ? D : never;
|
|
3
3
|
};
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Declare the events that can be emitted.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* class MyElement extends EmitterElement {
|
|
10
|
+
* emits!: Emits<"keydown" | "keyup">;
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export type Emits<A extends keyof HTMLElementEventMap> = { [K in A]: never };
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Declare the events that can be emitted, including the events listed in the
|
|
17
|
+
* provided superclass.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* class MyElement extends MySuperclassElement {
|
|
21
|
+
* emits!: EmitsSuper<MySuperclassElement, "click">;
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
export type EmitsSuper<C extends EmitterElement, A extends keyof HTMLElementEventMap> = {
|
|
25
|
+
[K in keyof C["emits"] | A]: never;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Given an element type, extract the emitted events for that element.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* class MyElement extends EmitterElement {
|
|
33
|
+
* emits!: Emits<"click" | "change">;
|
|
34
|
+
* }
|
|
35
|
+
* type MyElementEvents = ElementEmits<MyElement>;
|
|
36
|
+
* // resolves to "click" | "change";
|
|
37
|
+
*/
|
|
38
|
+
export type ElementEmits<C> = C extends EmitterElement ? keyof C["emits"] : never;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A subclass of {@link HTMLElement} which declares what events can be emitted
|
|
42
|
+
* by it at the type level. Thus, calling `this.emit()` with an undeclared event
|
|
43
|
+
* name will be a type error.
|
|
44
|
+
*
|
|
45
|
+
* It also offers proper type checking of the data provided to
|
|
46
|
+
* {@link EmitterElement.emit} using the types declared in
|
|
47
|
+
* {@link HTMLElementEventMap}.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* declare global {
|
|
51
|
+
* interface HTMLElementEventMap {
|
|
52
|
+
* "my-event": { name: string; count: number; }
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* class MyElement extends EmitterElement {
|
|
57
|
+
* emits!: Emits<"my-event">;
|
|
58
|
+
*
|
|
59
|
+
* handleMyEvent() {
|
|
60
|
+
* this.emit("my-event", { name: "Joe", count: 1337 });
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
*/
|
|
5
64
|
export class EmitterElement extends HTMLElement {
|
|
6
65
|
emits!: { [K in keyof HTMLElementEventMap]?: never };
|
|
7
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Emit a custom event with the given name and detail.
|
|
69
|
+
*
|
|
70
|
+
* Event init options default to `{ bubbles: true, composed: true }`.
|
|
71
|
+
*/
|
|
8
72
|
emit<
|
|
9
73
|
M extends CustomEventTypes<keyof this["emits"] & keyof HTMLElementEventMap>,
|
|
10
74
|
K extends Extract<keyof M, string>,
|
|
@@ -20,13 +84,24 @@ export class EmitterElement extends HTMLElement {
|
|
|
20
84
|
return event;
|
|
21
85
|
}
|
|
22
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Construct an event using the provided name and constructor.
|
|
89
|
+
*
|
|
90
|
+
* The constructor will be called with the name as its first argument,
|
|
91
|
+
* followed by any subsequent arguments provided after the constructor.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* this.emitEvent("click", MouseEvent, { button: 2 });
|
|
95
|
+
* // emits: new MouseEvent("click", { button: 2 });
|
|
96
|
+
*/
|
|
23
97
|
emitEvent<
|
|
24
98
|
K extends keyof this["emits"] & keyof HTMLElementEventMap,
|
|
25
99
|
E extends HTMLElementEventMap[K],
|
|
26
100
|
C extends new (type: string, ...args: Args) => E,
|
|
27
101
|
Args extends Array<any>,
|
|
28
|
-
>(name: K, constructor: C, ...args: Args) {
|
|
102
|
+
>(name: K, constructor: C, ...args: Args): E {
|
|
29
103
|
const event = new constructor(name, ...args);
|
|
30
104
|
this.dispatchEvent(event);
|
|
105
|
+
return event;
|
|
31
106
|
}
|
|
32
107
|
}
|
package/src/slot.ts
CHANGED
|
@@ -19,8 +19,12 @@ export interface QuerySlotOptions extends AssignedNodesOptions {
|
|
|
19
19
|
reactive?: boolean;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export function
|
|
23
|
-
|
|
22
|
+
export function listsEqual<A>(as: Array<A>, bs: Array<A>): boolean {
|
|
23
|
+
return as.length === bs.length && as.every((a, index) => Object.is(a, bs[index]));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function findSlot(root: Component, name: string | undefined): HTMLSlotElement | null {
|
|
27
|
+
const slotSelector = `slot${name !== undefined ? `[name=${name}]` : ":not([name])"}`;
|
|
24
28
|
return root.renderRoot.querySelector<HTMLSlotElement>(slotSelector);
|
|
25
29
|
}
|
|
26
30
|
|