@pandacss/config 2.0.0-beta.14 → 2.0.0-beta.15

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.
@@ -28,7 +28,8 @@ var themeEntryKeys = /* @__PURE__ */ new Set([
28
28
  "layerStyles",
29
29
  "recipes",
30
30
  "slotRecipes",
31
- "textStyles"
31
+ "textStyles",
32
+ "viewTransitions"
32
33
  ]);
33
34
  var SourceTracker = class {
34
35
  sources;
@@ -1,5 +1,7 @@
1
1
  import {
2
- compact
2
+ compact,
3
+ createConfigError,
4
+ isPlainObject
3
5
  } from "./chunk-R4R5RHIS.js";
4
6
 
5
7
  // src/serialize.ts
@@ -49,9 +51,55 @@ function normalizeHook(value, name) {
49
51
  return { filter: record.filter, handler: record.handler };
50
52
  }
51
53
 
54
+ // src/utility-global-vars.ts
55
+ function mergeUtilityGlobalVars(config) {
56
+ const utilities = config.utilities;
57
+ if (!isPlainObject(utilities)) return config;
58
+ const merged = {};
59
+ const owners = /* @__PURE__ */ new Map();
60
+ let found = false;
61
+ const nextUtilities = {};
62
+ for (const [name, utility] of Object.entries(utilities)) {
63
+ if (!isPlainObject(utility) || !isPlainObject(utility.globalVars)) {
64
+ nextUtilities[name] = utility;
65
+ continue;
66
+ }
67
+ found = true;
68
+ const { globalVars, ...rest } = utility;
69
+ nextUtilities[name] = rest;
70
+ for (const [key, definition] of Object.entries(globalVars)) {
71
+ const previous = merged[key];
72
+ if (previous !== void 0 && !isSameDefinition(previous, definition)) {
73
+ throw createConfigError(
74
+ `The \`${owners.get(key)}\` and \`${name}\` utilities both register \`${key}\`, with different definitions.
75
+ A CSS variable has one registration for the whole document, so share one definition between them.`
76
+ );
77
+ }
78
+ merged[key] = definition;
79
+ owners.set(key, name);
80
+ }
81
+ }
82
+ if (!found) return config;
83
+ const configVars = isPlainObject(config.globalVars) ? config.globalVars : {};
84
+ return {
85
+ ...config,
86
+ utilities: nextUtilities,
87
+ globalVars: { ...merged, ...configVars },
88
+ utilityGlobalVars: Object.fromEntries(owners)
89
+ };
90
+ }
91
+ function isSameDefinition(a, b) {
92
+ if (a === b) return true;
93
+ if (!isPlainObject(a) || !isPlainObject(b)) return false;
94
+ const keys = Object.keys(a);
95
+ if (keys.length !== Object.keys(b).length) return false;
96
+ return keys.every((key) => a[key] === b[key]);
97
+ }
98
+
52
99
  // src/serialize.ts
53
100
  var runtimeOnlyKeys = /* @__PURE__ */ new Set(["hooks", "plugins", "presets", "name"]);
54
- function createConfigSnapshot(config) {
101
+ function createConfigSnapshot(input) {
102
+ const config = mergeUtilityGlobalVars(input);
55
103
  const callbacks = {};
56
104
  const hooks = serializeHooks(config, callbacks, sanitize, hashCallbackSource);
57
105
  const serialized = {
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  mergeConfigs,
3
3
  mergeConfigsWithSources
4
- } from "./chunk-PER4IFQZ.js";
4
+ } from "./chunk-MDHADX5P.js";
5
5
  import {
6
6
  collectPluginHookHandlers,
7
7
  createConfigSnapshot,
8
8
  normalizeHook
9
- } from "./chunk-U6KCSKCU.js";
9
+ } from "./chunk-Y642H6DU.js";
10
10
  import {
11
11
  PandaError,
12
12
  clone,
package/dist/merge.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mergeConfigs,
3
3
  mergeConfigsWithSources
4
- } from "./chunk-PER4IFQZ.js";
4
+ } from "./chunk-MDHADX5P.js";
5
5
  import "./chunk-R4R5RHIS.js";
6
6
  export {
7
7
  mergeConfigs,
@@ -12,6 +12,6 @@ interface ConfigSnapshot {
12
12
  * pattern's `transform`/`defaultValues` source as `codegenSource` for the Rust
13
13
  * pattern generator.
14
14
  */
15
- declare function createConfigSnapshot(config: UserConfig): ConfigSnapshot;
15
+ declare function createConfigSnapshot(input: UserConfig): ConfigSnapshot;
16
16
 
17
17
  export { type ConfigSnapshot, createConfigSnapshot };
package/dist/serialize.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createConfigSnapshot
3
- } from "./chunk-U6KCSKCU.js";
3
+ } from "./chunk-Y642H6DU.js";
4
4
  import "./chunk-R4R5RHIS.js";
5
5
  export {
6
6
  createConfigSnapshot
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/config",
3
- "version": "2.0.0-beta.14",
3
+ "version": "2.0.0-beta.15",
4
4
  "description": "Self-contained loader that bundles and serializes a Panda config for the Rust compiler",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,8 +45,8 @@
45
45
  "magic-string": "^0.30.21",
46
46
  "microdiff": "1.5.0",
47
47
  "rolldown": "1.0.0-rc.17",
48
- "@pandacss/compiler-shared": "2.0.0-beta.14",
49
- "@pandacss/types": "2.0.0-beta.14"
48
+ "@pandacss/compiler-shared": "2.0.0-beta.15",
49
+ "@pandacss/types": "2.0.0-beta.15"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=22"