@unocss/core 66.6.3 → 66.6.4

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
@@ -279,6 +279,7 @@ interface RuleContext<Theme extends object = object> {
279
279
  }
280
280
  declare const SymbolShortcutsNoMerge: unique symbol;
281
281
  declare const SymbolNoMerge: unique symbol;
282
+ declare const SymbolNoScope: unique symbol;
282
283
  declare const SymbolVariants: unique symbol;
283
284
  declare const SymbolParent: unique symbol;
284
285
  declare const SymbolSelector: unique symbol;
@@ -294,6 +295,10 @@ interface ControlSymbols {
294
295
  * Prevent merging in rules
295
296
  */
296
297
  noMerge: typeof SymbolNoMerge;
298
+ /**
299
+ * Prevent applying the `scope` option to this rule/selector
300
+ */
301
+ noScope: typeof SymbolNoScope;
297
302
  /**
298
303
  * Additional variants applied to this rule
299
304
  */
@@ -322,6 +327,7 @@ interface ControlSymbols {
322
327
  interface ControlSymbolsValue {
323
328
  [SymbolShortcutsNoMerge]: true;
324
329
  [SymbolNoMerge]: true;
330
+ [SymbolNoScope]: true;
325
331
  [SymbolVariants]: VariantHandler[] | ((handlers: VariantHandler[]) => VariantHandler[]);
326
332
  [SymbolParent]: string;
327
333
  [SymbolSelector]: (selector: string) => string;
@@ -385,6 +391,11 @@ interface RuleMeta {
385
391
  * @default false
386
392
  */
387
393
  noMerge?: boolean;
394
+ /**
395
+ * Option to not apply scope to this selector.
396
+ * @default false
397
+ */
398
+ noScope?: boolean;
388
399
  /**
389
400
  * Fine tune sort
390
401
  */
package/dist/index.mjs CHANGED
@@ -617,13 +617,14 @@ function definePreset(preset) {
617
617
 
618
618
  //#endregion
619
619
  //#region package.json
620
- var version = "66.6.3";
620
+ var version = "66.6.4";
621
621
 
622
622
  //#endregion
623
623
  //#region src/generator.ts
624
624
  const symbols = {
625
625
  shortcutsNoMerge: "$$symbol-shortcut-no-merge",
626
626
  noMerge: "$$symbol-no-merge",
627
+ noScope: "$$symbol-no-scope",
627
628
  variants: "$$symbol-variants",
628
629
  parent: "$$symbol-parent",
629
630
  selector: "$$symbol-selector",
@@ -656,20 +657,42 @@ var UnoGeneratorInternal = class UnoGeneratorInternal {
656
657
  ];
657
658
  let variants = context.variantHandlers;
658
659
  let entryMeta = meta;
659
- for (const entry of css) if (entry[0] === symbols.variants) if (typeof entry[1] === "function") variants = entry[1](variants) || variants;
660
- else variants = [...toArray(entry[1]), ...variants];
661
- else if (entry[0] === symbols.parent) variants = [{ parent: entry[1] }, ...variants];
662
- else if (entry[0] === symbols.selector) variants = [{ selector: entry[1] }, ...variants];
663
- else if (entry[0] === symbols.layer) variants = [{ layer: entry[1] }, ...variants];
664
- else if (entry[0] === symbols.sort) entryMeta = {
665
- ...entryMeta,
666
- sort: entry[1]
660
+ const setVariant = (variant) => {
661
+ variants = [variant, ...variants];
667
662
  };
668
- else if (entry[0] === symbols.noMerge) entryMeta = {
669
- ...entryMeta,
670
- noMerge: entry[1]
663
+ const setMeta = (partial) => {
664
+ entryMeta = {
665
+ ...entryMeta,
666
+ ...partial
667
+ };
671
668
  };
672
- else if (entry[0] === symbols.body) entry[0] = VirtualKey;
669
+ for (const entry of css) switch (entry[0]) {
670
+ case symbols.variants:
671
+ if (typeof entry[1] === "function") variants = entry[1](variants) || variants;
672
+ else variants = [...toArray(entry[1]), ...variants];
673
+ break;
674
+ case symbols.parent:
675
+ setVariant({ parent: entry[1] });
676
+ break;
677
+ case symbols.selector:
678
+ setVariant({ selector: entry[1] });
679
+ break;
680
+ case symbols.layer:
681
+ setVariant({ layer: entry[1] });
682
+ break;
683
+ case symbols.sort:
684
+ setMeta({ sort: entry[1] });
685
+ break;
686
+ case symbols.noMerge:
687
+ setMeta({ noMerge: entry[1] });
688
+ break;
689
+ case symbols.noScope:
690
+ setMeta({ noScope: entry[1] });
691
+ break;
692
+ case symbols.body:
693
+ entry[0] = VirtualKey;
694
+ break;
695
+ }
673
696
  return [
674
697
  meta.__index,
675
698
  raw,
@@ -829,7 +852,7 @@ var UnoGeneratorInternal = class UnoGeneratorInternal {
829
852
  return a[0] - b[0] || (a[4]?.sort || 0) - (b[4]?.sort || 0) || a[5]?.currentSelector?.localeCompare(b[5]?.currentSelector ?? "") || a[1]?.localeCompare(b[1] || "") || a[2]?.localeCompare(b[2] || "") || 0;
830
853
  }).map(([, selector, body, , meta, , variantNoMerge]) => {
831
854
  return [
832
- [[(selector ? applyScope(selector, scope) : selector) ?? "", meta?.sort ?? 0]],
855
+ [[(selector && !meta?.noScope ? applyScope(selector, scope) : selector) ?? "", meta?.sort ?? 0]],
833
856
  body,
834
857
  !!(variantNoMerge ?? meta?.noMerge)
835
858
  ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/core",
3
3
  "type": "module",
4
- "version": "66.6.3",
4
+ "version": "66.6.4",
5
5
  "description": "The instant on-demand Atomic CSS engine.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",