@niibase/uniwind 1.0.13 → 1.1.1

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.
Files changed (38) hide show
  1. package/dist/common/core/index.js +13 -9
  2. package/dist/common/core/native/store.js +3 -33
  3. package/dist/common/css/themes.js +1 -1
  4. package/dist/common/utils/buildDtsFile.js +2 -2
  5. package/dist/common/vite/vite.js +4 -4
  6. package/dist/metro/index.cjs +8 -6
  7. package/dist/metro/index.mjs +8 -6
  8. package/dist/metro/metro-transformer.cjs +69 -56
  9. package/dist/metro/metro-transformer.mjs +69 -56
  10. package/dist/module/core/index.d.ts +9 -1
  11. package/dist/module/core/index.js +12 -1
  12. package/dist/module/core/native/store.d.ts +0 -2
  13. package/dist/module/core/native/store.js +3 -30
  14. package/dist/module/core/types.d.ts +0 -10
  15. package/dist/module/css/themes.js +1 -0
  16. package/dist/module/utils/buildDtsFile.js +4 -4
  17. package/dist/module/vite/vite.js +1 -1
  18. package/dist/shared/{uniwind.D6IIgDk0.cjs → uniwind.BDoX4wlN.cjs} +4 -7
  19. package/dist/shared/{uniwind.B0G4wRM3.mjs → uniwind.D8_HBWsJ.mjs} +5 -4
  20. package/dist/shared/{uniwind.DkoxF6fp.cjs → uniwind.DeQhDtT7.cjs} +5 -4
  21. package/dist/shared/{uniwind.BJZZANs0.mjs → uniwind.DhluOugg.mjs} +4 -7
  22. package/dist/vite/index.cjs +5 -6
  23. package/dist/vite/index.mjs +5 -6
  24. package/package.json +3 -1
  25. package/scripts/postinstall.mjs +57 -0
  26. package/src/core/index.tsx +18 -0
  27. package/src/core/native/store.ts +5 -51
  28. package/src/core/types.ts +0 -10
  29. package/src/css/themes.ts +1 -0
  30. package/src/metro/compileVirtual.ts +1 -5
  31. package/src/metro/metro-transformer.ts +3 -3
  32. package/src/metro/processor/processor.ts +72 -60
  33. package/src/metro/resolvers.ts +8 -6
  34. package/src/metro/utils/common.ts +2 -0
  35. package/src/utils/buildDtsFile.ts +4 -4
  36. package/src/vite/vite.ts +1 -1
  37. package/src/core/index.ts +0 -1
  38. package/src/metro/packageName.ts +0 -7
@@ -3,14 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.Uniwind = void 0;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _react = require("react");
9
+ var _hoc = require("../hoc");
6
10
  var _config = require("./config");
7
- Object.keys(_config).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _config[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _config[key];
14
- }
11
+ const Box = ({
12
+ as,
13
+ ...props
14
+ }) => {
15
+ const StyledComponent = (0, _react.useMemo)(() => (0, _hoc.withUniwind)(as), [as]);
16
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(StyledComponent, {
17
+ ...props
15
18
  });
16
- });
19
+ };
20
+ const Uniwind = exports.Uniwind = Object.assign(Box, _config.Uniwind);
@@ -15,7 +15,6 @@ class UniwindStoreBuilder {
15
15
  vars = {};
16
16
  runtimeThemeVariables = /* @__PURE__ */new Map();
17
17
  stylesheet = {};
18
- varsWithMediaQueries = [];
19
18
  cache = /* @__PURE__ */new Map();
20
19
  generateStyleSheetCallbackResult = null;
21
20
  getStyles(className, state) {
@@ -44,15 +43,11 @@ class UniwindStoreBuilder {
44
43
  const {
45
44
  scopedVars,
46
45
  stylesheet,
47
- vars,
48
- varsWithMediaQueries
46
+ vars
49
47
  } = config;
50
- this.vars = varsWithMediaQueries.length > 0 ? {
51
- ...vars
52
- } : vars;
53
- this.varsWithMediaQueries = varsWithMediaQueries;
54
48
  this.generateStyleSheetCallbackResult = config;
55
49
  this.stylesheet = stylesheet;
50
+ this.vars = vars;
56
51
  const themeVars = scopedVars[`__uniwind-theme-${this.runtime.currentThemeName}`];
57
52
  const platformVars = scopedVars[`__uniwind-platform-${_reactNative.Platform.OS}`];
58
53
  const runtimeThemeVars = this.runtimeThemeVariables.get(this.runtime.currentThemeName);
@@ -69,36 +64,11 @@ class UniwindStoreBuilder {
69
64
  _listener.UniwindListener.notifyAll();
70
65
  }
71
66
  };
72
- resolveMediaQueryVars(dependencies) {
73
- for (const [varName, mqVariants] of this.varsWithMediaQueries) {
74
- let bestMatch = null;
75
- for (const variant of mqVariants) {
76
- if (variant.orientation !== null) dependencies.add(_types.StyleDependency.Orientation);
77
- if (variant.maxWidth !== null || variant.minWidth !== null) dependencies.add(_types.StyleDependency.Dimensions);
78
- if (variant.colorScheme !== null) {
79
- dependencies.add(_types.StyleDependency.ColorScheme);
80
- dependencies.add(_types.StyleDependency.Theme);
81
- }
82
- if (variant.minWidth !== null && variant.minWidth > this.runtime.screen.width || variant.maxWidth !== null && variant.maxWidth !== Number.MAX_VALUE && variant.maxWidth < this.runtime.screen.width || variant.orientation !== null && this.runtime.orientation !== variant.orientation || variant.colorScheme !== null && this.runtime.currentThemeName !== variant.colorScheme) {
83
- continue;
84
- }
85
- if (bestMatch === null || (variant.minWidth ?? 0) > (bestMatch.minWidth ?? 0)) bestMatch = variant;
86
- }
87
- if (bestMatch !== null) {
88
- Object.defineProperty(this.vars, varName, {
89
- configurable: true,
90
- enumerable: true,
91
- get: () => bestMatch.value
92
- });
93
- }
94
- }
95
- return this.vars;
96
- }
97
67
  resolveStyles(classNames, state) {
98
68
  const result = {};
69
+ let vars = this.vars;
99
70
  const dependencies = /* @__PURE__ */new Set();
100
71
  const bestBreakpoints = /* @__PURE__ */new Map();
101
- let vars = this.resolveMediaQueryVars(dependencies);
102
72
  for (const className of classNames.split(" ")) {
103
73
  if (!(className in this.stylesheet)) {
104
74
  continue;
@@ -17,7 +17,7 @@ const readFileSafe = filePath => {
17
17
  return null;
18
18
  }
19
19
  };
20
- const isExcludedDependency = url => [url.includes("node_modules/tailwindcss"), url.includes("node_modules/@tailwindcss"), url.includes("node_modules/uniwind")].some(Boolean);
20
+ const isExcludedDependency = url => [url.includes("node_modules/tailwindcss"), url.includes("node_modules/@tailwindcss"), url.includes("node_modules/@niibase/uniwind"), url.includes("node_modules/uniwind")].some(Boolean);
21
21
  const generateCSSForThemes = async (themes, input) => {
22
22
  const themesVariables = Object.fromEntries(themes.map(theme => [theme, /* @__PURE__ */new Set()]));
23
23
  const findVariantsRec = async cssPath => {
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.buildDtsFile = void 0;
7
7
  var _fs = _interopRequireDefault(require("fs"));
8
- var _packageName = require("../metro/packageName");
8
+ var _package = require("../../package.json");
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
10
  const buildDtsFile = (dtsPath, stringifiedThemes) => {
11
11
  const oldDtsContent = _fs.default.existsSync(dtsPath) ? _fs.default.readFileSync(dtsPath, "utf-8") : "";
12
- const dtsContent = [`// NOTE: This file is generated by ${_packageName.packageName} and it should not be edited manually.`, `/// <reference types="${_packageName.packageName}/types" />`, "", `declare module '${_packageName.packageName}' {`, ` export interface UniwindConfig {`, ` themes: readonly ${stringifiedThemes}`, ` }`, `}`, "", `export {}`, ""].join("\n");
12
+ const dtsContent = [`// NOTE: This file is generated by ${_package.name} and it should not be edited manually.`, `/// <reference types="${_package.name}/types" />`, "", `declare module '${_package.name}' {`, ` export interface UniwindConfig {`, ` themes: readonly ${stringifiedThemes}`, ` }`, `}`, "", `export {}`, ""].join("\n");
13
13
  if (oldDtsContent === dtsContent) {
14
14
  return;
15
15
  }
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.uniwind = void 0;
7
7
  var _node = require("@tailwindcss/node");
8
8
  var _path = _interopRequireDefault(require("path"));
9
+ var _package = require("../../package.json");
9
10
  var _css = require("../css");
10
11
  var _processFunctions = require("../css/processFunctions");
11
- var _packageName = require("../metro/packageName");
12
12
  var _utils = require("../metro/utils");
13
13
  var _buildDtsFile = require("../utils/buildDtsFile");
14
14
  var _stringifyThemes = require("../utils/stringifyThemes");
@@ -34,7 +34,7 @@ const uniwind = ({
34
34
  }
35
35
  },
36
36
  optimizeDeps: {
37
- exclude: [_packageName.packageName, "react-native"]
37
+ exclude: [_package.name, "react-native"]
38
38
  },
39
39
  resolve: {
40
40
  alias: [{
@@ -42,7 +42,7 @@ const uniwind = ({
42
42
  replacement: componentPath,
43
43
  customResolver: {
44
44
  resolveId(_, importer) {
45
- if (importer !== void 0 && (0, _node.normalizePath)(importer).includes(`${_packageName.packageName}/dist`)) {
45
+ if (importer !== void 0 && (0, _node.normalizePath)(importer).includes(`${_package.name}/dist`)) {
46
46
  return this.resolve("react-native-web");
47
47
  }
48
48
  return componentPath;
@@ -53,7 +53,7 @@ const uniwind = ({
53
53
  }),
54
54
  transform: (code, id) => {
55
55
  const normalizedId = (0, _node.normalizePath)(id);
56
- if (normalizedId.includes(`${_packageName.packageName}/dist`) && normalizedId.includes("config/config.js")) {
56
+ if (normalizedId.includes(`${_package.name}/dist`) && normalizedId.includes("config/config.js")) {
57
57
  return {
58
58
  code: `${code}Uniwind.__reinit(() => ({}), ${stringifiedThemes})`
59
59
  };
@@ -4,7 +4,7 @@ const FileStoreBase = require('metro-cache/private/stores/FileStore');
4
4
  const os = require('os');
5
5
  const path = require('path');
6
6
  const node_path = require('node:path');
7
- const common = require('../shared/uniwind.D6IIgDk0.cjs');
7
+ const common = require('../shared/uniwind.BDoX4wlN.cjs');
8
8
  const types = require('../shared/uniwind.BZIuaszw.cjs');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
@@ -46,7 +46,9 @@ const patchMetroGraphToSupportUncachedModules = () => {
46
46
 
47
47
  const thisModuleDist = node_path.resolve(__dirname, "../../dist");
48
48
  const thisModuleSrc = node_path.resolve(__dirname, "../../src");
49
+ const nodeModulesPath = node_path.resolve(__dirname, "../../../");
49
50
  const isFromThisModule = (filename) => filename.startsWith(thisModuleDist) || filename.startsWith(thisModuleSrc);
51
+ const name = node_path.basename(nodeModulesPath) === "node_modules" ? node_path.basename(node_path.resolve(__dirname, "../../")) : common.name;
50
52
  const SUPPORTED_COMPONENTS = [
51
53
  "ActivityIndicator",
52
54
  "Button",
@@ -86,19 +88,19 @@ const nativeResolver = (extraComponents) => ({
86
88
  return resolution;
87
89
  }
88
90
  if (moduleName === "react-native") {
89
- return resolver(context, `${common.packageName}/components`, platform);
91
+ return resolver(context, `${name}/components`, platform);
90
92
  }
91
93
  if (moduleName === "react-native-gesture-handler") {
92
- return resolver(context, `${common.packageName}/components/react-native-gesture-handler`, platform);
94
+ return resolver(context, `${name}/components/react-native-gesture-handler`, platform);
93
95
  }
94
96
  if (moduleName === "react-native-svg") {
95
- return resolver(context, `${common.packageName}/components/react-native-svg`, platform);
97
+ return resolver(context, `${name}/components/react-native-svg`, platform);
96
98
  }
97
99
  if (resolution.filePath.includes(`${node_path.sep}react-native${node_path.sep}Libraries${node_path.sep}`)) {
98
100
  const filename = node_path.basename(resolution.filePath.split(node_path.sep).at(-1) ?? "");
99
101
  const module = filename.split(".").at(0);
100
102
  if (module !== void 0 && SUPPORTED_COMPONENTS.includes(module)) {
101
- return resolver(context, `${common.packageName}/components/${module}`, platform);
103
+ return resolver(context, `${name}/components/${module}`, platform);
102
104
  }
103
105
  }
104
106
  if (moduleName in extraComponents) {
@@ -127,7 +129,7 @@ const webResolver = (extraComponents) => ({
127
129
  if (!isIndex || module === void 0 || !SUPPORTED_COMPONENTS.includes(module) || context.originModulePath.endsWith(`${module}${node_path.sep}index.js`)) {
128
130
  return resolution;
129
131
  }
130
- return resolver(context, `${common.packageName}/components/${module}`, platform);
132
+ return resolver(context, `${name}/components/${module}`, platform);
131
133
  };
132
134
 
133
135
  const withUniwindConfig = (config, uniwindConfig) => {
@@ -2,7 +2,7 @@ import FileStoreBase from 'metro-cache/private/stores/FileStore';
2
2
  import os from 'os';
3
3
  import path from 'path';
4
4
  import { sep, basename, resolve } from 'node:path';
5
- import { p as packageName, u as uniq } from '../shared/uniwind.BJZZANs0.mjs';
5
+ import { n as name$1, u as uniq } from '../shared/uniwind.DhluOugg.mjs';
6
6
  import { P as Platform } from '../shared/uniwind.CyoRUwOj.mjs';
7
7
 
8
8
  class FileStore extends FileStoreBase {
@@ -38,7 +38,9 @@ const patchMetroGraphToSupportUncachedModules = () => {
38
38
 
39
39
  const thisModuleDist = resolve(__dirname, "../../dist");
40
40
  const thisModuleSrc = resolve(__dirname, "../../src");
41
+ const nodeModulesPath = resolve(__dirname, "../../../");
41
42
  const isFromThisModule = (filename) => filename.startsWith(thisModuleDist) || filename.startsWith(thisModuleSrc);
43
+ const name = basename(nodeModulesPath) === "node_modules" ? basename(resolve(__dirname, "../../")) : name$1;
42
44
  const SUPPORTED_COMPONENTS = [
43
45
  "ActivityIndicator",
44
46
  "Button",
@@ -78,19 +80,19 @@ const nativeResolver = (extraComponents) => ({
78
80
  return resolution;
79
81
  }
80
82
  if (moduleName === "react-native") {
81
- return resolver(context, `${packageName}/components`, platform);
83
+ return resolver(context, `${name}/components`, platform);
82
84
  }
83
85
  if (moduleName === "react-native-gesture-handler") {
84
- return resolver(context, `${packageName}/components/react-native-gesture-handler`, platform);
86
+ return resolver(context, `${name}/components/react-native-gesture-handler`, platform);
85
87
  }
86
88
  if (moduleName === "react-native-svg") {
87
- return resolver(context, `${packageName}/components/react-native-svg`, platform);
89
+ return resolver(context, `${name}/components/react-native-svg`, platform);
88
90
  }
89
91
  if (resolution.filePath.includes(`${sep}react-native${sep}Libraries${sep}`)) {
90
92
  const filename = basename(resolution.filePath.split(sep).at(-1) ?? "");
91
93
  const module = filename.split(".").at(0);
92
94
  if (module !== void 0 && SUPPORTED_COMPONENTS.includes(module)) {
93
- return resolver(context, `${packageName}/components/${module}`, platform);
95
+ return resolver(context, `${name}/components/${module}`, platform);
94
96
  }
95
97
  }
96
98
  if (moduleName in extraComponents) {
@@ -119,7 +121,7 @@ const webResolver = (extraComponents) => ({
119
121
  if (!isIndex || module === void 0 || !SUPPORTED_COMPONENTS.includes(module) || context.originModulePath.endsWith(`${module}${sep}index.js`)) {
120
122
  return resolution;
121
123
  }
122
- return resolver(context, `${packageName}/components/${module}`, platform);
124
+ return resolver(context, `${name}/components/${module}`, platform);
123
125
  };
124
126
 
125
127
  const withUniwindConfig = (config, uniwindConfig) => {
@@ -2,14 +2,13 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const common = require('../shared/uniwind.BDoX4wlN.cjs');
5
6
  const node = require('@tailwindcss/node');
6
7
  const oxide = require('@tailwindcss/oxide');
7
8
  const types = require('../shared/uniwind.BZIuaszw.cjs');
8
- const stringifyThemes = require('../shared/uniwind.DkoxF6fp.cjs');
9
- const common = require('../shared/uniwind.D6IIgDk0.cjs');
9
+ const stringifyThemes = require('../shared/uniwind.DeQhDtT7.cjs');
10
10
  const lightningcss = require('lightningcss');
11
11
  const culori = require('culori');
12
- require('node:path');
13
12
 
14
13
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
15
14
 
@@ -1257,7 +1256,6 @@ class ProcessorBuilder {
1257
1256
  stylesheets = {};
1258
1257
  vars = {};
1259
1258
  scopedVars = {};
1260
- varsWithMediaQueries = {};
1261
1259
  CSS = new CSS(this);
1262
1260
  RN = new RN(this);
1263
1261
  Var = new Var(this);
@@ -1266,16 +1264,32 @@ class ProcessorBuilder {
1266
1264
  Units = new Units(this);
1267
1265
  Functions = new Functions(this);
1268
1266
  meta = {};
1267
+ varsWithMediaQueries = {};
1268
+ pendingVarReferences = /* @__PURE__ */ new Map();
1269
1269
  declarationConfig = this.getDeclarationConfig();
1270
1270
  transform(css) {
1271
1271
  lightningcss.transform({
1272
1272
  filename: "tailwind.css",
1273
1273
  code: Buffer.from(css),
1274
1274
  visitor: {
1275
- StyleSheet: (styleSheet) => styleSheet.rules.forEach((rule) => {
1276
- this.declarationConfig = this.getDeclarationConfig();
1277
- this.parseRuleRec(rule);
1278
- })
1275
+ StyleSheet: (styleSheet) => {
1276
+ styleSheet.rules.forEach((rule) => {
1277
+ this.declarationConfig = this.getDeclarationConfig();
1278
+ this.parseRuleRec(rule);
1279
+ });
1280
+ for (const [className, varNames] of this.pendingVarReferences) {
1281
+ for (const varName of varNames) {
1282
+ const varStyles = this.varsWithMediaQueries[varName];
1283
+ if (!varStyles || varStyles.length === 0) {
1284
+ continue;
1285
+ }
1286
+ for (const varStyle of varStyles) {
1287
+ this.stylesheets[className].push(varStyle);
1288
+ }
1289
+ }
1290
+ this.pendingVarReferences.delete(className);
1291
+ }
1292
+ }
1279
1293
  }
1280
1294
  });
1281
1295
  }
@@ -1291,35 +1305,13 @@ class ProcessorBuilder {
1291
1305
  disabled: null
1292
1306
  };
1293
1307
  }
1294
- storeVarWithMediaQuery(varName, value, mq) {
1295
- if (!Array.isArray(this.varsWithMediaQueries[varName])) {
1296
- this.varsWithMediaQueries[varName] = [];
1297
- }
1298
- this.varsWithMediaQueries[varName].push({
1299
- value,
1300
- minWidth: mq.minWidth,
1301
- maxWidth: mq.maxWidth,
1302
- orientation: mq.orientation ? `'${mq.orientation}'` : null,
1303
- colorScheme: mq.colorScheme ? `'${mq.colorScheme}'` : null
1304
- });
1305
- }
1306
1308
  hasMediaQuery(mq) {
1307
1309
  return mq.minWidth !== 0 || mq.maxWidth !== Number.MAX_VALUE || mq.orientation !== null || mq.colorScheme !== null;
1308
1310
  }
1309
- processDeclarationValue(mq, varName, processedValue, context) {
1310
- const { isVar, style, important } = context;
1311
- if (isVar && this.hasMediaQuery(mq)) {
1312
- this.storeVarWithMediaQuery(varName, processedValue, mq);
1313
- } else {
1314
- style[varName] = processedValue;
1315
- }
1316
- if (!isVar && important) {
1317
- style.importantProperties.push(varName);
1318
- }
1319
- }
1320
1311
  addDeclaration(declaration, important = false) {
1321
1312
  const isVar = this.declarationConfig.root || this.declarationConfig.className === null;
1322
1313
  const mq = this.MQ.processMediaQueries(this.declarationConfig.mediaQueries);
1314
+ const { property, value } = this.parseDeclaration(declaration);
1323
1315
  const style = (() => {
1324
1316
  if (!isVar) {
1325
1317
  return this.stylesheets[this.declarationConfig.className]?.at(-1);
@@ -1329,6 +1321,11 @@ class ProcessorBuilder {
1329
1321
  this.scopedVars[platformKey] ??= {};
1330
1322
  return this.scopedVars[platformKey];
1331
1323
  }
1324
+ if (this.hasMediaQuery(mq)) {
1325
+ this.varsWithMediaQueries[property] ??= [];
1326
+ this.varsWithMediaQueries[property].push({});
1327
+ return this.varsWithMediaQueries[property].at(-1);
1328
+ }
1332
1329
  if (this.declarationConfig.theme === null) {
1333
1330
  return this.vars;
1334
1331
  }
@@ -1336,32 +1333,56 @@ class ProcessorBuilder {
1336
1333
  this.scopedVars[themeKey] ??= {};
1337
1334
  return this.scopedVars[themeKey];
1338
1335
  })();
1339
- if (!isVar) {
1336
+ if (!isVar || this.hasMediaQuery(mq)) {
1340
1337
  Object.assign(style, mq);
1341
1338
  style.importantProperties ??= [];
1342
1339
  style.rtl = this.declarationConfig.rtl;
1343
1340
  style.theme = mq.colorScheme ?? this.declarationConfig.theme;
1341
+ style.maxWidth = mq.maxWidth;
1342
+ style.minWidth = mq.minWidth;
1343
+ style.orientation = mq.orientation;
1344
1344
  style.active = this.declarationConfig.active;
1345
1345
  style.focus = this.declarationConfig.focus;
1346
1346
  style.disabled = this.declarationConfig.disabled;
1347
1347
  this.meta.className = this.declarationConfig.className;
1348
1348
  }
1349
- const context = { isVar, style, important };
1349
+ style[property] = value;
1350
+ if (!isVar && important) {
1351
+ style.importantProperties.push(property);
1352
+ }
1353
+ const match = typeof value === "string" ? value.match(/this\[`(.*?)`\]/) : null;
1354
+ if (match && !isVar) {
1355
+ const className = this.declarationConfig.className;
1356
+ if (className === null) {
1357
+ return;
1358
+ }
1359
+ if (!this.pendingVarReferences.has(className)) {
1360
+ this.pendingVarReferences.set(className, []);
1361
+ }
1362
+ const classVars = this.pendingVarReferences.get(className);
1363
+ const varName = match[1];
1364
+ if (!classVars.includes(varName)) {
1365
+ classVars.push(varName);
1366
+ }
1367
+ }
1368
+ }
1369
+ parseDeclaration(declaration) {
1350
1370
  if (declaration.property === "unparsed") {
1351
- const varName2 = declaration.value.propertyId.property;
1352
- const processedValue2 = this.CSS.processValue(declaration.value.value);
1353
- this.processDeclarationValue(mq, varName2, processedValue2, context);
1354
- return;
1371
+ return {
1372
+ property: declaration.value.propertyId.property,
1373
+ value: this.CSS.processValue(declaration.value.value)
1374
+ };
1355
1375
  }
1356
1376
  if (declaration.property === "custom") {
1357
- const varName2 = declaration.value.name;
1358
- const processedValue2 = this.CSS.processValue(declaration.value.value);
1359
- this.processDeclarationValue(mq, varName2, processedValue2, context);
1360
- return;
1377
+ return {
1378
+ property: declaration.value.name,
1379
+ value: this.CSS.processValue(declaration.value.value)
1380
+ };
1361
1381
  }
1362
- const varName = declaration.property;
1363
- const processedValue = this.CSS.processValue(declaration.value);
1364
- this.processDeclarationValue(mq, varName, processedValue, context);
1382
+ return {
1383
+ property: declaration.property,
1384
+ value: this.CSS.processValue(declaration.value)
1385
+ };
1365
1386
  }
1366
1387
  parseRuleRec(rule) {
1367
1388
  if (this.declarationConfig.className !== null) {
@@ -1445,14 +1466,8 @@ class ProcessorBuilder {
1445
1466
  if (rule.type === "media") {
1446
1467
  const { mediaQueries } = rule.value.query;
1447
1468
  this.declarationConfig.mediaQueries.push(...mediaQueries);
1448
- rule.value.rules.forEach((rule2) => {
1449
- this.parseRuleRec(rule2);
1450
- this.declarationConfig = this.getDeclarationConfig();
1451
- });
1452
- this.declarationConfig.mediaQueries.splice(
1453
- this.declarationConfig.mediaQueries.length - mediaQueries.length,
1454
- mediaQueries.length
1455
- );
1469
+ rule.value.rules.forEach((rule2) => this.parseRuleRec(rule2));
1470
+ this.declarationConfig = this.getDeclarationConfig();
1456
1471
  return;
1457
1472
  }
1458
1473
  if (rule.type === "layer-block") {
@@ -1506,14 +1521,12 @@ const compileVirtual = async ({ css, cssPath, platform, themes, polyfills, debug
1506
1521
  serializeJSObject(scopedVars2, (key, value) => `get "${key}"() { return ${value} }`)
1507
1522
  ])
1508
1523
  );
1509
- const varsWithMediaQueries = Object.entries(Processor.varsWithMediaQueries).map(([key, value]) => `["${key}", ${serialize(value)}]`).join(",");
1510
1524
  const serializedScopedVars = Object.entries(scopedVars).map(([scopedVarsName, scopedVars2]) => `"${scopedVarsName}": ({ ${scopedVars2} }),`).join("");
1511
1525
  const currentColorVar = `get currentColor() { return rt.colorScheme === 'dark' ? '#ffffff' : '#000000' },`;
1512
1526
  return [
1513
1527
  "({",
1514
1528
  `scopedVars: ({ ${serializedScopedVars} }),`,
1515
1529
  `vars: ({ ${currentColorVar} ${vars} }),`,
1516
- `varsWithMediaQueries: ([ ${varsWithMediaQueries} ]),`,
1517
1530
  `stylesheet: ({ ${stylesheet} }),`,
1518
1531
  "})"
1519
1532
  ].join("");
@@ -1552,7 +1565,7 @@ const transform = async (config, projectRoot, filePath, data, options) => {
1552
1565
  });
1553
1566
  data = Buffer.from(
1554
1567
  [
1555
- `import { Uniwind } from '${common.packageName}';`,
1568
+ `import { Uniwind } from '${common.name}';`,
1556
1569
  `Uniwind.__reinit(() => ({}), ${injectedThemesCode2});`
1557
1570
  ].join(""),
1558
1571
  "utf-8"
@@ -1580,7 +1593,7 @@ const transform = async (config, projectRoot, filePath, data, options) => {
1580
1593
  const isWeb = platform === types.Platform.Web;
1581
1594
  data = Buffer.from(
1582
1595
  isWeb ? virtualCode : [
1583
- `import { Uniwind } from '${common.packageName}';`,
1596
+ `import { Uniwind } from '${common.name}';`,
1584
1597
  `Uniwind.__reinit(rt => ${virtualCode}, ${injectedThemesCode});`
1585
1598
  ].join(""),
1586
1599
  "utf-8"