@pandacss/node 0.0.0-dev-20221124070053 → 0.0.0-dev-20221124074636

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.
Files changed (3) hide show
  1. package/dist/index.js +48 -17
  2. package/dist/index.mjs +47 -16
  3. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -380,6 +380,7 @@ function generatePreactJsxFactory(ctx) {
380
380
  // src/generators/jsx/preact-pattern.ts
381
381
  var import_shared3 = require("@pandacss/shared");
382
382
  var import_outdent7 = require("outdent");
383
+ var import_ts_pattern = require("ts-pattern");
383
384
  function generate(name, pattern, jsxFactory) {
384
385
  const upperName = (0, import_shared3.capitalize)(name);
385
386
  const jsxName = pattern.jsx ?? upperName;
@@ -392,9 +393,18 @@ function generate(name, pattern, jsxFactory) {
392
393
  import { config } from '../patterns/${(0, import_shared3.dashCase)(name)}'
393
394
 
394
395
  export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
395
- const { ${keys.join(", ")}, ...restProps } = props
396
- const styleProps = config.transform({${keys.join(", ")}})
397
- return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
396
+ ${(0, import_ts_pattern.match)(keys.length).with(
397
+ 0,
398
+ () => `
399
+ return <${jsxFactory}.div ref={ref} {...props} />
400
+ `
401
+ ).otherwise(
402
+ () => `
403
+ const { ${keys.join(", ")}, ...restProps } = props
404
+ const styleProps = config.transform({${keys.join(", ")}})
405
+ return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
406
+ `
407
+ )}
398
408
  })
399
409
  `,
400
410
  dts: import_outdent7.outdent`
@@ -410,7 +420,7 @@ function generate(name, pattern, jsxFactory) {
410
420
  type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties &
411
421
  Assign<Omit<PropsOf<C>, 'color'>, P & { as?: C }>
412
422
 
413
- type ${jsxName}Props<C extends ElementType> = Polymorphic<C, ${upperName}Options>
423
+ type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Options>
414
424
 
415
425
  export declare function ${jsxName}<V extends ElementType>(props: ${jsxName}Props<V>): JSX.Element
416
426
  `
@@ -507,6 +517,7 @@ function generateReactJsxFactory(ctx) {
507
517
  // src/generators/jsx/react-pattern.ts
508
518
  var import_shared5 = require("@pandacss/shared");
509
519
  var import_outdent9 = require("outdent");
520
+ var import_ts_pattern2 = require("ts-pattern");
510
521
  function generate2(name, pattern, jsxFactory) {
511
522
  const upperName = (0, import_shared5.capitalize)(name);
512
523
  const jsxName = pattern.jsx ?? upperName;
@@ -519,9 +530,19 @@ function generate2(name, pattern, jsxFactory) {
519
530
  import { config } from '../patterns/${(0, import_shared5.dashCase)(name)}'
520
531
 
521
532
  export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
522
- const { ${keys.join(", ")}, ...restProps } = props
523
- const styleProps = config.transform({${keys.join(", ")}})
524
- return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
533
+ ${(0, import_ts_pattern2.match)(keys.length).with(
534
+ 0,
535
+ () => `
536
+ return <${jsxFactory}.div ref={ref} {...props} />
537
+ `
538
+ ).otherwise(
539
+ () => `
540
+ const { ${keys.join(", ")}, ...restProps } = props
541
+ const styleProps = config.transform({${keys.join(", ")}})
542
+ return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
543
+ `
544
+ )}
545
+
525
546
  })
526
547
  `,
527
548
  dts: import_outdent9.outdent`
@@ -534,7 +555,7 @@ function generate2(name, pattern, jsxFactory) {
534
555
  type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties &
535
556
  Assign<Omit<PropsOf<C>, 'color'>, P & { as?: C }>
536
557
 
537
- export type ${jsxName}Props<C extends ElementType> = Polymorphic<C, ${upperName}Options>
558
+ export type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Options>
538
559
 
539
560
  export declare function ${jsxName}<V extends ElementType>(props: ${jsxName}Props<V>): JSX.Element
540
561
  `
@@ -618,6 +639,7 @@ function generateSolidJsxFactory(ctx) {
618
639
  // src/generators/jsx/solid-pattern.ts
619
640
  var import_shared7 = require("@pandacss/shared");
620
641
  var import_outdent11 = require("outdent");
642
+ var import_ts_pattern3 = require("ts-pattern");
621
643
  function generate3(name, pattern, jsxFactory) {
622
644
  const upperName = (0, import_shared7.capitalize)(name);
623
645
  const jsxName = pattern.jsx ?? upperName;
@@ -630,9 +652,18 @@ function generate3(name, pattern, jsxFactory) {
630
652
  import { config } from '../patterns/${(0, import_shared7.dashCase)(name)}'
631
653
 
632
654
  export function ${jsxName}(props) {
633
- const [patternProps, restProps] = splitProps(props, [${keys.map((v) => JSON.stringify(v)).join(", ")}]);
634
- const styleProps = config.transform(patternProps)
635
- return <${jsxFactory}.div {...styleProps} {...restProps} />
655
+ ${(0, import_ts_pattern3.match)(keys.length).with(
656
+ 0,
657
+ () => `
658
+ return <${jsxFactory}.div {...props} />
659
+ `
660
+ ).otherwise(
661
+ () => `
662
+ const [patternProps, restProps] = splitProps(props, [${keys.map((v) => JSON.stringify(v)).join(", ")}]);
663
+ const styleProps = config.transform(patternProps)
664
+ return <${jsxFactory}.div {...styleProps} {...restProps} />
665
+ `
666
+ )}
636
667
  }
637
668
  `,
638
669
  dts: import_outdent11.outdent`
@@ -646,7 +677,7 @@ function generate3(name, pattern, jsxFactory) {
646
677
  type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties &
647
678
  Assign<Omit<PropsOf<C>, 'color'>, P & { as?: C }>
648
679
 
649
- export type ${jsxName}Props<C extends ElementType> = Polymorphic<C, ${upperName}Options>
680
+ export type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Options>
650
681
 
651
682
  export declare function ${jsxName}<V extends ElementType>(props: ${jsxName}Props<V>): JSX.Element
652
683
  `
@@ -680,7 +711,7 @@ function generateJsxPatterns(ctx) {
680
711
  var import_shared8 = require("@pandacss/shared");
681
712
  var import_outdent12 = require("outdent");
682
713
  var import_telejson = require("telejson");
683
- var import_ts_pattern = require("ts-pattern");
714
+ var import_ts_pattern4 = require("ts-pattern");
684
715
  function generate4(name, pattern) {
685
716
  const { properties, transform, strict } = pattern;
686
717
  return {
@@ -693,7 +724,7 @@ function generate4(name, pattern) {
693
724
  export type ${(0, import_shared8.capitalize)(name)}Options = {
694
725
  ${Object.keys(properties ?? {}).map((key) => {
695
726
  const value = properties[key];
696
- return (0, import_ts_pattern.match)(value).with({ type: "property" }, (value2) => {
727
+ return (0, import_ts_pattern4.match)(value).with({ type: "property" }, (value2) => {
697
728
  return `${key}?: SystemStyleObject["${value2.value}"]`;
698
729
  }).with({ type: "token" }, (value2) => {
699
730
  if (value2.property) {
@@ -920,7 +951,7 @@ function generateReset() {
920
951
  // src/generators/token-css.ts
921
952
  var import_core2 = require("@pandacss/core");
922
953
  var import_outdent15 = require("outdent");
923
- var import_ts_pattern2 = require("ts-pattern");
954
+ var import_ts_pattern5 = require("ts-pattern");
924
955
  function generateKeyframes(keyframes) {
925
956
  if (keyframes) {
926
957
  return (0, import_core2.toKeyframeCss)(keyframes);
@@ -947,7 +978,7 @@ function generateTokenCss(ctx, varRoot) {
947
978
  results.push(css3);
948
979
  } else {
949
980
  const cond = conditions.normalize(key);
950
- const css3 = (0, import_ts_pattern2.match)(cond).with({ type: "parent-nesting" }, (cond2) => {
981
+ const css3 = (0, import_ts_pattern5.match)(cond).with({ type: "parent-nesting" }, (cond2) => {
951
982
  const selector = cond2.value.replace(/\s&/g, "");
952
983
  const { css: css4 } = (0, import_core2.toCss)(varsObj);
953
984
  return `${selector} {
@@ -961,7 +992,7 @@ function generateTokenCss(ctx, varRoot) {
961
992
  ${css4};
962
993
  }
963
994
  }`;
964
- }).with(import_ts_pattern2.P.nullish, () => {
995
+ }).with(import_ts_pattern5.P.nullish, () => {
965
996
  }).otherwise((cond2) => {
966
997
  if (cond2) {
967
998
  throw new Error(getConditionMessage(cond2.raw));
package/dist/index.mjs CHANGED
@@ -335,6 +335,7 @@ function generatePreactJsxFactory(ctx) {
335
335
  // src/generators/jsx/preact-pattern.ts
336
336
  import { capitalize as capitalize2, dashCase } from "@pandacss/shared";
337
337
  import { outdent as outdent7 } from "outdent";
338
+ import { match } from "ts-pattern";
338
339
  function generate(name, pattern, jsxFactory) {
339
340
  const upperName = capitalize2(name);
340
341
  const jsxName = pattern.jsx ?? upperName;
@@ -347,9 +348,18 @@ function generate(name, pattern, jsxFactory) {
347
348
  import { config } from '../patterns/${dashCase(name)}'
348
349
 
349
350
  export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
350
- const { ${keys.join(", ")}, ...restProps } = props
351
- const styleProps = config.transform({${keys.join(", ")}})
352
- return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
351
+ ${match(keys.length).with(
352
+ 0,
353
+ () => `
354
+ return <${jsxFactory}.div ref={ref} {...props} />
355
+ `
356
+ ).otherwise(
357
+ () => `
358
+ const { ${keys.join(", ")}, ...restProps } = props
359
+ const styleProps = config.transform({${keys.join(", ")}})
360
+ return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
361
+ `
362
+ )}
353
363
  })
354
364
  `,
355
365
  dts: outdent7`
@@ -365,7 +375,7 @@ function generate(name, pattern, jsxFactory) {
365
375
  type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties &
366
376
  Assign<Omit<PropsOf<C>, 'color'>, P & { as?: C }>
367
377
 
368
- type ${jsxName}Props<C extends ElementType> = Polymorphic<C, ${upperName}Options>
378
+ type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Options>
369
379
 
370
380
  export declare function ${jsxName}<V extends ElementType>(props: ${jsxName}Props<V>): JSX.Element
371
381
  `
@@ -462,6 +472,7 @@ function generateReactJsxFactory(ctx) {
462
472
  // src/generators/jsx/react-pattern.ts
463
473
  import { capitalize as capitalize4, dashCase as dashCase2 } from "@pandacss/shared";
464
474
  import { outdent as outdent9 } from "outdent";
475
+ import { match as match2 } from "ts-pattern";
465
476
  function generate2(name, pattern, jsxFactory) {
466
477
  const upperName = capitalize4(name);
467
478
  const jsxName = pattern.jsx ?? upperName;
@@ -474,9 +485,19 @@ function generate2(name, pattern, jsxFactory) {
474
485
  import { config } from '../patterns/${dashCase2(name)}'
475
486
 
476
487
  export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
477
- const { ${keys.join(", ")}, ...restProps } = props
478
- const styleProps = config.transform({${keys.join(", ")}})
479
- return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
488
+ ${match2(keys.length).with(
489
+ 0,
490
+ () => `
491
+ return <${jsxFactory}.div ref={ref} {...props} />
492
+ `
493
+ ).otherwise(
494
+ () => `
495
+ const { ${keys.join(", ")}, ...restProps } = props
496
+ const styleProps = config.transform({${keys.join(", ")}})
497
+ return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
498
+ `
499
+ )}
500
+
480
501
  })
481
502
  `,
482
503
  dts: outdent9`
@@ -489,7 +510,7 @@ function generate2(name, pattern, jsxFactory) {
489
510
  type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties &
490
511
  Assign<Omit<PropsOf<C>, 'color'>, P & { as?: C }>
491
512
 
492
- export type ${jsxName}Props<C extends ElementType> = Polymorphic<C, ${upperName}Options>
513
+ export type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Options>
493
514
 
494
515
  export declare function ${jsxName}<V extends ElementType>(props: ${jsxName}Props<V>): JSX.Element
495
516
  `
@@ -573,6 +594,7 @@ function generateSolidJsxFactory(ctx) {
573
594
  // src/generators/jsx/solid-pattern.ts
574
595
  import { capitalize as capitalize6, dashCase as dashCase3 } from "@pandacss/shared";
575
596
  import { outdent as outdent11 } from "outdent";
597
+ import { match as match3 } from "ts-pattern";
576
598
  function generate3(name, pattern, jsxFactory) {
577
599
  const upperName = capitalize6(name);
578
600
  const jsxName = pattern.jsx ?? upperName;
@@ -585,9 +607,18 @@ function generate3(name, pattern, jsxFactory) {
585
607
  import { config } from '../patterns/${dashCase3(name)}'
586
608
 
587
609
  export function ${jsxName}(props) {
588
- const [patternProps, restProps] = splitProps(props, [${keys.map((v) => JSON.stringify(v)).join(", ")}]);
589
- const styleProps = config.transform(patternProps)
590
- return <${jsxFactory}.div {...styleProps} {...restProps} />
610
+ ${match3(keys.length).with(
611
+ 0,
612
+ () => `
613
+ return <${jsxFactory}.div {...props} />
614
+ `
615
+ ).otherwise(
616
+ () => `
617
+ const [patternProps, restProps] = splitProps(props, [${keys.map((v) => JSON.stringify(v)).join(", ")}]);
618
+ const styleProps = config.transform(patternProps)
619
+ return <${jsxFactory}.div {...styleProps} {...restProps} />
620
+ `
621
+ )}
591
622
  }
592
623
  `,
593
624
  dts: outdent11`
@@ -601,7 +632,7 @@ function generate3(name, pattern, jsxFactory) {
601
632
  type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties &
602
633
  Assign<Omit<PropsOf<C>, 'color'>, P & { as?: C }>
603
634
 
604
- export type ${jsxName}Props<C extends ElementType> = Polymorphic<C, ${upperName}Options>
635
+ export type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Options>
605
636
 
606
637
  export declare function ${jsxName}<V extends ElementType>(props: ${jsxName}Props<V>): JSX.Element
607
638
  `
@@ -635,7 +666,7 @@ function generateJsxPatterns(ctx) {
635
666
  import { capitalize as capitalize7, dashCase as dashCase4, unionType as unionType2 } from "@pandacss/shared";
636
667
  import { outdent as outdent12 } from "outdent";
637
668
  import { stringify as stringify2 } from "telejson";
638
- import { match } from "ts-pattern";
669
+ import { match as match4 } from "ts-pattern";
639
670
  function generate4(name, pattern) {
640
671
  const { properties, transform, strict } = pattern;
641
672
  return {
@@ -648,7 +679,7 @@ function generate4(name, pattern) {
648
679
  export type ${capitalize7(name)}Options = {
649
680
  ${Object.keys(properties ?? {}).map((key) => {
650
681
  const value = properties[key];
651
- return match(value).with({ type: "property" }, (value2) => {
682
+ return match4(value).with({ type: "property" }, (value2) => {
652
683
  return `${key}?: SystemStyleObject["${value2.value}"]`;
653
684
  }).with({ type: "token" }, (value2) => {
654
685
  if (value2.property) {
@@ -875,7 +906,7 @@ function generateReset() {
875
906
  // src/generators/token-css.ts
876
907
  import { toCss, toKeyframeCss } from "@pandacss/core";
877
908
  import { outdent as outdent15 } from "outdent";
878
- import { match as match2, P } from "ts-pattern";
909
+ import { match as match5, P } from "ts-pattern";
879
910
  function generateKeyframes(keyframes) {
880
911
  if (keyframes) {
881
912
  return toKeyframeCss(keyframes);
@@ -902,7 +933,7 @@ function generateTokenCss(ctx, varRoot) {
902
933
  results.push(css3);
903
934
  } else {
904
935
  const cond = conditions.normalize(key);
905
- const css3 = match2(cond).with({ type: "parent-nesting" }, (cond2) => {
936
+ const css3 = match5(cond).with({ type: "parent-nesting" }, (cond2) => {
906
937
  const selector = cond2.value.replace(/\s&/g, "");
907
938
  const { css: css4 } = toCss(varsObj);
908
939
  return `${selector} {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.0.0-dev-20221124070053",
3
+ "version": "0.0.0-dev-20221124074636",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -30,15 +30,15 @@
30
30
  "telejson": "6.0.8",
31
31
  "ts-pattern": "4.0.6",
32
32
  "ts-morph": "17.0.1",
33
- "@pandacss/types": "0.0.0-dev-20221124070053",
34
- "@pandacss/is-valid-prop": "0.0.0-dev-20221124070053",
35
- "@pandacss/error": "0.0.0-dev-20221124070053",
36
- "@pandacss/parser": "0.0.0-dev-20221124070053",
37
- "@pandacss/shared": "0.0.0-dev-20221124070053",
38
- "@pandacss/token-dictionary": "0.0.0-dev-20221124070053",
39
- "@pandacss/logger": "0.0.0-dev-20221124070053",
40
- "@pandacss/core": "0.0.0-dev-20221124070053",
41
- "@pandacss/config": "0.0.0-dev-20221124070053"
33
+ "@pandacss/types": "0.0.0-dev-20221124074636",
34
+ "@pandacss/is-valid-prop": "0.0.0-dev-20221124074636",
35
+ "@pandacss/error": "0.0.0-dev-20221124074636",
36
+ "@pandacss/parser": "0.0.0-dev-20221124074636",
37
+ "@pandacss/shared": "0.0.0-dev-20221124074636",
38
+ "@pandacss/token-dictionary": "0.0.0-dev-20221124074636",
39
+ "@pandacss/logger": "0.0.0-dev-20221124074636",
40
+ "@pandacss/core": "0.0.0-dev-20221124074636",
41
+ "@pandacss/config": "0.0.0-dev-20221124074636"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/fs-extra": "9.0.13",
@@ -46,7 +46,7 @@
46
46
  "@types/glob-parent": "^5.1.1",
47
47
  "@types/pluralize": "0.0.29",
48
48
  "@types/lodash.merge": "4.6.7",
49
- "@pandacss/fixture": "0.0.0-dev-20221124070053"
49
+ "@pandacss/fixture": "0.0.0-dev-20221124074636"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",