@pandacss/studio 0.0.0-dev-20240130133424 → 0.0.0-dev-20240201185610

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/studio",
3
- "version": "0.0.0-dev-20240130133424",
3
+ "version": "0.0.0-dev-20240201185610",
4
4
  "description": "The automated token documentation for Panda CSS",
5
5
  "main": "dist/studio.js",
6
6
  "module": "dist/studio.mjs",
@@ -48,12 +48,12 @@
48
48
  "react": "18.2.0",
49
49
  "react-dom": "18.2.0",
50
50
  "vite": "5.0.12",
51
- "@pandacss/config": "0.0.0-dev-20240130133424",
52
- "@pandacss/logger": "0.0.0-dev-20240130133424",
53
- "@pandacss/shared": "0.0.0-dev-20240130133424",
54
- "@pandacss/token-dictionary": "0.0.0-dev-20240130133424",
55
- "@pandacss/types": "0.0.0-dev-20240130133424",
56
- "@pandacss/astro-plugin-studio": "0.0.0-dev-20240130133424"
51
+ "@pandacss/config": "0.0.0-dev-20240201185610",
52
+ "@pandacss/logger": "0.0.0-dev-20240201185610",
53
+ "@pandacss/shared": "0.0.0-dev-20240201185610",
54
+ "@pandacss/token-dictionary": "0.0.0-dev-20240201185610",
55
+ "@pandacss/types": "0.0.0-dev-20240201185610",
56
+ "@pandacss/astro-plugin-studio": "0.0.0-dev-20240201185610"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/react": "18.2.42",
@@ -7,7 +7,7 @@ import { Select } from './input'
7
7
  import { TokenContent } from './token-content'
8
8
  import { TokenGroup } from './token-group'
9
9
 
10
- const tokens = Object.fromEntries<Map<string, Token> | undefined>(context.tokens.categoryMap)
10
+ const tokens = Object.fromEntries<Map<string, Token> | undefined>(context.tokens.view.categoryMap)
11
11
 
12
12
  const defaultConfig = {
13
13
  fontSize: '',
@@ -39,7 +39,7 @@ export default function TypographyPlayground() {
39
39
  updateConfig(key, event.currentTarget.value)
40
40
  }
41
41
 
42
- const renderTokenSwitch = (token: any) => {
42
+ const renderTokenSwitch = (token: keyof typeof defaultConfig) => {
43
43
  const currentTokens = tokens[`${token}s`]
44
44
  if (!currentTokens) return
45
45
  const values = Array.from(currentTokens.values())
@@ -5,10 +5,10 @@ import { config } from 'virtual:panda'
5
5
 
6
6
  export const theme = config.theme ?? {}
7
7
 
8
- export const tokens = new TokenDictionary(theme)
8
+ export const tokens = new TokenDictionary(theme).init()
9
9
 
10
10
  export const getTokens = (category: keyof TokenDataTypes): Token[] => {
11
- const map = tokens.categoryMap.get(category) ?? new Map()
11
+ const map = tokens.view.categoryMap.get(category) ?? new Map()
12
12
  return Array.from(map.values())
13
13
  }
14
14
 
@@ -33,6 +33,7 @@ const context = {
33
33
  return { className: `${propKey}_${withoutSpace(value)}` }
34
34
  },
35
35
  hasShorthand: true,
36
+ toHash: (path, hashFn) => hashFn(path.join(":")),
36
37
  resolveShorthand: resolveShorthand,
37
38
  }
38
39
  }
@@ -14,18 +14,6 @@ function filterBaseConditions(c) {
14
14
  return c.slice().filter((v) => !isBaseCondition(v));
15
15
  }
16
16
 
17
- // src/important.ts
18
- var importantRegex = /\s*!(important)?/i;
19
- function isImportant(value) {
20
- return typeof value === "string" ? importantRegex.test(value) : false;
21
- }
22
- function withoutImportant(value) {
23
- return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
24
- }
25
- function withoutSpace(str) {
26
- return typeof str === "string" ? str.replaceAll(" ", "_") : str;
27
- }
28
-
29
17
  // src/hash.ts
30
18
  function toChar(code) {
31
19
  return String.fromCharCode(code + (code > 25 ? 39 : 97));
@@ -47,21 +35,16 @@ function toHash(value) {
47
35
  return toName(toPhash(5381, value) >>> 0);
48
36
  }
49
37
 
50
- // src/merge-props.ts
51
- function mergeProps(...sources) {
52
- const objects = sources.filter(Boolean);
53
- return objects.reduce((prev, obj) => {
54
- Object.keys(obj).forEach((key) => {
55
- const prevValue = prev[key];
56
- const value = obj[key];
57
- if (isObject(prevValue) && isObject(value)) {
58
- prev[key] = mergeProps(prevValue, value);
59
- } else {
60
- prev[key] = value;
61
- }
62
- });
63
- return prev;
64
- }, {});
38
+ // src/important.ts
39
+ var importantRegex = /\s*!(important)?/i;
40
+ function isImportant(value) {
41
+ return typeof value === "string" ? importantRegex.test(value) : false;
42
+ }
43
+ function withoutImportant(value) {
44
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
45
+ }
46
+ function withoutSpace(str) {
47
+ return typeof str === "string" ? str.replaceAll(" ", "_") : str;
65
48
  }
66
49
 
67
50
  // src/memo.ts
@@ -79,6 +62,23 @@ var memo = (fn) => {
79
62
  return get;
80
63
  };
81
64
 
65
+ // src/merge-props.ts
66
+ function mergeProps(...sources) {
67
+ const objects = sources.filter(Boolean);
68
+ return objects.reduce((prev, obj) => {
69
+ Object.keys(obj).forEach((key) => {
70
+ const prevValue = prev[key];
71
+ const value = obj[key];
72
+ if (isObject(prevValue) && isObject(value)) {
73
+ prev[key] = mergeProps(prevValue, value);
74
+ } else {
75
+ prev[key] = value;
76
+ }
77
+ });
78
+ return prev;
79
+ }, {});
80
+ }
81
+
82
82
  // src/walk-object.ts
83
83
  var isNotNullish = (element) => element != null;
84
84
  function walkObject(target, predicate, options = {}) {
@@ -158,7 +158,7 @@ function createCss(context) {
158
158
  let result;
159
159
  if (hash) {
160
160
  const baseArray = [...conds.finalize(conditions), className];
161
- result = formatClassName(toHash(baseArray.join(":")));
161
+ result = formatClassName(utility.toHash(baseArray, toHash));
162
162
  } else {
163
163
  const baseArray = [...conds.finalize(conditions), formatClassName(className)];
164
164
  result = baseArray.join(":");