@microsoft/fast-element 2.0.0-beta.9 → 2.0.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.
- package/.eslintrc.json +1 -1
- package/CHANGELOG.json +518 -0
- package/CHANGELOG.md +181 -1
- package/README.md +1 -9
- package/api-extractor.context.json +14 -0
- package/api-extractor.di.json +14 -0
- package/dist/context/context.api.json +1068 -0
- package/dist/di/di.api.json +4929 -0
- package/dist/dts/binding/binding.d.ts +49 -0
- package/dist/dts/binding/normalize.d.ts +9 -0
- package/dist/dts/binding/one-time.d.ts +11 -0
- package/dist/dts/binding/one-way.d.ts +20 -0
- package/dist/dts/{templating/binding-signal.d.ts → binding/signal.d.ts} +19 -4
- package/dist/dts/{templating/binding-two-way.d.ts → binding/two-way.d.ts} +9 -5
- package/dist/dts/components/attributes.d.ts +7 -1
- package/dist/dts/components/element-controller.d.ts +104 -8
- package/dist/dts/components/element-hydration.d.ts +2 -0
- package/dist/dts/components/fast-definitions.d.ts +6 -0
- package/dist/dts/components/hydration.d.ts +56 -0
- package/dist/dts/components/install-hydration.d.ts +1 -0
- package/dist/dts/context.d.ts +29 -15
- package/dist/dts/di/di.d.ts +0 -5
- package/dist/dts/dom-policy.d.ts +83 -0
- package/dist/dts/dom.d.ts +100 -0
- package/dist/dts/hydration/target-builder.d.ts +63 -0
- package/dist/dts/index.d.ts +33 -26
- package/dist/dts/index.rollup.d.ts +0 -1
- package/dist/dts/index.rollup.debug.d.ts +0 -1
- package/dist/dts/interfaces.d.ts +32 -82
- package/dist/dts/metadata.d.ts +6 -5
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/observable.bench.d.ts +18 -0
- package/dist/dts/observation/observable.d.ts +5 -5
- package/dist/dts/pending-task.d.ts +19 -7
- package/dist/dts/platform.d.ts +11 -2
- package/dist/dts/polyfills.d.ts +0 -8
- package/dist/dts/styles/css-binding-directive.d.ts +60 -0
- package/dist/dts/styles/css.d.ts +9 -7
- package/dist/dts/styles/element-styles.d.ts +1 -14
- package/dist/dts/styles/host.d.ts +2 -5
- package/dist/dts/styles/style-strategy.d.ts +42 -0
- package/dist/dts/templating/compiler.d.ts +11 -13
- package/dist/dts/templating/{binding.d.ts → html-binding-directive.d.ts} +21 -41
- package/dist/dts/templating/html-directive.d.ts +44 -140
- package/dist/dts/templating/install-hydratable-view-templates.d.ts +1 -0
- package/dist/dts/templating/node-observation.d.ts +11 -1
- package/dist/dts/templating/ref.d.ts +4 -0
- package/dist/dts/templating/render.bench.d.ts +3 -0
- package/dist/dts/templating/render.d.ts +49 -9
- package/dist/dts/templating/repeat-basic-reverse.bench.d.ts +3 -0
- package/dist/dts/templating/repeat-basic-shift.bench.d.ts +3 -0
- package/dist/dts/templating/repeat.d.ts +31 -9
- package/dist/dts/templating/template.d.ts +97 -12
- package/dist/dts/templating/view.d.ts +146 -29
- package/dist/dts/templating/when-basic.bench.d.ts +3 -0
- package/dist/dts/templating/when-conditional.bench.d.ts +3 -0
- package/dist/dts/templating/when-switch.bench.d.ts +3 -0
- package/dist/dts/templating/when.d.ts +3 -1
- package/dist/dts/testing/fakes.d.ts +12 -1
- package/dist/dts/tsdoc-metadata.json +1 -1
- package/dist/dts/utilities.d.ts +55 -1
- package/dist/esm/binding/binding.js +18 -0
- package/dist/esm/binding/normalize.js +17 -0
- package/dist/esm/binding/one-time.js +21 -0
- package/dist/esm/binding/one-way.js +30 -0
- package/dist/esm/{templating/binding-signal.js → binding/signal.js} +22 -6
- package/dist/esm/{templating/binding-two-way.js → binding/two-way.js} +18 -12
- package/dist/esm/components/attributes.js +19 -6
- package/dist/esm/components/element-controller.js +319 -49
- package/dist/esm/components/element-hydration.js +2 -0
- package/dist/esm/components/fast-definitions.js +12 -4
- package/dist/esm/components/fast-element.js +3 -1
- package/dist/esm/components/hydration.js +104 -0
- package/dist/esm/components/install-hydration.js +3 -0
- package/dist/esm/context.js +26 -4
- package/dist/esm/debug.js +8 -2
- package/dist/esm/di/di.js +9 -12
- package/dist/esm/dom-policy.js +345 -0
- package/dist/esm/dom.js +101 -0
- package/dist/esm/hydration/target-builder.js +175 -0
- package/dist/esm/index.js +34 -25
- package/dist/esm/index.rollup.debug.js +3 -1
- package/dist/esm/index.rollup.js +3 -1
- package/dist/esm/interfaces.js +51 -3
- package/dist/esm/metadata.js +11 -8
- package/dist/esm/observation/arrays.js +1 -1
- package/dist/esm/observation/observable.bench.js +79 -0
- package/dist/esm/observation/observable.js +20 -15
- package/dist/esm/observation/update-queue.js +2 -2
- package/dist/esm/pending-task.js +13 -1
- package/dist/esm/platform.js +12 -2
- package/dist/esm/polyfills.js +3 -61
- package/dist/esm/styles/css-binding-directive.js +76 -0
- package/dist/esm/styles/css.js +14 -7
- package/dist/esm/styles/element-styles.js +0 -33
- package/dist/esm/styles/style-strategy.js +1 -0
- package/dist/esm/templating/children.js +8 -4
- package/dist/esm/templating/compiler.js +37 -44
- package/dist/esm/templating/html-binding-directive.js +218 -0
- package/dist/esm/templating/html-directive.js +25 -152
- package/dist/esm/templating/install-hydratable-view-templates.js +17 -0
- package/dist/esm/templating/node-observation.js +14 -8
- package/dist/esm/templating/ref.js +1 -1
- package/dist/esm/templating/render.bench.js +56 -0
- package/dist/esm/templating/render.js +74 -30
- package/dist/esm/templating/repeat-basic-reverse.bench.js +43 -0
- package/dist/esm/templating/repeat-basic-shift.bench.js +43 -0
- package/dist/esm/templating/repeat.js +116 -17
- package/dist/esm/templating/template.js +135 -60
- package/dist/esm/templating/view.js +254 -34
- package/dist/esm/templating/when-basic.bench.js +36 -0
- package/dist/esm/templating/when-conditional.bench.js +39 -0
- package/dist/esm/templating/when-switch.bench.js +68 -0
- package/dist/esm/templating/when.js +12 -5
- package/dist/esm/testing/fakes.js +32 -1
- package/dist/esm/testing/fixture.js +1 -1
- package/dist/esm/utilities.js +97 -1
- package/dist/fast-element.api.json +9789 -5667
- package/dist/fast-element.d.ts +813 -2392
- package/dist/fast-element.debug.js +2788 -974
- package/dist/fast-element.debug.min.js +3 -1
- package/dist/fast-element.js +2641 -833
- package/dist/fast-element.min.js +3 -1
- package/dist/fast-element.untrimmed.d.ts +662 -314
- package/docs/{api-report.md → api-report.api.md} +238 -151
- package/docs/context/api-report.api.md +69 -0
- package/docs/di/api-report.api.md +315 -0
- package/karma.conf.cjs +2 -1
- package/package.json +59 -47
- package/scripts/run-api-extractor.js +51 -0
- package/scripts/run-benchmarks.js +46 -0
- package/tensile.config.js +12 -0
- package/dist/dts/templating/dom.d.ts +0 -41
- package/dist/esm/templating/binding.js +0 -282
- package/dist/esm/templating/dom.js +0 -49
- package/docs/guide/declaring-templates.md +0 -230
- package/docs/guide/defining-elements.md +0 -214
- package/docs/guide/leveraging-css.md +0 -253
- package/docs/guide/next-steps.md +0 -13
- package/docs/guide/observables-and-state.md +0 -213
- package/docs/guide/using-directives.md +0 -576
- package/docs/guide/working-with-shadow-dom.md +0 -296
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
## API Report File for "@microsoft/fast-element"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
// @public
|
|
8
|
+
export type Context<T> = {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly initialValue?: T;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// @public
|
|
14
|
+
export const Context: Readonly<{
|
|
15
|
+
eventType: "context-request";
|
|
16
|
+
for<T = unknown>(name: string): FASTContext<T>;
|
|
17
|
+
create<T_1 = unknown>(name: string, initialValue?: T_1 | undefined): FASTContext<T_1>;
|
|
18
|
+
setDefaultRequestStrategy(strategy: FASTContextRequestStrategy): void;
|
|
19
|
+
get<T_2 extends UnknownContext>(target: EventTarget, context: T_2): ContextType<T_2>;
|
|
20
|
+
request<T_3 extends UnknownContext>(target: EventTarget, context: T_3, callback: ContextCallback<ContextType<T_3>>, multiple?: boolean): void;
|
|
21
|
+
dispatch<T_4 extends UnknownContext>(target: EventTarget, context: T_4, callback: ContextCallback<ContextType<T_4>>, multiple?: boolean): void;
|
|
22
|
+
provide<T_5 extends UnknownContext>(target: EventTarget, context: T_5, value: ContextType<T_5>): void;
|
|
23
|
+
handle<T_6 extends UnknownContext>(target: EventTarget, callback: (event: ContextEvent<T_6>) => void, context?: T_6 | undefined): void;
|
|
24
|
+
defineProperty<T_7 extends UnknownContext>(target: Constructable<EventTarget> | EventTarget, propertyName: string, context: T_7): void;
|
|
25
|
+
}>;
|
|
26
|
+
|
|
27
|
+
// @public
|
|
28
|
+
export type ContextCallback<ValueType> = (value: ValueType, dispose?: () => void) => void;
|
|
29
|
+
|
|
30
|
+
// Warning: (ae-forgotten-export) The symbol "ParameterDecorator_2" needs to be exported by the entry point context.d.ts
|
|
31
|
+
//
|
|
32
|
+
// @public
|
|
33
|
+
export type ContextDecorator<T = any> = Readonly<Context<T>> & PropertyDecorator & ParameterDecorator_2;
|
|
34
|
+
|
|
35
|
+
// @public
|
|
36
|
+
export class ContextEvent<T extends UnknownContext> extends Event {
|
|
37
|
+
constructor(context: T, callback: ContextCallback<ContextType<T>>, multiple?: boolean | undefined);
|
|
38
|
+
// (undocumented)
|
|
39
|
+
readonly callback: ContextCallback<ContextType<T>>;
|
|
40
|
+
// (undocumented)
|
|
41
|
+
readonly context: T;
|
|
42
|
+
// (undocumented)
|
|
43
|
+
readonly multiple?: boolean | undefined;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// @public
|
|
47
|
+
export type ContextType<T extends UnknownContext> = T extends Context<infer Y> ? Y : never;
|
|
48
|
+
|
|
49
|
+
// @public
|
|
50
|
+
export type FASTContext<T> = ContextDecorator<T> & {
|
|
51
|
+
get(target: EventTarget): T;
|
|
52
|
+
provide(target: EventTarget, value: T): void;
|
|
53
|
+
request(target: EventTarget, callback: ContextCallback<T>, multiple?: boolean): void;
|
|
54
|
+
handle(target: EventTarget, callback: (event: ContextEvent<FASTContext<T>>) => void): void;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// @public
|
|
58
|
+
export type FASTContextRequestStrategy = <T extends UnknownContext>(target: EventTarget, context: T, callback: ContextCallback<ContextType<T>>, multiple: any) => void;
|
|
59
|
+
|
|
60
|
+
// @public
|
|
61
|
+
export type UnknownContext = Context<unknown>;
|
|
62
|
+
|
|
63
|
+
// Warnings were encountered during analysis:
|
|
64
|
+
//
|
|
65
|
+
// dist/dts/context.d.ts:127:5 - (ae-forgotten-export) The symbol "Constructable" needs to be exported by the entry point context.d.ts
|
|
66
|
+
|
|
67
|
+
// (No @packageDocumentation comment for this package)
|
|
68
|
+
|
|
69
|
+
```
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
## API Report File for "@microsoft/fast-element"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
// @public
|
|
8
|
+
export const all: (key: any, searchAncestors?: boolean) => ReturnType<typeof DI.inject>;
|
|
9
|
+
|
|
10
|
+
// @public
|
|
11
|
+
export type AsyncRegistrationLocator = (key: Key) => Promise<Registration | null>;
|
|
12
|
+
|
|
13
|
+
// @public
|
|
14
|
+
export interface Container extends ServiceLocator {
|
|
15
|
+
createChild(config?: Partial<Omit<ContainerConfiguration, "parentLocator">>): Container;
|
|
16
|
+
getFactory<T extends Constructable>(key: T): Factory<T>;
|
|
17
|
+
getResolver<K extends Key, T = K>(key: K | Key, autoRegister?: boolean): Resolver<T> | null;
|
|
18
|
+
register(...params: any[]): Container;
|
|
19
|
+
// Warning: (ae-forgotten-export) The symbol "Constructable" needs to be exported by the entry point di.d.ts
|
|
20
|
+
registerFactory<T extends Constructable>(key: T, factory: Factory<T>): void;
|
|
21
|
+
registerResolver<K extends Key, T = K>(key: K, resolver: Resolver<T>): Resolver<T>;
|
|
22
|
+
registerTransformer<K extends Key, T = K>(key: K, transformer: Transformer_2<T>): boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Warning: (ae-forgotten-export) The symbol "ContextDecorator" needs to be exported by the entry point di.d.ts
|
|
26
|
+
//
|
|
27
|
+
// @public
|
|
28
|
+
export const Container: ContextDecorator<Container>;
|
|
29
|
+
|
|
30
|
+
// @public
|
|
31
|
+
export interface ContainerConfiguration {
|
|
32
|
+
asyncRegistrationLocator: AsyncRegistrationLocator;
|
|
33
|
+
defaultResolver(key: Key, handler: Container): Resolver;
|
|
34
|
+
parentLocator: ParentLocator;
|
|
35
|
+
responsibleForOwnerRequests: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// @public
|
|
39
|
+
export const ContainerConfiguration: Readonly<{
|
|
40
|
+
default: Readonly<ContainerConfiguration>;
|
|
41
|
+
}>;
|
|
42
|
+
|
|
43
|
+
// Warning: (ae-internal-missing-underscore) The name "ContainerImpl" should be prefixed with an underscore because the declaration is marked as @internal
|
|
44
|
+
//
|
|
45
|
+
// @internal (undocumented)
|
|
46
|
+
export class ContainerImpl implements DOMContainer {
|
|
47
|
+
constructor(owner: any, config: ContainerConfiguration);
|
|
48
|
+
// (undocumented)
|
|
49
|
+
protected config: ContainerConfiguration;
|
|
50
|
+
// (undocumented)
|
|
51
|
+
createChild(config?: Partial<Omit<ContainerConfiguration, "parentLocator">>): Container;
|
|
52
|
+
// (undocumented)
|
|
53
|
+
get depth(): number;
|
|
54
|
+
// (undocumented)
|
|
55
|
+
get<K extends Key>(key: K): Resolved<K>;
|
|
56
|
+
// (undocumented)
|
|
57
|
+
getAll<K extends Key>(key: K, searchAncestors?: boolean): readonly Resolved<K>[];
|
|
58
|
+
// (undocumented)
|
|
59
|
+
getAsync<K extends Key>(key: K): Promise<Resolved<K>>;
|
|
60
|
+
// (undocumented)
|
|
61
|
+
getFactory<K extends Constructable>(Type: K): Factory<K>;
|
|
62
|
+
// (undocumented)
|
|
63
|
+
getResolver<K extends Key, T = K>(key: K | Key, autoRegister?: boolean): Resolver<T> | null;
|
|
64
|
+
// (undocumented)
|
|
65
|
+
handleContextRequests(enable: boolean): void;
|
|
66
|
+
// (undocumented)
|
|
67
|
+
has<K extends Key>(key: K, searchAncestors?: boolean): boolean;
|
|
68
|
+
// (undocumented)
|
|
69
|
+
protected owner: any;
|
|
70
|
+
// (undocumented)
|
|
71
|
+
get parent(): ContainerImpl | null;
|
|
72
|
+
// (undocumented)
|
|
73
|
+
register(...params: any[]): Container;
|
|
74
|
+
// (undocumented)
|
|
75
|
+
registerFactory<K extends Constructable>(key: K, factory: Factory<K>): void;
|
|
76
|
+
// (undocumented)
|
|
77
|
+
registerResolver<K extends Key, T = K>(key: K, resolver: Resolver<T>): Resolver<T>;
|
|
78
|
+
// (undocumented)
|
|
79
|
+
registerTransformer<K extends Key, T = K>(key: K, transformer: Transformer_2<T>): boolean;
|
|
80
|
+
// (undocumented)
|
|
81
|
+
get responsibleForOwnerRequests(): boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// @public
|
|
85
|
+
export const DefaultResolver: Readonly<{
|
|
86
|
+
none(key: Key): Resolver;
|
|
87
|
+
singleton(key: Key): Resolver;
|
|
88
|
+
transient(key: Key): Resolver;
|
|
89
|
+
}>;
|
|
90
|
+
|
|
91
|
+
// @public
|
|
92
|
+
export const DI: Readonly<{
|
|
93
|
+
installAsContextRequestStrategy(fallback?: () => DOMContainer): void;
|
|
94
|
+
createContainer(config?: Partial<ContainerConfiguration>): Container;
|
|
95
|
+
findResponsibleContainer(target: EventTarget, fallback?: () => DOMContainer): DOMContainer;
|
|
96
|
+
findParentContainer(target: EventTarget, fallback?: () => DOMContainer): DOMContainer;
|
|
97
|
+
getOrCreateDOMContainer(target?: EventTarget, config?: Partial<Omit<ContainerConfiguration, "parentLocator">>): DOMContainer;
|
|
98
|
+
getDependencies(Type: Constructable | Injectable): Key[];
|
|
99
|
+
defineProperty(target: {}, propertyName: string, key: Key, respectConnection?: boolean): void;
|
|
100
|
+
createContext: typeof createContext;
|
|
101
|
+
inject(...dependencies: Key[]): (target: any, key?: string | number, descriptor?: PropertyDescriptor | number) => void;
|
|
102
|
+
transient<T extends Constructable<{}>>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
103
|
+
singleton<T_1 extends Constructable<{}>>(target: T_1 & Partial<RegisterSelf<T_1>>, options?: SingletonOptions): T_1 & RegisterSelf<T_1>;
|
|
104
|
+
}>;
|
|
105
|
+
|
|
106
|
+
// @public
|
|
107
|
+
export interface DOMContainer extends Container {
|
|
108
|
+
// @beta
|
|
109
|
+
handleContextRequests(enable: boolean): void;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// @public
|
|
113
|
+
export const DOMContainer: ContextDecorator<DOMContainer>;
|
|
114
|
+
|
|
115
|
+
// @public
|
|
116
|
+
export interface Factory<T extends Constructable = any> {
|
|
117
|
+
construct(container: Container, dynamicDependencies?: Key[]): Resolved<T>;
|
|
118
|
+
constructAsync(container: Container, dynamicDependencies?: Key[]): Promise<Resolved<T>>;
|
|
119
|
+
registerTransformer(transformer: Transformer_2<T>): void;
|
|
120
|
+
readonly Type: T;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Warning: (ae-internal-missing-underscore) The name "FactoryImpl" should be prefixed with an underscore because the declaration is marked as @internal
|
|
124
|
+
//
|
|
125
|
+
// @internal (undocumented)
|
|
126
|
+
export class FactoryImpl<T extends Constructable = any> implements Factory<T> {
|
|
127
|
+
constructor(Type: T, dependencies: Key[]);
|
|
128
|
+
// (undocumented)
|
|
129
|
+
construct(container: Container, dynamicDependencies?: Key[]): Resolved<T>;
|
|
130
|
+
// (undocumented)
|
|
131
|
+
constructAsync(container: Container, dynamicDependencies?: Key[]): Promise<Resolved<T>>;
|
|
132
|
+
// (undocumented)
|
|
133
|
+
registerTransformer(transformer: (instance: any) => any): void;
|
|
134
|
+
// (undocumented)
|
|
135
|
+
Type: T;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// @public
|
|
139
|
+
export function ignore(target: Injectable, property?: string | number, descriptor?: PropertyDescriptor | number): void;
|
|
140
|
+
|
|
141
|
+
// @public
|
|
142
|
+
export const inject: (...dependencies: Key[]) => (target: any, key?: string | number, descriptor?: PropertyDescriptor | number) => void;
|
|
143
|
+
|
|
144
|
+
// @public
|
|
145
|
+
export type Injectable<T = {}> = Constructable<T> & {
|
|
146
|
+
inject?: Key[];
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// @public
|
|
150
|
+
export interface InterfaceConfiguration {
|
|
151
|
+
friendlyName?: string;
|
|
152
|
+
respectConnection?: boolean;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// @public
|
|
156
|
+
export type Key = PropertyKey | object | ContextDecorator | Constructable | Resolver;
|
|
157
|
+
|
|
158
|
+
// @public
|
|
159
|
+
export const lazy: (key: any) => any;
|
|
160
|
+
|
|
161
|
+
// @public
|
|
162
|
+
export const newInstanceForScope: (key: any) => any;
|
|
163
|
+
|
|
164
|
+
// @public
|
|
165
|
+
export const newInstanceOf: (key: any) => any;
|
|
166
|
+
|
|
167
|
+
// @public
|
|
168
|
+
export const optional: (key: any) => any;
|
|
169
|
+
|
|
170
|
+
// @public
|
|
171
|
+
export type ParentLocator = (owner: any) => Container | null;
|
|
172
|
+
|
|
173
|
+
// @public
|
|
174
|
+
export type RegisterSelf<T extends Constructable> = {
|
|
175
|
+
register(container: Container): Resolver<InstanceType<T>>;
|
|
176
|
+
registerInRequestor: boolean;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// @public
|
|
180
|
+
export interface Registration<K = any> {
|
|
181
|
+
register(container: Container): Resolver<K>;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// @public
|
|
185
|
+
export const Registration: Readonly<{
|
|
186
|
+
instance<T>(key: Key, value: T): Registration<T>;
|
|
187
|
+
singleton<T_1 extends Constructable<{}>>(key: Key, value: T_1): Registration<InstanceType<T_1>>;
|
|
188
|
+
transient<T_2 extends Constructable<{}>>(key: Key, value: T_2): Registration<InstanceType<T_2>>;
|
|
189
|
+
callback<T_3>(key: Key, callback: ResolveCallback<T_3>): Registration<Resolved<T_3>>;
|
|
190
|
+
cachedCallback<T_4>(key: Key, callback: ResolveCallback<T_4>): Registration<Resolved<T_4>>;
|
|
191
|
+
aliasTo<T_5>(originalKey: T_5, aliasKey: Key): Registration<Resolved<T_5>>;
|
|
192
|
+
}>;
|
|
193
|
+
|
|
194
|
+
// @public
|
|
195
|
+
export interface Registry {
|
|
196
|
+
register(container: Container, ...params: unknown[]): void | Resolver;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// @public
|
|
200
|
+
export type ResolveCallback<T = any> = (handler: Container, requestor: Container, resolver: Resolver<T>) => T;
|
|
201
|
+
|
|
202
|
+
// Warning: (ae-forgotten-export) The symbol "ResolverLike" needs to be exported by the entry point di.d.ts
|
|
203
|
+
//
|
|
204
|
+
// @public
|
|
205
|
+
export type Resolved<K> = K extends ContextDecorator<infer T> ? T : K extends Constructable ? InstanceType<K> : K extends ResolverLike<any, infer T1> ? T1 extends Constructable ? InstanceType<T1> : T1 : K;
|
|
206
|
+
|
|
207
|
+
// @public
|
|
208
|
+
export interface Resolver<K = any> extends ResolverLike<Container, K> {
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// @public
|
|
212
|
+
export class ResolverBuilder<K> {
|
|
213
|
+
constructor(container: Container, key: Key);
|
|
214
|
+
aliasTo(destinationKey: Key): Resolver<K>;
|
|
215
|
+
cachedCallback(value: ResolveCallback<K>): Resolver<K>;
|
|
216
|
+
callback(value: ResolveCallback<K>): Resolver<K>;
|
|
217
|
+
instance(value: K): Resolver<K>;
|
|
218
|
+
singleton(value: Constructable): Resolver<K>;
|
|
219
|
+
transient(value: Constructable): Resolver<K>;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Warning: (ae-internal-missing-underscore) The name "ResolverImpl" should be prefixed with an underscore because the declaration is marked as @internal
|
|
223
|
+
//
|
|
224
|
+
// @internal (undocumented)
|
|
225
|
+
export class ResolverImpl implements Resolver, Registration {
|
|
226
|
+
// (undocumented)
|
|
227
|
+
get $isResolver(): true;
|
|
228
|
+
constructor(key: Key, strategy: ResolverStrategy, state: any);
|
|
229
|
+
// (undocumented)
|
|
230
|
+
getFactory(container: Container): Factory | null;
|
|
231
|
+
// (undocumented)
|
|
232
|
+
key: Key;
|
|
233
|
+
// (undocumented)
|
|
234
|
+
register(container: Container): Resolver;
|
|
235
|
+
// (undocumented)
|
|
236
|
+
resolve(handler: Container, requestor: Container): any;
|
|
237
|
+
// (undocumented)
|
|
238
|
+
resolveAsync(handler: Container, requestor: Container): Promise<any>;
|
|
239
|
+
// (undocumented)
|
|
240
|
+
state: any;
|
|
241
|
+
// (undocumented)
|
|
242
|
+
strategy: ResolverStrategy;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Warning: (ae-internal-missing-underscore) The name "ResolverStrategy" should be prefixed with an underscore because the declaration is marked as @internal
|
|
246
|
+
//
|
|
247
|
+
// @internal (undocumented)
|
|
248
|
+
export const enum ResolverStrategy {
|
|
249
|
+
// (undocumented)
|
|
250
|
+
alias = 5,
|
|
251
|
+
// (undocumented)
|
|
252
|
+
array = 4,
|
|
253
|
+
// (undocumented)
|
|
254
|
+
callback = 3,
|
|
255
|
+
// (undocumented)
|
|
256
|
+
instance = 0,
|
|
257
|
+
// (undocumented)
|
|
258
|
+
singleton = 1,
|
|
259
|
+
// (undocumented)
|
|
260
|
+
transient = 2
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// @public
|
|
264
|
+
export interface ServiceLocator {
|
|
265
|
+
get<K extends Key>(key: K): Resolved<K>;
|
|
266
|
+
get<K extends Key>(key: Key): Resolved<K>;
|
|
267
|
+
get<K extends Key>(key: K | Key): Resolved<K>;
|
|
268
|
+
getAll<K extends Key>(key: K, searchAncestors?: boolean): readonly Resolved<K>[];
|
|
269
|
+
getAll<K extends Key>(key: Key, searchAncestors?: boolean): readonly Resolved<K>[];
|
|
270
|
+
getAll<K extends Key>(key: K | Key, searchAncestors?: boolean): readonly Resolved<K>[];
|
|
271
|
+
getAsync<K extends Key>(key: K): Promise<Resolved<K>>;
|
|
272
|
+
getAsync<K extends Key>(key: Key): Promise<Resolved<K>>;
|
|
273
|
+
getAsync<K extends Key>(key: K | Key): Promise<Resolved<K>>;
|
|
274
|
+
has<K extends Key>(key: K | Key, searchAncestors: boolean): boolean;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// @public
|
|
278
|
+
export const ServiceLocator: ContextDecorator<ServiceLocator>;
|
|
279
|
+
|
|
280
|
+
// Warning: (ae-forgotten-export) The symbol "singletonDecorator" needs to be exported by the entry point di.d.ts
|
|
281
|
+
//
|
|
282
|
+
// @public
|
|
283
|
+
export function singleton<T extends Constructable>(): typeof singletonDecorator;
|
|
284
|
+
|
|
285
|
+
// @public (undocumented)
|
|
286
|
+
export function singleton<T extends Constructable>(options?: SingletonOptions): typeof singletonDecorator;
|
|
287
|
+
|
|
288
|
+
// @public
|
|
289
|
+
export function singleton<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
290
|
+
|
|
291
|
+
// @public
|
|
292
|
+
type Transformer_2<K> = (instance: Resolved<K>) => Resolved<K>;
|
|
293
|
+
export { Transformer_2 as Transformer }
|
|
294
|
+
|
|
295
|
+
// Warning: (ae-forgotten-export) The symbol "transientDecorator" needs to be exported by the entry point di.d.ts
|
|
296
|
+
//
|
|
297
|
+
// @public
|
|
298
|
+
export function transient<T extends Constructable>(): typeof transientDecorator;
|
|
299
|
+
|
|
300
|
+
// @public
|
|
301
|
+
export function transient<T extends Constructable>(target: T & Partial<RegisterSelf<T>>): T & RegisterSelf<T>;
|
|
302
|
+
|
|
303
|
+
// Warning: (ae-internal-missing-underscore) The name "validateKey" should be prefixed with an underscore because the declaration is marked as @internal
|
|
304
|
+
//
|
|
305
|
+
// @internal (undocumented)
|
|
306
|
+
export function validateKey(key: any): void;
|
|
307
|
+
|
|
308
|
+
// Warnings were encountered during analysis:
|
|
309
|
+
//
|
|
310
|
+
// dist/dts/di/di.d.ts:479:5 - (ae-forgotten-export) The symbol "createContext" needs to be exported by the entry point di.d.ts
|
|
311
|
+
// dist/dts/di/di.d.ts:540:5 - (ae-forgotten-export) The symbol "SingletonOptions" needs to be exported by the entry point di.d.ts
|
|
312
|
+
|
|
313
|
+
// (No @packageDocumentation comment for this package)
|
|
314
|
+
|
|
315
|
+
```
|
package/karma.conf.cjs
CHANGED
|
@@ -121,7 +121,7 @@ module.exports = function (config) {
|
|
|
121
121
|
options.webpack.module.rules.push({
|
|
122
122
|
enforce: "post",
|
|
123
123
|
exclude: /(__tests__|testing|node_modules|\.spec\.[tj]s$)/,
|
|
124
|
-
loader:
|
|
124
|
+
loader: '@jsdevtools/coverage-istanbul-loader',
|
|
125
125
|
options: { esModules: true },
|
|
126
126
|
test: /\.[tj]s$/,
|
|
127
127
|
});
|
|
@@ -129,6 +129,7 @@ module.exports = function (config) {
|
|
|
129
129
|
options.coverageIstanbulReporter = {
|
|
130
130
|
reports: ["html", "text-summary", "json", "lcovonly", "cobertura"],
|
|
131
131
|
dir: "coverage",
|
|
132
|
+
fixWebpackSourcePaths: true,
|
|
132
133
|
};
|
|
133
134
|
options.junitReporter = {
|
|
134
135
|
outputDir: "coverage",
|
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.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"url": "https://discord.gg/FcSNfg4"
|
|
@@ -26,76 +26,88 @@
|
|
|
26
26
|
"development": "./dist/esm/index.debug.js",
|
|
27
27
|
"default": "./dist/esm/index.js"
|
|
28
28
|
},
|
|
29
|
-
"./
|
|
30
|
-
"types": "./dist/dts/polyfills.d.ts",
|
|
31
|
-
"default": "./dist/esm/polyfills.js"
|
|
32
|
-
},
|
|
33
|
-
"./debug": {
|
|
29
|
+
"./debug.js": {
|
|
34
30
|
"types": "./dist/dts/debug.d.ts",
|
|
35
31
|
"default": "./dist/esm/debug.js"
|
|
36
32
|
},
|
|
37
|
-
"./binding/two-way": {
|
|
38
|
-
"types": "./dist/dts/
|
|
39
|
-
"default": "./dist/esm/
|
|
33
|
+
"./binding/two-way.js": {
|
|
34
|
+
"types": "./dist/dts/binding/two-way.d.ts",
|
|
35
|
+
"default": "./dist/esm/binding/two-way.js"
|
|
40
36
|
},
|
|
41
|
-
"./binding/signal": {
|
|
42
|
-
"types": "./dist/dts/
|
|
43
|
-
"default": "./dist/esm/
|
|
37
|
+
"./binding/signal.js": {
|
|
38
|
+
"types": "./dist/dts/binding/signal.d.ts",
|
|
39
|
+
"default": "./dist/esm/binding/signal.js"
|
|
44
40
|
},
|
|
45
|
-
"./render": {
|
|
41
|
+
"./render.js": {
|
|
46
42
|
"types": "./dist/dts/templating/render.d.ts",
|
|
47
43
|
"default": "./dist/esm/templating/render.js"
|
|
48
44
|
},
|
|
49
|
-
"./utilities": {
|
|
45
|
+
"./utilities.js": {
|
|
50
46
|
"types": "./dist/dts/utilities.d.ts",
|
|
51
47
|
"default": "./dist/esm/utilities.js"
|
|
52
48
|
},
|
|
53
|
-
"./state": {
|
|
49
|
+
"./state.js": {
|
|
54
50
|
"types": "./dist/dts/state/exports.d.ts",
|
|
55
51
|
"default": "./dist/esm/state/exports.js"
|
|
56
52
|
},
|
|
57
|
-
"./context": {
|
|
53
|
+
"./context.js": {
|
|
58
54
|
"types": "./dist/dts/context.d.ts",
|
|
59
55
|
"default": "./dist/esm/context.js"
|
|
60
56
|
},
|
|
61
|
-
"./metadata": {
|
|
57
|
+
"./metadata.js": {
|
|
62
58
|
"types": "./dist/dts/metadata.d.ts",
|
|
63
59
|
"default": "./dist/esm/metadata.js"
|
|
64
60
|
},
|
|
65
|
-
"./testing": {
|
|
61
|
+
"./testing.js": {
|
|
66
62
|
"types": "./dist/dts/testing/exports.d.ts",
|
|
67
63
|
"default": "./dist/esm/testing/exports.js"
|
|
68
64
|
},
|
|
69
|
-
"./di": {
|
|
65
|
+
"./di.js": {
|
|
70
66
|
"types": "./dist/dts/di/di.d.ts",
|
|
71
67
|
"default": "./dist/esm/di/di.js"
|
|
72
68
|
},
|
|
73
|
-
"./
|
|
69
|
+
"./element-hydration.js": {
|
|
70
|
+
"types": "./dist/dts/components/hydration.d.ts",
|
|
71
|
+
"default": "./dist/esm/components/hydration.js"
|
|
72
|
+
},
|
|
73
|
+
"./install-element-hydration.js": {
|
|
74
|
+
"types": "./dist/dts/components/install-hydration.d.ts",
|
|
75
|
+
"default": "./dist/esm/components/install-hydration.js"
|
|
76
|
+
},
|
|
77
|
+
"./pending-task.js": {
|
|
74
78
|
"types": "./dist/dts/pending-task.d.ts",
|
|
75
79
|
"default": "./dist/esm/pending-task.js"
|
|
76
80
|
},
|
|
81
|
+
"./dom-policy.js": {
|
|
82
|
+
"types": "./dist/dts/dom-policy.d.ts",
|
|
83
|
+
"default": "./dist/esm/dom-policy.js"
|
|
84
|
+
},
|
|
77
85
|
"./package.json": "./package.json"
|
|
78
86
|
},
|
|
79
87
|
"unpkg": "dist/fast-element.min.js",
|
|
80
88
|
"sideEffects": [
|
|
81
89
|
"./dist/esm/debug.js",
|
|
82
|
-
"./dist/esm/polyfills.js"
|
|
90
|
+
"./dist/esm/polyfills.js",
|
|
91
|
+
"./dist/esm/components/install-hydration.js"
|
|
83
92
|
],
|
|
84
93
|
"scripts": {
|
|
94
|
+
"benchmark": "npm run clean:dist && npm run build && node ./scripts/run-benchmarks",
|
|
85
95
|
"clean:dist": "node ../../../build/clean.js dist",
|
|
86
96
|
"doc": "api-extractor run --local",
|
|
87
97
|
"doc:ci": "api-extractor run",
|
|
88
|
-
"
|
|
98
|
+
"doc:exports": "node ./scripts/run-api-extractor.js",
|
|
99
|
+
"doc:exports:ci": "node ./scripts/run-api-extractor.js ci",
|
|
100
|
+
"build": "npm run build:tsc && npm run build:rollup && npm run doc && npm run doc:exports",
|
|
89
101
|
"build:rollup": "rollup -c",
|
|
90
102
|
"build:tsc": "tsc -p ./tsconfig.json",
|
|
91
103
|
"dev": "tsc -p ./tsconfig.json -w",
|
|
92
|
-
"tdd": "
|
|
93
|
-
"
|
|
104
|
+
"tdd": "npm run dev & npm run test-chrome:watch",
|
|
105
|
+
"prepublishOnly": "npm run clean:dist && npm run build",
|
|
94
106
|
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.ts\"",
|
|
95
107
|
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different",
|
|
96
108
|
"eslint": "eslint . --ext .ts",
|
|
97
109
|
"eslint:fix": "eslint . --ext .ts --fix",
|
|
98
|
-
"test": "
|
|
110
|
+
"test": "npm run eslint && npm run test-chrome:verbose && npm run doc:ci && npm run doc:exports:ci",
|
|
99
111
|
"test-node": "mocha --reporter min --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'",
|
|
100
112
|
"test-node:verbose": "mocha --reporter spec --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'",
|
|
101
113
|
"test-chrome": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --single-run --coverage",
|
|
@@ -108,44 +120,44 @@
|
|
|
108
120
|
"test-firefox:verbose": "karma start karma.conf.cjs --browsers=FirefoxHeadless --single-run --coverage --reporter=mocha"
|
|
109
121
|
},
|
|
110
122
|
"devDependencies": {
|
|
111
|
-
"@
|
|
123
|
+
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
|
|
124
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
125
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
126
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
127
|
+
"@rollup/plugin-typescript": "^8.3.2",
|
|
128
|
+
"@tensile-perf/web-components": "^0.2.1",
|
|
112
129
|
"@types/chai": "^4.2.11",
|
|
113
130
|
"@types/chai-spies": "^1.0.3",
|
|
114
|
-
"@types/karma": "^
|
|
131
|
+
"@types/karma": "^6.3.3",
|
|
115
132
|
"@types/mocha": "^7.0.2",
|
|
116
|
-
"@types/webpack-env": "^1.
|
|
133
|
+
"@types/webpack-env": "^1.18.5",
|
|
117
134
|
"chai": "^4.2.0",
|
|
118
135
|
"chai-spies": "^1.0.0",
|
|
119
136
|
"esm": "^3.2.25",
|
|
120
137
|
"ignore-loader": "^0.1.2",
|
|
121
138
|
"istanbul": "^0.4.5",
|
|
122
|
-
"istanbul-instrumenter-loader": "^3.0.1",
|
|
123
139
|
"jsdom": "^16.2.2",
|
|
124
140
|
"jsdom-global": "3.0.2",
|
|
125
|
-
"karma": "^
|
|
126
|
-
"karma-chrome-launcher": "^3.
|
|
127
|
-
"karma-coverage": "^2.
|
|
128
|
-
"karma-coverage-istanbul-reporter": "^3.0.
|
|
129
|
-
"karma-firefox-launcher": "^2.1.
|
|
141
|
+
"karma": "^6.4.3",
|
|
142
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
143
|
+
"karma-coverage": "^2.2.1",
|
|
144
|
+
"karma-coverage-istanbul-reporter": "^3.0.3",
|
|
145
|
+
"karma-firefox-launcher": "^2.1.3",
|
|
130
146
|
"karma-mocha": "^2.0.1",
|
|
131
147
|
"karma-mocha-reporter": "^2.2.5",
|
|
132
148
|
"karma-source-map-support": "^1.4.0",
|
|
133
|
-
"karma-sourcemap-loader": "^0.
|
|
134
|
-
"karma-webpack": "^5.0.
|
|
135
|
-
"mocha": "^
|
|
136
|
-
"prettier": "2.
|
|
149
|
+
"karma-sourcemap-loader": "^0.4.0",
|
|
150
|
+
"karma-webpack": "^5.0.1",
|
|
151
|
+
"mocha": "^10.5.2",
|
|
152
|
+
"prettier": "2.8.8",
|
|
137
153
|
"rollup": "^2.71.1",
|
|
138
|
-
"rollup-plugin-filesize": "^
|
|
139
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
140
|
-
"@rollup/plugin-typescript": "^8.3.2",
|
|
154
|
+
"rollup-plugin-filesize": "^10.0.0",
|
|
141
155
|
"source-map": "^0.7.3",
|
|
142
|
-
"source-map-loader": "^0.
|
|
143
|
-
"ts-loader": "^
|
|
156
|
+
"source-map-loader": "^5.0.0",
|
|
157
|
+
"ts-loader": "^9.3.0",
|
|
144
158
|
"ts-node": "^8.9.1",
|
|
145
159
|
"tsconfig-paths": "^3.9.0",
|
|
146
|
-
"tslib": "^2.
|
|
147
|
-
"typescript": "
|
|
148
|
-
"webpack": "^5.72.0",
|
|
149
|
-
"webpack-cli": "^4.9.2"
|
|
160
|
+
"tslib": "^2.6.3",
|
|
161
|
+
"typescript": "~4.7.0"
|
|
150
162
|
}
|
|
151
163
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { Extractor, ExtractorConfig } from '@microsoft/api-extractor';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
export const exportPaths = [
|
|
10
|
+
{
|
|
11
|
+
path: "./context.js",
|
|
12
|
+
docsFolder: "context",
|
|
13
|
+
configPath: path.resolve(__dirname, "../api-extractor.context.json")
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
path: "./di.js",
|
|
17
|
+
docsFolder: "di",
|
|
18
|
+
configPath: path.resolve(__dirname, "../api-extractor.di.json")
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
(function() {
|
|
23
|
+
exportPaths.forEach((exportPath) => {
|
|
24
|
+
const docsFolder = path.resolve(__dirname, `../docs/${exportPath.docsFolder}`);
|
|
25
|
+
// Create folders in the docs directory
|
|
26
|
+
if (!fs.existsSync(docsFolder)) {
|
|
27
|
+
fs.mkdirSync(docsFolder);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Load and parse the api-extractor.json file
|
|
31
|
+
const extractorConfig = ExtractorConfig.loadFileAndPrepare(exportPath.configPath);
|
|
32
|
+
|
|
33
|
+
// Invoke API Extractor
|
|
34
|
+
const extractorResult = Extractor.invoke(
|
|
35
|
+
extractorConfig,
|
|
36
|
+
{
|
|
37
|
+
// Equivalent to the "--local" command-line parameter
|
|
38
|
+
localBuild: process.argv[2] !== "ci",
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (extractorResult.succeeded) {
|
|
43
|
+
console.log(`API Extractor completed successfully for ${exportPath.configPath}`);
|
|
44
|
+
} else {
|
|
45
|
+
console.error(
|
|
46
|
+
`API Extractor completed with ${extractorResult.errorCount} errors` +
|
|
47
|
+
` and ${extractorResult.warningCount} warnings for ${exportPath.configPath}`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
})();
|