@tokenami/config 0.0.28 → 0.0.30
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/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +240 -244
- package/dist/index.mjs +240 -244
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -194,7 +194,7 @@ type Validated<T> = {
|
|
|
194
194
|
type ThemeKey = 'alpha' | 'border' | 'color' | 'ease' | 'font-size' | 'leading' | 'line-style' | 'radii' | 'size' | 'shadow' | 'tracking' | 'transition' | 'weight' | 'z' | (string & {});
|
|
195
195
|
type ThemeValues = Record<string, string>;
|
|
196
196
|
type Theme = Partial<Record<ThemeKey, ThemeValues>>;
|
|
197
|
-
type Aliases = Record<string, readonly
|
|
197
|
+
type Aliases = Record<string, readonly CSSProperty[]>;
|
|
198
198
|
type PropertiesOptions = readonly ('grid' | ThemeKey)[];
|
|
199
199
|
type DeepReadonly<T> = {
|
|
200
200
|
readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K];
|
|
@@ -226,7 +226,7 @@ declare const createConfig: <T extends Config>(obj: Exact<Config, T>) => DeepRea
|
|
|
226
226
|
declare function getTokenPropertyName(tokenProperty: TokenProperty): string;
|
|
227
227
|
declare function getTokenPropertySplit(tokenProperty: TokenProperty): {
|
|
228
228
|
alias: string;
|
|
229
|
-
variants:
|
|
229
|
+
variants: string[];
|
|
230
230
|
};
|
|
231
231
|
type PropertyParts = {
|
|
232
232
|
name: string;
|
|
@@ -241,7 +241,7 @@ declare function getTokenValueParts(tokenValue: TokenValue): {
|
|
|
241
241
|
themeKey: string;
|
|
242
242
|
token: string;
|
|
243
243
|
};
|
|
244
|
-
declare function getCSSPropertiesForAlias(alias: string, aliases: Config['aliases']):
|
|
244
|
+
declare function getCSSPropertiesForAlias(alias: string, aliases: Config['aliases']): CSSProperty[];
|
|
245
245
|
|
|
246
246
|
declare const mapShorthandToLonghands: {
|
|
247
247
|
all: never[];
|
package/dist/index.d.ts
CHANGED
|
@@ -194,7 +194,7 @@ type Validated<T> = {
|
|
|
194
194
|
type ThemeKey = 'alpha' | 'border' | 'color' | 'ease' | 'font-size' | 'leading' | 'line-style' | 'radii' | 'size' | 'shadow' | 'tracking' | 'transition' | 'weight' | 'z' | (string & {});
|
|
195
195
|
type ThemeValues = Record<string, string>;
|
|
196
196
|
type Theme = Partial<Record<ThemeKey, ThemeValues>>;
|
|
197
|
-
type Aliases = Record<string, readonly
|
|
197
|
+
type Aliases = Record<string, readonly CSSProperty[]>;
|
|
198
198
|
type PropertiesOptions = readonly ('grid' | ThemeKey)[];
|
|
199
199
|
type DeepReadonly<T> = {
|
|
200
200
|
readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K];
|
|
@@ -226,7 +226,7 @@ declare const createConfig: <T extends Config>(obj: Exact<Config, T>) => DeepRea
|
|
|
226
226
|
declare function getTokenPropertyName(tokenProperty: TokenProperty): string;
|
|
227
227
|
declare function getTokenPropertySplit(tokenProperty: TokenProperty): {
|
|
228
228
|
alias: string;
|
|
229
|
-
variants:
|
|
229
|
+
variants: string[];
|
|
230
230
|
};
|
|
231
231
|
type PropertyParts = {
|
|
232
232
|
name: string;
|
|
@@ -241,7 +241,7 @@ declare function getTokenValueParts(tokenValue: TokenValue): {
|
|
|
241
241
|
themeKey: string;
|
|
242
242
|
token: string;
|
|
243
243
|
};
|
|
244
|
-
declare function getCSSPropertiesForAlias(alias: string, aliases: Config['aliases']):
|
|
244
|
+
declare function getCSSPropertiesForAlias(alias: string, aliases: Config['aliases']): CSSProperty[];
|
|
245
245
|
|
|
246
246
|
declare const mapShorthandToLonghands: {
|
|
247
247
|
all: never[];
|
package/dist/index.js
CHANGED
|
@@ -44,6 +44,246 @@ __export(src_exports, {
|
|
|
44
44
|
});
|
|
45
45
|
module.exports = __toCommonJS(src_exports);
|
|
46
46
|
|
|
47
|
+
// src/config.ts
|
|
48
|
+
var gridPropertyRegex = /--_grid/;
|
|
49
|
+
var GridProperty = {
|
|
50
|
+
safeParse: (input) => validate(gridPropertyRegex, input)
|
|
51
|
+
};
|
|
52
|
+
function gridProperty() {
|
|
53
|
+
return `--_grid`;
|
|
54
|
+
}
|
|
55
|
+
var gridValueRegex = /^\d+/;
|
|
56
|
+
var GridValue = {
|
|
57
|
+
safeParse: (input) => validate(gridValueRegex, input)
|
|
58
|
+
};
|
|
59
|
+
var tokenPropertyRegex = /(?<!var\()--(\w([\w-]+)?)/;
|
|
60
|
+
var TokenProperty = {
|
|
61
|
+
safeParse: (input) => validate(tokenPropertyRegex, input)
|
|
62
|
+
};
|
|
63
|
+
function tokenProperty(name) {
|
|
64
|
+
return `--${name}`;
|
|
65
|
+
}
|
|
66
|
+
var variantPropertyRegex = /(?<!var\()--((\w)([\w-]+)_([\w-]+))/;
|
|
67
|
+
var VariantProperty = {
|
|
68
|
+
safeParse: (input) => validate(variantPropertyRegex, input)
|
|
69
|
+
};
|
|
70
|
+
function variantProperty(variant, name) {
|
|
71
|
+
return `--${variant}_${name}`;
|
|
72
|
+
}
|
|
73
|
+
var tokenValueRegex = /var\((--([\w-]+)_([\w-]+))\)/;
|
|
74
|
+
var TokenValue = {
|
|
75
|
+
safeParse: (input) => validate(tokenValueRegex, input)
|
|
76
|
+
};
|
|
77
|
+
function tokenValue(themeKey, name) {
|
|
78
|
+
return `var(--${themeKey}_${name})`;
|
|
79
|
+
}
|
|
80
|
+
var arbitraryValueRegex = /var\(---,(.+)\)/;
|
|
81
|
+
var ArbitraryValue = {
|
|
82
|
+
safeParse: (input) => validate(arbitraryValueRegex, input)
|
|
83
|
+
};
|
|
84
|
+
function arbitraryValue(value) {
|
|
85
|
+
return `var(---,${value})`;
|
|
86
|
+
}
|
|
87
|
+
function validate(regex, input) {
|
|
88
|
+
try {
|
|
89
|
+
const inputString = String(input);
|
|
90
|
+
if (regex.test(inputString)) {
|
|
91
|
+
return { success: true, output: inputString };
|
|
92
|
+
} else {
|
|
93
|
+
return { success: false };
|
|
94
|
+
}
|
|
95
|
+
} catch (e) {
|
|
96
|
+
return { success: false };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
var createConfig = (obj) => {
|
|
100
|
+
return obj;
|
|
101
|
+
};
|
|
102
|
+
function getTokenPropertyName(tokenProperty2) {
|
|
103
|
+
return tokenProperty2.replace(tokenPropertyRegex, "$1");
|
|
104
|
+
}
|
|
105
|
+
function getTokenPropertySplit(tokenProperty2) {
|
|
106
|
+
const name = getTokenPropertyName(tokenProperty2);
|
|
107
|
+
const [alias, ...variants] = name.split("_").reverse();
|
|
108
|
+
return { alias, variants: variants.reverse() };
|
|
109
|
+
}
|
|
110
|
+
function getTokenPropertyParts(tokenProperty2, config) {
|
|
111
|
+
var _a, _b, _c;
|
|
112
|
+
const name = getTokenPropertyName(tokenProperty2);
|
|
113
|
+
const { alias, variants } = getTokenPropertySplit(tokenProperty2);
|
|
114
|
+
const [firstVariant, secondVariant] = variants;
|
|
115
|
+
const firstSelector = ((_a = config.selectors) == null ? void 0 : _a[firstVariant]) && firstVariant;
|
|
116
|
+
const secondSelector = ((_b = config.selectors) == null ? void 0 : _b[secondVariant]) && secondVariant;
|
|
117
|
+
const responsive = ((_c = config.responsive) == null ? void 0 : _c[firstVariant]) && firstVariant;
|
|
118
|
+
const selector = firstSelector || secondSelector;
|
|
119
|
+
const validVariant = [responsive, selector].filter(Boolean).join("_");
|
|
120
|
+
if (firstVariant && variantProperty(validVariant, alias) !== tokenProperty2)
|
|
121
|
+
return null;
|
|
122
|
+
return { name, alias, responsive, selector, variant: validVariant };
|
|
123
|
+
}
|
|
124
|
+
function getTokenValueParts(tokenValue2) {
|
|
125
|
+
const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
|
|
126
|
+
return { property, themeKey, token };
|
|
127
|
+
}
|
|
128
|
+
function getCSSPropertiesForAlias(alias, aliases) {
|
|
129
|
+
return (aliases == null ? void 0 : aliases[alias]) || [alias];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// src/config.default.ts
|
|
133
|
+
var defaultConfig = createConfig({
|
|
134
|
+
include: [],
|
|
135
|
+
grid: "0.25rem",
|
|
136
|
+
responsive: {},
|
|
137
|
+
theme: {},
|
|
138
|
+
aliases: {},
|
|
139
|
+
selectors: {
|
|
140
|
+
after: "&::after",
|
|
141
|
+
before: "&::before",
|
|
142
|
+
even: "&:nth-child(even)",
|
|
143
|
+
odd: "&:nth-child(odd)",
|
|
144
|
+
"first-child": "&:first-child",
|
|
145
|
+
"last-child": "&:last-child",
|
|
146
|
+
placeholder: "&::placeholder",
|
|
147
|
+
hover: "&:hover",
|
|
148
|
+
focus: "&:focus",
|
|
149
|
+
"focus-visible": "&:focus-visible",
|
|
150
|
+
"focus-within": "&:focus-within",
|
|
151
|
+
active: "&:active",
|
|
152
|
+
disabled: "&:disabled"
|
|
153
|
+
},
|
|
154
|
+
properties: {
|
|
155
|
+
"accent-color": ["color"],
|
|
156
|
+
animation: ["anim"],
|
|
157
|
+
"animation-timing-function": ["ease"],
|
|
158
|
+
background: ["color", "surface"],
|
|
159
|
+
"background-color": ["color"],
|
|
160
|
+
"background-image": ["surface"],
|
|
161
|
+
"background-position": ["grid"],
|
|
162
|
+
"background-position-x": ["grid"],
|
|
163
|
+
"background-position-y": ["grid"],
|
|
164
|
+
"block-size": ["grid", "size"],
|
|
165
|
+
border: ["border"],
|
|
166
|
+
"border-block": ["border"],
|
|
167
|
+
"border-block-color": ["color"],
|
|
168
|
+
"border-block-end": ["border"],
|
|
169
|
+
"border-block-end-color": ["color"],
|
|
170
|
+
"border-block-end-style": ["line-style"],
|
|
171
|
+
"border-block-start": ["border"],
|
|
172
|
+
"border-block-start-color": ["color"],
|
|
173
|
+
"border-block-start-style": ["line-style"],
|
|
174
|
+
"border-block-style": ["line-style"],
|
|
175
|
+
"border-bottom": ["border"],
|
|
176
|
+
"border-bottom-color": ["color"],
|
|
177
|
+
"border-bottom-left-radius": ["radii"],
|
|
178
|
+
"border-bottom-right-radius": ["radii"],
|
|
179
|
+
"border-bottom-style": ["line-style"],
|
|
180
|
+
"border-color": ["color"],
|
|
181
|
+
"border-end-end-radius": ["radii"],
|
|
182
|
+
"border-end-start-radius": ["radii"],
|
|
183
|
+
"border-inline": ["border"],
|
|
184
|
+
"border-inline-color": ["color"],
|
|
185
|
+
"border-inline-end": ["border"],
|
|
186
|
+
"border-inline-end-color": ["color"],
|
|
187
|
+
"border-inline-end-style": ["line-style"],
|
|
188
|
+
"border-inline-start": ["border"],
|
|
189
|
+
"border-inline-start-color": ["color"],
|
|
190
|
+
"border-inline-start-style": ["line-style"],
|
|
191
|
+
"border-inline-style": ["line-style"],
|
|
192
|
+
"border-left": ["border"],
|
|
193
|
+
"border-left-color": ["color"],
|
|
194
|
+
"border-left-style": ["line-style"],
|
|
195
|
+
"border-radius": ["radii"],
|
|
196
|
+
"border-right": ["border"],
|
|
197
|
+
"border-right-color": ["color"],
|
|
198
|
+
"border-right-style": ["line-style"],
|
|
199
|
+
"border-start-end-radius": ["radii"],
|
|
200
|
+
"border-start-start-radius": ["radii"],
|
|
201
|
+
"border-style": ["line-style"],
|
|
202
|
+
"border-top": ["border"],
|
|
203
|
+
"border-top-color": ["color"],
|
|
204
|
+
"border-top-left-radius": ["radii"],
|
|
205
|
+
"border-top-right-radius": ["radii"],
|
|
206
|
+
"border-top-style": ["line-style"],
|
|
207
|
+
bottom: ["grid"],
|
|
208
|
+
"box-shadow": ["shadow"],
|
|
209
|
+
"caret-color": ["color"],
|
|
210
|
+
color: ["color"],
|
|
211
|
+
"column-gap": ["grid"],
|
|
212
|
+
"column-rule-color": ["color"],
|
|
213
|
+
"column-rule-width": ["grid"],
|
|
214
|
+
"column-width": ["grid", "size"],
|
|
215
|
+
"flex-basis": ["grid", "size"],
|
|
216
|
+
"font-family": ["font"],
|
|
217
|
+
"font-size": ["font-size"],
|
|
218
|
+
"font-weight": ["weight"],
|
|
219
|
+
gap: ["grid"],
|
|
220
|
+
height: ["grid", "size"],
|
|
221
|
+
"inline-size": ["grid", "size"],
|
|
222
|
+
inset: ["grid"],
|
|
223
|
+
"inset-block": ["grid"],
|
|
224
|
+
"inset-block-end": ["grid"],
|
|
225
|
+
"inset-block-start": ["grid"],
|
|
226
|
+
"inset-inline": ["grid"],
|
|
227
|
+
"inset-inline-end": ["grid"],
|
|
228
|
+
"inset-inline-start": ["grid"],
|
|
229
|
+
left: ["grid"],
|
|
230
|
+
"letter-spacing": ["tracking"],
|
|
231
|
+
"line-height": ["leading"],
|
|
232
|
+
margin: ["grid"],
|
|
233
|
+
"margin-block": ["grid"],
|
|
234
|
+
"margin-block-end": ["grid"],
|
|
235
|
+
"margin-block-start": ["grid"],
|
|
236
|
+
"margin-bottom": ["grid"],
|
|
237
|
+
"margin-inline": ["grid"],
|
|
238
|
+
"margin-inline-end": ["grid"],
|
|
239
|
+
"margin-inline-start": ["grid"],
|
|
240
|
+
"margin-left": ["grid"],
|
|
241
|
+
"margin-right": ["grid"],
|
|
242
|
+
"margin-top": ["grid"],
|
|
243
|
+
"max-block-size": ["grid", "size"],
|
|
244
|
+
"max-height": ["grid", "size"],
|
|
245
|
+
"max-inline-size": ["grid", "size"],
|
|
246
|
+
"max-width": ["grid", "size"],
|
|
247
|
+
"min-block-size": ["grid", "size"],
|
|
248
|
+
"min-height": ["grid", "size"],
|
|
249
|
+
"min-inline-size": ["grid", "size"],
|
|
250
|
+
"min-width": ["grid", "size"],
|
|
251
|
+
opacity: ["alpha"],
|
|
252
|
+
"outline-color": ["color"],
|
|
253
|
+
padding: ["grid"],
|
|
254
|
+
"padding-block": ["grid"],
|
|
255
|
+
"padding-block-end": ["grid"],
|
|
256
|
+
"padding-block-start": ["grid"],
|
|
257
|
+
"padding-bottom": ["grid"],
|
|
258
|
+
"padding-inline": ["grid"],
|
|
259
|
+
"padding-inline-end": ["grid"],
|
|
260
|
+
"padding-inline-start": ["grid"],
|
|
261
|
+
"padding-left": ["grid"],
|
|
262
|
+
"padding-right": ["grid"],
|
|
263
|
+
"padding-top": ["grid"],
|
|
264
|
+
right: ["grid"],
|
|
265
|
+
"row-gap": ["grid"],
|
|
266
|
+
"scroll-margin": ["grid"],
|
|
267
|
+
"scroll-margin-bottom": ["grid"],
|
|
268
|
+
"scroll-margin-left": ["grid"],
|
|
269
|
+
"scroll-margin-right": ["grid"],
|
|
270
|
+
"scroll-margin-top": ["grid"],
|
|
271
|
+
"scroll-padding": ["grid"],
|
|
272
|
+
"scroll-padding-bottom": ["grid"],
|
|
273
|
+
"scroll-padding-left": ["grid"],
|
|
274
|
+
"scroll-padding-right": ["grid"],
|
|
275
|
+
"scroll-padding-top": ["grid"],
|
|
276
|
+
"text-decoration-color": ["color"],
|
|
277
|
+
"text-shadow": ["shadow"],
|
|
278
|
+
top: ["grid"],
|
|
279
|
+
transition: ["transition"],
|
|
280
|
+
"transition-timing-function": ["ease"],
|
|
281
|
+
width: ["grid", "size"],
|
|
282
|
+
"z-index": ["z"]
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
var config_default_default = defaultConfig;
|
|
286
|
+
|
|
47
287
|
// src/supports.ts
|
|
48
288
|
var logicalProperties = [
|
|
49
289
|
"block-size",
|
|
@@ -464,250 +704,6 @@ var properties = [
|
|
|
464
704
|
...logicalProperties
|
|
465
705
|
];
|
|
466
706
|
|
|
467
|
-
// src/config.ts
|
|
468
|
-
var gridPropertyRegex = /--_grid/;
|
|
469
|
-
var GridProperty = {
|
|
470
|
-
safeParse: (input) => validate(gridPropertyRegex, input)
|
|
471
|
-
};
|
|
472
|
-
function gridProperty() {
|
|
473
|
-
return `--_grid`;
|
|
474
|
-
}
|
|
475
|
-
var gridValueRegex = /^\d+/;
|
|
476
|
-
var GridValue = {
|
|
477
|
-
safeParse: (input) => validate(gridValueRegex, input)
|
|
478
|
-
};
|
|
479
|
-
var tokenPropertyRegex = /(?<!var\()--(\w([\w-]+)?)/;
|
|
480
|
-
var TokenProperty = {
|
|
481
|
-
safeParse: (input) => validate(tokenPropertyRegex, input)
|
|
482
|
-
};
|
|
483
|
-
function tokenProperty(name) {
|
|
484
|
-
return `--${name}`;
|
|
485
|
-
}
|
|
486
|
-
var variantPropertyRegex = /(?<!var\()--((\w)([\w-]+)_([\w-]+))/;
|
|
487
|
-
var VariantProperty = {
|
|
488
|
-
safeParse: (input) => validate(variantPropertyRegex, input)
|
|
489
|
-
};
|
|
490
|
-
function variantProperty(variant, name) {
|
|
491
|
-
return `--${variant}_${name}`;
|
|
492
|
-
}
|
|
493
|
-
var tokenValueRegex = /var\((--([\w-]+)_([\w-]+))\)/;
|
|
494
|
-
var TokenValue = {
|
|
495
|
-
safeParse: (input) => validate(tokenValueRegex, input)
|
|
496
|
-
};
|
|
497
|
-
function tokenValue(themeKey, name) {
|
|
498
|
-
return `var(--${themeKey}_${name})`;
|
|
499
|
-
}
|
|
500
|
-
var arbitraryValueRegex = /var\(---,(.+)\)/;
|
|
501
|
-
var ArbitraryValue = {
|
|
502
|
-
safeParse: (input) => validate(arbitraryValueRegex, input)
|
|
503
|
-
};
|
|
504
|
-
function arbitraryValue(value) {
|
|
505
|
-
return `var(---,${value})`;
|
|
506
|
-
}
|
|
507
|
-
function validate(regex, input) {
|
|
508
|
-
try {
|
|
509
|
-
const inputString = String(input);
|
|
510
|
-
if (regex.test(inputString)) {
|
|
511
|
-
return { success: true, output: inputString };
|
|
512
|
-
} else {
|
|
513
|
-
return { success: false };
|
|
514
|
-
}
|
|
515
|
-
} catch (e) {
|
|
516
|
-
return { success: false };
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
var createConfig = (obj) => {
|
|
520
|
-
return obj;
|
|
521
|
-
};
|
|
522
|
-
function getTokenPropertyName(tokenProperty2) {
|
|
523
|
-
return tokenProperty2.replace(tokenPropertyRegex, "$1");
|
|
524
|
-
}
|
|
525
|
-
function getTokenPropertySplit(tokenProperty2) {
|
|
526
|
-
const name = getTokenPropertyName(tokenProperty2);
|
|
527
|
-
const [alias, ...variants] = name.split("_").reverse();
|
|
528
|
-
return { alias, variants: variants.reverse() };
|
|
529
|
-
}
|
|
530
|
-
function getTokenPropertyParts(tokenProperty2, config) {
|
|
531
|
-
var _a, _b, _c;
|
|
532
|
-
const name = getTokenPropertyName(tokenProperty2);
|
|
533
|
-
const { alias, variants } = getTokenPropertySplit(tokenProperty2);
|
|
534
|
-
const [v1, v2, ...invalidVariants] = variants;
|
|
535
|
-
const responsive = ((_a = config.responsive) == null ? void 0 : _a[v1]) && v1;
|
|
536
|
-
const selectorVariant1 = ((_b = config.selectors) == null ? void 0 : _b[v1]) && !v2 ? v1 : void 0;
|
|
537
|
-
const selectorVariant2 = responsive && ((_c = config.selectors) == null ? void 0 : _c[v2]) && v2;
|
|
538
|
-
const selector = selectorVariant1 || selectorVariant2;
|
|
539
|
-
const hasInvalidVariant = v1 && !responsive && !selector;
|
|
540
|
-
const variant = [responsive, selector].filter(Boolean).join("_");
|
|
541
|
-
if (invalidVariants.length || hasInvalidVariant)
|
|
542
|
-
return null;
|
|
543
|
-
return { name, alias, responsive, selector, variant };
|
|
544
|
-
}
|
|
545
|
-
function getTokenValueParts(tokenValue2) {
|
|
546
|
-
const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
|
|
547
|
-
return { property, themeKey, token };
|
|
548
|
-
}
|
|
549
|
-
function getCSSPropertiesForAlias(alias, aliases) {
|
|
550
|
-
const longhands = aliases == null ? void 0 : aliases[alias];
|
|
551
|
-
const result = longhands || [alias];
|
|
552
|
-
const valid = result.filter((property) => properties.includes(property));
|
|
553
|
-
return valid;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
// src/config.default.ts
|
|
557
|
-
var defaultConfig = createConfig({
|
|
558
|
-
include: [],
|
|
559
|
-
grid: "0.25rem",
|
|
560
|
-
responsive: {},
|
|
561
|
-
theme: {},
|
|
562
|
-
aliases: {},
|
|
563
|
-
selectors: {
|
|
564
|
-
after: "&::after",
|
|
565
|
-
before: "&::before",
|
|
566
|
-
even: "&:nth-child(even)",
|
|
567
|
-
odd: "&:nth-child(odd)",
|
|
568
|
-
"first-child": "&:first-child",
|
|
569
|
-
"last-child": "&:last-child",
|
|
570
|
-
placeholder: "&::placeholder",
|
|
571
|
-
hover: "&:hover",
|
|
572
|
-
focus: "&:focus",
|
|
573
|
-
"focus-visible": "&:focus-visible",
|
|
574
|
-
"focus-within": "&:focus-within",
|
|
575
|
-
active: "&:active",
|
|
576
|
-
disabled: "&:disabled"
|
|
577
|
-
},
|
|
578
|
-
properties: {
|
|
579
|
-
"accent-color": ["color"],
|
|
580
|
-
animation: ["anim"],
|
|
581
|
-
"animation-timing-function": ["ease"],
|
|
582
|
-
background: ["color", "surface"],
|
|
583
|
-
"background-color": ["color"],
|
|
584
|
-
"background-image": ["surface"],
|
|
585
|
-
"background-position": ["grid"],
|
|
586
|
-
"background-position-x": ["grid"],
|
|
587
|
-
"background-position-y": ["grid"],
|
|
588
|
-
"block-size": ["grid", "size"],
|
|
589
|
-
border: ["border"],
|
|
590
|
-
"border-block": ["border"],
|
|
591
|
-
"border-block-color": ["color"],
|
|
592
|
-
"border-block-end": ["border"],
|
|
593
|
-
"border-block-end-color": ["color"],
|
|
594
|
-
"border-block-end-style": ["line-style"],
|
|
595
|
-
"border-block-start": ["border"],
|
|
596
|
-
"border-block-start-color": ["color"],
|
|
597
|
-
"border-block-start-style": ["line-style"],
|
|
598
|
-
"border-block-style": ["line-style"],
|
|
599
|
-
"border-bottom": ["border"],
|
|
600
|
-
"border-bottom-color": ["color"],
|
|
601
|
-
"border-bottom-left-radius": ["radii"],
|
|
602
|
-
"border-bottom-right-radius": ["radii"],
|
|
603
|
-
"border-bottom-style": ["line-style"],
|
|
604
|
-
"border-color": ["color"],
|
|
605
|
-
"border-end-end-radius": ["radii"],
|
|
606
|
-
"border-end-start-radius": ["radii"],
|
|
607
|
-
"border-inline": ["border"],
|
|
608
|
-
"border-inline-color": ["color"],
|
|
609
|
-
"border-inline-end": ["border"],
|
|
610
|
-
"border-inline-end-color": ["color"],
|
|
611
|
-
"border-inline-end-style": ["line-style"],
|
|
612
|
-
"border-inline-start": ["border"],
|
|
613
|
-
"border-inline-start-color": ["color"],
|
|
614
|
-
"border-inline-start-style": ["line-style"],
|
|
615
|
-
"border-inline-style": ["line-style"],
|
|
616
|
-
"border-left": ["border"],
|
|
617
|
-
"border-left-color": ["color"],
|
|
618
|
-
"border-left-style": ["line-style"],
|
|
619
|
-
"border-radius": ["radii"],
|
|
620
|
-
"border-right": ["border"],
|
|
621
|
-
"border-right-color": ["color"],
|
|
622
|
-
"border-right-style": ["line-style"],
|
|
623
|
-
"border-start-end-radius": ["radii"],
|
|
624
|
-
"border-start-start-radius": ["radii"],
|
|
625
|
-
"border-style": ["line-style"],
|
|
626
|
-
"border-top": ["border"],
|
|
627
|
-
"border-top-color": ["color"],
|
|
628
|
-
"border-top-left-radius": ["radii"],
|
|
629
|
-
"border-top-right-radius": ["radii"],
|
|
630
|
-
"border-top-style": ["line-style"],
|
|
631
|
-
bottom: ["grid"],
|
|
632
|
-
"box-shadow": ["shadow"],
|
|
633
|
-
"caret-color": ["color"],
|
|
634
|
-
color: ["color"],
|
|
635
|
-
"column-gap": ["grid"],
|
|
636
|
-
"column-rule-color": ["color"],
|
|
637
|
-
"column-rule-width": ["grid"],
|
|
638
|
-
"column-width": ["grid", "size"],
|
|
639
|
-
"flex-basis": ["grid", "size"],
|
|
640
|
-
"font-family": ["font"],
|
|
641
|
-
"font-size": ["font-size"],
|
|
642
|
-
"font-weight": ["weight"],
|
|
643
|
-
gap: ["grid"],
|
|
644
|
-
height: ["grid", "size"],
|
|
645
|
-
"inline-size": ["grid", "size"],
|
|
646
|
-
inset: ["grid"],
|
|
647
|
-
"inset-block": ["grid"],
|
|
648
|
-
"inset-block-end": ["grid"],
|
|
649
|
-
"inset-block-start": ["grid"],
|
|
650
|
-
"inset-inline": ["grid"],
|
|
651
|
-
"inset-inline-end": ["grid"],
|
|
652
|
-
"inset-inline-start": ["grid"],
|
|
653
|
-
left: ["grid"],
|
|
654
|
-
"letter-spacing": ["tracking"],
|
|
655
|
-
"line-height": ["leading"],
|
|
656
|
-
margin: ["grid"],
|
|
657
|
-
"margin-block": ["grid"],
|
|
658
|
-
"margin-block-end": ["grid"],
|
|
659
|
-
"margin-block-start": ["grid"],
|
|
660
|
-
"margin-bottom": ["grid"],
|
|
661
|
-
"margin-inline": ["grid"],
|
|
662
|
-
"margin-inline-end": ["grid"],
|
|
663
|
-
"margin-inline-start": ["grid"],
|
|
664
|
-
"margin-left": ["grid"],
|
|
665
|
-
"margin-right": ["grid"],
|
|
666
|
-
"margin-top": ["grid"],
|
|
667
|
-
"max-block-size": ["grid", "size"],
|
|
668
|
-
"max-height": ["grid", "size"],
|
|
669
|
-
"max-inline-size": ["grid", "size"],
|
|
670
|
-
"max-width": ["grid", "size"],
|
|
671
|
-
"min-block-size": ["grid", "size"],
|
|
672
|
-
"min-height": ["grid", "size"],
|
|
673
|
-
"min-inline-size": ["grid", "size"],
|
|
674
|
-
"min-width": ["grid", "size"],
|
|
675
|
-
opacity: ["alpha"],
|
|
676
|
-
"outline-color": ["color"],
|
|
677
|
-
padding: ["grid"],
|
|
678
|
-
"padding-block": ["grid"],
|
|
679
|
-
"padding-block-end": ["grid"],
|
|
680
|
-
"padding-block-start": ["grid"],
|
|
681
|
-
"padding-bottom": ["grid"],
|
|
682
|
-
"padding-inline": ["grid"],
|
|
683
|
-
"padding-inline-end": ["grid"],
|
|
684
|
-
"padding-inline-start": ["grid"],
|
|
685
|
-
"padding-left": ["grid"],
|
|
686
|
-
"padding-right": ["grid"],
|
|
687
|
-
"padding-top": ["grid"],
|
|
688
|
-
right: ["grid"],
|
|
689
|
-
"row-gap": ["grid"],
|
|
690
|
-
"scroll-margin": ["grid"],
|
|
691
|
-
"scroll-margin-bottom": ["grid"],
|
|
692
|
-
"scroll-margin-left": ["grid"],
|
|
693
|
-
"scroll-margin-right": ["grid"],
|
|
694
|
-
"scroll-margin-top": ["grid"],
|
|
695
|
-
"scroll-padding": ["grid"],
|
|
696
|
-
"scroll-padding-bottom": ["grid"],
|
|
697
|
-
"scroll-padding-left": ["grid"],
|
|
698
|
-
"scroll-padding-right": ["grid"],
|
|
699
|
-
"scroll-padding-top": ["grid"],
|
|
700
|
-
"text-decoration-color": ["color"],
|
|
701
|
-
"text-shadow": ["shadow"],
|
|
702
|
-
top: ["grid"],
|
|
703
|
-
transition: ["transition"],
|
|
704
|
-
"transition-timing-function": ["ease"],
|
|
705
|
-
width: ["grid", "size"],
|
|
706
|
-
"z-index": ["z"]
|
|
707
|
-
}
|
|
708
|
-
});
|
|
709
|
-
var config_default_default = defaultConfig;
|
|
710
|
-
|
|
711
707
|
// src/shorthands.ts
|
|
712
708
|
var mapShorthandToLonghands = {
|
|
713
709
|
all: [],
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,243 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
var gridPropertyRegex = /--_grid/;
|
|
3
|
+
var GridProperty = {
|
|
4
|
+
safeParse: (input) => validate(gridPropertyRegex, input)
|
|
5
|
+
};
|
|
6
|
+
function gridProperty() {
|
|
7
|
+
return `--_grid`;
|
|
8
|
+
}
|
|
9
|
+
var gridValueRegex = /^\d+/;
|
|
10
|
+
var GridValue = {
|
|
11
|
+
safeParse: (input) => validate(gridValueRegex, input)
|
|
12
|
+
};
|
|
13
|
+
var tokenPropertyRegex = /(?<!var\()--(\w([\w-]+)?)/;
|
|
14
|
+
var TokenProperty = {
|
|
15
|
+
safeParse: (input) => validate(tokenPropertyRegex, input)
|
|
16
|
+
};
|
|
17
|
+
function tokenProperty(name) {
|
|
18
|
+
return `--${name}`;
|
|
19
|
+
}
|
|
20
|
+
var variantPropertyRegex = /(?<!var\()--((\w)([\w-]+)_([\w-]+))/;
|
|
21
|
+
var VariantProperty = {
|
|
22
|
+
safeParse: (input) => validate(variantPropertyRegex, input)
|
|
23
|
+
};
|
|
24
|
+
function variantProperty(variant, name) {
|
|
25
|
+
return `--${variant}_${name}`;
|
|
26
|
+
}
|
|
27
|
+
var tokenValueRegex = /var\((--([\w-]+)_([\w-]+))\)/;
|
|
28
|
+
var TokenValue = {
|
|
29
|
+
safeParse: (input) => validate(tokenValueRegex, input)
|
|
30
|
+
};
|
|
31
|
+
function tokenValue(themeKey, name) {
|
|
32
|
+
return `var(--${themeKey}_${name})`;
|
|
33
|
+
}
|
|
34
|
+
var arbitraryValueRegex = /var\(---,(.+)\)/;
|
|
35
|
+
var ArbitraryValue = {
|
|
36
|
+
safeParse: (input) => validate(arbitraryValueRegex, input)
|
|
37
|
+
};
|
|
38
|
+
function arbitraryValue(value) {
|
|
39
|
+
return `var(---,${value})`;
|
|
40
|
+
}
|
|
41
|
+
function validate(regex, input) {
|
|
42
|
+
try {
|
|
43
|
+
const inputString = String(input);
|
|
44
|
+
if (regex.test(inputString)) {
|
|
45
|
+
return { success: true, output: inputString };
|
|
46
|
+
} else {
|
|
47
|
+
return { success: false };
|
|
48
|
+
}
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return { success: false };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
var createConfig = (obj) => {
|
|
54
|
+
return obj;
|
|
55
|
+
};
|
|
56
|
+
function getTokenPropertyName(tokenProperty2) {
|
|
57
|
+
return tokenProperty2.replace(tokenPropertyRegex, "$1");
|
|
58
|
+
}
|
|
59
|
+
function getTokenPropertySplit(tokenProperty2) {
|
|
60
|
+
const name = getTokenPropertyName(tokenProperty2);
|
|
61
|
+
const [alias, ...variants] = name.split("_").reverse();
|
|
62
|
+
return { alias, variants: variants.reverse() };
|
|
63
|
+
}
|
|
64
|
+
function getTokenPropertyParts(tokenProperty2, config) {
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
const name = getTokenPropertyName(tokenProperty2);
|
|
67
|
+
const { alias, variants } = getTokenPropertySplit(tokenProperty2);
|
|
68
|
+
const [firstVariant, secondVariant] = variants;
|
|
69
|
+
const firstSelector = ((_a = config.selectors) == null ? void 0 : _a[firstVariant]) && firstVariant;
|
|
70
|
+
const secondSelector = ((_b = config.selectors) == null ? void 0 : _b[secondVariant]) && secondVariant;
|
|
71
|
+
const responsive = ((_c = config.responsive) == null ? void 0 : _c[firstVariant]) && firstVariant;
|
|
72
|
+
const selector = firstSelector || secondSelector;
|
|
73
|
+
const validVariant = [responsive, selector].filter(Boolean).join("_");
|
|
74
|
+
if (firstVariant && variantProperty(validVariant, alias) !== tokenProperty2)
|
|
75
|
+
return null;
|
|
76
|
+
return { name, alias, responsive, selector, variant: validVariant };
|
|
77
|
+
}
|
|
78
|
+
function getTokenValueParts(tokenValue2) {
|
|
79
|
+
const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
|
|
80
|
+
return { property, themeKey, token };
|
|
81
|
+
}
|
|
82
|
+
function getCSSPropertiesForAlias(alias, aliases) {
|
|
83
|
+
return (aliases == null ? void 0 : aliases[alias]) || [alias];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/config.default.ts
|
|
87
|
+
var defaultConfig = createConfig({
|
|
88
|
+
include: [],
|
|
89
|
+
grid: "0.25rem",
|
|
90
|
+
responsive: {},
|
|
91
|
+
theme: {},
|
|
92
|
+
aliases: {},
|
|
93
|
+
selectors: {
|
|
94
|
+
after: "&::after",
|
|
95
|
+
before: "&::before",
|
|
96
|
+
even: "&:nth-child(even)",
|
|
97
|
+
odd: "&:nth-child(odd)",
|
|
98
|
+
"first-child": "&:first-child",
|
|
99
|
+
"last-child": "&:last-child",
|
|
100
|
+
placeholder: "&::placeholder",
|
|
101
|
+
hover: "&:hover",
|
|
102
|
+
focus: "&:focus",
|
|
103
|
+
"focus-visible": "&:focus-visible",
|
|
104
|
+
"focus-within": "&:focus-within",
|
|
105
|
+
active: "&:active",
|
|
106
|
+
disabled: "&:disabled"
|
|
107
|
+
},
|
|
108
|
+
properties: {
|
|
109
|
+
"accent-color": ["color"],
|
|
110
|
+
animation: ["anim"],
|
|
111
|
+
"animation-timing-function": ["ease"],
|
|
112
|
+
background: ["color", "surface"],
|
|
113
|
+
"background-color": ["color"],
|
|
114
|
+
"background-image": ["surface"],
|
|
115
|
+
"background-position": ["grid"],
|
|
116
|
+
"background-position-x": ["grid"],
|
|
117
|
+
"background-position-y": ["grid"],
|
|
118
|
+
"block-size": ["grid", "size"],
|
|
119
|
+
border: ["border"],
|
|
120
|
+
"border-block": ["border"],
|
|
121
|
+
"border-block-color": ["color"],
|
|
122
|
+
"border-block-end": ["border"],
|
|
123
|
+
"border-block-end-color": ["color"],
|
|
124
|
+
"border-block-end-style": ["line-style"],
|
|
125
|
+
"border-block-start": ["border"],
|
|
126
|
+
"border-block-start-color": ["color"],
|
|
127
|
+
"border-block-start-style": ["line-style"],
|
|
128
|
+
"border-block-style": ["line-style"],
|
|
129
|
+
"border-bottom": ["border"],
|
|
130
|
+
"border-bottom-color": ["color"],
|
|
131
|
+
"border-bottom-left-radius": ["radii"],
|
|
132
|
+
"border-bottom-right-radius": ["radii"],
|
|
133
|
+
"border-bottom-style": ["line-style"],
|
|
134
|
+
"border-color": ["color"],
|
|
135
|
+
"border-end-end-radius": ["radii"],
|
|
136
|
+
"border-end-start-radius": ["radii"],
|
|
137
|
+
"border-inline": ["border"],
|
|
138
|
+
"border-inline-color": ["color"],
|
|
139
|
+
"border-inline-end": ["border"],
|
|
140
|
+
"border-inline-end-color": ["color"],
|
|
141
|
+
"border-inline-end-style": ["line-style"],
|
|
142
|
+
"border-inline-start": ["border"],
|
|
143
|
+
"border-inline-start-color": ["color"],
|
|
144
|
+
"border-inline-start-style": ["line-style"],
|
|
145
|
+
"border-inline-style": ["line-style"],
|
|
146
|
+
"border-left": ["border"],
|
|
147
|
+
"border-left-color": ["color"],
|
|
148
|
+
"border-left-style": ["line-style"],
|
|
149
|
+
"border-radius": ["radii"],
|
|
150
|
+
"border-right": ["border"],
|
|
151
|
+
"border-right-color": ["color"],
|
|
152
|
+
"border-right-style": ["line-style"],
|
|
153
|
+
"border-start-end-radius": ["radii"],
|
|
154
|
+
"border-start-start-radius": ["radii"],
|
|
155
|
+
"border-style": ["line-style"],
|
|
156
|
+
"border-top": ["border"],
|
|
157
|
+
"border-top-color": ["color"],
|
|
158
|
+
"border-top-left-radius": ["radii"],
|
|
159
|
+
"border-top-right-radius": ["radii"],
|
|
160
|
+
"border-top-style": ["line-style"],
|
|
161
|
+
bottom: ["grid"],
|
|
162
|
+
"box-shadow": ["shadow"],
|
|
163
|
+
"caret-color": ["color"],
|
|
164
|
+
color: ["color"],
|
|
165
|
+
"column-gap": ["grid"],
|
|
166
|
+
"column-rule-color": ["color"],
|
|
167
|
+
"column-rule-width": ["grid"],
|
|
168
|
+
"column-width": ["grid", "size"],
|
|
169
|
+
"flex-basis": ["grid", "size"],
|
|
170
|
+
"font-family": ["font"],
|
|
171
|
+
"font-size": ["font-size"],
|
|
172
|
+
"font-weight": ["weight"],
|
|
173
|
+
gap: ["grid"],
|
|
174
|
+
height: ["grid", "size"],
|
|
175
|
+
"inline-size": ["grid", "size"],
|
|
176
|
+
inset: ["grid"],
|
|
177
|
+
"inset-block": ["grid"],
|
|
178
|
+
"inset-block-end": ["grid"],
|
|
179
|
+
"inset-block-start": ["grid"],
|
|
180
|
+
"inset-inline": ["grid"],
|
|
181
|
+
"inset-inline-end": ["grid"],
|
|
182
|
+
"inset-inline-start": ["grid"],
|
|
183
|
+
left: ["grid"],
|
|
184
|
+
"letter-spacing": ["tracking"],
|
|
185
|
+
"line-height": ["leading"],
|
|
186
|
+
margin: ["grid"],
|
|
187
|
+
"margin-block": ["grid"],
|
|
188
|
+
"margin-block-end": ["grid"],
|
|
189
|
+
"margin-block-start": ["grid"],
|
|
190
|
+
"margin-bottom": ["grid"],
|
|
191
|
+
"margin-inline": ["grid"],
|
|
192
|
+
"margin-inline-end": ["grid"],
|
|
193
|
+
"margin-inline-start": ["grid"],
|
|
194
|
+
"margin-left": ["grid"],
|
|
195
|
+
"margin-right": ["grid"],
|
|
196
|
+
"margin-top": ["grid"],
|
|
197
|
+
"max-block-size": ["grid", "size"],
|
|
198
|
+
"max-height": ["grid", "size"],
|
|
199
|
+
"max-inline-size": ["grid", "size"],
|
|
200
|
+
"max-width": ["grid", "size"],
|
|
201
|
+
"min-block-size": ["grid", "size"],
|
|
202
|
+
"min-height": ["grid", "size"],
|
|
203
|
+
"min-inline-size": ["grid", "size"],
|
|
204
|
+
"min-width": ["grid", "size"],
|
|
205
|
+
opacity: ["alpha"],
|
|
206
|
+
"outline-color": ["color"],
|
|
207
|
+
padding: ["grid"],
|
|
208
|
+
"padding-block": ["grid"],
|
|
209
|
+
"padding-block-end": ["grid"],
|
|
210
|
+
"padding-block-start": ["grid"],
|
|
211
|
+
"padding-bottom": ["grid"],
|
|
212
|
+
"padding-inline": ["grid"],
|
|
213
|
+
"padding-inline-end": ["grid"],
|
|
214
|
+
"padding-inline-start": ["grid"],
|
|
215
|
+
"padding-left": ["grid"],
|
|
216
|
+
"padding-right": ["grid"],
|
|
217
|
+
"padding-top": ["grid"],
|
|
218
|
+
right: ["grid"],
|
|
219
|
+
"row-gap": ["grid"],
|
|
220
|
+
"scroll-margin": ["grid"],
|
|
221
|
+
"scroll-margin-bottom": ["grid"],
|
|
222
|
+
"scroll-margin-left": ["grid"],
|
|
223
|
+
"scroll-margin-right": ["grid"],
|
|
224
|
+
"scroll-margin-top": ["grid"],
|
|
225
|
+
"scroll-padding": ["grid"],
|
|
226
|
+
"scroll-padding-bottom": ["grid"],
|
|
227
|
+
"scroll-padding-left": ["grid"],
|
|
228
|
+
"scroll-padding-right": ["grid"],
|
|
229
|
+
"scroll-padding-top": ["grid"],
|
|
230
|
+
"text-decoration-color": ["color"],
|
|
231
|
+
"text-shadow": ["shadow"],
|
|
232
|
+
top: ["grid"],
|
|
233
|
+
transition: ["transition"],
|
|
234
|
+
"transition-timing-function": ["ease"],
|
|
235
|
+
width: ["grid", "size"],
|
|
236
|
+
"z-index": ["z"]
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
var config_default_default = defaultConfig;
|
|
240
|
+
|
|
1
241
|
// src/supports.ts
|
|
2
242
|
var logicalProperties = [
|
|
3
243
|
"block-size",
|
|
@@ -418,250 +658,6 @@ var properties = [
|
|
|
418
658
|
...logicalProperties
|
|
419
659
|
];
|
|
420
660
|
|
|
421
|
-
// src/config.ts
|
|
422
|
-
var gridPropertyRegex = /--_grid/;
|
|
423
|
-
var GridProperty = {
|
|
424
|
-
safeParse: (input) => validate(gridPropertyRegex, input)
|
|
425
|
-
};
|
|
426
|
-
function gridProperty() {
|
|
427
|
-
return `--_grid`;
|
|
428
|
-
}
|
|
429
|
-
var gridValueRegex = /^\d+/;
|
|
430
|
-
var GridValue = {
|
|
431
|
-
safeParse: (input) => validate(gridValueRegex, input)
|
|
432
|
-
};
|
|
433
|
-
var tokenPropertyRegex = /(?<!var\()--(\w([\w-]+)?)/;
|
|
434
|
-
var TokenProperty = {
|
|
435
|
-
safeParse: (input) => validate(tokenPropertyRegex, input)
|
|
436
|
-
};
|
|
437
|
-
function tokenProperty(name) {
|
|
438
|
-
return `--${name}`;
|
|
439
|
-
}
|
|
440
|
-
var variantPropertyRegex = /(?<!var\()--((\w)([\w-]+)_([\w-]+))/;
|
|
441
|
-
var VariantProperty = {
|
|
442
|
-
safeParse: (input) => validate(variantPropertyRegex, input)
|
|
443
|
-
};
|
|
444
|
-
function variantProperty(variant, name) {
|
|
445
|
-
return `--${variant}_${name}`;
|
|
446
|
-
}
|
|
447
|
-
var tokenValueRegex = /var\((--([\w-]+)_([\w-]+))\)/;
|
|
448
|
-
var TokenValue = {
|
|
449
|
-
safeParse: (input) => validate(tokenValueRegex, input)
|
|
450
|
-
};
|
|
451
|
-
function tokenValue(themeKey, name) {
|
|
452
|
-
return `var(--${themeKey}_${name})`;
|
|
453
|
-
}
|
|
454
|
-
var arbitraryValueRegex = /var\(---,(.+)\)/;
|
|
455
|
-
var ArbitraryValue = {
|
|
456
|
-
safeParse: (input) => validate(arbitraryValueRegex, input)
|
|
457
|
-
};
|
|
458
|
-
function arbitraryValue(value) {
|
|
459
|
-
return `var(---,${value})`;
|
|
460
|
-
}
|
|
461
|
-
function validate(regex, input) {
|
|
462
|
-
try {
|
|
463
|
-
const inputString = String(input);
|
|
464
|
-
if (regex.test(inputString)) {
|
|
465
|
-
return { success: true, output: inputString };
|
|
466
|
-
} else {
|
|
467
|
-
return { success: false };
|
|
468
|
-
}
|
|
469
|
-
} catch (e) {
|
|
470
|
-
return { success: false };
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
var createConfig = (obj) => {
|
|
474
|
-
return obj;
|
|
475
|
-
};
|
|
476
|
-
function getTokenPropertyName(tokenProperty2) {
|
|
477
|
-
return tokenProperty2.replace(tokenPropertyRegex, "$1");
|
|
478
|
-
}
|
|
479
|
-
function getTokenPropertySplit(tokenProperty2) {
|
|
480
|
-
const name = getTokenPropertyName(tokenProperty2);
|
|
481
|
-
const [alias, ...variants] = name.split("_").reverse();
|
|
482
|
-
return { alias, variants: variants.reverse() };
|
|
483
|
-
}
|
|
484
|
-
function getTokenPropertyParts(tokenProperty2, config) {
|
|
485
|
-
var _a, _b, _c;
|
|
486
|
-
const name = getTokenPropertyName(tokenProperty2);
|
|
487
|
-
const { alias, variants } = getTokenPropertySplit(tokenProperty2);
|
|
488
|
-
const [v1, v2, ...invalidVariants] = variants;
|
|
489
|
-
const responsive = ((_a = config.responsive) == null ? void 0 : _a[v1]) && v1;
|
|
490
|
-
const selectorVariant1 = ((_b = config.selectors) == null ? void 0 : _b[v1]) && !v2 ? v1 : void 0;
|
|
491
|
-
const selectorVariant2 = responsive && ((_c = config.selectors) == null ? void 0 : _c[v2]) && v2;
|
|
492
|
-
const selector = selectorVariant1 || selectorVariant2;
|
|
493
|
-
const hasInvalidVariant = v1 && !responsive && !selector;
|
|
494
|
-
const variant = [responsive, selector].filter(Boolean).join("_");
|
|
495
|
-
if (invalidVariants.length || hasInvalidVariant)
|
|
496
|
-
return null;
|
|
497
|
-
return { name, alias, responsive, selector, variant };
|
|
498
|
-
}
|
|
499
|
-
function getTokenValueParts(tokenValue2) {
|
|
500
|
-
const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
|
|
501
|
-
return { property, themeKey, token };
|
|
502
|
-
}
|
|
503
|
-
function getCSSPropertiesForAlias(alias, aliases) {
|
|
504
|
-
const longhands = aliases == null ? void 0 : aliases[alias];
|
|
505
|
-
const result = longhands || [alias];
|
|
506
|
-
const valid = result.filter((property) => properties.includes(property));
|
|
507
|
-
return valid;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// src/config.default.ts
|
|
511
|
-
var defaultConfig = createConfig({
|
|
512
|
-
include: [],
|
|
513
|
-
grid: "0.25rem",
|
|
514
|
-
responsive: {},
|
|
515
|
-
theme: {},
|
|
516
|
-
aliases: {},
|
|
517
|
-
selectors: {
|
|
518
|
-
after: "&::after",
|
|
519
|
-
before: "&::before",
|
|
520
|
-
even: "&:nth-child(even)",
|
|
521
|
-
odd: "&:nth-child(odd)",
|
|
522
|
-
"first-child": "&:first-child",
|
|
523
|
-
"last-child": "&:last-child",
|
|
524
|
-
placeholder: "&::placeholder",
|
|
525
|
-
hover: "&:hover",
|
|
526
|
-
focus: "&:focus",
|
|
527
|
-
"focus-visible": "&:focus-visible",
|
|
528
|
-
"focus-within": "&:focus-within",
|
|
529
|
-
active: "&:active",
|
|
530
|
-
disabled: "&:disabled"
|
|
531
|
-
},
|
|
532
|
-
properties: {
|
|
533
|
-
"accent-color": ["color"],
|
|
534
|
-
animation: ["anim"],
|
|
535
|
-
"animation-timing-function": ["ease"],
|
|
536
|
-
background: ["color", "surface"],
|
|
537
|
-
"background-color": ["color"],
|
|
538
|
-
"background-image": ["surface"],
|
|
539
|
-
"background-position": ["grid"],
|
|
540
|
-
"background-position-x": ["grid"],
|
|
541
|
-
"background-position-y": ["grid"],
|
|
542
|
-
"block-size": ["grid", "size"],
|
|
543
|
-
border: ["border"],
|
|
544
|
-
"border-block": ["border"],
|
|
545
|
-
"border-block-color": ["color"],
|
|
546
|
-
"border-block-end": ["border"],
|
|
547
|
-
"border-block-end-color": ["color"],
|
|
548
|
-
"border-block-end-style": ["line-style"],
|
|
549
|
-
"border-block-start": ["border"],
|
|
550
|
-
"border-block-start-color": ["color"],
|
|
551
|
-
"border-block-start-style": ["line-style"],
|
|
552
|
-
"border-block-style": ["line-style"],
|
|
553
|
-
"border-bottom": ["border"],
|
|
554
|
-
"border-bottom-color": ["color"],
|
|
555
|
-
"border-bottom-left-radius": ["radii"],
|
|
556
|
-
"border-bottom-right-radius": ["radii"],
|
|
557
|
-
"border-bottom-style": ["line-style"],
|
|
558
|
-
"border-color": ["color"],
|
|
559
|
-
"border-end-end-radius": ["radii"],
|
|
560
|
-
"border-end-start-radius": ["radii"],
|
|
561
|
-
"border-inline": ["border"],
|
|
562
|
-
"border-inline-color": ["color"],
|
|
563
|
-
"border-inline-end": ["border"],
|
|
564
|
-
"border-inline-end-color": ["color"],
|
|
565
|
-
"border-inline-end-style": ["line-style"],
|
|
566
|
-
"border-inline-start": ["border"],
|
|
567
|
-
"border-inline-start-color": ["color"],
|
|
568
|
-
"border-inline-start-style": ["line-style"],
|
|
569
|
-
"border-inline-style": ["line-style"],
|
|
570
|
-
"border-left": ["border"],
|
|
571
|
-
"border-left-color": ["color"],
|
|
572
|
-
"border-left-style": ["line-style"],
|
|
573
|
-
"border-radius": ["radii"],
|
|
574
|
-
"border-right": ["border"],
|
|
575
|
-
"border-right-color": ["color"],
|
|
576
|
-
"border-right-style": ["line-style"],
|
|
577
|
-
"border-start-end-radius": ["radii"],
|
|
578
|
-
"border-start-start-radius": ["radii"],
|
|
579
|
-
"border-style": ["line-style"],
|
|
580
|
-
"border-top": ["border"],
|
|
581
|
-
"border-top-color": ["color"],
|
|
582
|
-
"border-top-left-radius": ["radii"],
|
|
583
|
-
"border-top-right-radius": ["radii"],
|
|
584
|
-
"border-top-style": ["line-style"],
|
|
585
|
-
bottom: ["grid"],
|
|
586
|
-
"box-shadow": ["shadow"],
|
|
587
|
-
"caret-color": ["color"],
|
|
588
|
-
color: ["color"],
|
|
589
|
-
"column-gap": ["grid"],
|
|
590
|
-
"column-rule-color": ["color"],
|
|
591
|
-
"column-rule-width": ["grid"],
|
|
592
|
-
"column-width": ["grid", "size"],
|
|
593
|
-
"flex-basis": ["grid", "size"],
|
|
594
|
-
"font-family": ["font"],
|
|
595
|
-
"font-size": ["font-size"],
|
|
596
|
-
"font-weight": ["weight"],
|
|
597
|
-
gap: ["grid"],
|
|
598
|
-
height: ["grid", "size"],
|
|
599
|
-
"inline-size": ["grid", "size"],
|
|
600
|
-
inset: ["grid"],
|
|
601
|
-
"inset-block": ["grid"],
|
|
602
|
-
"inset-block-end": ["grid"],
|
|
603
|
-
"inset-block-start": ["grid"],
|
|
604
|
-
"inset-inline": ["grid"],
|
|
605
|
-
"inset-inline-end": ["grid"],
|
|
606
|
-
"inset-inline-start": ["grid"],
|
|
607
|
-
left: ["grid"],
|
|
608
|
-
"letter-spacing": ["tracking"],
|
|
609
|
-
"line-height": ["leading"],
|
|
610
|
-
margin: ["grid"],
|
|
611
|
-
"margin-block": ["grid"],
|
|
612
|
-
"margin-block-end": ["grid"],
|
|
613
|
-
"margin-block-start": ["grid"],
|
|
614
|
-
"margin-bottom": ["grid"],
|
|
615
|
-
"margin-inline": ["grid"],
|
|
616
|
-
"margin-inline-end": ["grid"],
|
|
617
|
-
"margin-inline-start": ["grid"],
|
|
618
|
-
"margin-left": ["grid"],
|
|
619
|
-
"margin-right": ["grid"],
|
|
620
|
-
"margin-top": ["grid"],
|
|
621
|
-
"max-block-size": ["grid", "size"],
|
|
622
|
-
"max-height": ["grid", "size"],
|
|
623
|
-
"max-inline-size": ["grid", "size"],
|
|
624
|
-
"max-width": ["grid", "size"],
|
|
625
|
-
"min-block-size": ["grid", "size"],
|
|
626
|
-
"min-height": ["grid", "size"],
|
|
627
|
-
"min-inline-size": ["grid", "size"],
|
|
628
|
-
"min-width": ["grid", "size"],
|
|
629
|
-
opacity: ["alpha"],
|
|
630
|
-
"outline-color": ["color"],
|
|
631
|
-
padding: ["grid"],
|
|
632
|
-
"padding-block": ["grid"],
|
|
633
|
-
"padding-block-end": ["grid"],
|
|
634
|
-
"padding-block-start": ["grid"],
|
|
635
|
-
"padding-bottom": ["grid"],
|
|
636
|
-
"padding-inline": ["grid"],
|
|
637
|
-
"padding-inline-end": ["grid"],
|
|
638
|
-
"padding-inline-start": ["grid"],
|
|
639
|
-
"padding-left": ["grid"],
|
|
640
|
-
"padding-right": ["grid"],
|
|
641
|
-
"padding-top": ["grid"],
|
|
642
|
-
right: ["grid"],
|
|
643
|
-
"row-gap": ["grid"],
|
|
644
|
-
"scroll-margin": ["grid"],
|
|
645
|
-
"scroll-margin-bottom": ["grid"],
|
|
646
|
-
"scroll-margin-left": ["grid"],
|
|
647
|
-
"scroll-margin-right": ["grid"],
|
|
648
|
-
"scroll-margin-top": ["grid"],
|
|
649
|
-
"scroll-padding": ["grid"],
|
|
650
|
-
"scroll-padding-bottom": ["grid"],
|
|
651
|
-
"scroll-padding-left": ["grid"],
|
|
652
|
-
"scroll-padding-right": ["grid"],
|
|
653
|
-
"scroll-padding-top": ["grid"],
|
|
654
|
-
"text-decoration-color": ["color"],
|
|
655
|
-
"text-shadow": ["shadow"],
|
|
656
|
-
top: ["grid"],
|
|
657
|
-
transition: ["transition"],
|
|
658
|
-
"transition-timing-function": ["ease"],
|
|
659
|
-
width: ["grid", "size"],
|
|
660
|
-
"z-index": ["z"]
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
var config_default_default = defaultConfig;
|
|
664
|
-
|
|
665
661
|
// src/shorthands.ts
|
|
666
662
|
var mapShorthandToLonghands = {
|
|
667
663
|
all: [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenami/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"csstype": "^3.1.2",
|
|
15
15
|
"tsup": "^7.0.0",
|
|
16
16
|
"typescript": "^5.1.3",
|
|
17
|
-
"@tokenami/dev": "0.0.
|
|
17
|
+
"@tokenami/dev": "0.0.30"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsup src/index.ts --format=esm,cjs --dts",
|