@microsoft/fast-html 1.0.0-alpha.29 → 1.0.0-alpha.30

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.
@@ -391,6 +391,60 @@
391
391
  "overloadIndex": 1,
392
392
  "parameters": []
393
393
  },
394
+ {
395
+ "kind": "Method",
396
+ "canonicalReference": "@microsoft/fast-html!TemplateElement.config:member(1)",
397
+ "docComment": "/**\n * Configure lifecycle callbacks for hydration events.\n *\n * @param callbacks - Lifecycle callbacks to configure.\n *\n * @returns The {@link TemplateElement} class.\n */\n",
398
+ "excerptTokens": [
399
+ {
400
+ "kind": "Content",
401
+ "text": "static config(callbacks: "
402
+ },
403
+ {
404
+ "kind": "Reference",
405
+ "text": "HydrationLifecycleCallbacks",
406
+ "canonicalReference": "@microsoft/fast-html!~HydrationLifecycleCallbacks:interface"
407
+ },
408
+ {
409
+ "kind": "Content",
410
+ "text": "): "
411
+ },
412
+ {
413
+ "kind": "Content",
414
+ "text": "typeof "
415
+ },
416
+ {
417
+ "kind": "Reference",
418
+ "text": "TemplateElement",
419
+ "canonicalReference": "@microsoft/fast-html!TemplateElement:class"
420
+ },
421
+ {
422
+ "kind": "Content",
423
+ "text": ";"
424
+ }
425
+ ],
426
+ "isStatic": true,
427
+ "returnTypeTokenRange": {
428
+ "startIndex": 3,
429
+ "endIndex": 5
430
+ },
431
+ "releaseTag": "Public",
432
+ "isProtected": false,
433
+ "overloadIndex": 1,
434
+ "parameters": [
435
+ {
436
+ "parameterName": "callbacks",
437
+ "parameterTypeTokenRange": {
438
+ "startIndex": 1,
439
+ "endIndex": 2
440
+ },
441
+ "isOptional": false
442
+ }
443
+ ],
444
+ "isOptional": false,
445
+ "isAbstract": false,
446
+ "name": "config"
447
+ },
394
448
  {
395
449
  "kind": "Method",
396
450
  "canonicalReference": "@microsoft/fast-html!TemplateElement#connectedCallback:member(1)",
@@ -486,7 +540,7 @@
486
540
  {
487
541
  "kind": "Method",
488
542
  "canonicalReference": "@microsoft/fast-html!TemplateElement.options:member(1)",
489
- "docComment": "",
543
+ "docComment": "/**\n * Set options for custom elements.\n *\n * @param elementOptions - A dictionary of custom element options\n *\n * @returns The TemplateElement class.\n */\n",
490
544
  "excerptTokens": [
491
545
  {
492
546
  "kind": "Content",
@@ -1,5 +1,7 @@
1
1
  import { Constructable } from '@microsoft/fast-element';
2
2
  import { FASTElement } from '@microsoft/fast-element';
3
+ import { HydrationControllerCallbacks } from '@microsoft/fast-element';
4
+ import { TemplateLifecycleCallbacks } from '@microsoft/fast-element';
3
5
 
4
6
  declare interface AccessCachedPath extends CachedPathCommon {
5
7
  type: AccessCachedPathType;
@@ -28,8 +30,11 @@ declare interface DefaultCachedPath extends CachedPathCommon {
28
30
 
29
31
  declare type DefaultCachedPathType = "default";
30
32
 
33
+ /**
34
+ * Element options the TemplateElement will use to update the registered element
35
+ */
31
36
  declare interface ElementOptions {
32
- observerMap?: ObserverMapOption | undefined;
37
+ observerMap?: ObserverMapOption;
33
38
  }
34
39
 
35
40
  /**
@@ -45,6 +50,21 @@ declare interface EventCachedPath extends CachedPathCommon {
45
50
 
46
51
  declare type EventCachedPathType = "event";
47
52
 
53
+ /**
54
+ * Lifecycle callbacks for template and hydration events.
55
+ * Combines template lifecycle callbacks with hydration callbacks and adds template-processing events.
56
+ */
57
+ declare interface HydrationLifecycleCallbacks extends HydrationControllerCallbacks, TemplateLifecycleCallbacks {
58
+ /**
59
+ * Called after the JS class definition has been registered
60
+ */
61
+ elementDidRegister?(name: string): void;
62
+ /**
63
+ * Called before the template has been evaluated and assigned
64
+ */
65
+ templateWillUpdate?(name: string): void;
66
+ }
67
+
48
68
  declare interface JSONSchema extends JSONSchemaCommon {
49
69
  $schema: string;
50
70
  $id: string;
@@ -90,7 +110,17 @@ export declare class ObserverMap {
90
110
  private defineChanged;
91
111
  }
92
112
 
93
- declare type ObserverMapOption = "all";
113
+ /**
114
+ * Values for the observerMap element option.
115
+ */
116
+ declare const ObserverMapOption: {
117
+ readonly all: "all";
118
+ };
119
+
120
+ /**
121
+ * Type for the observerMap element option.
122
+ */
123
+ declare type ObserverMapOption = (typeof ObserverMapOption)[keyof typeof ObserverMapOption];
94
124
 
95
125
  declare interface RegisterPathConfig {
96
126
  rootPropertyName: string;
@@ -231,6 +261,23 @@ export declare class TemplateElement extends FASTElement {
231
261
  * Metadata containing JSON schema for properties on a custom eleemnt
232
262
  */
233
263
  private schema?;
264
+ /**
265
+ * Lifecycle callbacks for hydration events
266
+ */
267
+ private static lifecycleCallbacks;
268
+ /**
269
+ * Configure lifecycle callbacks for hydration events.
270
+ *
271
+ * @param callbacks - Lifecycle callbacks to configure.
272
+ * @returns The {@link TemplateElement} class.
273
+ */
274
+ static config(callbacks: HydrationLifecycleCallbacks): typeof TemplateElement;
275
+ /**
276
+ * Set options for custom elements.
277
+ *
278
+ * @param elementOptions - A dictionary of custom element options
279
+ * @returns The TemplateElement class.
280
+ */
234
281
  static options(elementOptions?: ElementOptionsDictionary): typeof TemplateElement;
235
282
  constructor();
236
283
  /**
@@ -1,5 +1,7 @@
1
1
  import { Constructable } from '@microsoft/fast-element';
2
2
  import { FASTElement } from '@microsoft/fast-element';
3
+ import { HydrationControllerCallbacks } from '@microsoft/fast-element';
4
+ import { TemplateLifecycleCallbacks } from '@microsoft/fast-element';
3
5
 
4
6
  declare interface AccessCachedPath extends CachedPathCommon {
5
7
  type: AccessCachedPathType;
@@ -28,8 +30,11 @@ declare interface DefaultCachedPath extends CachedPathCommon {
28
30
 
29
31
  declare type DefaultCachedPathType = "default";
30
32
 
33
+ /**
34
+ * Element options the TemplateElement will use to update the registered element
35
+ */
31
36
  declare interface ElementOptions {
32
- observerMap?: ObserverMapOption | undefined;
37
+ observerMap?: ObserverMapOption;
33
38
  }
34
39
 
35
40
  /**
@@ -45,6 +50,21 @@ declare interface EventCachedPath extends CachedPathCommon {
45
50
 
46
51
  declare type EventCachedPathType = "event";
47
52
 
53
+ /**
54
+ * Lifecycle callbacks for template and hydration events.
55
+ * Combines template lifecycle callbacks with hydration callbacks and adds template-processing events.
56
+ */
57
+ declare interface HydrationLifecycleCallbacks extends HydrationControllerCallbacks, TemplateLifecycleCallbacks {
58
+ /**
59
+ * Called after the JS class definition has been registered
60
+ */
61
+ elementDidRegister?(name: string): void;
62
+ /**
63
+ * Called before the template has been evaluated and assigned
64
+ */
65
+ templateWillUpdate?(name: string): void;
66
+ }
67
+
48
68
  declare interface JSONSchema extends JSONSchemaCommon {
49
69
  $schema: string;
50
70
  $id: string;
@@ -90,7 +110,17 @@ export declare class ObserverMap {
90
110
  private defineChanged;
91
111
  }
92
112
 
93
- declare type ObserverMapOption = "all";
113
+ /**
114
+ * Values for the observerMap element option.
115
+ */
116
+ declare const ObserverMapOption: {
117
+ readonly all: "all";
118
+ };
119
+
120
+ /**
121
+ * Type for the observerMap element option.
122
+ */
123
+ declare type ObserverMapOption = (typeof ObserverMapOption)[keyof typeof ObserverMapOption];
94
124
 
95
125
  declare interface RegisterPathConfig {
96
126
  rootPropertyName: string;
@@ -231,6 +261,23 @@ export declare class TemplateElement extends FASTElement {
231
261
  * Metadata containing JSON schema for properties on a custom eleemnt
232
262
  */
233
263
  private schema?;
264
+ /**
265
+ * Lifecycle callbacks for hydration events
266
+ */
267
+ private static lifecycleCallbacks;
268
+ /**
269
+ * Configure lifecycle callbacks for hydration events.
270
+ *
271
+ * @param callbacks - Lifecycle callbacks to configure.
272
+ * @returns The {@link TemplateElement} class.
273
+ */
274
+ static config(callbacks: HydrationLifecycleCallbacks): typeof TemplateElement;
275
+ /**
276
+ * Set options for custom elements.
277
+ *
278
+ * @param elementOptions - A dictionary of custom element options
279
+ * @returns The TemplateElement class.
280
+ */
234
281
  static options(elementOptions?: ElementOptionsDictionary): typeof TemplateElement;
235
282
  constructor();
236
283
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/fast-html",
3
- "version": "1.0.0-alpha.29",
3
+ "version": "1.0.0-alpha.30",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Microsoft",
@@ -34,7 +34,8 @@
34
34
  "build:repeat": "webpack --config ./src/fixtures/repeat/webpack.config.js",
35
35
  "build:observer-map": "webpack --config ./src/fixtures/observer-map/webpack.config.js",
36
36
  "build:slotted": "webpack --config ./src/fixtures/slotted/webpack.config.js",
37
- "build-app": "npm run build:attribute && npm run build:dot-syntax && npm run build:event && npm run build:children && npm run build:binding && npm run build:when && npm run build:ref && npm run build:repeat && npm run build:observer-map && npm run build:slotted",
37
+ "build:lifecycle-callbacks": "webpack --config ./src/fixtures/lifecycle-callbacks/webpack.config.js",
38
+ "build-app": "npm run build:attribute && npm run build:dot-syntax && npm run build:event && npm run build:children && npm run build:binding && npm run build:when && npm run build:ref && npm run build:repeat && npm run build:observer-map && npm run build:slotted && npm run build:lifecycle-callbacks",
38
39
  "build-server": "tsc -b server",
39
40
  "doc": "api-extractor run --local",
40
41
  "doc:ci": "api-extractor run",
@@ -44,7 +45,7 @@
44
45
  "pretest": "npm run build && npm run build-server",
45
46
  "prettier:diff": "prettier --config ../../../.prettierrc \"**/*.{ts,html}\" --list-different",
46
47
  "prettier": "prettier --config ../../../.prettierrc --write \"**/*.{ts,html}\"",
47
- "test": "npm run build-app && playwright test --config=playwright.config.cjs && npm run test:rules",
48
+ "test": "npm run build-app && playwright test && npm run test:rules",
48
49
  "test-server": "node server/dist/server.js",
49
50
  "test:rules": "sg test --skip-snapshot-tests",
50
51
  "install-playwright-browsers": "npm run playwright install",
@@ -63,12 +64,12 @@
63
64
  "./dist/esm/index.js"
64
65
  ],
65
66
  "peerDependencies": {
66
- "@microsoft/fast-element": "^2.7.0"
67
+ "@microsoft/fast-element": "^2.8.0"
67
68
  },
68
69
  "devDependencies": {
69
70
  "@ast-grep/cli": "^0.37.0",
70
71
  "@microsoft/api-extractor": "^7.47.0",
71
- "@microsoft/fast-element": "^2.7.0",
72
+ "@microsoft/fast-element": "^2.8.0",
72
73
  "@playwright/test": "^1.49.0",
73
74
  "@types/express": "^4.17.21",
74
75
  "@types/node": "^17.0.17",