@tokenami/config 0.0.11

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.mjs ADDED
@@ -0,0 +1,676 @@
1
+ // src/config.ts
2
+ import * as v from "valibot";
3
+ function tokenProperty(name) {
4
+ return `--${name}`;
5
+ }
6
+ function variantProperty(variant, name) {
7
+ return `--${variant}_${name}`;
8
+ }
9
+ function tokenValue(themeKey, name) {
10
+ return `var(--${themeKey}_${name})`;
11
+ }
12
+ function arbitraryValue(value) {
13
+ return `var(---,${value})`;
14
+ }
15
+ var tokenPropertyRegex = /--((\w)([\w-]+)?)/;
16
+ var tokenValueRegex = /var\(--([\w-]+)_([\w-]+)\)/;
17
+ var aritraryValueRegex = /var\(---,(.+)\)/;
18
+ var gridValueSchema = v.number();
19
+ var GridValue = { safeParse: (input) => v.safeParse(gridValueSchema, input) };
20
+ var tokenPropertySchema = v.string([v.regex(tokenPropertyRegex)]);
21
+ var TokenProperty = { safeParse: (input) => v.safeParse(tokenPropertySchema, input) };
22
+ var tokenValueSchema = v.string([v.regex(tokenValueRegex)]);
23
+ var TokenValue = { safeParse: (input) => v.safeParse(tokenValueSchema, input) };
24
+ var ArbitraryValue = v.string([v.regex(aritraryValueRegex)]);
25
+ var createConfig = (obj) => {
26
+ return obj;
27
+ };
28
+ function getTokenPropertyName(tokenProperty2) {
29
+ return tokenProperty2.replace(tokenPropertyRegex, "$1");
30
+ }
31
+ function getTokenValueParts(tokenValue2) {
32
+ const [, key, token] = tokenValue2.split(tokenValueRegex);
33
+ return key && token ? { themeKey: key, token } : void 0;
34
+ }
35
+
36
+ // src/config.default.ts
37
+ var defaultConfig = createConfig({
38
+ include: [],
39
+ grid: "0.25rem",
40
+ responsive: {},
41
+ theme: {},
42
+ aliases: {},
43
+ selectors: {
44
+ active: "&:active",
45
+ "any-link": "&:any-link",
46
+ checked: "&:checked",
47
+ current: "&:current",
48
+ default: "&:default",
49
+ defined: "&:defined",
50
+ disabled: "&:disabled",
51
+ empty: "&:empty",
52
+ enabled: "&:enabled",
53
+ first: "&:first",
54
+ "first-child": "&:first-child",
55
+ "first-of-type": "&:first-of-type",
56
+ focus: "&:focus",
57
+ "focus-visible": "&:focus-visible",
58
+ "focus-within": "&:focus-within",
59
+ fullscreen: "&:fullscreen",
60
+ hover: "&:hover",
61
+ "in-range": "&:in-range",
62
+ indeterminate: "&:indeterminate",
63
+ invalid: "&:invalid",
64
+ "last-child": "&:last-child",
65
+ "last-of-type": "&:last-of-type",
66
+ left: "&:left",
67
+ link: "&:link",
68
+ "local-link": "&:local-link",
69
+ "nth-col": "&:nth-col",
70
+ "nth-last-col": "&:nth-last-col",
71
+ "only-child": "&:only-child",
72
+ "only-of-type": "&:only-of-type",
73
+ optional: "&:optional",
74
+ "out-of-range": "&:out-of-range",
75
+ paused: "&:paused",
76
+ "picture-in-picture": "&:picture-in-picture",
77
+ "placeholder-shown": "&:placeholder-shown",
78
+ playing: "&:playing",
79
+ "read-only": "&:read-only",
80
+ "read-write": "&:read-write",
81
+ required: "&:required",
82
+ right: "&:right",
83
+ root: "&:root",
84
+ scope: "&:scope",
85
+ target: "&:target",
86
+ "user-invalid": "&:user-invalid",
87
+ "user-valid": "&:user-valid",
88
+ valid: "&:valid",
89
+ visited: "&:visited",
90
+ after: "&::after",
91
+ backdrop: "&::backdrop",
92
+ before: "&::before",
93
+ cue: "&::cue",
94
+ "cue-region": "&::cue-region",
95
+ "file-selector-button": "&::file-selector-button",
96
+ "first-letter": "&::first-letter",
97
+ "first-line": "&::first-line",
98
+ marker: "&::marker",
99
+ placeholder: "&::placeholder",
100
+ selection: "&::selection"
101
+ },
102
+ properties: {
103
+ "accent-color": ["color"],
104
+ animation: ["anim"],
105
+ "animation-timing-function": ["ease"],
106
+ background: ["color", "surface"],
107
+ "background-color": ["color"],
108
+ "background-image": ["surface"],
109
+ "background-position": ["grid"],
110
+ "background-position-x": ["grid"],
111
+ "background-position-y": ["grid"],
112
+ "block-size": ["grid", "size"],
113
+ border: ["border"],
114
+ "border-block": ["border"],
115
+ "border-block-color": ["color"],
116
+ "border-block-end": ["border"],
117
+ "border-block-end-color": ["color"],
118
+ "border-block-end-style": ["line-style"],
119
+ "border-block-end-width": ["grid"],
120
+ "border-block-start": ["border"],
121
+ "border-block-start-color": ["color"],
122
+ "border-block-start-style": ["line-style"],
123
+ "border-block-start-width": ["grid"],
124
+ "border-block-style": ["line-style"],
125
+ "border-block-width": ["grid"],
126
+ "border-bottom": ["border"],
127
+ "border-bottom-color": ["color"],
128
+ "border-bottom-left-radius": ["radii"],
129
+ "border-bottom-right-radius": ["radii"],
130
+ "border-bottom-style": ["line-style"],
131
+ "border-bottom-width": ["grid"],
132
+ "border-color": ["color"],
133
+ "border-end-end-radius": ["radii"],
134
+ "border-end-start-radius": ["radii"],
135
+ "border-inline": ["border"],
136
+ "border-inline-color": ["color"],
137
+ "border-inline-end": ["border"],
138
+ "border-inline-end-color": ["color"],
139
+ "border-inline-end-style": ["line-style"],
140
+ "border-inline-end-width": ["grid"],
141
+ "border-inline-start": ["border"],
142
+ "border-inline-start-color": ["color"],
143
+ "border-inline-start-style": ["line-style"],
144
+ "border-inline-start-width": ["grid"],
145
+ "border-inline-style": ["line-style"],
146
+ "border-inline-width": ["grid"],
147
+ "border-left": ["border"],
148
+ "border-left-color": ["color"],
149
+ "border-left-style": ["line-style"],
150
+ "border-left-width": ["grid"],
151
+ "border-radius": ["radii"],
152
+ "border-right": ["border"],
153
+ "border-right-color": ["color"],
154
+ "border-right-style": ["line-style"],
155
+ "border-right-width": ["grid"],
156
+ "border-start-end-radius": ["radii"],
157
+ "border-start-start-radius": ["radii"],
158
+ "border-style": ["line-style"],
159
+ "border-top": ["border"],
160
+ "border-top-color": ["color"],
161
+ "border-top-left-radius": ["radii"],
162
+ "border-top-right-radius": ["radii"],
163
+ "border-top-style": ["line-style"],
164
+ "border-top-width": ["grid"],
165
+ "border-width": ["grid"],
166
+ bottom: ["grid"],
167
+ "box-shadow": ["shadow"],
168
+ "caret-color": ["color"],
169
+ color: ["color"],
170
+ "column-gap": ["grid"],
171
+ "column-rule-color": ["color"],
172
+ "column-rule-width": ["grid"],
173
+ "column-width": ["grid", "size"],
174
+ "flex-basis": ["grid", "size"],
175
+ "font-family": ["font"],
176
+ "font-size": ["font-size"],
177
+ "font-weight": ["weight"],
178
+ gap: ["grid"],
179
+ height: ["grid", "size"],
180
+ "inline-size": ["grid", "size"],
181
+ inset: ["grid"],
182
+ "inset-block": ["grid"],
183
+ "inset-block-end": ["grid"],
184
+ "inset-block-start": ["grid"],
185
+ "inset-inline": ["grid"],
186
+ "inset-inline-end": ["grid"],
187
+ "inset-inline-start": ["grid"],
188
+ left: ["grid"],
189
+ "letter-spacing": ["tracking"],
190
+ "line-height": ["leading"],
191
+ margin: ["grid"],
192
+ "margin-block": ["grid"],
193
+ "margin-block-end": ["grid"],
194
+ "margin-block-start": ["grid"],
195
+ "margin-bottom": ["grid"],
196
+ "margin-inline": ["grid"],
197
+ "margin-inline-end": ["grid"],
198
+ "margin-inline-start": ["grid"],
199
+ "margin-left": ["grid"],
200
+ "margin-right": ["grid"],
201
+ "margin-top": ["grid"],
202
+ "max-block-size": ["grid", "size"],
203
+ "max-height": ["grid", "size"],
204
+ "max-inline-size": ["grid", "size"],
205
+ "max-width": ["grid", "size"],
206
+ "min-block-size": ["grid", "size"],
207
+ "min-height": ["grid", "size"],
208
+ "min-inline-size": ["grid", "size"],
209
+ "min-width": ["grid", "size"],
210
+ opacity: ["alpha"],
211
+ "outline-color": ["color"],
212
+ padding: ["grid"],
213
+ "padding-block": ["grid"],
214
+ "padding-block-end": ["grid"],
215
+ "padding-block-start": ["grid"],
216
+ "padding-bottom": ["grid"],
217
+ "padding-inline": ["grid"],
218
+ "padding-inline-end": ["grid"],
219
+ "padding-inline-start": ["grid"],
220
+ "padding-left": ["grid"],
221
+ "padding-right": ["grid"],
222
+ "padding-top": ["grid"],
223
+ right: ["grid"],
224
+ "row-gap": ["grid"],
225
+ "scroll-margin": ["grid"],
226
+ "scroll-margin-bottom": ["grid"],
227
+ "scroll-margin-left": ["grid"],
228
+ "scroll-margin-right": ["grid"],
229
+ "scroll-margin-top": ["grid"],
230
+ "scroll-padding": ["grid"],
231
+ "scroll-padding-bottom": ["grid"],
232
+ "scroll-padding-left": ["grid"],
233
+ "scroll-padding-right": ["grid"],
234
+ "scroll-padding-top": ["grid"],
235
+ "text-decoration-color": ["color"],
236
+ "text-shadow": ["shadow"],
237
+ top: ["grid"],
238
+ transition: ["transition"],
239
+ "transition-timing-function": ["ease"],
240
+ width: ["grid", "size"],
241
+ "z-index": ["z"]
242
+ }
243
+ });
244
+ var config_default_default = defaultConfig;
245
+
246
+ // src/supports.ts
247
+ var properties = [
248
+ "-webkit-line-clamp",
249
+ "accent-color",
250
+ "align-tracks",
251
+ "all",
252
+ "animation",
253
+ "animation-composition",
254
+ "animation-delay",
255
+ "animation-direction",
256
+ "animation-duration",
257
+ "animation-fill-mode",
258
+ "animation-iteration-count",
259
+ "animation-name",
260
+ "animation-play-state",
261
+ "animation-timeline",
262
+ "animation-timing-function",
263
+ "appearance",
264
+ "aspect-ratio",
265
+ "backdrop-filter",
266
+ "backface-visibility",
267
+ "background",
268
+ "background-attachment",
269
+ "background-blend-mode",
270
+ "background-clip",
271
+ "background-color",
272
+ "background-image",
273
+ "background-origin",
274
+ "background-position",
275
+ "background-position-x",
276
+ "background-position-y",
277
+ "background-repeat",
278
+ "background-size",
279
+ "block-overflow",
280
+ "block-size",
281
+ "border",
282
+ "border-style",
283
+ "border-color",
284
+ "border-width",
285
+ "border-top",
286
+ "border-top-color",
287
+ "border-top-style",
288
+ "border-top-width",
289
+ "border-right",
290
+ "border-right-color",
291
+ "border-right-style",
292
+ "border-right-width",
293
+ "border-bottom",
294
+ "border-bottom-color",
295
+ "border-bottom-style",
296
+ "border-bottom-width",
297
+ "border-left",
298
+ "border-left-color",
299
+ "border-left-style",
300
+ "border-left-width",
301
+ "border-block",
302
+ "border-block-width",
303
+ "border-block-style",
304
+ "border-block-color",
305
+ "border-block-start",
306
+ "border-block-end",
307
+ "border-block-start-color",
308
+ "border-block-start-style",
309
+ "border-block-start-width",
310
+ "border-block-end-color",
311
+ "border-block-end-style",
312
+ "border-block-end-width",
313
+ "border-image",
314
+ "border-image-outset",
315
+ "border-image-repeat",
316
+ "border-image-slice",
317
+ "border-image-source",
318
+ "border-image-width",
319
+ "border-inline",
320
+ "border-inline-color",
321
+ "border-inline-style",
322
+ "border-inline-width",
323
+ "border-inline-start",
324
+ "border-inline-end",
325
+ "border-inline-start-color",
326
+ "border-inline-start-style",
327
+ "border-inline-start-width",
328
+ "border-inline-end-color",
329
+ "border-inline-end-style",
330
+ "border-inline-end-width",
331
+ "border-radius",
332
+ "border-top-left-radius",
333
+ "border-top-right-radius",
334
+ "border-bottom-left-radius",
335
+ "border-bottom-right-radius",
336
+ "border-start-end-radius",
337
+ "border-start-start-radius",
338
+ "border-end-end-radius",
339
+ "border-end-start-radius",
340
+ "border-collapse",
341
+ "border-spacing",
342
+ "box-decoration-break",
343
+ "box-shadow",
344
+ "box-sizing",
345
+ "break-after",
346
+ "break-before",
347
+ "break-inside",
348
+ "caption-side",
349
+ "caret",
350
+ "caret-color",
351
+ "caret-shape",
352
+ "clear",
353
+ "clip",
354
+ "clip-path",
355
+ "color",
356
+ "color-scheme",
357
+ "column-fill",
358
+ "column-span",
359
+ "column-rule",
360
+ "column-rule-color",
361
+ "column-rule-style",
362
+ "column-rule-width",
363
+ "columns",
364
+ "column-count",
365
+ "column-width",
366
+ "contain",
367
+ "contain-intrinsic-block-size",
368
+ "contain-intrinsic-height",
369
+ "contain-intrinsic-inline-size",
370
+ "contain-intrinsic-size",
371
+ "contain-intrinsic-width",
372
+ "container",
373
+ "container-name",
374
+ "container-type",
375
+ "content",
376
+ "content-visibility",
377
+ "counter-increment",
378
+ "counter-reset",
379
+ "counter-set",
380
+ "cursor",
381
+ "direction",
382
+ "display",
383
+ "empty-cells",
384
+ "filter",
385
+ "flex",
386
+ "flex-basis",
387
+ "flex-direction",
388
+ "flex-flow",
389
+ "flex-grow",
390
+ "flex-shrink",
391
+ "flex-wrap",
392
+ "float",
393
+ "font",
394
+ "font-family",
395
+ "font-feature-settings",
396
+ "font-kerning",
397
+ "font-language-override",
398
+ "font-optical-sizing",
399
+ "font-palette",
400
+ "font-size",
401
+ "font-size-adjust",
402
+ "font-stretch",
403
+ "font-style",
404
+ "font-synthesis",
405
+ "font-variant",
406
+ "font-variant-alternates",
407
+ "font-variant-caps",
408
+ "font-variant-east-asian",
409
+ "font-variant-emoji",
410
+ "font-variant-ligatures",
411
+ "font-variant-numeric",
412
+ "font-variant-position",
413
+ "font-variation-settings",
414
+ "font-weight",
415
+ "forced-color-adjust",
416
+ "gap",
417
+ "row-gap",
418
+ "column-gap",
419
+ "grid",
420
+ "grid-area",
421
+ "grid-auto-rows",
422
+ "grid-auto-columns",
423
+ "grid-auto-flow",
424
+ "grid-column",
425
+ "grid-column-end",
426
+ "grid-column-start",
427
+ "grid-row",
428
+ "grid-row-end",
429
+ "grid-row-start",
430
+ "grid-template",
431
+ "grid-template-rows",
432
+ "grid-template-columns",
433
+ "grid-template-areas",
434
+ "hanging-punctuation",
435
+ "height",
436
+ "hyphenate-character",
437
+ "hyphenate-limit-chars",
438
+ "hyphens",
439
+ "image-orientation",
440
+ "image-rendering",
441
+ "image-resolution",
442
+ "initial-letter",
443
+ "inline-size",
444
+ "input-security",
445
+ "inset",
446
+ "top",
447
+ "right",
448
+ "bottom",
449
+ "left",
450
+ "inset-block",
451
+ "inset-block-end",
452
+ "inset-block-start",
453
+ "inset-inline",
454
+ "inset-inline-end",
455
+ "inset-inline-start",
456
+ "isolation",
457
+ "justify-tracks",
458
+ "letter-spacing",
459
+ "line-break",
460
+ "line-clamp",
461
+ "line-height",
462
+ "line-height-step",
463
+ "list-style",
464
+ "list-style-image",
465
+ "list-style-position",
466
+ "list-style-type",
467
+ "margin",
468
+ "margin-top",
469
+ "margin-right",
470
+ "margin-bottom",
471
+ "margin-left",
472
+ "margin-block",
473
+ "margin-block-end",
474
+ "margin-block-start",
475
+ "margin-inline",
476
+ "margin-inline-end",
477
+ "margin-inline-start",
478
+ "margin-trim",
479
+ "mask",
480
+ "mask-border",
481
+ "mask-border-mode",
482
+ "mask-border-outset",
483
+ "mask-border-repeat",
484
+ "mask-border-slice",
485
+ "mask-border-source",
486
+ "mask-border-width",
487
+ "mask-clip",
488
+ "mask-composite",
489
+ "mask-image",
490
+ "mask-mode",
491
+ "mask-origin",
492
+ "mask-position",
493
+ "mask-repeat",
494
+ "mask-size",
495
+ "mask-type",
496
+ "math-depth",
497
+ "math-shift",
498
+ "math-style",
499
+ "max-block-size",
500
+ "max-height",
501
+ "max-inline-size",
502
+ "max-lines",
503
+ "max-width",
504
+ "min-block-size",
505
+ "min-height",
506
+ "min-inline-size",
507
+ "min-width",
508
+ "mix-blend-mode",
509
+ "object-fit",
510
+ "object-position",
511
+ "offset",
512
+ "offset-anchor",
513
+ "offset-distance",
514
+ "offset-path",
515
+ "offset-position",
516
+ "offset-rotate",
517
+ "opacity",
518
+ "order",
519
+ "orphans",
520
+ "outline",
521
+ "outline-color",
522
+ "outline-offset",
523
+ "outline-style",
524
+ "outline-width",
525
+ "overflow",
526
+ "overflow-anchor",
527
+ "overflow-block",
528
+ "overflow-clip-margin",
529
+ "overflow-inline",
530
+ "overflow-wrap",
531
+ "overflow-x",
532
+ "overflow-y",
533
+ "overscroll-behavior",
534
+ "overscroll-behavior-block",
535
+ "overscroll-behavior-inline",
536
+ "overscroll-behavior-x",
537
+ "overscroll-behavior-y",
538
+ "padding",
539
+ "padding-top",
540
+ "padding-right",
541
+ "padding-bottom",
542
+ "padding-left",
543
+ "padding-block",
544
+ "padding-block-end",
545
+ "padding-block-start",
546
+ "padding-inline",
547
+ "padding-inline-end",
548
+ "padding-inline-start",
549
+ "page",
550
+ "page-break-after",
551
+ "page-break-before",
552
+ "page-break-inside",
553
+ "paint-order",
554
+ "perspective",
555
+ "perspective-origin",
556
+ "place-content",
557
+ "align-content",
558
+ "justify-content",
559
+ "place-items",
560
+ "align-items",
561
+ "justify-items",
562
+ "place-self",
563
+ "align-self",
564
+ "justify-self",
565
+ "pointer-events",
566
+ "position",
567
+ "print-color-adjust",
568
+ "quotes",
569
+ "resize",
570
+ "rotate",
571
+ "ruby-align",
572
+ "ruby-merge",
573
+ "ruby-position",
574
+ "scale",
575
+ "scroll-behavior",
576
+ "scroll-margin",
577
+ "scroll-margin-top",
578
+ "scroll-margin-right",
579
+ "scroll-margin-bottom",
580
+ "scroll-margin-left",
581
+ "scroll-margin-block",
582
+ "scroll-margin-block-end",
583
+ "scroll-margin-block-start",
584
+ "scroll-margin-inline",
585
+ "scroll-margin-inline-end",
586
+ "scroll-margin-inline-start",
587
+ "scroll-padding",
588
+ "scroll-padding-top",
589
+ "scroll-padding-right",
590
+ "scroll-padding-bottom",
591
+ "scroll-padding-left",
592
+ "scroll-padding-block",
593
+ "scroll-padding-block-end",
594
+ "scroll-padding-block-start",
595
+ "scroll-padding-inline",
596
+ "scroll-padding-inline-end",
597
+ "scroll-padding-inline-start",
598
+ "scroll-snap-align",
599
+ "scroll-snap-stop",
600
+ "scroll-snap-type",
601
+ "scroll-timeline",
602
+ "scroll-timeline-axis",
603
+ "scroll-timeline-name",
604
+ "scrollbar-color",
605
+ "scrollbar-gutter",
606
+ "scrollbar-width",
607
+ "shape-image-threshold",
608
+ "shape-margin",
609
+ "shape-outside",
610
+ "tab-size",
611
+ "table-layout",
612
+ "text-align",
613
+ "text-align-last",
614
+ "text-combine-upright",
615
+ "text-decoration",
616
+ "text-decoration-color",
617
+ "text-decoration-line",
618
+ "text-decoration-style",
619
+ "text-decoration-thickness",
620
+ "text-decoration-skip-ink",
621
+ "text-emphasis",
622
+ "text-emphasis-color",
623
+ "text-emphasis-position",
624
+ "text-emphasis-style",
625
+ "text-indent",
626
+ "text-justify",
627
+ "text-orientation",
628
+ "text-overflow",
629
+ "text-rendering",
630
+ "text-shadow",
631
+ "text-size-adjust",
632
+ "text-transform",
633
+ "text-underline-offset",
634
+ "text-underline-position",
635
+ "touch-action",
636
+ "transform",
637
+ "transform-box",
638
+ "transform-origin",
639
+ "transform-style",
640
+ "transition",
641
+ "transition-delay",
642
+ "transition-duration",
643
+ "transition-property",
644
+ "transition-timing-function",
645
+ "translate",
646
+ "unicode-bidi",
647
+ "user-select",
648
+ "vertical-align",
649
+ "view-transition-name",
650
+ "visibility",
651
+ "white-space",
652
+ "widows",
653
+ "width",
654
+ "will-change",
655
+ "word-break",
656
+ "word-spacing",
657
+ "word-wrap",
658
+ "writing-mode",
659
+ "z-index",
660
+ "zoom"
661
+ ];
662
+ export {
663
+ ArbitraryValue,
664
+ GridValue,
665
+ TokenProperty,
666
+ TokenValue,
667
+ arbitraryValue,
668
+ createConfig,
669
+ config_default_default as defaultConfig,
670
+ getTokenPropertyName,
671
+ getTokenValueParts,
672
+ properties,
673
+ tokenProperty,
674
+ tokenValue,
675
+ variantProperty
676
+ };
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@tokenami/config",
3
+ "version": "0.0.11",
4
+ "license": "MIT",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "repository": "https://github.com/tokenami/tokenami",
9
+ "sideEffects": false,
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "dependencies": {
14
+ "valibot": "^0.25.0"
15
+ },
16
+ "devDependencies": {
17
+ "csstype": "^3.1.2",
18
+ "tsup": "^7.0.0",
19
+ "typescript": "^5.1.3",
20
+ "@tokenami/dev": "0.0.11"
21
+ },
22
+ "scripts": {
23
+ "build": "tsup src/index.ts --format=esm,cjs --dts",
24
+ "typecheck": "tsc --noEmit",
25
+ "typecheck:ci": "pnpm typecheck"
26
+ }
27
+ }