@unocss/language-server 66.6.7 → 66.7.0-beta.1

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.mjs CHANGED
@@ -1,16 +1,39 @@
1
- import { n as __require$1, r as __toESM, t as __commonJSMin } from "./chunk-CBBoxR_p.mjs";
2
- import { a as join, i as isAbsolute, n as searchForIcon, o as resolve$1, t as loadIcon } from "./loader-DsXvVy9i.mjs";
1
+ import { n as searchForIcon, t as loadIcon } from "./loader-Cc0WuaWv.mjs";
3
2
  import { createRequire } from "node:module";
4
3
  import { BetterMap, LAYER_IMPORTS, clone, createGenerator, createNanoEvents, cssIdRE, defaultSplitRE, definePreset, escapeRegExp, escapeSelector, isAttributifySelector, isString, isValidSelector, mergeDeep, notNull, splitWithVariantGroupRE, symbols, toArray, uniq, warnOnce } from "@unocss/core";
5
4
  import { existsSync } from "node:fs";
6
5
  import { readdir } from "node:fs/promises";
7
6
  import path from "node:path";
8
- import process$1 from "node:process";
9
- import { createRecoveryConfigLoader } from "@unocss/config";
10
7
  import presetWind3 from "@unocss/preset-wind3";
11
8
  import { sourceObjectFields, sourcePluginFactory } from "unconfig/presets";
9
+ import process$1 from "node:process";
10
+ import { createRecoveryConfigLoader } from "@unocss/config";
11
+ import { colordx } from "@colordx/core";
12
12
  import parserCSS from "prettier/parser-postcss";
13
13
  import prettier from "prettier/standalone";
14
+ //#region \0rolldown/runtime.js
15
+ var __create = Object.create;
16
+ var __defProp$1 = Object.defineProperty;
17
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
18
+ var __getOwnPropNames = Object.getOwnPropertyNames;
19
+ var __getProtoOf = Object.getPrototypeOf;
20
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
21
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
22
+ var __copyProps = (to, from, except, desc) => {
23
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
24
+ key = keys[i];
25
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp$1(to, key, {
26
+ get: ((k) => from[k]).bind(null, key),
27
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
28
+ });
29
+ }
30
+ return to;
31
+ };
32
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
33
+ value: mod,
34
+ enumerable: true
35
+ }) : target, mod));
36
+ var __require$1 = /* @__PURE__ */ createRequire(import.meta.url);
14
37
  const SKIP_START_COMMENT = "@unocss-skip-start";
15
38
  const SKIP_END_COMMENT = "@unocss-skip-end";
16
39
  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");
@@ -1224,10 +1247,124 @@ function getMatchedPositionsFromDoc(uno, code, id, strictAnnotationMatch = false
1224
1247
  return result;
1225
1248
  }
1226
1249
  //#endregion
1227
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
1250
+ //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
1251
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
1252
+ function normalizeWindowsPath(input = "") {
1253
+ if (!input) return input;
1254
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
1255
+ }
1256
+ const _UNC_REGEX = /^[/\\]{2}/;
1257
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
1258
+ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
1259
+ const normalize = function(path) {
1260
+ if (path.length === 0) return ".";
1261
+ path = normalizeWindowsPath(path);
1262
+ const isUNCPath = path.match(_UNC_REGEX);
1263
+ const isPathAbsolute = isAbsolute(path);
1264
+ const trailingSeparator = path[path.length - 1] === "/";
1265
+ path = normalizeString(path, !isPathAbsolute);
1266
+ if (path.length === 0) {
1267
+ if (isPathAbsolute) return "/";
1268
+ return trailingSeparator ? "./" : ".";
1269
+ }
1270
+ if (trailingSeparator) path += "/";
1271
+ if (_DRIVE_LETTER_RE.test(path)) path += "/";
1272
+ if (isUNCPath) {
1273
+ if (!isPathAbsolute) return `//./${path}`;
1274
+ return `//${path}`;
1275
+ }
1276
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
1277
+ };
1278
+ const join = function(...segments) {
1279
+ let path = "";
1280
+ for (const seg of segments) {
1281
+ if (!seg) continue;
1282
+ if (path.length > 0) {
1283
+ const pathTrailing = path[path.length - 1] === "/";
1284
+ const segLeading = seg[0] === "/";
1285
+ if (pathTrailing && segLeading) path += seg.slice(1);
1286
+ else path += pathTrailing || segLeading ? seg : `/${seg}`;
1287
+ } else path += seg;
1288
+ }
1289
+ return normalize(path);
1290
+ };
1291
+ function cwd$1() {
1292
+ if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
1293
+ return "/";
1294
+ }
1295
+ const resolve$1 = function(...arguments_) {
1296
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
1297
+ let resolvedPath = "";
1298
+ let resolvedAbsolute = false;
1299
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
1300
+ const path = index >= 0 ? arguments_[index] : cwd$1();
1301
+ if (!path || path.length === 0) continue;
1302
+ resolvedPath = `${path}/${resolvedPath}`;
1303
+ resolvedAbsolute = isAbsolute(path);
1304
+ }
1305
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
1306
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
1307
+ return resolvedPath.length > 0 ? resolvedPath : ".";
1308
+ };
1309
+ function normalizeString(path, allowAboveRoot) {
1310
+ let res = "";
1311
+ let lastSegmentLength = 0;
1312
+ let lastSlash = -1;
1313
+ let dots = 0;
1314
+ let char = null;
1315
+ for (let index = 0; index <= path.length; ++index) {
1316
+ if (index < path.length) char = path[index];
1317
+ else if (char === "/") break;
1318
+ else char = "/";
1319
+ if (char === "/") {
1320
+ if (lastSlash === index - 1 || dots === 1);
1321
+ else if (dots === 2) {
1322
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
1323
+ if (res.length > 2) {
1324
+ const lastSlashIndex = res.lastIndexOf("/");
1325
+ if (lastSlashIndex === -1) {
1326
+ res = "";
1327
+ lastSegmentLength = 0;
1328
+ } else {
1329
+ res = res.slice(0, lastSlashIndex);
1330
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
1331
+ }
1332
+ lastSlash = index;
1333
+ dots = 0;
1334
+ continue;
1335
+ } else if (res.length > 0) {
1336
+ res = "";
1337
+ lastSegmentLength = 0;
1338
+ lastSlash = index;
1339
+ dots = 0;
1340
+ continue;
1341
+ }
1342
+ }
1343
+ if (allowAboveRoot) {
1344
+ res += res.length > 0 ? "/.." : "..";
1345
+ lastSegmentLength = 2;
1346
+ }
1347
+ } else {
1348
+ if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
1349
+ else res = path.slice(lastSlash + 1, index);
1350
+ lastSegmentLength = index - lastSlash - 1;
1351
+ }
1352
+ lastSlash = index;
1353
+ dots = 0;
1354
+ } else if (char === "." && dots !== -1) ++dots;
1355
+ else dots = -1;
1356
+ }
1357
+ return res;
1358
+ }
1359
+ const isAbsolute = function(p) {
1360
+ return _IS_ABSOLUTE_RE.test(p);
1361
+ };
1362
+ //#endregion
1363
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
1228
1364
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1229
1365
  const WIN_SLASH = "\\\\/";
1230
1366
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1367
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
1231
1368
  /**
1232
1369
  * Posix glob regex
1233
1370
  */
@@ -1277,8 +1414,10 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1277
1414
  SEP: "\\"
1278
1415
  };
1279
1416
  module.exports = {
1417
+ DEFAULT_MAX_EXTGLOB_RECURSION,
1280
1418
  MAX_LENGTH: 1024 * 64,
1281
1419
  POSIX_REGEX_SOURCE: {
1420
+ __proto__: null,
1282
1421
  alnum: "a-zA-Z0-9",
1283
1422
  alpha: "a-zA-Z",
1284
1423
  ascii: "\\x00-\\x7F",
@@ -1349,6 +1488,9 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1349
1488
  CHAR_UNDERSCORE: 95,
1350
1489
  CHAR_VERTICAL_LINE: 124,
1351
1490
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
1491
+ /**
1492
+ * Create EXTGLOB_CHARS
1493
+ */
1352
1494
  extglobChars(chars) {
1353
1495
  return {
1354
1496
  "!": {
@@ -1378,13 +1520,16 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1378
1520
  }
1379
1521
  };
1380
1522
  },
1523
+ /**
1524
+ * Create GLOB_CHARS
1525
+ */
1381
1526
  globChars(win32) {
1382
1527
  return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
1383
1528
  }
1384
1529
  };
1385
1530
  }));
1386
1531
  //#endregion
1387
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
1532
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
1388
1533
  var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
1389
1534
  const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
1390
1535
  exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
@@ -1432,7 +1577,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
1432
1577
  };
1433
1578
  }));
1434
1579
  //#endregion
1435
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
1580
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
1436
1581
  var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1437
1582
  const utils = require_utils();
1438
1583
  const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
@@ -1719,7 +1864,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1719
1864
  module.exports = scan;
1720
1865
  }));
1721
1866
  //#endregion
1722
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
1867
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
1723
1868
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1724
1869
  const constants = require_constants();
1725
1870
  const utils = require_utils();
@@ -1747,6 +1892,177 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1747
1892
  const syntaxError = (type, char) => {
1748
1893
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
1749
1894
  };
1895
+ const splitTopLevel = (input) => {
1896
+ const parts = [];
1897
+ let bracket = 0;
1898
+ let paren = 0;
1899
+ let quote = 0;
1900
+ let value = "";
1901
+ let escaped = false;
1902
+ for (const ch of input) {
1903
+ if (escaped === true) {
1904
+ value += ch;
1905
+ escaped = false;
1906
+ continue;
1907
+ }
1908
+ if (ch === "\\") {
1909
+ value += ch;
1910
+ escaped = true;
1911
+ continue;
1912
+ }
1913
+ if (ch === "\"") {
1914
+ quote = quote === 1 ? 0 : 1;
1915
+ value += ch;
1916
+ continue;
1917
+ }
1918
+ if (quote === 0) {
1919
+ if (ch === "[") bracket++;
1920
+ else if (ch === "]" && bracket > 0) bracket--;
1921
+ else if (bracket === 0) {
1922
+ if (ch === "(") paren++;
1923
+ else if (ch === ")" && paren > 0) paren--;
1924
+ else if (ch === "|" && paren === 0) {
1925
+ parts.push(value);
1926
+ value = "";
1927
+ continue;
1928
+ }
1929
+ }
1930
+ }
1931
+ value += ch;
1932
+ }
1933
+ parts.push(value);
1934
+ return parts;
1935
+ };
1936
+ const isPlainBranch = (branch) => {
1937
+ let escaped = false;
1938
+ for (const ch of branch) {
1939
+ if (escaped === true) {
1940
+ escaped = false;
1941
+ continue;
1942
+ }
1943
+ if (ch === "\\") {
1944
+ escaped = true;
1945
+ continue;
1946
+ }
1947
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
1948
+ }
1949
+ return true;
1950
+ };
1951
+ const normalizeSimpleBranch = (branch) => {
1952
+ let value = branch.trim();
1953
+ let changed = true;
1954
+ while (changed === true) {
1955
+ changed = false;
1956
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
1957
+ value = value.slice(2, -1);
1958
+ changed = true;
1959
+ }
1960
+ }
1961
+ if (!isPlainBranch(value)) return;
1962
+ return value.replace(/\\(.)/g, "$1");
1963
+ };
1964
+ const hasRepeatedCharPrefixOverlap = (branches) => {
1965
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
1966
+ for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
1967
+ const a = values[i];
1968
+ const b = values[j];
1969
+ const char = a[0];
1970
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
1971
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
1972
+ }
1973
+ return false;
1974
+ };
1975
+ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
1976
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
1977
+ let bracket = 0;
1978
+ let paren = 0;
1979
+ let quote = 0;
1980
+ let escaped = false;
1981
+ for (let i = 1; i < pattern.length; i++) {
1982
+ const ch = pattern[i];
1983
+ if (escaped === true) {
1984
+ escaped = false;
1985
+ continue;
1986
+ }
1987
+ if (ch === "\\") {
1988
+ escaped = true;
1989
+ continue;
1990
+ }
1991
+ if (ch === "\"") {
1992
+ quote = quote === 1 ? 0 : 1;
1993
+ continue;
1994
+ }
1995
+ if (quote === 1) continue;
1996
+ if (ch === "[") {
1997
+ bracket++;
1998
+ continue;
1999
+ }
2000
+ if (ch === "]" && bracket > 0) {
2001
+ bracket--;
2002
+ continue;
2003
+ }
2004
+ if (bracket > 0) continue;
2005
+ if (ch === "(") {
2006
+ paren++;
2007
+ continue;
2008
+ }
2009
+ if (ch === ")") {
2010
+ paren--;
2011
+ if (paren === 0) {
2012
+ if (requireEnd === true && i !== pattern.length - 1) return;
2013
+ return {
2014
+ type: pattern[0],
2015
+ body: pattern.slice(2, i),
2016
+ end: i
2017
+ };
2018
+ }
2019
+ }
2020
+ }
2021
+ };
2022
+ const getStarExtglobSequenceOutput = (pattern) => {
2023
+ let index = 0;
2024
+ const chars = [];
2025
+ while (index < pattern.length) {
2026
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
2027
+ if (!match || match.type !== "*") return;
2028
+ const branches = splitTopLevel(match.body).map((branch) => branch.trim());
2029
+ if (branches.length !== 1) return;
2030
+ const branch = normalizeSimpleBranch(branches[0]);
2031
+ if (!branch || branch.length !== 1) return;
2032
+ chars.push(branch);
2033
+ index += match.end + 1;
2034
+ }
2035
+ if (chars.length < 1) return;
2036
+ return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
2037
+ };
2038
+ const repeatedExtglobRecursion = (pattern) => {
2039
+ let depth = 0;
2040
+ let value = pattern.trim();
2041
+ let match = parseRepeatedExtglob(value);
2042
+ while (match) {
2043
+ depth++;
2044
+ value = match.body.trim();
2045
+ match = parseRepeatedExtglob(value);
2046
+ }
2047
+ return depth;
2048
+ };
2049
+ const analyzeRepeatedExtglob = (body, options) => {
2050
+ if (options.maxExtglobRecursion === false) return { risky: false };
2051
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
2052
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
2053
+ if (branches.length > 1) {
2054
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
2055
+ }
2056
+ for (const branch of branches) {
2057
+ const safeOutput = getStarExtglobSequenceOutput(branch);
2058
+ if (safeOutput) return {
2059
+ risky: true,
2060
+ safeOutput
2061
+ };
2062
+ if (repeatedExtglobRecursion(branch) > max) return { risky: true };
2063
+ }
2064
+ return { risky: false };
2065
+ };
1750
2066
  /**
1751
2067
  * Parse the given input string.
1752
2068
  * @param {String} input
@@ -1876,6 +2192,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1876
2192
  token.prev = prev;
1877
2193
  token.parens = state.parens;
1878
2194
  token.output = state.output;
2195
+ token.startIndex = state.index;
2196
+ token.tokensIndex = tokens.length;
1879
2197
  const output = (opts.capture ? "(" : "") + token.open;
1880
2198
  increment("parens");
1881
2199
  push({
@@ -1892,6 +2210,30 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1892
2210
  extglobs.push(token);
1893
2211
  };
1894
2212
  const extglobClose = (token) => {
2213
+ const literal = input.slice(token.startIndex, state.index + 1);
2214
+ const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
2215
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
2216
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
2217
+ const open = tokens[token.tokensIndex];
2218
+ open.type = "text";
2219
+ open.value = literal;
2220
+ open.output = safeOutput || utils.escapeRegex(literal);
2221
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
2222
+ tokens[i].value = "";
2223
+ tokens[i].output = "";
2224
+ delete tokens[i].suffix;
2225
+ }
2226
+ state.output = token.output + open.output;
2227
+ state.backtrack = true;
2228
+ push({
2229
+ type: "paren",
2230
+ extglob: true,
2231
+ value,
2232
+ output: ""
2233
+ });
2234
+ decrement("parens");
2235
+ return;
2236
+ }
1895
2237
  let output = token.close + (opts.capture ? ")" : "");
1896
2238
  let rest;
1897
2239
  if (token.type === "negate") {
@@ -2577,7 +2919,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2577
2919
  module.exports = parse;
2578
2920
  }));
2579
2921
  //#endregion
2580
- //#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
2922
+ //#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
2581
2923
  var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2582
2924
  const scan = require_scan();
2583
2925
  const parse = require_parse();
@@ -2787,6 +3129,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2787
3129
  * Compile a regular expression from the `state` object returned by the
2788
3130
  * [parse()](#parse) method.
2789
3131
  *
3132
+ * ```js
3133
+ * const picomatch = require('picomatch');
3134
+ * const state = picomatch.parse('*.js');
3135
+ * // picomatch.compileRe(state[, options]);
3136
+ *
3137
+ * console.log(picomatch.compileRe(state));
3138
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
3139
+ * ```
2790
3140
  * @param {Object} `state`
2791
3141
  * @param {Object} `options`
2792
3142
  * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
@@ -2810,10 +3160,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2810
3160
  *
2811
3161
  * ```js
2812
3162
  * const picomatch = require('picomatch');
2813
- * const state = picomatch.parse('*.js');
2814
- * // picomatch.compileRe(state[, options]);
3163
+ * // picomatch.makeRe(state[, options]);
2815
3164
  *
2816
- * console.log(picomatch.compileRe(state));
3165
+ * const result = picomatch.makeRe('*.js');
3166
+ * console.log(result);
2817
3167
  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2818
3168
  * ```
2819
3169
  * @param {String} `state` The object returned from the `.parse` method.
@@ -3083,7 +3433,7 @@ function variantAttributify(options = {}) {
3083
3433
  const [, bodyVariant, bracketValue] = content.match(variantsValueRE) || [];
3084
3434
  if (bracketValue) return `${bodyVariant}${variants}${name}-${bracketValue}`;
3085
3435
  }
3086
- if (variants && body.match(/^[\d.]+$/)) {
3436
+ if (variants && /^[\d.]+$/.test(body)) {
3087
3437
  const variantParts = variants.split(/([^:]*:)/g).filter(Boolean);
3088
3438
  const _body = variantParts.pop() + body;
3089
3439
  const _variants = variantParts.join("");
@@ -3254,7 +3604,7 @@ const presetAttributify = definePreset((options = {}) => {
3254
3604
  };
3255
3605
  });
3256
3606
  //#endregion
3257
- //#region ../../node_modules/.pnpm/@iconify+utils@3.1.0/node_modules/@iconify/utils/lib/svg/url.js
3607
+ //#region ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/svg/url.js
3258
3608
  /**
3259
3609
  * Encode SVG for use in url()
3260
3610
  *
@@ -3265,7 +3615,7 @@ function encodeSVGforURL(svg) {
3265
3615
  return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
3266
3616
  }
3267
3617
  //#endregion
3268
- //#region ../../node_modules/.pnpm/@iconify+utils@3.1.0/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.js
3618
+ //#region ../../node_modules/.pnpm/@iconify+utils@3.1.3/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.js
3269
3619
  /**
3270
3620
  * Encode the `SVG` to be used on `CSS`: https://bl.ocks.org/jennyknuth/222825e315d45a738ed9d6e04c7a88d0.
3271
3621
  *
@@ -3278,7 +3628,7 @@ function encodeSvgForCss(svg) {
3278
3628
  return encodeSVGforURL(useSvg);
3279
3629
  }
3280
3630
  //#endregion
3281
- //#region ../../packages-presets/preset-icons/dist/core-CVWr9MHW.mjs
3631
+ //#region ../../packages-presets/preset-icons/dist/core-Cb3gCBCx.mjs
3282
3632
  function getEnvFlags() {
3283
3633
  const isNode = typeof process !== "undefined" && process.stdout;
3284
3634
  return {
@@ -3374,6 +3724,7 @@ var collections_default = [
3374
3724
  "gala",
3375
3725
  "game-icons",
3376
3726
  "garden",
3727
+ "gcp",
3377
3728
  "geo",
3378
3729
  "gg",
3379
3730
  "gis",
@@ -3447,6 +3798,7 @@ var collections_default = [
3447
3798
  "pepicons",
3448
3799
  "ph",
3449
3800
  "picon",
3801
+ "pinhead",
3450
3802
  "pixel",
3451
3803
  "pixelarticons",
3452
3804
  "prime",
@@ -3659,9 +4011,9 @@ async function parseIconWithLoader(body, loader, options = {}, safeCollectionsNa
3659
4011
  };
3660
4012
  }
3661
4013
  //#endregion
3662
- //#region ../../packages-presets/preset-icons/dist/cdn-fz6F-x8c.mjs
4014
+ //#region ../../packages-presets/preset-icons/dist/cdn-B5KlXljx.mjs
3663
4015
  async function createCDNLoader(cdnBase) {
3664
- const { $fetch } = await import("./node-D23LglTq.mjs");
4016
+ const { $fetch } = await import("./node-oThp98aD.mjs");
3665
4017
  return createCDNFetchLoader($fetch, cdnBase);
3666
4018
  }
3667
4019
  //#endregion
@@ -3700,7 +4052,7 @@ const presetIcons = /* @__PURE__ */ definePreset((options = {}) => {
3700
4052
  });
3701
4053
  async function createNodeLoader() {
3702
4054
  try {
3703
- return await import("./node-loader-ZSa5xzQw.mjs").then((i) => i?.loadNodeIcon);
4055
+ return await import("./node-loader-CKcohGec.mjs").then((i) => i?.loadNodeIcon);
3704
4056
  } catch {}
3705
4057
  try {
3706
4058
  return __require("@iconify/utils/lib/loader/node-loader.cjs").loadNodeIcon;
@@ -4032,7 +4384,7 @@ function transformThemeFn(code, theme, throwOnMissing = true) {
4032
4384
  }
4033
4385
  function transformThemeString(code, theme, throwOnMissing = true) {
4034
4386
  const [rawKey, alpha] = code.split("/");
4035
- let value = rawKey.trim().split(".").reduce((t, k) => t === null || t === void 0 ? void 0 : t[k], theme);
4387
+ let value = rawKey.trim().split(".").reduce((t, k) => t?.[k], theme);
4036
4388
  if (typeof value === "object") value = value.DEFAULT;
4037
4389
  if (typeof value === "string") {
4038
4390
  if (alpha) {
@@ -4043,8 +4395,7 @@ function transformThemeString(code, theme, throwOnMissing = true) {
4043
4395
  } else if (throwOnMissing) throw new Error(`theme of "${code}" did not found`);
4044
4396
  }
4045
4397
  function calcMaxWidthBySize(size) {
4046
- var _size$match;
4047
- const value = ((_size$match = size.match(/^-?\d+\.?\d*/)) === null || _size$match === void 0 ? void 0 : _size$match[0]) || "";
4398
+ const value = size.match(/^-?\d+\.?\d*/)?.[0] || "";
4048
4399
  const unit = size.slice(value.length);
4049
4400
  if (unit === "px") {
4050
4401
  const maxWidth = Number.parseFloat(value) - .1;
@@ -4054,8 +4405,7 @@ function calcMaxWidthBySize(size) {
4054
4405
  }
4055
4406
  function createValueHandler(handlers) {
4056
4407
  const handler = function(str, theme) {
4057
- var _this$__options;
4058
- const s = ((_this$__options = this.__options) === null || _this$__options === void 0 ? void 0 : _this$__options.sequence) || [];
4408
+ const s = this.__options?.sequence || [];
4059
4409
  this.__options.sequence = [];
4060
4410
  for (const n of s) {
4061
4411
  const res = handlers[n](str, theme);
@@ -4171,13 +4521,12 @@ function createTaggedPseudoClassMatcher(tag, parent, combinator, utils) {
4171
4521
  let pseudoColonRE;
4172
4522
  let pseudoVarRE;
4173
4523
  const matchBracket = (input) => {
4174
- var _rest$split;
4175
4524
  const body = variantGetBracket(`${tag}-`, input, []);
4176
4525
  if (!body) return;
4177
4526
  const [match, rest] = body;
4178
4527
  const bracketValue = h.bracket(match);
4179
4528
  if (bracketValue == null) return;
4180
- const label = ((_rest$split = rest.split(splitRE, 1)) === null || _rest$split === void 0 ? void 0 : _rest$split[0]) ?? "";
4529
+ const label = rest.split(splitRE, 1)?.[0] ?? "";
4181
4530
  const prefix = `${parent}${escapeSelector(label)}`;
4182
4531
  return [
4183
4532
  label,
@@ -4322,8 +4671,8 @@ function createPseudoClassFunctions(utils) {
4322
4671
  };
4323
4672
  }
4324
4673
  function createTaggedPseudoClasses(options, utils) {
4325
- const attributify = !!(options === null || options === void 0 ? void 0 : options.attributifyPseudo);
4326
- let firstPrefix = (options === null || options === void 0 ? void 0 : options.prefix) ?? "";
4674
+ const attributify = !!options?.attributifyPseudo;
4675
+ let firstPrefix = options?.prefix ?? "";
4327
4676
  firstPrefix = escapeSelector((Array.isArray(firstPrefix) ? firstPrefix : [firstPrefix]).filter(Boolean)[0] ?? "");
4328
4677
  const tagWithPrefix = (tag, combinator) => createTaggedPseudoClassMatcher(tag, attributify ? `[${firstPrefix}${tag}=""]` : `.${firstPrefix}${tag}`, combinator, utils);
4329
4678
  return [
@@ -5847,21 +6196,55 @@ function getVariableWght(axes) {
5847
6196
  if (axes.min === axes.max) return `${axes.min}`;
5848
6197
  return `${axes.min} ${axes.max}`;
5849
6198
  }
6199
+ const NoneProvider = {
6200
+ name: "none",
6201
+ getPreflight() {
6202
+ return "";
6203
+ },
6204
+ getFontName(font) {
6205
+ return font.name;
6206
+ }
6207
+ };
6208
+ function parseFontName(name) {
6209
+ const atIndex = name.lastIndexOf("@");
6210
+ if (atIndex === -1) throw new Error(`[unocss] ZeoSeven provider requires font ID in format "FontFamily@id", e.g. "LXGW WenKai@292". Got: "${name}"`);
6211
+ return {
6212
+ family: name.slice(0, atIndex).trim(),
6213
+ id: name.slice(atIndex + 1).trim()
6214
+ };
6215
+ }
6216
+ function createZeoSevenProvider(name, host) {
6217
+ return {
6218
+ name,
6219
+ getFontName(font) {
6220
+ const { family } = parseFontName(font.name);
6221
+ return `"${family}"`;
6222
+ },
6223
+ async getPreflight(fonts, fetcher) {
6224
+ const cssParts = [];
6225
+ for (const font of fonts) {
6226
+ const { id } = parseFontName(font.name);
6227
+ const baseUrl = `${host}/${id}/main/`;
6228
+ const url = `${baseUrl}result.css`;
6229
+ try {
6230
+ const processed = (await fetcher(url)).replace(/url\("\.\/([^"]+)"\)/g, `url("${baseUrl}$1")`);
6231
+ cssParts.push(processed);
6232
+ } catch {
6233
+ throw new Error(`[unocss] Failed to fetch ZeoSeven font CSS for ID "${id}"`);
6234
+ }
6235
+ }
6236
+ return cssParts.join("\n");
6237
+ }
6238
+ };
6239
+ }
5850
6240
  const builtinProviders = {
5851
6241
  google: GoogleFontsProvider,
5852
6242
  bunny: BunnyFontsProvider,
5853
6243
  fontshare: FontshareProvider,
5854
6244
  fontsource: FontSourceProvider,
5855
6245
  coollabs: CoolLabsFontsProvider,
5856
- none: {
5857
- name: "none",
5858
- getPreflight() {
5859
- return "";
5860
- },
5861
- getFontName(font) {
5862
- return font.name;
5863
- }
5864
- }
6246
+ none: NoneProvider,
6247
+ zeoseven: createZeoSevenProvider("zeoseven", "https://fontsapi.zeoseven.com")
5865
6248
  };
5866
6249
  function resolveProvider(provider) {
5867
6250
  if (typeof provider === "string") return builtinProviders[provider];
@@ -5964,7 +6347,7 @@ function createWebFontPreset(fetcher) {
5964
6347
  };
5965
6348
  }
5966
6349
  const userAgentWoff2 = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36";
5967
- const defaultFetch = async (url) => (await import("./node-D23LglTq.mjs")).$fetch(url, {
6350
+ const defaultFetch = async (url) => (await import("./node-oThp98aD.mjs")).$fetch(url, {
5968
6351
  headers: { "User-Agent": userAgentWoff2 },
5969
6352
  retry: 3
5970
6353
  });
@@ -6017,7 +6400,7 @@ var __exportAll = (all, no_symbols) => {
6017
6400
  return target;
6018
6401
  };
6019
6402
  //#endregion
6020
- //#region ../../packages-presets/preset-wind4/dist/utils-BamiTVVE.mjs
6403
+ //#region ../../packages-presets/preset-wind4/dist/utils-CqAvZsCu.mjs
6021
6404
  const PRESET_NAME = "@unocss/preset-wind4";
6022
6405
  const CONTROL_NO_NEGATIVE = "$$mini-no-negative";
6023
6406
  const SpecialColorKey = {
@@ -6149,8 +6532,9 @@ const unitOnlyMap = {
6149
6532
  lvh: 100,
6150
6533
  lvw: 100
6151
6534
  };
6152
- const bracketTypeRe = /^\[(color|image|length|size|position|quoted|string|number|family):/i;
6535
+ const bracketTypeRe = /^\[(color|image|length|size|width|position|quoted|string|number|family):/i;
6153
6536
  const splitComma = /,(?![^()]*\))/g;
6537
+ const cssVarsRE = /(?<!var\()--([\w.-]+)(\([^)]+\)|,[#.\s\w]+)?/g;
6154
6538
  var handlers_exports = /* @__PURE__ */ __exportAll({
6155
6539
  auto: () => auto,
6156
6540
  bracket: () => bracket,
@@ -6285,13 +6669,23 @@ function fraction(str) {
6285
6669
  return `${round(num * 100)}%`;
6286
6670
  }
6287
6671
  }
6288
- function processThemeVariable(name, key, paths, theme) {
6289
- const valOrObj = getThemeByKey(theme, key, paths);
6672
+ /**
6673
+ * Process a theme variable reference and retrieve its value and corresponding CSS variable key.
6674
+ *
6675
+ * @example theme => Theme object
6676
+ * @example themeKey => 'colors
6677
+ * @example themeKeyPaths => ['blue', '500']
6678
+ * @example varPaths => 'colors.blue.500'
6679
+ *
6680
+ * @returns An object containing the resolved value from the theme and the corresponding CSS variable key.
6681
+ */
6682
+ function processThemeVariable(theme, themeKey, themeKeyPaths, varPaths) {
6683
+ const valOrObj = getThemeByKey(theme, themeKey, themeKeyPaths);
6290
6684
  const hasDefault = typeof valOrObj === "object" && "DEFAULT" in valOrObj;
6291
- if (hasDefault) paths.push("DEFAULT");
6685
+ if (hasDefault) themeKeyPaths.push("DEFAULT");
6292
6686
  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);
6687
+ const varKey = hasDefault && themeKey !== "spacing" ? `${varPaths}.DEFAULT` : varPaths;
6688
+ if (val != null) themeTracking(themeKey, themeKeyPaths.length ? themeKeyPaths : void 0);
6295
6689
  return {
6296
6690
  val,
6297
6691
  varKey
@@ -6310,23 +6704,24 @@ function bracketWithType(str, requiredType, theme) {
6310
6704
  }
6311
6705
  if (!base) return;
6312
6706
  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})`;
6707
+ if (theme) base = transformThemeFn(base, theme);
6708
+ const matches = Array.from(base.matchAll(cssVarsRE));
6709
+ for (const match of matches) {
6710
+ const [full, varPaths, _value] = match;
6711
+ if (theme) {
6712
+ const [key, ...paths] = varPaths.split(".");
6713
+ const { val, varKey } = processThemeVariable(theme, key, paths, varPaths);
6714
+ if (val != null) {
6715
+ const cssVar = `--${varKey.replaceAll(".", "-")}`;
6716
+ if (_value && !_value.startsWith(",")) base = base.replace(full, `calc(var(${cssVar}) * ${_value.slice(1, -1)})`);
6717
+ else {
6718
+ const fallback = _value?.slice(1);
6719
+ base = base.replace(full, `var(${cssVar}${fallback ? `, ${fallback}` : ""})`);
6720
+ }
6721
+ continue;
6722
+ }
6329
6723
  }
6724
+ base = base.replace(full, `var(${full})`);
6330
6725
  }
6331
6726
  let curly = 0;
6332
6727
  for (const i of base) if (i === "[") curly += 1;
@@ -6355,7 +6750,7 @@ function bracketOfColor(str, theme) {
6355
6750
  return bracketWithType(str, "color", theme);
6356
6751
  }
6357
6752
  function bracketOfLength(str, theme) {
6358
- return bracketWithType(str, "length", theme) || bracketWithType(str, "size", theme);
6753
+ return bracketWithType(str, "length", theme) || bracketWithType(str, "size", theme) || bracketWithType(str, "width", theme);
6359
6754
  }
6360
6755
  function bracketOfPosition(str, theme) {
6361
6756
  return bracketWithType(str, "position", theme);
@@ -6472,7 +6867,7 @@ function parseColor(body, theme) {
6472
6867
  if (!split) return;
6473
6868
  let opacity;
6474
6869
  let [main, opacityOrModifier, modifier] = split;
6475
- if (isInterpolatedMethod(opacityOrModifier) || isInterpolatedMethod(h.bracket(opacityOrModifier ?? ""))) modifier = opacityOrModifier;
6870
+ if (isInterpolatedMethod(opacityOrModifier) || isInterpolatedMethod(h.bracket(opacityOrModifier ?? "", theme))) modifier = opacityOrModifier;
6476
6871
  else opacity = opacityOrModifier;
6477
6872
  const colors = main.replace(/([a-z])(\d)(?![-_a-z])/g, "$1-$2").split(/-/g);
6478
6873
  const [name] = colors;
@@ -6495,11 +6890,14 @@ function parseColor(body, theme) {
6495
6890
  }
6496
6891
  return {
6497
6892
  opacity,
6498
- modifier: modifier && h.bracket.cssvar(modifier) || modifier,
6893
+ modifier: modifier && h.bracket.cssvar(modifier, theme) || modifier,
6499
6894
  name,
6500
6895
  no,
6501
6896
  color: color ?? SpecialColorKey[name],
6502
- alpha: h.bracket.cssvar.percent(opacity ?? ""),
6897
+ alpha: h.bracket.cssvar.percent(opacity ?? "", theme),
6898
+ /**
6899
+ * Keys means the color is from theme object.
6900
+ */
6503
6901
  keys,
6504
6902
  get cssColor() {
6505
6903
  return parseCssColor(this.color);
@@ -6708,7 +7106,7 @@ function propertyTracking(property, value) {
6708
7106
  if (!trackedProperties.has(property)) trackedProperties.set(property, value);
6709
7107
  }
6710
7108
  //#endregion
6711
- //#region ../../packages-presets/preset-wind4/dist/container-_7pdPWQl.mjs
7109
+ //#region ../../packages-presets/preset-wind4/dist/container-BwY4Hhe2.mjs
6712
7110
  const containerParent = [[/^@container(?:\/(\w+))?(?:-(normal))?$/, ([, l, v]) => {
6713
7111
  return {
6714
7112
  "container-type": v ?? "inline-size",
@@ -6782,7 +7180,7 @@ const verticalAlignAlias = {
6782
7180
  };
6783
7181
  const verticalAligns = [[
6784
7182
  /^(?:vertical|align|v)-(.+)$/,
6785
- ([, v]) => ({ "vertical-align": verticalAlignAlias[v] ?? h.bracket.cssvar.numberWithUnit(v) }),
7183
+ ([, v], { theme }) => ({ "vertical-align": verticalAlignAlias[v] ?? h.bracket.cssvar.numberWithUnit(v, theme) }),
6786
7184
  { autocomplete: [`(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})`, "(vertical|align|v)-<percentage>"] }
6787
7185
  ]];
6788
7186
  const textAlignValues = [
@@ -6817,24 +7215,24 @@ const animations = [
6817
7215
  ...props
6818
7216
  }];
6819
7217
  }
6820
- return { animation: h.bracket.cssvar(name) };
7218
+ return { animation: h.bracket.cssvar(name, theme) };
6821
7219
  },
6822
7220
  { autocomplete: "animate-$animation.keyframes" }
6823
7221
  ],
6824
- [/^animate-name-(.+)/, ([, d]) => ({ "animation-name": h.bracket.cssvar(d) ?? d })],
7222
+ [/^animate-name-(.+)/, ([, d], { theme }) => ({ "animation-name": h.bracket.cssvar(d, theme) ?? d })],
6825
7223
  [
6826
7224
  /^animate-duration-(.+)$/,
6827
- ([, d], { theme }) => ({ "animation-duration": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }),
7225
+ ([, d], { theme }) => ({ "animation-duration": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d, theme) }),
6828
7226
  { autocomplete: ["animate-duration"] }
6829
7227
  ],
6830
7228
  [
6831
7229
  /^animate-delay-(.+)$/,
6832
- ([, d], { theme }) => ({ "animation-delay": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d) }),
7230
+ ([, d], { theme }) => ({ "animation-delay": theme.duration?.[d || "DEFAULT"] ?? h.bracket.cssvar.time(d, theme) }),
6833
7231
  { autocomplete: ["animate-delay"] }
6834
7232
  ],
6835
7233
  [
6836
7234
  /^animate-ease(?:-(.+))?$/,
6837
- ([, d], { theme }) => ({ "animation-timing-function": theme.ease?.[d || "DEFAULT"] ?? h.bracket.cssvar(d) }),
7235
+ ([, d], { theme }) => ({ "animation-timing-function": theme.ease?.[d || "DEFAULT"] ?? h.bracket.cssvar(d, theme) }),
6838
7236
  { autocomplete: ["animate-ease", "animate-ease-$ease"] }
6839
7237
  ],
6840
7238
  [
@@ -6869,7 +7267,7 @@ const animations = [
6869
7267
  ],
6870
7268
  [
6871
7269
  /^animate-(?:iteration-count-|iteration-|count-)(.+)$/,
6872
- ([, d]) => ({ "animation-iteration-count": h.bracket.cssvar(d) ?? d.replace(/-/g, ",") }),
7270
+ ([, d], { theme }) => ({ "animation-iteration-count": h.bracket.cssvar(d, theme) ?? d.replace(/-/g, ",") }),
6873
7271
  { autocomplete: ["animate-(iteration|count|iteration-count)", "animate-(iteration|count|iteration-count)-<num>"] }
6874
7272
  ],
6875
7273
  [
@@ -6951,7 +7349,7 @@ function bgGradientColorResolver() {
6951
7349
  if (keys) themeTracking(`colors`, keys);
6952
7350
  if (theme) detectThemeValue(color, theme);
6953
7351
  }
6954
- } else css[`--un-gradient-${position}`] = h.bracket.cssvar(body);
7352
+ } else css[`--un-gradient-${position}`] = h.bracket.cssvar(body, theme);
6955
7353
  if (css[`--un-gradient-${position}`]) {
6956
7354
  switch (position) {
6957
7355
  case "from":
@@ -6982,18 +7380,18 @@ function bgGradientColorResolver() {
6982
7380
  };
6983
7381
  }
6984
7382
  function bgGradientPositionResolver() {
6985
- return function* ([, mode, body]) {
6986
- yield { [`--un-gradient-${mode}-position`]: `${h.bracket.cssvar.percent(body)}` };
7383
+ return function* ([, mode, body], { theme }) {
7384
+ yield { [`--un-gradient-${mode}-position`]: `${h.bracket.cssvar.percent(body, theme)}` };
6987
7385
  for (const p of Object.values(properties)) yield p;
6988
7386
  };
6989
7387
  }
6990
7388
  const backgroundStyles = [
6991
7389
  [
6992
7390
  /^bg-(linear|radial|conic)-([^/]+)(?:\/(.+))?$/,
6993
- ([, m, d, s]) => {
7391
+ ([, m, d, s], { theme }) => {
6994
7392
  let v;
6995
7393
  if (h.number(d) != null) v = `from ${h.number(d)}deg ${resolveModifier(s)};`;
6996
- else v = h.bracket(d);
7394
+ else v = h.bracket(d, theme);
6997
7395
  if (v) return {
6998
7396
  "--un-gradient-position": v,
6999
7397
  "background-image": `${m}-gradient(var(--un-gradient-stops))`
@@ -7007,7 +7405,7 @@ const backgroundStyles = [
7007
7405
  ] }
7008
7406
  ],
7009
7407
  [/^(from|via|to|stops)-(.+)$/, bgGradientColorResolver()],
7010
- [/^(from|via|to)-op(?:acity)?-?(.+)$/, ([, position, opacity]) => ({ [`--un-${position}-opacity`]: h.bracket.percent(opacity) })],
7408
+ [/^(from|via|to)-op(?:acity)?-?(.+)$/, ([, position, opacity], { theme }) => ({ [`--un-${position}-opacity`]: h.bracket.percent(opacity, theme) })],
7011
7409
  [/^(from|via|to)-([\d.]+%)$/, bgGradientPositionResolver()],
7012
7410
  [
7013
7411
  /^bg-((?:repeating-)?(?:linear|radial|conic))$/,
@@ -7042,7 +7440,7 @@ const backgroundStyles = [
7042
7440
  ["bg-auto", { "background-size": "auto" }],
7043
7441
  ["bg-cover", { "background-size": "cover" }],
7044
7442
  ["bg-contain", { "background-size": "contain" }],
7045
- [/^bg-size-(.+)$/, ([, v]) => ({ "background-size": h.bracket.cssvar(v) })],
7443
+ [/^bg-size-(.+)$/, ([, v], { theme }) => ({ "background-size": h.bracket.cssvar(v, theme) })],
7046
7444
  ["bg-fixed", { "background-attachment": "fixed" }],
7047
7445
  ["bg-local", { "background-attachment": "local" }],
7048
7446
  ["bg-scroll", { "background-attachment": "scroll" }],
@@ -7092,12 +7490,12 @@ const outline = [
7092
7490
  ],
7093
7491
  [
7094
7492
  /^outline-op(?:acity)?-?(.+)$/,
7095
- ([, opacity]) => ({ "--un-outline-opacity": h.bracket.percent.cssvar(opacity) }),
7493
+ ([, opacity], { theme }) => ({ "--un-outline-opacity": h.bracket.percent.cssvar(opacity, theme) }),
7096
7494
  { autocomplete: "outline-(op|opacity)-<percent>" }
7097
7495
  ],
7098
7496
  [
7099
7497
  /^outline-offset-(.+)$/,
7100
- ([, d]) => ({ "outline-offset": h.bracket.cssvar.global.px(d) }),
7498
+ ([, d], { theme }) => ({ "outline-offset": h.bracket.cssvar.global.px(d, theme) }),
7101
7499
  { autocomplete: "outline-(offset)-<num>" }
7102
7500
  ],
7103
7501
  ["outline-offset-none", { "outline-offset": "0" }],
@@ -7130,8 +7528,8 @@ const outline = [
7130
7528
  "outline-style": v
7131
7529
  }])
7132
7530
  ];
7133
- function* handleWidth$2([, b]) {
7134
- const v = h.bracket.cssvar.global.px(b);
7531
+ function* handleWidth$2([, b], { theme }) {
7532
+ const v = h.bracket.cssvar.global.px(b, theme);
7135
7533
  if (v != null) {
7136
7534
  yield {
7137
7535
  "outline-style": "var(--un-outline-style)",
@@ -7141,7 +7539,7 @@ function* handleWidth$2([, b]) {
7141
7539
  }
7142
7540
  }
7143
7541
  function* handleColorOrWidth$2(match, ctx) {
7144
- if (isCSSMathFn(h.bracket(match[1]))) yield* handleWidth$2(match);
7542
+ if (isCSSMathFn(h.bracket(match[1], ctx.theme))) yield* handleWidth$2(match, ctx);
7145
7543
  else {
7146
7544
  const result = colorResolver("outline-color", "outline")(match, ctx);
7147
7545
  if (result) for (const i of result) yield i;
@@ -7154,15 +7552,15 @@ const appearance = [["appearance-auto", {
7154
7552
  "-webkit-appearance": "none",
7155
7553
  "appearance": "none"
7156
7554
  }]];
7157
- function willChangeProperty(prop) {
7158
- const v = h.bracket(prop);
7555
+ function willChangeProperty(prop, theme) {
7556
+ const v = h.bracket(prop, theme);
7159
7557
  if (v && h.properties(v)) return v;
7160
7558
  return h.properties.auto.cssvar.global(prop) ?? {
7161
7559
  contents: "contents",
7162
7560
  scroll: "scroll-position"
7163
7561
  }[prop];
7164
7562
  }
7165
- const willChange = [[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]];
7563
+ const willChange = [[/^will-change-(.+)/, ([, p], { theme }) => ({ "will-change": willChangeProperty(p, theme) })]];
7166
7564
  const listStyles = {
7167
7565
  "disc": "disc",
7168
7566
  "circle": "circle",
@@ -7195,8 +7593,8 @@ const listStyle = [
7195
7593
  ["list-outside", { "list-style-position": "outside" }],
7196
7594
  ["list-inside", { "list-style-position": "inside" }],
7197
7595
  ["list-none", { "list-style-type": "none" }],
7198
- [/^list-image-(.+)$/, ([, d]) => {
7199
- if (/^\[url\(.+\)\]$/.test(d)) return { "list-style-image": h.bracket(d) };
7596
+ [/^list-image-(.+)$/, ([, d], { theme }) => {
7597
+ if (/^\[url\(.+\)\]$/.test(d)) return { "list-style-image": h.bracket(d, theme) };
7200
7598
  }],
7201
7599
  ["list-image-none", { "list-style-image": "none" }],
7202
7600
  ...makeGlobalStaticRules("list", "list-style-type")
@@ -7207,7 +7605,7 @@ const accents = [[
7207
7605
  { autocomplete: "accent-$colors" }
7208
7606
  ], [
7209
7607
  /^accent-op(?:acity)?-?(.+)$/,
7210
- ([, d]) => ({ "--un-accent-opacity": h.bracket.percent(d) }),
7608
+ ([, d], { theme }) => ({ "--un-accent-opacity": h.bracket.percent(d, theme) }),
7211
7609
  { autocomplete: ["accent-(op|opacity)", "accent-(op|opacity)-<percent>"] }
7212
7610
  ]];
7213
7611
  const carets = [[
@@ -7216,7 +7614,7 @@ const carets = [[
7216
7614
  { autocomplete: "caret-$colors" }
7217
7615
  ], [
7218
7616
  /^caret-op(?:acity)?-?(.+)$/,
7219
- ([, d]) => ({ "--un-caret-opacity": h.bracket.percent(d) }),
7617
+ ([, d], { theme }) => ({ "--un-caret-opacity": h.bracket.percent(d, theme) }),
7220
7618
  { autocomplete: ["caret-(op|opacity)", "caret-(op|opacity)-<percent>"] }
7221
7619
  ]];
7222
7620
  const imageRenderings = [
@@ -7341,19 +7739,24 @@ function borderColorResolver(direction) {
7341
7739
  }
7342
7740
  };
7343
7741
  }
7344
- function handlerBorderSize([, a = "", b = "1"]) {
7345
- const v = h.bracket.cssvar.global.px(b);
7742
+ function handlerBorderSize([, a = "", b = "1"], { theme }) {
7743
+ const v = h.bracket.bracketOfLength.cssvar.global.px(b, theme);
7346
7744
  if (a in directionMap && v != null) return directionMap[a].map((i) => [`border${i}-width`, v]);
7347
7745
  }
7348
7746
  function handlerBorderColorOrSize([, a = "", b], ctx) {
7349
7747
  if (a in directionMap) {
7350
- if (isCSSMathFn(h.bracket(b))) return handlerBorderSize([
7748
+ if (isCSSMathFn(h.bracket(b, ctx.theme))) return handlerBorderSize([
7351
7749
  "",
7352
7750
  a,
7353
7751
  b
7354
- ]);
7355
- if (hasParseableColor(b, ctx.theme)) {
7356
- const directions = directionMap[a].map((i) => borderColorResolver(i)(["", b], ctx)).filter(notNull);
7752
+ ], ctx);
7753
+ const bracketColor = h.bracketOfColor(b, ctx.theme);
7754
+ b = bracketColor ?? b;
7755
+ if (bracketColor != null || hasParseableColor(b, ctx.theme)) {
7756
+ const directions = directionMap[a].map((i) => borderColorResolver(i)(["", b], ctx) ?? colorCSSGenerator({
7757
+ color: b,
7758
+ name: "_"
7759
+ }, `border${i}-color`, `border${i}`, ctx)).filter(notNull);
7357
7760
  return [directions.map((d) => d[0]).reduce((acc, item) => {
7358
7761
  Object.assign(acc, item);
7359
7762
  return acc;
@@ -7361,14 +7764,14 @@ function handlerBorderColorOrSize([, a = "", b], ctx) {
7361
7764
  }
7362
7765
  }
7363
7766
  }
7364
- function handlerBorderOpacity([, a = "", opacity]) {
7365
- const v = h.bracket.percent.cssvar(opacity);
7767
+ function handlerBorderOpacity([, a = "", opacity], { theme }) {
7768
+ const v = h.bracket.percent.cssvar(opacity, theme);
7366
7769
  if (a in directionMap && v != null) return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
7367
7770
  }
7368
7771
  function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
7369
7772
  if (a in cornerMap) {
7370
7773
  if (s === "full") return cornerMap[a].map((i) => [`border${i}-radius`, "calc(infinity * 1px)"]);
7371
- const _v = theme.radius?.[s] ?? h.bracket.cssvar.global.fraction.rem(s);
7774
+ const _v = theme.radius?.[s] ?? h.bracket.cssvar.global.fraction.rem(s, theme);
7372
7775
  if (_v != null) {
7373
7776
  const isVar = theme.radius && s in theme.radius;
7374
7777
  if (isVar) themeTracking(`radius`, s);
@@ -7382,7 +7785,7 @@ function handlerBorderStyle([, a = "", s]) {
7382
7785
  /**
7383
7786
  * @example op10 op-30 opacity-100
7384
7787
  */
7385
- const opacity = [[/^op(?:acity)?-?(.+)$/, ([, d]) => ({ opacity: h.bracket.percent.cssvar(d) })]];
7788
+ const opacity = [[/^op(?:acity)?-?(.+)$/, ([, d], { theme }) => ({ opacity: h.bracket.percent.cssvar(d, theme) })]];
7386
7789
  const bgUrlRE = /^\[url\(.+\)\]$/;
7387
7790
  const bgLengthRE = /^\[(?:length|size):.+\]$/;
7388
7791
  const bgPositionRE = /^\[position:.+\]$/;
@@ -7390,27 +7793,27 @@ const bgGradientRE = /^\[(?:linear|conic|radial)-gradient\(.+\)\]$/;
7390
7793
  const bgImageRE = /^\[image:.+\]$/;
7391
7794
  const bgColors = [[
7392
7795
  /^bg-(.+)$/,
7393
- (...args) => {
7394
- const d = args[0][1];
7796
+ (match, ctx) => {
7797
+ const d = match[1];
7798
+ const { theme } = ctx;
7395
7799
  if (bgUrlRE.test(d)) return {
7396
- "--un-url": h.bracket(d),
7800
+ "--un-url": h.bracket(d, theme),
7397
7801
  "background-image": "var(--un-url)"
7398
7802
  };
7399
- if (bgLengthRE.test(d) && h.bracketOfLength(d) != null) return { "background-size": h.bracketOfLength(d).split(" ").map((e) => h.fraction.auto.px.cssvar(e) ?? e).join(" ") };
7400
- if ((isSize(d) || bgPositionRE.test(d)) && h.bracketOfPosition(d) != null) return { "background-position": h.bracketOfPosition(d).split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
7803
+ const bracketLength = h.bracketOfLength(d, theme);
7804
+ if (bgLengthRE.test(d) && bracketLength != null) return { "background-size": bracketLength.split(" ").map((e) => h.fraction.auto.px.cssvar(e) ?? e).join(" ") };
7805
+ const bracketPosition = h.bracketOfPosition(d, theme);
7806
+ if ((isSize(d) || bgPositionRE.test(d)) && bracketPosition != null) return { "background-position": bracketPosition.split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
7401
7807
  if (bgGradientRE.test(d) || bgImageRE.test(d)) {
7402
- const s = h.bracket(d);
7403
- if (s) {
7404
- const url = s.startsWith("http") ? `url(${s})` : h.cssvar(s);
7405
- return { "background-image": url ?? s };
7406
- }
7808
+ const s = h.bracket(d, theme);
7809
+ if (s) return { "background-image": (s.startsWith("http") ? `url(${s})` : h.cssvar(s)) ?? s };
7407
7810
  }
7408
- return colorResolver("background-color", "bg")(...args);
7811
+ return colorResolver("background-color", "bg")(match, ctx);
7409
7812
  },
7410
7813
  { autocomplete: "bg-$colors" }
7411
7814
  ], [
7412
7815
  /^bg-op(?:acity)?-?(.+)$/,
7413
- ([, opacity]) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity) }),
7816
+ ([, opacity], { theme }) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity, theme) }),
7414
7817
  { autocomplete: "bg-(op|opacity)-<percent>" }
7415
7818
  ]];
7416
7819
  const colorScheme = [[/^(?:color-)?scheme-(.+)$/, ([, v]) => ({ "color-scheme": v.split("-").join(" ") })]];
@@ -7422,7 +7825,7 @@ const columns = [
7422
7825
  themeTracking("container", v);
7423
7826
  return { columns: generateThemeVariable("container", v) };
7424
7827
  }
7425
- return { columns: h.bracket.numberWithUnit.number.cssvar(v) };
7828
+ return { columns: h.bracket.numberWithUnit.number.cssvar(v, theme) };
7426
7829
  },
7427
7830
  { autocomplete: ["columns-<num>", "columns-$container"] }
7428
7831
  ],
@@ -7482,12 +7885,12 @@ const textDecorations = [
7482
7885
  ],
7483
7886
  [
7484
7887
  /^(?:underline|decoration)-op(?:acity)?-?(.+)$/,
7485
- ([, opacity]) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity) }),
7888
+ ([, opacity], { theme }) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity, theme) }),
7486
7889
  { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }
7487
7890
  ],
7488
7891
  [
7489
7892
  /^(?:underline|decoration)-offset-(.+)$/,
7490
- ([, s]) => ({ "text-underline-offset": h.auto.bracket.cssvar.global.px(s) }),
7893
+ ([, s], { theme }) => ({ "text-underline-offset": h.auto.bracket.cssvar.global.px(s, theme) }),
7491
7894
  { autocomplete: "(underline|decoration)-(offset)-<num>" }
7492
7895
  ],
7493
7896
  ...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
@@ -7495,11 +7898,11 @@ const textDecorations = [
7495
7898
  ["no-underline", { "text-decoration": "none" }],
7496
7899
  ["decoration-none", { "text-decoration": "none" }]
7497
7900
  ];
7498
- function handleWidth$1([, b]) {
7499
- return { "text-decoration-thickness": h.bracket.cssvar.global.px(b) };
7901
+ function handleWidth$1([, b], { theme }) {
7902
+ return { "text-decoration-thickness": h.bracket.cssvar.global.px(b, theme) };
7500
7903
  }
7501
7904
  function handleColorOrWidth$1(match, ctx) {
7502
- if (isCSSMathFn(h.bracket(match[1]))) return handleWidth$1(match);
7905
+ if (isCSSMathFn(h.bracket(match[1], ctx.theme))) return handleWidth$1(match, ctx);
7503
7906
  const result = colorResolver("text-decoration-color", "line")(match, ctx);
7504
7907
  if (result) {
7505
7908
  const css = result[0];
@@ -7561,6 +7964,7 @@ const spaces = [[
7561
7964
  function notLastChildSelectorVariant(s) {
7562
7965
  return {
7563
7966
  matcher: s,
7967
+ order: 1,
7564
7968
  handle: (input, next) => next({
7565
7969
  ...input,
7566
7970
  parent: `${input.parent ? `${input.parent} $$ ` : ""}${input.selector}`,
@@ -7574,7 +7978,7 @@ function* handlerSpace([m, d, s], { theme, symbols }) {
7574
7978
  if (num != null) {
7575
7979
  themeTracking(`spacing`);
7576
7980
  v = `calc(var(--spacing) * ${num})`;
7577
- } else v = theme.spacing?.[s] ?? h.bracket.cssvar.auto.fraction.rem(s || "1");
7981
+ } else v = theme.spacing?.[s] ?? h.bracket.cssvar.auto.fraction.rem(s || "1", theme);
7578
7982
  if (v != null) {
7579
7983
  const results = directionMap[d === "x" ? "inline" : "block"].map((item, index) => {
7580
7984
  return [`margin${item}`, `calc(${v} * ${index === 0 ? `var(--un-space-${d}-reverse)` : `calc(1 - var(--un-space-${d}-reverse))`})`];
@@ -7606,10 +8010,10 @@ const divides = [
7606
8010
  ],
7607
8011
  [
7608
8012
  /^divide-op(?:acity)?-?(.+)$/,
7609
- function* ([match, opacity], { symbols }) {
8013
+ function* ([match, opacity], { symbols, theme }) {
7610
8014
  yield {
7611
8015
  [symbols.variants]: [notLastChildSelectorVariant(match)],
7612
- "--un-divide-opacity": h.bracket.percent(opacity)
8016
+ "--un-divide-opacity": h.bracket.percent(opacity, theme)
7613
8017
  };
7614
8018
  },
7615
8019
  { autocomplete: ["divide-(op|opacity)", "divide-(op|opacity)-<percent>"] }
@@ -7638,8 +8042,8 @@ const divides = [
7638
8042
  { autocomplete: borderStyles.map((i) => `divide-${i}`) }
7639
8043
  ]
7640
8044
  ];
7641
- function* handlerDivide([m, d, s], { symbols }) {
7642
- let v = h.bracket.cssvar.px(s || "1");
8045
+ function* handlerDivide([m, d, s], { symbols, theme }) {
8046
+ let v = h.bracket.cssvar.px(s || "1", theme);
7643
8047
  if (v != null) {
7644
8048
  if (v === "0") v = "0px";
7645
8049
  const results = {
@@ -7686,8 +8090,8 @@ const backdropBaseKeys = [
7686
8090
  ];
7687
8091
  const backdropProperties = backdropBaseKeys.map((i) => defineProperty(`--un-${i}`));
7688
8092
  const backdropCSS = backdropBaseKeys.map((i) => `var(--un-${i},)`).join(" ");
7689
- function percentWithDefault(str) {
7690
- let v = h.bracket.cssvar(str || "");
8093
+ function percentWithDefault(str, theme) {
8094
+ let v = h.bracket.cssvar(str || "", theme);
7691
8095
  if (v != null) return v;
7692
8096
  v = str ? h.percent(str) : "100%";
7693
8097
  if (v != null && Number.parseFloat(v.slice(0, -1)) <= 100) return v;
@@ -7715,9 +8119,9 @@ function dropShadowResolver(match, ctx) {
7715
8119
  if (s.startsWith("/")) res = ["", s.slice(1)];
7716
8120
  }
7717
8121
  let v = theme.dropShadow?.[res[0] || "DEFAULT"];
7718
- const c = s ? h.bracket.cssvar(s) : void 0;
8122
+ const c = s ? h.bracket.cssvar(s, theme) : void 0;
7719
8123
  if ((v != null || c != null) && !hasParseableColor(c, theme)) {
7720
- const alpha = res[1] ? h.bracket.percent.cssvar(res[1]) : void 0;
8124
+ const alpha = res[1] ? h.bracket.percent.cssvar(res[1], theme) : void 0;
7721
8125
  return [{
7722
8126
  "--un-drop-shadow-opacity": alpha,
7723
8127
  "--un-drop-shadow": `drop-shadow(${colorableShadows(v || c, "--un-drop-shadow-color", alpha).join(") drop-shadow(")})`,
@@ -7725,7 +8129,7 @@ function dropShadowResolver(match, ctx) {
7725
8129
  }, ...filterProperties];
7726
8130
  }
7727
8131
  if (hasParseableColor(s, theme)) return colorResolver("--un-drop-shadow-color", "drop-shadow")(match, ctx);
7728
- v = h.bracket.cssvar(s) ?? (s === "none" ? "" : void 0);
8132
+ v = h.bracket.cssvar(s, theme) ?? (s === "none" ? "" : void 0);
7729
8133
  if (v != null) return [{
7730
8134
  "--un-drop-shadow": v ? `drop-shadow(${v})` : v,
7731
8135
  "filter": filterCSS
@@ -7734,7 +8138,7 @@ function dropShadowResolver(match, ctx) {
7734
8138
  const filters = [
7735
8139
  [
7736
8140
  /^(?:(backdrop-)|filter-)?blur(?:-(.+))?$/,
7737
- toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || h.bracket.cssvar.px(s)),
8141
+ toFilter("blur", (s, theme) => theme.blur?.[s || "DEFAULT"] || h.bracket.cssvar.px(s, theme)),
7738
8142
  { autocomplete: [
7739
8143
  "(backdrop|filter)-blur-$blur",
7740
8144
  "blur-$blur",
@@ -7743,12 +8147,12 @@ const filters = [
7743
8147
  ],
7744
8148
  [
7745
8149
  /^(?:(backdrop-)|filter-)?brightness-(.+)$/,
7746
- toFilter("brightness", (s) => h.bracket.cssvar.percent(s)),
8150
+ toFilter("brightness", (s, theme) => h.bracket.cssvar.percent(s, theme)),
7747
8151
  { autocomplete: ["(backdrop|filter)-brightness-<percent>", "brightness-<percent>"] }
7748
8152
  ],
7749
8153
  [
7750
8154
  /^(?:(backdrop-)|filter-)?contrast-(.+)$/,
7751
- toFilter("contrast", (s) => h.bracket.cssvar.percent(s)),
8155
+ toFilter("contrast", (s, theme) => h.bracket.cssvar.percent(s, theme)),
7752
8156
  { autocomplete: ["(backdrop|filter)-contrast-<percent>", "contrast-<percent>"] }
7753
8157
  ],
7754
8158
  [
@@ -7773,7 +8177,7 @@ const filters = [
7773
8177
  ] }
7774
8178
  ],
7775
8179
  [/^(?:filter-)?drop-shadow-color-(.+)$/, colorResolver("--un-drop-shadow-color", "drop-shadow")],
7776
- [/^(?:filter-)?drop-shadow(?:-color)?-op(?:acity)?-?(.+)$/, ([, opacity]) => ({ "--un-drop-shadow-opacity": h.bracket.percent(opacity) })],
8180
+ [/^(?:filter-)?drop-shadow(?:-color)?-op(?:acity)?-?(.+)$/, ([, opacity], { theme }) => ({ "--un-drop-shadow-opacity": h.bracket.percent(opacity, theme) })],
7777
8181
  [
7778
8182
  /^(?:(backdrop-)|filter-)?grayscale(?:-(.+))?$/,
7779
8183
  toFilter("grayscale", percentWithDefault),
@@ -7783,7 +8187,7 @@ const filters = [
7783
8187
  "grayscale-<percent>"
7784
8188
  ] }
7785
8189
  ],
7786
- [/^(?:(backdrop-)|filter-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s) => h.bracket.cssvar.degree(s))],
8190
+ [/^(?:(backdrop-)|filter-)?hue-rotate-(.+)$/, toFilter("hue-rotate", (s, theme) => h.bracket.cssvar.degree(s, theme))],
7787
8191
  [
7788
8192
  /^(?:(backdrop-)|filter-)?invert(?:-(.+))?$/,
7789
8193
  toFilter("invert", percentWithDefault),
@@ -7795,12 +8199,12 @@ const filters = [
7795
8199
  ],
7796
8200
  [
7797
8201
  /^(backdrop-)op(?:acity)?-(.+)$/,
7798
- toFilter("opacity", (s) => h.bracket.cssvar.percent(s)),
8202
+ toFilter("opacity", (s, theme) => h.bracket.cssvar.percent(s, theme)),
7799
8203
  { autocomplete: ["backdrop-(op|opacity)", "backdrop-(op|opacity)-<percent>"] }
7800
8204
  ],
7801
8205
  [
7802
8206
  /^(?:(backdrop-)|filter-)?saturate-(.+)$/,
7803
- toFilter("saturate", (s) => h.bracket.cssvar.percent(s)),
8207
+ toFilter("saturate", (s, theme) => h.bracket.cssvar.percent(s, theme)),
7804
8208
  { autocomplete: [
7805
8209
  "(backdrop|filter)-saturate",
7806
8210
  "(backdrop|filter)-saturate-<percent>",
@@ -7836,30 +8240,33 @@ const flex = [
7836
8240
  ["flex", { display: "flex" }],
7837
8241
  ["inline-flex", { display: "inline-flex" }],
7838
8242
  ["flex-inline", { display: "inline-flex" }],
7839
- [/^flex-(.*)$/, ([, d]) => ({ flex: h.bracket(d) != null ? h.bracket(d).split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") : h.cssvar.fraction(d) })],
8243
+ [/^flex-(.*)$/, ([, d], { theme }) => {
8244
+ const value = h.bracket(d, theme);
8245
+ return { flex: value != null ? value.split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") : h.cssvar.fraction(d) };
8246
+ }],
7840
8247
  ["flex-1", { flex: "1 1 0%" }],
7841
8248
  ["flex-auto", { flex: "1 1 auto" }],
7842
8249
  ["flex-initial", { flex: "0 1 auto" }],
7843
8250
  ["flex-none", { flex: "none" }],
7844
8251
  [
7845
8252
  /^(?:flex-)?shrink(?:-(.*))?$/,
7846
- ([, d = ""]) => ({ "flex-shrink": h.bracket.cssvar.number(d) ?? 1 }),
8253
+ ([, d = ""], { theme }) => ({ "flex-shrink": h.bracket.cssvar.number(d, theme) ?? 1 }),
7847
8254
  { autocomplete: ["flex-shrink-<num>", "shrink-<num>"] }
7848
8255
  ],
7849
8256
  [
7850
8257
  /^(?:flex-)?grow(?:-(.*))?$/,
7851
- ([, d = ""]) => ({ "flex-grow": h.bracket.cssvar.number(d) ?? 1 }),
8258
+ ([, d = ""], { theme }) => ({ "flex-grow": h.bracket.cssvar.number(d, theme) ?? 1 }),
7852
8259
  { autocomplete: ["flex-grow-<num>", "grow-<num>"] }
7853
8260
  ],
7854
8261
  [
7855
8262
  /^(?:flex-)?basis-(.+)$/,
7856
- ([, d]) => {
8263
+ ([, d], { theme }) => {
7857
8264
  const v = numberResolver(d);
7858
8265
  if (v != null) {
7859
8266
  themeTracking(`spacing`);
7860
8267
  return { "flex-basis": `calc(var(--spacing) * ${v})` };
7861
8268
  }
7862
- return { "flex-basis": h.bracket.cssvar.auto.fraction.rem(d) };
8269
+ return { "flex-basis": h.bracket.cssvar.auto.fraction.rem(d, theme) };
7863
8270
  },
7864
8271
  { autocomplete: ["flex-basis-$spacing", "basis-$spacing"] }
7865
8272
  ],
@@ -7898,54 +8305,54 @@ const gaps = [
7898
8305
  function rowCol(s) {
7899
8306
  return s.replace("col", "column");
7900
8307
  }
7901
- function autoDirection(prop) {
8308
+ function autoDirection(prop, theme) {
7902
8309
  switch (prop) {
7903
8310
  case "min": return "min-content";
7904
8311
  case "max": return "max-content";
7905
8312
  case "fr": return "minmax(0,1fr)";
7906
8313
  }
7907
- return h.bracket.cssvar.auto.rem(prop);
8314
+ return h.bracket.cssvar.auto.rem(prop, theme);
7908
8315
  }
7909
8316
  const grids = [
7910
8317
  ["grid", { display: "grid" }],
7911
8318
  ["inline-grid", { display: "inline-grid" }],
7912
- [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}`]: h.bracket.number.cssvar.auto(v) })],
8319
+ [/^(?:grid-)?(row|col)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-${rowCol(c)}`]: h.bracket.number.cssvar.auto(v, theme) })],
7913
8320
  [
7914
8321
  /^(?:grid-)?(row|col)-span-(.+)$/,
7915
- ([, c, s]) => {
8322
+ ([, c, s], { theme }) => {
7916
8323
  if (s === "full") return { [`grid-${rowCol(c)}`]: "1/-1" };
7917
- const v = h.bracket.number.cssvar(s);
8324
+ const v = h.bracket.number.cssvar(s, theme);
7918
8325
  if (v != null) return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
7919
8326
  },
7920
8327
  { autocomplete: "(grid-row|grid-col|row|col)-span-<num>" }
7921
8328
  ],
7922
- [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v]) => ({ [`grid-${rowCol(c)}-start`]: h.bracket.cssvar(v) ?? v })],
8329
+ [/^(?:grid-)?(row|col)-start-(.+)$/, ([, c, v], { theme }) => ({ [`grid-${rowCol(c)}-start`]: h.bracket.cssvar(v, theme) ?? v })],
7923
8330
  [
7924
8331
  /^(?:grid-)?(row|col)-end-(.+)$/,
7925
- ([, c, v]) => ({ [`grid-${rowCol(c)}-end`]: h.bracket.cssvar(v) ?? v }),
8332
+ ([, c, v], { theme }) => ({ [`grid-${rowCol(c)}-end`]: h.bracket.cssvar(v, theme) ?? v }),
7926
8333
  { autocomplete: "(grid-row|grid-col|row|col)-(start|end)-<num>" }
7927
8334
  ],
7928
8335
  [
7929
8336
  /^(?:grid-)?auto-(rows|cols)-(.+)$/,
7930
- ([, c, v]) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v) }),
8337
+ ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) }),
7931
8338
  { autocomplete: "(grid-auto|auto)-(rows|cols)-<num>" }
7932
8339
  ],
7933
- [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v]) => ({ "grid-auto-flow": h.bracket.cssvar(v) })],
8340
+ [/^(?:grid-auto-flow|auto-flow|grid-flow)-(.+)$/, ([, v], { theme }) => ({ "grid-auto-flow": h.bracket.cssvar(v, theme) })],
7934
8341
  [
7935
8342
  /^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/,
7936
8343
  ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") }),
7937
8344
  { autocomplete: ["(grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)"] }
7938
8345
  ],
7939
- [/^(?:grid-)?(rows|cols)-(.+)$/, ([, c, v]) => ({ [`grid-template-${rowCol(c)}`]: h.bracket.cssvar(v) })],
8346
+ [/^(?:grid-)?(rows|cols)-(.+)$/, ([, c, v], { theme }) => ({ [`grid-template-${rowCol(c)}`]: h.bracket.cssvar(v, theme) })],
7940
8347
  [/^(?:grid-)?(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
7941
8348
  [
7942
8349
  /^(?:grid-)?(rows|cols)-(\d+)$/,
7943
8350
  ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` }),
7944
8351
  { autocomplete: "(grid-rows|grid-cols|rows|cols)-<num>" }
7945
8352
  ],
7946
- [/^grid-area(s)?-(.+)$/, ([, s, v]) => {
7947
- if (s != null) return { "grid-template-areas": h.cssvar(v) ?? v.split("-").map((s) => `"${h.bracket(s)}"`).join(" ") };
7948
- return { "grid-area": h.bracket.cssvar(v) };
8353
+ [/^grid-area(s)?-(.+)$/, ([, s, v], { theme }) => {
8354
+ if (s != null) return { "grid-template-areas": h.cssvar(v) ?? v.split("-").map((s) => `"${h.bracket(s, theme)}"`).join(" ") };
8355
+ return { "grid-area": h.bracket.cssvar(v, theme) };
7949
8356
  }],
7950
8357
  ["grid-rows-none", { "grid-template-rows": "none" }],
7951
8358
  ["grid-cols-none", { "grid-template-columns": "none" }],
@@ -7994,12 +8401,9 @@ const baseMaskImage = {
7994
8401
  "mask-image": "var(--un-mask-linear), var(--un-mask-radial), var(--un-mask-conic)",
7995
8402
  "mask-composite": "intersect"
7996
8403
  };
7997
- function handlePosition([, v = ""]) {
7998
- if (v in cornerMap) {
7999
- const positions = v.split("").flatMap((c) => linearMap[c]).join(" ");
8000
- return { "mask-position": positions };
8001
- }
8002
- const _v = h.bracket.cssvar.global.position(v);
8404
+ function handlePosition([, v = ""], ctx) {
8405
+ if (v in cornerMap) return { "mask-position": v.split("").flatMap((c) => linearMap[c]).join(" ") };
8406
+ const _v = h.bracket.cssvar.global.position(v, ctx?.theme);
8003
8407
  if (_v !== null) return { "mask-position": _v };
8004
8408
  }
8005
8409
  function handleImage([_, gradient = "", direction, val], ctx) {
@@ -8016,8 +8420,8 @@ function handleImage([_, gradient = "", direction, val], ctx) {
8016
8420
  css[`--un-mask-${dir}`] = `linear-gradient(to ${dir}, var(--un-mask-${dir}-from-color) var(--un-mask-${dir}-from-position), var(--un-mask-${dir}-to-color) var(--un-mask-${dir}-to-position))`;
8017
8421
  if (numberResolver(val) != null) {
8018
8422
  themeTracking("spacing");
8019
- css[`--un-mask-${dir}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val)})`;
8020
- } else css[`--un-mask-${dir}-${direction}-position`] = h.bracket.cssvar.fraction.rem(val);
8423
+ css[`--un-mask-${dir}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val, ctx.theme)})`;
8424
+ } else css[`--un-mask-${dir}-${direction}-position`] = h.bracket.cssvar.fraction.rem(val, ctx.theme);
8021
8425
  if (hasParseableColor(val, ctx.theme)) {
8022
8426
  const result = colorResolver(`--un-mask-${dir}-${direction}-color`, hyphenate("colors"))([_, val], ctx);
8023
8427
  if (result) {
@@ -8043,10 +8447,10 @@ function handleImage([_, gradient = "", direction, val], ctx) {
8043
8447
  } else {
8044
8448
  if (direction == null) if (gradient === "radial") {
8045
8449
  css["--un-mask-radial"] = "radial-gradient(var(--un-mask-radial-stops, var(--un-mask-radial-size)))";
8046
- css["--un-mask-radial-size"] = h.bracket.cssvar.rem(val);
8450
+ css["--un-mask-radial-size"] = h.bracket.cssvar.rem(val, ctx.theme);
8047
8451
  } else {
8048
8452
  css[`--un-mask-${gradient}`] = `${gradient}-gradient(var(--un-mask-${gradient}-stops, var(--un-mask-${gradient}-position)))`;
8049
- css[`--un-mask-${gradient}-position`] = numberResolver(val) ? `calc(1deg * ${h.bracket.cssvar.number(val)})` : h.bracket.cssvar.fraction(val);
8453
+ css[`--un-mask-${gradient}-position`] = numberResolver(val) ? `calc(1deg * ${h.bracket.cssvar.number(val, ctx.theme)})` : h.bracket.cssvar.fraction(val, ctx.theme);
8050
8454
  }
8051
8455
  else {
8052
8456
  const gradientStopsPrefixMap = {
@@ -8065,8 +8469,8 @@ function handleImage([_, gradient = "", direction, val], ctx) {
8065
8469
  }
8066
8470
  } else if (numberResolver(val) != null) {
8067
8471
  themeTracking("spacing");
8068
- css[`--un-mask-${gradient}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val)})`;
8069
- } else css[`--un-mask-${gradient}-${direction}-position`] = h.bracket.cssvar.fraction.rem(val);
8472
+ css[`--un-mask-${gradient}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val, ctx.theme)})`;
8473
+ } else css[`--un-mask-${gradient}-${direction}-position`] = h.bracket.cssvar.fraction.rem(val, ctx.theme);
8070
8474
  }
8071
8475
  if (gradient === "radial") props.push(...[defineProperty("--un-mask-radial-shape", { initialValue: "ellipse" }), defineProperty("--un-mask-radial-size", { initialValue: "farthest-corner" })]);
8072
8476
  props.push(...["from", "to"].flatMap((p) => [
@@ -8083,8 +8487,8 @@ function handleImage([_, gradient = "", direction, val], ctx) {
8083
8487
  }
8084
8488
  return [css, ...props];
8085
8489
  }
8086
- function handleSize$1([, v = ""]) {
8087
- const _v = h.bracket.cssvar.global.fraction.rem(v);
8490
+ function handleSize$1([, v = ""], ctx) {
8491
+ const _v = h.bracket.cssvar.global.fraction.rem(v, ctx?.theme);
8088
8492
  if (_v !== null) return { "mask-size": _v };
8089
8493
  }
8090
8494
  const masks = [
@@ -8099,7 +8503,7 @@ const masks = [
8099
8503
  ["mask-subtract", { "mask-composite": "subtract" }],
8100
8504
  ["mask-intersect", { "mask-composite": "intersect" }],
8101
8505
  ["mask-exclude", { "mask-composite": "exclude" }],
8102
- [/^mask-(.+)$/, ([, v]) => ({ "mask-image": h.bracket.cssvar(v) })],
8506
+ [/^mask-(.+)$/, ([, v], { theme }) => ({ "mask-image": h.bracket.cssvar(v, theme) })],
8103
8507
  [
8104
8508
  /^mask-(linear|radial|conic|[xytblr])-(from|to)()(?:-(.+))?$/,
8105
8509
  handleImage,
@@ -8159,7 +8563,7 @@ const placeholders = [[
8159
8563
  { autocomplete: "placeholder-$colors" }
8160
8564
  ], [
8161
8565
  /^\$ placeholder-op(?:acity)?-?(.+)$/,
8162
- ([, opacity]) => ({ "--un-placeholder-opacity": h.bracket.percent(opacity) }),
8566
+ ([, opacity], { theme }) => ({ "--un-placeholder-opacity": h.bracket.percent(opacity, theme) }),
8163
8567
  { autocomplete: ["placeholder-(op|opacity)", "placeholder-(op|opacity)-<percent>"] }
8164
8568
  ]];
8165
8569
  const positions = [
@@ -8207,7 +8611,7 @@ const justifies = [
8207
8611
  ...makeGlobalStaticRules("justify-self")
8208
8612
  ];
8209
8613
  const orders = [
8210
- [/^order-(.+)$/, ([, v]) => ({ order: h.bracket.cssvar.number(v) })],
8614
+ [/^order-(.+)$/, ([, v], { theme }) => ({ order: h.bracket.cssvar.number(v, theme) })],
8211
8615
  ["order-first", { order: "calc(-infinity)" }],
8212
8616
  ["order-last", { order: "calc(infinity)" }],
8213
8617
  ["order-none", { order: "0" }]
@@ -8283,21 +8687,21 @@ const flexGridJustifiesAlignments = [
8283
8687
  ...alignments,
8284
8688
  ...placements
8285
8689
  ].flatMap(([k, v]) => [[`flex-${k}`, v], [`grid-${k}`, v]]);
8286
- function handleInsetValue(v) {
8690
+ function handleInsetValue(v, theme) {
8287
8691
  const _v = numberResolver(v);
8288
8692
  if (_v != null) {
8289
8693
  themeTracking(`spacing`);
8290
8694
  return `calc(var(--spacing) * ${_v})`;
8291
- } else return h.bracket.cssvar.global.auto.fraction.rem(v);
8695
+ } else return h.bracket.cssvar.global.auto.fraction.rem(v, theme);
8292
8696
  }
8293
- function handleInsetValues([, d, v]) {
8294
- const r = handleInsetValue(v);
8697
+ function handleInsetValues([, d, v], { theme }) {
8698
+ const r = handleInsetValue(v, theme);
8295
8699
  if (r != null && d in insetMap) return insetMap[d].map((i) => [i.slice(1), r]);
8296
8700
  }
8297
8701
  const insets = [
8298
8702
  [
8299
8703
  /^(?:position-|pos-)?inset-(.+)$/,
8300
- ([, v]) => ({ inset: handleInsetValue(v) }),
8704
+ ([, v], { theme }) => ({ inset: handleInsetValue(v, theme) }),
8301
8705
  { autocomplete: [
8302
8706
  "(position|pos)-inset-<directions>-$spacing",
8303
8707
  "(position|pos)-inset-(block|inline)-$spacing",
@@ -8310,7 +8714,7 @@ const insets = [
8310
8714
  [/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
8311
8715
  [/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
8312
8716
  [/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
8313
- [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v]) => ({ [d]: handleInsetValue(v) })]
8717
+ [/^(?:position-|pos-)?(top|left|right|bottom)-(.+)$/, ([, d, v], { theme }) => ({ [d]: handleInsetValue(v, theme) })]
8314
8718
  ];
8315
8719
  const floats = [
8316
8720
  ["float-left", { float: "left" }],
@@ -8329,7 +8733,7 @@ const floats = [
8329
8733
  ];
8330
8734
  const zIndexes = [[/^(?:position-|pos-)?z([\d.]+)$/, ([, v]) => ({ "z-index": h.number(v) })], [
8331
8735
  /^(?:position-|pos-)?z-(.+)$/,
8332
- ([, v]) => ({ "z-index": h.bracket.cssvar.global.auto.number(v) }),
8736
+ ([, v], { theme }) => ({ "z-index": h.bracket.cssvar.global.auto.number(v, theme) }),
8333
8737
  { autocomplete: "z-<num>" }
8334
8738
  ]];
8335
8739
  const boxSizing = [
@@ -8370,7 +8774,7 @@ const boxShadows = [
8370
8774
  ],
8371
8775
  [
8372
8776
  /^shadow-op(?:acity)?-?(.+)$/,
8373
- ([, opacity]) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity) }),
8777
+ ([, opacity], { theme }) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8374
8778
  { autocomplete: "shadow-(op|opacity)-<percent>" }
8375
8779
  ],
8376
8780
  [
@@ -8380,7 +8784,7 @@ const boxShadows = [
8380
8784
  ],
8381
8785
  [
8382
8786
  /^inset-shadow-op(?:acity)?-?(.+)$/,
8383
- ([, opacity]) => ({ "--un-inset-shadow-opacity": h.bracket.percent.cssvar(opacity) }),
8787
+ ([, opacity], { theme }) => ({ "--un-inset-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8384
8788
  { autocomplete: "shadow-(op|opacity)-<percent>" }
8385
8789
  ]
8386
8790
  ];
@@ -8394,10 +8798,10 @@ function handleShadow(themeKey) {
8394
8798
  if (d.startsWith("/")) res = ["", d.slice(1)];
8395
8799
  }
8396
8800
  const v = theme[themeKey]?.[res[0] || "DEFAULT"];
8397
- const c = d ? h.bracket.cssvar(d) : void 0;
8801
+ const c = d ? h.bracket.cssvar(d, theme) : void 0;
8398
8802
  const shadowVar = hyphenate(themeKey);
8399
8803
  if ((v != null || c != null) && !hasParseableColor(c, theme)) {
8400
- const alpha = res[1] ? h.bracket.percent.cssvar(res[1]) : void 0;
8804
+ const alpha = res[1] ? h.bracket.percent.cssvar(res[1], theme) : void 0;
8401
8805
  return [{
8402
8806
  [`--un-${shadowVar}-opacity`]: alpha,
8403
8807
  [`--un-${shadowVar}`]: colorableShadows(v || c, `--un-${shadowVar}-color`, alpha).join(","),
@@ -8408,8 +8812,8 @@ function handleShadow(themeKey) {
8408
8812
  };
8409
8813
  }
8410
8814
  const rings = [
8411
- [/^ring(?:-(.+))?$/, ([, d]) => {
8412
- const v = h.bracket.px(d || "1");
8815
+ [/^ring(?:-(.+))?$/, ([, d], { theme }) => {
8816
+ const v = h.bracket.px(d || "1", theme);
8413
8817
  if (v != null) return [{
8414
8818
  "--un-ring-shadow": `var(--un-ring-inset,) 0 0 0 calc(${v} + var(--un-ring-offset-width)) var(--un-ring-color, currentColor)`,
8415
8819
  "box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
@@ -8422,11 +8826,11 @@ const rings = [
8422
8826
  ],
8423
8827
  [
8424
8828
  /^ring-op(?:acity)?-?(.+)$/,
8425
- ([, opacity]) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity) }),
8829
+ ([, opacity], { theme }) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8426
8830
  { autocomplete: "ring-(op|opacity)-<percent>" }
8427
8831
  ],
8428
- [/^inset-ring(?:-(.+))?$/, ([, d]) => {
8429
- const v = h.bracket.px(d || "1");
8832
+ [/^inset-ring(?:-(.+))?$/, ([, d], { theme }) => {
8833
+ const v = h.bracket.px(d || "1", theme);
8430
8834
  if (v != null) return [{
8431
8835
  "--un-inset-ring-shadow": `inset 0 0 0 ${v} var(--un-inset-ring-color, currentColor)`,
8432
8836
  "box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
@@ -8439,13 +8843,13 @@ const rings = [
8439
8843
  ],
8440
8844
  [
8441
8845
  /^inset-ring-op(?:acity)?-?(.+)$/,
8442
- ([, opacity]) => ({ "--un-inset-ring-opacity": h.bracket.percent.cssvar(opacity) }),
8846
+ ([, opacity], { theme }) => ({ "--un-inset-ring-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8443
8847
  { autocomplete: "inset-ring-(op|opacity)-<percent>" }
8444
8848
  ],
8445
8849
  [
8446
8850
  /^ring-offset(?:-(?:width-|size-)?(.+))?$/,
8447
- ([, d]) => {
8448
- const v = h.bracket.cssvar.px(d || "1");
8851
+ ([, d], { theme }) => {
8852
+ const v = h.bracket.cssvar.px(d || "1", theme);
8449
8853
  if (v != null) return {
8450
8854
  "--un-ring-offset-width": v,
8451
8855
  "--un-ring-offset-shadow": "var(--un-ring-inset,) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)"
@@ -8460,7 +8864,7 @@ const rings = [
8460
8864
  ],
8461
8865
  [
8462
8866
  /^ring-offset-op(?:acity)?-?(.+)$/,
8463
- ([, opacity]) => ({ "--un-ring-offset-opacity": h.bracket.percent.cssvar(opacity) }),
8867
+ ([, opacity], { theme }) => ({ "--un-ring-offset-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8464
8868
  { autocomplete: "ring-offset-(op|opacity)-<percent>" }
8465
8869
  ],
8466
8870
  ["ring-inset", { "--un-ring-inset": "inset" }]
@@ -8532,7 +8936,7 @@ function getSizeValue(theme, hw, prop) {
8532
8936
  themeTracking(`spacing`);
8533
8937
  v = `calc(var(--spacing) * ${h.number(prop)})`;
8534
8938
  }
8535
- return v ?? h.bracket.cssvar.global.auto.none.fraction.rem(prop);
8939
+ return v ?? h.bracket.cssvar.global.auto.none.fraction.rem(prop, theme);
8536
8940
  }
8537
8941
  const sizes = [
8538
8942
  [/^size-(min-|max-)?(.+)$/, ([, m, s], { theme }) => ({
@@ -8573,17 +8977,17 @@ function handleBreakpoint(context, point, key = "breakpoint") {
8573
8977
  const bp = resolveBreakpoints(context, key);
8574
8978
  if (bp) return bp.find((i) => i.point === point)?.size;
8575
8979
  }
8576
- function getAspectRatio(prop) {
8980
+ function getAspectRatio(prop, theme) {
8577
8981
  if (/^\d+\/\d+$/.test(prop)) return prop;
8578
8982
  switch (prop) {
8579
8983
  case "square": return "1/1";
8580
8984
  case "video": return "16/9";
8581
8985
  }
8582
- return h.bracket.cssvar.global.auto.number(prop);
8986
+ return h.bracket.cssvar.global.auto.number(prop, theme);
8583
8987
  }
8584
8988
  const aspectRatio = [[
8585
8989
  /^(?:size-)?aspect-(?:ratio-)?(.+)$/,
8586
- ([, d]) => ({ "aspect-ratio": getAspectRatio(d) }),
8990
+ ([, d], { theme }) => ({ "aspect-ratio": getAspectRatio(d, theme) }),
8587
8991
  { autocomplete: ["aspect-(square|video|ratio)", "aspect-ratio-(square|video)"] }
8588
8992
  ]];
8589
8993
  const cursorValues = [
@@ -8638,7 +9042,7 @@ const displays = [
8638
9042
  ["flow-root", { display: "flow-root" }],
8639
9043
  ["list-item", { display: "list-item" }],
8640
9044
  ["hidden", { display: "none" }],
8641
- [/^display-(.+)$/, ([, c]) => ({ display: h.bracket.cssvar.global(c) })]
9045
+ [/^display-(.+)$/, ([, c], { theme }) => ({ display: h.bracket.cssvar.global(c, theme) })]
8642
9046
  ];
8643
9047
  const appearances = [
8644
9048
  ["visible", { visibility: "visible" }],
@@ -8648,10 +9052,11 @@ const appearances = [
8648
9052
  ["backface-hidden", { "backface-visibility": "hidden" }],
8649
9053
  ...makeGlobalStaticRules("backface", "backface-visibility")
8650
9054
  ];
8651
- const cursors = [[/^cursor-(.+)$/, ([, c]) => ({ cursor: h.bracket.cssvar.global(c) })], ...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])];
9055
+ const cursors = [[/^cursor-(.+)$/, ([, c], { theme }) => ({ cursor: h.bracket.cssvar.global(c, theme) })], ...cursorValues.map((v) => [`cursor-${v}`, { cursor: v }])];
8652
9056
  const contains = [
8653
- [/^contain-(.*)$/, ([, d]) => {
8654
- if (h.bracket(d) != null) return { contain: h.bracket(d).split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") };
9057
+ [/^contain-(.*)$/, ([, d], { theme }) => {
9058
+ const value = h.bracket(d, theme);
9059
+ if (value != null) return { contain: value.split(" ").map((e) => h.cssvar.fraction(e) ?? e).join(" ") };
8655
9060
  return containValues.includes(d) ? [{
8656
9061
  "--un-contain-size": d,
8657
9062
  "contain": containValues.map((i) => `var(--un-contain-${i})`).join(" ")
@@ -8708,13 +9113,13 @@ const whitespaces = [[
8708
9113
  const contentVisibility = [
8709
9114
  [
8710
9115
  /^intrinsic(?:-(block|inline|w|h))?(?:-size)?-(.+)$/,
8711
- ([, d, s]) => {
9116
+ ([, d, s], { theme }) => {
8712
9117
  return { [`contain-intrinsic-${{
8713
9118
  block: "block-size",
8714
9119
  inline: "inline-size",
8715
9120
  w: "width",
8716
9121
  h: "height"
8717
- }[d] ?? "size"}`]: h.bracket.cssvar.global.fraction.rem(s) };
9122
+ }[d] ?? "size"}`]: h.bracket.cssvar.global.fraction.rem(s, theme) };
8718
9123
  },
8719
9124
  { autocomplete: [
8720
9125
  "intrinsic-size-<num>",
@@ -8728,9 +9133,9 @@ const contentVisibility = [
8728
9133
  ...makeGlobalStaticRules("content-visibility")
8729
9134
  ];
8730
9135
  const contents = [
8731
- [/^content-(.+)$/, ([, v]) => {
8732
- if (h.bracket.cssvar(v) != null) return [{
8733
- "--un-content": h.bracket.cssvar(v),
9136
+ [/^content-(.+)$/, ([, v], { theme }) => {
9137
+ if (h.bracket.cssvar(v, theme) != null) return [{
9138
+ "--un-content": h.bracket.cssvar(v, theme),
8734
9139
  "content": "var(--un-content)"
8735
9140
  }, defineProperty("--un-content", { initialValue: "\"\"" })];
8736
9141
  }],
@@ -8853,9 +9258,10 @@ const objectPositions = [
8853
9258
  ["object-none", { "object-fit": "none" }],
8854
9259
  [
8855
9260
  /^object-(.+)$/,
8856
- ([, d]) => {
9261
+ ([, d], { theme }) => {
8857
9262
  if (positionMap[d]) return { "object-position": positionMap[d] };
8858
- if (h.bracketOfPosition(d) != null) return { "object-position": h.bracketOfPosition(d).split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
9263
+ const position = h.bracketOfPosition(d, theme);
9264
+ if (position != null) return { "object-position": position.split(" ").map((e) => h.position.fraction.auto.px.cssvar(e) ?? e).join(" ") };
8859
9265
  },
8860
9266
  { autocomplete: `object-(${Object.keys(positionMap).join("|")})` }
8861
9267
  ]
@@ -8920,17 +9326,17 @@ const svgUtilities = [
8920
9326
  ],
8921
9327
  [
8922
9328
  /^fill-op(?:acity)?-?(.+)$/,
8923
- ([, opacity]) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity) }),
9329
+ ([, opacity], { theme }) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8924
9330
  { autocomplete: "fill-(op|opacity)-<percent>" }
8925
9331
  ],
8926
9332
  ["fill-none", { fill: "none" }],
8927
9333
  [/^stroke-(?:width-|size-)?(.+)$/, handleWidth],
8928
9334
  [
8929
9335
  /^stroke-dash-(.+)$/,
8930
- ([, s]) => ({ "stroke-dasharray": h.bracket.cssvar.number(s) }),
9336
+ ([, s], { theme }) => ({ "stroke-dasharray": h.bracket.cssvar.number(s, theme) }),
8931
9337
  { autocomplete: "stroke-dash-<num>" }
8932
9338
  ],
8933
- [/^stroke-offset-(.+)$/, ([, s]) => ({ "stroke-dashoffset": h.bracket.cssvar.px.numberWithUnit(s) })],
9339
+ [/^stroke-offset-(.+)$/, ([, s], { theme }) => ({ "stroke-dashoffset": h.bracket.cssvar.px.numberWithUnit(s, theme) })],
8934
9340
  [
8935
9341
  /^stroke-(.+)$/,
8936
9342
  handleColorOrWidth,
@@ -8938,7 +9344,7 @@ const svgUtilities = [
8938
9344
  ],
8939
9345
  [
8940
9346
  /^stroke-op(?:acity)?-?(.+)$/,
8941
- ([, opacity]) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity) }),
9347
+ ([, opacity], { theme }) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8942
9348
  { autocomplete: "stroke-(op|opacity)-<percent>" }
8943
9349
  ],
8944
9350
  ["stroke-cap-square", { "stroke-linecap": "square" }],
@@ -8951,11 +9357,11 @@ const svgUtilities = [
8951
9357
  ["stroke-join-auto", { "stroke-linejoin": "miter" }],
8952
9358
  ["stroke-none", { stroke: "none" }]
8953
9359
  ];
8954
- function handleWidth([, b]) {
8955
- return { "stroke-width": h.bracket.cssvar.fraction.px.number(b) };
9360
+ function handleWidth([, b], { theme }) {
9361
+ return { "stroke-width": h.bracket.cssvar.fraction.px.number(b, theme) };
8956
9362
  }
8957
9363
  function handleColorOrWidth(match, ctx) {
8958
- if (isCSSMathFn(h.bracket(match[1]))) return handleWidth(match);
9364
+ if (isCSSMathFn(h.bracket(match[1], ctx.theme))) return handleWidth(match, ctx);
8959
9365
  return colorResolver("stroke", "stroke")(match, ctx);
8960
9366
  }
8961
9367
  const tables = [
@@ -9020,7 +9426,7 @@ function resolveValue(s, theme) {
9020
9426
  if (num != null) {
9021
9427
  themeTracking(`spacing`);
9022
9428
  v = `calc(var(--spacing) * ${num})`;
9023
- } else v = h.bracket.cssvar.global.auto.fraction.rem(s);
9429
+ } else v = h.bracket.cssvar.global.auto.fraction.rem(s, theme);
9024
9430
  }
9025
9431
  return v;
9026
9432
  }
@@ -9078,7 +9484,7 @@ const transformGpu = ["translateZ(0)", transformCpu].join(" ");
9078
9484
  const transforms = [
9079
9485
  [
9080
9486
  /^(?:transform-)?origin-(.+)$/,
9081
- ([, s]) => ({ "transform-origin": positionMap[s] ?? h.bracket.cssvar(s) }),
9487
+ ([, s], { theme }) => ({ "transform-origin": positionMap[s] ?? h.bracket.cssvar(s, theme) }),
9082
9488
  { autocomplete: [`transform-origin-(${Object.keys(positionMap).join("|")})`, `origin-(${Object.keys(positionMap).join("|")})`] }
9083
9489
  ],
9084
9490
  [
@@ -9088,7 +9494,7 @@ const transforms = [
9088
9494
  if (theme.perspective?.[s]) {
9089
9495
  themeTracking(`perspective`, s);
9090
9496
  v = generateThemeVariable("perspective", s);
9091
- } else v = h.bracket.cssvar.px.numberWithUnit(s);
9497
+ } else v = h.bracket.cssvar.px.numberWithUnit(s, theme);
9092
9498
  if (v != null) {
9093
9499
  if (t) return {
9094
9500
  "--un-perspective": `perspective(${v})`,
@@ -9099,8 +9505,8 @@ const transforms = [
9099
9505
  },
9100
9506
  { autocomplete: [`perspective-<num>`, `perspective-$perspective`] }
9101
9507
  ],
9102
- [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
9103
- const v = h.bracket.cssvar(s) ?? (s.length >= 3 ? positionMap[s] : void 0);
9508
+ [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s], { theme }) => {
9509
+ const v = h.bracket.cssvar(s, theme) ?? (s.length >= 3 ? positionMap[s] : void 0);
9104
9510
  if (v != null) return { "perspective-origin": v };
9105
9511
  }],
9106
9512
  [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
@@ -9133,8 +9539,8 @@ const transforms = [
9133
9539
  ["transform-none", { transform: "none" }],
9134
9540
  ...makeGlobalStaticRules("transform")
9135
9541
  ];
9136
- function handleTranslate([, d, b]) {
9137
- const v = numberResolver(b) ?? h.bracket.cssvar.none.fraction.rem(b);
9542
+ function handleTranslate([, d, b], { theme }) {
9543
+ const v = numberResolver(b) ?? h.bracket.cssvar.none.fraction.rem(b, theme);
9138
9544
  if (v != null) {
9139
9545
  if (v === "none") return { translate: "none" };
9140
9546
  themeTracking(`spacing`);
@@ -9149,8 +9555,8 @@ function handleTranslate([, d, b]) {
9149
9555
  ].map((d) => defineProperty(`--un-translate-${d}`, { initialValue: 0 }))];
9150
9556
  }
9151
9557
  }
9152
- function handleScale([, d, b]) {
9153
- const v = h.bracket.cssvar.none.fraction.percent(b);
9558
+ function handleScale([, d, b], { theme }) {
9559
+ const v = h.bracket.cssvar.none.fraction.percent(b, theme);
9154
9560
  if (v != null) {
9155
9561
  if (v === "none") return { scale: "none" };
9156
9562
  return [[...transformXYZ(d, v, "scale"), ["scale", `var(--un-scale-x) var(--un-scale-y)${d === "z" ? " var(--un-scale-z)" : ""}`]], ...[
@@ -9160,8 +9566,8 @@ function handleScale([, d, b]) {
9160
9566
  ].map((d) => defineProperty(`--un-scale-${d}`, { initialValue: 1 }))];
9161
9567
  }
9162
9568
  }
9163
- function handleRotate([, d = "", b]) {
9164
- const v = h.bracket.cssvar.none.degree(b);
9569
+ function handleRotate([, d = "", b], { theme }) {
9570
+ const v = h.bracket.cssvar.none.degree(b, theme);
9165
9571
  if (v != null) {
9166
9572
  if (v === "none") return { rotate: "none" };
9167
9573
  if (d) return [
@@ -9173,11 +9579,11 @@ function handleRotate([, d = "", b]) {
9173
9579
  ].map((d) => defineProperty(`--un-rotate-${d}`, { initialValue: `rotate${d.toUpperCase()}(0)` })),
9174
9580
  ...["x", "y"].map((d) => defineProperty(`--un-skew-${d}`, { initialValue: `skew${d.toUpperCase()}(0)` }))
9175
9581
  ];
9176
- else return { rotate: h.bracket.cssvar.degree(b) };
9582
+ else return { rotate: h.bracket.cssvar.degree(b, theme) };
9177
9583
  }
9178
9584
  }
9179
- function handleSkew([, d, b]) {
9180
- const v = h.bracket.cssvar.degree(b);
9585
+ function handleSkew([, d, b], { theme }) {
9586
+ const v = h.bracket.cssvar.degree(b, theme);
9181
9587
  const ds = xyzMap[d];
9182
9588
  if (v != null && ds) return [
9183
9589
  [...ds.map((_d) => [`--un-skew${_d}`, v.endsWith("deg") ? `skew${_d.slice(1).toUpperCase()}(${v})` : v]), ["transform", transform]],
@@ -9226,11 +9632,11 @@ const transitions = [
9226
9632
  ...defaultTransition
9227
9633
  };
9228
9634
  }],
9229
- [/^(?:transition-)?duration-(.+)$/, ([, d]) => ({
9230
- "--un-duration": h.bracket.cssvar.time(d),
9231
- "transition-duration": h.bracket.cssvar.time(d)
9635
+ [/^(?:transition-)?duration-(.+)$/, ([, d], { theme }) => ({
9636
+ "--un-duration": h.bracket.cssvar.time(d, theme),
9637
+ "transition-duration": h.bracket.cssvar.time(d, theme)
9232
9638
  })],
9233
- [/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": h.bracket.cssvar.time(d) })],
9639
+ [/^(?:transition-)?delay-(.+)$/, ([, d], { theme }) => ({ "transition-delay": h.bracket.cssvar.time(d, theme) })],
9234
9640
  [
9235
9641
  /^(?:transition-)?ease(?:-(.+))?$/,
9236
9642
  ([, d = "DEFAULT"], { theme }) => {
@@ -9238,7 +9644,7 @@ const transitions = [
9238
9644
  if (theme.ease?.[d]) {
9239
9645
  themeTracking("ease", d);
9240
9646
  v = generateThemeVariable("ease", d);
9241
- } else v = h.bracket.cssvar(d);
9647
+ } else v = h.bracket.cssvar(d, theme);
9242
9648
  return [{
9243
9649
  "--un-ease": v,
9244
9650
  "transition-timing-function": v
@@ -9283,7 +9689,7 @@ const fonts = [
9283
9689
  ],
9284
9690
  [
9285
9691
  /^(?:text|color|c)-op(?:acity)?-?(.+)$/,
9286
- ([, opacity]) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity) }),
9692
+ ([, opacity], { theme }) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity, theme) }),
9287
9693
  { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }
9288
9694
  ],
9289
9695
  [
@@ -9293,7 +9699,7 @@ const fonts = [
9293
9699
  if (theme.fontWeight?.[s]) {
9294
9700
  themeTracking(`fontWeight`, s);
9295
9701
  v = generateThemeVariable("fontWeight", s);
9296
- } else v = h.bracket.cssvar.global.number(s);
9702
+ } else v = h.bracket.cssvar.global.number(s, theme);
9297
9703
  return {
9298
9704
  "--un-font-weight": v,
9299
9705
  "font-weight": v
@@ -9311,7 +9717,7 @@ const fonts = [
9311
9717
  } else if (numberResolver(s)) {
9312
9718
  themeTracking("spacing");
9313
9719
  v = `calc(var(--spacing) * ${numberResolver(s)})`;
9314
- } else v = h.bracket.cssvar.global.rem(s);
9720
+ } else v = h.bracket.cssvar.global.rem(s, theme);
9315
9721
  if (v != null) return [{
9316
9722
  "--un-leading": v,
9317
9723
  "line-height": v
@@ -9323,7 +9729,7 @@ const fonts = [
9323
9729
  ["font-synthesis-style", { "font-synthesis": "style" }],
9324
9730
  ["font-synthesis-small-caps", { "font-synthesis": "small-caps" }],
9325
9731
  ["font-synthesis-none", { "font-synthesis": "none" }],
9326
- [/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis": h.bracket.cssvar.global(s) })],
9732
+ [/^font-synthesis-(.+)$/, ([, s], { theme }) => ({ "font-synthesis": h.bracket.cssvar.global(s, theme) })],
9327
9733
  [
9328
9734
  /^(?:font-)?tracking-(.+)$/,
9329
9735
  ([, s], { theme }) => {
@@ -9331,7 +9737,7 @@ const fonts = [
9331
9737
  if (theme.tracking?.[s]) {
9332
9738
  themeTracking(`tracking`, s);
9333
9739
  v = generateThemeVariable("tracking", s);
9334
- } else v = h.bracket.cssvar.global.rem(s);
9740
+ } else v = h.bracket.cssvar.global.rem(s, theme);
9335
9741
  return {
9336
9742
  "--un-tracking": v,
9337
9743
  "letter-spacing": v
@@ -9342,7 +9748,7 @@ const fonts = [
9342
9748
  [
9343
9749
  /^(?:font-)?word-spacing-(.+)$/,
9344
9750
  ([, s], { theme }) => {
9345
- const v = theme.tracking?.[s] ? generateThemeVariable("tracking", s) : h.bracket.cssvar.global.rem(s);
9751
+ const v = theme.tracking?.[s] ? generateThemeVariable("tracking", s) : h.bracket.cssvar.global.rem(s, theme);
9346
9752
  return {
9347
9753
  "--un-word-spacing": v,
9348
9754
  "word-spacing": v
@@ -9361,7 +9767,7 @@ const fonts = [
9361
9767
  ["font-stretch-ultra-expanded", { "font-stretch": "ultra-expanded" }],
9362
9768
  [
9363
9769
  /^font-stretch-(.+)$/,
9364
- ([, s]) => ({ "font-stretch": h.bracket.cssvar.fraction.global(s) }),
9770
+ ([, s], { theme }) => ({ "font-stretch": h.bracket.cssvar.fraction.global(s, theme) }),
9365
9771
  { autocomplete: "font-stretch-<percentage>" }
9366
9772
  ],
9367
9773
  [
@@ -9386,12 +9792,12 @@ const fonts = [
9386
9792
  "--un-font-weight": v,
9387
9793
  "font-weight": v
9388
9794
  };
9389
- v = h.bracketOfFamily(d);
9795
+ v = h.bracketOfFamily(d, theme);
9390
9796
  if (v != null && h.number(v) == null) {
9391
9797
  v = h.cssvar(v) ?? v;
9392
9798
  return { "font-family": v };
9393
9799
  }
9394
- v = h.bracketOfNumber(d);
9800
+ v = h.bracketOfNumber(d, theme);
9395
9801
  if (v != null) {
9396
9802
  v = h.cssvar.number(v);
9397
9803
  return {
@@ -9399,7 +9805,7 @@ const fonts = [
9399
9805
  "font-weight": v
9400
9806
  };
9401
9807
  }
9402
- v = h.bracket(d);
9808
+ v = h.bracket(d, theme);
9403
9809
  if (v != null && h.number(v) != null) {
9404
9810
  const num = h.number(v);
9405
9811
  return {
@@ -9407,27 +9813,27 @@ const fonts = [
9407
9813
  "font-weight": num
9408
9814
  };
9409
9815
  }
9410
- v = h.bracket.cssvar.global(d);
9816
+ v = h.bracket.cssvar.global(d, theme);
9411
9817
  if (v != null) return { "font-family": v };
9412
9818
  },
9413
9819
  { autocomplete: ["font-$font", "font-$fontWeight"] }
9414
9820
  ]
9415
9821
  ];
9416
- const tabSizes = [[/^tab(?:-(.+))?$/, ([, s]) => {
9417
- const v = h.bracket.cssvar.global.number(s || "4");
9822
+ const tabSizes = [[/^tab(?:-(.+))?$/, ([, s], { theme }) => {
9823
+ const v = h.bracket.cssvar.global.number(s || "4", theme);
9418
9824
  if (v != null) return {
9419
9825
  "-moz-tab-size": v,
9420
9826
  "-o-tab-size": v,
9421
9827
  "tab-size": v
9422
9828
  };
9423
9829
  }]];
9424
- const textIndents = [[/^indent-(.+)$/, ([, s]) => {
9830
+ const textIndents = [[/^indent-(.+)$/, ([, s], { theme }) => {
9425
9831
  let v = numberResolver(s);
9426
9832
  if (v != null) {
9427
9833
  themeTracking(`spacing`);
9428
9834
  return { "text-indent": `calc(var(--spacing) * ${v})` };
9429
9835
  }
9430
- v = h.bracket.cssvar.auto.global.rem(s);
9836
+ v = h.bracket.cssvar.auto.global.rem(s, theme);
9431
9837
  if (v != null) return { "text-indent": v };
9432
9838
  }]];
9433
9839
  const textStrokes = [
@@ -9435,7 +9841,7 @@ const textStrokes = [
9435
9841
  /^text-stroke(?:-(.+))?$/,
9436
9842
  ([, s = "DEFAULT"], { theme }) => {
9437
9843
  if (theme.textStrokeWidth?.[s]) themeTracking(`textStrokeWidth`, s);
9438
- return { "-webkit-text-stroke-width": theme.textStrokeWidth?.[s] ? generateThemeVariable("textStrokeWidth", s) : h.bracket.cssvar.px(s) };
9844
+ return { "-webkit-text-stroke-width": theme.textStrokeWidth?.[s] ? generateThemeVariable("textStrokeWidth", s) : h.bracket.cssvar.px(s, theme) };
9439
9845
  },
9440
9846
  { autocomplete: "text-stroke-$textStrokeWidth" }
9441
9847
  ],
@@ -9446,7 +9852,7 @@ const textStrokes = [
9446
9852
  ],
9447
9853
  [
9448
9854
  /^text-stroke-op(?:acity)?-?(.+)$/,
9449
- ([, opacity]) => ({ "--un-text-stroke-opacity": h.bracket.percent.cssvar(opacity) }),
9855
+ ([, opacity], { theme }) => ({ "--un-text-stroke-opacity": h.bracket.percent.cssvar(opacity, theme) }),
9450
9856
  { autocomplete: "text-stroke-(op|opacity)-<percent>" }
9451
9857
  ]
9452
9858
  ];
@@ -9456,16 +9862,16 @@ function handleTextShadow(match, ctx) {
9456
9862
  let res = [];
9457
9863
  if (s) res = getStringComponents(s, "/", 2) ?? [];
9458
9864
  const v = theme.textShadow?.[res[0]];
9459
- const c = s ? h.bracket.cssvar(s) : void 0;
9865
+ const c = s ? h.bracket.cssvar(s, theme) : void 0;
9460
9866
  if ((v != null || c != null) && !hasParseableColor(c, theme)) {
9461
- const alpha = res[1] ? h.bracket.percent.cssvar(res[1]) : void 0;
9867
+ const alpha = res[1] ? h.bracket.percent.cssvar(res[1], theme) : void 0;
9462
9868
  return {
9463
9869
  "--un-text-shadow-opacity": alpha,
9464
9870
  "--un-text-shadow": colorableShadows(v || c, "--un-text-shadow-color", alpha).join(","),
9465
9871
  "text-shadow": "var(--un-text-shadow)"
9466
9872
  };
9467
9873
  }
9468
- return colorResolver("--un-text-shadow-color", "text-shadow")(match, ctx) ?? { "text-shadow": h.bracket.cssvar.global(s) };
9874
+ return colorResolver("--un-text-shadow-color", "text-shadow")(match, ctx) ?? { "text-shadow": h.bracket.cssvar.global(s, theme) };
9469
9875
  }
9470
9876
  const textShadows = [
9471
9877
  [
@@ -9484,7 +9890,7 @@ const textShadows = [
9484
9890
  ],
9485
9891
  [
9486
9892
  /^text-shadow(?:-color)?-op(?:acity)?-?(.+)$/,
9487
- ([, opacity]) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity) }),
9893
+ ([, opacity], { theme }) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
9488
9894
  { autocomplete: "text-shadow(-color)?-(op|opacity)-<percent>" }
9489
9895
  ]
9490
9896
  ];
@@ -9540,7 +9946,7 @@ function handleText([, s = "base"], { theme }) {
9540
9946
  if (leading) if (theme.leading?.[leading]) {
9541
9947
  themeTracking(`leading`, leading);
9542
9948
  lineHeight = generateThemeVariable("leading", leading);
9543
- } else lineHeight = h.bracket.cssvar.global.rem(leading);
9949
+ } else lineHeight = h.bracket.cssvar.global.rem(leading, theme);
9544
9950
  if (sizePairs) {
9545
9951
  themeTracking(`text`, [size, "fontSize"]);
9546
9952
  themeTracking(`text`, [size, "lineHeight"]);
@@ -9551,12 +9957,12 @@ function handleText([, s = "base"], { theme }) {
9551
9957
  "letter-spacing": sizePairs.letterSpacing ? generateThemeVariable("text", [size, "letterSpacing"]) : void 0
9552
9958
  };
9553
9959
  }
9554
- const fontSize = h.bracketOfLength.rem(size);
9960
+ const fontSize = h.bracketOfLength.rem(size, theme);
9555
9961
  if (lineHeight && fontSize) return {
9556
9962
  "font-size": fontSize,
9557
9963
  "line-height": lineHeight
9558
9964
  };
9559
- return { "font-size": h.bracketOfLength.rem(s) };
9965
+ return { "font-size": h.bracketOfLength.rem(s, theme) };
9560
9966
  }
9561
9967
  function handleSize([, s], { theme }) {
9562
9968
  if (theme.text?.[s] != null) {
@@ -9567,12 +9973,12 @@ function handleSize([, s], { theme }) {
9567
9973
  "line-height": `var(--un-leading, ${generateThemeVariable("text", [s, "lineHeight"])})`
9568
9974
  };
9569
9975
  } else {
9570
- const d = h.bracket.cssvar.global.rem(s);
9976
+ const d = h.bracket.cssvar.global.rem(s, theme);
9571
9977
  if (d) return { "font-size": d };
9572
9978
  }
9573
9979
  }
9574
9980
  function handlerColorOrSize(match, ctx) {
9575
- if (isCSSMathFn(h.bracket(match[1]))) return handleSize(match, ctx);
9981
+ if (isCSSMathFn(h.bracket(match[1], ctx.theme))) return handleSize(match, ctx);
9576
9982
  return colorResolver("color", "text")(match, ctx);
9577
9983
  }
9578
9984
  function splitShorthand(body, type) {
@@ -10669,14 +11075,12 @@ const breakpoint = {
10669
11075
  "xl": "80rem",
10670
11076
  "2xl": "96rem"
10671
11077
  };
10672
- const verticalBreakpoint = { ...breakpoint };
10673
- const supports = { grid: "(display: grid)" };
10674
11078
  const theme = {
10675
11079
  font,
10676
11080
  colors,
10677
11081
  spacing,
10678
11082
  breakpoint,
10679
- verticalBreakpoint,
11083
+ verticalBreakpoint: { ...breakpoint },
10680
11084
  text,
10681
11085
  fontWeight,
10682
11086
  tracking,
@@ -10735,17 +11139,17 @@ const theme = {
10735
11139
  container,
10736
11140
  aria,
10737
11141
  media,
10738
- supports
11142
+ supports: { grid: "(display: grid)" }
10739
11143
  };
10740
11144
  //#endregion
10741
- //#region ../../packages-presets/preset-wind4/dist/variants-BQhcPCjX.mjs
11145
+ //#region ../../packages-presets/preset-wind4/dist/variants-pAIxzNbQ.mjs
10742
11146
  const variantAria = {
10743
11147
  name: "aria",
10744
11148
  match(matcher, ctx) {
10745
11149
  const variant = variantGetParameter("aria-", matcher, ctx.generator.config.separators);
10746
11150
  if (variant) {
10747
11151
  const [match, rest] = variant;
10748
- const aria = h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
11152
+ const aria = h.bracket(match, ctx.theme) ?? ctx.theme.aria?.[match] ?? "";
10749
11153
  if (aria) return {
10750
11154
  matcher: rest,
10751
11155
  selector: (s) => `${s}[aria-${aria}]`
@@ -10762,7 +11166,7 @@ function taggedAria(tagName) {
10762
11166
  const variant = variantGetParameter(`${tagName}-aria-`, matcher, ctx.generator.config.separators);
10763
11167
  if (variant) {
10764
11168
  const [match, rest, label] = variant;
10765
- const ariaAttribute = h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
11169
+ const ariaAttribute = h.bracket(match, ctx.theme) ?? ctx.theme.aria?.[match] ?? "";
10766
11170
  if (ariaAttribute) {
10767
11171
  const tagSelectorMap = {
10768
11172
  group: `&:is(:where(.group${label ? `\\/${label}` : ""})[aria-${ariaAttribute}] *)`,
@@ -10874,7 +11278,7 @@ function scopeMatcher(name, combinator) {
10874
11278
  }
10875
11279
  if (!body) return;
10876
11280
  }
10877
- let bracketValue = h.bracket(body[0]) ?? "";
11281
+ let bracketValue = h.bracket(body[0], ctx.theme) ?? "";
10878
11282
  if (bracketValue === "") bracketValue = "*";
10879
11283
  return {
10880
11284
  matcher: body[1],
@@ -10899,7 +11303,7 @@ const variantContainerQuery = {
10899
11303
  const variant = variantGetParameter("@", matcher, ctx.generator.config.separators);
10900
11304
  if (variant) {
10901
11305
  const [match, rest, label] = variant;
10902
- const unbracket = h.bracket(match);
11306
+ const unbracket = h.bracket(match, ctx.theme);
10903
11307
  let container;
10904
11308
  if (unbracket) container = h.numberWithUnit(unbracket);
10905
11309
  else container = ctx.theme.container?.[match] ?? "";
@@ -10939,7 +11343,7 @@ const variantDataAttribute = {
10939
11343
  const variant = variantGetParameter("data-", matcher, ctx.generator.config.separators);
10940
11344
  if (variant) {
10941
11345
  const [match, rest] = variant;
10942
- const dataAttribute = h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
11346
+ const dataAttribute = h.bracket(match, ctx.theme) ?? ctx.theme.data?.[match] ?? "";
10943
11347
  if (dataAttribute) return {
10944
11348
  matcher: rest,
10945
11349
  selector: (s) => `${s}[data-${dataAttribute}]`
@@ -10955,7 +11359,7 @@ function taggedData(tagName) {
10955
11359
  const variant = variantGetParameter(`${tagName}-data-`, matcher, ctx.generator.config.separators);
10956
11360
  if (variant) {
10957
11361
  const [match, rest, label] = variant;
10958
- const dataAttribute = h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
11362
+ const dataAttribute = h.bracket(match, ctx.theme) ?? ctx.theme.data?.[match] ?? "";
10959
11363
  if (dataAttribute) {
10960
11364
  const tagSelectorMap = {
10961
11365
  group: `&:is(:where(.group${label ? `\\/${label}` : ""})[data-${dataAttribute}] *)`,
@@ -11044,7 +11448,7 @@ const variantCustomMedia = {
11044
11448
  const variant = variantGetParameter("media-", matcher, ctx.generator.config.separators);
11045
11449
  if (variant) {
11046
11450
  const [match, rest] = variant;
11047
- let media = h.bracket(match) ?? "";
11451
+ let media = h.bracket(match, ctx.theme) ?? "";
11048
11452
  if (media === "") media = ctx.theme.media?.[match] ?? "";
11049
11453
  if (media) return {
11050
11454
  matcher: rest,
@@ -11068,7 +11472,7 @@ const variantSelector = {
11068
11472
  const variant = variantGetBracket("selector-", matcher, ctx.generator.config.separators);
11069
11473
  if (variant) {
11070
11474
  const [match, rest] = variant;
11071
- const selector = h.bracket(match);
11475
+ const selector = h.bracket(match, ctx.theme);
11072
11476
  if (selector) return {
11073
11477
  matcher: rest,
11074
11478
  selector: () => selector
@@ -11082,7 +11486,7 @@ const variantCssLayer = {
11082
11486
  const variant = variantGetParameter("layer-", matcher, ctx.generator.config.separators);
11083
11487
  if (variant) {
11084
11488
  const [match, rest] = variant;
11085
- const layer = h.bracket(match) ?? match;
11489
+ const layer = h.bracket(match, ctx.theme) ?? match;
11086
11490
  if (layer) return {
11087
11491
  matcher: rest,
11088
11492
  handle: (input, next) => next({
@@ -11099,7 +11503,7 @@ const variantInternalLayer = {
11099
11503
  const variant = variantGetParameter("uno-layer-", matcher, ctx.generator.config.separators);
11100
11504
  if (variant) {
11101
11505
  const [match, rest] = variant;
11102
- const layer = h.bracket(match) ?? match;
11506
+ const layer = h.bracket(match, ctx.theme) ?? match;
11103
11507
  if (layer) return {
11104
11508
  matcher: rest,
11105
11509
  layer
@@ -11113,7 +11517,7 @@ const variantScope = {
11113
11517
  const variant = variantGetBracket("scope-", matcher, ctx.generator.config.separators);
11114
11518
  if (variant) {
11115
11519
  const [match, rest] = variant;
11116
- const scope = h.bracket(match);
11520
+ const scope = h.bracket(match, ctx.theme);
11117
11521
  if (scope) return {
11118
11522
  matcher: rest,
11119
11523
  selector: (s) => `${scope} $$ ${s}`
@@ -11133,7 +11537,7 @@ const variantVariables = {
11133
11537
  break;
11134
11538
  }
11135
11539
  if (newMatcher == null) return;
11136
- const variant = h.bracket(match) ?? "";
11540
+ const variant = h.bracket(match, ctx.theme) ?? "";
11137
11541
  const useParent = variant.startsWith("@");
11138
11542
  if (!(useParent || variant.includes("&"))) return;
11139
11543
  return {
@@ -11174,7 +11578,7 @@ const variantImplicitGroup = {
11174
11578
  const variant = variantGetParameter("in-", matcher, ctx.generator.config.separators);
11175
11579
  if (variant) {
11176
11580
  const [match, rest] = variant;
11177
- const group = h.bracket(match) ?? match;
11581
+ const group = h.bracket(match, ctx.theme) ?? match;
11178
11582
  if (group) return {
11179
11583
  matcher: rest,
11180
11584
  handle: (input, next) => next({
@@ -11226,7 +11630,7 @@ const variantNegative = {
11226
11630
  return {
11227
11631
  matcher: matcher.slice(1),
11228
11632
  body: (body) => {
11229
- if (body.find((v) => v[0] === "$$mini-no-negative")) return;
11633
+ if (body.some((v) => v[0] === "$$mini-no-negative")) return;
11230
11634
  let changed = false;
11231
11635
  for (const v of body) {
11232
11636
  const [prop, rawValue, meta] = v;
@@ -11249,12 +11653,12 @@ const placeholderModifier = (input, { theme }) => {
11249
11653
  const m = input.match(/^(.*)\b(placeholder-)(.+)$/);
11250
11654
  if (m) {
11251
11655
  const [, pre = "", p, body] = m;
11252
- if (hasParseableColor(body, theme) || hasOpacityValue(body)) return { matcher: `${pre}placeholder-$ ${p}${body}` };
11656
+ if (hasParseableColor(body, theme) || hasOpacityValue(body, theme)) return { matcher: `${pre}placeholder-$ ${p}${body}` };
11253
11657
  }
11254
11658
  };
11255
- function hasOpacityValue(body) {
11659
+ function hasOpacityValue(body, theme) {
11256
11660
  const match = body.match(/^op(?:acity)?-?(.+)$/);
11257
- if (match && match[1] != null) return h.bracket.percent(match[1]) != null;
11661
+ if (match && match[1] != null) return h.bracket.percent(match[1], theme) != null;
11258
11662
  return false;
11259
11663
  }
11260
11664
  function variantPseudoClassesAndElements() {
@@ -11298,7 +11702,7 @@ const variantSupports = {
11298
11702
  const variant = variantGetParameter("supports-", matcher, ctx.generator.config.separators);
11299
11703
  if (variant) {
11300
11704
  const [match, rest] = variant;
11301
- let supports = h.bracket(match) ?? "";
11705
+ let supports = h.bracket(match, ctx.theme) ?? "";
11302
11706
  if (supports === "") supports = ctx.theme.supports?.[match] ?? "";
11303
11707
  if (supports) {
11304
11708
  if (!(supports.startsWith("(") && supports.endsWith(")"))) supports = `(${supports})`;
@@ -12024,6 +12428,8 @@ const frameworkConfigRE = /^(?:vite|svelte|astro|iles|nuxt|unocss|uno)\.config/;
12024
12428
  const unoConfigRE = /\buno(?:css)?\.config\./;
12025
12429
  const excludeFileRE = /[\\/](?:node_modules|dist|\.temp|\.cache)[\\/]/;
12026
12430
  var ContextManager = class {
12431
+ cwd;
12432
+ connection;
12027
12433
  ready;
12028
12434
  contextsMap = /* @__PURE__ */ new Map();
12029
12435
  configSources = [];
@@ -12284,8 +12690,11 @@ const defaultSettings = {
12284
12690
  //#endregion
12285
12691
  //#region src/utils/color.ts
12286
12692
  const matchCssVarNameRE = /var\((?<cssVarName>--[^,|)]+)(?:,(?<fallback>[^)]+))?\)/g;
12287
- const cssColorRE = /(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{6})\b|(?:rgb|rgba|hsl|hsla|oklch)\(.*\)/g;
12693
+ const cssColorSource = String.raw`(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{4}|[a-f0-9]{6}|[a-f0-9]{8})\b|(?:rgb|rgba|hsl|hsla|oklch)\([^)]*\)`;
12694
+ const cssColorRE = new RegExp(cssColorSource, "g");
12288
12695
  const varFnRE = /var\((--[^,|)]+)(?:,([^)]+))?\)/;
12696
+ const cssColorPropertyRE = /(?:^|[;{]\s*)(?:[\w-]+-color|color|fill|stroke)\s*:\s*(?<value>[^;}{]+)/gm;
12697
+ const colorMixWithWeightRE = new RegExp(String.raw`color-mix\([^,]+,\s*(?<color>${cssColorSource})\s+(?<weight>\d+(?:\.\d+)?%)\s*,\s*transparent\s*\)`, "i");
12289
12698
  function getCssVariables(code) {
12290
12699
  const regex = /(?<key>--[^\s:]+):(?<value>.+?)[!;]/g;
12291
12700
  const cssVariables = /* @__PURE__ */ new Map();
@@ -12295,6 +12704,49 @@ function getCssVariables(code) {
12295
12704
  }
12296
12705
  return cssVariables;
12297
12706
  }
12707
+ function resolveVarToken(value, cssVars) {
12708
+ let nextValue = value.trim();
12709
+ while (nextValue.startsWith("var(")) {
12710
+ const varMatch = nextValue.match(varFnRE);
12711
+ if (!varMatch) break;
12712
+ const varName = varMatch[1];
12713
+ const fallback = varMatch[2]?.trim();
12714
+ const cssVarValue = cssVars.get(varName)?.trim();
12715
+ if (cssVarValue) {
12716
+ nextValue = cssVarValue;
12717
+ continue;
12718
+ }
12719
+ if (fallback) return fallback;
12720
+ return "1";
12721
+ }
12722
+ return nextValue;
12723
+ }
12724
+ function resolveCssVars(value, cssVars) {
12725
+ let output = value;
12726
+ for (const match of value.matchAll(matchCssVarNameRE)) {
12727
+ const matchedString = match[0];
12728
+ const cssVarName = match.groups?.cssVarName;
12729
+ const fallback = match.groups?.fallback;
12730
+ if (!cssVarName) continue;
12731
+ const cssVarValue = cssVars.get(cssVarName);
12732
+ if (cssVarValue) output = output.replaceAll(matchedString, resolveVarToken(cssVarValue, cssVars));
12733
+ else if (fallback) output = output.replaceAll(matchedString, fallback);
12734
+ }
12735
+ return output.replaceAll(/,?\s+var\(--.*?\)/g, "");
12736
+ }
12737
+ function getColorStringFromValue(value, cssVars) {
12738
+ const resolvedValue = resolveCssVars(value, cssVars);
12739
+ const colorMixMatch = resolvedValue.match(colorMixWithWeightRE);
12740
+ if (colorMixMatch?.groups?.color) {
12741
+ const colorFromMix = colorMixMatch.groups.color;
12742
+ const weight = colorMixMatch.groups.weight;
12743
+ if (colorFromMix) return /\//.test(colorFromMix) ? colorFromMix : colorFromMix.replace(/\)$/, ` / ${weight})`);
12744
+ }
12745
+ let colorString = resolvedValue.match(cssColorRE)?.[0];
12746
+ if (!colorString) return;
12747
+ if (/\/\)/.test(colorString)) colorString = colorString.replace(/ \/\)/g, "/ 1)");
12748
+ return colorString;
12749
+ }
12298
12750
  /**
12299
12751
  * Get CSS color string from CSS string
12300
12752
  *
@@ -12327,56 +12779,25 @@ function getCssVariables(code) {
12327
12779
  * @returns The **first** CSS color string (hex, rgb[a], hsl[a]) or `undefined`
12328
12780
  */
12329
12781
  function getColorString(str) {
12330
- let colorString = str.match(cssColorRE)?.[0];
12331
- if (!colorString) return;
12332
12782
  const cssVars = getCssVariables(str);
12333
- for (const match of colorString.matchAll(matchCssVarNameRE)) {
12334
- const matchedString = match[0];
12335
- const cssVarName = match.groups?.cssVarName;
12336
- const fallback = match.groups?.fallback;
12337
- if (cssVarName && cssVars.get(cssVarName)) colorString = colorString.replaceAll(matchedString, () => {
12338
- let v = cssVars.get(cssVarName) ?? matchedString;
12339
- while (v && v.startsWith("var(")) {
12340
- const varName = v.match(varFnRE)?.[1];
12341
- if (!varName) {
12342
- v = "";
12343
- break;
12344
- }
12345
- v = cssVars.get(varName) || "";
12346
- }
12347
- return v || "1";
12348
- });
12349
- else if (fallback) colorString = colorString.replaceAll(matchedString, fallback);
12350
- colorString = colorString.replaceAll(/,?\s+var\(--.*?\)/g, "");
12783
+ for (const match of str.matchAll(cssColorPropertyRE)) {
12784
+ const value = match.groups?.value;
12785
+ if (!value) continue;
12786
+ const color = getColorStringFromValue(value, cssVars);
12787
+ if (color) return color;
12351
12788
  }
12352
- if (/\/\)/.test(colorString)) colorString = colorString.replace(/ \/\)/g, "/ 1)");
12353
- return convertToRGBA(colorString);
12354
- }
12355
- const reRgbFn = /rgb\((\d+)\s+(\d+)\s+(\d+)\s*\/\s*([\d.]+)\)/;
12356
- function convertToRGBA(rgbColor) {
12357
- const match = rgbColor.match(reRgbFn);
12358
- if (match) return `rgba(${Number.parseInt(match[1].trim())}, ${Number.parseInt(match[2].trim())}, ${Number.parseInt(match[3].trim())}, ${Number.parseFloat(match[4].trim())})`;
12359
- return rgbColor;
12789
+ return getColorStringFromValue(str, cssVars);
12360
12790
  }
12361
12791
  function parseColorToRGBA(colorString) {
12362
- const rgbaMatch = colorString.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
12363
- if (rgbaMatch) return {
12364
- red: Number.parseInt(rgbaMatch[1]) / 255,
12365
- green: Number.parseInt(rgbaMatch[2]) / 255,
12366
- blue: Number.parseInt(rgbaMatch[3]) / 255,
12367
- alpha: rgbaMatch[4] ? Number.parseFloat(rgbaMatch[4]) : 1
12792
+ const color = colordx(colorString);
12793
+ if (!color.isValid()) return void 0;
12794
+ const rgb = color.toRgb();
12795
+ return {
12796
+ red: rgb.r / 255,
12797
+ green: rgb.g / 255,
12798
+ blue: rgb.b / 255,
12799
+ alpha: rgb.alpha
12368
12800
  };
12369
- const hexMatch = colorString.match(/^#([a-f0-9]{3,6})$/i);
12370
- if (hexMatch) {
12371
- let hex = hexMatch[1];
12372
- if (hex.length === 3) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
12373
- return {
12374
- red: Number.parseInt(hex.slice(0, 2), 16) / 255,
12375
- green: Number.parseInt(hex.slice(2, 4), 16) / 255,
12376
- blue: Number.parseInt(hex.slice(4, 6), 16) / 255,
12377
- alpha: 1
12378
- };
12379
- }
12380
12801
  }
12381
12802
  //#endregion
12382
12803
  //#region src/utils/css.ts
@@ -12404,9 +12825,9 @@ function addRemToPxComment(str, remToPixel = 16) {
12404
12825
  output.push(str.slice(index));
12405
12826
  return output.join("");
12406
12827
  }
12407
- async function getCSS(uno, utilName) {
12828
+ async function getCSS(uno, utilName, preflights = false) {
12408
12829
  const { css } = await uno.generate(new Set(toArray(utilName)), {
12409
- preflights: false,
12830
+ preflights,
12410
12831
  safelist: false
12411
12832
  });
12412
12833
  return css;
@@ -12417,7 +12838,7 @@ async function getPrettiedCSS(uno, util, remToPxRatio) {
12417
12838
  safelist: false
12418
12839
  });
12419
12840
  const css = addRemToPxComment(result.css, remToPxRatio);
12420
- const prettified = prettier.format(css, {
12841
+ const prettified = await prettier.format(css, {
12421
12842
  parser: "css",
12422
12843
  plugins: [parserCSS]
12423
12844
  });
@@ -12430,4 +12851,4 @@ async function getPrettiedMarkdown(uno, util, remToPxRatio) {
12430
12851
  return `\`\`\`css\n${(await getPrettiedCSS(uno, util, remToPxRatio)).prettified.trimEnd()}\n\`\`\``;
12431
12852
  }
12432
12853
  //#endregion
12433
- export { ContextManager, addRemToPxComment, clearDocumentCache, convertToRGBA, defaultSettings, getCSS, getColorString, getMatchedPositionsFromCode, getMatchedPositionsFromDoc, getPrettiedCSS, getPrettiedMarkdown, isSubdir, isVueWithPug, parseColorToRGBA, shouldProvideAutocomplete };
12854
+ export { ContextManager, addRemToPxComment, clearDocumentCache, defaultSettings, getCSS, getColorString, getMatchedPositionsFromCode, getMatchedPositionsFromDoc, getPrettiedCSS, getPrettiedMarkdown, isSubdir, isVueWithPug, parseColorToRGBA, shouldProvideAutocomplete, __require$1 as t };