@o3r/design 9.6.0-rc.4

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 (143) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +51 -0
  3. package/builders/generate-css/index.d.ts +8 -0
  4. package/builders/generate-css/index.d.ts.map +1 -0
  5. package/builders/generate-css/index.js +119 -0
  6. package/builders/generate-css/index.js.map +1 -0
  7. package/builders/generate-css/schema.d.ts +32 -0
  8. package/builders/generate-css/schema.d.ts.map +1 -0
  9. package/builders/generate-css/schema.js +3 -0
  10. package/builders/generate-css/schema.js.map +1 -0
  11. package/builders/generate-css/schema.json +68 -0
  12. package/builders/package.json +3 -0
  13. package/builders.json +10 -0
  14. package/cli/generate-css-from-design-token.cli.cjs +33 -0
  15. package/cli/generate-css-from-design-token.cli.cjs.map +1 -0
  16. package/cli/generate-css-from-design-token.cli.d.cts +3 -0
  17. package/cli/generate-css-from-design-token.cli.d.cts.map +1 -0
  18. package/collection.json +24 -0
  19. package/migration.json +5 -0
  20. package/package.json +206 -0
  21. package/schemas/design-token.schema.json +546 -0
  22. package/schematics/ extract-token/index.d.ts +8 -0
  23. package/schematics/ extract-token/index.d.ts.map +1 -0
  24. package/schematics/ extract-token/index.js +90 -0
  25. package/schematics/ extract-token/index.js.map +1 -0
  26. package/schematics/ extract-token/schema.d.ts +14 -0
  27. package/schematics/ extract-token/schema.d.ts.map +1 -0
  28. package/schematics/ extract-token/schema.js +3 -0
  29. package/schematics/ extract-token/schema.js.map +1 -0
  30. package/schematics/ extract-token/schema.json +43 -0
  31. package/schematics/generate-css/index.d.ts +8 -0
  32. package/schematics/generate-css/index.d.ts.map +1 -0
  33. package/schematics/generate-css/index.js +54 -0
  34. package/schematics/generate-css/index.js.map +1 -0
  35. package/schematics/generate-css/schema.d.ts +17 -0
  36. package/schematics/generate-css/schema.d.ts.map +1 -0
  37. package/schematics/generate-css/schema.js +3 -0
  38. package/schematics/generate-css/schema.js.map +1 -0
  39. package/schematics/generate-css/schema.json +43 -0
  40. package/schematics/ng-add/index.d.ts +7 -0
  41. package/schematics/ng-add/index.d.ts.map +1 -0
  42. package/schematics/ng-add/index.js +19 -0
  43. package/schematics/ng-add/index.js.map +1 -0
  44. package/schematics/ng-add/register-generate-css/index.d.ts +2 -0
  45. package/schematics/ng-add/register-generate-css/index.d.ts.map +1 -0
  46. package/schematics/ng-add/register-generate-css/index.js +5 -0
  47. package/schematics/ng-add/register-generate-css/index.js.map +1 -0
  48. package/schematics/ng-add/register-generate-css/register-task.d.ts +8 -0
  49. package/schematics/ng-add/register-generate-css/register-task.d.ts.map +1 -0
  50. package/schematics/ng-add/register-generate-css/register-task.js +68 -0
  51. package/schematics/ng-add/register-generate-css/register-task.js.map +1 -0
  52. package/schematics/ng-add/register-generate-css/templates/design-token.custom.json.template +3 -0
  53. package/schematics/ng-add/register-generate-css/templates/theme.scss.template +6 -0
  54. package/schematics/ng-add/schema.d.ts +6 -0
  55. package/schematics/ng-add/schema.d.ts.map +1 -0
  56. package/schematics/ng-add/schema.js +3 -0
  57. package/schematics/ng-add/schema.js.map +1 -0
  58. package/schematics/ng-add/schema.json +18 -0
  59. package/schematics/package.json +3 -0
  60. package/src/core/design-token/design-token-specification.interface.d.ts +195 -0
  61. package/src/core/design-token/design-token-specification.interface.d.ts.map +1 -0
  62. package/src/core/design-token/design-token-specification.interface.js +39 -0
  63. package/src/core/design-token/design-token-specification.interface.js.map +1 -0
  64. package/src/core/design-token/index.d.ts +4 -0
  65. package/src/core/design-token/index.d.ts.map +1 -0
  66. package/src/core/design-token/index.js +7 -0
  67. package/src/core/design-token/index.js.map +1 -0
  68. package/src/core/design-token/parsers/design-token-parser.interface.d.ts +70 -0
  69. package/src/core/design-token/parsers/design-token-parser.interface.d.ts.map +1 -0
  70. package/src/core/design-token/parsers/design-token-parser.interface.js +3 -0
  71. package/src/core/design-token/parsers/design-token-parser.interface.js.map +1 -0
  72. package/src/core/design-token/parsers/design-token.parser.d.ts +25 -0
  73. package/src/core/design-token/parsers/design-token.parser.d.ts.map +1 -0
  74. package/src/core/design-token/parsers/design-token.parser.js +143 -0
  75. package/src/core/design-token/parsers/design-token.parser.js.map +1 -0
  76. package/src/core/design-token/parsers/index.d.ts +3 -0
  77. package/src/core/design-token/parsers/index.d.ts.map +1 -0
  78. package/src/core/design-token/parsers/index.js +6 -0
  79. package/src/core/design-token/parsers/index.js.map +1 -0
  80. package/src/core/design-token/renderers/css/design-token-definition.renderers.d.ts +47 -0
  81. package/src/core/design-token/renderers/css/design-token-definition.renderers.d.ts.map +1 -0
  82. package/src/core/design-token/renderers/css/design-token-definition.renderers.js +53 -0
  83. package/src/core/design-token/renderers/css/design-token-definition.renderers.js.map +1 -0
  84. package/src/core/design-token/renderers/css/design-token-updater.renderers.d.ts +24 -0
  85. package/src/core/design-token/renderers/css/design-token-updater.renderers.d.ts.map +1 -0
  86. package/src/core/design-token/renderers/css/design-token-updater.renderers.js +29 -0
  87. package/src/core/design-token/renderers/css/design-token-updater.renderers.js.map +1 -0
  88. package/src/core/design-token/renderers/css/design-token-value.renderers.d.ts +19 -0
  89. package/src/core/design-token/renderers/css/design-token-value.renderers.d.ts.map +1 -0
  90. package/src/core/design-token/renderers/css/design-token-value.renderers.js +29 -0
  91. package/src/core/design-token/renderers/css/design-token-value.renderers.js.map +1 -0
  92. package/src/core/design-token/renderers/css/index.d.ts +4 -0
  93. package/src/core/design-token/renderers/css/index.d.ts.map +1 -0
  94. package/src/core/design-token/renderers/css/index.js +7 -0
  95. package/src/core/design-token/renderers/css/index.js.map +1 -0
  96. package/src/core/design-token/renderers/design-token-style.renderer.d.ts +25 -0
  97. package/src/core/design-token/renderers/design-token-style.renderer.d.ts.map +1 -0
  98. package/src/core/design-token/renderers/design-token-style.renderer.js +58 -0
  99. package/src/core/design-token/renderers/design-token-style.renderer.js.map +1 -0
  100. package/src/core/design-token/renderers/design-token.renderer.helpers.d.ts +8 -0
  101. package/src/core/design-token/renderers/design-token.renderer.helpers.d.ts.map +1 -0
  102. package/src/core/design-token/renderers/design-token.renderer.helpers.js +11 -0
  103. package/src/core/design-token/renderers/design-token.renderer.helpers.js.map +1 -0
  104. package/src/core/design-token/renderers/design-token.renderer.interface.d.ts +56 -0
  105. package/src/core/design-token/renderers/design-token.renderer.interface.d.ts.map +1 -0
  106. package/src/core/design-token/renderers/design-token.renderer.interface.js +3 -0
  107. package/src/core/design-token/renderers/design-token.renderer.interface.js.map +1 -0
  108. package/src/core/design-token/renderers/index.d.ts +7 -0
  109. package/src/core/design-token/renderers/index.d.ts.map +1 -0
  110. package/src/core/design-token/renderers/index.js +10 -0
  111. package/src/core/design-token/renderers/index.js.map +1 -0
  112. package/src/core/design-token/renderers/metadata/design-token-definition.renderers.d.ts +39 -0
  113. package/src/core/design-token/renderers/metadata/design-token-definition.renderers.d.ts.map +1 -0
  114. package/src/core/design-token/renderers/metadata/design-token-definition.renderers.js +41 -0
  115. package/src/core/design-token/renderers/metadata/design-token-definition.renderers.js.map +1 -0
  116. package/src/core/design-token/renderers/metadata/design-token-updater.renderers.d.ts +6 -0
  117. package/src/core/design-token/renderers/metadata/design-token-updater.renderers.d.ts.map +1 -0
  118. package/src/core/design-token/renderers/metadata/design-token-updater.renderers.js +13 -0
  119. package/src/core/design-token/renderers/metadata/design-token-updater.renderers.js.map +1 -0
  120. package/src/core/design-token/renderers/metadata/design-token-value.renderers.d.ts +18 -0
  121. package/src/core/design-token/renderers/metadata/design-token-value.renderers.d.ts.map +1 -0
  122. package/src/core/design-token/renderers/metadata/design-token-value.renderers.js +27 -0
  123. package/src/core/design-token/renderers/metadata/design-token-value.renderers.js.map +1 -0
  124. package/src/core/design-token/renderers/metadata/index.d.ts +4 -0
  125. package/src/core/design-token/renderers/metadata/index.d.ts.map +1 -0
  126. package/src/core/design-token/renderers/metadata/index.js +7 -0
  127. package/src/core/design-token/renderers/metadata/index.js.map +1 -0
  128. package/src/core/design-token/renderers/sass/design-token-definition.renderers.d.ts +23 -0
  129. package/src/core/design-token/renderers/sass/design-token-definition.renderers.d.ts.map +1 -0
  130. package/src/core/design-token/renderers/sass/design-token-definition.renderers.js +28 -0
  131. package/src/core/design-token/renderers/sass/design-token-definition.renderers.js.map +1 -0
  132. package/src/core/design-token/renderers/sass/index.d.ts +2 -0
  133. package/src/core/design-token/renderers/sass/index.d.ts.map +1 -0
  134. package/src/core/design-token/renderers/sass/index.js +5 -0
  135. package/src/core/design-token/renderers/sass/index.js.map +1 -0
  136. package/src/core/index.d.ts +2 -0
  137. package/src/core/index.d.ts.map +1 -0
  138. package/src/core/index.js +5 -0
  139. package/src/core/index.js.map +1 -0
  140. package/src/public_api.d.ts +2 -0
  141. package/src/public_api.d.ts.map +1 -0
  142. package/src/public_api.js +5 -0
  143. package/src/public_api.js.map +1 -0
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "ngAddSchematicsSchema",
4
+ "title": "Extract Design Token From Sass",
5
+ "description": "Extract Design Token From Sass o3r variable helpers",
6
+ "properties": {
7
+ "includeTags": {
8
+ "description": "Include the tags in the original Sass file",
9
+ "oneOf": [
10
+ {
11
+ "type": "boolean"
12
+ },
13
+ {
14
+ "type": "object",
15
+ "properties": {
16
+ "startTag": {
17
+ "type": "string"
18
+ },
19
+ "endTag": {
20
+ "type": "string"
21
+ }
22
+ },
23
+ "required": [
24
+ "startTag",
25
+ "endTag"
26
+ ]
27
+ }
28
+ ],
29
+ "default": true
30
+ },
31
+ "componentFilePatterns": {
32
+ "description": "List of file pattern of component theme files",
33
+ "type": "array",
34
+ "items": {
35
+ "type": "string"
36
+ }
37
+ }
38
+ },
39
+ "additionalProperties": true,
40
+ "required": [
41
+ "componentFilePattern"
42
+ ]
43
+ }
@@ -0,0 +1,8 @@
1
+ import type { GenerateCssSchematicsSchema } from './schema';
2
+ import type { Rule } from '@angular-devkit/schematics';
3
+ /**
4
+ * Generate CSS from Design Token files
5
+ * @param options
6
+ */
7
+ export declare function generateCss(options: GenerateCssSchematicsSchema): Rule;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/generate-css/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAavD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAuCtE"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateCss = void 0;
4
+ const design_1 = require("@o3r/design");
5
+ /* for v9.6 migration only, it is integrated into @o3r/schematics package in v10 */
6
+ const schematics_1 = require("@o3r/schematics");
7
+ const minimatch_1 = require("minimatch");
8
+ function globInTree(tree, patterns) {
9
+ const files = (0, schematics_1.getAllFilesInTree)(tree);
10
+ return files.filter((basePath) => patterns.some((p) => (0, minimatch_1.minimatch)(basePath, p, { dot: true })));
11
+ }
12
+ /**
13
+ * Generate CSS from Design Token files
14
+ * @param options
15
+ */
16
+ function generateCss(options) {
17
+ return async (tree, context) => {
18
+ const writeFile = (filePath, content) => tree.exists(filePath) ? tree.overwrite(filePath, content) : tree.create(filePath, content);
19
+ const readFile = tree.readText;
20
+ const existsFile = tree.exists;
21
+ const determineFileToUpdate = options.output ? () => options.output :
22
+ (token) => {
23
+ if (token.extensions.o3rTargetFile && tree.exists(token.extensions.o3rTargetFile)) {
24
+ return token.extensions.o3rTargetFile;
25
+ }
26
+ return options.defaultStyleFile;
27
+ };
28
+ const renderDesignTokenOptions = {
29
+ readFile,
30
+ writeFile,
31
+ existsFile,
32
+ determineFileToUpdate,
33
+ logger: context.logger
34
+ };
35
+ const files = globInTree(tree, Array.isArray(options.designTokenFilePatterns) ? options.designTokenFilePatterns : [options.designTokenFilePatterns]);
36
+ const duplicatedToken = [];
37
+ const tokens = (await Promise.all(files.map(async (file) => ({ file, parsed: await (0, design_1.parseDesignTokenFile)(file) }))))
38
+ .reduce((acc, { file, parsed }) => {
39
+ parsed.forEach((variable, key) => {
40
+ if (acc.has(key)) {
41
+ context.logger[options.failOnDuplicate ? 'error' : 'warn'](`A duplication of the variable ${key} is found in ${file}`);
42
+ }
43
+ acc.set(key, variable);
44
+ });
45
+ return acc;
46
+ }, new Map());
47
+ if (options.failOnDuplicate && duplicatedToken.length > 0) {
48
+ throw new Error(`Found ${duplicatedToken.length} duplicated Design Token keys`);
49
+ }
50
+ await (0, design_1.renderDesignTokens)(tokens, renderDesignTokenOptions);
51
+ };
52
+ }
53
+ exports.generateCss = generateCss;
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/generate-css/index.ts"],"names":[],"mappings":";;;AAEA,wCAAuE;AAGvE,mFAAmF;AACnF,gDAAoD;AAEpD,yCAAsC;AACtC,SAAS,UAAU,CAAC,IAAU,EAAE,QAAkB;IAChD,MAAM,KAAK,GAAG,IAAA,8BAAiB,EAAC,IAAI,CAAC,CAAC;IACtC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAS,EAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,OAAoC;IAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QAC7B,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CA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AAO,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;gBAC/B,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;oBAChB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,iCAAiC,GAAG,gBAAgB,IAAI,EAAE,CAAC,CAAC;iBACxH;gBACD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YACzB,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAChB,IAAI,OAAO,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;YACzD,MAAM,IAAI,KAAK,CAAC,SAAS,eAAe,CAAC,MAAM,+BAA+B,CAAC,CAAC;SACjF;QACD,MAAM,IAAA,2BAAkB,EAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAC7D,CAAC,CAAC;AACJ,CAAC;AAvCD,kCAuCC"}
@@ -0,0 +1,17 @@
1
+ import type { SchematicOptionObject } from '@o3r/schematics';
2
+ export interface GenerateCssSchematicsSchema extends SchematicOptionObject {
3
+ /** Path patterns to the Design Token JSON files */
4
+ designTokenFilePatterns: string | string[];
5
+ /** File path to generate the variable if not determined by the specification */
6
+ defaultStyleFile: string;
7
+ /**
8
+ * Output file where generate the CSS
9
+ *
10
+ * If specified, all the generated CSS variable will be generated in the given file.
11
+ * Otherwise, the output file will be determined based on the Variable parameters
12
+ */
13
+ output?: string;
14
+ /** Determine if the process should stop in case of Token duplication */
15
+ failOnDuplicate?: boolean;
16
+ }
17
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/generate-css/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB;IACxE,mDAAmD;IACnD,uBAAuB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE3C,gFAAgF;IAChF,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,wEAAwE;IACxE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../schematics/generate-css/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "ngAddSchematicsSchema",
4
+ "title": "Add Otter Design",
5
+ "description": "ngAdd Otter Design",
6
+ "properties": {
7
+ "designTokenFilePatterns": {
8
+ "description": "Path patterns to the Design Token JSON files",
9
+ "oneOf": [
10
+ {
11
+ "type": "string"
12
+ },
13
+ {
14
+ "type": "array",
15
+ "items": {
16
+ "type": "string"
17
+ }
18
+ }
19
+ ],
20
+ "$default": {
21
+ "$source": "argv"
22
+ }
23
+ },
24
+ "output": {
25
+ "type": "string",
26
+ "description": "Output file where generate the CSS"
27
+ },
28
+ "defaultStyleFile": {
29
+ "type": "string",
30
+ "default": "src/theme.scss",
31
+ "description": "File path to generate the variable if not determined by the specification"
32
+ },
33
+ "failOnDuplicate": {
34
+ "type": "boolean",
35
+ "default": false,
36
+ "description": "Determine if the process should stop in case of Token duplication"
37
+ }
38
+ },
39
+ "additionalProperties": true,
40
+ "required": [
41
+ "designTokenFilePatterns"
42
+ ]
43
+ }
@@ -0,0 +1,7 @@
1
+ import { type Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Add Otter design to an Angular Project
4
+ * @param options
5
+ */
6
+ export declare function ngAdd(): Rule;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAI9D;;;GAGG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAM5B"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAdd = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const register_generate_css_1 = require("./register-generate-css");
6
+ const _extract_token_1 = require("../ extract-token");
7
+ /**
8
+ * Add Otter design to an Angular Project
9
+ * @param options
10
+ */
11
+ function ngAdd() {
12
+ /* ng add rules */
13
+ return (0, schematics_1.chain)([
14
+ (0, register_generate_css_1.registerGenerateCssBuilder)(),
15
+ (0, _extract_token_1.extractToken)({ componentFilePatterns: ['**/*.scss'], includeTags: true })
16
+ ]);
17
+ }
18
+ exports.ngAdd = ngAdd;
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,2DAA8D;AAC9D,mEAAqE;AACrE,sDAAiD;AAEjD;;;GAGG;AACH,SAAgB,KAAK;IACnB,kBAAkB;IAClB,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,kDAA0B,GAAE;QAC5B,IAAA,6BAAY,EAAC,EAAE,qBAAqB,EAAE,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;KAC1E,CAAC,CAAC;AACL,CAAC;AAND,sBAMC"}
@@ -0,0 +1,2 @@
1
+ export * from './register-task';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/register-generate-css/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./register-task"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../schematics/ng-add/register-generate-css/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC"}
@@ -0,0 +1,8 @@
1
+ import { type Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Register the Design Token CSS generator
4
+ * @param projectName Project name
5
+ * @param taskName name of the task to generate
6
+ */
7
+ export declare const registerGenerateCssBuilder: (projectName?: string, taskName?: string) => Rule;
8
+ //# sourceMappingURL=register-task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-task.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/register-generate-css/register-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqE,KAAK,IAAI,EAAiB,MAAM,4BAA4B,CAAC;AAgBzI;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,iBAAkB,MAAM,wBAA8B,IAmD5F,CAAC"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerGenerateCssBuilder = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const schematics_2 = require("@o3r/schematics");
6
+ const node_path_1 = require("node:path");
7
+ function registerBuilder(workspaceProject, taskName, taskParameters, force = false) {
8
+ workspaceProject.architect ||= {};
9
+ if (workspaceProject.architect[taskName] && !force) {
10
+ throw new Error(`The builder task ${taskName} already exist`);
11
+ }
12
+ workspaceProject.architect[taskName] = taskParameters;
13
+ return workspaceProject;
14
+ }
15
+ /**
16
+ * Register the Design Token CSS generator
17
+ * @param projectName Project name
18
+ * @param taskName name of the task to generate
19
+ */
20
+ const registerGenerateCssBuilder = (projectName, taskName = 'generate-css') => {
21
+ const registerBuilderRule = (tree, { logger }) => {
22
+ const workspaceProject = projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[projectName] : undefined;
23
+ const srcBasePath = workspaceProject?.sourceRoot || (workspaceProject?.root ? node_path_1.posix.resolve(workspaceProject.root, 'src') : '');
24
+ const themeFile = node_path_1.posix.resolve(srcBasePath, 'style', 'theme.scss');
25
+ const taskParameters = {
26
+ defaultStyleFile: themeFile,
27
+ renderPrivateVariableTo: 'sass',
28
+ designTokenFilePatterns: [
29
+ `${node_path_1.posix.resolve(srcBasePath, 'style', '*.json')}`,
30
+ `${node_path_1.posix.resolve(srcBasePath, '**', '*.theme.json')}`
31
+ ]
32
+ };
33
+ if (!workspaceProject) {
34
+ logger.warn(`No angular.json found, the task ${taskName} will not be created`);
35
+ return tree;
36
+ }
37
+ registerBuilder(workspaceProject, taskName, taskParameters);
38
+ return tree;
39
+ };
40
+ const generateTemplateRule = (tree, context) => {
41
+ const workspaceProject = projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[projectName] : undefined;
42
+ const srcBasePath = workspaceProject?.sourceRoot || (workspaceProject?.root ? node_path_1.posix.resolve(workspaceProject.root, 'src') : '');
43
+ const themeFolder = node_path_1.posix.resolve(srcBasePath, 'style');
44
+ const rule = (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./templates'), [
45
+ (0, schematics_1.template)({}),
46
+ (0, schematics_1.move)(themeFolder),
47
+ (0, schematics_1.renameTemplateFiles)()
48
+ ]), schematics_1.MergeStrategy.Overwrite)(tree, context);
49
+ return rule;
50
+ };
51
+ const importTheme = (tree, context) => {
52
+ const workspaceProject = projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[projectName] : undefined;
53
+ const srcBasePath = workspaceProject?.sourceRoot || (workspaceProject?.root ? node_path_1.posix.resolve(workspaceProject.root, 'src') : '');
54
+ const styleFile = node_path_1.posix.resolve(srcBasePath, 'styles.scss');
55
+ if (!tree.exists(styleFile)) {
56
+ context.logger.warn(`The theme was not updated as ${styleFile} was not found`);
57
+ return tree;
58
+ }
59
+ return tree.overwrite(styleFile, '@import "./style/theme.scss";\n' + tree.readText(styleFile));
60
+ };
61
+ return (0, schematics_1.chain)([
62
+ registerBuilderRule,
63
+ generateTemplateRule,
64
+ importTheme
65
+ ]);
66
+ };
67
+ exports.registerGenerateCssBuilder = registerGenerateCssBuilder;
68
+ //# sourceMappingURL=register-task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-task.js","sourceRoot":"","sources":["../../../../schematics/ng-add/register-generate-css/register-task.ts"],"names":[],"mappings":";;;AAAA,2DAAyI;AACzI,gDAAqD;AAErD,yCAAkC;AAIlC,SAAS,eAAe,CAAC,gBAAkC,EAAE,QAAgB,EAAE,cAAqC,EAAE,KAAK,GAAG,KAAK;IACjI,gBAAgB,CAAC,SAAS,KAAK,EAAE,CAAC;IAClC,IAAI,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE;QAClD,MAAM,IAAI,KAAK,CAAC,oBAAoB,QAAQ,gBAAgB,CAAC,CAAC;KAC/D;IACD,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC;IACtD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACI,MAAM,0BAA0B,GAAG,CAAC,WAAoB,EAAE,QAAQ,GAAG,cAAc,EAAQ,EAAE;IAClG,MAAM,mBAAmB,GAAS,CAAC,IAAI,EAAE,EAAC,MAAM,EAAC,EAAE,EAAE;QACnD,MAAM,gBAAgB,GAAG,WAAW,CAAC,CAAC,CAAC,IAAA,+BAAkB,EAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACnG,MAAM,WAAW,GAAG,gBAAgB,EAAE,UAAU,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC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+ "$schema": "https://raw.githubusercontent.com/AmadeusITGroup/otter/main/packages/@o3r/design/schemas/design-token.schema.json"
3
+ }
@@ -0,0 +1,6 @@
1
+
2
+ :root {
3
+ /* --- BEGIN THEME Auto-generated --- */
4
+
5
+ /* --- END THEME Auto-generated --- */
6
+ }
@@ -0,0 +1,6 @@
1
+ import type { SchematicOptionObject } from '@o3r/schematics';
2
+ export interface NgAddSchematicsSchema extends SchematicOptionObject {
3
+ /** Project name */
4
+ projectName?: string | undefined;
5
+ }
6
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "ngAddSchematicsSchema",
4
+ "title": "Add Otter Design",
5
+ "description": "ngAdd Otter Design",
6
+ "properties": {
7
+ "projectName": {
8
+ "type": "string",
9
+ "description": "Project name",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ }
14
+ },
15
+ "additionalProperties": true,
16
+ "required": [
17
+ ]
18
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,195 @@
1
+ /** Metadata information added in the design token extension for Metadata extraction */
2
+ export interface DesignTokenMetadata {
3
+ tags?: string[];
4
+ /** Description of the variable */
5
+ label?: string;
6
+ /** Name of a group of variables */
7
+ category?: string;
8
+ }
9
+ /** Design Token Group Extension fields supported by the default renderer */
10
+ export interface DesignTokenGroupExtensions {
11
+ /** Indicate the file where to generate the token */
12
+ o3rTargetFile?: string;
13
+ /**
14
+ * Indicate that the variable does not need to be generated.
15
+ * It is up to the generator to describe how to render private variables.
16
+ * It can choose to ignore the private extension, it can provide a dedicated renderer (for example to prefix it with '_') or it can decide to skip the generation straight to its referenced value.
17
+ */
18
+ o3rPrivate?: boolean;
19
+ /** Indicate that the value of this token is flagged as important */
20
+ o3rImportant?: boolean;
21
+ /** Metadata specific information */
22
+ o3rMetadata?: DesignTokenMetadata;
23
+ /** Scope of the Design Token value */
24
+ o3rScope?: string;
25
+ }
26
+ /** Design Token Extension fields supported by the default renderer */
27
+ export interface DesignTokenExtensions extends DesignTokenGroupExtensions {
28
+ }
29
+ interface DesignTokenBase<T> {
30
+ /** Value of the Token */
31
+ $value: T;
32
+ /** Type of the Design Token */
33
+ $type: string;
34
+ }
35
+ /** Design Token without explicit type (mainly alias) */
36
+ export interface DesignTokenTypeImplicit {
37
+ /** Value of the Token */
38
+ $value: string;
39
+ /** @inheritdoc */
40
+ $type?: undefined;
41
+ }
42
+ /** Design Token Color */
43
+ export interface DesignTokenTypeColor extends DesignTokenBase<string> {
44
+ /** @inheritdoc */
45
+ $type: 'color';
46
+ }
47
+ /** Design Token Dimension */
48
+ export interface DesignTokenTypeDimension extends DesignTokenBase<string> {
49
+ /** @inheritdoc */
50
+ $type: 'dimension';
51
+ }
52
+ /** Design Token Font Family */
53
+ export interface DesignTokenTypeFontFamily extends DesignTokenBase<string> {
54
+ /** @inheritdoc */
55
+ $type: 'fontFamily';
56
+ }
57
+ /** Design Token Duration */
58
+ export interface DesignTokenTypeDuration extends DesignTokenBase<number | string> {
59
+ /** @inheritdoc */
60
+ $type: 'duration';
61
+ }
62
+ type DesignTokenTypeCubicBezierValue = (number | string)[];
63
+ /** Design Token Cubic Bezier */
64
+ export interface DesignTokenTypeCubicBezier extends DesignTokenBase<DesignTokenTypeCubicBezierValue> {
65
+ /** @inheritdoc */
66
+ $type: 'cubicBezier';
67
+ }
68
+ type DesignTokenTypeFontWeightValue = number | string;
69
+ /** Design Token Font Weight */
70
+ export interface DesignTokenTypeFontWeight extends DesignTokenBase<DesignTokenTypeFontWeightValue> {
71
+ /** @inheritdoc */
72
+ $type: 'fontWeight';
73
+ }
74
+ /** Design Token Number */
75
+ export interface DesignTokenTypeNumber extends DesignTokenBase<number | string> {
76
+ /** @inheritdoc */
77
+ $type: 'number';
78
+ }
79
+ type DesignTokenTypeStrokeStyleDetailsValue = {
80
+ dashArray: string[];
81
+ lineCap: 'round' | 'butt' | 'square';
82
+ };
83
+ /** Value of the Design Token Stroke Style */
84
+ export type DesignTokenTypeStrokeStyleValue = DesignTokenTypeStrokeStyleDetailsValue | 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'outset' | 'inset';
85
+ /** Design Token Stroke Style */
86
+ export interface DesignTokenTypeStrokeStyle<T extends DesignTokenTypeStrokeStyleValue = DesignTokenTypeStrokeStyleValue> extends DesignTokenBase<T> {
87
+ /** @inheritdoc */
88
+ $type: 'strokeStyle';
89
+ }
90
+ type DesignTokenTypeBorderValue = {
91
+ color: string;
92
+ width: string;
93
+ style: string | DesignTokenTypeStrokeStyleValue;
94
+ };
95
+ /** Design Token Border */
96
+ export interface DesignTokenTypeBorder extends DesignTokenBase<DesignTokenTypeBorderValue> {
97
+ /** @inheritdoc */
98
+ $type: 'border';
99
+ }
100
+ type DesignTokenTypeTransitionValue = {
101
+ duration: string;
102
+ delay: string;
103
+ timingFunction: string | DesignTokenTypeCubicBezierValue;
104
+ };
105
+ /** Design Token Transition */
106
+ export interface DesignTokenTypeTransition extends DesignTokenBase<DesignTokenTypeTransitionValue> {
107
+ /** @inheritdoc */
108
+ $type: 'transition';
109
+ }
110
+ type DesignTokenTypeShadowValue = {
111
+ color: string;
112
+ offsetX: string;
113
+ offsetY: string;
114
+ blur: string;
115
+ spread: string;
116
+ };
117
+ /** Design Token Shadow */
118
+ export interface DesignTokenTypeShadow extends DesignTokenBase<DesignTokenTypeShadowValue> {
119
+ /** @inheritdoc */
120
+ $type: 'shadow';
121
+ }
122
+ type DesignTokenTypeGradientValue = {
123
+ color: string;
124
+ position: string | number;
125
+ }[];
126
+ /** Design Token Gradient */
127
+ export interface DesignTokenTypeGradient extends DesignTokenBase<DesignTokenTypeGradientValue> {
128
+ /** @inheritdoc */
129
+ $type: 'gradient';
130
+ }
131
+ type DesignTokenTypeTypographyValue = {
132
+ fontFamily: string;
133
+ fontSize: string;
134
+ letterSpacing: string;
135
+ fontWeight: DesignTokenTypeFontWeightValue;
136
+ lineHeight: string | number;
137
+ };
138
+ /** Design Token Typography */
139
+ export interface DesignTokenTypeTypography extends DesignTokenBase<DesignTokenTypeTypographyValue> {
140
+ /** @inheritdoc */
141
+ $type: 'typography';
142
+ }
143
+ /** Common field for the Design Token Groups */
144
+ export interface DesignTokenGroupCommonFields<G extends DesignTokenExtensions> {
145
+ /** Description of the Group */
146
+ $description?: string;
147
+ /** Design Token Extension */
148
+ $extensions?: G;
149
+ }
150
+ /** Common field for the Design Token */
151
+ export type DesignTokenCommonFields<E extends DesignTokenExtensions = DesignTokenExtensions> = DesignTokenGroupCommonFields<E>;
152
+ /** Available Design Token types */
153
+ export type DesignToken<E extends DesignTokenExtensions = DesignTokenExtensions> = DesignTokenCommonFields<E> & (DesignTokenTypeColor | DesignTokenTypeDimension | DesignTokenTypeFontFamily | DesignTokenTypeDuration | DesignTokenTypeCubicBezier | DesignTokenTypeFontWeight | DesignTokenTypeNumber | DesignTokenTypeStrokeStyle | DesignTokenTypeBorder | DesignTokenTypeTransition | DesignTokenTypeShadow | DesignTokenTypeGradient | DesignTokenTypeTypography | DesignTokenTypeImplicit);
154
+ /** Design Token Node (Design Token Group or Item) */
155
+ export type DesignTokenNode<E extends DesignTokenExtensions = DesignTokenExtensions, G extends DesignTokenGroupExtensions = E> = DesignTokenGroup<E, G> | DesignToken<E>;
156
+ /** Design Token Group */
157
+ export type DesignTokenGroup<E extends DesignTokenExtensions = DesignTokenExtensions, G extends DesignTokenGroupExtensions = E> = DesignTokenGroupCommonFields<G> & {
158
+ [x: string]: DesignTokenNode<E, G> | E | string | boolean | undefined;
159
+ };
160
+ /** Context of the Design Token specification document */
161
+ export type DesignTokenContext = {
162
+ /** Base path used to compute the path of the file to render the Tokens into */
163
+ basePath?: string;
164
+ };
165
+ /** Design Token specification */
166
+ export type DesignTokenSpecification<C extends DesignTokenContext = DesignTokenContext, E extends DesignTokenExtensions = DesignTokenExtensions, G extends DesignTokenGroupExtensions = E> = {
167
+ /** Specification as described on {@link https://design-tokens.github.io/community-group/format/} */
168
+ document: DesignTokenGroup<E, G>;
169
+ /** Specification document context information */
170
+ context?: C;
171
+ };
172
+ /**
173
+ * Determine if the Design Token Node is a Token (not a Group)
174
+ * @param node Design Token Node
175
+ */
176
+ export declare const isDesignToken: (node?: any) => node is DesignToken<DesignTokenExtensions>;
177
+ /**
178
+ * Determine if the Design Token Node is a Group (not a Token)
179
+ * @param node Design Token Node
180
+ */
181
+ export declare const isDesignTokenGroup: (node?: any) => node is DesignTokenGroup<DesignTokenExtensions, DesignTokenExtensions>;
182
+ /**
183
+ * Determine if the Stroke Style value is defined or is a reference
184
+ * @param value Stroke Style value
185
+ * @returns true if it is a defined value
186
+ */
187
+ export declare const isTokenTypeStrokeStyleValueComplex: (value?: DesignTokenTypeStrokeStyleValue | string) => value is DesignTokenTypeStrokeStyleDetailsValue;
188
+ /**
189
+ * Determine if the Stroke Style Token has a value defined or is a reference
190
+ * @param node Stroke Style Token
191
+ * @returns true if it is a token with defined value
192
+ */
193
+ export declare const isTokenTypeStrokeStyleComplex: (node?: DesignTokenTypeStrokeStyle) => node is DesignTokenTypeStrokeStyle<DesignTokenTypeStrokeStyleDetailsValue>;
194
+ export {};
195
+ //# sourceMappingURL=design-token-specification.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-token-specification.interface.d.ts","sourceRoot":"","sources":["../../../../src/core/design-token/design-token-specification.interface.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,4EAA4E;AAC5E,MAAM,WAAW,0BAA0B;IACzC,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oEAAoE;IACpE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oCAAoC;IACpC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,sEAAsE;AACtE,MAAM,WAAW,qBAAsB,SAAQ,0BAA0B;CACxE;AAGD,UAAU,eAAe,CAAC,CAAC;IACzB,yBAAyB;IACzB,MAAM,EAAE,CAAC,CAAC;IAEV,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wDAAwD;AACxD,MAAM,WAAW,uBAAuB;IACtC,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IAEf,kBAAkB;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,yBAAyB;AACzB,MAAM,WAAW,oBAAqB,SAAQ,eAAe,CAAC,MAAM,CAAC;IACnE,kBAAkB;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,6BAA6B;AAC7B,MAAM,WAAW,wBAAyB,SAAQ,eAAe,CAAC,MAAM,CAAC;IACvE,kBAAkB;IAClB,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,+BAA+B;AAC/B,MAAM,WAAW,yBAA0B,SAAQ,eAAe,C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M,GAAG,OAAO,GAAG,SAAS,CAAA;CAAE,CAAC;AAE9G,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,iCAAiC;AACjC,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,EAAE,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,EAAE,CAAC,SAAS,0BAA0B,GAAG,CAAC,IAAI;IAC3L,oGAAoG;IACpG,QAAQ,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjC,iDAAiD;IACjD,OAAO,CAAC,EAAE,CAAC,CAAC;CACb,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,UAAW,GAAG,+CAEvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAAW,GAAG,2EAE5C,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,kCAAkC,WAAY,+BAA+B,GAAG,MAAM,oDAElG,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,UAAW,0BAA0B,+EAE9E,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTokenTypeStrokeStyleComplex = exports.isTokenTypeStrokeStyleValueComplex = exports.isDesignTokenGroup = exports.isDesignToken = void 0;
4
+ /**
5
+ * Determine if the Design Token Node is a Token (not a Group)
6
+ * @param node Design Token Node
7
+ */
8
+ const isDesignToken = (node) => {
9
+ return !!node && (typeof node.$type !== 'undefined' || typeof node.$value === 'string');
10
+ };
11
+ exports.isDesignToken = isDesignToken;
12
+ /**
13
+ * Determine if the Design Token Node is a Group (not a Token)
14
+ * @param node Design Token Node
15
+ */
16
+ const isDesignTokenGroup = (node) => {
17
+ return typeof node === 'object' && Object.keys(node).some((k) => !k.startsWith('$'));
18
+ };
19
+ exports.isDesignTokenGroup = isDesignTokenGroup;
20
+ /**
21
+ * Determine if the Stroke Style value is defined or is a reference
22
+ * @param value Stroke Style value
23
+ * @returns true if it is a defined value
24
+ */
25
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
26
+ const isTokenTypeStrokeStyleValueComplex = (value) => {
27
+ return !!value && typeof value !== 'string';
28
+ };
29
+ exports.isTokenTypeStrokeStyleValueComplex = isTokenTypeStrokeStyleValueComplex;
30
+ /**
31
+ * Determine if the Stroke Style Token has a value defined or is a reference
32
+ * @param node Stroke Style Token
33
+ * @returns true if it is a token with defined value
34
+ */
35
+ const isTokenTypeStrokeStyleComplex = (node) => {
36
+ return !!node && (0, exports.isTokenTypeStrokeStyleValueComplex)(node.$value);
37
+ };
38
+ exports.isTokenTypeStrokeStyleComplex = isTokenTypeStrokeStyleComplex;
39
+ //# sourceMappingURL=design-token-specification.interface.js.map