@unocss/language-server 66.6.7 → 66.6.8

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
@@ -1,4 +1,4 @@
1
- import * as _unocss_core0 from "@unocss/core";
1
+ import * as _$_unocss_core0 from "@unocss/core";
2
2
  import { UnoGenerator, UnocssPluginContext, UserConfig } from "@unocss/core";
3
3
  import { Connection } from "vscode-languageserver";
4
4
 
@@ -20,7 +20,7 @@ declare class ContextManager {
20
20
  private discoveredConfigs;
21
21
  private readonly defaultUnocssConfig;
22
22
  private readonly workspaceRoots;
23
- events: _unocss_core0.Emitter<{
23
+ events: _$_unocss_core0.Emitter<{
24
24
  reload: () => void;
25
25
  unload: (context: UnocssPluginContext<UserConfig<any>>) => void;
26
26
  contextLoaded: (context: UnocssPluginContext<UserConfig<any>>) => void;
package/dist/index.mjs CHANGED
@@ -9,8 +9,8 @@ import process$1 from "node:process";
9
9
  import { createRecoveryConfigLoader } from "@unocss/config";
10
10
  import presetWind3 from "@unocss/preset-wind3";
11
11
  import { sourceObjectFields, sourcePluginFactory } from "unconfig/presets";
12
- import parserCSS from "prettier/parser-postcss";
13
- import prettier from "prettier/standalone";
12
+ import parserCSS from "prettier/parser-postcss.js";
13
+ import prettier from "prettier/standalone.js";
14
14
  const SKIP_START_COMMENT = "@unocss-skip-start";
15
15
  const SKIP_END_COMMENT = "@unocss-skip-end";
16
16
  const SKIP_COMMENT_RE = new RegExp(`(\/\/\\s*?${SKIP_START_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(\/\/\\s*?${SKIP_END_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, "g");
@@ -3083,7 +3083,7 @@ function variantAttributify(options = {}) {
3083
3083
  const [, bodyVariant, bracketValue] = content.match(variantsValueRE) || [];
3084
3084
  if (bracketValue) return `${bodyVariant}${variants}${name}-${bracketValue}`;
3085
3085
  }
3086
- if (variants && body.match(/^[\d.]+$/)) {
3086
+ if (variants && /^[\d.]+$/.test(body)) {
3087
3087
  const variantParts = variants.split(/([^:]*:)/g).filter(Boolean);
3088
3088
  const _body = variantParts.pop() + body;
3089
3089
  const _variants = variantParts.join("");
@@ -3278,7 +3278,7 @@ function encodeSvgForCss(svg) {
3278
3278
  return encodeSVGforURL(useSvg);
3279
3279
  }
3280
3280
  //#endregion
3281
- //#region ../../packages-presets/preset-icons/dist/core-CVWr9MHW.mjs
3281
+ //#region ../../packages-presets/preset-icons/dist/core-DIrlUwzK.mjs
3282
3282
  function getEnvFlags() {
3283
3283
  const isNode = typeof process !== "undefined" && process.stdout;
3284
3284
  return {
@@ -3374,6 +3374,7 @@ var collections_default = [
3374
3374
  "gala",
3375
3375
  "game-icons",
3376
3376
  "garden",
3377
+ "gcp",
3377
3378
  "geo",
3378
3379
  "gg",
3379
3380
  "gis",
@@ -3659,7 +3660,7 @@ async function parseIconWithLoader(body, loader, options = {}, safeCollectionsNa
3659
3660
  };
3660
3661
  }
3661
3662
  //#endregion
3662
- //#region ../../packages-presets/preset-icons/dist/cdn-fz6F-x8c.mjs
3663
+ //#region ../../packages-presets/preset-icons/dist/cdn-DYTPkoFm.mjs
3663
3664
  async function createCDNLoader(cdnBase) {
3664
3665
  const { $fetch } = await import("./node-D23LglTq.mjs");
3665
3666
  return createCDNFetchLoader($fetch, cdnBase);
@@ -6017,7 +6018,7 @@ var __exportAll = (all, no_symbols) => {
6017
6018
  return target;
6018
6019
  };
6019
6020
  //#endregion
6020
- //#region ../../packages-presets/preset-wind4/dist/utils-BamiTVVE.mjs
6021
+ //#region ../../packages-presets/preset-wind4/dist/utils-B60b98El.mjs
6021
6022
  const PRESET_NAME = "@unocss/preset-wind4";
6022
6023
  const CONTROL_NO_NEGATIVE = "$$mini-no-negative";
6023
6024
  const SpecialColorKey = {
@@ -6151,6 +6152,7 @@ const unitOnlyMap = {
6151
6152
  };
6152
6153
  const bracketTypeRe = /^\[(color|image|length|size|position|quoted|string|number|family):/i;
6153
6154
  const splitComma = /,(?![^()]*\))/g;
6155
+ const cssVarsRE = /(?<!var\()--([\w.-]+)(\([^)]+\)|,[#.\s\w]+)?/g;
6154
6156
  var handlers_exports = /* @__PURE__ */ __exportAll({
6155
6157
  auto: () => auto,
6156
6158
  bracket: () => bracket,
@@ -6285,13 +6287,23 @@ function fraction(str) {
6285
6287
  return `${round(num * 100)}%`;
6286
6288
  }
6287
6289
  }
6288
- function processThemeVariable(name, key, paths, theme) {
6289
- const valOrObj = getThemeByKey(theme, key, paths);
6290
+ /**
6291
+ * Process a theme variable reference and retrieve its value and corresponding CSS variable key.
6292
+ *
6293
+ * @example theme => Theme object
6294
+ * @example themeKey => 'colors
6295
+ * @example themeKeyPaths => ['blue', '500']
6296
+ * @example varPaths => 'colors.blue.500'
6297
+ *
6298
+ * @returns An object containing the resolved value from the theme and the corresponding CSS variable key.
6299
+ */
6300
+ function processThemeVariable(theme, themeKey, themeKeyPaths, varPaths) {
6301
+ const valOrObj = getThemeByKey(theme, themeKey, themeKeyPaths);
6290
6302
  const hasDefault = typeof valOrObj === "object" && "DEFAULT" in valOrObj;
6291
- if (hasDefault) paths.push("DEFAULT");
6303
+ if (hasDefault) themeKeyPaths.push("DEFAULT");
6292
6304
  const val = hasDefault ? valOrObj.DEFAULT : valOrObj;
6293
- const varKey = hasDefault && key !== "spacing" ? `${name}.DEFAULT` : name;
6294
- if (val != null) themeTracking(key, paths.length ? paths : void 0);
6305
+ const varKey = hasDefault && themeKey !== "spacing" ? `${varPaths}.DEFAULT` : varPaths;
6306
+ if (val != null) themeTracking(themeKey, themeKeyPaths.length ? themeKeyPaths : void 0);
6295
6307
  return {
6296
6308
  val,
6297
6309
  varKey
@@ -6310,23 +6322,24 @@ function bracketWithType(str, requiredType, theme) {
6310
6322
  }
6311
6323
  if (!base) return;
6312
6324
  if (base === "=\"\"") return;
6313
- if (base.startsWith("--")) {
6314
- const calcMatch = base.match(/^--([\w.-]+)\(([^)]+)\)$/);
6315
- if (calcMatch != null && theme) {
6316
- const [, name, factor] = calcMatch;
6317
- const [key, ...paths] = name.split(".");
6318
- const { val, varKey } = processThemeVariable(name, key, paths, theme);
6319
- if (val != null) base = `calc(var(--${escapeSelector(varKey.replaceAll(".", "-"))}) * ${factor})`;
6320
- } else {
6321
- const [name, defaultValue] = base.slice(2).split(",");
6322
- const suffix = defaultValue ? `, ${defaultValue}` : "";
6323
- const escapedName = escapeSelector(name);
6324
- if (theme) {
6325
- const [key, ...paths] = name.split(".");
6326
- const { val, varKey } = processThemeVariable(name, key, paths, theme);
6327
- base = val != null ? `var(--${escapeSelector(varKey.replaceAll(".", "-"))}${suffix})` : `var(--${escapedName}${suffix})`;
6328
- } else base = `var(--${escapedName}${suffix})`;
6325
+ if (theme) base = transformThemeFn(base, theme);
6326
+ const matches = Array.from(base.matchAll(cssVarsRE));
6327
+ for (const match of matches) {
6328
+ const [full, varPaths, _value] = match;
6329
+ if (theme) {
6330
+ const [key, ...paths] = varPaths.split(".");
6331
+ const { val, varKey } = processThemeVariable(theme, key, paths, varPaths);
6332
+ if (val != null) {
6333
+ const cssVar = `--${varKey.replaceAll(".", "-")}`;
6334
+ if (_value && !_value.startsWith(",")) base = base.replace(full, `calc(var(${cssVar}) * ${_value.slice(1, -1)})`);
6335
+ else {
6336
+ const fallback = _value?.slice(1);
6337
+ base = base.replace(full, `var(${cssVar}${fallback ? `, ${fallback}` : ""})`);
6338
+ }
6339
+ continue;
6340
+ }
6329
6341
  }
6342
+ base = base.replace(full, `var(${full})`);
6330
6343
  }
6331
6344
  let curly = 0;
6332
6345
  for (const i of base) if (i === "[") curly += 1;
@@ -6708,7 +6721,7 @@ function propertyTracking(property, value) {
6708
6721
  if (!trackedProperties.has(property)) trackedProperties.set(property, value);
6709
6722
  }
6710
6723
  //#endregion
6711
- //#region ../../packages-presets/preset-wind4/dist/container-_7pdPWQl.mjs
6724
+ //#region ../../packages-presets/preset-wind4/dist/container-m1WfKD7R.mjs
6712
6725
  const containerParent = [[/^@container(?:\/(\w+))?(?:-(normal))?$/, ([, l, v]) => {
6713
6726
  return {
6714
6727
  "container-type": v ?? "inline-size",
@@ -8532,7 +8545,7 @@ function getSizeValue(theme, hw, prop) {
8532
8545
  themeTracking(`spacing`);
8533
8546
  v = `calc(var(--spacing) * ${h.number(prop)})`;
8534
8547
  }
8535
- return v ?? h.bracket.cssvar.global.auto.none.fraction.rem(prop);
8548
+ return v ?? h.bracket.cssvar.global.auto.none.fraction.rem(prop, theme);
8536
8549
  }
8537
8550
  const sizes = [
8538
8551
  [/^size-(min-|max-)?(.+)$/, ([, m, s], { theme }) => ({
@@ -10738,7 +10751,7 @@ const theme = {
10738
10751
  supports
10739
10752
  };
10740
10753
  //#endregion
10741
- //#region ../../packages-presets/preset-wind4/dist/variants-BQhcPCjX.mjs
10754
+ //#region ../../packages-presets/preset-wind4/dist/variants-B5PDncV-.mjs
10742
10755
  const variantAria = {
10743
10756
  name: "aria",
10744
10757
  match(matcher, ctx) {
@@ -11226,7 +11239,7 @@ const variantNegative = {
11226
11239
  return {
11227
11240
  matcher: matcher.slice(1),
11228
11241
  body: (body) => {
11229
- if (body.find((v) => v[0] === "$$mini-no-negative")) return;
11242
+ if (body.some((v) => v[0] === "$$mini-no-negative")) return;
11230
11243
  let changed = false;
11231
11244
  for (const v of body) {
11232
11245
  const [prop, rawValue, meta] = v;