@pandacss/shared 0.5.1 → 0.7.0

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.d.mts CHANGED
@@ -8,6 +8,8 @@ declare const calc: {
8
8
  negate(x: Operand): string;
9
9
  };
10
10
 
11
+ declare const camelCaseProperty: (property: string) => string;
12
+
11
13
  declare const capitalize: (s: string) => string;
12
14
  declare const dashCase: (s: string) => string;
13
15
  declare const uncapitalize: (s: string) => string;
@@ -50,4 +52,4 @@ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
50
52
 
51
53
  declare function unionType(values: IterableIterator<string> | string[] | Set<string>): string;
52
54
 
53
- export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, mapToJson, memo, normalizeShorthand, normalizeStyleObject, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType };
55
+ export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, mapToJson, memo, normalizeShorthand, normalizeStyleObject, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,8 @@ declare const calc: {
8
8
  negate(x: Operand): string;
9
9
  };
10
10
 
11
+ declare const camelCaseProperty: (property: string) => string;
12
+
11
13
  declare const capitalize: (s: string) => string;
12
14
  declare const dashCase: (s: string) => string;
13
15
  declare const uncapitalize: (s: string) => string;
@@ -50,4 +52,4 @@ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
50
52
 
51
53
  declare function unionType(values: IterableIterator<string> | string[] | Set<string>): string;
52
54
 
53
- export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, mapToJson, memo, normalizeShorthand, normalizeStyleObject, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType };
55
+ export { CreateCssContext, CssVar, CssVarOptions, MappedObject, WalkObjectStopFn, calc, camelCaseProperty, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, mapToJson, memo, normalizeShorthand, normalizeStyleObject, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType };
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ var src_exports = {};
22
22
  __export(src_exports, {
23
23
  astish: () => astish,
24
24
  calc: () => calc,
25
+ camelCaseProperty: () => camelCaseProperty,
25
26
  capitalize: () => capitalize,
26
27
  compact: () => compact,
27
28
  createCss: () => createCss,
@@ -104,6 +105,32 @@ var calc = {
104
105
  }
105
106
  };
106
107
 
108
+ // src/memo.ts
109
+ var memo = (fn) => {
110
+ const cache = /* @__PURE__ */ new Map();
111
+ const get = (...args) => {
112
+ const key = JSON.stringify(args);
113
+ if (cache.has(key)) {
114
+ return cache.get(key);
115
+ }
116
+ const result = fn(...args);
117
+ cache.set(key, result);
118
+ return result;
119
+ };
120
+ return get;
121
+ };
122
+
123
+ // src/camelcase-property.ts
124
+ var regex = /-(\w|$)/g;
125
+ var callback = (_dashChar, char) => char.toUpperCase();
126
+ var camelCaseProperty = memo((property) => {
127
+ if (property.startsWith("--"))
128
+ return property;
129
+ let str = property.toLowerCase();
130
+ str = str.startsWith("-ms-") ? str.substring(1) : str;
131
+ return str.replace(regex, callback);
132
+ });
133
+
107
134
  // src/capitalize.ts
108
135
  var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
109
136
  var camelCaseRegex = /([a-z])([A-Z])/g;
@@ -347,7 +374,7 @@ function toRem(value = "") {
347
374
  }
348
375
 
349
376
  // src/css-var.ts
350
- var escRegex = /[.*+?^${}()|[\]\\]/g;
377
+ var escRegex = /[.*+?^${}()|[\]\\/]/g;
351
378
  function esc(string) {
352
379
  return string.replace(escRegex, "\\$&");
353
380
  }
@@ -399,27 +426,13 @@ function flatten(values, stop) {
399
426
  return result;
400
427
  }
401
428
 
402
- // src/memo.ts
403
- var memo = (fn) => {
404
- const cache = /* @__PURE__ */ new Map();
405
- const get = (...args) => {
406
- const key = JSON.stringify(args);
407
- if (cache.has(key)) {
408
- return cache.get(key);
409
- }
410
- const result = fn(...args);
411
- cache.set(key, result);
412
- return result;
413
- };
414
- return get;
415
- };
416
-
417
- // src/hypenate.ts
418
- var dashCaseRegex2 = /[A-Z]/g;
429
+ // src/hypenate-property.ts
430
+ var wordRegex = /([A-Z])/g;
431
+ var msRegex = /^ms-/;
419
432
  var hypenateProperty = memo((property) => {
420
433
  if (property.startsWith("--"))
421
434
  return property;
422
- return property.replace(dashCaseRegex2, (match) => `-${match.toLowerCase()}`);
435
+ return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
423
436
  });
424
437
 
425
438
  // src/split.ts
@@ -513,6 +526,7 @@ function unionType(values) {
513
526
  0 && (module.exports = {
514
527
  astish,
515
528
  calc,
529
+ camelCaseProperty,
516
530
  capitalize,
517
531
  compact,
518
532
  createCss,
package/dist/index.mjs CHANGED
@@ -41,6 +41,32 @@ var calc = {
41
41
  }
42
42
  };
43
43
 
44
+ // src/memo.ts
45
+ var memo = (fn) => {
46
+ const cache = /* @__PURE__ */ new Map();
47
+ const get = (...args) => {
48
+ const key = JSON.stringify(args);
49
+ if (cache.has(key)) {
50
+ return cache.get(key);
51
+ }
52
+ const result = fn(...args);
53
+ cache.set(key, result);
54
+ return result;
55
+ };
56
+ return get;
57
+ };
58
+
59
+ // src/camelcase-property.ts
60
+ var regex = /-(\w|$)/g;
61
+ var callback = (_dashChar, char) => char.toUpperCase();
62
+ var camelCaseProperty = memo((property) => {
63
+ if (property.startsWith("--"))
64
+ return property;
65
+ let str = property.toLowerCase();
66
+ str = str.startsWith("-ms-") ? str.substring(1) : str;
67
+ return str.replace(regex, callback);
68
+ });
69
+
44
70
  // src/capitalize.ts
45
71
  var capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
46
72
  var camelCaseRegex = /([a-z])([A-Z])/g;
@@ -284,7 +310,7 @@ function toRem(value = "") {
284
310
  }
285
311
 
286
312
  // src/css-var.ts
287
- var escRegex = /[.*+?^${}()|[\]\\]/g;
313
+ var escRegex = /[.*+?^${}()|[\]\\/]/g;
288
314
  function esc(string) {
289
315
  return string.replace(escRegex, "\\$&");
290
316
  }
@@ -336,27 +362,13 @@ function flatten(values, stop) {
336
362
  return result;
337
363
  }
338
364
 
339
- // src/memo.ts
340
- var memo = (fn) => {
341
- const cache = /* @__PURE__ */ new Map();
342
- const get = (...args) => {
343
- const key = JSON.stringify(args);
344
- if (cache.has(key)) {
345
- return cache.get(key);
346
- }
347
- const result = fn(...args);
348
- cache.set(key, result);
349
- return result;
350
- };
351
- return get;
352
- };
353
-
354
- // src/hypenate.ts
355
- var dashCaseRegex2 = /[A-Z]/g;
365
+ // src/hypenate-property.ts
366
+ var wordRegex = /([A-Z])/g;
367
+ var msRegex = /^ms-/;
356
368
  var hypenateProperty = memo((property) => {
357
369
  if (property.startsWith("--"))
358
370
  return property;
359
- return property.replace(dashCaseRegex2, (match) => `-${match.toLowerCase()}`);
371
+ return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
360
372
  });
361
373
 
362
374
  // src/split.ts
@@ -449,6 +461,7 @@ function unionType(values) {
449
461
  export {
450
462
  astish,
451
463
  calc,
464
+ camelCaseProperty,
452
465
  capitalize,
453
466
  compact,
454
467
  createCss,
package/dist/shared.js CHANGED
@@ -256,12 +256,13 @@ var memo = (fn) => {
256
256
  return get;
257
257
  };
258
258
 
259
- // src/hypenate.ts
260
- var dashCaseRegex = /[A-Z]/g;
259
+ // src/hypenate-property.ts
260
+ var wordRegex = /([A-Z])/g;
261
+ var msRegex = /^ms-/;
261
262
  var hypenateProperty = memo((property) => {
262
263
  if (property.startsWith("--"))
263
264
  return property;
264
- return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
265
+ return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
265
266
  });
266
267
 
267
268
  // src/normalize-html.ts
package/dist/shared.mjs CHANGED
@@ -216,12 +216,13 @@ var memo = (fn) => {
216
216
  return get;
217
217
  };
218
218
 
219
- // src/hypenate.ts
220
- var dashCaseRegex = /[A-Z]/g;
219
+ // src/hypenate-property.ts
220
+ var wordRegex = /([A-Z])/g;
221
+ var msRegex = /^ms-/;
221
222
  var hypenateProperty = memo((property) => {
222
223
  if (property.startsWith("--"))
223
224
  return property;
224
- return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);
225
+ return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
225
226
  });
226
227
 
227
228
  // src/normalize-html.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",