@pandacss/shared 0.0.0-dev-20230416210337 → 0.0.0-dev-20230417092334

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
@@ -74,7 +74,8 @@ function isCssVar(value) {
74
74
  function getRef(operand) {
75
75
  return isCssVar(operand) ? operand.ref : operand.toString();
76
76
  }
77
- var toExpression = (operator, ...operands) => operands.map(getRef).join(` ${operator} `).replace(/calc/g, "");
77
+ var calcRegex = /calc/g;
78
+ var toExpression = (operator, ...operands) => operands.map(getRef).join(` ${operator} `).replace(calcRegex, "");
78
79
  var multiply = (...operands) => `calc(${toExpression("*", ...operands)})`;
79
80
  var calc = {
80
81
  negate(x) {
@@ -88,7 +89,8 @@ var calc = {
88
89
 
89
90
  // src/capitalize.ts
90
91
  var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
91
- var dashCase = (s) => s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
92
+ var camelCaseRegex = /([a-z])([A-Z])/g;
93
+ var dashCase = (s) => s.replace(camelCaseRegex, "$1-$2").toLowerCase();
92
94
  var uncapitalize = (s) => s.charAt(0).toLowerCase() + s.slice(1);
93
95
 
94
96
  // src/compact.ts
@@ -103,11 +105,12 @@ function filterBaseConditions(c) {
103
105
  }
104
106
 
105
107
  // src/css-important.ts
108
+ var importantRegex = /!(important)?$/;
106
109
  function isImportant(value) {
107
- return typeof value === "string" ? /!(important)?$/.test(value) : false;
110
+ return typeof value === "string" ? importantRegex.test(value) : false;
108
111
  }
109
112
  function withoutImportant(value) {
110
- return typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;
113
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
111
114
  }
112
115
  function withoutSpace(str) {
113
116
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
@@ -323,11 +326,13 @@ function toRem(value = "") {
323
326
  }
324
327
 
325
328
  // src/css-var.ts
329
+ var escRegex = /[.*+?^${}()|[\]\\]/g;
326
330
  function esc(string) {
327
- return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
331
+ return string.replace(escRegex, "\\$&");
328
332
  }
333
+ var dashCaseRegex = /[A-Z]/g;
329
334
  function dashCase2(string) {
330
- return string.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
335
+ return string.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
331
336
  }
332
337
  function cssVar(name, options = {}) {
333
338
  const { fallback = "", prefix = "" } = options;
@@ -378,10 +383,11 @@ var memo = (fn) => {
378
383
  };
379
384
 
380
385
  // src/hypenate.ts
386
+ var dashCaseRegex2 = /[A-Z]/g;
381
387
  var hypenateProperty = memo((property) => {
382
388
  if (property.startsWith("--"))
383
389
  return property;
384
- return property.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
390
+ return property.replace(dashCaseRegex2, (match) => `-${match.toLowerCase()}`);
385
391
  });
386
392
 
387
393
  // src/split.ts
package/dist/index.mjs CHANGED
@@ -12,7 +12,8 @@ function isCssVar(value) {
12
12
  function getRef(operand) {
13
13
  return isCssVar(operand) ? operand.ref : operand.toString();
14
14
  }
15
- var toExpression = (operator, ...operands) => operands.map(getRef).join(` ${operator} `).replace(/calc/g, "");
15
+ var calcRegex = /calc/g;
16
+ var toExpression = (operator, ...operands) => operands.map(getRef).join(` ${operator} `).replace(calcRegex, "");
16
17
  var multiply = (...operands) => `calc(${toExpression("*", ...operands)})`;
17
18
  var calc = {
18
19
  negate(x) {
@@ -26,7 +27,8 @@ var calc = {
26
27
 
27
28
  // src/capitalize.ts
28
29
  var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
29
- var dashCase = (s) => s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
30
+ var camelCaseRegex = /([a-z])([A-Z])/g;
31
+ var dashCase = (s) => s.replace(camelCaseRegex, "$1-$2").toLowerCase();
30
32
  var uncapitalize = (s) => s.charAt(0).toLowerCase() + s.slice(1);
31
33
 
32
34
  // src/compact.ts
@@ -41,11 +43,12 @@ function filterBaseConditions(c) {
41
43
  }
42
44
 
43
45
  // src/css-important.ts
46
+ var importantRegex = /!(important)?$/;
44
47
  function isImportant(value) {
45
- return typeof value === "string" ? /!(important)?$/.test(value) : false;
48
+ return typeof value === "string" ? importantRegex.test(value) : false;
46
49
  }
47
50
  function withoutImportant(value) {
48
- return typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;
51
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
49
52
  }
50
53
  function withoutSpace(str) {
51
54
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
@@ -261,11 +264,13 @@ function toRem(value = "") {
261
264
  }
262
265
 
263
266
  // src/css-var.ts
267
+ var escRegex = /[.*+?^${}()|[\]\\]/g;
264
268
  function esc(string) {
265
- return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
269
+ return string.replace(escRegex, "\\$&");
266
270
  }
271
+ var dashCaseRegex = /[A-Z]/g;
267
272
  function dashCase2(string) {
268
- return string.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
273
+ return string.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
269
274
  }
270
275
  function cssVar(name, options = {}) {
271
276
  const { fallback = "", prefix = "" } = options;
@@ -316,10 +321,11 @@ var memo = (fn) => {
316
321
  };
317
322
 
318
323
  // src/hypenate.ts
324
+ var dashCaseRegex2 = /[A-Z]/g;
319
325
  var hypenateProperty = memo((property) => {
320
326
  if (property.startsWith("--"))
321
327
  return property;
322
- return property.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
328
+ return property.replace(dashCaseRegex2, (match) => `-${match.toLowerCase()}`);
323
329
  });
324
330
 
325
331
  // src/split.ts
package/dist/shared.js CHANGED
@@ -54,11 +54,12 @@ function filterBaseConditions(c) {
54
54
  }
55
55
 
56
56
  // src/css-important.ts
57
+ var importantRegex = /!(important)?$/;
57
58
  function isImportant(value) {
58
- return typeof value === "string" ? /!(important)?$/.test(value) : false;
59
+ return typeof value === "string" ? importantRegex.test(value) : false;
59
60
  }
60
61
  function withoutImportant(value) {
61
- return typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;
62
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
62
63
  }
63
64
  function withoutSpace(str) {
64
65
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
@@ -264,10 +265,11 @@ var memo = (fn) => {
264
265
  };
265
266
 
266
267
  // src/hypenate.ts
268
+ var dashCaseRegex = /[A-Z]/g;
267
269
  var hypenateProperty = memo((property) => {
268
270
  if (property.startsWith("--"))
269
271
  return property;
270
- return property.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
272
+ return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
271
273
  });
272
274
  // Annotate the CommonJS export names for ESM import in node:
273
275
  0 && (module.exports = {
package/dist/shared.mjs CHANGED
@@ -15,11 +15,12 @@ function filterBaseConditions(c) {
15
15
  }
16
16
 
17
17
  // src/css-important.ts
18
+ var importantRegex = /!(important)?$/;
18
19
  function isImportant(value) {
19
- return typeof value === "string" ? /!(important)?$/.test(value) : false;
20
+ return typeof value === "string" ? importantRegex.test(value) : false;
20
21
  }
21
22
  function withoutImportant(value) {
22
- return typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;
23
+ return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
23
24
  }
24
25
  function withoutSpace(str) {
25
26
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
@@ -225,10 +226,11 @@ var memo = (fn) => {
225
226
  };
226
227
 
227
228
  // src/hypenate.ts
229
+ var dashCaseRegex = /[A-Z]/g;
228
230
  var hypenateProperty = memo((property) => {
229
231
  if (property.startsWith("--"))
230
232
  return property;
231
- return property.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
233
+ return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
232
234
  });
233
235
  export {
234
236
  compact,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.0.0-dev-20230416210337",
3
+ "version": "0.0.0-dev-20230417092334",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",