@microsoft/fast-element 2.0.0-beta.16 → 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.
Files changed (63) hide show
  1. package/CHANGELOG.json +36 -0
  2. package/CHANGELOG.md +18 -1
  3. package/dist/dts/components/element-controller.d.ts +5 -0
  4. package/dist/dts/dom-policy.d.ts +68 -0
  5. package/dist/dts/dom.d.ts +116 -0
  6. package/dist/dts/index.d.ts +3 -2
  7. package/dist/dts/index.rollup.d.ts +0 -1
  8. package/dist/dts/index.rollup.debug.d.ts +0 -1
  9. package/dist/dts/interfaces.d.ts +15 -24
  10. package/dist/dts/polyfills.d.ts +0 -1
  11. package/dist/dts/templating/binding-signal.d.ts +3 -1
  12. package/dist/dts/templating/binding-two-way.d.ts +3 -1
  13. package/dist/dts/templating/binding.d.ts +16 -5
  14. package/dist/dts/templating/compiler.d.ts +11 -13
  15. package/dist/dts/templating/dangerous-html.d.ts +18 -0
  16. package/dist/dts/templating/html-directive.d.ts +54 -118
  17. package/dist/dts/templating/node-observation.d.ts +11 -1
  18. package/dist/dts/templating/ref.d.ts +4 -0
  19. package/dist/dts/templating/render.d.ts +30 -6
  20. package/dist/dts/templating/repeat.d.ts +1 -5
  21. package/dist/dts/templating/template.d.ts +44 -13
  22. package/dist/dts/templating/view.d.ts +8 -3
  23. package/dist/dts/testing/fakes.d.ts +1 -0
  24. package/dist/dts/utilities.d.ts +39 -0
  25. package/dist/esm/components/attributes.js +1 -1
  26. package/dist/esm/components/element-controller.js +6 -1
  27. package/dist/esm/debug.js +4 -1
  28. package/dist/esm/dom-policy.js +337 -0
  29. package/dist/esm/dom.js +117 -0
  30. package/dist/esm/index.js +2 -1
  31. package/dist/esm/index.rollup.debug.js +3 -1
  32. package/dist/esm/index.rollup.js +3 -1
  33. package/dist/esm/observation/observable.js +5 -1
  34. package/dist/esm/platform.js +1 -1
  35. package/dist/esm/polyfills.js +3 -7
  36. package/dist/esm/templating/binding-signal.js +9 -3
  37. package/dist/esm/templating/binding-two-way.js +9 -3
  38. package/dist/esm/templating/binding.js +40 -55
  39. package/dist/esm/templating/children.js +8 -4
  40. package/dist/esm/templating/compiler.js +31 -38
  41. package/dist/esm/templating/dangerous-html.js +23 -0
  42. package/dist/esm/templating/html-directive.js +42 -133
  43. package/dist/esm/templating/node-observation.js +14 -8
  44. package/dist/esm/templating/ref.js +1 -1
  45. package/dist/esm/templating/render.js +17 -6
  46. package/dist/esm/templating/repeat.js +2 -6
  47. package/dist/esm/templating/template.js +86 -56
  48. package/dist/esm/templating/view.js +6 -0
  49. package/dist/esm/testing/fakes.js +2 -0
  50. package/dist/esm/testing/fixture.js +1 -1
  51. package/dist/esm/utilities.js +68 -0
  52. package/dist/fast-element.api.json +1088 -608
  53. package/dist/fast-element.d.ts +194 -147
  54. package/dist/fast-element.debug.js +745 -381
  55. package/dist/fast-element.debug.min.js +1 -1
  56. package/dist/fast-element.js +716 -355
  57. package/dist/fast-element.min.js +1 -1
  58. package/dist/fast-element.untrimmed.d.ts +208 -145
  59. package/docs/api-report.md +74 -56
  60. package/package.json +5 -1
  61. package/yarn-error.log +177 -0
  62. package/dist/dts/templating/dom.d.ts +0 -41
  63. package/dist/esm/templating/dom.js +0 -49
@@ -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: Aspect;
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>) => HTMLTemplateCompilationResult;
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
- setHTMLPolicy(policy: TrustedTypesPolicy): void;
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
@@ -262,6 +287,8 @@ export class ElementController<TElement extends HTMLElement = HTMLElement> exten
262
287
  readonly source: TElement;
263
288
  get template(): ElementViewTemplate<TElement> | null;
264
289
  set template(value: ElementViewTemplate<TElement> | null);
290
+ // @internal
291
+ toJSON: () => undefined;
265
292
  readonly view: ElementView<TElement> | null;
266
293
  }
267
294
 
@@ -441,7 +468,7 @@ export function html<TSource = any, TParent = any>(strings: TemplateStringsArray
441
468
  // @public
442
469
  export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
443
470
  constructor(dataBinding: Binding);
444
- aspectType: Aspect;
471
+ aspectType: DOMAspect;
445
472
  // @internal (undocumented)
446
473
  bind(controller: ViewController): void;
447
474
  createBehavior(): ViewBehavior;
@@ -453,9 +480,11 @@ export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory,
453
480
  // @internal (undocumented)
454
481
  handleEvent(event: Event): void;
455
482
  id: string;
456
- nodeId: string;
483
+ policy: DOMPolicy;
457
484
  sourceAspect: string;
458
485
  targetAspect: string;
486
+ targetNodeId: string;
487
+ targetTagName: string | null;
459
488
  // @internal (undocumented)
460
489
  unbind(controller: ViewController): void;
461
490
  }
@@ -470,6 +499,7 @@ export const HTMLDirective: Readonly<{
470
499
  getForInstance: (object: any) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
471
500
  getByType: (key: Function) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
472
501
  define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
502
+ assignAspect(directive: Aspected, value?: string): void;
473
503
  }>;
474
504
 
475
505
  // @public
@@ -487,7 +517,7 @@ export interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
487
517
 
488
518
  // @public
489
519
  export class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
490
- constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
520
+ constructor(fragment: DocumentFragment, factories: ReadonlyArray<CompiledViewBehaviorFactory>, targets: ViewBehaviorTargets);
491
521
  appendTo(node: Node): void;
492
522
  bind(source: TSource, context?: ExecutionContext<TParent>): void;
493
523
  context: ExecutionContext<TParent>;
@@ -518,6 +548,8 @@ export class HTMLView<TSource = any, TParent = any> implements ElementView<TSour
518
548
  readonly sourceLifetime: SourceLifetime;
519
549
  // (undocumented)
520
550
  readonly targets: ViewBehaviorTargets;
551
+ // @internal
552
+ toJSON: () => undefined;
521
553
  unbind(): void;
522
554
  }
523
555
 
@@ -559,7 +591,10 @@ export abstract class NodeObservationDirective<T extends NodeBehaviorOptions> ex
559
591
  protected abstract disconnect(target: any): void;
560
592
  protected abstract getNodes(target: any): Node[];
561
593
  protected getSource(target: Node): any;
594
+ get id(): string;
595
+ set id(value: string);
562
596
  protected abstract observe(target: any): void;
597
+ targetNodeId: string;
563
598
  unbind(controller: ViewController): void;
564
599
  protected updateTarget(source: any, value: ReadonlyArray<any>): void;
565
600
  }
@@ -601,7 +636,7 @@ export interface ObservationRecord {
601
636
  }
602
637
 
603
638
  // @public
604
- export function oneTime<T = any>(expression: Expression<T>): Binding<T>;
639
+ export function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
605
640
 
606
641
  // @public
607
642
  export const Parser: Readonly<{
@@ -639,6 +674,7 @@ export const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & s
639
674
  // @public
640
675
  export class RefDirective extends StatelessAttachedAttributeDirective<string> {
641
676
  bind(controller: ViewController): void;
677
+ targetNodeId: string;
642
678
  }
643
679
 
644
680
  // @public
@@ -661,10 +697,9 @@ export class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehavi
661
697
  createHTML(add: AddViewBehaviorFactory): string;
662
698
  // (undocumented)
663
699
  readonly dataBinding: Binding<TSource>;
664
- id: string;
665
- nodeId: string;
666
700
  // (undocumented)
667
701
  readonly options: RepeatOptions;
702
+ targetNodeId: string;
668
703
  // (undocumented)
669
704
  readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
670
705
  }
@@ -754,10 +789,10 @@ export abstract class StatelessAttachedAttributeDirective<TOptions> implements H
754
789
  abstract bind(controller: ViewController): void;
755
790
  createBehavior(): ViewBehavior;
756
791
  createHTML(add: AddViewBehaviorFactory): string;
757
- id: string;
758
- nodeId: string;
759
792
  // (undocumented)
760
793
  protected options: TOptions;
794
+ // @internal
795
+ toJSON: () => undefined;
761
796
  }
762
797
 
763
798
  // @public
@@ -811,16 +846,6 @@ export interface SyntheticViewTemplate<TSource = any, TParent = any> {
811
846
  // @public
812
847
  export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
813
848
 
814
- // @public
815
- export type TrustedTypes = {
816
- createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
817
- };
818
-
819
- // @public
820
- export type TrustedTypesPolicy = {
821
- createHTML(html: string): string;
822
- };
823
-
824
849
  // Warning: (ae-internal-missing-underscore) The name "TypeDefinition" should be prefixed with an underscore because the declaration is marked as @internal
825
850
  //
826
851
  // @internal
@@ -874,23 +899,12 @@ export interface ViewBehavior<TSource = any, TParent = any> {
874
899
  // @public
875
900
  export interface ViewBehaviorFactory {
876
901
  createBehavior(): ViewBehavior;
877
- id: string;
878
- nodeId: string;
879
- }
880
-
881
- // @public
882
- export interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
883
- addBehavior(behavior: ViewBehavior): void;
884
- addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
885
- // (undocumented)
886
- addTarget(nodeId: string, target: Node): void;
902
+ id?: string;
903
+ policy?: DOMPolicy;
904
+ targetNodeId?: string;
905
+ targetTagName?: string | null;
887
906
  }
888
907
 
889
- // @public
890
- export const ViewBehaviorOrchestrator: Readonly<{
891
- create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
892
- }>;
893
-
894
908
  // @public
895
909
  export type ViewBehaviorTargets = {
896
910
  [id: string]: Node;
@@ -903,11 +917,15 @@ export interface ViewController<TSource = any, TParent = any> extends Expression
903
917
 
904
918
  // @public
905
919
  export class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
906
- constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
920
+ constructor(html: string | HTMLTemplateElement, factories?: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy | undefined);
907
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>;
908
923
  readonly factories: Record<string, ViewBehaviorFactory>;
909
924
  readonly html: string | HTMLTemplateElement;
910
925
  render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
926
+ // @internal
927
+ toJSON: () => undefined;
928
+ withPolicy(policy: DOMPolicy): this;
911
929
  }
912
930
 
913
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.16",
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
- });