@unocss/core 66.10.0 → 66.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +21 -3
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -267,7 +267,24 @@ function clearIdenticalEntries(entry) {
267
267
  const VirtualKey = "__virtual_key__";
268
268
  function entriesToCss(arr) {
269
269
  if (arr == null) return "";
270
- return clearIdenticalEntries(arr).map(([key, value]) => value != null && typeof value !== "function" ? key !== "__virtual_key__" ? `${key}:${value};` : value : void 0).filter(Boolean).join("");
270
+ return clearIdenticalEntries(arr).map(([key, value]) => {
271
+ if (value == null || typeof value === "function") return void 0;
272
+ if (key === "__virtual_key__") return value;
273
+ if (breaksOutOfDeclaration(String(value))) return void 0;
274
+ return `${key}:${value};`;
275
+ }).filter(Boolean).join("");
276
+ }
277
+ function breaksOutOfDeclaration(value) {
278
+ let quote;
279
+ for (let i = 0; i < value.length; i++) {
280
+ const c = value[i];
281
+ if (quote) {
282
+ if (c === "\\") i += 1;
283
+ else if (c === quote) quote = void 0;
284
+ } else if (c === "\"" || c === "'" || c === "`") quote = c;
285
+ else if (c === "{" || c === "}") return true;
286
+ }
287
+ return false;
271
288
  }
272
289
  function isObject(item) {
273
290
  return item && typeof item === "object" && !Array.isArray(item);
@@ -633,7 +650,7 @@ function definePreset(preset) {
633
650
  }
634
651
  //#endregion
635
652
  //#region package.json
636
- var version = "66.10.0";
653
+ var version = "66.10.1";
637
654
  //#endregion
638
655
  //#region src/generator.ts
639
656
  const symbols = {
@@ -1279,7 +1296,8 @@ var UnoGeneratorInternal = class UnoGeneratorInternal {
1279
1296
  if (raw !== inputWithoutVariant) {
1280
1297
  const expanded = await this.expandShortcut(inputWithoutVariant, context, depth - 1);
1281
1298
  if (expanded) {
1282
- stringResult = expanded[0].filter(isString).map((item) => raw.replace(inputWithoutVariant, item));
1299
+ const matcherIndex = raw.lastIndexOf(inputWithoutVariant);
1300
+ stringResult = expanded[0].filter(isString).map((item) => matcherIndex === -1 ? raw : raw.slice(0, matcherIndex) + item + raw.slice(matcherIndex + inputWithoutVariant.length));
1283
1301
  inlineResult = expanded[0].filter((i) => !isString(i)).map((item) => {
1284
1302
  return {
1285
1303
  handles: [...item.handles, ...handles],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
3
  "type": "module",
4
- "version": "66.10.0",
4
+ "version": "66.10.1",
5
5
  "description": "The instant on-demand Atomic CSS engine.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",