@unocss/core 0.55.1 → 0.55.3

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.cjs CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  function escapeRegExp(string) {
6
4
  return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7
5
  }
@@ -21,11 +19,19 @@ function escapeSelector(str) {
21
19
  result += "\\,";
22
20
  continue;
23
21
  }
24
- if (codeUnit >= 1 && codeUnit <= 31 || codeUnit === 127 || index === 0 && codeUnit >= 48 && codeUnit <= 57 || index === 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit === 45) {
22
+ if (
23
+ // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
24
+ // U+007F, […]
25
+ codeUnit >= 1 && codeUnit <= 31 || codeUnit === 127 || index === 0 && codeUnit >= 48 && codeUnit <= 57 || index === 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit === 45
26
+ ) {
25
27
  result += `\\${codeUnit.toString(16)} `;
26
28
  continue;
27
29
  }
28
- if (index === 0 && length === 1 && codeUnit === 45) {
30
+ if (
31
+ // If the character is the first character and is a `-` (U+002D), and
32
+ // there is no second character, […]
33
+ index === 0 && length === 1 && codeUnit === 45
34
+ ) {
29
35
  result += `\\${str.charAt(index)}`;
30
36
  continue;
31
37
  }
@@ -158,9 +164,15 @@ function notNull(value) {
158
164
  function noop() {
159
165
  }
160
166
 
167
+ var __defProp$2 = Object.defineProperty;
168
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
169
+ var __publicField$2 = (obj, key, value) => {
170
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
171
+ return value;
172
+ };
161
173
  class TwoKeyMap {
162
174
  constructor() {
163
- this._map = /* @__PURE__ */ new Map();
175
+ __publicField$2(this, "_map", /* @__PURE__ */ new Map());
164
176
  }
165
177
  get(key1, key2) {
166
178
  const m2 = this._map.get(key1);
@@ -213,9 +225,16 @@ class BetterMap extends Map {
213
225
  }
214
226
  }
215
227
 
228
+ var __defProp$1 = Object.defineProperty;
229
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
230
+ var __publicField$1 = (obj, key, value) => {
231
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
232
+ return value;
233
+ };
216
234
  class CountableSet extends Set {
217
235
  constructor(values) {
218
236
  super(values);
237
+ __publicField$1(this, "_map");
219
238
  this._map ?? (this._map = /* @__PURE__ */ new Map());
220
239
  }
221
240
  add(key) {
@@ -325,6 +344,7 @@ function parseVariantGroup(str, separators = ["-", ":"], depth = 5) {
325
344
  prefixes: Array.from(prefixes),
326
345
  hasChanged,
327
346
  groupsByOffset,
347
+ // Computed lazily because MagicString's toString does a lot of work
328
348
  get expanded() {
329
349
  return expanded.toString();
330
350
  }
@@ -546,33 +566,25 @@ function resolveConfig(userConfig = {}, defaults = {}) {
546
566
  shortcuts: resolveShortcuts(getMerged("shortcuts")).reverse(),
547
567
  extractors,
548
568
  safelist: getMerged("safelist"),
549
- separators
569
+ separators,
570
+ details: config.details ?? config.envMode === "dev"
550
571
  };
551
572
  for (const p of sources)
552
573
  p?.configResolved?.(resolved);
553
574
  return resolved;
554
575
  }
555
576
  function mergeConfigs(configs) {
556
- function getMerged(key) {
557
- return uniq(configs.flatMap((p) => toArray(p[key] || [])));
558
- }
559
- const merged = Object.assign(
560
- {},
561
- ...configs,
562
- {
563
- theme: mergeThemes(configs.map((c) => c.theme)),
564
- presets: getMerged("presets"),
565
- safelist: getMerged("safelist"),
566
- preprocess: getMerged("preprocess"),
567
- postprocess: getMerged("postprocess"),
568
- preflights: getMerged("preflights"),
569
- rules: getMerged("rules"),
570
- variants: getMerged("variants"),
571
- shortcuts: getMerged("shortcuts"),
572
- extractors: getMerged("extractors")
573
- }
574
- );
575
- return merged;
577
+ const maybeArrays = ["shortcuts", "preprocess", "postprocess"];
578
+ const config = configs.map((config2) => Object.entries(config2).reduce((acc, [key, value]) => ({
579
+ ...acc,
580
+ [key]: maybeArrays.includes(key) ? toArray(value) : value
581
+ }), {})).reduce(({ theme: themeA, ...a }, { theme: themeB, ...b }) => {
582
+ const c = mergeDeep(a, b, true);
583
+ if (themeA || themeB)
584
+ c.theme = mergeThemes([themeA, themeB]);
585
+ return c;
586
+ }, {});
587
+ return config;
576
588
  }
577
589
  function mergeThemes(themes) {
578
590
  return themes.map((theme) => theme ? clone(theme) : {}).reduce((a, b) => mergeDeep(a, b), {});
@@ -597,17 +609,24 @@ function mergeAutocompleteShorthands(shorthands) {
597
609
  );
598
610
  }
599
611
 
600
- const version = "0.55.1";
612
+ const version = "0.55.3";
601
613
 
614
+ var __defProp = Object.defineProperty;
615
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
616
+ var __publicField = (obj, key, value) => {
617
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
618
+ return value;
619
+ };
602
620
  class UnoGenerator {
603
621
  constructor(userConfig = {}, defaults = {}) {
604
622
  this.userConfig = userConfig;
605
623
  this.defaults = defaults;
606
- this.version = version;
607
- this._cache = /* @__PURE__ */ new Map();
608
- this.blocked = /* @__PURE__ */ new Set();
609
- this.parentOrders = /* @__PURE__ */ new Map();
610
- this.events = createNanoEvents();
624
+ __publicField(this, "version", version);
625
+ __publicField(this, "_cache", /* @__PURE__ */ new Map());
626
+ __publicField(this, "config");
627
+ __publicField(this, "blocked", /* @__PURE__ */ new Set());
628
+ __publicField(this, "parentOrders", /* @__PURE__ */ new Map());
629
+ __publicField(this, "events", createNanoEvents());
611
630
  this.config = resolveConfig(userConfig, defaults);
612
631
  this.events.emit("config", this.config);
613
632
  }