@pandacss/generator 0.0.0-dev-20230505185444 → 0.0.0-dev-20230506210137
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.js
CHANGED
|
@@ -127,7 +127,7 @@ var getMessages = (ctx) => ({
|
|
|
127
127
|
var import_lil_fp4 = require("lil-fp");
|
|
128
128
|
|
|
129
129
|
// src/artifacts/index.ts
|
|
130
|
-
var
|
|
130
|
+
var import_outdent25 = __toESM(require("outdent"));
|
|
131
131
|
|
|
132
132
|
// src/artifacts/css/keyframe-css.ts
|
|
133
133
|
var import_core = require("@pandacss/core");
|
|
@@ -152,45 +152,9 @@ function generateKeyframeCss(ctx) {
|
|
|
152
152
|
return rule.toString();
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
// src/artifacts/css/layout-grid-css.ts
|
|
156
|
-
var import_outdent2 = require("outdent");
|
|
157
|
-
var css = String.raw;
|
|
158
|
-
var layoutGrid = css`
|
|
159
|
-
.panda-layout-grid {
|
|
160
|
-
display: grid;
|
|
161
|
-
gap: var(--gutter);
|
|
162
|
-
grid-template-columns: repeat(var(--count), 1fr);
|
|
163
|
-
height: 100%;
|
|
164
|
-
width: 100%;
|
|
165
|
-
position: absolute;
|
|
166
|
-
inset: 0;
|
|
167
|
-
pointer-events: none;
|
|
168
|
-
max-width: var(--max-width);
|
|
169
|
-
margin-inline: var(--margin-x);
|
|
170
|
-
padding-inline: var(--padding-x);
|
|
171
|
-
}
|
|
172
|
-
.panda-layout-grid__item {
|
|
173
|
-
display: flex;
|
|
174
|
-
--color: rgba(255, 0, 0, 0.1);
|
|
175
|
-
height: 100%;
|
|
176
|
-
}
|
|
177
|
-
.panda-layout-grid__item[data-variant='bg'] {
|
|
178
|
-
background: var(--color);
|
|
179
|
-
}
|
|
180
|
-
.panda-layout-grid__item[data-variant='outline'] {
|
|
181
|
-
border-inline: 1px solid var(--color);
|
|
182
|
-
}
|
|
183
|
-
`;
|
|
184
|
-
function generateLayoutGridCss() {
|
|
185
|
-
return import_outdent2.outdent`
|
|
186
|
-
@layer base {
|
|
187
|
-
${layoutGrid}
|
|
188
|
-
}`;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
155
|
// src/artifacts/css/reset-css.ts
|
|
192
|
-
var
|
|
193
|
-
var reset =
|
|
156
|
+
var css = String.raw;
|
|
157
|
+
var reset = css`
|
|
194
158
|
* {
|
|
195
159
|
margin: 0;
|
|
196
160
|
}
|
|
@@ -309,11 +273,11 @@ function generateTokenCss(ctx) {
|
|
|
309
273
|
if (Object.keys(varsObj).length === 0)
|
|
310
274
|
continue;
|
|
311
275
|
if (key === "base") {
|
|
312
|
-
const { css:
|
|
313
|
-
results.push(
|
|
276
|
+
const { css: css3 } = (0, import_core2.toCss)({ [root]: varsObj });
|
|
277
|
+
results.push(css3);
|
|
314
278
|
} else {
|
|
315
279
|
const keys = key.split(":");
|
|
316
|
-
const { css:
|
|
280
|
+
const { css: css3 } = (0, import_core2.toCss)(varsObj);
|
|
317
281
|
const mapped = keys.map((key2) => conditions.get(key2)).filter(Boolean).map((condition) => {
|
|
318
282
|
const parent = (0, import_core2.extractParentSelectors)(condition);
|
|
319
283
|
return parent ? `&${parent}` : condition;
|
|
@@ -321,13 +285,13 @@ function generateTokenCss(ctx) {
|
|
|
321
285
|
const rule = getDeepestRule(root, mapped);
|
|
322
286
|
if (!rule)
|
|
323
287
|
continue;
|
|
324
|
-
getDeepestNode(rule)?.append(
|
|
288
|
+
getDeepestNode(rule)?.append(css3);
|
|
325
289
|
results.push((0, import_core2.expandNestedCss)(rule.toString()));
|
|
326
290
|
}
|
|
327
291
|
}
|
|
328
|
-
const
|
|
292
|
+
const css2 = results.join("\n\n");
|
|
329
293
|
return `@layer tokens {
|
|
330
|
-
${(0, import_core2.prettifyCss)(cleanupSelectors(
|
|
294
|
+
${(0, import_core2.prettifyCss)(cleanupSelectors(css2, root))}
|
|
331
295
|
}
|
|
332
296
|
`;
|
|
333
297
|
}
|
|
@@ -351,8 +315,8 @@ function getDeepestNode(node) {
|
|
|
351
315
|
}
|
|
352
316
|
return node;
|
|
353
317
|
}
|
|
354
|
-
function cleanupSelectors(
|
|
355
|
-
const root = import_postcss2.default.parse(
|
|
318
|
+
function cleanupSelectors(css2, varSelector) {
|
|
319
|
+
const root = import_postcss2.default.parse(css2);
|
|
356
320
|
root.walkRules((rule) => {
|
|
357
321
|
rule.selectors.forEach((selector) => {
|
|
358
322
|
const res = selector.split(varSelector).filter(Boolean);
|
|
@@ -365,11 +329,11 @@ function cleanupSelectors(css3, varSelector) {
|
|
|
365
329
|
}
|
|
366
330
|
|
|
367
331
|
// src/artifacts/js/conditions.ts
|
|
368
|
-
var
|
|
332
|
+
var import_outdent2 = __toESM(require("outdent"));
|
|
369
333
|
function generateConditions(ctx) {
|
|
370
334
|
const keys = Object.keys(ctx.conditions.values).concat("base");
|
|
371
335
|
return {
|
|
372
|
-
js:
|
|
336
|
+
js: import_outdent2.default`
|
|
373
337
|
${ctx.file.import("withoutSpace", "../helpers")}
|
|
374
338
|
|
|
375
339
|
const conditions = new Set([${keys.map((key) => JSON.stringify(key))}])
|
|
@@ -404,7 +368,7 @@ function generateConditions(ctx) {
|
|
|
404
368
|
})
|
|
405
369
|
}
|
|
406
370
|
`,
|
|
407
|
-
dts:
|
|
371
|
+
dts: import_outdent2.default`
|
|
408
372
|
import type { AnySelector, Selectors } from './selectors'
|
|
409
373
|
|
|
410
374
|
export type Conditions = {
|
|
@@ -435,7 +399,7 @@ function generateConditions(ctx) {
|
|
|
435
399
|
}
|
|
436
400
|
|
|
437
401
|
// src/artifacts/js/css-fn.ts
|
|
438
|
-
var
|
|
402
|
+
var import_outdent3 = require("outdent");
|
|
439
403
|
var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
|
|
440
404
|
function generateCssFn(ctx) {
|
|
441
405
|
const {
|
|
@@ -445,11 +409,11 @@ function generateCssFn(ctx) {
|
|
|
445
409
|
} = ctx;
|
|
446
410
|
const { separator } = utility;
|
|
447
411
|
return {
|
|
448
|
-
dts:
|
|
412
|
+
dts: import_outdent3.outdent`
|
|
449
413
|
import type { SystemStyleObject } from '../types'
|
|
450
414
|
export declare function css(styles: SystemStyleObject): string
|
|
451
415
|
`,
|
|
452
|
-
js:
|
|
416
|
+
js: import_outdent3.outdent`
|
|
453
417
|
${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
|
|
454
418
|
${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
|
|
455
419
|
|
|
@@ -493,10 +457,10 @@ function generateCssFn(ctx) {
|
|
|
493
457
|
}
|
|
494
458
|
|
|
495
459
|
// src/artifacts/js/cva.ts
|
|
496
|
-
var
|
|
460
|
+
var import_outdent4 = require("outdent");
|
|
497
461
|
function generateCvaFn(ctx) {
|
|
498
462
|
return {
|
|
499
|
-
js:
|
|
463
|
+
js: import_outdent4.outdent`
|
|
500
464
|
${ctx.file.import("compact", "../helpers")}
|
|
501
465
|
${ctx.file.import("css, mergeCss", "./css")}
|
|
502
466
|
|
|
@@ -554,7 +518,7 @@ function generateCvaFn(ctx) {
|
|
|
554
518
|
}
|
|
555
519
|
|
|
556
520
|
`,
|
|
557
|
-
dts:
|
|
521
|
+
dts: import_outdent4.outdent`
|
|
558
522
|
import type { RecipeCreatorFn } from '../types/recipe'
|
|
559
523
|
|
|
560
524
|
export declare const cva: RecipeCreatorFn
|
|
@@ -566,10 +530,10 @@ function generateCvaFn(ctx) {
|
|
|
566
530
|
}
|
|
567
531
|
|
|
568
532
|
// src/artifacts/js/cx.ts
|
|
569
|
-
var
|
|
533
|
+
var import_outdent5 = __toESM(require("outdent"));
|
|
570
534
|
function generateCx() {
|
|
571
535
|
return {
|
|
572
|
-
js:
|
|
536
|
+
js: import_outdent5.default`
|
|
573
537
|
function cx() {
|
|
574
538
|
let str = '',
|
|
575
539
|
i = 0,
|
|
@@ -586,7 +550,7 @@ function generateCx() {
|
|
|
586
550
|
|
|
587
551
|
export { cx }
|
|
588
552
|
`,
|
|
589
|
-
dts:
|
|
553
|
+
dts: import_outdent5.default`
|
|
590
554
|
type Argument = string | boolean | null | undefined
|
|
591
555
|
|
|
592
556
|
/** Conditionally join classNames into a single string */
|
|
@@ -596,7 +560,7 @@ function generateCx() {
|
|
|
596
560
|
}
|
|
597
561
|
|
|
598
562
|
// src/artifacts/js/helpers.ts
|
|
599
|
-
var
|
|
563
|
+
var import_outdent6 = require("outdent");
|
|
600
564
|
|
|
601
565
|
// src/artifacts/generated/helpers.mjs.json
|
|
602
566
|
var helpers_mjs_default = {
|
|
@@ -606,7 +570,7 @@ var helpers_mjs_default = {
|
|
|
606
570
|
// src/artifacts/js/helpers.ts
|
|
607
571
|
function generateHelpers() {
|
|
608
572
|
return {
|
|
609
|
-
js:
|
|
573
|
+
js: import_outdent6.outdent`
|
|
610
574
|
${helpers_mjs_default.content}
|
|
611
575
|
|
|
612
576
|
export function __spreadValues(a, b){
|
|
@@ -640,7 +604,7 @@ function generateisValidProp(ctx) {
|
|
|
640
604
|
// src/artifacts/js/pattern.ts
|
|
641
605
|
var import_shared = require("@pandacss/shared");
|
|
642
606
|
var import_javascript_stringify = require("javascript-stringify");
|
|
643
|
-
var
|
|
607
|
+
var import_outdent7 = require("outdent");
|
|
644
608
|
var import_ts_pattern = require("ts-pattern");
|
|
645
609
|
function generatePattern(ctx) {
|
|
646
610
|
if (ctx.patterns.isEmpty())
|
|
@@ -658,7 +622,7 @@ function generatePattern(ctx) {
|
|
|
658
622
|
}
|
|
659
623
|
return {
|
|
660
624
|
name: dashName,
|
|
661
|
-
dts:
|
|
625
|
+
dts: import_outdent7.outdent`
|
|
662
626
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
663
627
|
import type { PropertyValue } from '../types/prop-type'
|
|
664
628
|
import type { Properties } from '../types/csstype'
|
|
@@ -682,7 +646,7 @@ function generatePattern(ctx) {
|
|
|
682
646
|
}).join("\n ")}
|
|
683
647
|
}
|
|
684
648
|
|
|
685
|
-
${strict ?
|
|
649
|
+
${strict ? import_outdent7.outdent`export declare function ${name}(options: ${upperName}Properties): string` : import_outdent7.outdent`
|
|
686
650
|
|
|
687
651
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
688
652
|
|
|
@@ -691,7 +655,7 @@ function generatePattern(ctx) {
|
|
|
691
655
|
`}
|
|
692
656
|
|
|
693
657
|
`,
|
|
694
|
-
js:
|
|
658
|
+
js: import_outdent7.outdent`
|
|
695
659
|
${ctx.file.import(helperImports.join(", "), "../helpers")}
|
|
696
660
|
${ctx.file.import("css", "../css/index")}
|
|
697
661
|
|
|
@@ -708,7 +672,7 @@ transform`)}
|
|
|
708
672
|
|
|
709
673
|
// src/artifacts/js/recipe.ts
|
|
710
674
|
var import_shared2 = require("@pandacss/shared");
|
|
711
|
-
var
|
|
675
|
+
var import_outdent8 = require("outdent");
|
|
712
676
|
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
713
677
|
function generateRecipes(ctx) {
|
|
714
678
|
const {
|
|
@@ -721,7 +685,7 @@ function generateRecipes(ctx) {
|
|
|
721
685
|
const createRecipeFn = {
|
|
722
686
|
name: "create-recipe",
|
|
723
687
|
dts: "",
|
|
724
|
-
js:
|
|
688
|
+
js: import_outdent8.outdent`
|
|
725
689
|
${ctx.file.import("css", "../css/css")}
|
|
726
690
|
${ctx.file.import("assertCompoundVariant, getCompoundVariantCss", "../css/cva")}
|
|
727
691
|
${ctx.file.import("cx", "../css/cx")}
|
|
@@ -768,7 +732,7 @@ function generateRecipes(ctx) {
|
|
|
768
732
|
const { name, description, defaultVariants, compoundVariants } = config;
|
|
769
733
|
return {
|
|
770
734
|
name: dashName,
|
|
771
|
-
js:
|
|
735
|
+
js: import_outdent8.outdent`
|
|
772
736
|
${ctx.file.import("splitProps", "../helpers")}
|
|
773
737
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
774
738
|
|
|
@@ -781,7 +745,7 @@ function generateRecipes(ctx) {
|
|
|
781
745
|
const variantKeys = ${stringify3(Object.keys(variantKeyMap))}
|
|
782
746
|
${name}.splitVariantProps = (props) => splitProps(props, variantKeys)
|
|
783
747
|
`,
|
|
784
|
-
dts:
|
|
748
|
+
dts: import_outdent8.outdent`
|
|
785
749
|
import type { ConditionalValue } from '../types'
|
|
786
750
|
import type { Pretty } from '../types/helpers'
|
|
787
751
|
|
|
@@ -812,7 +776,7 @@ function generateRecipes(ctx) {
|
|
|
812
776
|
}
|
|
813
777
|
|
|
814
778
|
// src/artifacts/js/token.ts
|
|
815
|
-
var
|
|
779
|
+
var import_outdent9 = __toESM(require("outdent"));
|
|
816
780
|
function generateTokenJs(ctx) {
|
|
817
781
|
const { tokens } = ctx;
|
|
818
782
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -823,7 +787,7 @@ function generateTokenJs(ctx) {
|
|
|
823
787
|
});
|
|
824
788
|
const obj = Object.fromEntries(map);
|
|
825
789
|
return {
|
|
826
|
-
js:
|
|
790
|
+
js: import_outdent9.default`
|
|
827
791
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
828
792
|
|
|
829
793
|
export function token(path, fallback) {
|
|
@@ -836,7 +800,7 @@ function generateTokenJs(ctx) {
|
|
|
836
800
|
|
|
837
801
|
token.var = tokenVar
|
|
838
802
|
`,
|
|
839
|
-
dts:
|
|
803
|
+
dts: import_outdent9.default`
|
|
840
804
|
import type { Token } from '../types/tokens'
|
|
841
805
|
|
|
842
806
|
export declare const token: {
|
|
@@ -848,11 +812,11 @@ function generateTokenJs(ctx) {
|
|
|
848
812
|
}
|
|
849
813
|
|
|
850
814
|
// src/artifacts/preact-jsx/jsx.ts
|
|
851
|
-
var
|
|
815
|
+
var import_outdent10 = require("outdent");
|
|
852
816
|
function generatePreactJsxFactory(ctx) {
|
|
853
817
|
const { factoryName, componentName } = ctx.jsx;
|
|
854
818
|
return {
|
|
855
|
-
js:
|
|
819
|
+
js: import_outdent10.outdent`
|
|
856
820
|
import { h } from 'preact'
|
|
857
821
|
import { forwardRef } from 'preact/compat'
|
|
858
822
|
import { useMemo } from 'preact/hooks'
|
|
@@ -910,53 +874,8 @@ function generatePreactJsxFactory(ctx) {
|
|
|
910
874
|
};
|
|
911
875
|
}
|
|
912
876
|
|
|
913
|
-
// src/artifacts/preact-jsx/layout-grid.ts
|
|
914
|
-
var import_outdent12 = require("outdent");
|
|
915
|
-
function generatePreactLayoutGrid() {
|
|
916
|
-
return {
|
|
917
|
-
dts: import_outdent12.outdent`
|
|
918
|
-
import { FunctionComponent } from 'preact'
|
|
919
|
-
|
|
920
|
-
export type LayoutGridProps = {
|
|
921
|
-
count?: number
|
|
922
|
-
gutter?: string
|
|
923
|
-
maxWidth?: string
|
|
924
|
-
margin?: string
|
|
925
|
-
outline?: boolean
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
929
|
-
`,
|
|
930
|
-
js: import_outdent12.outdent`
|
|
931
|
-
import { h } from 'preact'
|
|
932
|
-
|
|
933
|
-
export function LayoutGrid(props) {
|
|
934
|
-
const { count = 12, margin, gutter = '24px', maxWidth, outline } = props
|
|
935
|
-
const hasMaxWidth = maxWidth != null
|
|
936
|
-
return h('div', {
|
|
937
|
-
className: 'panda-layout-grid',
|
|
938
|
-
style: {
|
|
939
|
-
'--gutter': gutter,
|
|
940
|
-
'--count': count,
|
|
941
|
-
'--max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
942
|
-
'--margin-x': hasMaxWidth ? 'auto' : undefined,
|
|
943
|
-
'--padding-x': !hasMaxWidth ? margin : undefined,
|
|
944
|
-
},
|
|
945
|
-
children: Array.from({ length: count }).map((_, i) =>
|
|
946
|
-
h('span', {
|
|
947
|
-
'data-variant': outline ? 'outline' : 'bg',
|
|
948
|
-
key: i,
|
|
949
|
-
className: 'panda-layout-grid__item',
|
|
950
|
-
}),
|
|
951
|
-
),
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
`
|
|
955
|
-
};
|
|
956
|
-
}
|
|
957
|
-
|
|
958
877
|
// src/artifacts/preact-jsx/pattern.ts
|
|
959
|
-
var
|
|
878
|
+
var import_outdent11 = require("outdent");
|
|
960
879
|
var import_ts_pattern2 = require("ts-pattern");
|
|
961
880
|
function generatePreactJsxPattern(ctx) {
|
|
962
881
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -965,7 +884,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
965
884
|
const { description, jsxElement = "div" } = pattern.config;
|
|
966
885
|
return {
|
|
967
886
|
name: dashName,
|
|
968
|
-
js:
|
|
887
|
+
js: import_outdent11.outdent`
|
|
969
888
|
import { h } from 'preact'
|
|
970
889
|
import { forwardRef } from 'preact/compat'
|
|
971
890
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -974,11 +893,11 @@ function generatePreactJsxPattern(ctx) {
|
|
|
974
893
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
975
894
|
${(0, import_ts_pattern2.match)(props.length).with(
|
|
976
895
|
0,
|
|
977
|
-
() =>
|
|
896
|
+
() => import_outdent11.outdent`
|
|
978
897
|
return h(${factoryName}.${jsxElement}, { ref, ...props })
|
|
979
898
|
`
|
|
980
899
|
).otherwise(
|
|
981
|
-
() =>
|
|
900
|
+
() => import_outdent11.outdent`
|
|
982
901
|
const { ${props.join(", ")}, ...restProps } = props
|
|
983
902
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
984
903
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -986,7 +905,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
986
905
|
)}
|
|
987
906
|
})
|
|
988
907
|
`,
|
|
989
|
-
dts:
|
|
908
|
+
dts: import_outdent11.outdent`
|
|
990
909
|
import type { FunctionComponent } from 'preact'
|
|
991
910
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
992
911
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1001,15 +920,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1001
920
|
}
|
|
1002
921
|
|
|
1003
922
|
// src/artifacts/preact-jsx/types.ts
|
|
1004
|
-
var
|
|
923
|
+
var import_outdent12 = require("outdent");
|
|
1005
924
|
function generatePreactJsxTypes(ctx) {
|
|
1006
925
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1007
926
|
return {
|
|
1008
|
-
jsxFactory:
|
|
927
|
+
jsxFactory: import_outdent12.outdent`
|
|
1009
928
|
import type { ${upperName} } from '../types/jsx'
|
|
1010
929
|
export declare const ${factoryName}: ${upperName}
|
|
1011
930
|
`,
|
|
1012
|
-
jsxType:
|
|
931
|
+
jsxType: import_outdent12.outdent`
|
|
1013
932
|
import type { JSX, ComponentProps } from 'preact'
|
|
1014
933
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1015
934
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1033,11 +952,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1033
952
|
}
|
|
1034
953
|
|
|
1035
954
|
// src/artifacts/react-jsx/jsx.ts
|
|
1036
|
-
var
|
|
955
|
+
var import_outdent13 = require("outdent");
|
|
1037
956
|
function generateReactJsxFactory(ctx) {
|
|
1038
957
|
const { factoryName, componentName } = ctx.jsx;
|
|
1039
958
|
return {
|
|
1040
|
-
js:
|
|
959
|
+
js: import_outdent13.outdent`
|
|
1041
960
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1042
961
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1043
962
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1094,53 +1013,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
1094
1013
|
};
|
|
1095
1014
|
}
|
|
1096
1015
|
|
|
1097
|
-
// src/artifacts/react-jsx/layout-grid.ts
|
|
1098
|
-
var import_outdent16 = require("outdent");
|
|
1099
|
-
function generateReactLayoutGrid() {
|
|
1100
|
-
return {
|
|
1101
|
-
dts: import_outdent16.outdent`
|
|
1102
|
-
import type { FunctionComponent } from 'react'
|
|
1103
|
-
|
|
1104
|
-
export type LayoutGridProps = {
|
|
1105
|
-
count?: number
|
|
1106
|
-
gutter?: string
|
|
1107
|
-
maxWidth?: string
|
|
1108
|
-
margin?: string
|
|
1109
|
-
outline?: boolean
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
1113
|
-
`,
|
|
1114
|
-
js: import_outdent16.outdent`
|
|
1115
|
-
import { createElement } from 'react'
|
|
1116
|
-
|
|
1117
|
-
export function LayoutGrid(props) {
|
|
1118
|
-
const { count = 12, margin, gutter = '24px', maxWidth, outline } = props
|
|
1119
|
-
const hasMaxWidth = maxWidth != null
|
|
1120
|
-
return createElement('div', {
|
|
1121
|
-
className: 'panda-layout-grid',
|
|
1122
|
-
style: {
|
|
1123
|
-
'--gutter': gutter,
|
|
1124
|
-
'--count': count,
|
|
1125
|
-
'--max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
1126
|
-
'--margin-x': hasMaxWidth ? 'auto' : undefined,
|
|
1127
|
-
'--padding-x': !hasMaxWidth ? margin : undefined,
|
|
1128
|
-
},
|
|
1129
|
-
children: Array.from({ length: count }).map((_, i) =>
|
|
1130
|
-
createElement('span', {
|
|
1131
|
-
'data-variant': outline ? 'outline' : 'bg',
|
|
1132
|
-
key: i,
|
|
1133
|
-
className: 'panda-layout-grid__item',
|
|
1134
|
-
}),
|
|
1135
|
-
),
|
|
1136
|
-
})
|
|
1137
|
-
}
|
|
1138
|
-
`
|
|
1139
|
-
};
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
1016
|
// src/artifacts/react-jsx/pattern.ts
|
|
1143
|
-
var
|
|
1017
|
+
var import_outdent14 = require("outdent");
|
|
1144
1018
|
var import_ts_pattern3 = require("ts-pattern");
|
|
1145
1019
|
function generateReactJsxPattern(ctx) {
|
|
1146
1020
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1149,7 +1023,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1149
1023
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1150
1024
|
return {
|
|
1151
1025
|
name: dashName,
|
|
1152
|
-
js:
|
|
1026
|
+
js: import_outdent14.outdent`
|
|
1153
1027
|
import { createElement, forwardRef } from 'react'
|
|
1154
1028
|
${ctx.file.import(factoryName, "./factory")}
|
|
1155
1029
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1157,11 +1031,11 @@ function generateReactJsxPattern(ctx) {
|
|
|
1157
1031
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1158
1032
|
${(0, import_ts_pattern3.match)(props.length).with(
|
|
1159
1033
|
0,
|
|
1160
|
-
() =>
|
|
1034
|
+
() => import_outdent14.outdent`
|
|
1161
1035
|
return createElement(${factoryName}.${jsxElement}, { ref, ...props })
|
|
1162
1036
|
`
|
|
1163
1037
|
).otherwise(
|
|
1164
|
-
() =>
|
|
1038
|
+
() => import_outdent14.outdent`
|
|
1165
1039
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1166
1040
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1167
1041
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1169,7 +1043,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1169
1043
|
)}
|
|
1170
1044
|
})
|
|
1171
1045
|
`,
|
|
1172
|
-
dts:
|
|
1046
|
+
dts: import_outdent14.outdent`
|
|
1173
1047
|
import type { FunctionComponent } from 'react'
|
|
1174
1048
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1175
1049
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1184,15 +1058,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1184
1058
|
}
|
|
1185
1059
|
|
|
1186
1060
|
// src/artifacts/react-jsx/types.ts
|
|
1187
|
-
var
|
|
1061
|
+
var import_outdent15 = require("outdent");
|
|
1188
1062
|
function generateReactJsxTypes(ctx) {
|
|
1189
1063
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1190
1064
|
return {
|
|
1191
|
-
jsxFactory:
|
|
1065
|
+
jsxFactory: import_outdent15.outdent`
|
|
1192
1066
|
import { ${upperName} } from '../types/jsx'
|
|
1193
1067
|
export declare const ${factoryName}: ${upperName}
|
|
1194
1068
|
`,
|
|
1195
|
-
jsxType:
|
|
1069
|
+
jsxType: import_outdent15.outdent`
|
|
1196
1070
|
import type { ElementType, ComponentProps } from 'react'
|
|
1197
1071
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1198
1072
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1214,11 +1088,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1214
1088
|
}
|
|
1215
1089
|
|
|
1216
1090
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1217
|
-
var
|
|
1091
|
+
var import_outdent16 = require("outdent");
|
|
1218
1092
|
function generateSolidJsxFactory(ctx) {
|
|
1219
1093
|
const { componentName, factoryName } = ctx.jsx;
|
|
1220
1094
|
return {
|
|
1221
|
-
js:
|
|
1095
|
+
js: import_outdent16.outdent`
|
|
1222
1096
|
import { Dynamic } from 'solid-js/web'
|
|
1223
1097
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1224
1098
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1286,59 +1160,8 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1286
1160
|
};
|
|
1287
1161
|
}
|
|
1288
1162
|
|
|
1289
|
-
// src/artifacts/solid-jsx/layout-grid.ts
|
|
1290
|
-
var import_outdent20 = require("outdent");
|
|
1291
|
-
function generateSolidLayoutGrid() {
|
|
1292
|
-
return {
|
|
1293
|
-
dts: import_outdent20.outdent`
|
|
1294
|
-
import type { ParentProps } from 'solid-js'
|
|
1295
|
-
|
|
1296
|
-
export type LayoutGridProps = {
|
|
1297
|
-
count?: number
|
|
1298
|
-
gutter?: string
|
|
1299
|
-
maxWidth?: string
|
|
1300
|
-
margin?: string
|
|
1301
|
-
outline?: boolean
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
export declare const LayoutGrid: ParentProps<LayoutGridProps>
|
|
1305
|
-
`,
|
|
1306
|
-
js: import_outdent20.outdent`
|
|
1307
|
-
import { createComponent, For } from 'solid-js/web'
|
|
1308
|
-
|
|
1309
|
-
export function LayoutGrid(props) {
|
|
1310
|
-
const { count = 12, margin, gutter = '24px', maxWidth, outline } = props
|
|
1311
|
-
const hasMaxWidth = maxWidth != null
|
|
1312
|
-
return createComponent('div', {
|
|
1313
|
-
className: 'panda-layout-grid',
|
|
1314
|
-
style: {
|
|
1315
|
-
'--gutter': gutter,
|
|
1316
|
-
'--count': count,
|
|
1317
|
-
'--max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
1318
|
-
'--margin-x': hasMaxWidth ? 'auto' : undefined,
|
|
1319
|
-
'--padding-x': !hasMaxWidth ? margin : undefined,
|
|
1320
|
-
},
|
|
1321
|
-
get children() {
|
|
1322
|
-
return createComponent(For, {
|
|
1323
|
-
get each() {
|
|
1324
|
-
return Array.from({ length: count })
|
|
1325
|
-
},
|
|
1326
|
-
children: () =>
|
|
1327
|
-
createComponent('span', {
|
|
1328
|
-
'data-variant': outline ? 'outline' : 'bg',
|
|
1329
|
-
className: 'panda-layout-grid__item',
|
|
1330
|
-
}),
|
|
1331
|
-
})
|
|
1332
|
-
},
|
|
1333
|
-
})
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
`
|
|
1337
|
-
};
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
1163
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1341
|
-
var
|
|
1164
|
+
var import_outdent17 = require("outdent");
|
|
1342
1165
|
var import_ts_pattern4 = require("ts-pattern");
|
|
1343
1166
|
function generateSolidJsxPattern(ctx) {
|
|
1344
1167
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1347,7 +1170,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1347
1170
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1348
1171
|
return {
|
|
1349
1172
|
name: dashName,
|
|
1350
|
-
js:
|
|
1173
|
+
js: import_outdent17.outdent`
|
|
1351
1174
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1352
1175
|
import { createComponent } from 'solid-js/web'
|
|
1353
1176
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1356,11 +1179,11 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1356
1179
|
export function ${jsxName}(props) {
|
|
1357
1180
|
${(0, import_ts_pattern4.match)(props.length).with(
|
|
1358
1181
|
0,
|
|
1359
|
-
() =>
|
|
1182
|
+
() => import_outdent17.outdent`
|
|
1360
1183
|
return createComponent(${factoryName}.${jsxElement}, props)
|
|
1361
1184
|
`
|
|
1362
1185
|
).otherwise(
|
|
1363
|
-
() =>
|
|
1186
|
+
() => import_outdent17.outdent`
|
|
1364
1187
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1365
1188
|
const styleProps = ${styleFnName}(patternProps)
|
|
1366
1189
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1368,7 +1191,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1368
1191
|
)}
|
|
1369
1192
|
}
|
|
1370
1193
|
`,
|
|
1371
|
-
dts:
|
|
1194
|
+
dts: import_outdent17.outdent`
|
|
1372
1195
|
import { Component } from 'solid-js'
|
|
1373
1196
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1374
1197
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1383,15 +1206,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1383
1206
|
}
|
|
1384
1207
|
|
|
1385
1208
|
// src/artifacts/solid-jsx/types.ts
|
|
1386
|
-
var
|
|
1209
|
+
var import_outdent18 = require("outdent");
|
|
1387
1210
|
function generateSolidJsxTypes(ctx) {
|
|
1388
1211
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1389
1212
|
return {
|
|
1390
|
-
jsxFactory:
|
|
1213
|
+
jsxFactory: import_outdent18.outdent`
|
|
1391
1214
|
import type { ${upperName} } from '../types/jsx'
|
|
1392
1215
|
export declare const ${factoryName}: ${upperName}
|
|
1393
1216
|
`,
|
|
1394
|
-
jsxType:
|
|
1217
|
+
jsxType: import_outdent18.outdent`
|
|
1395
1218
|
import type { JSX, ComponentProps, Component } from 'solid-js'
|
|
1396
1219
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1397
1220
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1415,11 +1238,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1415
1238
|
}
|
|
1416
1239
|
|
|
1417
1240
|
// src/artifacts/vue-jsx/jsx.ts
|
|
1418
|
-
var
|
|
1241
|
+
var import_outdent19 = require("outdent");
|
|
1419
1242
|
function generateVueJsxFactory(ctx) {
|
|
1420
1243
|
const { factoryName } = ctx.jsx;
|
|
1421
1244
|
return {
|
|
1422
|
-
js:
|
|
1245
|
+
js: import_outdent19.outdent`
|
|
1423
1246
|
import { defineComponent, h, computed } from 'vue'
|
|
1424
1247
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1425
1248
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1483,87 +1306,16 @@ function generateVueJsxFactory(ctx) {
|
|
|
1483
1306
|
};
|
|
1484
1307
|
}
|
|
1485
1308
|
|
|
1486
|
-
// src/artifacts/vue-jsx/layout-grid.ts
|
|
1487
|
-
var import_outdent24 = require("outdent");
|
|
1488
|
-
function generateVueLayoutGrid() {
|
|
1489
|
-
return {
|
|
1490
|
-
dts: import_outdent24.outdent`
|
|
1491
|
-
import type { FunctionalComponent } from 'vue'
|
|
1492
|
-
|
|
1493
|
-
export type LayoutGridProps = {
|
|
1494
|
-
count?: number
|
|
1495
|
-
gutter?: string
|
|
1496
|
-
maxWidth?: string
|
|
1497
|
-
margin?: string
|
|
1498
|
-
outline?: boolean
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
export declare const LayoutGrid: FunctionalComponent<LayoutGridProps>
|
|
1502
|
-
`,
|
|
1503
|
-
js: import_outdent24.outdent`
|
|
1504
|
-
import { h, computed, defineComponent } from 'vue'
|
|
1505
|
-
|
|
1506
|
-
export const LayoutGrid = defineComponent({
|
|
1507
|
-
name: 'LayoutGrid',
|
|
1508
|
-
props: {
|
|
1509
|
-
count: {
|
|
1510
|
-
type: Number,
|
|
1511
|
-
default: 12,
|
|
1512
|
-
},
|
|
1513
|
-
margin: String,
|
|
1514
|
-
gutter: {
|
|
1515
|
-
type: String,
|
|
1516
|
-
default: '24px',
|
|
1517
|
-
},
|
|
1518
|
-
maxWidth: String,
|
|
1519
|
-
outline: Boolean,
|
|
1520
|
-
},
|
|
1521
|
-
setup(props) {
|
|
1522
|
-
const hasMaxWidthRef = computed(() => props.maxWidth != null)
|
|
1523
|
-
const variantRef = computed(() => (props.outline ? 'outline' : 'default'))
|
|
1524
|
-
return () => {
|
|
1525
|
-
const { count, margin, gutter, maxWidth } = props
|
|
1526
|
-
const hasMaxWidth = hasMaxWidthRef.value
|
|
1527
|
-
const variant = variantRef.value
|
|
1528
|
-
|
|
1529
|
-
return h(
|
|
1530
|
-
'div',
|
|
1531
|
-
{
|
|
1532
|
-
class: 'panda-layout-grid',
|
|
1533
|
-
style: {
|
|
1534
|
-
'--gutter': gutter,
|
|
1535
|
-
'--count': count,
|
|
1536
|
-
'--max-width': hasMaxWidth ? maxWidth : 'initial',
|
|
1537
|
-
'--margin-x': hasMaxWidth ? 'auto' : undefined,
|
|
1538
|
-
'--padding-x': !hasMaxWidth ? margin : undefined,
|
|
1539
|
-
},
|
|
1540
|
-
},
|
|
1541
|
-
Array.from({ length: count }, (_, i) => {
|
|
1542
|
-
return h('span', {
|
|
1543
|
-
'data-variant': variant,
|
|
1544
|
-
key: i,
|
|
1545
|
-
class: 'panda-layout-grid__item',
|
|
1546
|
-
})
|
|
1547
|
-
}),
|
|
1548
|
-
)
|
|
1549
|
-
}
|
|
1550
|
-
},
|
|
1551
|
-
})
|
|
1552
|
-
|
|
1553
|
-
`
|
|
1554
|
-
};
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1557
1309
|
// src/artifacts/vue-jsx/types.ts
|
|
1558
|
-
var
|
|
1310
|
+
var import_outdent20 = require("outdent");
|
|
1559
1311
|
function generateVueJsxTypes(ctx) {
|
|
1560
1312
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1561
1313
|
return {
|
|
1562
|
-
jsxFactory:
|
|
1314
|
+
jsxFactory: import_outdent20.outdent`
|
|
1563
1315
|
import { ${upperName} } from '../types/jsx'
|
|
1564
1316
|
export declare const ${factoryName}: ${upperName}
|
|
1565
1317
|
`,
|
|
1566
|
-
jsxType:
|
|
1318
|
+
jsxType: import_outdent20.outdent`
|
|
1567
1319
|
import type { Component, FunctionalComponent } from 'vue'
|
|
1568
1320
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1569
1321
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1742,17 +1494,6 @@ function generateJsxPatterns(ctx) {
|
|
|
1742
1494
|
return [];
|
|
1743
1495
|
return patternMap[ctx.jsx.framework](ctx);
|
|
1744
1496
|
}
|
|
1745
|
-
var layoutGridMap = {
|
|
1746
|
-
react: generateReactLayoutGrid,
|
|
1747
|
-
preact: generatePreactLayoutGrid,
|
|
1748
|
-
solid: generateSolidLayoutGrid,
|
|
1749
|
-
vue: generateVueLayoutGrid
|
|
1750
|
-
};
|
|
1751
|
-
function generateLayoutGrid(ctx) {
|
|
1752
|
-
if (!ctx.jsx.framework)
|
|
1753
|
-
return;
|
|
1754
|
-
return layoutGridMap[ctx.jsx.framework]();
|
|
1755
|
-
}
|
|
1756
1497
|
|
|
1757
1498
|
// src/artifacts/pkg-json.ts
|
|
1758
1499
|
function generatePackageJson(ctx) {
|
|
@@ -1843,9 +1584,9 @@ function getGeneratedTypes() {
|
|
|
1843
1584
|
}
|
|
1844
1585
|
|
|
1845
1586
|
// src/artifacts/types/main.ts
|
|
1846
|
-
var
|
|
1587
|
+
var import_outdent21 = require("outdent");
|
|
1847
1588
|
var generateTypesEntry = () => ({
|
|
1848
|
-
global:
|
|
1589
|
+
global: import_outdent21.outdent`
|
|
1849
1590
|
import { AnyRecipeConfig, RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
1850
1591
|
import { Parts } from './parts'
|
|
1851
1592
|
import { AnyPatternConfig, PatternConfig } from './pattern'
|
|
@@ -1861,19 +1602,19 @@ var generateTypesEntry = () => ({
|
|
|
1861
1602
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
1862
1603
|
}
|
|
1863
1604
|
`,
|
|
1864
|
-
index:
|
|
1605
|
+
index: import_outdent21.outdent`
|
|
1865
1606
|
import './global'
|
|
1866
1607
|
export { ConditionalValue } from './conditions'
|
|
1867
1608
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
1868
1609
|
|
|
1869
1610
|
`,
|
|
1870
|
-
helpers:
|
|
1611
|
+
helpers: import_outdent21.outdent`
|
|
1871
1612
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
1872
1613
|
`
|
|
1873
1614
|
});
|
|
1874
1615
|
|
|
1875
1616
|
// src/artifacts/types/prop-types.ts
|
|
1876
|
-
var
|
|
1617
|
+
var import_outdent22 = require("outdent");
|
|
1877
1618
|
function generatePropTypes(ctx) {
|
|
1878
1619
|
const {
|
|
1879
1620
|
config: { strictTokens },
|
|
@@ -1881,7 +1622,7 @@ function generatePropTypes(ctx) {
|
|
|
1881
1622
|
} = ctx;
|
|
1882
1623
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
1883
1624
|
const result = [
|
|
1884
|
-
|
|
1625
|
+
import_outdent22.outdent`
|
|
1885
1626
|
import type { ConditionalValue } from './conditions';
|
|
1886
1627
|
import type { CssProperties } from './system-types'
|
|
1887
1628
|
import type { Tokens } from './tokens'
|
|
@@ -1904,7 +1645,7 @@ function generatePropTypes(ctx) {
|
|
|
1904
1645
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
1905
1646
|
});
|
|
1906
1647
|
result.push("}");
|
|
1907
|
-
return
|
|
1648
|
+
return import_outdent22.outdent`
|
|
1908
1649
|
${result.join("\n")}
|
|
1909
1650
|
|
|
1910
1651
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -1917,10 +1658,10 @@ function generatePropTypes(ctx) {
|
|
|
1917
1658
|
|
|
1918
1659
|
// src/artifacts/types/style-props.ts
|
|
1919
1660
|
var import_is_valid_prop = require("@pandacss/is-valid-prop");
|
|
1920
|
-
var
|
|
1661
|
+
var import_outdent23 = __toESM(require("outdent"));
|
|
1921
1662
|
function generateStyleProps(ctx) {
|
|
1922
1663
|
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
|
|
1923
|
-
return
|
|
1664
|
+
return import_outdent23.default`
|
|
1924
1665
|
import { ConditionalValue } from './conditions'
|
|
1925
1666
|
import { PropertyValue } from './prop-type'
|
|
1926
1667
|
import { Token } from './tokens'
|
|
@@ -1937,7 +1678,7 @@ function generateStyleProps(ctx) {
|
|
|
1937
1678
|
|
|
1938
1679
|
// src/artifacts/types/token-types.ts
|
|
1939
1680
|
var import_shared3 = require("@pandacss/shared");
|
|
1940
|
-
var
|
|
1681
|
+
var import_outdent24 = require("outdent");
|
|
1941
1682
|
var import_pluralize = __toESM(require("pluralize"));
|
|
1942
1683
|
var categories = [
|
|
1943
1684
|
"zIndex",
|
|
@@ -1979,7 +1720,7 @@ function generateTokenTypes(ctx) {
|
|
|
1979
1720
|
result.add("} & { [token: string]: never }");
|
|
1980
1721
|
set.add(Array.from(result).join("\n"));
|
|
1981
1722
|
set.add(`export type TokenCategory = ${(0, import_shared3.unionType)(categories)}`);
|
|
1982
|
-
return
|
|
1723
|
+
return import_outdent24.outdent.string(Array.from(set).join("\n\n"));
|
|
1983
1724
|
}
|
|
1984
1725
|
|
|
1985
1726
|
// src/artifacts/css/global-css.ts
|
|
@@ -2038,8 +1779,8 @@ var generateStaticCss = (ctx) => {
|
|
|
2038
1779
|
// @ts-ignore
|
|
2039
1780
|
getRecipeKeys: (recipe) => recipes.details[recipe]
|
|
2040
1781
|
});
|
|
2041
|
-
results.css.forEach((
|
|
2042
|
-
sheet.processAtomic(
|
|
1782
|
+
results.css.forEach((css2) => {
|
|
1783
|
+
sheet.processAtomic(css2);
|
|
2043
1784
|
});
|
|
2044
1785
|
results.recipes.forEach((result) => {
|
|
2045
1786
|
Object.entries(result).forEach(([name, value]) => {
|
|
@@ -2070,11 +1811,11 @@ function setupDesignTokens(ctx) {
|
|
|
2070
1811
|
if (ctx.tokens.isEmpty)
|
|
2071
1812
|
return;
|
|
2072
1813
|
const code = generateTokenJs(ctx);
|
|
2073
|
-
const
|
|
1814
|
+
const css2 = generateTokenCss(ctx);
|
|
2074
1815
|
return {
|
|
2075
1816
|
dir: ctx.paths.token,
|
|
2076
1817
|
files: [
|
|
2077
|
-
{ file: "index.css", code:
|
|
1818
|
+
{ file: "index.css", code: css2 },
|
|
2078
1819
|
{ file: "index.d.ts", code: code.dts },
|
|
2079
1820
|
{ file: ctx.file.ext("index"), code: code.js }
|
|
2080
1821
|
]
|
|
@@ -2144,8 +1885,8 @@ function setupRecipes(ctx) {
|
|
|
2144
1885
|
return;
|
|
2145
1886
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
2146
1887
|
const index = {
|
|
2147
|
-
js:
|
|
2148
|
-
dts:
|
|
1888
|
+
js: import_outdent25.default.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
1889
|
+
dts: import_outdent25.default.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2149
1890
|
};
|
|
2150
1891
|
return {
|
|
2151
1892
|
dir: ctx.paths.recipe,
|
|
@@ -2162,8 +1903,8 @@ function setupPatterns(ctx) {
|
|
|
2162
1903
|
if (!files)
|
|
2163
1904
|
return;
|
|
2164
1905
|
const index = {
|
|
2165
|
-
js:
|
|
2166
|
-
dts:
|
|
1906
|
+
js: import_outdent25.default.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
1907
|
+
dts: import_outdent25.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2167
1908
|
};
|
|
2168
1909
|
return {
|
|
2169
1910
|
dir: ctx.paths.pattern,
|
|
@@ -2182,17 +1923,14 @@ function setupJsx(ctx) {
|
|
|
2182
1923
|
const types = generateJsxTypes(ctx);
|
|
2183
1924
|
const factory = generateJsxFactory(ctx);
|
|
2184
1925
|
const patterns = generateJsxPatterns(ctx);
|
|
2185
|
-
const layoutGrid2 = generateLayoutGrid(ctx);
|
|
2186
1926
|
const index = {
|
|
2187
|
-
js:
|
|
1927
|
+
js: import_outdent25.default`
|
|
2188
1928
|
${ctx.file.export("./factory")}
|
|
2189
|
-
${ctx.file.export("
|
|
2190
|
-
${import_outdent30.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
1929
|
+
${import_outdent25.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2191
1930
|
`,
|
|
2192
|
-
dts:
|
|
1931
|
+
dts: import_outdent25.default`
|
|
2193
1932
|
export * from './factory'
|
|
2194
|
-
export * from '
|
|
2195
|
-
${import_outdent30.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
1933
|
+
${import_outdent25.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2196
1934
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2197
1935
|
`
|
|
2198
1936
|
};
|
|
@@ -2201,8 +1939,6 @@ function setupJsx(ctx) {
|
|
|
2201
1939
|
files: [
|
|
2202
1940
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
2203
1941
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
2204
|
-
{ file: ctx.file.ext("layout-grid"), code: layoutGrid2?.js },
|
|
2205
|
-
{ file: "layout-grid.d.ts", code: layoutGrid2?.dts },
|
|
2206
1942
|
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp.js },
|
|
2207
1943
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
2208
1944
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
@@ -2213,12 +1949,12 @@ function setupJsx(ctx) {
|
|
|
2213
1949
|
}
|
|
2214
1950
|
function setupCssIndex(ctx) {
|
|
2215
1951
|
const index = {
|
|
2216
|
-
js:
|
|
1952
|
+
js: import_outdent25.default`
|
|
2217
1953
|
${ctx.file.export("./css")}
|
|
2218
1954
|
${ctx.file.export("./cx")}
|
|
2219
1955
|
${ctx.file.export("./cva")}
|
|
2220
1956
|
`,
|
|
2221
|
-
dts:
|
|
1957
|
+
dts: import_outdent25.default`
|
|
2222
1958
|
export * from './css'
|
|
2223
1959
|
export * from './cx'
|
|
2224
1960
|
export * from './cva'
|
|
@@ -2238,10 +1974,6 @@ function setupResetCss(ctx) {
|
|
|
2238
1974
|
const code = generateResetCss();
|
|
2239
1975
|
return { files: [{ file: "reset.css", code }] };
|
|
2240
1976
|
}
|
|
2241
|
-
function setupLayoutGridCss() {
|
|
2242
|
-
const code = generateLayoutGridCss();
|
|
2243
|
-
return { files: [{ file: "layout-grid.css", code }] };
|
|
2244
|
-
}
|
|
2245
1977
|
function setupGlobalCss(ctx) {
|
|
2246
1978
|
const code = generateGlobalCss(ctx);
|
|
2247
1979
|
return { files: [{ file: "global.css", code }] };
|
|
@@ -2272,7 +2004,6 @@ var generateArtifacts = (ctx) => () => [
|
|
|
2272
2004
|
setupGlobalCss(ctx),
|
|
2273
2005
|
setupStaticCss(ctx),
|
|
2274
2006
|
setupResetCss(ctx),
|
|
2275
|
-
setupLayoutGridCss(),
|
|
2276
2007
|
setupPackageJson(ctx)
|
|
2277
2008
|
].filter(Boolean);
|
|
2278
2009
|
|
|
@@ -2282,7 +2013,6 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
2282
2013
|
const { theme: { keyframes } = {}, preflight, minify, staticCss } = ctx.config;
|
|
2283
2014
|
const unresolved = [
|
|
2284
2015
|
"@layer reset, base, tokens, recipes, utilities;",
|
|
2285
|
-
"@import './layout-grid.css';",
|
|
2286
2016
|
"@import './global.css';",
|
|
2287
2017
|
staticCss && "@import './static.css';",
|
|
2288
2018
|
preflight && "@import './reset.css';",
|
|
@@ -2291,7 +2021,6 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
2291
2021
|
].filter(Boolean).join("\n\n");
|
|
2292
2022
|
const sheet = ctx.createSheet({
|
|
2293
2023
|
content: resolve ? [
|
|
2294
|
-
generateLayoutGridCss(),
|
|
2295
2024
|
generateGlobalCss(ctx),
|
|
2296
2025
|
generateStaticCss(ctx),
|
|
2297
2026
|
generateResetCss(),
|
|
@@ -2311,8 +2040,8 @@ var flattenStyles = (data) => Object.assign({}, data, { css: void 0 }, data.css
|
|
|
2311
2040
|
var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
2312
2041
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
2313
2042
|
(0, import_func.tap)(({ sheet, result: result2, patterns, recipes }) => {
|
|
2314
|
-
result2.css.forEach((
|
|
2315
|
-
|
|
2043
|
+
result2.css.forEach((css2) => {
|
|
2044
|
+
css2.data.forEach((data) => {
|
|
2316
2045
|
sheet.processAtomic(data);
|
|
2317
2046
|
});
|
|
2318
2047
|
});
|