tokenami 0.0.81 → 0.0.82

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.cjs CHANGED
@@ -44,8 +44,7 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
44
44
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
45
45
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
46
46
  }) : x)(function(x) {
47
- if (typeof require !== "undefined")
48
- return require.apply(this, arguments);
47
+ if (typeof require !== "undefined") return require.apply(this, arguments);
49
48
  throw Error('Dynamic require of "' + x + '" is not supported');
50
49
  });
51
50
  var __esm = (fn, res) => function __init() {
@@ -71,9 +70,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
71
70
  mod
72
71
  ));
73
72
 
74
- // ../../node_modules/.pnpm/tsup@7.3.0_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js
73
+ // ../../node_modules/.pnpm/tsup@8.4.0_jiti@1.21.6_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js
75
74
  var init_cjs_shims = __esm({
76
- "../../node_modules/.pnpm/tsup@7.3.0_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js"() {
75
+ "../../node_modules/.pnpm/tsup@8.4.0_jiti@1.21.6_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js"() {
77
76
  }
78
77
  });
79
78
 
@@ -268,8 +267,7 @@ var require_HashArray = __commonJS({
268
267
  continue;
269
268
  }
270
269
  this._map[inst].push(obj);
271
- } else
272
- this._map[inst] = [obj];
270
+ } else this._map[inst] = [obj];
273
271
  }
274
272
  }
275
273
  if (!needsDupCheck || this._list.indexOf(obj) == -1)
@@ -358,8 +356,7 @@ var require_HashArray = __commonJS({
358
356
  count = Math.min(Math.max(max - min, 1), count);
359
357
  while (res.length < count) {
360
358
  var r = Math.floor(min + Math.random() * (max + 1));
361
- if (map[r])
362
- continue;
359
+ if (map[r]) continue;
363
360
  map[r] = true;
364
361
  res.push(r);
365
362
  }
@@ -632,8 +629,7 @@ var require_crypt = __commonJS({
632
629
  base64ToBytes: function(base64) {
633
630
  base64 = base64.replace(/[^A-Z0-9+\/]/ig, "");
634
631
  for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) {
635
- if (imod4 == 0)
636
- continue;
632
+ if (imod4 == 0) continue;
637
633
  bytes.push((base64map.indexOf(base64.charAt(i - 1)) & Math.pow(2, -2 * imod4 + 8) - 1) << imod4 * 2 | base64map.indexOf(base64.charAt(i)) >>> 6 - imod4 * 2);
638
634
  }
639
635
  return bytes;
@@ -882,16 +878,14 @@ var require_TrieSearch = __commonJS({
882
878
  }
883
879
  TrieSearch2.prototype = {
884
880
  add: function(item, customKeys) {
885
- if (this.options.cache)
886
- this.clearCache();
881
+ if (this.options.cache) this.clearCache();
887
882
  if (typeof customKeys === "number") {
888
883
  customKeys = void 0;
889
884
  }
890
885
  var keyFields = customKeys || this.keyFields;
891
886
  for (var k in keyFields) {
892
887
  var key = keyFields[k], isKeyArr = key instanceof Array, val = isKeyArr ? deepLookup(item, key) : item[key];
893
- if (!val)
894
- continue;
888
+ if (!val) continue;
895
889
  val = val.toString();
896
890
  if (this.options.ignoreCase) {
897
891
  val = val.toLowerCase();
@@ -911,14 +905,12 @@ var require_TrieSearch = __commonJS({
911
905
  * @param keyFields The keyfields in which to search for this phrase to remove
912
906
  */
913
907
  remove: function(phrase, keyFields) {
914
- if (!phrase)
915
- return;
908
+ if (!phrase) return;
916
909
  phrase = phrase.toString();
917
910
  phrase = this.options.ignoreCase ? phrase.toLowerCase() : phrase;
918
911
  keyFields = keyFields || this.keyFields;
919
912
  keyFields = keyFields instanceof Array ? keyFields : [keyFields];
920
- if (this.options.cache)
921
- this.clearCache();
913
+ if (this.options.cache) this.clearCache();
922
914
  var diacriticalVariants = this.expandString(phrase);
923
915
  for (var variant of diacriticalVariants) {
924
916
  var words = this.options.splitOnRegEx ? variant.split(this.options.splitOnRegEx) : [variant];
@@ -1070,17 +1062,14 @@ var require_TrieSearch = __commonJS({
1070
1062
  return [];
1071
1063
  keyArr = [key.substring(0, this.options.min)];
1072
1064
  keyArr = keyArr.concat(key.substring(this.options.min).split(""));
1073
- } else
1074
- keyArr = key.split("");
1065
+ } else keyArr = key.split("");
1075
1066
  return keyArr;
1076
1067
  },
1077
1068
  findNode: function(key) {
1078
1069
  return f(this.keyToArr(key), this.root);
1079
1070
  function f(keyArr, node) {
1080
- if (!node)
1081
- return void 0;
1082
- if (keyArr.length === 0)
1083
- return node;
1071
+ if (!node) return void 0;
1072
+ if (keyArr.length === 0) return node;
1084
1073
  var k = keyArr.shift();
1085
1074
  return f(keyArr, node[k]);
1086
1075
  }
@@ -1117,8 +1106,7 @@ var require_TrieSearch = __commonJS({
1117
1106
  var item = node2.value[i];
1118
1107
  if (!limit || all.length < limit) {
1119
1108
  const id = self.getId(item);
1120
- if (dedupDict[id])
1121
- continue;
1109
+ if (dedupDict[id]) continue;
1122
1110
  all.push(item);
1123
1111
  dedupDict[id] = item;
1124
1112
  }
@@ -1152,8 +1140,7 @@ var require_TrieSearch = __commonJS({
1152
1140
  return this.get(phrases, reducer, limit);
1153
1141
  },
1154
1142
  getId: function(item, customKeys) {
1155
- if (item.$tsid)
1156
- return item.$tsid;
1143
+ if (item.$tsid) return item.$tsid;
1157
1144
  if (!this.options.idFieldOrFunction) {
1158
1145
  var s = "";
1159
1146
  var kf = customKeys || this.keyFields;
@@ -1227,8 +1214,7 @@ var TokenamiDiagnostics = class {
1227
1214
  const processNode = this.#processNode.bind(this);
1228
1215
  ts__default.default.forEachChild(sourceFile, function nextNode(node) {
1229
1216
  const nodeDiagnostics = processNode(node, sourceFile);
1230
- if (nodeDiagnostics)
1231
- diagnostics.push(...nodeDiagnostics);
1217
+ if (nodeDiagnostics) diagnostics.push(...nodeDiagnostics);
1232
1218
  ts__default.default.forEachChild(node, nextNode);
1233
1219
  });
1234
1220
  }
@@ -1236,16 +1222,14 @@ var TokenamiDiagnostics = class {
1236
1222
  }
1237
1223
  #processNode(node, sourceFile) {
1238
1224
  const isDiagnosticPrevented = this.#shouldSuppressDiagnosticForNode(node, sourceFile);
1239
- if (isDiagnosticPrevented)
1240
- return;
1225
+ if (isDiagnosticPrevented) return;
1241
1226
  if (ts__default.default.isCallExpression(node) && ts__default.default.isPropertyAccessExpression(node.expression) && ts__default.default.isIdentifier(node.expression.expression) && node.expression.expression.text === "css" && node.expression.name.text === "compose" && node.arguments[0] && ts__default.default.isObjectLiteralExpression(node.arguments[0])) {
1242
1227
  return this.#validateComposeConfig(node.arguments[0], sourceFile);
1243
1228
  }
1244
1229
  if (ts__default.default.isPropertyAssignment(node)) {
1245
1230
  const nodeProperty = ts__default.default.isStringLiteral(node.name) ? node.name.text : null;
1246
1231
  const property = TokenamiConfig4__namespace.TokenProperty.safeParse(nodeProperty);
1247
- if (!property.success)
1248
- return;
1232
+ if (!property.success) return;
1249
1233
  return this.#validateTokenamiProperty(property.output, node, sourceFile);
1250
1234
  }
1251
1235
  }
@@ -1253,8 +1237,7 @@ var TokenamiDiagnostics = class {
1253
1237
  const { variants } = TokenamiConfig4__namespace.getTokenPropertySplit(property);
1254
1238
  const parts = TokenamiConfig4__namespace.getTokenPropertyParts(property, this.#config);
1255
1239
  const isArbitrarySelector = variants.some(TokenamiConfig4__namespace.getArbitrarySelector);
1256
- if (!variants.length || parts || isArbitrarySelector)
1257
- return;
1240
+ if (!variants.length || parts || isArbitrarySelector) return;
1258
1241
  const selector = variants.join("_");
1259
1242
  const isEmptyArbSelector = variants.includes("{}");
1260
1243
  const arbSuffix = isEmptyArbSelector ? ` Add an arbitrary selector or remove '${selector}'.` : "";
@@ -1282,8 +1265,7 @@ var TokenamiDiagnostics = class {
1282
1265
  const length = prop.getWidth(sourceFile);
1283
1266
  return [{ ...diagnostic, start, length }];
1284
1267
  }
1285
- if (!ts__default.default.isPropertyAssignment(prop))
1286
- continue;
1268
+ if (!ts__default.default.isPropertyAssignment(prop)) continue;
1287
1269
  const key = prop.name;
1288
1270
  const value = prop.initializer;
1289
1271
  if (ts__default.default.isComputedPropertyName(key)) {
@@ -1301,8 +1283,7 @@ var TokenamiDiagnostics = class {
1301
1283
  }
1302
1284
  }
1303
1285
  #shouldSuppressDiagnosticForNode(node, sourceFile) {
1304
- if (!sourceFile)
1305
- return false;
1286
+ if (!sourceFile) return false;
1306
1287
  const lineStarts = sourceFile.getLineStarts();
1307
1288
  const nodeStartPos = node.getStart(sourceFile);
1308
1289
  const nodeStartLine = sourceFile.getLineAndCharacterOfPosition(nodeStartPos).line;
@@ -1814,14 +1795,13 @@ var DEFAULT_PATHS = {
1814
1795
  mjs: "./.tokenami/tokenami.config.mjs"
1815
1796
  };
1816
1797
  function getConfigPath(cwd, path, type) {
1817
- path = path || getConfigDefaultPath(cwd, type);
1798
+ path = path || getConfigDefaultPath(cwd);
1818
1799
  return pathe__namespace.join(cwd, path);
1819
1800
  }
1820
1801
  function getConfigAtPath(path, opts = { cache: true }) {
1821
1802
  const config = (() => {
1822
1803
  try {
1823
- if (!opts.cache)
1824
- delete __require.cache[__require.resolve(path)];
1804
+ if (!opts.cache) delete __require.cache[__require.resolve(path)];
1825
1805
  return __require(path);
1826
1806
  } catch {
1827
1807
  return lazyJiti({ cache: opts.cache })(path);
@@ -1833,7 +1813,7 @@ function getConfigDefaultPath(cwd, type) {
1833
1813
  const existingConfig = Object.values(DEFAULT_PATHS).find((path) => {
1834
1814
  return fs__namespace.existsSync(pathe__namespace.join(cwd, path));
1835
1815
  });
1836
- return existingConfig || DEFAULT_PATHS[type || "js"];
1816
+ return existingConfig || DEFAULT_PATHS["js"];
1837
1817
  }
1838
1818
  function getTypeDefsPath(configPath) {
1839
1819
  const dirname2 = pathe__namespace.dirname(configPath);
@@ -1998,10 +1978,8 @@ var TrieCompletions = class {
1998
1978
  variantSearch(search) {
1999
1979
  const input = this.#createTrieInput(search);
2000
1980
  const parts = TokenamiConfig4__namespace.getTokenPropertySplit(search);
2001
- if (!parts.variants.length)
2002
- return this.#selectorSnippets.search(input);
2003
- if (parts.variants.length > 1)
2004
- return this.#responsiveSelectorsSearch(input, parts.variants);
1981
+ if (!parts.variants.length) return this.#selectorSnippets.search(input);
1982
+ if (parts.variants.length > 1) return this.#responsiveSelectorsSearch(input, parts.variants);
2005
1983
  const selectors = this.#selectorsSearch(input, parts.variants);
2006
1984
  const snippets = this.#responsiveSelectorSnippets.search(input);
2007
1985
  return [...selectors, ...snippets];
@@ -2018,8 +1996,7 @@ var TrieCompletions = class {
2018
1996
  }
2019
1997
  #selectorsSearch(input, variants) {
2020
1998
  const [_, arbSelector] = input.match(/\{(.*)\}/) ?? [];
2021
- if (!arbSelector)
2022
- return this.#selectors.search(input);
1999
+ if (!arbSelector) return this.#selectors.search(input);
2023
2000
  const key = String(variants);
2024
2001
  this.#arbSelectors[key] ??= this.#createCompletionEntriesTrie(
2025
2002
  this.#getSelectorCompletions(arbSelector)
@@ -2028,8 +2005,7 @@ var TrieCompletions = class {
2028
2005
  }
2029
2006
  #responsiveSelectorsSearch(input, variants) {
2030
2007
  const [_, arbSelector] = input.match(/\{(.*)\}/) ?? [];
2031
- if (!arbSelector)
2032
- return this.#responsiveSelectors.search(input);
2008
+ if (!arbSelector) return this.#responsiveSelectors.search(input);
2033
2009
  const key = String(variants);
2034
2010
  this.#arbResponsiveSelectors[key] ??= this.#createCompletionEntriesTrie(
2035
2011
  this.#getResponsiveSelectorCompletions(arbSelector)
@@ -2177,8 +2153,7 @@ var TokenamiPlugin = class {
2177
2153
  }
2178
2154
  #watchConfig(configPath) {
2179
2155
  this.#ctx.ts.sys.watchFile?.(configPath, (_fileName, eventKind) => {
2180
- if (eventKind !== this.#ctx.ts.FileWatcherEventKind.Changed)
2181
- return;
2156
+ if (eventKind !== this.#ctx.ts.FileWatcherEventKind.Changed) return;
2182
2157
  try {
2183
2158
  const reloadedConfig = getConfigAtPath(configPath, { cache: false });
2184
2159
  updateEnvFile(configPath, reloadedConfig);
@@ -2197,8 +2172,7 @@ var TokenamiPlugin = class {
2197
2172
  getSemanticDiagnostics(fileName) {
2198
2173
  const original = this.#ctx.info.languageService.getSemanticDiagnostics(fileName);
2199
2174
  const sourceFile = this.#ctx.info.languageService.getProgram()?.getSourceFile(fileName);
2200
- if (!sourceFile)
2201
- return original;
2175
+ if (!sourceFile) return original;
2202
2176
  return [...this.#diagnostics.getSemanticDiagnostics(sourceFile), ...original];
2203
2177
  }
2204
2178
  getCompletionsAtPosition = (fileName, position, options) => {
@@ -2209,8 +2183,7 @@ var TokenamiPlugin = class {
2209
2183
  );
2210
2184
  const program = this.#ctx.info.languageService.getProgram();
2211
2185
  const sourceFile = program?.getSourceFile(fileName);
2212
- if (!original || !sourceFile)
2213
- return original;
2186
+ if (!original || !sourceFile) return original;
2214
2187
  const isTokenPropertyEntries = original.entries.some(
2215
2188
  (entry) => TokenamiConfig4__namespace.TokenProperty.safeParse(entry.name).success
2216
2189
  );
@@ -2218,8 +2191,7 @@ var TokenamiPlugin = class {
2218
2191
  (entry) => TokenamiConfig4__namespace.TokenValue.safeParse(entry.name).success
2219
2192
  );
2220
2193
  const node = findNodeAtPosition(sourceFile, position);
2221
- if (!node)
2222
- return original;
2194
+ if (!node) return original;
2223
2195
  if (isTokenValueEntries) {
2224
2196
  const input = getValueAtPosition(node, position);
2225
2197
  const needsQuotes = !input.startsWith('"') && !input.startsWith("'");
@@ -2258,22 +2230,17 @@ var TokenamiPlugin = class {
2258
2230
  return entry2 ? createEntryDetails(original, entry2, String(entry2.details.selector)) : original;
2259
2231
  }
2260
2232
  const sourceFile = this.#ctx.info.languageService.getProgram()?.getSourceFile(fileName);
2261
- if (!sourceFile)
2262
- return original;
2233
+ if (!sourceFile) return original;
2263
2234
  const node = findNodeAtPosition(sourceFile, position);
2264
- if (!node || !ts__default.default.isPropertyAssignment(node.parent))
2265
- return original;
2235
+ if (!node || !ts__default.default.isPropertyAssignment(node.parent)) return original;
2266
2236
  const parentProperty = node.parent.name.getText();
2267
2237
  const isTokenamiValue = TokenamiConfig4__namespace.TokenProperty.safeParse(parentProperty).success;
2268
- if (!isTokenamiValue)
2269
- return original;
2238
+ if (!isTokenamiValue) return original;
2270
2239
  const [entry] = this.#completions.valueSearch(search);
2271
- if (!entry)
2272
- return original;
2240
+ if (!entry) return original;
2273
2241
  const themeEntries = Object.entries(entry.details.modeValues);
2274
2242
  const [mode, firstValue] = themeEntries[0] || [];
2275
- if (!firstValue)
2276
- return original;
2243
+ if (!firstValue) return original;
2277
2244
  if (isColorThemeEntry(entry.details.modeValues)) {
2278
2245
  const colorDescription = createColorTokenDescription(entry.details.modeValues);
2279
2246
  const rgb2 = convertToRgb(replaceCssVarsWithFallback(firstValue), mode);
@@ -2288,22 +2255,18 @@ ${colorDescription}`);
2288
2255
  getQuickInfoAtPosition(fileName, position) {
2289
2256
  const original = this.#ctx.info.languageService.getQuickInfoAtPosition(fileName, position);
2290
2257
  const sourceFile = this.#ctx.info.languageService.getProgram()?.getSourceFile(fileName);
2291
- if (!original || !sourceFile)
2292
- return original;
2258
+ if (!original || !sourceFile) return original;
2293
2259
  const node = findNodeAtPosition(sourceFile, position);
2294
- if (!node || !node.parent || !ts__default.default.isPropertyAssignment(node.parent))
2295
- return original;
2260
+ if (!node || !node.parent || !ts__default.default.isPropertyAssignment(node.parent)) return original;
2296
2261
  const property = node.parent;
2297
2262
  const propertyName = property.name.getText(sourceFile);
2298
2263
  const propertyValue = property.initializer.getText();
2299
2264
  const tokenProperty3 = TokenamiConfig4__namespace.TokenProperty.safeParse(propertyName);
2300
2265
  const tokenValue2 = TokenamiConfig4__namespace.TokenValue.safeParse(propertyValue);
2301
- if (!tokenProperty3.success || !tokenValue2.success)
2302
- return original;
2266
+ if (!tokenProperty3.success || !tokenValue2.success) return original;
2303
2267
  const { variants } = TokenamiConfig4__namespace.getTokenPropertySplit(tokenProperty3.output);
2304
2268
  const propertyParts = TokenamiConfig4__namespace.getTokenPropertyParts(tokenProperty3.output, this.#config);
2305
- if (!propertyParts && variants.length)
2306
- return;
2269
+ if (!propertyParts && variants.length) return;
2307
2270
  const modeValues = getThemeValuesByThemeMode(tokenValue2.output, this.#config.theme);
2308
2271
  const text = isColorThemeEntry(modeValues) ? createColorTokenDescription(modeValues) : createTokenDescription(modeValues);
2309
2272
  return { ...original, documentation: [{ text, kind: "markdown" }] };
@@ -2318,16 +2281,13 @@ ${colorDescription}`);
2318
2281
  preferences
2319
2282
  );
2320
2283
  const sourceFile = this.#ctx.info.languageService.getProgram()?.getSourceFile(fileName);
2321
- if (!sourceFile || !errorCodes.includes(INVALID_VALUE))
2322
- return original;
2284
+ if (!sourceFile || !errorCodes.includes(INVALID_VALUE)) return original;
2323
2285
  const node = findNodeAtPosition(sourceFile, start);
2324
- if (!node?.parent || !ts__default.default.isPropertyAssignment(node.parent))
2325
- return original;
2286
+ if (!node?.parent || !ts__default.default.isPropertyAssignment(node.parent)) return original;
2326
2287
  const assignment = node.parent;
2327
2288
  const valueSpan = createTextSpanFromNode(assignment.initializer);
2328
2289
  const value = ts__default.default.isStringLiteral(assignment.initializer) && assignment.initializer.text;
2329
- if (!value)
2330
- return original;
2290
+ if (!value) return original;
2331
2291
  const quoteMark = assignment.initializer.getText().slice(-1);
2332
2292
  const arbitraryValue2 = TokenamiConfig4__namespace.arbitraryValue(value);
2333
2293
  const arbitraryText = `${quoteMark}${arbitraryValue2}${quoteMark}`;
@@ -2343,13 +2303,11 @@ ${colorDescription}`);
2343
2303
  function updateEnvFile(configPath, config) {
2344
2304
  const envFilePath = getTypeDefsPath(configPath);
2345
2305
  const envFileContent = ts__default.default.sys.readFile(envFilePath, "utf-8");
2346
- if (!envFileContent)
2347
- throw new Error("Cannot read tokenami.env.d.ts file");
2306
+ if (!envFileContent) throw new Error("Cannot read tokenami.env.d.ts file");
2348
2307
  const properties = Object.keys(config.properties || {});
2349
2308
  const customProperties = Object.keys(config.customProperties || {});
2350
2309
  const experimentalProperties = properties.flatMap((property) => {
2351
- if (supportedProperties.has(property))
2352
- return [];
2310
+ if (supportedProperties.has(property)) return [];
2353
2311
  return [property];
2354
2312
  });
2355
2313
  const customPropertyTypes = [...experimentalProperties, ...customProperties].map((property) => {
@@ -2395,8 +2353,7 @@ function getValueAtPosition(node, position) {
2395
2353
  let input = node.getText();
2396
2354
  if (ts__default.default.isObjectLiteralExpression(node)) {
2397
2355
  for (const property of node.properties) {
2398
- if (!ts__default.default.isPropertyAssignment(property))
2399
- continue;
2356
+ if (!ts__default.default.isPropertyAssignment(property)) continue;
2400
2357
  const value = property.initializer;
2401
2358
  const start = value.getStart();
2402
2359
  const end = value.getEnd();
@@ -2433,8 +2390,7 @@ function convertToRgb(fill, mode) {
2433
2390
  const color = culori2__namespace.rgb(parsed);
2434
2391
  const modeColor = culori2__namespace.rgb(mode == "dark" ? "#000" : "#fff");
2435
2392
  const bgColor = fill === "transparent" ? void 0 : modeColor;
2436
- if (!color)
2437
- return fill;
2393
+ if (!color) return fill;
2438
2394
  if (!bgColor || parsed?.alpha === void 0 || parsed.alpha === 1) {
2439
2395
  return culori2__namespace.formatRgb(color);
2440
2396
  }
package/dist/index.d.cts CHANGED
@@ -3,22 +3,13 @@ import * as Tokenami from '@tokenami/config';
3
3
  import ts from 'typescript/lib/tsserverlibrary.js';
4
4
 
5
5
  type Merge<A, B> = B extends never ? A : Omit<A, keyof B> & B;
6
- type DefaultConfig = Tokenami.Config & {
7
- CI: false;
8
- };
9
6
  interface TokenamiConfig {
10
7
  }
11
- interface TokenamiFinalConfig extends Merge<DefaultConfig, TokenamiConfig> {
8
+ interface TokenamiFinalConfig extends Merge<Tokenami.Config, TokenamiConfig> {
12
9
  }
13
10
  type ThemeConfig = TokenamiFinalConfig['theme'];
14
11
  type AliasConfig = Omit<NonNullable<TokenamiFinalConfig['aliases']>, Tokenami.CSSProperty>;
15
12
  type PropertyConfig = NonNullable<TokenamiFinalConfig['properties']> & NonNullable<TokenamiFinalConfig['customProperties']>;
16
- type SelectorKey = Extract<keyof NonNullable<TokenamiFinalConfig['selectors']>, string>;
17
- type ResponsiveKey = Extract<keyof NonNullable<TokenamiFinalConfig['responsive']>, string>;
18
- type ResponsiveSelectorKey = `${ResponsiveKey}_${SelectorKey}`;
19
- type ResponsiveArbitrarySelectorKey = `${ResponsiveKey}_{${string}}`;
20
- type ArbitrarySelectorKey = `{${string}}`;
21
- type VariantKey = ResponsiveKey | SelectorKey | ResponsiveSelectorKey | ArbitrarySelectorKey | ResponsiveArbitrarySelectorKey;
22
13
  type Theme = ThemeConfig extends Tokenami.ThemeModes<infer T> ? T & ThemeConfig['root'] : Omit<ThemeConfig, 'modes' | 'root'>;
23
14
  type TokenProperties<P> = {
24
15
  [K in TokenProperty<P>]?: TokenValue<P> extends never ? P extends keyof Tokenami.CSSProperties ? Tokenami.CSSProperties[P] : never : TokenValue<P>;
@@ -27,7 +18,7 @@ type TokenProperty<P> = P extends string ? AliasedProperty<P> extends never ? Va
27
18
  type AliasedProperty<P> = {
28
19
  [A in keyof AliasConfig]: P extends AliasConfig[A][number] ? VariantProperty<A> : never;
29
20
  }[keyof AliasConfig];
30
- type VariantProperty<P extends string> = Tokenami.TokenProperty<P> | (TokenamiFinalConfig['CI'] extends true ? Tokenami.VariantProperty<P, VariantKey> : Tokenami.VariantProperty<P, string>);
21
+ type VariantProperty<P extends string> = Tokenami.TokenProperty<P> | Tokenami.VariantProperty<P, string>;
31
22
  type TokenValue<P> = P extends string ? P extends keyof PropertyConfig ? NonNullable<PropertyConfig[P]>[number] extends `${infer ThemeKey}` ? PropertyThemeValue<ThemeKey> : never : never : never;
32
23
  type PropertyThemeValue<ThemeKey extends string> = Tokenami.ArbitraryValue | CSS.Globals | TokensByThemeKey[ThemeKey] | (ThemeKey extends 'grid' | 'number' ? Tokenami.GridValue : never);
33
24
  type TokensByThemeKey = {
package/dist/index.d.ts CHANGED
@@ -3,22 +3,13 @@ import * as Tokenami from '@tokenami/config';
3
3
  import ts from 'typescript/lib/tsserverlibrary.js';
4
4
 
5
5
  type Merge<A, B> = B extends never ? A : Omit<A, keyof B> & B;
6
- type DefaultConfig = Tokenami.Config & {
7
- CI: false;
8
- };
9
6
  interface TokenamiConfig {
10
7
  }
11
- interface TokenamiFinalConfig extends Merge<DefaultConfig, TokenamiConfig> {
8
+ interface TokenamiFinalConfig extends Merge<Tokenami.Config, TokenamiConfig> {
12
9
  }
13
10
  type ThemeConfig = TokenamiFinalConfig['theme'];
14
11
  type AliasConfig = Omit<NonNullable<TokenamiFinalConfig['aliases']>, Tokenami.CSSProperty>;
15
12
  type PropertyConfig = NonNullable<TokenamiFinalConfig['properties']> & NonNullable<TokenamiFinalConfig['customProperties']>;
16
- type SelectorKey = Extract<keyof NonNullable<TokenamiFinalConfig['selectors']>, string>;
17
- type ResponsiveKey = Extract<keyof NonNullable<TokenamiFinalConfig['responsive']>, string>;
18
- type ResponsiveSelectorKey = `${ResponsiveKey}_${SelectorKey}`;
19
- type ResponsiveArbitrarySelectorKey = `${ResponsiveKey}_{${string}}`;
20
- type ArbitrarySelectorKey = `{${string}}`;
21
- type VariantKey = ResponsiveKey | SelectorKey | ResponsiveSelectorKey | ArbitrarySelectorKey | ResponsiveArbitrarySelectorKey;
22
13
  type Theme = ThemeConfig extends Tokenami.ThemeModes<infer T> ? T & ThemeConfig['root'] : Omit<ThemeConfig, 'modes' | 'root'>;
23
14
  type TokenProperties<P> = {
24
15
  [K in TokenProperty<P>]?: TokenValue<P> extends never ? P extends keyof Tokenami.CSSProperties ? Tokenami.CSSProperties[P] : never : TokenValue<P>;
@@ -27,7 +18,7 @@ type TokenProperty<P> = P extends string ? AliasedProperty<P> extends never ? Va
27
18
  type AliasedProperty<P> = {
28
19
  [A in keyof AliasConfig]: P extends AliasConfig[A][number] ? VariantProperty<A> : never;
29
20
  }[keyof AliasConfig];
30
- type VariantProperty<P extends string> = Tokenami.TokenProperty<P> | (TokenamiFinalConfig['CI'] extends true ? Tokenami.VariantProperty<P, VariantKey> : Tokenami.VariantProperty<P, string>);
21
+ type VariantProperty<P extends string> = Tokenami.TokenProperty<P> | Tokenami.VariantProperty<P, string>;
31
22
  type TokenValue<P> = P extends string ? P extends keyof PropertyConfig ? NonNullable<PropertyConfig[P]>[number] extends `${infer ThemeKey}` ? PropertyThemeValue<ThemeKey> : never : never : never;
32
23
  type PropertyThemeValue<ThemeKey extends string> = Tokenami.ArbitraryValue | CSS.Globals | TokensByThemeKey[ThemeKey] | (ThemeKey extends 'grid' | 'number' ? Tokenami.GridValue : never);
33
24
  type TokensByThemeKey = {