tokenami 0.0.82 → 0.0.83
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/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +10 -18
- package/dist/index.js +10 -18
- package/package.json +4 -4
package/dist/cli.cjs
CHANGED
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2214,7 +2214,6 @@ var TokenamiPlugin = class {
|
|
|
2214
2214
|
return original;
|
|
2215
2215
|
};
|
|
2216
2216
|
getCompletionEntryDetails(fileName, position, entryName, formatOptions, source, preferences, data) {
|
|
2217
|
-
const isTokenamiProperty = TokenamiConfig4__namespace.TokenProperty.safeParse(entryName).success;
|
|
2218
2217
|
const original = this.#ctx.info.languageService.getCompletionEntryDetails(
|
|
2219
2218
|
fileName,
|
|
2220
2219
|
position,
|
|
@@ -2224,31 +2223,24 @@ var TokenamiPlugin = class {
|
|
|
2224
2223
|
preferences,
|
|
2225
2224
|
data
|
|
2226
2225
|
);
|
|
2227
|
-
const
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
}
|
|
2232
|
-
const sourceFile = this.#ctx.info.languageService.getProgram()?.getSourceFile(fileName);
|
|
2233
|
-
if (!sourceFile) return original;
|
|
2234
|
-
const node = findNodeAtPosition(sourceFile, position);
|
|
2235
|
-
if (!node || !ts__default.default.isPropertyAssignment(node.parent)) return original;
|
|
2236
|
-
const parentProperty = node.parent.name.getText();
|
|
2237
|
-
const isTokenamiValue = TokenamiConfig4__namespace.TokenProperty.safeParse(parentProperty).success;
|
|
2238
|
-
if (!isTokenamiValue) return original;
|
|
2239
|
-
const [entry] = this.#completions.valueSearch(search);
|
|
2226
|
+
const completions = this.getCompletionsAtPosition(fileName, position);
|
|
2227
|
+
const entry = completions?.entries.find((entry2) => entry2.name === entryName);
|
|
2228
|
+
const selector = entry.details?.selector;
|
|
2229
|
+
const modeValues = entry.details?.modeValues;
|
|
2240
2230
|
if (!entry) return original;
|
|
2241
|
-
|
|
2231
|
+
if (selector) return createEntryDetails(original, entry, selector);
|
|
2232
|
+
if (!modeValues) return original;
|
|
2233
|
+
const themeEntries = Object.entries(modeValues);
|
|
2242
2234
|
const [mode, firstValue] = themeEntries[0] || [];
|
|
2243
2235
|
if (!firstValue) return original;
|
|
2244
|
-
if (isColorThemeEntry(
|
|
2245
|
-
const colorDescription = createColorTokenDescription(
|
|
2236
|
+
if (isColorThemeEntry(modeValues)) {
|
|
2237
|
+
const colorDescription = createColorTokenDescription(modeValues);
|
|
2246
2238
|
const rgb2 = convertToRgb(replaceCssVarsWithFallback(firstValue), mode);
|
|
2247
2239
|
return createEntryDetails(original, entry, `${rgb2}
|
|
2248
2240
|
|
|
2249
2241
|
${colorDescription}`);
|
|
2250
2242
|
} else {
|
|
2251
|
-
const description = createTokenDescription(
|
|
2243
|
+
const description = createTokenDescription(modeValues);
|
|
2252
2244
|
return createEntryDetails(original, entry, description);
|
|
2253
2245
|
}
|
|
2254
2246
|
}
|
package/dist/index.js
CHANGED
|
@@ -2190,7 +2190,6 @@ var TokenamiPlugin = class {
|
|
|
2190
2190
|
return original;
|
|
2191
2191
|
};
|
|
2192
2192
|
getCompletionEntryDetails(fileName, position, entryName, formatOptions, source, preferences, data) {
|
|
2193
|
-
const isTokenamiProperty = TokenamiConfig4.TokenProperty.safeParse(entryName).success;
|
|
2194
2193
|
const original = this.#ctx.info.languageService.getCompletionEntryDetails(
|
|
2195
2194
|
fileName,
|
|
2196
2195
|
position,
|
|
@@ -2200,31 +2199,24 @@ var TokenamiPlugin = class {
|
|
|
2200
2199
|
preferences,
|
|
2201
2200
|
data
|
|
2202
2201
|
);
|
|
2203
|
-
const
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
}
|
|
2208
|
-
const sourceFile = this.#ctx.info.languageService.getProgram()?.getSourceFile(fileName);
|
|
2209
|
-
if (!sourceFile) return original;
|
|
2210
|
-
const node = findNodeAtPosition(sourceFile, position);
|
|
2211
|
-
if (!node || !ts.isPropertyAssignment(node.parent)) return original;
|
|
2212
|
-
const parentProperty = node.parent.name.getText();
|
|
2213
|
-
const isTokenamiValue = TokenamiConfig4.TokenProperty.safeParse(parentProperty).success;
|
|
2214
|
-
if (!isTokenamiValue) return original;
|
|
2215
|
-
const [entry] = this.#completions.valueSearch(search);
|
|
2202
|
+
const completions = this.getCompletionsAtPosition(fileName, position);
|
|
2203
|
+
const entry = completions?.entries.find((entry2) => entry2.name === entryName);
|
|
2204
|
+
const selector = entry.details?.selector;
|
|
2205
|
+
const modeValues = entry.details?.modeValues;
|
|
2216
2206
|
if (!entry) return original;
|
|
2217
|
-
|
|
2207
|
+
if (selector) return createEntryDetails(original, entry, selector);
|
|
2208
|
+
if (!modeValues) return original;
|
|
2209
|
+
const themeEntries = Object.entries(modeValues);
|
|
2218
2210
|
const [mode, firstValue] = themeEntries[0] || [];
|
|
2219
2211
|
if (!firstValue) return original;
|
|
2220
|
-
if (isColorThemeEntry(
|
|
2221
|
-
const colorDescription = createColorTokenDescription(
|
|
2212
|
+
if (isColorThemeEntry(modeValues)) {
|
|
2213
|
+
const colorDescription = createColorTokenDescription(modeValues);
|
|
2222
2214
|
const rgb2 = convertToRgb(replaceCssVarsWithFallback(firstValue), mode);
|
|
2223
2215
|
return createEntryDetails(original, entry, `${rgb2}
|
|
2224
2216
|
|
|
2225
2217
|
${colorDescription}`);
|
|
2226
2218
|
} else {
|
|
2227
|
-
const description = createTokenDescription(
|
|
2219
|
+
const description = createTokenDescription(modeValues);
|
|
2228
2220
|
return createEntryDetails(original, entry, description);
|
|
2229
2221
|
}
|
|
2230
2222
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokenami",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@stitches/stringify": "^1.2.8",
|
|
48
|
-
"@tokenami/config": "0.0.
|
|
49
|
-
"@tokenami/ds": "0.0.
|
|
48
|
+
"@tokenami/config": "0.0.83",
|
|
49
|
+
"@tokenami/ds": "0.0.83",
|
|
50
50
|
"acorn": "^8.11.3",
|
|
51
51
|
"acorn-walk": "^8.3.2",
|
|
52
52
|
"browserslist": "^4.24.4",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"typescript": ">= 5"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "69cee783e6cb6e1fd3006c437e17d1106e67595d"
|
|
71
71
|
}
|