@microsoft/fast-element 1.11.1 → 1.13.0
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 +31 -1
- package/CHANGELOG.md +18 -2
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/interfaces.d.ts +5 -0
- package/dist/dts/styles/element-styles.d.ts +5 -0
- package/dist/dts/templating/when.d.ts +3 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/interfaces.js +5 -1
- package/dist/esm/styles/element-styles.js +16 -2
- package/dist/esm/templating/when.js +14 -5
- package/dist/fast-element.api.json +63 -3
- package/dist/fast-element.d.ts +9 -1
- package/dist/fast-element.js +49 -6
- package/dist/fast-element.min.js +1 -1
- package/docs/api-report.md +4 -1
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,37 @@
|
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 08 Apr 2024 15:47:10 GMT",
|
|
6
|
+
"tag": "@microsoft/fast-element_v1.13.0",
|
|
7
|
+
"version": "1.13.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "7282195+m-akinc@users.noreply.github.com",
|
|
12
|
+
"package": "@microsoft/fast-element",
|
|
13
|
+
"commit": "0c27d027ff6e8616ad4fddc17f4432aa7f6cbad0",
|
|
14
|
+
"comment": "Export Symbol to allow prepending specific stylesheets to adoptedStyleSheets"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Thu, 04 May 2023 17:35:08 GMT",
|
|
21
|
+
"tag": "@microsoft/fast-element_v1.12.0",
|
|
22
|
+
"version": "1.12.0",
|
|
23
|
+
"comments": {
|
|
24
|
+
"minor": [
|
|
25
|
+
{
|
|
26
|
+
"author": "chhol@microsoft.com",
|
|
27
|
+
"package": "@microsoft/fast-element",
|
|
28
|
+
"commit": "a29696c6c5e90d0e5e6121146628c188d95736d0",
|
|
29
|
+
"comment": "add else case to when directive"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Fri, 14 Apr 2023 19:08:49 GMT",
|
|
6
36
|
"tag": "@microsoft/fast-element_v1.11.1",
|
|
7
37
|
"version": "1.11.1",
|
|
8
38
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-element
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 08 Apr 2024 15:47:10 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.13.0
|
|
8
|
+
|
|
9
|
+
Mon, 08 Apr 2024 15:47:10 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Export Symbol to allow prepending specific stylesheets to adoptedStyleSheets (7282195+m-akinc@users.noreply.github.com)
|
|
14
|
+
|
|
15
|
+
## 1.12.0
|
|
16
|
+
|
|
17
|
+
Thu, 04 May 2023 17:35:08 GMT
|
|
18
|
+
|
|
19
|
+
### Minor changes
|
|
20
|
+
|
|
21
|
+
- add else case to when directive (chhol@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 1.11.1
|
|
8
24
|
|
|
9
|
-
Fri, 14 Apr 2023 19:
|
|
25
|
+
Fri, 14 Apr 2023 19:08:49 GMT
|
|
10
26
|
|
|
11
27
|
### Patches
|
|
12
28
|
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export * from "./components/attributes.js";
|
|
|
6
6
|
export * from "./components/controller.js";
|
|
7
7
|
export type { Callable, Constructable, Mutable } from "./interfaces.js";
|
|
8
8
|
export * from "./templating/compiler.js";
|
|
9
|
-
export { ElementStyles, ElementStyleFactory, ComposableStyles, StyleTarget, } from "./styles/element-styles.js";
|
|
9
|
+
export { ElementStyles, ElementStyleFactory, ComposableStyles, StyleTarget, prependToAdoptedStyleSheetsSymbol, } from "./styles/element-styles.js";
|
|
10
10
|
export { css, cssPartial } from "./styles/css.js";
|
|
11
11
|
export { CSSDirective } from "./styles/css-directive.js";
|
|
12
12
|
export * from "./templating/view.js";
|
package/dist/dts/interfaces.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
13
13
|
export declare type Constructable<T = {}> = {
|
|
14
14
|
new (...args: any[]): T;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Determines whether or not an object is a function.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare const isFunction: (object: any) => object is Function;
|
|
16
21
|
/**
|
|
17
22
|
* Reverses all readonly members, making them mutable.
|
|
18
23
|
* @internal
|
|
@@ -66,6 +66,11 @@ export declare abstract class ElementStyles {
|
|
|
66
66
|
*/
|
|
67
67
|
static readonly create: ElementStyleFactory;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* A Symbol that can be added to a CSSStyleSheet to cause it to be prepended (rather than appended) to adoptedStyleSheets.
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare const prependToAdoptedStyleSheetsSymbol: unique symbol;
|
|
69
74
|
/**
|
|
70
75
|
* https://wicg.github.io/construct-stylesheets/
|
|
71
76
|
* https://developers.google.com/web/updates/2019/02/constructable-stylesheets
|
|
@@ -5,6 +5,8 @@ import type { CaptureType, SyntheticViewTemplate } from "./template.js";
|
|
|
5
5
|
* @param binding - The condition to test for rendering.
|
|
6
6
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
7
7
|
* the template to render when the condition is true.
|
|
8
|
+
* @param elseTemplateOrTemplateBinding - Optional template or binding that that
|
|
9
|
+
* gets the template to render when the conditional is false.
|
|
8
10
|
* @public
|
|
9
11
|
*/
|
|
10
|
-
export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
12
|
+
export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>, elseTemplateOrTemplateBinding?: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
package/dist/esm/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { FASTElementDefinition, } from "./components/fast-definitions.js";
|
|
|
5
5
|
export * from "./components/attributes.js";
|
|
6
6
|
export * from "./components/controller.js";
|
|
7
7
|
export * from "./templating/compiler.js";
|
|
8
|
-
export { ElementStyles, } from "./styles/element-styles.js";
|
|
8
|
+
export { ElementStyles, prependToAdoptedStyleSheetsSymbol, } from "./styles/element-styles.js";
|
|
9
9
|
export { css, cssPartial } from "./styles/css.js";
|
|
10
10
|
export { CSSDirective } from "./styles/css-directive.js";
|
|
11
11
|
export * from "./templating/view.js";
|
package/dist/esm/interfaces.js
CHANGED
|
@@ -60,8 +60,20 @@ function reduceBehaviors(styles) {
|
|
|
60
60
|
return prev.concat(curr);
|
|
61
61
|
}, null);
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* A Symbol that can be added to a CSSStyleSheet to cause it to be prepended (rather than appended) to adoptedStyleSheets.
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export const prependToAdoptedStyleSheetsSymbol = Symbol("prependToAdoptedStyleSheets");
|
|
68
|
+
function separateSheetsToPrepend(sheets) {
|
|
69
|
+
const prepend = [];
|
|
70
|
+
const append = [];
|
|
71
|
+
sheets.forEach(x => (x[prependToAdoptedStyleSheetsSymbol] ? prepend : append).push(x));
|
|
72
|
+
return { prepend, append };
|
|
73
|
+
}
|
|
63
74
|
let addAdoptedStyleSheets = (target, sheets) => {
|
|
64
|
-
|
|
75
|
+
const { prepend, append } = separateSheetsToPrepend(sheets);
|
|
76
|
+
target.adoptedStyleSheets = [...prepend, ...target.adoptedStyleSheets, ...append];
|
|
65
77
|
};
|
|
66
78
|
let removeAdoptedStyleSheets = (target, sheets) => {
|
|
67
79
|
target.adoptedStyleSheets = target.adoptedStyleSheets.filter((x) => sheets.indexOf(x) === -1);
|
|
@@ -76,7 +88,9 @@ if (DOM.supportsAdoptedStyleSheets) {
|
|
|
76
88
|
document.adoptedStyleSheets.push();
|
|
77
89
|
document.adoptedStyleSheets.splice();
|
|
78
90
|
addAdoptedStyleSheets = (target, sheets) => {
|
|
79
|
-
|
|
91
|
+
const { prepend, append } = separateSheetsToPrepend(sheets);
|
|
92
|
+
target.adoptedStyleSheets.splice(0, 0, ...prepend);
|
|
93
|
+
target.adoptedStyleSheets.push(...append);
|
|
80
94
|
};
|
|
81
95
|
removeAdoptedStyleSheets = (target, sheets) => {
|
|
82
96
|
for (const sheet of sheets) {
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
import { isFunction } from "../interfaces.js";
|
|
2
|
+
const noTemplate = () => null;
|
|
3
|
+
function normalizeBinding(value) {
|
|
4
|
+
return value === undefined ? noTemplate : isFunction(value) ? value : () => value;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* A directive that enables basic conditional rendering in a template.
|
|
3
8
|
* @param binding - The condition to test for rendering.
|
|
4
9
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
5
10
|
* the template to render when the condition is true.
|
|
11
|
+
* @param elseTemplateOrTemplateBinding - Optional template or binding that that
|
|
12
|
+
* gets the template to render when the conditional is false.
|
|
6
13
|
* @public
|
|
7
14
|
*/
|
|
8
|
-
export function when(binding, templateOrTemplateBinding) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (source, context) =>
|
|
15
|
+
export function when(binding, templateOrTemplateBinding, elseTemplateOrTemplateBinding) {
|
|
16
|
+
const dataBinding = isFunction(binding) ? binding : () => binding;
|
|
17
|
+
const templateBinding = normalizeBinding(templateOrTemplateBinding);
|
|
18
|
+
const elseBinding = normalizeBinding(elseTemplateOrTemplateBinding);
|
|
19
|
+
return (source, context) => dataBinding(source, context)
|
|
20
|
+
? templateBinding(source, context)
|
|
21
|
+
: elseBinding(source, context);
|
|
13
22
|
}
|
|
@@ -7450,6 +7450,27 @@
|
|
|
7450
7450
|
],
|
|
7451
7451
|
"extendsTokenRanges": []
|
|
7452
7452
|
},
|
|
7453
|
+
{
|
|
7454
|
+
"kind": "Variable",
|
|
7455
|
+
"canonicalReference": "@microsoft/fast-element!prependToAdoptedStyleSheetsSymbol:var",
|
|
7456
|
+
"docComment": "/**\n * A Symbol that can be added to a CSSStyleSheet to cause it to be prepended (rather than appended) to adoptedStyleSheets.\n *\n * @public\n */\n",
|
|
7457
|
+
"excerptTokens": [
|
|
7458
|
+
{
|
|
7459
|
+
"kind": "Content",
|
|
7460
|
+
"text": "prependToAdoptedStyleSheetsSymbol: "
|
|
7461
|
+
},
|
|
7462
|
+
{
|
|
7463
|
+
"kind": "Content",
|
|
7464
|
+
"text": "unique symbol"
|
|
7465
|
+
}
|
|
7466
|
+
],
|
|
7467
|
+
"releaseTag": "Public",
|
|
7468
|
+
"name": "prependToAdoptedStyleSheetsSymbol",
|
|
7469
|
+
"variableTypeTokenRange": {
|
|
7470
|
+
"startIndex": 1,
|
|
7471
|
+
"endIndex": 2
|
|
7472
|
+
}
|
|
7473
|
+
},
|
|
7453
7474
|
{
|
|
7454
7475
|
"kind": "Class",
|
|
7455
7476
|
"canonicalReference": "@microsoft/fast-element!PropertyChangeNotifier:class",
|
|
@@ -11180,7 +11201,7 @@
|
|
|
11180
11201
|
{
|
|
11181
11202
|
"kind": "Function",
|
|
11182
11203
|
"canonicalReference": "@microsoft/fast-element!when:function(1)",
|
|
11183
|
-
"docComment": "/**\n * A directive that enables basic conditional rendering in a template.\n *\n * @param binding - The condition to test for rendering.\n *\n * @param templateOrTemplateBinding - The template or a binding that gets the template to render when the condition is true.\n *\n * @public\n */\n",
|
|
11204
|
+
"docComment": "/**\n * A directive that enables basic conditional rendering in a template.\n *\n * @param binding - The condition to test for rendering.\n *\n * @param templateOrTemplateBinding - The template or a binding that gets the template to render when the condition is true.\n *\n * @param elseTemplateOrTemplateBinding - Optional template or binding that that gets the template to render when the conditional is false.\n *\n * @public\n */\n",
|
|
11184
11205
|
"excerptTokens": [
|
|
11185
11206
|
{
|
|
11186
11207
|
"kind": "Content",
|
|
@@ -11242,6 +11263,37 @@
|
|
|
11242
11263
|
"kind": "Content",
|
|
11243
11264
|
"text": ">"
|
|
11244
11265
|
},
|
|
11266
|
+
{
|
|
11267
|
+
"kind": "Content",
|
|
11268
|
+
"text": ", elseTemplateOrTemplateBinding?: "
|
|
11269
|
+
},
|
|
11270
|
+
{
|
|
11271
|
+
"kind": "Reference",
|
|
11272
|
+
"text": "SyntheticViewTemplate",
|
|
11273
|
+
"canonicalReference": "@microsoft/fast-element!SyntheticViewTemplate:interface"
|
|
11274
|
+
},
|
|
11275
|
+
{
|
|
11276
|
+
"kind": "Content",
|
|
11277
|
+
"text": " | "
|
|
11278
|
+
},
|
|
11279
|
+
{
|
|
11280
|
+
"kind": "Reference",
|
|
11281
|
+
"text": "Binding",
|
|
11282
|
+
"canonicalReference": "@microsoft/fast-element!Binding:type"
|
|
11283
|
+
},
|
|
11284
|
+
{
|
|
11285
|
+
"kind": "Content",
|
|
11286
|
+
"text": "<TSource, "
|
|
11287
|
+
},
|
|
11288
|
+
{
|
|
11289
|
+
"kind": "Reference",
|
|
11290
|
+
"text": "SyntheticViewTemplate",
|
|
11291
|
+
"canonicalReference": "@microsoft/fast-element!SyntheticViewTemplate:interface"
|
|
11292
|
+
},
|
|
11293
|
+
{
|
|
11294
|
+
"kind": "Content",
|
|
11295
|
+
"text": ">"
|
|
11296
|
+
},
|
|
11245
11297
|
{
|
|
11246
11298
|
"kind": "Content",
|
|
11247
11299
|
"text": "): "
|
|
@@ -11261,8 +11313,8 @@
|
|
|
11261
11313
|
}
|
|
11262
11314
|
],
|
|
11263
11315
|
"returnTypeTokenRange": {
|
|
11264
|
-
"startIndex":
|
|
11265
|
-
"endIndex":
|
|
11316
|
+
"startIndex": 22,
|
|
11317
|
+
"endIndex": 24
|
|
11266
11318
|
},
|
|
11267
11319
|
"releaseTag": "Public",
|
|
11268
11320
|
"overloadIndex": 1,
|
|
@@ -11282,6 +11334,14 @@
|
|
|
11282
11334
|
"endIndex": 14
|
|
11283
11335
|
},
|
|
11284
11336
|
"isOptional": false
|
|
11337
|
+
},
|
|
11338
|
+
{
|
|
11339
|
+
"parameterName": "elseTemplateOrTemplateBinding",
|
|
11340
|
+
"parameterTypeTokenRange": {
|
|
11341
|
+
"startIndex": 15,
|
|
11342
|
+
"endIndex": 21
|
|
11343
|
+
},
|
|
11344
|
+
"isOptional": true
|
|
11285
11345
|
}
|
|
11286
11346
|
],
|
|
11287
11347
|
"typeParameters": [
|
package/dist/fast-element.d.ts
CHANGED
|
@@ -1426,6 +1426,12 @@ export declare interface PartialFASTElementDefinition {
|
|
|
1426
1426
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
1427
1427
|
}
|
|
1428
1428
|
|
|
1429
|
+
/**
|
|
1430
|
+
* A Symbol that can be added to a CSSStyleSheet to cause it to be prepended (rather than appended) to adoptedStyleSheets.
|
|
1431
|
+
* @public
|
|
1432
|
+
*/
|
|
1433
|
+
export declare const prependToAdoptedStyleSheetsSymbol: unique symbol;
|
|
1434
|
+
|
|
1429
1435
|
/**
|
|
1430
1436
|
* An implementation of Notifier that allows subscribers to be notified
|
|
1431
1437
|
* of individual property changes on an object.
|
|
@@ -1958,8 +1964,10 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
|
|
|
1958
1964
|
* @param binding - The condition to test for rendering.
|
|
1959
1965
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
1960
1966
|
* the template to render when the condition is true.
|
|
1967
|
+
* @param elseTemplateOrTemplateBinding - Optional template or binding that that
|
|
1968
|
+
* gets the template to render when the conditional is false.
|
|
1961
1969
|
* @public
|
|
1962
1970
|
*/
|
|
1963
|
-
export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
1971
|
+
export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>, elseTemplateOrTemplateBinding?: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
1964
1972
|
|
|
1965
1973
|
export { }
|
package/dist/fast-element.js
CHANGED
|
@@ -1992,9 +1992,30 @@ function reduceBehaviors(styles) {
|
|
|
1992
1992
|
return prev.concat(curr);
|
|
1993
1993
|
}, null);
|
|
1994
1994
|
}
|
|
1995
|
+
/**
|
|
1996
|
+
* A Symbol that can be added to a CSSStyleSheet to cause it to be prepended (rather than appended) to adoptedStyleSheets.
|
|
1997
|
+
* @public
|
|
1998
|
+
*/
|
|
1999
|
+
|
|
2000
|
+
|
|
2001
|
+
const prependToAdoptedStyleSheetsSymbol = Symbol("prependToAdoptedStyleSheets");
|
|
2002
|
+
|
|
2003
|
+
function separateSheetsToPrepend(sheets) {
|
|
2004
|
+
const prepend = [];
|
|
2005
|
+
const append = [];
|
|
2006
|
+
sheets.forEach(x => (x[prependToAdoptedStyleSheetsSymbol] ? prepend : append).push(x));
|
|
2007
|
+
return {
|
|
2008
|
+
prepend,
|
|
2009
|
+
append
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
1995
2012
|
|
|
1996
2013
|
let addAdoptedStyleSheets = (target, sheets) => {
|
|
1997
|
-
|
|
2014
|
+
const {
|
|
2015
|
+
prepend,
|
|
2016
|
+
append
|
|
2017
|
+
} = separateSheetsToPrepend(sheets);
|
|
2018
|
+
target.adoptedStyleSheets = [...prepend, ...target.adoptedStyleSheets, ...append];
|
|
1998
2019
|
};
|
|
1999
2020
|
|
|
2000
2021
|
let removeAdoptedStyleSheets = (target, sheets) => {
|
|
@@ -2012,7 +2033,12 @@ if (DOM.supportsAdoptedStyleSheets) {
|
|
|
2012
2033
|
document.adoptedStyleSheets.splice();
|
|
2013
2034
|
|
|
2014
2035
|
addAdoptedStyleSheets = (target, sheets) => {
|
|
2015
|
-
|
|
2036
|
+
const {
|
|
2037
|
+
prepend,
|
|
2038
|
+
append
|
|
2039
|
+
} = separateSheetsToPrepend(sheets);
|
|
2040
|
+
target.adoptedStyleSheets.splice(0, 0, ...prepend);
|
|
2041
|
+
target.adoptedStyleSheets.push(...append);
|
|
2016
2042
|
};
|
|
2017
2043
|
|
|
2018
2044
|
removeAdoptedStyleSheets = (target, sheets) => {
|
|
@@ -3788,16 +3814,33 @@ function ref(propertyName) {
|
|
|
3788
3814
|
return new AttachedBehaviorHTMLDirective("fast-ref", RefBehavior, propertyName);
|
|
3789
3815
|
}
|
|
3790
3816
|
|
|
3817
|
+
/**
|
|
3818
|
+
* Determines whether or not an object is a function.
|
|
3819
|
+
* @public
|
|
3820
|
+
*/
|
|
3821
|
+
const isFunction = object => typeof object === "function";
|
|
3822
|
+
|
|
3823
|
+
const noTemplate = () => null;
|
|
3824
|
+
|
|
3825
|
+
function normalizeBinding(value) {
|
|
3826
|
+
return value === undefined ? noTemplate : isFunction(value) ? value : () => value;
|
|
3827
|
+
}
|
|
3791
3828
|
/**
|
|
3792
3829
|
* A directive that enables basic conditional rendering in a template.
|
|
3793
3830
|
* @param binding - The condition to test for rendering.
|
|
3794
3831
|
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
3795
3832
|
* the template to render when the condition is true.
|
|
3833
|
+
* @param elseTemplateOrTemplateBinding - Optional template or binding that that
|
|
3834
|
+
* gets the template to render when the conditional is false.
|
|
3796
3835
|
* @public
|
|
3797
3836
|
*/
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3837
|
+
|
|
3838
|
+
|
|
3839
|
+
function when(binding, templateOrTemplateBinding, elseTemplateOrTemplateBinding) {
|
|
3840
|
+
const dataBinding = isFunction(binding) ? binding : () => binding;
|
|
3841
|
+
const templateBinding = normalizeBinding(templateOrTemplateBinding);
|
|
3842
|
+
const elseBinding = normalizeBinding(elseTemplateOrTemplateBinding);
|
|
3843
|
+
return (source, context) => dataBinding(source, context) ? templateBinding(source, context) : elseBinding(source, context);
|
|
3801
3844
|
}
|
|
3802
3845
|
|
|
3803
3846
|
const defaultRepeatOptions = Object.freeze({
|
|
@@ -4305,4 +4348,4 @@ function children(propertyOrOptions) {
|
|
|
4305
4348
|
return new AttachedBehaviorHTMLDirective("fast-children", ChildrenBehavior, propertyOrOptions);
|
|
4306
4349
|
}
|
|
4307
4350
|
|
|
4308
|
-
export { $global, AttachedBehaviorHTMLDirective, AttributeConfiguration, AttributeDefinition, BindingBehavior, CSSDirective, ChildrenBehavior, Controller, DOM, ElementStyles, ExecutionContext, FAST, FASTElement, FASTElementDefinition, HTMLBindingDirective, HTMLDirective, HTMLView, Observable, PropertyChangeNotifier, RefBehavior, RepeatBehavior, RepeatDirective, SlottedBehavior, SubscriberSet, TargetedHTMLDirective, ViewTemplate, attr, booleanConverter, children, compileTemplate, createMetadataLocator, css, cssPartial, customElement, defaultExecutionContext, elements, emptyArray, enableArrayObservation, html, nullableNumberConverter, observable, ref, repeat, slotted, volatile, when };
|
|
4351
|
+
export { $global, AttachedBehaviorHTMLDirective, AttributeConfiguration, AttributeDefinition, BindingBehavior, CSSDirective, ChildrenBehavior, Controller, DOM, ElementStyles, ExecutionContext, FAST, FASTElement, FASTElementDefinition, HTMLBindingDirective, HTMLDirective, HTMLView, Observable, PropertyChangeNotifier, RefBehavior, RepeatBehavior, RepeatDirective, SlottedBehavior, SubscriberSet, TargetedHTMLDirective, ViewTemplate, attr, booleanConverter, children, compileTemplate, createMetadataLocator, css, cssPartial, customElement, defaultExecutionContext, elements, emptyArray, enableArrayObservation, html, nullableNumberConverter, observable, prependToAdoptedStyleSheetsSymbol, ref, repeat, slotted, volatile, when };
|
package/dist/fast-element.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;try{return new Function("return this")()}catch(t){return{}}}();void 0===t.trustedTypes&&(t.trustedTypes={createPolicy:(t,e)=>e});const e={configurable:!1,enumerable:!1,writable:!1};void 0===t.FAST&&Reflect.defineProperty(t,"FAST",Object.assign({value:Object.create(null)},e));const s=t.FAST;if(void 0===s.getById){const t=Object.create(null);Reflect.defineProperty(s,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},e))}const i=Object.freeze([]);function n(){const t=new WeakMap;return function(e){let s=t.get(e);if(void 0===s){let i=Reflect.getPrototypeOf(e);for(;void 0===s&&null!==i;)s=t.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),t.set(e,s)}return s}}const r=t.FAST.getById(1,()=>{const e=[],s=[];function i(){if(s.length)throw s.shift()}function n(t){try{t.call()}catch(t){s.push(t),setTimeout(i,0)}}function r(){let t=0;for(;t<e.length;)if(n(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}return Object.freeze({enqueue:function(s){e.length<1&&t.requestAnimationFrame(r),e.push(s)},process:r})}),o=t.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let l=o;const h="fast-"+Math.random().toString(36).substring(2,8),a=h+"{",c="}"+h,d=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(l!==o)throw new Error("The HTML policy can only be set once.");l=t},createHTML:t=>l.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(h),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(h+":","")),createInterpolationPlaceholder:t=>`${a}${t}${c}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${h}:${t}--\x3e`,queueUpdate:r.enqueue,processUpdates:r.process,nextUpdate:()=>new Promise(r.enqueue),setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)},removeChildNodes(t){for(let e=t.firstChild;null!==e;e=t.firstChild)t.removeChild(e)},createTemplateWalker:t=>document.createTreeWalker(t,133,null,!1)});class u{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover;if(void 0===e){if(this.has(t))return;if(void 0===this.sub1)return void(this.sub1=t);if(void 0===this.sub2)return void(this.sub2=t);this.spillover=[this.sub1,this.sub2,t],this.sub1=void 0,this.sub2=void 0}else{-1===e.indexOf(t)&&e.push(t)}}unsubscribe(t){const e=this.spillover;if(void 0===e)this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0);else{const s=e.indexOf(t);-1!==s&&e.splice(s,1)}}notify(t){const e=this.spillover,s=this.source;if(void 0===e){const e=this.sub1,i=this.sub2;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}else for(let i=0,n=e.length;i<n;++i)e[i].handleChange(s,t)}}class f{constructor(t){this.subscribers={},this.sourceSubscribers=null,this.source=t}notify(t){var e;const s=this.subscribers[t];void 0!==s&&s.notify(t),null===(e=this.sourceSubscribers)||void 0===e||e.notify(t)}subscribe(t,e){var s;if(e){let s=this.subscribers[e];void 0===s&&(this.subscribers[e]=s=new u(this.source)),s.subscribe(t)}else this.sourceSubscribers=null!==(s=this.sourceSubscribers)&&void 0!==s?s:new u(this.source),this.sourceSubscribers.subscribe(t)}unsubscribe(t,e){var s;if(e){const s=this.subscribers[e];void 0!==s&&s.unsubscribe(t)}else null===(s=this.sourceSubscribers)||void 0===s||s.unsubscribe(t)}}const p=s.getById(2,()=>{const t=/(:|&&|\|\||if)/,e=new WeakMap,s=d.queueUpdate;let i=void 0,r=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};function o(t){let s=t.$fastController||e.get(t);return void 0===s&&(Array.isArray(t)?s=r(t):e.set(t,s=new f(t))),s}const l=n();class h{constructor(t){this.name=t,this.field="_"+t,this.callback=t+"Changed"}getValue(t){return void 0!==i&&i.watch(t,this.name),t[this.field]}setValue(t,e){const s=this.field,i=t[s];if(i!==e){t[s]=e;const n=t[this.callback];"function"==typeof n&&n.call(t,i,e),o(t).notify(this.name)}}}class a extends u{constructor(t,e,s=!1){super(t,e),this.binding=t,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}observe(t,e){this.needsRefresh&&null!==this.last&&this.disconnect();const s=i;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const n=this.binding(t,e);return i=s,n}disconnect(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=!0}}watch(t,e){const s=this.last,n=o(t),r=null===s?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=n,n.subscribe(this,e),null!==s){if(!this.needsRefresh){let e;i=void 0,e=s.propertySource[s.propertyName],i=this,t===e&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue&&(this.needsQueue=!1,s(this))}call(){null!==this.last&&(this.needsQueue=!0,this.notify(this))}records(){let t=this.first;return{next:()=>{const e=t;return void 0===e?{value:void 0,done:!0}:(t=t.next,{value:e,done:!1})},[Symbol.iterator]:function(){return this}}}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){void 0!==i&&i.watch(t,e)},trackVolatile(){void 0!==i&&(i.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new h(e)),l(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors:l,binding(t,e,s=this.isVolatileBinding(t)){return new a(t,e,s)},isVolatileBinding:e=>t.test(e.toString())})});function g(t,e){p.defineProperty(t,e)}function b(t,e,s){return Object.assign({},s,{get:function(){return p.trackVolatile(),s.get.apply(this)}})}const v=s.getById(3,()=>{let t=null;return{get:()=>t,set(e){t=e}}});class m{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return v.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}static setEvent(t){v.set(t)}}p.defineProperty(m.prototype,"index"),p.defineProperty(m.prototype,"length");const y=Object.seal(new m);class C{constructor(){this.targetIndex=0}}class x extends C{constructor(){super(...arguments),this.createPlaceholder=d.createInterpolationPlaceholder}}class w extends C{constructor(t,e,s){super(),this.name=t,this.behavior=e,this.options=s}createPlaceholder(t){return d.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function S(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=p.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function B(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function T(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function O(){this.bindingObserver.disconnect(),this.source=null,this.context=null;const t=this.target.$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}function A(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function N(t){d.setAttribute(this.target,this.targetName,t)}function k(t){d.setBooleanAttribute(this.target,this.targetName,t)}function V(t){if(null==t&&(t=""),t.create){this.target.textContent="";let e=this.target.$fastView;void 0===e?e=t.create():this.target.$fastTemplate!==t&&(e.isComposed&&(e.remove(),e.unbind()),e=t.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(this.source,this.context)):(e.isComposed=!0,e.bind(this.source,this.context),e.insertBefore(this.target),this.target.$fastView=e,this.target.$fastTemplate=t)}else{const e=this.target.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),this.target.textContent=t}}function F(t){this.target[this.targetName]=t}function I(t){const e=this.classVersions||Object.create(null),s=this.target;let i=this.version||0;if(null!=t&&t.length){const n=t.split(/\s+/);for(let t=0,r=n.length;t<r;++t){const r=n[t];""!==r&&(e[r]=i,s.classList.add(r))}}if(this.classVersions=e,this.version=i+1,0!==i){i-=1;for(const t in e)e[t]===i&&s.classList.remove(t)}}class $ extends x{constructor(t){super(),this.binding=t,this.bind=S,this.unbind=T,this.updateTarget=N,this.isBindingVolatile=p.isVolatileBinding(this.binding)}get targetName(){return this.originalTargetName}set targetName(t){if(this.originalTargetName=t,void 0!==t)switch(t[0]){case":":if(this.cleanedTargetName=t.substr(1),this.updateTarget=F,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,s)=>d.createHTML(t(e,s))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=k;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=B,this.unbind=A;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=I)}}targetAtContent(){this.updateTarget=V,this.unbind=O}createBehavior(t){return new _(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class _{constructor(t,e,s,i,n,r,o){this.source=null,this.context=null,this.bindingObserver=null,this.target=t,this.binding=e,this.isBindingVolatile=s,this.bind=i,this.unbind=n,this.updateTarget=r,this.targetName=o}handleChange(){this.updateTarget(this.bindingObserver.observe(this.source,this.context))}handleEvent(t){m.setEvent(t);const e=this.binding(this.source,this.context);m.setEvent(null),!0!==e&&t.preventDefault()}}let M=null;class P{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){M=this}static borrow(t){const e=M||new P;return e.directives=t,e.reset(),M=null,e}}function E(t){if(1===t.length)return t[0];let e;const s=t.length,i=t.map(t=>"string"==typeof t?()=>t:(e=t.targetName||e,t.binding)),n=new $((t,e)=>{let n="";for(let r=0;r<s;++r)n+=i[r](t,e);return n});return n.targetName=e,n}const j=c.length;function L(t,e){const s=e.split(a);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(c);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));i.push(t.directives[e]),o=n.substring(r+j)}""!==o&&i.push(o)}return i}function R(t,e,s=!1){const i=e.attributes;for(let n=0,r=i.length;n<r;++n){const o=i[n],l=o.value,h=L(t,l);let a=null;null===h?s&&(a=new $(()=>l),a.targetName=o.name):a=E(h),null!==a&&(e.removeAttributeNode(o),n--,r--,t.addFactory(a))}}function z(t,e,s){const i=L(t,e.textContent);if(null!==i){let n=e;for(let r=0,o=i.length;r<o;++r){const o=i[r],l=0===r?e:n.parentNode.insertBefore(document.createTextNode(""),n.nextSibling);"string"==typeof o?l.textContent=o:(l.textContent=" ",t.captureContentBinding(o)),n=l,t.targetIndex++,l!==e&&s.nextNode()}t.targetIndex--}}function H(t,e){const s=t.content;document.adoptNode(s);const i=P.borrow(e);R(i,t,!0);const n=i.behaviorFactories;i.reset();const r=d.createTemplateWalker(s);let o;for(;o=r.nextNode();)switch(i.targetIndex++,o.nodeType){case 1:R(i,o);break;case 3:z(i,o,r);break;case 8:d.isMarker(o)&&i.addFactory(e[d.extractDirectiveIndexFromMarker(o)])}let l=0;(d.isMarker(s.firstChild)||1===s.childNodes.length&&e.length)&&(s.insertBefore(document.createComment(""),s.firstChild),l=-1);const h=i.behaviorFactories;return i.release(),{fragment:s,viewBehaviorFactories:h,hostBehaviorFactories:n,targetOffset:l}}const q=document.createRange();class Q{constructor(t,e){this.fragment=t,this.behaviors=e,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=this.lastChild;if(t.previousSibling===e)return;const s=t.parentNode;let i,n=this.firstChild;for(;n!==e;)i=n.nextSibling,s.insertBefore(n,t),n=i;s.insertBefore(e,t)}}remove(){const t=this.fragment,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.appendChild(i),i=s;t.appendChild(e)}dispose(){const t=this.firstChild.parentNode,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.removeChild(i),i=s;t.removeChild(e);const n=this.behaviors,r=this.source;for(let t=0,e=n.length;t<e;++t)n[t].unbind(r)}bind(t,e){const s=this.behaviors;if(this.source!==t)if(null!==this.source){const i=this.source;this.source=t,this.context=e;for(let n=0,r=s.length;n<r;++n){const r=s[n];r.unbind(i),r.bind(t,e)}}else{this.source=t,this.context=e;for(let i=0,n=s.length;i<n;++i)s[i].bind(t,e)}}unbind(){if(null===this.source)return;const t=this.behaviors,e=this.source;for(let s=0,i=t.length;s<i;++s)t[s].unbind(e);this.source=null}static disposeContiguousBatch(t){if(0!==t.length){q.setStartBefore(t[0].firstChild),q.setEndAfter(t[t.length-1].lastChild),q.deleteContents();for(let e=0,s=t.length;e<s;++e){const s=t[e],i=s.behaviors,n=s.source;for(let t=0,e=i.length;t<e;++t)i[t].unbind(n)}}}}class U{constructor(t,e){this.behaviorCount=0,this.hasHostBehaviors=!1,this.fragment=null,this.targetOffset=0,this.viewBehaviorFactories=null,this.hostBehaviorFactories=null,this.html=t,this.directives=e}create(t){if(null===this.fragment){let t;const e=this.html;if("string"==typeof e){t=document.createElement("template"),t.innerHTML=d.createHTML(e);const s=t.content.firstElementChild;null!==s&&"TEMPLATE"===s.tagName&&(t=s)}else t=e;const s=H(t,this.directives);this.fragment=s.fragment,this.viewBehaviorFactories=s.viewBehaviorFactories,this.hostBehaviorFactories=s.hostBehaviorFactories,this.targetOffset=s.targetOffset,this.behaviorCount=this.viewBehaviorFactories.length+this.hostBehaviorFactories.length,this.hasHostBehaviors=this.hostBehaviorFactories.length>0}const e=this.fragment.cloneNode(!0),s=this.viewBehaviorFactories,i=new Array(this.behaviorCount),n=d.createTemplateWalker(e);let r=0,o=this.targetOffset,l=n.nextNode();for(let t=s.length;r<t;++r){const t=s[r],e=t.targetIndex;for(;null!==l;){if(o===e){i[r]=t.createBehavior(l);break}l=n.nextNode(),o++}}if(this.hasHostBehaviors){const e=this.hostBehaviorFactories;for(let s=0,n=e.length;s<n;++s,++r)i[r]=e[s].createBehavior(t)}return new Q(e,i)}render(t,e,s){"string"==typeof e&&(e=document.getElementById(e)),void 0===s&&(s=e);const i=this.create(s);return i.bind(t,y),i.appendTo(e),i}}const W=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function D(t,...e){const s=[];let i="";for(let n=0,r=t.length-1;n<r;++n){const r=t[n];let o=e[n];if(i+=r,o instanceof U){const t=o;o=()=>t}if("function"==typeof o&&(o=new $(o)),o instanceof x){const t=W.exec(r);null!==t&&(o.targetName=t[2])}o instanceof C?(i+=o.createPlaceholder(s.length),s.push(o)):i+=o}return i+=t[t.length-1],new U(i,s)}class G{constructor(){this.targets=new WeakSet}addStylesTo(t){this.targets.add(t)}removeStylesFrom(t){this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}}function J(t){return t.map(t=>t instanceof G?J(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function K(t){return t.map(t=>t instanceof G?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}G.create=(()=>{if(d.supportsAdoptedStyleSheets){const t=new Map;return e=>new Z(e,t)}return t=>new et(t)})();let X=(t,e)=>{t.adoptedStyleSheets=[...t.adoptedStyleSheets,...e]},Y=(t,e)=>{t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>-1===e.indexOf(t))};if(d.supportsAdoptedStyleSheets)try{document.adoptedStyleSheets.push(),document.adoptedStyleSheets.splice(),X=(t,e)=>{t.adoptedStyleSheets.push(...e)},Y=(t,e)=>{for(const s of e){const e=t.adoptedStyleSheets.indexOf(s);-1!==e&&t.adoptedStyleSheets.splice(e,1)}}}catch(t){}class Z extends G{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=K(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=J(t).map(t=>{if(t instanceof CSSStyleSheet)return t;let s=e.get(t);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(t),e.set(t,s)),s})}return this._styleSheets}addStylesTo(t){X(t,this.styleSheets),super.addStylesTo(t)}removeStylesFrom(t){Y(t,this.styleSheets),super.removeStylesFrom(t)}}let tt=0;class et extends G{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=K(t),this.styleSheets=J(t),this.styleClass="fast-style-class-"+ ++tt}addStylesTo(t){const e=this.styleSheets,s=this.styleClass;t=this.normalizeTarget(t);for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}super.addStylesTo(t)}removeStylesFrom(t){const e=(t=this.normalizeTarget(t)).querySelectorAll("."+this.styleClass);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s]);super.removeStylesFrom(t)}isAttachedTo(t){return super.isAttachedTo(this.normalizeTarget(t))}normalizeTarget(t){return t===document?document.body:t}}const st=Object.freeze({locate:n()}),it={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},nt={toView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e.toString()},fromView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}};class rt{constructor(t,e,s=e.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=s,this.mode=i,this.converter=n,this.fieldName="_"+e,this.callbackName=e+"Changed",this.hasCallback=this.callbackName in t.prototype,"boolean"===i&&void 0===n&&(this.converter=it)}setValue(t,e){const s=t[this.fieldName],i=this.converter;void 0!==i&&(e=i.fromView(e)),s!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](s,e),t.$fastController.notify(this.name))}getValue(t){return p.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,s=this.guards;s.has(t)||"fromView"===e||d.queueUpdate(()=>{s.add(t);const i=t[this.fieldName];switch(e){case"reflect":const e=this.converter;d.setAttribute(t,this.attribute,void 0!==e?e.toView(i):i);break;case"boolean":d.setBooleanAttribute(t,this.attribute,i)}s.delete(t)})}static collect(t,...e){const s=[];e.push(st.locate(t));for(let i=0,n=e.length;i<n;++i){const n=e[i];if(void 0!==n)for(let e=0,i=n.length;e<i;++e){const i=n[e];"string"==typeof i?s.push(new rt(t,i)):s.push(new rt(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function ot(t,e){let s;function i(t,e){arguments.length>1&&(s.property=e),st.locate(t.constructor).push(s)}return arguments.length>1?(s={},void i(t,e)):(s=void 0===t?{}:t,i)}const lt={mode:"open"},ht={},at=s.getById(4,()=>{const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e)})});class ct{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=rt.collect(t,e.attributes),i=new Array(s.length),n={},r={};for(let t=0,e=s.length;t<e;++t){const e=s[t];i[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=s,this.observedAttributes=i,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?lt:null===e.shadowOptions?void 0:Object.assign(Object.assign({},lt),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ht:Object.assign(Object.assign({},ht),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?G.create(e.styles):e.styles instanceof G?e.styles:G.create([e.styles])}get isDefined(){return!!at.getByType(this.type)}define(t=customElements){const e=this.type;if(at.register(this)){const t=this.attributes,s=e.prototype;for(let e=0,i=t.length;e<i;++e)p.defineProperty(s,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}}ct.forType=at.getByType;const dt=new WeakMap,ut={bubbles:!0,composed:!0,cancelable:!0};function ft(t){return t.shadowRoot||dt.get(t)||null}class pt extends f{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const s=e.shadowOptions;if(void 0!==s){const e=t.attachShadow(s);"closed"===s.mode&&dt.set(t,e)}const i=p.getAccessors(t);if(i.length>0){const e=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return p.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,p.notify(this,"isConnected")}get template(){return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||null===t||this.addStyles(t))}addStyles(t){const e=ft(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){const e=ft(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){const e=this.behaviors||(this.behaviors=new Map),s=t.length,i=[];for(let n=0;n<s;++n){const s=t[n];e.has(s)?e.set(s,e.get(s)+1):(e.set(s,1),i.push(s))}if(this._isConnected){const t=this.element;for(let e=0;e<i.length;++e)i[e].bind(t,y)}}removeBehaviors(t,e=!1){const s=this.behaviors;if(null===s)return;const i=t.length,n=[];for(let r=0;r<i;++r){const i=t[r];if(s.has(i)){const t=s.get(i)-1;0===t||e?s.delete(i)&&n.push(i):s.set(i,t)}}if(this._isConnected){const t=this.element;for(let e=0;e<n.length;++e)n[e].unbind(t)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,y);const e=this.behaviors;if(null!==e)for(const[s]of e)s.bind(t,y);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element;for(const[s]of e)s.unbind(t)}}onAttributeChangedCallback(t,e,s){const i=this.definition.attributeLookup[t];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(t,e,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},ut),s)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const s=Object.keys(e);for(let i=0,n=s.length;i<n;++i){const n=s[i];t[n]=e[n]}this.boundObservables=null}const s=this.definition;null===this._template&&(this.element.resolveTemplate?this._template=this.element.resolveTemplate():s.template&&(this._template=s.template||null)),null!==this._template&&this.renderTemplate(this._template),null===this._styles&&(this.element.resolveStyles?this._styles=this.element.resolveStyles():s.styles&&(this._styles=s.styles||null)),null!==this._styles&&this.addStyles(this._styles),this.needsInitialization=!1}renderTemplate(t){const e=this.element,s=ft(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||d.removeChildNodes(s),t&&(this.view=t.render(e,s,e))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=ct.forType(t.constructor);if(void 0===s)throw new Error("Missing FASTElement definition.");return t.$fastController=new pt(t,s)}}function gt(t){return class extends t{constructor(){super(),pt.forCustomElement(this)}$emit(t,e,s){return this.$fastController.emit(t,e,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,s){this.$fastController.onAttributeChangedCallback(t,e,s)}}}const bt=Object.assign(gt(HTMLElement),{from:t=>gt(t),define:(t,e)=>new ct(t,e).define().type});function vt(t){return function(e){new ct(e,t).define()}}class mt{createCSS(){return""}createBehavior(){}}function yt(t,e){const s=[];let i="";const n=[];for(let r=0,o=t.length-1;r<o;++r){i+=t[r];let o=e[r];if(o instanceof mt){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof G||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=t[t.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}function Ct(t,...e){const{styles:s,behaviors:i}=yt(t,e),n=G.create(s);return i.length&&n.withBehaviors(...i),n}class xt extends mt{constructor(t,e){super(),this.behaviors=e,this.css="";const s=t.reduce((t,e)=>("string"==typeof e?this.css+=e:t.push(e),t),[]);s.length&&(this.styles=G.create(s))}createBehavior(){return this}createCSS(){return this.css}bind(t){this.styles&&t.$fastController.addStyles(this.styles),this.behaviors.length&&t.$fastController.addBehaviors(this.behaviors)}unbind(t){this.styles&&t.$fastController.removeStyles(this.styles),this.behaviors.length&&t.$fastController.removeBehaviors(this.behaviors)}}function wt(t,...e){const{styles:s,behaviors:i}=yt(t,e);return new xt(s,i)}function St(t,e,s){return{index:t,removed:e,addedCount:s}}function Bt(t,e,s,n,r,o){let l=0,h=0;const a=Math.min(s-e,o-r);if(0===e&&0===r&&(l=function(t,e,s){for(let i=0;i<s;++i)if(t[i]!==e[i])return i;return s}(t,n,a)),s===t.length&&o===n.length&&(h=function(t,e,s){let i=t.length,n=e.length,r=0;for(;r<s&&t[--i]===e[--n];)r++;return r}(t,n,a-l)),r+=l,o-=h,(s-=h)-(e+=l)==0&&o-r==0)return i;if(e===s){const t=St(e,[],0);for(;r<o;)t.removed.push(n[r++]);return[t]}if(r===o)return[St(e,[],s-e)];const c=function(t){let e=t.length-1,s=t[0].length-1,i=t[e][s];const n=[];for(;e>0||s>0;){if(0===e){n.push(2),s--;continue}if(0===s){n.push(3),e--;continue}const r=t[e-1][s-1],o=t[e-1][s],l=t[e][s-1];let h;h=o<l?o<r?o:r:l<r?l:r,h===r?(r===i?n.push(0):(n.push(1),i=r),e--,s--):h===o?(n.push(3),e--,i=o):(n.push(2),s--,i=l)}return n.reverse(),n}(function(t,e,s,i,n,r){const o=r-n+1,l=s-e+1,h=new Array(o);let a,c;for(let t=0;t<o;++t)h[t]=new Array(l),h[t][0]=t;for(let t=0;t<l;++t)h[0][t]=t;for(let s=1;s<o;++s)for(let r=1;r<l;++r)t[e+r-1]===i[n+s-1]?h[s][r]=h[s-1][r-1]:(a=h[s-1][r]+1,c=h[s][r-1]+1,h[s][r]=a<c?a:c);return h}(t,e,s,n,r,o)),d=[];let u=void 0,f=e,p=r;for(let t=0;t<c.length;++t)switch(c[t]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=St(f,[],0)),u.addedCount++,f++,u.removed.push(n[p]),p++;break;case 2:void 0===u&&(u=St(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=St(f,[],0)),u.removed.push(n[p]),p++}return void 0!==u&&d.push(u),d}const Tt=Array.prototype.push;function Ot(t,e,s,i){const n=St(e,s,i);let r=!1,o=0;for(let e=0;e<t.length;e++){const s=t[e];if(s.index+=o,r)continue;const i=(l=n.index,h=n.index+n.removed.length,a=s.index,c=s.index+s.addedCount,h<a||c<l?-1:h===a||c===l?0:l<a?h<c?h-a:c-a:c<h?c-l:h-l);if(i>=0){t.splice(e,1),e--,o-=s.addedCount-s.removed.length,n.addedCount+=s.addedCount-i;const l=n.removed.length+s.removed.length-i;if(n.addedCount||l){let t=s.removed;if(n.index<s.index){const e=n.removed.slice(0,s.index-n.index);Tt.apply(e,t),t=e}if(n.index+n.removed.length>s.index+s.addedCount){const e=n.removed.slice(s.index+s.addedCount-n.index);Tt.apply(t,e)}n.removed=t,s.index<n.index&&(n.index=s.index)}else r=!0}else if(n.index<s.index){r=!0,t.splice(e,0,n),e++;const i=n.addedCount-n.removed.length;s.index+=i,o+=i}}var l,h,a,c;r||t.push(n)}function At(t,e){let s=[];const i=function(t){const e=[];for(let s=0,i=t.length;s<i;s++){const i=t[s];Ot(e,i.index,i.removed,i.addedCount)}return e}(e);for(let e=0,n=i.length;e<n;++e){const n=i[e];1!==n.addedCount||1!==n.removed.length?s=s.concat(Bt(t,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==t[n.index]&&s.push(n)}return s}let Nt=!1;function kt(t,e){let s=t.index;const i=e.length;return s>i?s=i-t.addedCount:s<0&&(s=i+t.removed.length+s-t.addedCount),s<0&&(s=0),t.index=s,t}class Vt extends u{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(t,"$fastController",{value:this,enumerable:!1})}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,d.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,d.queueUpdate(this))}flush(){const t=this.splices,e=this.oldCollection;if(void 0===t&&void 0===e)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const s=void 0===e?At(this.source,t):Bt(this.source,0,this.source.length,e,0,e.length);this.notify(s)}}function Ft(){if(Nt)return;Nt=!0,p.setArrayObserverFactory(t=>new Vt(t));const t=Array.prototype;if(t.$fastPatch)return;Reflect.defineProperty(t,"$fastPatch",{value:1,enumerable:!1});const e=t.pop,s=t.push,i=t.reverse,n=t.shift,r=t.sort,o=t.splice,l=t.unshift;t.pop=function(){const t=this.length>0,s=e.apply(this,arguments),i=this.$fastController;return void 0!==i&&t&&i.addSplice(St(this.length,[s],0)),s},t.push=function(){const t=s.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(kt(St(this.length-arguments.length,[],arguments.length),this)),t},t.reverse=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const s=i.apply(this,arguments);return void 0!==e&&e.reset(t),s},t.shift=function(){const t=this.length>0,e=n.apply(this,arguments),s=this.$fastController;return void 0!==s&&t&&s.addSplice(St(0,[e],0)),e},t.sort=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const s=r.apply(this,arguments);return void 0!==e&&e.reset(t),s},t.splice=function(){const t=o.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(kt(St(+arguments[0],t,arguments.length>2?arguments.length-2:0),this)),t},t.unshift=function(){const t=l.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(kt(St(0,[],arguments.length),this)),t}}class It{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function $t(t){return new w("fast-ref",It,t)}function _t(t,e){const s="function"==typeof e?e:()=>e;return(e,i)=>t(e,i)?s(e,i):null}const Mt=Object.freeze({positioning:!1,recycle:!0});function Pt(t,e,s,i){t.bind(e[s],i)}function Et(t,e,s,i){const n=Object.create(i);n.index=s,n.length=e.length,t.bind(e[s],n)}class jt{constructor(t,e,s,i,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=i,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.originalContext=void 0,this.childContext=void 0,this.bindView=Pt,this.itemsBindingObserver=p.binding(e,this,s),this.templateBindingObserver=p.binding(i,this,n),r.positioning&&(this.bindView=Et)}bind(t,e){this.source=t,this.originalContext=e,this.childContext=Object.create(e),this.childContext.parent=t,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(t,this.originalContext),this.template=this.templateBindingObserver.observe(t,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=i);const e=this.itemsObserver,s=this.itemsObserver=p.getNotifier(this.items),n=e!==s;n&&null!==e&&e.unsubscribe(this),(n||t)&&s.subscribe(this)}updateViews(t){const e=this.childContext,s=this.views,i=this.bindView,n=this.items,r=this.template,o=this.options.recycle,l=[];let h=0,a=0;for(let c=0,d=t.length;c<d;++c){const d=t[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=s.splice(d.index,u.length),v=a=l.length+b.length;for(;p<g;++p){const t=s[p],c=t?t.firstChild:this.location;let d;o&&a>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[h],h++),a--):d=r.create(),s.splice(p,0,d),i(d,n,p,e),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let t=h,e=l.length;t<e;++t)l[t].dispose();if(this.options.positioning)for(let t=0,e=s.length;t<e;++t){const i=s[t].context;i.length=e,i.index=t}}refreshAllViews(t=!1){const e=this.items,s=this.childContext,i=this.template,n=this.location,r=this.bindView;let o=e.length,l=this.views,h=l.length;if(0!==o&&!t&&this.options.recycle||(Q.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=i.create();r(o,e,t,s),l[t]=o,o.insertBefore(n)}}else{let t=0;for(;t<o;++t)if(t<h){r(l[t],e,t,s)}else{const o=i.create();r(o,e,t,s),l.push(o),o.insertBefore(n)}const a=l.splice(t,h-t);for(t=0,o=a.length;t<o;++t)a[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}class Lt extends C{constructor(t,e,s){super(),this.itemsBinding=t,this.templateBinding=e,this.options=s,this.createPlaceholder=d.createBlockPlaceholder,Ft(),this.isItemsBindingVolatile=p.isVolatileBinding(t),this.isTemplateBindingVolatile=p.isVolatileBinding(e)}createBehavior(t){return new jt(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Rt(t,e,s=Mt){return new Lt(t,"function"==typeof e?e:()=>e,Object.assign(Object.assign({},Mt),s))}function zt(t){return t?function(e,s,i){return 1===e.nodeType&&e.matches(t)}:function(t,e,s){return 1===t.nodeType}}class Ht{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=p.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(i),this.source=null,this.shouldUpdate&&this.disconnect()}handleEvent(){this.updateTarget(this.computeNodes())}computeNodes(){let t=this.getNodes();return void 0!==this.options.filter&&(t=t.filter(this.options.filter)),t}updateTarget(t){this.source[this.options.property]=t}}class qt extends Ht{constructor(t,e){super(t,e)}observe(){this.target.addEventListener("slotchange",this)}disconnect(){this.target.removeEventListener("slotchange",this)}getNodes(){return this.target.assignedNodes(this.options)}}function Qt(t){return"string"==typeof t&&(t={property:t}),new w("fast-slotted",qt,t)}class Ut extends Ht{constructor(t,e){super(t,e),this.observer=null,e.childList=!0}observe(){null===this.observer&&(this.observer=new MutationObserver(this.handleEvent.bind(this))),this.observer.observe(this.target,this.options)}disconnect(){this.observer.disconnect()}getNodes(){return"subtree"in this.options?Array.from(this.target.querySelectorAll(this.options.selector)):Array.from(this.target.childNodes)}}function Wt(t){return"string"==typeof t&&(t={property:t}),new w("fast-children",Ut,t)}export{t as $global,w as AttachedBehaviorHTMLDirective,st as AttributeConfiguration,rt as AttributeDefinition,_ as BindingBehavior,mt as CSSDirective,Ut as ChildrenBehavior,pt as Controller,d as DOM,G as ElementStyles,m as ExecutionContext,s as FAST,bt as FASTElement,ct as FASTElementDefinition,$ as HTMLBindingDirective,C as HTMLDirective,Q as HTMLView,p as Observable,f as PropertyChangeNotifier,It as RefBehavior,jt as RepeatBehavior,Lt as RepeatDirective,qt as SlottedBehavior,u as SubscriberSet,x as TargetedHTMLDirective,U as ViewTemplate,ot as attr,it as booleanConverter,Wt as children,H as compileTemplate,n as createMetadataLocator,Ct as css,wt as cssPartial,vt as customElement,y as defaultExecutionContext,zt as elements,i as emptyArray,Ft as enableArrayObservation,D as html,nt as nullableNumberConverter,g as observable,$t as ref,Rt as repeat,Qt as slotted,b as volatile,_t as when};
|
|
1
|
+
const t=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof global)return global;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;try{return new Function("return this")()}catch(t){return{}}}();void 0===t.trustedTypes&&(t.trustedTypes={createPolicy:(t,e)=>e});const e={configurable:!1,enumerable:!1,writable:!1};void 0===t.FAST&&Reflect.defineProperty(t,"FAST",Object.assign({value:Object.create(null)},e));const s=t.FAST;if(void 0===s.getById){const t=Object.create(null);Reflect.defineProperty(s,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},e))}const i=Object.freeze([]);function n(){const t=new WeakMap;return function(e){let s=t.get(e);if(void 0===s){let i=Reflect.getPrototypeOf(e);for(;void 0===s&&null!==i;)s=t.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),t.set(e,s)}return s}}const r=t.FAST.getById(1,()=>{const e=[],s=[];function i(){if(s.length)throw s.shift()}function n(t){try{t.call()}catch(t){s.push(t),setTimeout(i,0)}}function r(){let t=0;for(;t<e.length;)if(n(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}return Object.freeze({enqueue:function(s){e.length<1&&t.requestAnimationFrame(r),e.push(s)},process:r})}),o=t.trustedTypes.createPolicy("fast-html",{createHTML:t=>t});let l=o;const h="fast-"+Math.random().toString(36).substring(2,8),a=h+"{",c="}"+h,d=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(l!==o)throw new Error("The HTML policy can only be set once.");l=t},createHTML:t=>l.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(h),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(h+":","")),createInterpolationPlaceholder:t=>`${a}${t}${c}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${h}:${t}--\x3e`,queueUpdate:r.enqueue,processUpdates:r.process,nextUpdate:()=>new Promise(r.enqueue),setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)},removeChildNodes(t){for(let e=t.firstChild;null!==e;e=t.firstChild)t.removeChild(e)},createTemplateWalker:t=>document.createTreeWalker(t,133,null,!1)});class u{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover;if(void 0===e){if(this.has(t))return;if(void 0===this.sub1)return void(this.sub1=t);if(void 0===this.sub2)return void(this.sub2=t);this.spillover=[this.sub1,this.sub2,t],this.sub1=void 0,this.sub2=void 0}else{-1===e.indexOf(t)&&e.push(t)}}unsubscribe(t){const e=this.spillover;if(void 0===e)this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0);else{const s=e.indexOf(t);-1!==s&&e.splice(s,1)}}notify(t){const e=this.spillover,s=this.source;if(void 0===e){const e=this.sub1,i=this.sub2;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}else for(let i=0,n=e.length;i<n;++i)e[i].handleChange(s,t)}}class f{constructor(t){this.subscribers={},this.sourceSubscribers=null,this.source=t}notify(t){var e;const s=this.subscribers[t];void 0!==s&&s.notify(t),null===(e=this.sourceSubscribers)||void 0===e||e.notify(t)}subscribe(t,e){var s;if(e){let s=this.subscribers[e];void 0===s&&(this.subscribers[e]=s=new u(this.source)),s.subscribe(t)}else this.sourceSubscribers=null!==(s=this.sourceSubscribers)&&void 0!==s?s:new u(this.source),this.sourceSubscribers.subscribe(t)}unsubscribe(t,e){var s;if(e){const s=this.subscribers[e];void 0!==s&&s.unsubscribe(t)}else null===(s=this.sourceSubscribers)||void 0===s||s.unsubscribe(t)}}const p=s.getById(2,()=>{const t=/(:|&&|\|\||if)/,e=new WeakMap,s=d.queueUpdate;let i=void 0,r=t=>{throw new Error("Must call enableArrayObservation before observing arrays.")};function o(t){let s=t.$fastController||e.get(t);return void 0===s&&(Array.isArray(t)?s=r(t):e.set(t,s=new f(t))),s}const l=n();class h{constructor(t){this.name=t,this.field="_"+t,this.callback=t+"Changed"}getValue(t){return void 0!==i&&i.watch(t,this.name),t[this.field]}setValue(t,e){const s=this.field,i=t[s];if(i!==e){t[s]=e;const n=t[this.callback];"function"==typeof n&&n.call(t,i,e),o(t).notify(this.name)}}}class a extends u{constructor(t,e,s=!1){super(t,e),this.binding=t,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}observe(t,e){this.needsRefresh&&null!==this.last&&this.disconnect();const s=i;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const n=this.binding(t,e);return i=s,n}disconnect(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=!0}}watch(t,e){const s=this.last,n=o(t),r=null===s?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=n,n.subscribe(this,e),null!==s){if(!this.needsRefresh){let e;i=void 0,e=s.propertySource[s.propertyName],i=this,t===e&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue&&(this.needsQueue=!1,s(this))}call(){null!==this.last&&(this.needsQueue=!0,this.notify(this))}records(){let t=this.first;return{next:()=>{const e=t;return void 0===e?{value:void 0,done:!0}:(t=t.next,{value:e,done:!1})},[Symbol.iterator]:function(){return this}}}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){void 0!==i&&i.watch(t,e)},trackVolatile(){void 0!==i&&(i.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){"string"==typeof e&&(e=new h(e)),l(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get:function(){return e.getValue(this)},set:function(t){e.setValue(this,t)}})},getAccessors:l,binding(t,e,s=this.isVolatileBinding(t)){return new a(t,e,s)},isVolatileBinding:e=>t.test(e.toString())})});function g(t,e){p.defineProperty(t,e)}function b(t,e,s){return Object.assign({},s,{get:function(){return p.trackVolatile(),s.get.apply(this)}})}const v=s.getById(3,()=>{let t=null;return{get:()=>t,set(e){t=e}}});class m{constructor(){this.index=0,this.length=0,this.parent=null,this.parentContext=null}get event(){return v.get()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}static setEvent(t){v.set(t)}}p.defineProperty(m.prototype,"index"),p.defineProperty(m.prototype,"length");const y=Object.seal(new m);class C{constructor(){this.targetIndex=0}}class x extends C{constructor(){super(...arguments),this.createPlaceholder=d.createInterpolationPlaceholder}}class S extends C{constructor(t,e,s){super(),this.name=t,this.behavior=e,this.options=s}createPlaceholder(t){return d.createCustomAttributePlaceholder(this.name,t)}createBehavior(t){return new this.behavior(t,this.options)}}function w(t,e){this.source=t,this.context=e,null===this.bindingObserver&&(this.bindingObserver=p.binding(this.binding,this,this.isBindingVolatile)),this.updateTarget(this.bindingObserver.observe(t,e))}function B(t,e){this.source=t,this.context=e,this.target.addEventListener(this.targetName,this)}function T(){this.bindingObserver.disconnect(),this.source=null,this.context=null}function O(){this.bindingObserver.disconnect(),this.source=null,this.context=null;const t=this.target.$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}function A(){this.target.removeEventListener(this.targetName,this),this.source=null,this.context=null}function N(t){d.setAttribute(this.target,this.targetName,t)}function k(t){d.setBooleanAttribute(this.target,this.targetName,t)}function V(t){if(null==t&&(t=""),t.create){this.target.textContent="";let e=this.target.$fastView;void 0===e?e=t.create():this.target.$fastTemplate!==t&&(e.isComposed&&(e.remove(),e.unbind()),e=t.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(this.source,this.context)):(e.isComposed=!0,e.bind(this.source,this.context),e.insertBefore(this.target),this.target.$fastView=e,this.target.$fastTemplate=t)}else{const e=this.target.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),this.target.textContent=t}}function F(t){this.target[this.targetName]=t}function I(t){const e=this.classVersions||Object.create(null),s=this.target;let i=this.version||0;if(null!=t&&t.length){const n=t.split(/\s+/);for(let t=0,r=n.length;t<r;++t){const r=n[t];""!==r&&(e[r]=i,s.classList.add(r))}}if(this.classVersions=e,this.version=i+1,0!==i){i-=1;for(const t in e)e[t]===i&&s.classList.remove(t)}}class $ extends x{constructor(t){super(),this.binding=t,this.bind=w,this.unbind=T,this.updateTarget=N,this.isBindingVolatile=p.isVolatileBinding(this.binding)}get targetName(){return this.originalTargetName}set targetName(t){if(this.originalTargetName=t,void 0!==t)switch(t[0]){case":":if(this.cleanedTargetName=t.substr(1),this.updateTarget=F,"innerHTML"===this.cleanedTargetName){const t=this.binding;this.binding=(e,s)=>d.createHTML(t(e,s))}break;case"?":this.cleanedTargetName=t.substr(1),this.updateTarget=k;break;case"@":this.cleanedTargetName=t.substr(1),this.bind=B,this.unbind=A;break;default:this.cleanedTargetName=t,"class"===t&&(this.updateTarget=I)}}targetAtContent(){this.updateTarget=V,this.unbind=O}createBehavior(t){return new _(t,this.binding,this.isBindingVolatile,this.bind,this.unbind,this.updateTarget,this.cleanedTargetName)}}class _{constructor(t,e,s,i,n,r,o){this.source=null,this.context=null,this.bindingObserver=null,this.target=t,this.binding=e,this.isBindingVolatile=s,this.bind=i,this.unbind=n,this.updateTarget=r,this.targetName=o}handleChange(){this.updateTarget(this.bindingObserver.observe(this.source,this.context))}handleEvent(t){m.setEvent(t);const e=this.binding(this.source,this.context);m.setEvent(null),!0!==e&&t.preventDefault()}}let E=null;class M{addFactory(t){t.targetIndex=this.targetIndex,this.behaviorFactories.push(t)}captureContentBinding(t){t.targetAtContent(),this.addFactory(t)}reset(){this.behaviorFactories=[],this.targetIndex=-1}release(){E=this}static borrow(t){const e=E||new M;return e.directives=t,e.reset(),E=null,e}}function P(t){if(1===t.length)return t[0];let e;const s=t.length,i=t.map(t=>"string"==typeof t?()=>t:(e=t.targetName||e,t.binding)),n=new $((t,e)=>{let n="";for(let r=0;r<s;++r)n+=i[r](t,e);return n});return n.targetName=e,n}const j=c.length;function L(t,e){const s=e.split(a);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(c);let o;if(-1===r)o=n;else{const e=parseInt(n.substring(0,r));i.push(t.directives[e]),o=n.substring(r+j)}""!==o&&i.push(o)}return i}function R(t,e,s=!1){const i=e.attributes;for(let n=0,r=i.length;n<r;++n){const o=i[n],l=o.value,h=L(t,l);let a=null;null===h?s&&(a=new $(()=>l),a.targetName=o.name):a=P(h),null!==a&&(e.removeAttributeNode(o),n--,r--,t.addFactory(a))}}function z(t,e,s){const i=L(t,e.textContent);if(null!==i){let n=e;for(let r=0,o=i.length;r<o;++r){const o=i[r],l=0===r?e:n.parentNode.insertBefore(document.createTextNode(""),n.nextSibling);"string"==typeof o?l.textContent=o:(l.textContent=" ",t.captureContentBinding(o)),n=l,t.targetIndex++,l!==e&&s.nextNode()}t.targetIndex--}}function H(t,e){const s=t.content;document.adoptNode(s);const i=M.borrow(e);R(i,t,!0);const n=i.behaviorFactories;i.reset();const r=d.createTemplateWalker(s);let o;for(;o=r.nextNode();)switch(i.targetIndex++,o.nodeType){case 1:R(i,o);break;case 3:z(i,o,r);break;case 8:d.isMarker(o)&&i.addFactory(e[d.extractDirectiveIndexFromMarker(o)])}let l=0;(d.isMarker(s.firstChild)||1===s.childNodes.length&&e.length)&&(s.insertBefore(document.createComment(""),s.firstChild),l=-1);const h=i.behaviorFactories;return i.release(),{fragment:s,viewBehaviorFactories:h,hostBehaviorFactories:n,targetOffset:l}}const q=document.createRange();class Q{constructor(t,e){this.fragment=t,this.behaviors=e,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=this.lastChild;if(t.previousSibling===e)return;const s=t.parentNode;let i,n=this.firstChild;for(;n!==e;)i=n.nextSibling,s.insertBefore(n,t),n=i;s.insertBefore(e,t)}}remove(){const t=this.fragment,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.appendChild(i),i=s;t.appendChild(e)}dispose(){const t=this.firstChild.parentNode,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.removeChild(i),i=s;t.removeChild(e);const n=this.behaviors,r=this.source;for(let t=0,e=n.length;t<e;++t)n[t].unbind(r)}bind(t,e){const s=this.behaviors;if(this.source!==t)if(null!==this.source){const i=this.source;this.source=t,this.context=e;for(let n=0,r=s.length;n<r;++n){const r=s[n];r.unbind(i),r.bind(t,e)}}else{this.source=t,this.context=e;for(let i=0,n=s.length;i<n;++i)s[i].bind(t,e)}}unbind(){if(null===this.source)return;const t=this.behaviors,e=this.source;for(let s=0,i=t.length;s<i;++s)t[s].unbind(e);this.source=null}static disposeContiguousBatch(t){if(0!==t.length){q.setStartBefore(t[0].firstChild),q.setEndAfter(t[t.length-1].lastChild),q.deleteContents();for(let e=0,s=t.length;e<s;++e){const s=t[e],i=s.behaviors,n=s.source;for(let t=0,e=i.length;t<e;++t)i[t].unbind(n)}}}}class U{constructor(t,e){this.behaviorCount=0,this.hasHostBehaviors=!1,this.fragment=null,this.targetOffset=0,this.viewBehaviorFactories=null,this.hostBehaviorFactories=null,this.html=t,this.directives=e}create(t){if(null===this.fragment){let t;const e=this.html;if("string"==typeof e){t=document.createElement("template"),t.innerHTML=d.createHTML(e);const s=t.content.firstElementChild;null!==s&&"TEMPLATE"===s.tagName&&(t=s)}else t=e;const s=H(t,this.directives);this.fragment=s.fragment,this.viewBehaviorFactories=s.viewBehaviorFactories,this.hostBehaviorFactories=s.hostBehaviorFactories,this.targetOffset=s.targetOffset,this.behaviorCount=this.viewBehaviorFactories.length+this.hostBehaviorFactories.length,this.hasHostBehaviors=this.hostBehaviorFactories.length>0}const e=this.fragment.cloneNode(!0),s=this.viewBehaviorFactories,i=new Array(this.behaviorCount),n=d.createTemplateWalker(e);let r=0,o=this.targetOffset,l=n.nextNode();for(let t=s.length;r<t;++r){const t=s[r],e=t.targetIndex;for(;null!==l;){if(o===e){i[r]=t.createBehavior(l);break}l=n.nextNode(),o++}}if(this.hasHostBehaviors){const e=this.hostBehaviorFactories;for(let s=0,n=e.length;s<n;++s,++r)i[r]=e[s].createBehavior(t)}return new Q(e,i)}render(t,e,s){"string"==typeof e&&(e=document.getElementById(e)),void 0===s&&(s=e);const i=this.create(s);return i.bind(t,y),i.appendTo(e),i}}const W=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function D(t,...e){const s=[];let i="";for(let n=0,r=t.length-1;n<r;++n){const r=t[n];let o=e[n];if(i+=r,o instanceof U){const t=o;o=()=>t}if("function"==typeof o&&(o=new $(o)),o instanceof x){const t=W.exec(r);null!==t&&(o.targetName=t[2])}o instanceof C?(i+=o.createPlaceholder(s.length),s.push(o)):i+=o}return i+=t[t.length-1],new U(i,s)}class G{constructor(){this.targets=new WeakSet}addStylesTo(t){this.targets.add(t)}removeStylesFrom(t){this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}}function J(t){return t.map(t=>t instanceof G?J(t.styles):[t]).reduce((t,e)=>t.concat(e),[])}function K(t){return t.map(t=>t instanceof G?t.behaviors:null).reduce((t,e)=>null===e?t:(null===t&&(t=[]),t.concat(e)),null)}G.create=(()=>{if(d.supportsAdoptedStyleSheets){const t=new Map;return e=>new et(e,t)}return t=>new it(t)})();const X=Symbol("prependToAdoptedStyleSheets");function Y(t){const e=[],s=[];return t.forEach(t=>(t[X]?e:s).push(t)),{prepend:e,append:s}}let Z=(t,e)=>{const{prepend:s,append:i}=Y(e);t.adoptedStyleSheets=[...s,...t.adoptedStyleSheets,...i]},tt=(t,e)=>{t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>-1===e.indexOf(t))};if(d.supportsAdoptedStyleSheets)try{document.adoptedStyleSheets.push(),document.adoptedStyleSheets.splice(),Z=(t,e)=>{const{prepend:s,append:i}=Y(e);t.adoptedStyleSheets.splice(0,0,...s),t.adoptedStyleSheets.push(...i)},tt=(t,e)=>{for(const s of e){const e=t.adoptedStyleSheets.indexOf(s);-1!==e&&t.adoptedStyleSheets.splice(e,1)}}}catch(t){}class et extends G{constructor(t,e){super(),this.styles=t,this.styleSheetCache=e,this._styleSheets=void 0,this.behaviors=K(t)}get styleSheets(){if(void 0===this._styleSheets){const t=this.styles,e=this.styleSheetCache;this._styleSheets=J(t).map(t=>{if(t instanceof CSSStyleSheet)return t;let s=e.get(t);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(t),e.set(t,s)),s})}return this._styleSheets}addStylesTo(t){Z(t,this.styleSheets),super.addStylesTo(t)}removeStylesFrom(t){tt(t,this.styleSheets),super.removeStylesFrom(t)}}let st=0;class it extends G{constructor(t){super(),this.styles=t,this.behaviors=null,this.behaviors=K(t),this.styleSheets=J(t),this.styleClass="fast-style-class-"+ ++st}addStylesTo(t){const e=this.styleSheets,s=this.styleClass;t=this.normalizeTarget(t);for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}super.addStylesTo(t)}removeStylesFrom(t){const e=(t=this.normalizeTarget(t)).querySelectorAll("."+this.styleClass);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s]);super.removeStylesFrom(t)}isAttachedTo(t){return super.isAttachedTo(this.normalizeTarget(t))}normalizeTarget(t){return t===document?document.body:t}}const nt=Object.freeze({locate:n()}),rt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t},ot={toView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e.toString()},fromView(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}};class lt{constructor(t,e,s=e.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=s,this.mode=i,this.converter=n,this.fieldName="_"+e,this.callbackName=e+"Changed",this.hasCallback=this.callbackName in t.prototype,"boolean"===i&&void 0===n&&(this.converter=rt)}setValue(t,e){const s=t[this.fieldName],i=this.converter;void 0!==i&&(e=i.fromView(e)),s!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](s,e),t.$fastController.notify(this.name))}getValue(t){return p.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,s=this.guards;s.has(t)||"fromView"===e||d.queueUpdate(()=>{s.add(t);const i=t[this.fieldName];switch(e){case"reflect":const e=this.converter;d.setAttribute(t,this.attribute,void 0!==e?e.toView(i):i);break;case"boolean":d.setBooleanAttribute(t,this.attribute,i)}s.delete(t)})}static collect(t,...e){const s=[];e.push(nt.locate(t));for(let i=0,n=e.length;i<n;++i){const n=e[i];if(void 0!==n)for(let e=0,i=n.length;e<i;++e){const i=n[e];"string"==typeof i?s.push(new lt(t,i)):s.push(new lt(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function ht(t,e){let s;function i(t,e){arguments.length>1&&(s.property=e),nt.locate(t.constructor).push(s)}return arguments.length>1?(s={},void i(t,e)):(s=void 0===t?{}:t,i)}const at={mode:"open"},ct={},dt=s.getById(4,()=>{const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e)})});class ut{constructor(t,e=t.definition){"string"==typeof e&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=lt.collect(t,e.attributes),i=new Array(s.length),n={},r={};for(let t=0,e=s.length;t<e;++t){const e=s[t];i[t]=e.attribute,n[e.name]=e,r[e.attribute]=e}this.attributes=s,this.observedAttributes=i,this.propertyLookup=n,this.attributeLookup=r,this.shadowOptions=void 0===e.shadowOptions?at:null===e.shadowOptions?void 0:Object.assign(Object.assign({},at),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ct:Object.assign(Object.assign({},ct),e.elementOptions),this.styles=void 0===e.styles?void 0:Array.isArray(e.styles)?G.create(e.styles):e.styles instanceof G?e.styles:G.create([e.styles])}get isDefined(){return!!dt.getByType(this.type)}define(t=customElements){const e=this.type;if(dt.register(this)){const t=this.attributes,s=e.prototype;for(let e=0,i=t.length;e<i;++e)p.defineProperty(s,t[e]);Reflect.defineProperty(e,"observedAttributes",{value:this.observedAttributes,enumerable:!0})}return t.get(this.name)||t.define(this.name,e,this.elementOptions),this}}ut.forType=dt.getByType;const ft=new WeakMap,pt={bubbles:!0,composed:!0,cancelable:!0};function gt(t){return t.shadowRoot||ft.get(t)||null}class bt extends f{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const s=e.shadowOptions;if(void 0!==s){const e=t.attachShadow(s);"closed"===s.mode&&ft.set(t,e)}const i=p.getAccessors(t);if(i.length>0){const e=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return p.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,p.notify(this,"isConnected")}get template(){return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||null===t||this.addStyles(t))}addStyles(t){const e=gt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){const e=gt(this.element)||this.element.getRootNode();if(t instanceof HTMLStyleElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){const e=this.behaviors||(this.behaviors=new Map),s=t.length,i=[];for(let n=0;n<s;++n){const s=t[n];e.has(s)?e.set(s,e.get(s)+1):(e.set(s,1),i.push(s))}if(this._isConnected){const t=this.element;for(let e=0;e<i.length;++e)i[e].bind(t,y)}}removeBehaviors(t,e=!1){const s=this.behaviors;if(null===s)return;const i=t.length,n=[];for(let r=0;r<i;++r){const i=t[r];if(s.has(i)){const t=s.get(i)-1;0===t||e?s.delete(i)&&n.push(i):s.set(i,t)}}if(this._isConnected){const t=this.element;for(let e=0;e<n.length;++e)n[e].unbind(t)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,y);const e=this.behaviors;if(null!==e)for(const[s]of e)s.bind(t,y);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element;for(const[s]of e)s.unbind(t)}}onAttributeChangedCallback(t,e,s){const i=this.definition.attributeLookup[t];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(t,e,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},pt),s)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const s=Object.keys(e);for(let i=0,n=s.length;i<n;++i){const n=s[i];t[n]=e[n]}this.boundObservables=null}const s=this.definition;null===this._template&&(this.element.resolveTemplate?this._template=this.element.resolveTemplate():s.template&&(this._template=s.template||null)),null!==this._template&&this.renderTemplate(this._template),null===this._styles&&(this.element.resolveStyles?this._styles=this.element.resolveStyles():s.styles&&(this._styles=s.styles||null)),null!==this._styles&&this.addStyles(this._styles),this.needsInitialization=!1}renderTemplate(t){const e=this.element,s=gt(e)||e;null!==this.view?(this.view.dispose(),this.view=null):this.needsInitialization||d.removeChildNodes(s),t&&(this.view=t.render(e,s,e))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=ut.forType(t.constructor);if(void 0===s)throw new Error("Missing FASTElement definition.");return t.$fastController=new bt(t,s)}}function vt(t){return class extends t{constructor(){super(),bt.forCustomElement(this)}$emit(t,e,s){return this.$fastController.emit(t,e,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,s){this.$fastController.onAttributeChangedCallback(t,e,s)}}}const mt=Object.assign(vt(HTMLElement),{from:t=>vt(t),define:(t,e)=>new ut(t,e).define().type});function yt(t){return function(e){new ut(e,t).define()}}class Ct{createCSS(){return""}createBehavior(){}}function xt(t,e){const s=[];let i="";const n=[];for(let r=0,o=t.length-1;r<o;++r){i+=t[r];let o=e[r];if(o instanceof Ct){const t=o.createBehavior();o=o.createCSS(),t&&n.push(t)}o instanceof G||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=t[t.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}function St(t,...e){const{styles:s,behaviors:i}=xt(t,e),n=G.create(s);return i.length&&n.withBehaviors(...i),n}class wt extends Ct{constructor(t,e){super(),this.behaviors=e,this.css="";const s=t.reduce((t,e)=>("string"==typeof e?this.css+=e:t.push(e),t),[]);s.length&&(this.styles=G.create(s))}createBehavior(){return this}createCSS(){return this.css}bind(t){this.styles&&t.$fastController.addStyles(this.styles),this.behaviors.length&&t.$fastController.addBehaviors(this.behaviors)}unbind(t){this.styles&&t.$fastController.removeStyles(this.styles),this.behaviors.length&&t.$fastController.removeBehaviors(this.behaviors)}}function Bt(t,...e){const{styles:s,behaviors:i}=xt(t,e);return new wt(s,i)}function Tt(t,e,s){return{index:t,removed:e,addedCount:s}}function Ot(t,e,s,n,r,o){let l=0,h=0;const a=Math.min(s-e,o-r);if(0===e&&0===r&&(l=function(t,e,s){for(let i=0;i<s;++i)if(t[i]!==e[i])return i;return s}(t,n,a)),s===t.length&&o===n.length&&(h=function(t,e,s){let i=t.length,n=e.length,r=0;for(;r<s&&t[--i]===e[--n];)r++;return r}(t,n,a-l)),r+=l,o-=h,(s-=h)-(e+=l)==0&&o-r==0)return i;if(e===s){const t=Tt(e,[],0);for(;r<o;)t.removed.push(n[r++]);return[t]}if(r===o)return[Tt(e,[],s-e)];const c=function(t){let e=t.length-1,s=t[0].length-1,i=t[e][s];const n=[];for(;e>0||s>0;){if(0===e){n.push(2),s--;continue}if(0===s){n.push(3),e--;continue}const r=t[e-1][s-1],o=t[e-1][s],l=t[e][s-1];let h;h=o<l?o<r?o:r:l<r?l:r,h===r?(r===i?n.push(0):(n.push(1),i=r),e--,s--):h===o?(n.push(3),e--,i=o):(n.push(2),s--,i=l)}return n.reverse(),n}(function(t,e,s,i,n,r){const o=r-n+1,l=s-e+1,h=new Array(o);let a,c;for(let t=0;t<o;++t)h[t]=new Array(l),h[t][0]=t;for(let t=0;t<l;++t)h[0][t]=t;for(let s=1;s<o;++s)for(let r=1;r<l;++r)t[e+r-1]===i[n+s-1]?h[s][r]=h[s-1][r-1]:(a=h[s-1][r]+1,c=h[s][r-1]+1,h[s][r]=a<c?a:c);return h}(t,e,s,n,r,o)),d=[];let u=void 0,f=e,p=r;for(let t=0;t<c.length;++t)switch(c[t]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=Tt(f,[],0)),u.addedCount++,f++,u.removed.push(n[p]),p++;break;case 2:void 0===u&&(u=Tt(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=Tt(f,[],0)),u.removed.push(n[p]),p++}return void 0!==u&&d.push(u),d}const At=Array.prototype.push;function Nt(t,e,s,i){const n=Tt(e,s,i);let r=!1,o=0;for(let e=0;e<t.length;e++){const s=t[e];if(s.index+=o,r)continue;const i=(l=n.index,h=n.index+n.removed.length,a=s.index,c=s.index+s.addedCount,h<a||c<l?-1:h===a||c===l?0:l<a?h<c?h-a:c-a:c<h?c-l:h-l);if(i>=0){t.splice(e,1),e--,o-=s.addedCount-s.removed.length,n.addedCount+=s.addedCount-i;const l=n.removed.length+s.removed.length-i;if(n.addedCount||l){let t=s.removed;if(n.index<s.index){const e=n.removed.slice(0,s.index-n.index);At.apply(e,t),t=e}if(n.index+n.removed.length>s.index+s.addedCount){const e=n.removed.slice(s.index+s.addedCount-n.index);At.apply(t,e)}n.removed=t,s.index<n.index&&(n.index=s.index)}else r=!0}else if(n.index<s.index){r=!0,t.splice(e,0,n),e++;const i=n.addedCount-n.removed.length;s.index+=i,o+=i}}var l,h,a,c;r||t.push(n)}function kt(t,e){let s=[];const i=function(t){const e=[];for(let s=0,i=t.length;s<i;s++){const i=t[s];Nt(e,i.index,i.removed,i.addedCount)}return e}(e);for(let e=0,n=i.length;e<n;++e){const n=i[e];1!==n.addedCount||1!==n.removed.length?s=s.concat(Ot(t,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==t[n.index]&&s.push(n)}return s}let Vt=!1;function Ft(t,e){let s=t.index;const i=e.length;return s>i?s=i-t.addedCount:s<0&&(s=i+t.removed.length+s-t.addedCount),s<0&&(s=0),t.index=s,t}class It extends u{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this.call=this.flush,Reflect.defineProperty(t,"$fastController",{value:this,enumerable:!1})}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.needsQueue&&(this.needsQueue=!1,d.queueUpdate(this))}reset(t){this.oldCollection=t,this.needsQueue&&(this.needsQueue=!1,d.queueUpdate(this))}flush(){const t=this.splices,e=this.oldCollection;if(void 0===t&&void 0===e)return;this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0;const s=void 0===e?kt(this.source,t):Ot(this.source,0,this.source.length,e,0,e.length);this.notify(s)}}function $t(){if(Vt)return;Vt=!0,p.setArrayObserverFactory(t=>new It(t));const t=Array.prototype;if(t.$fastPatch)return;Reflect.defineProperty(t,"$fastPatch",{value:1,enumerable:!1});const e=t.pop,s=t.push,i=t.reverse,n=t.shift,r=t.sort,o=t.splice,l=t.unshift;t.pop=function(){const t=this.length>0,s=e.apply(this,arguments),i=this.$fastController;return void 0!==i&&t&&i.addSplice(Tt(this.length,[s],0)),s},t.push=function(){const t=s.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(Ft(Tt(this.length-arguments.length,[],arguments.length),this)),t},t.reverse=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const s=i.apply(this,arguments);return void 0!==e&&e.reset(t),s},t.shift=function(){const t=this.length>0,e=n.apply(this,arguments),s=this.$fastController;return void 0!==s&&t&&s.addSplice(Tt(0,[e],0)),e},t.sort=function(){let t;const e=this.$fastController;void 0!==e&&(e.flush(),t=this.slice());const s=r.apply(this,arguments);return void 0!==e&&e.reset(t),s},t.splice=function(){const t=o.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(Ft(Tt(+arguments[0],t,arguments.length>2?arguments.length-2:0),this)),t},t.unshift=function(){const t=l.apply(this,arguments),e=this.$fastController;return void 0!==e&&e.addSplice(Ft(Tt(0,[],arguments.length),this)),t}}class _t{constructor(t,e){this.target=t,this.propertyName=e}bind(t){t[this.propertyName]=this.target}unbind(){}}function Et(t){return new S("fast-ref",_t,t)}const Mt=t=>"function"==typeof t,Pt=()=>null;function jt(t){return void 0===t?Pt:Mt(t)?t:()=>t}function Lt(t,e,s){const i=Mt(t)?t:()=>t,n=jt(e),r=jt(s);return(t,e)=>i(t,e)?n(t,e):r(t,e)}const Rt=Object.freeze({positioning:!1,recycle:!0});function zt(t,e,s,i){t.bind(e[s],i)}function Ht(t,e,s,i){const n=Object.create(i);n.index=s,n.length=e.length,t.bind(e[s],n)}class qt{constructor(t,e,s,i,n,r){this.location=t,this.itemsBinding=e,this.templateBinding=i,this.options=r,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.originalContext=void 0,this.childContext=void 0,this.bindView=zt,this.itemsBindingObserver=p.binding(e,this,s),this.templateBindingObserver=p.binding(i,this,n),r.positioning&&(this.bindView=Ht)}bind(t,e){this.source=t,this.originalContext=e,this.childContext=Object.create(e),this.childContext.parent=t,this.childContext.parentContext=this.originalContext,this.items=this.itemsBindingObserver.observe(t,this.originalContext),this.template=this.templateBindingObserver.observe(t,this.originalContext),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.disconnect(),this.templateBindingObserver.disconnect()}handleChange(t,e){t===this.itemsBinding?(this.items=this.itemsBindingObserver.observe(this.source,this.originalContext),this.observeItems(),this.refreshAllViews()):t===this.templateBinding?(this.template=this.templateBindingObserver.observe(this.source,this.originalContext),this.refreshAllViews(!0)):this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=i);const e=this.itemsObserver,s=this.itemsObserver=p.getNotifier(this.items),n=e!==s;n&&null!==e&&e.unsubscribe(this),(n||t)&&s.subscribe(this)}updateViews(t){const e=this.childContext,s=this.views,i=this.bindView,n=this.items,r=this.template,o=this.options.recycle,l=[];let h=0,a=0;for(let c=0,d=t.length;c<d;++c){const d=t[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=s.splice(d.index,u.length),v=a=l.length+b.length;for(;p<g;++p){const t=s[p],c=t?t.firstChild:this.location;let d;o&&a>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[h],h++),a--):d=r.create(),s.splice(p,0,d),i(d,n,p,e),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let t=h,e=l.length;t<e;++t)l[t].dispose();if(this.options.positioning)for(let t=0,e=s.length;t<e;++t){const i=s[t].context;i.length=e,i.index=t}}refreshAllViews(t=!1){const e=this.items,s=this.childContext,i=this.template,n=this.location,r=this.bindView;let o=e.length,l=this.views,h=l.length;if(0!==o&&!t&&this.options.recycle||(Q.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=i.create();r(o,e,t,s),l[t]=o,o.insertBefore(n)}}else{let t=0;for(;t<o;++t)if(t<h){r(l[t],e,t,s)}else{const o=i.create();r(o,e,t,s),l.push(o),o.insertBefore(n)}const a=l.splice(t,h-t);for(t=0,o=a.length;t<o;++t)a[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}class Qt extends C{constructor(t,e,s){super(),this.itemsBinding=t,this.templateBinding=e,this.options=s,this.createPlaceholder=d.createBlockPlaceholder,$t(),this.isItemsBindingVolatile=p.isVolatileBinding(t),this.isTemplateBindingVolatile=p.isVolatileBinding(e)}createBehavior(t){return new qt(t,this.itemsBinding,this.isItemsBindingVolatile,this.templateBinding,this.isTemplateBindingVolatile,this.options)}}function Ut(t,e,s=Rt){return new Qt(t,"function"==typeof e?e:()=>e,Object.assign(Object.assign({},Rt),s))}function Wt(t){return t?function(e,s,i){return 1===e.nodeType&&e.matches(t)}:function(t,e,s){return 1===t.nodeType}}class Dt{constructor(t,e){this.target=t,this.options=e,this.source=null}bind(t){const e=this.options.property;this.shouldUpdate=p.getAccessors(t).some(t=>t.name===e),this.source=t,this.updateTarget(this.computeNodes()),this.shouldUpdate&&this.observe()}unbind(){this.updateTarget(i),this.source=null,this.shouldUpdate&&this.disconnect()}handleEvent(){this.updateTarget(this.computeNodes())}computeNodes(){let t=this.getNodes();return void 0!==this.options.filter&&(t=t.filter(this.options.filter)),t}updateTarget(t){this.source[this.options.property]=t}}class Gt extends Dt{constructor(t,e){super(t,e)}observe(){this.target.addEventListener("slotchange",this)}disconnect(){this.target.removeEventListener("slotchange",this)}getNodes(){return this.target.assignedNodes(this.options)}}function Jt(t){return"string"==typeof t&&(t={property:t}),new S("fast-slotted",Gt,t)}class Kt extends Dt{constructor(t,e){super(t,e),this.observer=null,e.childList=!0}observe(){null===this.observer&&(this.observer=new MutationObserver(this.handleEvent.bind(this))),this.observer.observe(this.target,this.options)}disconnect(){this.observer.disconnect()}getNodes(){return"subtree"in this.options?Array.from(this.target.querySelectorAll(this.options.selector)):Array.from(this.target.childNodes)}}function Xt(t){return"string"==typeof t&&(t={property:t}),new S("fast-children",Kt,t)}export{t as $global,S as AttachedBehaviorHTMLDirective,nt as AttributeConfiguration,lt as AttributeDefinition,_ as BindingBehavior,Ct as CSSDirective,Kt as ChildrenBehavior,bt as Controller,d as DOM,G as ElementStyles,m as ExecutionContext,s as FAST,mt as FASTElement,ut as FASTElementDefinition,$ as HTMLBindingDirective,C as HTMLDirective,Q as HTMLView,p as Observable,f as PropertyChangeNotifier,_t as RefBehavior,qt as RepeatBehavior,Qt as RepeatDirective,Gt as SlottedBehavior,u as SubscriberSet,x as TargetedHTMLDirective,U as ViewTemplate,ht as attr,rt as booleanConverter,Xt as children,H as compileTemplate,n as createMetadataLocator,St as css,Bt as cssPartial,yt as customElement,y as defaultExecutionContext,Wt as elements,i as emptyArray,$t as enableArrayObservation,D as html,ot as nullableNumberConverter,g as observable,X as prependToAdoptedStyleSheetsSymbol,Et as ref,Ut as repeat,Jt as slotted,b as volatile,Lt as when};
|
package/docs/api-report.md
CHANGED
|
@@ -463,6 +463,9 @@ export interface PartialFASTElementDefinition {
|
|
|
463
463
|
readonly template?: ElementViewTemplate;
|
|
464
464
|
}
|
|
465
465
|
|
|
466
|
+
// @public
|
|
467
|
+
export const prependToAdoptedStyleSheetsSymbol: unique symbol;
|
|
468
|
+
|
|
466
469
|
// @public
|
|
467
470
|
export class PropertyChangeNotifier implements Notifier {
|
|
468
471
|
constructor(source: any);
|
|
@@ -627,7 +630,7 @@ export class ViewTemplate<TSource = any, TParent = any> implements ElementViewTe
|
|
|
627
630
|
export function volatile(target: {}, name: string | Accessor, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
628
631
|
|
|
629
632
|
// @public
|
|
630
|
-
export function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
633
|
+
export function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>, elseTemplateOrTemplateBinding?: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
631
634
|
|
|
632
635
|
// (No @packageDocumentation comment for this package)
|
|
633
636
|
|
package/package.json
CHANGED