@microsoft/fast-element 2.0.0-beta.2 → 2.0.0-beta.5

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.
Files changed (54) hide show
  1. package/CHANGELOG.json +147 -0
  2. package/CHANGELOG.md +42 -1
  3. package/dist/dts/components/fast-definitions.d.ts +9 -8
  4. package/dist/dts/components/fast-element.d.ts +12 -24
  5. package/dist/dts/context.d.ts +1 -1
  6. package/dist/dts/di/di.d.ts +858 -0
  7. package/dist/dts/hooks.d.ts +2 -2
  8. package/dist/dts/interfaces.d.ts +40 -7
  9. package/dist/dts/observation/observable.d.ts +19 -13
  10. package/dist/dts/styles/element-styles.d.ts +6 -0
  11. package/dist/dts/templating/binding-signal.d.ts +10 -27
  12. package/dist/dts/templating/binding-two-way.d.ts +16 -41
  13. package/dist/dts/templating/binding.d.ts +79 -118
  14. package/dist/dts/templating/html-directive.d.ts +31 -3
  15. package/dist/dts/templating/render.d.ts +277 -0
  16. package/dist/dts/templating/repeat.d.ts +12 -16
  17. package/dist/dts/templating/template.d.ts +3 -3
  18. package/dist/dts/templating/when.d.ts +3 -3
  19. package/dist/dts/testing/exports.d.ts +2 -0
  20. package/dist/dts/testing/fixture.d.ts +90 -0
  21. package/dist/dts/testing/timeout.d.ts +7 -0
  22. package/dist/esm/components/fast-definitions.js +25 -27
  23. package/dist/esm/components/fast-element.js +20 -11
  24. package/dist/esm/context.js +5 -1
  25. package/dist/esm/debug.js +36 -4
  26. package/dist/esm/di/di.js +1351 -0
  27. package/dist/esm/observation/arrays.js +303 -2
  28. package/dist/esm/observation/observable.js +11 -6
  29. package/dist/esm/platform.js +1 -1
  30. package/dist/esm/styles/element-styles.js +14 -0
  31. package/dist/esm/templating/binding-signal.js +56 -61
  32. package/dist/esm/templating/binding-two-way.js +56 -34
  33. package/dist/esm/templating/binding.js +137 -156
  34. package/dist/esm/templating/compiler.js +30 -7
  35. package/dist/esm/templating/html-directive.js +16 -2
  36. package/dist/esm/templating/render.js +392 -0
  37. package/dist/esm/templating/repeat.js +57 -40
  38. package/dist/esm/templating/template.js +8 -5
  39. package/dist/esm/templating/view.js +3 -1
  40. package/dist/esm/templating/when.js +5 -4
  41. package/dist/esm/testing/exports.js +2 -0
  42. package/dist/esm/testing/fixture.js +88 -0
  43. package/dist/esm/testing/timeout.js +24 -0
  44. package/dist/fast-element.api.json +2828 -2758
  45. package/dist/fast-element.d.ts +218 -230
  46. package/dist/fast-element.debug.js +656 -257
  47. package/dist/fast-element.debug.min.js +1 -1
  48. package/dist/fast-element.js +620 -253
  49. package/dist/fast-element.min.js +1 -1
  50. package/dist/fast-element.untrimmed.d.ts +226 -235
  51. package/docs/api-report.md +88 -91
  52. package/package.json +15 -6
  53. package/dist/dts/observation/splice-strategies.d.ts +0 -13
  54. package/dist/esm/observation/splice-strategies.js +0 -400
package/CHANGELOG.json CHANGED
@@ -1,6 +1,153 @@
1
1
  {
2
2
  "name": "@microsoft/fast-element",
3
3
  "entries": [
4
+ {
5
+ "date": "Thu, 18 Aug 2022 20:46:10 GMT",
6
+ "tag": "@microsoft/fast-element_v2.0.0-beta.5",
7
+ "version": "2.0.0-beta.5",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "nicholasrice@users.noreply.github.com",
12
+ "package": "@microsoft/fast-element",
13
+ "commit": "218cfc014f5c76464493725f83bd883e8b07defa",
14
+ "comment": "Fix ExpressionObserer bug where watcher was not reset if the binding threw"
15
+ },
16
+ {
17
+ "author": "prudepixie@users.noreply.github.com",
18
+ "package": "@microsoft/fast-element",
19
+ "commit": "fdd4514664691021a5673934c95acf31a8e73416",
20
+ "comment": "make insertbefore noop in view"
21
+ },
22
+ {
23
+ "author": "prudepixie@users.noreply.github.com",
24
+ "package": "@microsoft/fast-element",
25
+ "commit": "eb8d5a59f645b85567adadac41a3bfa66001f941",
26
+ "comment": "make sure default options for recycle gets set in different scenarios"
27
+ },
28
+ {
29
+ "author": "roeisenb@microsoft.com",
30
+ "package": "@microsoft/fast-element",
31
+ "commit": "ac3954c97acd3bd549a27829593855c431a24027",
32
+ "comment": "refactor: remove dependency of DI on FASTElement"
33
+ },
34
+ {
35
+ "author": "32497422+KingOfTac@users.noreply.github.com",
36
+ "package": "@microsoft/fast-element",
37
+ "commit": "29308db7920baaaac5b31b206d551669e165bc06",
38
+ "comment": "add subpath export for package.json to packages"
39
+ },
40
+ {
41
+ "author": "prudepixie@users.noreply.github.com",
42
+ "package": "@microsoft/fast-element",
43
+ "commit": "775d51602cba544347ec1e57fdb4fea248d1b1b5",
44
+ "comment": "change default array strategy to merge strategy, update repeat directive"
45
+ },
46
+ {
47
+ "author": "nicholasrice@users.noreply.github.com",
48
+ "package": "@microsoft/fast-element",
49
+ "commit": "aeac1198f427c33f789a2d869f58549ea5bfea57",
50
+ "comment": "assert FASTElement's type so that instanceof behavior is consistent with other class implementations"
51
+ }
52
+ ]
53
+ }
54
+ },
55
+ {
56
+ "date": "Mon, 18 Jul 2022 21:10:01 GMT",
57
+ "tag": "@microsoft/fast-element_v2.0.0-beta.4",
58
+ "version": "2.0.0-beta.4",
59
+ "comments": {
60
+ "prerelease": [
61
+ {
62
+ "author": "roeisenb@microsoft.com",
63
+ "package": "@microsoft/fast-element",
64
+ "commit": "f9fb9c88902bd81233fb927a7357d4bca7634f29",
65
+ "comment": "feat: extract all error messages from context and DI"
66
+ },
67
+ {
68
+ "author": "roeisenb@microsoft.com",
69
+ "package": "@microsoft/fast-element",
70
+ "commit": "27dc848327b25328e428f67505684d2171b58711",
71
+ "comment": "feat: introduce new binding API"
72
+ },
73
+ {
74
+ "author": "roeisenb@microsoft.com",
75
+ "package": "@microsoft/fast-element",
76
+ "commit": "7f4d6b5587f6eff52e5b7f414e27543bb4d7772d",
77
+ "comment": "Enabled DOM Container fallback functions when a container cannot be located."
78
+ },
79
+ {
80
+ "author": "roeisenb@microsoft.com",
81
+ "package": "@microsoft/fast-element",
82
+ "commit": "0f57d55822bbf97ab69f90efc0a0d100b27e10eb",
83
+ "comment": "feat: add render directive, renderWith decorator, and RenderInstruction"
84
+ },
85
+ {
86
+ "author": "prudepixie@users.noreply.github.com",
87
+ "package": "@microsoft/fast-element",
88
+ "commit": "94e6b0a0e7e1fd1167bd6453c3f7b27efdc91804",
89
+ "comment": "only store removed views if it can't be reused right away"
90
+ },
91
+ {
92
+ "author": "32497422+KingOfTac@users.noreply.github.com",
93
+ "package": "@microsoft/fast-element",
94
+ "commit": "11d5b4075118456b2e7c2a4f32a415eeea94ed7f",
95
+ "comment": "fix: enable createElementTemplate to have undefined attributes"
96
+ },
97
+ {
98
+ "author": "prudepixie@users.noreply.github.com",
99
+ "package": "@microsoft/fast-element",
100
+ "commit": "31296ea2be3981d25f5feb773b2895dbedfaf2c2",
101
+ "comment": "use index to track reusable views"
102
+ },
103
+ {
104
+ "author": "roeisenb@microsoft.com",
105
+ "package": "@microsoft/fast-element",
106
+ "commit": "4567188a47598b3d2589b05f039bea695f2b8875",
107
+ "comment": "feat: enable render, repeat, and when template helpers to handle static data in addition to the already supported dynamic bindings"
108
+ },
109
+ {
110
+ "author": "roeisenb@microsoft.com",
111
+ "package": "@microsoft/fast-element",
112
+ "commit": "f164aa75e62ed71c9386902051c021f1fdfba364",
113
+ "comment": "fix: FASTElementDefinition#isDefined should be true only after define"
114
+ },
115
+ {
116
+ "author": "roeisenb@microsoft.com",
117
+ "package": "@microsoft/fast-element",
118
+ "commit": "aacfde6d1f52a20af5511c5e792f730bd091d452",
119
+ "comment": "feat: move testing and dependency injection to fast-element"
120
+ },
121
+ {
122
+ "author": "roeisenb@microsoft.com",
123
+ "package": "@microsoft/fast-element",
124
+ "commit": "04c51a17dde6d03dc2e2a4de3666cbbec950d900",
125
+ "comment": "fix: warn when host bindings are accidentally applied on non CE views"
126
+ },
127
+ {
128
+ "author": "roeisenb@microsoft.com",
129
+ "package": "@microsoft/fast-element",
130
+ "commit": "b32eb1004960da95b74dba7f111ee859b6655896",
131
+ "comment": "feat: perf and safety improvements to fast element definition"
132
+ }
133
+ ]
134
+ }
135
+ },
136
+ {
137
+ "date": "Wed, 22 Jun 2022 20:17:50 GMT",
138
+ "tag": "@microsoft/fast-element_v2.0.0-beta.3",
139
+ "version": "2.0.0-beta.3",
140
+ "comments": {
141
+ "prerelease": [
142
+ {
143
+ "comment": "fix: correct aspect type for content that looks like an attribute",
144
+ "author": "nicholasrice@users.noreply.github.com",
145
+ "commit": "f28cdb9fdba9cb27904acfad7444de82d447f39e",
146
+ "package": "@microsoft/fast-element"
147
+ }
148
+ ]
149
+ }
150
+ },
4
151
  {
5
152
  "date": "Wed, 15 Jun 2022 17:41:10 GMT",
6
153
  "tag": "@microsoft/fast-element_v2.0.0-beta.2",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,50 @@
1
1
  # Change Log - @microsoft/fast-element
2
2
 
3
- This log was last generated on Wed, 15 Jun 2022 17:41:10 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 18 Aug 2022 20:46:10 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.0.0-beta.5
8
+
9
+ Thu, 18 Aug 2022 20:46:10 GMT
10
+
11
+ ### Changes
12
+
13
+ - Fix ExpressionObserer bug where watcher was not reset if the binding threw (nicholasrice@users.noreply.github.com)
14
+ - make insertbefore noop in view (prudepixie@users.noreply.github.com)
15
+ - make sure default options for recycle gets set in different scenarios (prudepixie@users.noreply.github.com)
16
+ - refactor: remove dependency of DI on FASTElement (roeisenb@microsoft.com)
17
+ - add subpath export for package.json to packages (32497422+KingOfTac@users.noreply.github.com)
18
+ - change default array strategy to merge strategy, update repeat directive (prudepixie@users.noreply.github.com)
19
+ - assert FASTElement's type so that instanceof behavior is consistent with other class implementations (nicholasrice@users.noreply.github.com)
20
+
21
+ ## 2.0.0-beta.4
22
+
23
+ Mon, 18 Jul 2022 21:10:01 GMT
24
+
25
+ ### Changes
26
+
27
+ - feat: extract all error messages from context and DI (roeisenb@microsoft.com)
28
+ - feat: introduce new binding API (roeisenb@microsoft.com)
29
+ - Enabled DOM Container fallback functions when a container cannot be located. (roeisenb@microsoft.com)
30
+ - feat: add render directive, renderWith decorator, and RenderInstruction (roeisenb@microsoft.com)
31
+ - only store removed views if it can't be reused right away (prudepixie@users.noreply.github.com)
32
+ - fix: enable createElementTemplate to have undefined attributes (32497422+KingOfTac@users.noreply.github.com)
33
+ - use index to track reusable views (prudepixie@users.noreply.github.com)
34
+ - feat: enable render, repeat, and when template helpers to handle static data in addition to the already supported dynamic bindings (roeisenb@microsoft.com)
35
+ - fix: FASTElementDefinition#isDefined should be true only after define (roeisenb@microsoft.com)
36
+ - feat: move testing and dependency injection to fast-element (roeisenb@microsoft.com)
37
+ - fix: warn when host bindings are accidentally applied on non CE views (roeisenb@microsoft.com)
38
+ - feat: perf and safety improvements to fast element definition (roeisenb@microsoft.com)
39
+
40
+ ## 2.0.0-beta.3
41
+
42
+ Wed, 22 Jun 2022 20:17:50 GMT
43
+
44
+ ### Changes
45
+
46
+ - fix: correct aspect type for content that looks like an attribute (nicholasrice@users.noreply.github.com)
47
+
7
48
  ## 2.0.0-beta.2
8
49
 
9
50
  Wed, 15 Jun 2022 17:41:10 GMT
@@ -37,7 +37,7 @@ export interface PartialFASTElementDefinition {
37
37
  * @public
38
38
  */
39
39
  export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
40
- private observedAttributes;
40
+ private platformDefined;
41
41
  /**
42
42
  * The type this element definition describes.
43
43
  */
@@ -78,13 +78,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
78
78
  * Options controlling how the custom element is defined with the platform.
79
79
  */
80
80
  readonly elementOptions?: ElementDefinitionOptions;
81
- /**
82
- * Creates an instance of FASTElementDefinition.
83
- * @param type - The type this definition is being created for.
84
- * @param nameOrConfig - The name of the element to define or a config object
85
- * that describes the element to define.
86
- */
87
- constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
81
+ private constructor();
88
82
  /**
89
83
  * Defines a custom element based on this definition.
90
84
  * @param registry - The element registry to define the element in.
@@ -92,6 +86,13 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
92
86
  * This operation is idempotent per registry.
93
87
  */
94
88
  define(registry?: CustomElementRegistry): this;
89
+ /**
90
+ * Creates an instance of FASTElementDefinition.
91
+ * @param type - The type this definition is being created for.
92
+ * @param nameOrDef - The name of the element to define or a config object
93
+ * that describes the element to define.
94
+ */
95
+ static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
95
96
  /**
96
97
  * Gets the element definition associated with the specified type.
97
98
  * @param type - The custom element type to retrieve the definition for.
@@ -1,4 +1,4 @@
1
- import type { Constructable } from "../interfaces.js";
1
+ import { Constructable } from "../interfaces.js";
2
2
  import { Controller } from "./controller.js";
3
3
  import { FASTElementDefinition, PartialFASTElementDefinition } from "./fast-definitions.js";
4
4
  /**
@@ -45,34 +45,21 @@ export interface FASTElement extends HTMLElement {
45
45
  */
46
46
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
47
47
  }
48
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
49
+ declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
50
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
51
+ declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
52
+ declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
48
53
  /**
49
54
  * A minimal base class for FASTElements that also provides
50
55
  * static helpers for working with FASTElements.
51
56
  * @public
52
57
  */
53
- export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
54
- /**
55
- * Creates a new FASTElement base class inherited from the
56
- * provided base type.
57
- * @param BaseType - The base element type to inherit from.
58
- */
59
- from<TBase extends {
60
- new (): HTMLElement;
61
- prototype: HTMLElement;
62
- }>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
63
- /**
64
- * Defines a platform custom element based on the provided type and definition.
65
- * @param type - The custom element type to define.
66
- * @param nameOrDef - The name of the element to define or a definition object
67
- * that describes the element to define.
68
- */
69
- define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
70
- /**
71
- * Defines metadata for a FASTElement which can be used to later define the element.
72
- * IMPORTANT: This API will be renamed to "compose" in a future beta.
73
- * @public
74
- */
75
- metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
58
+ export declare const FASTElement: {
59
+ new (): FASTElement;
60
+ define: typeof define;
61
+ compose: typeof compose;
62
+ from: typeof from;
76
63
  };
77
64
  /**
78
65
  * Decorator: Defines a platform custom element based on `FASTElement`.
@@ -81,3 +68,4 @@ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
81
68
  * @public
82
69
  */
83
70
  export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
71
+ export {};
@@ -1,4 +1,4 @@
1
- import type { Constructable } from "./interfaces.js";
1
+ import { Constructable } from "./interfaces.js";
2
2
  /**
3
3
  * A Context object defines an optional initial value for a Context, as well as a name identifier for debugging purposes.
4
4
  * @public