@tokenami/config 0.0.29 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -226,7 +226,7 @@ declare const createConfig: <T extends Config>(obj: Exact<Config, T>) => DeepRea
226
226
  declare function getTokenPropertyName(tokenProperty: TokenProperty): string;
227
227
  declare function getTokenPropertySplit(tokenProperty: TokenProperty): {
228
228
  alias: string;
229
- variants: (string | undefined)[];
229
+ variants: string[];
230
230
  };
231
231
  type PropertyParts = {
232
232
  name: string;
package/dist/index.d.ts CHANGED
@@ -226,7 +226,7 @@ declare const createConfig: <T extends Config>(obj: Exact<Config, T>) => DeepRea
226
226
  declare function getTokenPropertyName(tokenProperty: TokenProperty): string;
227
227
  declare function getTokenPropertySplit(tokenProperty: TokenProperty): {
228
228
  alias: string;
229
- variants: (string | undefined)[];
229
+ variants: string[];
230
230
  };
231
231
  type PropertyParts = {
232
232
  name: string;
package/dist/index.js CHANGED
@@ -111,16 +111,15 @@ function getTokenPropertyParts(tokenProperty2, config) {
111
111
  var _a, _b, _c;
112
112
  const name = getTokenPropertyName(tokenProperty2);
113
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)
114
+ const [firstVariant, secondVariant] = variants;
115
+ const firstSelector = ((_a = config.selectors) == null ? void 0 : _a[firstVariant]) && firstVariant;
116
+ const secondSelector = ((_b = config.selectors) == null ? void 0 : _b[secondVariant]) && secondVariant;
117
+ const responsive = ((_c = config.responsive) == null ? void 0 : _c[firstVariant]) && firstVariant;
118
+ const selector = firstSelector || secondSelector;
119
+ const validVariant = [responsive, selector].filter(Boolean).join("_");
120
+ if (firstVariant && variantProperty(validVariant, alias) !== tokenProperty2)
122
121
  return null;
123
- return { name, alias, responsive, selector, variant };
122
+ return { name, alias, responsive, selector, variant: validVariant };
124
123
  }
125
124
  function getTokenValueParts(tokenValue2) {
126
125
  const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
package/dist/index.mjs CHANGED
@@ -65,16 +65,15 @@ function getTokenPropertyParts(tokenProperty2, config) {
65
65
  var _a, _b, _c;
66
66
  const name = getTokenPropertyName(tokenProperty2);
67
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)
68
+ const [firstVariant, secondVariant] = variants;
69
+ const firstSelector = ((_a = config.selectors) == null ? void 0 : _a[firstVariant]) && firstVariant;
70
+ const secondSelector = ((_b = config.selectors) == null ? void 0 : _b[secondVariant]) && secondVariant;
71
+ const responsive = ((_c = config.responsive) == null ? void 0 : _c[firstVariant]) && firstVariant;
72
+ const selector = firstSelector || secondSelector;
73
+ const validVariant = [responsive, selector].filter(Boolean).join("_");
74
+ if (firstVariant && variantProperty(validVariant, alias) !== tokenProperty2)
76
75
  return null;
77
- return { name, alias, responsive, selector, variant };
76
+ return { name, alias, responsive, selector, variant: validVariant };
78
77
  }
79
78
  function getTokenValueParts(tokenValue2) {
80
79
  const [, property, themeKey, token] = tokenValue2.split(tokenValueRegex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenami/config",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -14,7 +14,7 @@
14
14
  "csstype": "^3.1.2",
15
15
  "tsup": "^7.0.0",
16
16
  "typescript": "^5.1.3",
17
- "@tokenami/dev": "0.0.29"
17
+ "@tokenami/dev": "0.0.30"
18
18
  },
19
19
  "scripts": {
20
20
  "build": "tsup src/index.ts --format=esm,cjs --dts",