@microsoft/fast-element 2.0.0-beta.5 → 2.0.0-beta.7
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/CHANGELOG.json +72 -0
- package/CHANGELOG.md +24 -1
- package/dist/dts/components/attributes.d.ts +10 -0
- package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +24 -25
- package/dist/dts/components/fast-definitions.d.ts +28 -3
- package/dist/dts/components/fast-element.d.ts +2 -2
- package/dist/dts/di/di.d.ts +41 -0
- package/dist/dts/index.d.ts +2 -2
- package/dist/dts/interfaces.d.ts +4 -0
- package/dist/dts/observation/observable.d.ts +86 -47
- package/dist/dts/pending-task.d.ts +20 -0
- package/dist/dts/platform.d.ts +6 -0
- package/dist/dts/state/exports.d.ts +3 -0
- package/dist/dts/state/reactive.d.ts +8 -0
- package/dist/dts/state/state.d.ts +141 -0
- package/dist/dts/state/visitor.d.ts +6 -0
- package/dist/dts/state/watch.d.ts +10 -0
- package/dist/dts/styles/css-directive.d.ts +2 -2
- package/dist/dts/styles/element-styles.d.ts +3 -3
- package/dist/dts/styles/host.d.ts +68 -0
- package/dist/dts/templating/binding-signal.d.ts +2 -2
- package/dist/dts/templating/binding-two-way.d.ts +11 -3
- package/dist/dts/templating/binding.d.ts +21 -119
- package/dist/dts/templating/children.d.ts +1 -1
- package/dist/dts/templating/html-directive.d.ts +69 -39
- package/dist/dts/templating/node-observation.d.ts +4 -5
- package/dist/dts/templating/ref.d.ts +5 -13
- package/dist/dts/templating/render.d.ts +15 -20
- package/dist/dts/templating/repeat.d.ts +11 -16
- package/dist/dts/templating/slotted.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +4 -4
- package/dist/dts/templating/view.d.ts +68 -9
- package/dist/dts/templating/when.d.ts +1 -1
- package/dist/dts/testing/exports.d.ts +1 -0
- package/dist/dts/testing/fakes.d.ts +4 -0
- package/dist/dts/testing/fixture.d.ts +0 -6
- package/dist/dts/utilities.d.ts +0 -18
- package/dist/esm/components/attributes.js +13 -4
- package/dist/esm/components/{controller.js → element-controller.js} +95 -105
- package/dist/esm/components/fast-definitions.js +3 -1
- package/dist/esm/components/fast-element.js +4 -4
- package/dist/esm/di/di.js +87 -3
- package/dist/esm/index.js +2 -1
- package/dist/esm/interfaces.js +4 -0
- package/dist/esm/observation/observable.js +59 -126
- package/dist/esm/pending-task.js +16 -0
- package/dist/esm/platform.js +21 -0
- package/dist/esm/state/exports.js +3 -0
- package/dist/esm/state/reactive.js +34 -0
- package/dist/esm/state/state.js +148 -0
- package/dist/esm/state/visitor.js +28 -0
- package/dist/esm/state/watch.js +36 -0
- package/dist/esm/styles/css.js +4 -4
- package/dist/esm/{observation/behavior.js → styles/host.js} +0 -0
- package/dist/esm/templating/binding-signal.js +21 -17
- package/dist/esm/templating/binding-two-way.js +32 -27
- package/dist/esm/templating/binding.js +73 -177
- package/dist/esm/templating/html-directive.js +78 -7
- package/dist/esm/templating/node-observation.js +9 -8
- package/dist/esm/templating/ref.js +4 -12
- package/dist/esm/templating/render.js +30 -31
- package/dist/esm/templating/repeat.js +37 -38
- package/dist/esm/templating/template.js +3 -4
- package/dist/esm/templating/view.js +96 -24
- package/dist/esm/testing/exports.js +1 -0
- package/dist/esm/testing/fakes.js +76 -0
- package/dist/esm/testing/fixture.js +1 -3
- package/dist/esm/utilities.js +0 -95
- package/dist/fast-element.api.json +5720 -5385
- package/dist/fast-element.d.ts +510 -399
- package/dist/fast-element.debug.js +492 -509
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +492 -509
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +519 -405
- package/docs/api-report.md +197 -129
- package/package.json +8 -4
- package/dist/dts/hooks.d.ts +0 -20
- package/dist/dts/observation/behavior.d.ts +0 -19
- package/dist/esm/hooks.js +0 -32
package/docs/api-report.md
CHANGED
|
@@ -12,7 +12,7 @@ export interface Accessor {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// @public
|
|
15
|
-
export type AddBehavior = (behavior:
|
|
15
|
+
export type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
|
|
16
16
|
|
|
17
17
|
// @public
|
|
18
18
|
export type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
|
|
@@ -81,6 +81,11 @@ export type AttributeConfiguration = {
|
|
|
81
81
|
converter?: ValueConverter;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
+
// @public
|
|
85
|
+
export const AttributeConfiguration: Readonly<{
|
|
86
|
+
locate: (target: {}) => AttributeConfiguration[];
|
|
87
|
+
}>;
|
|
88
|
+
|
|
84
89
|
// @public
|
|
85
90
|
export class AttributeDefinition implements Accessor {
|
|
86
91
|
constructor(Owner: Function, name: string, attribute?: string, mode?: AttributeMode, converter?: ValueConverter);
|
|
@@ -103,36 +108,18 @@ export class AttributeDefinition implements Accessor {
|
|
|
103
108
|
// @public
|
|
104
109
|
export type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
|
|
105
110
|
|
|
106
|
-
// @public
|
|
107
|
-
export interface Behavior<TSource = any, TParent = any> {
|
|
108
|
-
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
109
|
-
unbind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
111
|
// @public
|
|
113
112
|
export function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
|
|
114
113
|
|
|
115
114
|
// @public
|
|
116
115
|
export abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
116
|
+
constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
|
|
117
117
|
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
|
|
118
|
-
evaluate: Expression<TSource, TReturn, TParent>;
|
|
119
|
-
isVolatile?: boolean;
|
|
120
|
-
options?: any;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// @public
|
|
124
|
-
export class BindingBehavior implements ViewBehavior {
|
|
125
|
-
constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
|
|
126
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
127
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
128
118
|
// (undocumented)
|
|
129
|
-
|
|
130
|
-
protected getObserver(target: Node): ExpressionObserver;
|
|
131
|
-
// @internal (undocumented)
|
|
132
|
-
handleChange(binding: Expression, observer: ExpressionObserver): void;
|
|
133
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
119
|
+
evaluate: Expression<TSource, TReturn, TParent>;
|
|
134
120
|
// (undocumented)
|
|
135
|
-
|
|
121
|
+
isVolatile: boolean;
|
|
122
|
+
options?: any;
|
|
136
123
|
}
|
|
137
124
|
|
|
138
125
|
// @public
|
|
@@ -144,7 +131,7 @@ export type Callable = typeof Function.prototype.call | {
|
|
|
144
131
|
};
|
|
145
132
|
|
|
146
133
|
// @public
|
|
147
|
-
export interface CaptureType<TSource> {
|
|
134
|
+
export interface CaptureType<TSource, TParent> {
|
|
148
135
|
}
|
|
149
136
|
|
|
150
137
|
// @public
|
|
@@ -152,7 +139,7 @@ export interface ChildListDirectiveOptions<T = any> extends NodeBehaviorOptions<
|
|
|
152
139
|
}
|
|
153
140
|
|
|
154
141
|
// @public
|
|
155
|
-
export function children<
|
|
142
|
+
export function children<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | ChildrenDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
156
143
|
|
|
157
144
|
// @public
|
|
158
145
|
export class ChildrenDirective extends NodeObservationDirective<ChildrenDirectiveOptions> {
|
|
@@ -191,11 +178,6 @@ export type ConstructibleStyleStrategy = {
|
|
|
191
178
|
new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
|
|
192
179
|
};
|
|
193
180
|
|
|
194
|
-
// @public
|
|
195
|
-
export class ContentBehavior extends BindingBehavior {
|
|
196
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
181
|
// @public
|
|
200
182
|
export interface ContentTemplate {
|
|
201
183
|
create(): ContentView;
|
|
@@ -203,34 +185,18 @@ export interface ContentTemplate {
|
|
|
203
185
|
|
|
204
186
|
// @public
|
|
205
187
|
export interface ContentView {
|
|
206
|
-
bind(source: any
|
|
188
|
+
bind(source: any): void;
|
|
189
|
+
// (undocumented)
|
|
190
|
+
readonly context: ExecutionContext;
|
|
207
191
|
insertBefore(node: Node): void;
|
|
208
192
|
remove(): void;
|
|
209
193
|
unbind(): void;
|
|
210
194
|
}
|
|
211
195
|
|
|
212
|
-
// @
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
|
|
217
|
-
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
218
|
-
readonly definition: FASTElementDefinition;
|
|
219
|
-
readonly element: TElement;
|
|
220
|
-
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
221
|
-
static forCustomElement(element: HTMLElement): Controller;
|
|
222
|
-
get isConnected(): boolean;
|
|
223
|
-
onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
224
|
-
onConnectedCallback(): void;
|
|
225
|
-
onDisconnectedCallback(): void;
|
|
226
|
-
removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
|
|
227
|
-
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
228
|
-
get styles(): ElementStyles | null;
|
|
229
|
-
set styles(value: ElementStyles | null);
|
|
230
|
-
get template(): ElementViewTemplate<TElement> | null;
|
|
231
|
-
set template(value: ElementViewTemplate<TElement> | null);
|
|
232
|
-
readonly view: ElementView<TElement> | null;
|
|
233
|
-
}
|
|
196
|
+
// Warning: (ae-internal-missing-underscore) The name "createMetadataLocator" should be prefixed with an underscore because the declaration is marked as @internal
|
|
197
|
+
//
|
|
198
|
+
// @internal
|
|
199
|
+
export function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
|
|
234
200
|
|
|
235
201
|
// Warning: (ae-internal-missing-underscore) The name "createTypeRegistry" should be prefixed with an underscore because the declaration is marked as @internal
|
|
236
202
|
//
|
|
@@ -288,18 +254,41 @@ export const DOM: Readonly<{
|
|
|
288
254
|
setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
|
|
289
255
|
}>;
|
|
290
256
|
|
|
257
|
+
// @public
|
|
258
|
+
export class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
|
|
259
|
+
// @internal
|
|
260
|
+
constructor(element: TElement, definition: FASTElementDefinition);
|
|
261
|
+
addBehavior(behavior: HostBehavior<TElement>): void;
|
|
262
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
263
|
+
connect(): void;
|
|
264
|
+
readonly definition: FASTElementDefinition;
|
|
265
|
+
disconnect(): void;
|
|
266
|
+
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
267
|
+
static forCustomElement(element: HTMLElement): ElementController;
|
|
268
|
+
get isConnected(): boolean;
|
|
269
|
+
get mainStyles(): ElementStyles | null;
|
|
270
|
+
set mainStyles(value: ElementStyles | null);
|
|
271
|
+
onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
272
|
+
removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
|
|
273
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
274
|
+
readonly source: TElement;
|
|
275
|
+
get template(): ElementViewTemplate<TElement> | null;
|
|
276
|
+
set template(value: ElementViewTemplate<TElement> | null);
|
|
277
|
+
readonly view: ElementView<TElement> | null;
|
|
278
|
+
}
|
|
279
|
+
|
|
291
280
|
// @public
|
|
292
281
|
export const elements: (selector?: string) => ElementsFilter;
|
|
293
282
|
|
|
294
283
|
// @public
|
|
295
|
-
export type ElementsFilter = (value: Node, index
|
|
284
|
+
export type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;
|
|
296
285
|
|
|
297
286
|
// @public
|
|
298
287
|
export class ElementStyles {
|
|
299
288
|
constructor(styles: ReadonlyArray<ComposableStyles>);
|
|
300
289
|
// @internal (undocumented)
|
|
301
290
|
addStylesTo(target: StyleTarget): void;
|
|
302
|
-
readonly behaviors: ReadonlyArray<
|
|
291
|
+
readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
|
|
303
292
|
// @internal (undocumented)
|
|
304
293
|
isAttachedTo(target: StyleTarget): boolean;
|
|
305
294
|
static normalize(styles: ComposableStyles | ComposableStyles[] | undefined): ElementStyles | undefined;
|
|
@@ -310,7 +299,7 @@ export class ElementStyles {
|
|
|
310
299
|
// (undocumented)
|
|
311
300
|
readonly styles: ReadonlyArray<ComposableStyles>;
|
|
312
301
|
static readonly supportsAdoptedStyleSheets: boolean;
|
|
313
|
-
withBehaviors(...behaviors:
|
|
302
|
+
withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
|
|
314
303
|
withStrategy(Strategy: ConstructibleStyleStrategy): this;
|
|
315
304
|
}
|
|
316
305
|
|
|
@@ -329,52 +318,52 @@ export interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
|
329
318
|
export const emptyArray: readonly never[];
|
|
330
319
|
|
|
331
320
|
// @public
|
|
332
|
-
export
|
|
333
|
-
|
|
334
|
-
bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
335
|
-
createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
|
|
336
|
-
// (undocumented)
|
|
337
|
-
readonly directive: HTMLBindingDirective;
|
|
338
|
-
// @internal (undocumented)
|
|
339
|
-
handleEvent(event: Event): void;
|
|
340
|
-
unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// @public
|
|
344
|
-
export class ExecutionContext<TParentSource = any> {
|
|
345
|
-
static create(): ExecutionContext;
|
|
346
|
-
createChildContext<TParentSource>(parentSource: TParentSource): ExecutionContext<TParentSource>;
|
|
347
|
-
createItemContext(index: number, length: number): ExecutionContext<TParentSource>;
|
|
348
|
-
static readonly default: ExecutionContext<any>;
|
|
349
|
-
get event(): Event;
|
|
321
|
+
export interface ExecutionContext<TParent = any> {
|
|
322
|
+
readonly event: Event;
|
|
350
323
|
eventDetail<TDetail>(): TDetail;
|
|
351
324
|
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
352
325
|
index: number;
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
326
|
+
readonly isEven: boolean;
|
|
327
|
+
readonly isFirst: boolean;
|
|
328
|
+
readonly isInMiddle: boolean;
|
|
329
|
+
readonly isLast: boolean;
|
|
330
|
+
readonly isOdd: boolean;
|
|
358
331
|
length: number;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
// @internal
|
|
362
|
-
static setEvent(event: Event | null): void;
|
|
363
|
-
updatePosition(index: number, length: number): void;
|
|
332
|
+
parent: TParent;
|
|
333
|
+
parentContext: ExecutionContext<TParent>;
|
|
364
334
|
}
|
|
365
335
|
|
|
336
|
+
// @public
|
|
337
|
+
export const ExecutionContext: Readonly<{
|
|
338
|
+
default: ExecutionContext<any>;
|
|
339
|
+
getEvent(): Event | null;
|
|
340
|
+
setEvent(event: Event | null): void;
|
|
341
|
+
}>;
|
|
342
|
+
|
|
366
343
|
// @public
|
|
367
344
|
export type Expression<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
|
|
368
345
|
|
|
369
346
|
// @public
|
|
370
|
-
export interface
|
|
347
|
+
export interface ExpressionController<TSource = any, TParent = any> {
|
|
348
|
+
readonly context: ExecutionContext<TParent>;
|
|
349
|
+
readonly isBound: boolean;
|
|
350
|
+
onUnbind(behavior: {
|
|
351
|
+
unbind(controller: ExpressionController<TSource, TParent>): any;
|
|
352
|
+
}): void;
|
|
353
|
+
readonly source: TSource;
|
|
354
|
+
readonly sourceLifetime?: SourceLifetime;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// @public
|
|
358
|
+
export interface ExpressionNotifier<TSource = any, TReturn = any, TParent = any> extends Notifier, ExpressionObserver<TSource, TReturn, TParent>, Disposable {
|
|
359
|
+
observe(source: TSource, context?: ExecutionContext): TReturn;
|
|
371
360
|
records(): IterableIterator<ObservationRecord>;
|
|
372
361
|
setMode(isAsync: boolean): void;
|
|
373
362
|
}
|
|
374
363
|
|
|
375
364
|
// @public
|
|
376
|
-
export interface ExpressionObserver<TSource = any, TReturn = any, TParent = any>
|
|
377
|
-
|
|
365
|
+
export interface ExpressionObserver<TSource = any, TReturn = any, TParent = any> {
|
|
366
|
+
bind(controller: ExpressionController<TSource, TParent>): TReturn;
|
|
378
367
|
}
|
|
379
368
|
|
|
380
369
|
// Warning: (ae-internal-missing-underscore) The name "FAST" should be prefixed with an underscore because the declaration is marked as @internal
|
|
@@ -385,7 +374,7 @@ export const FAST: FASTGlobal;
|
|
|
385
374
|
// @public
|
|
386
375
|
export interface FASTElement extends HTMLElement {
|
|
387
376
|
$emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): boolean | void;
|
|
388
|
-
readonly $fastController:
|
|
377
|
+
readonly $fastController: ElementController;
|
|
389
378
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
390
379
|
connectedCallback(): void;
|
|
391
380
|
disconnectedCallback(): void;
|
|
@@ -405,13 +394,14 @@ export class FASTElementDefinition<TType extends Constructable<HTMLElement> = Co
|
|
|
405
394
|
readonly attributes: ReadonlyArray<AttributeDefinition>;
|
|
406
395
|
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
|
|
407
396
|
define(registry?: CustomElementRegistry): this;
|
|
408
|
-
readonly elementOptions
|
|
397
|
+
readonly elementOptions: ElementDefinitionOptions;
|
|
409
398
|
static readonly getByType: (key: Function) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
|
|
410
399
|
static readonly getForInstance: (object: any) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
|
|
411
400
|
get isDefined(): boolean;
|
|
412
401
|
readonly name: string;
|
|
413
402
|
readonly propertyLookup: Record<string, AttributeDefinition>;
|
|
414
|
-
readonly
|
|
403
|
+
readonly registry: CustomElementRegistry;
|
|
404
|
+
readonly shadowOptions?: ShadowRootOptions;
|
|
415
405
|
readonly styles?: ElementStyles;
|
|
416
406
|
readonly template?: ElementViewTemplate;
|
|
417
407
|
readonly type: TType;
|
|
@@ -430,21 +420,54 @@ export interface FASTGlobal {
|
|
|
430
420
|
warn(code: number, values?: Record<string, any>): void;
|
|
431
421
|
}
|
|
432
422
|
|
|
423
|
+
// @public
|
|
424
|
+
export interface HostBehavior<TSource = any> {
|
|
425
|
+
addedCallback?(controller: HostController<TSource>): void;
|
|
426
|
+
connectedCallback?(controller: HostController<TSource>): void;
|
|
427
|
+
disconnectedCallback?(controller: HostController<TSource>): void;
|
|
428
|
+
removedCallback?(controller: HostController<TSource>): void;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// @public
|
|
432
|
+
export interface HostController<TSource = any> {
|
|
433
|
+
addBehavior(behavior: HostBehavior<TSource>): void;
|
|
434
|
+
addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
435
|
+
readonly isConnected: boolean;
|
|
436
|
+
mainStyles: ElementStyles | null;
|
|
437
|
+
removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
|
|
438
|
+
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
|
|
439
|
+
readonly source: TSource;
|
|
440
|
+
}
|
|
441
|
+
|
|
433
442
|
// @public
|
|
434
443
|
export function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
|
|
435
444
|
|
|
436
445
|
// @public
|
|
437
|
-
export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
|
|
446
|
+
export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
|
|
438
447
|
constructor(dataBinding: Binding);
|
|
439
448
|
aspectType: Aspect;
|
|
440
|
-
|
|
449
|
+
// @internal (undocumented)
|
|
450
|
+
bind: (controller: ViewController) => void;
|
|
451
|
+
// @internal (undocumented)
|
|
452
|
+
bindContent(controller: ViewController): void;
|
|
453
|
+
// @internal (undocumented)
|
|
454
|
+
bindDefault(controller: ViewController): void;
|
|
455
|
+
// @internal (undocumented)
|
|
456
|
+
bindEvent(controller: ViewController): void;
|
|
457
|
+
createBehavior(): ViewBehavior;
|
|
441
458
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
442
459
|
// (undocumented)
|
|
443
460
|
dataBinding: Binding;
|
|
461
|
+
// @internal (undocumented)
|
|
462
|
+
handleChange(binding: Expression, observer: ExpressionObserver): void;
|
|
463
|
+
// @internal (undocumented)
|
|
464
|
+
handleEvent(event: Event): void;
|
|
444
465
|
id: string;
|
|
445
466
|
nodeId: string;
|
|
446
467
|
sourceAspect: string;
|
|
447
468
|
targetAspect: string;
|
|
469
|
+
// @internal (undocumented)
|
|
470
|
+
unbind(controller: ViewController): void;
|
|
448
471
|
}
|
|
449
472
|
|
|
450
473
|
// @public
|
|
@@ -473,18 +496,40 @@ export interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
|
|
|
473
496
|
}
|
|
474
497
|
|
|
475
498
|
// @public
|
|
476
|
-
export class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
|
|
499
|
+
export class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
|
|
477
500
|
constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
|
|
478
501
|
appendTo(node: Node): void;
|
|
479
|
-
bind(source: TSource
|
|
480
|
-
context: ExecutionContext<TParent
|
|
502
|
+
bind(source: TSource): void;
|
|
503
|
+
get context(): ExecutionContext<TParent>;
|
|
481
504
|
dispose(): void;
|
|
482
505
|
static disposeContiguousBatch(views: SyntheticView[]): void;
|
|
506
|
+
get event(): Event;
|
|
507
|
+
eventDetail<TDetail>(): TDetail;
|
|
508
|
+
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
483
509
|
firstChild: Node;
|
|
510
|
+
index: number;
|
|
484
511
|
insertBefore(node: Node): void;
|
|
512
|
+
// (undocumented)
|
|
513
|
+
isBound: boolean;
|
|
514
|
+
get isEven(): boolean;
|
|
515
|
+
get isFirst(): boolean;
|
|
516
|
+
get isInMiddle(): boolean;
|
|
517
|
+
get isLast(): boolean;
|
|
518
|
+
get isOdd(): boolean;
|
|
485
519
|
lastChild: Node;
|
|
520
|
+
length: number;
|
|
521
|
+
// (undocumented)
|
|
522
|
+
onUnbind(behavior: {
|
|
523
|
+
unbind(controller: ViewController<TSource, TParent>): any;
|
|
524
|
+
}): void;
|
|
525
|
+
readonly parent: TParent;
|
|
526
|
+
readonly parentContext: ExecutionContext<TParent>;
|
|
486
527
|
remove(): void;
|
|
528
|
+
// (undocumented)
|
|
529
|
+
selfContained: boolean;
|
|
487
530
|
source: TSource | null;
|
|
531
|
+
// (undocumented)
|
|
532
|
+
readonly targets: ViewBehaviorTargets;
|
|
488
533
|
unbind(): void;
|
|
489
534
|
}
|
|
490
535
|
|
|
@@ -521,13 +566,13 @@ export interface NodeBehaviorOptions<T = any> {
|
|
|
521
566
|
|
|
522
567
|
// @public
|
|
523
568
|
export abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
|
|
524
|
-
bind(
|
|
569
|
+
bind(controller: ViewController): void;
|
|
525
570
|
protected computeNodes(target: any): Node[];
|
|
526
571
|
protected abstract disconnect(target: any): void;
|
|
527
572
|
protected abstract getNodes(target: any): Node[];
|
|
528
573
|
protected getSource(target: Node): any;
|
|
529
574
|
protected abstract observe(target: any): void;
|
|
530
|
-
unbind(
|
|
575
|
+
unbind(controller: ViewController): void;
|
|
531
576
|
protected updateTarget(source: any, value: ReadonlyArray<any>): void;
|
|
532
577
|
}
|
|
533
578
|
|
|
@@ -580,7 +625,8 @@ export interface PartialFASTElementDefinition {
|
|
|
580
625
|
readonly attributes?: (AttributeConfiguration | string)[];
|
|
581
626
|
readonly elementOptions?: ElementDefinitionOptions;
|
|
582
627
|
readonly name: string;
|
|
583
|
-
readonly
|
|
628
|
+
readonly registry?: CustomElementRegistry;
|
|
629
|
+
readonly shadowOptions?: Partial<ShadowRootOptions> | null;
|
|
584
630
|
readonly styles?: ComposableStyles | ComposableStyles[];
|
|
585
631
|
readonly template?: ElementViewTemplate;
|
|
586
632
|
}
|
|
@@ -600,21 +646,20 @@ export class PropertyChangeNotifier implements Notifier {
|
|
|
600
646
|
}
|
|
601
647
|
|
|
602
648
|
// @public
|
|
603
|
-
export const ref: <
|
|
649
|
+
export const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & string) => CaptureType<TSource, TParent>;
|
|
604
650
|
|
|
605
651
|
// @public
|
|
606
652
|
export class RefDirective extends StatelessAttachedAttributeDirective<string> {
|
|
607
|
-
bind(
|
|
608
|
-
unbind(): void;
|
|
653
|
+
bind(controller: ViewController): void;
|
|
609
654
|
}
|
|
610
655
|
|
|
611
656
|
// @public
|
|
612
|
-
export function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any
|
|
657
|
+
export function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>, TParent = any>(items: Expression<TSource, TArray, TParent> | Binding<TSource, TArray, TParent> | ReadonlyArray<any>, template: Expression<TSource, ViewTemplate<any, TSource>> | Binding<TSource, ViewTemplate<any, TSource>> | ViewTemplate<any, TSource>, options?: RepeatOptions): CaptureType<TSource, TParent>;
|
|
613
658
|
|
|
614
659
|
// @public
|
|
615
|
-
export class RepeatBehavior<TSource = any> implements
|
|
616
|
-
constructor(directive: RepeatDirective
|
|
617
|
-
bind(
|
|
660
|
+
export class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
|
|
661
|
+
constructor(directive: RepeatDirective);
|
|
662
|
+
bind(controller: ViewController): void;
|
|
618
663
|
handleChange(source: any, args: Splice[] | ExpressionObserver): void;
|
|
619
664
|
unbind(): void;
|
|
620
665
|
}
|
|
@@ -622,7 +667,7 @@ export class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
|
|
|
622
667
|
// @public
|
|
623
668
|
export class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
|
|
624
669
|
constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
|
|
625
|
-
createBehavior(
|
|
670
|
+
createBehavior(): RepeatBehavior<TSource>;
|
|
626
671
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
627
672
|
// (undocumented)
|
|
628
673
|
readonly dataBinding: Binding<TSource>;
|
|
@@ -641,7 +686,13 @@ export interface RepeatOptions {
|
|
|
641
686
|
}
|
|
642
687
|
|
|
643
688
|
// @public
|
|
644
|
-
export
|
|
689
|
+
export interface ShadowRootOptions extends ShadowRootInit {
|
|
690
|
+
// @beta
|
|
691
|
+
registry?: CustomElementRegistry;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// @public
|
|
695
|
+
export function slotted<TSource = any, TParent = any>(propertyOrOptions: (keyof TSource & string) | SlottedDirectiveOptions<keyof TSource & string>): CaptureType<TSource, TParent>;
|
|
645
696
|
|
|
646
697
|
// @public
|
|
647
698
|
export class SlottedDirective extends NodeObservationDirective<SlottedDirectiveOptions> {
|
|
@@ -656,6 +707,15 @@ export class SlottedDirective extends NodeObservationDirective<SlottedDirectiveO
|
|
|
656
707
|
export interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
|
|
657
708
|
}
|
|
658
709
|
|
|
710
|
+
// @public
|
|
711
|
+
export const SourceLifetime: Readonly<{
|
|
712
|
+
readonly unknown: undefined;
|
|
713
|
+
readonly coupled: 1;
|
|
714
|
+
}>;
|
|
715
|
+
|
|
716
|
+
// @public
|
|
717
|
+
export type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
|
|
718
|
+
|
|
659
719
|
// @public
|
|
660
720
|
export class Splice {
|
|
661
721
|
constructor(index: number, removed: any[], addedCount: number);
|
|
@@ -699,16 +759,15 @@ export const SpliceStrategySupport: Readonly<{
|
|
|
699
759
|
export type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
|
|
700
760
|
|
|
701
761
|
// @public
|
|
702
|
-
export abstract class StatelessAttachedAttributeDirective<
|
|
703
|
-
constructor(options:
|
|
704
|
-
abstract bind(
|
|
705
|
-
createBehavior(
|
|
762
|
+
export abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
|
|
763
|
+
constructor(options: TOptions);
|
|
764
|
+
abstract bind(controller: ViewController): void;
|
|
765
|
+
createBehavior(): ViewBehavior;
|
|
706
766
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
707
767
|
id: string;
|
|
708
768
|
nodeId: string;
|
|
709
769
|
// (undocumented)
|
|
710
|
-
protected options:
|
|
711
|
-
abstract unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
|
|
770
|
+
protected options: TOptions;
|
|
712
771
|
}
|
|
713
772
|
|
|
714
773
|
// @public
|
|
@@ -760,7 +819,7 @@ export interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
760
819
|
}
|
|
761
820
|
|
|
762
821
|
// @public
|
|
763
|
-
export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
|
|
822
|
+
export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
|
|
764
823
|
|
|
765
824
|
// @public
|
|
766
825
|
export type TrustedTypes = {
|
|
@@ -803,14 +862,6 @@ export interface UpdateQueue {
|
|
|
803
862
|
// @public
|
|
804
863
|
export const Updates: UpdateQueue;
|
|
805
864
|
|
|
806
|
-
// @public
|
|
807
|
-
export type UpdateTarget = (this: UpdateTargetThis, target: Node, aspect: string, value: any, source: any, context: ExecutionContext) => void;
|
|
808
|
-
|
|
809
|
-
// @public
|
|
810
|
-
export interface UpdateTargetThis {
|
|
811
|
-
directive: HTMLBindingDirective;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
865
|
// @public
|
|
815
866
|
export interface ValueConverter {
|
|
816
867
|
fromView(value: any): any;
|
|
@@ -819,44 +870,61 @@ export interface ValueConverter {
|
|
|
819
870
|
|
|
820
871
|
// @public
|
|
821
872
|
export interface View<TSource = any, TParent = any> extends Disposable {
|
|
822
|
-
bind(source: TSource
|
|
823
|
-
readonly context: ExecutionContext<TParent
|
|
873
|
+
bind(source: TSource): void;
|
|
874
|
+
readonly context: ExecutionContext<TParent>;
|
|
824
875
|
readonly source: TSource | null;
|
|
825
876
|
unbind(): void;
|
|
826
877
|
}
|
|
827
878
|
|
|
828
879
|
// @public
|
|
829
880
|
export interface ViewBehavior<TSource = any, TParent = any> {
|
|
830
|
-
bind(
|
|
831
|
-
unbind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
|
|
881
|
+
bind(controller: ViewController<TSource, TParent>): void;
|
|
832
882
|
}
|
|
833
883
|
|
|
834
884
|
// @public
|
|
835
885
|
export interface ViewBehaviorFactory {
|
|
836
|
-
createBehavior(
|
|
886
|
+
createBehavior(): ViewBehavior;
|
|
837
887
|
id: string;
|
|
838
888
|
nodeId: string;
|
|
839
889
|
}
|
|
840
890
|
|
|
891
|
+
// @public
|
|
892
|
+
export interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
|
|
893
|
+
addBehavior(behavior: ViewBehavior): void;
|
|
894
|
+
addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
|
|
895
|
+
// (undocumented)
|
|
896
|
+
addTarget(nodeId: string, target: Node): void;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
// @public
|
|
900
|
+
export const ViewBehaviorOrchestrator: Readonly<{
|
|
901
|
+
create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
|
|
902
|
+
}>;
|
|
903
|
+
|
|
841
904
|
// @public
|
|
842
905
|
export type ViewBehaviorTargets = {
|
|
843
906
|
[id: string]: Node;
|
|
844
907
|
};
|
|
845
908
|
|
|
909
|
+
// @public
|
|
910
|
+
export interface ViewController<TSource = any, TParent = any> extends ExpressionController<TSource, TParent> {
|
|
911
|
+
readonly targets: ViewBehaviorTargets;
|
|
912
|
+
}
|
|
913
|
+
|
|
846
914
|
// @public
|
|
847
915
|
export class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
848
916
|
constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
|
|
849
917
|
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
850
918
|
readonly factories: Record<string, ViewBehaviorFactory>;
|
|
851
919
|
readonly html: string | HTMLTemplateElement;
|
|
852
|
-
render(source: TSource, host: Node, hostBindingTarget?: Element
|
|
920
|
+
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
853
921
|
}
|
|
854
922
|
|
|
855
923
|
// @public
|
|
856
924
|
export function volatile(target: {}, name: string | Accessor, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
857
925
|
|
|
858
926
|
// @public
|
|
859
|
-
export function when<TSource = any, TReturn = any>(condition: Expression<TSource, TReturn> | boolean, templateOrTemplateBinding: SyntheticViewTemplate | Expression<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
|
|
927
|
+
export function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
|
|
860
928
|
|
|
861
929
|
// Warnings were encountered during analysis:
|
|
862
930
|
//
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/fast-element",
|
|
3
3
|
"description": "A library for constructing Web Components",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.7",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"url": "https://discord.gg/FcSNfg4"
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"types": "./dist/dts/utilities.d.ts",
|
|
51
51
|
"default": "./dist/esm/utilities.js"
|
|
52
52
|
},
|
|
53
|
-
"./
|
|
54
|
-
"types": "./dist/dts/
|
|
55
|
-
"default": "./dist/esm/
|
|
53
|
+
"./state": {
|
|
54
|
+
"types": "./dist/dts/state/exports.d.ts",
|
|
55
|
+
"default": "./dist/esm/state/exports.js"
|
|
56
56
|
},
|
|
57
57
|
"./context": {
|
|
58
58
|
"types": "./dist/dts/context.d.ts",
|
|
@@ -70,6 +70,10 @@
|
|
|
70
70
|
"types": "./dist/dts/di/di.d.ts",
|
|
71
71
|
"default": "./dist/esm/di/di.js"
|
|
72
72
|
},
|
|
73
|
+
"./pending-task": {
|
|
74
|
+
"types": "./dist/dts/pending-task.d.ts",
|
|
75
|
+
"default": "./dist/esm/pending-task.js"
|
|
76
|
+
},
|
|
73
77
|
"./package.json": "./package.json"
|
|
74
78
|
},
|
|
75
79
|
"unpkg": "dist/fast-element.min.js",
|
package/dist/dts/hooks.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ExpressionNotifier } from "./observation/observable.js";
|
|
2
|
-
/**
|
|
3
|
-
* Functions used for getting and setting a stateful value.
|
|
4
|
-
* @beta
|
|
5
|
-
*/
|
|
6
|
-
export declare type State<T> = [() => T, (newValue: T) => T];
|
|
7
|
-
/**
|
|
8
|
-
* Creates an observable state value.
|
|
9
|
-
* @param value The initial state value.
|
|
10
|
-
* @param deep Whether or not to convert the state value to an observable.
|
|
11
|
-
* @returns The state accessor functions.
|
|
12
|
-
* @beta
|
|
13
|
-
*/
|
|
14
|
-
export declare function useState<T>(value: T, deep?: boolean): State<T>;
|
|
15
|
-
/**
|
|
16
|
-
* Executes an action once, and then whenever any of its dependent state changes.
|
|
17
|
-
* @param action An action that is affected by state changes.
|
|
18
|
-
* @returns A BindingObserver which can be used to dispose of the effect.
|
|
19
|
-
*/
|
|
20
|
-
export declare function useEffect(action: () => void): ExpressionNotifier;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext } from "./observable.js";
|
|
2
|
-
/**
|
|
3
|
-
* Represents an object that can contribute behavior to a view or
|
|
4
|
-
* element's bind/unbind operations.
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export interface Behavior<TSource = any, TParent = any> {
|
|
8
|
-
/**
|
|
9
|
-
* Bind this behavior to the source.
|
|
10
|
-
* @param source - The source to bind to.
|
|
11
|
-
* @param context - The execution context that the binding is operating within.
|
|
12
|
-
*/
|
|
13
|
-
bind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
14
|
-
/**
|
|
15
|
-
* Unbinds this behavior from the source.
|
|
16
|
-
* @param source - The source to unbind from.
|
|
17
|
-
*/
|
|
18
|
-
unbind(source: TSource, context: ExecutionContext<TParent>): void;
|
|
19
|
-
}
|