@unocss/core 66.1.0-beta.4 → 66.1.0-beta.6

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.mts CHANGED
@@ -740,6 +740,10 @@ interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
740
740
  * Custom API endpoint for cross-preset communication
741
741
  */
742
742
  api?: any;
743
+ /**
744
+ * Custom metadata for the preset
745
+ */
746
+ meta?: Record<string, any>;
743
747
  }
744
748
  type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
745
749
  type PresetFactoryAwaitable<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Awaitable<Preset<Theme>>;
package/dist/index.d.ts CHANGED
@@ -740,6 +740,10 @@ interface Preset<Theme extends object = object> extends ConfigBase<Theme> {
740
740
  * Custom API endpoint for cross-preset communication
741
741
  */
742
742
  api?: any;
743
+ /**
744
+ * Custom metadata for the preset
745
+ */
746
+ meta?: Record<string, any>;
743
747
  }
744
748
  type PresetFactory<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Preset<Theme>;
745
749
  type PresetFactoryAwaitable<Theme extends object = object, PresetOptions extends object | undefined = undefined> = (options?: PresetOptions) => Awaitable<Preset<Theme>>;
package/dist/index.mjs CHANGED
@@ -41,17 +41,23 @@ function isString(s) {
41
41
  }
42
42
 
43
43
  class CountableSet extends Set {
44
- _map;
44
+ _map = /* @__PURE__ */ new Map();
45
45
  constructor(values) {
46
- super(values);
47
- this._map ??= /* @__PURE__ */ new Map();
46
+ super();
47
+ if (values) {
48
+ for (const key of values) {
49
+ this.add(key);
50
+ }
51
+ }
48
52
  }
49
53
  add(key) {
50
- this._map ??= /* @__PURE__ */ new Map();
51
54
  this._map.set(key, (this._map.get(key) ?? 0) + 1);
52
55
  return super.add(key);
53
56
  }
54
57
  delete(key) {
58
+ if (!this._map.has(key)) {
59
+ return false;
60
+ }
55
61
  this._map.delete(key);
56
62
  return super.delete(key);
57
63
  }
@@ -651,7 +657,7 @@ function definePreset(preset) {
651
657
  return preset;
652
658
  }
653
659
 
654
- const version = "66.1.0-beta.4";
660
+ const version = "66.1.0-beta.6";
655
661
 
656
662
  const symbols = {
657
663
  shortcutsNoMerge: "$$symbol-shortcut-no-merge",
@@ -1043,13 +1049,13 @@ class UnoGeneratorInternal {
1043
1049
  const staticMatch = this.config.rulesStaticMap[processed];
1044
1050
  if (staticMatch) {
1045
1051
  if (staticMatch[1] && (internal || !staticMatch[2]?.internal)) {
1046
- context.generator.activatedRules.add(staticMatch);
1047
1052
  if (this.config.details)
1048
1053
  context.rules.push(staticMatch);
1049
1054
  const index = this.config.rules.indexOf(staticMatch);
1050
1055
  const entries = normalizeCSSValues(staticMatch[1]).filter((i) => i.length);
1051
1056
  const meta = staticMatch[2];
1052
1057
  if (entries.length) {
1058
+ context.generator.activatedRules.add(staticMatch);
1053
1059
  return entries.map((css) => {
1054
1060
  if (isString(css))
1055
1061
  return [index, css, meta];
@@ -1084,7 +1090,6 @@ class UnoGeneratorInternal {
1084
1090
  let result = await handler(match, context);
1085
1091
  if (!result)
1086
1092
  continue;
1087
- context.generator.activatedRules.add(rule);
1088
1093
  if (this.config.details)
1089
1094
  context.rules.push(rule);
1090
1095
  if (typeof result !== "string") {
@@ -1101,6 +1106,7 @@ class UnoGeneratorInternal {
1101
1106
  }
1102
1107
  const entries = normalizeCSSValues(result).filter((i) => i.length);
1103
1108
  if (entries.length) {
1109
+ context.generator.activatedRules.add(rule);
1104
1110
  const index = this.config.rules.indexOf(rule);
1105
1111
  return entries.map((css) => {
1106
1112
  if (isString(css))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
3
  "type": "module",
4
- "version": "66.1.0-beta.4",
4
+ "version": "66.1.0-beta.6",
5
5
  "description": "The instant on-demand Atomic CSS engine.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",