@microsoft/fast-element 2.0.0-beta.3 → 2.0.0-beta.6

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 (68) 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/interfaces.d.ts +43 -7
  8. package/dist/dts/observation/observable.d.ts +19 -13
  9. package/dist/dts/state/exports.d.ts +3 -0
  10. package/dist/dts/state/reactive.d.ts +8 -0
  11. package/dist/dts/state/state.d.ts +141 -0
  12. package/dist/dts/state/visitor.d.ts +6 -0
  13. package/dist/dts/state/watch.d.ts +10 -0
  14. package/dist/dts/styles/element-styles.d.ts +6 -0
  15. package/dist/dts/templating/binding-signal.d.ts +10 -27
  16. package/dist/dts/templating/binding-two-way.d.ts +16 -41
  17. package/dist/dts/templating/binding.d.ts +79 -118
  18. package/dist/dts/templating/html-directive.d.ts +28 -2
  19. package/dist/dts/templating/render.d.ts +277 -0
  20. package/dist/dts/templating/repeat.d.ts +12 -16
  21. package/dist/dts/templating/template.d.ts +3 -3
  22. package/dist/dts/templating/when.d.ts +3 -3
  23. package/dist/dts/testing/exports.d.ts +2 -0
  24. package/dist/dts/testing/fixture.d.ts +90 -0
  25. package/dist/dts/testing/timeout.d.ts +7 -0
  26. package/dist/dts/utilities.d.ts +0 -18
  27. package/dist/esm/components/fast-definitions.js +25 -27
  28. package/dist/esm/components/fast-element.js +20 -11
  29. package/dist/esm/context.js +5 -1
  30. package/dist/esm/debug.js +35 -4
  31. package/dist/esm/di/di.js +1351 -0
  32. package/dist/esm/interfaces.js +4 -0
  33. package/dist/esm/observation/arrays.js +303 -2
  34. package/dist/esm/observation/observable.js +11 -6
  35. package/dist/esm/platform.js +1 -1
  36. package/dist/esm/state/exports.js +3 -0
  37. package/dist/esm/state/reactive.js +34 -0
  38. package/dist/esm/state/state.js +148 -0
  39. package/dist/esm/state/visitor.js +28 -0
  40. package/dist/esm/state/watch.js +36 -0
  41. package/dist/esm/styles/element-styles.js +14 -0
  42. package/dist/esm/templating/binding-signal.js +56 -61
  43. package/dist/esm/templating/binding-two-way.js +51 -35
  44. package/dist/esm/templating/binding.js +137 -156
  45. package/dist/esm/templating/compiler.js +29 -7
  46. package/dist/esm/templating/html-directive.js +12 -1
  47. package/dist/esm/templating/render.js +392 -0
  48. package/dist/esm/templating/repeat.js +57 -40
  49. package/dist/esm/templating/template.js +8 -5
  50. package/dist/esm/templating/view.js +3 -1
  51. package/dist/esm/templating/when.js +5 -4
  52. package/dist/esm/testing/exports.js +2 -0
  53. package/dist/esm/testing/fixture.js +88 -0
  54. package/dist/esm/testing/timeout.js +24 -0
  55. package/dist/esm/utilities.js +0 -95
  56. package/dist/fast-element.api.json +2827 -2757
  57. package/dist/fast-element.d.ts +215 -229
  58. package/dist/fast-element.debug.js +650 -256
  59. package/dist/fast-element.debug.min.js +1 -1
  60. package/dist/fast-element.js +615 -252
  61. package/dist/fast-element.min.js +1 -1
  62. package/dist/fast-element.untrimmed.d.ts +223 -234
  63. package/docs/api-report.md +87 -90
  64. package/package.json +18 -9
  65. package/dist/dts/hooks.d.ts +0 -20
  66. package/dist/dts/observation/splice-strategies.d.ts +0 -13
  67. package/dist/esm/hooks.js +0 -32
  68. 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, 01 Sep 2022 21:53:34 GMT",
6
+ "tag": "@microsoft/fast-element_v2.0.0-beta.6",
7
+ "version": "2.0.0-beta.6",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "roeisenb@microsoft.com",
12
+ "package": "@microsoft/fast-element",
13
+ "commit": "da9ebbe1b7471cd4e6f7b74f2f9bf02fcc54da4f",
14
+ "comment": "feat: add new state, ownedState, and computedState APIs"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 18 Aug 2022 20:46:10 GMT",
21
+ "tag": "@microsoft/fast-element_v2.0.0-beta.5",
22
+ "version": "2.0.0-beta.5",
23
+ "comments": {
24
+ "prerelease": [
25
+ {
26
+ "author": "nicholasrice@users.noreply.github.com",
27
+ "package": "@microsoft/fast-element",
28
+ "commit": "218cfc014f5c76464493725f83bd883e8b07defa",
29
+ "comment": "Fix ExpressionObserer bug where watcher was not reset if the binding threw"
30
+ },
31
+ {
32
+ "author": "prudepixie@users.noreply.github.com",
33
+ "package": "@microsoft/fast-element",
34
+ "commit": "fdd4514664691021a5673934c95acf31a8e73416",
35
+ "comment": "make insertbefore noop in view"
36
+ },
37
+ {
38
+ "author": "prudepixie@users.noreply.github.com",
39
+ "package": "@microsoft/fast-element",
40
+ "commit": "eb8d5a59f645b85567adadac41a3bfa66001f941",
41
+ "comment": "make sure default options for recycle gets set in different scenarios"
42
+ },
43
+ {
44
+ "author": "roeisenb@microsoft.com",
45
+ "package": "@microsoft/fast-element",
46
+ "commit": "ac3954c97acd3bd549a27829593855c431a24027",
47
+ "comment": "refactor: remove dependency of DI on FASTElement"
48
+ },
49
+ {
50
+ "author": "32497422+KingOfTac@users.noreply.github.com",
51
+ "package": "@microsoft/fast-element",
52
+ "commit": "29308db7920baaaac5b31b206d551669e165bc06",
53
+ "comment": "add subpath export for package.json to packages"
54
+ },
55
+ {
56
+ "author": "prudepixie@users.noreply.github.com",
57
+ "package": "@microsoft/fast-element",
58
+ "commit": "775d51602cba544347ec1e57fdb4fea248d1b1b5",
59
+ "comment": "change default array strategy to merge strategy, update repeat directive"
60
+ },
61
+ {
62
+ "author": "nicholasrice@users.noreply.github.com",
63
+ "package": "@microsoft/fast-element",
64
+ "commit": "aeac1198f427c33f789a2d869f58549ea5bfea57",
65
+ "comment": "assert FASTElement's type so that instanceof behavior is consistent with other class implementations"
66
+ }
67
+ ]
68
+ }
69
+ },
70
+ {
71
+ "date": "Mon, 18 Jul 2022 21:10:01 GMT",
72
+ "tag": "@microsoft/fast-element_v2.0.0-beta.4",
73
+ "version": "2.0.0-beta.4",
74
+ "comments": {
75
+ "prerelease": [
76
+ {
77
+ "author": "roeisenb@microsoft.com",
78
+ "package": "@microsoft/fast-element",
79
+ "commit": "f9fb9c88902bd81233fb927a7357d4bca7634f29",
80
+ "comment": "feat: extract all error messages from context and DI"
81
+ },
82
+ {
83
+ "author": "roeisenb@microsoft.com",
84
+ "package": "@microsoft/fast-element",
85
+ "commit": "27dc848327b25328e428f67505684d2171b58711",
86
+ "comment": "feat: introduce new binding API"
87
+ },
88
+ {
89
+ "author": "roeisenb@microsoft.com",
90
+ "package": "@microsoft/fast-element",
91
+ "commit": "7f4d6b5587f6eff52e5b7f414e27543bb4d7772d",
92
+ "comment": "Enabled DOM Container fallback functions when a container cannot be located."
93
+ },
94
+ {
95
+ "author": "roeisenb@microsoft.com",
96
+ "package": "@microsoft/fast-element",
97
+ "commit": "0f57d55822bbf97ab69f90efc0a0d100b27e10eb",
98
+ "comment": "feat: add render directive, renderWith decorator, and RenderInstruction"
99
+ },
100
+ {
101
+ "author": "prudepixie@users.noreply.github.com",
102
+ "package": "@microsoft/fast-element",
103
+ "commit": "94e6b0a0e7e1fd1167bd6453c3f7b27efdc91804",
104
+ "comment": "only store removed views if it can't be reused right away"
105
+ },
106
+ {
107
+ "author": "32497422+KingOfTac@users.noreply.github.com",
108
+ "package": "@microsoft/fast-element",
109
+ "commit": "11d5b4075118456b2e7c2a4f32a415eeea94ed7f",
110
+ "comment": "fix: enable createElementTemplate to have undefined attributes"
111
+ },
112
+ {
113
+ "author": "prudepixie@users.noreply.github.com",
114
+ "package": "@microsoft/fast-element",
115
+ "commit": "31296ea2be3981d25f5feb773b2895dbedfaf2c2",
116
+ "comment": "use index to track reusable views"
117
+ },
118
+ {
119
+ "author": "roeisenb@microsoft.com",
120
+ "package": "@microsoft/fast-element",
121
+ "commit": "4567188a47598b3d2589b05f039bea695f2b8875",
122
+ "comment": "feat: enable render, repeat, and when template helpers to handle static data in addition to the already supported dynamic bindings"
123
+ },
124
+ {
125
+ "author": "roeisenb@microsoft.com",
126
+ "package": "@microsoft/fast-element",
127
+ "commit": "f164aa75e62ed71c9386902051c021f1fdfba364",
128
+ "comment": "fix: FASTElementDefinition#isDefined should be true only after define"
129
+ },
130
+ {
131
+ "author": "roeisenb@microsoft.com",
132
+ "package": "@microsoft/fast-element",
133
+ "commit": "aacfde6d1f52a20af5511c5e792f730bd091d452",
134
+ "comment": "feat: move testing and dependency injection to fast-element"
135
+ },
136
+ {
137
+ "author": "roeisenb@microsoft.com",
138
+ "package": "@microsoft/fast-element",
139
+ "commit": "04c51a17dde6d03dc2e2a4de3666cbbec950d900",
140
+ "comment": "fix: warn when host bindings are accidentally applied on non CE views"
141
+ },
142
+ {
143
+ "author": "roeisenb@microsoft.com",
144
+ "package": "@microsoft/fast-element",
145
+ "commit": "b32eb1004960da95b74dba7f111ee859b6655896",
146
+ "comment": "feat: perf and safety improvements to fast element definition"
147
+ }
148
+ ]
149
+ }
150
+ },
4
151
  {
5
152
  "date": "Wed, 22 Jun 2022 20:17:50 GMT",
6
153
  "tag": "@microsoft/fast-element_v2.0.0-beta.3",
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, 22 Jun 2022 20:17:50 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 01 Sep 2022 21:53:34 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.0.0-beta.6
8
+
9
+ Thu, 01 Sep 2022 21:53:34 GMT
10
+
11
+ ### Changes
12
+
13
+ - feat: add new state, ownedState, and computedState APIs (roeisenb@microsoft.com)
14
+
15
+ ## 2.0.0-beta.5
16
+
17
+ Thu, 18 Aug 2022 20:46:10 GMT
18
+
19
+ ### Changes
20
+
21
+ - Fix ExpressionObserer bug where watcher was not reset if the binding threw (nicholasrice@users.noreply.github.com)
22
+ - make insertbefore noop in view (prudepixie@users.noreply.github.com)
23
+ - make sure default options for recycle gets set in different scenarios (prudepixie@users.noreply.github.com)
24
+ - refactor: remove dependency of DI on FASTElement (roeisenb@microsoft.com)
25
+ - add subpath export for package.json to packages (32497422+KingOfTac@users.noreply.github.com)
26
+ - change default array strategy to merge strategy, update repeat directive (prudepixie@users.noreply.github.com)
27
+ - assert FASTElement's type so that instanceof behavior is consistent with other class implementations (nicholasrice@users.noreply.github.com)
28
+
29
+ ## 2.0.0-beta.4
30
+
31
+ Mon, 18 Jul 2022 21:10:01 GMT
32
+
33
+ ### Changes
34
+
35
+ - feat: extract all error messages from context and DI (roeisenb@microsoft.com)
36
+ - feat: introduce new binding API (roeisenb@microsoft.com)
37
+ - Enabled DOM Container fallback functions when a container cannot be located. (roeisenb@microsoft.com)
38
+ - feat: add render directive, renderWith decorator, and RenderInstruction (roeisenb@microsoft.com)
39
+ - only store removed views if it can't be reused right away (prudepixie@users.noreply.github.com)
40
+ - fix: enable createElementTemplate to have undefined attributes (32497422+KingOfTac@users.noreply.github.com)
41
+ - use index to track reusable views (prudepixie@users.noreply.github.com)
42
+ - feat: enable render, repeat, and when template helpers to handle static data in addition to the already supported dynamic bindings (roeisenb@microsoft.com)
43
+ - fix: FASTElementDefinition#isDefined should be true only after define (roeisenb@microsoft.com)
44
+ - feat: move testing and dependency injection to fast-element (roeisenb@microsoft.com)
45
+ - fix: warn when host bindings are accidentally applied on non CE views (roeisenb@microsoft.com)
46
+ - feat: perf and safety improvements to fast element definition (roeisenb@microsoft.com)
47
+
7
48
  ## 2.0.0-beta.3
8
49
 
9
50
  Wed, 22 Jun 2022 20:17:50 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