@unocss/svelte-scoped 0.53.4 → 0.53.5

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
  'use strict';
2
2
 
3
- const index = require('./shared/svelte-scoped.ff02f958.cjs');
3
+ const index = require('./shared/svelte-scoped.a06bf383.cjs');
4
4
  require('@unocss/core');
5
5
  require('@unocss/preset-uno');
6
6
  require('@unocss/config');
@@ -1,4 +1,4 @@
1
- export { U as default } from './shared/svelte-scoped.089933b6.mjs';
1
+ export { U as default } from './shared/svelte-scoped.90e5653a.mjs';
2
2
  import '@unocss/core';
3
3
  import '@unocss/preset-uno';
4
4
  import '@unocss/config';
@@ -426,12 +426,16 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
426
426
  return await transformClasses({ content, filename: filename || "", uno, options });
427
427
  },
428
428
  style: async ({ content, attributes, filename }) => {
429
- let addPreflights = !!attributes["uno:preflights"];
430
- let addSafelist = !!attributes["uno:safelist"];
429
+ const svelte3AddPreflights = attributes["uno:preflights"];
430
+ const svelte3AddSafelist = attributes["uno:safelist"];
431
+ const svelte4DeprecatedAddPreflights = attributes.uno && attributes.preflights;
432
+ const svelte4DeprecatedAddSafelist = attributes.uno && attributes.safelist;
433
+ let addPreflights = attributes["uno-preflights"] || svelte3AddPreflights || svelte4DeprecatedAddPreflights;
434
+ let addSafelist = attributes["uno-safelist"] || svelte3AddSafelist || svelte4DeprecatedAddSafelist;
431
435
  if (unoContextFromVite && (addPreflights || addSafelist)) {
432
436
  addPreflights = false;
433
437
  addSafelist = false;
434
- 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.");
438
+ 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.");
435
439
  }
436
440
  const { hasApply, applyVariables } = checkForApply(content, options.applyVariables);
437
441
  const hasThemeFn = !!content.match(themeRE);
@@ -442,7 +446,7 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
442
446
  uno = await getGenerator(options.configOrPath);
443
447
  let preflightsSafelistCss = "";
444
448
  if (addPreflights || addSafelist) {
445
- const { css } = await uno.generate([], { preflights: addPreflights, safelist: addSafelist, minify: true });
449
+ const { css } = await uno.generate([], { preflights: !!addPreflights, safelist: !!addSafelist, minify: true });
446
450
  preflightsSafelistCss = wrapSelectorsWithGlobal(css);
447
451
  }
448
452
  if (hasApply || hasThemeFn) {
@@ -433,12 +433,16 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
433
433
  return await transformClasses({ content, filename: filename || "", uno, options });
434
434
  },
435
435
  style: async ({ content, attributes, filename }) => {
436
- let addPreflights = !!attributes["uno:preflights"];
437
- let addSafelist = !!attributes["uno:safelist"];
436
+ const svelte3AddPreflights = attributes["uno:preflights"];
437
+ const svelte3AddSafelist = attributes["uno:safelist"];
438
+ const svelte4DeprecatedAddPreflights = attributes.uno && attributes.preflights;
439
+ const svelte4DeprecatedAddSafelist = attributes.uno && attributes.safelist;
440
+ let addPreflights = attributes["uno-preflights"] || svelte3AddPreflights || svelte4DeprecatedAddPreflights;
441
+ let addSafelist = attributes["uno-safelist"] || svelte3AddSafelist || svelte4DeprecatedAddSafelist;
438
442
  if (unoContextFromVite && (addPreflights || addSafelist)) {
439
443
  addPreflights = false;
440
444
  addSafelist = false;
441
- core.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.");
445
+ core.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
446
  }
443
447
  const { hasApply, applyVariables } = checkForApply(content, options.applyVariables);
444
448
  const hasThemeFn = !!content.match(themeRE);
@@ -449,7 +453,7 @@ function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
449
453
  uno = await getGenerator(options.configOrPath);
450
454
  let preflightsSafelistCss = "";
451
455
  if (addPreflights || addSafelist) {
452
- const { css } = await uno.generate([], { preflights: addPreflights, safelist: addSafelist, minify: true });
456
+ const { css } = await uno.generate([], { preflights: !!addPreflights, safelist: !!addSafelist, minify: true });
453
457
  preflightsSafelistCss = wrapSelectorsWithGlobal(css);
454
458
  }
455
459
  if (hasApply || hasThemeFn) {
package/dist/vite.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const core = require('@unocss/core');
4
4
  const config = require('@unocss/config');
5
- const index = require('./shared/svelte-scoped.ff02f958.cjs');
5
+ const index = require('./shared/svelte-scoped.a06bf383.cjs');
6
6
  const node_fs = require('node:fs');
7
7
  const node_path = require('node:path');
8
8
  const node_url = require('node:url');
package/dist/vite.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { cssIdRE, createGenerator } from '@unocss/core';
2
2
  import { loadConfig } from '@unocss/config';
3
- import { U as UnocssSveltePreprocess } from './shared/svelte-scoped.089933b6.mjs';
3
+ import { U as UnocssSveltePreprocess } from './shared/svelte-scoped.90e5653a.mjs';
4
4
  import { readFileSync, existsSync, statSync } from 'node:fs';
5
5
  import { dirname, resolve } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/svelte-scoped",
3
3
  "type": "module",
4
- "version": "0.53.4",
4
+ "version": "0.53.5",
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, preprocessor for component libraries",
6
6
  "author": "Jacob Bowdoin",
7
7
  "license": "MIT",
@@ -53,13 +53,13 @@
53
53
  ],
54
54
  "dependencies": {
55
55
  "css-tree": "^2.3.1",
56
- "magic-string": "^0.30.0",
57
- "@unocss/config": "0.53.4",
58
- "@unocss/reset": "0.53.4"
56
+ "magic-string": "^0.30.1",
57
+ "@unocss/config": "0.53.5",
58
+ "@unocss/reset": "0.53.5"
59
59
  },
60
60
  "devDependencies": {
61
61
  "prettier-plugin-svelte": "^2.10.1",
62
- "svelte": "^3.59.1"
62
+ "svelte": "^4.0.5"
63
63
  },
64
64
  "scripts": {
65
65
  "build": "unbuild",