@microsoft/fast-element 1.10.5 → 2.0.0-beta.10

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 (122) hide show
  1. package/.eslintrc.json +1 -12
  2. package/CHANGELOG.json +629 -6
  3. package/CHANGELOG.md +152 -5
  4. package/dist/dts/components/attributes.d.ts +14 -1
  5. package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +32 -32
  6. package/dist/dts/components/fast-definitions.d.ts +51 -11
  7. package/dist/dts/components/fast-element.d.ts +18 -23
  8. package/dist/dts/context.d.ts +157 -0
  9. package/dist/{esm/observation/behavior.js → dts/debug.d.ts} +0 -0
  10. package/dist/dts/di/di.d.ts +899 -0
  11. package/dist/dts/index.d.ts +17 -16
  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 +176 -0
  16. package/dist/dts/metadata.d.ts +25 -0
  17. package/dist/dts/observation/arrays.d.ts +207 -0
  18. package/dist/dts/observation/notifier.d.ts +18 -18
  19. package/dist/dts/observation/observable.d.ts +117 -34
  20. package/dist/dts/observation/update-queue.d.ts +40 -0
  21. package/dist/dts/pending-task.d.ts +20 -0
  22. package/dist/dts/platform.d.ts +23 -66
  23. package/dist/dts/polyfills.d.ts +8 -0
  24. package/dist/dts/state/exports.d.ts +3 -0
  25. package/dist/dts/state/reactive.d.ts +8 -0
  26. package/dist/dts/state/state.d.ts +141 -0
  27. package/dist/dts/state/visitor.d.ts +6 -0
  28. package/dist/dts/state/watch.d.ts +10 -0
  29. package/dist/dts/styles/css-directive.d.ts +44 -6
  30. package/dist/dts/styles/css.d.ts +19 -3
  31. package/dist/dts/styles/element-styles.d.ts +49 -63
  32. package/dist/dts/styles/host.d.ts +68 -0
  33. package/dist/dts/templating/binding-signal.d.ts +21 -0
  34. package/dist/dts/templating/binding-two-way.d.ts +39 -0
  35. package/dist/dts/templating/binding.d.ts +101 -70
  36. package/dist/dts/templating/children.d.ts +18 -15
  37. package/dist/dts/templating/compiler.d.ts +46 -28
  38. package/dist/dts/templating/dom.d.ts +41 -0
  39. package/dist/dts/templating/html-directive.d.ts +239 -45
  40. package/dist/dts/templating/markup.d.ts +48 -0
  41. package/dist/dts/templating/node-observation.d.ts +45 -30
  42. package/dist/dts/templating/ref.d.ts +6 -20
  43. package/dist/dts/templating/render.d.ts +272 -0
  44. package/dist/dts/templating/repeat.d.ts +36 -33
  45. package/dist/dts/templating/slotted.d.ts +13 -14
  46. package/dist/dts/templating/template.d.ts +28 -22
  47. package/dist/dts/templating/view.d.ts +82 -24
  48. package/dist/dts/templating/when.d.ts +3 -3
  49. package/dist/dts/testing/exports.d.ts +3 -0
  50. package/dist/dts/testing/fakes.d.ts +4 -0
  51. package/dist/dts/testing/fixture.d.ts +84 -0
  52. package/dist/dts/testing/timeout.d.ts +7 -0
  53. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +1 -1
  54. package/dist/dts/utilities.d.ts +22 -0
  55. package/dist/esm/components/attributes.js +38 -28
  56. package/dist/esm/components/{controller.js → element-controller.js} +150 -140
  57. package/dist/esm/components/fast-definitions.js +48 -46
  58. package/dist/esm/components/fast-element.js +31 -12
  59. package/dist/esm/context.js +163 -0
  60. package/dist/esm/debug.js +61 -0
  61. package/dist/esm/di/di.js +1435 -0
  62. package/dist/esm/index.debug.js +2 -0
  63. package/dist/esm/index.js +20 -14
  64. package/dist/esm/index.rollup.debug.js +3 -0
  65. package/dist/esm/index.rollup.js +2 -0
  66. package/dist/esm/interfaces.js +12 -1
  67. package/dist/esm/metadata.js +60 -0
  68. package/dist/esm/observation/arrays.js +570 -0
  69. package/dist/esm/observation/notifier.js +27 -35
  70. package/dist/esm/observation/observable.js +116 -149
  71. package/dist/esm/observation/update-queue.js +67 -0
  72. package/dist/esm/pending-task.js +16 -0
  73. package/dist/esm/platform.js +60 -42
  74. package/dist/esm/polyfills.js +85 -0
  75. package/dist/esm/state/exports.js +3 -0
  76. package/dist/esm/state/reactive.js +34 -0
  77. package/dist/esm/state/state.js +148 -0
  78. package/dist/esm/state/visitor.js +28 -0
  79. package/dist/esm/state/watch.js +36 -0
  80. package/dist/esm/styles/css-directive.js +29 -13
  81. package/dist/esm/styles/css.js +29 -42
  82. package/dist/esm/styles/element-styles.js +79 -104
  83. package/dist/esm/styles/host.js +1 -0
  84. package/dist/esm/templating/binding-signal.js +83 -0
  85. package/dist/esm/templating/binding-two-way.js +103 -0
  86. package/dist/esm/templating/binding.js +189 -159
  87. package/dist/esm/templating/children.js +33 -23
  88. package/dist/esm/templating/compiler.js +258 -152
  89. package/dist/esm/templating/dom.js +49 -0
  90. package/dist/esm/templating/html-directive.js +193 -36
  91. package/dist/esm/templating/markup.js +75 -0
  92. package/dist/esm/templating/node-observation.js +51 -45
  93. package/dist/esm/templating/ref.js +8 -25
  94. package/dist/esm/templating/render.js +391 -0
  95. package/dist/esm/templating/repeat.js +83 -79
  96. package/dist/esm/templating/slotted.js +23 -20
  97. package/dist/esm/templating/template.js +51 -93
  98. package/dist/esm/templating/view.js +125 -46
  99. package/dist/esm/templating/when.js +6 -4
  100. package/dist/esm/testing/exports.js +3 -0
  101. package/dist/esm/testing/fakes.js +76 -0
  102. package/dist/esm/testing/fixture.js +86 -0
  103. package/dist/esm/testing/timeout.js +24 -0
  104. package/dist/esm/utilities.js +44 -0
  105. package/dist/fast-element.api.json +12153 -5373
  106. package/dist/fast-element.d.ts +1448 -696
  107. package/dist/fast-element.debug.js +4107 -0
  108. package/dist/fast-element.debug.min.js +1 -0
  109. package/dist/fast-element.js +3817 -4029
  110. package/dist/fast-element.min.js +1 -1
  111. package/dist/fast-element.untrimmed.d.ts +2814 -0
  112. package/docs/api-report.md +567 -254
  113. package/docs/fast-element-2-changes.md +15 -0
  114. package/karma.conf.cjs +6 -17
  115. package/package.json +76 -15
  116. package/dist/dts/dom.d.ts +0 -112
  117. package/dist/dts/observation/array-change-records.d.ts +0 -48
  118. package/dist/dts/observation/array-observer.d.ts +0 -9
  119. package/dist/dts/observation/behavior.d.ts +0 -19
  120. package/dist/esm/dom.js +0 -207
  121. package/dist/esm/observation/array-change-records.js +0 -326
  122. package/dist/esm/observation/array-observer.js +0 -177
@@ -1,21 +1,17 @@
1
+ export type { Callable, Constructable, Disposable, FASTGlobal, Mutable, StyleStrategy, StyleTarget, TrustedTypes, TrustedTypesPolicy, } from "./interfaces.js";
1
2
  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
3
  export * from "./observation/observable.js";
14
4
  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";
5
+ export * from "./observation/arrays.js";
6
+ export * from "./observation/update-queue.js";
7
+ export * from "./styles/element-styles.js";
8
+ export * from "./styles/css.js";
9
+ export * from "./styles/css-directive.js";
10
+ export * from "./styles/host.js";
11
+ export * from "./templating/dom.js";
12
+ export * from "./templating/template.js";
13
+ export * from "./templating/compiler.js";
14
+ export { Markup, Parser } from "./templating/markup.js";
19
15
  export * from "./templating/binding.js";
20
16
  export * from "./templating/html-directive.js";
21
17
  export * from "./templating/ref.js";
@@ -23,4 +19,9 @@ export * from "./templating/when.js";
23
19
  export * from "./templating/repeat.js";
24
20
  export * from "./templating/slotted.js";
25
21
  export * from "./templating/children.js";
26
- export { elements, ElementsFilter, NodeBehaviorOptions, } from "./templating/node-observation.js";
22
+ export * from "./templating/view.js";
23
+ export * from "./templating/node-observation.js";
24
+ export * from "./components/fast-element.js";
25
+ export * from "./components/fast-definitions.js";
26
+ export * from "./components/attributes.js";
27
+ export * from "./components/element-controller.js";
@@ -0,0 +1,2 @@
1
+ import "./debug.js";
2
+ export * from "./index.js";
@@ -0,0 +1,2 @@
1
+ import "./polyfills.js";
2
+ export * from "./index.js";
@@ -0,0 +1,3 @@
1
+ import "./polyfills.js";
2
+ import "./debug.js";
3
+ export * from "./index.js";
@@ -13,6 +13,30 @@ export declare type Callable = typeof Function.prototype.call | {
13
13
  export declare type Constructable<T = {}> = {
14
14
  new (...args: any[]): T;
15
15
  };
16
+ /**
17
+ * Represents a class.
18
+ * @public
19
+ */
20
+ export declare type Class<T, C = {}> = C & {
21
+ /**
22
+ * The class's prototype;
23
+ */
24
+ readonly prototype: T;
25
+ /**
26
+ * The class's constructor.
27
+ */
28
+ new (...args: any[]): T;
29
+ };
30
+ /**
31
+ * Provides a mechanism for releasing resources.
32
+ * @public
33
+ */
34
+ export interface Disposable {
35
+ /**
36
+ * Disposes the resources.
37
+ */
38
+ dispose(): void;
39
+ }
16
40
  /**
17
41
  * Reverses all readonly members, making them mutable.
18
42
  * @internal
@@ -20,3 +44,155 @@ export declare type Constructable<T = {}> = {
20
44
  export declare type Mutable<T> = {
21
45
  -readonly [P in keyof T]: T[P];
22
46
  };
47
+ /**
48
+ * A policy for use with the standard trustedTypes platform API.
49
+ * @public
50
+ */
51
+ export declare type TrustedTypesPolicy = {
52
+ /**
53
+ * Creates trusted HTML.
54
+ * @param html - The HTML to clear as trustworthy.
55
+ */
56
+ createHTML(html: string): string;
57
+ };
58
+ /**
59
+ * Enables working with trusted types.
60
+ * @public
61
+ */
62
+ export declare type TrustedTypes = {
63
+ /**
64
+ * Creates a trusted types policy.
65
+ * @param name - The policy name.
66
+ * @param rules - The policy rules implementation.
67
+ */
68
+ createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
69
+ };
70
+ /**
71
+ * The FAST global.
72
+ * @internal
73
+ */
74
+ export interface FASTGlobal {
75
+ /**
76
+ * The list of loaded versions.
77
+ */
78
+ readonly versions: string[];
79
+ /**
80
+ * Gets a kernel value.
81
+ * @param id - The id to get the value for.
82
+ * @param initialize - Creates the initial value for the id if not already existing.
83
+ */
84
+ getById<T>(id: string | number): T | null;
85
+ getById<T>(id: string | number, initialize: () => T): T;
86
+ /**
87
+ * Sends a warning to the developer.
88
+ * @param code - The warning code to send.
89
+ * @param values - Values relevant for the warning message.
90
+ */
91
+ warn(code: number, values?: Record<string, any>): void;
92
+ /**
93
+ * Creates an error.
94
+ * @param code - The error code to send.
95
+ * @param values - Values relevant for the error message.
96
+ */
97
+ error(code: number, values?: Record<string, any>): Error;
98
+ /**
99
+ * Adds debug messages for errors and warnings.
100
+ * @param messages - The message dictionary to add.
101
+ * @remarks
102
+ * Message can include placeholders like $\{name\} which can be
103
+ * replaced by values passed at runtime.
104
+ */
105
+ addMessages(messages: Record<number, string>): void;
106
+ }
107
+ /**
108
+ * Core services shared across FAST instances.
109
+ * @internal
110
+ */
111
+ export declare const enum KernelServiceId {
112
+ updateQueue = 1,
113
+ observable = 2,
114
+ contextEvent = 3,
115
+ elementRegistry = 4,
116
+ styleSheetStrategy = 5
117
+ }
118
+ /**
119
+ * A node that can be targeted by styles.
120
+ * @public
121
+ */
122
+ export interface StyleTarget {
123
+ /**
124
+ * Stylesheets to be adopted by the node.
125
+ */
126
+ adoptedStyleSheets?: CSSStyleSheet[];
127
+ /**
128
+ * Adds styles to the target by appending the styles.
129
+ * @param styles - The styles element to add.
130
+ */
131
+ append(styles: HTMLStyleElement): void;
132
+ /**
133
+ * Removes styles from the target.
134
+ * @param styles - The styles element to remove.
135
+ */
136
+ removeChild(styles: HTMLStyleElement): void;
137
+ /**
138
+ * Returns all element descendants of node that match selectors.
139
+ * @param selectors - The CSS selector to use for the query.
140
+ */
141
+ querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
142
+ }
143
+ /**
144
+ * Implemented to provide specific behavior when adding/removing styles
145
+ * for elements.
146
+ * @public
147
+ */
148
+ export interface StyleStrategy {
149
+ /**
150
+ * Adds styles to the target.
151
+ * @param target - The target to add the styles to.
152
+ */
153
+ addStylesTo(target: StyleTarget): void;
154
+ /**
155
+ * Removes styles from the target.
156
+ * @param target - The target to remove the styles from.
157
+ */
158
+ removeStylesFrom(target: StyleTarget): void;
159
+ }
160
+ /**
161
+ * Warning and error messages.
162
+ * @internal
163
+ */
164
+ export declare const enum Message {
165
+ needsArrayObservation = 1101,
166
+ onlySetHTMLPolicyOnce = 1201,
167
+ bindingInnerHTMLRequiresTrustedTypes = 1202,
168
+ twoWayBindingRequiresObservables = 1203,
169
+ hostBindingWithoutHost = 1204,
170
+ unsupportedBindingBehavior = 1205,
171
+ missingElementDefinition = 1401,
172
+ noRegistrationForContext = 1501,
173
+ noFactoryForResolver = 1502,
174
+ invalidResolverStrategy = 1503,
175
+ cannotAutoregisterDependency = 1504,
176
+ cannotResolveKey = 1505,
177
+ cannotConstructNativeFunction = 1506,
178
+ cannotJITRegisterNonConstructor = 1507,
179
+ cannotJITRegisterIntrinsic = 1508,
180
+ cannotJITRegisterInterface = 1509,
181
+ invalidResolver = 1510,
182
+ invalidKey = 1511,
183
+ noDefaultResolver = 1512,
184
+ cyclicDependency = 1513,
185
+ connectUpdateRequiresController = 1514
186
+ }
187
+ /**
188
+ * @internal
189
+ */
190
+ export declare const isFunction: (object: any) => object is Function;
191
+ /**
192
+ * @internal
193
+ */
194
+ export declare const isString: (object: any) => object is string;
195
+ /**
196
+ * @internal
197
+ */
198
+ export declare const noop: () => undefined;
@@ -0,0 +1,25 @@
1
+ import type { Constructable } from "./interfaces.js";
2
+ /**
3
+ * Provides basic metadata capabilities used by Context and Dependency Injection.
4
+ */
5
+ export declare const Metadata: Readonly<{
6
+ /**
7
+ * Gets the "design:paramtypes" metadata for the specified type.
8
+ * @param Type - The type to get the metadata for.
9
+ * @returns The metadata array or a frozen empty array if no metadata is found.
10
+ */
11
+ getDesignParamTypes: (Type: any) => any;
12
+ /**
13
+ * Gets the "annotation:paramtypes" metadata for the specified type.
14
+ * @param Type - The type to get the metadata for.
15
+ * @returns The metadata array or a frozen empty array if no metadata is found.
16
+ */
17
+ getAnnotationParamTypes: (Type: any) => any;
18
+ /**
19
+ *
20
+ * @param Type - Gets the "annotation:paramtypes" metadata for the specified type. If none is found,
21
+ * an empty, mutable metadata array is created and added.
22
+ * @returns The metadata array.
23
+ */
24
+ getOrCreateAnnotationParamTypes(Type: Constructable): any[];
25
+ }>;
@@ -0,0 +1,207 @@
1
+ import { Subscriber, SubscriberSet } from "./notifier.js";
2
+ /**
3
+ * A splice map is a representation of how a previous array of items
4
+ * was transformed into a new array of items. Conceptually it is a list of
5
+ * tuples of
6
+ *
7
+ * (index, removed, addedCount)
8
+ *
9
+ * which are kept in ascending index order of. The tuple represents that at
10
+ * the |index|, |removed| sequence of items were removed, and counting forward
11
+ * from |index|, |addedCount| items were added.
12
+ * @public
13
+ */
14
+ export declare class Splice {
15
+ index: number;
16
+ removed: any[];
17
+ addedCount: number;
18
+ /**
19
+ * Indicates that this splice represents a complete array reset.
20
+ */
21
+ reset?: boolean;
22
+ /**
23
+ * Creates a splice.
24
+ * @param index - The index that the splice occurs at.
25
+ * @param removed - The items that were removed.
26
+ * @param addedCount - The number of items that were added.
27
+ */
28
+ constructor(index: number, removed: any[], addedCount: number);
29
+ /**
30
+ * Adjusts the splice index based on the provided array.
31
+ * @param array - The array to adjust to.
32
+ * @returns The same splice, mutated based on the reference array.
33
+ */
34
+ adjustTo(array: any[]): this;
35
+ }
36
+ /**
37
+ * Indicates what level of feature support the splice
38
+ * strategy provides.
39
+ * @public
40
+ */
41
+ export declare const SpliceStrategySupport: Readonly<{
42
+ /**
43
+ * Only supports resets.
44
+ */
45
+ readonly reset: 1;
46
+ /**
47
+ * Supports tracking splices and resets.
48
+ */
49
+ readonly splice: 2;
50
+ /**
51
+ * Supports tracking splices and resets, while applying some form
52
+ * of optimization, such as merging, to the splices.
53
+ */
54
+ readonly optimized: 3;
55
+ }>;
56
+ /**
57
+ * The available values for SpliceStrategySupport.
58
+ * @public
59
+ */
60
+ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
61
+ /**
62
+ * An approach to tracking changes in an array.
63
+ * @public
64
+ */
65
+ export interface SpliceStrategy {
66
+ /**
67
+ * The level of feature support the splice strategy provides.
68
+ */
69
+ readonly support: SpliceStrategySupport;
70
+ /**
71
+ * Normalizes the splices before delivery to array change subscribers.
72
+ * @param previous - The previous version of the array if a reset has taken place.
73
+ * @param current - The current version of the array.
74
+ * @param changes - The set of changes tracked against the array.
75
+ */
76
+ normalize(previous: unknown[] | undefined, current: unknown[], changes: Splice[] | undefined): readonly Splice[];
77
+ /**
78
+ * Performs and tracks a pop operation on an array.
79
+ * @param array - The array to track the change for.
80
+ * @param observer - The observer to register the change with.
81
+ * @param pop - The operation to perform.
82
+ * @param args - The arguments for the operation.
83
+ */
84
+ pop(array: any[], observer: ArrayObserver, pop: typeof Array.prototype.pop, args: any[]): any;
85
+ /**
86
+ * Performs and tracks a push operation on an array.
87
+ * @param array - The array to track the change for.
88
+ * @param observer - The observer to register the change with.
89
+ * @param push - The operation to perform.
90
+ * @param args - The arguments for the operation.
91
+ */
92
+ push(array: any[], observer: ArrayObserver, push: typeof Array.prototype.push, args: any[]): any;
93
+ /**
94
+ * Performs and tracks a reverse operation on an array.
95
+ * @param array - The array to track the change for.
96
+ * @param observer - The observer to register the change with.
97
+ * @param reverse - The operation to perform.
98
+ * @param args - The arguments for the operation.
99
+ */
100
+ reverse(array: any[], observer: ArrayObserver, reverse: typeof Array.prototype.reverse, args: any[]): any;
101
+ /**
102
+ * Performs and tracks a shift operation on an array.
103
+ * @param array - The array to track the change for.
104
+ * @param observer - The observer to register the change with.
105
+ * @param shift - The operation to perform.
106
+ * @param args - The arguments for the operation.
107
+ */
108
+ shift(array: any[], observer: ArrayObserver, shift: typeof Array.prototype.shift, args: any[]): any;
109
+ /**
110
+ * Performs and tracks a sort operation on an array.
111
+ * @param array - The array to track the change for.
112
+ * @param observer - The observer to register the change with.
113
+ * @param sort - The operation to perform.
114
+ * @param args - The arguments for the operation.
115
+ */
116
+ sort(array: any[], observer: ArrayObserver, sort: typeof Array.prototype.sort, args: any[]): any[];
117
+ /**
118
+ * Performs and tracks a splice operation on an array.
119
+ * @param array - The array to track the change for.
120
+ * @param observer - The observer to register the change with.
121
+ * @param splice - The operation to perform.
122
+ * @param args - The arguments for the operation.
123
+ */
124
+ splice(array: any[], observer: ArrayObserver, splice: typeof Array.prototype.splice, args: any[]): any;
125
+ /**
126
+ * Performs and tracks an unshift operation on an array.
127
+ * @param array - The array to track the change for.
128
+ * @param observer - The observer to register the change with.
129
+ * @param unshift - The operation to perform.
130
+ * @param args - The arguments for the operation.
131
+ */
132
+ unshift(array: any[], observer: ArrayObserver, unshift: typeof Array.prototype.unshift, args: any[]): any[];
133
+ }
134
+ /**
135
+ * Functionality related to tracking changes in arrays.
136
+ * @public
137
+ */
138
+ export declare const SpliceStrategy: Readonly<{
139
+ /**
140
+ * A set of changes that represent a full array reset.
141
+ */
142
+ readonly reset: Splice[];
143
+ /**
144
+ * Sets the default strategy to use for array observers.
145
+ * @param strategy - The splice strategy to use.
146
+ */
147
+ readonly setDefaultStrategy: (strategy: SpliceStrategy) => void;
148
+ }>;
149
+ /**
150
+ * Observes array lengths.
151
+ * @public
152
+ */
153
+ export interface LengthObserver extends Subscriber {
154
+ /**
155
+ * The length of the observed array.
156
+ */
157
+ length: number;
158
+ }
159
+ /**
160
+ * An observer for arrays.
161
+ * @public
162
+ */
163
+ export interface ArrayObserver extends SubscriberSet {
164
+ /**
165
+ * The strategy to use for tracking changes.
166
+ */
167
+ strategy: SpliceStrategy | null;
168
+ /**
169
+ * The length observer for the array.
170
+ */
171
+ readonly lengthObserver: LengthObserver;
172
+ /**
173
+ * Adds a splice to the list of changes.
174
+ * @param splice - The splice to add.
175
+ */
176
+ addSplice(splice: Splice): void;
177
+ /**
178
+ * Indicates that a reset change has occurred.
179
+ * @param oldCollection - The collection as it was before the reset.
180
+ */
181
+ reset(oldCollection: any[] | undefined): void;
182
+ /**
183
+ * Flushes the changes to subscribers.
184
+ */
185
+ flush(): void;
186
+ }
187
+ /**
188
+ * An observer for arrays.
189
+ * @public
190
+ */
191
+ export declare const ArrayObserver: Readonly<{
192
+ /**
193
+ * Enables the array observation mechanism.
194
+ * @remarks
195
+ * Array observation is enabled automatically when using the
196
+ * {@link RepeatDirective}, so calling this API manually is
197
+ * not typically necessary.
198
+ */
199
+ readonly enable: () => void;
200
+ }>;
201
+ /**
202
+ * Enables observing the length of an array.
203
+ * @param array - The array to observe the length of.
204
+ * @returns The length of the array.
205
+ * @public
206
+ */
207
+ export declare function lengthOf<T>(array: readonly T[]): number;
@@ -4,21 +4,21 @@
4
4
  */
5
5
  export interface Subscriber {
6
6
  /**
7
- * Called when a source this instance has subscribed to changes.
8
- * @param source - The source of the change.
7
+ * Called when a subject this instance has subscribed to changes.
8
+ * @param subject - The subject of the change.
9
9
  * @param args - The event args detailing the change that occurred.
10
10
  */
11
- handleChange(source: any, args: any): void;
11
+ handleChange(subject: any, args: any): void;
12
12
  }
13
13
  /**
14
- * Provides change notification for a source object.
14
+ * Provides change notifications for an observed subject.
15
15
  * @public
16
16
  */
17
17
  export interface Notifier {
18
18
  /**
19
- * The source object that this notifier provides change notification for.
19
+ * The object that subscribers will receive notifications for.
20
20
  */
21
- readonly source: any;
21
+ readonly subject: any;
22
22
  /**
23
23
  * Notifies all subscribers, based on the args.
24
24
  * @param args - Data passed along to subscribers during notification.
@@ -47,7 +47,7 @@ export interface Notifier {
47
47
  /**
48
48
  * An implementation of {@link Notifier} that efficiently keeps track of
49
49
  * subscribers interested in a specific change notification on an
50
- * observable source.
50
+ * observable subject.
51
51
  *
52
52
  * @remarks
53
53
  * This set is optimized for the most common scenario of 1 or 2 subscribers.
@@ -60,15 +60,15 @@ export declare class SubscriberSet implements Notifier {
60
60
  private sub2;
61
61
  private spillover;
62
62
  /**
63
- * The source that this subscriber set is reporting changes for.
63
+ * The object that subscribers will receive notifications for.
64
64
  */
65
- readonly source: any;
65
+ readonly subject: any;
66
66
  /**
67
- * Creates an instance of SubscriberSet for the specified source.
68
- * @param source - The object source that subscribers will receive notifications from.
67
+ * Creates an instance of SubscriberSet for the specified subject.
68
+ * @param subject - The subject that subscribers will receive notifications from.
69
69
  * @param initialSubscriber - An initial subscriber to changes.
70
70
  */
71
- constructor(source: any, initialSubscriber?: Subscriber);
71
+ constructor(subject: any, initialSubscriber?: Subscriber);
72
72
  /**
73
73
  * Checks whether the provided subscriber has been added to this set.
74
74
  * @param subscriber - The subscriber to test for inclusion in this set.
@@ -97,16 +97,16 @@ export declare class SubscriberSet implements Notifier {
97
97
  */
98
98
  export declare class PropertyChangeNotifier implements Notifier {
99
99
  private subscribers;
100
- private sourceSubscribers;
100
+ private subjectSubscribers;
101
101
  /**
102
- * The source that property changes are being notified for.
102
+ * The subject that property changes are being notified for.
103
103
  */
104
- readonly source: any;
104
+ readonly subject: any;
105
105
  /**
106
- * Creates an instance of PropertyChangeNotifier for the specified source.
107
- * @param source - The object source that subscribers will receive notifications from.
106
+ * Creates an instance of PropertyChangeNotifier for the specified subject.
107
+ * @param subject - The object that subscribers will receive notifications for.
108
108
  */
109
- constructor(source: any);
109
+ constructor(subject: any);
110
110
  /**
111
111
  * Notifies all subscribers, based on the specified property.
112
112
  * @param propertyName - The property name, passed along to subscribers during notification.