@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.d.ts CHANGED
@@ -584,7 +584,7 @@ interface ConfigBase<Theme extends object = object> {
584
584
  *
585
585
  * You don't usually need to set this.
586
586
  *
587
- * @default false
587
+ * @default `true` when `envMode` is `dev`, otherwise `false`
588
588
  */
589
589
  details?: boolean;
590
590
  }
@@ -987,4 +987,4 @@ declare function resolveConfig<Theme extends object = object>(userConfig?: UserC
987
987
  */
988
988
  declare function mergeConfigs<Theme extends object = object>(configs: UserConfig<Theme>[]): UserConfig<Theme>;
989
989
 
990
- export { ArgumentType, Arrayable, AutoCompleteExtractor, AutoCompleteExtractorContext, AutoCompleteExtractorResult, AutoCompleteFunction, AutoCompleteTemplate, Awaitable, BetterMap, BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, CSSColorValue, CSSEntries, CSSObject, CSSValue, CSSValues, CliEntryItem, CliOptions, ConfigBase, ContentOptions, CountableSet, DeepPartial, DynamicMatcher, DynamicRule, DynamicShortcut, DynamicShortcutMatcher, ExtendedTokenInfo, Extractor, ExtractorContext, FilterPattern, FlatObjectTuple, GenerateOptions, GenerateResult, GeneratorOptions, HighlightAnnotation, ParsedColorValue, ParsedUtil, PartialByKeys, PluginOptions, Postprocessor, Preflight, PreflightContext, PreparedRule, Preprocessor, Preset, PresetOptions, RGBAColorValue, RawUtil, Replacement, RequiredByKey, ResolvedConfig, RestArgs, Rule, RuleContext, RuleMeta, Shift, Shortcut, ShortcutValue, SourceCodeTransformer, SourceCodeTransformerEnforce, SourceMap, StaticRule, StaticShortcut, StaticShortcutMap, StringifiedUtil, SuggestResult, ThemeExtender, ToArray, TwoKeyMap, UnoGenerator, UnocssPluginContext, UserConfig, UserConfigDefaults, UserOnlyOptions, UserShortcuts, UtilObject, ValueHandler, ValueHandlerCallback, Variant, VariantContext, VariantFunction, VariantHandler, VariantHandlerContext, VariantMatchedResult, VariantObject, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createValueHandler, cssIdRE, defaultSplitRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isCountableSet, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
990
+ export { type ArgumentType, type Arrayable, type AutoCompleteExtractor, type AutoCompleteExtractorContext, type AutoCompleteExtractorResult, type AutoCompleteFunction, type AutoCompleteTemplate, type Awaitable, BetterMap, type BlocklistRule, CONTROL_SHORTCUT_NO_MERGE, type CSSColorValue, type CSSEntries, type CSSObject, type CSSValue, type CSSValues, type CliEntryItem, type CliOptions, type ConfigBase, type ContentOptions, CountableSet, type DeepPartial, type DynamicMatcher, type DynamicRule, type DynamicShortcut, type DynamicShortcutMatcher, type ExtendedTokenInfo, type Extractor, type ExtractorContext, type FilterPattern, type FlatObjectTuple, type GenerateOptions, type GenerateResult, type GeneratorOptions, type HighlightAnnotation, type ParsedColorValue, type ParsedUtil, type PartialByKeys, type PluginOptions, type Postprocessor, type Preflight, type PreflightContext, type PreparedRule, type Preprocessor, type Preset, type PresetOptions, type RGBAColorValue, type RawUtil, type Replacement, type RequiredByKey, type ResolvedConfig, type RestArgs, type Rule, type RuleContext, type RuleMeta, type Shift, type Shortcut, type ShortcutValue, type SourceCodeTransformer, type SourceCodeTransformerEnforce, type SourceMap, type StaticRule, type StaticShortcut, type StaticShortcutMap, type StringifiedUtil, type SuggestResult, type ThemeExtender, type ToArray, TwoKeyMap, UnoGenerator, type UnocssPluginContext, type UserConfig, type UserConfigDefaults, type UserOnlyOptions, type UserShortcuts, type UtilObject, type ValueHandler, type ValueHandlerCallback, type Variant, type VariantContext, type VariantFunction, type VariantHandler, type VariantHandlerContext, type VariantMatchedResult, type VariantObject, attributifyRE, clearIdenticalEntries, clone, collapseVariantGroup, createGenerator, createValueHandler, cssIdRE, defaultSplitRE, e, entriesToCss, escapeRegExp, escapeSelector, expandVariantGroup, extractorSplit as extractorDefault, extractorSplit, hasScopePlaceholder, isAttributifySelector, isCountableSet, isObject, isRawUtil, isStaticRule, isStaticShortcut, isString, isValidSelector, makeRegexClassGroup, mergeConfigs, mergeDeep, noop, normalizeCSSEntries, normalizeCSSValues, normalizeVariant, notNull, parseVariantGroup, regexScopePlaceholder, resolveConfig, resolvePreset, resolvePresets, resolveShortcuts, splitWithVariantGroupRE, toArray, toEscapedSelector, uniq, validateFilterRE, warnOnce, withLayer };
package/dist/index.mjs CHANGED
@@ -17,11 +17,19 @@ function escapeSelector(str) {
17
17
  result += "\\,";
18
18
  continue;
19
19
  }
20
- if (codeUnit >= 1 && codeUnit <= 31 || codeUnit === 127 || index === 0 && codeUnit >= 48 && codeUnit <= 57 || index === 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit === 45) {
20
+ if (
21
+ // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
22
+ // U+007F, […]
23
+ codeUnit >= 1 && codeUnit <= 31 || codeUnit === 127 || index === 0 && codeUnit >= 48 && codeUnit <= 57 || index === 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit === 45
24
+ ) {
21
25
  result += `\\${codeUnit.toString(16)} `;
22
26
  continue;
23
27
  }
24
- if (index === 0 && length === 1 && codeUnit === 45) {
28
+ if (
29
+ // If the character is the first character and is a `-` (U+002D), and
30
+ // there is no second character, […]
31
+ index === 0 && length === 1 && codeUnit === 45
32
+ ) {
25
33
  result += `\\${str.charAt(index)}`;
26
34
  continue;
27
35
  }
@@ -154,9 +162,15 @@ function notNull(value) {
154
162
  function noop() {
155
163
  }
156
164
 
165
+ var __defProp$2 = Object.defineProperty;
166
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
167
+ var __publicField$2 = (obj, key, value) => {
168
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
169
+ return value;
170
+ };
157
171
  class TwoKeyMap {
158
172
  constructor() {
159
- this._map = /* @__PURE__ */ new Map();
173
+ __publicField$2(this, "_map", /* @__PURE__ */ new Map());
160
174
  }
161
175
  get(key1, key2) {
162
176
  const m2 = this._map.get(key1);
@@ -209,9 +223,16 @@ class BetterMap extends Map {
209
223
  }
210
224
  }
211
225
 
226
+ var __defProp$1 = Object.defineProperty;
227
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
228
+ var __publicField$1 = (obj, key, value) => {
229
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
230
+ return value;
231
+ };
212
232
  class CountableSet extends Set {
213
233
  constructor(values) {
214
234
  super(values);
235
+ __publicField$1(this, "_map");
215
236
  this._map ?? (this._map = /* @__PURE__ */ new Map());
216
237
  }
217
238
  add(key) {
@@ -321,6 +342,7 @@ function parseVariantGroup(str, separators = ["-", ":"], depth = 5) {
321
342
  prefixes: Array.from(prefixes),
322
343
  hasChanged,
323
344
  groupsByOffset,
345
+ // Computed lazily because MagicString's toString does a lot of work
324
346
  get expanded() {
325
347
  return expanded.toString();
326
348
  }
@@ -542,33 +564,25 @@ function resolveConfig(userConfig = {}, defaults = {}) {
542
564
  shortcuts: resolveShortcuts(getMerged("shortcuts")).reverse(),
543
565
  extractors,
544
566
  safelist: getMerged("safelist"),
545
- separators
567
+ separators,
568
+ details: config.details ?? config.envMode === "dev"
546
569
  };
547
570
  for (const p of sources)
548
571
  p?.configResolved?.(resolved);
549
572
  return resolved;
550
573
  }
551
574
  function mergeConfigs(configs) {
552
- function getMerged(key) {
553
- return uniq(configs.flatMap((p) => toArray(p[key] || [])));
554
- }
555
- const merged = Object.assign(
556
- {},
557
- ...configs,
558
- {
559
- theme: mergeThemes(configs.map((c) => c.theme)),
560
- presets: getMerged("presets"),
561
- safelist: getMerged("safelist"),
562
- preprocess: getMerged("preprocess"),
563
- postprocess: getMerged("postprocess"),
564
- preflights: getMerged("preflights"),
565
- rules: getMerged("rules"),
566
- variants: getMerged("variants"),
567
- shortcuts: getMerged("shortcuts"),
568
- extractors: getMerged("extractors")
569
- }
570
- );
571
- return merged;
575
+ const maybeArrays = ["shortcuts", "preprocess", "postprocess"];
576
+ const config = configs.map((config2) => Object.entries(config2).reduce((acc, [key, value]) => ({
577
+ ...acc,
578
+ [key]: maybeArrays.includes(key) ? toArray(value) : value
579
+ }), {})).reduce(({ theme: themeA, ...a }, { theme: themeB, ...b }) => {
580
+ const c = mergeDeep(a, b, true);
581
+ if (themeA || themeB)
582
+ c.theme = mergeThemes([themeA, themeB]);
583
+ return c;
584
+ }, {});
585
+ return config;
572
586
  }
573
587
  function mergeThemes(themes) {
574
588
  return themes.map((theme) => theme ? clone(theme) : {}).reduce((a, b) => mergeDeep(a, b), {});
@@ -593,17 +607,24 @@ function mergeAutocompleteShorthands(shorthands) {
593
607
  );
594
608
  }
595
609
 
596
- const version = "0.55.1";
610
+ const version = "0.55.3";
597
611
 
612
+ var __defProp = Object.defineProperty;
613
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
614
+ var __publicField = (obj, key, value) => {
615
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
616
+ return value;
617
+ };
598
618
  class UnoGenerator {
599
619
  constructor(userConfig = {}, defaults = {}) {
600
620
  this.userConfig = userConfig;
601
621
  this.defaults = defaults;
602
- this.version = version;
603
- this._cache = /* @__PURE__ */ new Map();
604
- this.blocked = /* @__PURE__ */ new Set();
605
- this.parentOrders = /* @__PURE__ */ new Map();
606
- this.events = createNanoEvents();
622
+ __publicField(this, "version", version);
623
+ __publicField(this, "_cache", /* @__PURE__ */ new Map());
624
+ __publicField(this, "config");
625
+ __publicField(this, "blocked", /* @__PURE__ */ new Set());
626
+ __publicField(this, "parentOrders", /* @__PURE__ */ new Map());
627
+ __publicField(this, "events", createNanoEvents());
607
628
  this.config = resolveConfig(userConfig, defaults);
608
629
  this.events.emit("config", this.config);
609
630
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
- "version": "0.55.1",
3
+ "version": "0.55.3",
4
4
  "description": "The instant on-demand Atomic CSS engine.",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "dist"
38
38
  ],
39
39
  "devDependencies": {
40
- "magic-string": "^0.30.2",
40
+ "magic-string": "^0.30.3",
41
41
  "unconfig": "^0.3.10"
42
42
  },
43
43
  "scripts": {