@unocss/language-server 66.6.8 → 66.7.0

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";
12
- import parserCSS from "prettier/parser-postcss.js";
13
- import prettier from "prettier/standalone.js";
9
+ import process$1 from "node:process";
10
+ import { createRecoveryConfigLoader } from "@unocss/config";
11
+ import { colordx } from "@colordx/core";
12
+ import parserCSS from "prettier/parser-postcss";
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.
@@ -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-DIrlUwzK.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 {
@@ -3448,6 +3798,7 @@ var collections_default = [
3448
3798
  "pepicons",
3449
3799
  "ph",
3450
3800
  "picon",
3801
+ "pinhead",
3451
3802
  "pixel",
3452
3803
  "pixelarticons",
3453
3804
  "prime",
@@ -3660,9 +4011,9 @@ async function parseIconWithLoader(body, loader, options = {}, safeCollectionsNa
3660
4011
  };
3661
4012
  }
3662
4013
  //#endregion
3663
- //#region ../../packages-presets/preset-icons/dist/cdn-DYTPkoFm.mjs
4014
+ //#region ../../packages-presets/preset-icons/dist/cdn-B5KlXljx.mjs
3664
4015
  async function createCDNLoader(cdnBase) {
3665
- const { $fetch } = await import("./node-D23LglTq.mjs");
4016
+ const { $fetch } = await import("./node-oThp98aD.mjs");
3666
4017
  return createCDNFetchLoader($fetch, cdnBase);
3667
4018
  }
3668
4019
  //#endregion
@@ -3701,7 +4052,7 @@ const presetIcons = /* @__PURE__ */ definePreset((options = {}) => {
3701
4052
  });
3702
4053
  async function createNodeLoader() {
3703
4054
  try {
3704
- return await import("./node-loader-ZSa5xzQw.mjs").then((i) => i?.loadNodeIcon);
4055
+ return await import("./node-loader-CKcohGec.mjs").then((i) => i?.loadNodeIcon);
3705
4056
  } catch {}
3706
4057
  try {
3707
4058
  return __require("@iconify/utils/lib/loader/node-loader.cjs").loadNodeIcon;
@@ -4033,7 +4384,7 @@ function transformThemeFn(code, theme, throwOnMissing = true) {
4033
4384
  }
4034
4385
  function transformThemeString(code, theme, throwOnMissing = true) {
4035
4386
  const [rawKey, alpha] = code.split("/");
4036
- 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);
4037
4388
  if (typeof value === "object") value = value.DEFAULT;
4038
4389
  if (typeof value === "string") {
4039
4390
  if (alpha) {
@@ -4044,8 +4395,7 @@ function transformThemeString(code, theme, throwOnMissing = true) {
4044
4395
  } else if (throwOnMissing) throw new Error(`theme of "${code}" did not found`);
4045
4396
  }
4046
4397
  function calcMaxWidthBySize(size) {
4047
- var _size$match;
4048
- 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] || "";
4049
4399
  const unit = size.slice(value.length);
4050
4400
  if (unit === "px") {
4051
4401
  const maxWidth = Number.parseFloat(value) - .1;
@@ -4055,8 +4405,7 @@ function calcMaxWidthBySize(size) {
4055
4405
  }
4056
4406
  function createValueHandler(handlers) {
4057
4407
  const handler = function(str, theme) {
4058
- var _this$__options;
4059
- const s = ((_this$__options = this.__options) === null || _this$__options === void 0 ? void 0 : _this$__options.sequence) || [];
4408
+ const s = this.__options?.sequence || [];
4060
4409
  this.__options.sequence = [];
4061
4410
  for (const n of s) {
4062
4411
  const res = handlers[n](str, theme);
@@ -4172,13 +4521,12 @@ function createTaggedPseudoClassMatcher(tag, parent, combinator, utils) {
4172
4521
  let pseudoColonRE;
4173
4522
  let pseudoVarRE;
4174
4523
  const matchBracket = (input) => {
4175
- var _rest$split;
4176
4524
  const body = variantGetBracket(`${tag}-`, input, []);
4177
4525
  if (!body) return;
4178
4526
  const [match, rest] = body;
4179
4527
  const bracketValue = h.bracket(match);
4180
4528
  if (bracketValue == null) return;
4181
- 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] ?? "";
4182
4530
  const prefix = `${parent}${escapeSelector(label)}`;
4183
4531
  return [
4184
4532
  label,
@@ -4323,8 +4671,8 @@ function createPseudoClassFunctions(utils) {
4323
4671
  };
4324
4672
  }
4325
4673
  function createTaggedPseudoClasses(options, utils) {
4326
- const attributify = !!(options === null || options === void 0 ? void 0 : options.attributifyPseudo);
4327
- let firstPrefix = (options === null || options === void 0 ? void 0 : options.prefix) ?? "";
4674
+ const attributify = !!options?.attributifyPseudo;
4675
+ let firstPrefix = options?.prefix ?? "";
4328
4676
  firstPrefix = escapeSelector((Array.isArray(firstPrefix) ? firstPrefix : [firstPrefix]).filter(Boolean)[0] ?? "");
4329
4677
  const tagWithPrefix = (tag, combinator) => createTaggedPseudoClassMatcher(tag, attributify ? `[${firstPrefix}${tag}=""]` : `.${firstPrefix}${tag}`, combinator, utils);
4330
4678
  return [
@@ -5848,21 +6196,55 @@ function getVariableWght(axes) {
5848
6196
  if (axes.min === axes.max) return `${axes.min}`;
5849
6197
  return `${axes.min} ${axes.max}`;
5850
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
+ }
5851
6240
  const builtinProviders = {
5852
6241
  google: GoogleFontsProvider,
5853
6242
  bunny: BunnyFontsProvider,
5854
6243
  fontshare: FontshareProvider,
5855
6244
  fontsource: FontSourceProvider,
5856
6245
  coollabs: CoolLabsFontsProvider,
5857
- none: {
5858
- name: "none",
5859
- getPreflight() {
5860
- return "";
5861
- },
5862
- getFontName(font) {
5863
- return font.name;
5864
- }
5865
- }
6246
+ none: NoneProvider,
6247
+ zeoseven: createZeoSevenProvider("zeoseven", "https://fontsapi.zeoseven.com")
5866
6248
  };
5867
6249
  function resolveProvider(provider) {
5868
6250
  if (typeof provider === "string") return builtinProviders[provider];
@@ -5965,7 +6347,7 @@ function createWebFontPreset(fetcher) {
5965
6347
  };
5966
6348
  }
5967
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";
5968
- const defaultFetch = async (url) => (await import("./node-D23LglTq.mjs")).$fetch(url, {
6350
+ const defaultFetch = async (url) => (await import("./node-oThp98aD.mjs")).$fetch(url, {
5969
6351
  headers: { "User-Agent": userAgentWoff2 },
5970
6352
  retry: 3
5971
6353
  });
@@ -6018,7 +6400,7 @@ var __exportAll = (all, no_symbols) => {
6018
6400
  return target;
6019
6401
  };
6020
6402
  //#endregion
6021
- //#region ../../packages-presets/preset-wind4/dist/utils-B60b98El.mjs
6403
+ //#region ../../packages-presets/preset-wind4/dist/utils-CqAvZsCu.mjs
6022
6404
  const PRESET_NAME = "@unocss/preset-wind4";
6023
6405
  const CONTROL_NO_NEGATIVE = "$$mini-no-negative";
6024
6406
  const SpecialColorKey = {
@@ -6150,7 +6532,7 @@ const unitOnlyMap = {
6150
6532
  lvh: 100,
6151
6533
  lvw: 100
6152
6534
  };
6153
- 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;
6154
6536
  const splitComma = /,(?![^()]*\))/g;
6155
6537
  const cssVarsRE = /(?<!var\()--([\w.-]+)(\([^)]+\)|,[#.\s\w]+)?/g;
6156
6538
  var handlers_exports = /* @__PURE__ */ __exportAll({
@@ -6368,7 +6750,7 @@ function bracketOfColor(str, theme) {
6368
6750
  return bracketWithType(str, "color", theme);
6369
6751
  }
6370
6752
  function bracketOfLength(str, theme) {
6371
- return bracketWithType(str, "length", theme) || bracketWithType(str, "size", theme);
6753
+ return bracketWithType(str, "length", theme) || bracketWithType(str, "size", theme) || bracketWithType(str, "width", theme);
6372
6754
  }
6373
6755
  function bracketOfPosition(str, theme) {
6374
6756
  return bracketWithType(str, "position", theme);
@@ -6485,7 +6867,7 @@ function parseColor(body, theme) {
6485
6867
  if (!split) return;
6486
6868
  let opacity;
6487
6869
  let [main, opacityOrModifier, modifier] = split;
6488
- if (isInterpolatedMethod(opacityOrModifier) || isInterpolatedMethod(h.bracket(opacityOrModifier ?? ""))) modifier = opacityOrModifier;
6870
+ if (isInterpolatedMethod(opacityOrModifier) || isInterpolatedMethod(h.bracket(opacityOrModifier ?? "", theme))) modifier = opacityOrModifier;
6489
6871
  else opacity = opacityOrModifier;
6490
6872
  const colors = main.replace(/([a-z])(\d)(?![-_a-z])/g, "$1-$2").split(/-/g);
6491
6873
  const [name] = colors;
@@ -6508,11 +6890,14 @@ function parseColor(body, theme) {
6508
6890
  }
6509
6891
  return {
6510
6892
  opacity,
6511
- modifier: modifier && h.bracket.cssvar(modifier) || modifier,
6893
+ modifier: modifier && h.bracket.cssvar(modifier, theme) || modifier,
6512
6894
  name,
6513
6895
  no,
6514
6896
  color: color ?? SpecialColorKey[name],
6515
- 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
+ */
6516
6901
  keys,
6517
6902
  get cssColor() {
6518
6903
  return parseCssColor(this.color);
@@ -6721,7 +7106,7 @@ function propertyTracking(property, value) {
6721
7106
  if (!trackedProperties.has(property)) trackedProperties.set(property, value);
6722
7107
  }
6723
7108
  //#endregion
6724
- //#region ../../packages-presets/preset-wind4/dist/container-m1WfKD7R.mjs
7109
+ //#region ../../packages-presets/preset-wind4/dist/container-BwY4Hhe2.mjs
6725
7110
  const containerParent = [[/^@container(?:\/(\w+))?(?:-(normal))?$/, ([, l, v]) => {
6726
7111
  return {
6727
7112
  "container-type": v ?? "inline-size",
@@ -6795,7 +7180,7 @@ const verticalAlignAlias = {
6795
7180
  };
6796
7181
  const verticalAligns = [[
6797
7182
  /^(?:vertical|align|v)-(.+)$/,
6798
- ([, v]) => ({ "vertical-align": verticalAlignAlias[v] ?? h.bracket.cssvar.numberWithUnit(v) }),
7183
+ ([, v], { theme }) => ({ "vertical-align": verticalAlignAlias[v] ?? h.bracket.cssvar.numberWithUnit(v, theme) }),
6799
7184
  { autocomplete: [`(vertical|align|v)-(${Object.keys(verticalAlignAlias).join("|")})`, "(vertical|align|v)-<percentage>"] }
6800
7185
  ]];
6801
7186
  const textAlignValues = [
@@ -6830,24 +7215,24 @@ const animations = [
6830
7215
  ...props
6831
7216
  }];
6832
7217
  }
6833
- return { animation: h.bracket.cssvar(name) };
7218
+ return { animation: h.bracket.cssvar(name, theme) };
6834
7219
  },
6835
7220
  { autocomplete: "animate-$animation.keyframes" }
6836
7221
  ],
6837
- [/^animate-name-(.+)/, ([, d]) => ({ "animation-name": h.bracket.cssvar(d) ?? d })],
7222
+ [/^animate-name-(.+)/, ([, d], { theme }) => ({ "animation-name": h.bracket.cssvar(d, theme) ?? d })],
6838
7223
  [
6839
7224
  /^animate-duration-(.+)$/,
6840
- ([, 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) }),
6841
7226
  { autocomplete: ["animate-duration"] }
6842
7227
  ],
6843
7228
  [
6844
7229
  /^animate-delay-(.+)$/,
6845
- ([, 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) }),
6846
7231
  { autocomplete: ["animate-delay"] }
6847
7232
  ],
6848
7233
  [
6849
7234
  /^animate-ease(?:-(.+))?$/,
6850
- ([, 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) }),
6851
7236
  { autocomplete: ["animate-ease", "animate-ease-$ease"] }
6852
7237
  ],
6853
7238
  [
@@ -6882,7 +7267,7 @@ const animations = [
6882
7267
  ],
6883
7268
  [
6884
7269
  /^animate-(?:iteration-count-|iteration-|count-)(.+)$/,
6885
- ([, 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, ",") }),
6886
7271
  { autocomplete: ["animate-(iteration|count|iteration-count)", "animate-(iteration|count|iteration-count)-<num>"] }
6887
7272
  ],
6888
7273
  [
@@ -6964,7 +7349,7 @@ function bgGradientColorResolver() {
6964
7349
  if (keys) themeTracking(`colors`, keys);
6965
7350
  if (theme) detectThemeValue(color, theme);
6966
7351
  }
6967
- } else css[`--un-gradient-${position}`] = h.bracket.cssvar(body);
7352
+ } else css[`--un-gradient-${position}`] = h.bracket.cssvar(body, theme);
6968
7353
  if (css[`--un-gradient-${position}`]) {
6969
7354
  switch (position) {
6970
7355
  case "from":
@@ -6995,18 +7380,18 @@ function bgGradientColorResolver() {
6995
7380
  };
6996
7381
  }
6997
7382
  function bgGradientPositionResolver() {
6998
- return function* ([, mode, body]) {
6999
- 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)}` };
7000
7385
  for (const p of Object.values(properties)) yield p;
7001
7386
  };
7002
7387
  }
7003
7388
  const backgroundStyles = [
7004
7389
  [
7005
7390
  /^bg-(linear|radial|conic)-([^/]+)(?:\/(.+))?$/,
7006
- ([, m, d, s]) => {
7391
+ ([, m, d, s], { theme }) => {
7007
7392
  let v;
7008
7393
  if (h.number(d) != null) v = `from ${h.number(d)}deg ${resolveModifier(s)};`;
7009
- else v = h.bracket(d);
7394
+ else v = h.bracket(d, theme);
7010
7395
  if (v) return {
7011
7396
  "--un-gradient-position": v,
7012
7397
  "background-image": `${m}-gradient(var(--un-gradient-stops))`
@@ -7020,7 +7405,7 @@ const backgroundStyles = [
7020
7405
  ] }
7021
7406
  ],
7022
7407
  [/^(from|via|to|stops)-(.+)$/, bgGradientColorResolver()],
7023
- [/^(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) })],
7024
7409
  [/^(from|via|to)-([\d.]+%)$/, bgGradientPositionResolver()],
7025
7410
  [
7026
7411
  /^bg-((?:repeating-)?(?:linear|radial|conic))$/,
@@ -7055,7 +7440,7 @@ const backgroundStyles = [
7055
7440
  ["bg-auto", { "background-size": "auto" }],
7056
7441
  ["bg-cover", { "background-size": "cover" }],
7057
7442
  ["bg-contain", { "background-size": "contain" }],
7058
- [/^bg-size-(.+)$/, ([, v]) => ({ "background-size": h.bracket.cssvar(v) })],
7443
+ [/^bg-size-(.+)$/, ([, v], { theme }) => ({ "background-size": h.bracket.cssvar(v, theme) })],
7059
7444
  ["bg-fixed", { "background-attachment": "fixed" }],
7060
7445
  ["bg-local", { "background-attachment": "local" }],
7061
7446
  ["bg-scroll", { "background-attachment": "scroll" }],
@@ -7105,12 +7490,12 @@ const outline = [
7105
7490
  ],
7106
7491
  [
7107
7492
  /^outline-op(?:acity)?-?(.+)$/,
7108
- ([, opacity]) => ({ "--un-outline-opacity": h.bracket.percent.cssvar(opacity) }),
7493
+ ([, opacity], { theme }) => ({ "--un-outline-opacity": h.bracket.percent.cssvar(opacity, theme) }),
7109
7494
  { autocomplete: "outline-(op|opacity)-<percent>" }
7110
7495
  ],
7111
7496
  [
7112
7497
  /^outline-offset-(.+)$/,
7113
- ([, d]) => ({ "outline-offset": h.bracket.cssvar.global.px(d) }),
7498
+ ([, d], { theme }) => ({ "outline-offset": h.bracket.cssvar.global.px(d, theme) }),
7114
7499
  { autocomplete: "outline-(offset)-<num>" }
7115
7500
  ],
7116
7501
  ["outline-offset-none", { "outline-offset": "0" }],
@@ -7143,8 +7528,8 @@ const outline = [
7143
7528
  "outline-style": v
7144
7529
  }])
7145
7530
  ];
7146
- function* handleWidth$2([, b]) {
7147
- const v = h.bracket.cssvar.global.px(b);
7531
+ function* handleWidth$2([, b], { theme }) {
7532
+ const v = h.bracket.cssvar.global.px(b, theme);
7148
7533
  if (v != null) {
7149
7534
  yield {
7150
7535
  "outline-style": "var(--un-outline-style)",
@@ -7154,7 +7539,7 @@ function* handleWidth$2([, b]) {
7154
7539
  }
7155
7540
  }
7156
7541
  function* handleColorOrWidth$2(match, ctx) {
7157
- if (isCSSMathFn(h.bracket(match[1]))) yield* handleWidth$2(match);
7542
+ if (isCSSMathFn(h.bracket(match[1], ctx.theme))) yield* handleWidth$2(match, ctx);
7158
7543
  else {
7159
7544
  const result = colorResolver("outline-color", "outline")(match, ctx);
7160
7545
  if (result) for (const i of result) yield i;
@@ -7167,15 +7552,15 @@ const appearance = [["appearance-auto", {
7167
7552
  "-webkit-appearance": "none",
7168
7553
  "appearance": "none"
7169
7554
  }]];
7170
- function willChangeProperty(prop) {
7171
- const v = h.bracket(prop);
7555
+ function willChangeProperty(prop, theme) {
7556
+ const v = h.bracket(prop, theme);
7172
7557
  if (v && h.properties(v)) return v;
7173
7558
  return h.properties.auto.cssvar.global(prop) ?? {
7174
7559
  contents: "contents",
7175
7560
  scroll: "scroll-position"
7176
7561
  }[prop];
7177
7562
  }
7178
- const willChange = [[/^will-change-(.+)/, ([, p]) => ({ "will-change": willChangeProperty(p) })]];
7563
+ const willChange = [[/^will-change-(.+)/, ([, p], { theme }) => ({ "will-change": willChangeProperty(p, theme) })]];
7179
7564
  const listStyles = {
7180
7565
  "disc": "disc",
7181
7566
  "circle": "circle",
@@ -7208,8 +7593,8 @@ const listStyle = [
7208
7593
  ["list-outside", { "list-style-position": "outside" }],
7209
7594
  ["list-inside", { "list-style-position": "inside" }],
7210
7595
  ["list-none", { "list-style-type": "none" }],
7211
- [/^list-image-(.+)$/, ([, d]) => {
7212
- 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) };
7213
7598
  }],
7214
7599
  ["list-image-none", { "list-style-image": "none" }],
7215
7600
  ...makeGlobalStaticRules("list", "list-style-type")
@@ -7220,7 +7605,7 @@ const accents = [[
7220
7605
  { autocomplete: "accent-$colors" }
7221
7606
  ], [
7222
7607
  /^accent-op(?:acity)?-?(.+)$/,
7223
- ([, d]) => ({ "--un-accent-opacity": h.bracket.percent(d) }),
7608
+ ([, d], { theme }) => ({ "--un-accent-opacity": h.bracket.percent(d, theme) }),
7224
7609
  { autocomplete: ["accent-(op|opacity)", "accent-(op|opacity)-<percent>"] }
7225
7610
  ]];
7226
7611
  const carets = [[
@@ -7229,7 +7614,7 @@ const carets = [[
7229
7614
  { autocomplete: "caret-$colors" }
7230
7615
  ], [
7231
7616
  /^caret-op(?:acity)?-?(.+)$/,
7232
- ([, d]) => ({ "--un-caret-opacity": h.bracket.percent(d) }),
7617
+ ([, d], { theme }) => ({ "--un-caret-opacity": h.bracket.percent(d, theme) }),
7233
7618
  { autocomplete: ["caret-(op|opacity)", "caret-(op|opacity)-<percent>"] }
7234
7619
  ]];
7235
7620
  const imageRenderings = [
@@ -7354,19 +7739,24 @@ function borderColorResolver(direction) {
7354
7739
  }
7355
7740
  };
7356
7741
  }
7357
- function handlerBorderSize([, a = "", b = "1"]) {
7358
- 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);
7359
7744
  if (a in directionMap && v != null) return directionMap[a].map((i) => [`border${i}-width`, v]);
7360
7745
  }
7361
7746
  function handlerBorderColorOrSize([, a = "", b], ctx) {
7362
7747
  if (a in directionMap) {
7363
- if (isCSSMathFn(h.bracket(b))) return handlerBorderSize([
7748
+ if (isCSSMathFn(h.bracket(b, ctx.theme))) return handlerBorderSize([
7364
7749
  "",
7365
7750
  a,
7366
7751
  b
7367
- ]);
7368
- if (hasParseableColor(b, ctx.theme)) {
7369
- 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);
7370
7760
  return [directions.map((d) => d[0]).reduce((acc, item) => {
7371
7761
  Object.assign(acc, item);
7372
7762
  return acc;
@@ -7374,14 +7764,14 @@ function handlerBorderColorOrSize([, a = "", b], ctx) {
7374
7764
  }
7375
7765
  }
7376
7766
  }
7377
- function handlerBorderOpacity([, a = "", opacity]) {
7378
- const v = h.bracket.percent.cssvar(opacity);
7767
+ function handlerBorderOpacity([, a = "", opacity], { theme }) {
7768
+ const v = h.bracket.percent.cssvar(opacity, theme);
7379
7769
  if (a in directionMap && v != null) return directionMap[a].map((i) => [`--un-border${i}-opacity`, v]);
7380
7770
  }
7381
7771
  function handlerRounded([, a = "", s = "DEFAULT"], { theme }) {
7382
7772
  if (a in cornerMap) {
7383
7773
  if (s === "full") return cornerMap[a].map((i) => [`border${i}-radius`, "calc(infinity * 1px)"]);
7384
- 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);
7385
7775
  if (_v != null) {
7386
7776
  const isVar = theme.radius && s in theme.radius;
7387
7777
  if (isVar) themeTracking(`radius`, s);
@@ -7395,7 +7785,7 @@ function handlerBorderStyle([, a = "", s]) {
7395
7785
  /**
7396
7786
  * @example op10 op-30 opacity-100
7397
7787
  */
7398
- 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) })]];
7399
7789
  const bgUrlRE = /^\[url\(.+\)\]$/;
7400
7790
  const bgLengthRE = /^\[(?:length|size):.+\]$/;
7401
7791
  const bgPositionRE = /^\[position:.+\]$/;
@@ -7403,27 +7793,27 @@ const bgGradientRE = /^\[(?:linear|conic|radial)-gradient\(.+\)\]$/;
7403
7793
  const bgImageRE = /^\[image:.+\]$/;
7404
7794
  const bgColors = [[
7405
7795
  /^bg-(.+)$/,
7406
- (...args) => {
7407
- const d = args[0][1];
7796
+ (match, ctx) => {
7797
+ const d = match[1];
7798
+ const { theme } = ctx;
7408
7799
  if (bgUrlRE.test(d)) return {
7409
- "--un-url": h.bracket(d),
7800
+ "--un-url": h.bracket(d, theme),
7410
7801
  "background-image": "var(--un-url)"
7411
7802
  };
7412
- 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(" ") };
7413
- 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(" ") };
7414
7807
  if (bgGradientRE.test(d) || bgImageRE.test(d)) {
7415
- const s = h.bracket(d);
7416
- if (s) {
7417
- const url = s.startsWith("http") ? `url(${s})` : h.cssvar(s);
7418
- return { "background-image": url ?? s };
7419
- }
7808
+ const s = h.bracket(d, theme);
7809
+ if (s) return { "background-image": (s.startsWith("http") ? `url(${s})` : h.cssvar(s)) ?? s };
7420
7810
  }
7421
- return colorResolver("background-color", "bg")(...args);
7811
+ return colorResolver("background-color", "bg")(match, ctx);
7422
7812
  },
7423
7813
  { autocomplete: "bg-$colors" }
7424
7814
  ], [
7425
7815
  /^bg-op(?:acity)?-?(.+)$/,
7426
- ([, opacity]) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity) }),
7816
+ ([, opacity], { theme }) => ({ "--un-bg-opacity": h.bracket.percent.cssvar(opacity, theme) }),
7427
7817
  { autocomplete: "bg-(op|opacity)-<percent>" }
7428
7818
  ]];
7429
7819
  const colorScheme = [[/^(?:color-)?scheme-(.+)$/, ([, v]) => ({ "color-scheme": v.split("-").join(" ") })]];
@@ -7435,7 +7825,7 @@ const columns = [
7435
7825
  themeTracking("container", v);
7436
7826
  return { columns: generateThemeVariable("container", v) };
7437
7827
  }
7438
- return { columns: h.bracket.numberWithUnit.number.cssvar(v) };
7828
+ return { columns: h.bracket.numberWithUnit.number.cssvar(v, theme) };
7439
7829
  },
7440
7830
  { autocomplete: ["columns-<num>", "columns-$container"] }
7441
7831
  ],
@@ -7495,12 +7885,12 @@ const textDecorations = [
7495
7885
  ],
7496
7886
  [
7497
7887
  /^(?:underline|decoration)-op(?:acity)?-?(.+)$/,
7498
- ([, opacity]) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity) }),
7888
+ ([, opacity], { theme }) => ({ "--un-line-opacity": h.bracket.percent.cssvar(opacity, theme) }),
7499
7889
  { autocomplete: "(underline|decoration)-(op|opacity)-<percent>" }
7500
7890
  ],
7501
7891
  [
7502
7892
  /^(?:underline|decoration)-offset-(.+)$/,
7503
- ([, 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) }),
7504
7894
  { autocomplete: "(underline|decoration)-(offset)-<num>" }
7505
7895
  ],
7506
7896
  ...decorationStyles.map((v) => [`underline-${v}`, { "text-decoration-style": v }]),
@@ -7508,11 +7898,11 @@ const textDecorations = [
7508
7898
  ["no-underline", { "text-decoration": "none" }],
7509
7899
  ["decoration-none", { "text-decoration": "none" }]
7510
7900
  ];
7511
- function handleWidth$1([, b]) {
7512
- 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) };
7513
7903
  }
7514
7904
  function handleColorOrWidth$1(match, ctx) {
7515
- if (isCSSMathFn(h.bracket(match[1]))) return handleWidth$1(match);
7905
+ if (isCSSMathFn(h.bracket(match[1], ctx.theme))) return handleWidth$1(match, ctx);
7516
7906
  const result = colorResolver("text-decoration-color", "line")(match, ctx);
7517
7907
  if (result) {
7518
7908
  const css = result[0];
@@ -7574,6 +7964,7 @@ const spaces = [[
7574
7964
  function notLastChildSelectorVariant(s) {
7575
7965
  return {
7576
7966
  matcher: s,
7967
+ order: 1,
7577
7968
  handle: (input, next) => next({
7578
7969
  ...input,
7579
7970
  parent: `${input.parent ? `${input.parent} $$ ` : ""}${input.selector}`,
@@ -7587,7 +7978,7 @@ function* handlerSpace([m, d, s], { theme, symbols }) {
7587
7978
  if (num != null) {
7588
7979
  themeTracking(`spacing`);
7589
7980
  v = `calc(var(--spacing) * ${num})`;
7590
- } 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);
7591
7982
  if (v != null) {
7592
7983
  const results = directionMap[d === "x" ? "inline" : "block"].map((item, index) => {
7593
7984
  return [`margin${item}`, `calc(${v} * ${index === 0 ? `var(--un-space-${d}-reverse)` : `calc(1 - var(--un-space-${d}-reverse))`})`];
@@ -7619,10 +8010,10 @@ const divides = [
7619
8010
  ],
7620
8011
  [
7621
8012
  /^divide-op(?:acity)?-?(.+)$/,
7622
- function* ([match, opacity], { symbols }) {
8013
+ function* ([match, opacity], { symbols, theme }) {
7623
8014
  yield {
7624
8015
  [symbols.variants]: [notLastChildSelectorVariant(match)],
7625
- "--un-divide-opacity": h.bracket.percent(opacity)
8016
+ "--un-divide-opacity": h.bracket.percent(opacity, theme)
7626
8017
  };
7627
8018
  },
7628
8019
  { autocomplete: ["divide-(op|opacity)", "divide-(op|opacity)-<percent>"] }
@@ -7651,8 +8042,8 @@ const divides = [
7651
8042
  { autocomplete: borderStyles.map((i) => `divide-${i}`) }
7652
8043
  ]
7653
8044
  ];
7654
- function* handlerDivide([m, d, s], { symbols }) {
7655
- 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);
7656
8047
  if (v != null) {
7657
8048
  if (v === "0") v = "0px";
7658
8049
  const results = {
@@ -7699,8 +8090,8 @@ const backdropBaseKeys = [
7699
8090
  ];
7700
8091
  const backdropProperties = backdropBaseKeys.map((i) => defineProperty(`--un-${i}`));
7701
8092
  const backdropCSS = backdropBaseKeys.map((i) => `var(--un-${i},)`).join(" ");
7702
- function percentWithDefault(str) {
7703
- let v = h.bracket.cssvar(str || "");
8093
+ function percentWithDefault(str, theme) {
8094
+ let v = h.bracket.cssvar(str || "", theme);
7704
8095
  if (v != null) return v;
7705
8096
  v = str ? h.percent(str) : "100%";
7706
8097
  if (v != null && Number.parseFloat(v.slice(0, -1)) <= 100) return v;
@@ -7728,9 +8119,9 @@ function dropShadowResolver(match, ctx) {
7728
8119
  if (s.startsWith("/")) res = ["", s.slice(1)];
7729
8120
  }
7730
8121
  let v = theme.dropShadow?.[res[0] || "DEFAULT"];
7731
- const c = s ? h.bracket.cssvar(s) : void 0;
8122
+ const c = s ? h.bracket.cssvar(s, theme) : void 0;
7732
8123
  if ((v != null || c != null) && !hasParseableColor(c, theme)) {
7733
- 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;
7734
8125
  return [{
7735
8126
  "--un-drop-shadow-opacity": alpha,
7736
8127
  "--un-drop-shadow": `drop-shadow(${colorableShadows(v || c, "--un-drop-shadow-color", alpha).join(") drop-shadow(")})`,
@@ -7738,7 +8129,7 @@ function dropShadowResolver(match, ctx) {
7738
8129
  }, ...filterProperties];
7739
8130
  }
7740
8131
  if (hasParseableColor(s, theme)) return colorResolver("--un-drop-shadow-color", "drop-shadow")(match, ctx);
7741
- v = h.bracket.cssvar(s) ?? (s === "none" ? "" : void 0);
8132
+ v = h.bracket.cssvar(s, theme) ?? (s === "none" ? "" : void 0);
7742
8133
  if (v != null) return [{
7743
8134
  "--un-drop-shadow": v ? `drop-shadow(${v})` : v,
7744
8135
  "filter": filterCSS
@@ -7747,7 +8138,7 @@ function dropShadowResolver(match, ctx) {
7747
8138
  const filters = [
7748
8139
  [
7749
8140
  /^(?:(backdrop-)|filter-)?blur(?:-(.+))?$/,
7750
- 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)),
7751
8142
  { autocomplete: [
7752
8143
  "(backdrop|filter)-blur-$blur",
7753
8144
  "blur-$blur",
@@ -7756,12 +8147,12 @@ const filters = [
7756
8147
  ],
7757
8148
  [
7758
8149
  /^(?:(backdrop-)|filter-)?brightness-(.+)$/,
7759
- toFilter("brightness", (s) => h.bracket.cssvar.percent(s)),
8150
+ toFilter("brightness", (s, theme) => h.bracket.cssvar.percent(s, theme)),
7760
8151
  { autocomplete: ["(backdrop|filter)-brightness-<percent>", "brightness-<percent>"] }
7761
8152
  ],
7762
8153
  [
7763
8154
  /^(?:(backdrop-)|filter-)?contrast-(.+)$/,
7764
- toFilter("contrast", (s) => h.bracket.cssvar.percent(s)),
8155
+ toFilter("contrast", (s, theme) => h.bracket.cssvar.percent(s, theme)),
7765
8156
  { autocomplete: ["(backdrop|filter)-contrast-<percent>", "contrast-<percent>"] }
7766
8157
  ],
7767
8158
  [
@@ -7786,7 +8177,7 @@ const filters = [
7786
8177
  ] }
7787
8178
  ],
7788
8179
  [/^(?:filter-)?drop-shadow-color-(.+)$/, colorResolver("--un-drop-shadow-color", "drop-shadow")],
7789
- [/^(?: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) })],
7790
8181
  [
7791
8182
  /^(?:(backdrop-)|filter-)?grayscale(?:-(.+))?$/,
7792
8183
  toFilter("grayscale", percentWithDefault),
@@ -7796,7 +8187,7 @@ const filters = [
7796
8187
  "grayscale-<percent>"
7797
8188
  ] }
7798
8189
  ],
7799
- [/^(?:(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))],
7800
8191
  [
7801
8192
  /^(?:(backdrop-)|filter-)?invert(?:-(.+))?$/,
7802
8193
  toFilter("invert", percentWithDefault),
@@ -7808,12 +8199,12 @@ const filters = [
7808
8199
  ],
7809
8200
  [
7810
8201
  /^(backdrop-)op(?:acity)?-(.+)$/,
7811
- toFilter("opacity", (s) => h.bracket.cssvar.percent(s)),
8202
+ toFilter("opacity", (s, theme) => h.bracket.cssvar.percent(s, theme)),
7812
8203
  { autocomplete: ["backdrop-(op|opacity)", "backdrop-(op|opacity)-<percent>"] }
7813
8204
  ],
7814
8205
  [
7815
8206
  /^(?:(backdrop-)|filter-)?saturate-(.+)$/,
7816
- toFilter("saturate", (s) => h.bracket.cssvar.percent(s)),
8207
+ toFilter("saturate", (s, theme) => h.bracket.cssvar.percent(s, theme)),
7817
8208
  { autocomplete: [
7818
8209
  "(backdrop|filter)-saturate",
7819
8210
  "(backdrop|filter)-saturate-<percent>",
@@ -7849,30 +8240,33 @@ const flex = [
7849
8240
  ["flex", { display: "flex" }],
7850
8241
  ["inline-flex", { display: "inline-flex" }],
7851
8242
  ["flex-inline", { display: "inline-flex" }],
7852
- [/^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
+ }],
7853
8247
  ["flex-1", { flex: "1 1 0%" }],
7854
8248
  ["flex-auto", { flex: "1 1 auto" }],
7855
8249
  ["flex-initial", { flex: "0 1 auto" }],
7856
8250
  ["flex-none", { flex: "none" }],
7857
8251
  [
7858
8252
  /^(?:flex-)?shrink(?:-(.*))?$/,
7859
- ([, d = ""]) => ({ "flex-shrink": h.bracket.cssvar.number(d) ?? 1 }),
8253
+ ([, d = ""], { theme }) => ({ "flex-shrink": h.bracket.cssvar.number(d, theme) ?? 1 }),
7860
8254
  { autocomplete: ["flex-shrink-<num>", "shrink-<num>"] }
7861
8255
  ],
7862
8256
  [
7863
8257
  /^(?:flex-)?grow(?:-(.*))?$/,
7864
- ([, d = ""]) => ({ "flex-grow": h.bracket.cssvar.number(d) ?? 1 }),
8258
+ ([, d = ""], { theme }) => ({ "flex-grow": h.bracket.cssvar.number(d, theme) ?? 1 }),
7865
8259
  { autocomplete: ["flex-grow-<num>", "grow-<num>"] }
7866
8260
  ],
7867
8261
  [
7868
8262
  /^(?:flex-)?basis-(.+)$/,
7869
- ([, d]) => {
8263
+ ([, d], { theme }) => {
7870
8264
  const v = numberResolver(d);
7871
8265
  if (v != null) {
7872
8266
  themeTracking(`spacing`);
7873
8267
  return { "flex-basis": `calc(var(--spacing) * ${v})` };
7874
8268
  }
7875
- return { "flex-basis": h.bracket.cssvar.auto.fraction.rem(d) };
8269
+ return { "flex-basis": h.bracket.cssvar.auto.fraction.rem(d, theme) };
7876
8270
  },
7877
8271
  { autocomplete: ["flex-basis-$spacing", "basis-$spacing"] }
7878
8272
  ],
@@ -7911,54 +8305,54 @@ const gaps = [
7911
8305
  function rowCol(s) {
7912
8306
  return s.replace("col", "column");
7913
8307
  }
7914
- function autoDirection(prop) {
8308
+ function autoDirection(prop, theme) {
7915
8309
  switch (prop) {
7916
8310
  case "min": return "min-content";
7917
8311
  case "max": return "max-content";
7918
8312
  case "fr": return "minmax(0,1fr)";
7919
8313
  }
7920
- return h.bracket.cssvar.auto.rem(prop);
8314
+ return h.bracket.cssvar.auto.rem(prop, theme);
7921
8315
  }
7922
8316
  const grids = [
7923
8317
  ["grid", { display: "grid" }],
7924
8318
  ["inline-grid", { display: "inline-grid" }],
7925
- [/^(?: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) })],
7926
8320
  [
7927
8321
  /^(?:grid-)?(row|col)-span-(.+)$/,
7928
- ([, c, s]) => {
8322
+ ([, c, s], { theme }) => {
7929
8323
  if (s === "full") return { [`grid-${rowCol(c)}`]: "1/-1" };
7930
- const v = h.bracket.number.cssvar(s);
8324
+ const v = h.bracket.number.cssvar(s, theme);
7931
8325
  if (v != null) return { [`grid-${rowCol(c)}`]: `span ${v}/span ${v}` };
7932
8326
  },
7933
8327
  { autocomplete: "(grid-row|grid-col|row|col)-span-<num>" }
7934
8328
  ],
7935
- [/^(?: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 })],
7936
8330
  [
7937
8331
  /^(?:grid-)?(row|col)-end-(.+)$/,
7938
- ([, 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 }),
7939
8333
  { autocomplete: "(grid-row|grid-col|row|col)-(start|end)-<num>" }
7940
8334
  ],
7941
8335
  [
7942
8336
  /^(?:grid-)?auto-(rows|cols)-(.+)$/,
7943
- ([, c, v]) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v) }),
8337
+ ([, c, v], { theme }) => ({ [`grid-auto-${rowCol(c)}`]: autoDirection(v, theme) }),
7944
8338
  { autocomplete: "(grid-auto|auto)-(rows|cols)-<num>" }
7945
8339
  ],
7946
- [/^(?: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) })],
7947
8341
  [
7948
8342
  /^(?:grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)$/,
7949
8343
  ([, v]) => ({ "grid-auto-flow": rowCol(v).replace("-", " ") }),
7950
8344
  { autocomplete: ["(grid-auto-flow|auto-flow|grid-flow)-(row|col|dense|row-dense|col-dense)"] }
7951
8345
  ],
7952
- [/^(?: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) })],
7953
8347
  [/^(?:grid-)?(rows|cols)-minmax-([\w.-]+)$/, ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(auto-fill,minmax(${d},1fr))` })],
7954
8348
  [
7955
8349
  /^(?:grid-)?(rows|cols)-(\d+)$/,
7956
8350
  ([, c, d]) => ({ [`grid-template-${rowCol(c)}`]: `repeat(${d},minmax(0,1fr))` }),
7957
8351
  { autocomplete: "(grid-rows|grid-cols|rows|cols)-<num>" }
7958
8352
  ],
7959
- [/^grid-area(s)?-(.+)$/, ([, s, v]) => {
7960
- if (s != null) return { "grid-template-areas": h.cssvar(v) ?? v.split("-").map((s) => `"${h.bracket(s)}"`).join(" ") };
7961
- 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) };
7962
8356
  }],
7963
8357
  ["grid-rows-none", { "grid-template-rows": "none" }],
7964
8358
  ["grid-cols-none", { "grid-template-columns": "none" }],
@@ -8007,12 +8401,9 @@ const baseMaskImage = {
8007
8401
  "mask-image": "var(--un-mask-linear), var(--un-mask-radial), var(--un-mask-conic)",
8008
8402
  "mask-composite": "intersect"
8009
8403
  };
8010
- function handlePosition([, v = ""]) {
8011
- if (v in cornerMap) {
8012
- const positions = v.split("").flatMap((c) => linearMap[c]).join(" ");
8013
- return { "mask-position": positions };
8014
- }
8015
- 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);
8016
8407
  if (_v !== null) return { "mask-position": _v };
8017
8408
  }
8018
8409
  function handleImage([_, gradient = "", direction, val], ctx) {
@@ -8029,8 +8420,8 @@ function handleImage([_, gradient = "", direction, val], ctx) {
8029
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))`;
8030
8421
  if (numberResolver(val) != null) {
8031
8422
  themeTracking("spacing");
8032
- css[`--un-mask-${dir}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val)})`;
8033
- } 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);
8034
8425
  if (hasParseableColor(val, ctx.theme)) {
8035
8426
  const result = colorResolver(`--un-mask-${dir}-${direction}-color`, hyphenate("colors"))([_, val], ctx);
8036
8427
  if (result) {
@@ -8056,10 +8447,10 @@ function handleImage([_, gradient = "", direction, val], ctx) {
8056
8447
  } else {
8057
8448
  if (direction == null) if (gradient === "radial") {
8058
8449
  css["--un-mask-radial"] = "radial-gradient(var(--un-mask-radial-stops, var(--un-mask-radial-size)))";
8059
- css["--un-mask-radial-size"] = h.bracket.cssvar.rem(val);
8450
+ css["--un-mask-radial-size"] = h.bracket.cssvar.rem(val, ctx.theme);
8060
8451
  } else {
8061
8452
  css[`--un-mask-${gradient}`] = `${gradient}-gradient(var(--un-mask-${gradient}-stops, var(--un-mask-${gradient}-position)))`;
8062
- 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);
8063
8454
  }
8064
8455
  else {
8065
8456
  const gradientStopsPrefixMap = {
@@ -8078,8 +8469,8 @@ function handleImage([_, gradient = "", direction, val], ctx) {
8078
8469
  }
8079
8470
  } else if (numberResolver(val) != null) {
8080
8471
  themeTracking("spacing");
8081
- css[`--un-mask-${gradient}-${direction}-position`] = `calc(var(--spacing) * ${h.bracket.cssvar.fraction.number(val)})`;
8082
- } 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);
8083
8474
  }
8084
8475
  if (gradient === "radial") props.push(...[defineProperty("--un-mask-radial-shape", { initialValue: "ellipse" }), defineProperty("--un-mask-radial-size", { initialValue: "farthest-corner" })]);
8085
8476
  props.push(...["from", "to"].flatMap((p) => [
@@ -8096,8 +8487,8 @@ function handleImage([_, gradient = "", direction, val], ctx) {
8096
8487
  }
8097
8488
  return [css, ...props];
8098
8489
  }
8099
- function handleSize$1([, v = ""]) {
8100
- 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);
8101
8492
  if (_v !== null) return { "mask-size": _v };
8102
8493
  }
8103
8494
  const masks = [
@@ -8112,7 +8503,7 @@ const masks = [
8112
8503
  ["mask-subtract", { "mask-composite": "subtract" }],
8113
8504
  ["mask-intersect", { "mask-composite": "intersect" }],
8114
8505
  ["mask-exclude", { "mask-composite": "exclude" }],
8115
- [/^mask-(.+)$/, ([, v]) => ({ "mask-image": h.bracket.cssvar(v) })],
8506
+ [/^mask-(.+)$/, ([, v], { theme }) => ({ "mask-image": h.bracket.cssvar(v, theme) })],
8116
8507
  [
8117
8508
  /^mask-(linear|radial|conic|[xytblr])-(from|to)()(?:-(.+))?$/,
8118
8509
  handleImage,
@@ -8172,7 +8563,7 @@ const placeholders = [[
8172
8563
  { autocomplete: "placeholder-$colors" }
8173
8564
  ], [
8174
8565
  /^\$ placeholder-op(?:acity)?-?(.+)$/,
8175
- ([, opacity]) => ({ "--un-placeholder-opacity": h.bracket.percent(opacity) }),
8566
+ ([, opacity], { theme }) => ({ "--un-placeholder-opacity": h.bracket.percent(opacity, theme) }),
8176
8567
  { autocomplete: ["placeholder-(op|opacity)", "placeholder-(op|opacity)-<percent>"] }
8177
8568
  ]];
8178
8569
  const positions = [
@@ -8220,7 +8611,7 @@ const justifies = [
8220
8611
  ...makeGlobalStaticRules("justify-self")
8221
8612
  ];
8222
8613
  const orders = [
8223
- [/^order-(.+)$/, ([, v]) => ({ order: h.bracket.cssvar.number(v) })],
8614
+ [/^order-(.+)$/, ([, v], { theme }) => ({ order: h.bracket.cssvar.number(v, theme) })],
8224
8615
  ["order-first", { order: "calc(-infinity)" }],
8225
8616
  ["order-last", { order: "calc(infinity)" }],
8226
8617
  ["order-none", { order: "0" }]
@@ -8296,21 +8687,21 @@ const flexGridJustifiesAlignments = [
8296
8687
  ...alignments,
8297
8688
  ...placements
8298
8689
  ].flatMap(([k, v]) => [[`flex-${k}`, v], [`grid-${k}`, v]]);
8299
- function handleInsetValue(v) {
8690
+ function handleInsetValue(v, theme) {
8300
8691
  const _v = numberResolver(v);
8301
8692
  if (_v != null) {
8302
8693
  themeTracking(`spacing`);
8303
8694
  return `calc(var(--spacing) * ${_v})`;
8304
- } else return h.bracket.cssvar.global.auto.fraction.rem(v);
8695
+ } else return h.bracket.cssvar.global.auto.fraction.rem(v, theme);
8305
8696
  }
8306
- function handleInsetValues([, d, v]) {
8307
- const r = handleInsetValue(v);
8697
+ function handleInsetValues([, d, v], { theme }) {
8698
+ const r = handleInsetValue(v, theme);
8308
8699
  if (r != null && d in insetMap) return insetMap[d].map((i) => [i.slice(1), r]);
8309
8700
  }
8310
8701
  const insets = [
8311
8702
  [
8312
8703
  /^(?:position-|pos-)?inset-(.+)$/,
8313
- ([, v]) => ({ inset: handleInsetValue(v) }),
8704
+ ([, v], { theme }) => ({ inset: handleInsetValue(v, theme) }),
8314
8705
  { autocomplete: [
8315
8706
  "(position|pos)-inset-<directions>-$spacing",
8316
8707
  "(position|pos)-inset-(block|inline)-$spacing",
@@ -8323,7 +8714,7 @@ const insets = [
8323
8714
  [/^(?:position-|pos-)?inset-([rltbse])-(.+)$/, handleInsetValues],
8324
8715
  [/^(?:position-|pos-)?inset-(block|inline)-(.+)$/, handleInsetValues],
8325
8716
  [/^(?:position-|pos-)?inset-([bi][se])-(.+)$/, handleInsetValues],
8326
- [/^(?: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) })]
8327
8718
  ];
8328
8719
  const floats = [
8329
8720
  ["float-left", { float: "left" }],
@@ -8342,7 +8733,7 @@ const floats = [
8342
8733
  ];
8343
8734
  const zIndexes = [[/^(?:position-|pos-)?z([\d.]+)$/, ([, v]) => ({ "z-index": h.number(v) })], [
8344
8735
  /^(?:position-|pos-)?z-(.+)$/,
8345
- ([, v]) => ({ "z-index": h.bracket.cssvar.global.auto.number(v) }),
8736
+ ([, v], { theme }) => ({ "z-index": h.bracket.cssvar.global.auto.number(v, theme) }),
8346
8737
  { autocomplete: "z-<num>" }
8347
8738
  ]];
8348
8739
  const boxSizing = [
@@ -8383,7 +8774,7 @@ const boxShadows = [
8383
8774
  ],
8384
8775
  [
8385
8776
  /^shadow-op(?:acity)?-?(.+)$/,
8386
- ([, opacity]) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity) }),
8777
+ ([, opacity], { theme }) => ({ "--un-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8387
8778
  { autocomplete: "shadow-(op|opacity)-<percent>" }
8388
8779
  ],
8389
8780
  [
@@ -8393,7 +8784,7 @@ const boxShadows = [
8393
8784
  ],
8394
8785
  [
8395
8786
  /^inset-shadow-op(?:acity)?-?(.+)$/,
8396
- ([, opacity]) => ({ "--un-inset-shadow-opacity": h.bracket.percent.cssvar(opacity) }),
8787
+ ([, opacity], { theme }) => ({ "--un-inset-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8397
8788
  { autocomplete: "shadow-(op|opacity)-<percent>" }
8398
8789
  ]
8399
8790
  ];
@@ -8407,10 +8798,10 @@ function handleShadow(themeKey) {
8407
8798
  if (d.startsWith("/")) res = ["", d.slice(1)];
8408
8799
  }
8409
8800
  const v = theme[themeKey]?.[res[0] || "DEFAULT"];
8410
- const c = d ? h.bracket.cssvar(d) : void 0;
8801
+ const c = d ? h.bracket.cssvar(d, theme) : void 0;
8411
8802
  const shadowVar = hyphenate(themeKey);
8412
8803
  if ((v != null || c != null) && !hasParseableColor(c, theme)) {
8413
- 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;
8414
8805
  return [{
8415
8806
  [`--un-${shadowVar}-opacity`]: alpha,
8416
8807
  [`--un-${shadowVar}`]: colorableShadows(v || c, `--un-${shadowVar}-color`, alpha).join(","),
@@ -8421,8 +8812,8 @@ function handleShadow(themeKey) {
8421
8812
  };
8422
8813
  }
8423
8814
  const rings = [
8424
- [/^ring(?:-(.+))?$/, ([, d]) => {
8425
- const v = h.bracket.px(d || "1");
8815
+ [/^ring(?:-(.+))?$/, ([, d], { theme }) => {
8816
+ const v = h.bracket.px(d || "1", theme);
8426
8817
  if (v != null) return [{
8427
8818
  "--un-ring-shadow": `var(--un-ring-inset,) 0 0 0 calc(${v} + var(--un-ring-offset-width)) var(--un-ring-color, currentColor)`,
8428
8819
  "box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
@@ -8435,11 +8826,11 @@ const rings = [
8435
8826
  ],
8436
8827
  [
8437
8828
  /^ring-op(?:acity)?-?(.+)$/,
8438
- ([, opacity]) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity) }),
8829
+ ([, opacity], { theme }) => ({ "--un-ring-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8439
8830
  { autocomplete: "ring-(op|opacity)-<percent>" }
8440
8831
  ],
8441
- [/^inset-ring(?:-(.+))?$/, ([, d]) => {
8442
- const v = h.bracket.px(d || "1");
8832
+ [/^inset-ring(?:-(.+))?$/, ([, d], { theme }) => {
8833
+ const v = h.bracket.px(d || "1", theme);
8443
8834
  if (v != null) return [{
8444
8835
  "--un-inset-ring-shadow": `inset 0 0 0 ${v} var(--un-inset-ring-color, currentColor)`,
8445
8836
  "box-shadow": "var(--un-inset-shadow), var(--un-inset-ring-shadow), var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow)"
@@ -8452,13 +8843,13 @@ const rings = [
8452
8843
  ],
8453
8844
  [
8454
8845
  /^inset-ring-op(?:acity)?-?(.+)$/,
8455
- ([, opacity]) => ({ "--un-inset-ring-opacity": h.bracket.percent.cssvar(opacity) }),
8846
+ ([, opacity], { theme }) => ({ "--un-inset-ring-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8456
8847
  { autocomplete: "inset-ring-(op|opacity)-<percent>" }
8457
8848
  ],
8458
8849
  [
8459
8850
  /^ring-offset(?:-(?:width-|size-)?(.+))?$/,
8460
- ([, d]) => {
8461
- const v = h.bracket.cssvar.px(d || "1");
8851
+ ([, d], { theme }) => {
8852
+ const v = h.bracket.cssvar.px(d || "1", theme);
8462
8853
  if (v != null) return {
8463
8854
  "--un-ring-offset-width": v,
8464
8855
  "--un-ring-offset-shadow": "var(--un-ring-inset,) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color)"
@@ -8473,7 +8864,7 @@ const rings = [
8473
8864
  ],
8474
8865
  [
8475
8866
  /^ring-offset-op(?:acity)?-?(.+)$/,
8476
- ([, opacity]) => ({ "--un-ring-offset-opacity": h.bracket.percent.cssvar(opacity) }),
8867
+ ([, opacity], { theme }) => ({ "--un-ring-offset-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8477
8868
  { autocomplete: "ring-offset-(op|opacity)-<percent>" }
8478
8869
  ],
8479
8870
  ["ring-inset", { "--un-ring-inset": "inset" }]
@@ -8586,17 +8977,17 @@ function handleBreakpoint(context, point, key = "breakpoint") {
8586
8977
  const bp = resolveBreakpoints(context, key);
8587
8978
  if (bp) return bp.find((i) => i.point === point)?.size;
8588
8979
  }
8589
- function getAspectRatio(prop) {
8980
+ function getAspectRatio(prop, theme) {
8590
8981
  if (/^\d+\/\d+$/.test(prop)) return prop;
8591
8982
  switch (prop) {
8592
8983
  case "square": return "1/1";
8593
8984
  case "video": return "16/9";
8594
8985
  }
8595
- return h.bracket.cssvar.global.auto.number(prop);
8986
+ return h.bracket.cssvar.global.auto.number(prop, theme);
8596
8987
  }
8597
8988
  const aspectRatio = [[
8598
8989
  /^(?:size-)?aspect-(?:ratio-)?(.+)$/,
8599
- ([, d]) => ({ "aspect-ratio": getAspectRatio(d) }),
8990
+ ([, d], { theme }) => ({ "aspect-ratio": getAspectRatio(d, theme) }),
8600
8991
  { autocomplete: ["aspect-(square|video|ratio)", "aspect-ratio-(square|video)"] }
8601
8992
  ]];
8602
8993
  const cursorValues = [
@@ -8651,7 +9042,7 @@ const displays = [
8651
9042
  ["flow-root", { display: "flow-root" }],
8652
9043
  ["list-item", { display: "list-item" }],
8653
9044
  ["hidden", { display: "none" }],
8654
- [/^display-(.+)$/, ([, c]) => ({ display: h.bracket.cssvar.global(c) })]
9045
+ [/^display-(.+)$/, ([, c], { theme }) => ({ display: h.bracket.cssvar.global(c, theme) })]
8655
9046
  ];
8656
9047
  const appearances = [
8657
9048
  ["visible", { visibility: "visible" }],
@@ -8661,10 +9052,11 @@ const appearances = [
8661
9052
  ["backface-hidden", { "backface-visibility": "hidden" }],
8662
9053
  ...makeGlobalStaticRules("backface", "backface-visibility")
8663
9054
  ];
8664
- 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 }])];
8665
9056
  const contains = [
8666
- [/^contain-(.*)$/, ([, d]) => {
8667
- 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(" ") };
8668
9060
  return containValues.includes(d) ? [{
8669
9061
  "--un-contain-size": d,
8670
9062
  "contain": containValues.map((i) => `var(--un-contain-${i})`).join(" ")
@@ -8721,13 +9113,13 @@ const whitespaces = [[
8721
9113
  const contentVisibility = [
8722
9114
  [
8723
9115
  /^intrinsic(?:-(block|inline|w|h))?(?:-size)?-(.+)$/,
8724
- ([, d, s]) => {
9116
+ ([, d, s], { theme }) => {
8725
9117
  return { [`contain-intrinsic-${{
8726
9118
  block: "block-size",
8727
9119
  inline: "inline-size",
8728
9120
  w: "width",
8729
9121
  h: "height"
8730
- }[d] ?? "size"}`]: h.bracket.cssvar.global.fraction.rem(s) };
9122
+ }[d] ?? "size"}`]: h.bracket.cssvar.global.fraction.rem(s, theme) };
8731
9123
  },
8732
9124
  { autocomplete: [
8733
9125
  "intrinsic-size-<num>",
@@ -8741,9 +9133,9 @@ const contentVisibility = [
8741
9133
  ...makeGlobalStaticRules("content-visibility")
8742
9134
  ];
8743
9135
  const contents = [
8744
- [/^content-(.+)$/, ([, v]) => {
8745
- if (h.bracket.cssvar(v) != null) return [{
8746
- "--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),
8747
9139
  "content": "var(--un-content)"
8748
9140
  }, defineProperty("--un-content", { initialValue: "\"\"" })];
8749
9141
  }],
@@ -8866,9 +9258,10 @@ const objectPositions = [
8866
9258
  ["object-none", { "object-fit": "none" }],
8867
9259
  [
8868
9260
  /^object-(.+)$/,
8869
- ([, d]) => {
9261
+ ([, d], { theme }) => {
8870
9262
  if (positionMap[d]) return { "object-position": positionMap[d] };
8871
- 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(" ") };
8872
9265
  },
8873
9266
  { autocomplete: `object-(${Object.keys(positionMap).join("|")})` }
8874
9267
  ]
@@ -8933,17 +9326,17 @@ const svgUtilities = [
8933
9326
  ],
8934
9327
  [
8935
9328
  /^fill-op(?:acity)?-?(.+)$/,
8936
- ([, opacity]) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity) }),
9329
+ ([, opacity], { theme }) => ({ "--un-fill-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8937
9330
  { autocomplete: "fill-(op|opacity)-<percent>" }
8938
9331
  ],
8939
9332
  ["fill-none", { fill: "none" }],
8940
9333
  [/^stroke-(?:width-|size-)?(.+)$/, handleWidth],
8941
9334
  [
8942
9335
  /^stroke-dash-(.+)$/,
8943
- ([, s]) => ({ "stroke-dasharray": h.bracket.cssvar.number(s) }),
9336
+ ([, s], { theme }) => ({ "stroke-dasharray": h.bracket.cssvar.number(s, theme) }),
8944
9337
  { autocomplete: "stroke-dash-<num>" }
8945
9338
  ],
8946
- [/^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) })],
8947
9340
  [
8948
9341
  /^stroke-(.+)$/,
8949
9342
  handleColorOrWidth,
@@ -8951,7 +9344,7 @@ const svgUtilities = [
8951
9344
  ],
8952
9345
  [
8953
9346
  /^stroke-op(?:acity)?-?(.+)$/,
8954
- ([, opacity]) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity) }),
9347
+ ([, opacity], { theme }) => ({ "--un-stroke-opacity": h.bracket.percent.cssvar(opacity, theme) }),
8955
9348
  { autocomplete: "stroke-(op|opacity)-<percent>" }
8956
9349
  ],
8957
9350
  ["stroke-cap-square", { "stroke-linecap": "square" }],
@@ -8964,11 +9357,11 @@ const svgUtilities = [
8964
9357
  ["stroke-join-auto", { "stroke-linejoin": "miter" }],
8965
9358
  ["stroke-none", { stroke: "none" }]
8966
9359
  ];
8967
- function handleWidth([, b]) {
8968
- 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) };
8969
9362
  }
8970
9363
  function handleColorOrWidth(match, ctx) {
8971
- if (isCSSMathFn(h.bracket(match[1]))) return handleWidth(match);
9364
+ if (isCSSMathFn(h.bracket(match[1], ctx.theme))) return handleWidth(match, ctx);
8972
9365
  return colorResolver("stroke", "stroke")(match, ctx);
8973
9366
  }
8974
9367
  const tables = [
@@ -9033,7 +9426,7 @@ function resolveValue(s, theme) {
9033
9426
  if (num != null) {
9034
9427
  themeTracking(`spacing`);
9035
9428
  v = `calc(var(--spacing) * ${num})`;
9036
- } else v = h.bracket.cssvar.global.auto.fraction.rem(s);
9429
+ } else v = h.bracket.cssvar.global.auto.fraction.rem(s, theme);
9037
9430
  }
9038
9431
  return v;
9039
9432
  }
@@ -9091,7 +9484,7 @@ const transformGpu = ["translateZ(0)", transformCpu].join(" ");
9091
9484
  const transforms = [
9092
9485
  [
9093
9486
  /^(?:transform-)?origin-(.+)$/,
9094
- ([, s]) => ({ "transform-origin": positionMap[s] ?? h.bracket.cssvar(s) }),
9487
+ ([, s], { theme }) => ({ "transform-origin": positionMap[s] ?? h.bracket.cssvar(s, theme) }),
9095
9488
  { autocomplete: [`transform-origin-(${Object.keys(positionMap).join("|")})`, `origin-(${Object.keys(positionMap).join("|")})`] }
9096
9489
  ],
9097
9490
  [
@@ -9101,7 +9494,7 @@ const transforms = [
9101
9494
  if (theme.perspective?.[s]) {
9102
9495
  themeTracking(`perspective`, s);
9103
9496
  v = generateThemeVariable("perspective", s);
9104
- } else v = h.bracket.cssvar.px.numberWithUnit(s);
9497
+ } else v = h.bracket.cssvar.px.numberWithUnit(s, theme);
9105
9498
  if (v != null) {
9106
9499
  if (t) return {
9107
9500
  "--un-perspective": `perspective(${v})`,
@@ -9112,8 +9505,8 @@ const transforms = [
9112
9505
  },
9113
9506
  { autocomplete: [`perspective-<num>`, `perspective-$perspective`] }
9114
9507
  ],
9115
- [/^(?:transform-)?perspect(?:ive)?-origin-(.+)$/, ([, s]) => {
9116
- 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);
9117
9510
  if (v != null) return { "perspective-origin": v };
9118
9511
  }],
9119
9512
  [/^(?:transform-)?translate-()(.+)$/, handleTranslate],
@@ -9146,8 +9539,8 @@ const transforms = [
9146
9539
  ["transform-none", { transform: "none" }],
9147
9540
  ...makeGlobalStaticRules("transform")
9148
9541
  ];
9149
- function handleTranslate([, d, b]) {
9150
- 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);
9151
9544
  if (v != null) {
9152
9545
  if (v === "none") return { translate: "none" };
9153
9546
  themeTracking(`spacing`);
@@ -9162,8 +9555,8 @@ function handleTranslate([, d, b]) {
9162
9555
  ].map((d) => defineProperty(`--un-translate-${d}`, { initialValue: 0 }))];
9163
9556
  }
9164
9557
  }
9165
- function handleScale([, d, b]) {
9166
- 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);
9167
9560
  if (v != null) {
9168
9561
  if (v === "none") return { scale: "none" };
9169
9562
  return [[...transformXYZ(d, v, "scale"), ["scale", `var(--un-scale-x) var(--un-scale-y)${d === "z" ? " var(--un-scale-z)" : ""}`]], ...[
@@ -9173,8 +9566,8 @@ function handleScale([, d, b]) {
9173
9566
  ].map((d) => defineProperty(`--un-scale-${d}`, { initialValue: 1 }))];
9174
9567
  }
9175
9568
  }
9176
- function handleRotate([, d = "", b]) {
9177
- const v = h.bracket.cssvar.none.degree(b);
9569
+ function handleRotate([, d = "", b], { theme }) {
9570
+ const v = h.bracket.cssvar.none.degree(b, theme);
9178
9571
  if (v != null) {
9179
9572
  if (v === "none") return { rotate: "none" };
9180
9573
  if (d) return [
@@ -9186,11 +9579,11 @@ function handleRotate([, d = "", b]) {
9186
9579
  ].map((d) => defineProperty(`--un-rotate-${d}`, { initialValue: `rotate${d.toUpperCase()}(0)` })),
9187
9580
  ...["x", "y"].map((d) => defineProperty(`--un-skew-${d}`, { initialValue: `skew${d.toUpperCase()}(0)` }))
9188
9581
  ];
9189
- else return { rotate: h.bracket.cssvar.degree(b) };
9582
+ else return { rotate: h.bracket.cssvar.degree(b, theme) };
9190
9583
  }
9191
9584
  }
9192
- function handleSkew([, d, b]) {
9193
- const v = h.bracket.cssvar.degree(b);
9585
+ function handleSkew([, d, b], { theme }) {
9586
+ const v = h.bracket.cssvar.degree(b, theme);
9194
9587
  const ds = xyzMap[d];
9195
9588
  if (v != null && ds) return [
9196
9589
  [...ds.map((_d) => [`--un-skew${_d}`, v.endsWith("deg") ? `skew${_d.slice(1).toUpperCase()}(${v})` : v]), ["transform", transform]],
@@ -9239,11 +9632,11 @@ const transitions = [
9239
9632
  ...defaultTransition
9240
9633
  };
9241
9634
  }],
9242
- [/^(?:transition-)?duration-(.+)$/, ([, d]) => ({
9243
- "--un-duration": h.bracket.cssvar.time(d),
9244
- "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)
9245
9638
  })],
9246
- [/^(?:transition-)?delay-(.+)$/, ([, d]) => ({ "transition-delay": h.bracket.cssvar.time(d) })],
9639
+ [/^(?:transition-)?delay-(.+)$/, ([, d], { theme }) => ({ "transition-delay": h.bracket.cssvar.time(d, theme) })],
9247
9640
  [
9248
9641
  /^(?:transition-)?ease(?:-(.+))?$/,
9249
9642
  ([, d = "DEFAULT"], { theme }) => {
@@ -9251,7 +9644,7 @@ const transitions = [
9251
9644
  if (theme.ease?.[d]) {
9252
9645
  themeTracking("ease", d);
9253
9646
  v = generateThemeVariable("ease", d);
9254
- } else v = h.bracket.cssvar(d);
9647
+ } else v = h.bracket.cssvar(d, theme);
9255
9648
  return [{
9256
9649
  "--un-ease": v,
9257
9650
  "transition-timing-function": v
@@ -9296,7 +9689,7 @@ const fonts = [
9296
9689
  ],
9297
9690
  [
9298
9691
  /^(?:text|color|c)-op(?:acity)?-?(.+)$/,
9299
- ([, opacity]) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity) }),
9692
+ ([, opacity], { theme }) => ({ "--un-text-opacity": h.bracket.percent.cssvar(opacity, theme) }),
9300
9693
  { autocomplete: "(text|color|c)-(op|opacity)-<percent>" }
9301
9694
  ],
9302
9695
  [
@@ -9306,7 +9699,7 @@ const fonts = [
9306
9699
  if (theme.fontWeight?.[s]) {
9307
9700
  themeTracking(`fontWeight`, s);
9308
9701
  v = generateThemeVariable("fontWeight", s);
9309
- } else v = h.bracket.cssvar.global.number(s);
9702
+ } else v = h.bracket.cssvar.global.number(s, theme);
9310
9703
  return {
9311
9704
  "--un-font-weight": v,
9312
9705
  "font-weight": v
@@ -9324,7 +9717,7 @@ const fonts = [
9324
9717
  } else if (numberResolver(s)) {
9325
9718
  themeTracking("spacing");
9326
9719
  v = `calc(var(--spacing) * ${numberResolver(s)})`;
9327
- } else v = h.bracket.cssvar.global.rem(s);
9720
+ } else v = h.bracket.cssvar.global.rem(s, theme);
9328
9721
  if (v != null) return [{
9329
9722
  "--un-leading": v,
9330
9723
  "line-height": v
@@ -9336,7 +9729,7 @@ const fonts = [
9336
9729
  ["font-synthesis-style", { "font-synthesis": "style" }],
9337
9730
  ["font-synthesis-small-caps", { "font-synthesis": "small-caps" }],
9338
9731
  ["font-synthesis-none", { "font-synthesis": "none" }],
9339
- [/^font-synthesis-(.+)$/, ([, s]) => ({ "font-synthesis": h.bracket.cssvar.global(s) })],
9732
+ [/^font-synthesis-(.+)$/, ([, s], { theme }) => ({ "font-synthesis": h.bracket.cssvar.global(s, theme) })],
9340
9733
  [
9341
9734
  /^(?:font-)?tracking-(.+)$/,
9342
9735
  ([, s], { theme }) => {
@@ -9344,7 +9737,7 @@ const fonts = [
9344
9737
  if (theme.tracking?.[s]) {
9345
9738
  themeTracking(`tracking`, s);
9346
9739
  v = generateThemeVariable("tracking", s);
9347
- } else v = h.bracket.cssvar.global.rem(s);
9740
+ } else v = h.bracket.cssvar.global.rem(s, theme);
9348
9741
  return {
9349
9742
  "--un-tracking": v,
9350
9743
  "letter-spacing": v
@@ -9355,7 +9748,7 @@ const fonts = [
9355
9748
  [
9356
9749
  /^(?:font-)?word-spacing-(.+)$/,
9357
9750
  ([, s], { theme }) => {
9358
- 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);
9359
9752
  return {
9360
9753
  "--un-word-spacing": v,
9361
9754
  "word-spacing": v
@@ -9374,7 +9767,7 @@ const fonts = [
9374
9767
  ["font-stretch-ultra-expanded", { "font-stretch": "ultra-expanded" }],
9375
9768
  [
9376
9769
  /^font-stretch-(.+)$/,
9377
- ([, s]) => ({ "font-stretch": h.bracket.cssvar.fraction.global(s) }),
9770
+ ([, s], { theme }) => ({ "font-stretch": h.bracket.cssvar.fraction.global(s, theme) }),
9378
9771
  { autocomplete: "font-stretch-<percentage>" }
9379
9772
  ],
9380
9773
  [
@@ -9399,12 +9792,12 @@ const fonts = [
9399
9792
  "--un-font-weight": v,
9400
9793
  "font-weight": v
9401
9794
  };
9402
- v = h.bracketOfFamily(d);
9795
+ v = h.bracketOfFamily(d, theme);
9403
9796
  if (v != null && h.number(v) == null) {
9404
9797
  v = h.cssvar(v) ?? v;
9405
9798
  return { "font-family": v };
9406
9799
  }
9407
- v = h.bracketOfNumber(d);
9800
+ v = h.bracketOfNumber(d, theme);
9408
9801
  if (v != null) {
9409
9802
  v = h.cssvar.number(v);
9410
9803
  return {
@@ -9412,7 +9805,7 @@ const fonts = [
9412
9805
  "font-weight": v
9413
9806
  };
9414
9807
  }
9415
- v = h.bracket(d);
9808
+ v = h.bracket(d, theme);
9416
9809
  if (v != null && h.number(v) != null) {
9417
9810
  const num = h.number(v);
9418
9811
  return {
@@ -9420,27 +9813,27 @@ const fonts = [
9420
9813
  "font-weight": num
9421
9814
  };
9422
9815
  }
9423
- v = h.bracket.cssvar.global(d);
9816
+ v = h.bracket.cssvar.global(d, theme);
9424
9817
  if (v != null) return { "font-family": v };
9425
9818
  },
9426
9819
  { autocomplete: ["font-$font", "font-$fontWeight"] }
9427
9820
  ]
9428
9821
  ];
9429
- const tabSizes = [[/^tab(?:-(.+))?$/, ([, s]) => {
9430
- 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);
9431
9824
  if (v != null) return {
9432
9825
  "-moz-tab-size": v,
9433
9826
  "-o-tab-size": v,
9434
9827
  "tab-size": v
9435
9828
  };
9436
9829
  }]];
9437
- const textIndents = [[/^indent-(.+)$/, ([, s]) => {
9830
+ const textIndents = [[/^indent-(.+)$/, ([, s], { theme }) => {
9438
9831
  let v = numberResolver(s);
9439
9832
  if (v != null) {
9440
9833
  themeTracking(`spacing`);
9441
9834
  return { "text-indent": `calc(var(--spacing) * ${v})` };
9442
9835
  }
9443
- v = h.bracket.cssvar.auto.global.rem(s);
9836
+ v = h.bracket.cssvar.auto.global.rem(s, theme);
9444
9837
  if (v != null) return { "text-indent": v };
9445
9838
  }]];
9446
9839
  const textStrokes = [
@@ -9448,7 +9841,7 @@ const textStrokes = [
9448
9841
  /^text-stroke(?:-(.+))?$/,
9449
9842
  ([, s = "DEFAULT"], { theme }) => {
9450
9843
  if (theme.textStrokeWidth?.[s]) themeTracking(`textStrokeWidth`, s);
9451
- 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) };
9452
9845
  },
9453
9846
  { autocomplete: "text-stroke-$textStrokeWidth" }
9454
9847
  ],
@@ -9459,7 +9852,7 @@ const textStrokes = [
9459
9852
  ],
9460
9853
  [
9461
9854
  /^text-stroke-op(?:acity)?-?(.+)$/,
9462
- ([, opacity]) => ({ "--un-text-stroke-opacity": h.bracket.percent.cssvar(opacity) }),
9855
+ ([, opacity], { theme }) => ({ "--un-text-stroke-opacity": h.bracket.percent.cssvar(opacity, theme) }),
9463
9856
  { autocomplete: "text-stroke-(op|opacity)-<percent>" }
9464
9857
  ]
9465
9858
  ];
@@ -9469,16 +9862,16 @@ function handleTextShadow(match, ctx) {
9469
9862
  let res = [];
9470
9863
  if (s) res = getStringComponents(s, "/", 2) ?? [];
9471
9864
  const v = theme.textShadow?.[res[0]];
9472
- const c = s ? h.bracket.cssvar(s) : void 0;
9865
+ const c = s ? h.bracket.cssvar(s, theme) : void 0;
9473
9866
  if ((v != null || c != null) && !hasParseableColor(c, theme)) {
9474
- 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;
9475
9868
  return {
9476
9869
  "--un-text-shadow-opacity": alpha,
9477
9870
  "--un-text-shadow": colorableShadows(v || c, "--un-text-shadow-color", alpha).join(","),
9478
9871
  "text-shadow": "var(--un-text-shadow)"
9479
9872
  };
9480
9873
  }
9481
- 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) };
9482
9875
  }
9483
9876
  const textShadows = [
9484
9877
  [
@@ -9497,7 +9890,7 @@ const textShadows = [
9497
9890
  ],
9498
9891
  [
9499
9892
  /^text-shadow(?:-color)?-op(?:acity)?-?(.+)$/,
9500
- ([, opacity]) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity) }),
9893
+ ([, opacity], { theme }) => ({ "--un-text-shadow-opacity": h.bracket.percent.cssvar(opacity, theme) }),
9501
9894
  { autocomplete: "text-shadow(-color)?-(op|opacity)-<percent>" }
9502
9895
  ]
9503
9896
  ];
@@ -9553,7 +9946,7 @@ function handleText([, s = "base"], { theme }) {
9553
9946
  if (leading) if (theme.leading?.[leading]) {
9554
9947
  themeTracking(`leading`, leading);
9555
9948
  lineHeight = generateThemeVariable("leading", leading);
9556
- } else lineHeight = h.bracket.cssvar.global.rem(leading);
9949
+ } else lineHeight = h.bracket.cssvar.global.rem(leading, theme);
9557
9950
  if (sizePairs) {
9558
9951
  themeTracking(`text`, [size, "fontSize"]);
9559
9952
  themeTracking(`text`, [size, "lineHeight"]);
@@ -9564,12 +9957,12 @@ function handleText([, s = "base"], { theme }) {
9564
9957
  "letter-spacing": sizePairs.letterSpacing ? generateThemeVariable("text", [size, "letterSpacing"]) : void 0
9565
9958
  };
9566
9959
  }
9567
- const fontSize = h.bracketOfLength.rem(size);
9960
+ const fontSize = h.bracketOfLength.rem(size, theme);
9568
9961
  if (lineHeight && fontSize) return {
9569
9962
  "font-size": fontSize,
9570
9963
  "line-height": lineHeight
9571
9964
  };
9572
- return { "font-size": h.bracketOfLength.rem(s) };
9965
+ return { "font-size": h.bracketOfLength.rem(s, theme) };
9573
9966
  }
9574
9967
  function handleSize([, s], { theme }) {
9575
9968
  if (theme.text?.[s] != null) {
@@ -9580,12 +9973,12 @@ function handleSize([, s], { theme }) {
9580
9973
  "line-height": `var(--un-leading, ${generateThemeVariable("text", [s, "lineHeight"])})`
9581
9974
  };
9582
9975
  } else {
9583
- const d = h.bracket.cssvar.global.rem(s);
9976
+ const d = h.bracket.cssvar.global.rem(s, theme);
9584
9977
  if (d) return { "font-size": d };
9585
9978
  }
9586
9979
  }
9587
9980
  function handlerColorOrSize(match, ctx) {
9588
- if (isCSSMathFn(h.bracket(match[1]))) return handleSize(match, ctx);
9981
+ if (isCSSMathFn(h.bracket(match[1], ctx.theme))) return handleSize(match, ctx);
9589
9982
  return colorResolver("color", "text")(match, ctx);
9590
9983
  }
9591
9984
  function splitShorthand(body, type) {
@@ -10682,14 +11075,12 @@ const breakpoint = {
10682
11075
  "xl": "80rem",
10683
11076
  "2xl": "96rem"
10684
11077
  };
10685
- const verticalBreakpoint = { ...breakpoint };
10686
- const supports = { grid: "(display: grid)" };
10687
11078
  const theme = {
10688
11079
  font,
10689
11080
  colors,
10690
11081
  spacing,
10691
11082
  breakpoint,
10692
- verticalBreakpoint,
11083
+ verticalBreakpoint: { ...breakpoint },
10693
11084
  text,
10694
11085
  fontWeight,
10695
11086
  tracking,
@@ -10748,17 +11139,17 @@ const theme = {
10748
11139
  container,
10749
11140
  aria,
10750
11141
  media,
10751
- supports
11142
+ supports: { grid: "(display: grid)" }
10752
11143
  };
10753
11144
  //#endregion
10754
- //#region ../../packages-presets/preset-wind4/dist/variants-B5PDncV-.mjs
11145
+ //#region ../../packages-presets/preset-wind4/dist/variants-pAIxzNbQ.mjs
10755
11146
  const variantAria = {
10756
11147
  name: "aria",
10757
11148
  match(matcher, ctx) {
10758
11149
  const variant = variantGetParameter("aria-", matcher, ctx.generator.config.separators);
10759
11150
  if (variant) {
10760
11151
  const [match, rest] = variant;
10761
- const aria = h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
11152
+ const aria = h.bracket(match, ctx.theme) ?? ctx.theme.aria?.[match] ?? "";
10762
11153
  if (aria) return {
10763
11154
  matcher: rest,
10764
11155
  selector: (s) => `${s}[aria-${aria}]`
@@ -10775,7 +11166,7 @@ function taggedAria(tagName) {
10775
11166
  const variant = variantGetParameter(`${tagName}-aria-`, matcher, ctx.generator.config.separators);
10776
11167
  if (variant) {
10777
11168
  const [match, rest, label] = variant;
10778
- const ariaAttribute = h.bracket(match) ?? ctx.theme.aria?.[match] ?? "";
11169
+ const ariaAttribute = h.bracket(match, ctx.theme) ?? ctx.theme.aria?.[match] ?? "";
10779
11170
  if (ariaAttribute) {
10780
11171
  const tagSelectorMap = {
10781
11172
  group: `&:is(:where(.group${label ? `\\/${label}` : ""})[aria-${ariaAttribute}] *)`,
@@ -10887,7 +11278,7 @@ function scopeMatcher(name, combinator) {
10887
11278
  }
10888
11279
  if (!body) return;
10889
11280
  }
10890
- let bracketValue = h.bracket(body[0]) ?? "";
11281
+ let bracketValue = h.bracket(body[0], ctx.theme) ?? "";
10891
11282
  if (bracketValue === "") bracketValue = "*";
10892
11283
  return {
10893
11284
  matcher: body[1],
@@ -10912,7 +11303,7 @@ const variantContainerQuery = {
10912
11303
  const variant = variantGetParameter("@", matcher, ctx.generator.config.separators);
10913
11304
  if (variant) {
10914
11305
  const [match, rest, label] = variant;
10915
- const unbracket = h.bracket(match);
11306
+ const unbracket = h.bracket(match, ctx.theme);
10916
11307
  let container;
10917
11308
  if (unbracket) container = h.numberWithUnit(unbracket);
10918
11309
  else container = ctx.theme.container?.[match] ?? "";
@@ -10952,7 +11343,7 @@ const variantDataAttribute = {
10952
11343
  const variant = variantGetParameter("data-", matcher, ctx.generator.config.separators);
10953
11344
  if (variant) {
10954
11345
  const [match, rest] = variant;
10955
- const dataAttribute = h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
11346
+ const dataAttribute = h.bracket(match, ctx.theme) ?? ctx.theme.data?.[match] ?? "";
10956
11347
  if (dataAttribute) return {
10957
11348
  matcher: rest,
10958
11349
  selector: (s) => `${s}[data-${dataAttribute}]`
@@ -10968,7 +11359,7 @@ function taggedData(tagName) {
10968
11359
  const variant = variantGetParameter(`${tagName}-data-`, matcher, ctx.generator.config.separators);
10969
11360
  if (variant) {
10970
11361
  const [match, rest, label] = variant;
10971
- const dataAttribute = h.bracket(match) ?? ctx.theme.data?.[match] ?? "";
11362
+ const dataAttribute = h.bracket(match, ctx.theme) ?? ctx.theme.data?.[match] ?? "";
10972
11363
  if (dataAttribute) {
10973
11364
  const tagSelectorMap = {
10974
11365
  group: `&:is(:where(.group${label ? `\\/${label}` : ""})[data-${dataAttribute}] *)`,
@@ -11057,7 +11448,7 @@ const variantCustomMedia = {
11057
11448
  const variant = variantGetParameter("media-", matcher, ctx.generator.config.separators);
11058
11449
  if (variant) {
11059
11450
  const [match, rest] = variant;
11060
- let media = h.bracket(match) ?? "";
11451
+ let media = h.bracket(match, ctx.theme) ?? "";
11061
11452
  if (media === "") media = ctx.theme.media?.[match] ?? "";
11062
11453
  if (media) return {
11063
11454
  matcher: rest,
@@ -11081,7 +11472,7 @@ const variantSelector = {
11081
11472
  const variant = variantGetBracket("selector-", matcher, ctx.generator.config.separators);
11082
11473
  if (variant) {
11083
11474
  const [match, rest] = variant;
11084
- const selector = h.bracket(match);
11475
+ const selector = h.bracket(match, ctx.theme);
11085
11476
  if (selector) return {
11086
11477
  matcher: rest,
11087
11478
  selector: () => selector
@@ -11095,7 +11486,7 @@ const variantCssLayer = {
11095
11486
  const variant = variantGetParameter("layer-", matcher, ctx.generator.config.separators);
11096
11487
  if (variant) {
11097
11488
  const [match, rest] = variant;
11098
- const layer = h.bracket(match) ?? match;
11489
+ const layer = h.bracket(match, ctx.theme) ?? match;
11099
11490
  if (layer) return {
11100
11491
  matcher: rest,
11101
11492
  handle: (input, next) => next({
@@ -11112,7 +11503,7 @@ const variantInternalLayer = {
11112
11503
  const variant = variantGetParameter("uno-layer-", matcher, ctx.generator.config.separators);
11113
11504
  if (variant) {
11114
11505
  const [match, rest] = variant;
11115
- const layer = h.bracket(match) ?? match;
11506
+ const layer = h.bracket(match, ctx.theme) ?? match;
11116
11507
  if (layer) return {
11117
11508
  matcher: rest,
11118
11509
  layer
@@ -11126,7 +11517,7 @@ const variantScope = {
11126
11517
  const variant = variantGetBracket("scope-", matcher, ctx.generator.config.separators);
11127
11518
  if (variant) {
11128
11519
  const [match, rest] = variant;
11129
- const scope = h.bracket(match);
11520
+ const scope = h.bracket(match, ctx.theme);
11130
11521
  if (scope) return {
11131
11522
  matcher: rest,
11132
11523
  selector: (s) => `${scope} $$ ${s}`
@@ -11146,7 +11537,7 @@ const variantVariables = {
11146
11537
  break;
11147
11538
  }
11148
11539
  if (newMatcher == null) return;
11149
- const variant = h.bracket(match) ?? "";
11540
+ const variant = h.bracket(match, ctx.theme) ?? "";
11150
11541
  const useParent = variant.startsWith("@");
11151
11542
  if (!(useParent || variant.includes("&"))) return;
11152
11543
  return {
@@ -11187,7 +11578,7 @@ const variantImplicitGroup = {
11187
11578
  const variant = variantGetParameter("in-", matcher, ctx.generator.config.separators);
11188
11579
  if (variant) {
11189
11580
  const [match, rest] = variant;
11190
- const group = h.bracket(match) ?? match;
11581
+ const group = h.bracket(match, ctx.theme) ?? match;
11191
11582
  if (group) return {
11192
11583
  matcher: rest,
11193
11584
  handle: (input, next) => next({
@@ -11262,12 +11653,12 @@ const placeholderModifier = (input, { theme }) => {
11262
11653
  const m = input.match(/^(.*)\b(placeholder-)(.+)$/);
11263
11654
  if (m) {
11264
11655
  const [, pre = "", p, body] = m;
11265
- 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}` };
11266
11657
  }
11267
11658
  };
11268
- function hasOpacityValue(body) {
11659
+ function hasOpacityValue(body, theme) {
11269
11660
  const match = body.match(/^op(?:acity)?-?(.+)$/);
11270
- 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;
11271
11662
  return false;
11272
11663
  }
11273
11664
  function variantPseudoClassesAndElements() {
@@ -11311,7 +11702,7 @@ const variantSupports = {
11311
11702
  const variant = variantGetParameter("supports-", matcher, ctx.generator.config.separators);
11312
11703
  if (variant) {
11313
11704
  const [match, rest] = variant;
11314
- let supports = h.bracket(match) ?? "";
11705
+ let supports = h.bracket(match, ctx.theme) ?? "";
11315
11706
  if (supports === "") supports = ctx.theme.supports?.[match] ?? "";
11316
11707
  if (supports) {
11317
11708
  if (!(supports.startsWith("(") && supports.endsWith(")"))) supports = `(${supports})`;
@@ -12037,6 +12428,8 @@ const frameworkConfigRE = /^(?:vite|svelte|astro|iles|nuxt|unocss|uno)\.config/;
12037
12428
  const unoConfigRE = /\buno(?:css)?\.config\./;
12038
12429
  const excludeFileRE = /[\\/](?:node_modules|dist|\.temp|\.cache)[\\/]/;
12039
12430
  var ContextManager = class {
12431
+ cwd;
12432
+ connection;
12040
12433
  ready;
12041
12434
  contextsMap = /* @__PURE__ */ new Map();
12042
12435
  configSources = [];
@@ -12297,8 +12690,11 @@ const defaultSettings = {
12297
12690
  //#endregion
12298
12691
  //#region src/utils/color.ts
12299
12692
  const matchCssVarNameRE = /var\((?<cssVarName>--[^,|)]+)(?:,(?<fallback>[^)]+))?\)/g;
12300
- 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");
12301
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");
12302
12698
  function getCssVariables(code) {
12303
12699
  const regex = /(?<key>--[^\s:]+):(?<value>.+?)[!;]/g;
12304
12700
  const cssVariables = /* @__PURE__ */ new Map();
@@ -12308,6 +12704,49 @@ function getCssVariables(code) {
12308
12704
  }
12309
12705
  return cssVariables;
12310
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
+ }
12311
12750
  /**
12312
12751
  * Get CSS color string from CSS string
12313
12752
  *
@@ -12340,56 +12779,25 @@ function getCssVariables(code) {
12340
12779
  * @returns The **first** CSS color string (hex, rgb[a], hsl[a]) or `undefined`
12341
12780
  */
12342
12781
  function getColorString(str) {
12343
- let colorString = str.match(cssColorRE)?.[0];
12344
- if (!colorString) return;
12345
12782
  const cssVars = getCssVariables(str);
12346
- for (const match of colorString.matchAll(matchCssVarNameRE)) {
12347
- const matchedString = match[0];
12348
- const cssVarName = match.groups?.cssVarName;
12349
- const fallback = match.groups?.fallback;
12350
- if (cssVarName && cssVars.get(cssVarName)) colorString = colorString.replaceAll(matchedString, () => {
12351
- let v = cssVars.get(cssVarName) ?? matchedString;
12352
- while (v && v.startsWith("var(")) {
12353
- const varName = v.match(varFnRE)?.[1];
12354
- if (!varName) {
12355
- v = "";
12356
- break;
12357
- }
12358
- v = cssVars.get(varName) || "";
12359
- }
12360
- return v || "1";
12361
- });
12362
- else if (fallback) colorString = colorString.replaceAll(matchedString, fallback);
12363
- 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;
12364
12788
  }
12365
- if (/\/\)/.test(colorString)) colorString = colorString.replace(/ \/\)/g, "/ 1)");
12366
- return convertToRGBA(colorString);
12367
- }
12368
- const reRgbFn = /rgb\((\d+)\s+(\d+)\s+(\d+)\s*\/\s*([\d.]+)\)/;
12369
- function convertToRGBA(rgbColor) {
12370
- const match = rgbColor.match(reRgbFn);
12371
- if (match) return `rgba(${Number.parseInt(match[1].trim())}, ${Number.parseInt(match[2].trim())}, ${Number.parseInt(match[3].trim())}, ${Number.parseFloat(match[4].trim())})`;
12372
- return rgbColor;
12789
+ return getColorStringFromValue(str, cssVars);
12373
12790
  }
12374
12791
  function parseColorToRGBA(colorString) {
12375
- const rgbaMatch = colorString.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
12376
- if (rgbaMatch) return {
12377
- red: Number.parseInt(rgbaMatch[1]) / 255,
12378
- green: Number.parseInt(rgbaMatch[2]) / 255,
12379
- blue: Number.parseInt(rgbaMatch[3]) / 255,
12380
- 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
12381
12800
  };
12382
- const hexMatch = colorString.match(/^#([a-f0-9]{3,6})$/i);
12383
- if (hexMatch) {
12384
- let hex = hexMatch[1];
12385
- if (hex.length === 3) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
12386
- return {
12387
- red: Number.parseInt(hex.slice(0, 2), 16) / 255,
12388
- green: Number.parseInt(hex.slice(2, 4), 16) / 255,
12389
- blue: Number.parseInt(hex.slice(4, 6), 16) / 255,
12390
- alpha: 1
12391
- };
12392
- }
12393
12801
  }
12394
12802
  //#endregion
12395
12803
  //#region src/utils/css.ts
@@ -12417,9 +12825,9 @@ function addRemToPxComment(str, remToPixel = 16) {
12417
12825
  output.push(str.slice(index));
12418
12826
  return output.join("");
12419
12827
  }
12420
- async function getCSS(uno, utilName) {
12828
+ async function getCSS(uno, utilName, preflights = false) {
12421
12829
  const { css } = await uno.generate(new Set(toArray(utilName)), {
12422
- preflights: false,
12830
+ preflights,
12423
12831
  safelist: false
12424
12832
  });
12425
12833
  return css;
@@ -12430,7 +12838,7 @@ async function getPrettiedCSS(uno, util, remToPxRatio) {
12430
12838
  safelist: false
12431
12839
  });
12432
12840
  const css = addRemToPxComment(result.css, remToPxRatio);
12433
- const prettified = prettier.format(css, {
12841
+ const prettified = await prettier.format(css, {
12434
12842
  parser: "css",
12435
12843
  plugins: [parserCSS]
12436
12844
  });
@@ -12443,4 +12851,4 @@ async function getPrettiedMarkdown(uno, util, remToPxRatio) {
12443
12851
  return `\`\`\`css\n${(await getPrettiedCSS(uno, util, remToPxRatio)).prettified.trimEnd()}\n\`\`\``;
12444
12852
  }
12445
12853
  //#endregion
12446
- 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 };