@pandacss/node 0.0.0-dev-20221222102219 → 0.0.0-dev-20221229135204
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 +12 -13
- package/dist/index.js +262 -179
- package/dist/index.mjs +244 -161
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -127,7 +127,7 @@ async function writeFileChunk(ctx, file) {
|
|
|
127
127
|
|
|
128
128
|
// src/generators/index.ts
|
|
129
129
|
var import_fs2 = require("fs");
|
|
130
|
-
var
|
|
130
|
+
var import_outdent25 = __toESM(require("outdent"));
|
|
131
131
|
|
|
132
132
|
// src/generators/conditions.ts
|
|
133
133
|
var import_shared = require("@pandacss/shared");
|
|
@@ -335,21 +335,6 @@ function generatePreactJsxFactory(ctx) {
|
|
|
335
335
|
const name = ctx.jsxFactory;
|
|
336
336
|
const upperName = (0, import_shared2.capitalize)(name);
|
|
337
337
|
return {
|
|
338
|
-
dts: import_outdent6.outdent`
|
|
339
|
-
import type { ComponentProps, JSX } from 'preact'
|
|
340
|
-
import type { JSXStyleProperties } from '../types'
|
|
341
|
-
|
|
342
|
-
type Element = keyof JSX.IntrinsicElements
|
|
343
|
-
|
|
344
|
-
export type HTML${upperName}Props<T extends Element> = Omit<ComponentProps<T>, 'color'> | JSXStyleProperties
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
type JSXFactory = {
|
|
348
|
-
[K in Element]: (props: HTML${upperName}Props<K>) => JSX.Element
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
export declare const ${name}: JSXFactory
|
|
352
|
-
`,
|
|
353
338
|
js: import_outdent6.outdent`
|
|
354
339
|
import { h } from 'preact'
|
|
355
340
|
import { forwardRef } from 'preact/compat'
|
|
@@ -497,19 +482,11 @@ function generate(name, pattern, jsxFactory) {
|
|
|
497
482
|
})
|
|
498
483
|
`,
|
|
499
484
|
dts: import_outdent8.outdent`
|
|
500
|
-
import { ComponentProps, JSX, ComponentChildren } from 'preact';
|
|
501
485
|
import { ${upperName}Properties } from '../patterns/${(0, import_shared3.dashCase)(name)}'
|
|
502
|
-
import {
|
|
503
|
-
|
|
504
|
-
type ElementType = keyof JSX.IntrinsicElements
|
|
505
|
-
|
|
506
|
-
type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties |
|
|
507
|
-
Assign<Omit<ComponentProps<C>, 'color'>, P & { as?: C }>
|
|
486
|
+
import { PolymorphicComponent } from '../types/jsx'
|
|
508
487
|
|
|
509
|
-
type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Properties>
|
|
510
|
-
|
|
511
488
|
${pattern.description ? `/** ${pattern.description} */` : ""}
|
|
512
|
-
export declare
|
|
489
|
+
export declare const ${jsxName}: PolymorphicComponent<"div", ${upperName}Properties>
|
|
513
490
|
`
|
|
514
491
|
};
|
|
515
492
|
}
|
|
@@ -517,28 +494,59 @@ function generatePreactJsxPattern(ctx) {
|
|
|
517
494
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate(name, pattern, ctx.jsxFactory));
|
|
518
495
|
}
|
|
519
496
|
|
|
520
|
-
// src/generators/jsx/
|
|
497
|
+
// src/generators/jsx/preact-types.ts
|
|
521
498
|
var import_shared4 = require("@pandacss/shared");
|
|
522
499
|
var import_outdent9 = require("outdent");
|
|
523
|
-
function
|
|
500
|
+
function generatePreactJsxTypes(ctx) {
|
|
524
501
|
const name = ctx.jsxFactory;
|
|
525
502
|
const upperName = (0, import_shared4.capitalize)(name);
|
|
526
503
|
return {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
504
|
+
jsxFactory: import_outdent9.outdent`
|
|
505
|
+
import { PolymorphicComponents } from '../types/jsx'
|
|
506
|
+
export declare const ${name}: PolymorphicComponents
|
|
507
|
+
`,
|
|
508
|
+
jsxType: import_outdent9.outdent`
|
|
509
|
+
import type { JSX, ComponentProps, ElementType } from 'preact'
|
|
510
|
+
import type { JsxStyleProps, Assign } from '.'
|
|
532
511
|
|
|
533
|
-
|
|
512
|
+
type Element = keyof JSX.IntrinsicElements
|
|
513
|
+
type As<P = any> = JSX.ElementType<P>
|
|
514
|
+
type Dict<T = unknown> = Record<string, T>
|
|
534
515
|
|
|
535
|
-
|
|
536
|
-
[K in Element]: (props: HTML${upperName}Props<K>) => JSX.Element
|
|
537
|
-
}
|
|
516
|
+
type Clean<T> = Omit<T, 'transition' | 'as' | 'color'>
|
|
538
517
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
518
|
+
type PolymorphicProps<
|
|
519
|
+
ComponentProps extends Dict,
|
|
520
|
+
AsProps extends Dict,
|
|
521
|
+
AdditionalProps extends Dict = {},
|
|
522
|
+
AsComponent extends As = As,
|
|
523
|
+
> = Assign<Clean<ComponentProps>, AdditionalProps> &
|
|
524
|
+
Assign<Clean<AsProps>, AdditionalProps> & {
|
|
525
|
+
as?: AsComponent
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
export type PolymorphicComponent<C extends As, P extends Dict = {}> = {
|
|
529
|
+
<E extends As = C>(props: PolymorphicProps<ComponentProps<C>, ComponentProps<E>, P, E> & JsxStyleProps<P>): JSX.Element
|
|
530
|
+
displayName?: string
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export type PolymorphicComponents = {
|
|
534
|
+
[K in Element]: PolymorphicComponent<K, {}>
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export type HTML${upperName}Props<T extends As> = Clean<ComponentProps<T>> & JsxStyleProps
|
|
538
|
+
`
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// src/generators/jsx/react-jsx.ts
|
|
543
|
+
var import_shared5 = require("@pandacss/shared");
|
|
544
|
+
var import_outdent10 = require("outdent");
|
|
545
|
+
function generateReactJsxFactory(ctx) {
|
|
546
|
+
const name = ctx.jsxFactory;
|
|
547
|
+
const upperName = (0, import_shared5.capitalize)(name);
|
|
548
|
+
return {
|
|
549
|
+
js: import_outdent10.outdent`
|
|
542
550
|
import { forwardRef } from 'react'
|
|
543
551
|
import { isCssProperty } from './is-valid-prop'
|
|
544
552
|
import { css } from '../css'
|
|
@@ -600,10 +608,10 @@ function generateReactJsxFactory(ctx) {
|
|
|
600
608
|
}
|
|
601
609
|
|
|
602
610
|
// src/generators/jsx/react-layout-grid.ts
|
|
603
|
-
var
|
|
611
|
+
var import_outdent11 = require("outdent");
|
|
604
612
|
function generateReactLayoutGrid() {
|
|
605
613
|
return {
|
|
606
|
-
dts:
|
|
614
|
+
dts: import_outdent11.outdent`
|
|
607
615
|
import type { FunctionComponent } from 'react'
|
|
608
616
|
|
|
609
617
|
export type LayoutGridProps = {
|
|
@@ -615,7 +623,7 @@ function generateReactLayoutGrid() {
|
|
|
615
623
|
|
|
616
624
|
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
617
625
|
`,
|
|
618
|
-
js:
|
|
626
|
+
js: import_outdent11.outdent`
|
|
619
627
|
export function LayoutGrid(props) {
|
|
620
628
|
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
621
629
|
const hasMaxWidth = maxWidth != null;
|
|
@@ -653,29 +661,29 @@ function generateReactLayoutGrid() {
|
|
|
653
661
|
}
|
|
654
662
|
|
|
655
663
|
// src/generators/jsx/react-pattern.ts
|
|
656
|
-
var
|
|
657
|
-
var
|
|
664
|
+
var import_shared6 = require("@pandacss/shared");
|
|
665
|
+
var import_outdent12 = require("outdent");
|
|
658
666
|
var import_ts_pattern2 = require("ts-pattern");
|
|
659
667
|
function generate2(name, pattern, jsxFactory) {
|
|
660
|
-
const upperName = (0,
|
|
668
|
+
const upperName = (0, import_shared6.capitalize)(name);
|
|
661
669
|
const upperFn = `get${upperName}Style`;
|
|
662
670
|
const jsxName = pattern.jsx ?? upperName;
|
|
663
671
|
const keys = Object.keys(pattern.properties ?? {});
|
|
664
672
|
return {
|
|
665
|
-
name: (0,
|
|
666
|
-
js:
|
|
673
|
+
name: (0, import_shared6.dashCase)(name),
|
|
674
|
+
js: import_outdent12.outdent`
|
|
667
675
|
import { forwardRef } from 'react'
|
|
668
676
|
import { ${jsxFactory} } from './factory'
|
|
669
|
-
import { ${upperFn} } from '../patterns/${(0,
|
|
677
|
+
import { ${upperFn} } from '../patterns/${(0, import_shared6.dashCase)(name)}'
|
|
670
678
|
|
|
671
679
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
672
680
|
${(0, import_ts_pattern2.match)(keys.length).with(
|
|
673
681
|
0,
|
|
674
|
-
() =>
|
|
682
|
+
() => import_outdent12.outdent`
|
|
675
683
|
return <${jsxFactory}.div ref={ref} {...props} />
|
|
676
684
|
`
|
|
677
685
|
).otherwise(
|
|
678
|
-
() =>
|
|
686
|
+
() => import_outdent12.outdent`
|
|
679
687
|
const { ${keys.join(", ")}, ...restProps } = props
|
|
680
688
|
const styleProps = ${upperFn}({${keys.join(", ")}})
|
|
681
689
|
return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
|
|
@@ -684,19 +692,12 @@ function generate2(name, pattern, jsxFactory) {
|
|
|
684
692
|
|
|
685
693
|
})
|
|
686
694
|
`,
|
|
687
|
-
dts:
|
|
688
|
-
import {
|
|
689
|
-
import {
|
|
690
|
-
import { JSXStyleProperties, Assign } from '../types'
|
|
691
|
-
|
|
692
|
-
type Polymorphic<C extends ElementType = "div", P = {}> =
|
|
693
|
-
| JSXStyleProperties
|
|
694
|
-
| Assign<Omit<ComponentProps<C>, "color">, P & { as?: C }>
|
|
695
|
+
dts: import_outdent12.outdent`
|
|
696
|
+
import { ${upperName}Properties } from '../patterns/${(0, import_shared6.dashCase)(name)}'
|
|
697
|
+
import { PolymorphicComponent } from '../types/jsx'
|
|
695
698
|
|
|
696
|
-
export type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Properties>
|
|
697
|
-
|
|
698
699
|
${pattern.description ? `/** ${pattern.description} */` : ""}
|
|
699
|
-
export declare
|
|
700
|
+
export declare const ${jsxName}: PolymorphicComponent<"div", ${upperName}Properties>
|
|
700
701
|
`
|
|
701
702
|
};
|
|
702
703
|
}
|
|
@@ -704,28 +705,59 @@ function generateReactJsxPattern(ctx) {
|
|
|
704
705
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate2(name, pattern, ctx.jsxFactory));
|
|
705
706
|
}
|
|
706
707
|
|
|
707
|
-
// src/generators/jsx/
|
|
708
|
-
var
|
|
709
|
-
var
|
|
710
|
-
function
|
|
708
|
+
// src/generators/jsx/react-types.ts
|
|
709
|
+
var import_shared7 = require("@pandacss/shared");
|
|
710
|
+
var import_outdent13 = require("outdent");
|
|
711
|
+
function generateReactJsxTypes(ctx) {
|
|
711
712
|
const name = ctx.jsxFactory;
|
|
712
|
-
const upperName = (0,
|
|
713
|
+
const upperName = (0, import_shared7.capitalize)(name);
|
|
713
714
|
return {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
715
|
+
jsxFactory: import_outdent13.outdent`
|
|
716
|
+
import { PolymorphicComponents } from '../types/jsx'
|
|
717
|
+
export declare const ${name}: PolymorphicComponents
|
|
718
|
+
`,
|
|
719
|
+
jsxType: import_outdent13.outdent`
|
|
720
|
+
import type { ElementType, ComponentProps } from 'react'
|
|
721
|
+
import type { JsxStyleProps, Assign } from '.'
|
|
721
722
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
723
|
+
type Element = keyof JSX.IntrinsicElements
|
|
724
|
+
type As<P = any> = ElementType<P>
|
|
725
|
+
type Dict<T = unknown> = Record<string, T>
|
|
725
726
|
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
727
|
+
type Clean<T> = Omit<T, 'transition' | 'as' | 'color'>
|
|
728
|
+
|
|
729
|
+
type PolymorphicProps<
|
|
730
|
+
ComponentProps extends Dict,
|
|
731
|
+
AsProps extends Dict,
|
|
732
|
+
AdditionalProps extends Dict = {},
|
|
733
|
+
AsComponent extends As = As,
|
|
734
|
+
> = Assign<Clean<ComponentProps>, AdditionalProps> &
|
|
735
|
+
Assign<Clean<AsProps>, AdditionalProps> & {
|
|
736
|
+
as?: AsComponent
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export type PolymorphicComponent<C extends As, P extends Dict = {}> = {
|
|
740
|
+
<E extends As = C>(props: PolymorphicProps<ComponentProps<C>, ComponentProps<E>, P, E> & JsxStyleProps<P>): JSX.Element
|
|
741
|
+
displayName?: string
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
export type PolymorphicComponents = {
|
|
745
|
+
[K in Element]: PolymorphicComponent<K, {}>
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export type HTML${upperName}Props<T extends As> = Clean<ComponentProps<T>> & JsxStyleProps
|
|
749
|
+
`
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
// src/generators/jsx/solid-jsx.ts
|
|
754
|
+
var import_shared8 = require("@pandacss/shared");
|
|
755
|
+
var import_outdent14 = require("outdent");
|
|
756
|
+
function generateSolidJsxFactory(ctx) {
|
|
757
|
+
const name = ctx.jsxFactory;
|
|
758
|
+
const upperName = (0, import_shared8.capitalize)(name);
|
|
759
|
+
return {
|
|
760
|
+
js: import_outdent14.outdent`
|
|
729
761
|
import { Dynamic } from 'solid-js/web'
|
|
730
762
|
import { mergeProps, splitProps } from 'solid-js'
|
|
731
763
|
import { allCssProperties } from './is-valid-prop'
|
|
@@ -774,10 +806,10 @@ function generateSolidJsxFactory(ctx) {
|
|
|
774
806
|
}
|
|
775
807
|
|
|
776
808
|
// src/generators/jsx/solid-layout-grid.ts
|
|
777
|
-
var
|
|
809
|
+
var import_outdent15 = require("outdent");
|
|
778
810
|
function generateSolidLayoutGrid() {
|
|
779
811
|
return {
|
|
780
|
-
dts:
|
|
812
|
+
dts: import_outdent15.outdent`
|
|
781
813
|
export type LayoutGridProps = {
|
|
782
814
|
count?: number
|
|
783
815
|
gutter?: string
|
|
@@ -787,7 +819,7 @@ function generateSolidLayoutGrid() {
|
|
|
787
819
|
|
|
788
820
|
export declare const LayoutGrid: React.FC<LayoutGridProps>
|
|
789
821
|
`,
|
|
790
|
-
js:
|
|
822
|
+
js: import_outdent15.outdent`
|
|
791
823
|
export function LayoutGrid(props) {
|
|
792
824
|
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
793
825
|
const hasMaxWidth = maxWidth != null;
|
|
@@ -825,29 +857,29 @@ function generateSolidLayoutGrid() {
|
|
|
825
857
|
}
|
|
826
858
|
|
|
827
859
|
// src/generators/jsx/solid-pattern.ts
|
|
828
|
-
var
|
|
829
|
-
var
|
|
860
|
+
var import_shared9 = require("@pandacss/shared");
|
|
861
|
+
var import_outdent16 = require("outdent");
|
|
830
862
|
var import_ts_pattern3 = require("ts-pattern");
|
|
831
863
|
function generate3(name, pattern, jsxFactory) {
|
|
832
|
-
const upperName = (0,
|
|
864
|
+
const upperName = (0, import_shared9.capitalize)(name);
|
|
833
865
|
const upperFn = `get${upperName}Style`;
|
|
834
866
|
const jsxName = pattern.jsx ?? upperName;
|
|
835
867
|
const keys = Object.keys(pattern.properties ?? {});
|
|
836
868
|
return {
|
|
837
|
-
name: (0,
|
|
838
|
-
js:
|
|
869
|
+
name: (0, import_shared9.dashCase)(name),
|
|
870
|
+
js: import_outdent16.outdent`
|
|
839
871
|
import { splitProps } from 'solid-js'
|
|
840
872
|
import { ${jsxFactory} } from './factory'
|
|
841
|
-
import { ${upperFn} } from '../patterns/${(0,
|
|
873
|
+
import { ${upperFn} } from '../patterns/${(0, import_shared9.dashCase)(name)}'
|
|
842
874
|
|
|
843
875
|
export function ${jsxName}(props) {
|
|
844
876
|
${(0, import_ts_pattern3.match)(keys.length).with(
|
|
845
877
|
0,
|
|
846
|
-
() =>
|
|
878
|
+
() => import_outdent16.outdent`
|
|
847
879
|
return <${jsxFactory}.div {...props} />
|
|
848
880
|
`
|
|
849
881
|
).otherwise(
|
|
850
|
-
() =>
|
|
882
|
+
() => import_outdent16.outdent`
|
|
851
883
|
const [patternProps, restProps] = splitProps(props, [${keys.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
852
884
|
const styleProps = ${upperFn}(patternProps)
|
|
853
885
|
return <${jsxFactory}.div {...styleProps} {...restProps} />
|
|
@@ -855,20 +887,12 @@ function generate3(name, pattern, jsxFactory) {
|
|
|
855
887
|
)}
|
|
856
888
|
}
|
|
857
889
|
`,
|
|
858
|
-
dts:
|
|
859
|
-
import {
|
|
860
|
-
import {
|
|
861
|
-
import { Assign, JSXStyleProperties } from '../types'
|
|
862
|
-
|
|
863
|
-
type ElementType = keyof JSX.IntrinsicElements
|
|
864
|
-
|
|
865
|
-
type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties |
|
|
866
|
-
Assign<Omit<ComponentProps<C>, 'color'>, P & { as?: C }>
|
|
890
|
+
dts: import_outdent16.outdent`
|
|
891
|
+
import { ${upperName}Properties } from '../patterns/${(0, import_shared9.dashCase)(name)}'
|
|
892
|
+
import { PolymorphicComponent } from '../types/jsx'
|
|
867
893
|
|
|
868
|
-
export type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Properties>
|
|
869
|
-
|
|
870
894
|
${pattern.description ? `/** ${pattern.description} */` : ""}
|
|
871
|
-
export declare
|
|
895
|
+
export declare const ${jsxName}: PolymorphicComponent<"div", ${upperName}Properties>
|
|
872
896
|
`
|
|
873
897
|
};
|
|
874
898
|
}
|
|
@@ -876,7 +900,62 @@ function generateSolidJsxPattern(ctx) {
|
|
|
876
900
|
return Object.entries(ctx.patterns).map(([name, pattern]) => generate3(name, pattern, ctx.jsxFactory));
|
|
877
901
|
}
|
|
878
902
|
|
|
903
|
+
// src/generators/jsx/solid-types.ts
|
|
904
|
+
var import_shared10 = require("@pandacss/shared");
|
|
905
|
+
var import_outdent17 = require("outdent");
|
|
906
|
+
function generateSolidJsxTypes(ctx) {
|
|
907
|
+
const name = ctx.jsxFactory;
|
|
908
|
+
const upperName = (0, import_shared10.capitalize)(name);
|
|
909
|
+
return {
|
|
910
|
+
jsxFactory: import_outdent17.outdent`
|
|
911
|
+
import { PolymorphicComponents } from '../types/jsx'
|
|
912
|
+
export declare const ${name}: PolymorphicComponents
|
|
913
|
+
`,
|
|
914
|
+
jsxType: import_outdent17.outdent`
|
|
915
|
+
import type { JSX, ComponentProps, Component } from 'solid-js'
|
|
916
|
+
import type { JsxStyleProps, Assign } from '.'
|
|
917
|
+
|
|
918
|
+
type Element = keyof JSX.IntrinsicElements
|
|
919
|
+
type As<P = any> = Element | Component<P>;
|
|
920
|
+
type Dict<T = unknown> = Record<string, T>
|
|
921
|
+
|
|
922
|
+
type Clean<T> = Omit<T, 'transition' | 'as' | 'color'>
|
|
923
|
+
|
|
924
|
+
type PolymorphicProps<
|
|
925
|
+
ComponentProps extends Dict,
|
|
926
|
+
AsProps extends Dict,
|
|
927
|
+
AdditionalProps extends Dict = {},
|
|
928
|
+
AsComponent extends As = As,
|
|
929
|
+
> = Assign<Clean<ComponentProps>, AdditionalProps> &
|
|
930
|
+
Assign<Clean<AsProps>, AdditionalProps> & {
|
|
931
|
+
as?: AsComponent
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export type PolymorphicComponent<C extends As, P extends Dict = {}> = {
|
|
935
|
+
<E extends As = C>(props: PolymorphicProps<ComponentProps<C>, ComponentProps<E>, P, E> & JsxStyleProps<P>): JSX.Element
|
|
936
|
+
displayName?: string
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
export type PolymorphicComponents = {
|
|
940
|
+
[K in Element]: PolymorphicComponent<K, {}>
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
export type HTML${upperName}Props<T extends As> = Clean<ComponentProps<T>> & JsxStyleProps
|
|
944
|
+
`
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
|
|
879
948
|
// src/generators/jsx/index.ts
|
|
949
|
+
var typesMap = {
|
|
950
|
+
react: generateReactJsxTypes,
|
|
951
|
+
preact: generatePreactJsxTypes,
|
|
952
|
+
solid: generateSolidJsxTypes
|
|
953
|
+
};
|
|
954
|
+
function generateJsxTypes(ctx) {
|
|
955
|
+
if (!ctx.jsxFramework)
|
|
956
|
+
return;
|
|
957
|
+
return typesMap[ctx.jsxFramework](ctx);
|
|
958
|
+
}
|
|
880
959
|
var factoryMap = {
|
|
881
960
|
react: generateReactJsxFactory,
|
|
882
961
|
solid: generateSolidJsxFactory,
|
|
@@ -905,22 +984,22 @@ function generateLayoutGrid(ctx) {
|
|
|
905
984
|
}
|
|
906
985
|
|
|
907
986
|
// src/generators/pattern.ts
|
|
908
|
-
var
|
|
909
|
-
var
|
|
987
|
+
var import_shared11 = require("@pandacss/shared");
|
|
988
|
+
var import_outdent18 = require("outdent");
|
|
910
989
|
var import_telejson = require("telejson");
|
|
911
990
|
var import_ts_pattern4 = require("ts-pattern");
|
|
912
991
|
function generate4(name, pattern) {
|
|
913
992
|
const { properties, transform, strict, description } = pattern;
|
|
914
|
-
const upperName = (0,
|
|
993
|
+
const upperName = (0, import_shared11.capitalize)(name);
|
|
915
994
|
const upperFn = `get${upperName}Style`;
|
|
916
995
|
return {
|
|
917
|
-
name: (0,
|
|
918
|
-
dts:
|
|
996
|
+
name: (0, import_shared11.dashCase)(name),
|
|
997
|
+
dts: import_outdent18.outdent`
|
|
919
998
|
import { SystemStyleObject, ConditionalValue } from "../types"
|
|
920
999
|
import { Properties } from "../types/csstype"
|
|
921
1000
|
import { Tokens } from "../types/token"
|
|
922
1001
|
|
|
923
|
-
export type ${(0,
|
|
1002
|
+
export type ${(0, import_shared11.capitalize)(name)}Properties = {
|
|
924
1003
|
${Object.keys(properties ?? {}).map((key) => {
|
|
925
1004
|
const value = properties[key];
|
|
926
1005
|
return (0, import_ts_pattern4.match)(value).with({ type: "property" }, (value2) => {
|
|
@@ -931,22 +1010,21 @@ function generate4(name, pattern) {
|
|
|
931
1010
|
}
|
|
932
1011
|
return `${key}?: ConditionalValue<Tokens["${value2.value}"]>`;
|
|
933
1012
|
}).with({ type: "enum" }, (value2) => {
|
|
934
|
-
return `${key}?: ConditionalValue<${(0,
|
|
1013
|
+
return `${key}?: ConditionalValue<${(0, import_shared11.unionType)(value2.value)}>`;
|
|
935
1014
|
}).otherwise(() => {
|
|
936
1015
|
return `${key}?: ConditionalValue<${value.type}>`;
|
|
937
1016
|
});
|
|
938
1017
|
}).join("\n ")}
|
|
939
1018
|
}
|
|
940
1019
|
|
|
941
|
-
${strict ?
|
|
942
|
-
|
|
943
|
-
|
|
1020
|
+
${strict ? import_outdent18.outdent`export declare function ${name}(options: ${upperName}Properties): string` : import_outdent18.outdent`
|
|
1021
|
+
|
|
944
1022
|
${description ? `/** ${description} */` : ""}
|
|
945
|
-
export declare function ${name}(options:
|
|
1023
|
+
export declare function ${name}(options: SystemStyleObject<${upperName}Properties>): string
|
|
946
1024
|
`}
|
|
947
1025
|
|
|
948
1026
|
`,
|
|
949
|
-
js:
|
|
1027
|
+
js: import_outdent18.outdent`
|
|
950
1028
|
import { mapObject } from "../helpers"
|
|
951
1029
|
import { css } from "../css"
|
|
952
1030
|
|
|
@@ -965,10 +1043,10 @@ function generatePattern(ctx) {
|
|
|
965
1043
|
}
|
|
966
1044
|
|
|
967
1045
|
// src/generators/prop-types.ts
|
|
968
|
-
var
|
|
1046
|
+
var import_outdent19 = require("outdent");
|
|
969
1047
|
function generatePropTypes(utility) {
|
|
970
1048
|
const result = [
|
|
971
|
-
|
|
1049
|
+
import_outdent19.outdent`
|
|
972
1050
|
import { Properties as CSSProperties } from "./csstype"
|
|
973
1051
|
|
|
974
1052
|
type BasePropTypes = {`
|
|
@@ -995,15 +1073,15 @@ function generatePropTypes(utility) {
|
|
|
995
1073
|
}
|
|
996
1074
|
|
|
997
1075
|
// src/generators/recipe.ts
|
|
998
|
-
var
|
|
999
|
-
var
|
|
1076
|
+
var import_shared12 = require("@pandacss/shared");
|
|
1077
|
+
var import_outdent20 = require("outdent");
|
|
1000
1078
|
function generateRecipes(ctx) {
|
|
1001
1079
|
const { recipes = {}, hash, hasRecipes, utility } = ctx;
|
|
1002
1080
|
const { separator } = utility;
|
|
1003
1081
|
if (!hasRecipes)
|
|
1004
1082
|
return;
|
|
1005
1083
|
const js = [
|
|
1006
|
-
|
|
1084
|
+
import_outdent20.outdent`
|
|
1007
1085
|
import { createCss, withoutSpace } from "../helpers"
|
|
1008
1086
|
|
|
1009
1087
|
const createRecipe = (name, defaultVariants) => {
|
|
@@ -1038,27 +1116,27 @@ function generateRecipes(ctx) {
|
|
|
1038
1116
|
const dts = [""];
|
|
1039
1117
|
Object.values(recipes).forEach((recipe) => {
|
|
1040
1118
|
const { name, description, defaultVariants, variants } = recipe;
|
|
1041
|
-
js.push(
|
|
1119
|
+
js.push(import_outdent20.outdent`
|
|
1042
1120
|
export const ${name} = createRecipe('${name}', ${JSON.stringify(defaultVariants ?? {})})
|
|
1043
1121
|
`);
|
|
1044
|
-
dts.push(
|
|
1122
|
+
dts.push(import_outdent20.outdent`
|
|
1045
1123
|
import { ConditionalValue } from "../types"
|
|
1046
1124
|
|
|
1047
|
-
export type ${(0,
|
|
1125
|
+
export type ${(0, import_shared12.capitalize)(name)}Variants = {
|
|
1048
1126
|
${Object.keys(variants ?? {}).map((key) => {
|
|
1049
1127
|
const value = variants[key];
|
|
1050
1128
|
const keys = Object.keys(value);
|
|
1051
|
-
return `${key}?: ConditionalValue<${(0,
|
|
1129
|
+
return `${key}?: ConditionalValue<${(0, import_shared12.unionType)(keys)}>`;
|
|
1052
1130
|
}).join("\n")}
|
|
1053
1131
|
}
|
|
1054
1132
|
|
|
1055
1133
|
${description ? `/** ${description} */` : ""}
|
|
1056
|
-
export declare function ${name}(value?: ${(0,
|
|
1134
|
+
export declare function ${name}(value?: ${(0, import_shared12.capitalize)(name)}Variants): string
|
|
1057
1135
|
`);
|
|
1058
1136
|
});
|
|
1059
1137
|
return {
|
|
1060
|
-
js:
|
|
1061
|
-
dts:
|
|
1138
|
+
js: import_outdent20.outdent.string(js.join("\n\n")),
|
|
1139
|
+
dts: import_outdent20.outdent.string(dts.join("\n\n"))
|
|
1062
1140
|
};
|
|
1063
1141
|
}
|
|
1064
1142
|
|
|
@@ -1165,14 +1243,14 @@ function generateReset() {
|
|
|
1165
1243
|
|
|
1166
1244
|
// src/generators/token-css.ts
|
|
1167
1245
|
var import_core2 = require("@pandacss/core");
|
|
1168
|
-
var
|
|
1246
|
+
var import_outdent21 = require("outdent");
|
|
1169
1247
|
var import_ts_pattern5 = require("ts-pattern");
|
|
1170
1248
|
function generateKeyframes(keyframes) {
|
|
1171
1249
|
if (!keyframes)
|
|
1172
1250
|
return;
|
|
1173
1251
|
return (0, import_core2.toKeyframeCss)(keyframes);
|
|
1174
1252
|
}
|
|
1175
|
-
var getConditionMessage = (value) =>
|
|
1253
|
+
var getConditionMessage = (value) => import_outdent21.outdent`
|
|
1176
1254
|
It seems you provided an invalid condition for semantic tokens.
|
|
1177
1255
|
|
|
1178
1256
|
- You provided: \`${value}\`
|
|
@@ -1233,30 +1311,30 @@ function generateTokenCss(ctx, varRoot) {
|
|
|
1233
1311
|
}
|
|
1234
1312
|
|
|
1235
1313
|
// src/generators/token-dts.ts
|
|
1236
|
-
var
|
|
1237
|
-
var
|
|
1314
|
+
var import_shared13 = require("@pandacss/shared");
|
|
1315
|
+
var import_outdent22 = require("outdent");
|
|
1238
1316
|
var import_pluralize = __toESM(require("pluralize"));
|
|
1239
1317
|
function generateTokenDts(dict) {
|
|
1240
1318
|
const set = /* @__PURE__ */ new Set();
|
|
1241
|
-
set.add(`export type Token = ${dict.isEmpty ? "string" : (0,
|
|
1319
|
+
set.add(`export type Token = ${dict.isEmpty ? "string" : (0, import_shared13.unionType)(dict.allNames)}`);
|
|
1242
1320
|
const interfaceSet = /* @__PURE__ */ new Set(["export interface Tokens {"]);
|
|
1243
1321
|
if (dict.isEmpty) {
|
|
1244
1322
|
interfaceSet.add("[token: string]: string");
|
|
1245
1323
|
} else {
|
|
1246
1324
|
for (const [key, value] of dict.categoryMap.entries()) {
|
|
1247
|
-
const typeName = (0,
|
|
1248
|
-
set.add(`export type ${typeName} = ${(0,
|
|
1249
|
-
set.add(`export type ColorPalette = ${(0,
|
|
1325
|
+
const typeName = (0, import_shared13.capitalize)(import_pluralize.default.singular(key));
|
|
1326
|
+
set.add(`export type ${typeName} = ${(0, import_shared13.unionType)(value.keys())}`);
|
|
1327
|
+
set.add(`export type ColorPalette = ${(0, import_shared13.unionType)(Object.keys(dict.colorPalettes))}`);
|
|
1250
1328
|
interfaceSet.add(` ${key}: ${typeName}`);
|
|
1251
1329
|
}
|
|
1252
1330
|
}
|
|
1253
1331
|
interfaceSet.add("}");
|
|
1254
1332
|
set.add(Array.from(interfaceSet).join("\n"));
|
|
1255
|
-
return
|
|
1333
|
+
return import_outdent22.outdent.string(Array.from(set).join("\n\n"));
|
|
1256
1334
|
}
|
|
1257
1335
|
|
|
1258
1336
|
// src/generators/token-js.ts
|
|
1259
|
-
var
|
|
1337
|
+
var import_outdent23 = __toESM(require("outdent"));
|
|
1260
1338
|
function generateTokenJs(dict) {
|
|
1261
1339
|
const map = /* @__PURE__ */ new Map();
|
|
1262
1340
|
dict.allTokens.forEach((token) => {
|
|
@@ -1266,7 +1344,7 @@ function generateTokenJs(dict) {
|
|
|
1266
1344
|
});
|
|
1267
1345
|
const obj = Object.fromEntries(map);
|
|
1268
1346
|
return {
|
|
1269
|
-
js:
|
|
1347
|
+
js: import_outdent23.default`
|
|
1270
1348
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1271
1349
|
|
|
1272
1350
|
function getToken(path) {
|
|
@@ -1279,7 +1357,7 @@ function generateTokenJs(dict) {
|
|
|
1279
1357
|
return variable
|
|
1280
1358
|
}
|
|
1281
1359
|
`,
|
|
1282
|
-
dts:
|
|
1360
|
+
dts: import_outdent23.default`
|
|
1283
1361
|
import { Token } from "../types/token"
|
|
1284
1362
|
export declare function getToken(path: Token): string
|
|
1285
1363
|
export declare function getTokenVar(path: Token): string
|
|
@@ -1289,27 +1367,29 @@ function generateTokenJs(dict) {
|
|
|
1289
1367
|
|
|
1290
1368
|
// src/generators/types.ts
|
|
1291
1369
|
var import_fs_extra = require("fs-extra");
|
|
1292
|
-
var
|
|
1370
|
+
var import_outdent24 = __toESM(require("outdent"));
|
|
1293
1371
|
function getType(file) {
|
|
1294
1372
|
const filepath = getEntrypoint("@pandacss/types", { dev: file });
|
|
1295
1373
|
return (0, import_fs_extra.readFileSync)(filepath, "utf8");
|
|
1296
1374
|
}
|
|
1297
1375
|
function generateCssType(ctx) {
|
|
1298
1376
|
const strict = ctx.strictTokens;
|
|
1377
|
+
const strictArg = strict ? "true" : "false";
|
|
1299
1378
|
return {
|
|
1300
1379
|
cssType: getType("csstype.d.ts"),
|
|
1301
1380
|
pandaCssType: getType("system-types.d.ts"),
|
|
1302
|
-
publicType:
|
|
1381
|
+
publicType: import_outdent24.default`
|
|
1303
1382
|
import * as System from './system-types'
|
|
1304
1383
|
import { PropTypes } from './prop-type'
|
|
1305
1384
|
import { Conditions } from './conditions'
|
|
1306
1385
|
|
|
1307
|
-
export type SystemStyleObject = System.StyleObject<Conditions, PropTypes${
|
|
1308
|
-
export type GlobalStyleObject = System.GlobalStyleObject<Conditions, PropTypes${
|
|
1309
|
-
export type
|
|
1386
|
+
export type SystemStyleObject<Overrides = {}> = System.StyleObject<Conditions, PropTypes, ${strictArg}, Overrides>
|
|
1387
|
+
export type GlobalStyleObject<Overrides = {}> = System.GlobalStyleObject<Conditions, PropTypes, ${strictArg}, Overrides>
|
|
1388
|
+
export type JsxStyleProps<Overrides = {}> = System.JsxStyleProps<Conditions, PropTypes, ${strictArg}, Overrides>
|
|
1389
|
+
export type ConditionalValue<Value> = System.Conditional<Conditions, Value>
|
|
1310
1390
|
|
|
1311
|
-
|
|
1312
|
-
export type Assign<
|
|
1391
|
+
type DistributiveOmit<T, U> = T extends any ? Pick<T, Exclude<keyof T, U>> : never
|
|
1392
|
+
export type Assign<Target, Override> = DistributiveOmit<Target, keyof Override> & Override
|
|
1313
1393
|
`
|
|
1314
1394
|
};
|
|
1315
1395
|
}
|
|
@@ -1358,16 +1438,18 @@ function setupGlobalCss(ctx) {
|
|
|
1358
1438
|
function setupTypes(ctx) {
|
|
1359
1439
|
const code = generateCssType(ctx);
|
|
1360
1440
|
const conditions = generateConditions(ctx);
|
|
1441
|
+
const jsx = generateJsxTypes(ctx);
|
|
1361
1442
|
return {
|
|
1362
1443
|
dir: ctx.paths.types,
|
|
1363
1444
|
files: [
|
|
1445
|
+
jsx ? { file: "jsx.d.ts", code: jsx.jsxType } : null,
|
|
1364
1446
|
{ file: "csstype.d.ts", code: code.cssType },
|
|
1365
1447
|
{ file: "system-types.d.ts", code: code.pandaCssType },
|
|
1366
1448
|
{ file: "index.d.ts", code: code.publicType },
|
|
1367
1449
|
{ file: "token.d.ts", code: generateTokenDts(ctx.tokens) },
|
|
1368
1450
|
{ file: "prop-type.d.ts", code: generatePropTypes(ctx.utility) },
|
|
1369
1451
|
{ file: "conditions.d.ts", code: conditions.dts }
|
|
1370
|
-
]
|
|
1452
|
+
].filter(Boolean)
|
|
1371
1453
|
};
|
|
1372
1454
|
}
|
|
1373
1455
|
function setupCss(ctx) {
|
|
@@ -1420,11 +1502,11 @@ function setupPatterns(ctx) {
|
|
|
1420
1502
|
if (!files) {
|
|
1421
1503
|
return { files: [] };
|
|
1422
1504
|
}
|
|
1423
|
-
const indexCode =
|
|
1505
|
+
const indexCode = import_outdent25.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"));
|
|
1424
1506
|
return {
|
|
1425
1507
|
dir: ctx.paths.pattern,
|
|
1426
1508
|
files: [
|
|
1427
|
-
...files.map((file) => ({ file: `${file.name}.
|
|
1509
|
+
...files.map((file) => ({ file: `${file.name}.mjs`, code: file.js })),
|
|
1428
1510
|
...files.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
1429
1511
|
{ file: "index.mjs", code: indexCode },
|
|
1430
1512
|
{ file: "index.d.ts", code: indexCode }
|
|
@@ -1435,13 +1517,14 @@ function setupJsx(ctx) {
|
|
|
1435
1517
|
if (!ctx.jsxFramework)
|
|
1436
1518
|
return { files: [] };
|
|
1437
1519
|
const isValidProp = generateisValidProp(ctx);
|
|
1520
|
+
const types = generateJsxTypes(ctx);
|
|
1438
1521
|
const factory = generateJsxFactory(ctx);
|
|
1439
1522
|
const patterns = generateJsxPatterns(ctx);
|
|
1440
1523
|
const layoutGrid = generateLayoutGrid(ctx);
|
|
1441
|
-
const indexCode =
|
|
1524
|
+
const indexCode = import_outdent25.default`
|
|
1442
1525
|
export * from './factory'
|
|
1443
1526
|
export * from './layout-grid'
|
|
1444
|
-
${
|
|
1527
|
+
${import_outdent25.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
1445
1528
|
`;
|
|
1446
1529
|
return {
|
|
1447
1530
|
dir: ctx.paths.jsx,
|
|
@@ -1451,7 +1534,7 @@ function setupJsx(ctx) {
|
|
|
1451
1534
|
{ file: "layout-grid.jsx", code: layoutGrid.js },
|
|
1452
1535
|
{ file: "layout-grid.d.ts", code: layoutGrid.dts },
|
|
1453
1536
|
{ file: "is-valid-prop.mjs", code: isValidProp.js },
|
|
1454
|
-
{ file: "factory.d.ts", code:
|
|
1537
|
+
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
1455
1538
|
{ file: "factory.jsx", code: factory.js },
|
|
1456
1539
|
{ file: "index.d.ts", code: indexCode },
|
|
1457
1540
|
{ file: "index.jsx", code: indexCode }
|
|
@@ -1459,7 +1542,7 @@ function setupJsx(ctx) {
|
|
|
1459
1542
|
};
|
|
1460
1543
|
}
|
|
1461
1544
|
function setupCssIndex(ctx) {
|
|
1462
|
-
const code =
|
|
1545
|
+
const code = import_outdent25.default`
|
|
1463
1546
|
export * from './css'
|
|
1464
1547
|
export * from './cx'
|
|
1465
1548
|
export * from './global-css'
|
|
@@ -1499,30 +1582,30 @@ function generateSystem(ctx) {
|
|
|
1499
1582
|
|
|
1500
1583
|
// src/messages.ts
|
|
1501
1584
|
var import_logger3 = require("@pandacss/logger");
|
|
1502
|
-
var
|
|
1585
|
+
var import_outdent26 = require("outdent");
|
|
1503
1586
|
var tick = import_logger3.colors.green().bold("\u2714\uFE0F");
|
|
1504
1587
|
function artifactsGeneratedMessage(ctx) {
|
|
1505
1588
|
return [
|
|
1506
|
-
|
|
1589
|
+
import_outdent26.outdent`
|
|
1507
1590
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/css")}: the css function to author styles
|
|
1508
1591
|
`,
|
|
1509
|
-
ctx.hasTokens &&
|
|
1592
|
+
ctx.hasTokens && import_outdent26.outdent`
|
|
1510
1593
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
1511
1594
|
`,
|
|
1512
|
-
ctx.hasPatterns &&
|
|
1595
|
+
ctx.hasPatterns && import_outdent26.outdent`
|
|
1513
1596
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/patterns")}: functions to implement common css patterns
|
|
1514
1597
|
`,
|
|
1515
|
-
ctx.hasRecipes &&
|
|
1598
|
+
ctx.hasRecipes && import_outdent26.outdent`
|
|
1516
1599
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/recipes")}: functions to create multi-variant styles
|
|
1517
1600
|
`,
|
|
1518
|
-
ctx.jsxFramework &&
|
|
1601
|
+
ctx.jsxFramework && import_outdent26.outdent`
|
|
1519
1602
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/jsx")}: style prop powered elements for ${ctx.jsxFramework}
|
|
1520
1603
|
`,
|
|
1521
1604
|
"\n"
|
|
1522
1605
|
].filter(Boolean).join("\n");
|
|
1523
1606
|
}
|
|
1524
1607
|
function configExistsMessage(cmd) {
|
|
1525
|
-
return
|
|
1608
|
+
return import_outdent26.outdent`
|
|
1526
1609
|
\n
|
|
1527
1610
|
It looks like you already have panda created\`.
|
|
1528
1611
|
|
|
@@ -1531,7 +1614,7 @@ function configExistsMessage(cmd) {
|
|
|
1531
1614
|
`;
|
|
1532
1615
|
}
|
|
1533
1616
|
function thankYouMessage() {
|
|
1534
|
-
return
|
|
1617
|
+
return import_outdent26.outdent`
|
|
1535
1618
|
|
|
1536
1619
|
🚀 Thanks for choosing ${import_logger3.colors.cyan("Panda")} to write your css.
|
|
1537
1620
|
|
|
@@ -1543,7 +1626,7 @@ var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
|
|
|
1543
1626
|
var pickRandom = (arr) => arr[Math.floor(Math.random() * arr.length)];
|
|
1544
1627
|
function scaffoldCompleteMessage() {
|
|
1545
1628
|
return import_logger3.logger.box(
|
|
1546
|
-
|
|
1629
|
+
import_outdent26.outdent`
|
|
1547
1630
|
|
|
1548
1631
|
${import_logger3.colors.bold().cyan("Next steps:")}
|
|
1549
1632
|
|
|
@@ -1559,12 +1642,12 @@ function scaffoldCompleteMessage() {
|
|
|
1559
1642
|
);
|
|
1560
1643
|
}
|
|
1561
1644
|
function watchMessage() {
|
|
1562
|
-
return
|
|
1645
|
+
return import_outdent26.outdent`
|
|
1563
1646
|
Watching for file changes...
|
|
1564
1647
|
`;
|
|
1565
1648
|
}
|
|
1566
1649
|
function buildCompleteMessage(ctx) {
|
|
1567
|
-
return
|
|
1650
|
+
return import_outdent26.outdent`
|
|
1568
1651
|
Successfully extracted css from ${ctx.files.length} file(s) ✨
|
|
1569
1652
|
`;
|
|
1570
1653
|
}
|
|
@@ -1599,7 +1682,7 @@ function getBaseCss(ctx) {
|
|
|
1599
1682
|
var import_core4 = require("@pandacss/core");
|
|
1600
1683
|
var import_error = require("@pandacss/error");
|
|
1601
1684
|
var import_logger5 = require("@pandacss/logger");
|
|
1602
|
-
var
|
|
1685
|
+
var import_shared15 = require("@pandacss/shared");
|
|
1603
1686
|
var import_fs4 = require("fs");
|
|
1604
1687
|
var import_fs_extra3 = require("fs-extra");
|
|
1605
1688
|
var import_path4 = require("path");
|
|
@@ -1613,7 +1696,7 @@ var import_core3 = require("@pandacss/core");
|
|
|
1613
1696
|
var import_is_valid_prop2 = require("@pandacss/is-valid-prop");
|
|
1614
1697
|
var import_logger4 = require("@pandacss/logger");
|
|
1615
1698
|
var import_parser = require("@pandacss/parser");
|
|
1616
|
-
var
|
|
1699
|
+
var import_shared14 = require("@pandacss/shared");
|
|
1617
1700
|
var import_token_dictionary = require("@pandacss/token-dictionary");
|
|
1618
1701
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
1619
1702
|
var import_fs3 = require("fs");
|
|
@@ -1624,7 +1707,7 @@ var import_postcss = __toESM(require("postcss"));
|
|
|
1624
1707
|
var import_ts_morph = require("ts-morph");
|
|
1625
1708
|
var import_ts_pattern6 = require("ts-pattern");
|
|
1626
1709
|
var helpers = {
|
|
1627
|
-
map:
|
|
1710
|
+
map: import_shared14.mapObject
|
|
1628
1711
|
};
|
|
1629
1712
|
var fileSystem = {
|
|
1630
1713
|
read: (path) => {
|
|
@@ -1697,7 +1780,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1697
1780
|
import_logger4.logger.debug({ type: "ctx:conditions", msg: conditions });
|
|
1698
1781
|
(0, import_core3.assignCompositions)(
|
|
1699
1782
|
{ conditions, utility },
|
|
1700
|
-
(0,
|
|
1783
|
+
(0, import_shared14.compact)({
|
|
1701
1784
|
textStyle: textStyles,
|
|
1702
1785
|
layerStyle: layerStyles
|
|
1703
1786
|
})
|
|
@@ -1718,12 +1801,12 @@ function createContext(conf, io = fileSystem) {
|
|
|
1718
1801
|
}
|
|
1719
1802
|
const patternNodes = Object.entries(patterns).map(([name, pattern]) => ({
|
|
1720
1803
|
type: "pattern",
|
|
1721
|
-
name: pattern.jsx ?? (0,
|
|
1804
|
+
name: pattern.jsx ?? (0, import_shared14.capitalize)(name),
|
|
1722
1805
|
props: Object.keys(pattern.properties),
|
|
1723
1806
|
baseName: name
|
|
1724
1807
|
}));
|
|
1725
1808
|
function getPatternFnName(jsx) {
|
|
1726
|
-
return patternNodes.find((node) => node.name === jsx)?.baseName ?? (0,
|
|
1809
|
+
return patternNodes.find((node) => node.name === jsx)?.baseName ?? (0, import_shared14.uncapitalize)(jsx);
|
|
1727
1810
|
}
|
|
1728
1811
|
const hasPatterns = Object.keys(patterns).length > 0;
|
|
1729
1812
|
function getRecipe(name) {
|
|
@@ -1731,12 +1814,12 @@ function createContext(conf, io = fileSystem) {
|
|
|
1731
1814
|
}
|
|
1732
1815
|
const recipeNodes = Object.entries(recipes).map(([name, recipe]) => ({
|
|
1733
1816
|
type: "recipe",
|
|
1734
|
-
name: recipe.jsx ?? (0,
|
|
1817
|
+
name: recipe.jsx ?? (0, import_shared14.capitalize)(name),
|
|
1735
1818
|
props: Object.keys(recipe.variants ?? {}),
|
|
1736
1819
|
baseName: name
|
|
1737
1820
|
}));
|
|
1738
1821
|
function getRecipeFnName(jsx) {
|
|
1739
|
-
return recipeNodes.find((node) => node.name === jsx)?.baseName ?? (0,
|
|
1822
|
+
return recipeNodes.find((node) => node.name === jsx)?.baseName ?? (0, import_shared14.uncapitalize)(jsx);
|
|
1740
1823
|
}
|
|
1741
1824
|
function splitRecipeProps(name, props) {
|
|
1742
1825
|
const recipe = recipeNodes.find((node) => node.name === name);
|
|
@@ -1752,7 +1835,7 @@ function createContext(conf, io = fileSystem) {
|
|
|
1752
1835
|
}));
|
|
1753
1836
|
}
|
|
1754
1837
|
const hasRecipes = Object.keys(recipes).length > 0;
|
|
1755
|
-
const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
|
|
1838
|
+
const properties = Array.from(/* @__PURE__ */ new Set(["css", "sx", ...utility.keys(), ...conditions.keys()]));
|
|
1756
1839
|
function isCustomCssProperty(prop) {
|
|
1757
1840
|
const regex = new RegExp("^(?:" + properties.join("|") + ")$");
|
|
1758
1841
|
return regex.test(prop);
|
|
@@ -2088,7 +2171,7 @@ function getConfigHash() {
|
|
|
2088
2171
|
if (!file) {
|
|
2089
2172
|
throw new import_error.ConfigNotFoundError();
|
|
2090
2173
|
}
|
|
2091
|
-
return (0,
|
|
2174
|
+
return (0, import_shared15.toHash)((0, import_fs4.readFileSync)(file, "utf-8"));
|
|
2092
2175
|
}
|
|
2093
2176
|
var setupCount = 0;
|
|
2094
2177
|
var Builder = class {
|
|
@@ -2298,9 +2381,9 @@ async function generate5(config, configPath) {
|
|
|
2298
2381
|
// src/git-ignore.ts
|
|
2299
2382
|
var import_fs5 = require("fs");
|
|
2300
2383
|
var import_look_it_up2 = require("look-it-up");
|
|
2301
|
-
var
|
|
2384
|
+
var import_outdent27 = __toESM(require("outdent"));
|
|
2302
2385
|
function setupGitIgnore(ctx) {
|
|
2303
|
-
const txt =
|
|
2386
|
+
const txt = import_outdent27.default`## CSS Panda
|
|
2304
2387
|
${ctx.outdir}
|
|
2305
2388
|
${ctx.outdir}-static
|
|
2306
2389
|
`;
|
|
@@ -2318,7 +2401,7 @@ function setupGitIgnore(ctx) {
|
|
|
2318
2401
|
var import_logger9 = require("@pandacss/logger");
|
|
2319
2402
|
var import_fs_extra4 = require("fs-extra");
|
|
2320
2403
|
var import_look_it_up3 = require("look-it-up");
|
|
2321
|
-
var
|
|
2404
|
+
var import_outdent28 = require("outdent");
|
|
2322
2405
|
var import_path6 = require("path");
|
|
2323
2406
|
var import_preferred_pm2 = __toESM(require("preferred-pm"));
|
|
2324
2407
|
async function setupConfig(cwd, { force }) {
|
|
@@ -2332,7 +2415,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
2332
2415
|
if (!force && configFile) {
|
|
2333
2416
|
import_logger9.logger.warn("config exists", configExistsMessage(cmd));
|
|
2334
2417
|
} else {
|
|
2335
|
-
const content =
|
|
2418
|
+
const content = import_outdent28.outdent`
|
|
2336
2419
|
import { defineConfig } from "css-panda"
|
|
2337
2420
|
|
|
2338
2421
|
export default defineConfig({
|
|
@@ -2358,7 +2441,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
2358
2441
|
}
|
|
2359
2442
|
async function setupPostcss(cwd) {
|
|
2360
2443
|
import_logger9.logger.info({ type: "init", msg: `creating postcss config file: ${(0, import_logger9.quote)("postcss.config.cjs")}` });
|
|
2361
|
-
const content =
|
|
2444
|
+
const content = import_outdent28.outdent`
|
|
2362
2445
|
module.exports = {
|
|
2363
2446
|
plugins: {
|
|
2364
2447
|
'css-panda/postcss': {},
|