@tokenami/config 0.0.27 → 0.0.29

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 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 (CSSProperty | (string & {}))[]>;
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];
@@ -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']): ("accent-color" | "align-content" | "align-items" | "align-self" | "align-tracks" | "animation-composition" | "animation-delay" | "animation-direction" | "animation-duration" | "animation-fill-mode" | "animation-iteration-count" | "animation-name" | "animation-play-state" | "animation-timeline" | "animation-timing-function" | "appearance" | "aspect-ratio" | "backdrop-filter" | "backface-visibility" | "background-attachment" | "background-blend-mode" | "background-clip" | "background-color" | "background-image" | "background-origin" | "background-position-x" | "background-position-y" | "background-repeat" | "background-size" | "block-size" | "border-block-color" | "border-block-end-color" | "border-block-end-style" | "border-block-end-width" | "border-block-start-color" | "border-block-start-style" | "border-block-start-width" | "border-block-style" | "border-block-width" | "border-bottom-color" | "border-bottom-left-radius" | "border-bottom-right-radius" | "border-bottom-style" | "border-bottom-width" | "border-collapse" | "border-end-end-radius" | "border-end-start-radius" | "border-image-outset" | "border-image-repeat" | "border-image-slice" | "border-image-source" | "border-image-width" | "border-inline-color" | "border-inline-end-color" | "border-inline-end-style" | "border-inline-end-width" | "border-inline-start-color" | "border-inline-start-style" | "border-inline-start-width" | "border-inline-style" | "border-inline-width" | "border-left-color" | "border-left-style" | "border-left-width" | "border-right-color" | "border-right-style" | "border-right-width" | "border-spacing" | "border-start-end-radius" | "border-start-start-radius" | "border-top-color" | "border-top-left-radius" | "border-top-right-radius" | "border-top-style" | "border-top-width" | "bottom" | "box-decoration-break" | "box-shadow" | "box-sizing" | "break-after" | "break-before" | "break-inside" | "caption-side" | "caret-color" | "caret-shape" | "clear" | "clip-path" | "color" | "color-scheme" | "column-count" | "column-fill" | "column-gap" | "column-rule-color" | "column-rule-style" | "column-rule-width" | "column-span" | "column-width" | "contain" | "contain-intrinsic-block-size" | "contain-intrinsic-height" | "contain-intrinsic-inline-size" | "contain-intrinsic-width" | "container-name" | "container-type" | "content" | "content-visibility" | "counter-increment" | "counter-reset" | "counter-set" | "cursor" | "direction" | "display" | "empty-cells" | "filter" | "flex-basis" | "flex-direction" | "flex-grow" | "flex-shrink" | "flex-wrap" | "float" | "font-family" | "font-feature-settings" | "font-kerning" | "font-language-override" | "font-optical-sizing" | "font-palette" | "font-size" | "font-size-adjust" | "font-stretch" | "font-style" | "font-synthesis" | "font-variant" | "font-variant-alternates" | "font-variant-caps" | "font-variant-east-asian" | "font-variant-emoji" | "font-variant-ligatures" | "font-variant-numeric" | "font-variant-position" | "font-variation-settings" | "font-weight" | "forced-color-adjust" | "grid-auto-columns" | "grid-auto-flow" | "grid-auto-rows" | "grid-column-end" | "grid-column-start" | "grid-row-end" | "grid-row-start" | "grid-template-areas" | "grid-template-columns" | "grid-template-rows" | "hanging-punctuation" | "height" | "hyphenate-character" | "hyphenate-limit-chars" | "hyphens" | "image-orientation" | "image-rendering" | "image-resolution" | "initial-letter" | "inline-size" | "input-security" | "inset-block-end" | "inset-block-start" | "inset-inline-end" | "inset-inline-start" | "isolation" | "justify-content" | "justify-items" | "justify-self" | "justify-tracks" | "left" | "letter-spacing" | "line-break" | "line-height" | "line-height-step" | "list-style-image" | "list-style-position" | "list-style-type" | "margin-block-end" | "margin-block-start" | "margin-bottom" | "margin-inline-end" | "margin-inline-start" | "margin-left" | "margin-right" | "margin-top" | "margin-trim" | "mask-border-mode" | "mask-border-outset" | "mask-border-repeat" | "mask-border-slice" | "mask-border-source" | "mask-border-width" | "mask-clip" | "mask-composite" | "mask-image" | "mask-mode" | "mask-origin" | "mask-position" | "mask-repeat" | "mask-size" | "mask-type" | "math-depth" | "math-shift" | "math-style" | "max-block-size" | "max-height" | "max-inline-size" | "max-lines" | "max-width" | "min-block-size" | "min-height" | "min-inline-size" | "min-width" | "mix-blend-mode" | "object-fit" | "object-position" | "offset-anchor" | "offset-distance" | "offset-path" | "offset-position" | "offset-rotate" | "opacity" | "order" | "orphans" | "outline-color" | "outline-offset" | "outline-style" | "outline-width" | "overflow-anchor" | "overflow-block" | "overflow-clip-margin" | "overflow-inline" | "overflow-wrap" | "overflow-x" | "overflow-y" | "overscroll-behavior-block" | "overscroll-behavior-inline" | "overscroll-behavior-x" | "overscroll-behavior-y" | "padding-block-end" | "padding-block-start" | "padding-bottom" | "padding-inline-end" | "padding-inline-start" | "padding-left" | "padding-right" | "padding-top" | "page" | "page-break-after" | "page-break-before" | "page-break-inside" | "paint-order" | "perspective" | "perspective-origin" | "pointer-events" | "position" | "print-color-adjust" | "quotes" | "resize" | "right" | "rotate" | "row-gap" | "ruby-align" | "ruby-merge" | "ruby-position" | "scale" | "scroll-behavior" | "scroll-margin-block-end" | "scroll-margin-block-start" | "scroll-margin-bottom" | "scroll-margin-inline-end" | "scroll-margin-inline-start" | "scroll-margin-left" | "scroll-margin-right" | "scroll-margin-top" | "scroll-padding-block-end" | "scroll-padding-block-start" | "scroll-padding-bottom" | "scroll-padding-inline-end" | "scroll-padding-inline-start" | "scroll-padding-left" | "scroll-padding-right" | "scroll-padding-top" | "scroll-snap-align" | "scroll-snap-stop" | "scroll-snap-type" | "scroll-timeline-axis" | "scroll-timeline-name" | "scrollbar-color" | "scrollbar-gutter" | "scrollbar-width" | "shape-image-threshold" | "shape-margin" | "shape-outside" | "tab-size" | "table-layout" | "text-align" | "text-align-last" | "text-combine-upright" | "text-decoration-color" | "text-decoration-line" | "text-decoration-skip-ink" | "text-decoration-style" | "text-decoration-thickness" | "text-emphasis-color" | "text-emphasis-position" | "text-emphasis-style" | "text-indent" | "text-justify" | "text-orientation" | "text-overflow" | "text-rendering" | "text-shadow" | "text-size-adjust" | "text-transform" | "text-underline-offset" | "text-underline-position" | "top" | "touch-action" | "transform" | "transform-box" | "transform-origin" | "transform-style" | "transition-delay" | "transition-duration" | "transition-property" | "transition-timing-function" | "translate" | "unicode-bidi" | "user-select" | "vertical-align" | "view-transition-name" | "visibility" | "white-space" | "widows" | "width" | "will-change" | "word-break" | "word-spacing" | "word-wrap" | "writing-mode" | "z-index" | "zoom" | "all" | "animation" | "background" | "background-position" | "border" | "border-block" | "border-block-end" | "border-block-start" | "border-bottom" | "border-color" | "border-image" | "border-inline" | "border-inline-end" | "border-inline-start" | "border-left" | "border-radius" | "border-right" | "border-style" | "border-top" | "border-width" | "caret" | "column-rule" | "columns" | "contain-intrinsic-size" | "container" | "flex" | "flex-flow" | "font" | "gap" | "grid" | "grid-area" | "grid-column" | "grid-row" | "grid-template" | "inset" | "inset-block" | "inset-inline" | "line-clamp" | "list-style" | "margin" | "margin-block" | "margin-inline" | "mask" | "mask-border" | "offset" | "outline" | "overflow" | "overscroll-behavior" | "padding" | "padding-block" | "padding-inline" | "place-content" | "place-items" | "place-self" | "scroll-margin" | "scroll-margin-block" | "scroll-margin-inline" | "scroll-padding" | "scroll-padding-block" | "scroll-padding-inline" | "scroll-timeline" | "text-decoration" | "text-emphasis" | "transition" | "-webkit-line-clamp" | "clip")[];
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 (CSSProperty | (string & {}))[]>;
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];
@@ -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']): ("accent-color" | "align-content" | "align-items" | "align-self" | "align-tracks" | "animation-composition" | "animation-delay" | "animation-direction" | "animation-duration" | "animation-fill-mode" | "animation-iteration-count" | "animation-name" | "animation-play-state" | "animation-timeline" | "animation-timing-function" | "appearance" | "aspect-ratio" | "backdrop-filter" | "backface-visibility" | "background-attachment" | "background-blend-mode" | "background-clip" | "background-color" | "background-image" | "background-origin" | "background-position-x" | "background-position-y" | "background-repeat" | "background-size" | "block-size" | "border-block-color" | "border-block-end-color" | "border-block-end-style" | "border-block-end-width" | "border-block-start-color" | "border-block-start-style" | "border-block-start-width" | "border-block-style" | "border-block-width" | "border-bottom-color" | "border-bottom-left-radius" | "border-bottom-right-radius" | "border-bottom-style" | "border-bottom-width" | "border-collapse" | "border-end-end-radius" | "border-end-start-radius" | "border-image-outset" | "border-image-repeat" | "border-image-slice" | "border-image-source" | "border-image-width" | "border-inline-color" | "border-inline-end-color" | "border-inline-end-style" | "border-inline-end-width" | "border-inline-start-color" | "border-inline-start-style" | "border-inline-start-width" | "border-inline-style" | "border-inline-width" | "border-left-color" | "border-left-style" | "border-left-width" | "border-right-color" | "border-right-style" | "border-right-width" | "border-spacing" | "border-start-end-radius" | "border-start-start-radius" | "border-top-color" | "border-top-left-radius" | "border-top-right-radius" | "border-top-style" | "border-top-width" | "bottom" | "box-decoration-break" | "box-shadow" | "box-sizing" | "break-after" | "break-before" | "break-inside" | "caption-side" | "caret-color" | "caret-shape" | "clear" | "clip-path" | "color" | "color-scheme" | "column-count" | "column-fill" | "column-gap" | "column-rule-color" | "column-rule-style" | "column-rule-width" | "column-span" | "column-width" | "contain" | "contain-intrinsic-block-size" | "contain-intrinsic-height" | "contain-intrinsic-inline-size" | "contain-intrinsic-width" | "container-name" | "container-type" | "content" | "content-visibility" | "counter-increment" | "counter-reset" | "counter-set" | "cursor" | "direction" | "display" | "empty-cells" | "filter" | "flex-basis" | "flex-direction" | "flex-grow" | "flex-shrink" | "flex-wrap" | "float" | "font-family" | "font-feature-settings" | "font-kerning" | "font-language-override" | "font-optical-sizing" | "font-palette" | "font-size" | "font-size-adjust" | "font-stretch" | "font-style" | "font-synthesis" | "font-variant" | "font-variant-alternates" | "font-variant-caps" | "font-variant-east-asian" | "font-variant-emoji" | "font-variant-ligatures" | "font-variant-numeric" | "font-variant-position" | "font-variation-settings" | "font-weight" | "forced-color-adjust" | "grid-auto-columns" | "grid-auto-flow" | "grid-auto-rows" | "grid-column-end" | "grid-column-start" | "grid-row-end" | "grid-row-start" | "grid-template-areas" | "grid-template-columns" | "grid-template-rows" | "hanging-punctuation" | "height" | "hyphenate-character" | "hyphenate-limit-chars" | "hyphens" | "image-orientation" | "image-rendering" | "image-resolution" | "initial-letter" | "inline-size" | "input-security" | "inset-block-end" | "inset-block-start" | "inset-inline-end" | "inset-inline-start" | "isolation" | "justify-content" | "justify-items" | "justify-self" | "justify-tracks" | "left" | "letter-spacing" | "line-break" | "line-height" | "line-height-step" | "list-style-image" | "list-style-position" | "list-style-type" | "margin-block-end" | "margin-block-start" | "margin-bottom" | "margin-inline-end" | "margin-inline-start" | "margin-left" | "margin-right" | "margin-top" | "margin-trim" | "mask-border-mode" | "mask-border-outset" | "mask-border-repeat" | "mask-border-slice" | "mask-border-source" | "mask-border-width" | "mask-clip" | "mask-composite" | "mask-image" | "mask-mode" | "mask-origin" | "mask-position" | "mask-repeat" | "mask-size" | "mask-type" | "math-depth" | "math-shift" | "math-style" | "max-block-size" | "max-height" | "max-inline-size" | "max-lines" | "max-width" | "min-block-size" | "min-height" | "min-inline-size" | "min-width" | "mix-blend-mode" | "object-fit" | "object-position" | "offset-anchor" | "offset-distance" | "offset-path" | "offset-position" | "offset-rotate" | "opacity" | "order" | "orphans" | "outline-color" | "outline-offset" | "outline-style" | "outline-width" | "overflow-anchor" | "overflow-block" | "overflow-clip-margin" | "overflow-inline" | "overflow-wrap" | "overflow-x" | "overflow-y" | "overscroll-behavior-block" | "overscroll-behavior-inline" | "overscroll-behavior-x" | "overscroll-behavior-y" | "padding-block-end" | "padding-block-start" | "padding-bottom" | "padding-inline-end" | "padding-inline-start" | "padding-left" | "padding-right" | "padding-top" | "page" | "page-break-after" | "page-break-before" | "page-break-inside" | "paint-order" | "perspective" | "perspective-origin" | "pointer-events" | "position" | "print-color-adjust" | "quotes" | "resize" | "right" | "rotate" | "row-gap" | "ruby-align" | "ruby-merge" | "ruby-position" | "scale" | "scroll-behavior" | "scroll-margin-block-end" | "scroll-margin-block-start" | "scroll-margin-bottom" | "scroll-margin-inline-end" | "scroll-margin-inline-start" | "scroll-margin-left" | "scroll-margin-right" | "scroll-margin-top" | "scroll-padding-block-end" | "scroll-padding-block-start" | "scroll-padding-bottom" | "scroll-padding-inline-end" | "scroll-padding-inline-start" | "scroll-padding-left" | "scroll-padding-right" | "scroll-padding-top" | "scroll-snap-align" | "scroll-snap-stop" | "scroll-snap-type" | "scroll-timeline-axis" | "scroll-timeline-name" | "scrollbar-color" | "scrollbar-gutter" | "scrollbar-width" | "shape-image-threshold" | "shape-margin" | "shape-outside" | "tab-size" | "table-layout" | "text-align" | "text-align-last" | "text-combine-upright" | "text-decoration-color" | "text-decoration-line" | "text-decoration-skip-ink" | "text-decoration-style" | "text-decoration-thickness" | "text-emphasis-color" | "text-emphasis-position" | "text-emphasis-style" | "text-indent" | "text-justify" | "text-orientation" | "text-overflow" | "text-rendering" | "text-shadow" | "text-size-adjust" | "text-transform" | "text-underline-offset" | "text-underline-position" | "top" | "touch-action" | "transform" | "transform-box" | "transform-origin" | "transform-style" | "transition-delay" | "transition-duration" | "transition-property" | "transition-timing-function" | "translate" | "unicode-bidi" | "user-select" | "vertical-align" | "view-transition-name" | "visibility" | "white-space" | "widows" | "width" | "will-change" | "word-break" | "word-spacing" | "word-wrap" | "writing-mode" | "z-index" | "zoom" | "all" | "animation" | "background" | "background-position" | "border" | "border-block" | "border-block-end" | "border-block-start" | "border-bottom" | "border-color" | "border-image" | "border-inline" | "border-inline-end" | "border-inline-start" | "border-left" | "border-radius" | "border-right" | "border-style" | "border-top" | "border-width" | "caret" | "column-rule" | "columns" | "contain-intrinsic-size" | "container" | "flex" | "flex-flow" | "font" | "gap" | "grid" | "grid-area" | "grid-column" | "grid-row" | "grid-template" | "inset" | "inset-block" | "inset-inline" | "line-clamp" | "list-style" | "margin" | "margin-block" | "margin-inline" | "mask" | "mask-border" | "offset" | "outline" | "overflow" | "overscroll-behavior" | "padding" | "padding-block" | "padding-inline" | "place-content" | "place-items" | "place-self" | "scroll-margin" | "scroll-margin-block" | "scroll-margin-inline" | "scroll-padding" | "scroll-padding-block" | "scroll-padding-inline" | "scroll-timeline" | "text-decoration" | "text-emphasis" | "transition" | "-webkit-line-clamp" | "clip")[];
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,247 @@ __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 [v1, v2, ...invalidVariants] = variants;
115
+ const responsive = ((_a = config.responsive) == null ? void 0 : _a[v1]) && v1;
116
+ const selectorVariant1 = ((_b = config.selectors) == null ? void 0 : _b[v1]) && !v2 ? v1 : void 0;
117
+ const selectorVariant2 = responsive && ((_c = config.selectors) == null ? void 0 : _c[v2]) && v2;
118
+ const selector = selectorVariant1 || selectorVariant2;
119
+ const hasInvalidVariant = v1 && !responsive && !selector;
120
+ const variant = [responsive, selector].filter(Boolean).join("_");
121
+ if (invalidVariants.length || hasInvalidVariant)
122
+ return null;
123
+ return { name, alias, responsive, selector, variant };
124
+ }
125
+ function getTokenValueParts(tokenValue2) {
126
+ const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
127
+ return { property, themeKey, token };
128
+ }
129
+ function getCSSPropertiesForAlias(alias, aliases) {
130
+ return (aliases == null ? void 0 : aliases[alias]) || [alias];
131
+ }
132
+
133
+ // src/config.default.ts
134
+ var defaultConfig = createConfig({
135
+ include: [],
136
+ grid: "0.25rem",
137
+ responsive: {},
138
+ theme: {},
139
+ aliases: {},
140
+ selectors: {
141
+ after: "&::after",
142
+ before: "&::before",
143
+ even: "&:nth-child(even)",
144
+ odd: "&:nth-child(odd)",
145
+ "first-child": "&:first-child",
146
+ "last-child": "&:last-child",
147
+ placeholder: "&::placeholder",
148
+ hover: "&:hover",
149
+ focus: "&:focus",
150
+ "focus-visible": "&:focus-visible",
151
+ "focus-within": "&:focus-within",
152
+ active: "&:active",
153
+ disabled: "&:disabled"
154
+ },
155
+ properties: {
156
+ "accent-color": ["color"],
157
+ animation: ["anim"],
158
+ "animation-timing-function": ["ease"],
159
+ background: ["color", "surface"],
160
+ "background-color": ["color"],
161
+ "background-image": ["surface"],
162
+ "background-position": ["grid"],
163
+ "background-position-x": ["grid"],
164
+ "background-position-y": ["grid"],
165
+ "block-size": ["grid", "size"],
166
+ border: ["border"],
167
+ "border-block": ["border"],
168
+ "border-block-color": ["color"],
169
+ "border-block-end": ["border"],
170
+ "border-block-end-color": ["color"],
171
+ "border-block-end-style": ["line-style"],
172
+ "border-block-start": ["border"],
173
+ "border-block-start-color": ["color"],
174
+ "border-block-start-style": ["line-style"],
175
+ "border-block-style": ["line-style"],
176
+ "border-bottom": ["border"],
177
+ "border-bottom-color": ["color"],
178
+ "border-bottom-left-radius": ["radii"],
179
+ "border-bottom-right-radius": ["radii"],
180
+ "border-bottom-style": ["line-style"],
181
+ "border-color": ["color"],
182
+ "border-end-end-radius": ["radii"],
183
+ "border-end-start-radius": ["radii"],
184
+ "border-inline": ["border"],
185
+ "border-inline-color": ["color"],
186
+ "border-inline-end": ["border"],
187
+ "border-inline-end-color": ["color"],
188
+ "border-inline-end-style": ["line-style"],
189
+ "border-inline-start": ["border"],
190
+ "border-inline-start-color": ["color"],
191
+ "border-inline-start-style": ["line-style"],
192
+ "border-inline-style": ["line-style"],
193
+ "border-left": ["border"],
194
+ "border-left-color": ["color"],
195
+ "border-left-style": ["line-style"],
196
+ "border-radius": ["radii"],
197
+ "border-right": ["border"],
198
+ "border-right-color": ["color"],
199
+ "border-right-style": ["line-style"],
200
+ "border-start-end-radius": ["radii"],
201
+ "border-start-start-radius": ["radii"],
202
+ "border-style": ["line-style"],
203
+ "border-top": ["border"],
204
+ "border-top-color": ["color"],
205
+ "border-top-left-radius": ["radii"],
206
+ "border-top-right-radius": ["radii"],
207
+ "border-top-style": ["line-style"],
208
+ bottom: ["grid"],
209
+ "box-shadow": ["shadow"],
210
+ "caret-color": ["color"],
211
+ color: ["color"],
212
+ "column-gap": ["grid"],
213
+ "column-rule-color": ["color"],
214
+ "column-rule-width": ["grid"],
215
+ "column-width": ["grid", "size"],
216
+ "flex-basis": ["grid", "size"],
217
+ "font-family": ["font"],
218
+ "font-size": ["font-size"],
219
+ "font-weight": ["weight"],
220
+ gap: ["grid"],
221
+ height: ["grid", "size"],
222
+ "inline-size": ["grid", "size"],
223
+ inset: ["grid"],
224
+ "inset-block": ["grid"],
225
+ "inset-block-end": ["grid"],
226
+ "inset-block-start": ["grid"],
227
+ "inset-inline": ["grid"],
228
+ "inset-inline-end": ["grid"],
229
+ "inset-inline-start": ["grid"],
230
+ left: ["grid"],
231
+ "letter-spacing": ["tracking"],
232
+ "line-height": ["leading"],
233
+ margin: ["grid"],
234
+ "margin-block": ["grid"],
235
+ "margin-block-end": ["grid"],
236
+ "margin-block-start": ["grid"],
237
+ "margin-bottom": ["grid"],
238
+ "margin-inline": ["grid"],
239
+ "margin-inline-end": ["grid"],
240
+ "margin-inline-start": ["grid"],
241
+ "margin-left": ["grid"],
242
+ "margin-right": ["grid"],
243
+ "margin-top": ["grid"],
244
+ "max-block-size": ["grid", "size"],
245
+ "max-height": ["grid", "size"],
246
+ "max-inline-size": ["grid", "size"],
247
+ "max-width": ["grid", "size"],
248
+ "min-block-size": ["grid", "size"],
249
+ "min-height": ["grid", "size"],
250
+ "min-inline-size": ["grid", "size"],
251
+ "min-width": ["grid", "size"],
252
+ opacity: ["alpha"],
253
+ "outline-color": ["color"],
254
+ padding: ["grid"],
255
+ "padding-block": ["grid"],
256
+ "padding-block-end": ["grid"],
257
+ "padding-block-start": ["grid"],
258
+ "padding-bottom": ["grid"],
259
+ "padding-inline": ["grid"],
260
+ "padding-inline-end": ["grid"],
261
+ "padding-inline-start": ["grid"],
262
+ "padding-left": ["grid"],
263
+ "padding-right": ["grid"],
264
+ "padding-top": ["grid"],
265
+ right: ["grid"],
266
+ "row-gap": ["grid"],
267
+ "scroll-margin": ["grid"],
268
+ "scroll-margin-bottom": ["grid"],
269
+ "scroll-margin-left": ["grid"],
270
+ "scroll-margin-right": ["grid"],
271
+ "scroll-margin-top": ["grid"],
272
+ "scroll-padding": ["grid"],
273
+ "scroll-padding-bottom": ["grid"],
274
+ "scroll-padding-left": ["grid"],
275
+ "scroll-padding-right": ["grid"],
276
+ "scroll-padding-top": ["grid"],
277
+ "text-decoration-color": ["color"],
278
+ "text-shadow": ["shadow"],
279
+ top: ["grid"],
280
+ transition: ["transition"],
281
+ "transition-timing-function": ["ease"],
282
+ width: ["grid", "size"],
283
+ "z-index": ["z"]
284
+ }
285
+ });
286
+ var config_default_default = defaultConfig;
287
+
47
288
  // src/supports.ts
48
289
  var logicalProperties = [
49
290
  "block-size",
@@ -464,250 +705,6 @@ var properties = [
464
705
  ...logicalProperties
465
706
  ];
466
707
 
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
708
  // src/shorthands.ts
712
709
  var mapShorthandToLonghands = {
713
710
  all: [],
package/dist/index.mjs CHANGED
@@ -1,3 +1,244 @@
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 [v1, v2, ...invalidVariants] = variants;
69
+ const responsive = ((_a = config.responsive) == null ? void 0 : _a[v1]) && v1;
70
+ const selectorVariant1 = ((_b = config.selectors) == null ? void 0 : _b[v1]) && !v2 ? v1 : void 0;
71
+ const selectorVariant2 = responsive && ((_c = config.selectors) == null ? void 0 : _c[v2]) && v2;
72
+ const selector = selectorVariant1 || selectorVariant2;
73
+ const hasInvalidVariant = v1 && !responsive && !selector;
74
+ const variant = [responsive, selector].filter(Boolean).join("_");
75
+ if (invalidVariants.length || hasInvalidVariant)
76
+ return null;
77
+ return { name, alias, responsive, selector, variant };
78
+ }
79
+ function getTokenValueParts(tokenValue2) {
80
+ const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
81
+ return { property, themeKey, token };
82
+ }
83
+ function getCSSPropertiesForAlias(alias, aliases) {
84
+ return (aliases == null ? void 0 : aliases[alias]) || [alias];
85
+ }
86
+
87
+ // src/config.default.ts
88
+ var defaultConfig = createConfig({
89
+ include: [],
90
+ grid: "0.25rem",
91
+ responsive: {},
92
+ theme: {},
93
+ aliases: {},
94
+ selectors: {
95
+ after: "&::after",
96
+ before: "&::before",
97
+ even: "&:nth-child(even)",
98
+ odd: "&:nth-child(odd)",
99
+ "first-child": "&:first-child",
100
+ "last-child": "&:last-child",
101
+ placeholder: "&::placeholder",
102
+ hover: "&:hover",
103
+ focus: "&:focus",
104
+ "focus-visible": "&:focus-visible",
105
+ "focus-within": "&:focus-within",
106
+ active: "&:active",
107
+ disabled: "&:disabled"
108
+ },
109
+ properties: {
110
+ "accent-color": ["color"],
111
+ animation: ["anim"],
112
+ "animation-timing-function": ["ease"],
113
+ background: ["color", "surface"],
114
+ "background-color": ["color"],
115
+ "background-image": ["surface"],
116
+ "background-position": ["grid"],
117
+ "background-position-x": ["grid"],
118
+ "background-position-y": ["grid"],
119
+ "block-size": ["grid", "size"],
120
+ border: ["border"],
121
+ "border-block": ["border"],
122
+ "border-block-color": ["color"],
123
+ "border-block-end": ["border"],
124
+ "border-block-end-color": ["color"],
125
+ "border-block-end-style": ["line-style"],
126
+ "border-block-start": ["border"],
127
+ "border-block-start-color": ["color"],
128
+ "border-block-start-style": ["line-style"],
129
+ "border-block-style": ["line-style"],
130
+ "border-bottom": ["border"],
131
+ "border-bottom-color": ["color"],
132
+ "border-bottom-left-radius": ["radii"],
133
+ "border-bottom-right-radius": ["radii"],
134
+ "border-bottom-style": ["line-style"],
135
+ "border-color": ["color"],
136
+ "border-end-end-radius": ["radii"],
137
+ "border-end-start-radius": ["radii"],
138
+ "border-inline": ["border"],
139
+ "border-inline-color": ["color"],
140
+ "border-inline-end": ["border"],
141
+ "border-inline-end-color": ["color"],
142
+ "border-inline-end-style": ["line-style"],
143
+ "border-inline-start": ["border"],
144
+ "border-inline-start-color": ["color"],
145
+ "border-inline-start-style": ["line-style"],
146
+ "border-inline-style": ["line-style"],
147
+ "border-left": ["border"],
148
+ "border-left-color": ["color"],
149
+ "border-left-style": ["line-style"],
150
+ "border-radius": ["radii"],
151
+ "border-right": ["border"],
152
+ "border-right-color": ["color"],
153
+ "border-right-style": ["line-style"],
154
+ "border-start-end-radius": ["radii"],
155
+ "border-start-start-radius": ["radii"],
156
+ "border-style": ["line-style"],
157
+ "border-top": ["border"],
158
+ "border-top-color": ["color"],
159
+ "border-top-left-radius": ["radii"],
160
+ "border-top-right-radius": ["radii"],
161
+ "border-top-style": ["line-style"],
162
+ bottom: ["grid"],
163
+ "box-shadow": ["shadow"],
164
+ "caret-color": ["color"],
165
+ color: ["color"],
166
+ "column-gap": ["grid"],
167
+ "column-rule-color": ["color"],
168
+ "column-rule-width": ["grid"],
169
+ "column-width": ["grid", "size"],
170
+ "flex-basis": ["grid", "size"],
171
+ "font-family": ["font"],
172
+ "font-size": ["font-size"],
173
+ "font-weight": ["weight"],
174
+ gap: ["grid"],
175
+ height: ["grid", "size"],
176
+ "inline-size": ["grid", "size"],
177
+ inset: ["grid"],
178
+ "inset-block": ["grid"],
179
+ "inset-block-end": ["grid"],
180
+ "inset-block-start": ["grid"],
181
+ "inset-inline": ["grid"],
182
+ "inset-inline-end": ["grid"],
183
+ "inset-inline-start": ["grid"],
184
+ left: ["grid"],
185
+ "letter-spacing": ["tracking"],
186
+ "line-height": ["leading"],
187
+ margin: ["grid"],
188
+ "margin-block": ["grid"],
189
+ "margin-block-end": ["grid"],
190
+ "margin-block-start": ["grid"],
191
+ "margin-bottom": ["grid"],
192
+ "margin-inline": ["grid"],
193
+ "margin-inline-end": ["grid"],
194
+ "margin-inline-start": ["grid"],
195
+ "margin-left": ["grid"],
196
+ "margin-right": ["grid"],
197
+ "margin-top": ["grid"],
198
+ "max-block-size": ["grid", "size"],
199
+ "max-height": ["grid", "size"],
200
+ "max-inline-size": ["grid", "size"],
201
+ "max-width": ["grid", "size"],
202
+ "min-block-size": ["grid", "size"],
203
+ "min-height": ["grid", "size"],
204
+ "min-inline-size": ["grid", "size"],
205
+ "min-width": ["grid", "size"],
206
+ opacity: ["alpha"],
207
+ "outline-color": ["color"],
208
+ padding: ["grid"],
209
+ "padding-block": ["grid"],
210
+ "padding-block-end": ["grid"],
211
+ "padding-block-start": ["grid"],
212
+ "padding-bottom": ["grid"],
213
+ "padding-inline": ["grid"],
214
+ "padding-inline-end": ["grid"],
215
+ "padding-inline-start": ["grid"],
216
+ "padding-left": ["grid"],
217
+ "padding-right": ["grid"],
218
+ "padding-top": ["grid"],
219
+ right: ["grid"],
220
+ "row-gap": ["grid"],
221
+ "scroll-margin": ["grid"],
222
+ "scroll-margin-bottom": ["grid"],
223
+ "scroll-margin-left": ["grid"],
224
+ "scroll-margin-right": ["grid"],
225
+ "scroll-margin-top": ["grid"],
226
+ "scroll-padding": ["grid"],
227
+ "scroll-padding-bottom": ["grid"],
228
+ "scroll-padding-left": ["grid"],
229
+ "scroll-padding-right": ["grid"],
230
+ "scroll-padding-top": ["grid"],
231
+ "text-decoration-color": ["color"],
232
+ "text-shadow": ["shadow"],
233
+ top: ["grid"],
234
+ transition: ["transition"],
235
+ "transition-timing-function": ["ease"],
236
+ width: ["grid", "size"],
237
+ "z-index": ["z"]
238
+ }
239
+ });
240
+ var config_default_default = defaultConfig;
241
+
1
242
  // src/supports.ts
2
243
  var logicalProperties = [
3
244
  "block-size",
@@ -418,250 +659,6 @@ var properties = [
418
659
  ...logicalProperties
419
660
  ];
420
661
 
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
662
  // src/shorthands.ts
666
663
  var mapShorthandToLonghands = {
667
664
  all: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenami/config",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
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.27"
17
+ "@tokenami/dev": "0.0.29"
18
18
  },
19
19
  "scripts": {
20
20
  "build": "tsup src/index.ts --format=esm,cjs --dts",