@unocss/svelte-scoped 0.62.4 → 0.63.0

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.
@@ -1,6 +1,6 @@
1
1
  import { PreprocessorGroup } from 'svelte/types/compiler/preprocess';
2
- import { U as UnocssSveltePreprocessOptions, S as SvelteScopedContext } from './shared/svelte-scoped.rCC-t1bd.mjs';
3
- export { a as TransformApplyOptions, T as TransformClassesOptions } from './shared/svelte-scoped.rCC-t1bd.mjs';
2
+ import { U as UnocssSveltePreprocessOptions, S as SvelteScopedContext } from './shared/svelte-scoped.BG2YMHlZ.mjs';
3
+ export { a as TransformApplyOptions, T as TransformClassesOptions, b as TransformDirectivesOptions } from './shared/svelte-scoped.BG2YMHlZ.mjs';
4
4
  import '@unocss/config';
5
5
  import '@unocss/core';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { PreprocessorGroup } from 'svelte/types/compiler/preprocess';
2
- import { U as UnocssSveltePreprocessOptions, S as SvelteScopedContext } from './shared/svelte-scoped.rCC-t1bd.js';
3
- export { a as TransformApplyOptions, T as TransformClassesOptions } from './shared/svelte-scoped.rCC-t1bd.js';
2
+ import { U as UnocssSveltePreprocessOptions, S as SvelteScopedContext } from './shared/svelte-scoped.BG2YMHlZ.js';
3
+ export { a as TransformApplyOptions, T as TransformClassesOptions, b as TransformDirectivesOptions } from './shared/svelte-scoped.BG2YMHlZ.js';
4
4
  import '@unocss/config';
5
5
  import '@unocss/core';
6
6
 
@@ -1,4 +1,4 @@
1
- export { U as default } from './shared/svelte-scoped.C_b8iifX.mjs';
1
+ export { U as default } from './shared/svelte-scoped.DPsPs-Am.mjs';
2
2
  import 'node:process';
3
3
  import '@unocss/config';
4
4
  import '@unocss/core';
@@ -1,7 +1,7 @@
1
1
  import { LoadConfigResult } from '@unocss/config';
2
2
  import { UserConfig, UnoGenerator } from '@unocss/core';
3
3
 
4
- interface UnocssSveltePreprocessOptions extends TransformClassesOptions, TransformApplyOptions {
4
+ interface UnocssSveltePreprocessOptions extends TransformClassesOptions, TransformApplyOptions, TransformDirectivesOptions {
5
5
  /**
6
6
  * UnoCSS config or path to config file. If not provided, will load unocss.config.ts/js. It's recommended to use the separate config file if you are having trouble with the UnoCSS extension in VSCode.
7
7
  */
@@ -37,9 +37,22 @@ interface TransformApplyOptions {
37
37
  applyVariables?: string | string[] | false
38
38
  }
39
39
 
40
+ interface TransformDirectivesOptions {
41
+ /**
42
+ * Transform the `theme()` directive (recommended for CSS syntax compatibility).
43
+ *
44
+ * Disable for TailwindCss compatibility.
45
+ *
46
+ * Pass `false` to disable.
47
+ *
48
+ * @default true
49
+ */
50
+ transformThemeDirective?: boolean
51
+ }
52
+
40
53
  interface SvelteScopedContext {
41
54
  uno: UnoGenerator
42
55
  ready: Promise<LoadConfigResult<UserConfig>>
43
56
  }
44
57
 
45
- export type { SvelteScopedContext as S, TransformClassesOptions as T, UnocssSveltePreprocessOptions as U, TransformApplyOptions as a };
58
+ export type { SvelteScopedContext as S, TransformClassesOptions as T, UnocssSveltePreprocessOptions as U, TransformApplyOptions as a, TransformDirectivesOptions as b };
@@ -1,7 +1,7 @@
1
1
  import { LoadConfigResult } from '@unocss/config';
2
2
  import { UserConfig, UnoGenerator } from '@unocss/core';
3
3
 
4
- interface UnocssSveltePreprocessOptions extends TransformClassesOptions, TransformApplyOptions {
4
+ interface UnocssSveltePreprocessOptions extends TransformClassesOptions, TransformApplyOptions, TransformDirectivesOptions {
5
5
  /**
6
6
  * UnoCSS config or path to config file. If not provided, will load unocss.config.ts/js. It's recommended to use the separate config file if you are having trouble with the UnoCSS extension in VSCode.
7
7
  */
@@ -37,9 +37,22 @@ interface TransformApplyOptions {
37
37
  applyVariables?: string | string[] | false
38
38
  }
39
39
 
40
+ interface TransformDirectivesOptions {
41
+ /**
42
+ * Transform the `theme()` directive (recommended for CSS syntax compatibility).
43
+ *
44
+ * Disable for TailwindCss compatibility.
45
+ *
46
+ * Pass `false` to disable.
47
+ *
48
+ * @default true
49
+ */
50
+ transformThemeDirective?: boolean
51
+ }
52
+
40
53
  interface SvelteScopedContext {
41
54
  uno: UnoGenerator
42
55
  ready: Promise<LoadConfigResult<UserConfig>>
43
56
  }
44
57
 
45
- export type { SvelteScopedContext as S, TransformClassesOptions as T, UnocssSveltePreprocessOptions as U, TransformApplyOptions as a };
58
+ export type { SvelteScopedContext as S, TransformClassesOptions as T, UnocssSveltePreprocessOptions as U, TransformApplyOptions as a, TransformDirectivesOptions as b };
@@ -398,12 +398,12 @@ async function transformStyle({
398
398
  prepend,
399
399
  filename,
400
400
  applyVariables,
401
- hasThemeFn
401
+ transformThemeFn
402
402
  }) {
403
403
  const s = new MagicString(content);
404
404
  if (applyVariables?.length)
405
405
  await transformApply({ s, uno, applyVariables });
406
- if (hasThemeFn)
406
+ if (transformThemeFn)
407
407
  transformTheme(s, uno.config.theme);
408
408
  if (!s.hasChanged())
409
409
  return;
@@ -441,7 +441,7 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
441
441
  warnOnce("Notice for those transitioning to @unocss/svelte-scoped/vite: uno-preflights and uno-safelist are only for use in component libraries. Please see the documentation for how to add preflights and safelist into your head tag. If you are consuming a component library built by @unocss/svelte-scoped/preprocess, you can ignore this upgrade notice.");
442
442
  }
443
443
  const { hasApply, applyVariables } = checkForApply(content, options.applyVariables);
444
- const hasThemeFn = !!content.match(themeRE);
444
+ const hasThemeFn = options.transformThemeDirective === false ? false : !!content.match(themeRE);
445
445
  const changeNeeded = addPreflights || addSafelist || hasApply || hasThemeFn;
446
446
  if (!changeNeeded)
447
447
  return;
@@ -459,7 +459,7 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
459
459
  filename,
460
460
  prepend: preflightsSafelistCss,
461
461
  applyVariables,
462
- hasThemeFn
462
+ transformThemeFn: hasThemeFn
463
463
  });
464
464
  }
465
465
  if (preflightsSafelistCss)
package/dist/vite.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from 'vite';
2
2
  import { PluginOptions } from '@unocss/core';
3
- import { U as UnocssSveltePreprocessOptions } from './shared/svelte-scoped.rCC-t1bd.mjs';
3
+ import { U as UnocssSveltePreprocessOptions } from './shared/svelte-scoped.BG2YMHlZ.mjs';
4
4
  import '@unocss/config';
5
5
 
6
6
  interface UnocssSvelteScopedViteOptions extends UnocssSveltePreprocessOptions {
package/dist/vite.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from 'vite';
2
2
  import { PluginOptions } from '@unocss/core';
3
- import { U as UnocssSveltePreprocessOptions } from './shared/svelte-scoped.rCC-t1bd.js';
3
+ import { U as UnocssSveltePreprocessOptions } from './shared/svelte-scoped.BG2YMHlZ.js';
4
4
  import '@unocss/config';
5
5
 
6
6
  interface UnocssSvelteScopedViteOptions extends UnocssSveltePreprocessOptions {
package/dist/vite.mjs CHANGED
@@ -7,7 +7,7 @@ import MagicString from 'magic-string';
7
7
  import { readFileSync, existsSync, statSync } from 'node:fs';
8
8
  import { dirname, resolve } from 'node:path';
9
9
  import { fileURLToPath } from 'node:url';
10
- import { U as UnocssSveltePreprocess } from './shared/svelte-scoped.C_b8iifX.mjs';
10
+ import { U as UnocssSveltePreprocess } from './shared/svelte-scoped.DPsPs-Am.mjs';
11
11
  import 'css-tree';
12
12
 
13
13
  function ConfigHMRPlugin({ ready }) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/svelte-scoped",
3
3
  "type": "module",
4
- "version": "0.62.4",
4
+ "version": "0.63.0",
5
5
  "description": "Use UnoCSS in a modular fashion with styles being stored only in the Svelte component they are used in: Vite plugin for apps, Svelte preprocessor for component libraries",
6
6
  "author": "Jacob Bowdoin",
7
7
  "license": "MIT",
@@ -50,11 +50,11 @@
50
50
  "dist"
51
51
  ],
52
52
  "dependencies": {
53
- "css-tree": "^2.3.1",
53
+ "css-tree": "^3.0.0",
54
54
  "magic-string": "^0.30.11",
55
- "@unocss/config": "0.62.4",
56
- "@unocss/preset-uno": "0.62.4",
57
- "@unocss/reset": "0.62.4"
55
+ "@unocss/config": "0.63.0",
56
+ "@unocss/reset": "0.63.0",
57
+ "@unocss/preset-uno": "0.63.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "prettier-plugin-svelte": "^2.10.1",