@o3r/style-dictionary 12.2.0-prerelease.4 → 12.2.0-prerelease.7
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.
- package/README.md +92 -69
- package/package.json +10 -10
- package/schematics/ng-add/templates/config.__configExtension__ +16 -12
- package/src/filters/target-file.filter.d.mts +1 -1
- package/src/filters/target-file.filter.d.mts.map +1 -1
- package/src/filters/target-file.filter.mjs +11 -4
- package/src/filters/target-file.filter.mjs.map +1 -1
- package/src/formats/css-formatters/default.formatter.d.mts +7 -0
- package/src/formats/css-formatters/default.formatter.d.mts.map +1 -0
- package/src/formats/css-formatters/default.formatter.mjs +19 -0
- package/src/formats/css-formatters/default.formatter.mjs.map +1 -0
- package/src/formats/css-formatters/gradients.formatter.d.mts +7 -0
- package/src/formats/css-formatters/gradients.formatter.d.mts.map +1 -0
- package/src/formats/css-formatters/gradients.formatter.mjs +32 -0
- package/src/formats/css-formatters/gradients.formatter.mjs.map +1 -0
- package/src/formats/css-formatters/interface.formatter.d.mts +13 -0
- package/src/formats/css-formatters/interface.formatter.d.mts.map +1 -0
- package/src/formats/css-formatters/interface.formatter.mjs +2 -0
- package/src/formats/css-formatters/interface.formatter.mjs.map +1 -0
- package/src/formats/css-formatters/private.formatter.d.mts +7 -0
- package/src/formats/css-formatters/private.formatter.d.mts.map +1 -0
- package/src/formats/css-formatters/private.formatter.mjs +33 -0
- package/src/formats/css-formatters/private.formatter.mjs.map +1 -0
- package/src/formats/css.format.d.mts.map +1 -1
- package/src/formats/css.format.mjs +20 -36
- package/src/formats/css.format.mjs.map +1 -1
- package/src/formats/metadata.format.d.mts.map +1 -1
- package/src/formats/metadata.format.mjs +14 -28
- package/src/formats/metadata.format.mjs.map +1 -1
- package/src/transforms/unit.transform.mjs +1 -1
- package/src/transforms/unit.transform.mjs.map +1 -1
package/README.md
CHANGED
|
@@ -14,9 +14,29 @@ This package is an [Otter Framework Module](https://github.com/AmadeusITGroup/ot
|
|
|
14
14
|
|
|
15
15
|
This package exposes a set of **Hooks** and **Modules** for the [Style Dictionary](https://styledictionary.com/) to enhance the capabilities of Design Tokens.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Get Started
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Set up your [Style Dictionary](https://styledictionary.com/) in your project thanks to the command:
|
|
20
|
+
|
|
21
|
+
```shell
|
|
22
|
+
ng add @o3r/style-dictionary
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
By default, the command will do the following updates:
|
|
26
|
+
|
|
27
|
+
- Add a dev dependency to the [Style Dictionary package](https://www.npmjs.com/package/style-dictionary).
|
|
28
|
+
- Create a minimal [config.mjs](https://styledictionary.com/reference/config/#_top) configuration file with the required setup for CSS and Metadata generation.
|
|
29
|
+
- Add the `generate:theme` and `generate:metadata` scripts in the project *package.json*.
|
|
30
|
+
|
|
31
|
+
You will then be able to customize this setup with your project's specifications:
|
|
32
|
+
|
|
33
|
+
- Customize the [Style Dictionary configuration](https://styledictionary.com/reference/config/#_top) in the generated *config.mjs* file.
|
|
34
|
+
- Add [extensions](https://tr.designtokens.org/format/#extensions) to your source Design Token via the [enhancement mechanism](#enhancement).
|
|
35
|
+
- Configure output files thanks to the [`getTargetFiles` helper](#gettargetfiles).
|
|
36
|
+
|
|
37
|
+
## Enhancement
|
|
38
|
+
|
|
39
|
+
### Design Token Extensions
|
|
20
40
|
|
|
21
41
|
The [Design Tokens](https://tr.designtokens.org/format/#extensions) format allows to provide the `$extensions` property to enhance the Token it is applied to.\
|
|
22
42
|
The property can be applied to the Token directly as follows:
|
|
@@ -60,7 +80,7 @@ or in a dedicated `.extensions.json` file (when the [o3r/json-parser/extensions]
|
|
|
60
80
|
}
|
|
61
81
|
```
|
|
62
82
|
|
|
63
|
-
|
|
83
|
+
### Available Otter Extensions
|
|
64
84
|
|
|
65
85
|
| Extensions | Type | Description | Required hooks |
|
|
66
86
|
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
@@ -75,68 +95,6 @@ or in a dedicated `.extensions.json` file (when the [o3r/json-parser/extensions]
|
|
|
75
95
|
> [!WARNING]
|
|
76
96
|
> The **required hooks** need to be registered to the [Style Dictionary configuration](https://styledictionary.com/reference/config/) to fully support the extension.
|
|
77
97
|
|
|
78
|
-
### Basic Node Configuration Example
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
// style-builder.mjs
|
|
82
|
-
|
|
83
|
-
import { register, getTargetFiles, baseConfiguration } from '@o3r/style-dictionary';
|
|
84
|
-
import StyleDictionary from 'style-dictionary';
|
|
85
|
-
|
|
86
|
-
// Rules to generate different CSS files according to Token name
|
|
87
|
-
const fileRules = {
|
|
88
|
-
colors: 'style/colors.tokens.css',
|
|
89
|
-
'components.panel': 'components/panel/panel.tokens.css'
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const sd = new StyleDictionary({
|
|
93
|
-
...baseConfiguration, // Use basic Otter configuration setup
|
|
94
|
-
usesDtcg: true, // Use Design Token Standard format
|
|
95
|
-
|
|
96
|
-
source: ['tokens/*.tokens.json'], // Design Token files
|
|
97
|
-
include: ['token.extensions.json'], // Custom extensions
|
|
98
|
-
|
|
99
|
-
platforms: {
|
|
100
|
-
// Generate CSS Files
|
|
101
|
-
css: {
|
|
102
|
-
options: {
|
|
103
|
-
outputReferences: true // to output `--var: var(--other-var)` instead of the value of `--other-var`
|
|
104
|
-
},
|
|
105
|
-
transformGroup: 'o3r/css/recommended',
|
|
106
|
-
files: [
|
|
107
|
-
...getTargetFiles(fileRules, { format: 'css' }),
|
|
108
|
-
// default CSS file where generate variables
|
|
109
|
-
{ destination: 'style/default.tokens.css', format: 'css' }
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
cms: {
|
|
113
|
-
options: {
|
|
114
|
-
outputReferences: true
|
|
115
|
-
},
|
|
116
|
-
transformGroup: 'o3r/css/recommended',
|
|
117
|
-
files: [
|
|
118
|
-
{ destination: 'style.metadata.json', format: 'o3r/json/metadata' }
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// Register otter hooks/modules
|
|
125
|
-
register(sd);
|
|
126
|
-
|
|
127
|
-
if (process.env.CSS_ONLY){
|
|
128
|
-
sd.buildPlatform('css');
|
|
129
|
-
} else {
|
|
130
|
-
sd.buildAllPlatforms();
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Can be run with the following command:
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
node ./style-builder.mjs
|
|
138
|
-
```
|
|
139
|
-
|
|
140
98
|
## Modules
|
|
141
99
|
|
|
142
100
|
### [Parsers](https://styledictionary.com/reference/hooks/parsers/)
|
|
@@ -219,14 +177,79 @@ const sd = new StyleDictionary({
|
|
|
219
177
|
plateforms: {
|
|
220
178
|
css: {
|
|
221
179
|
files: [
|
|
222
|
-
...getTargetFiles({rule, { format: 'css' })
|
|
223
|
-
|
|
224
|
-
destination: 'default-file.css'
|
|
225
|
-
}
|
|
180
|
+
...getTargetFiles({ rule, { format: 'css', defaultFile: 'default-file.css' } })
|
|
181
|
+
]
|
|
226
182
|
}
|
|
227
183
|
}
|
|
228
184
|
});
|
|
229
185
|
|
|
230
186
|
register(sd); // Register all Otter modules
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
> [!NOTE]
|
|
190
|
+
> The `format` option will be applied to all the files provided to the `getTargetFiles` function (including `defaultFile`).
|
|
191
|
+
> `defaultFile` defines the default file where variables not matching any rule will be generated.
|
|
192
|
+
|
|
193
|
+
## Advanced
|
|
194
|
+
|
|
195
|
+
### Basic Node Configuration Example
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
// style-builder.mjs
|
|
199
|
+
|
|
200
|
+
import { register, getTargetFiles, baseConfiguration } from '@o3r/style-dictionary';
|
|
201
|
+
import StyleDictionary from 'style-dictionary';
|
|
202
|
+
|
|
203
|
+
// Rules to generate different CSS files according to Token name
|
|
204
|
+
const fileRules = {
|
|
205
|
+
colors: 'style/colors.tokens.css',
|
|
206
|
+
'components.panel': 'components/panel/panel.tokens.css'
|
|
207
|
+
}
|
|
231
208
|
|
|
209
|
+
const sd = new StyleDictionary({
|
|
210
|
+
...baseConfiguration, // Use basic Otter configuration setup
|
|
211
|
+
usesDtcg: true, // Use Design Token Standard format
|
|
232
212
|
|
|
213
|
+
source: ['tokens/*.tokens.json'], // Design Token files
|
|
214
|
+
include: ['token.extensions.json'], // Custom extensions
|
|
215
|
+
|
|
216
|
+
platforms: {
|
|
217
|
+
// Generate CSS Files
|
|
218
|
+
css: {
|
|
219
|
+
options: {
|
|
220
|
+
outputReferences: true // to output `--var: var(--other-var)` instead of the value of `--other-var`
|
|
221
|
+
},
|
|
222
|
+
transformGroup: 'o3r/css/recommended',
|
|
223
|
+
files: [
|
|
224
|
+
...getTargetFiles(fileRules, { format: 'css' }),
|
|
225
|
+
// default CSS file where generate variables
|
|
226
|
+
{ destination: 'style/default.tokens.css', format: 'css' }
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
cms: {
|
|
230
|
+
options: {
|
|
231
|
+
outputReferences: true
|
|
232
|
+
},
|
|
233
|
+
transformGroup: 'o3r/css/recommended',
|
|
234
|
+
files: [
|
|
235
|
+
{ destination: 'style.metadata.json', format: 'o3r/json/metadata' }
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// Register otter hooks/modules
|
|
242
|
+
register(sd);
|
|
243
|
+
|
|
244
|
+
if (process.env.CSS_ONLY){
|
|
245
|
+
sd.buildPlatform('css');
|
|
246
|
+
} else {
|
|
247
|
+
sd.buildAllPlatforms();
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Can be run with the following command:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
node ./style-builder.mjs
|
|
255
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/style-dictionary",
|
|
3
|
-
"version": "12.2.0-prerelease.
|
|
3
|
+
"version": "12.2.0-prerelease.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@angular-devkit/architect": "~0.1902.0",
|
|
44
44
|
"@angular-devkit/schematics": "~19.2.0",
|
|
45
|
-
"@o3r/schematics": "^12.2.0-prerelease.
|
|
45
|
+
"@o3r/schematics": "^12.2.0-prerelease.7",
|
|
46
46
|
"@schematics/angular": "~19.2.0",
|
|
47
47
|
"tslib": "^2.6.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@o3r/core": "^12.2.0-prerelease.
|
|
51
|
-
"@o3r/telemetry": "^12.2.0-prerelease.
|
|
50
|
+
"@o3r/core": "^12.2.0-prerelease.7",
|
|
51
|
+
"@o3r/telemetry": "^12.2.0-prerelease.7",
|
|
52
52
|
"style-dictionary": "^4.3.2",
|
|
53
53
|
"type-fest": "^4.30.1"
|
|
54
54
|
},
|
|
@@ -82,12 +82,12 @@
|
|
|
82
82
|
"@nx/eslint-plugin": "~20.4.0",
|
|
83
83
|
"@nx/jest": "~20.4.0",
|
|
84
84
|
"@nx/js": "~20.4.0",
|
|
85
|
-
"@o3r/build-helpers": "^12.2.0-prerelease.
|
|
86
|
-
"@o3r/core": "^12.2.0-prerelease.
|
|
87
|
-
"@o3r/eslint-plugin": "^12.2.0-prerelease.
|
|
88
|
-
"@o3r/schematics": "^12.2.0-prerelease.
|
|
89
|
-
"@o3r/telemetry": "^12.2.0-prerelease.
|
|
90
|
-
"@o3r/test-helpers": "^12.2.0-prerelease.
|
|
85
|
+
"@o3r/build-helpers": "^12.2.0-prerelease.7",
|
|
86
|
+
"@o3r/core": "^12.2.0-prerelease.7",
|
|
87
|
+
"@o3r/eslint-plugin": "^12.2.0-prerelease.7",
|
|
88
|
+
"@o3r/schematics": "^12.2.0-prerelease.7",
|
|
89
|
+
"@o3r/telemetry": "^12.2.0-prerelease.7",
|
|
90
|
+
"@o3r/test-helpers": "^12.2.0-prerelease.7",
|
|
91
91
|
"@schematics/angular": "~19.2.0",
|
|
92
92
|
"@stylistic/eslint-plugin": "~3.1.0",
|
|
93
93
|
"@types/jest": "~29.5.2",
|
|
@@ -8,36 +8,40 @@ const fileRules = {
|
|
|
8
8
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
/** @type {import('style-dictionary').Config} */
|
|
11
12
|
export default {
|
|
12
13
|
...baseConfig, // Use basic Otter configuration setup
|
|
13
14
|
usesDtcg: true, // Use Design Token Standard format
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
source: [
|
|
17
|
+
// Design Token files
|
|
18
|
+
'*.tokens.json',
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// Custom application extension setup
|
|
21
|
+
'token.extensions.json'
|
|
22
|
+
],
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
platforms: {
|
|
24
25
|
css: {
|
|
25
26
|
options: {
|
|
26
27
|
outputReferences: true
|
|
27
28
|
},
|
|
28
|
-
transformGroup: 'css',
|
|
29
|
+
transformGroup: 'o3r/css/recommended',
|
|
29
30
|
files: [
|
|
30
|
-
...getTargetFiles(fileRules, {
|
|
31
|
+
...getTargetFiles(fileRules, {
|
|
32
|
+
format: 'o3r/css/variable',
|
|
33
|
+
defaultFile: 'default.tokens.css' // default CSS file
|
|
34
|
+
}),
|
|
31
35
|
|
|
32
|
-
//
|
|
33
|
-
{ destination: '
|
|
36
|
+
// All CSS outputted in a single file:
|
|
37
|
+
{ destination: 'all.tokens.css', format: 'o3r/css/variable' }
|
|
34
38
|
]
|
|
35
39
|
},
|
|
36
40
|
cms: {
|
|
37
41
|
options: {
|
|
38
42
|
outputReferences: true
|
|
39
43
|
},
|
|
40
|
-
transformGroup: 'css',
|
|
44
|
+
transformGroup: 'o3r/css/recommended',
|
|
41
45
|
files: [
|
|
42
46
|
{ destination: 'style.metadata.json', format: 'o3r/json/metadata' }
|
|
43
47
|
]
|
|
@@ -6,7 +6,7 @@ interface TargetFileOptions {
|
|
|
6
6
|
/** Root path to calculate the target file */
|
|
7
7
|
rootPath?: string;
|
|
8
8
|
/** Default file if not matching any rule */
|
|
9
|
-
|
|
9
|
+
defaultFile?: string;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Legacy configuration to support inputs from @o3r/design templates
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target-file.filter.d.mts","sourceRoot":"","sources":["../../../src/filters/target-file.filter.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"target-file.filter.d.mts","sourceRoot":"","sources":["../../../src/filters/target-file.filter.mts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,IAAI,EACJ,QAAQ,EACT,MAAM,wBAAwB,CAAC;AAKhC,kCAAkC;AAClC,UAAU,iBAAiB;IACzB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,UAAU,gBAAiB,SAAQ,YAAY;IAC7C,+BAA+B;IAC/B,WAAW,EAAE;QACX,oDAAoD;QACpD,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,gBAAgB,CAAC;CAC1D;AAsBD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,YAAY,EAAE,UAAU,iBAAiB,KAAG,IAAI,EAgCzF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolve, } from 'node:path';
|
|
1
|
+
import { normalize, resolve, } from 'node:path';
|
|
2
2
|
import { deflatten, } from '../helpers/config-deflatten.helpers.mjs';
|
|
3
3
|
const isLegacyConfig = (config) => typeof config.$extensions?.o3rTargetFile === 'string';
|
|
4
4
|
const getPathMap = (rule, path = [], map = new Map()) => {
|
|
@@ -25,8 +25,9 @@ const getPathMap = (rule, path = [], map = new Map()) => {
|
|
|
25
25
|
export const getTargetFiles = (fileRules, options) => {
|
|
26
26
|
const flatterRules = deflatten(fileRules);
|
|
27
27
|
const fileMap = getPathMap(flatterRules);
|
|
28
|
+
const fileMapEntries = [...fileMap.entries()];
|
|
28
29
|
return [
|
|
29
|
-
...
|
|
30
|
+
...fileMapEntries
|
|
30
31
|
.map(([filePath, nodes]) => {
|
|
31
32
|
return {
|
|
32
33
|
destination: options?.rootPath ? resolve(options.rootPath, filePath) : filePath,
|
|
@@ -34,8 +35,14 @@ export const getTargetFiles = (fileRules, options) => {
|
|
|
34
35
|
filter: (token) => nodes.some((path) => path.every((item, idx) => token.path[idx] === item))
|
|
35
36
|
};
|
|
36
37
|
}),
|
|
37
|
-
...(options?.
|
|
38
|
-
? [{
|
|
38
|
+
...(options?.defaultFile
|
|
39
|
+
? [{
|
|
40
|
+
destination: options.rootPath ? resolve(options.rootPath, options.defaultFile) : options.defaultFile,
|
|
41
|
+
format: options?.format,
|
|
42
|
+
filter: (token) => !fileMapEntries
|
|
43
|
+
.filter(([filePath]) => normalize(filePath) !== normalize(options.defaultFile))
|
|
44
|
+
.some(([, nodes]) => nodes.some((path) => path.every((item, idx) => token.path[idx] === item)))
|
|
45
|
+
}]
|
|
39
46
|
: [])
|
|
40
47
|
];
|
|
41
48
|
};
|
|
@@ -1 +1 @@
|
|
|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ACD,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW;oBACpG,MAAM,EAAE,OAAO,EAAE,MAAM;oBACvB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAChB,CAAC,cAAc;yBACZ,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC,OAAO,CAAC,WAAY,CAAC,CAAC;yBAC/E,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAClB,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAClB,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CACpD,CACF;iBACS,CAAC;YACjB,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.formatter.d.mts","sourceRoot":"","sources":["../../../../src/formats/css-formatters/default.formatter.mts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AAKnC;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,gBAkBpC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createPropertyFormatter, } from 'style-dictionary/utils';
|
|
2
|
+
import { createGradientFormatter, } from './gradients.formatter.mjs';
|
|
3
|
+
import { createPrivateFormatter, } from './private.formatter.mjs';
|
|
4
|
+
/**
|
|
5
|
+
* Get default CSS Formatter
|
|
6
|
+
* @param options Options
|
|
7
|
+
*/
|
|
8
|
+
export const getDefaultCssFormatter = (options) => {
|
|
9
|
+
const formatters = [];
|
|
10
|
+
const propertyFormatter = (token) => formatters.reduce((acc, formatter) => formatter(token, acc), undefined);
|
|
11
|
+
const formatterOptions = {
|
|
12
|
+
...options,
|
|
13
|
+
formatter: propertyFormatter
|
|
14
|
+
};
|
|
15
|
+
// formatter list to chain
|
|
16
|
+
formatters.push(createPropertyFormatter(formatterOptions), createGradientFormatter(formatterOptions), createPrivateFormatter(formatterOptions));
|
|
17
|
+
return propertyFormatter;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=default.formatter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.formatter.mjs","sourceRoot":"","sources":["../../../../src/formats/css-formatters/default.formatter.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EACL,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAqB,CAAC,OAAO,EAAE,EAAE;IAClE,MAAM,UAAU,GAAqB,EAAE,CAAC;IACxC,MAAM,iBAAiB,GAAc,CAAC,KAAK,EAAE,EAAE,CAC7C,UAAU,CAAC,MAAM,CAAC,CAAC,GAAuB,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,SAAS,CAAE,CAAC;IAE/F,MAAM,gBAAgB,GAAqB;QACzC,GAAG,OAAO;QACV,SAAS,EAAE,iBAAiB;KAC7B,CAAC;IAEF,0BAA0B;IAC1B,UAAU,CAAC,IAAI,CACb,uBAAuB,CAAC,gBAAgB,CAAC,EACzC,uBAAuB,CAAC,gBAAgB,CAAC,EACzC,sBAAsB,CAAC,gBAAgB,CAAC,CACzC,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FormatterFactory } from './interface.formatter.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve a formatter for a Token with Gradient type
|
|
4
|
+
* @param options Option of gradient formatter generator
|
|
5
|
+
*/
|
|
6
|
+
export declare const createGradientFormatter: FormatterFactory;
|
|
7
|
+
//# sourceMappingURL=gradients.formatter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradients.formatter.d.mts","sourceRoot":"","sources":["../../../../src/formats/css-formatters/gradients.formatter.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAqBnC;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBA4BrC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getReferences, } from 'style-dictionary/utils';
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string -- get the value of serialized object
|
|
3
|
+
const objectString = new Object().toString();
|
|
4
|
+
/**
|
|
5
|
+
* Retrieve a formatter for a Token with Gradient type
|
|
6
|
+
* @param options Option of gradient formatter generator
|
|
7
|
+
*/
|
|
8
|
+
export const createGradientFormatter = (options) => {
|
|
9
|
+
const tokens = options.dictionary.tokens;
|
|
10
|
+
const prefix = options.formatting?.prefix ?? '--';
|
|
11
|
+
return (token, str) => {
|
|
12
|
+
const type = options.usesDtcg ? token.$type : token.type;
|
|
13
|
+
if (!str || !str.includes(objectString) || type !== 'gradient') {
|
|
14
|
+
return str || '';
|
|
15
|
+
}
|
|
16
|
+
const value = options.usesDtcg ? token.original.$value : token.original.value;
|
|
17
|
+
const angle = typeof value.angle === 'number' ? value.angle + 'deg' : value.angle;
|
|
18
|
+
let gradientValue = `${value.type || 'linear'}-gradient(${angle || '0deg'}, ${value.stops
|
|
19
|
+
?.map(({ color, position }) => `${color} ${typeof position === 'number' ? position + '%' : position}`)
|
|
20
|
+
.join(', ')})`;
|
|
21
|
+
if (options.outputReferences && options.formatter) {
|
|
22
|
+
const refs = getReferences(value, options.dictionary.unfilteredTokens || tokens, options);
|
|
23
|
+
if (refs.length > 0) {
|
|
24
|
+
gradientValue = refs.reduce((acc, ref) => {
|
|
25
|
+
return acc.replaceAll(`{${ref.path.join('.')}}`, `var(${prefix}${ref.name})`);
|
|
26
|
+
}, gradientValue);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return str.replace(objectString, gradientValue);
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=gradients.formatter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradients.formatter.mjs","sourceRoot":"","sources":["../../../../src/formats/css-formatters/gradients.formatter.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GACd,MAAM,wBAAwB,CAAC;AAqBhC,sGAAsG;AACtG,MAAM,YAAY,GAAG,IAAI,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAqB,CAAC,OAAO,EAAE,EAAE;IACnE,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;IACzC,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,IAAI,IAAI,CAAC;IAElD,OAAO,CAAC,KAAK,EAAE,GAAG,EAAU,EAAE;QAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QAEzD,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;YAC/D,OAAO,GAAG,IAAI,EAAE,CAAC;QACnB,CAAC;QAED,MAAM,KAAK,GAAiC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QA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+1,13 @@
|
|
|
1
|
+
import type { TransformedToken } from 'style-dictionary/types';
|
|
2
|
+
import { type createPropertyFormatter } from 'style-dictionary/utils';
|
|
3
|
+
/** Type of a formatter function */
|
|
4
|
+
export type Formatter = ReturnType<typeof createPropertyFormatter>;
|
|
5
|
+
/** Type of a formatter function part of a formatter chain */
|
|
6
|
+
export type ChainFormatter = (token: TransformedToken, str?: string) => string;
|
|
7
|
+
/** Options supported by a formatter factory */
|
|
8
|
+
export type FormatterOptions = Parameters<typeof createPropertyFormatter>['0'] & {
|
|
9
|
+
formatter?: Formatter;
|
|
10
|
+
};
|
|
11
|
+
/** Formatter factory type */
|
|
12
|
+
export type FormatterFactory = (options: FormatterOptions) => ChainFormatter;
|
|
13
|
+
//# sourceMappingURL=interface.formatter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.formatter.d.mts","sourceRoot":"","sources":["../../../../src/formats/css-formatters/interface.formatter.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAEhC,mCAAmC;AACnC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEnE,6DAA6D;AAC7D,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAE/E,+CAA+C;AAC/C,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,GAAG,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAE3G,6BAA6B;AAC7B,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.formatter.mjs","sourceRoot":"","sources":["../../../../src/formats/css-formatters/interface.formatter.mts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FormatterFactory } from './interface.formatter.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve a formatter for a private Token
|
|
4
|
+
* @param options Option of private formatter generator
|
|
5
|
+
*/
|
|
6
|
+
export declare const createPrivateFormatter: FormatterFactory;
|
|
7
|
+
//# sourceMappingURL=private.formatter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private.formatter.d.mts","sourceRoot":"","sources":["../../../../src/formats/css-formatters/private.formatter.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,gBA8BpC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getReferences, } from 'style-dictionary/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve a formatter for a private Token
|
|
4
|
+
* @param options Option of private formatter generator
|
|
5
|
+
*/
|
|
6
|
+
export const createPrivateFormatter = (options) => {
|
|
7
|
+
const tokens = options.dictionary.tokens;
|
|
8
|
+
const prefix = options.formatting?.prefix ?? '--';
|
|
9
|
+
const separator = options.formatting?.separator ?? ':';
|
|
10
|
+
const suffix = options.formatting?.suffix ?? ';';
|
|
11
|
+
const replacePrivateTokenReferences = (token, str) => {
|
|
12
|
+
if (!str) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
let strValue = str;
|
|
16
|
+
const originalValue = options.usesDtcg ? token.original.$value : token.original.value;
|
|
17
|
+
if (options.outputReferences && options.formatter) {
|
|
18
|
+
const refs = getReferences(originalValue, options.dictionary.unfilteredTokens || tokens, options);
|
|
19
|
+
const privateRefs = refs.filter((ref) => ref.attributes?.o3rPrivate);
|
|
20
|
+
if (privateRefs.length > 0) {
|
|
21
|
+
privateRefs.forEach((ref) => {
|
|
22
|
+
const refValue = options.formatter(ref);
|
|
23
|
+
const suffixIdx = refValue.indexOf(suffix);
|
|
24
|
+
strValue = strValue.replaceAll(`${prefix}${ref.name}`, `${prefix}${ref.name}, ${refValue.substring(refValue.indexOf(separator) + 1, suffixIdx === -1 ? undefined : suffixIdx).trim()}`);
|
|
25
|
+
strValue = replacePrivateTokenReferences(ref, strValue);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return strValue;
|
|
30
|
+
};
|
|
31
|
+
return replacePrivateTokenReferences;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=private.formatter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"private.formatter.mjs","sourceRoot":"","sources":["../../../../src/formats/css-formatters/private.formatter.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GACd,MAAM,wBAAwB,CAAC;AAOhC;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAqB,CAAC,OAAyB,EAAE,EAAE;IACpF,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;IACzC,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,IAAI,IAAI,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,EAAE,SAAS,IAAI,GAAG,CAAC;IACvD,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,IAAI,GAAG,CAAC;IAEjD,MAAM,6BAA6B,GAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACnE,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,QAAQ,GAAG,GAAG,CAAC;QACnB,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC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],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,
|
|
1
|
+
{"version":3,"file":"css.format.d.mts","sourceRoot":"","sources":["../../../src/formats/css.format.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACP,MAAM,wBAAwB,CAAC;AAehC,eAAO,MAAM,SAAS,EAAE,MA+DvB,CAAC"}
|
|
@@ -1,60 +1,44 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fileHeader, sortByReference, } from 'style-dictionary/utils';
|
|
2
2
|
import { OTTER_NAME_PREFIX, } from '../constants.mjs';
|
|
3
|
+
import { getDefaultCssFormatter, } from './css-formatters/default.formatter.mjs';
|
|
3
4
|
export const cssFormat = {
|
|
4
5
|
name: `${OTTER_NAME_PREFIX}/css/variable`,
|
|
5
6
|
format: async ({ dictionary, file, options }) => {
|
|
6
7
|
const selector = options.selector || ':root';
|
|
7
|
-
const { outputReferences, usesDtcg, formatting } = options;
|
|
8
|
+
const { outputReferences: outRef, usesDtcg, formatting } = options;
|
|
9
|
+
const outputReferences = outRef ?? true;
|
|
8
10
|
const header = await fileHeader({ file, formatting, options });
|
|
9
11
|
const { lineSeparator } = { lineSeparator: '\n', ...formatting };
|
|
10
12
|
const format = 'css';
|
|
11
13
|
const suffix = ';';
|
|
12
14
|
const prefix = '--';
|
|
13
15
|
const separator = ':';
|
|
16
|
+
const baseFormatterOptions = {
|
|
17
|
+
outputReferences,
|
|
18
|
+
outputReferenceFallbacks: false,
|
|
19
|
+
dictionary,
|
|
20
|
+
format,
|
|
21
|
+
formatting: {
|
|
22
|
+
...formatting,
|
|
23
|
+
suffix,
|
|
24
|
+
prefix,
|
|
25
|
+
separator
|
|
26
|
+
},
|
|
27
|
+
themeable: false,
|
|
28
|
+
usesDtcg
|
|
29
|
+
};
|
|
14
30
|
const formattedVariables = () => {
|
|
15
31
|
let allTokens = dictionary.allTokens;
|
|
16
32
|
const tokens = dictionary.tokens;
|
|
17
33
|
if (outputReferences) {
|
|
18
34
|
allTokens = [...allTokens].sort(sortByReference(tokens, { unfilteredTokens: dictionary.unfilteredTokens, usesDtcg }));
|
|
19
35
|
}
|
|
20
|
-
const propertyFormatter =
|
|
21
|
-
outputReferences: outputReferences ?? true,
|
|
22
|
-
outputReferenceFallbacks: false,
|
|
23
|
-
dictionary,
|
|
24
|
-
format,
|
|
25
|
-
formatting: {
|
|
26
|
-
...formatting,
|
|
27
|
-
suffix,
|
|
28
|
-
prefix,
|
|
29
|
-
separator
|
|
30
|
-
},
|
|
31
|
-
themeable: false,
|
|
32
|
-
usesDtcg
|
|
33
|
-
});
|
|
34
|
-
const replacePrivateTokenReferences = (token, strValue) => {
|
|
35
|
-
const originalValue = usesDtcg ? token.original.$value : token.original.value;
|
|
36
|
-
if (outputReferences) {
|
|
37
|
-
const refs = getReferences(originalValue, dictionary.unfilteredTokens || tokens, options);
|
|
38
|
-
const privateRefs = refs.filter((ref) => ref.attributes?.o3rPrivate);
|
|
39
|
-
if (privateRefs.length > 0) {
|
|
40
|
-
privateRefs.forEach((ref) => {
|
|
41
|
-
const refValue = propertyFormatter(ref);
|
|
42
|
-
strValue = strValue.replaceAll(`${prefix}${ref.name}`, `${prefix}${ref.name}, ${refValue.substring(refValue.indexOf(separator) + 1).trim()}`);
|
|
43
|
-
strValue = replacePrivateTokenReferences(ref, strValue);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return strValue;
|
|
48
|
-
};
|
|
49
|
-
const privatePropertyFormatter = (token) => {
|
|
50
|
-
const strValue = propertyFormatter(token);
|
|
51
|
-
return strValue && replacePrivateTokenReferences(token, strValue);
|
|
52
|
-
};
|
|
36
|
+
const propertyFormatter = getDefaultCssFormatter(baseFormatterOptions);
|
|
53
37
|
return allTokens
|
|
54
38
|
.filter(({ attributes }) => !attributes?.private)
|
|
55
39
|
.map((token) => ({
|
|
56
40
|
token,
|
|
57
|
-
strValue:
|
|
41
|
+
strValue: propertyFormatter(token)
|
|
58
42
|
}))
|
|
59
43
|
.filter(({ strValue }) => !!strValue)
|
|
60
44
|
.map(({ token, strValue }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.format.mjs","sourceRoot":"","sources":["../../../src/formats/css.format.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css.format.mjs","sourceRoot":"","sources":["../../../src/formats/css.format.mts"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EACV,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAKhD,MAAM,CAAC,MAAM,SAAS,GAAW;IAC/B,IAAI,EAAE,GAAG,iBAAiB,eAAe;IACzC,MAAM,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC;QAC7C,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QACnE,MAAM,gBAAgB,GAAG,MAAM,IAAI,IAAI,CAAC;QACxC,MAAM,MAAM,GAAW,MAAM,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;QACvE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,CAAC;QACjE,MAAM,MAAM,GAAG,KAAK,CAAC;QACrB,MAAM,MAAM,GAAG,GAAG,CAAC;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC;QACpB,MAAM,SAAS,GAAG,GAAG,CAAC;QAEtB,MAAM,oBAAoB,GAAG;YAC3B,gBAAgB;YAChB,wBAAwB,EAAE,KAAK;YAC/B,UAAU;YACV,MAAM;YACN,UAAU,EAAE;gBACV,GAAG,UAAU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S,CAAC,CAAC;gBAChG,CAAC;gBACD,OAAO,QAAQ,CAAC;YAClB,CAAC,CAAC;iBACD,IAAI,CAAC,aAAa,CAAC,CAAC;QACzB,CAAC,CAAC;QAEF,OAAO,MAAM;cACT,GAAG,QAAQ,KAAK,aAAa,EAAE;cAC/B,kBAAkB,EAAE;cACpB,GAAG,aAAa,IAAI,aAAa,EAAE,CAAC;IAC1C,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.format.d.mts","sourceRoot":"","sources":["../../../src/formats/metadata.format.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAEP,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"metadata.format.d.mts","sourceRoot":"","sources":["../../../src/formats/metadata.format.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAEP,MAAM,wBAAwB,CAAC;AAoBhC,eAAO,MAAM,cAAc,EAAE,MA0E5B,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getReferences, sortByReference, } from 'style-dictionary/utils';
|
|
2
2
|
import { OTTER_NAME_PREFIX, } from '../constants.mjs';
|
|
3
|
+
import { getDefaultCssFormatter, } from './css-formatters/default.formatter.mjs';
|
|
3
4
|
export const metadataFormat = {
|
|
4
5
|
name: `${OTTER_NAME_PREFIX}/json/metadata`,
|
|
5
6
|
format: ({ dictionary, options }) => {
|
|
6
|
-
const { outputReferences, usesDtcg, formatting, keepPrivate } = options;
|
|
7
|
+
const { outputReferences: outRef, usesDtcg, formatting, keepPrivate } = options;
|
|
8
|
+
const outputReferences = outRef ?? true;
|
|
7
9
|
const format = 'css';
|
|
8
10
|
const suffix = ';';
|
|
9
11
|
const prefix = '--';
|
|
@@ -11,13 +13,8 @@ export const metadataFormat = {
|
|
|
11
13
|
const commentStyle = options.formatting?.commentStyle ?? 'none';
|
|
12
14
|
const indentation = options.formatting?.indentation ?? '';
|
|
13
15
|
const { lineSeparator } = { lineSeparator: '\n', ...formatting };
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (outputReferences) {
|
|
17
|
-
allTokens = [...allTokens].sort(sortByReference(tokens, { unfilteredTokens: dictionary.unfilteredTokens, usesDtcg }));
|
|
18
|
-
}
|
|
19
|
-
const propertyFormatter = createPropertyFormatter({
|
|
20
|
-
outputReferences: outputReferences ?? true,
|
|
16
|
+
const baseFormatterOptions = {
|
|
17
|
+
outputReferences,
|
|
21
18
|
outputReferenceFallbacks: false,
|
|
22
19
|
dictionary,
|
|
23
20
|
format,
|
|
@@ -31,31 +28,20 @@ export const metadataFormat = {
|
|
|
31
28
|
},
|
|
32
29
|
themeable: false,
|
|
33
30
|
usesDtcg
|
|
34
|
-
});
|
|
35
|
-
const replacePrivateTokenReferences = (token, strValue) => {
|
|
36
|
-
const originalValue = usesDtcg ? token.original.$value : token.original.value;
|
|
37
|
-
const refs = getReferences(originalValue, tokens);
|
|
38
|
-
const privateRefs = refs.filter((ref) => ref.attributes?.o3rPrivate);
|
|
39
|
-
if (privateRefs.length > 0) {
|
|
40
|
-
privateRefs.forEach((ref) => {
|
|
41
|
-
const refValue = propertyFormatter(ref);
|
|
42
|
-
strValue = strValue.replaceAll(`${prefix}${ref.name}`, `${prefix}${ref.name}, ${refValue.substring(refValue.indexOf(separator) + 1).trim()}`);
|
|
43
|
-
strValue = replacePrivateTokenReferences(ref, strValue);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return strValue;
|
|
47
|
-
};
|
|
48
|
-
const privatePropertyFormatter = (token) => {
|
|
49
|
-
const strValue = propertyFormatter(token);
|
|
50
|
-
return strValue && replacePrivateTokenReferences(token, strValue);
|
|
51
31
|
};
|
|
32
|
+
let allTokens = dictionary.allTokens;
|
|
33
|
+
const tokens = dictionary.tokens;
|
|
34
|
+
if (outputReferences) {
|
|
35
|
+
allTokens = [...allTokens].sort(sortByReference(tokens, { unfilteredTokens: dictionary.unfilteredTokens, usesDtcg }));
|
|
36
|
+
}
|
|
37
|
+
const propertyFormatter = getDefaultCssFormatter(baseFormatterOptions);
|
|
52
38
|
const getValueFromCssVariable = (strValue) => strValue.replace(new RegExp(`^.*?${separator}(.*)$`), '$1').trim();
|
|
53
39
|
const getMetadataReferences = (token) => {
|
|
54
40
|
const originalValue = usesDtcg ? token.original.$value : token.original.value;
|
|
55
41
|
const refs = getReferences(originalValue, tokens);
|
|
56
42
|
return refs
|
|
57
43
|
.map((ref) => ({
|
|
58
|
-
defaultValue: getValueFromCssVariable(
|
|
44
|
+
defaultValue: getValueFromCssVariable(propertyFormatter(ref)),
|
|
59
45
|
name: ref.name,
|
|
60
46
|
references: getMetadataReferences(ref)
|
|
61
47
|
}));
|
|
@@ -64,7 +50,7 @@ export const metadataFormat = {
|
|
|
64
50
|
.filter(({ attributes }) => !!keepPrivate || !attributes?.private)
|
|
65
51
|
.map((token) => ({
|
|
66
52
|
token,
|
|
67
|
-
strValue:
|
|
53
|
+
strValue: propertyFormatter(token)
|
|
68
54
|
}))
|
|
69
55
|
.filter(({ strValue }) => !!strValue)
|
|
70
56
|
.reduce((acc, { token, strValue }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.format.mjs","sourceRoot":"","sources":["../../../src/formats/metadata.format.mts"],"names":[],"mappings":"AAIA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"metadata.format.mjs","sourceRoot":"","sources":["../../../src/formats/metadata.format.mts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EACb,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EACL,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAKhD,MAAM,CAAC,MAAM,cAAc,GAAW;IACpC,IAAI,EAAE,GAAG,iBAAiB,gBAAgB;IAC1C,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,OAAO,E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AI,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;gBAC1G,YAAY,EAAE,uBAAuB,CAAC,QAAQ,CAAC;gBAC/C,UAAU,EAAE,qBAAqB,CAAC,KAAK,CAAC;gBACxC,GAAI,KAAK,CAAC,UAAU,EAAE,WAA+C;aACtE,CAAC;YACF,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC;YACxC,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAiB,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACxG,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unit.transform.mjs","sourceRoot":"","sources":["../../../src/transforms/unit.transform.mts"],"names":[],"mappings":"AAGA,OAAO,EACL,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAK1B,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAEtD,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IAChD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC5C,OAAO,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"unit.transform.mjs","sourceRoot":"","sources":["../../../src/transforms/unit.transform.mts"],"names":[],"mappings":"AAGA,OAAO,EACL,i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