@microsoft/fast-element 2.10.4 → 3.0.0-rc.2
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/CHANGELOG.md +52 -2
- package/README.md +244 -1
- package/dist/arrays/arrays.api.json +2621 -0
- package/dist/context/context.api.json +13 -13
- package/dist/declarative/declarative.api.json +8483 -0
- package/dist/di/di.api.json +16 -16
- package/dist/dts/__test__/helpers.d.ts +6 -0
- package/dist/dts/array-observer.d.ts +2 -0
- package/dist/dts/arrays.d.ts +2 -0
- package/dist/dts/attr.d.ts +1 -0
- package/dist/dts/binding/binding.d.ts +15 -5
- package/dist/dts/binding/one-time.d.ts +1 -1
- package/dist/dts/binding/one-way.d.ts +1 -1
- package/dist/dts/binding/signal.d.ts +6 -6
- package/dist/dts/binding/two-way.d.ts +2 -1
- package/dist/dts/binding.d.ts +7 -0
- package/dist/dts/components/attributes.d.ts +1 -4
- package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
- package/dist/dts/components/element-controller.d.ts +80 -114
- package/dist/dts/components/element-hydration.d.ts +1 -1
- package/dist/dts/components/enable-hydration.d.ts +54 -0
- package/dist/dts/components/fast-definitions.d.ts +98 -46
- package/dist/dts/components/fast-element.d.ts +43 -16
- package/dist/dts/components/hydration-tracker.d.ts +83 -0
- package/dist/dts/components/hydration.d.ts +23 -53
- package/dist/dts/components/schema.d.ts +205 -0
- package/dist/dts/context.d.ts +13 -13
- package/dist/dts/css.d.ts +3 -0
- package/dist/dts/debug.d.ts +5 -1
- package/dist/dts/declarative/attribute-map.d.ts +58 -0
- package/dist/dts/declarative/debug.d.ts +4 -0
- package/dist/dts/declarative/index.d.ts +14 -0
- package/dist/dts/declarative/interfaces.d.ts +8 -0
- package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
- package/dist/dts/declarative/observer-map.d.ts +89 -0
- package/dist/dts/declarative/runtime.d.ts +5 -0
- package/dist/dts/declarative/syntax.d.ts +21 -0
- package/dist/dts/declarative/template-bridge.d.ts +33 -0
- package/dist/dts/declarative/template-parser.d.ts +98 -0
- package/dist/dts/declarative/template.d.ts +10 -0
- package/dist/dts/declarative/utilities.d.ts +358 -0
- package/dist/dts/di/di.d.ts +7 -7
- package/dist/dts/directives/children.d.ts +2 -0
- package/dist/dts/directives/node-observation.d.ts +2 -0
- package/dist/dts/directives/ref.d.ts +2 -0
- package/dist/dts/directives/repeat.d.ts +4 -0
- package/dist/dts/directives/slotted.d.ts +2 -0
- package/dist/dts/directives/when.d.ts +3 -0
- package/dist/dts/dom-policy.d.ts +23 -5
- package/dist/dts/dom.d.ts +4 -16
- package/dist/dts/html.d.ts +5 -0
- package/dist/dts/hydration/diagnostics.d.ts +93 -0
- package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
- package/dist/dts/hydration/messages.d.ts +62 -0
- package/dist/dts/hydration/runtime.d.ts +7 -0
- package/dist/dts/hydration/target-builder.d.ts +40 -12
- package/dist/dts/hydration.d.ts +18 -0
- package/dist/dts/index.d.ts +42 -42
- package/dist/dts/index.debug.d.ts +0 -1
- package/dist/dts/index.rollup.debug.d.ts +0 -1
- package/dist/dts/interfaces.d.ts +2 -49
- package/dist/dts/observable.d.ts +3 -6
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/observable.d.ts +3 -3
- package/dist/dts/observation/update-queue.d.ts +1 -1
- package/dist/dts/platform.d.ts +45 -8
- package/dist/dts/registry.d.ts +1 -0
- package/dist/dts/render.d.ts +7 -0
- package/dist/dts/schema.d.ts +1 -0
- package/dist/dts/state/exports.d.ts +1 -1
- package/dist/dts/state/state.d.ts +2 -2
- package/dist/dts/styles/css-directive.d.ts +5 -12
- package/dist/dts/styles/css.d.ts +5 -7
- package/dist/dts/styles/element-styles.d.ts +0 -10
- package/dist/dts/styles.d.ts +6 -0
- package/dist/dts/templating/compiler.d.ts +1 -1
- package/dist/dts/templating/html-binding-directive.d.ts +10 -2
- package/dist/dts/templating/html-directive.d.ts +19 -1
- package/dist/dts/templating/hydration-view.d.ts +130 -0
- package/dist/dts/templating/render.d.ts +1 -1
- package/dist/dts/templating/repeat.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +15 -7
- package/dist/dts/templating/view.d.ts +25 -102
- package/dist/dts/templating.d.ts +10 -0
- package/dist/dts/testing/exports.d.ts +2 -2
- package/dist/dts/testing/fakes.d.ts +4 -4
- package/dist/dts/updates.d.ts +1 -0
- package/dist/dts/volatile.d.ts +2 -0
- package/dist/esm/__test__/helpers.js +22 -0
- package/dist/esm/__test__/setup-node.js +18 -0
- package/dist/esm/array-observer.js +1 -0
- package/dist/esm/arrays.js +1 -0
- package/dist/esm/attr.js +1 -0
- package/dist/esm/binding/normalize.js +1 -1
- package/dist/esm/binding/signal.js +4 -4
- package/dist/esm/binding/two-way.js +3 -3
- package/dist/esm/binding.js +4 -0
- package/dist/esm/components/attributes.js +18 -11
- package/dist/esm/components/definition-schema-transforms.js +23 -0
- package/dist/esm/components/element-controller.js +206 -270
- package/dist/esm/components/element-hydration.js +1 -1
- package/dist/esm/components/enable-hydration.js +124 -0
- package/dist/esm/components/fast-definitions.js +219 -56
- package/dist/esm/components/fast-element.js +18 -27
- package/dist/esm/components/hydration-tracker.js +122 -0
- package/dist/esm/components/hydration.js +137 -140
- package/dist/esm/components/schema.js +253 -0
- package/dist/esm/context.js +6 -6
- package/dist/esm/css.js +3 -0
- package/dist/esm/debug.js +27 -26
- package/dist/esm/declarative/attribute-map.js +122 -0
- package/dist/esm/declarative/debug.js +4 -0
- package/dist/esm/declarative/index.js +4 -0
- package/dist/esm/declarative/interfaces.js +9 -0
- package/dist/esm/declarative/observer-map-utilities.js +565 -0
- package/dist/esm/declarative/observer-map.js +216 -0
- package/dist/esm/declarative/runtime.js +14 -0
- package/dist/esm/declarative/syntax.js +36 -0
- package/dist/esm/declarative/template-bridge.js +160 -0
- package/dist/esm/declarative/template-parser.js +306 -0
- package/dist/esm/declarative/template.js +143 -0
- package/dist/esm/declarative/utilities.js +1069 -0
- package/dist/esm/di/di.js +8 -9
- package/dist/esm/directives/children.js +1 -0
- package/dist/esm/directives/node-observation.js +1 -0
- package/dist/esm/directives/ref.js +1 -0
- package/dist/esm/directives/repeat.js +1 -0
- package/dist/esm/directives/slotted.js +1 -0
- package/dist/esm/directives/when.js +1 -0
- package/dist/esm/dom-policy.js +35 -6
- package/dist/esm/dom.js +1 -1
- package/dist/esm/html.js +2 -0
- package/dist/esm/hydration/diagnostics.js +50 -0
- package/dist/esm/hydration/hydration-debugger.js +112 -0
- package/dist/esm/hydration/messages.js +84 -0
- package/dist/esm/hydration/runtime.js +33 -0
- package/dist/esm/hydration/target-builder.js +144 -91
- package/dist/esm/hydration.js +6 -0
- package/dist/esm/index.debug.js +2 -1
- package/dist/esm/index.js +38 -29
- package/dist/esm/index.rollup.debug.js +3 -2
- package/dist/esm/index.rollup.js +1 -1
- package/dist/esm/interfaces.js +2 -45
- package/dist/esm/metadata.js +2 -8
- package/dist/esm/observable.js +1 -4
- package/dist/esm/observation/arrays.js +1 -1
- package/dist/esm/observation/notifier.js +2 -4
- package/dist/esm/observation/observable.js +5 -5
- package/dist/esm/observation/update-queue.js +47 -58
- package/dist/esm/platform.js +31 -30
- package/dist/esm/registry.js +1 -0
- package/dist/esm/render.js +1 -0
- package/dist/esm/schema.js +1 -0
- package/dist/esm/state/exports.js +1 -1
- package/dist/esm/styles/css-directive.js +1 -2
- package/dist/esm/styles/css.js +15 -56
- package/dist/esm/styles/element-styles.js +69 -15
- package/dist/esm/styles.js +2 -0
- package/dist/esm/templating/html-binding-directive.js +11 -9
- package/dist/esm/templating/hydration-view.js +228 -0
- package/dist/esm/templating/render.js +39 -18
- package/dist/esm/templating/repeat.js +69 -33
- package/dist/esm/templating/template.js +7 -7
- package/dist/esm/templating/view.js +25 -234
- package/dist/esm/templating.js +7 -0
- package/dist/esm/testing/exports.js +2 -2
- package/dist/esm/testing/fixture.js +2 -2
- package/dist/esm/testing/timeout.js +2 -2
- package/dist/esm/updates.js +1 -0
- package/dist/esm/volatile.js +1 -0
- package/dist/fast-element.api.json +14389 -11138
- package/dist/fast-element.d.ts +3651 -809
- package/dist/fast-element.debug.js +5666 -4722
- package/dist/fast-element.debug.min.js +2 -2
- package/dist/fast-element.js +5394 -4381
- package/dist/fast-element.min.js +2 -2
- package/dist/fast-element.untrimmed.d.ts +923 -472
- package/dist/hydration/hydration.api.json +6460 -0
- package/dist/styles/styles.api.json +2672 -0
- package/package.json +165 -45
- package/ARCHITECTURE_FASTELEMENT.md +0 -63
- package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +0 -36
- package/ARCHITECTURE_INTRO.md +0 -10
- package/ARCHITECTURE_OVERVIEW.md +0 -52
- package/ARCHITECTURE_UPDATES.md +0 -11
- package/CHANGELOG.json +0 -2275
- package/DESIGN.md +0 -510
- package/api-extractor.context.json +0 -14
- package/api-extractor.di.json +0 -14
- package/biome.json +0 -4
- package/dist/dts/components/install-hydration.d.ts +0 -1
- package/dist/dts/pending-task.d.ts +0 -32
- package/dist/dts/styles/css-binding-directive.d.ts +0 -60
- package/dist/dts/templating/install-hydratable-view-templates.d.ts +0 -1
- package/dist/esm/components/install-hydration.js +0 -3
- package/dist/esm/pending-task.js +0 -28
- package/dist/esm/polyfills.js +0 -60
- package/dist/esm/styles/css-binding-directive.js +0 -76
- package/dist/esm/templating/install-hydratable-view-templates.js +0 -23
- package/docs/ACKNOWLEDGEMENTS.md +0 -12
- package/docs/api-report.api.md +0 -1122
- package/docs/context/api-report.api.md +0 -69
- package/docs/di/api-report.api.md +0 -315
- package/docs/fast-element-2-changes.md +0 -15
- package/playwright.config.ts +0 -26
- package/scripts/run-api-extractor.js +0 -51
- package/test/index.html +0 -11
- package/test/main.ts +0 -104
- package/test/vite.config.ts +0 -19
- package/tsconfig.api-extractor.json +0 -6
- /package/dist/dts/{polyfills.d.ts → __test__/setup-node.d.ts} +0 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
var _a;
|
|
2
|
-
import { Hydratable } from "../components/hydration.js";
|
|
3
|
-
import { buildViewBindingTargets, createRangeForNodes, HydrationTargetElementError, targetFactory, } from "../hydration/target-builder.js";
|
|
4
1
|
import { ExecutionContext, Observable, SourceLifetime, } from "../observation/observable.js";
|
|
5
2
|
import { makeSerializationNoop } from "../platform.js";
|
|
6
|
-
function removeNodeSequence(firstNode, lastNode) {
|
|
3
|
+
export function removeNodeSequence(firstNode, lastNode) {
|
|
7
4
|
const parent = firstNode.parentNode;
|
|
8
5
|
let current = firstNode;
|
|
9
6
|
let next;
|
|
@@ -17,7 +14,11 @@ function removeNodeSequence(firstNode, lastNode) {
|
|
|
17
14
|
}
|
|
18
15
|
parent.removeChild(lastNode);
|
|
19
16
|
}
|
|
20
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The default execution context for template views.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export class DefaultExecutionContext {
|
|
21
22
|
constructor() {
|
|
22
23
|
/**
|
|
23
24
|
* The index of the current item within a repeat context.
|
|
@@ -111,6 +112,24 @@ export class HTMLView extends DefaultExecutionContext {
|
|
|
111
112
|
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
112
113
|
*/
|
|
113
114
|
this.sourceLifetime = SourceLifetime.unknown;
|
|
115
|
+
/**
|
|
116
|
+
* When true, directives skip attribute/booleanAttribute DOM
|
|
117
|
+
* updates during bind(). Set only during the prerendered bind
|
|
118
|
+
* window and cleared immediately after.
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
this._skipAttrUpdates = false;
|
|
122
|
+
/**
|
|
123
|
+
* A promise that resolves with `true` after prerendered content
|
|
124
|
+
* has been hydrated, or `false` when the view is client-side
|
|
125
|
+
* rendered. Resolves once the first bind completes.
|
|
126
|
+
*/
|
|
127
|
+
this.isPrerendered = Promise.resolve(false);
|
|
128
|
+
/**
|
|
129
|
+
* Resolves `true` after prerendered content has been hydrated,
|
|
130
|
+
* `false` when client-side rendered or hydration not enabled.
|
|
131
|
+
*/
|
|
132
|
+
this.isHydrated = Promise.resolve(false);
|
|
114
133
|
/**
|
|
115
134
|
* The execution context the view is running within.
|
|
116
135
|
*/
|
|
@@ -192,7 +211,7 @@ export class HTMLView extends DefaultExecutionContext {
|
|
|
192
211
|
* @param context - The execution context to run the behaviors within.
|
|
193
212
|
*/
|
|
194
213
|
bind(source, context = this) {
|
|
195
|
-
if (this.source === source) {
|
|
214
|
+
if (this.source === source && this.context === context) {
|
|
196
215
|
return;
|
|
197
216
|
}
|
|
198
217
|
let behaviors = this.behaviors;
|
|
@@ -258,231 +277,3 @@ export class HTMLView extends DefaultExecutionContext {
|
|
|
258
277
|
makeSerializationNoop(HTMLView);
|
|
259
278
|
Observable.defineProperty(HTMLView.prototype, "index");
|
|
260
279
|
Observable.defineProperty(HTMLView.prototype, "length");
|
|
261
|
-
export const HydrationStage = {
|
|
262
|
-
unhydrated: "unhydrated",
|
|
263
|
-
hydrating: "hydrating",
|
|
264
|
-
hydrated: "hydrated",
|
|
265
|
-
};
|
|
266
|
-
/** @public */
|
|
267
|
-
export class HydrationBindingError extends Error {
|
|
268
|
-
constructor(
|
|
269
|
-
/**
|
|
270
|
-
* The error message
|
|
271
|
-
*/
|
|
272
|
-
message,
|
|
273
|
-
/**
|
|
274
|
-
* The factory that was unable to be bound
|
|
275
|
-
*/
|
|
276
|
-
factory,
|
|
277
|
-
/**
|
|
278
|
-
* A DocumentFragment containing a clone of the
|
|
279
|
-
* view's Nodes.
|
|
280
|
-
*/
|
|
281
|
-
fragment,
|
|
282
|
-
/**
|
|
283
|
-
* String representation of the HTML in the template that
|
|
284
|
-
* threw the binding error.
|
|
285
|
-
*/
|
|
286
|
-
templateString) {
|
|
287
|
-
super(message);
|
|
288
|
-
this.factory = factory;
|
|
289
|
-
this.fragment = fragment;
|
|
290
|
-
this.templateString = templateString;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
export class HydrationView extends DefaultExecutionContext {
|
|
294
|
-
get hydrationStage() {
|
|
295
|
-
return this._hydrationStage;
|
|
296
|
-
}
|
|
297
|
-
get targets() {
|
|
298
|
-
return this._targets;
|
|
299
|
-
}
|
|
300
|
-
get bindingViewBoundaries() {
|
|
301
|
-
return this._bindingViewBoundaries;
|
|
302
|
-
}
|
|
303
|
-
constructor(firstChild, lastChild, sourceTemplate, hostBindingTarget) {
|
|
304
|
-
super();
|
|
305
|
-
this.firstChild = firstChild;
|
|
306
|
-
this.lastChild = lastChild;
|
|
307
|
-
this.sourceTemplate = sourceTemplate;
|
|
308
|
-
this.hostBindingTarget = hostBindingTarget;
|
|
309
|
-
this[_a] = Hydratable;
|
|
310
|
-
this.context = this;
|
|
311
|
-
this.source = null;
|
|
312
|
-
this.isBound = false;
|
|
313
|
-
this.sourceLifetime = SourceLifetime.unknown;
|
|
314
|
-
this.unbindables = [];
|
|
315
|
-
this.fragment = null;
|
|
316
|
-
this.behaviors = null;
|
|
317
|
-
this._hydrationStage = HydrationStage.unhydrated;
|
|
318
|
-
this._bindingViewBoundaries = {};
|
|
319
|
-
this._targets = {};
|
|
320
|
-
this.factories = sourceTemplate.compile().factories;
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* no-op. Hydrated views are don't need to be moved from a documentFragment
|
|
324
|
-
* to the target node.
|
|
325
|
-
*/
|
|
326
|
-
insertBefore(node) {
|
|
327
|
-
// No-op in cases where this is called before the view is removed,
|
|
328
|
-
// because the nodes will already be in the document and just need hydrating.
|
|
329
|
-
if (this.fragment === null) {
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
if (this.fragment.hasChildNodes()) {
|
|
333
|
-
node.parentNode.insertBefore(this.fragment, node);
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
const end = this.lastChild;
|
|
337
|
-
if (node.previousSibling === end)
|
|
338
|
-
return;
|
|
339
|
-
const parentNode = node.parentNode;
|
|
340
|
-
let current = this.firstChild;
|
|
341
|
-
let next;
|
|
342
|
-
while (current !== end) {
|
|
343
|
-
next = current.nextSibling;
|
|
344
|
-
parentNode.insertBefore(current, node);
|
|
345
|
-
current = next;
|
|
346
|
-
}
|
|
347
|
-
parentNode.insertBefore(end, node);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Appends the view to a node. In cases where this is called before the
|
|
352
|
-
* view has been removed, the method will no-op.
|
|
353
|
-
* @param node - the node to append the view to.
|
|
354
|
-
*/
|
|
355
|
-
appendTo(node) {
|
|
356
|
-
if (this.fragment !== null) {
|
|
357
|
-
node.appendChild(this.fragment);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
remove() {
|
|
361
|
-
const fragment = this.fragment || (this.fragment = document.createDocumentFragment());
|
|
362
|
-
const end = this.lastChild;
|
|
363
|
-
let current = this.firstChild;
|
|
364
|
-
let next;
|
|
365
|
-
while (current !== end) {
|
|
366
|
-
next = current.nextSibling;
|
|
367
|
-
if (!next) {
|
|
368
|
-
throw new Error(`Unmatched first/last child inside "${end.getRootNode().host.nodeName}".`);
|
|
369
|
-
}
|
|
370
|
-
fragment.appendChild(current);
|
|
371
|
-
current = next;
|
|
372
|
-
}
|
|
373
|
-
fragment.appendChild(end);
|
|
374
|
-
}
|
|
375
|
-
bind(source, context = this) {
|
|
376
|
-
var _b;
|
|
377
|
-
if (this.hydrationStage !== HydrationStage.hydrated) {
|
|
378
|
-
this._hydrationStage = HydrationStage.hydrating;
|
|
379
|
-
}
|
|
380
|
-
if (this.source === source) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
let behaviors = this.behaviors;
|
|
384
|
-
if (behaviors === null) {
|
|
385
|
-
this.source = source;
|
|
386
|
-
this.context = context;
|
|
387
|
-
try {
|
|
388
|
-
const { targets, boundaries } = buildViewBindingTargets(this.firstChild, this.lastChild, this.factories);
|
|
389
|
-
this._targets = targets;
|
|
390
|
-
this._bindingViewBoundaries = boundaries;
|
|
391
|
-
}
|
|
392
|
-
catch (error) {
|
|
393
|
-
if (error instanceof HydrationTargetElementError) {
|
|
394
|
-
let templateString = this.sourceTemplate.html;
|
|
395
|
-
if (typeof templateString !== "string") {
|
|
396
|
-
templateString = templateString.innerHTML;
|
|
397
|
-
}
|
|
398
|
-
error.templateString = templateString;
|
|
399
|
-
}
|
|
400
|
-
throw error;
|
|
401
|
-
}
|
|
402
|
-
this.behaviors = behaviors = new Array(this.factories.length);
|
|
403
|
-
const factories = this.factories;
|
|
404
|
-
for (let i = 0, ii = factories.length; i < ii; ++i) {
|
|
405
|
-
const factory = factories[i];
|
|
406
|
-
if (factory.targetNodeId === "h" && this.hostBindingTarget) {
|
|
407
|
-
targetFactory(factory, this.hostBindingTarget, this._targets);
|
|
408
|
-
}
|
|
409
|
-
// If the binding has been targeted or it is a host binding and the view has a hostBindingTarget
|
|
410
|
-
if (factory.targetNodeId in this.targets) {
|
|
411
|
-
const behavior = factory.createBehavior();
|
|
412
|
-
behavior.bind(this);
|
|
413
|
-
behaviors[i] = behavior;
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
let templateString = this.sourceTemplate.html;
|
|
417
|
-
if (typeof templateString !== "string") {
|
|
418
|
-
templateString = templateString.innerHTML;
|
|
419
|
-
}
|
|
420
|
-
const hostElement = ((_b = this.firstChild) === null || _b === void 0 ? void 0 : _b.getRootNode())
|
|
421
|
-
.host;
|
|
422
|
-
const hostName = (hostElement === null || hostElement === void 0 ? void 0 : hostElement.nodeName) || "unknown";
|
|
423
|
-
const factoryInfo = factory;
|
|
424
|
-
// Build detailed error message
|
|
425
|
-
const details = [
|
|
426
|
-
`HydrationView was unable to successfully target bindings inside "<${hostName.toLowerCase()}>".`,
|
|
427
|
-
`\nMismatch Details:`,
|
|
428
|
-
` - Expected target node ID: "${factory.targetNodeId}"`,
|
|
429
|
-
` - Available target IDs: [${Object.keys(this.targets).join(", ") || "none"}]`,
|
|
430
|
-
];
|
|
431
|
-
if (factory.targetTagName) {
|
|
432
|
-
details.push(` - Expected tag name: "${factory.targetTagName}"`);
|
|
433
|
-
}
|
|
434
|
-
if (factoryInfo.sourceAspect) {
|
|
435
|
-
details.push(` - Source aspect: "${factoryInfo.sourceAspect}"`);
|
|
436
|
-
}
|
|
437
|
-
if (factoryInfo.aspectType !== undefined) {
|
|
438
|
-
details.push(` - Aspect type: ${factoryInfo.aspectType}`);
|
|
439
|
-
}
|
|
440
|
-
details.push(`\nThis usually means:`, ` 1. The server-rendered HTML doesn't match the client template`, ` 2. The hydration markers are missing or corrupted`, ` 3. The DOM structure was modified before hydration`, `\nTemplate: ${templateString.slice(0, 200)}${templateString.length > 200 ? "..." : ""}`);
|
|
441
|
-
throw new HydrationBindingError(details.join("\n"), factory, createRangeForNodes(this.firstChild, this.lastChild).cloneContents(), templateString);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
if (this.source !== null) {
|
|
447
|
-
this.evaluateUnbindables();
|
|
448
|
-
}
|
|
449
|
-
this.isBound = false;
|
|
450
|
-
this.source = source;
|
|
451
|
-
this.context = context;
|
|
452
|
-
for (let i = 0, ii = behaviors.length; i < ii; ++i) {
|
|
453
|
-
behaviors[i].bind(this);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
this.isBound = true;
|
|
457
|
-
this._hydrationStage = HydrationStage.hydrated;
|
|
458
|
-
}
|
|
459
|
-
unbind() {
|
|
460
|
-
if (!this.isBound || this.source === null) {
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
this.evaluateUnbindables();
|
|
464
|
-
this.source = null;
|
|
465
|
-
this.context = this;
|
|
466
|
-
this.isBound = false;
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
|
|
470
|
-
* Once a view has been disposed, it cannot be inserted or bound again.
|
|
471
|
-
*/
|
|
472
|
-
dispose() {
|
|
473
|
-
removeNodeSequence(this.firstChild, this.lastChild);
|
|
474
|
-
this.unbind();
|
|
475
|
-
}
|
|
476
|
-
onUnbind(behavior) {
|
|
477
|
-
this.unbindables.push(behavior);
|
|
478
|
-
}
|
|
479
|
-
evaluateUnbindables() {
|
|
480
|
-
const unbindables = this.unbindables;
|
|
481
|
-
for (let i = 0, ii = unbindables.length; i < ii; ++i) {
|
|
482
|
-
unbindables[i].unbind(this);
|
|
483
|
-
}
|
|
484
|
-
unbindables.length = 0;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
_a = Hydratable;
|
|
488
|
-
makeSerializationNoop(HydrationView);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Compiler } from "./templating/compiler.js";
|
|
2
|
+
export { HTMLBindingDirective, } from "./templating/html-binding-directive.js";
|
|
3
|
+
export { HTMLDirective, htmlDirective, StatelessAttachedAttributeDirective, } from "./templating/html-directive.js";
|
|
4
|
+
export { Markup, Parser } from "./templating/markup.js";
|
|
5
|
+
export { RenderBehavior, RenderDirective, render } from "./templating/render.js";
|
|
6
|
+
export { InlineTemplateDirective, ViewTemplate, } from "./templating/template.js";
|
|
7
|
+
export { HTMLView, } from "./templating/view.js";
|
|
@@ -32,8 +32,8 @@ export function uniqueElementName(prefix = "fast-unique") {
|
|
|
32
32
|
* ensure that the DOM has settled.
|
|
33
33
|
* @public
|
|
34
34
|
*/
|
|
35
|
-
export function fixture(
|
|
36
|
-
return __awaiter(this,
|
|
35
|
+
export function fixture(templateNameOrType_1) {
|
|
36
|
+
return __awaiter(this, arguments, void 0, function* (templateNameOrType, options = {}) {
|
|
37
37
|
const document = options.document || globalThis.document;
|
|
38
38
|
const parent = options.parent || document.createElement("div");
|
|
39
39
|
const source = options.source || {};
|
|
@@ -13,8 +13,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
* @returns A promise that resolves once the configured time has elapsed.
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
export function timeout(
|
|
17
|
-
return __awaiter(this,
|
|
16
|
+
export function timeout() {
|
|
17
|
+
return __awaiter(this, arguments, void 0, function* (timeout = 0) {
|
|
18
18
|
return new Promise((resolve, reject) => {
|
|
19
19
|
window.setTimeout(() => {
|
|
20
20
|
resolve(void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Updates } from "./observation/update-queue.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { volatile } from "./observation/observable.js";
|