@pandacss/shared 0.0.0-dev-20230106105402 → 0.0.0-dev-20230106183338

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.ts CHANGED
@@ -46,6 +46,10 @@ declare function splitDotPath(path: string): string[];
46
46
  declare function getNegativePath(path: string[]): string[];
47
47
  declare function getDotPath(obj: any, path: string, fallback?: any): any;
48
48
 
49
+ type Dict = Record<string, unknown>;
50
+ type PickFn = (key: string) => boolean;
51
+ declare function splitObject(obj: Dict, pickFn: PickFn): Dict[];
52
+
49
53
  type MapToRecord<K extends Map<string, any>> = {
50
54
  [P in keyof K]: K[P] extends Map<string, infer V> ? Record<string, V> : never;
51
55
  };
@@ -53,4 +57,4 @@ declare function mapToJson<T extends Map<string, any>>(map: T): MapToRecord<T>;
53
57
 
54
58
  declare function unionType(values: IterableIterator<string> | string[]): string;
55
59
 
56
- export { CssVar, CssVarOptions, calc, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, isFunction, isObject, isString, mapToJson, memo, normalizeStyleObject, splitBy, splitDotPath, toEm, toPx, toRem, uncapitalize, unionType };
60
+ export { CssVar, CssVarOptions, calc, capitalize, cssVar, dashCase, esc, flatten, getDotPath, getNegativePath, getUnit, isFunction, isObject, isString, mapToJson, memo, normalizeStyleObject, splitBy, splitDotPath, splitObject, toEm, toPx, toRem, uncapitalize, unionType };
package/dist/index.js CHANGED
@@ -43,6 +43,7 @@ __export(src_exports, {
43
43
  normalizeStyleObject: () => normalizeStyleObject,
44
44
  splitBy: () => splitBy,
45
45
  splitDotPath: () => splitDotPath,
46
+ splitObject: () => splitObject,
46
47
  toEm: () => toEm,
47
48
  toHash: () => toHash,
48
49
  toPx: () => toPx,
@@ -400,6 +401,20 @@ function getDotPath(obj, path, fallback) {
400
401
  return getDotPath(obj?.[key], nextPath, fallback) ?? fallback;
401
402
  }
402
403
 
404
+ // src/split-object.ts
405
+ function splitObject(obj, pickFn) {
406
+ const omitted = {};
407
+ const picked = {};
408
+ for (const [key, value] of Object.entries(obj)) {
409
+ if (pickFn(key)) {
410
+ picked[key] = value;
411
+ } else {
412
+ omitted[key] = value;
413
+ }
414
+ }
415
+ return [picked, omitted];
416
+ }
417
+
403
418
  // src/to-json.ts
404
419
  function mapToJson(map) {
405
420
  const obj = {};
@@ -442,6 +457,7 @@ function unionType(values) {
442
457
  normalizeStyleObject,
443
458
  splitBy,
444
459
  splitDotPath,
460
+ splitObject,
445
461
  toEm,
446
462
  toHash,
447
463
  toPx,
package/dist/index.mjs CHANGED
@@ -342,6 +342,20 @@ function getDotPath(obj, path, fallback) {
342
342
  return getDotPath(obj?.[key], nextPath, fallback) ?? fallback;
343
343
  }
344
344
 
345
+ // src/split-object.ts
346
+ function splitObject(obj, pickFn) {
347
+ const omitted = {};
348
+ const picked = {};
349
+ for (const [key, value] of Object.entries(obj)) {
350
+ if (pickFn(key)) {
351
+ picked[key] = value;
352
+ } else {
353
+ omitted[key] = value;
354
+ }
355
+ }
356
+ return [picked, omitted];
357
+ }
358
+
345
359
  // src/to-json.ts
346
360
  function mapToJson(map) {
347
361
  const obj = {};
@@ -383,6 +397,7 @@ export {
383
397
  normalizeStyleObject,
384
398
  splitBy,
385
399
  splitDotPath,
400
+ splitObject,
386
401
  toEm,
387
402
  toHash,
388
403
  toPx,
package/dist/shared.js CHANGED
@@ -32,12 +32,6 @@ __export(shared_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(shared_exports);
34
34
 
35
- // src/condition.ts
36
- var isBaseCondition = (c) => /^(base|_)$/.test(c);
37
- function filterBaseConditions(c) {
38
- return c.slice().filter((v) => !isBaseCondition(v));
39
- }
40
-
41
35
  // src/css-important.ts
42
36
  function isImportant(value) {
43
37
  return typeof value === "string" ? /!(important)?$/.test(value) : false;
@@ -49,6 +43,12 @@ function withoutSpace(str) {
49
43
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
50
44
  }
51
45
 
46
+ // src/condition.ts
47
+ var isBaseCondition = (c) => /^(base|_)$/.test(c);
48
+ function filterBaseConditions(c) {
49
+ return c.slice().filter((v) => !isBaseCondition(v));
50
+ }
51
+
52
52
  // src/hash.ts
53
53
  function toChar(code) {
54
54
  return String.fromCharCode(code + (code > 25 ? 39 : 97));
package/dist/shared.mjs CHANGED
@@ -1,9 +1,3 @@
1
- // src/condition.ts
2
- var isBaseCondition = (c) => /^(base|_)$/.test(c);
3
- function filterBaseConditions(c) {
4
- return c.slice().filter((v) => !isBaseCondition(v));
5
- }
6
-
7
1
  // src/css-important.ts
8
2
  function isImportant(value) {
9
3
  return typeof value === "string" ? /!(important)?$/.test(value) : false;
@@ -15,6 +9,12 @@ function withoutSpace(str) {
15
9
  return typeof str === "string" ? str.replaceAll(" ", "_") : str;
16
10
  }
17
11
 
12
+ // src/condition.ts
13
+ var isBaseCondition = (c) => /^(base|_)$/.test(c);
14
+ function filterBaseConditions(c) {
15
+ return c.slice().filter((v) => !isBaseCondition(v));
16
+ }
17
+
18
18
  // src/hash.ts
19
19
  function toChar(code) {
20
20
  return String.fromCharCode(code + (code > 25 ? 39 : 97));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/shared",
3
- "version": "0.0.0-dev-20230106105402",
3
+ "version": "0.0.0-dev-20230106183338",
4
4
  "description": "Shared utilities for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",