@pandacss/node 0.0.0-dev-20221124074636 → 0.0.0-dev-20221124141119
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 +223 -54
- package/dist/index.mjs +223 -54
- 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,9 +377,62 @@ 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");
|
|
383
436
|
var import_ts_pattern = require("ts-pattern");
|
|
384
437
|
function generate(name, pattern, jsxFactory) {
|
|
385
438
|
const upperName = (0, import_shared3.capitalize)(name);
|
|
@@ -387,7 +440,7 @@ function generate(name, pattern, jsxFactory) {
|
|
|
387
440
|
const keys = Object.keys(pattern.properties ?? {});
|
|
388
441
|
return {
|
|
389
442
|
name: (0, import_shared3.dashCase)(name),
|
|
390
|
-
js:
|
|
443
|
+
js: import_outdent8.outdent`
|
|
391
444
|
import { forwardRef } from 'preact/compat'
|
|
392
445
|
import { ${jsxFactory} } from './factory'
|
|
393
446
|
import { config } from '../patterns/${(0, import_shared3.dashCase)(name)}'
|
|
@@ -407,7 +460,7 @@ function generate(name, pattern, jsxFactory) {
|
|
|
407
460
|
)}
|
|
408
461
|
})
|
|
409
462
|
`,
|
|
410
|
-
dts:
|
|
463
|
+
dts: import_outdent8.outdent`
|
|
411
464
|
import { ComponentProps, JSX, ComponentChildren } from 'preact';
|
|
412
465
|
import { ${upperName}Options } from '../patterns/${(0, import_shared3.dashCase)(name)}'
|
|
413
466
|
import { JSXStyleProperties, Assign } from '../types'
|
|
@@ -434,12 +487,12 @@ function generatePreactJsxPattern(ctx) {
|
|
|
434
487
|
|
|
435
488
|
// src/generators/jsx/react-jsx.ts
|
|
436
489
|
var import_shared4 = require("@pandacss/shared");
|
|
437
|
-
var
|
|
490
|
+
var import_outdent9 = require("outdent");
|
|
438
491
|
function generateReactJsxFactory(ctx) {
|
|
439
492
|
const name = ctx.jsxFactory;
|
|
440
493
|
const upperName = (0, import_shared4.capitalize)(name);
|
|
441
494
|
return {
|
|
442
|
-
dts:
|
|
495
|
+
dts: import_outdent9.outdent`
|
|
443
496
|
import type { ComponentProps } from "react"
|
|
444
497
|
import type { JSXStyleProperties } from "../types"
|
|
445
498
|
|
|
@@ -453,7 +506,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
453
506
|
|
|
454
507
|
export declare const ${name}: JSXFactory
|
|
455
508
|
`,
|
|
456
|
-
js:
|
|
509
|
+
js: import_outdent9.outdent`
|
|
457
510
|
import { forwardRef } from 'react'
|
|
458
511
|
import { isCssProperty } from './is-valid-prop'
|
|
459
512
|
import { css } from '../css'
|
|
@@ -514,9 +567,62 @@ function generateReactJsxFactory(ctx) {
|
|
|
514
567
|
};
|
|
515
568
|
}
|
|
516
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
|
+
|
|
517
623
|
// src/generators/jsx/react-pattern.ts
|
|
518
624
|
var import_shared5 = require("@pandacss/shared");
|
|
519
|
-
var
|
|
625
|
+
var import_outdent11 = require("outdent");
|
|
520
626
|
var import_ts_pattern2 = require("ts-pattern");
|
|
521
627
|
function generate2(name, pattern, jsxFactory) {
|
|
522
628
|
const upperName = (0, import_shared5.capitalize)(name);
|
|
@@ -524,7 +630,7 @@ function generate2(name, pattern, jsxFactory) {
|
|
|
524
630
|
const keys = Object.keys(pattern.properties ?? {});
|
|
525
631
|
return {
|
|
526
632
|
name: (0, import_shared5.dashCase)(name),
|
|
527
|
-
js:
|
|
633
|
+
js: import_outdent11.outdent`
|
|
528
634
|
import { forwardRef } from 'react'
|
|
529
635
|
import { ${jsxFactory} } from './factory'
|
|
530
636
|
import { config } from '../patterns/${(0, import_shared5.dashCase)(name)}'
|
|
@@ -545,7 +651,7 @@ function generate2(name, pattern, jsxFactory) {
|
|
|
545
651
|
|
|
546
652
|
})
|
|
547
653
|
`,
|
|
548
|
-
dts:
|
|
654
|
+
dts: import_outdent11.outdent`
|
|
549
655
|
import { ComponentProps, ElementType, PropsWithChildren } from 'react'
|
|
550
656
|
import { ${upperName}Options } from '../patterns/${(0, import_shared5.dashCase)(name)}'
|
|
551
657
|
import { JSXStyleProperties, Assign } from '../types'
|
|
@@ -569,12 +675,12 @@ function generateReactJsxPattern(ctx) {
|
|
|
569
675
|
|
|
570
676
|
// src/generators/jsx/solid-jsx.ts
|
|
571
677
|
var import_shared6 = require("@pandacss/shared");
|
|
572
|
-
var
|
|
678
|
+
var import_outdent12 = require("outdent");
|
|
573
679
|
function generateSolidJsxFactory(ctx) {
|
|
574
680
|
const name = ctx.jsxFactory;
|
|
575
681
|
const upperName = (0, import_shared6.capitalize)(name);
|
|
576
682
|
return {
|
|
577
|
-
dts:
|
|
683
|
+
dts: import_outdent12.outdent`
|
|
578
684
|
import type { JSX } from 'solid-js'
|
|
579
685
|
import type { JSXStyleProperties, Assign} from '../types'
|
|
580
686
|
|
|
@@ -588,7 +694,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
588
694
|
|
|
589
695
|
export declare const ${name}: JSXFactory
|
|
590
696
|
`,
|
|
591
|
-
js:
|
|
697
|
+
js: import_outdent12.outdent`
|
|
592
698
|
import { Dynamic } from 'solid-js/web';
|
|
593
699
|
import { mergeProps, splitProps } from 'solid-js';
|
|
594
700
|
import { allCssProperties } from './is-valid-prop'
|
|
@@ -636,9 +742,60 @@ function generateSolidJsxFactory(ctx) {
|
|
|
636
742
|
};
|
|
637
743
|
}
|
|
638
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
|
+
|
|
639
796
|
// src/generators/jsx/solid-pattern.ts
|
|
640
797
|
var import_shared7 = require("@pandacss/shared");
|
|
641
|
-
var
|
|
798
|
+
var import_outdent14 = require("outdent");
|
|
642
799
|
var import_ts_pattern3 = require("ts-pattern");
|
|
643
800
|
function generate3(name, pattern, jsxFactory) {
|
|
644
801
|
const upperName = (0, import_shared7.capitalize)(name);
|
|
@@ -646,7 +803,7 @@ function generate3(name, pattern, jsxFactory) {
|
|
|
646
803
|
const keys = Object.keys(pattern.properties ?? {});
|
|
647
804
|
return {
|
|
648
805
|
name: (0, import_shared7.dashCase)(name),
|
|
649
|
-
js:
|
|
806
|
+
js: import_outdent14.outdent`
|
|
650
807
|
import { splitProps } from 'solid-js'
|
|
651
808
|
import { ${jsxFactory} } from './factory'
|
|
652
809
|
import { config } from '../patterns/${(0, import_shared7.dashCase)(name)}'
|
|
@@ -666,7 +823,7 @@ function generate3(name, pattern, jsxFactory) {
|
|
|
666
823
|
)}
|
|
667
824
|
}
|
|
668
825
|
`,
|
|
669
|
-
dts:
|
|
826
|
+
dts: import_outdent14.outdent`
|
|
670
827
|
import { ComponentProps, JSX } from 'solid-js'
|
|
671
828
|
import { ${upperName}Options } from '../patterns/${(0, import_shared7.dashCase)(name)}'
|
|
672
829
|
import { Assign, JSXStyleProperties } from '../types'
|
|
@@ -706,17 +863,25 @@ var patternMap = {
|
|
|
706
863
|
function generateJsxPatterns(ctx) {
|
|
707
864
|
return patternMap[ctx.jsxFramework](ctx);
|
|
708
865
|
}
|
|
866
|
+
var layoutGridMap = {
|
|
867
|
+
react: generateReactLayoutGrid,
|
|
868
|
+
preact: generatePreactLayoutGrid,
|
|
869
|
+
solid: generateSolidLayoutGrid
|
|
870
|
+
};
|
|
871
|
+
function generateLayoutGrid(ctx) {
|
|
872
|
+
return layoutGridMap[ctx.jsxFramework]();
|
|
873
|
+
}
|
|
709
874
|
|
|
710
875
|
// src/generators/pattern.ts
|
|
711
876
|
var import_shared8 = require("@pandacss/shared");
|
|
712
|
-
var
|
|
877
|
+
var import_outdent15 = require("outdent");
|
|
713
878
|
var import_telejson = require("telejson");
|
|
714
879
|
var import_ts_pattern4 = require("ts-pattern");
|
|
715
880
|
function generate4(name, pattern) {
|
|
716
881
|
const { properties, transform, strict } = pattern;
|
|
717
882
|
return {
|
|
718
883
|
name: (0, import_shared8.dashCase)(name),
|
|
719
|
-
dts:
|
|
884
|
+
dts: import_outdent15.outdent`
|
|
720
885
|
import { SystemStyleObject, ConditionalValue } from "../types"
|
|
721
886
|
import { Properties } from "../types/csstype"
|
|
722
887
|
import { Tokens } from "../types/token"
|
|
@@ -739,13 +904,13 @@ function generate4(name, pattern) {
|
|
|
739
904
|
}).join("\n ")}
|
|
740
905
|
}
|
|
741
906
|
|
|
742
|
-
${strict ?
|
|
907
|
+
${strict ? import_outdent15.outdent`export declare function ${name}(options: ${(0, import_shared8.capitalize)(name)}Options): string` : import_outdent15.outdent`
|
|
743
908
|
type Merge<T> = Omit<SystemStyleObject, keyof T> & T
|
|
744
909
|
export declare function ${name}(options: Merge<${(0, import_shared8.capitalize)(name)}Options>): string
|
|
745
910
|
`}
|
|
746
911
|
|
|
747
912
|
`,
|
|
748
|
-
js:
|
|
913
|
+
js: import_outdent15.outdent`
|
|
749
914
|
import { mapObject } from "../helpers"
|
|
750
915
|
import { css } from "../css"
|
|
751
916
|
|
|
@@ -762,10 +927,10 @@ function generatePattern(ctx) {
|
|
|
762
927
|
}
|
|
763
928
|
|
|
764
929
|
// src/generators/prop-types.ts
|
|
765
|
-
var
|
|
930
|
+
var import_outdent16 = require("outdent");
|
|
766
931
|
function generatePropTypes(utility) {
|
|
767
932
|
const result = [
|
|
768
|
-
|
|
933
|
+
import_outdent16.outdent`
|
|
769
934
|
import { Properties as CSSProperties } from "./csstype"
|
|
770
935
|
|
|
771
936
|
type BasePropTypes = {`
|
|
@@ -793,14 +958,14 @@ function generatePropTypes(utility) {
|
|
|
793
958
|
|
|
794
959
|
// src/generators/recipe.ts
|
|
795
960
|
var import_shared9 = require("@pandacss/shared");
|
|
796
|
-
var
|
|
961
|
+
var import_outdent17 = require("outdent");
|
|
797
962
|
function generateRecipes(ctx) {
|
|
798
963
|
const { recipes = {}, hash, hasRecipes, utility } = ctx;
|
|
799
964
|
const { separator } = utility;
|
|
800
965
|
if (!hasRecipes)
|
|
801
966
|
return;
|
|
802
967
|
const js = [
|
|
803
|
-
|
|
968
|
+
import_outdent17.outdent`
|
|
804
969
|
import { createCss, withoutSpace } from "../helpers"
|
|
805
970
|
|
|
806
971
|
const createRecipe = (name) => {
|
|
@@ -824,10 +989,10 @@ function generateRecipes(ctx) {
|
|
|
824
989
|
];
|
|
825
990
|
const dts = [""];
|
|
826
991
|
Object.values(recipes).forEach((recipe) => {
|
|
827
|
-
js.push(
|
|
992
|
+
js.push(import_outdent17.outdent`
|
|
828
993
|
export const ${recipe.name} = createRecipe('${recipe.name}')
|
|
829
994
|
`);
|
|
830
|
-
dts.push(
|
|
995
|
+
dts.push(import_outdent17.outdent`
|
|
831
996
|
import { ConditionalValue } from "../types"
|
|
832
997
|
|
|
833
998
|
export type ${(0, import_shared9.capitalize)(recipe.name)}Value = {
|
|
@@ -842,8 +1007,8 @@ function generateRecipes(ctx) {
|
|
|
842
1007
|
`);
|
|
843
1008
|
});
|
|
844
1009
|
return {
|
|
845
|
-
js:
|
|
846
|
-
dts:
|
|
1010
|
+
js: import_outdent17.outdent.string(js.join("\n\n")),
|
|
1011
|
+
dts: import_outdent17.outdent.string(dts.join("\n\n"))
|
|
847
1012
|
};
|
|
848
1013
|
}
|
|
849
1014
|
|
|
@@ -950,14 +1115,14 @@ function generateReset() {
|
|
|
950
1115
|
|
|
951
1116
|
// src/generators/token-css.ts
|
|
952
1117
|
var import_core2 = require("@pandacss/core");
|
|
953
|
-
var
|
|
1118
|
+
var import_outdent18 = require("outdent");
|
|
954
1119
|
var import_ts_pattern5 = require("ts-pattern");
|
|
955
1120
|
function generateKeyframes(keyframes) {
|
|
956
1121
|
if (keyframes) {
|
|
957
1122
|
return (0, import_core2.toKeyframeCss)(keyframes);
|
|
958
1123
|
}
|
|
959
1124
|
}
|
|
960
|
-
var getConditionMessage = (value) =>
|
|
1125
|
+
var getConditionMessage = (value) => import_outdent18.outdent`
|
|
961
1126
|
It seems you provided an invalid condition for semantic tokens.
|
|
962
1127
|
|
|
963
1128
|
- You provided: \`${value}\`
|
|
@@ -1012,7 +1177,7 @@ function generateTokenCss(ctx, varRoot) {
|
|
|
1012
1177
|
|
|
1013
1178
|
// src/generators/token-dts.ts
|
|
1014
1179
|
var import_shared10 = require("@pandacss/shared");
|
|
1015
|
-
var
|
|
1180
|
+
var import_outdent19 = require("outdent");
|
|
1016
1181
|
var import_pluralize = require("pluralize");
|
|
1017
1182
|
function generateTokenDts(dict) {
|
|
1018
1183
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -1030,11 +1195,11 @@ function generateTokenDts(dict) {
|
|
|
1030
1195
|
}
|
|
1031
1196
|
interfaceSet.add("}");
|
|
1032
1197
|
set.add(Array.from(interfaceSet).join("\n"));
|
|
1033
|
-
return
|
|
1198
|
+
return import_outdent19.outdent.string(Array.from(set).join("\n\n"));
|
|
1034
1199
|
}
|
|
1035
1200
|
|
|
1036
1201
|
// src/generators/token-js.ts
|
|
1037
|
-
var
|
|
1202
|
+
var import_outdent20 = __toESM(require("outdent"));
|
|
1038
1203
|
function generateTokenJs(dict) {
|
|
1039
1204
|
const map = /* @__PURE__ */ new Map();
|
|
1040
1205
|
dict.allTokens.forEach((token) => {
|
|
@@ -1044,7 +1209,7 @@ function generateTokenJs(dict) {
|
|
|
1044
1209
|
});
|
|
1045
1210
|
const obj = Object.fromEntries(map);
|
|
1046
1211
|
return {
|
|
1047
|
-
js:
|
|
1212
|
+
js: import_outdent20.default`
|
|
1048
1213
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1049
1214
|
|
|
1050
1215
|
function getToken(path) {
|
|
@@ -1057,7 +1222,7 @@ function generateTokenJs(dict) {
|
|
|
1057
1222
|
return variable
|
|
1058
1223
|
}
|
|
1059
1224
|
`,
|
|
1060
|
-
dts:
|
|
1225
|
+
dts: import_outdent20.default`
|
|
1061
1226
|
import { Token } from "../types/token"
|
|
1062
1227
|
export declare function getToken(path: Token): string
|
|
1063
1228
|
export declare function getTokenVar(path: Token): string
|
|
@@ -1067,7 +1232,7 @@ function generateTokenJs(dict) {
|
|
|
1067
1232
|
|
|
1068
1233
|
// src/generators/types.ts
|
|
1069
1234
|
var import_fs_extra = require("fs-extra");
|
|
1070
|
-
var
|
|
1235
|
+
var import_outdent21 = __toESM(require("outdent"));
|
|
1071
1236
|
function getType(file) {
|
|
1072
1237
|
const filepath = getEntrypoint("@pandacss/types", { dev: file });
|
|
1073
1238
|
return (0, import_fs_extra.readFileSync)(filepath, "utf8");
|
|
@@ -1077,7 +1242,7 @@ function generateCssType(ctx) {
|
|
|
1077
1242
|
return {
|
|
1078
1243
|
cssType: getType("csstype.d.ts"),
|
|
1079
1244
|
pandaCssType: getType("system-types.d.ts"),
|
|
1080
|
-
publicType:
|
|
1245
|
+
publicType: import_outdent21.default`
|
|
1081
1246
|
import * as System from './system-types'
|
|
1082
1247
|
import { PropTypes } from './prop-type'
|
|
1083
1248
|
import { Conditions } from './conditions'
|
|
@@ -1198,7 +1363,7 @@ function setupPatterns(ctx) {
|
|
|
1198
1363
|
if (!files) {
|
|
1199
1364
|
return { files: [] };
|
|
1200
1365
|
}
|
|
1201
|
-
const indexCode =
|
|
1366
|
+
const indexCode = import_outdent22.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"));
|
|
1202
1367
|
return {
|
|
1203
1368
|
dir: ctx.paths.pattern,
|
|
1204
1369
|
files: [
|
|
@@ -1215,15 +1380,19 @@ function setupJsx(ctx) {
|
|
|
1215
1380
|
const isValidProp = generateisValidProp(ctx);
|
|
1216
1381
|
const factory = generateJsxFactory(ctx);
|
|
1217
1382
|
const patterns = generateJsxPatterns(ctx);
|
|
1218
|
-
const
|
|
1383
|
+
const layoutGrid = generateLayoutGrid(ctx);
|
|
1384
|
+
const indexCode = import_outdent22.default`
|
|
1219
1385
|
export * from './factory'
|
|
1220
|
-
|
|
1386
|
+
export * from './layout-grid'
|
|
1387
|
+
${import_outdent22.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
1221
1388
|
`;
|
|
1222
1389
|
return {
|
|
1223
1390
|
dir: ctx.paths.jsx,
|
|
1224
1391
|
files: [
|
|
1225
1392
|
...patterns.map((file) => ({ file: `${file.name}.jsx`, code: file.js })),
|
|
1226
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 },
|
|
1227
1396
|
{ file: "is-valid-prop.js", code: isValidProp.js },
|
|
1228
1397
|
{ file: "factory.d.ts", code: factory.dts },
|
|
1229
1398
|
{ file: "factory.jsx", code: factory.js },
|
|
@@ -1233,7 +1402,7 @@ function setupJsx(ctx) {
|
|
|
1233
1402
|
};
|
|
1234
1403
|
}
|
|
1235
1404
|
function setupCssIndex(ctx) {
|
|
1236
|
-
const code =
|
|
1405
|
+
const code = import_outdent22.default`
|
|
1237
1406
|
export * from './css'
|
|
1238
1407
|
export * from './cx'
|
|
1239
1408
|
export * from './global-css'
|
|
@@ -1254,7 +1423,7 @@ function setupReset(ctx) {
|
|
|
1254
1423
|
return { files: [{ file: "reset.css", code }] };
|
|
1255
1424
|
}
|
|
1256
1425
|
function setupGitIgnore(ctx) {
|
|
1257
|
-
const txt =
|
|
1426
|
+
const txt = import_outdent22.default`## CSS Panda
|
|
1258
1427
|
${ctx.outdir}
|
|
1259
1428
|
`;
|
|
1260
1429
|
const file = (0, import_look_it_up.lookItUpSync)(".gitignore");
|
|
@@ -1293,30 +1462,30 @@ function generateSystem(ctx) {
|
|
|
1293
1462
|
|
|
1294
1463
|
// src/messages.ts
|
|
1295
1464
|
var import_logger3 = require("@pandacss/logger");
|
|
1296
|
-
var
|
|
1465
|
+
var import_outdent23 = require("outdent");
|
|
1297
1466
|
var tick = import_logger3.colors.green().bold("\u2714\uFE0F");
|
|
1298
1467
|
function artifactsGeneratedMessage(ctx) {
|
|
1299
1468
|
return [
|
|
1300
|
-
|
|
1469
|
+
import_outdent23.outdent`
|
|
1301
1470
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/css")}: the css function to author styles
|
|
1302
1471
|
`,
|
|
1303
|
-
ctx.hasTokens &&
|
|
1472
|
+
ctx.hasTokens && import_outdent23.outdent`
|
|
1304
1473
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
1305
1474
|
`,
|
|
1306
|
-
ctx.hasPattern &&
|
|
1475
|
+
ctx.hasPattern && import_outdent23.outdent`
|
|
1307
1476
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/patterns")}: functions to implement common css patterns
|
|
1308
1477
|
`,
|
|
1309
|
-
ctx.hasRecipes &&
|
|
1478
|
+
ctx.hasRecipes && import_outdent23.outdent`
|
|
1310
1479
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/recipes")}: functions to create multi-variant styles
|
|
1311
1480
|
`,
|
|
1312
|
-
ctx.jsxFramework &&
|
|
1481
|
+
ctx.jsxFramework && import_outdent23.outdent`
|
|
1313
1482
|
${tick} ${(0, import_logger3.quote)(ctx.outdir, "/jsx")}: style prop powered elements for ${ctx.jsxFramework}
|
|
1314
1483
|
`,
|
|
1315
1484
|
"\n"
|
|
1316
1485
|
].filter(Boolean).join("\n");
|
|
1317
1486
|
}
|
|
1318
1487
|
function configExistsMessage(cmd) {
|
|
1319
|
-
return
|
|
1488
|
+
return import_outdent23.outdent`
|
|
1320
1489
|
\n
|
|
1321
1490
|
It looks like you already have panda created\`.
|
|
1322
1491
|
|
|
@@ -1325,7 +1494,7 @@ function configExistsMessage(cmd) {
|
|
|
1325
1494
|
`;
|
|
1326
1495
|
}
|
|
1327
1496
|
function thankYouMessage() {
|
|
1328
|
-
return
|
|
1497
|
+
return import_outdent23.outdent`
|
|
1329
1498
|
|
|
1330
1499
|
🚀 Thanks for choosing ${import_logger3.colors.cyan("Panda")} to write your css.
|
|
1331
1500
|
|
|
@@ -1337,7 +1506,7 @@ var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
|
|
|
1337
1506
|
var pickRandom = (arr) => arr[Math.floor(Math.random() * arr.length)];
|
|
1338
1507
|
function scaffoldCompleteMessage() {
|
|
1339
1508
|
return import_logger3.logger.box(
|
|
1340
|
-
|
|
1509
|
+
import_outdent23.outdent`
|
|
1341
1510
|
|
|
1342
1511
|
${import_logger3.colors.bold().cyan("Next steps:")}
|
|
1343
1512
|
|
|
@@ -1963,7 +2132,7 @@ async function generate5(config, configPath) {
|
|
|
1963
2132
|
var import_logger8 = require("@pandacss/logger");
|
|
1964
2133
|
var import_fs_extra4 = require("fs-extra");
|
|
1965
2134
|
var import_look_it_up3 = require("look-it-up");
|
|
1966
|
-
var
|
|
2135
|
+
var import_outdent24 = require("outdent");
|
|
1967
2136
|
var import_path7 = require("path");
|
|
1968
2137
|
var import_preferred_pm2 = __toESM(require("preferred-pm"));
|
|
1969
2138
|
async function setupConfig(cwd, { force }) {
|
|
@@ -1977,7 +2146,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
1977
2146
|
if (!force && configFile) {
|
|
1978
2147
|
import_logger8.logger.warn("config exists", configExistsMessage(cmd));
|
|
1979
2148
|
} else {
|
|
1980
|
-
const content =
|
|
2149
|
+
const content = import_outdent24.outdent`
|
|
1981
2150
|
import { defineConfig } from "css-panda"
|
|
1982
2151
|
|
|
1983
2152
|
export default defineConfig({
|
|
@@ -2003,7 +2172,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
2003
2172
|
}
|
|
2004
2173
|
async function setupPostcss(cwd) {
|
|
2005
2174
|
import_logger8.logger.info({ type: "init", msg: `creating postcss config file: ${(0, import_logger8.quote)("postcss.config.cjs")}` });
|
|
2006
|
-
const content =
|
|
2175
|
+
const content = import_outdent24.outdent`
|
|
2007
2176
|
module.exports = {
|
|
2008
2177
|
plugins: {
|
|
2009
2178
|
'css-panda/postcss': {},
|
package/dist/index.mjs
CHANGED
|
@@ -70,7 +70,7 @@ async function writeFileChunk(ctx, file) {
|
|
|
70
70
|
// src/generators/index.ts
|
|
71
71
|
import { readFileSync as readFileSync3 } from "fs";
|
|
72
72
|
import { lookItUpSync } from "look-it-up";
|
|
73
|
-
import
|
|
73
|
+
import outdent22 from "outdent";
|
|
74
74
|
import { dirname as dirname2 } from "path";
|
|
75
75
|
|
|
76
76
|
// src/generators/conditions.ts
|
|
@@ -332,9 +332,62 @@ function generatePreactJsxFactory(ctx) {
|
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
// src/generators/jsx/preact-layout-grid.ts
|
|
336
|
+
import { outdent as outdent7 } from "outdent";
|
|
337
|
+
function generatePreactLayoutGrid() {
|
|
338
|
+
return {
|
|
339
|
+
dts: outdent7`
|
|
340
|
+
import { FunctionComponent } from 'preact'
|
|
341
|
+
|
|
342
|
+
export type LayoutGridProps = {
|
|
343
|
+
count?: number
|
|
344
|
+
gutter?: string
|
|
345
|
+
maxWidth?: string
|
|
346
|
+
margin?: string
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
350
|
+
`,
|
|
351
|
+
js: outdent7`
|
|
352
|
+
export function LayoutGrid(props) {
|
|
353
|
+
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
354
|
+
const hasMaxWidth = maxWidth != null;
|
|
355
|
+
return (
|
|
356
|
+
<div
|
|
357
|
+
style={{
|
|
358
|
+
display: 'grid',
|
|
359
|
+
gap: gutter,
|
|
360
|
+
gridTemplateColumns: \`repeat(\${count}, 1fr)\`,
|
|
361
|
+
height: '100%',
|
|
362
|
+
width: '100%',
|
|
363
|
+
position: 'absolute',
|
|
364
|
+
inset: '0',
|
|
365
|
+
pointerEvents: 'none',
|
|
366
|
+
maxWidth: hasMaxWidth ? maxWidth : 'initial',
|
|
367
|
+
marginInline: hasMaxWidth ? 'auto' : undefined,
|
|
368
|
+
paddingInline: !hasMaxWidth ? margin : undefined,
|
|
369
|
+
}}
|
|
370
|
+
>
|
|
371
|
+
{Array.from({ length: count }).map((_, i) => (
|
|
372
|
+
<span
|
|
373
|
+
key={i}
|
|
374
|
+
style={{
|
|
375
|
+
display: 'flex',
|
|
376
|
+
background: 'rgba(255, 0, 0, 0.1)',
|
|
377
|
+
height: '100%',
|
|
378
|
+
}}
|
|
379
|
+
/>
|
|
380
|
+
))}
|
|
381
|
+
</div>
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
`
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
335
388
|
// src/generators/jsx/preact-pattern.ts
|
|
336
389
|
import { capitalize as capitalize2, dashCase } from "@pandacss/shared";
|
|
337
|
-
import { outdent as
|
|
390
|
+
import { outdent as outdent8 } from "outdent";
|
|
338
391
|
import { match } from "ts-pattern";
|
|
339
392
|
function generate(name, pattern, jsxFactory) {
|
|
340
393
|
const upperName = capitalize2(name);
|
|
@@ -342,7 +395,7 @@ function generate(name, pattern, jsxFactory) {
|
|
|
342
395
|
const keys = Object.keys(pattern.properties ?? {});
|
|
343
396
|
return {
|
|
344
397
|
name: dashCase(name),
|
|
345
|
-
js:
|
|
398
|
+
js: outdent8`
|
|
346
399
|
import { forwardRef } from 'preact/compat'
|
|
347
400
|
import { ${jsxFactory} } from './factory'
|
|
348
401
|
import { config } from '../patterns/${dashCase(name)}'
|
|
@@ -362,7 +415,7 @@ function generate(name, pattern, jsxFactory) {
|
|
|
362
415
|
)}
|
|
363
416
|
})
|
|
364
417
|
`,
|
|
365
|
-
dts:
|
|
418
|
+
dts: outdent8`
|
|
366
419
|
import { ComponentProps, JSX, ComponentChildren } from 'preact';
|
|
367
420
|
import { ${upperName}Options } from '../patterns/${dashCase(name)}'
|
|
368
421
|
import { JSXStyleProperties, Assign } from '../types'
|
|
@@ -389,12 +442,12 @@ function generatePreactJsxPattern(ctx) {
|
|
|
389
442
|
|
|
390
443
|
// src/generators/jsx/react-jsx.ts
|
|
391
444
|
import { capitalize as capitalize3 } from "@pandacss/shared";
|
|
392
|
-
import { outdent as
|
|
445
|
+
import { outdent as outdent9 } from "outdent";
|
|
393
446
|
function generateReactJsxFactory(ctx) {
|
|
394
447
|
const name = ctx.jsxFactory;
|
|
395
448
|
const upperName = capitalize3(name);
|
|
396
449
|
return {
|
|
397
|
-
dts:
|
|
450
|
+
dts: outdent9`
|
|
398
451
|
import type { ComponentProps } from "react"
|
|
399
452
|
import type { JSXStyleProperties } from "../types"
|
|
400
453
|
|
|
@@ -408,7 +461,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
408
461
|
|
|
409
462
|
export declare const ${name}: JSXFactory
|
|
410
463
|
`,
|
|
411
|
-
js:
|
|
464
|
+
js: outdent9`
|
|
412
465
|
import { forwardRef } from 'react'
|
|
413
466
|
import { isCssProperty } from './is-valid-prop'
|
|
414
467
|
import { css } from '../css'
|
|
@@ -469,9 +522,62 @@ function generateReactJsxFactory(ctx) {
|
|
|
469
522
|
};
|
|
470
523
|
}
|
|
471
524
|
|
|
525
|
+
// src/generators/jsx/react-layout-grid.ts
|
|
526
|
+
import { outdent as outdent10 } from "outdent";
|
|
527
|
+
function generateReactLayoutGrid() {
|
|
528
|
+
return {
|
|
529
|
+
dts: outdent10`
|
|
530
|
+
import type { FunctionComponent } from 'react'
|
|
531
|
+
|
|
532
|
+
export type LayoutGridProps = {
|
|
533
|
+
count?: number
|
|
534
|
+
gutter?: string
|
|
535
|
+
maxWidth?: string
|
|
536
|
+
margin?: string
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
540
|
+
`,
|
|
541
|
+
js: outdent10`
|
|
542
|
+
export function LayoutGrid(props) {
|
|
543
|
+
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
544
|
+
const hasMaxWidth = maxWidth != null;
|
|
545
|
+
return (
|
|
546
|
+
<div
|
|
547
|
+
style={{
|
|
548
|
+
display: 'grid',
|
|
549
|
+
gap: gutter,
|
|
550
|
+
gridTemplateColumns: \`repeat(\${count}, 1fr)\`,
|
|
551
|
+
height: '100%',
|
|
552
|
+
width: '100%',
|
|
553
|
+
position: 'absolute',
|
|
554
|
+
inset: '0',
|
|
555
|
+
pointerEvents: 'none',
|
|
556
|
+
maxWidth: hasMaxWidth ? maxWidth : 'initial',
|
|
557
|
+
marginInline: hasMaxWidth ? 'auto' : undefined,
|
|
558
|
+
paddingInline: !hasMaxWidth ? margin : undefined,
|
|
559
|
+
}}
|
|
560
|
+
>
|
|
561
|
+
{Array.from({ length: count }).map((_, i) => (
|
|
562
|
+
<span
|
|
563
|
+
key={i}
|
|
564
|
+
style={{
|
|
565
|
+
display: 'flex',
|
|
566
|
+
background: 'rgba(255, 0, 0, 0.1)',
|
|
567
|
+
height: '100%',
|
|
568
|
+
}}
|
|
569
|
+
/>
|
|
570
|
+
))}
|
|
571
|
+
</div>
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
`
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
|
|
472
578
|
// src/generators/jsx/react-pattern.ts
|
|
473
579
|
import { capitalize as capitalize4, dashCase as dashCase2 } from "@pandacss/shared";
|
|
474
|
-
import { outdent as
|
|
580
|
+
import { outdent as outdent11 } from "outdent";
|
|
475
581
|
import { match as match2 } from "ts-pattern";
|
|
476
582
|
function generate2(name, pattern, jsxFactory) {
|
|
477
583
|
const upperName = capitalize4(name);
|
|
@@ -479,7 +585,7 @@ function generate2(name, pattern, jsxFactory) {
|
|
|
479
585
|
const keys = Object.keys(pattern.properties ?? {});
|
|
480
586
|
return {
|
|
481
587
|
name: dashCase2(name),
|
|
482
|
-
js:
|
|
588
|
+
js: outdent11`
|
|
483
589
|
import { forwardRef } from 'react'
|
|
484
590
|
import { ${jsxFactory} } from './factory'
|
|
485
591
|
import { config } from '../patterns/${dashCase2(name)}'
|
|
@@ -500,7 +606,7 @@ function generate2(name, pattern, jsxFactory) {
|
|
|
500
606
|
|
|
501
607
|
})
|
|
502
608
|
`,
|
|
503
|
-
dts:
|
|
609
|
+
dts: outdent11`
|
|
504
610
|
import { ComponentProps, ElementType, PropsWithChildren } from 'react'
|
|
505
611
|
import { ${upperName}Options } from '../patterns/${dashCase2(name)}'
|
|
506
612
|
import { JSXStyleProperties, Assign } from '../types'
|
|
@@ -524,12 +630,12 @@ function generateReactJsxPattern(ctx) {
|
|
|
524
630
|
|
|
525
631
|
// src/generators/jsx/solid-jsx.ts
|
|
526
632
|
import { capitalize as capitalize5 } from "@pandacss/shared";
|
|
527
|
-
import { outdent as
|
|
633
|
+
import { outdent as outdent12 } from "outdent";
|
|
528
634
|
function generateSolidJsxFactory(ctx) {
|
|
529
635
|
const name = ctx.jsxFactory;
|
|
530
636
|
const upperName = capitalize5(name);
|
|
531
637
|
return {
|
|
532
|
-
dts:
|
|
638
|
+
dts: outdent12`
|
|
533
639
|
import type { JSX } from 'solid-js'
|
|
534
640
|
import type { JSXStyleProperties, Assign} from '../types'
|
|
535
641
|
|
|
@@ -543,7 +649,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
543
649
|
|
|
544
650
|
export declare const ${name}: JSXFactory
|
|
545
651
|
`,
|
|
546
|
-
js:
|
|
652
|
+
js: outdent12`
|
|
547
653
|
import { Dynamic } from 'solid-js/web';
|
|
548
654
|
import { mergeProps, splitProps } from 'solid-js';
|
|
549
655
|
import { allCssProperties } from './is-valid-prop'
|
|
@@ -591,9 +697,60 @@ function generateSolidJsxFactory(ctx) {
|
|
|
591
697
|
};
|
|
592
698
|
}
|
|
593
699
|
|
|
700
|
+
// src/generators/jsx/solid-layout-grid.ts
|
|
701
|
+
import { outdent as outdent13 } from "outdent";
|
|
702
|
+
function generateSolidLayoutGrid() {
|
|
703
|
+
return {
|
|
704
|
+
dts: outdent13`
|
|
705
|
+
export type LayoutGridProps = {
|
|
706
|
+
count?: number
|
|
707
|
+
gutter?: string
|
|
708
|
+
maxWidth?: string
|
|
709
|
+
margin?: string
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
export declare const LayoutGrid: React.FC<LayoutGridProps>
|
|
713
|
+
`,
|
|
714
|
+
js: outdent13`
|
|
715
|
+
export function LayoutGrid(props) {
|
|
716
|
+
const { count = 12, margin, gutter = '24px', maxWidth } = props
|
|
717
|
+
const hasMaxWidth = maxWidth != null;
|
|
718
|
+
return (
|
|
719
|
+
<div
|
|
720
|
+
style={{
|
|
721
|
+
display: 'grid',
|
|
722
|
+
gap: gutter,
|
|
723
|
+
'grid-template-columns': \`repeat(\${count}, 1fr)\`,
|
|
724
|
+
height: '100%',
|
|
725
|
+
width: '100%',
|
|
726
|
+
position: 'absolute',
|
|
727
|
+
inset: '0',
|
|
728
|
+
'pointer-events': 'none',
|
|
729
|
+
'max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
730
|
+
'margin-inline': hasMaxWidth ? 'auto' : undefined,
|
|
731
|
+
'padding-inline': !hasMaxWidth ? margin : undefined,
|
|
732
|
+
}}
|
|
733
|
+
>
|
|
734
|
+
{Array.from({ length: count }).map((_, i) => (
|
|
735
|
+
<span
|
|
736
|
+
key={i}
|
|
737
|
+
style={{
|
|
738
|
+
display: 'flex',
|
|
739
|
+
background: 'rgba(255, 0, 0, 0.1)',
|
|
740
|
+
height: '100%',
|
|
741
|
+
}}
|
|
742
|
+
/>
|
|
743
|
+
))}
|
|
744
|
+
</div>
|
|
745
|
+
);
|
|
746
|
+
}
|
|
747
|
+
`
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
|
|
594
751
|
// src/generators/jsx/solid-pattern.ts
|
|
595
752
|
import { capitalize as capitalize6, dashCase as dashCase3 } from "@pandacss/shared";
|
|
596
|
-
import { outdent as
|
|
753
|
+
import { outdent as outdent14 } from "outdent";
|
|
597
754
|
import { match as match3 } from "ts-pattern";
|
|
598
755
|
function generate3(name, pattern, jsxFactory) {
|
|
599
756
|
const upperName = capitalize6(name);
|
|
@@ -601,7 +758,7 @@ function generate3(name, pattern, jsxFactory) {
|
|
|
601
758
|
const keys = Object.keys(pattern.properties ?? {});
|
|
602
759
|
return {
|
|
603
760
|
name: dashCase3(name),
|
|
604
|
-
js:
|
|
761
|
+
js: outdent14`
|
|
605
762
|
import { splitProps } from 'solid-js'
|
|
606
763
|
import { ${jsxFactory} } from './factory'
|
|
607
764
|
import { config } from '../patterns/${dashCase3(name)}'
|
|
@@ -621,7 +778,7 @@ function generate3(name, pattern, jsxFactory) {
|
|
|
621
778
|
)}
|
|
622
779
|
}
|
|
623
780
|
`,
|
|
624
|
-
dts:
|
|
781
|
+
dts: outdent14`
|
|
625
782
|
import { ComponentProps, JSX } from 'solid-js'
|
|
626
783
|
import { ${upperName}Options } from '../patterns/${dashCase3(name)}'
|
|
627
784
|
import { Assign, JSXStyleProperties } from '../types'
|
|
@@ -661,17 +818,25 @@ var patternMap = {
|
|
|
661
818
|
function generateJsxPatterns(ctx) {
|
|
662
819
|
return patternMap[ctx.jsxFramework](ctx);
|
|
663
820
|
}
|
|
821
|
+
var layoutGridMap = {
|
|
822
|
+
react: generateReactLayoutGrid,
|
|
823
|
+
preact: generatePreactLayoutGrid,
|
|
824
|
+
solid: generateSolidLayoutGrid
|
|
825
|
+
};
|
|
826
|
+
function generateLayoutGrid(ctx) {
|
|
827
|
+
return layoutGridMap[ctx.jsxFramework]();
|
|
828
|
+
}
|
|
664
829
|
|
|
665
830
|
// src/generators/pattern.ts
|
|
666
831
|
import { capitalize as capitalize7, dashCase as dashCase4, unionType as unionType2 } from "@pandacss/shared";
|
|
667
|
-
import { outdent as
|
|
832
|
+
import { outdent as outdent15 } from "outdent";
|
|
668
833
|
import { stringify as stringify2 } from "telejson";
|
|
669
834
|
import { match as match4 } from "ts-pattern";
|
|
670
835
|
function generate4(name, pattern) {
|
|
671
836
|
const { properties, transform, strict } = pattern;
|
|
672
837
|
return {
|
|
673
838
|
name: dashCase4(name),
|
|
674
|
-
dts:
|
|
839
|
+
dts: outdent15`
|
|
675
840
|
import { SystemStyleObject, ConditionalValue } from "../types"
|
|
676
841
|
import { Properties } from "../types/csstype"
|
|
677
842
|
import { Tokens } from "../types/token"
|
|
@@ -694,13 +859,13 @@ function generate4(name, pattern) {
|
|
|
694
859
|
}).join("\n ")}
|
|
695
860
|
}
|
|
696
861
|
|
|
697
|
-
${strict ?
|
|
862
|
+
${strict ? outdent15`export declare function ${name}(options: ${capitalize7(name)}Options): string` : outdent15`
|
|
698
863
|
type Merge<T> = Omit<SystemStyleObject, keyof T> & T
|
|
699
864
|
export declare function ${name}(options: Merge<${capitalize7(name)}Options>): string
|
|
700
865
|
`}
|
|
701
866
|
|
|
702
867
|
`,
|
|
703
|
-
js:
|
|
868
|
+
js: outdent15`
|
|
704
869
|
import { mapObject } from "../helpers"
|
|
705
870
|
import { css } from "../css"
|
|
706
871
|
|
|
@@ -717,10 +882,10 @@ function generatePattern(ctx) {
|
|
|
717
882
|
}
|
|
718
883
|
|
|
719
884
|
// src/generators/prop-types.ts
|
|
720
|
-
import { outdent as
|
|
885
|
+
import { outdent as outdent16 } from "outdent";
|
|
721
886
|
function generatePropTypes(utility) {
|
|
722
887
|
const result = [
|
|
723
|
-
|
|
888
|
+
outdent16`
|
|
724
889
|
import { Properties as CSSProperties } from "./csstype"
|
|
725
890
|
|
|
726
891
|
type BasePropTypes = {`
|
|
@@ -748,14 +913,14 @@ function generatePropTypes(utility) {
|
|
|
748
913
|
|
|
749
914
|
// src/generators/recipe.ts
|
|
750
915
|
import { capitalize as capitalize8, unionType as unionType3 } from "@pandacss/shared";
|
|
751
|
-
import { outdent as
|
|
916
|
+
import { outdent as outdent17 } from "outdent";
|
|
752
917
|
function generateRecipes(ctx) {
|
|
753
918
|
const { recipes = {}, hash, hasRecipes, utility } = ctx;
|
|
754
919
|
const { separator } = utility;
|
|
755
920
|
if (!hasRecipes)
|
|
756
921
|
return;
|
|
757
922
|
const js = [
|
|
758
|
-
|
|
923
|
+
outdent17`
|
|
759
924
|
import { createCss, withoutSpace } from "../helpers"
|
|
760
925
|
|
|
761
926
|
const createRecipe = (name) => {
|
|
@@ -779,10 +944,10 @@ function generateRecipes(ctx) {
|
|
|
779
944
|
];
|
|
780
945
|
const dts = [""];
|
|
781
946
|
Object.values(recipes).forEach((recipe) => {
|
|
782
|
-
js.push(
|
|
947
|
+
js.push(outdent17`
|
|
783
948
|
export const ${recipe.name} = createRecipe('${recipe.name}')
|
|
784
949
|
`);
|
|
785
|
-
dts.push(
|
|
950
|
+
dts.push(outdent17`
|
|
786
951
|
import { ConditionalValue } from "../types"
|
|
787
952
|
|
|
788
953
|
export type ${capitalize8(recipe.name)}Value = {
|
|
@@ -797,8 +962,8 @@ function generateRecipes(ctx) {
|
|
|
797
962
|
`);
|
|
798
963
|
});
|
|
799
964
|
return {
|
|
800
|
-
js:
|
|
801
|
-
dts:
|
|
965
|
+
js: outdent17.string(js.join("\n\n")),
|
|
966
|
+
dts: outdent17.string(dts.join("\n\n"))
|
|
802
967
|
};
|
|
803
968
|
}
|
|
804
969
|
|
|
@@ -905,14 +1070,14 @@ function generateReset() {
|
|
|
905
1070
|
|
|
906
1071
|
// src/generators/token-css.ts
|
|
907
1072
|
import { toCss, toKeyframeCss } from "@pandacss/core";
|
|
908
|
-
import { outdent as
|
|
1073
|
+
import { outdent as outdent18 } from "outdent";
|
|
909
1074
|
import { match as match5, P } from "ts-pattern";
|
|
910
1075
|
function generateKeyframes(keyframes) {
|
|
911
1076
|
if (keyframes) {
|
|
912
1077
|
return toKeyframeCss(keyframes);
|
|
913
1078
|
}
|
|
914
1079
|
}
|
|
915
|
-
var getConditionMessage = (value) =>
|
|
1080
|
+
var getConditionMessage = (value) => outdent18`
|
|
916
1081
|
It seems you provided an invalid condition for semantic tokens.
|
|
917
1082
|
|
|
918
1083
|
- You provided: \`${value}\`
|
|
@@ -967,7 +1132,7 @@ function generateTokenCss(ctx, varRoot) {
|
|
|
967
1132
|
|
|
968
1133
|
// src/generators/token-dts.ts
|
|
969
1134
|
import { unionType as unionType4, capitalize as capitalize9 } from "@pandacss/shared";
|
|
970
|
-
import { outdent as
|
|
1135
|
+
import { outdent as outdent19 } from "outdent";
|
|
971
1136
|
import { singular } from "pluralize";
|
|
972
1137
|
function generateTokenDts(dict) {
|
|
973
1138
|
const set = /* @__PURE__ */ new Set();
|
|
@@ -985,11 +1150,11 @@ function generateTokenDts(dict) {
|
|
|
985
1150
|
}
|
|
986
1151
|
interfaceSet.add("}");
|
|
987
1152
|
set.add(Array.from(interfaceSet).join("\n"));
|
|
988
|
-
return
|
|
1153
|
+
return outdent19.string(Array.from(set).join("\n\n"));
|
|
989
1154
|
}
|
|
990
1155
|
|
|
991
1156
|
// src/generators/token-js.ts
|
|
992
|
-
import
|
|
1157
|
+
import outdent20 from "outdent";
|
|
993
1158
|
function generateTokenJs(dict) {
|
|
994
1159
|
const map = /* @__PURE__ */ new Map();
|
|
995
1160
|
dict.allTokens.forEach((token) => {
|
|
@@ -999,7 +1164,7 @@ function generateTokenJs(dict) {
|
|
|
999
1164
|
});
|
|
1000
1165
|
const obj = Object.fromEntries(map);
|
|
1001
1166
|
return {
|
|
1002
|
-
js:
|
|
1167
|
+
js: outdent20`
|
|
1003
1168
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1004
1169
|
|
|
1005
1170
|
function getToken(path) {
|
|
@@ -1012,7 +1177,7 @@ function generateTokenJs(dict) {
|
|
|
1012
1177
|
return variable
|
|
1013
1178
|
}
|
|
1014
1179
|
`,
|
|
1015
|
-
dts:
|
|
1180
|
+
dts: outdent20`
|
|
1016
1181
|
import { Token } from "../types/token"
|
|
1017
1182
|
export declare function getToken(path: Token): string
|
|
1018
1183
|
export declare function getTokenVar(path: Token): string
|
|
@@ -1022,7 +1187,7 @@ function generateTokenJs(dict) {
|
|
|
1022
1187
|
|
|
1023
1188
|
// src/generators/types.ts
|
|
1024
1189
|
import { readFileSync as readFileSync2 } from "fs-extra";
|
|
1025
|
-
import
|
|
1190
|
+
import outdent21 from "outdent";
|
|
1026
1191
|
function getType(file) {
|
|
1027
1192
|
const filepath = getEntrypoint("@pandacss/types", { dev: file });
|
|
1028
1193
|
return readFileSync2(filepath, "utf8");
|
|
@@ -1032,7 +1197,7 @@ function generateCssType(ctx) {
|
|
|
1032
1197
|
return {
|
|
1033
1198
|
cssType: getType("csstype.d.ts"),
|
|
1034
1199
|
pandaCssType: getType("system-types.d.ts"),
|
|
1035
|
-
publicType:
|
|
1200
|
+
publicType: outdent21`
|
|
1036
1201
|
import * as System from './system-types'
|
|
1037
1202
|
import { PropTypes } from './prop-type'
|
|
1038
1203
|
import { Conditions } from './conditions'
|
|
@@ -1153,7 +1318,7 @@ function setupPatterns(ctx) {
|
|
|
1153
1318
|
if (!files) {
|
|
1154
1319
|
return { files: [] };
|
|
1155
1320
|
}
|
|
1156
|
-
const indexCode =
|
|
1321
|
+
const indexCode = outdent22.string(files.map((file) => `export * from './${file.name}'`).join("\n"));
|
|
1157
1322
|
return {
|
|
1158
1323
|
dir: ctx.paths.pattern,
|
|
1159
1324
|
files: [
|
|
@@ -1170,15 +1335,19 @@ function setupJsx(ctx) {
|
|
|
1170
1335
|
const isValidProp = generateisValidProp(ctx);
|
|
1171
1336
|
const factory = generateJsxFactory(ctx);
|
|
1172
1337
|
const patterns = generateJsxPatterns(ctx);
|
|
1173
|
-
const
|
|
1338
|
+
const layoutGrid = generateLayoutGrid(ctx);
|
|
1339
|
+
const indexCode = outdent22`
|
|
1174
1340
|
export * from './factory'
|
|
1175
|
-
|
|
1341
|
+
export * from './layout-grid'
|
|
1342
|
+
${outdent22.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
1176
1343
|
`;
|
|
1177
1344
|
return {
|
|
1178
1345
|
dir: ctx.paths.jsx,
|
|
1179
1346
|
files: [
|
|
1180
1347
|
...patterns.map((file) => ({ file: `${file.name}.jsx`, code: file.js })),
|
|
1181
1348
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
1349
|
+
{ file: "layout-grid.jsx", code: layoutGrid.js },
|
|
1350
|
+
{ file: "layout-grid.d.ts", code: layoutGrid.dts },
|
|
1182
1351
|
{ file: "is-valid-prop.js", code: isValidProp.js },
|
|
1183
1352
|
{ file: "factory.d.ts", code: factory.dts },
|
|
1184
1353
|
{ file: "factory.jsx", code: factory.js },
|
|
@@ -1188,7 +1357,7 @@ function setupJsx(ctx) {
|
|
|
1188
1357
|
};
|
|
1189
1358
|
}
|
|
1190
1359
|
function setupCssIndex(ctx) {
|
|
1191
|
-
const code =
|
|
1360
|
+
const code = outdent22`
|
|
1192
1361
|
export * from './css'
|
|
1193
1362
|
export * from './cx'
|
|
1194
1363
|
export * from './global-css'
|
|
@@ -1209,7 +1378,7 @@ function setupReset(ctx) {
|
|
|
1209
1378
|
return { files: [{ file: "reset.css", code }] };
|
|
1210
1379
|
}
|
|
1211
1380
|
function setupGitIgnore(ctx) {
|
|
1212
|
-
const txt =
|
|
1381
|
+
const txt = outdent22`## CSS Panda
|
|
1213
1382
|
${ctx.outdir}
|
|
1214
1383
|
`;
|
|
1215
1384
|
const file = lookItUpSync(".gitignore");
|
|
@@ -1248,30 +1417,30 @@ function generateSystem(ctx) {
|
|
|
1248
1417
|
|
|
1249
1418
|
// src/messages.ts
|
|
1250
1419
|
import { colors, logger as logger3, quote as quote2 } from "@pandacss/logger";
|
|
1251
|
-
import { outdent as
|
|
1420
|
+
import { outdent as outdent23 } from "outdent";
|
|
1252
1421
|
var tick = colors.green().bold("\u2714\uFE0F");
|
|
1253
1422
|
function artifactsGeneratedMessage(ctx) {
|
|
1254
1423
|
return [
|
|
1255
|
-
|
|
1424
|
+
outdent23`
|
|
1256
1425
|
${tick} ${quote2(ctx.outdir, "/css")}: the css function to author styles
|
|
1257
1426
|
`,
|
|
1258
|
-
ctx.hasTokens &&
|
|
1427
|
+
ctx.hasTokens && outdent23`
|
|
1259
1428
|
${tick} ${quote2(ctx.outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
1260
1429
|
`,
|
|
1261
|
-
ctx.hasPattern &&
|
|
1430
|
+
ctx.hasPattern && outdent23`
|
|
1262
1431
|
${tick} ${quote2(ctx.outdir, "/patterns")}: functions to implement common css patterns
|
|
1263
1432
|
`,
|
|
1264
|
-
ctx.hasRecipes &&
|
|
1433
|
+
ctx.hasRecipes && outdent23`
|
|
1265
1434
|
${tick} ${quote2(ctx.outdir, "/recipes")}: functions to create multi-variant styles
|
|
1266
1435
|
`,
|
|
1267
|
-
ctx.jsxFramework &&
|
|
1436
|
+
ctx.jsxFramework && outdent23`
|
|
1268
1437
|
${tick} ${quote2(ctx.outdir, "/jsx")}: style prop powered elements for ${ctx.jsxFramework}
|
|
1269
1438
|
`,
|
|
1270
1439
|
"\n"
|
|
1271
1440
|
].filter(Boolean).join("\n");
|
|
1272
1441
|
}
|
|
1273
1442
|
function configExistsMessage(cmd) {
|
|
1274
|
-
return
|
|
1443
|
+
return outdent23`
|
|
1275
1444
|
\n
|
|
1276
1445
|
It looks like you already have panda created\`.
|
|
1277
1446
|
|
|
@@ -1280,7 +1449,7 @@ function configExistsMessage(cmd) {
|
|
|
1280
1449
|
`;
|
|
1281
1450
|
}
|
|
1282
1451
|
function thankYouMessage() {
|
|
1283
|
-
return
|
|
1452
|
+
return outdent23`
|
|
1284
1453
|
|
|
1285
1454
|
🚀 Thanks for choosing ${colors.cyan("Panda")} to write your css.
|
|
1286
1455
|
|
|
@@ -1292,7 +1461,7 @@ var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
|
|
|
1292
1461
|
var pickRandom = (arr) => arr[Math.floor(Math.random() * arr.length)];
|
|
1293
1462
|
function scaffoldCompleteMessage() {
|
|
1294
1463
|
return logger3.box(
|
|
1295
|
-
|
|
1464
|
+
outdent23`
|
|
1296
1465
|
|
|
1297
1466
|
${colors.bold().cyan("Next steps:")}
|
|
1298
1467
|
|
|
@@ -1924,7 +2093,7 @@ async function generate5(config, configPath) {
|
|
|
1924
2093
|
import { logger as logger8, quote as quote3 } from "@pandacss/logger";
|
|
1925
2094
|
import { writeFile as writeFile2 } from "fs-extra";
|
|
1926
2095
|
import { lookItUpSync as lookItUpSync3 } from "look-it-up";
|
|
1927
|
-
import { outdent as
|
|
2096
|
+
import { outdent as outdent24 } from "outdent";
|
|
1928
2097
|
import { join as join4 } from "path";
|
|
1929
2098
|
import getPackageManager2 from "preferred-pm";
|
|
1930
2099
|
async function setupConfig(cwd, { force }) {
|
|
@@ -1938,7 +2107,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
1938
2107
|
if (!force && configFile) {
|
|
1939
2108
|
logger8.warn("config exists", configExistsMessage(cmd));
|
|
1940
2109
|
} else {
|
|
1941
|
-
const content =
|
|
2110
|
+
const content = outdent24`
|
|
1942
2111
|
import { defineConfig } from "css-panda"
|
|
1943
2112
|
|
|
1944
2113
|
export default defineConfig({
|
|
@@ -1964,7 +2133,7 @@ async function setupConfig(cwd, { force }) {
|
|
|
1964
2133
|
}
|
|
1965
2134
|
async function setupPostcss(cwd) {
|
|
1966
2135
|
logger8.info({ type: "init", msg: `creating postcss config file: ${quote3("postcss.config.cjs")}` });
|
|
1967
|
-
const content =
|
|
2136
|
+
const content = outdent24`
|
|
1968
2137
|
module.exports = {
|
|
1969
2138
|
plugins: {
|
|
1970
2139
|
'css-panda/postcss': {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20221124141119",
|
|
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-
|
|
34
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
35
|
-
"@pandacss/error": "0.0.0-dev-
|
|
36
|
-
"@pandacss/parser": "0.0.0-dev-
|
|
37
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
38
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
39
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
40
|
-
"@pandacss/core": "0.0.0-dev-
|
|
41
|
-
"@pandacss/config": "0.0.0-dev-
|
|
33
|
+
"@pandacss/types": "0.0.0-dev-20221124141119",
|
|
34
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20221124141119",
|
|
35
|
+
"@pandacss/error": "0.0.0-dev-20221124141119",
|
|
36
|
+
"@pandacss/parser": "0.0.0-dev-20221124141119",
|
|
37
|
+
"@pandacss/shared": "0.0.0-dev-20221124141119",
|
|
38
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20221124141119",
|
|
39
|
+
"@pandacss/logger": "0.0.0-dev-20221124141119",
|
|
40
|
+
"@pandacss/core": "0.0.0-dev-20221124141119",
|
|
41
|
+
"@pandacss/config": "0.0.0-dev-20221124141119"
|
|
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-
|
|
49
|
+
"@pandacss/fixture": "0.0.0-dev-20221124141119"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsup src/index.ts --format=cjs,esm --shims --dts",
|