@pandacss/generator 0.0.0-dev-20230505185444 → 0.0.0-dev-20230509102236
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 +98 -369
- package/dist/index.mjs +98 -369
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -96,7 +96,7 @@ var getMessages = (ctx) => ({
|
|
|
96
96
|
import { Obj as Obj4, pipe as pipe5 } from "lil-fp";
|
|
97
97
|
|
|
98
98
|
// src/artifacts/index.ts
|
|
99
|
-
import
|
|
99
|
+
import outdent25 from "outdent";
|
|
100
100
|
|
|
101
101
|
// src/artifacts/css/keyframe-css.ts
|
|
102
102
|
import { toCss } from "@pandacss/core";
|
|
@@ -121,45 +121,9 @@ function generateKeyframeCss(ctx) {
|
|
|
121
121
|
return rule.toString();
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
// src/artifacts/css/layout-grid-css.ts
|
|
125
|
-
import { outdent as outdent2 } from "outdent";
|
|
126
|
-
var css = String.raw;
|
|
127
|
-
var layoutGrid = css`
|
|
128
|
-
.panda-layout-grid {
|
|
129
|
-
display: grid;
|
|
130
|
-
gap: var(--gutter);
|
|
131
|
-
grid-template-columns: repeat(var(--count), 1fr);
|
|
132
|
-
height: 100%;
|
|
133
|
-
width: 100%;
|
|
134
|
-
position: absolute;
|
|
135
|
-
inset: 0;
|
|
136
|
-
pointer-events: none;
|
|
137
|
-
max-width: var(--max-width);
|
|
138
|
-
margin-inline: var(--margin-x);
|
|
139
|
-
padding-inline: var(--padding-x);
|
|
140
|
-
}
|
|
141
|
-
.panda-layout-grid__item {
|
|
142
|
-
display: flex;
|
|
143
|
-
--color: rgba(255, 0, 0, 0.1);
|
|
144
|
-
height: 100%;
|
|
145
|
-
}
|
|
146
|
-
.panda-layout-grid__item[data-variant='bg'] {
|
|
147
|
-
background: var(--color);
|
|
148
|
-
}
|
|
149
|
-
.panda-layout-grid__item[data-variant='outline'] {
|
|
150
|
-
border-inline: 1px solid var(--color);
|
|
151
|
-
}
|
|
152
|
-
`;
|
|
153
|
-
function generateLayoutGridCss() {
|
|
154
|
-
return outdent2`
|
|
155
|
-
@layer base {
|
|
156
|
-
${layoutGrid}
|
|
157
|
-
}`;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
124
|
// src/artifacts/css/reset-css.ts
|
|
161
|
-
var
|
|
162
|
-
var reset =
|
|
125
|
+
var css = String.raw;
|
|
126
|
+
var reset = css`
|
|
163
127
|
* {
|
|
164
128
|
margin: 0;
|
|
165
129
|
}
|
|
@@ -278,11 +242,11 @@ function generateTokenCss(ctx) {
|
|
|
278
242
|
if (Object.keys(varsObj).length === 0)
|
|
279
243
|
continue;
|
|
280
244
|
if (key === "base") {
|
|
281
|
-
const { css:
|
|
282
|
-
results.push(
|
|
245
|
+
const { css: css3 } = toCss2({ [root]: varsObj });
|
|
246
|
+
results.push(css3);
|
|
283
247
|
} else {
|
|
284
248
|
const keys = key.split(":");
|
|
285
|
-
const { css:
|
|
249
|
+
const { css: css3 } = toCss2(varsObj);
|
|
286
250
|
const mapped = keys.map((key2) => conditions.get(key2)).filter(Boolean).map((condition) => {
|
|
287
251
|
const parent = extractParentSelectors(condition);
|
|
288
252
|
return parent ? `&${parent}` : condition;
|
|
@@ -290,13 +254,13 @@ function generateTokenCss(ctx) {
|
|
|
290
254
|
const rule = getDeepestRule(root, mapped);
|
|
291
255
|
if (!rule)
|
|
292
256
|
continue;
|
|
293
|
-
getDeepestNode(rule)?.append(
|
|
257
|
+
getDeepestNode(rule)?.append(css3);
|
|
294
258
|
results.push(expandNestedCss(rule.toString()));
|
|
295
259
|
}
|
|
296
260
|
}
|
|
297
|
-
const
|
|
261
|
+
const css2 = results.join("\n\n");
|
|
298
262
|
return `@layer tokens {
|
|
299
|
-
${prettifyCss(cleanupSelectors(
|
|
263
|
+
${prettifyCss(cleanupSelectors(css2, root))}
|
|
300
264
|
}
|
|
301
265
|
`;
|
|
302
266
|
}
|
|
@@ -320,8 +284,8 @@ function getDeepestNode(node) {
|
|
|
320
284
|
}
|
|
321
285
|
return node;
|
|
322
286
|
}
|
|
323
|
-
function cleanupSelectors(
|
|
324
|
-
const root = postcss2.parse(
|
|
287
|
+
function cleanupSelectors(css2, varSelector) {
|
|
288
|
+
const root = postcss2.parse(css2);
|
|
325
289
|
root.walkRules((rule) => {
|
|
326
290
|
rule.selectors.forEach((selector) => {
|
|
327
291
|
const res = selector.split(varSelector).filter(Boolean);
|
|
@@ -334,11 +298,11 @@ function cleanupSelectors(css3, varSelector) {
|
|
|
334
298
|
}
|
|
335
299
|
|
|
336
300
|
// src/artifacts/js/conditions.ts
|
|
337
|
-
import
|
|
301
|
+
import outdent2 from "outdent";
|
|
338
302
|
function generateConditions(ctx) {
|
|
339
303
|
const keys = Object.keys(ctx.conditions.values).concat("base");
|
|
340
304
|
return {
|
|
341
|
-
js:
|
|
305
|
+
js: outdent2`
|
|
342
306
|
${ctx.file.import("withoutSpace", "../helpers")}
|
|
343
307
|
|
|
344
308
|
const conditions = new Set([${keys.map((key) => JSON.stringify(key))}])
|
|
@@ -373,7 +337,7 @@ function generateConditions(ctx) {
|
|
|
373
337
|
})
|
|
374
338
|
}
|
|
375
339
|
`,
|
|
376
|
-
dts:
|
|
340
|
+
dts: outdent2`
|
|
377
341
|
import type { AnySelector, Selectors } from './selectors'
|
|
378
342
|
|
|
379
343
|
export type Conditions = {
|
|
@@ -404,7 +368,7 @@ function generateConditions(ctx) {
|
|
|
404
368
|
}
|
|
405
369
|
|
|
406
370
|
// src/artifacts/js/css-fn.ts
|
|
407
|
-
import { outdent as
|
|
371
|
+
import { outdent as outdent3 } from "outdent";
|
|
408
372
|
var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
|
|
409
373
|
function generateCssFn(ctx) {
|
|
410
374
|
const {
|
|
@@ -414,11 +378,11 @@ function generateCssFn(ctx) {
|
|
|
414
378
|
} = ctx;
|
|
415
379
|
const { separator } = utility;
|
|
416
380
|
return {
|
|
417
|
-
dts:
|
|
381
|
+
dts: outdent3`
|
|
418
382
|
import type { SystemStyleObject } from '../types'
|
|
419
383
|
export declare function css(styles: SystemStyleObject): string
|
|
420
384
|
`,
|
|
421
|
-
js:
|
|
385
|
+
js: outdent3`
|
|
422
386
|
${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
|
|
423
387
|
${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
|
|
424
388
|
|
|
@@ -462,10 +426,10 @@ function generateCssFn(ctx) {
|
|
|
462
426
|
}
|
|
463
427
|
|
|
464
428
|
// src/artifacts/js/cva.ts
|
|
465
|
-
import { outdent as
|
|
429
|
+
import { outdent as outdent4 } from "outdent";
|
|
466
430
|
function generateCvaFn(ctx) {
|
|
467
431
|
return {
|
|
468
|
-
js:
|
|
432
|
+
js: outdent4`
|
|
469
433
|
${ctx.file.import("compact", "../helpers")}
|
|
470
434
|
${ctx.file.import("css, mergeCss", "./css")}
|
|
471
435
|
|
|
@@ -523,7 +487,7 @@ function generateCvaFn(ctx) {
|
|
|
523
487
|
}
|
|
524
488
|
|
|
525
489
|
`,
|
|
526
|
-
dts:
|
|
490
|
+
dts: outdent4`
|
|
527
491
|
import type { RecipeCreatorFn } from '../types/recipe'
|
|
528
492
|
|
|
529
493
|
export declare const cva: RecipeCreatorFn
|
|
@@ -535,10 +499,10 @@ function generateCvaFn(ctx) {
|
|
|
535
499
|
}
|
|
536
500
|
|
|
537
501
|
// src/artifacts/js/cx.ts
|
|
538
|
-
import
|
|
502
|
+
import outdent5 from "outdent";
|
|
539
503
|
function generateCx() {
|
|
540
504
|
return {
|
|
541
|
-
js:
|
|
505
|
+
js: outdent5`
|
|
542
506
|
function cx() {
|
|
543
507
|
let str = '',
|
|
544
508
|
i = 0,
|
|
@@ -555,7 +519,7 @@ function generateCx() {
|
|
|
555
519
|
|
|
556
520
|
export { cx }
|
|
557
521
|
`,
|
|
558
|
-
dts:
|
|
522
|
+
dts: outdent5`
|
|
559
523
|
type Argument = string | boolean | null | undefined
|
|
560
524
|
|
|
561
525
|
/** Conditionally join classNames into a single string */
|
|
@@ -565,7 +529,7 @@ function generateCx() {
|
|
|
565
529
|
}
|
|
566
530
|
|
|
567
531
|
// src/artifacts/js/helpers.ts
|
|
568
|
-
import { outdent as
|
|
532
|
+
import { outdent as outdent6 } from "outdent";
|
|
569
533
|
|
|
570
534
|
// src/artifacts/generated/helpers.mjs.json
|
|
571
535
|
var helpers_mjs_default = {
|
|
@@ -575,7 +539,7 @@ var helpers_mjs_default = {
|
|
|
575
539
|
// src/artifacts/js/helpers.ts
|
|
576
540
|
function generateHelpers() {
|
|
577
541
|
return {
|
|
578
|
-
js:
|
|
542
|
+
js: outdent6`
|
|
579
543
|
${helpers_mjs_default.content}
|
|
580
544
|
|
|
581
545
|
export function __spreadValues(a, b){
|
|
@@ -609,7 +573,7 @@ function generateisValidProp(ctx) {
|
|
|
609
573
|
// src/artifacts/js/pattern.ts
|
|
610
574
|
import { unionType } from "@pandacss/shared";
|
|
611
575
|
import { stringify as stringify2 } from "javascript-stringify";
|
|
612
|
-
import { outdent as
|
|
576
|
+
import { outdent as outdent7 } from "outdent";
|
|
613
577
|
import { match } from "ts-pattern";
|
|
614
578
|
function generatePattern(ctx) {
|
|
615
579
|
if (ctx.patterns.isEmpty())
|
|
@@ -627,7 +591,7 @@ function generatePattern(ctx) {
|
|
|
627
591
|
}
|
|
628
592
|
return {
|
|
629
593
|
name: dashName,
|
|
630
|
-
dts:
|
|
594
|
+
dts: outdent7`
|
|
631
595
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
632
596
|
import type { PropertyValue } from '../types/prop-type'
|
|
633
597
|
import type { Properties } from '../types/csstype'
|
|
@@ -651,7 +615,7 @@ function generatePattern(ctx) {
|
|
|
651
615
|
}).join("\n ")}
|
|
652
616
|
}
|
|
653
617
|
|
|
654
|
-
${strict ?
|
|
618
|
+
${strict ? outdent7`export declare function ${name}(options: ${upperName}Properties): string` : outdent7`
|
|
655
619
|
|
|
656
620
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
657
621
|
|
|
@@ -660,7 +624,7 @@ function generatePattern(ctx) {
|
|
|
660
624
|
`}
|
|
661
625
|
|
|
662
626
|
`,
|
|
663
|
-
js:
|
|
627
|
+
js: outdent7`
|
|
664
628
|
${ctx.file.import(helperImports.join(", "), "../helpers")}
|
|
665
629
|
${ctx.file.import("css", "../css/index")}
|
|
666
630
|
|
|
@@ -677,7 +641,7 @@ transform`)}
|
|
|
677
641
|
|
|
678
642
|
// src/artifacts/js/recipe.ts
|
|
679
643
|
import { unionType as unionType2 } from "@pandacss/shared";
|
|
680
|
-
import { outdent as
|
|
644
|
+
import { outdent as outdent8 } from "outdent";
|
|
681
645
|
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
682
646
|
function generateRecipes(ctx) {
|
|
683
647
|
const {
|
|
@@ -690,7 +654,7 @@ function generateRecipes(ctx) {
|
|
|
690
654
|
const createRecipeFn = {
|
|
691
655
|
name: "create-recipe",
|
|
692
656
|
dts: "",
|
|
693
|
-
js:
|
|
657
|
+
js: outdent8`
|
|
694
658
|
${ctx.file.import("css", "../css/css")}
|
|
695
659
|
${ctx.file.import("assertCompoundVariant, getCompoundVariantCss", "../css/cva")}
|
|
696
660
|
${ctx.file.import("cx", "../css/cx")}
|
|
@@ -737,7 +701,7 @@ function generateRecipes(ctx) {
|
|
|
737
701
|
const { name, description, defaultVariants, compoundVariants } = config;
|
|
738
702
|
return {
|
|
739
703
|
name: dashName,
|
|
740
|
-
js:
|
|
704
|
+
js: outdent8`
|
|
741
705
|
${ctx.file.import("splitProps", "../helpers")}
|
|
742
706
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
743
707
|
|
|
@@ -750,7 +714,7 @@ function generateRecipes(ctx) {
|
|
|
750
714
|
const variantKeys = ${stringify3(Object.keys(variantKeyMap))}
|
|
751
715
|
${name}.splitVariantProps = (props) => splitProps(props, variantKeys)
|
|
752
716
|
`,
|
|
753
|
-
dts:
|
|
717
|
+
dts: outdent8`
|
|
754
718
|
import type { ConditionalValue } from '../types'
|
|
755
719
|
import type { Pretty } from '../types/helpers'
|
|
756
720
|
|
|
@@ -781,7 +745,7 @@ function generateRecipes(ctx) {
|
|
|
781
745
|
}
|
|
782
746
|
|
|
783
747
|
// src/artifacts/js/token.ts
|
|
784
|
-
import
|
|
748
|
+
import outdent9 from "outdent";
|
|
785
749
|
function generateTokenJs(ctx) {
|
|
786
750
|
const { tokens } = ctx;
|
|
787
751
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -792,7 +756,7 @@ function generateTokenJs(ctx) {
|
|
|
792
756
|
});
|
|
793
757
|
const obj = Object.fromEntries(map);
|
|
794
758
|
return {
|
|
795
|
-
js:
|
|
759
|
+
js: outdent9`
|
|
796
760
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
797
761
|
|
|
798
762
|
export function token(path, fallback) {
|
|
@@ -805,7 +769,7 @@ function generateTokenJs(ctx) {
|
|
|
805
769
|
|
|
806
770
|
token.var = tokenVar
|
|
807
771
|
`,
|
|
808
|
-
dts:
|
|
772
|
+
dts: outdent9`
|
|
809
773
|
import type { Token } from '../types/tokens'
|
|
810
774
|
|
|
811
775
|
export declare const token: {
|
|
@@ -817,11 +781,11 @@ function generateTokenJs(ctx) {
|
|
|
817
781
|
}
|
|
818
782
|
|
|
819
783
|
// src/artifacts/preact-jsx/jsx.ts
|
|
820
|
-
import { outdent as
|
|
784
|
+
import { outdent as outdent10 } from "outdent";
|
|
821
785
|
function generatePreactJsxFactory(ctx) {
|
|
822
786
|
const { factoryName, componentName } = ctx.jsx;
|
|
823
787
|
return {
|
|
824
|
-
js:
|
|
788
|
+
js: outdent10`
|
|
825
789
|
import { h } from 'preact'
|
|
826
790
|
import { forwardRef } from 'preact/compat'
|
|
827
791
|
import { useMemo } from 'preact/hooks'
|
|
@@ -879,53 +843,8 @@ function generatePreactJsxFactory(ctx) {
|
|
|
879
843
|
};
|
|
880
844
|
}
|
|
881
845
|
|
|
882
|
-
// src/artifacts/preact-jsx/layout-grid.ts
|
|
883
|
-
import { outdent as outdent12 } from "outdent";
|
|
884
|
-
function generatePreactLayoutGrid() {
|
|
885
|
-
return {
|
|
886
|
-
dts: outdent12`
|
|
887
|
-
import { FunctionComponent } from 'preact'
|
|
888
|
-
|
|
889
|
-
export type LayoutGridProps = {
|
|
890
|
-
count?: number
|
|
891
|
-
gutter?: string
|
|
892
|
-
maxWidth?: string
|
|
893
|
-
margin?: string
|
|
894
|
-
outline?: boolean
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
898
|
-
`,
|
|
899
|
-
js: outdent12`
|
|
900
|
-
import { h } from 'preact'
|
|
901
|
-
|
|
902
|
-
export function LayoutGrid(props) {
|
|
903
|
-
const { count = 12, margin, gutter = '24px', maxWidth, outline } = props
|
|
904
|
-
const hasMaxWidth = maxWidth != null
|
|
905
|
-
return h('div', {
|
|
906
|
-
className: 'panda-layout-grid',
|
|
907
|
-
style: {
|
|
908
|
-
'--gutter': gutter,
|
|
909
|
-
'--count': count,
|
|
910
|
-
'--max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
911
|
-
'--margin-x': hasMaxWidth ? 'auto' : undefined,
|
|
912
|
-
'--padding-x': !hasMaxWidth ? margin : undefined,
|
|
913
|
-
},
|
|
914
|
-
children: Array.from({ length: count }).map((_, i) =>
|
|
915
|
-
h('span', {
|
|
916
|
-
'data-variant': outline ? 'outline' : 'bg',
|
|
917
|
-
key: i,
|
|
918
|
-
className: 'panda-layout-grid__item',
|
|
919
|
-
}),
|
|
920
|
-
),
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
`
|
|
924
|
-
};
|
|
925
|
-
}
|
|
926
|
-
|
|
927
846
|
// src/artifacts/preact-jsx/pattern.ts
|
|
928
|
-
import { outdent as
|
|
847
|
+
import { outdent as outdent11 } from "outdent";
|
|
929
848
|
import { match as match2 } from "ts-pattern";
|
|
930
849
|
function generatePreactJsxPattern(ctx) {
|
|
931
850
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -934,7 +853,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
934
853
|
const { description, jsxElement = "div" } = pattern.config;
|
|
935
854
|
return {
|
|
936
855
|
name: dashName,
|
|
937
|
-
js:
|
|
856
|
+
js: outdent11`
|
|
938
857
|
import { h } from 'preact'
|
|
939
858
|
import { forwardRef } from 'preact/compat'
|
|
940
859
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -943,11 +862,11 @@ function generatePreactJsxPattern(ctx) {
|
|
|
943
862
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
944
863
|
${match2(props.length).with(
|
|
945
864
|
0,
|
|
946
|
-
() =>
|
|
865
|
+
() => outdent11`
|
|
947
866
|
return h(${factoryName}.${jsxElement}, { ref, ...props })
|
|
948
867
|
`
|
|
949
868
|
).otherwise(
|
|
950
|
-
() =>
|
|
869
|
+
() => outdent11`
|
|
951
870
|
const { ${props.join(", ")}, ...restProps } = props
|
|
952
871
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
953
872
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -955,7 +874,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
955
874
|
)}
|
|
956
875
|
})
|
|
957
876
|
`,
|
|
958
|
-
dts:
|
|
877
|
+
dts: outdent11`
|
|
959
878
|
import type { FunctionComponent } from 'preact'
|
|
960
879
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
961
880
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -970,15 +889,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
970
889
|
}
|
|
971
890
|
|
|
972
891
|
// src/artifacts/preact-jsx/types.ts
|
|
973
|
-
import { outdent as
|
|
892
|
+
import { outdent as outdent12 } from "outdent";
|
|
974
893
|
function generatePreactJsxTypes(ctx) {
|
|
975
894
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
976
895
|
return {
|
|
977
|
-
jsxFactory:
|
|
896
|
+
jsxFactory: outdent12`
|
|
978
897
|
import type { ${upperName} } from '../types/jsx'
|
|
979
898
|
export declare const ${factoryName}: ${upperName}
|
|
980
899
|
`,
|
|
981
|
-
jsxType:
|
|
900
|
+
jsxType: outdent12`
|
|
982
901
|
import type { JSX, ComponentProps } from 'preact'
|
|
983
902
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
984
903
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1002,11 +921,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1002
921
|
}
|
|
1003
922
|
|
|
1004
923
|
// src/artifacts/react-jsx/jsx.ts
|
|
1005
|
-
import { outdent as
|
|
924
|
+
import { outdent as outdent13 } from "outdent";
|
|
1006
925
|
function generateReactJsxFactory(ctx) {
|
|
1007
926
|
const { factoryName, componentName } = ctx.jsx;
|
|
1008
927
|
return {
|
|
1009
|
-
js:
|
|
928
|
+
js: outdent13`
|
|
1010
929
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1011
930
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1012
931
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1063,53 +982,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
1063
982
|
};
|
|
1064
983
|
}
|
|
1065
984
|
|
|
1066
|
-
// src/artifacts/react-jsx/layout-grid.ts
|
|
1067
|
-
import { outdent as outdent16 } from "outdent";
|
|
1068
|
-
function generateReactLayoutGrid() {
|
|
1069
|
-
return {
|
|
1070
|
-
dts: outdent16`
|
|
1071
|
-
import type { FunctionComponent } from 'react'
|
|
1072
|
-
|
|
1073
|
-
export type LayoutGridProps = {
|
|
1074
|
-
count?: number
|
|
1075
|
-
gutter?: string
|
|
1076
|
-
maxWidth?: string
|
|
1077
|
-
margin?: string
|
|
1078
|
-
outline?: boolean
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
1082
|
-
`,
|
|
1083
|
-
js: outdent16`
|
|
1084
|
-
import { createElement } from 'react'
|
|
1085
|
-
|
|
1086
|
-
export function LayoutGrid(props) {
|
|
1087
|
-
const { count = 12, margin, gutter = '24px', maxWidth, outline } = props
|
|
1088
|
-
const hasMaxWidth = maxWidth != null
|
|
1089
|
-
return createElement('div', {
|
|
1090
|
-
className: 'panda-layout-grid',
|
|
1091
|
-
style: {
|
|
1092
|
-
'--gutter': gutter,
|
|
1093
|
-
'--count': count,
|
|
1094
|
-
'--max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
1095
|
-
'--margin-x': hasMaxWidth ? 'auto' : undefined,
|
|
1096
|
-
'--padding-x': !hasMaxWidth ? margin : undefined,
|
|
1097
|
-
},
|
|
1098
|
-
children: Array.from({ length: count }).map((_, i) =>
|
|
1099
|
-
createElement('span', {
|
|
1100
|
-
'data-variant': outline ? 'outline' : 'bg',
|
|
1101
|
-
key: i,
|
|
1102
|
-
className: 'panda-layout-grid__item',
|
|
1103
|
-
}),
|
|
1104
|
-
),
|
|
1105
|
-
})
|
|
1106
|
-
}
|
|
1107
|
-
`
|
|
1108
|
-
};
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
985
|
// src/artifacts/react-jsx/pattern.ts
|
|
1112
|
-
import { outdent as
|
|
986
|
+
import { outdent as outdent14 } from "outdent";
|
|
1113
987
|
import { match as match3 } from "ts-pattern";
|
|
1114
988
|
function generateReactJsxPattern(ctx) {
|
|
1115
989
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1118,7 +992,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1118
992
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1119
993
|
return {
|
|
1120
994
|
name: dashName,
|
|
1121
|
-
js:
|
|
995
|
+
js: outdent14`
|
|
1122
996
|
import { createElement, forwardRef } from 'react'
|
|
1123
997
|
${ctx.file.import(factoryName, "./factory")}
|
|
1124
998
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1126,11 +1000,11 @@ function generateReactJsxPattern(ctx) {
|
|
|
1126
1000
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1127
1001
|
${match3(props.length).with(
|
|
1128
1002
|
0,
|
|
1129
|
-
() =>
|
|
1003
|
+
() => outdent14`
|
|
1130
1004
|
return createElement(${factoryName}.${jsxElement}, { ref, ...props })
|
|
1131
1005
|
`
|
|
1132
1006
|
).otherwise(
|
|
1133
|
-
() =>
|
|
1007
|
+
() => outdent14`
|
|
1134
1008
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1135
1009
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1136
1010
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1138,7 +1012,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1138
1012
|
)}
|
|
1139
1013
|
})
|
|
1140
1014
|
`,
|
|
1141
|
-
dts:
|
|
1015
|
+
dts: outdent14`
|
|
1142
1016
|
import type { FunctionComponent } from 'react'
|
|
1143
1017
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1144
1018
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1153,15 +1027,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1153
1027
|
}
|
|
1154
1028
|
|
|
1155
1029
|
// src/artifacts/react-jsx/types.ts
|
|
1156
|
-
import { outdent as
|
|
1030
|
+
import { outdent as outdent15 } from "outdent";
|
|
1157
1031
|
function generateReactJsxTypes(ctx) {
|
|
1158
1032
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1159
1033
|
return {
|
|
1160
|
-
jsxFactory:
|
|
1034
|
+
jsxFactory: outdent15`
|
|
1161
1035
|
import { ${upperName} } from '../types/jsx'
|
|
1162
1036
|
export declare const ${factoryName}: ${upperName}
|
|
1163
1037
|
`,
|
|
1164
|
-
jsxType:
|
|
1038
|
+
jsxType: outdent15`
|
|
1165
1039
|
import type { ElementType, ComponentProps } from 'react'
|
|
1166
1040
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1167
1041
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1183,11 +1057,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1183
1057
|
}
|
|
1184
1058
|
|
|
1185
1059
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1186
|
-
import { outdent as
|
|
1060
|
+
import { outdent as outdent16 } from "outdent";
|
|
1187
1061
|
function generateSolidJsxFactory(ctx) {
|
|
1188
1062
|
const { componentName, factoryName } = ctx.jsx;
|
|
1189
1063
|
return {
|
|
1190
|
-
js:
|
|
1064
|
+
js: outdent16`
|
|
1191
1065
|
import { Dynamic } from 'solid-js/web'
|
|
1192
1066
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1193
1067
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1255,59 +1129,8 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1255
1129
|
};
|
|
1256
1130
|
}
|
|
1257
1131
|
|
|
1258
|
-
// src/artifacts/solid-jsx/layout-grid.ts
|
|
1259
|
-
import { outdent as outdent20 } from "outdent";
|
|
1260
|
-
function generateSolidLayoutGrid() {
|
|
1261
|
-
return {
|
|
1262
|
-
dts: outdent20`
|
|
1263
|
-
import type { ParentProps } from 'solid-js'
|
|
1264
|
-
|
|
1265
|
-
export type LayoutGridProps = {
|
|
1266
|
-
count?: number
|
|
1267
|
-
gutter?: string
|
|
1268
|
-
maxWidth?: string
|
|
1269
|
-
margin?: string
|
|
1270
|
-
outline?: boolean
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
export declare const LayoutGrid: ParentProps<LayoutGridProps>
|
|
1274
|
-
`,
|
|
1275
|
-
js: outdent20`
|
|
1276
|
-
import { createComponent, For } from 'solid-js/web'
|
|
1277
|
-
|
|
1278
|
-
export function LayoutGrid(props) {
|
|
1279
|
-
const { count = 12, margin, gutter = '24px', maxWidth, outline } = props
|
|
1280
|
-
const hasMaxWidth = maxWidth != null
|
|
1281
|
-
return createComponent('div', {
|
|
1282
|
-
className: 'panda-layout-grid',
|
|
1283
|
-
style: {
|
|
1284
|
-
'--gutter': gutter,
|
|
1285
|
-
'--count': count,
|
|
1286
|
-
'--max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
1287
|
-
'--margin-x': hasMaxWidth ? 'auto' : undefined,
|
|
1288
|
-
'--padding-x': !hasMaxWidth ? margin : undefined,
|
|
1289
|
-
},
|
|
1290
|
-
get children() {
|
|
1291
|
-
return createComponent(For, {
|
|
1292
|
-
get each() {
|
|
1293
|
-
return Array.from({ length: count })
|
|
1294
|
-
},
|
|
1295
|
-
children: () =>
|
|
1296
|
-
createComponent('span', {
|
|
1297
|
-
'data-variant': outline ? 'outline' : 'bg',
|
|
1298
|
-
className: 'panda-layout-grid__item',
|
|
1299
|
-
}),
|
|
1300
|
-
})
|
|
1301
|
-
},
|
|
1302
|
-
})
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
`
|
|
1306
|
-
};
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
1132
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1310
|
-
import { outdent as
|
|
1133
|
+
import { outdent as outdent17 } from "outdent";
|
|
1311
1134
|
import { match as match4 } from "ts-pattern";
|
|
1312
1135
|
function generateSolidJsxPattern(ctx) {
|
|
1313
1136
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1316,7 +1139,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1316
1139
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1317
1140
|
return {
|
|
1318
1141
|
name: dashName,
|
|
1319
|
-
js:
|
|
1142
|
+
js: outdent17`
|
|
1320
1143
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1321
1144
|
import { createComponent } from 'solid-js/web'
|
|
1322
1145
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1325,11 +1148,11 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1325
1148
|
export function ${jsxName}(props) {
|
|
1326
1149
|
${match4(props.length).with(
|
|
1327
1150
|
0,
|
|
1328
|
-
() =>
|
|
1151
|
+
() => outdent17`
|
|
1329
1152
|
return createComponent(${factoryName}.${jsxElement}, props)
|
|
1330
1153
|
`
|
|
1331
1154
|
).otherwise(
|
|
1332
|
-
() =>
|
|
1155
|
+
() => outdent17`
|
|
1333
1156
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1334
1157
|
const styleProps = ${styleFnName}(patternProps)
|
|
1335
1158
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1337,7 +1160,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1337
1160
|
)}
|
|
1338
1161
|
}
|
|
1339
1162
|
`,
|
|
1340
|
-
dts:
|
|
1163
|
+
dts: outdent17`
|
|
1341
1164
|
import { Component } from 'solid-js'
|
|
1342
1165
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1343
1166
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1352,15 +1175,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1352
1175
|
}
|
|
1353
1176
|
|
|
1354
1177
|
// src/artifacts/solid-jsx/types.ts
|
|
1355
|
-
import { outdent as
|
|
1178
|
+
import { outdent as outdent18 } from "outdent";
|
|
1356
1179
|
function generateSolidJsxTypes(ctx) {
|
|
1357
1180
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1358
1181
|
return {
|
|
1359
|
-
jsxFactory:
|
|
1182
|
+
jsxFactory: outdent18`
|
|
1360
1183
|
import type { ${upperName} } from '../types/jsx'
|
|
1361
1184
|
export declare const ${factoryName}: ${upperName}
|
|
1362
1185
|
`,
|
|
1363
|
-
jsxType:
|
|
1186
|
+
jsxType: outdent18`
|
|
1364
1187
|
import type { JSX, ComponentProps, Component } from 'solid-js'
|
|
1365
1188
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1366
1189
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1384,11 +1207,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1384
1207
|
}
|
|
1385
1208
|
|
|
1386
1209
|
// src/artifacts/vue-jsx/jsx.ts
|
|
1387
|
-
import { outdent as
|
|
1210
|
+
import { outdent as outdent19 } from "outdent";
|
|
1388
1211
|
function generateVueJsxFactory(ctx) {
|
|
1389
1212
|
const { factoryName } = ctx.jsx;
|
|
1390
1213
|
return {
|
|
1391
|
-
js:
|
|
1214
|
+
js: outdent19`
|
|
1392
1215
|
import { defineComponent, h, computed } from 'vue'
|
|
1393
1216
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1394
1217
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1452,87 +1275,16 @@ function generateVueJsxFactory(ctx) {
|
|
|
1452
1275
|
};
|
|
1453
1276
|
}
|
|
1454
1277
|
|
|
1455
|
-
// src/artifacts/vue-jsx/layout-grid.ts
|
|
1456
|
-
import { outdent as outdent24 } from "outdent";
|
|
1457
|
-
function generateVueLayoutGrid() {
|
|
1458
|
-
return {
|
|
1459
|
-
dts: outdent24`
|
|
1460
|
-
import type { FunctionalComponent } from 'vue'
|
|
1461
|
-
|
|
1462
|
-
export type LayoutGridProps = {
|
|
1463
|
-
count?: number
|
|
1464
|
-
gutter?: string
|
|
1465
|
-
maxWidth?: string
|
|
1466
|
-
margin?: string
|
|
1467
|
-
outline?: boolean
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
export declare const LayoutGrid: FunctionalComponent<LayoutGridProps>
|
|
1471
|
-
`,
|
|
1472
|
-
js: outdent24`
|
|
1473
|
-
import { h, computed, defineComponent } from 'vue'
|
|
1474
|
-
|
|
1475
|
-
export const LayoutGrid = defineComponent({
|
|
1476
|
-
name: 'LayoutGrid',
|
|
1477
|
-
props: {
|
|
1478
|
-
count: {
|
|
1479
|
-
type: Number,
|
|
1480
|
-
default: 12,
|
|
1481
|
-
},
|
|
1482
|
-
margin: String,
|
|
1483
|
-
gutter: {
|
|
1484
|
-
type: String,
|
|
1485
|
-
default: '24px',
|
|
1486
|
-
},
|
|
1487
|
-
maxWidth: String,
|
|
1488
|
-
outline: Boolean,
|
|
1489
|
-
},
|
|
1490
|
-
setup(props) {
|
|
1491
|
-
const hasMaxWidthRef = computed(() => props.maxWidth != null)
|
|
1492
|
-
const variantRef = computed(() => (props.outline ? 'outline' : 'default'))
|
|
1493
|
-
return () => {
|
|
1494
|
-
const { count, margin, gutter, maxWidth } = props
|
|
1495
|
-
const hasMaxWidth = hasMaxWidthRef.value
|
|
1496
|
-
const variant = variantRef.value
|
|
1497
|
-
|
|
1498
|
-
return h(
|
|
1499
|
-
'div',
|
|
1500
|
-
{
|
|
1501
|
-
class: 'panda-layout-grid',
|
|
1502
|
-
style: {
|
|
1503
|
-
'--gutter': gutter,
|
|
1504
|
-
'--count': count,
|
|
1505
|
-
'--max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
1506
|
-
'--margin-x': hasMaxWidth ? 'auto' : undefined,
|
|
1507
|
-
'--padding-x': !hasMaxWidth ? margin : undefined,
|
|
1508
|
-
},
|
|
1509
|
-
},
|
|
1510
|
-
Array.from({ length: count }, (_, i) => {
|
|
1511
|
-
return h('span', {
|
|
1512
|
-
'data-variant': variant,
|
|
1513
|
-
key: i,
|
|
1514
|
-
class: 'panda-layout-grid__item',
|
|
1515
|
-
})
|
|
1516
|
-
}),
|
|
1517
|
-
)
|
|
1518
|
-
}
|
|
1519
|
-
},
|
|
1520
|
-
})
|
|
1521
|
-
|
|
1522
|
-
`
|
|
1523
|
-
};
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
1278
|
// src/artifacts/vue-jsx/types.ts
|
|
1527
|
-
import { outdent as
|
|
1279
|
+
import { outdent as outdent20 } from "outdent";
|
|
1528
1280
|
function generateVueJsxTypes(ctx) {
|
|
1529
1281
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1530
1282
|
return {
|
|
1531
|
-
jsxFactory:
|
|
1283
|
+
jsxFactory: outdent20`
|
|
1532
1284
|
import { ${upperName} } from '../types/jsx'
|
|
1533
1285
|
export declare const ${factoryName}: ${upperName}
|
|
1534
1286
|
`,
|
|
1535
|
-
jsxType:
|
|
1287
|
+
jsxType: outdent20`
|
|
1536
1288
|
import type { Component, FunctionalComponent } from 'vue'
|
|
1537
1289
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1538
1290
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1711,17 +1463,6 @@ function generateJsxPatterns(ctx) {
|
|
|
1711
1463
|
return [];
|
|
1712
1464
|
return patternMap[ctx.jsx.framework](ctx);
|
|
1713
1465
|
}
|
|
1714
|
-
var layoutGridMap = {
|
|
1715
|
-
react: generateReactLayoutGrid,
|
|
1716
|
-
preact: generatePreactLayoutGrid,
|
|
1717
|
-
solid: generateSolidLayoutGrid,
|
|
1718
|
-
vue: generateVueLayoutGrid
|
|
1719
|
-
};
|
|
1720
|
-
function generateLayoutGrid(ctx) {
|
|
1721
|
-
if (!ctx.jsx.framework)
|
|
1722
|
-
return;
|
|
1723
|
-
return layoutGridMap[ctx.jsx.framework]();
|
|
1724
|
-
}
|
|
1725
1466
|
|
|
1726
1467
|
// src/artifacts/pkg-json.ts
|
|
1727
1468
|
function generatePackageJson(ctx) {
|
|
@@ -1812,9 +1553,9 @@ function getGeneratedTypes() {
|
|
|
1812
1553
|
}
|
|
1813
1554
|
|
|
1814
1555
|
// src/artifacts/types/main.ts
|
|
1815
|
-
import { outdent as
|
|
1556
|
+
import { outdent as outdent21 } from "outdent";
|
|
1816
1557
|
var generateTypesEntry = () => ({
|
|
1817
|
-
global:
|
|
1558
|
+
global: outdent21`
|
|
1818
1559
|
import { AnyRecipeConfig, RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
1819
1560
|
import { Parts } from './parts'
|
|
1820
1561
|
import { AnyPatternConfig, PatternConfig } from './pattern'
|
|
@@ -1830,19 +1571,19 @@ var generateTypesEntry = () => ({
|
|
|
1830
1571
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
1831
1572
|
}
|
|
1832
1573
|
`,
|
|
1833
|
-
index:
|
|
1574
|
+
index: outdent21`
|
|
1834
1575
|
import './global'
|
|
1835
1576
|
export { ConditionalValue } from './conditions'
|
|
1836
1577
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
1837
1578
|
|
|
1838
1579
|
`,
|
|
1839
|
-
helpers:
|
|
1580
|
+
helpers: outdent21`
|
|
1840
1581
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
1841
1582
|
`
|
|
1842
1583
|
});
|
|
1843
1584
|
|
|
1844
1585
|
// src/artifacts/types/prop-types.ts
|
|
1845
|
-
import { outdent as
|
|
1586
|
+
import { outdent as outdent22 } from "outdent";
|
|
1846
1587
|
function generatePropTypes(ctx) {
|
|
1847
1588
|
const {
|
|
1848
1589
|
config: { strictTokens },
|
|
@@ -1850,7 +1591,7 @@ function generatePropTypes(ctx) {
|
|
|
1850
1591
|
} = ctx;
|
|
1851
1592
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
1852
1593
|
const result = [
|
|
1853
|
-
|
|
1594
|
+
outdent22`
|
|
1854
1595
|
import type { ConditionalValue } from './conditions';
|
|
1855
1596
|
import type { CssProperties } from './system-types'
|
|
1856
1597
|
import type { Tokens } from './tokens'
|
|
@@ -1873,7 +1614,7 @@ function generatePropTypes(ctx) {
|
|
|
1873
1614
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
1874
1615
|
});
|
|
1875
1616
|
result.push("}");
|
|
1876
|
-
return
|
|
1617
|
+
return outdent22`
|
|
1877
1618
|
${result.join("\n")}
|
|
1878
1619
|
|
|
1879
1620
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -1886,10 +1627,10 @@ function generatePropTypes(ctx) {
|
|
|
1886
1627
|
|
|
1887
1628
|
// src/artifacts/types/style-props.ts
|
|
1888
1629
|
import { allCssProperties } from "@pandacss/is-valid-prop";
|
|
1889
|
-
import
|
|
1630
|
+
import outdent23 from "outdent";
|
|
1890
1631
|
function generateStyleProps(ctx) {
|
|
1891
1632
|
const props = new Set(allCssProperties.concat(ctx.utility.keys()));
|
|
1892
|
-
return
|
|
1633
|
+
return outdent23`
|
|
1893
1634
|
import { ConditionalValue } from './conditions'
|
|
1894
1635
|
import { PropertyValue } from './prop-type'
|
|
1895
1636
|
import { Token } from './tokens'
|
|
@@ -1906,7 +1647,7 @@ function generateStyleProps(ctx) {
|
|
|
1906
1647
|
|
|
1907
1648
|
// src/artifacts/types/token-types.ts
|
|
1908
1649
|
import { capitalize, unionType as unionType3 } from "@pandacss/shared";
|
|
1909
|
-
import { outdent as
|
|
1650
|
+
import { outdent as outdent24 } from "outdent";
|
|
1910
1651
|
import pluralize from "pluralize";
|
|
1911
1652
|
var categories = [
|
|
1912
1653
|
"zIndex",
|
|
@@ -1948,7 +1689,7 @@ function generateTokenTypes(ctx) {
|
|
|
1948
1689
|
result.add("} & { [token: string]: never }");
|
|
1949
1690
|
set.add(Array.from(result).join("\n"));
|
|
1950
1691
|
set.add(`export type TokenCategory = ${unionType3(categories)}`);
|
|
1951
|
-
return
|
|
1692
|
+
return outdent24.string(Array.from(set).join("\n\n"));
|
|
1952
1693
|
}
|
|
1953
1694
|
|
|
1954
1695
|
// src/artifacts/css/global-css.ts
|
|
@@ -2007,8 +1748,8 @@ var generateStaticCss = (ctx) => {
|
|
|
2007
1748
|
// @ts-ignore
|
|
2008
1749
|
getRecipeKeys: (recipe) => recipes.details[recipe]
|
|
2009
1750
|
});
|
|
2010
|
-
results.css.forEach((
|
|
2011
|
-
sheet.processAtomic(
|
|
1751
|
+
results.css.forEach((css2) => {
|
|
1752
|
+
sheet.processAtomic(css2);
|
|
2012
1753
|
});
|
|
2013
1754
|
results.recipes.forEach((result) => {
|
|
2014
1755
|
Object.entries(result).forEach(([name, value]) => {
|
|
@@ -2039,11 +1780,11 @@ function setupDesignTokens(ctx) {
|
|
|
2039
1780
|
if (ctx.tokens.isEmpty)
|
|
2040
1781
|
return;
|
|
2041
1782
|
const code = generateTokenJs(ctx);
|
|
2042
|
-
const
|
|
1783
|
+
const css2 = generateTokenCss(ctx);
|
|
2043
1784
|
return {
|
|
2044
1785
|
dir: ctx.paths.token,
|
|
2045
1786
|
files: [
|
|
2046
|
-
{ file: "index.css", code:
|
|
1787
|
+
{ file: "index.css", code: css2 },
|
|
2047
1788
|
{ file: "index.d.ts", code: code.dts },
|
|
2048
1789
|
{ file: ctx.file.ext("index"), code: code.js }
|
|
2049
1790
|
]
|
|
@@ -2113,8 +1854,8 @@ function setupRecipes(ctx) {
|
|
|
2113
1854
|
return;
|
|
2114
1855
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
2115
1856
|
const index = {
|
|
2116
|
-
js:
|
|
2117
|
-
dts:
|
|
1857
|
+
js: outdent25.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
1858
|
+
dts: outdent25.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2118
1859
|
};
|
|
2119
1860
|
return {
|
|
2120
1861
|
dir: ctx.paths.recipe,
|
|
@@ -2131,8 +1872,8 @@ function setupPatterns(ctx) {
|
|
|
2131
1872
|
if (!files)
|
|
2132
1873
|
return;
|
|
2133
1874
|
const index = {
|
|
2134
|
-
js:
|
|
2135
|
-
dts:
|
|
1875
|
+
js: outdent25.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
1876
|
+
dts: outdent25.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2136
1877
|
};
|
|
2137
1878
|
return {
|
|
2138
1879
|
dir: ctx.paths.pattern,
|
|
@@ -2151,17 +1892,14 @@ function setupJsx(ctx) {
|
|
|
2151
1892
|
const types = generateJsxTypes(ctx);
|
|
2152
1893
|
const factory = generateJsxFactory(ctx);
|
|
2153
1894
|
const patterns = generateJsxPatterns(ctx);
|
|
2154
|
-
const layoutGrid2 = generateLayoutGrid(ctx);
|
|
2155
1895
|
const index = {
|
|
2156
|
-
js:
|
|
1896
|
+
js: outdent25`
|
|
2157
1897
|
${ctx.file.export("./factory")}
|
|
2158
|
-
${ctx.file.export("
|
|
2159
|
-
${outdent30.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
1898
|
+
${outdent25.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2160
1899
|
`,
|
|
2161
|
-
dts:
|
|
1900
|
+
dts: outdent25`
|
|
2162
1901
|
export * from './factory'
|
|
2163
|
-
export * from '
|
|
2164
|
-
${outdent30.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
1902
|
+
${outdent25.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2165
1903
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2166
1904
|
`
|
|
2167
1905
|
};
|
|
@@ -2170,8 +1908,6 @@ function setupJsx(ctx) {
|
|
|
2170
1908
|
files: [
|
|
2171
1909
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
2172
1910
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
2173
|
-
{ file: ctx.file.ext("layout-grid"), code: layoutGrid2?.js },
|
|
2174
|
-
{ file: "layout-grid.d.ts", code: layoutGrid2?.dts },
|
|
2175
1911
|
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp.js },
|
|
2176
1912
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
2177
1913
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
@@ -2182,12 +1918,12 @@ function setupJsx(ctx) {
|
|
|
2182
1918
|
}
|
|
2183
1919
|
function setupCssIndex(ctx) {
|
|
2184
1920
|
const index = {
|
|
2185
|
-
js:
|
|
1921
|
+
js: outdent25`
|
|
2186
1922
|
${ctx.file.export("./css")}
|
|
2187
1923
|
${ctx.file.export("./cx")}
|
|
2188
1924
|
${ctx.file.export("./cva")}
|
|
2189
1925
|
`,
|
|
2190
|
-
dts:
|
|
1926
|
+
dts: outdent25`
|
|
2191
1927
|
export * from './css'
|
|
2192
1928
|
export * from './cx'
|
|
2193
1929
|
export * from './cva'
|
|
@@ -2207,10 +1943,6 @@ function setupResetCss(ctx) {
|
|
|
2207
1943
|
const code = generateResetCss();
|
|
2208
1944
|
return { files: [{ file: "reset.css", code }] };
|
|
2209
1945
|
}
|
|
2210
|
-
function setupLayoutGridCss() {
|
|
2211
|
-
const code = generateLayoutGridCss();
|
|
2212
|
-
return { files: [{ file: "layout-grid.css", code }] };
|
|
2213
|
-
}
|
|
2214
1946
|
function setupGlobalCss(ctx) {
|
|
2215
1947
|
const code = generateGlobalCss(ctx);
|
|
2216
1948
|
return { files: [{ file: "global.css", code }] };
|
|
@@ -2241,7 +1973,6 @@ var generateArtifacts = (ctx) => () => [
|
|
|
2241
1973
|
setupGlobalCss(ctx),
|
|
2242
1974
|
setupStaticCss(ctx),
|
|
2243
1975
|
setupResetCss(ctx),
|
|
2244
|
-
setupLayoutGridCss(),
|
|
2245
1976
|
setupPackageJson(ctx)
|
|
2246
1977
|
].filter(Boolean);
|
|
2247
1978
|
|
|
@@ -2251,7 +1982,6 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
2251
1982
|
const { theme: { keyframes } = {}, preflight, minify, staticCss } = ctx.config;
|
|
2252
1983
|
const unresolved = [
|
|
2253
1984
|
"@layer reset, base, tokens, recipes, utilities;",
|
|
2254
|
-
"@import './layout-grid.css';",
|
|
2255
1985
|
"@import './global.css';",
|
|
2256
1986
|
staticCss && "@import './static.css';",
|
|
2257
1987
|
preflight && "@import './reset.css';",
|
|
@@ -2260,7 +1990,6 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
2260
1990
|
].filter(Boolean).join("\n\n");
|
|
2261
1991
|
const sheet = ctx.createSheet({
|
|
2262
1992
|
content: resolve ? [
|
|
2263
|
-
generateLayoutGridCss(),
|
|
2264
1993
|
generateGlobalCss(ctx),
|
|
2265
1994
|
generateStaticCss(ctx),
|
|
2266
1995
|
generateResetCss(),
|
|
@@ -2280,8 +2009,8 @@ var flattenStyles = (data) => Object.assign({}, data, { css: void 0 }, data.css
|
|
|
2280
2009
|
var generateParserCss = (ctx) => (result) => pipe(
|
|
2281
2010
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
2282
2011
|
tap(({ sheet, result: result2, patterns, recipes }) => {
|
|
2283
|
-
result2.css.forEach((
|
|
2284
|
-
|
|
2012
|
+
result2.css.forEach((css2) => {
|
|
2013
|
+
css2.data.forEach((data) => {
|
|
2285
2014
|
sheet.processAtomic(data);
|
|
2286
2015
|
});
|
|
2287
2016
|
});
|