@pandacss/token-dictionary 0.0.0-dev-20230207095721 → 0.0.0-dev-20230208150234

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/dist/index.js CHANGED
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -98,15 +102,31 @@ var Token = class {
98
102
  this.extensions.condition = data.extensions?.condition ?? "base";
99
103
  this.setType();
100
104
  }
105
+ /**
106
+ * Whether the token is a conditional token.
107
+ * Conditional tokens are tokens that have multiple values based on a condition.
108
+ */
101
109
  get isConditional() {
102
110
  return !!this.extensions?.conditions;
103
111
  }
112
+ /**
113
+ * Whether the token has a reference in its value.
114
+ * e.g. {color.gray.100}
115
+ */
104
116
  get hasReference() {
105
117
  return !!this.extensions?.references;
106
118
  }
119
+ /**
120
+ * Whether the token is a complex or composite token.
121
+ */
107
122
  get isComposite() {
108
123
  return (0, import_shared2.isObject)(this.originalValue) || Array.isArray(this.originalValue);
109
124
  }
125
+ /**
126
+ * Returns the token value with the references expanded.
127
+ * e.g. {color.gray.100} => #f7fafc
128
+ *
129
+ */
110
130
  expandReferences() {
111
131
  if (!this.hasReference)
112
132
  return this.value;
@@ -122,9 +142,15 @@ var Token = class {
122
142
  delete this.extensions.references;
123
143
  return this.value;
124
144
  }
145
+ /**
146
+ * Whether this token has a reference to another token
147
+ */
125
148
  get isReference() {
126
149
  return hasReference(this.originalValue);
127
150
  }
151
+ /**
152
+ * Returns the list of references in the token value
153
+ */
128
154
  get references() {
129
155
  return getReferences(this.originalValue);
130
156
  }
@@ -138,6 +164,11 @@ var Token = class {
138
164
  extensions: cloneDeep(this.extensions)
139
165
  });
140
166
  }
167
+ /**
168
+ * Returns an array of tokens per conditions.
169
+ * It is commonly used in semantic tokens, and can have multiple values based on a condition.
170
+ * e.g. primary: { light: '#000', dark: '#fff' }
171
+ */
141
172
  getConditionTokens() {
142
173
  if (!this.isConditional)
143
174
  return;
@@ -154,6 +185,9 @@ var Token = class {
154
185
  });
155
186
  return conditionalTokens;
156
187
  }
188
+ /**
189
+ * Add more extensions to the token
190
+ */
157
191
  setExtensions(extensions) {
158
192
  this.extensions = { ...this.extensions, ...extensions };
159
193
  this.setType();
package/dist/index.mjs CHANGED
@@ -66,15 +66,31 @@ var Token = class {
66
66
  this.extensions.condition = data.extensions?.condition ?? "base";
67
67
  this.setType();
68
68
  }
69
+ /**
70
+ * Whether the token is a conditional token.
71
+ * Conditional tokens are tokens that have multiple values based on a condition.
72
+ */
69
73
  get isConditional() {
70
74
  return !!this.extensions?.conditions;
71
75
  }
76
+ /**
77
+ * Whether the token has a reference in its value.
78
+ * e.g. {color.gray.100}
79
+ */
72
80
  get hasReference() {
73
81
  return !!this.extensions?.references;
74
82
  }
83
+ /**
84
+ * Whether the token is a complex or composite token.
85
+ */
75
86
  get isComposite() {
76
87
  return isObject2(this.originalValue) || Array.isArray(this.originalValue);
77
88
  }
89
+ /**
90
+ * Returns the token value with the references expanded.
91
+ * e.g. {color.gray.100} => #f7fafc
92
+ *
93
+ */
78
94
  expandReferences() {
79
95
  if (!this.hasReference)
80
96
  return this.value;
@@ -90,9 +106,15 @@ var Token = class {
90
106
  delete this.extensions.references;
91
107
  return this.value;
92
108
  }
109
+ /**
110
+ * Whether this token has a reference to another token
111
+ */
93
112
  get isReference() {
94
113
  return hasReference(this.originalValue);
95
114
  }
115
+ /**
116
+ * Returns the list of references in the token value
117
+ */
96
118
  get references() {
97
119
  return getReferences(this.originalValue);
98
120
  }
@@ -106,6 +128,11 @@ var Token = class {
106
128
  extensions: cloneDeep(this.extensions)
107
129
  });
108
130
  }
131
+ /**
132
+ * Returns an array of tokens per conditions.
133
+ * It is commonly used in semantic tokens, and can have multiple values based on a condition.
134
+ * e.g. primary: { light: '#000', dark: '#fff' }
135
+ */
109
136
  getConditionTokens() {
110
137
  if (!this.isConditional)
111
138
  return;
@@ -122,6 +149,9 @@ var Token = class {
122
149
  });
123
150
  return conditionalTokens;
124
151
  }
152
+ /**
153
+ * Add more extensions to the token
154
+ */
125
155
  setExtensions(extensions) {
126
156
  this.extensions = { ...this.extensions, ...extensions };
127
157
  this.setType();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/token-dictionary",
3
- "version": "0.0.0-dev-20230207095721",
3
+ "version": "0.0.0-dev-20230208150234",
4
4
  "description": "Common error messages for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -16,11 +16,11 @@
16
16
  "dependencies": {
17
17
  "mini-svg-data-uri": "^1.4.4",
18
18
  "ts-pattern": "4.1.4",
19
- "@pandacss/types": "0.0.0-dev-20230207095721",
20
- "@pandacss/shared": "0.0.0-dev-20230207095721"
19
+ "@pandacss/types": "0.0.0-dev-20230208150234",
20
+ "@pandacss/shared": "0.0.0-dev-20230208150234"
21
21
  },
22
22
  "devDependencies": {
23
- "@pandacss/fixture": "0.0.0-dev-20230207095721"
23
+ "@pandacss/fixture": "0.0.0-dev-20230208150234"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tsup src/index.ts --format=esm,cjs --dts",