@microsoft/fast-element 1.8.0 → 1.9.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/.eslintrc.json +30 -0
- package/CHANGELOG.json +43 -1
- package/CHANGELOG.md +10 -2
- package/dist/dts/components/attributes.d.ts +1 -1
- package/dist/dts/components/controller.d.ts +6 -6
- package/dist/dts/components/fast-definitions.d.ts +3 -3
- package/dist/dts/components/fast-element.d.ts +2 -2
- package/dist/dts/dom.d.ts +2 -2
- package/dist/dts/index.d.ts +26 -26
- package/dist/dts/observation/behavior.d.ts +1 -1
- package/dist/dts/observation/observable.d.ts +1 -1
- package/dist/dts/styles/css-directive.d.ts +2 -2
- package/dist/dts/styles/css.d.ts +2 -2
- package/dist/dts/styles/element-styles.d.ts +1 -1
- package/dist/dts/templating/binding.d.ts +3 -3
- package/dist/dts/templating/children.d.ts +2 -2
- package/dist/dts/templating/compiler.d.ts +1 -1
- package/dist/dts/templating/html-directive.d.ts +1 -1
- package/dist/dts/templating/node-observation.d.ts +1 -1
- package/dist/dts/templating/ref.d.ts +2 -2
- package/dist/dts/templating/repeat.d.ts +6 -6
- package/dist/dts/templating/slotted.d.ts +2 -2
- package/dist/dts/templating/template.d.ts +3 -3
- package/dist/dts/templating/view.d.ts +2 -2
- package/dist/dts/templating/when.d.ts +2 -2
- package/dist/esm/components/attributes.js +2 -2
- package/dist/esm/components/controller.js +4 -4
- package/dist/esm/components/fast-definitions.js +4 -4
- package/dist/esm/components/fast-element.js +2 -2
- package/dist/esm/dom.js +1 -1
- package/dist/esm/index.js +23 -23
- package/dist/esm/observation/array-change-records.js +1 -1
- package/dist/esm/observation/array-observer.js +4 -4
- package/dist/esm/observation/observable.js +3 -3
- package/dist/esm/styles/css.js +2 -2
- package/dist/esm/styles/element-styles.js +1 -1
- package/dist/esm/templating/binding.js +3 -3
- package/dist/esm/templating/children.js +2 -2
- package/dist/esm/templating/compiler.js +2 -2
- package/dist/esm/templating/html-directive.js +1 -1
- package/dist/esm/templating/node-observation.js +2 -2
- package/dist/esm/templating/ref.js +1 -1
- package/dist/esm/templating/repeat.js +6 -6
- package/dist/esm/templating/slotted.js +2 -2
- package/dist/esm/templating/template.js +6 -6
- package/docs/guide/observables-and-state.md +10 -8
- package/docs/guide/using-directives.md +1 -1
- package/karma.conf.cjs +152 -0
- package/package.json +11 -10
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["@microsoft/eslint-config-fast-dna", "prettier"],
|
|
3
|
+
"rules": {
|
|
4
|
+
"max-classes-per-file": "off",
|
|
5
|
+
"no-case-declarations": "off",
|
|
6
|
+
"@typescript-eslint/ban-types": [
|
|
7
|
+
"error",
|
|
8
|
+
{
|
|
9
|
+
"types": {
|
|
10
|
+
"{}": false,
|
|
11
|
+
"Function": false,
|
|
12
|
+
"Object": false
|
|
13
|
+
},
|
|
14
|
+
"extendDefaults": true
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"@typescript-eslint/no-use-before-define": ["error", { "typedefs": false }],
|
|
18
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
19
|
+
"@typescript-eslint/explicit-function-return-type": [
|
|
20
|
+
"error",
|
|
21
|
+
{
|
|
22
|
+
"allowExpressions": true
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"import/extensions": [
|
|
26
|
+
"error",
|
|
27
|
+
"always"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,49 @@
|
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 06 Apr 2022 07:10:25 GMT",
|
|
6
|
+
"tag": "@microsoft/fast-element_v1.9.0",
|
|
7
|
+
"version": "1.9.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "convert fast-element to type:module",
|
|
12
|
+
"author": "nicholasrice@users.noreply.github.com",
|
|
13
|
+
"commit": "ead7f7340654236f2503359e2fc6f0b41639b507",
|
|
14
|
+
"package": "@microsoft/fast-element"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Sun, 03 Apr 2022 07:12:01 GMT",
|
|
21
|
+
"tag": "@microsoft/fast-element_v1.8.0",
|
|
22
|
+
"version": "1.8.0",
|
|
23
|
+
"comments": {
|
|
24
|
+
"none": [
|
|
25
|
+
{
|
|
26
|
+
"comment": "Fixed a typo in a doc example",
|
|
27
|
+
"author": "47367562+bheston@users.noreply.github.com",
|
|
28
|
+
"commit": "35913ce3a2dcba83bebb63cce2b8edf4e9da7df9",
|
|
29
|
+
"package": "@microsoft/fast-element"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"comment": "add comment-style tags for syntax highlighting (#5561)",
|
|
33
|
+
"author": "chhol@microsoft.com",
|
|
34
|
+
"commit": "7495a63e6e89b6e92e2d7f289eea063a8a354108",
|
|
35
|
+
"package": "@microsoft/fast-element"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"comment": "Update binding documentation to have an accurate example. Changes \"Bindings\" to \"Volatile Properties\".",
|
|
39
|
+
"author": "tgoze@ntst.com",
|
|
40
|
+
"commit": "1ffb431816f418864d2385b29ba494efcb3fa844",
|
|
41
|
+
"package": "@microsoft/fast-element"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"date": "Tue, 08 Mar 2022 07:12:45 GMT",
|
|
6
48
|
"tag": "@microsoft/fast-element_v1.8.0",
|
|
7
49
|
"version": "1.8.0",
|
|
8
50
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @microsoft/fast-element
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 06 Apr 2022 07:10:25 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.9.0
|
|
8
|
+
|
|
9
|
+
Wed, 06 Apr 2022 07:10:25 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- convert fast-element to type:module (nicholasrice@users.noreply.github.com)
|
|
14
|
+
|
|
7
15
|
## 1.8.0
|
|
8
16
|
|
|
9
|
-
Tue, 08 Mar 2022 07:
|
|
17
|
+
Tue, 08 Mar 2022 07:12:45 GMT
|
|
10
18
|
|
|
11
19
|
### Minor changes
|
|
12
20
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Behavior } from "../observation/behavior";
|
|
2
|
-
import { PropertyChangeNotifier } from "../observation/notifier";
|
|
3
|
-
import type { ElementStyles } from "../styles/element-styles";
|
|
4
|
-
import type { ElementViewTemplate } from "../templating/template";
|
|
5
|
-
import type { ElementView } from "../templating/view";
|
|
6
|
-
import { FASTElementDefinition } from "./fast-definitions";
|
|
1
|
+
import type { Behavior } from "../observation/behavior.js";
|
|
2
|
+
import { PropertyChangeNotifier } from "../observation/notifier.js";
|
|
3
|
+
import type { ElementStyles } from "../styles/element-styles.js";
|
|
4
|
+
import type { ElementViewTemplate } from "../templating/template.js";
|
|
5
|
+
import type { ElementView } from "../templating/view.js";
|
|
6
|
+
import { FASTElementDefinition } from "./fast-definitions.js";
|
|
7
7
|
/**
|
|
8
8
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
9
9
|
* @public
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComposableStyles, ElementStyles } from "../styles/element-styles";
|
|
2
|
-
import type { ElementViewTemplate } from "../templating/template";
|
|
3
|
-
import { AttributeConfiguration, AttributeDefinition } from "./attributes";
|
|
1
|
+
import { ComposableStyles, ElementStyles } from "../styles/element-styles.js";
|
|
2
|
+
import type { ElementViewTemplate } from "../templating/template.js";
|
|
3
|
+
import { AttributeConfiguration, AttributeDefinition } from "./attributes.js";
|
|
4
4
|
/**
|
|
5
5
|
* Represents metadata configuration for a custom element.
|
|
6
6
|
* @public
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Controller } from "./controller";
|
|
2
|
-
import { PartialFASTElementDefinition } from "./fast-definitions";
|
|
1
|
+
import { Controller } from "./controller.js";
|
|
2
|
+
import { PartialFASTElementDefinition } from "./fast-definitions.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a custom element based on the FASTElement infrastructure.
|
|
5
5
|
* @public
|
package/dist/dts/dom.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Callable } from "./interfaces";
|
|
2
|
-
import { TrustedTypesPolicy } from "./platform";
|
|
1
|
+
import type { Callable } from "./interfaces.js";
|
|
2
|
+
import { TrustedTypesPolicy } from "./platform.js";
|
|
3
3
|
/** @internal */
|
|
4
4
|
export declare const _interpolationStart: string;
|
|
5
5
|
/** @internal */
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export * from "./platform";
|
|
2
|
-
export * from "./templating/template";
|
|
3
|
-
export * from "./components/fast-element";
|
|
4
|
-
export { FASTElementDefinition, PartialFASTElementDefinition, } from "./components/fast-definitions";
|
|
5
|
-
export * from "./components/attributes";
|
|
6
|
-
export * from "./components/controller";
|
|
7
|
-
export type { Callable, Constructable, Mutable } from "./interfaces";
|
|
8
|
-
export * from "./templating/compiler";
|
|
9
|
-
export { ElementStyles, ElementStyleFactory, ComposableStyles, StyleTarget, } from "./styles/element-styles";
|
|
10
|
-
export { css, cssPartial } from "./styles/css";
|
|
11
|
-
export { CSSDirective } from "./styles/css-directive";
|
|
12
|
-
export * from "./templating/view";
|
|
13
|
-
export * from "./observation/observable";
|
|
14
|
-
export * from "./observation/notifier";
|
|
15
|
-
export { Splice } from "./observation/array-change-records";
|
|
16
|
-
export { enableArrayObservation } from "./observation/array-observer";
|
|
17
|
-
export { DOM } from "./dom";
|
|
18
|
-
export type { Behavior } from "./observation/behavior";
|
|
19
|
-
export * from "./templating/binding";
|
|
20
|
-
export * from "./templating/html-directive";
|
|
21
|
-
export * from "./templating/ref";
|
|
22
|
-
export * from "./templating/when";
|
|
23
|
-
export * from "./templating/repeat";
|
|
24
|
-
export * from "./templating/slotted";
|
|
25
|
-
export * from "./templating/children";
|
|
26
|
-
export { elements, ElementsFilter, NodeBehaviorOptions, } from "./templating/node-observation";
|
|
1
|
+
export * from "./platform.js";
|
|
2
|
+
export * from "./templating/template.js";
|
|
3
|
+
export * from "./components/fast-element.js";
|
|
4
|
+
export { FASTElementDefinition, PartialFASTElementDefinition, } from "./components/fast-definitions.js";
|
|
5
|
+
export * from "./components/attributes.js";
|
|
6
|
+
export * from "./components/controller.js";
|
|
7
|
+
export type { Callable, Constructable, Mutable } from "./interfaces.js";
|
|
8
|
+
export * from "./templating/compiler.js";
|
|
9
|
+
export { ElementStyles, ElementStyleFactory, ComposableStyles, StyleTarget, } from "./styles/element-styles.js";
|
|
10
|
+
export { css, cssPartial } from "./styles/css.js";
|
|
11
|
+
export { CSSDirective } from "./styles/css-directive.js";
|
|
12
|
+
export * from "./templating/view.js";
|
|
13
|
+
export * from "./observation/observable.js";
|
|
14
|
+
export * from "./observation/notifier.js";
|
|
15
|
+
export { Splice } from "./observation/array-change-records.js";
|
|
16
|
+
export { enableArrayObservation } from "./observation/array-observer.js";
|
|
17
|
+
export { DOM } from "./dom.js";
|
|
18
|
+
export type { Behavior } from "./observation/behavior.js";
|
|
19
|
+
export * from "./templating/binding.js";
|
|
20
|
+
export * from "./templating/html-directive.js";
|
|
21
|
+
export * from "./templating/ref.js";
|
|
22
|
+
export * from "./templating/when.js";
|
|
23
|
+
export * from "./templating/repeat.js";
|
|
24
|
+
export * from "./templating/slotted.js";
|
|
25
|
+
export * from "./templating/children.js";
|
|
26
|
+
export { elements, ElementsFilter, NodeBehaviorOptions, } from "./templating/node-observation.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Behavior } from "../observation/behavior";
|
|
2
|
-
import type { ComposableStyles } from "./element-styles";
|
|
1
|
+
import type { Behavior } from "../observation/behavior.js";
|
|
2
|
+
import type { ComposableStyles } from "./element-styles.js";
|
|
3
3
|
/**
|
|
4
4
|
* Directive for use in {@link css}.
|
|
5
5
|
*
|
package/dist/dts/styles/css.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSDirective } from "./css-directive";
|
|
2
|
-
import { ComposableStyles, ElementStyles } from "./element-styles";
|
|
1
|
+
import { CSSDirective } from "./css-directive.js";
|
|
2
|
+
import { ComposableStyles, ElementStyles } from "./element-styles.js";
|
|
3
3
|
/**
|
|
4
4
|
* Transforms a template literal string into styles.
|
|
5
5
|
* @param strings - The string fragments that are interpolated with the values.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Behavior } from "../observation/behavior";
|
|
2
|
-
import { Binding, BindingObserver, ExecutionContext } from "../observation/observable";
|
|
3
|
-
import { TargetedHTMLDirective } from "./html-directive";
|
|
1
|
+
import type { Behavior } from "../observation/behavior.js";
|
|
2
|
+
import { Binding, BindingObserver, ExecutionContext } from "../observation/observable.js";
|
|
3
|
+
import { TargetedHTMLDirective } from "./html-directive.js";
|
|
4
4
|
declare function normalBind(this: BindingBehavior, source: unknown, context: ExecutionContext): void;
|
|
5
5
|
declare function normalUnbind(this: BindingBehavior): void;
|
|
6
6
|
declare function updatePropertyTarget(this: BindingBehavior, value: unknown): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NodeBehaviorOptions, NodeObservationBehavior } from "./node-observation";
|
|
2
|
-
import type { CaptureType } from "./template";
|
|
1
|
+
import { NodeBehaviorOptions, NodeObservationBehavior } from "./node-observation.js";
|
|
2
|
+
import type { CaptureType } from "./template.js";
|
|
3
3
|
/**
|
|
4
4
|
* The options used to configure child list observation.
|
|
5
5
|
* @public
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Behavior } from "../observation/behavior";
|
|
2
|
-
import type { CaptureType } from "./template";
|
|
1
|
+
import type { Behavior } from "../observation/behavior.js";
|
|
2
|
+
import type { CaptureType } from "./template.js";
|
|
3
3
|
/**
|
|
4
4
|
* The runtime behavior for template references.
|
|
5
5
|
* @public
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Binding, ExecutionContext } from "../observation/observable";
|
|
2
|
-
import type { Subscriber } from "../observation/notifier";
|
|
3
|
-
import type { Splice } from "../observation/array-change-records";
|
|
4
|
-
import type { Behavior } from "../observation/behavior";
|
|
5
|
-
import { HTMLDirective } from "./html-directive";
|
|
6
|
-
import type { CaptureType, SyntheticViewTemplate } from "./template";
|
|
1
|
+
import { Binding, ExecutionContext } from "../observation/observable.js";
|
|
2
|
+
import type { Subscriber } from "../observation/notifier.js";
|
|
3
|
+
import type { Splice } from "../observation/array-change-records.js";
|
|
4
|
+
import type { Behavior } from "../observation/behavior.js";
|
|
5
|
+
import { HTMLDirective } from "./html-directive.js";
|
|
6
|
+
import type { CaptureType, SyntheticViewTemplate } from "./template.js";
|
|
7
7
|
/**
|
|
8
8
|
* Options for configuring repeat behavior.
|
|
9
9
|
* @public
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NodeBehaviorOptions, NodeObservationBehavior } from "./node-observation";
|
|
2
|
-
import type { CaptureType } from "./template";
|
|
1
|
+
import { NodeBehaviorOptions, NodeObservationBehavior } from "./node-observation.js";
|
|
2
|
+
import type { CaptureType } from "./template.js";
|
|
3
3
|
/**
|
|
4
4
|
* The options used to configure slotted node observation.
|
|
5
5
|
* @public
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Binding } from "../observation/observable";
|
|
2
|
-
import { ElementView, HTMLView, SyntheticView } from "./view";
|
|
3
|
-
import { HTMLDirective } from "./html-directive";
|
|
1
|
+
import { Binding } from "../observation/observable.js";
|
|
2
|
+
import { ElementView, HTMLView, SyntheticView } from "./view.js";
|
|
3
|
+
import { HTMLDirective } from "./html-directive.js";
|
|
4
4
|
/**
|
|
5
5
|
* A template capable of creating views specifically for rendering custom elements.
|
|
6
6
|
* @public
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Behavior } from "../observation/behavior";
|
|
2
|
-
import type { ExecutionContext } from "../observation/observable";
|
|
1
|
+
import type { Behavior } from "../observation/behavior.js";
|
|
2
|
+
import type { ExecutionContext } from "../observation/observable.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a collection of DOM nodes which can be bound to a data source.
|
|
5
5
|
* @public
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Binding } from "../observation/observable";
|
|
2
|
-
import type { CaptureType, SyntheticViewTemplate } from "./template";
|
|
1
|
+
import type { Binding } from "../observation/observable.js";
|
|
2
|
+
import type { CaptureType, SyntheticViewTemplate } from "./template.js";
|
|
3
3
|
/**
|
|
4
4
|
* A directive that enables basic conditional rendering in a template.
|
|
5
5
|
* @param binding - The condition to test for rendering.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Observable } from "../observation/observable";
|
|
2
|
-
import { DOM } from "../dom";
|
|
1
|
+
import { Observable } from "../observation/observable.js";
|
|
2
|
+
import { DOM } from "../dom.js";
|
|
3
3
|
/**
|
|
4
4
|
* A {@link ValueConverter} that converts to and from `boolean` values.
|
|
5
5
|
* @remarks
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DOM } from "../dom";
|
|
2
|
-
import { PropertyChangeNotifier } from "../observation/notifier";
|
|
3
|
-
import { defaultExecutionContext, Observable } from "../observation/observable";
|
|
4
|
-
import { FASTElementDefinition } from "./fast-definitions";
|
|
1
|
+
import { DOM } from "../dom.js";
|
|
2
|
+
import { PropertyChangeNotifier } from "../observation/notifier.js";
|
|
3
|
+
import { defaultExecutionContext, Observable } from "../observation/observable.js";
|
|
4
|
+
import { FASTElementDefinition } from "./fast-definitions.js";
|
|
5
5
|
const shadowRoots = new WeakMap();
|
|
6
6
|
const defaultEventOptions = {
|
|
7
7
|
bubbles: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FAST } from "../platform";
|
|
2
|
-
import { Observable } from "../observation/observable";
|
|
3
|
-
import { ElementStyles } from "../styles/element-styles";
|
|
4
|
-
import { AttributeDefinition } from "./attributes";
|
|
1
|
+
import { FAST } from "../platform.js";
|
|
2
|
+
import { Observable } from "../observation/observable.js";
|
|
3
|
+
import { ElementStyles } from "../styles/element-styles.js";
|
|
4
|
+
import { AttributeDefinition } from "./attributes.js";
|
|
5
5
|
const defaultShadowOptions = { mode: "open" };
|
|
6
6
|
const defaultElementOptions = {};
|
|
7
7
|
const fastRegistry = FAST.getById(4 /* elementRegistry */, () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Controller } from "./controller";
|
|
2
|
-
import { FASTElementDefinition } from "./fast-definitions";
|
|
1
|
+
import { Controller } from "./controller.js";
|
|
2
|
+
import { FASTElementDefinition, } from "./fast-definitions.js";
|
|
3
3
|
/* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */
|
|
4
4
|
function createFASTElement(BaseType) {
|
|
5
5
|
return class extends BaseType {
|
package/dist/esm/dom.js
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export * from "./platform";
|
|
2
|
-
export * from "./templating/template";
|
|
3
|
-
export * from "./components/fast-element";
|
|
4
|
-
export { FASTElementDefinition, } from "./components/fast-definitions";
|
|
5
|
-
export * from "./components/attributes";
|
|
6
|
-
export * from "./components/controller";
|
|
7
|
-
export * from "./templating/compiler";
|
|
8
|
-
export { ElementStyles, } from "./styles/element-styles";
|
|
9
|
-
export { css, cssPartial } from "./styles/css";
|
|
10
|
-
export { CSSDirective } from "./styles/css-directive";
|
|
11
|
-
export * from "./templating/view";
|
|
12
|
-
export * from "./observation/observable";
|
|
13
|
-
export * from "./observation/notifier";
|
|
14
|
-
export { enableArrayObservation } from "./observation/array-observer";
|
|
15
|
-
export { DOM } from "./dom";
|
|
16
|
-
export * from "./templating/binding";
|
|
17
|
-
export * from "./templating/html-directive";
|
|
18
|
-
export * from "./templating/ref";
|
|
19
|
-
export * from "./templating/when";
|
|
20
|
-
export * from "./templating/repeat";
|
|
21
|
-
export * from "./templating/slotted";
|
|
22
|
-
export * from "./templating/children";
|
|
23
|
-
export { elements, } from "./templating/node-observation";
|
|
1
|
+
export * from "./platform.js";
|
|
2
|
+
export * from "./templating/template.js";
|
|
3
|
+
export * from "./components/fast-element.js";
|
|
4
|
+
export { FASTElementDefinition, } from "./components/fast-definitions.js";
|
|
5
|
+
export * from "./components/attributes.js";
|
|
6
|
+
export * from "./components/controller.js";
|
|
7
|
+
export * from "./templating/compiler.js";
|
|
8
|
+
export { ElementStyles, } from "./styles/element-styles.js";
|
|
9
|
+
export { css, cssPartial } from "./styles/css.js";
|
|
10
|
+
export { CSSDirective } from "./styles/css-directive.js";
|
|
11
|
+
export * from "./templating/view.js";
|
|
12
|
+
export * from "./observation/observable.js";
|
|
13
|
+
export * from "./observation/notifier.js";
|
|
14
|
+
export { enableArrayObservation } from "./observation/array-observer.js";
|
|
15
|
+
export { DOM } from "./dom.js";
|
|
16
|
+
export * from "./templating/binding.js";
|
|
17
|
+
export * from "./templating/html-directive.js";
|
|
18
|
+
export * from "./templating/ref.js";
|
|
19
|
+
export * from "./templating/when.js";
|
|
20
|
+
export * from "./templating/repeat.js";
|
|
21
|
+
export * from "./templating/slotted.js";
|
|
22
|
+
export * from "./templating/children.js";
|
|
23
|
+
export { elements, } from "./templating/node-observation.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DOM } from "../dom";
|
|
2
|
-
import { calcSplices, newSplice, projectArraySplices } from "./array-change-records";
|
|
3
|
-
import { SubscriberSet } from "./notifier";
|
|
4
|
-
import { Observable } from "./observable";
|
|
1
|
+
import { DOM } from "../dom.js";
|
|
2
|
+
import { calcSplices, newSplice, projectArraySplices } from "./array-change-records.js";
|
|
3
|
+
import { SubscriberSet } from "./notifier.js";
|
|
4
|
+
import { Observable } from "./observable.js";
|
|
5
5
|
let arrayObservationEnabled = false;
|
|
6
6
|
function adjustIndex(changeRecord, array) {
|
|
7
7
|
let index = changeRecord.index;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DOM } from "../dom";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { DOM } from "../dom.js";
|
|
2
|
+
import { FAST } from "../platform.js";
|
|
3
|
+
import { PropertyChangeNotifier, SubscriberSet } from "./notifier.js";
|
|
4
4
|
/**
|
|
5
5
|
* Common Observable APIs.
|
|
6
6
|
* @public
|
package/dist/esm/styles/css.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSDirective } from "./css-directive";
|
|
2
|
-
import { ElementStyles } from "./element-styles";
|
|
1
|
+
import { CSSDirective } from "./css-directive.js";
|
|
2
|
+
import { ElementStyles } from "./element-styles.js";
|
|
3
3
|
function collectStyles(strings, values) {
|
|
4
4
|
const styles = [];
|
|
5
5
|
let cssString = "";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DOM } from "../dom";
|
|
2
|
-
import { ExecutionContext, Observable, } from "../observation/observable";
|
|
3
|
-
import { TargetedHTMLDirective } from "./html-directive";
|
|
1
|
+
import { DOM } from "../dom.js";
|
|
2
|
+
import { ExecutionContext, Observable, } from "../observation/observable.js";
|
|
3
|
+
import { TargetedHTMLDirective } from "./html-directive.js";
|
|
4
4
|
function normalBind(source, context) {
|
|
5
5
|
this.source = source;
|
|
6
6
|
this.context = context;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AttachedBehaviorHTMLDirective } from "./html-directive";
|
|
2
|
-
import { NodeObservationBehavior } from "./node-observation";
|
|
1
|
+
import { AttachedBehaviorHTMLDirective } from "./html-directive.js";
|
|
2
|
+
import { NodeObservationBehavior } from "./node-observation.js";
|
|
3
3
|
/**
|
|
4
4
|
* The runtime behavior for child node observation.
|
|
5
5
|
* @public
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _interpolationEnd, _interpolationStart, DOM } from "../dom";
|
|
2
|
-
import { HTMLBindingDirective } from "./binding";
|
|
1
|
+
import { _interpolationEnd, _interpolationStart, DOM } from "../dom.js";
|
|
2
|
+
import { HTMLBindingDirective } from "./binding.js";
|
|
3
3
|
let sharedContext = null;
|
|
4
4
|
class CompilationContext {
|
|
5
5
|
addFactory(factory) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Observable } from "../observation/observable";
|
|
2
|
-
import { emptyArray } from "../platform";
|
|
1
|
+
import { Observable } from "../observation/observable.js";
|
|
2
|
+
import { emptyArray } from "../platform.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
5
5
|
* @param selector - An optional selector to restrict the filter to.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DOM } from "../dom";
|
|
2
|
-
import { Observable, } from "../observation/observable";
|
|
3
|
-
import { enableArrayObservation } from "../observation/array-observer";
|
|
4
|
-
import { emptyArray } from "../platform";
|
|
5
|
-
import { HTMLDirective } from "./html-directive";
|
|
6
|
-
import { HTMLView } from "./view";
|
|
1
|
+
import { DOM } from "../dom.js";
|
|
2
|
+
import { Observable, } from "../observation/observable.js";
|
|
3
|
+
import { enableArrayObservation } from "../observation/array-observer.js";
|
|
4
|
+
import { emptyArray } from "../platform.js";
|
|
5
|
+
import { HTMLDirective } from "./html-directive.js";
|
|
6
|
+
import { HTMLView } from "./view.js";
|
|
7
7
|
const defaultRepeatOptions = Object.freeze({
|
|
8
8
|
positioning: false,
|
|
9
9
|
recycle: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AttachedBehaviorHTMLDirective } from "./html-directive";
|
|
2
|
-
import { NodeObservationBehavior } from "./node-observation";
|
|
1
|
+
import { AttachedBehaviorHTMLDirective } from "./html-directive.js";
|
|
2
|
+
import { NodeObservationBehavior } from "./node-observation.js";
|
|
3
3
|
/**
|
|
4
4
|
* The runtime behavior for slotted node observation.
|
|
5
5
|
* @public
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DOM } from "../dom";
|
|
2
|
-
import { defaultExecutionContext } from "../observation/observable";
|
|
3
|
-
import { compileTemplate } from "./compiler";
|
|
4
|
-
import { HTMLView } from "./view";
|
|
5
|
-
import { HTMLDirective, TargetedHTMLDirective, } from "./html-directive";
|
|
6
|
-
import { HTMLBindingDirective } from "./binding";
|
|
1
|
+
import { DOM } from "../dom.js";
|
|
2
|
+
import { defaultExecutionContext } from "../observation/observable.js";
|
|
3
|
+
import { compileTemplate } from "./compiler.js";
|
|
4
|
+
import { HTMLView } from "./view.js";
|
|
5
|
+
import { HTMLDirective, TargetedHTMLDirective, } from "./html-directive.js";
|
|
6
|
+
import { HTMLBindingDirective } from "./binding.js";
|
|
7
7
|
/**
|
|
8
8
|
* A template capable of creating HTMLView instances or rendering directly to DOM.
|
|
9
9
|
* @public
|
|
@@ -172,25 +172,27 @@ There are a couple of important details to note with array observation:
|
|
|
172
172
|
* If the array is a property of an object, you will often want to observe both the property and the array. Observing the property will allow you to detect when the array instance is completely replaced on the object, while observing the array will allow you to detect changes in the array instance itself. When the property changes, be sure to unsubscribe to the old array and set up a subscription to the new array instance.
|
|
173
173
|
* Observing an array only notifies on changes to the array itself. It does not notify on changes to properties on objects held within the array. Separate observers would need to be set up for those individual properties. These could be set up and torn down in response to changes in the array though.
|
|
174
174
|
|
|
175
|
-
##
|
|
175
|
+
## Observing Volatile Properties
|
|
176
176
|
|
|
177
|
-
In addition to watching properties and arrays, you can also watch
|
|
177
|
+
In addition to watching properties and arrays, you can also watch volatile properties.
|
|
178
178
|
|
|
179
|
-
**Example: Subscribing to a
|
|
179
|
+
**Example: Subscribing to a Volatile Property**
|
|
180
180
|
|
|
181
181
|
```ts
|
|
182
|
-
import { Observable } from '@microsoft/fast-element';
|
|
182
|
+
import { Observable, defaultExecutionContext } from '@microsoft/fast-element';
|
|
183
183
|
|
|
184
|
-
const
|
|
185
|
-
const bindingObserver = Observable.binding(binding);
|
|
184
|
+
const myObject = new MyClass();
|
|
186
185
|
const handler = {
|
|
187
186
|
handleChange(source: any) {
|
|
188
187
|
// respond to the change here
|
|
189
|
-
// the source is the
|
|
188
|
+
// the source is the volatile binding itself
|
|
190
189
|
}
|
|
191
190
|
};
|
|
191
|
+
const bindingObserver = Observable.binding(myObject.computedValue, handler);
|
|
192
|
+
bindingObserver.observe(myObject, defaultExecutionContext);
|
|
192
193
|
|
|
193
|
-
|
|
194
|
+
// Call this to dismantle the observer
|
|
195
|
+
bindingObserver.disconnect();
|
|
194
196
|
```
|
|
195
197
|
|
|
196
198
|
### Records
|
package/karma.conf.cjs
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
const basePath = path.resolve(__dirname);
|
|
4
|
+
|
|
5
|
+
const commonChromeFlags = [
|
|
6
|
+
"--no-default-browser-check",
|
|
7
|
+
"--no-first-run",
|
|
8
|
+
"--no-sandbox",
|
|
9
|
+
"--no-managed-user-acknowledgment-check",
|
|
10
|
+
"--disable-background-timer-throttling",
|
|
11
|
+
"--disable-backing-store-limit",
|
|
12
|
+
"--disable-boot-animation",
|
|
13
|
+
"--disable-cloud-import",
|
|
14
|
+
"--disable-contextual-search",
|
|
15
|
+
"--disable-default-apps",
|
|
16
|
+
"--disable-extensions",
|
|
17
|
+
"--disable-infobars",
|
|
18
|
+
"--disable-translate",
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
module.exports = function (config) {
|
|
22
|
+
let browsers;
|
|
23
|
+
if (process.env.BROWSERS) {
|
|
24
|
+
browsers = [process.env.BROWSERS];
|
|
25
|
+
} else if (config.browsers) {
|
|
26
|
+
browsers = config.browsers;
|
|
27
|
+
} else {
|
|
28
|
+
browsers = ["Chrome"];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const setup = "setup-browser" + (config.package ? "-" + config.package : "");
|
|
32
|
+
const options = {
|
|
33
|
+
basePath,
|
|
34
|
+
browserDisconnectTimeout: 10000,
|
|
35
|
+
processKillTimeout: 10000,
|
|
36
|
+
frameworks: ["source-map-support", "mocha"],
|
|
37
|
+
plugins: [
|
|
38
|
+
require("karma-mocha"),
|
|
39
|
+
require("karma-mocha-reporter"),
|
|
40
|
+
require("karma-webpack"),
|
|
41
|
+
require("karma-source-map-support"),
|
|
42
|
+
require("karma-sourcemap-loader"),
|
|
43
|
+
require("karma-coverage-istanbul-reporter"),
|
|
44
|
+
require("karma-chrome-launcher"),
|
|
45
|
+
require("karma-firefox-launcher"),
|
|
46
|
+
],
|
|
47
|
+
files: [`dist/esm/__test__/${setup}.js`],
|
|
48
|
+
preprocessors: {
|
|
49
|
+
[`dist/esm/__test__/${setup}.js`]: ["webpack", "sourcemap"],
|
|
50
|
+
},
|
|
51
|
+
webpackMiddleware: {
|
|
52
|
+
// webpack-dev-middleware configuration
|
|
53
|
+
// i. e.
|
|
54
|
+
stats: "errors-only",
|
|
55
|
+
},
|
|
56
|
+
webpack: {
|
|
57
|
+
mode: "none",
|
|
58
|
+
resolve: {
|
|
59
|
+
extensions: [".js"],
|
|
60
|
+
modules: ["dist", "node_modules"],
|
|
61
|
+
mainFields: ["module", "main"],
|
|
62
|
+
},
|
|
63
|
+
devtool: "inline-source-map",
|
|
64
|
+
performance: {
|
|
65
|
+
hints: false,
|
|
66
|
+
},
|
|
67
|
+
optimization: {
|
|
68
|
+
namedModules: false,
|
|
69
|
+
namedChunks: false,
|
|
70
|
+
nodeEnv: false,
|
|
71
|
+
usedExports: true,
|
|
72
|
+
flagIncludedChunks: false,
|
|
73
|
+
occurrenceOrder: false,
|
|
74
|
+
sideEffects: true,
|
|
75
|
+
concatenateModules: true,
|
|
76
|
+
splitChunks: {
|
|
77
|
+
name: false,
|
|
78
|
+
},
|
|
79
|
+
runtimeChunk: false,
|
|
80
|
+
noEmitOnErrors: false,
|
|
81
|
+
checkWasmTypes: false,
|
|
82
|
+
minimize: false,
|
|
83
|
+
},
|
|
84
|
+
module: {
|
|
85
|
+
rules: [
|
|
86
|
+
{
|
|
87
|
+
test: /\.js\.map$/,
|
|
88
|
+
use: ["ignore-loader"],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
test: /\.js$/,
|
|
92
|
+
use: [
|
|
93
|
+
{
|
|
94
|
+
loader: "source-map-loader",
|
|
95
|
+
options: {
|
|
96
|
+
enforce: "pre",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
mime: {
|
|
105
|
+
"text/x-typescript": ["ts"],
|
|
106
|
+
},
|
|
107
|
+
reporters: [config.reporter || (process.env.CI ? "min" : "progress")],
|
|
108
|
+
browsers: browsers,
|
|
109
|
+
customLaunchers: {
|
|
110
|
+
ChromeDebugging: {
|
|
111
|
+
base: "Chrome",
|
|
112
|
+
flags: [...commonChromeFlags, "--remote-debugging-port=9333"],
|
|
113
|
+
debug: true,
|
|
114
|
+
},
|
|
115
|
+
ChromeHeadlessOpt: {
|
|
116
|
+
base: "ChromeHeadless",
|
|
117
|
+
flags: [...commonChromeFlags],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
client: {
|
|
121
|
+
captureConsole: true,
|
|
122
|
+
mocha: {
|
|
123
|
+
bail: config["bail"],
|
|
124
|
+
ui: "bdd",
|
|
125
|
+
timeout: 5000,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
logLevel: config.LOG_ERROR, // to disable the WARN 404 for image requests
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
if (config.coverage) {
|
|
132
|
+
options.webpack.module.rules.push({
|
|
133
|
+
enforce: "post",
|
|
134
|
+
exclude: /(__tests__|testing|node_modules|\.spec\.[tj]s$)/,
|
|
135
|
+
loader: "istanbul-instrumenter-loader",
|
|
136
|
+
options: { esModules: true },
|
|
137
|
+
test: /\.[tj]s$/,
|
|
138
|
+
});
|
|
139
|
+
options.reporters = ["coverage-istanbul", ...options.reporters];
|
|
140
|
+
options.coverageIstanbulReporter = {
|
|
141
|
+
reports: ["html", "text-summary", "json", "lcovonly", "cobertura"],
|
|
142
|
+
dir: "coverage",
|
|
143
|
+
};
|
|
144
|
+
options.junitReporter = {
|
|
145
|
+
outputDir: "coverage",
|
|
146
|
+
outputFile: "test-results.xml",
|
|
147
|
+
useBrowserName: false,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
config.set(options);
|
|
152
|
+
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"description": "A library for constructing Web Components",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.9.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Microsoft",
|
|
8
8
|
"url": "https://discord.gg/FcSNfg4"
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"main": "dist/esm/index.js",
|
|
19
19
|
"types": "dist/fast-element.d.ts",
|
|
20
|
+
"type": "module",
|
|
20
21
|
"unpkg": "dist/fast-element.min.js",
|
|
21
22
|
"scripts": {
|
|
22
23
|
"clean:dist": "node ../../../build/clean.js dist",
|
|
@@ -32,17 +33,17 @@
|
|
|
32
33
|
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different",
|
|
33
34
|
"eslint": "eslint . --ext .ts",
|
|
34
35
|
"eslint:fix": "eslint . --ext .ts --fix",
|
|
35
|
-
"test": "yarn test-chrome:verbose && yarn doc:ci",
|
|
36
|
+
"test": "yarn eslint && yarn test-chrome:verbose && yarn doc:ci",
|
|
36
37
|
"test-node": "mocha --reporter min --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'",
|
|
37
38
|
"test-node:verbose": "mocha --reporter spec --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'",
|
|
38
|
-
"test-chrome": "karma start karma.conf.
|
|
39
|
-
"test-chrome:verbose": "karma start karma.conf.
|
|
40
|
-
"test-chrome:watch": "karma start karma.conf.
|
|
41
|
-
"test-chrome:debugger": "karma start karma.conf.
|
|
42
|
-
"test-chrome:verbose:watch": "karma start karma.conf.
|
|
43
|
-
"test-chrome:verbose:debugger": "karma start karma.conf.
|
|
44
|
-
"test-firefox": "karma start karma.conf.
|
|
45
|
-
"test-firefox:verbose": "karma start karma.conf.
|
|
39
|
+
"test-chrome": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --single-run --coverage",
|
|
40
|
+
"test-chrome:verbose": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --single-run --coverage --reporter=mocha",
|
|
41
|
+
"test-chrome:watch": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --coverage --watch-extensions js",
|
|
42
|
+
"test-chrome:debugger": "karma start karma.conf.cjs --browsers=ChromeDebugging",
|
|
43
|
+
"test-chrome:verbose:watch": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --coverage --watch-extensions js --reporter=mocha",
|
|
44
|
+
"test-chrome:verbose:debugger": "karma start karma.conf.cjs --browsers=ChromeDebugging --reporter=mocha",
|
|
45
|
+
"test-firefox": "karma start karma.conf.cjs --browsers=FirefoxHeadless --single-run --coverage",
|
|
46
|
+
"test-firefox:verbose": "karma start karma.conf.cjs --browsers=FirefoxHeadless --single-run --coverage --reporter=mocha"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@microsoft/api-extractor": "7.8.1",
|