@pandacss/node 0.0.0-dev-20221124070053 → 0.0.0-dev-20221124124535
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 +271 -71
- package/dist/index.mjs +270 -70
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ async function writeFileChunk(ctx, file) {
|
|
|
115
115
|
// src/generators/index.ts
|
|
116
116
|
var import_fs2 = require("fs");
|
|
117
117
|
var import_look_it_up = require("look-it-up");
|
|
118
|
-
var
|
|
118
|
+
var import_outdent22 = __toESM(require("outdent"));
|
|
119
119
|
var import_path2 = require("path");
|
|
120
120
|
|
|
121
121
|
// src/generators/conditions.ts
|
|
@@ -377,27 +377,90 @@ function generatePreactJsxFactory(ctx) {
|
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
// src/generators/jsx/preact-layout-grid.ts
|
|
381
|
+
var import_outdent7 = require("outdent");
|
|
382
|
+
function generatePreactLayoutGrid() {
|
|
383
|
+
return {
|
|
384
|
+
dts: import_outdent7.outdent`
|
|
385
|
+
import { FunctionComponent } from 'preact'
|
|
386
|
+
|
|
387
|
+
export type LayoutGridProps = {
|
|
388
|
+
count?: number
|
|
389
|
+
gutter?: string
|
|
390
|
+
maxWidth?: string
|
|
391
|
+
margin?: string
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
395
|
+
`,
|
|
396
|
+
js: import_outdent7.outdent`
|
|
397
|
+
export function LayoutGrid(props) {
|
|
398
|
+
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
399
|
+
const hasMaxWidth = maxWidth != null;
|
|
400
|
+
return (
|
|
401
|
+
<div
|
|
402
|
+
style={{
|
|
403
|
+
display: 'grid',
|
|
404
|
+
gap: gutter,
|
|
405
|
+
gridTemplateColumns: \`repeat(\${count}, 1fr)\`,
|
|
406
|
+
height: '100%',
|
|
407
|
+
width: '100%',
|
|
408
|
+
position: 'absolute',
|
|
409
|
+
inset: '0',
|
|
410
|
+
pointerEvents: 'none',
|
|
411
|
+
maxWidth: hasMaxWidth ? maxWidth : 'initial',
|
|
412
|
+
marginInline: hasMaxWidth ? 'auto' : undefined,
|
|
413
|
+
paddingInline: !hasMaxWidth ? margin : undefined,
|
|
414
|
+
}}
|
|
415
|
+
>
|
|
416
|
+
{Array.from({ length: count }).map((_, i) => (
|
|
417
|
+
<span
|
|
418
|
+
key={i}
|
|
419
|
+
style={{
|
|
420
|
+
display: 'flex',
|
|
421
|
+
background: 'rgba(255, 0, 0, 0.1)',
|
|
422
|
+
height: '100%',
|
|
423
|
+
}}
|
|
424
|
+
/>
|
|
425
|
+
))}
|
|
426
|
+
</div>
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
`
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
|
|
380
433
|
// src/generators/jsx/preact-pattern.ts
|
|
381
434
|
var import_shared3 = require("@pandacss/shared");
|
|
382
|
-
var
|
|
435
|
+
var import_outdent8 = require("outdent");
|
|
436
|
+
var import_ts_pattern = require("ts-pattern");
|
|
383
437
|
function generate(name, pattern, jsxFactory) {
|
|
384
438
|
const upperName = (0, import_shared3.capitalize)(name);
|
|
385
439
|
const jsxName = pattern.jsx ?? upperName;
|
|
386
440
|
const keys = Object.keys(pattern.properties ?? {});
|
|
387
441
|
return {
|
|
388
442
|
name: (0, import_shared3.dashCase)(name),
|
|
389
|
-
js:
|
|
443
|
+
js: import_outdent8.outdent`
|
|
390
444
|
import { forwardRef } from 'preact/compat'
|
|
391
445
|
import { ${jsxFactory} } from './factory'
|
|
392
446
|
import { config } from '../patterns/${(0, import_shared3.dashCase)(name)}'
|
|
393
447
|
|
|
394
448
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
449
|
+
${(0, import_ts_pattern.match)(keys.length).with(
|
|
450
|
+
0,
|
|
451
|
+
() => `
|
|
452
|
+
return <${jsxFactory}.div ref={ref} {...props} />
|
|
453
|
+
`
|
|
454
|
+
).otherwise(
|
|
455
|
+
() => `
|
|
456
|
+
const { ${keys.join(", ")}, ...restProps } = props
|
|
457
|
+
const styleProps = config.transform({${keys.join(", ")}})
|
|
458
|
+
return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
|
|
459
|
+
`
|
|
460
|
+
)}
|
|
398
461
|
})
|
|
399
462
|
`,
|
|
400
|
-
dts:
|
|
463
|
+
dts: import_outdent8.outdent`
|
|
401
464
|
import { ComponentProps, JSX, ComponentChildren } from 'preact';
|
|
402
465
|
import { ${upperName}Options } from '../patterns/${(0, import_shared3.dashCase)(name)}'
|
|
403
466
|
import { JSXStyleProperties, Assign } from '../types'
|
|
@@ -410,7 +473,7 @@ function generate(name, pattern, jsxFactory) {
|
|
|
410
473
|
type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties &
|
|
411
474
|
Assign<Omit<PropsOf<C>, 'color'>, P & { as?: C }>
|
|
412
475
|
|
|
413
|
-
type ${jsxName}Props<C extends ElementType> = Polymorphic<C, ${upperName}Options>
|
|
476
|
+
type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Options>
|
|
414
477
|
|
|
415
478
|
export declare function ${jsxName}<V extends ElementType>(props: ${jsxName}Props<V>): JSX.Element
|
|
416
479
|
`
|
|
@@ -424,12 +487,12 @@ function generatePreactJsxPattern(ctx) {
|
|
|
424
487
|
|
|
425
488
|
// src/generators/jsx/react-jsx.ts
|
|
426
489
|
var import_shared4 = require("@pandacss/shared");
|
|
427
|
-
var
|
|
490
|
+
var import_outdent9 = require("outdent");
|
|
428
491
|
function generateReactJsxFactory(ctx) {
|
|
429
492
|
const name = ctx.jsxFactory;
|
|
430
493
|
const upperName = (0, import_shared4.capitalize)(name);
|
|
431
494
|
return {
|
|
432
|
-
dts:
|
|
495
|
+
dts: import_outdent9.outdent`
|
|
433
496
|
import type { ComponentProps } from "react"
|
|
434
497
|
import type { JSXStyleProperties } from "../types"
|
|
435
498
|
|
|
@@ -443,7 +506,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
443
506
|
|
|
444
507
|
export declare const ${name}: JSXFactory
|
|
445
508
|
`,
|
|
446
|
-
js:
|
|
509
|
+
js: import_outdent9.outdent`
|
|
447
510
|
import { forwardRef } from 'react'
|
|
448
511
|
import { isCssProperty } from './is-valid-prop'
|
|
449
512
|
import { css } from '../css'
|
|
@@ -504,27 +567,91 @@ function generateReactJsxFactory(ctx) {
|
|
|
504
567
|
};
|
|
505
568
|
}
|
|
506
569
|
|
|
570
|
+
// src/generators/jsx/react-layout-grid.ts
|
|
571
|
+
var import_outdent10 = require("outdent");
|
|
572
|
+
function generateReactLayoutGrid() {
|
|
573
|
+
return {
|
|
574
|
+
dts: import_outdent10.outdent`
|
|
575
|
+
import type { FunctionComponent } from 'react'
|
|
576
|
+
|
|
577
|
+
export type LayoutGridProps = {
|
|
578
|
+
count?: number
|
|
579
|
+
gutter?: string
|
|
580
|
+
maxWidth?: string
|
|
581
|
+
margin?: string
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
585
|
+
`,
|
|
586
|
+
js: import_outdent10.outdent`
|
|
587
|
+
export function LayoutGrid(props) {
|
|
588
|
+
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
589
|
+
const hasMaxWidth = maxWidth != null;
|
|
590
|
+
return (
|
|
591
|
+
<div
|
|
592
|
+
style={{
|
|
593
|
+
display: 'grid',
|
|
594
|
+
gap: gutter,
|
|
595
|
+
gridTemplateColumns: \`repeat(\${count}, 1fr)\`,
|
|
596
|
+
height: '100%',
|
|
597
|
+
width: '100%',
|
|
598
|
+
position: 'absolute',
|
|
599
|
+
inset: '0',
|
|
600
|
+
pointerEvents: 'none',
|
|
601
|
+
maxWidth: hasMaxWidth ? maxWidth : 'initial',
|
|
602
|
+
marginInline: hasMaxWidth ? 'auto' : undefined,
|
|
603
|
+
paddingInline: !hasMaxWidth ? margin : undefined,
|
|
604
|
+
}}
|
|
605
|
+
>
|
|
606
|
+
{Array.from({ length: count }).map((_, i) => (
|
|
607
|
+
<span
|
|
608
|
+
key={i}
|
|
609
|
+
style={{
|
|
610
|
+
display: 'flex',
|
|
611
|
+
background: 'rgba(255, 0, 0, 0.1)',
|
|
612
|
+
height: '100%',
|
|
613
|
+
}}
|
|
614
|
+
/>
|
|
615
|
+
))}
|
|
616
|
+
</div>
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
`
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
|
|
507
623
|
// src/generators/jsx/react-pattern.ts
|
|
508
624
|
var import_shared5 = require("@pandacss/shared");
|
|
509
|
-
var
|
|
625
|
+
var import_outdent11 = require("outdent");
|
|
626
|
+
var import_ts_pattern2 = require("ts-pattern");
|
|
510
627
|
function generate2(name, pattern, jsxFactory) {
|
|
511
628
|
const upperName = (0, import_shared5.capitalize)(name);
|
|
512
629
|
const jsxName = pattern.jsx ?? upperName;
|
|
513
630
|
const keys = Object.keys(pattern.properties ?? {});
|
|
514
631
|
return {
|
|
515
632
|
name: (0, import_shared5.dashCase)(name),
|
|
516
|
-
js:
|
|
633
|
+
js: import_outdent11.outdent`
|
|
517
634
|
import { forwardRef } from 'react'
|
|
518
635
|
import { ${jsxFactory} } from './factory'
|
|
519
636
|
import { config } from '../patterns/${(0, import_shared5.dashCase)(name)}'
|
|
520
637
|
|
|
521
638
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
639
|
+
${(0, import_ts_pattern2.match)(keys.length).with(
|
|
640
|
+
0,
|
|
641
|
+
() => `
|
|
642
|
+
return <${jsxFactory}.div ref={ref} {...props} />
|
|
643
|
+
`
|
|
644
|
+
).otherwise(
|
|
645
|
+
() => `
|
|
646
|
+
const { ${keys.join(", ")}, ...restProps } = props
|
|
647
|
+
const styleProps = config.transform({${keys.join(", ")}})
|
|
648
|
+
return <${jsxFactory}.div ref={ref} {...styleProps} {...restProps} />
|
|
649
|
+
`
|
|
650
|
+
)}
|
|
651
|
+
|
|
525
652
|
})
|
|
526
653
|
`,
|
|
527
|
-
dts:
|
|
654
|
+
dts: import_outdent11.outdent`
|
|
528
655
|
import { ComponentProps, ElementType, PropsWithChildren } from 'react'
|
|
529
656
|
import { ${upperName}Options } from '../patterns/${(0, import_shared5.dashCase)(name)}'
|
|
530
657
|
import { JSXStyleProperties, Assign } from '../types'
|
|
@@ -534,7 +661,7 @@ function generate2(name, pattern, jsxFactory) {
|
|
|
534
661
|
type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties &
|
|
535
662
|
Assign<Omit<PropsOf<C>, 'color'>, P & { as?: C }>
|
|
536
663
|
|
|
537
|
-
export type ${jsxName}Props<C extends ElementType> = Polymorphic<C, ${upperName}Options>
|
|
664
|
+
export type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Options>
|
|
538
665
|
|
|
539
666
|
export declare function ${jsxName}<V extends ElementType>(props: ${jsxName}Props<V>): JSX.Element
|
|
540
667
|
`
|
|
@@ -548,12 +675,12 @@ function generateReactJsxPattern(ctx) {
|
|
|
548
675
|
|
|
549
676
|
// src/generators/jsx/solid-jsx.ts
|
|
550
677
|
var import_shared6 = require("@pandacss/shared");
|
|
551
|
-
var
|
|
678
|
+
var import_outdent12 = require("outdent");
|
|
552
679
|
function generateSolidJsxFactory(ctx) {
|
|
553
680
|
const name = ctx.jsxFactory;
|
|
554
681
|
const upperName = (0, import_shared6.capitalize)(name);
|
|
555
682
|
return {
|
|
556
|
-
dts:
|
|
683
|
+
dts: import_outdent12.outdent`
|
|
557
684
|
import type { JSX } from 'solid-js'
|
|
558
685
|
import type { JSXStyleProperties, Assign} from '../types'
|
|
559
686
|
|
|
@@ -567,7 +694,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
567
694
|
|
|
568
695
|
export declare const ${name}: JSXFactory
|
|
569
696
|
`,
|
|
570
|
-
js:
|
|
697
|
+
js: import_outdent12.outdent`
|
|
571
698
|
import { Dynamic } from 'solid-js/web';
|
|
572
699
|
import { mergeProps, splitProps } from 'solid-js';
|
|
573
700
|
import { allCssProperties } from './is-valid-prop'
|
|
@@ -615,27 +742,88 @@ function generateSolidJsxFactory(ctx) {
|
|
|
615
742
|
};
|
|
616
743
|
}
|
|
617
744
|
|
|
745
|
+
// src/generators/jsx/solid-layout-grid.ts
|
|
746
|
+
var import_outdent13 = require("outdent");
|
|
747
|
+
function generateSolidLayoutGrid() {
|
|
748
|
+
return {
|
|
749
|
+
dts: import_outdent13.outdent`
|
|
750
|
+
export type LayoutGridProps = {
|
|
751
|
+
count?: number
|
|
752
|
+
gutter?: string
|
|
753
|
+
maxWidth?: string
|
|
754
|
+
margin?: string
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
export declare const LayoutGrid: React.FC<LayoutGridProps>
|
|
758
|
+
`,
|
|
759
|
+
js: import_outdent13.outdent`
|
|
760
|
+
export function LayoutGrid(props) {
|
|
761
|
+
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
762
|
+
const hasMaxWidth = maxWidth != null;
|
|
763
|
+
return (
|
|
764
|
+
<div
|
|
765
|
+
style={{
|
|
766
|
+
display: 'grid',
|
|
767
|
+
gap: gutter,
|
|
768
|
+
'grid-template-columns': \`repeat(\${count}, 1fr)\`,
|
|
769
|
+
height: '100%',
|
|
770
|
+
width: '100%',
|
|
771
|
+
position: 'absolute',
|
|
772
|
+
inset: '0',
|
|
773
|
+
'pointer-events': 'none',
|
|
774
|
+
'max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
775
|
+
'margin-inline': hasMaxWidth ? 'auto' : undefined,
|
|
776
|
+
'padding-inline': !hasMaxWidth ? margin : undefined,
|
|
777
|
+
}}
|
|
778
|
+
>
|
|
779
|
+
{Array.from({ length: count }).map((_, i) => (
|
|
780
|
+
<span
|
|
781
|
+
key={i}
|
|
782
|
+
style={{
|
|
783
|
+
display: 'flex',
|
|
784
|
+
background: 'rgba(255, 0, 0, 0.1)',
|
|
785
|
+
height: '100%',
|
|
786
|
+
}}
|
|
787
|
+
/>
|
|
788
|
+
))}
|
|
789
|
+
</div>
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
`
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
|
|
618
796
|
// src/generators/jsx/solid-pattern.ts
|
|
619
797
|
var import_shared7 = require("@pandacss/shared");
|
|
620
|
-
var
|
|
798
|
+
var import_outdent14 = require("outdent");
|
|
799
|
+
var import_ts_pattern3 = require("ts-pattern");
|
|
621
800
|
function generate3(name, pattern, jsxFactory) {
|
|
622
801
|
const upperName = (0, import_shared7.capitalize)(name);
|
|
623
802
|
const jsxName = pattern.jsx ?? upperName;
|
|
624
803
|
const keys = Object.keys(pattern.properties ?? {});
|
|
625
804
|
return {
|
|
626
805
|
name: (0, import_shared7.dashCase)(name),
|
|
627
|
-
js:
|
|
806
|
+
js: import_outdent14.outdent`
|
|
628
807
|
import { splitProps } from 'solid-js'
|
|
629
808
|
import { ${jsxFactory} } from './factory'
|
|
630
809
|
import { config } from '../patterns/${(0, import_shared7.dashCase)(name)}'
|
|
631
810
|
|
|
632
811
|
export function ${jsxName}(props) {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
812
|
+
${(0, import_ts_pattern3.match)(keys.length).with(
|
|
813
|
+
0,
|
|
814
|
+
() => `
|
|
815
|
+
return <${jsxFactory}.div {...props} />
|
|
816
|
+
`
|
|
817
|
+
).otherwise(
|
|
818
|
+
() => `
|
|
819
|
+
const [patternProps, restProps] = splitProps(props, [${keys.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
820
|
+
const styleProps = config.transform(patternProps)
|
|
821
|
+
return <${jsxFactory}.div {...styleProps} {...restProps} />
|
|
822
|
+
`
|
|
823
|
+
)}
|
|
636
824
|
}
|
|
637
825
|
`,
|
|
638
|
-
dts:
|
|
826
|
+
dts: import_outdent14.outdent`
|
|
639
827
|
import { ComponentProps, JSX } from 'solid-js'
|
|
640
828
|
import { ${upperName}Options } from '../patterns/${(0, import_shared7.dashCase)(name)}'
|
|
641
829
|
import { Assign, JSXStyleProperties } from '../types'
|
|
@@ -646,7 +834,7 @@ function generate3(name, pattern, jsxFactory) {
|
|
|
646
834
|
type Polymorphic<C extends ElementType = 'div', P = {}> = JSXStyleProperties &
|
|
647
835
|
Assign<Omit<PropsOf<C>, 'color'>, P & { as?: C }>
|
|
648
836
|
|
|
649
|
-
export type ${jsxName}Props<C extends ElementType> = Polymorphic<C, ${upperName}Options>
|
|
837
|
+
export type ${jsxName}Props<C extends ElementType = 'div'> = Polymorphic<C, ${upperName}Options>
|
|
650
838
|
|
|
651
839
|
export declare function ${jsxName}<V extends ElementType>(props: ${jsxName}Props<V>): JSX.Element
|
|
652
840
|
`
|
|
@@ -675,17 +863,25 @@ var patternMap = {
|
|
|
675
863
|
function generateJsxPatterns(ctx) {
|
|
676
864
|
return patternMap[ctx.jsxFramework](ctx);
|
|
677
865
|
}
|
|
866
|
+
var layoutGridMap = {
|
|
867
|
+
react: generateReactLayoutGrid,
|
|
868
|
+
preact: generatePreactLayoutGrid,
|
|
869
|
+
solid: generateSolidLayoutGrid
|
|
870
|
+
};
|
|
871
|
+
function generateLayoutGrid(ctx) {
|
|
872
|
+
return layoutGridMap[ctx.jsxFramework]();
|
|
873
|
+
}
|
|
678
874
|
|
|
679
875
|
// src/generators/pattern.ts
|
|
680
876
|
var import_shared8 = require("@pandacss/shared");
|
|
681
|
-
var
|
|
877
|
+
var import_outdent15 = require("outdent");
|
|
682
878
|
var import_telejson = require("telejson");
|
|
683
|
-
var
|
|
879
|
+
var import_ts_pattern4 = require("ts-pattern");
|
|
684
880
|
function generate4(name, pattern) {
|
|
685
881
|
const { properties, transform, strict } = pattern;
|
|
686
882
|
return {
|
|
687
883
|
name: (0, import_shared8.dashCase)(name),
|
|
688
|
-
dts:
|
|
884
|
+
dts: import_outdent15.outdent`
|
|
689
885
|
import { SystemStyleObject, ConditionalValue } from "../types"
|
|
690
886
|
import { Properties } from "../types/csstype"
|
|
691
887
|
import { Tokens } from "../types/token"
|
|
@@ -693,7 +889,7 @@ function generate4(name, pattern) {
|
|
|
693
889
|
export type ${(0, import_shared8.capitalize)(name)}Options = {
|
|
694
890
|
${Object.keys(properties ?? {}).map((key) => {
|
|
695
891
|
const value = properties[key];
|
|
696
|
-
return (0,
|
|
892
|
+
return (0, import_ts_pattern4.match)(value).with({ type: "property" }, (value2) => {
|
|
697
893
|
return `${key}?: SystemStyleObject["${value2.value}"]`;
|
|
698
894
|
}).with({ type: "token" }, (value2) => {
|
|
699
895
|
if (value2.property) {
|
|
@@ -708,13 +904,13 @@ function generate4(name, pattern) {
|
|
|
708
904
|
}).join("\n ")}
|
|
709
905
|
}
|
|
710
906
|
|
|
711
|
-
${strict ?
|
|
907
|
+
${strict ? import_outdent15.outdent`export declare function ${name}(options: ${(0, import_shared8.capitalize)(name)}Options): string` : import_outdent15.outdent`
|
|
712
908
|
type Merge<T> = Omit<SystemStyleObject, keyof T> & T
|
|
713
909
|
export declare function ${name}(options: Merge<${(0, import_shared8.capitalize)(name)}Options>): string
|
|
714
910
|
`}
|
|
715
911
|
|
|
716
912
|
`,
|
|
717
|
-
js:
|
|
913
|
+
js: import_outdent15.outdent`
|
|
718
914
|
import { mapObject } from "../helpers"
|
|
719
915
|
import { css } from "../css"
|
|
720
916
|
|
|
@@ -731,10 +927,10 @@ function generatePattern(ctx) {
|
|
|
731
927
|
}
|
|
732
928
|
|
|
733
929
|
// src/generators/prop-types.ts
|
|
734
|
-
var
|
|
930
|
+
var import_outdent16 = require("outdent");
|
|
735
931
|
function generatePropTypes(utility) {
|
|
736
932
|
const result = [
|
|
737
|
-
|
|
933
|
+
import_outdent16.outdent`
|
|
738
934
|
import { Properties as CSSProperties } from "./csstype"
|
|
739
935
|
|
|
740
936
|
type BasePropTypes = {`
|
|
@@ -762,14 +958,14 @@ function generatePropTypes(utility) {
|
|
|
762
958
|
|
|
763
959
|
// src/generators/recipe.ts
|
|
764
960
|
var import_shared9 = require("@pandacss/shared");
|
|
765
|
-
var
|
|
961
|
+
var import_outdent17 = require("outdent");
|
|
766
962
|
function generateRecipes(ctx) {
|
|
767
963
|
const { recipes = {}, hash, hasRecipes, utility } = ctx;
|
|
768
964
|
const { separator } = utility;
|
|
769
965
|
if (!hasRecipes)
|
|
770
966
|
return;
|
|
771
967
|
const js = [
|
|
772
|
-
|
|
968
|
+
import_outdent17.outdent`
|
|
773
969
|
import { createCss, withoutSpace } from "../helpers"
|
|
774
970
|
|
|
775
971
|
const createRecipe = (name) => {
|
|
@@ -793,10 +989,10 @@ function generateRecipes(ctx) {
|
|
|
793
989
|
];
|
|
794
990
|
const dts = [""];
|
|
795
991
|
Object.values(recipes).forEach((recipe) => {
|
|
796
|
-
js.push(
|
|
992
|
+
js.push(import_outdent17.outdent`
|
|
797
993
|
export const ${recipe.name} = createRecipe('${recipe.name}')
|
|
798
994
|
`);
|
|
799
|
-
dts.push(
|
|
995
|
+
dts.push(import_outdent17.outdent`
|
|
800
996
|
import { ConditionalValue } from "../types"
|
|
801
997
|
|
|
802
998
|
export type ${(0, import_shared9.capitalize)(recipe.name)}Value = {
|
|
@@ -811,8 +1007,8 @@ function generateRecipes(ctx) {
|
|
|
811
1007
|
`);
|
|
812
1008
|
});
|
|
813
1009
|
return {
|
|
814
|
-
js:
|
|
815
|
-
dts:
|
|
1010
|
+
js: import_outdent17.outdent.string(js.join("\n\n")),
|
|
1011
|
+
dts: import_outdent17.outdent.string(dts.join("\n\n"))
|
|
816
1012
|
};
|
|
817
1013
|
}
|
|
818
1014
|
|
|
@@ -919,14 +1115,14 @@ function generateReset() {
|
|
|
919
1115
|
|
|
920
1116
|
// src/generators/token-css.ts
|
|
921
1117
|
var import_core2 = require("@pandacss/core");
|
|
922
|
-
var
|
|
923
|
-
var
|
|
1118
|
+
var import_outdent18 = require("outdent");
|
|
1119
|
+
var import_ts_pattern5 = require("ts-pattern");
|
|
924
1120
|
function generateKeyframes(keyframes) {
|
|
925
1121
|
if (keyframes) {
|
|
926
1122
|
return (0, import_core2.toKeyframeCss)(keyframes);
|
|
927
1123
|
}
|
|
928
1124
|
}
|
|
929
|
-
var getConditionMessage = (value) =>
|
|
1125
|
+
var getConditionMessage = (value) => import_outdent18.outdent`
|
|
930
1126
|
It seems you provided an invalid condition for semantic tokens.
|
|
931
1127
|
|
|
932
1128
|
- You provided: \`${value}\`
|
|
@@ -947,7 +1143,7 @@ function generateTokenCss(ctx, varRoot) {
|
|
|
947
1143
|
results.push(css3);
|
|
948
1144
|
} else {
|
|
949
1145
|
const cond = conditions.normalize(key);
|
|
950
|
-
const css3 = (0,
|
|
1146
|
+
const css3 = (0, import_ts_pattern5.match)(cond).with({ type: "parent-nesting" }, (cond2) => {
|
|
951
1147
|
const selector = cond2.value.replace(/\s&/g, "");
|
|
952
1148
|
const { css: css4 } = (0, import_core2.toCss)(varsObj);
|
|
953
1149
|
return `${selector} {
|
|
@@ -961,7 +1157,7 @@ function generateTokenCss(ctx, varRoot) {
|
|
|
961
1157
|
${css4};
|
|
962
1158
|
}
|
|
963
1159
|
}`;
|
|
964
|
-
}).with(
|
|
1160
|
+
}).with(import_ts_pattern5.P.nullish, () => {
|
|
965
1161
|
}).otherwise((cond2) => {
|
|
966
1162
|
if (cond2) {
|
|
967
1163
|
throw new Error(getConditionMessage(cond2.raw));
|
|
@@ -981,7 +1177,7 @@ function generateTokenCss(ctx, varRoot) {
|
|
|
981
1177
|
|
|
982
1178
|
// src/generators/token-dts.ts
|
|
983
1179
|
var import_shared10 = require("@pandacss/shared");
|
|
984
|
-
var
|
|
1180
|
+
var import_outdent19 = require("outdent");
|
|
985
1181
|
var import_pluralize = require("pluralize");
|
|
986
1182
|
function generateTokenDts(dict) {
|
|
987
1183
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -999,11 +1195,11 @@ function generateTokenDts(dict) {
|
|
|
999
1195
|
}
|
|
1000
1196
|
interfaceSet.add("}");
|
|
1001
1197
|
set.add(Array.from(interfaceSet).join("\n"));
|
|
1002
|
-
return
|
|
1198
|
+
return import_outdent19.outdent.string(Array.from(set).join("\n\n"));
|
|
1003
1199
|
}
|
|
1004
1200
|
|
|
1005
1201
|
// src/generators/token-js.ts
|
|
1006
|
-
var
|
|
1202
|
+
var import_outdent20 = __toESM(require("outdent"));
|
|
1007
1203
|
function generateTokenJs(dict) {
|
|
1008
1204
|
const map = /* @__PURE__ */ new Map();
|
|
1009
1205
|
dict.allTokens.forEach((token) => {
|
|
@@ -1013,7 +1209,7 @@ function generateTokenJs(dict) {
|
|
|
1013
1209
|
});
|
|
1014
1210
|
const obj = Object.fromEntries(map);
|
|
1015
1211
|
return {
|
|
1016
|
-
js:
|
|
1212
|
+
js: import_outdent20.default`
|
|
1017
1213
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1018
1214
|
|
|
1019
1215
|
function getToken(path) {
|
|
@@ -1026,7 +1222,7 @@ function generateTokenJs(dict) {
|
|
|
1026
1222
|
return variable
|
|
1027
1223
|
}
|
|
1028
1224
|
`,
|
|
1029
|
-
dts:
|
|
1225
|
+
dts: import_outdent20.default`
|
|
1030
1226
|
import { Token } from "../types/token"
|
|
1031
1227
|
export declare function getToken(path: Token): string
|
|
1032
1228
|
export declare function getTokenVar(path: Token): string
|
|
@@ -1036,7 +1232,7 @@ function generateTokenJs(dict) {
|
|
|
1036
1232
|
|
|
1037
1233
|
// src/generators/types.ts
|
|
1038
1234
|
var import_fs_extra = require("fs-extra");
|
|
1039
|
-
var
|
|
1235
|
+
var import_outdent21 = __toESM(require("outdent"));
|
|
1040
1236
|
function getType(file) {
|
|
1041
1237
|
const filepath = getEntrypoint("@pandacss/types", { dev: file });
|
|
1042
1238
|
return (0, import_fs_extra.readFileSync)(filepath, "utf8");
|
|
@@ -1046,7 +1242,7 @@ function generateCssType(ctx) {
|
|
|
1046
1242
|
return {
|
|
1047
1243
|
cssType: getType("csstype.d.ts"),
|
|
1048
1244
|
pandaCssType: getType("system-types.d.ts"),
|
|
1049
|
-
publicType:
|
|
1245
|
+
publicType: import_outdent21.default`
|
|
1050
1246
|
import * as System from './system-types'
|
|
1051
1247
|
import { PropTypes } from './prop-type'
|
|
1052
1248
|
import { Conditions } from './conditions'
|
|
@@ -1167,7 +1363,7 @@ function setupPatterns(ctx) {
|
|
|
1167
1363
|
if (!files) {
|
|
1168
1364
|
return { files: [] };
|
|
1169
1365
|
}
|
|
1170
|
-
const indexCode =
|
|
1366
|
+
const indexCode = import_outdent22.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"));
|
|
1171
1367
|
return {
|
|
1172
1368
|
dir: ctx.paths.pattern,
|
|
1173
1369
|
files: [
|
|
@@ -1184,15 +1380,19 @@ function setupJsx(ctx) {
|
|
|
1184
1380
|
const isValidProp = generateisValidProp(ctx);
|
|
1185
1381
|
const factory = generateJsxFactory(ctx);
|
|
1186
1382
|
const patterns = generateJsxPatterns(ctx);
|
|
1187
|
-
const
|
|
1383
|
+
const layoutGrid = generateLayoutGrid(ctx);
|
|
1384
|
+
const indexCode = import_outdent22.default`
|
|
1188
1385
|
export * from './factory'
|
|
1189
|
-
|
|
1386
|
+
export * from './layout-grid'
|
|
1387
|
+
${import_outdent22.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
1190
1388
|
`;
|
|
1191
1389
|
return {
|
|
1192
1390
|
dir: ctx.paths.jsx,
|
|
1193
1391
|
files: [
|
|
1194
1392
|
...patterns.map((file) => ({ file: `${file.name}.jsx`, code: file.js })),
|
|
1195
1393
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
1394
|
+
{ file: "layout-grid.jsx", code: layoutGrid.js },
|
|
1395
|
+
{ file: "layout-grid.d.ts", code: layoutGrid.dts },
|
|
1196
1396
|
{ file: "is-valid-prop.js", code: isValidProp.js },
|
|
1197
1397
|
{ file: "factory.d.ts", code: factory.dts },
|
|
1198
1398
|
{ file: "factory.jsx", code: factory.js },
|
|
@@ -1202,7 +1402,7 @@ function setupJsx(ctx) {
|
|
|
1202
1402
|
};
|
|
1203
1403
|
}
|
|
1204
1404
|
function setupCssIndex(ctx) {
|
|
1205
|
-
const code =
|
|
1405
|
+
const code = import_outdent22.default`
|
|
1206
1406
|
export * from './css'
|
|
1207
1407
|
export * from './cx'
|
|
1208
1408
|
export * from './global-css'
|
|
@@ -1223,7 +1423,7 @@ function setupReset(ctx) {
|
|
|
1223
1423
|
return { files: [{ file: "reset.css", code }] };
|
|
1224
1424
|
}
|
|
1225
1425
|
function setupGitIgnore(ctx) {
|
|
1226
|
-
const txt =
|
|
1426
|
+
const txt = import_outdent22.default`## CSS Panda
|
|
1227
1427
|
${ctx.outdir}
|
|
1228
1428
|
`;
|
|
1229
1429
|
const file = (0, import_look_it_up.lookItUpSync)(".gitignore");
|
|
@@ -1262,30 +1462,30 @@ function generateSystem(ctx) {
|
|
|
1262
1462
|
|
|
1263
1463
|
// src/messages.ts
|
|
1264
1464
|
var import_logger3 = require("@pandacss/logger");
|
|
1265
|
-
var
|
|
1465
|
+
var import_outdent23 = require("outdent");
|
|
1266
1466
|
var tick = import_logger3.colors.green().bold("\u2714\uFE0F");
|
|
1267
1467
|
function artifactsGeneratedMessage(ctx) {
|
|
1268
1468
|
return [
|
|
1269
|
-
|
|
1469
|
+
import_outdent23.outdent`
|
|
1270
1470
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/css")}: the css function to author styles
|
|
1271
1471
|
`,
|
|
1272
|
-
ctx.hasTokens &&
|
|
1472
|
+
ctx.hasTokens && import_outdent23.outdent`
|
|
1273
1473
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
1274
1474
|
`,
|
|
1275
|
-
ctx.hasPattern &&
|
|
1475
|
+
ctx.hasPattern && import_outdent23.outdent`
|
|
1276
1476
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/patterns")}: functions to implement common css patterns
|
|
1277
1477
|
`,
|
|
1278
|
-
ctx.hasRecipes &&
|
|
1478
|
+
ctx.hasRecipes && import_outdent23.outdent`
|
|
1279
1479
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/recipes")}: functions to create multi-variant styles
|
|
1280
1480
|
`,
|
|
1281
|
-
ctx.jsxFramework &&
|
|
1481
|
+
ctx.jsxFramework && import_outdent23.outdent`
|
|
1282
1482
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/jsx")}: style prop powered elements for ${ctx.jsxFramework}
|
|
1283
1483
|
`,
|
|
1284
1484
|
"\n"
|
|
1285
1485
|
].filter(Boolean).join("\n");
|
|
1286
1486
|
}
|
|
1287
1487
|
function configExistsMessage(cmd) {
|
|
1288
|
-
return
|
|
1488
|
+
return import_outdent23.outdent`
|
|
1289
1489
|
\n
|
|
1290
1490
|
It looks like you already have panda created\`.
|
|
1291
1491
|
|
|
@@ -1294,7 +1494,7 @@ function configExistsMessage(cmd) {
|
|
|
1294
1494
|
`;
|
|
1295
1495
|
}
|
|
1296
1496
|
function thankYouMessage() {
|
|
1297
|
-
return
|
|
1497
|
+
return import_outdent23.outdent`
|
|
1298
1498
|
|
|
1299
1499
|
🚀 Thanks for choosing ${import_logger3.colors.cyan("Panda")} to write your css.
|
|
1300
1500
|
|
|
@@ -1306,7 +1506,7 @@ var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
|
|
|
1306
1506
|
var pickRandom = (arr) => arr[Math.floor(Math.random() * arr.length)];
|
|
1307
1507
|
function scaffoldCompleteMessage() {
|
|
1308
1508
|
return import_logger3.logger.box(
|
|
1309
|
-
|
|
1509
|
+
import_outdent23.outdent`
|
|
1310
1510
|
|
|
1311
1511
|
${import_logger3.colors.bold().cyan("Next steps:")}
|
|
1312
1512
|
|
|
@@ -1932,7 +2132,7 @@ async function generate5(config, configPath) {
|
|
|
1932
2132
|
var import_logger8 = require("@pandacss/logger");
|
|
1933
2133
|
var import_fs_extra4 = require("fs-extra");
|
|
1934
2134
|
var import_look_it_up3 = require("look-it-up");
|
|
1935
|
-
var
|
|
2135
|
+
var import_outdent24 = require("outdent");
|
|
1936
2136
|
var import_path7 = require("path");
|
|
1937
2137
|
var import_preferred_pm2 = __toESM(require("preferred-pm"));
|
|
1938
2138
|
async function setupConfig(cwd, { force }) {
|
|
@@ -1946,7 +2146,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
1946
2146
|
if (!force && configFile) {
|
|
1947
2147
|
import_logger8.logger.warn("config exists", configExistsMessage(cmd));
|
|
1948
2148
|
} else {
|
|
1949
|
-
const content =
|
|
2149
|
+
const content = import_outdent24.outdent`
|
|
1950
2150
|
import { defineConfig } from "css-panda"
|
|
1951
2151
|
|
|
1952
2152
|
export default defineConfig({
|
|
@@ -1972,7 +2172,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
1972
2172
|
}
|
|
1973
2173
|
async function setupPostcss(cwd) {
|
|
1974
2174
|
import_logger8.logger.info({ type: "init", msg: `creating postcss config file: ${(0, import_logger8.quote)("postcss.config.cjs")}` });
|
|
1975
|
-
const content =
|
|
2175
|
+
const content = import_outdent24.outdent`
|
|
1976
2176
|
module.exports = {
|
|
1977
2177
|
plugins: {
|
|
1978
2178
|
'css-panda/postcss': {},
|