@genesislcap/web-core 14.213.1 → 14.214.0

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.
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deprecatedAttr = void 0;
4
+ const fast_element_1 = require("@microsoft/fast-element");
5
+ const warningQueue = [];
6
+ const logTimeout = 5000;
7
+ setTimeout(() => {
8
+ if (warningQueue.length) {
9
+ console.warn(`${warningQueue.length} attribute deprecation notice(s):\n ${warningQueue.join('\n')}`);
10
+ }
11
+ }, logTimeout);
12
+ /**
13
+ * Value converter is an interface from FAST which lets you convert types. An example
14
+ * of this usage is the number converter when using `mode: number` which converts to and from
15
+ * the string attribute on the DOM, to the number property on the class.
16
+ *
17
+ * Instead of doing a conversion we sit in the middle and if a value is set from the attribute
18
+ * we know that the deprecatedName is used, hence we queue a deprecation warning. We only emit one warning
19
+ * per attribute per class, to stop repeat emits on change.
20
+ *
21
+ * this function needs to take all the variables in separately to capture them in the closure rather
22
+ * than pulling them from the `deprecatedConfig` object, as that is modified which causes issues such
23
+ * as infinite loops
24
+ */
25
+ const deprecationLogger = (className, deprecatedName, attributeName, converter) => ({
26
+ hasEmitLog: false,
27
+ toView(value) {
28
+ return converter ? converter.toView(value) : value;
29
+ },
30
+ fromView(value) {
31
+ if (value && !this.hasEmitLog) {
32
+ this.hasEmitLog = true;
33
+ warningQueue.push(`Deprecation warning: attribute name "${deprecatedName}" on component "${className}" is deprecated. Please use "${attributeName}" instead.`);
34
+ }
35
+ return converter ? converter.fromView(value) : value;
36
+ },
37
+ });
38
+ function deprecatedAttr(configOrTarget, prop) {
39
+ let config;
40
+ function decorator($target, $prop) {
41
+ if (arguments.length > 1) {
42
+ // Non invocation:
43
+ // - @attr
44
+ // Invocation with or w/o opts:
45
+ // - @attr()
46
+ // - @attr({...opts})
47
+ config.property = $prop;
48
+ }
49
+ fast_element_1.AttributeConfiguration.locate($target.constructor).push(config);
50
+ if ('deprecatedName' in config) {
51
+ const deprecatedConfig = structuredClone(config);
52
+ deprecatedConfig.converter = deprecationLogger($target.constructor.name, deprecatedConfig.deprecatedName, deprecatedConfig.attribute, deprecatedConfig.converter);
53
+ deprecatedConfig.attribute = config.deprecatedName.toLowerCase();
54
+ fast_element_1.AttributeConfiguration.locate($target.constructor).push(deprecatedConfig);
55
+ }
56
+ }
57
+ if (arguments.length > 1) {
58
+ // Non invocation:
59
+ // - @attr
60
+ config = {};
61
+ decorator(configOrTarget, prop);
62
+ return;
63
+ }
64
+ // Invocation with or w/o opts:
65
+ // - @attr()
66
+ // - @attr({...opts})
67
+ config = configOrTarget === void 0 ? {} : configOrTarget;
68
+ return decorator;
69
+ }
70
+ exports.deprecatedAttr = deprecatedAttr;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./deprecated-attr"), exports);
package/dist/cjs/index.js CHANGED
@@ -4,3 +4,4 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./directives"), exports);
5
5
  tslib_1.__exportStar(require("./FAST"), exports);
6
6
  tslib_1.__exportStar(require("./patterns"), exports);
7
+ tslib_1.__exportStar(require("./decorators"), exports);
@@ -0,0 +1,22 @@
1
+ import { DecoratorAttributeConfiguration } from '@microsoft/fast-element';
2
+ type ExtendedDecoratorAttributeConfiguration = DecoratorAttributeConfiguration & {
3
+ deprecatedName?: string;
4
+ };
5
+ /**
6
+ * ALL FOLLOWING CODE FROM FAST IMPLEMENTATION EXCEPT THE `deprecatedName` HANDLING
7
+ */
8
+ /**
9
+ * Decorator: Specifies an HTML attribute.
10
+ * @param config - The configuration for the attribute.
11
+ * @public
12
+ */
13
+ export declare function deprecatedAttr(config?: ExtendedDecoratorAttributeConfiguration): (target: {}, property: string) => void;
14
+ /**
15
+ * Decorator: Specifies an HTML attribute.
16
+ * @param target - The class to define the attribute on.
17
+ * @param prop - The property name to be associated with the attribute.
18
+ * @public
19
+ */
20
+ export declare function deprecatedAttr(target: {}, prop: string): void;
21
+ export {};
22
+ //# sourceMappingURL=deprecated-attr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated-attr.d.ts","sourceRoot":"","sources":["../../../src/decorators/deprecated-attr.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,+BAA+B,EAEhC,MAAM,yBAAyB,CAAC;AAajC,KAAK,uCAAuC,GAAG,+BAA+B,GAAG;IAC/E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAsCF;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,CAAC,EAAE,uCAAuC,GAC/C,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './deprecated-attr';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './directives';
2
2
  export * from './FAST';
3
3
  export * from './patterns';
4
+ export * from './decorators';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { AttributeConfiguration, } from '@microsoft/fast-element';
2
+ const warningQueue = [];
3
+ const logTimeout = 5000;
4
+ setTimeout(() => {
5
+ if (warningQueue.length) {
6
+ console.warn(`${warningQueue.length} attribute deprecation notice(s):\n ${warningQueue.join('\n')}`);
7
+ }
8
+ }, logTimeout);
9
+ /**
10
+ * Value converter is an interface from FAST which lets you convert types. An example
11
+ * of this usage is the number converter when using `mode: number` which converts to and from
12
+ * the string attribute on the DOM, to the number property on the class.
13
+ *
14
+ * Instead of doing a conversion we sit in the middle and if a value is set from the attribute
15
+ * we know that the deprecatedName is used, hence we queue a deprecation warning. We only emit one warning
16
+ * per attribute per class, to stop repeat emits on change.
17
+ *
18
+ * this function needs to take all the variables in separately to capture them in the closure rather
19
+ * than pulling them from the `deprecatedConfig` object, as that is modified which causes issues such
20
+ * as infinite loops
21
+ */
22
+ const deprecationLogger = (className, deprecatedName, attributeName, converter) => ({
23
+ hasEmitLog: false,
24
+ toView(value) {
25
+ return converter ? converter.toView(value) : value;
26
+ },
27
+ fromView(value) {
28
+ if (value && !this.hasEmitLog) {
29
+ this.hasEmitLog = true;
30
+ warningQueue.push(`Deprecation warning: attribute name "${deprecatedName}" on component "${className}" is deprecated. Please use "${attributeName}" instead.`);
31
+ }
32
+ return converter ? converter.fromView(value) : value;
33
+ },
34
+ });
35
+ export function deprecatedAttr(configOrTarget, prop) {
36
+ let config;
37
+ function decorator($target, $prop) {
38
+ if (arguments.length > 1) {
39
+ // Non invocation:
40
+ // - @attr
41
+ // Invocation with or w/o opts:
42
+ // - @attr()
43
+ // - @attr({...opts})
44
+ config.property = $prop;
45
+ }
46
+ AttributeConfiguration.locate($target.constructor).push(config);
47
+ if ('deprecatedName' in config) {
48
+ const deprecatedConfig = structuredClone(config);
49
+ deprecatedConfig.converter = deprecationLogger($target.constructor.name, deprecatedConfig.deprecatedName, deprecatedConfig.attribute, deprecatedConfig.converter);
50
+ deprecatedConfig.attribute = config.deprecatedName.toLowerCase();
51
+ AttributeConfiguration.locate($target.constructor).push(deprecatedConfig);
52
+ }
53
+ }
54
+ if (arguments.length > 1) {
55
+ // Non invocation:
56
+ // - @attr
57
+ config = {};
58
+ decorator(configOrTarget, prop);
59
+ return;
60
+ }
61
+ // Invocation with or w/o opts:
62
+ // - @attr()
63
+ // - @attr({...opts})
64
+ config = configOrTarget === void 0 ? {} : configOrTarget;
65
+ return decorator;
66
+ }
@@ -0,0 +1 @@
1
+ export * from './deprecated-attr';
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './directives';
2
2
  export * from './FAST';
3
3
  export * from './patterns';
4
+ export * from './decorators';
@@ -415,6 +415,113 @@
415
415
  "endIndex": 5
416
416
  }
417
417
  },
418
+ {
419
+ "kind": "Function",
420
+ "canonicalReference": "@genesislcap/web-core!deprecatedAttr:function(1)",
421
+ "docComment": "/**\n * Decorator: Specifies an HTML attribute.\n *\n * @param config - The configuration for the attribute.\n *\n * @public\n */\n",
422
+ "excerptTokens": [
423
+ {
424
+ "kind": "Content",
425
+ "text": "export declare function deprecatedAttr(config?: "
426
+ },
427
+ {
428
+ "kind": "Reference",
429
+ "text": "ExtendedDecoratorAttributeConfiguration",
430
+ "canonicalReference": "@genesislcap/web-core!~ExtendedDecoratorAttributeConfiguration:type"
431
+ },
432
+ {
433
+ "kind": "Content",
434
+ "text": "): "
435
+ },
436
+ {
437
+ "kind": "Content",
438
+ "text": "(target: {}, property: string) => void"
439
+ },
440
+ {
441
+ "kind": "Content",
442
+ "text": ";"
443
+ }
444
+ ],
445
+ "fileUrlPath": "src/decorators/deprecated-attr.ts",
446
+ "returnTypeTokenRange": {
447
+ "startIndex": 3,
448
+ "endIndex": 4
449
+ },
450
+ "releaseTag": "Public",
451
+ "overloadIndex": 1,
452
+ "parameters": [
453
+ {
454
+ "parameterName": "config",
455
+ "parameterTypeTokenRange": {
456
+ "startIndex": 1,
457
+ "endIndex": 2
458
+ },
459
+ "isOptional": true
460
+ }
461
+ ],
462
+ "name": "deprecatedAttr"
463
+ },
464
+ {
465
+ "kind": "Function",
466
+ "canonicalReference": "@genesislcap/web-core!deprecatedAttr:function(2)",
467
+ "docComment": "/**\n * Decorator: Specifies an HTML attribute.\n *\n * @param target - The class to define the attribute on.\n *\n * @param prop - The property name to be associated with the attribute.\n *\n * @public\n */\n",
468
+ "excerptTokens": [
469
+ {
470
+ "kind": "Content",
471
+ "text": "export declare function deprecatedAttr(target: "
472
+ },
473
+ {
474
+ "kind": "Content",
475
+ "text": "{}"
476
+ },
477
+ {
478
+ "kind": "Content",
479
+ "text": ", prop: "
480
+ },
481
+ {
482
+ "kind": "Content",
483
+ "text": "string"
484
+ },
485
+ {
486
+ "kind": "Content",
487
+ "text": "): "
488
+ },
489
+ {
490
+ "kind": "Content",
491
+ "text": "void"
492
+ },
493
+ {
494
+ "kind": "Content",
495
+ "text": ";"
496
+ }
497
+ ],
498
+ "fileUrlPath": "src/decorators/deprecated-attr.ts",
499
+ "returnTypeTokenRange": {
500
+ "startIndex": 5,
501
+ "endIndex": 6
502
+ },
503
+ "releaseTag": "Public",
504
+ "overloadIndex": 2,
505
+ "parameters": [
506
+ {
507
+ "parameterName": "target",
508
+ "parameterTypeTokenRange": {
509
+ "startIndex": 1,
510
+ "endIndex": 2
511
+ },
512
+ "isOptional": false
513
+ },
514
+ {
515
+ "parameterName": "prop",
516
+ "parameterTypeTokenRange": {
517
+ "startIndex": 3,
518
+ "endIndex": 4
519
+ },
520
+ "isOptional": false
521
+ }
522
+ ],
523
+ "name": "deprecatedAttr"
524
+ },
418
525
  {
419
526
  "kind": "TypeAlias",
420
527
  "canonicalReference": "@genesislcap/web-core!EventName:type",
@@ -39,6 +39,7 @@ import { customElement } from '@microsoft/fast-element';
39
39
  import { dataGridCellTemplate } from '@microsoft/fast-foundation';
40
40
  import { dataGridRowTemplate } from '@microsoft/fast-foundation';
41
41
  import { dataGridTemplate } from '@microsoft/fast-foundation';
42
+ import { DecoratorAttributeConfiguration } from '@microsoft/fast-element';
42
43
  import { defaultExecutionContext } from '@microsoft/fast-element';
43
44
  import { DefaultRouteRecognizer } from '@microsoft/fast-router';
44
45
  import { DesignSystem } from '@microsoft/fast-foundation';
@@ -280,6 +281,24 @@ export declare type DefineFunction<TType> = (definition: PartialFASTElementDefin
280
281
  */
281
282
  export declare type DefinitionOverrider = (override: PartialFASTElementDefinition) => PartialFASTElementDefinition;
282
283
 
284
+ /**
285
+ * ALL FOLLOWING CODE FROM FAST IMPLEMENTATION EXCEPT THE `deprecatedName` HANDLING
286
+ */
287
+ /**
288
+ * Decorator: Specifies an HTML attribute.
289
+ * @param config - The configuration for the attribute.
290
+ * @public
291
+ */
292
+ export declare function deprecatedAttr(config?: ExtendedDecoratorAttributeConfiguration): (target: {}, property: string) => void;
293
+
294
+ /**
295
+ * Decorator: Specifies an HTML attribute.
296
+ * @param target - The class to define the attribute on.
297
+ * @param prop - The property name to be associated with the attribute.
298
+ * @public
299
+ */
300
+ export declare function deprecatedAttr(target: {}, prop: string): void;
301
+
283
302
  export { DesignSystem }
284
303
 
285
304
  export { DesignSystemRegistrationContext }
@@ -316,6 +335,10 @@ export declare type EventName = 'input' | 'change' | 'default';
316
335
 
317
336
  export { ExecutionContext }
318
337
 
338
+ declare type ExtendedDecoratorAttributeConfiguration = DecoratorAttributeConfiguration & {
339
+ deprecatedName?: string;
340
+ };
341
+
319
342
  export { FASTElement }
320
343
  export { FASTElement as GenesisElement }
321
344
 
@@ -0,0 +1,24 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/web-core](./web-core.md) &gt; [deprecatedAttr](./web-core.deprecatedattr.md)
4
+
5
+ ## deprecatedAttr() function
6
+
7
+ Decorator: Specifies an HTML attribute.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function deprecatedAttr(config?: ExtendedDecoratorAttributeConfiguration): (target: {}, property: string) => void;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | config | ExtendedDecoratorAttributeConfiguration | _(Optional)_ The configuration for the attribute. |
20
+
21
+ **Returns:**
22
+
23
+ (target: {}, property: string) =&gt; void
24
+
@@ -0,0 +1,25 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/web-core](./web-core.md) &gt; [deprecatedAttr](./web-core.deprecatedattr_1.md)
4
+
5
+ ## deprecatedAttr() function
6
+
7
+ Decorator: Specifies an HTML attribute.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function deprecatedAttr(target: {}, prop: string): void;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | target | {} | The class to define the attribute on. |
20
+ | prop | string | The property name to be associated with the attribute. |
21
+
22
+ **Returns:**
23
+
24
+ void
25
+
@@ -8,6 +8,8 @@
8
8
 
9
9
  | Function | Description |
10
10
  | --- | --- |
11
+ | [deprecatedAttr(config)](./web-core.deprecatedattr.md) | Decorator: Specifies an HTML attribute. |
12
+ | [deprecatedAttr(target, prop)](./web-core.deprecatedattr_1.md) | Decorator: Specifies an HTML attribute. |
11
13
  | [sync(binding, conversionType, eventName, keyAttr)](./web-core.sync.md) | Creates a synchronization directive that binds a data source to an HTML element, |
12
14
  | [tagFor(dependency)](./web-core.tagfor.md) | **_(BETA)_** Determines what HTML tag name to use for the dependency. |
13
15
  | [whenElse(binding, trueTemplateOrTemplateBinding, falseTemplateOrTemplateBinding)](./web-core.whenelse.md) | Directive that allows supplying an "else" template to the traditional [https://www.fast.design/docs/api/fast-element.when/\#when-function](https://www.fast.design/docs/api/fast-element.when/#when-function) directive |
@@ -45,6 +45,7 @@ import { customElement } from '@microsoft/fast-element';
45
45
  import { dataGridCellTemplate } from '@microsoft/fast-foundation';
46
46
  import { dataGridRowTemplate } from '@microsoft/fast-foundation';
47
47
  import { dataGridTemplate } from '@microsoft/fast-foundation';
48
+ import { DecoratorAttributeConfiguration } from '@microsoft/fast-element';
48
49
  import { defaultExecutionContext } from '@microsoft/fast-element';
49
50
  import { DefaultRouteRecognizer } from '@microsoft/fast-router';
50
51
  import { DesignSystem } from '@microsoft/fast-foundation';
@@ -249,6 +250,14 @@ export type DefineFunction<TType> = (definition: PartialFASTElementDefinition) =
249
250
  // @beta (undocumented)
250
251
  export type DefinitionOverrider = (override: PartialFASTElementDefinition) => PartialFASTElementDefinition;
251
252
 
253
+ // Warning: (ae-forgotten-export) The symbol "ExtendedDecoratorAttributeConfiguration" needs to be exported by the entry point index.d.ts
254
+ //
255
+ // @public
256
+ export function deprecatedAttr(config?: ExtendedDecoratorAttributeConfiguration): (target: {}, property: string) => void;
257
+
258
+ // @public
259
+ export function deprecatedAttr(target: {}, prop: string): void;
260
+
252
261
  export { DesignSystem }
253
262
 
254
263
  export { DesignSystemRegistrationContext }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/web-core",
3
3
  "description": "Genesis Foundation Web Core",
4
- "version": "14.213.1",
4
+ "version": "14.214.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "97adf0941ef3506927d10118aab06e973437baad"
46
+ "gitHead": "12de0640c63d111cb448bd3204a9d2133afb9c49"
47
47
  }