@genesislcap/foundation-utils 14.246.0 → 14.246.1-alpha-e79f189.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.
@@ -369,7 +369,7 @@
369
369
  },
370
370
  {
371
371
  "kind": "javascript-module",
372
- "path": "src/directives/index.ts",
372
+ "path": "src/decorators/index.ts",
373
373
  "declarations": [],
374
374
  "exports": [
375
375
  {
@@ -377,15 +377,45 @@
377
377
  "name": "*",
378
378
  "declaration": {
379
379
  "name": "*",
380
- "package": "./sync"
380
+ "package": "./renderOnChange"
381
381
  }
382
- },
382
+ }
383
+ ]
384
+ },
385
+ {
386
+ "kind": "javascript-module",
387
+ "path": "src/decorators/renderOnChange.ts",
388
+ "declarations": [
389
+ {
390
+ "kind": "function",
391
+ "name": "renderOnChange",
392
+ "parameters": [
393
+ {
394
+ "name": "target",
395
+ "type": {
396
+ "text": "FASTElement & { render(): void }"
397
+ },
398
+ "description": "The target to define the property change handler on."
399
+ },
400
+ {
401
+ "name": "name",
402
+ "type": {
403
+ "text": "string"
404
+ },
405
+ "description": "The property name."
406
+ }
407
+ ],
408
+ "description": "Defines a property changed handler that calls a render() method on the target as an internal observation enhancement.",
409
+ "privacy": "public"
410
+ }
411
+ ],
412
+ "exports": [
383
413
  {
384
414
  "kind": "js",
385
- "name": "*",
415
+ "name": "renderOnChange",
386
416
  "declaration": {
387
- "name": "*",
388
- "package": "./when-else"
417
+ "name": "renderOnChange",
418
+ "module": "src/decorators/renderOnChange.ts"
389
419
  }
390
420
  }
391
421
  ]
@@ -412,6 +442,32 @@
412
442
  ],
413
443
  "description": "assureDesignSystem.",
414
444
  "privacy": "public"
445
+ },
446
+ {
447
+ "kind": "function",
448
+ "name": "getCurrentDesignSystemPrefix",
449
+ "return": {
450
+ "type": {
451
+ "text": ""
452
+ }
453
+ },
454
+ "parameters": [
455
+ {
456
+ "name": "element",
457
+ "type": {
458
+ "text": "HTMLElement"
459
+ }
460
+ },
461
+ {
462
+ "name": "fallbackPrefix",
463
+ "type": {
464
+ "text": "string"
465
+ },
466
+ "description": "The prefix to fallback to if the provider is not available"
467
+ }
468
+ ],
469
+ "description": "Get the current design system prefix. If the provider is not available, fallback to the provided prefix.",
470
+ "privacy": "public"
415
471
  }
416
472
  ],
417
473
  "exports": [
@@ -422,6 +478,14 @@
422
478
  "name": "assureDesignSystem",
423
479
  "module": "src/design-system/design-system.ts"
424
480
  }
481
+ },
482
+ {
483
+ "kind": "js",
484
+ "name": "getCurrentDesignSystemPrefix",
485
+ "declaration": {
486
+ "name": "getCurrentDesignSystemPrefix",
487
+ "module": "src/design-system/design-system.ts"
488
+ }
425
489
  }
426
490
  ]
427
491
  },
@@ -440,6 +504,29 @@
440
504
  }
441
505
  ]
442
506
  },
507
+ {
508
+ "kind": "javascript-module",
509
+ "path": "src/directives/index.ts",
510
+ "declarations": [],
511
+ "exports": [
512
+ {
513
+ "kind": "js",
514
+ "name": "*",
515
+ "declaration": {
516
+ "name": "*",
517
+ "package": "./sync"
518
+ }
519
+ },
520
+ {
521
+ "kind": "js",
522
+ "name": "*",
523
+ "declaration": {
524
+ "name": "*",
525
+ "package": "./when-else"
526
+ }
527
+ }
528
+ ]
529
+ },
443
530
  {
444
531
  "kind": "javascript-module",
445
532
  "path": "src/encoding/index.ts",
@@ -896,59 +983,6 @@
896
983
  }
897
984
  ]
898
985
  },
899
- {
900
- "kind": "javascript-module",
901
- "path": "src/decorators/index.ts",
902
- "declarations": [],
903
- "exports": [
904
- {
905
- "kind": "js",
906
- "name": "*",
907
- "declaration": {
908
- "name": "*",
909
- "package": "./renderOnChange"
910
- }
911
- }
912
- ]
913
- },
914
- {
915
- "kind": "javascript-module",
916
- "path": "src/decorators/renderOnChange.ts",
917
- "declarations": [
918
- {
919
- "kind": "function",
920
- "name": "renderOnChange",
921
- "parameters": [
922
- {
923
- "name": "target",
924
- "type": {
925
- "text": "FASTElement & { render(): void }"
926
- },
927
- "description": "The target to define the property change handler on."
928
- },
929
- {
930
- "name": "name",
931
- "type": {
932
- "text": "string"
933
- },
934
- "description": "The property name."
935
- }
936
- ],
937
- "description": "Defines a property changed handler that calls a render() method on the target as an internal observation enhancement.",
938
- "privacy": "public"
939
- }
940
- ],
941
- "exports": [
942
- {
943
- "kind": "js",
944
- "name": "renderOnChange",
945
- "declaration": {
946
- "name": "renderOnChange",
947
- "module": "src/decorators/renderOnChange.ts"
948
- }
949
- }
950
- ]
951
- },
952
986
  {
953
987
  "kind": "javascript-module",
954
988
  "path": "src/error/errorMap.ts",
@@ -51,4 +51,17 @@ export type DesignSystemResource<T = DesignSystemModule> = Promise<T>;
51
51
  * @public
52
52
  */
53
53
  export declare function assureDesignSystem(module: DesignSystemModule): DesignSystemModule;
54
+ /**
55
+ * Get the current design system prefix. If the provider is not available, fallback to the provided prefix.
56
+ * @param fallbackPrefix - The prefix to fallback to if the provider is not available
57
+ * @returns The current design system prefix
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const prefix = getCurrentDesignSystemPrefix('my-prefix');
62
+ * logger.debug(prefix); // May return 'zero' or 'rapid' if the provider is available or 'my-prefix' if not
63
+ * ```
64
+ * @public
65
+ */
66
+ export declare function getCurrentDesignSystemPrefix(element: HTMLElement, fallbackPrefix: string): string;
54
67
  //# sourceMappingURL=design-system.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"design-system.d.ts","sourceRoot":"","sources":["../../../src/design-system/design-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,CACjB,OAAO,CAAC,EAAE,WAAW,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACjD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,kBAAkB,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAQjF"}
1
+ {"version":3,"file":"design-system.d.ts","sourceRoot":"","sources":["../../../src/design-system/design-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,CACjB,OAAO,CAAC,EAAE,WAAW,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACjD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,kBAAkB,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAQjF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAajG"}
@@ -1,3 +1,5 @@
1
+ import { DesignSystem } from '@microsoft/fast-foundation';
2
+ import { logger } from '../utils';
1
3
  /**
2
4
  * assureDesignSystem.
3
5
  *
@@ -45,3 +47,22 @@ export function assureDesignSystem(module) {
45
47
  }
46
48
  return module;
47
49
  }
50
+ /**
51
+ * Get the current design system prefix. If the provider is not available, fallback to the provided prefix.
52
+ * @param fallbackPrefix - The prefix to fallback to if the provider is not available
53
+ * @returns The current design system prefix
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const prefix = getCurrentDesignSystemPrefix('my-prefix');
58
+ * logger.debug(prefix); // May return 'zero' or 'rapid' if the provider is available or 'my-prefix' if not
59
+ * ```
60
+ * @public
61
+ */
62
+ export function getCurrentDesignSystemPrefix(element, fallbackPrefix) {
63
+ const provider = DesignSystem.responsibleFor(element);
64
+ if (!provider || !provider.owner) {
65
+ logger.warn(`DesignSystem provider not found for ${element.localName} element, falling back to ${fallbackPrefix} prefix.`);
66
+ }
67
+ return provider && provider.owner ? provider.prefix : fallbackPrefix;
68
+ }
@@ -3565,6 +3565,68 @@
3565
3565
  "endIndex": 2
3566
3566
  }
3567
3567
  },
3568
+ {
3569
+ "kind": "Function",
3570
+ "canonicalReference": "@genesislcap/foundation-utils!getCurrentDesignSystemPrefix:function(1)",
3571
+ "docComment": "/**\n * Get the current design system prefix. If the provider is not available, fallback to the provided prefix.\n *\n * @param fallbackPrefix - The prefix to fallback to if the provider is not available\n *\n * @returns The current design system prefix\n *\n * @example\n * ```ts\n * const prefix = getCurrentDesignSystemPrefix('my-prefix');\n * logger.debug(prefix); // May return 'zero' or 'rapid' if the provider is available or 'my-prefix' if not\n * ```\n *\n * @public\n */\n",
3572
+ "excerptTokens": [
3573
+ {
3574
+ "kind": "Content",
3575
+ "text": "export declare function getCurrentDesignSystemPrefix(element: "
3576
+ },
3577
+ {
3578
+ "kind": "Reference",
3579
+ "text": "HTMLElement",
3580
+ "canonicalReference": "!HTMLElement:interface"
3581
+ },
3582
+ {
3583
+ "kind": "Content",
3584
+ "text": ", fallbackPrefix: "
3585
+ },
3586
+ {
3587
+ "kind": "Content",
3588
+ "text": "string"
3589
+ },
3590
+ {
3591
+ "kind": "Content",
3592
+ "text": "): "
3593
+ },
3594
+ {
3595
+ "kind": "Content",
3596
+ "text": "string"
3597
+ },
3598
+ {
3599
+ "kind": "Content",
3600
+ "text": ";"
3601
+ }
3602
+ ],
3603
+ "fileUrlPath": "src/design-system/design-system.ts",
3604
+ "returnTypeTokenRange": {
3605
+ "startIndex": 5,
3606
+ "endIndex": 6
3607
+ },
3608
+ "releaseTag": "Public",
3609
+ "overloadIndex": 1,
3610
+ "parameters": [
3611
+ {
3612
+ "parameterName": "element",
3613
+ "parameterTypeTokenRange": {
3614
+ "startIndex": 1,
3615
+ "endIndex": 2
3616
+ },
3617
+ "isOptional": false
3618
+ },
3619
+ {
3620
+ "parameterName": "fallbackPrefix",
3621
+ "parameterTypeTokenRange": {
3622
+ "startIndex": 3,
3623
+ "endIndex": 4
3624
+ },
3625
+ "isOptional": false
3626
+ }
3627
+ ],
3628
+ "name": "getCurrentDesignSystemPrefix"
3629
+ },
3568
3630
  {
3569
3631
  "kind": "Function",
3570
3632
  "canonicalReference": "@genesislcap/foundation-utils!getDateFormatter:function(1)",
@@ -505,6 +505,20 @@ export declare type FoundationLayoutContainer = {
505
505
  */
506
506
  export declare const GENESIS_SOCKET_URL: string;
507
507
 
508
+ /**
509
+ * Get the current design system prefix. If the provider is not available, fallback to the provided prefix.
510
+ * @param fallbackPrefix - The prefix to fallback to if the provider is not available
511
+ * @returns The current design system prefix
512
+ *
513
+ * @example
514
+ * ```ts
515
+ * const prefix = getCurrentDesignSystemPrefix('my-prefix');
516
+ * logger.debug(prefix); // May return 'zero' or 'rapid' if the provider is available or 'my-prefix' if not
517
+ * ```
518
+ * @public
519
+ */
520
+ export declare function getCurrentDesignSystemPrefix(element: HTMLElement, fallbackPrefix: string): string;
521
+
508
522
  /**
509
523
  * @public
510
524
  */
@@ -0,0 +1,35 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-utils](./foundation-utils.md) &gt; [getCurrentDesignSystemPrefix](./foundation-utils.getcurrentdesignsystemprefix.md)
4
+
5
+ ## getCurrentDesignSystemPrefix() function
6
+
7
+ Get the current design system prefix. If the provider is not available, fallback to the provided prefix.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function getCurrentDesignSystemPrefix(element: HTMLElement, fallbackPrefix: string): string;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | element | HTMLElement | |
20
+ | fallbackPrefix | string | The prefix to fallback to if the provider is not available |
21
+
22
+ **Returns:**
23
+
24
+ string
25
+
26
+ The current design system prefix
27
+
28
+ ## Example
29
+
30
+
31
+ ```ts
32
+ const prefix = getCurrentDesignSystemPrefix('my-prefix');
33
+ logger.debug(prefix); // May return 'zero' or 'rapid' if the provider is available or 'my-prefix' if not
34
+ ```
35
+
@@ -32,6 +32,7 @@
32
32
  | [formatDateTimestamp(timestamp)](./foundation-utils.formatdatetimestamp.md) | Formats \[DATE\] UNIX Timestamps (without time) to readable strings |
33
33
  | [formatDateTimeTimestamp(timestamp)](./foundation-utils.formatdatetimetimestamp.md) | Formats \[DATETIME\] UNIX Timestamps (with time) to readable strings |
34
34
  | [formatTimestamp(timestamp, withTime)](./foundation-utils.formattimestamp.md) | Formats \[DATE\|DATETIME\] Unix Timestamps to readable strings |
35
+ | [getCurrentDesignSystemPrefix(element, fallbackPrefix)](./foundation-utils.getcurrentdesignsystemprefix.md) | Get the current design system prefix. If the provider is not available, fallback to the provided prefix. |
35
36
  | [getDateFormatter(locale, options)](./foundation-utils.getdateformatter.md) | |
36
37
  | [getNumberFormatter(format, locale)](./foundation-utils.getnumberformatter.md) | |
37
38
  | [JSONReplacer(key, value)](./foundation-utils.jsonreplacer.md) | JSON replacer function. |
@@ -277,6 +277,9 @@ export type FoundationLayoutContainer = {
277
277
  // @public
278
278
  export const GENESIS_SOCKET_URL: string;
279
279
 
280
+ // @public
281
+ export function getCurrentDesignSystemPrefix(element: HTMLElement, fallbackPrefix: string): string;
282
+
280
283
  // @public (undocumented)
281
284
  export function getDateFormatter(locale?: string, options?: Intl.DateTimeFormatOptions): (params: any) => string;
282
285
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-utils",
3
3
  "description": "Genesis Foundation Utils",
4
- "version": "14.246.0",
4
+ "version": "14.246.1-alpha-e79f189.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -27,17 +27,17 @@
27
27
  }
28
28
  },
29
29
  "devDependencies": {
30
- "@genesislcap/foundation-testing": "14.246.0",
31
- "@genesislcap/genx": "14.246.0",
32
- "@genesislcap/rollup-builder": "14.246.0",
33
- "@genesislcap/ts-builder": "14.246.0",
34
- "@genesislcap/uvu-playwright-builder": "14.246.0",
35
- "@genesislcap/vite-builder": "14.246.0",
36
- "@genesislcap/webpack-builder": "14.246.0",
30
+ "@genesislcap/foundation-testing": "14.246.1-alpha-e79f189.0",
31
+ "@genesislcap/genx": "14.246.1-alpha-e79f189.0",
32
+ "@genesislcap/rollup-builder": "14.246.1-alpha-e79f189.0",
33
+ "@genesislcap/ts-builder": "14.246.1-alpha-e79f189.0",
34
+ "@genesislcap/uvu-playwright-builder": "14.246.1-alpha-e79f189.0",
35
+ "@genesislcap/vite-builder": "14.246.1-alpha-e79f189.0",
36
+ "@genesislcap/webpack-builder": "14.246.1-alpha-e79f189.0",
37
37
  "rimraf": "^5.0.0"
38
38
  },
39
39
  "dependencies": {
40
- "@genesislcap/foundation-logger": "14.246.0",
40
+ "@genesislcap/foundation-logger": "14.246.1-alpha-e79f189.0",
41
41
  "@microsoft/fast-components": "2.30.6",
42
42
  "@microsoft/fast-element": "1.14.0",
43
43
  "@microsoft/fast-foundation": "2.49.6",
@@ -55,5 +55,5 @@
55
55
  "access": "public"
56
56
  },
57
57
  "customElements": "dist/custom-elements.json",
58
- "gitHead": "3b622b3bd389713fd2d2cc72a3b3f61dd046bd28"
58
+ "gitHead": "228d83f62347569881dcf1a9cece988aee373adb"
59
59
  }