@microsoft/fast-element 2.9.2 → 2.10.1
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.json +58 -0
- package/CHANGELOG.md +22 -1
- package/dist/dts/binding/one-way.d.ts +1 -1
- package/dist/dts/binding/two-way.d.ts +2 -2
- package/dist/dts/components/attributes.d.ts +1 -1
- package/dist/dts/components/element-controller.d.ts +19 -8
- package/dist/dts/components/fast-definitions.d.ts +4 -4
- package/dist/dts/components/fast-element.d.ts +2 -2
- package/dist/dts/context.d.ts +1 -1
- package/dist/dts/di/di.d.ts +2 -2
- package/dist/dts/dom-policy.d.ts +3 -3
- package/dist/dts/index.d.ts +41 -28
- package/dist/dts/observable.d.ts +4 -2
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/observable.d.ts +1 -1
- package/dist/dts/observation/update-queue.d.ts +1 -1
- package/dist/dts/platform.d.ts +1 -1
- package/dist/dts/state/state.d.ts +1 -1
- package/dist/dts/state/watch.d.ts +1 -1
- package/dist/dts/styles/css-binding-directive.d.ts +1 -1
- package/dist/dts/styles/css.d.ts +2 -2
- package/dist/dts/templating/children.d.ts +1 -2
- package/dist/dts/templating/compiler.d.ts +2 -2
- package/dist/dts/templating/html-binding-directive.d.ts +3 -3
- package/dist/dts/templating/html-directive.d.ts +2 -2
- package/dist/dts/templating/node-observation.d.ts +1 -1
- package/dist/dts/templating/ref.d.ts +1 -1
- package/dist/dts/templating/render.d.ts +4 -4
- package/dist/dts/templating/repeat.d.ts +4 -4
- package/dist/dts/templating/slotted.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +2 -2
- package/dist/dts/templating/view.d.ts +2 -2
- package/dist/esm/binding/one-way.js +1 -1
- package/dist/esm/binding/two-way.js +3 -3
- package/dist/esm/components/element-controller.js +69 -23
- package/dist/esm/components/fast-definitions.js +1 -1
- package/dist/esm/context.js +2 -2
- package/dist/esm/di/di.js +61 -51
- package/dist/esm/dom-policy.js +2 -2
- package/dist/esm/dom.js +2 -2
- package/dist/esm/index.js +21 -22
- package/dist/esm/interfaces.js +38 -0
- package/dist/esm/observable.js +1 -1
- package/dist/esm/observation/arrays.js +17 -10
- package/dist/esm/observation/observable.js +3 -3
- package/dist/esm/styles/css.js +2 -2
- package/dist/esm/templating/children.js +5 -8
- package/dist/esm/templating/compiler.js +5 -5
- package/dist/esm/templating/html-binding-directive.js +2 -2
- package/dist/esm/templating/node-observation.js +1 -1
- package/dist/esm/templating/render.js +4 -4
- package/dist/esm/templating/repeat.js +4 -4
- package/dist/esm/templating/slotted.js +1 -1
- package/dist/esm/templating/template.js +7 -7
- package/dist/fast-element.api.json +70 -11
- package/dist/fast-element.debug.js +2312 -2224
- package/dist/fast-element.debug.min.js +2 -2
- package/dist/fast-element.js +2312 -2224
- package/dist/fast-element.min.js +2 -2
- package/dist/fast-element.untrimmed.d.ts +17 -7
- package/docs/api-report.api.md +5 -4
- package/package.json +4 -3
- package/playwright.config.ts +18 -0
- package/test/index.html +11 -0
- package/test/main.ts +10 -0
- package/test/vite.config.ts +19 -0
- package/dist/dts/observation/observable.bench.d.ts +0 -18
- package/dist/dts/templating/render.bench.d.ts +0 -3
- package/dist/dts/templating/repeat-basic-reverse.bench.d.ts +0 -3
- package/dist/dts/templating/repeat-basic-shift.bench.d.ts +0 -3
- package/dist/dts/templating/when-basic.bench.d.ts +0 -3
- package/dist/dts/templating/when-conditional.bench.d.ts +0 -3
- package/dist/dts/templating/when-switch.bench.d.ts +0 -3
- package/dist/esm/observation/observable.bench.js +0 -79
- package/dist/esm/templating/render.bench.js +0 -56
- package/dist/esm/templating/repeat-basic-reverse.bench.js +0 -43
- package/dist/esm/templating/repeat-basic-shift.bench.js +0 -43
- package/dist/esm/templating/when-basic.bench.js +0 -36
- package/dist/esm/templating/when-conditional.bench.js +0 -39
- package/dist/esm/templating/when-switch.bench.js +0 -68
- package/scripts/run-benchmarks.js +0 -46
- package/tensile.config.js +0 -12
package/dist/esm/index.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { emptyArray, FAST } from "./platform.js";
|
|
2
2
|
// DOM
|
|
3
|
-
export {
|
|
3
|
+
export { DOM, DOMAspect } from "./dom.js";
|
|
4
4
|
// Observation
|
|
5
|
-
export {
|
|
5
|
+
export { ArrayObserver, lengthOf, Sort, sortedCount, Splice, SpliceStrategy, SpliceStrategySupport, } from "./observation/arrays.js";
|
|
6
6
|
export { PropertyChangeNotifier, SubscriberSet, } from "./observation/notifier.js";
|
|
7
|
-
export {
|
|
7
|
+
export { ExecutionContext, Observable, observable, SourceLifetime, volatile, } from "./observation/observable.js";
|
|
8
8
|
export { Updates } from "./observation/update-queue.js";
|
|
9
9
|
// Binding
|
|
10
10
|
export { Binding } from "./binding/binding.js";
|
|
11
|
-
export { listener, oneWay } from "./binding/one-way.js";
|
|
12
|
-
export { oneTime } from "./binding/one-time.js";
|
|
13
11
|
export { normalizeBinding } from "./binding/normalize.js";
|
|
12
|
+
export { oneTime } from "./binding/one-time.js";
|
|
13
|
+
export { listener, oneWay } from "./binding/one-way.js";
|
|
14
14
|
// Styles
|
|
15
|
-
export {
|
|
16
|
-
export { css } from "./styles/css.js";
|
|
15
|
+
export { CSSBindingDirective } from "./styles/css-binding-directive.js";
|
|
17
16
|
export { cssDirective, CSSDirective, } from "./styles/css-directive.js";
|
|
17
|
+
export { css } from "./styles/css.js";
|
|
18
|
+
export { ElementStyles, } from "./styles/element-styles.js";
|
|
18
19
|
export {} from "./styles/host.js";
|
|
19
|
-
export {} from "./styles/style-strategy.js";
|
|
20
|
-
export { CSSBindingDirective } from "./styles/css-binding-directive.js";
|
|
21
20
|
// Templating
|
|
22
|
-
export {
|
|
21
|
+
export { children, ChildrenDirective } from "./templating/children.js";
|
|
23
22
|
export { Compiler } from "./templating/compiler.js";
|
|
24
|
-
export {
|
|
25
|
-
export { HTMLBindingDirective, } from "./templating/html-binding-directive.js";
|
|
23
|
+
export { HTMLBindingDirective } from "./templating/html-binding-directive.js";
|
|
26
24
|
export { htmlDirective, HTMLDirective, StatelessAttachedAttributeDirective, } from "./templating/html-directive.js";
|
|
25
|
+
export { Markup, Parser } from "./templating/markup.js";
|
|
26
|
+
export { elements, NodeObservationDirective } from "./templating/node-observation.js";
|
|
27
27
|
export { ref, RefDirective } from "./templating/ref.js";
|
|
28
|
-
export { when } from "./templating/when.js";
|
|
29
|
-
export { repeat, RepeatBehavior, RepeatDirective, } from "./templating/repeat.js";
|
|
30
|
-
export { slotted, SlottedDirective, } from "./templating/slotted.js";
|
|
31
|
-
export { children, ChildrenDirective, } from "./templating/children.js";
|
|
32
|
-
export { HTMLView, HydrationBindingError, } from "./templating/view.js";
|
|
33
|
-
export { elements, NodeObservationDirective, } from "./templating/node-observation.js";
|
|
34
28
|
export { render, RenderBehavior, RenderDirective } from "./templating/render.js";
|
|
29
|
+
export { repeat, RepeatBehavior, RepeatDirective } from "./templating/repeat.js";
|
|
30
|
+
export { slotted, SlottedDirective } from "./templating/slotted.js";
|
|
31
|
+
export { html, InlineTemplateDirective, ViewTemplate } from "./templating/template.js";
|
|
32
|
+
export { HTMLView, HydrationBindingError } from "./templating/view.js";
|
|
33
|
+
export { when } from "./templating/when.js";
|
|
35
34
|
// Components
|
|
36
|
-
export { customElement, FASTElement } from "./components/fast-element.js";
|
|
37
|
-
export { FASTElementDefinition, fastElementRegistry, TemplateOptions, } from "./components/fast-definitions.js";
|
|
38
35
|
export { attr, AttributeConfiguration, AttributeDefinition, booleanConverter, nullableBooleanConverter, nullableNumberConverter, } from "./components/attributes.js";
|
|
39
|
-
export { ElementController, HydratableElementController, needsHydrationAttribute, } from "./components/element-controller.js";
|
|
36
|
+
export { ElementController, HydratableElementController, needsHydrationAttribute, Stages, } from "./components/element-controller.js";
|
|
37
|
+
export { FASTElementDefinition, fastElementRegistry, TemplateOptions, } from "./components/fast-definitions.js";
|
|
38
|
+
export { customElement, FASTElement } from "./components/fast-element.js";
|
|
40
39
|
export { deferHydrationAttribute, isHydratable } from "./components/hydration.js";
|
package/dist/esm/interfaces.js
CHANGED
|
@@ -43,6 +43,44 @@ switch (kernelMode) {
|
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
45
|
export { KernelServiceId };
|
|
46
|
+
/**
|
|
47
|
+
* Warning and error messages.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export var Message;
|
|
51
|
+
(function (Message) {
|
|
52
|
+
// 1000 - 1100 Kernel
|
|
53
|
+
// 1101 - 1200 Observation
|
|
54
|
+
Message[Message["needsArrayObservation"] = 1101] = "needsArrayObservation";
|
|
55
|
+
// 1201 - 1300 Templating
|
|
56
|
+
Message[Message["onlySetDOMPolicyOnce"] = 1201] = "onlySetDOMPolicyOnce";
|
|
57
|
+
Message[Message["bindingInnerHTMLRequiresTrustedTypes"] = 1202] = "bindingInnerHTMLRequiresTrustedTypes";
|
|
58
|
+
Message[Message["twoWayBindingRequiresObservables"] = 1203] = "twoWayBindingRequiresObservables";
|
|
59
|
+
Message[Message["hostBindingWithoutHost"] = 1204] = "hostBindingWithoutHost";
|
|
60
|
+
Message[Message["unsupportedBindingBehavior"] = 1205] = "unsupportedBindingBehavior";
|
|
61
|
+
Message[Message["directCallToHTMLTagNotAllowed"] = 1206] = "directCallToHTMLTagNotAllowed";
|
|
62
|
+
Message[Message["onlySetTemplatePolicyOnce"] = 1207] = "onlySetTemplatePolicyOnce";
|
|
63
|
+
Message[Message["cannotSetTemplatePolicyAfterCompilation"] = 1208] = "cannotSetTemplatePolicyAfterCompilation";
|
|
64
|
+
Message[Message["blockedByDOMPolicy"] = 1209] = "blockedByDOMPolicy";
|
|
65
|
+
// 1301 - 1400 Styles
|
|
66
|
+
// 1401 - 1500 Components
|
|
67
|
+
Message[Message["missingElementDefinition"] = 1401] = "missingElementDefinition";
|
|
68
|
+
// 1501 - 1600 Context and Dependency Injection
|
|
69
|
+
Message[Message["noRegistrationForContext"] = 1501] = "noRegistrationForContext";
|
|
70
|
+
Message[Message["noFactoryForResolver"] = 1502] = "noFactoryForResolver";
|
|
71
|
+
Message[Message["invalidResolverStrategy"] = 1503] = "invalidResolverStrategy";
|
|
72
|
+
Message[Message["cannotAutoregisterDependency"] = 1504] = "cannotAutoregisterDependency";
|
|
73
|
+
Message[Message["cannotResolveKey"] = 1505] = "cannotResolveKey";
|
|
74
|
+
Message[Message["cannotConstructNativeFunction"] = 1506] = "cannotConstructNativeFunction";
|
|
75
|
+
Message[Message["cannotJITRegisterNonConstructor"] = 1507] = "cannotJITRegisterNonConstructor";
|
|
76
|
+
Message[Message["cannotJITRegisterIntrinsic"] = 1508] = "cannotJITRegisterIntrinsic";
|
|
77
|
+
Message[Message["cannotJITRegisterInterface"] = 1509] = "cannotJITRegisterInterface";
|
|
78
|
+
Message[Message["invalidResolver"] = 1510] = "invalidResolver";
|
|
79
|
+
Message[Message["invalidKey"] = 1511] = "invalidKey";
|
|
80
|
+
Message[Message["noDefaultResolver"] = 1512] = "noDefaultResolver";
|
|
81
|
+
Message[Message["cyclicDependency"] = 1513] = "cyclicDependency";
|
|
82
|
+
Message[Message["connectUpdateRequiresController"] = 1514] = "connectUpdateRequiresController";
|
|
83
|
+
})(Message || (Message = {}));
|
|
46
84
|
/**
|
|
47
85
|
* Determines whether or not an object is a function.
|
|
48
86
|
* @public
|
package/dist/esm/observable.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Observable exports for easy access to the Observable API
|
|
3
3
|
*/
|
|
4
4
|
export { ExecutionContext, Observable, observable, SourceLifetime, volatile, } from "./observation/observable.js";
|
|
5
|
-
export { PropertyChangeNotifier, SubscriberSet
|
|
5
|
+
export { PropertyChangeNotifier, SubscriberSet } from "./observation/notifier.js";
|
|
@@ -80,6 +80,13 @@ export const SpliceStrategySupport = Object.freeze({
|
|
|
80
80
|
const reset = new Splice(0, emptyArray, 0);
|
|
81
81
|
reset.reset = true;
|
|
82
82
|
const resetSplices = [reset];
|
|
83
|
+
var Edit;
|
|
84
|
+
(function (Edit) {
|
|
85
|
+
Edit[Edit["leave"] = 0] = "leave";
|
|
86
|
+
Edit[Edit["update"] = 1] = "update";
|
|
87
|
+
Edit[Edit["add"] = 2] = "add";
|
|
88
|
+
Edit[Edit["delete"] = 3] = "delete";
|
|
89
|
+
})(Edit || (Edit = {}));
|
|
83
90
|
// Note: This function is *based* on the computation of the Levenshtein
|
|
84
91
|
// "edit" distance. The one change is that "updates" are treated as two
|
|
85
92
|
// edits - not one. With Array splices, an update is really a delete
|
|
@@ -131,12 +138,12 @@ function spliceOperationsFromEditDistances(distances) {
|
|
|
131
138
|
const edits = [];
|
|
132
139
|
while (i > 0 || j > 0) {
|
|
133
140
|
if (i === 0) {
|
|
134
|
-
edits.push(
|
|
141
|
+
edits.push(Edit.add);
|
|
135
142
|
j--;
|
|
136
143
|
continue;
|
|
137
144
|
}
|
|
138
145
|
if (j === 0) {
|
|
139
|
-
edits.push(
|
|
146
|
+
edits.push(Edit.delete);
|
|
140
147
|
i--;
|
|
141
148
|
continue;
|
|
142
149
|
}
|
|
@@ -152,22 +159,22 @@ function spliceOperationsFromEditDistances(distances) {
|
|
|
152
159
|
}
|
|
153
160
|
if (min === northWest) {
|
|
154
161
|
if (northWest === current) {
|
|
155
|
-
edits.push(
|
|
162
|
+
edits.push(Edit.leave);
|
|
156
163
|
}
|
|
157
164
|
else {
|
|
158
|
-
edits.push(
|
|
165
|
+
edits.push(Edit.update);
|
|
159
166
|
current = northWest;
|
|
160
167
|
}
|
|
161
168
|
i--;
|
|
162
169
|
j--;
|
|
163
170
|
}
|
|
164
171
|
else if (min === west) {
|
|
165
|
-
edits.push(
|
|
172
|
+
edits.push(Edit.delete);
|
|
166
173
|
i--;
|
|
167
174
|
current = west;
|
|
168
175
|
}
|
|
169
176
|
else {
|
|
170
|
-
edits.push(
|
|
177
|
+
edits.push(Edit.add);
|
|
171
178
|
j--;
|
|
172
179
|
current = north;
|
|
173
180
|
}
|
|
@@ -258,7 +265,7 @@ function calc(current, currentStart, currentEnd, old, oldStart, oldEnd) {
|
|
|
258
265
|
let oldIndex = oldStart;
|
|
259
266
|
for (let i = 0; i < ops.length; ++i) {
|
|
260
267
|
switch (ops[i]) {
|
|
261
|
-
case
|
|
268
|
+
case Edit.leave:
|
|
262
269
|
if (splice !== void 0) {
|
|
263
270
|
splices.push(splice);
|
|
264
271
|
splice = void 0;
|
|
@@ -266,7 +273,7 @@ function calc(current, currentStart, currentEnd, old, oldStart, oldEnd) {
|
|
|
266
273
|
index++;
|
|
267
274
|
oldIndex++;
|
|
268
275
|
break;
|
|
269
|
-
case
|
|
276
|
+
case Edit.update:
|
|
270
277
|
if (splice === void 0) {
|
|
271
278
|
splice = new Splice(index, [], 0);
|
|
272
279
|
}
|
|
@@ -275,14 +282,14 @@ function calc(current, currentStart, currentEnd, old, oldStart, oldEnd) {
|
|
|
275
282
|
splice.removed.push(old[oldIndex]);
|
|
276
283
|
oldIndex++;
|
|
277
284
|
break;
|
|
278
|
-
case
|
|
285
|
+
case Edit.add:
|
|
279
286
|
if (splice === void 0) {
|
|
280
287
|
splice = new Splice(index, [], 0);
|
|
281
288
|
}
|
|
282
289
|
splice.addedCount++;
|
|
283
290
|
index++;
|
|
284
291
|
break;
|
|
285
|
-
case
|
|
292
|
+
case Edit.delete:
|
|
286
293
|
if (splice === void 0) {
|
|
287
294
|
splice = new Splice(index, [], 0);
|
|
288
295
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isFunction, isString, KernelServiceId, } from "../interfaces.js";
|
|
1
|
+
import { isFunction, isString, KernelServiceId, Message, } from "../interfaces.js";
|
|
2
2
|
import { createMetadataLocator, FAST, makeSerializationNoop } from "../platform.js";
|
|
3
|
-
import { Updates } from "./update-queue.js";
|
|
4
3
|
import { PropertyChangeNotifier, SubscriberSet } from "./notifier.js";
|
|
4
|
+
import { Updates } from "./update-queue.js";
|
|
5
5
|
/**
|
|
6
6
|
* Describes how the source's lifetime relates to its controller's lifetime.
|
|
7
7
|
* @public
|
|
@@ -27,7 +27,7 @@ export const Observable = FAST.getById(KernelServiceId.observable, () => {
|
|
|
27
27
|
const notifierLookup = new WeakMap();
|
|
28
28
|
let watcher = void 0;
|
|
29
29
|
let createArrayObserver = (array) => {
|
|
30
|
-
throw FAST.error(
|
|
30
|
+
throw FAST.error(Message.needsArrayObservation);
|
|
31
31
|
};
|
|
32
32
|
function getNotifier(source) {
|
|
33
33
|
var _a;
|
package/dist/esm/styles/css.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isFunction, isString } from "../interfaces.js";
|
|
2
1
|
import { Binding } from "../binding/binding.js";
|
|
3
2
|
import { oneWay } from "../binding/one-way.js";
|
|
3
|
+
import { isFunction, isString } from "../interfaces.js";
|
|
4
|
+
import { CSSBindingDirective } from "./css-binding-directive.js";
|
|
4
5
|
import { CSSDirective } from "./css-directive.js";
|
|
5
6
|
import { ElementStyles } from "./element-styles.js";
|
|
6
|
-
import { CSSBindingDirective } from "./css-binding-directive.js";
|
|
7
7
|
const marker = `${Math.random().toString(36).substring(2, 8)}`;
|
|
8
8
|
let varId = 0;
|
|
9
9
|
const nextCSSVariable = () => `--v${marker}${++varId}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isString, noop } from "../interfaces.js";
|
|
2
2
|
import { HTMLDirective } from "./html-directive.js";
|
|
3
|
-
import { NodeObservationDirective } from "./node-observation.js";
|
|
3
|
+
import { NodeObservationDirective, } from "./node-observation.js";
|
|
4
4
|
/**
|
|
5
5
|
* The runtime behavior for child node observation.
|
|
6
6
|
* @public
|
|
@@ -13,10 +13,6 @@ export class ChildrenDirective extends NodeObservationDirective {
|
|
|
13
13
|
constructor(options) {
|
|
14
14
|
super(options);
|
|
15
15
|
this.observerProperty = Symbol();
|
|
16
|
-
this.handleEvent = (mutations, observer) => {
|
|
17
|
-
const target = observer.target;
|
|
18
|
-
this.updateTarget(this.getSource(target), this.computeNodes(target));
|
|
19
|
-
};
|
|
20
16
|
options.childList = true;
|
|
21
17
|
}
|
|
22
18
|
/**
|
|
@@ -26,11 +22,13 @@ export class ChildrenDirective extends NodeObservationDirective {
|
|
|
26
22
|
observe(target) {
|
|
27
23
|
let observer = target[this.observerProperty];
|
|
28
24
|
if (!observer) {
|
|
29
|
-
|
|
25
|
+
const handleEvent = (mutations, observer) => {
|
|
26
|
+
this.updateTarget(this.getSource(target), this.computeNodes(target));
|
|
27
|
+
};
|
|
28
|
+
observer = new MutationObserver(handleEvent);
|
|
30
29
|
observer.toJSON = noop;
|
|
31
30
|
target[this.observerProperty] = observer;
|
|
32
31
|
}
|
|
33
|
-
observer.target = target;
|
|
34
32
|
observer.observe(target, this.options);
|
|
35
33
|
}
|
|
36
34
|
/**
|
|
@@ -39,7 +37,6 @@ export class ChildrenDirective extends NodeObservationDirective {
|
|
|
39
37
|
*/
|
|
40
38
|
disconnect(target) {
|
|
41
39
|
const observer = target[this.observerProperty];
|
|
42
|
-
observer.target = null;
|
|
43
40
|
observer.disconnect();
|
|
44
41
|
}
|
|
45
42
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { isFunction, isString } from "../interfaces.js";
|
|
2
|
-
import { FAST } from "../platform.js";
|
|
3
|
-
import { DOM } from "../dom.js";
|
|
4
1
|
import { oneTime } from "../binding/one-time.js";
|
|
5
2
|
import { oneWay } from "../binding/one-way.js";
|
|
6
|
-
import {
|
|
3
|
+
import { DOM } from "../dom.js";
|
|
4
|
+
import { isFunction, isString, Message } from "../interfaces.js";
|
|
5
|
+
import { FAST } from "../platform.js";
|
|
7
6
|
import { HTMLBindingDirective } from "./html-binding-directive.js";
|
|
8
7
|
import { HTMLDirective, } from "./html-directive.js";
|
|
8
|
+
import { nextId, Parser } from "./markup.js";
|
|
9
9
|
import { HTMLView } from "./view.js";
|
|
10
10
|
const targetIdFrom = (parentId, nodeIndex) => `${parentId}.${nodeIndex}`;
|
|
11
11
|
const descriptorCache = {};
|
|
@@ -16,7 +16,7 @@ const next = {
|
|
|
16
16
|
};
|
|
17
17
|
function tryWarn(name) {
|
|
18
18
|
if (!name.startsWith("fast-")) {
|
|
19
|
-
FAST.warn(
|
|
19
|
+
FAST.warn(Message.hostBindingWithoutHost, { name });
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
const warningHost = new Proxy(document.createElement("div"), {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isHydratable } from "../components/hydration.js";
|
|
2
2
|
import { DOM, DOMAspect } from "../dom.js";
|
|
3
|
-
import "../interfaces.js";
|
|
3
|
+
import { Message } from "../interfaces.js";
|
|
4
4
|
import { ExecutionContext, } from "../observation/observable.js";
|
|
5
5
|
import { FAST } from "../platform.js";
|
|
6
6
|
import { HTMLDirective, } from "./html-directive.js";
|
|
@@ -150,7 +150,7 @@ export class HTMLBindingDirective {
|
|
|
150
150
|
const sink = sinkLookup[this.aspectType];
|
|
151
151
|
const policy = (_a = this.dataBinding.policy) !== null && _a !== void 0 ? _a : this.policy;
|
|
152
152
|
if (!sink) {
|
|
153
|
-
throw FAST.error(
|
|
153
|
+
throw FAST.error(Message.unsupportedBindingBehavior);
|
|
154
154
|
}
|
|
155
155
|
this.data = `${this.id}-d`;
|
|
156
156
|
this.updateTarget = policy.protect(this.targetTagName, this.aspectType, this.targetAspect, sink);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { emptyArray } from "../platform.js";
|
|
2
|
-
import { StatelessAttachedAttributeDirective } from "./html-directive.js";
|
|
2
|
+
import { StatelessAttachedAttributeDirective, } from "./html-directive.js";
|
|
3
3
|
const selectElements = (value) => value.nodeType === 1;
|
|
4
4
|
/**
|
|
5
5
|
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FASTElementDefinition } from "../components/fast-definitions.js";
|
|
2
|
-
import { isHydratable } from "../components/hydration.js";
|
|
3
|
-
import { isFunction, isString } from "../interfaces.js";
|
|
4
1
|
import { Binding } from "../binding/binding.js";
|
|
2
|
+
import { normalizeBinding } from "../binding/normalize.js";
|
|
5
3
|
import { oneTime } from "../binding/one-time.js";
|
|
6
4
|
import { oneWay } from "../binding/one-way.js";
|
|
7
|
-
import {
|
|
5
|
+
import { FASTElementDefinition } from "../components/fast-definitions.js";
|
|
6
|
+
import { isHydratable } from "../components/hydration.js";
|
|
7
|
+
import { isFunction, isString } from "../interfaces.js";
|
|
8
8
|
import { HTMLDirective, } from "./html-directive.js";
|
|
9
9
|
import { Markup } from "./markup.js";
|
|
10
10
|
import { html, ViewTemplate, } from "./template.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { normalizeBinding } from "../binding/normalize.js";
|
|
1
2
|
import { HydrationMarkup, isHydratable } from "../components/hydration.js";
|
|
2
|
-
import { ArrayObserver } from "../observation/arrays.js";
|
|
3
|
-
import { Observable } from "../observation/observable.js";
|
|
3
|
+
import { ArrayObserver, Sort, Splice } from "../observation/arrays.js";
|
|
4
|
+
import { Observable, } from "../observation/observable.js";
|
|
4
5
|
import { emptyArray } from "../platform.js";
|
|
5
|
-
import { normalizeBinding } from "../binding/normalize.js";
|
|
6
6
|
import { HTMLDirective, } from "./html-directive.js";
|
|
7
7
|
import { Markup } from "./markup.js";
|
|
8
|
-
import { HTMLView, HydrationStage } from "./view.js";
|
|
8
|
+
import { HTMLView, HydrationStage, HydrationView } from "./view.js";
|
|
9
9
|
const defaultRepeatOptions = Object.freeze({
|
|
10
10
|
positioning: false,
|
|
11
11
|
recycle: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isString } from "../interfaces.js";
|
|
2
2
|
import { HTMLDirective } from "./html-directive.js";
|
|
3
|
-
import { NodeObservationDirective } from "./node-observation.js";
|
|
3
|
+
import { NodeObservationDirective, } from "./node-observation.js";
|
|
4
4
|
const slotEvent = "slotchange";
|
|
5
5
|
/**
|
|
6
6
|
* The runtime behavior for slotted node observation.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { isFunction, isString } from "../interfaces.js";
|
|
2
1
|
import { Binding } from "../binding/binding.js";
|
|
3
|
-
import { FAST, makeSerializationNoop } from "../platform.js";
|
|
4
|
-
import { oneWay } from "../binding/one-way.js";
|
|
5
2
|
import { oneTime } from "../binding/one-time.js";
|
|
6
|
-
import {
|
|
3
|
+
import { oneWay } from "../binding/one-way.js";
|
|
4
|
+
import { isFunction, isString, Message } from "../interfaces.js";
|
|
5
|
+
import { FAST, makeSerializationNoop } from "../platform.js";
|
|
7
6
|
import { Compiler } from "./compiler.js";
|
|
7
|
+
import { HTMLBindingDirective } from "./html-binding-directive.js";
|
|
8
8
|
import { HTMLDirective, } from "./html-directive.js";
|
|
9
9
|
import { nextId } from "./markup.js";
|
|
10
10
|
// Much thanks to LitHTML for working this out!
|
|
@@ -100,10 +100,10 @@ export class ViewTemplate {
|
|
|
100
100
|
*/
|
|
101
101
|
withPolicy(policy) {
|
|
102
102
|
if (this.result) {
|
|
103
|
-
throw FAST.error(
|
|
103
|
+
throw FAST.error(Message.cannotSetTemplatePolicyAfterCompilation);
|
|
104
104
|
}
|
|
105
105
|
if (this.policy) {
|
|
106
|
-
throw FAST.error(
|
|
106
|
+
throw FAST.error(Message.onlySetTemplatePolicyOnce);
|
|
107
107
|
}
|
|
108
108
|
this.policy = policy;
|
|
109
109
|
return this;
|
|
@@ -177,7 +177,7 @@ export const html = ((strings, ...values) => {
|
|
|
177
177
|
if (Array.isArray(strings) && Array.isArray(strings.raw)) {
|
|
178
178
|
return ViewTemplate.create(strings, values);
|
|
179
179
|
}
|
|
180
|
-
throw FAST.error(
|
|
180
|
+
throw FAST.error(Message.directCallToHTMLTagNotAllowed);
|
|
181
181
|
});
|
|
182
182
|
html.partial = (html) => {
|
|
183
183
|
return new InlineTemplateDirective(html);
|
|
@@ -12578,7 +12578,7 @@
|
|
|
12578
12578
|
"excerptTokens": [
|
|
12579
12579
|
{
|
|
12580
12580
|
"kind": "Content",
|
|
12581
|
-
"text": "static lifecycleCallbacks
|
|
12581
|
+
"text": "static lifecycleCallbacks: "
|
|
12582
12582
|
},
|
|
12583
12583
|
{
|
|
12584
12584
|
"kind": "Reference",
|
|
@@ -12591,7 +12591,7 @@
|
|
|
12591
12591
|
}
|
|
12592
12592
|
],
|
|
12593
12593
|
"isReadonly": false,
|
|
12594
|
-
"isOptional":
|
|
12594
|
+
"isOptional": false,
|
|
12595
12595
|
"releaseTag": "Beta",
|
|
12596
12596
|
"name": "lifecycleCallbacks",
|
|
12597
12597
|
"propertyTypeTokenRange": {
|
|
@@ -13107,26 +13107,57 @@
|
|
|
13107
13107
|
"excerptTokens": [
|
|
13108
13108
|
{
|
|
13109
13109
|
"kind": "Content",
|
|
13110
|
-
"text": "export interface HydrationControllerCallbacks "
|
|
13110
|
+
"text": "export interface HydrationControllerCallbacks<TElement extends "
|
|
13111
|
+
},
|
|
13112
|
+
{
|
|
13113
|
+
"kind": "Reference",
|
|
13114
|
+
"text": "HTMLElement",
|
|
13115
|
+
"canonicalReference": "!HTMLElement:interface"
|
|
13116
|
+
},
|
|
13117
|
+
{
|
|
13118
|
+
"kind": "Content",
|
|
13119
|
+
"text": " = "
|
|
13120
|
+
},
|
|
13121
|
+
{
|
|
13122
|
+
"kind": "Reference",
|
|
13123
|
+
"text": "HTMLElement",
|
|
13124
|
+
"canonicalReference": "!HTMLElement:interface"
|
|
13125
|
+
},
|
|
13126
|
+
{
|
|
13127
|
+
"kind": "Content",
|
|
13128
|
+
"text": "> "
|
|
13111
13129
|
}
|
|
13112
13130
|
],
|
|
13113
13131
|
"fileUrlPath": "dist/dts/components/element-controller.d.ts",
|
|
13114
13132
|
"releaseTag": "Public",
|
|
13133
|
+
"typeParameters": [
|
|
13134
|
+
{
|
|
13135
|
+
"typeParameterName": "TElement",
|
|
13136
|
+
"constraintTokenRange": {
|
|
13137
|
+
"startIndex": 1,
|
|
13138
|
+
"endIndex": 2
|
|
13139
|
+
},
|
|
13140
|
+
"defaultTypeTokenRange": {
|
|
13141
|
+
"startIndex": 3,
|
|
13142
|
+
"endIndex": 4
|
|
13143
|
+
}
|
|
13144
|
+
}
|
|
13145
|
+
],
|
|
13115
13146
|
"name": "HydrationControllerCallbacks",
|
|
13116
13147
|
"preserveMemberOrder": false,
|
|
13117
13148
|
"members": [
|
|
13118
13149
|
{
|
|
13119
13150
|
"kind": "MethodSignature",
|
|
13120
13151
|
"canonicalReference": "@microsoft/fast-element!HydrationControllerCallbacks#elementDidHydrate:member(1)",
|
|
13121
|
-
"docComment": "/**\n * Called after hydration has finished\n */\n",
|
|
13152
|
+
"docComment": "/**\n * Called after an individual element's hydration has finished\n */\n",
|
|
13122
13153
|
"excerptTokens": [
|
|
13123
13154
|
{
|
|
13124
13155
|
"kind": "Content",
|
|
13125
|
-
"text": "elementDidHydrate?(
|
|
13156
|
+
"text": "elementDidHydrate?(source: "
|
|
13126
13157
|
},
|
|
13127
13158
|
{
|
|
13128
13159
|
"kind": "Content",
|
|
13129
|
-
"text": "
|
|
13160
|
+
"text": "TElement"
|
|
13130
13161
|
},
|
|
13131
13162
|
{
|
|
13132
13163
|
"kind": "Content",
|
|
@@ -13150,7 +13181,7 @@
|
|
|
13150
13181
|
"overloadIndex": 1,
|
|
13151
13182
|
"parameters": [
|
|
13152
13183
|
{
|
|
13153
|
-
"parameterName": "
|
|
13184
|
+
"parameterName": "source",
|
|
13154
13185
|
"parameterTypeTokenRange": {
|
|
13155
13186
|
"startIndex": 1,
|
|
13156
13187
|
"endIndex": 2
|
|
@@ -13163,15 +13194,15 @@
|
|
|
13163
13194
|
{
|
|
13164
13195
|
"kind": "MethodSignature",
|
|
13165
13196
|
"canonicalReference": "@microsoft/fast-element!HydrationControllerCallbacks#elementWillHydrate:member(1)",
|
|
13166
|
-
"docComment": "/**\n * Called before hydration
|
|
13197
|
+
"docComment": "/**\n * Called before an individual element's hydration begins\n */\n",
|
|
13167
13198
|
"excerptTokens": [
|
|
13168
13199
|
{
|
|
13169
13200
|
"kind": "Content",
|
|
13170
|
-
"text": "elementWillHydrate?(
|
|
13201
|
+
"text": "elementWillHydrate?(source: "
|
|
13171
13202
|
},
|
|
13172
13203
|
{
|
|
13173
13204
|
"kind": "Content",
|
|
13174
|
-
"text": "
|
|
13205
|
+
"text": "TElement"
|
|
13175
13206
|
},
|
|
13176
13207
|
{
|
|
13177
13208
|
"kind": "Content",
|
|
@@ -13195,7 +13226,7 @@
|
|
|
13195
13226
|
"overloadIndex": 1,
|
|
13196
13227
|
"parameters": [
|
|
13197
13228
|
{
|
|
13198
|
-
"parameterName": "
|
|
13229
|
+
"parameterName": "source",
|
|
13199
13230
|
"parameterTypeTokenRange": {
|
|
13200
13231
|
"startIndex": 1,
|
|
13201
13232
|
"endIndex": 2
|
|
@@ -13232,6 +13263,34 @@
|
|
|
13232
13263
|
"overloadIndex": 1,
|
|
13233
13264
|
"parameters": [],
|
|
13234
13265
|
"name": "hydrationComplete"
|
|
13266
|
+
},
|
|
13267
|
+
{
|
|
13268
|
+
"kind": "MethodSignature",
|
|
13269
|
+
"canonicalReference": "@microsoft/fast-element!HydrationControllerCallbacks#hydrationStarted:member(1)",
|
|
13270
|
+
"docComment": "/**\n * Called once when the first element enters the hydration pipeline. This is the earliest point at which we know a component has been async-defined with `defer-and-hydrate`, a template is pending via `<f-template>`, and the element has `needs-hydration`.\n */\n",
|
|
13271
|
+
"excerptTokens": [
|
|
13272
|
+
{
|
|
13273
|
+
"kind": "Content",
|
|
13274
|
+
"text": "hydrationStarted?(): "
|
|
13275
|
+
},
|
|
13276
|
+
{
|
|
13277
|
+
"kind": "Content",
|
|
13278
|
+
"text": "void"
|
|
13279
|
+
},
|
|
13280
|
+
{
|
|
13281
|
+
"kind": "Content",
|
|
13282
|
+
"text": ";"
|
|
13283
|
+
}
|
|
13284
|
+
],
|
|
13285
|
+
"isOptional": true,
|
|
13286
|
+
"returnTypeTokenRange": {
|
|
13287
|
+
"startIndex": 1,
|
|
13288
|
+
"endIndex": 2
|
|
13289
|
+
},
|
|
13290
|
+
"releaseTag": "Public",
|
|
13291
|
+
"overloadIndex": 1,
|
|
13292
|
+
"parameters": [],
|
|
13293
|
+
"name": "hydrationStarted"
|
|
13235
13294
|
}
|
|
13236
13295
|
],
|
|
13237
13296
|
"extendsTokenRanges": []
|