@microsoft/fast-element 2.0.0-beta.17 → 2.0.0-beta.18
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 +21 -0
- package/CHANGELOG.md +10 -1
- package/dist/dts/dom-policy.d.ts +68 -0
- package/dist/dts/dom.d.ts +116 -0
- package/dist/dts/index.d.ts +3 -2
- 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 +15 -24
- package/dist/dts/polyfills.d.ts +0 -1
- package/dist/dts/templating/binding-signal.d.ts +3 -1
- package/dist/dts/templating/binding-two-way.d.ts +3 -1
- package/dist/dts/templating/binding.d.ts +16 -5
- package/dist/dts/templating/compiler.d.ts +11 -13
- package/dist/dts/templating/dangerous-html.d.ts +18 -0
- package/dist/dts/templating/html-directive.d.ts +50 -119
- package/dist/dts/templating/node-observation.d.ts +11 -1
- package/dist/dts/templating/ref.d.ts +4 -0
- package/dist/dts/templating/render.d.ts +30 -6
- package/dist/dts/templating/repeat.d.ts +1 -5
- package/dist/dts/templating/template.d.ts +39 -13
- package/dist/dts/templating/view.d.ts +2 -2
- package/dist/dts/utilities.d.ts +39 -0
- package/dist/esm/components/attributes.js +1 -1
- package/dist/esm/debug.js +4 -1
- package/dist/esm/dom-policy.js +337 -0
- package/dist/esm/dom.js +117 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.rollup.debug.js +3 -1
- package/dist/esm/index.rollup.js +3 -1
- package/dist/esm/platform.js +1 -1
- package/dist/esm/polyfills.js +3 -7
- package/dist/esm/templating/binding-signal.js +3 -2
- package/dist/esm/templating/binding-two-way.js +3 -2
- package/dist/esm/templating/binding.js +31 -54
- package/dist/esm/templating/compiler.js +31 -38
- package/dist/esm/templating/dangerous-html.js +23 -0
- package/dist/esm/templating/html-directive.js +38 -135
- package/dist/esm/templating/node-observation.js +14 -8
- package/dist/esm/templating/ref.js +1 -1
- package/dist/esm/templating/render.js +17 -6
- package/dist/esm/templating/repeat.js +2 -6
- package/dist/esm/templating/template.js +81 -56
- package/dist/esm/testing/fixture.js +1 -1
- package/dist/esm/utilities.js +68 -0
- package/dist/fast-element.api.json +1088 -608
- package/dist/fast-element.d.ts +190 -147
- package/dist/fast-element.debug.js +708 -384
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +679 -358
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +190 -147
- package/docs/api-report.md +66 -56
- package/package.json +5 -1
- package/yarn-error.log +177 -0
- package/dist/dts/templating/dom.d.ts +0 -41
- package/dist/esm/templating/dom.js +0 -49
package/docs/api-report.md
CHANGED
|
@@ -31,24 +31,9 @@ export const ArrayObserver: Readonly<{
|
|
|
31
31
|
readonly enable: () => void;
|
|
32
32
|
}>;
|
|
33
33
|
|
|
34
|
-
// @public
|
|
35
|
-
export const Aspect: Readonly<{
|
|
36
|
-
readonly none: 0;
|
|
37
|
-
readonly attribute: 1;
|
|
38
|
-
readonly booleanAttribute: 2;
|
|
39
|
-
readonly property: 3;
|
|
40
|
-
readonly content: 4;
|
|
41
|
-
readonly tokenList: 5;
|
|
42
|
-
readonly event: 6;
|
|
43
|
-
readonly assign: (directive: Aspected, value?: string) => void;
|
|
44
|
-
}>;
|
|
45
|
-
|
|
46
|
-
// @public
|
|
47
|
-
export type Aspect = typeof Aspect[Exclude<keyof typeof Aspect, "assign" | "none">];
|
|
48
|
-
|
|
49
34
|
// @public
|
|
50
35
|
export interface Aspected {
|
|
51
|
-
aspectType:
|
|
36
|
+
aspectType: DOMAspect;
|
|
52
37
|
dataBinding?: Binding;
|
|
53
38
|
sourceAspect: string;
|
|
54
39
|
targetAspect: string;
|
|
@@ -96,17 +81,19 @@ export class AttributeDefinition implements Accessor {
|
|
|
96
81
|
export type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
|
|
97
82
|
|
|
98
83
|
// @public
|
|
99
|
-
export function bind<T = any>(expression: Expression<T>, isVolatile?: boolean): Binding<T>;
|
|
84
|
+
export function bind<T = any>(expression: Expression<T>, policy?: DOMPolicy, isVolatile?: boolean): Binding<T>;
|
|
100
85
|
|
|
101
86
|
// @public
|
|
102
87
|
export abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
103
|
-
constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
|
|
88
|
+
constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy | undefined, isVolatile?: boolean);
|
|
104
89
|
abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
|
|
105
90
|
// (undocumented)
|
|
106
91
|
evaluate: Expression<TSource, TReturn, TParent>;
|
|
107
92
|
// (undocumented)
|
|
108
93
|
isVolatile: boolean;
|
|
109
94
|
options?: any;
|
|
95
|
+
// (undocumented)
|
|
96
|
+
policy?: DOMPolicy | undefined;
|
|
110
97
|
}
|
|
111
98
|
|
|
112
99
|
// @public
|
|
@@ -142,14 +129,17 @@ export type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | S
|
|
|
142
129
|
// @public
|
|
143
130
|
export type CompilationStrategy = (
|
|
144
131
|
html: string | HTMLTemplateElement,
|
|
145
|
-
factories: Record<string, ViewBehaviorFactory
|
|
132
|
+
factories: Record<string, ViewBehaviorFactory>,
|
|
133
|
+
policy: DOMPolicy) => HTMLTemplateCompilationResult;
|
|
134
|
+
|
|
135
|
+
// @public
|
|
136
|
+
export type CompiledViewBehaviorFactory = Required<ViewBehaviorFactory>;
|
|
146
137
|
|
|
147
138
|
// @public
|
|
148
139
|
export const Compiler: {
|
|
149
|
-
|
|
150
|
-
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
140
|
+
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
151
141
|
setDefaultStrategy(strategy: CompilationStrategy): void;
|
|
152
|
-
aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
|
|
142
|
+
aggregate(parts: (string | ViewBehaviorFactory)[], policy?: DOMPolicy): ViewBehaviorFactory;
|
|
153
143
|
};
|
|
154
144
|
|
|
155
145
|
// @public
|
|
@@ -224,6 +214,16 @@ export type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: (Compos
|
|
|
224
214
|
// @public
|
|
225
215
|
export function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
|
|
226
216
|
|
|
217
|
+
// @public
|
|
218
|
+
export function dangerousHTML<TSource = any, TParent = any>(html: string): CaptureType<TSource, TParent>;
|
|
219
|
+
|
|
220
|
+
// @public
|
|
221
|
+
export class DangerousHTMLDirective implements HTMLDirective {
|
|
222
|
+
constructor(html: string);
|
|
223
|
+
// (undocumented)
|
|
224
|
+
createHTML(): string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
227
|
// @public
|
|
228
228
|
export type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
229
229
|
|
|
@@ -237,10 +237,35 @@ export const DOM: Readonly<{
|
|
|
237
237
|
queueUpdate: (callable: Callable) => void;
|
|
238
238
|
nextUpdate: () => Promise<void>;
|
|
239
239
|
processUpdates: () => void;
|
|
240
|
+
readonly policy: DOMPolicy;
|
|
241
|
+
setPolicy(value: DOMPolicy): void;
|
|
240
242
|
setAttribute(element: HTMLElement, attributeName: string, value: any): void;
|
|
241
243
|
setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
|
|
242
244
|
}>;
|
|
243
245
|
|
|
246
|
+
// @public
|
|
247
|
+
export const DOMAspect: Readonly<{
|
|
248
|
+
readonly none: 0;
|
|
249
|
+
readonly attribute: 1;
|
|
250
|
+
readonly booleanAttribute: 2;
|
|
251
|
+
readonly property: 3;
|
|
252
|
+
readonly content: 4;
|
|
253
|
+
readonly tokenList: 5;
|
|
254
|
+
readonly event: 6;
|
|
255
|
+
}>;
|
|
256
|
+
|
|
257
|
+
// @public
|
|
258
|
+
export type DOMAspect = typeof DOMAspect[Exclude<keyof typeof DOMAspect, "none">];
|
|
259
|
+
|
|
260
|
+
// @public
|
|
261
|
+
export interface DOMPolicy {
|
|
262
|
+
createHTML(value: string): string;
|
|
263
|
+
protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// @public
|
|
267
|
+
export type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
|
|
268
|
+
|
|
244
269
|
// @public
|
|
245
270
|
export class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
|
|
246
271
|
// @internal
|
|
@@ -443,7 +468,7 @@ export function html<TSource = any, TParent = any>(strings: TemplateStringsArray
|
|
|
443
468
|
// @public
|
|
444
469
|
export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
|
|
445
470
|
constructor(dataBinding: Binding);
|
|
446
|
-
aspectType:
|
|
471
|
+
aspectType: DOMAspect;
|
|
447
472
|
// @internal (undocumented)
|
|
448
473
|
bind(controller: ViewController): void;
|
|
449
474
|
createBehavior(): ViewBehavior;
|
|
@@ -455,9 +480,11 @@ export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory,
|
|
|
455
480
|
// @internal (undocumented)
|
|
456
481
|
handleEvent(event: Event): void;
|
|
457
482
|
id: string;
|
|
458
|
-
|
|
483
|
+
policy: DOMPolicy;
|
|
459
484
|
sourceAspect: string;
|
|
460
485
|
targetAspect: string;
|
|
486
|
+
targetNodeId: string;
|
|
487
|
+
targetTagName: string | null;
|
|
461
488
|
// @internal (undocumented)
|
|
462
489
|
unbind(controller: ViewController): void;
|
|
463
490
|
}
|
|
@@ -472,6 +499,7 @@ export const HTMLDirective: Readonly<{
|
|
|
472
499
|
getForInstance: (object: any) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
|
|
473
500
|
getByType: (key: Function) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
|
|
474
501
|
define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
|
|
502
|
+
assignAspect(directive: Aspected, value?: string): void;
|
|
475
503
|
}>;
|
|
476
504
|
|
|
477
505
|
// @public
|
|
@@ -489,7 +517,7 @@ export interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
|
|
|
489
517
|
|
|
490
518
|
// @public
|
|
491
519
|
export class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
|
|
492
|
-
constructor(fragment: DocumentFragment, factories: ReadonlyArray<
|
|
520
|
+
constructor(fragment: DocumentFragment, factories: ReadonlyArray<CompiledViewBehaviorFactory>, targets: ViewBehaviorTargets);
|
|
493
521
|
appendTo(node: Node): void;
|
|
494
522
|
bind(source: TSource, context?: ExecutionContext<TParent>): void;
|
|
495
523
|
context: ExecutionContext<TParent>;
|
|
@@ -563,7 +591,10 @@ export abstract class NodeObservationDirective<T extends NodeBehaviorOptions> ex
|
|
|
563
591
|
protected abstract disconnect(target: any): void;
|
|
564
592
|
protected abstract getNodes(target: any): Node[];
|
|
565
593
|
protected getSource(target: Node): any;
|
|
594
|
+
get id(): string;
|
|
595
|
+
set id(value: string);
|
|
566
596
|
protected abstract observe(target: any): void;
|
|
597
|
+
targetNodeId: string;
|
|
567
598
|
unbind(controller: ViewController): void;
|
|
568
599
|
protected updateTarget(source: any, value: ReadonlyArray<any>): void;
|
|
569
600
|
}
|
|
@@ -605,7 +636,7 @@ export interface ObservationRecord {
|
|
|
605
636
|
}
|
|
606
637
|
|
|
607
638
|
// @public
|
|
608
|
-
export function oneTime<T = any>(expression: Expression<T
|
|
639
|
+
export function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
|
|
609
640
|
|
|
610
641
|
// @public
|
|
611
642
|
export const Parser: Readonly<{
|
|
@@ -643,6 +674,7 @@ export const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & s
|
|
|
643
674
|
// @public
|
|
644
675
|
export class RefDirective extends StatelessAttachedAttributeDirective<string> {
|
|
645
676
|
bind(controller: ViewController): void;
|
|
677
|
+
targetNodeId: string;
|
|
646
678
|
}
|
|
647
679
|
|
|
648
680
|
// @public
|
|
@@ -665,10 +697,9 @@ export class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehavi
|
|
|
665
697
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
666
698
|
// (undocumented)
|
|
667
699
|
readonly dataBinding: Binding<TSource>;
|
|
668
|
-
id: string;
|
|
669
|
-
nodeId: string;
|
|
670
700
|
// (undocumented)
|
|
671
701
|
readonly options: RepeatOptions;
|
|
702
|
+
targetNodeId: string;
|
|
672
703
|
// (undocumented)
|
|
673
704
|
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
674
705
|
}
|
|
@@ -758,8 +789,6 @@ export abstract class StatelessAttachedAttributeDirective<TOptions> implements H
|
|
|
758
789
|
abstract bind(controller: ViewController): void;
|
|
759
790
|
createBehavior(): ViewBehavior;
|
|
760
791
|
createHTML(add: AddViewBehaviorFactory): string;
|
|
761
|
-
id: string;
|
|
762
|
-
nodeId: string;
|
|
763
792
|
// (undocumented)
|
|
764
793
|
protected options: TOptions;
|
|
765
794
|
// @internal
|
|
@@ -817,16 +846,6 @@ export interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
817
846
|
// @public
|
|
818
847
|
export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
|
|
819
848
|
|
|
820
|
-
// @public
|
|
821
|
-
export type TrustedTypes = {
|
|
822
|
-
createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
|
|
823
|
-
};
|
|
824
|
-
|
|
825
|
-
// @public
|
|
826
|
-
export type TrustedTypesPolicy = {
|
|
827
|
-
createHTML(html: string): string;
|
|
828
|
-
};
|
|
829
|
-
|
|
830
849
|
// Warning: (ae-internal-missing-underscore) The name "TypeDefinition" should be prefixed with an underscore because the declaration is marked as @internal
|
|
831
850
|
//
|
|
832
851
|
// @internal
|
|
@@ -880,23 +899,12 @@ export interface ViewBehavior<TSource = any, TParent = any> {
|
|
|
880
899
|
// @public
|
|
881
900
|
export interface ViewBehaviorFactory {
|
|
882
901
|
createBehavior(): ViewBehavior;
|
|
883
|
-
id
|
|
884
|
-
|
|
902
|
+
id?: string;
|
|
903
|
+
policy?: DOMPolicy;
|
|
904
|
+
targetNodeId?: string;
|
|
905
|
+
targetTagName?: string | null;
|
|
885
906
|
}
|
|
886
907
|
|
|
887
|
-
// @public
|
|
888
|
-
export interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
|
|
889
|
-
addBehavior(behavior: ViewBehavior): void;
|
|
890
|
-
addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
|
|
891
|
-
// (undocumented)
|
|
892
|
-
addTarget(nodeId: string, target: Node): void;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
// @public
|
|
896
|
-
export const ViewBehaviorOrchestrator: Readonly<{
|
|
897
|
-
create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
|
|
898
|
-
}>;
|
|
899
|
-
|
|
900
908
|
// @public
|
|
901
909
|
export type ViewBehaviorTargets = {
|
|
902
910
|
[id: string]: Node;
|
|
@@ -909,13 +917,15 @@ export interface ViewController<TSource = any, TParent = any> extends Expression
|
|
|
909
917
|
|
|
910
918
|
// @public
|
|
911
919
|
export class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
912
|
-
constructor(html: string | HTMLTemplateElement, factories
|
|
920
|
+
constructor(html: string | HTMLTemplateElement, factories?: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy | undefined);
|
|
913
921
|
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
922
|
+
static create<TSource = any, TParent = any>(strings: string[], values: TemplateValue<TSource, TParent>[], policy?: DOMPolicy): ViewTemplate<TSource, TParent>;
|
|
914
923
|
readonly factories: Record<string, ViewBehaviorFactory>;
|
|
915
924
|
readonly html: string | HTMLTemplateElement;
|
|
916
925
|
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
917
926
|
// @internal
|
|
918
927
|
toJSON: () => undefined;
|
|
928
|
+
withPolicy(policy: DOMPolicy): this;
|
|
919
929
|
}
|
|
920
930
|
|
|
921
931
|
// @public
|
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.18",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"url": "https://discord.gg/FcSNfg4"
|
|
@@ -78,6 +78,10 @@
|
|
|
78
78
|
"types": "./dist/dts/pending-task.d.ts",
|
|
79
79
|
"default": "./dist/esm/pending-task.js"
|
|
80
80
|
},
|
|
81
|
+
"./dom-policy": {
|
|
82
|
+
"types": "./dist/dts/dom-policy.d.ts",
|
|
83
|
+
"default": "./dist/esm/dom-policy.js"
|
|
84
|
+
},
|
|
81
85
|
"./package.json": "./package.json"
|
|
82
86
|
},
|
|
83
87
|
"unpkg": "dist/fast-element.min.js",
|
package/yarn-error.log
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Arguments:
|
|
2
|
+
/Users/christopherholt/.nvm/versions/node/v16.14.2/bin/node /Users/christopherholt/repos/fast-dna/.yarn/releases/yarn-1.22.11.cjs clean:dist
|
|
3
|
+
|
|
4
|
+
PATH:
|
|
5
|
+
/Users/christopherholt/repos/fast-dna/packages/web-components/fast-element/node_modules/.bin:/Users/christopherholt/repos/fast-dna/packages/web-components/node_modules/.bin:/Users/christopherholt/repos/fast-dna/packages/node_modules/.bin:/Users/christopherholt/repos/fast-dna/node_modules/.bin:/Users/christopherholt/repos/node_modules/.bin:/Users/christopherholt/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/Users/christopherholt/.nvm/versions/node/v16.14.2/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/Users/christopherholt/.nvm/versions/node/v16.14.2/bin:/usr/local/opt/openssl/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
|
|
6
|
+
|
|
7
|
+
Yarn version:
|
|
8
|
+
1.22.11
|
|
9
|
+
|
|
10
|
+
Node version:
|
|
11
|
+
16.14.2
|
|
12
|
+
|
|
13
|
+
Platform:
|
|
14
|
+
darwin x64
|
|
15
|
+
|
|
16
|
+
Trace:
|
|
17
|
+
SyntaxError: /Users/christopherholt/repos/fast-dna/package.json: Unexpected token / in JSON at position 353
|
|
18
|
+
at JSON.parse (<anonymous>)
|
|
19
|
+
at /Users/christopherholt/repos/fast-dna/.yarn/releases/yarn-1.22.11.cjs:1098:57
|
|
20
|
+
at Generator.next (<anonymous>)
|
|
21
|
+
at step (/Users/christopherholt/repos/fast-dna/.yarn/releases/yarn-1.22.11.cjs:310:30)
|
|
22
|
+
at /Users/christopherholt/repos/fast-dna/.yarn/releases/yarn-1.22.11.cjs:321:13
|
|
23
|
+
|
|
24
|
+
npm manifest:
|
|
25
|
+
{
|
|
26
|
+
"name": "@microsoft/fast-element",
|
|
27
|
+
"description": "A library for constructing Web Components",
|
|
28
|
+
"version": "2.0.0-beta.14",
|
|
29
|
+
"author": {
|
|
30
|
+
"name": "Microsoft",
|
|
31
|
+
"url": "https://discord.gg/FcSNfg4"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://www.fast.design/",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/Microsoft/fast.git",
|
|
38
|
+
"directory": "packages/web-components/fast-element"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/Microsoft/fast/issues/new/choose"
|
|
42
|
+
},
|
|
43
|
+
"type": "module",
|
|
44
|
+
"main": "dist/esm/index.js",
|
|
45
|
+
"types": "dist/dts/index.d.ts",
|
|
46
|
+
"exports": {
|
|
47
|
+
".": {
|
|
48
|
+
"types": "./dist/dts/index.d.ts",
|
|
49
|
+
"production": "./dist/esm/index.js",
|
|
50
|
+
"development": "./dist/esm/index.debug.js",
|
|
51
|
+
"default": "./dist/esm/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./debug": {
|
|
54
|
+
"types": "./dist/dts/debug.d.ts",
|
|
55
|
+
"default": "./dist/esm/debug.js"
|
|
56
|
+
},
|
|
57
|
+
"./binding/two-way": {
|
|
58
|
+
"types": "./dist/dts/templating/binding-two-way.d.ts",
|
|
59
|
+
"default": "./dist/esm/templating/binding-two-way.js"
|
|
60
|
+
},
|
|
61
|
+
"./binding/signal": {
|
|
62
|
+
"types": "./dist/dts/templating/binding-signal.d.ts",
|
|
63
|
+
"default": "./dist/esm/templating/binding-signal.js"
|
|
64
|
+
},
|
|
65
|
+
"./render": {
|
|
66
|
+
"types": "./dist/dts/templating/render.d.ts",
|
|
67
|
+
"default": "./dist/esm/templating/render.js"
|
|
68
|
+
},
|
|
69
|
+
"./utilities": {
|
|
70
|
+
"types": "./dist/dts/utilities.d.ts",
|
|
71
|
+
"default": "./dist/esm/utilities.js"
|
|
72
|
+
},
|
|
73
|
+
"./state": {
|
|
74
|
+
"types": "./dist/dts/state/exports.d.ts",
|
|
75
|
+
"default": "./dist/esm/state/exports.js"
|
|
76
|
+
},
|
|
77
|
+
"./context": {
|
|
78
|
+
"types": "./dist/dts/context.d.ts",
|
|
79
|
+
"default": "./dist/esm/context.js"
|
|
80
|
+
},
|
|
81
|
+
"./metadata": {
|
|
82
|
+
"types": "./dist/dts/metadata.d.ts",
|
|
83
|
+
"default": "./dist/esm/metadata.js"
|
|
84
|
+
},
|
|
85
|
+
"./testing": {
|
|
86
|
+
"types": "./dist/dts/testing/exports.d.ts",
|
|
87
|
+
"default": "./dist/esm/testing/exports.js"
|
|
88
|
+
},
|
|
89
|
+
"./di": {
|
|
90
|
+
"types": "./dist/dts/di/di.d.ts",
|
|
91
|
+
"default": "./dist/esm/di/di.js"
|
|
92
|
+
},
|
|
93
|
+
"./pending-task": {
|
|
94
|
+
"types": "./dist/dts/pending-task.d.ts",
|
|
95
|
+
"default": "./dist/esm/pending-task.js"
|
|
96
|
+
},
|
|
97
|
+
"./package.json": "./package.json"
|
|
98
|
+
},
|
|
99
|
+
"unpkg": "dist/fast-element.min.js",
|
|
100
|
+
"sideEffects": [
|
|
101
|
+
"./dist/esm/debug.js",
|
|
102
|
+
"./dist/esm/polyfills.js"
|
|
103
|
+
],
|
|
104
|
+
"scripts": {
|
|
105
|
+
"clean:dist": "node ../../../build/clean.js dist",
|
|
106
|
+
"doc": "api-extractor run --local",
|
|
107
|
+
"doc:ci": "api-extractor run",
|
|
108
|
+
"build": "yarn build:tsc && yarn build:rollup && yarn doc",
|
|
109
|
+
"build:rollup": "rollup -c",
|
|
110
|
+
"build:tsc": "tsc -p ./tsconfig.json",
|
|
111
|
+
"dev": "tsc -p ./tsconfig.json -w",
|
|
112
|
+
"tdd": "yarn dev & yarn test-chrome:watch",
|
|
113
|
+
"prepare": "yarn clean:dist && yarn build",
|
|
114
|
+
"prettier": "prettier --config ../../../.prettierrc --write \"**/*.ts\"",
|
|
115
|
+
"prettier:diff": "prettier --config ../../../.prettierrc \"**/*.ts\" --list-different",
|
|
116
|
+
"eslint": "eslint . --ext .ts",
|
|
117
|
+
"eslint:fix": "eslint . --ext .ts --fix",
|
|
118
|
+
"test": "yarn eslint && yarn test-chrome:verbose && yarn doc:ci",
|
|
119
|
+
"test-node": "mocha --reporter min --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'",
|
|
120
|
+
"test-node:verbose": "mocha --reporter spec --exit dist/esm/__test__/setup-node.js './dist/esm/**/*.spec.js'",
|
|
121
|
+
"test-chrome": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --single-run --coverage",
|
|
122
|
+
"test-chrome:verbose": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --single-run --coverage --reporter=mocha",
|
|
123
|
+
"test-chrome:watch": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --coverage --watch-extensions js",
|
|
124
|
+
"test-chrome:debugger": "karma start karma.conf.cjs --browsers=ChromeDebugging",
|
|
125
|
+
"test-chrome:verbose:watch": "karma start karma.conf.cjs --browsers=ChromeHeadlessOpt --coverage --watch-extensions js --reporter=mocha",
|
|
126
|
+
"test-chrome:verbose:debugger": "karma start karma.conf.cjs --browsers=ChromeDebugging --reporter=mocha",
|
|
127
|
+
"test-firefox": "karma start karma.conf.cjs --browsers=FirefoxHeadless --single-run --coverage",
|
|
128
|
+
"test-firefox:verbose": "karma start karma.conf.cjs --browsers=FirefoxHeadless --single-run --coverage --reporter=mocha"
|
|
129
|
+
},
|
|
130
|
+
"devDependencies": {
|
|
131
|
+
"@microsoft/api-extractor": "7.24.2",
|
|
132
|
+
"@types/chai": "^4.2.11",
|
|
133
|
+
"@types/chai-spies": "^1.0.3",
|
|
134
|
+
"@types/karma": "^6.3.3",
|
|
135
|
+
"@types/mocha": "^7.0.2",
|
|
136
|
+
"@types/webpack-env": "^1.15.2",
|
|
137
|
+
"chai": "^4.2.0",
|
|
138
|
+
"chai-spies": "^1.0.0",
|
|
139
|
+
"esm": "^3.2.25",
|
|
140
|
+
"ignore-loader": "^0.1.2",
|
|
141
|
+
"istanbul": "^0.4.5",
|
|
142
|
+
"istanbul-instrumenter-loader": "^3.0.1",
|
|
143
|
+
"jsdom": "^16.2.2",
|
|
144
|
+
"jsdom-global": "3.0.2",
|
|
145
|
+
"karma": "^6.4.1",
|
|
146
|
+
"karma-chrome-launcher": "^3.1.0",
|
|
147
|
+
"karma-coverage": "^2.0.2",
|
|
148
|
+
"karma-coverage-istanbul-reporter": "^3.0.0",
|
|
149
|
+
"karma-firefox-launcher": "^2.1.0",
|
|
150
|
+
"karma-mocha": "^2.0.1",
|
|
151
|
+
"karma-mocha-reporter": "^2.2.5",
|
|
152
|
+
"karma-source-map-support": "^1.4.0",
|
|
153
|
+
"karma-sourcemap-loader": "^0.3.7",
|
|
154
|
+
"karma-webpack": "^5.0.0",
|
|
155
|
+
"mocha": "^7.1.2",
|
|
156
|
+
"prettier": "2.0.2",
|
|
157
|
+
"rollup": "^2.71.1",
|
|
158
|
+
"rollup-plugin-filesize": "^9.1.2",
|
|
159
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
160
|
+
"@rollup/plugin-typescript": "^8.3.2",
|
|
161
|
+
"source-map": "^0.7.3",
|
|
162
|
+
"source-map-loader": "^0.2.4",
|
|
163
|
+
"ts-loader": "^7.0.2",
|
|
164
|
+
"ts-node": "^8.9.1",
|
|
165
|
+
"tsconfig-paths": "^3.9.0",
|
|
166
|
+
"tslib": "^2.4.0",
|
|
167
|
+
"typescript": "^4.7.0",
|
|
168
|
+
"webpack": "^5.72.0",
|
|
169
|
+
"webpack-cli": "^4.9.2"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
yarn manifest:
|
|
174
|
+
No manifest
|
|
175
|
+
|
|
176
|
+
Lockfile:
|
|
177
|
+
No lockfile
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Callable } from "../interfaces.js";
|
|
2
|
-
/**
|
|
3
|
-
* Common DOM APIs.
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export declare const DOM: Readonly<{
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated
|
|
9
|
-
* Use Updates.enqueue().
|
|
10
|
-
*/
|
|
11
|
-
queueUpdate: (callable: Callable) => void;
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated
|
|
14
|
-
* Use Updates.next()
|
|
15
|
-
*/
|
|
16
|
-
nextUpdate: () => Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated
|
|
19
|
-
* Use Updates.process()
|
|
20
|
-
*/
|
|
21
|
-
processUpdates: () => void;
|
|
22
|
-
/**
|
|
23
|
-
* Sets an attribute value on an element.
|
|
24
|
-
* @param element - The element to set the attribute value on.
|
|
25
|
-
* @param attributeName - The attribute name to set.
|
|
26
|
-
* @param value - The value of the attribute to set.
|
|
27
|
-
* @remarks
|
|
28
|
-
* If the value is `null` or `undefined`, the attribute is removed, otherwise
|
|
29
|
-
* it is set to the provided value using the standard `setAttribute` API.
|
|
30
|
-
*/
|
|
31
|
-
setAttribute(element: HTMLElement, attributeName: string, value: any): void;
|
|
32
|
-
/**
|
|
33
|
-
* Sets a boolean attribute value.
|
|
34
|
-
* @param element - The element to set the boolean attribute value on.
|
|
35
|
-
* @param attributeName - The attribute name to set.
|
|
36
|
-
* @param value - The value of the attribute to set.
|
|
37
|
-
* @remarks
|
|
38
|
-
* If the value is true, the attribute is added; otherwise it is removed.
|
|
39
|
-
*/
|
|
40
|
-
setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
|
|
41
|
-
}>;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Updates } from "../observation/update-queue.js";
|
|
2
|
-
/**
|
|
3
|
-
* Common DOM APIs.
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export const DOM = Object.freeze({
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated
|
|
9
|
-
* Use Updates.enqueue().
|
|
10
|
-
*/
|
|
11
|
-
queueUpdate: Updates.enqueue,
|
|
12
|
-
/**
|
|
13
|
-
* @deprecated
|
|
14
|
-
* Use Updates.next()
|
|
15
|
-
*/
|
|
16
|
-
nextUpdate: Updates.next,
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated
|
|
19
|
-
* Use Updates.process()
|
|
20
|
-
*/
|
|
21
|
-
processUpdates: Updates.process,
|
|
22
|
-
/**
|
|
23
|
-
* Sets an attribute value on an element.
|
|
24
|
-
* @param element - The element to set the attribute value on.
|
|
25
|
-
* @param attributeName - The attribute name to set.
|
|
26
|
-
* @param value - The value of the attribute to set.
|
|
27
|
-
* @remarks
|
|
28
|
-
* If the value is `null` or `undefined`, the attribute is removed, otherwise
|
|
29
|
-
* it is set to the provided value using the standard `setAttribute` API.
|
|
30
|
-
*/
|
|
31
|
-
setAttribute(element, attributeName, value) {
|
|
32
|
-
value === null || value === undefined
|
|
33
|
-
? element.removeAttribute(attributeName)
|
|
34
|
-
: element.setAttribute(attributeName, value);
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* Sets a boolean attribute value.
|
|
38
|
-
* @param element - The element to set the boolean attribute value on.
|
|
39
|
-
* @param attributeName - The attribute name to set.
|
|
40
|
-
* @param value - The value of the attribute to set.
|
|
41
|
-
* @remarks
|
|
42
|
-
* If the value is true, the attribute is added; otherwise it is removed.
|
|
43
|
-
*/
|
|
44
|
-
setBooleanAttribute(element, attributeName, value) {
|
|
45
|
-
value
|
|
46
|
-
? element.setAttribute(attributeName, "")
|
|
47
|
-
: element.removeAttribute(attributeName);
|
|
48
|
-
},
|
|
49
|
-
});
|