@unocss/svelte-scoped 0.53.4 → 0.53.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.
@@ -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.6b434367.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.90d314b5.mjs';
2
2
  import '@unocss/core';
3
3
  import '@unocss/preset-uno';
4
4
  import '@unocss/config';
@@ -422,23 +422,27 @@ async function transformStyle({ content, uno, prepend, filename, applyVariables,
422
422
 
423
423
  function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
424
424
  if (!options.classPrefix)
425
- options.classPrefix = "spu-";
425
+ options.classPrefix = "usp-";
426
426
  let uno;
427
427
  return {
428
428
  markup: async ({ content, filename }) => {
429
429
  if (!uno)
430
430
  uno = await getGenerator(options.configOrPath, unoContextFromVite);
431
- if (isViteBuild && !options.combine)
431
+ if (isViteBuild && options.combine === void 0)
432
432
  options.combine = 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) {
@@ -415,23 +415,27 @@ async function transformStyle({ content, uno, prepend, filename, applyVariables,
415
415
 
416
416
  function UnocssSveltePreprocess(options = {}, unoContextFromVite, isViteBuild) {
417
417
  if (!options.classPrefix)
418
- options.classPrefix = "spu-";
418
+ options.classPrefix = "usp-";
419
419
  let uno;
420
420
  return {
421
421
  markup: async ({ content, filename }) => {
422
422
  if (!uno)
423
423
  uno = await getGenerator(options.configOrPath, unoContextFromVite);
424
- if (isViteBuild && !options.combine)
424
+ if (isViteBuild && options.combine === void 0)
425
425
  options.combine = 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) {
package/dist/vite.cjs CHANGED
@@ -2,18 +2,19 @@
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 presetUno = require('@unocss/preset-uno');
6
+ const index = require('./shared/svelte-scoped.6b434367.cjs');
6
7
  const node_fs = require('node:fs');
7
8
  const node_path = require('node:path');
8
9
  const node_url = require('node:url');
9
10
  const MagicString = require('magic-string');
10
11
  const remapping = require('@ampproject/remapping');
11
12
  require('node:crypto');
12
- require('@unocss/preset-uno');
13
13
  require('css-tree');
14
14
 
15
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
16
16
 
17
+ const presetUno__default = /*#__PURE__*/_interopDefaultLegacy(presetUno);
17
18
  const MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
18
19
  const remapping__default = /*#__PURE__*/_interopDefaultLegacy(remapping);
19
20
 
@@ -238,6 +239,8 @@ function UnocssSvelteScopedVite(options = {}) {
238
239
  const context = createSvelteScopedContext(options.configOrPath);
239
240
  if (context.uno.config.transformers)
240
241
  throw new Error('Due to the differences in normal UnoCSS global usage and Svelte Scoped usage, "config.transformers" will be ignored. You can still use transformers in CSS files with the "cssFileTransformers" option.');
242
+ if (!options.classPrefix)
243
+ options.classPrefix = "uno-";
241
244
  const plugins = [
242
245
  GlobalStylesPlugin(context, options.injectReset)
243
246
  ];
@@ -247,12 +250,17 @@ function UnocssSvelteScopedVite(options = {}) {
247
250
  plugins.push(...createCssTransformerPlugins(context, options.cssFileTransformers));
248
251
  return plugins;
249
252
  }
253
+ const defaults = {
254
+ presets: [
255
+ presetUno__default()
256
+ ]
257
+ };
250
258
  function createSvelteScopedContext(configOrPath) {
251
259
  const uno = core.createGenerator();
252
260
  const ready = reloadConfig();
253
261
  async function reloadConfig() {
254
262
  const { config: config$1 } = await config.loadConfig(process.cwd(), configOrPath);
255
- uno.setConfig(config$1);
263
+ uno.setConfig(config$1, defaults);
256
264
  return config$1;
257
265
  }
258
266
  return {
package/dist/vite.mjs CHANGED
@@ -1,13 +1,13 @@
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 presetUno from '@unocss/preset-uno';
4
+ import { U as UnocssSveltePreprocess } from './shared/svelte-scoped.90d314b5.mjs';
4
5
  import { readFileSync, existsSync, statSync } from 'node:fs';
5
6
  import { dirname, resolve } from 'node:path';
6
7
  import { fileURLToPath } from 'node:url';
7
8
  import MagicString from 'magic-string';
8
9
  import remapping from '@ampproject/remapping';
9
10
  import 'node:crypto';
10
- import '@unocss/preset-uno';
11
11
  import 'css-tree';
12
12
 
13
13
  function PassPreprocessToSveltePlugin(options = {}, ctx) {
@@ -231,6 +231,8 @@ function UnocssSvelteScopedVite(options = {}) {
231
231
  const context = createSvelteScopedContext(options.configOrPath);
232
232
  if (context.uno.config.transformers)
233
233
  throw new Error('Due to the differences in normal UnoCSS global usage and Svelte Scoped usage, "config.transformers" will be ignored. You can still use transformers in CSS files with the "cssFileTransformers" option.');
234
+ if (!options.classPrefix)
235
+ options.classPrefix = "uno-";
234
236
  const plugins = [
235
237
  GlobalStylesPlugin(context, options.injectReset)
236
238
  ];
@@ -240,12 +242,17 @@ function UnocssSvelteScopedVite(options = {}) {
240
242
  plugins.push(...createCssTransformerPlugins(context, options.cssFileTransformers));
241
243
  return plugins;
242
244
  }
245
+ const defaults = {
246
+ presets: [
247
+ presetUno()
248
+ ]
249
+ };
243
250
  function createSvelteScopedContext(configOrPath) {
244
251
  const uno = createGenerator();
245
252
  const ready = reloadConfig();
246
253
  async function reloadConfig() {
247
254
  const { config } = await loadConfig(process.cwd(), configOrPath);
248
- uno.setConfig(config);
255
+ uno.setConfig(config, defaults);
249
256
  return config;
250
257
  }
251
258
  return {
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.6",
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.6",
58
+ "@unocss/reset": "0.53.6"
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",