@o3r/design 11.2.0-prerelease.46 → 11.2.0-prerelease.48

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 (30) hide show
  1. package/README.md +19 -0
  2. package/cli/build-design-token.cli.cjs +39 -0
  3. package/cli/build-design-token.cli.cjs.map +1 -0
  4. package/cli/build-design-token.cli.d.cts +3 -0
  5. package/cli/build-design-token.cli.d.cts.map +1 -0
  6. package/cli/generate-css-from-design-token.cli.cjs +3 -1
  7. package/cli/generate-css-from-design-token.cli.cjs.map +1 -1
  8. package/package.json +11 -10
  9. package/src/core/design-token/renderers/design-token/design-token-definition.renderers.d.ts +20 -0
  10. package/src/core/design-token/renderers/design-token/design-token-definition.renderers.d.ts.map +1 -0
  11. package/src/core/design-token/renderers/design-token/design-token-definition.renderers.js +26 -0
  12. package/src/core/design-token/renderers/design-token/design-token-definition.renderers.js.map +1 -0
  13. package/src/core/design-token/renderers/design-token/design-token-updater.renderers.d.ts +10 -0
  14. package/src/core/design-token/renderers/design-token/design-token-updater.renderers.d.ts.map +1 -0
  15. package/src/core/design-token/renderers/design-token/design-token-updater.renderers.js +23 -0
  16. package/src/core/design-token/renderers/design-token/design-token-updater.renderers.js.map +1 -0
  17. package/src/core/design-token/renderers/design-token/design-token-value.renderers.d.ts +10 -0
  18. package/src/core/design-token/renderers/design-token/design-token-value.renderers.d.ts.map +1 -0
  19. package/src/core/design-token/renderers/design-token/design-token-value.renderers.js +20 -0
  20. package/src/core/design-token/renderers/design-token/design-token-value.renderers.js.map +1 -0
  21. package/src/core/design-token/renderers/design-token/index.d.ts +4 -0
  22. package/src/core/design-token/renderers/design-token/index.d.ts.map +1 -0
  23. package/src/core/design-token/renderers/design-token/index.js +7 -0
  24. package/src/core/design-token/renderers/design-token/index.js.map +1 -0
  25. package/src/core/design-token/renderers/index.d.ts +1 -0
  26. package/src/core/design-token/renderers/index.d.ts.map +1 -1
  27. package/src/core/design-token/renderers/index.js +1 -0
  28. package/src/core/design-token/renderers/index.js.map +1 -1
  29. package/src/core/design-token/renderers/json-schema/design-token-updater.renderers.d.ts +1 -1
  30. package/src/core/design-token/renderers/json-schema/design-token-updater.renderers.js +1 -1
package/README.md CHANGED
@@ -67,6 +67,25 @@ The following configurations are available:
67
67
  | **schemaDescription** | *null* | Description of the generated JSON Schema. |
68
68
  | **watch** | false | Enable Watch mode. |
69
69
 
70
+ ## Command Line Interfaces
71
+
72
+ ### o3r-build-design-token
73
+
74
+ The purpose of this CLI is to concatenate different Design Token files and check the potential duplication.
75
+ Can be run with the following command:
76
+
77
+ ```shell
78
+ npx -p @o3r/design o3r-build-design-token <...design-tokens> -o ./my-new-token-file.json
79
+ ```
80
+
81
+ It comes with the following options:
82
+
83
+ | Options | Alias | Description |
84
+ | ---------------- | ----- | --------------------------------------------------------------------- |
85
+ | **`--output`** | `-o` | Path to the file where the resulting Design Token will be generated |
86
+ | **`--template`** | `-t` | Template file to apply to the Design Token files |
87
+ | **`--level`** | `-l` | Number of key to join together when generating the Design Token nodes |
88
+
70
89
  ## Technical documentation
71
90
 
72
91
  Documentation providing explanations on the use and customization of the `Design Token` parser and renderers is available in the [technical documentation](https://github.com/AmadeusITGroup/otter/blob/main/docs/design/TECHNICAL_DOCUMENTATION.md).
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const node_path_1 = require("node:path");
5
+ const node_fs_1 = require("node:fs");
6
+ const public_api_1 = require("../src/public_api");
7
+ const minimist = require("minimist");
8
+ const args = minimist(process.argv.splice(2));
9
+ void (async () => {
10
+ const renderDesignTokenOptions = {
11
+ tokenDefinitionRenderer: (0, public_api_1.getDesignTokenTokenDefinitionRenderer)({ keyJoinNumber: args.l || args.level })
12
+ };
13
+ const output = args.o || args.output;
14
+ const templatePath = args.t || args.template;
15
+ const template = templatePath ? JSON.parse(await node_fs_1.promises.readFile((0, node_path_1.resolve)(process.cwd(), templatePath), { encoding: 'utf8' })) : undefined;
16
+ if (output) {
17
+ renderDesignTokenOptions.determineFileToUpdate = () => (0, node_path_1.resolve)(process.cwd(), output);
18
+ }
19
+ const tokens = (await Promise.all(args._
20
+ .map((file) => (0, node_path_1.isAbsolute)(file) ? (0, node_path_1.normalize)(file) : (0, node_path_1.resolve)(process.cwd(), file))
21
+ .filter((file) => {
22
+ const res = (0, node_fs_1.existsSync)(file);
23
+ if (!res) {
24
+ throw new Error(`The file ${file} does not exist, the process will stop.`);
25
+ }
26
+ return res;
27
+ })
28
+ .map(async (file) => ({ file, parsed: await (0, public_api_1.parseDesignTokenFile)(file, { specificationContext: { template } }) })))).reduce((acc, { file, parsed }) => {
29
+ parsed.forEach((variable, key) => {
30
+ if (acc.has(key)) {
31
+ console.warn(`A duplication of the variable ${key} is found in ${file}.`);
32
+ }
33
+ acc.set(key, variable);
34
+ });
35
+ return acc;
36
+ }, new Map());
37
+ await (0, public_api_1.renderDesignTokens)(tokens, renderDesignTokenOptions);
38
+ })();
39
+ //# sourceMappingURL=build-design-token.cli.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-design-token.cli.cjs","sourceRoot":"","sources":["../../cli/build-design-token.cli.cts"],"names":[],"mappings":";;;AAEA,yCAA2D;AAC3D,qCAAqD;AACrD,kDAAoH;AAEpH,qCAAqC;AAErC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9C,KAAK,CAAC,KAAK,IAAI,EAAE;IACf,MAAM,wBAAwB,GAA+B;QAC3D,uBAAuB,EAAE,IAAA,kDAAqC,EAAC,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;KACxG,CAAC;IAEF,MAAM,MAAM,GAAW,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC;IAC7C,MAAM,YAAY,GAAuB,IAAI,CAAC,CAA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,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE;QAC1D,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;YAC/B,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjB,OAAO,CAAC,IAAI,CAAC,iCAAiC,GAAG,gBAAgB,IAAI,GAAG,CAAC,CAAC;YAC5E,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;IAEd,MAAM,IAAA,+BAAkB,EAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;AAC7D,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=build-design-token.cli.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-design-token.cli.d.cts","sourceRoot":"","sources":["../../cli/build-design-token.cli.cts"],"names":[],"mappings":""}
@@ -23,8 +23,10 @@ void (async () => {
23
23
  })
24
24
  .map(async (file) => ({ file, parsed: await (0, public_api_1.parseDesignTokenFile)(file) })))).reduce((acc, { file, parsed }) => {
25
25
  parsed.forEach((variable, key) => {
26
+ if (acc.has(key)) {
27
+ console.warn(`A duplication of the variable ${key} is found in ${file}.`);
28
+ }
26
29
  acc.set(key, variable);
27
- console.warn(`A duplication of the variable ${key} is found in ${file}`);
28
30
  });
29
31
  return acc;
30
32
  }, new Map());
@@ -1 +1 @@
1
- {"version":3,"file":"generate-css-from-design-token.cli.cjs","sourceRoot":"","sources":["../../cli/generate-css-from-design-token.cli.cts"],"names":[],"mappings":";;;AAEA,yCAA2D;AAC3D,qCAAqC;AACrC,kDAA6E;AAE7E,qCAAqC;AAErC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,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,oBAAU,EAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,YAAY,IAAI,wCAAwC,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;SACD,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,IAAA,iCAAoB,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAC7E,CAAC,CAAC,MAAM,CAAyB,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE;QAC1D,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;YAC/B,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjB,OAAO,CAAC,IAAI,CAAC,iCAAiC,GAAG,gBAAgB,IAAI,GAAG,CAAC,CAAC;YAC5E,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;IAEd,MAAM,IAAA,+BAAkB,EAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;AAC7D,CAAC,CAAC,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/design",
3
- "version": "11.2.0-prerelease.46",
3
+ "version": "11.2.0-prerelease.48",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -43,6 +43,7 @@
43
43
  }
44
44
  },
45
45
  "bin": {
46
+ "o3r-build-design-token": "./cli/build-design-token.cli.cjs",
46
47
  "o3r-css-from-design-token": "./cli/generate-css-from-design-token.cli.cjs"
47
48
  },
48
49
  "dependencies": {
@@ -52,9 +53,9 @@
52
53
  "tslib": "^2.6.2"
53
54
  },
54
55
  "peerDependencies": {
55
- "@o3r/core": "^11.2.0-prerelease.46",
56
- "@o3r/schematics": "^11.2.0-prerelease.46",
57
- "@o3r/styling": "^11.2.0-prerelease.46",
56
+ "@o3r/core": "^11.2.0-prerelease.48",
57
+ "@o3r/schematics": "^11.2.0-prerelease.48",
58
+ "@o3r/styling": "^11.2.0-prerelease.48",
58
59
  "chokidar": "^3.5.2",
59
60
  "globby": "^11.1.0",
60
61
  "sass": "~1.77.0"
@@ -100,12 +101,12 @@
100
101
  "@nx/eslint-plugin": "~19.5.0",
101
102
  "@nx/jest": "~19.5.0",
102
103
  "@nx/js": "~19.5.0",
103
- "@o3r/build-helpers": "^11.2.0-prerelease.46",
104
- "@o3r/core": "^11.2.0-prerelease.46",
105
- "@o3r/eslint-plugin": "^11.2.0-prerelease.46",
106
- "@o3r/schematics": "^11.2.0-prerelease.46",
107
- "@o3r/styling": "^11.2.0-prerelease.46",
108
- "@o3r/test-helpers": "^11.2.0-prerelease.46",
104
+ "@o3r/build-helpers": "^11.2.0-prerelease.48",
105
+ "@o3r/core": "^11.2.0-prerelease.48",
106
+ "@o3r/eslint-plugin": "^11.2.0-prerelease.48",
107
+ "@o3r/schematics": "^11.2.0-prerelease.48",
108
+ "@o3r/styling": "^11.2.0-prerelease.48",
109
+ "@o3r/test-helpers": "^11.2.0-prerelease.48",
109
110
  "@schematics/angular": "~18.2.0",
110
111
  "@stylistic/eslint-plugin-ts": "~2.4.0",
111
112
  "@types/jest": "~29.5.2",
@@ -0,0 +1,20 @@
1
+ import type { TokenValueRenderer } from '../../parsers/design-token-parser.interface';
2
+ import type { TokenDefinitionRenderer } from '../design-token.renderer.interface';
3
+ /** Options for {@link getDesignTokenTokenDefinitionRenderer} */
4
+ export interface DesignTokenTokenDefinitionRendererOptions {
5
+ /**
6
+ * Custom Design Token value renderer
7
+ */
8
+ tokenValueRenderer?: TokenValueRenderer;
9
+ /**
10
+ * Number of key to join together
11
+ * @default 0
12
+ */
13
+ keyJoinNumber?: undefined | number;
14
+ }
15
+ /**
16
+ * Retrieve the Design Token Variable renderer for DesignToken
17
+ * @param options
18
+ */
19
+ export declare const getDesignTokenTokenDefinitionRenderer: (options?: DesignTokenTokenDefinitionRendererOptions) => TokenDefinitionRenderer;
20
+ //# sourceMappingURL=design-token-definition.renderers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-token-definition.renderers.d.ts","sourceRoot":"","sources":["../../../../../../src/core/design-token/renderers/design-token/design-token-definition.renderers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACpH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAGlF,gEAAgE;AAChE,MAAM,WAAW,yCAAyC;IACxD;;OAEG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IAExC;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CACpC;AAED;;;GAGG;AACH,eAAO,MAAM,qCAAqC,aAAc,yCAAyC,KAAG,uBAiB3G,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDesignTokenTokenDefinitionRenderer = void 0;
4
+ const design_token_value_renderers_1 = require("./design-token-value.renderers");
5
+ /**
6
+ * Retrieve the Design Token Variable renderer for DesignToken
7
+ * @param options
8
+ */
9
+ const getDesignTokenTokenDefinitionRenderer = (options) => {
10
+ const tokenValueRenderer = options?.tokenValueRenderer || (0, design_token_value_renderers_1.getDesignTokenTokenValueRenderer)();
11
+ const renderer = (variable, variableSet) => {
12
+ const variableValue = tokenValueRenderer(variable, variableSet);
13
+ const splitNodeIndex = (options?.keyJoinNumber || 0) + 1;
14
+ const nodeNames = variable.tokenReferenceName.split('.');
15
+ const rootName = nodeNames.slice(0, splitNodeIndex).join('.');
16
+ const node = nodeNames.slice(splitNodeIndex)
17
+ .reverse()
18
+ .reduce((acc, cur) => {
19
+ return { [cur]: acc };
20
+ }, variableValue);
21
+ return JSON.stringify({ [rootName]: node });
22
+ };
23
+ return renderer;
24
+ };
25
+ exports.getDesignTokenTokenDefinitionRenderer = getDesignTokenTokenDefinitionRenderer;
26
+ //# sourceMappingURL=design-token-definition.renderers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-token-definition.renderers.js","sourceRoot":"","sources":["../../../../../../src/core/design-token/renderers/design-token/design-token-definition.renderers.ts"],"names":[],"mappings":";;;AAEA,iFAAkF;AAgBlF;;;GAGG;AACI,MAAM,qCAAqC,GAAG,CAAC,OAAmD,EAA2B,EAAE;IACpI,MAAM,kBAAkB,GAAG,OAAO,EAAE,kBAAkB,IAAI,IAAA,+DAAgC,GAAE,CAAC;IAE7F,MAAM,QAAQ,GAAG,CAAC,QAAsC,EAAE,WAAsD,EAAE,EAAE;QAClH,MAAM,aAAa,GAAG,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAEhE,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,aAAa,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACzD,MAAM,SAAS,GAAG,QAAQ,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9D,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC;aACzC,OAAO,EAAE;aACT,MAAM,CAAC,CAAC,GAAiC,EAAE,GAAG,EAAE,EAAE;YACjD,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC;QACxB,CAAC,EAAE,aAAa,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAjBW,QAAA,qCAAqC,yCAiBhD"}
@@ -0,0 +1,10 @@
1
+ import type { DesignContentFileUpdater } from '../design-token.renderer.interface';
2
+ /** Options for {@link getDesignTokenStyleContentUpdater} */
3
+ export interface DesignTokenStyleContentUpdaterOptions {
4
+ }
5
+ /**
6
+ * Retrieve a Content Updater function for Metadata generator
7
+ * @param _options
8
+ */
9
+ export declare const getDesignTokenStyleContentUpdater: (_options?: DesignTokenStyleContentUpdaterOptions) => DesignContentFileUpdater;
10
+ //# sourceMappingURL=design-token-updater.renderers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-token-updater.renderers.d.ts","sourceRoot":"","sources":["../../../../../../src/core/design-token/renderers/design-token/design-token-updater.renderers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAEnF,4DAA4D;AAC5D,MAAM,WAAW,qCAAqC;CACrD;AAUD;;;GAGG;AACH,eAAO,MAAM,iCAAiC,cAAe,qCAAqC,KAAG,wBAMpG,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDesignTokenStyleContentUpdater = void 0;
4
+ const mergeValue = (tokenObject, newValue) => {
5
+ return Object.entries(newValue)
6
+ .reduce((acc, [key, value]) => {
7
+ acc[key] = acc[key] ? mergeValue(acc[key], value) : value;
8
+ return acc;
9
+ }, { ...tokenObject });
10
+ };
11
+ /**
12
+ * Retrieve a Content Updater function for Metadata generator
13
+ * @param _options
14
+ */
15
+ const getDesignTokenStyleContentUpdater = (_options) => {
16
+ return (variables) => {
17
+ const nodes = JSON.parse(`[${variables.join(',')}]`);
18
+ const res = nodes.reduce(mergeValue, {});
19
+ return JSON.stringify(res, null, 2);
20
+ };
21
+ };
22
+ exports.getDesignTokenStyleContentUpdater = getDesignTokenStyleContentUpdater;
23
+ //# sourceMappingURL=design-token-updater.renderers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-token-updater.renderers.js","sourceRoot":"","sources":["../../../../../../src/core/design-token/renderers/design-token/design-token-updater.renderers.ts"],"names":[],"mappings":";;;AAMA,MAAM,UAAU,GAAG,CAAC,WAAgC,EAAE,QAA6B,EAAE,EAAE;IACrF,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC5B,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC5B,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC1D,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,iCAAiC,GAAG,CAAC,QAAgD,EAA4B,EAAE;IAC9H,OAAO,CAAC,SAAmB,EAAE,EAAE;QAC7B,MAAM,KAAK,GAA0B,IAAI,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5E,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,EAAyB,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,iCAAiC,qCAM5C"}
@@ -0,0 +1,10 @@
1
+ import type { TokenValueRenderer } from '../../parsers/design-token-parser.interface';
2
+ /** Options for {@link getDesignTokenTokenValueRenderer} */
3
+ export interface DesignTokenTokenValueRendererOptions {
4
+ }
5
+ /**
6
+ * Retrieve the Design Token value renderer
7
+ * @param _options
8
+ */
9
+ export declare const getDesignTokenTokenValueRenderer: (_options?: DesignTokenTokenValueRendererOptions) => TokenValueRenderer;
10
+ //# sourceMappingURL=design-token-value.renderers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-token-value.renderers.d.ts","sourceRoot":"","sources":["../../../../../../src/core/design-token/renderers/design-token/design-token-value.renderers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgC,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEpH,2DAA2D;AAC3D,MAAM,WAAW,oCAAoC;CACpD;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,cAAe,oCAAoC,KAAG,kBAYlG,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDesignTokenTokenValueRenderer = void 0;
4
+ /**
5
+ * Retrieve the Design Token value renderer
6
+ * @param _options
7
+ */
8
+ const getDesignTokenTokenValueRenderer = (_options) => {
9
+ const renderer = (variable, _variableSet) => {
10
+ const variableValue = {
11
+ ...variable.node,
12
+ $description: variable.description,
13
+ $extensions: variable.extensions
14
+ };
15
+ return JSON.stringify(variableValue);
16
+ };
17
+ return renderer;
18
+ };
19
+ exports.getDesignTokenTokenValueRenderer = getDesignTokenTokenValueRenderer;
20
+ //# sourceMappingURL=design-token-value.renderers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-token-value.renderers.js","sourceRoot":"","sources":["../../../../../../src/core/design-token/renderers/design-token/design-token-value.renderers.ts"],"names":[],"mappings":";;;AAOA;;;GAGG;AACI,MAAM,gCAAgC,GAAG,CAAC,QAA+C,EAAsB,EAAE;IAEtH,MAAM,QAAQ,GAAG,CAAC,QAAsC,EAAE,YAAuD,EAAE,EAAE;QACnH,MAAM,aAAa,GAAgB;YACjC,GAAG,QAAQ,CAAC,IAAI;YAChB,YAAY,EAAE,QAAQ,CAAC,WAAW;YAClC,WAAW,EAAE,QAAQ,CAAC,UAAU;SACjC,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IACvC,CAAC,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAZW,QAAA,gCAAgC,oCAY3C"}
@@ -0,0 +1,4 @@
1
+ export * from './design-token-definition.renderers';
2
+ export * from './design-token-value.renderers';
3
+ export * from './design-token-updater.renderers';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core/design-token/renderers/design-token/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./design-token-definition.renderers"), exports);
5
+ tslib_1.__exportStar(require("./design-token-value.renderers"), exports);
6
+ tslib_1.__exportStar(require("./design-token-updater.renderers"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/design-token/renderers/design-token/index.ts"],"names":[],"mappings":";;;AAAA,8EAAoD;AACpD,yEAA+C;AAC/C,2EAAiD"}
@@ -5,4 +5,5 @@ export * from './design-token.renderer.interface';
5
5
  export * from './json-schema/index';
6
6
  export * from './metadata/index';
7
7
  export * from './sass/index';
8
+ export * from './design-token/index';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/design-token/renderers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/design-token/renderers/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC"}
@@ -8,4 +8,5 @@ tslib_1.__exportStar(require("./design-token.renderer.interface"), exports);
8
8
  tslib_1.__exportStar(require("./json-schema/index"), exports);
9
9
  tslib_1.__exportStar(require("./metadata/index"), exports);
10
10
  tslib_1.__exportStar(require("./sass/index"), exports);
11
+ tslib_1.__exportStar(require("./design-token/index"), exports);
11
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/design-token/renderers/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,wEAA8C;AAC9C,wEAA8C;AAC9C,4EAAkD;AAClD,8DAAoC;AACpC,2DAAiC;AACjC,uDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/design-token/renderers/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,wEAA8C;AAC9C,wEAA8C;AAC9C,4EAAkD;AAClD,8DAAoC;AACpC,2DAAiC;AACjC,uDAA6B;AAC7B,+DAAqC"}
@@ -7,7 +7,7 @@ export interface JsonSchemaStyleContentUpdaterOptions {
7
7
  id?: string;
8
8
  }
9
9
  /**
10
- * Retrieve a Content Updater function for Metadata generator
10
+ * Retrieve a Content Updater function for Json Schema generator
11
11
  * @param options
12
12
  */
13
13
  export declare const getJsonSchemaStyleContentUpdater: (options?: JsonSchemaStyleContentUpdaterOptions) => DesignContentFileUpdater;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getJsonSchemaStyleContentUpdater = void 0;
4
4
  /**
5
- * Retrieve a Content Updater function for Metadata generator
5
+ * Retrieve a Content Updater function for Json Schema generator
6
6
  * @param options
7
7
  */
8
8
  const getJsonSchemaStyleContentUpdater = (options) => {