@microsoft/fast-element 2.9.1 → 2.9.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.json +15 -0
- package/CHANGELOG.md +9 -1
- package/dist/context/context.api.json +7 -7
- package/dist/di/di.api.json +12 -12
- package/dist/dts/binding/two-way.d.ts +1 -1
- package/dist/dts/components/attributes.d.ts +3 -3
- package/dist/dts/components/fast-definitions.d.ts +1 -1
- package/dist/dts/context.d.ts +7 -7
- package/dist/dts/di/di.d.ts +13 -13
- package/dist/dts/dom-policy.d.ts +5 -5
- package/dist/dts/dom.d.ts +2 -2
- package/dist/dts/interfaces.d.ts +7 -7
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/observable.d.ts +2 -2
- package/dist/dts/state/state.d.ts +9 -9
- package/dist/dts/styles/css-binding-directive.d.ts +1 -1
- package/dist/dts/styles/css-directive.d.ts +1 -1
- package/dist/dts/styles/css.d.ts +2 -2
- package/dist/dts/styles/element-styles.d.ts +2 -2
- package/dist/dts/templating/children.d.ts +1 -1
- package/dist/dts/templating/compiler.d.ts +1 -1
- package/dist/dts/templating/html-directive.d.ts +3 -3
- package/dist/dts/templating/node-observation.d.ts +1 -1
- package/dist/dts/templating/render.d.ts +6 -6
- package/dist/dts/templating/template.d.ts +2 -2
- package/dist/esm/components/element-controller.js +84 -84
- package/dist/esm/components/fast-definitions.js +15 -15
- package/dist/esm/di/di.js +12 -12
- package/dist/esm/observation/arrays.js +12 -12
- package/dist/esm/styles/element-styles.js +9 -9
- package/dist/esm/templating/repeat.js +7 -7
- package/dist/esm/templating/view.js +9 -9
- package/dist/fast-element.api.json +26 -26
- package/dist/fast-element.d.ts +4 -4
- package/dist/fast-element.debug.js +141 -139
- package/dist/fast-element.debug.min.js +2 -2
- package/dist/fast-element.js +141 -139
- package/dist/fast-element.min.js +2 -2
- package/docs/di/api-report.api.md +4 -4
- package/karma.conf.cjs +13 -7
- package/package.json +3 -44
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
"excerptTokens": [
|
|
331
331
|
{
|
|
332
332
|
"kind": "Content",
|
|
333
|
-
"text": "export
|
|
333
|
+
"text": "export type AddBehavior = "
|
|
334
334
|
},
|
|
335
335
|
{
|
|
336
336
|
"kind": "Content",
|
|
@@ -374,7 +374,7 @@
|
|
|
374
374
|
"excerptTokens": [
|
|
375
375
|
{
|
|
376
376
|
"kind": "Content",
|
|
377
|
-
"text": "export
|
|
377
|
+
"text": "export type AddViewBehaviorFactory = "
|
|
378
378
|
},
|
|
379
379
|
{
|
|
380
380
|
"kind": "Content",
|
|
@@ -957,7 +957,7 @@
|
|
|
957
957
|
"excerptTokens": [
|
|
958
958
|
{
|
|
959
959
|
"kind": "Content",
|
|
960
|
-
"text": "export
|
|
960
|
+
"text": "export type AttributeConfiguration = "
|
|
961
961
|
},
|
|
962
962
|
{
|
|
963
963
|
"kind": "Content",
|
|
@@ -1437,7 +1437,7 @@
|
|
|
1437
1437
|
"excerptTokens": [
|
|
1438
1438
|
{
|
|
1439
1439
|
"kind": "Content",
|
|
1440
|
-
"text": "export
|
|
1440
|
+
"text": "export type AttributeMode = "
|
|
1441
1441
|
},
|
|
1442
1442
|
{
|
|
1443
1443
|
"kind": "Content",
|
|
@@ -1959,7 +1959,7 @@
|
|
|
1959
1959
|
"excerptTokens": [
|
|
1960
1960
|
{
|
|
1961
1961
|
"kind": "Content",
|
|
1962
|
-
"text": "export
|
|
1962
|
+
"text": "export type Callable = "
|
|
1963
1963
|
},
|
|
1964
1964
|
{
|
|
1965
1965
|
"kind": "Content",
|
|
@@ -2444,7 +2444,7 @@
|
|
|
2444
2444
|
"excerptTokens": [
|
|
2445
2445
|
{
|
|
2446
2446
|
"kind": "Content",
|
|
2447
|
-
"text": "export
|
|
2447
|
+
"text": "export type ChildrenDirectiveOptions<T = "
|
|
2448
2448
|
},
|
|
2449
2449
|
{
|
|
2450
2450
|
"kind": "Content",
|
|
@@ -2505,7 +2505,7 @@
|
|
|
2505
2505
|
"excerptTokens": [
|
|
2506
2506
|
{
|
|
2507
2507
|
"kind": "Content",
|
|
2508
|
-
"text": "export
|
|
2508
|
+
"text": "export type Class<T, C = "
|
|
2509
2509
|
},
|
|
2510
2510
|
{
|
|
2511
2511
|
"kind": "Content",
|
|
@@ -2572,7 +2572,7 @@
|
|
|
2572
2572
|
"excerptTokens": [
|
|
2573
2573
|
{
|
|
2574
2574
|
"kind": "Content",
|
|
2575
|
-
"text": "export
|
|
2575
|
+
"text": "export type CompilationStrategy = "
|
|
2576
2576
|
},
|
|
2577
2577
|
{
|
|
2578
2578
|
"kind": "Content",
|
|
@@ -2639,7 +2639,7 @@
|
|
|
2639
2639
|
"excerptTokens": [
|
|
2640
2640
|
{
|
|
2641
2641
|
"kind": "Content",
|
|
2642
|
-
"text": "export
|
|
2642
|
+
"text": "export type CompiledViewBehaviorFactory = "
|
|
2643
2643
|
},
|
|
2644
2644
|
{
|
|
2645
2645
|
"kind": "Reference",
|
|
@@ -2783,7 +2783,7 @@
|
|
|
2783
2783
|
"excerptTokens": [
|
|
2784
2784
|
{
|
|
2785
2785
|
"kind": "Content",
|
|
2786
|
-
"text": "export
|
|
2786
|
+
"text": "export type ComposableStyles = "
|
|
2787
2787
|
},
|
|
2788
2788
|
{
|
|
2789
2789
|
"kind": "Content",
|
|
@@ -2823,7 +2823,7 @@
|
|
|
2823
2823
|
"excerptTokens": [
|
|
2824
2824
|
{
|
|
2825
2825
|
"kind": "Content",
|
|
2826
|
-
"text": "export
|
|
2826
|
+
"text": "export type Constructable<T = "
|
|
2827
2827
|
},
|
|
2828
2828
|
{
|
|
2829
2829
|
"kind": "Content",
|
|
@@ -2870,7 +2870,7 @@
|
|
|
2870
2870
|
"excerptTokens": [
|
|
2871
2871
|
{
|
|
2872
2872
|
"kind": "Content",
|
|
2873
|
-
"text": "export
|
|
2873
|
+
"text": "export type ConstructibleStyleStrategy = "
|
|
2874
2874
|
},
|
|
2875
2875
|
{
|
|
2876
2876
|
"kind": "Content",
|
|
@@ -4016,7 +4016,7 @@
|
|
|
4016
4016
|
"excerptTokens": [
|
|
4017
4017
|
{
|
|
4018
4018
|
"kind": "Content",
|
|
4019
|
-
"text": "export
|
|
4019
|
+
"text": "export type CSSTemplateTag = "
|
|
4020
4020
|
},
|
|
4021
4021
|
{
|
|
4022
4022
|
"kind": "Content",
|
|
@@ -4096,7 +4096,7 @@
|
|
|
4096
4096
|
"excerptTokens": [
|
|
4097
4097
|
{
|
|
4098
4098
|
"kind": "Content",
|
|
4099
|
-
"text": "export
|
|
4099
|
+
"text": "export type CSSValue<TSource, TParent = "
|
|
4100
4100
|
},
|
|
4101
4101
|
{
|
|
4102
4102
|
"kind": "Content",
|
|
@@ -4250,7 +4250,7 @@
|
|
|
4250
4250
|
"excerptTokens": [
|
|
4251
4251
|
{
|
|
4252
4252
|
"kind": "Content",
|
|
4253
|
-
"text": "export
|
|
4253
|
+
"text": "export type DecoratorAttributeConfiguration = "
|
|
4254
4254
|
},
|
|
4255
4255
|
{
|
|
4256
4256
|
"kind": "Reference",
|
|
@@ -4427,7 +4427,7 @@
|
|
|
4427
4427
|
"excerptTokens": [
|
|
4428
4428
|
{
|
|
4429
4429
|
"kind": "Content",
|
|
4430
|
-
"text": "export
|
|
4430
|
+
"text": "export type DOMAspect = "
|
|
4431
4431
|
},
|
|
4432
4432
|
{
|
|
4433
4433
|
"kind": "Content",
|
|
@@ -4667,7 +4667,7 @@
|
|
|
4667
4667
|
"excerptTokens": [
|
|
4668
4668
|
{
|
|
4669
4669
|
"kind": "Content",
|
|
4670
|
-
"text": "export
|
|
4670
|
+
"text": "export type DOMSink = "
|
|
4671
4671
|
},
|
|
4672
4672
|
{
|
|
4673
4673
|
"kind": "Content",
|
|
@@ -6194,7 +6194,7 @@
|
|
|
6194
6194
|
"excerptTokens": [
|
|
6195
6195
|
{
|
|
6196
6196
|
"kind": "Content",
|
|
6197
|
-
"text": "export
|
|
6197
|
+
"text": "export type ElementsFilter = "
|
|
6198
6198
|
},
|
|
6199
6199
|
{
|
|
6200
6200
|
"kind": "Content",
|
|
@@ -7569,7 +7569,7 @@
|
|
|
7569
7569
|
"excerptTokens": [
|
|
7570
7570
|
{
|
|
7571
7571
|
"kind": "Content",
|
|
7572
|
-
"text": "export
|
|
7572
|
+
"text": "export type Expression<TSource = "
|
|
7573
7573
|
},
|
|
7574
7574
|
{
|
|
7575
7575
|
"kind": "Content",
|
|
@@ -11512,7 +11512,7 @@
|
|
|
11512
11512
|
"excerptTokens": [
|
|
11513
11513
|
{
|
|
11514
11514
|
"kind": "Content",
|
|
11515
|
-
"text": "export
|
|
11515
|
+
"text": "export type HTMLTemplateTag = "
|
|
11516
11516
|
},
|
|
11517
11517
|
{
|
|
11518
11518
|
"kind": "Content",
|
|
@@ -18698,7 +18698,7 @@
|
|
|
18698
18698
|
"excerptTokens": [
|
|
18699
18699
|
{
|
|
18700
18700
|
"kind": "Content",
|
|
18701
|
-
"text": "export
|
|
18701
|
+
"text": "export type SourceLifetime = "
|
|
18702
18702
|
},
|
|
18703
18703
|
{
|
|
18704
18704
|
"kind": "Content",
|
|
@@ -19897,7 +19897,7 @@
|
|
|
19897
19897
|
"excerptTokens": [
|
|
19898
19898
|
{
|
|
19899
19899
|
"kind": "Content",
|
|
19900
|
-
"text": "export
|
|
19900
|
+
"text": "export type SpliceStrategySupport = "
|
|
19901
19901
|
},
|
|
19902
19902
|
{
|
|
19903
19903
|
"kind": "Content",
|
|
@@ -21655,7 +21655,7 @@
|
|
|
21655
21655
|
"excerptTokens": [
|
|
21656
21656
|
{
|
|
21657
21657
|
"kind": "Content",
|
|
21658
|
-
"text": "export
|
|
21658
|
+
"text": "export type TemplateOptions = "
|
|
21659
21659
|
},
|
|
21660
21660
|
{
|
|
21661
21661
|
"kind": "Content",
|
|
@@ -21722,7 +21722,7 @@
|
|
|
21722
21722
|
"excerptTokens": [
|
|
21723
21723
|
{
|
|
21724
21724
|
"kind": "Content",
|
|
21725
|
-
"text": "export
|
|
21725
|
+
"text": "export type TemplateValue<TSource, TParent = "
|
|
21726
21726
|
},
|
|
21727
21727
|
{
|
|
21728
21728
|
"kind": "Content",
|
|
@@ -21812,7 +21812,7 @@
|
|
|
21812
21812
|
"excerptTokens": [
|
|
21813
21813
|
{
|
|
21814
21814
|
"kind": "Content",
|
|
21815
|
-
"text": "export
|
|
21815
|
+
"text": "export type TrustedTypesPolicy = "
|
|
21816
21816
|
},
|
|
21817
21817
|
{
|
|
21818
21818
|
"kind": "Content",
|
|
@@ -22656,7 +22656,7 @@
|
|
|
22656
22656
|
"excerptTokens": [
|
|
22657
22657
|
{
|
|
22658
22658
|
"kind": "Content",
|
|
22659
|
-
"text": "export
|
|
22659
|
+
"text": "export type ViewBehaviorTargets = "
|
|
22660
22660
|
},
|
|
22661
22661
|
{
|
|
22662
22662
|
"kind": "Content",
|
package/dist/fast-element.d.ts
CHANGED
|
@@ -431,7 +431,7 @@ export declare const DI: Readonly<{
|
|
|
431
431
|
*
|
|
432
432
|
* @public
|
|
433
433
|
*/
|
|
434
|
-
transient<T extends Constructable
|
|
434
|
+
transient<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
435
435
|
/**
|
|
436
436
|
* Registers the `target` class as a singleton dependency; the class will only be created once. Each
|
|
437
437
|
* consecutive time the dependency is resolved, the same instance will be returned.
|
|
@@ -455,7 +455,7 @@ export declare const DI: Readonly<{
|
|
|
455
455
|
*
|
|
456
456
|
* @public
|
|
457
457
|
*/
|
|
458
|
-
singleton<T_1 extends Constructable
|
|
458
|
+
singleton<T_1 extends Constructable>(target: T_1 & Partial<RegisterSelf<T_1>>, options?: SingletonOptions): T_1 & RegisterSelf<T_1>;
|
|
459
459
|
}>;
|
|
460
460
|
|
|
461
461
|
/**
|
|
@@ -762,7 +762,7 @@ export declare const Registration: Readonly<{
|
|
|
762
762
|
* @param key - The key to register the singleton under.
|
|
763
763
|
* @param value - The class to instantiate as a singleton when first requested.
|
|
764
764
|
*/
|
|
765
|
-
singleton<T_1 extends Constructable
|
|
765
|
+
singleton<T_1 extends Constructable>(key: Key, value: T_1): Registration<InstanceType<T_1>>;
|
|
766
766
|
/**
|
|
767
767
|
* Creates an instance from a class.
|
|
768
768
|
* Every time you request this {@link Key} you will get a new instance.
|
|
@@ -775,7 +775,7 @@ export declare const Registration: Readonly<{
|
|
|
775
775
|
* @param key - The key to register the instance type under.
|
|
776
776
|
* @param value - The class to instantiate each time the key is requested.
|
|
777
777
|
*/
|
|
778
|
-
transient<T_2 extends Constructable
|
|
778
|
+
transient<T_2 extends Constructable>(key: Key, value: T_2): Registration<InstanceType<T_2>>;
|
|
779
779
|
/**
|
|
780
780
|
* Delegates to a callback function to provide the dependency.
|
|
781
781
|
* Every time you request this {@link Key} the callback will be invoked to provide
|
|
@@ -1761,18 +1761,6 @@ function setNonEnumerable(target, property, value, writable = true) {
|
|
|
1761
1761
|
});
|
|
1762
1762
|
}
|
|
1763
1763
|
class DefaultArrayObserver extends SubscriberSet {
|
|
1764
|
-
constructor(subject) {
|
|
1765
|
-
super(subject);
|
|
1766
|
-
this.oldCollection = void 0;
|
|
1767
|
-
this.splices = void 0;
|
|
1768
|
-
this.sorts = void 0;
|
|
1769
|
-
this.needsQueue = true;
|
|
1770
|
-
this._strategy = null;
|
|
1771
|
-
this._lengthObserver = void 0;
|
|
1772
|
-
this._sortObserver = void 0;
|
|
1773
|
-
this.call = this.flush;
|
|
1774
|
-
setNonEnumerable(subject, "$fastController", this);
|
|
1775
|
-
}
|
|
1776
1764
|
get strategy() {
|
|
1777
1765
|
return this._strategy;
|
|
1778
1766
|
}
|
|
@@ -1813,6 +1801,18 @@ class DefaultArrayObserver extends SubscriberSet {
|
|
|
1813
1801
|
}
|
|
1814
1802
|
return observer;
|
|
1815
1803
|
}
|
|
1804
|
+
constructor(subject) {
|
|
1805
|
+
super(subject);
|
|
1806
|
+
this.oldCollection = void 0;
|
|
1807
|
+
this.splices = void 0;
|
|
1808
|
+
this.sorts = void 0;
|
|
1809
|
+
this.needsQueue = true;
|
|
1810
|
+
this._strategy = null;
|
|
1811
|
+
this._lengthObserver = void 0;
|
|
1812
|
+
this._sortObserver = void 0;
|
|
1813
|
+
this.call = this.flush;
|
|
1814
|
+
setNonEnumerable(subject, "$fastController", this);
|
|
1815
|
+
}
|
|
1816
1816
|
subscribe(subscriber) {
|
|
1817
1817
|
this.flush();
|
|
1818
1818
|
super.subscribe(subscriber);
|
|
@@ -2036,6 +2036,15 @@ function reduceStyles(styles) {
|
|
|
2036
2036
|
* @public
|
|
2037
2037
|
*/
|
|
2038
2038
|
class ElementStyles {
|
|
2039
|
+
/**
|
|
2040
|
+
* Gets the StyleStrategy associated with these element styles.
|
|
2041
|
+
*/
|
|
2042
|
+
get strategy() {
|
|
2043
|
+
if (this._strategy === null) {
|
|
2044
|
+
this.withStrategy(DefaultStyleStrategy);
|
|
2045
|
+
}
|
|
2046
|
+
return this._strategy;
|
|
2047
|
+
}
|
|
2039
2048
|
/**
|
|
2040
2049
|
* Creates an instance of ElementStyles.
|
|
2041
2050
|
* @param styles - The styles that will be associated with elements.
|
|
@@ -2048,15 +2057,6 @@ class ElementStyles {
|
|
|
2048
2057
|
.map((x) => x instanceof ElementStyles ? x.behaviors : null)
|
|
2049
2058
|
.reduce((prev, curr) => (curr === null ? prev : prev === null ? curr : prev.concat(curr)), null);
|
|
2050
2059
|
}
|
|
2051
|
-
/**
|
|
2052
|
-
* Gets the StyleStrategy associated with these element styles.
|
|
2053
|
-
*/
|
|
2054
|
-
get strategy() {
|
|
2055
|
-
if (this._strategy === null) {
|
|
2056
|
-
this.withStrategy(DefaultStyleStrategy);
|
|
2057
|
-
}
|
|
2058
|
-
return this._strategy;
|
|
2059
|
-
}
|
|
2060
2060
|
/** @internal */
|
|
2061
2061
|
addStylesTo(target) {
|
|
2062
2062
|
this.strategy.addStylesTo(target);
|
|
@@ -2865,7 +2865,7 @@ function targetFactory(factory, node, targets) {
|
|
|
2865
2865
|
targets[factory.targetNodeId] = node;
|
|
2866
2866
|
}
|
|
2867
2867
|
|
|
2868
|
-
var _a;
|
|
2868
|
+
var _a$1;
|
|
2869
2869
|
function removeNodeSequence(firstNode, lastNode) {
|
|
2870
2870
|
const parent = firstNode.parentNode;
|
|
2871
2871
|
let current = firstNode;
|
|
@@ -3141,13 +3141,22 @@ class HydrationBindingError extends Error {
|
|
|
3141
3141
|
}
|
|
3142
3142
|
}
|
|
3143
3143
|
class HydrationView extends DefaultExecutionContext {
|
|
3144
|
+
get hydrationStage() {
|
|
3145
|
+
return this._hydrationStage;
|
|
3146
|
+
}
|
|
3147
|
+
get targets() {
|
|
3148
|
+
return this._targets;
|
|
3149
|
+
}
|
|
3150
|
+
get bindingViewBoundaries() {
|
|
3151
|
+
return this._bindingViewBoundaries;
|
|
3152
|
+
}
|
|
3144
3153
|
constructor(firstChild, lastChild, sourceTemplate, hostBindingTarget) {
|
|
3145
3154
|
super();
|
|
3146
3155
|
this.firstChild = firstChild;
|
|
3147
3156
|
this.lastChild = lastChild;
|
|
3148
3157
|
this.sourceTemplate = sourceTemplate;
|
|
3149
3158
|
this.hostBindingTarget = hostBindingTarget;
|
|
3150
|
-
this[_a] = Hydratable;
|
|
3159
|
+
this[_a$1] = Hydratable;
|
|
3151
3160
|
this.context = this;
|
|
3152
3161
|
this.source = null;
|
|
3153
3162
|
this.isBound = false;
|
|
@@ -3160,15 +3169,6 @@ class HydrationView extends DefaultExecutionContext {
|
|
|
3160
3169
|
this._targets = {};
|
|
3161
3170
|
this.factories = sourceTemplate.compile().factories;
|
|
3162
3171
|
}
|
|
3163
|
-
get hydrationStage() {
|
|
3164
|
-
return this._hydrationStage;
|
|
3165
|
-
}
|
|
3166
|
-
get targets() {
|
|
3167
|
-
return this._targets;
|
|
3168
|
-
}
|
|
3169
|
-
get bindingViewBoundaries() {
|
|
3170
|
-
return this._bindingViewBoundaries;
|
|
3171
|
-
}
|
|
3172
3172
|
/**
|
|
3173
3173
|
* no-op. Hydrated views are don't need to be moved from a documentFragment
|
|
3174
3174
|
* to the target node.
|
|
@@ -3334,7 +3334,7 @@ class HydrationView extends DefaultExecutionContext {
|
|
|
3334
3334
|
unbindables.length = 0;
|
|
3335
3335
|
}
|
|
3336
3336
|
}
|
|
3337
|
-
_a = Hydratable;
|
|
3337
|
+
_a$1 = Hydratable;
|
|
3338
3338
|
makeSerializationNoop(HydrationView);
|
|
3339
3339
|
|
|
3340
3340
|
function isContentTemplate(value) {
|
|
@@ -4386,6 +4386,13 @@ class RepeatBehavior {
|
|
|
4386
4386
|
* @public
|
|
4387
4387
|
*/
|
|
4388
4388
|
class RepeatDirective {
|
|
4389
|
+
/**
|
|
4390
|
+
* Creates a placeholder string based on the directive's index within the template.
|
|
4391
|
+
* @param index - The index of the directive within the template.
|
|
4392
|
+
*/
|
|
4393
|
+
createHTML(add) {
|
|
4394
|
+
return Markup.comment(add(this));
|
|
4395
|
+
}
|
|
4389
4396
|
/**
|
|
4390
4397
|
* Creates an instance of RepeatDirective.
|
|
4391
4398
|
* @param dataBinding - The binding that provides the array to render.
|
|
@@ -4398,13 +4405,6 @@ class RepeatDirective {
|
|
|
4398
4405
|
this.options = options;
|
|
4399
4406
|
ArrayObserver.enable();
|
|
4400
4407
|
}
|
|
4401
|
-
/**
|
|
4402
|
-
* Creates a placeholder string based on the directive's index within the template.
|
|
4403
|
-
* @param index - The index of the directive within the template.
|
|
4404
|
-
*/
|
|
4405
|
-
createHTML(add) {
|
|
4406
|
-
return Markup.comment(add(this));
|
|
4407
|
-
}
|
|
4408
4408
|
/**
|
|
4409
4409
|
* Creates a behavior for the provided target node.
|
|
4410
4410
|
* @param target - The node instance to create the behavior for.
|
|
@@ -4864,6 +4864,7 @@ function attr(configOrTarget, prop) {
|
|
|
4864
4864
|
return decorator;
|
|
4865
4865
|
}
|
|
4866
4866
|
|
|
4867
|
+
var _a;
|
|
4867
4868
|
const defaultShadowOptions = { mode: "open" };
|
|
4868
4869
|
const defaultElementOptions = {};
|
|
4869
4870
|
const fastElementBaseTypes = new Set();
|
|
@@ -4884,6 +4885,12 @@ const TemplateOptions = {
|
|
|
4884
4885
|
* @public
|
|
4885
4886
|
*/
|
|
4886
4887
|
class FASTElementDefinition {
|
|
4888
|
+
/**
|
|
4889
|
+
* Indicates if this element has been defined in at least one registry.
|
|
4890
|
+
*/
|
|
4891
|
+
get isDefined() {
|
|
4892
|
+
return this.platformDefined;
|
|
4893
|
+
}
|
|
4887
4894
|
constructor(type, nameOrConfig = type.definition) {
|
|
4888
4895
|
var _b;
|
|
4889
4896
|
this.platformDefined = false;
|
|
@@ -4926,14 +4933,8 @@ class FASTElementDefinition {
|
|
|
4926
4933
|
: Object.assign(Object.assign({}, defaultElementOptions), nameOrConfig.elementOptions);
|
|
4927
4934
|
this.styles = ElementStyles.normalize(nameOrConfig.styles);
|
|
4928
4935
|
fastElementRegistry.register(this);
|
|
4929
|
-
Observable.defineProperty(
|
|
4930
|
-
|
|
4931
|
-
}
|
|
4932
|
-
/**
|
|
4933
|
-
* Indicates if this element has been defined in at least one registry.
|
|
4934
|
-
*/
|
|
4935
|
-
get isDefined() {
|
|
4936
|
-
return this.platformDefined;
|
|
4936
|
+
Observable.defineProperty(_a.isRegistered, this.name);
|
|
4937
|
+
_a.isRegistered[this.name] = this.type;
|
|
4937
4938
|
}
|
|
4938
4939
|
/**
|
|
4939
4940
|
* Defines a custom element based on this definition.
|
|
@@ -4959,10 +4960,10 @@ class FASTElementDefinition {
|
|
|
4959
4960
|
*/
|
|
4960
4961
|
static compose(type, nameOrDef) {
|
|
4961
4962
|
if (fastElementBaseTypes.has(type) || fastElementRegistry.getByType(type)) {
|
|
4962
|
-
return new
|
|
4963
|
+
return new _a(class extends type {
|
|
4963
4964
|
}, nameOrDef);
|
|
4964
4965
|
}
|
|
4965
|
-
return new
|
|
4966
|
+
return new _a(type, nameOrDef);
|
|
4966
4967
|
}
|
|
4967
4968
|
/**
|
|
4968
4969
|
* Registers a FASTElement base type.
|
|
@@ -4984,10 +4985,10 @@ class FASTElementDefinition {
|
|
|
4984
4985
|
static composeAsync(type, nameOrDef) {
|
|
4985
4986
|
return new Promise(resolve => {
|
|
4986
4987
|
if (fastElementBaseTypes.has(type) || fastElementRegistry.getByType(type)) {
|
|
4987
|
-
resolve(new
|
|
4988
|
+
resolve(new _a(class extends type {
|
|
4988
4989
|
}, nameOrDef));
|
|
4989
4990
|
}
|
|
4990
|
-
const definition = new
|
|
4991
|
+
const definition = new _a(type, nameOrDef);
|
|
4991
4992
|
Observable.getNotifier(definition).subscribe({
|
|
4992
4993
|
handleChange: () => {
|
|
4993
4994
|
var _b, _c;
|
|
@@ -4998,6 +4999,7 @@ class FASTElementDefinition {
|
|
|
4998
4999
|
});
|
|
4999
5000
|
}
|
|
5000
5001
|
}
|
|
5002
|
+
_a = FASTElementDefinition;
|
|
5001
5003
|
/**
|
|
5002
5004
|
* The definition has been registered to the FAST element registry.
|
|
5003
5005
|
*/
|
|
@@ -5019,10 +5021,10 @@ FASTElementDefinition.getForInstance = fastElementRegistry.getForInstance;
|
|
|
5019
5021
|
*/
|
|
5020
5022
|
FASTElementDefinition.registerAsync = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5021
5023
|
return new Promise(resolve => {
|
|
5022
|
-
if (
|
|
5023
|
-
resolve(
|
|
5024
|
+
if (_a.isRegistered[name]) {
|
|
5025
|
+
resolve(_a.isRegistered[name]);
|
|
5024
5026
|
}
|
|
5025
|
-
Observable.getNotifier(
|
|
5027
|
+
Observable.getNotifier(_a.isRegistered).subscribe({ handleChange: () => resolve(_a.isRegistered[name]) }, name);
|
|
5026
5028
|
});
|
|
5027
5029
|
});
|
|
5028
5030
|
Observable.defineProperty(FASTElementDefinition.prototype, "template");
|
|
@@ -5550,90 +5552,6 @@ let elementControllerStrategy;
|
|
|
5550
5552
|
* @public
|
|
5551
5553
|
*/
|
|
5552
5554
|
class ElementController extends PropertyChangeNotifier {
|
|
5553
|
-
/**
|
|
5554
|
-
* Creates a Controller to control the specified element.
|
|
5555
|
-
* @param element - The element to be controlled by this controller.
|
|
5556
|
-
* @param definition - The element definition metadata that instructs this
|
|
5557
|
-
* controller in how to handle rendering and other platform integrations.
|
|
5558
|
-
* @internal
|
|
5559
|
-
*/
|
|
5560
|
-
constructor(element, definition) {
|
|
5561
|
-
super(element);
|
|
5562
|
-
/**
|
|
5563
|
-
* A map of observable properties that were set on the element before upgrade.
|
|
5564
|
-
*/
|
|
5565
|
-
this.boundObservables = null;
|
|
5566
|
-
/**
|
|
5567
|
-
* Indicates whether the controller needs to perform initial rendering.
|
|
5568
|
-
*/
|
|
5569
|
-
this.needsInitialization = true;
|
|
5570
|
-
/**
|
|
5571
|
-
* Indicates whether the element has an existing shadow root (e.g. from declarative shadow DOM).
|
|
5572
|
-
*/
|
|
5573
|
-
this.hasExistingShadowRoot = false;
|
|
5574
|
-
/**
|
|
5575
|
-
* The template used to render the component.
|
|
5576
|
-
*/
|
|
5577
|
-
this._template = null;
|
|
5578
|
-
/**
|
|
5579
|
-
* The current lifecycle stage of the controller.
|
|
5580
|
-
*/
|
|
5581
|
-
this.stage = 3 /* Stages.disconnected */;
|
|
5582
|
-
/**
|
|
5583
|
-
* A guard against connecting behaviors multiple times
|
|
5584
|
-
* during connect in scenarios where a behavior adds
|
|
5585
|
-
* another behavior during it's connectedCallback
|
|
5586
|
-
*/
|
|
5587
|
-
this.guardBehaviorConnection = false;
|
|
5588
|
-
/**
|
|
5589
|
-
* The behaviors associated with the component.
|
|
5590
|
-
*/
|
|
5591
|
-
this.behaviors = null;
|
|
5592
|
-
/**
|
|
5593
|
-
* Tracks whether behaviors are connected so that
|
|
5594
|
-
* behaviors cant be connected multiple times
|
|
5595
|
-
*/
|
|
5596
|
-
this.behaviorsConnected = false;
|
|
5597
|
-
/**
|
|
5598
|
-
* The main set of styles used for the component, independent of any
|
|
5599
|
-
* dynamically added styles.
|
|
5600
|
-
*/
|
|
5601
|
-
this._mainStyles = null;
|
|
5602
|
-
/**
|
|
5603
|
-
* This allows Observable.getNotifier(...) to return the Controller
|
|
5604
|
-
* when the notifier for the Controller itself is being requested. The
|
|
5605
|
-
* result is that the Observable system does not need to create a separate
|
|
5606
|
-
* instance of Notifier for observables on the Controller. The component and
|
|
5607
|
-
* the controller will now share the same notifier, removing one-object construct
|
|
5608
|
-
* per web component instance.
|
|
5609
|
-
*/
|
|
5610
|
-
this.$fastController = this;
|
|
5611
|
-
/**
|
|
5612
|
-
* The view associated with the custom element.
|
|
5613
|
-
* @remarks
|
|
5614
|
-
* If `null` then the element is managing its own rendering.
|
|
5615
|
-
*/
|
|
5616
|
-
this.view = null;
|
|
5617
|
-
this.source = element;
|
|
5618
|
-
this.definition = definition;
|
|
5619
|
-
this.shadowOptions = definition.shadowOptions;
|
|
5620
|
-
// Capture any observable values that were set by the binding engine before
|
|
5621
|
-
// the browser upgraded the element. Then delete the property since it will
|
|
5622
|
-
// shadow the getter/setter that is required to make the observable operate.
|
|
5623
|
-
// Later, in the connect callback, we'll re-apply the values.
|
|
5624
|
-
const accessors = Observable.getAccessors(element);
|
|
5625
|
-
if (accessors.length > 0) {
|
|
5626
|
-
const boundObservables = (this.boundObservables = Object.create(null));
|
|
5627
|
-
for (let i = 0, ii = accessors.length; i < ii; ++i) {
|
|
5628
|
-
const propertyName = accessors[i].name;
|
|
5629
|
-
const value = element[propertyName];
|
|
5630
|
-
if (value !== void 0) {
|
|
5631
|
-
delete element[propertyName];
|
|
5632
|
-
boundObservables[propertyName] = value;
|
|
5633
|
-
}
|
|
5634
|
-
}
|
|
5635
|
-
}
|
|
5636
|
-
}
|
|
5637
5555
|
/**
|
|
5638
5556
|
* Indicates whether or not the custom element has been
|
|
5639
5557
|
* connected to the document.
|
|
@@ -5747,6 +5665,90 @@ class ElementController extends PropertyChangeNotifier {
|
|
|
5747
5665
|
this.addStyles(value);
|
|
5748
5666
|
}
|
|
5749
5667
|
}
|
|
5668
|
+
/**
|
|
5669
|
+
* Creates a Controller to control the specified element.
|
|
5670
|
+
* @param element - The element to be controlled by this controller.
|
|
5671
|
+
* @param definition - The element definition metadata that instructs this
|
|
5672
|
+
* controller in how to handle rendering and other platform integrations.
|
|
5673
|
+
* @internal
|
|
5674
|
+
*/
|
|
5675
|
+
constructor(element, definition) {
|
|
5676
|
+
super(element);
|
|
5677
|
+
/**
|
|
5678
|
+
* A map of observable properties that were set on the element before upgrade.
|
|
5679
|
+
*/
|
|
5680
|
+
this.boundObservables = null;
|
|
5681
|
+
/**
|
|
5682
|
+
* Indicates whether the controller needs to perform initial rendering.
|
|
5683
|
+
*/
|
|
5684
|
+
this.needsInitialization = true;
|
|
5685
|
+
/**
|
|
5686
|
+
* Indicates whether the element has an existing shadow root (e.g. from declarative shadow DOM).
|
|
5687
|
+
*/
|
|
5688
|
+
this.hasExistingShadowRoot = false;
|
|
5689
|
+
/**
|
|
5690
|
+
* The template used to render the component.
|
|
5691
|
+
*/
|
|
5692
|
+
this._template = null;
|
|
5693
|
+
/**
|
|
5694
|
+
* The current lifecycle stage of the controller.
|
|
5695
|
+
*/
|
|
5696
|
+
this.stage = 3 /* Stages.disconnected */;
|
|
5697
|
+
/**
|
|
5698
|
+
* A guard against connecting behaviors multiple times
|
|
5699
|
+
* during connect in scenarios where a behavior adds
|
|
5700
|
+
* another behavior during it's connectedCallback
|
|
5701
|
+
*/
|
|
5702
|
+
this.guardBehaviorConnection = false;
|
|
5703
|
+
/**
|
|
5704
|
+
* The behaviors associated with the component.
|
|
5705
|
+
*/
|
|
5706
|
+
this.behaviors = null;
|
|
5707
|
+
/**
|
|
5708
|
+
* Tracks whether behaviors are connected so that
|
|
5709
|
+
* behaviors cant be connected multiple times
|
|
5710
|
+
*/
|
|
5711
|
+
this.behaviorsConnected = false;
|
|
5712
|
+
/**
|
|
5713
|
+
* The main set of styles used for the component, independent of any
|
|
5714
|
+
* dynamically added styles.
|
|
5715
|
+
*/
|
|
5716
|
+
this._mainStyles = null;
|
|
5717
|
+
/**
|
|
5718
|
+
* This allows Observable.getNotifier(...) to return the Controller
|
|
5719
|
+
* when the notifier for the Controller itself is being requested. The
|
|
5720
|
+
* result is that the Observable system does not need to create a separate
|
|
5721
|
+
* instance of Notifier for observables on the Controller. The component and
|
|
5722
|
+
* the controller will now share the same notifier, removing one-object construct
|
|
5723
|
+
* per web component instance.
|
|
5724
|
+
*/
|
|
5725
|
+
this.$fastController = this;
|
|
5726
|
+
/**
|
|
5727
|
+
* The view associated with the custom element.
|
|
5728
|
+
* @remarks
|
|
5729
|
+
* If `null` then the element is managing its own rendering.
|
|
5730
|
+
*/
|
|
5731
|
+
this.view = null;
|
|
5732
|
+
this.source = element;
|
|
5733
|
+
this.definition = definition;
|
|
5734
|
+
this.shadowOptions = definition.shadowOptions;
|
|
5735
|
+
// Capture any observable values that were set by the binding engine before
|
|
5736
|
+
// the browser upgraded the element. Then delete the property since it will
|
|
5737
|
+
// shadow the getter/setter that is required to make the observable operate.
|
|
5738
|
+
// Later, in the connect callback, we'll re-apply the values.
|
|
5739
|
+
const accessors = Observable.getAccessors(element);
|
|
5740
|
+
if (accessors.length > 0) {
|
|
5741
|
+
const boundObservables = (this.boundObservables = Object.create(null));
|
|
5742
|
+
for (let i = 0, ii = accessors.length; i < ii; ++i) {
|
|
5743
|
+
const propertyName = accessors[i].name;
|
|
5744
|
+
const value = element[propertyName];
|
|
5745
|
+
if (value !== void 0) {
|
|
5746
|
+
delete element[propertyName];
|
|
5747
|
+
boundObservables[propertyName] = value;
|
|
5748
|
+
}
|
|
5749
|
+
}
|
|
5750
|
+
}
|
|
5751
|
+
}
|
|
5750
5752
|
/**
|
|
5751
5753
|
* Registers an unbind handler with the controller.
|
|
5752
5754
|
* @param behavior - An object to call when the controller unbinds.
|