@tokenami/config 0.0.25 → 0.0.27

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
@@ -224,6 +224,10 @@ interface Config extends DeepReadonly<{
224
224
  }
225
225
  declare const createConfig: <T extends Config>(obj: Exact<Config, T>) => DeepReadonly<T>;
226
226
  declare function getTokenPropertyName(tokenProperty: TokenProperty): string;
227
+ declare function getTokenPropertySplit(tokenProperty: TokenProperty): {
228
+ alias: string;
229
+ variants: (string | undefined)[];
230
+ };
227
231
  type PropertyParts = {
228
232
  name: string;
229
233
  alias: string;
@@ -237,6 +241,7 @@ declare function getTokenValueParts(tokenValue: TokenValue): {
237
241
  themeKey: string;
238
242
  token: string;
239
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")[];
240
245
 
241
246
  declare const mapShorthandToLonghands: {
242
247
  all: never[];
@@ -308,4 +313,4 @@ declare const mapShorthandToLonghands: {
308
313
  transition: ("transition-delay" | "transition-duration" | "transition-property" | "transition-timing-function")[];
309
314
  };
310
315
 
311
- export { type Aliases, ArbitraryValue, type CSSProperty, type Config, type DefaultConfig, GridProperty, GridValue, type Theme, TokenProperty, TokenValue, VariantProperty, arbitraryValue, createConfig, defaultConfig, getTokenPropertyName, getTokenPropertyParts, getTokenValueParts, gridProperty, logicalProperties, mapShorthandToLonghands, properties, tokenProperty, tokenValue, variantProperty };
316
+ export { type Aliases, ArbitraryValue, type CSSProperty, type Config, type DefaultConfig, GridProperty, GridValue, type Theme, TokenProperty, TokenValue, VariantProperty, arbitraryValue, createConfig, defaultConfig, getCSSPropertiesForAlias, getTokenPropertyName, getTokenPropertyParts, getTokenPropertySplit, getTokenValueParts, gridProperty, logicalProperties, mapShorthandToLonghands, properties, tokenProperty, tokenValue, variantProperty };
package/dist/index.d.ts CHANGED
@@ -224,6 +224,10 @@ interface Config extends DeepReadonly<{
224
224
  }
225
225
  declare const createConfig: <T extends Config>(obj: Exact<Config, T>) => DeepReadonly<T>;
226
226
  declare function getTokenPropertyName(tokenProperty: TokenProperty): string;
227
+ declare function getTokenPropertySplit(tokenProperty: TokenProperty): {
228
+ alias: string;
229
+ variants: (string | undefined)[];
230
+ };
227
231
  type PropertyParts = {
228
232
  name: string;
229
233
  alias: string;
@@ -237,6 +241,7 @@ declare function getTokenValueParts(tokenValue: TokenValue): {
237
241
  themeKey: string;
238
242
  token: string;
239
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")[];
240
245
 
241
246
  declare const mapShorthandToLonghands: {
242
247
  all: never[];
@@ -308,4 +313,4 @@ declare const mapShorthandToLonghands: {
308
313
  transition: ("transition-delay" | "transition-duration" | "transition-property" | "transition-timing-function")[];
309
314
  };
310
315
 
311
- export { type Aliases, ArbitraryValue, type CSSProperty, type Config, type DefaultConfig, GridProperty, GridValue, type Theme, TokenProperty, TokenValue, VariantProperty, arbitraryValue, createConfig, defaultConfig, getTokenPropertyName, getTokenPropertyParts, getTokenValueParts, gridProperty, logicalProperties, mapShorthandToLonghands, properties, tokenProperty, tokenValue, variantProperty };
316
+ export { type Aliases, ArbitraryValue, type CSSProperty, type Config, type DefaultConfig, GridProperty, GridValue, type Theme, TokenProperty, TokenValue, VariantProperty, arbitraryValue, createConfig, defaultConfig, getCSSPropertiesForAlias, getTokenPropertyName, getTokenPropertyParts, getTokenPropertySplit, getTokenValueParts, gridProperty, logicalProperties, mapShorthandToLonghands, properties, tokenProperty, tokenValue, variantProperty };
package/dist/index.js CHANGED
@@ -29,8 +29,10 @@ __export(src_exports, {
29
29
  arbitraryValue: () => arbitraryValue,
30
30
  createConfig: () => createConfig,
31
31
  defaultConfig: () => config_default_default,
32
+ getCSSPropertiesForAlias: () => getCSSPropertiesForAlias,
32
33
  getTokenPropertyName: () => getTokenPropertyName,
33
34
  getTokenPropertyParts: () => getTokenPropertyParts,
35
+ getTokenPropertySplit: () => getTokenPropertySplit,
34
36
  getTokenValueParts: () => getTokenValueParts,
35
37
  gridProperty: () => gridProperty,
36
38
  logicalProperties: () => logicalProperties,
@@ -42,239 +44,6 @@ __export(src_exports, {
42
44
  });
43
45
  module.exports = __toCommonJS(src_exports);
44
46
 
45
- // src/config.ts
46
- var gridPropertyRegex = /--_grid/;
47
- var GridProperty = {
48
- safeParse: (input) => validate(gridPropertyRegex, input)
49
- };
50
- function gridProperty() {
51
- return `--_grid`;
52
- }
53
- var gridValueRegex = /^\d+/;
54
- var GridValue = {
55
- safeParse: (input) => validate(gridValueRegex, input)
56
- };
57
- var tokenPropertyRegex = /(?<!var\()--(\w([\w-]+)?)/;
58
- var TokenProperty = {
59
- safeParse: (input) => validate(tokenPropertyRegex, input)
60
- };
61
- function tokenProperty(name) {
62
- return `--${name}`;
63
- }
64
- var variantPropertyRegex = /(?<!var\()--((\w)([\w-]+)_([\w-]+))/;
65
- var VariantProperty = {
66
- safeParse: (input) => validate(variantPropertyRegex, input)
67
- };
68
- function variantProperty(variant, name) {
69
- return `--${variant}_${name}`;
70
- }
71
- var tokenValueRegex = /var\((--([\w-]+)_([\w-]+))\)/;
72
- var TokenValue = {
73
- safeParse: (input) => validate(tokenValueRegex, input)
74
- };
75
- function tokenValue(themeKey, name) {
76
- return `var(--${themeKey}_${name})`;
77
- }
78
- var arbitraryValueRegex = /var\(---,(.+)\)/;
79
- var ArbitraryValue = {
80
- safeParse: (input) => validate(arbitraryValueRegex, input)
81
- };
82
- function arbitraryValue(value) {
83
- return `var(---,${value})`;
84
- }
85
- function validate(regex, input) {
86
- try {
87
- const inputString = String(input);
88
- if (regex.test(inputString)) {
89
- return { success: true, output: inputString };
90
- } else {
91
- return { success: false };
92
- }
93
- } catch (e) {
94
- return { success: false };
95
- }
96
- }
97
- var createConfig = (obj) => {
98
- return obj;
99
- };
100
- function getTokenPropertyName(tokenProperty2) {
101
- return tokenProperty2.replace(tokenPropertyRegex, "$1");
102
- }
103
- function getTokenPropertyParts(tokenProperty2, config) {
104
- var _a, _b, _c;
105
- const name = getTokenPropertyName(tokenProperty2);
106
- const [alias, ...variants] = name.split("_").reverse();
107
- const [v1, v2, ...invalidVariants] = variants.reverse();
108
- const responsive = ((_a = config.responsive) == null ? void 0 : _a[v1]) && v1;
109
- const selectorVariant1 = ((_b = config.selectors) == null ? void 0 : _b[v1]) && !v2 ? v1 : void 0;
110
- const selectorVariant2 = responsive && ((_c = config.selectors) == null ? void 0 : _c[v2]) && v2;
111
- const selector = selectorVariant1 || selectorVariant2;
112
- const hasInvalidVariant = v1 && !responsive && !selector;
113
- const variant = [responsive, selector].filter(Boolean).join("_");
114
- if (invalidVariants.length || hasInvalidVariant)
115
- return null;
116
- return { name, alias, responsive, selector, variant };
117
- }
118
- function getTokenValueParts(tokenValue2) {
119
- const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
120
- return { property, themeKey, token };
121
- }
122
-
123
- // src/config.default.ts
124
- var defaultConfig = createConfig({
125
- include: [],
126
- grid: "0.25rem",
127
- responsive: {},
128
- theme: {},
129
- aliases: {},
130
- selectors: {
131
- after: "&::after",
132
- before: "&::before",
133
- even: "&:nth-child(even)",
134
- odd: "&:nth-child(odd)",
135
- "first-child": "&:first-child",
136
- "last-child": "&:last-child",
137
- placeholder: "&::placeholder",
138
- hover: "&:hover",
139
- focus: "&:focus",
140
- "focus-visible": "&:focus-visible",
141
- "focus-within": "&:focus-within",
142
- active: "&:active",
143
- disabled: "&:disabled"
144
- },
145
- properties: {
146
- "accent-color": ["color"],
147
- animation: ["anim"],
148
- "animation-timing-function": ["ease"],
149
- background: ["color", "surface"],
150
- "background-color": ["color"],
151
- "background-image": ["surface"],
152
- "background-position": ["grid"],
153
- "background-position-x": ["grid"],
154
- "background-position-y": ["grid"],
155
- "block-size": ["grid", "size"],
156
- border: ["border"],
157
- "border-block": ["border"],
158
- "border-block-color": ["color"],
159
- "border-block-end": ["border"],
160
- "border-block-end-color": ["color"],
161
- "border-block-end-style": ["line-style"],
162
- "border-block-start": ["border"],
163
- "border-block-start-color": ["color"],
164
- "border-block-start-style": ["line-style"],
165
- "border-block-style": ["line-style"],
166
- "border-bottom": ["border"],
167
- "border-bottom-color": ["color"],
168
- "border-bottom-left-radius": ["radii"],
169
- "border-bottom-right-radius": ["radii"],
170
- "border-bottom-style": ["line-style"],
171
- "border-color": ["color"],
172
- "border-end-end-radius": ["radii"],
173
- "border-end-start-radius": ["radii"],
174
- "border-inline": ["border"],
175
- "border-inline-color": ["color"],
176
- "border-inline-end": ["border"],
177
- "border-inline-end-color": ["color"],
178
- "border-inline-end-style": ["line-style"],
179
- "border-inline-start": ["border"],
180
- "border-inline-start-color": ["color"],
181
- "border-inline-start-style": ["line-style"],
182
- "border-inline-style": ["line-style"],
183
- "border-left": ["border"],
184
- "border-left-color": ["color"],
185
- "border-left-style": ["line-style"],
186
- "border-radius": ["radii"],
187
- "border-right": ["border"],
188
- "border-right-color": ["color"],
189
- "border-right-style": ["line-style"],
190
- "border-start-end-radius": ["radii"],
191
- "border-start-start-radius": ["radii"],
192
- "border-style": ["line-style"],
193
- "border-top": ["border"],
194
- "border-top-color": ["color"],
195
- "border-top-left-radius": ["radii"],
196
- "border-top-right-radius": ["radii"],
197
- "border-top-style": ["line-style"],
198
- bottom: ["grid"],
199
- "box-shadow": ["shadow"],
200
- "caret-color": ["color"],
201
- color: ["color"],
202
- "column-gap": ["grid"],
203
- "column-rule-color": ["color"],
204
- "column-rule-width": ["grid"],
205
- "column-width": ["grid", "size"],
206
- "flex-basis": ["grid", "size"],
207
- "font-family": ["font"],
208
- "font-size": ["font-size"],
209
- "font-weight": ["weight"],
210
- gap: ["grid"],
211
- height: ["grid", "size"],
212
- "inline-size": ["grid", "size"],
213
- inset: ["grid"],
214
- "inset-block": ["grid"],
215
- "inset-block-end": ["grid"],
216
- "inset-block-start": ["grid"],
217
- "inset-inline": ["grid"],
218
- "inset-inline-end": ["grid"],
219
- "inset-inline-start": ["grid"],
220
- left: ["grid"],
221
- "letter-spacing": ["tracking"],
222
- "line-height": ["leading"],
223
- margin: ["grid"],
224
- "margin-block": ["grid"],
225
- "margin-block-end": ["grid"],
226
- "margin-block-start": ["grid"],
227
- "margin-bottom": ["grid"],
228
- "margin-inline": ["grid"],
229
- "margin-inline-end": ["grid"],
230
- "margin-inline-start": ["grid"],
231
- "margin-left": ["grid"],
232
- "margin-right": ["grid"],
233
- "margin-top": ["grid"],
234
- "max-block-size": ["grid", "size"],
235
- "max-height": ["grid", "size"],
236
- "max-inline-size": ["grid", "size"],
237
- "max-width": ["grid", "size"],
238
- "min-block-size": ["grid", "size"],
239
- "min-height": ["grid", "size"],
240
- "min-inline-size": ["grid", "size"],
241
- "min-width": ["grid", "size"],
242
- opacity: ["alpha"],
243
- "outline-color": ["color"],
244
- padding: ["grid"],
245
- "padding-block": ["grid"],
246
- "padding-block-end": ["grid"],
247
- "padding-block-start": ["grid"],
248
- "padding-bottom": ["grid"],
249
- "padding-inline": ["grid"],
250
- "padding-inline-end": ["grid"],
251
- "padding-inline-start": ["grid"],
252
- "padding-left": ["grid"],
253
- "padding-right": ["grid"],
254
- "padding-top": ["grid"],
255
- right: ["grid"],
256
- "row-gap": ["grid"],
257
- "scroll-margin": ["grid"],
258
- "scroll-margin-bottom": ["grid"],
259
- "scroll-margin-left": ["grid"],
260
- "scroll-margin-right": ["grid"],
261
- "scroll-margin-top": ["grid"],
262
- "scroll-padding": ["grid"],
263
- "scroll-padding-bottom": ["grid"],
264
- "scroll-padding-left": ["grid"],
265
- "scroll-padding-right": ["grid"],
266
- "scroll-padding-top": ["grid"],
267
- "text-decoration-color": ["color"],
268
- "text-shadow": ["shadow"],
269
- top: ["grid"],
270
- transition: ["transition"],
271
- "transition-timing-function": ["ease"],
272
- width: ["grid", "size"],
273
- "z-index": ["z"]
274
- }
275
- });
276
- var config_default_default = defaultConfig;
277
-
278
47
  // src/supports.ts
279
48
  var logicalProperties = [
280
49
  "block-size",
@@ -695,6 +464,250 @@ var properties = [
695
464
  ...logicalProperties
696
465
  ];
697
466
 
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
+
698
711
  // src/shorthands.ts
699
712
  var mapShorthandToLonghands = {
700
713
  all: [],
@@ -915,8 +928,10 @@ var mapShorthandToLonghands = {
915
928
  arbitraryValue,
916
929
  createConfig,
917
930
  defaultConfig,
931
+ getCSSPropertiesForAlias,
918
932
  getTokenPropertyName,
919
933
  getTokenPropertyParts,
934
+ getTokenPropertySplit,
920
935
  getTokenValueParts,
921
936
  gridProperty,
922
937
  logicalProperties,
package/dist/index.mjs CHANGED
@@ -1,236 +1,3 @@
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 getTokenPropertyParts(tokenProperty2, config) {
60
- var _a, _b, _c;
61
- const name = getTokenPropertyName(tokenProperty2);
62
- const [alias, ...variants] = name.split("_").reverse();
63
- const [v1, v2, ...invalidVariants] = variants.reverse();
64
- const responsive = ((_a = config.responsive) == null ? void 0 : _a[v1]) && v1;
65
- const selectorVariant1 = ((_b = config.selectors) == null ? void 0 : _b[v1]) && !v2 ? v1 : void 0;
66
- const selectorVariant2 = responsive && ((_c = config.selectors) == null ? void 0 : _c[v2]) && v2;
67
- const selector = selectorVariant1 || selectorVariant2;
68
- const hasInvalidVariant = v1 && !responsive && !selector;
69
- const variant = [responsive, selector].filter(Boolean).join("_");
70
- if (invalidVariants.length || hasInvalidVariant)
71
- return null;
72
- return { name, alias, responsive, selector, variant };
73
- }
74
- function getTokenValueParts(tokenValue2) {
75
- const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
76
- return { property, themeKey, token };
77
- }
78
-
79
- // src/config.default.ts
80
- var defaultConfig = createConfig({
81
- include: [],
82
- grid: "0.25rem",
83
- responsive: {},
84
- theme: {},
85
- aliases: {},
86
- selectors: {
87
- after: "&::after",
88
- before: "&::before",
89
- even: "&:nth-child(even)",
90
- odd: "&:nth-child(odd)",
91
- "first-child": "&:first-child",
92
- "last-child": "&:last-child",
93
- placeholder: "&::placeholder",
94
- hover: "&:hover",
95
- focus: "&:focus",
96
- "focus-visible": "&:focus-visible",
97
- "focus-within": "&:focus-within",
98
- active: "&:active",
99
- disabled: "&:disabled"
100
- },
101
- properties: {
102
- "accent-color": ["color"],
103
- animation: ["anim"],
104
- "animation-timing-function": ["ease"],
105
- background: ["color", "surface"],
106
- "background-color": ["color"],
107
- "background-image": ["surface"],
108
- "background-position": ["grid"],
109
- "background-position-x": ["grid"],
110
- "background-position-y": ["grid"],
111
- "block-size": ["grid", "size"],
112
- border: ["border"],
113
- "border-block": ["border"],
114
- "border-block-color": ["color"],
115
- "border-block-end": ["border"],
116
- "border-block-end-color": ["color"],
117
- "border-block-end-style": ["line-style"],
118
- "border-block-start": ["border"],
119
- "border-block-start-color": ["color"],
120
- "border-block-start-style": ["line-style"],
121
- "border-block-style": ["line-style"],
122
- "border-bottom": ["border"],
123
- "border-bottom-color": ["color"],
124
- "border-bottom-left-radius": ["radii"],
125
- "border-bottom-right-radius": ["radii"],
126
- "border-bottom-style": ["line-style"],
127
- "border-color": ["color"],
128
- "border-end-end-radius": ["radii"],
129
- "border-end-start-radius": ["radii"],
130
- "border-inline": ["border"],
131
- "border-inline-color": ["color"],
132
- "border-inline-end": ["border"],
133
- "border-inline-end-color": ["color"],
134
- "border-inline-end-style": ["line-style"],
135
- "border-inline-start": ["border"],
136
- "border-inline-start-color": ["color"],
137
- "border-inline-start-style": ["line-style"],
138
- "border-inline-style": ["line-style"],
139
- "border-left": ["border"],
140
- "border-left-color": ["color"],
141
- "border-left-style": ["line-style"],
142
- "border-radius": ["radii"],
143
- "border-right": ["border"],
144
- "border-right-color": ["color"],
145
- "border-right-style": ["line-style"],
146
- "border-start-end-radius": ["radii"],
147
- "border-start-start-radius": ["radii"],
148
- "border-style": ["line-style"],
149
- "border-top": ["border"],
150
- "border-top-color": ["color"],
151
- "border-top-left-radius": ["radii"],
152
- "border-top-right-radius": ["radii"],
153
- "border-top-style": ["line-style"],
154
- bottom: ["grid"],
155
- "box-shadow": ["shadow"],
156
- "caret-color": ["color"],
157
- color: ["color"],
158
- "column-gap": ["grid"],
159
- "column-rule-color": ["color"],
160
- "column-rule-width": ["grid"],
161
- "column-width": ["grid", "size"],
162
- "flex-basis": ["grid", "size"],
163
- "font-family": ["font"],
164
- "font-size": ["font-size"],
165
- "font-weight": ["weight"],
166
- gap: ["grid"],
167
- height: ["grid", "size"],
168
- "inline-size": ["grid", "size"],
169
- inset: ["grid"],
170
- "inset-block": ["grid"],
171
- "inset-block-end": ["grid"],
172
- "inset-block-start": ["grid"],
173
- "inset-inline": ["grid"],
174
- "inset-inline-end": ["grid"],
175
- "inset-inline-start": ["grid"],
176
- left: ["grid"],
177
- "letter-spacing": ["tracking"],
178
- "line-height": ["leading"],
179
- margin: ["grid"],
180
- "margin-block": ["grid"],
181
- "margin-block-end": ["grid"],
182
- "margin-block-start": ["grid"],
183
- "margin-bottom": ["grid"],
184
- "margin-inline": ["grid"],
185
- "margin-inline-end": ["grid"],
186
- "margin-inline-start": ["grid"],
187
- "margin-left": ["grid"],
188
- "margin-right": ["grid"],
189
- "margin-top": ["grid"],
190
- "max-block-size": ["grid", "size"],
191
- "max-height": ["grid", "size"],
192
- "max-inline-size": ["grid", "size"],
193
- "max-width": ["grid", "size"],
194
- "min-block-size": ["grid", "size"],
195
- "min-height": ["grid", "size"],
196
- "min-inline-size": ["grid", "size"],
197
- "min-width": ["grid", "size"],
198
- opacity: ["alpha"],
199
- "outline-color": ["color"],
200
- padding: ["grid"],
201
- "padding-block": ["grid"],
202
- "padding-block-end": ["grid"],
203
- "padding-block-start": ["grid"],
204
- "padding-bottom": ["grid"],
205
- "padding-inline": ["grid"],
206
- "padding-inline-end": ["grid"],
207
- "padding-inline-start": ["grid"],
208
- "padding-left": ["grid"],
209
- "padding-right": ["grid"],
210
- "padding-top": ["grid"],
211
- right: ["grid"],
212
- "row-gap": ["grid"],
213
- "scroll-margin": ["grid"],
214
- "scroll-margin-bottom": ["grid"],
215
- "scroll-margin-left": ["grid"],
216
- "scroll-margin-right": ["grid"],
217
- "scroll-margin-top": ["grid"],
218
- "scroll-padding": ["grid"],
219
- "scroll-padding-bottom": ["grid"],
220
- "scroll-padding-left": ["grid"],
221
- "scroll-padding-right": ["grid"],
222
- "scroll-padding-top": ["grid"],
223
- "text-decoration-color": ["color"],
224
- "text-shadow": ["shadow"],
225
- top: ["grid"],
226
- transition: ["transition"],
227
- "transition-timing-function": ["ease"],
228
- width: ["grid", "size"],
229
- "z-index": ["z"]
230
- }
231
- });
232
- var config_default_default = defaultConfig;
233
-
234
1
  // src/supports.ts
235
2
  var logicalProperties = [
236
3
  "block-size",
@@ -651,6 +418,250 @@ var properties = [
651
418
  ...logicalProperties
652
419
  ];
653
420
 
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
+
654
665
  // src/shorthands.ts
655
666
  var mapShorthandToLonghands = {
656
667
  all: [],
@@ -870,8 +881,10 @@ export {
870
881
  arbitraryValue,
871
882
  createConfig,
872
883
  config_default_default as defaultConfig,
884
+ getCSSPropertiesForAlias,
873
885
  getTokenPropertyName,
874
886
  getTokenPropertyParts,
887
+ getTokenPropertySplit,
875
888
  getTokenValueParts,
876
889
  gridProperty,
877
890
  logicalProperties,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenami/config",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
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.25"
17
+ "@tokenami/dev": "0.0.27"
18
18
  },
19
19
  "scripts": {
20
20
  "build": "tsup src/index.ts --format=esm,cjs --dts",