@microsoft/fast-element 1.10.2 → 2.0.0-beta.1

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 (95) hide show
  1. package/.eslintrc.json +1 -12
  2. package/CHANGELOG.json +321 -1
  3. package/CHANGELOG.md +52 -2
  4. package/README.md +2 -2
  5. package/dist/dts/components/attributes.d.ts +4 -1
  6. package/dist/dts/components/controller.d.ts +12 -11
  7. package/dist/dts/components/fast-definitions.d.ts +8 -2
  8. package/dist/dts/components/fast-element.d.ts +5 -4
  9. package/dist/dts/debug.d.ts +1 -0
  10. package/dist/dts/hooks.d.ts +20 -0
  11. package/dist/dts/index.d.ts +16 -15
  12. package/dist/dts/index.debug.d.ts +2 -0
  13. package/dist/dts/index.rollup.d.ts +2 -0
  14. package/dist/dts/index.rollup.debug.d.ts +3 -0
  15. package/dist/dts/interfaces.d.ts +144 -0
  16. package/dist/dts/observation/arrays.d.ts +207 -0
  17. package/dist/dts/observation/behavior.d.ts +5 -5
  18. package/dist/dts/observation/notifier.d.ts +18 -18
  19. package/dist/dts/observation/observable.d.ts +86 -29
  20. package/dist/dts/observation/splice-strategies.d.ts +13 -0
  21. package/dist/dts/observation/update-queue.d.ts +40 -0
  22. package/dist/dts/platform.d.ts +18 -67
  23. package/dist/dts/polyfills.d.ts +8 -0
  24. package/dist/dts/styles/css-directive.d.ts +43 -5
  25. package/dist/dts/styles/css.d.ts +19 -3
  26. package/dist/dts/styles/element-styles.d.ts +42 -62
  27. package/dist/dts/templating/binding.d.ts +320 -64
  28. package/dist/dts/templating/children.d.ts +18 -15
  29. package/dist/dts/templating/compiler.d.ts +47 -28
  30. package/dist/dts/templating/dom.d.ts +41 -0
  31. package/dist/dts/templating/html-directive.d.ts +179 -43
  32. package/dist/dts/templating/markup.d.ts +48 -0
  33. package/dist/dts/templating/node-observation.d.ts +45 -29
  34. package/dist/dts/templating/ref.d.ts +6 -12
  35. package/dist/dts/templating/repeat.d.ts +72 -14
  36. package/dist/dts/templating/slotted.d.ts +13 -14
  37. package/dist/dts/templating/template.d.ts +78 -23
  38. package/dist/dts/templating/view.d.ts +16 -23
  39. package/dist/dts/utilities.d.ts +40 -0
  40. package/dist/esm/components/attributes.js +25 -24
  41. package/dist/esm/components/controller.js +77 -57
  42. package/dist/esm/components/fast-definitions.js +14 -22
  43. package/dist/esm/debug.js +29 -0
  44. package/dist/esm/hooks.js +32 -0
  45. package/dist/esm/index.debug.js +2 -0
  46. package/dist/esm/index.js +19 -14
  47. package/dist/esm/index.rollup.debug.js +3 -0
  48. package/dist/esm/index.rollup.js +2 -0
  49. package/dist/esm/interfaces.js +8 -1
  50. package/dist/esm/observation/arrays.js +269 -0
  51. package/dist/esm/observation/notifier.js +27 -35
  52. package/dist/esm/observation/observable.js +80 -107
  53. package/dist/esm/observation/{array-change-records.js → splice-strategies.js} +136 -62
  54. package/dist/esm/observation/update-queue.js +67 -0
  55. package/dist/esm/platform.js +36 -42
  56. package/dist/esm/polyfills.js +85 -0
  57. package/dist/esm/styles/css-directive.js +29 -13
  58. package/dist/esm/styles/css.js +27 -40
  59. package/dist/esm/styles/element-styles.js +65 -104
  60. package/dist/esm/templating/binding.js +465 -155
  61. package/dist/esm/templating/children.js +33 -23
  62. package/dist/esm/templating/compiler.js +235 -152
  63. package/dist/esm/templating/dom.js +49 -0
  64. package/dist/esm/templating/html-directive.js +125 -40
  65. package/dist/esm/templating/markup.js +75 -0
  66. package/dist/esm/templating/node-observation.js +50 -45
  67. package/dist/esm/templating/ref.js +7 -16
  68. package/dist/esm/templating/repeat.js +38 -43
  69. package/dist/esm/templating/slotted.js +23 -20
  70. package/dist/esm/templating/template.js +71 -95
  71. package/dist/esm/templating/view.js +44 -43
  72. package/dist/esm/templating/when.js +2 -1
  73. package/dist/esm/utilities.js +139 -0
  74. package/dist/fast-element.api.json +13633 -5266
  75. package/dist/fast-element.d.ts +1434 -578
  76. package/dist/fast-element.debug.js +3824 -0
  77. package/dist/fast-element.debug.min.js +1 -0
  78. package/dist/fast-element.js +3574 -4020
  79. package/dist/fast-element.min.js +1 -1
  80. package/dist/fast-element.untrimmed.d.ts +2908 -0
  81. package/dist/tsdoc-metadata.json +1 -1
  82. package/docs/api-report.md +590 -231
  83. package/docs/fast-element-2-changes.md +15 -0
  84. package/docs/guide/declaring-templates.md +4 -4
  85. package/docs/guide/defining-elements.md +2 -2
  86. package/docs/guide/next-steps.md +2 -2
  87. package/docs/guide/observables-and-state.md +1 -1
  88. package/docs/guide/using-directives.md +1 -1
  89. package/karma.conf.cjs +6 -17
  90. package/package.json +46 -14
  91. package/dist/dts/dom.d.ts +0 -112
  92. package/dist/dts/observation/array-change-records.d.ts +0 -48
  93. package/dist/dts/observation/array-observer.d.ts +0 -9
  94. package/dist/esm/dom.js +0 -207
  95. package/dist/esm/observation/array-observer.js +0 -177
@@ -1,16 +1,17 @@
1
- import { Binding } from "../observation/observable.js";
2
- import { ElementView, HTMLView, SyntheticView } from "./view.js";
3
- import { HTMLDirective } from "./html-directive.js";
1
+ import { Binding, ChildContext, ExecutionContext, ItemContext } from "../observation/observable.js";
2
+ import { HTMLDirective, ViewBehaviorFactory } from "./html-directive.js";
3
+ import type { ElementView, HTMLView, SyntheticView } from "./view.js";
4
4
  /**
5
5
  * A template capable of creating views specifically for rendering custom elements.
6
6
  * @public
7
7
  */
8
- export interface ElementViewTemplate {
8
+ export interface ElementViewTemplate<TSource = any, TParent = any> {
9
+ type: "element";
9
10
  /**
10
11
  * Creates an ElementView instance based on this template definition.
11
12
  * @param hostBindingTarget - The element that host behaviors will be bound to.
12
13
  */
13
- create(hostBindingTarget: Element): ElementView;
14
+ create(hostBindingTarget: Element): ElementView<TSource, TParent>;
14
15
  /**
15
16
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
16
17
  * @param source - The data source to bind the template to.
@@ -18,29 +19,63 @@ export interface ElementViewTemplate {
18
19
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
19
20
  * host that the template is being attached to.
20
21
  */
21
- render(source: any, host: Node, hostBindingTarget?: Element): HTMLView;
22
+ render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
22
23
  }
23
24
  /**
24
25
  * A template capable of rendering views not specifically connected to custom elements.
25
26
  * @public
26
27
  */
27
- export interface SyntheticViewTemplate<TSource = any, TParent = any> {
28
+ export interface SyntheticViewTemplate<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> {
29
+ type: "synthetic";
28
30
  /**
29
31
  * Creates a SyntheticView instance based on this template definition.
30
32
  */
31
- create(): SyntheticView;
33
+ create(): SyntheticView<TSource, TParent, TContext>;
34
+ }
35
+ /**
36
+ * A template capable of rendering child views not specifically connected to custom elements.
37
+ * @public
38
+ */
39
+ export interface ChildViewTemplate<TSource = any, TParent = any> {
40
+ type: "child";
41
+ /**
42
+ * Creates a SyntheticView instance based on this template definition.
43
+ */
44
+ create(): SyntheticView<TSource, TParent, ChildContext<TParent>>;
45
+ }
46
+ /**
47
+ * A template capable of rendering item views not specifically connected to custom elements.
48
+ * @public
49
+ */
50
+ export interface ItemViewTemplate<TSource = any, TParent = any> {
51
+ type: "item";
52
+ /**
53
+ * Creates a SyntheticView instance based on this template definition.
54
+ */
55
+ create(): SyntheticView<TSource, TParent, ItemContext<TParent>>;
56
+ }
57
+ /**
58
+ * The result of a template compilation operation.
59
+ * @public
60
+ */
61
+ export interface HTMLTemplateCompilationResult<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> {
62
+ /**
63
+ * Creates a view instance.
64
+ * @param hostBindingTarget - The host binding target for the view.
65
+ */
66
+ createView(hostBindingTarget?: Element): HTMLView<TSource, TParent, TContext>;
32
67
  }
33
68
  /**
34
69
  * A template capable of creating HTMLView instances or rendering directly to DOM.
35
70
  * @public
36
71
  */
37
- export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate, SyntheticViewTemplate {
38
- private behaviorCount;
39
- private hasHostBehaviors;
40
- private fragment;
41
- private targetOffset;
42
- private viewBehaviorFactories;
43
- private hostBehaviorFactories;
72
+ export declare class ViewTemplate<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent, TContext> {
73
+ private result;
74
+ /**
75
+ * Used for TypeScript purposes only.
76
+ * Do not use.
77
+ */
78
+ type: any;
44
79
  /**
45
80
  * The html representing what this template will
46
81
  * instantiate, including placeholders for directives.
@@ -49,18 +84,18 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
49
84
  /**
50
85
  * The directives that will be connected to placeholders in the html.
51
86
  */
52
- readonly directives: ReadonlyArray<HTMLDirective>;
87
+ readonly factories: Record<string, ViewBehaviorFactory>;
53
88
  /**
54
89
  * Creates an instance of ViewTemplate.
55
90
  * @param html - The html representing what this template will instantiate, including placeholders for directives.
56
- * @param directives - The directives that will be connected to placeholders in the html.
91
+ * @param factories - The directives that will be connected to placeholders in the html.
57
92
  */
58
- constructor(html: string | HTMLTemplateElement, directives: ReadonlyArray<HTMLDirective>);
93
+ constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
59
94
  /**
60
95
  * Creates an HTMLView instance based on this template definition.
61
96
  * @param hostBindingTarget - The element that host behaviors will be bound to.
62
97
  */
63
- create(hostBindingTarget?: Element): HTMLView;
98
+ create(hostBindingTarget?: Element): HTMLView<TSource, TParent, TContext>;
64
99
  /**
65
100
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
66
101
  * @param source - The data source to bind the template to.
@@ -68,7 +103,7 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
68
103
  * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
69
104
  * host that the template is being attached to.
70
105
  */
71
- render(source: TSource, host: Node | string, hostBindingTarget?: Element): HTMLView;
106
+ render(source: TSource, host: Node, hostBindingTarget?: Element, context?: TContext): HTMLView<TSource, TParent, TContext>;
72
107
  }
73
108
  /**
74
109
  * A marker interface used to capture types when interpolating Directive helpers
@@ -81,9 +116,29 @@ export interface CaptureType<TSource> {
81
116
  * Represents the types of values that can be interpolated into a template.
82
117
  * @public
83
118
  */
84
- export declare type TemplateValue<TScope, TParent = any> = Binding<TScope, any, TParent> | string | number | HTMLDirective | CaptureType<TScope>;
119
+ export declare type TemplateValue<TSource, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> = Binding<TSource, any, TContext> | HTMLDirective | CaptureType<TSource>;
120
+ /**
121
+ * Transforms a template literal string into a ViewTemplate.
122
+ * @param strings - The string fragments that are interpolated with the values.
123
+ * @param values - The values that are interpolated with the string fragments.
124
+ * @remarks
125
+ * The html helper supports interpolation of strings, numbers, binding expressions,
126
+ * other template instances, and Directive instances.
127
+ * @public
128
+ */
129
+ export declare function html<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent, TContext>[]): ViewTemplate<TSource, TParent>;
130
+ /**
131
+ * Transforms a template literal string into a ChildViewTemplate.
132
+ * @param strings - The string fragments that are interpolated with the values.
133
+ * @param values - The values that are interpolated with the string fragments.
134
+ * @remarks
135
+ * The html helper supports interpolation of strings, numbers, binding expressions,
136
+ * other template instances, and Directive instances.
137
+ * @public
138
+ */
139
+ export declare const child: <TChild = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TChild, TParent, ChildContext<TParent>>[]) => ChildViewTemplate<TChild, TParent>;
85
140
  /**
86
- * Transforms a template literal string into a renderable ViewTemplate.
141
+ * Transforms a template literal string into an ItemViewTemplate.
87
142
  * @param strings - The string fragments that are interpolated with the values.
88
143
  * @param values - The values that are interpolated with the string fragments.
89
144
  * @remarks
@@ -91,4 +146,4 @@ export declare type TemplateValue<TScope, TParent = any> = Binding<TScope, any,
91
146
  * other template instances, and Directive instances.
92
147
  * @public
93
148
  */
94
- export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
149
+ export declare const item: <TItem = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TItem, TParent, ItemContext<TParent>>[]) => ItemViewTemplate<TItem, TParent>;
@@ -1,39 +1,35 @@
1
- import type { Behavior } from "../observation/behavior.js";
2
- import type { ExecutionContext } from "../observation/observable.js";
1
+ import type { Disposable } from "../interfaces.js";
2
+ import type { ExecutionContext, RootContext } from "../observation/observable.js";
3
+ import type { ViewBehaviorFactory, ViewBehaviorTargets } from "./html-directive.js";
3
4
  /**
4
5
  * Represents a collection of DOM nodes which can be bound to a data source.
5
6
  * @public
6
7
  */
7
- export interface View {
8
+ export interface View<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> extends Disposable {
8
9
  /**
9
10
  * The execution context the view is running within.
10
11
  */
11
- readonly context: ExecutionContext | null;
12
+ readonly context: TContext | null;
12
13
  /**
13
14
  * The data that the view is bound to.
14
15
  */
15
- readonly source: any | null;
16
+ readonly source: TSource | null;
16
17
  /**
17
18
  * Binds a view's behaviors to its binding source.
18
19
  * @param source - The binding source for the view's binding behaviors.
19
20
  * @param context - The execution context to run the view within.
20
21
  */
21
- bind(source: unknown, context: ExecutionContext): void;
22
+ bind(source: TSource, context: TContext): void;
22
23
  /**
23
24
  * Unbinds a view's behaviors from its binding source and context.
24
25
  */
25
26
  unbind(): void;
26
- /**
27
- * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
28
- * Once a view has been disposed, it cannot be inserted or bound again.
29
- */
30
- dispose(): void;
31
27
  }
32
28
  /**
33
29
  * A View representing DOM nodes specifically for rendering the view of a custom element.
34
30
  * @public
35
31
  */
36
- export interface ElementView extends View {
32
+ export interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent, RootContext> {
37
33
  /**
38
34
  * Appends the view's DOM nodes to the referenced node.
39
35
  * @param node - The parent node to append the view's DOM nodes to.
@@ -44,7 +40,7 @@ export interface ElementView extends View {
44
40
  * A view representing a range of DOM nodes which can be added/removed ad hoc.
45
41
  * @public
46
42
  */
47
- export interface SyntheticView extends View {
43
+ export interface SyntheticView<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> extends View<TSource, TParent, TContext> {
48
44
  /**
49
45
  * The first DOM node in the range of nodes that make up the view.
50
46
  */
@@ -63,27 +59,24 @@ export interface SyntheticView extends View {
63
59
  * The nodes are not disposed and the view can later be re-inserted.
64
60
  */
65
61
  remove(): void;
66
- /**
67
- * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
68
- * Once a view has been disposed, it cannot be inserted or bound again.
69
- */
70
- dispose(): void;
71
62
  }
72
63
  /**
73
64
  * The standard View implementation, which also implements ElementView and SyntheticView.
74
65
  * @public
75
66
  */
76
- export declare class HTMLView implements ElementView, SyntheticView {
67
+ export declare class HTMLView<TSource = any, TParent = any, TContext extends ExecutionContext<TParent> = ExecutionContext<TParent>> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent, TContext> {
77
68
  private fragment;
69
+ private factories;
70
+ private targets;
78
71
  private behaviors;
79
72
  /**
80
73
  * The data that the view is bound to.
81
74
  */
82
- source: any | null;
75
+ source: TSource | null;
83
76
  /**
84
77
  * The execution context the view is running within.
85
78
  */
86
- context: ExecutionContext | null;
79
+ context: TContext | null;
87
80
  /**
88
81
  * The first DOM node in the range of nodes that make up the view.
89
82
  */
@@ -97,7 +90,7 @@ export declare class HTMLView implements ElementView, SyntheticView {
97
90
  * @param fragment - The html fragment that contains the nodes for this view.
98
91
  * @param behaviors - The behaviors to be applied to this view.
99
92
  */
100
- constructor(fragment: DocumentFragment, behaviors: Behavior[]);
93
+ constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
101
94
  /**
102
95
  * Appends the view's DOM nodes to the referenced node.
103
96
  * @param node - The parent node to append the view's DOM nodes to.
@@ -123,7 +116,7 @@ export declare class HTMLView implements ElementView, SyntheticView {
123
116
  * @param source - The binding source for the view's binding behaviors.
124
117
  * @param context - The execution context to run the behaviors within.
125
118
  */
126
- bind(source: unknown, context: ExecutionContext): void;
119
+ bind(source: TSource, context: TContext): void;
127
120
  /**
128
121
  * Unbinds a view's behaviors from its binding source.
129
122
  */
@@ -0,0 +1,40 @@
1
+ import { Disposable } from "./interfaces.js";
2
+ import type { Subscriber } from "./observation/notifier.js";
3
+ /**
4
+ * Converts a plain object to an observable object.
5
+ * @param object - The object to make observable.
6
+ * @param deep - Indicates whether or not to deeply convert the oject.
7
+ * @returns The converted object.
8
+ * @beta
9
+ */
10
+ export declare function makeObservable<T>(object: T, deep?: boolean): T;
11
+ /**
12
+ * Deeply subscribes to changes in existing observable objects.
13
+ * @param object - The observable object to watch.
14
+ * @param subscriber - The handler to call when changes are made to the object.
15
+ * @returns A disposable that can be used to unsubscribe from change updates.
16
+ * @beta
17
+ */
18
+ export declare function watch(object: any, subscriber: Subscriber | ((subject: any, args: any) => void)): Disposable;
19
+ /**
20
+ * Retrieves the "composed parent" element of a node, ignoring DOM tree boundaries.
21
+ * When the parent of a node is a shadow-root, it will return the host
22
+ * element of the shadow root. Otherwise it will return the parent node or null if
23
+ * no parent node exists.
24
+ * @param element - The element for which to retrieve the composed parent
25
+ *
26
+ * @public
27
+ */
28
+ export declare function composedParent<T extends HTMLElement>(element: T): HTMLElement | null;
29
+ /**
30
+ * Determines if the reference element contains the test element in a "composed" DOM tree that
31
+ * ignores shadow DOM boundaries.
32
+ *
33
+ * Returns true of the test element is a descendent of the reference, or exist in
34
+ * a shadow DOM that is a logical descendent of the reference. Otherwise returns false.
35
+ * @param reference - The element to test for containment against.
36
+ * @param test - The element being tested for containment.
37
+ *
38
+ * @public
39
+ */
40
+ export declare function composedContains(reference: HTMLElement, test: HTMLElement): boolean;
@@ -1,5 +1,9 @@
1
1
  import { Observable } from "../observation/observable.js";
2
- import { DOM } from "../dom.js";
2
+ import { isString } from "../interfaces.js";
3
+ import { Updates } from "../observation/update-queue.js";
4
+ import { DOM } from "../templating/dom.js";
5
+ const booleanMode = "boolean";
6
+ const reflectMode = "reflect";
3
7
  /**
4
8
  * A {@link ValueConverter} that converts to and from `boolean` values.
5
9
  * @remarks
@@ -11,16 +15,22 @@ export const booleanConverter = {
11
15
  return value ? "true" : "false";
12
16
  },
13
17
  fromView(value) {
14
- if (value === null ||
18
+ return value === null ||
15
19
  value === void 0 ||
16
20
  value === "false" ||
17
21
  value === false ||
18
- value === 0) {
19
- return false;
20
- }
21
- return true;
22
+ value === 0
23
+ ? false
24
+ : true;
22
25
  },
23
26
  };
27
+ function toNumber(value) {
28
+ if (value === null || value === undefined) {
29
+ return null;
30
+ }
31
+ const number = value * 1;
32
+ return isNaN(number) ? null : number;
33
+ }
24
34
  /**
25
35
  * A {@link ValueConverter} that converts to and from `number` values.
26
36
  * @remarks
@@ -30,19 +40,10 @@ export const booleanConverter = {
30
40
  */
31
41
  export const nullableNumberConverter = {
32
42
  toView(value) {
33
- if (value === null || value === undefined) {
34
- return null;
35
- }
36
- const number = value * 1;
37
- return isNaN(number) ? null : number.toString();
38
- },
39
- fromView(value) {
40
- if (value === null || value === undefined) {
41
- return null;
42
- }
43
- const number = value * 1;
44
- return isNaN(number) ? null : number;
43
+ const output = toNumber(value);
44
+ return output ? output.toString() : output;
45
45
  },
46
+ fromView: toNumber,
46
47
  };
47
48
  /**
48
49
  * An implementation of {@link Accessor} that supports reactivity,
@@ -60,7 +61,7 @@ export class AttributeDefinition {
60
61
  * @param converter - A {@link ValueConverter} that integrates with the property getter/setter
61
62
  * to convert values to and from a DOM string.
62
63
  */
63
- constructor(Owner, name, attribute = name.toLowerCase(), mode = "reflect", converter) {
64
+ constructor(Owner, name, attribute = name.toLowerCase(), mode = reflectMode, converter) {
64
65
  this.guards = new Set();
65
66
  this.Owner = Owner;
66
67
  this.name = name;
@@ -70,7 +71,7 @@ export class AttributeDefinition {
70
71
  this.fieldName = `_${name}`;
71
72
  this.callbackName = `${name}Changed`;
72
73
  this.hasCallback = this.callbackName in Owner.prototype;
73
- if (mode === "boolean" && converter === void 0) {
74
+ if (mode === booleanMode && converter === void 0) {
74
75
  this.converter = booleanConverter;
75
76
  }
76
77
  }
@@ -117,15 +118,15 @@ export class AttributeDefinition {
117
118
  if (guards.has(element) || mode === "fromView") {
118
119
  return;
119
120
  }
120
- DOM.queueUpdate(() => {
121
+ Updates.enqueue(() => {
121
122
  guards.add(element);
122
123
  const latestValue = element[this.fieldName];
123
124
  switch (mode) {
124
- case "reflect":
125
+ case reflectMode:
125
126
  const converter = this.converter;
126
127
  DOM.setAttribute(element, this.attribute, converter !== void 0 ? converter.toView(latestValue) : latestValue);
127
128
  break;
128
- case "boolean":
129
+ case booleanMode:
129
130
  DOM.setBooleanAttribute(element, this.attribute, latestValue);
130
131
  break;
131
132
  }
@@ -148,7 +149,7 @@ export class AttributeDefinition {
148
149
  }
149
150
  for (let j = 0, jj = list.length; j < jj; ++j) {
150
151
  const config = list[j];
151
- if (typeof config === "string") {
152
+ if (isString(config)) {
152
153
  attributes.push(new AttributeDefinition(Owner, config));
153
154
  }
154
155
  else {