@pandacss/generator 0.0.0-dev-20230213064912 → 0.0.0-dev-20230215185427
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 +108 -84
- package/dist/index.mjs +108 -84
- 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_outdent30 = __toESM(require("outdent"));
|
|
131
131
|
|
|
132
132
|
// src/artifacts/css/keyframe-css.ts
|
|
133
133
|
var import_core = require("@pandacss/core");
|
|
@@ -558,14 +558,29 @@ function generateCx() {
|
|
|
558
558
|
};
|
|
559
559
|
}
|
|
560
560
|
|
|
561
|
+
// src/artifacts/js/helpers.ts
|
|
562
|
+
var import_outdent7 = require("outdent");
|
|
563
|
+
|
|
561
564
|
// src/artifacts/generated/helpers.mjs.json
|
|
562
565
|
var helpers_mjs_default = {
|
|
563
566
|
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nfunction isImportant(value) {\n return typeof value === "string" ? /!(important)?$/.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n result[key] = inner(child, childPath);\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/normalize-html.ts\nvar htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];\nfunction convert(key) {\n return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;\n}\nfunction normalizeHTMLProps(props) {\n return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));\n}\nnormalizeHTMLProps.keys = htmlProps;\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate.ts\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);\n});\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n mergeProps,\n normalizeHTMLProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
|
|
564
567
|
};
|
|
565
568
|
|
|
566
569
|
// src/artifacts/js/helpers.ts
|
|
567
|
-
function
|
|
568
|
-
return {
|
|
570
|
+
function generateHelpers() {
|
|
571
|
+
return {
|
|
572
|
+
js: import_outdent7.outdent`
|
|
573
|
+
${helpers_mjs_default.content}
|
|
574
|
+
|
|
575
|
+
export function __spreadValues(a, b){
|
|
576
|
+
return { ...a, ...b }
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
export function __objRest(source, exclude){
|
|
580
|
+
return Object.fromEntries(Object.entries(source).filter(([key]) => !exclude.includes(key)))
|
|
581
|
+
}
|
|
582
|
+
`
|
|
583
|
+
};
|
|
569
584
|
}
|
|
570
585
|
|
|
571
586
|
// src/artifacts/generated/is-valid-prop.mjs.json
|
|
@@ -588,7 +603,7 @@ function generateisValidProp(ctx) {
|
|
|
588
603
|
// src/artifacts/js/pattern.ts
|
|
589
604
|
var import_shared = require("@pandacss/shared");
|
|
590
605
|
var import_javascript_stringify = require("javascript-stringify");
|
|
591
|
-
var
|
|
606
|
+
var import_outdent8 = require("outdent");
|
|
592
607
|
var import_ts_pattern = require("ts-pattern");
|
|
593
608
|
function generatePattern(ctx) {
|
|
594
609
|
if (ctx.patterns.isEmpty())
|
|
@@ -596,9 +611,17 @@ function generatePattern(ctx) {
|
|
|
596
611
|
return ctx.patterns.details.map((pattern) => {
|
|
597
612
|
const { name, config, dashName, upperName, styleFnName, blocklistType } = pattern;
|
|
598
613
|
const { properties, transform, strict, description } = config;
|
|
614
|
+
const transformFn = (0, import_javascript_stringify.stringify)({ transform }) ?? "";
|
|
615
|
+
const helperImports = ["mapObject"];
|
|
616
|
+
if (transformFn.includes("__spreadValues")) {
|
|
617
|
+
helperImports.push("__spreadValues");
|
|
618
|
+
}
|
|
619
|
+
if (transformFn.includes("__objRest")) {
|
|
620
|
+
helperImports.push("__objRest");
|
|
621
|
+
}
|
|
599
622
|
return {
|
|
600
623
|
name: dashName,
|
|
601
|
-
dts:
|
|
624
|
+
dts: import_outdent8.outdent`
|
|
602
625
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
603
626
|
import type { PropertyValue } from '../types/prop-type'
|
|
604
627
|
import type { Properties } from '../types/csstype'
|
|
@@ -622,7 +645,7 @@ function generatePattern(ctx) {
|
|
|
622
645
|
}).join("\n ")}
|
|
623
646
|
}
|
|
624
647
|
|
|
625
|
-
${strict ?
|
|
648
|
+
${strict ? import_outdent8.outdent`export declare function ${name}(options: ${upperName}Properties): string` : import_outdent8.outdent`
|
|
626
649
|
|
|
627
650
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
628
651
|
|
|
@@ -631,11 +654,12 @@ function generatePattern(ctx) {
|
|
|
631
654
|
`}
|
|
632
655
|
|
|
633
656
|
`,
|
|
634
|
-
js:
|
|
635
|
-
${ctx.file.import("
|
|
657
|
+
js: import_outdent8.outdent`
|
|
658
|
+
${ctx.file.import(helperImports.join(", "), "../helpers")}
|
|
636
659
|
${ctx.file.import("css", "../css/index")}
|
|
637
660
|
|
|
638
|
-
const ${name}Config = ${
|
|
661
|
+
const ${name}Config = ${transformFn.replace(`{transform`, `{
|
|
662
|
+
transform`)}
|
|
639
663
|
|
|
640
664
|
export const ${styleFnName} = (styles) => ${name}Config.transform(styles, { map: mapObject })
|
|
641
665
|
|
|
@@ -647,7 +671,7 @@ function generatePattern(ctx) {
|
|
|
647
671
|
|
|
648
672
|
// src/artifacts/js/recipe.ts
|
|
649
673
|
var import_shared2 = require("@pandacss/shared");
|
|
650
|
-
var
|
|
674
|
+
var import_outdent9 = require("outdent");
|
|
651
675
|
function generateRecipes(ctx) {
|
|
652
676
|
const {
|
|
653
677
|
recipes,
|
|
@@ -659,7 +683,7 @@ function generateRecipes(ctx) {
|
|
|
659
683
|
const createRecipeFn = {
|
|
660
684
|
name: "create-recipe",
|
|
661
685
|
dts: "",
|
|
662
|
-
js:
|
|
686
|
+
js: import_outdent9.outdent`
|
|
663
687
|
${ctx.file.import("createCss, withoutSpace, compact", "../helpers")}
|
|
664
688
|
|
|
665
689
|
export const createRecipe = (name, defaultVariants) => {
|
|
@@ -699,13 +723,13 @@ function generateRecipes(ctx) {
|
|
|
699
723
|
const { name, description, defaultVariants } = config;
|
|
700
724
|
return {
|
|
701
725
|
name: dashName,
|
|
702
|
-
js:
|
|
726
|
+
js: import_outdent9.outdent`
|
|
703
727
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
704
728
|
|
|
705
729
|
export const ${name} = createRecipe('${name}', ${JSON.stringify(defaultVariants ?? {})})
|
|
706
730
|
${name}.variants = ${JSON.stringify(variantKeyMap)}
|
|
707
731
|
`,
|
|
708
|
-
dts:
|
|
732
|
+
dts: import_outdent9.outdent`
|
|
709
733
|
import type { ConditionalValue } from '../types'
|
|
710
734
|
|
|
711
735
|
type ${upperName}Variant = {
|
|
@@ -731,7 +755,7 @@ function generateRecipes(ctx) {
|
|
|
731
755
|
}
|
|
732
756
|
|
|
733
757
|
// src/artifacts/js/token.ts
|
|
734
|
-
var
|
|
758
|
+
var import_outdent10 = __toESM(require("outdent"));
|
|
735
759
|
function generateTokenJs(ctx) {
|
|
736
760
|
const { tokens } = ctx;
|
|
737
761
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -742,7 +766,7 @@ function generateTokenJs(ctx) {
|
|
|
742
766
|
});
|
|
743
767
|
const obj = Object.fromEntries(map);
|
|
744
768
|
return {
|
|
745
|
-
js:
|
|
769
|
+
js: import_outdent10.default`
|
|
746
770
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
747
771
|
|
|
748
772
|
export function token(path, fallback) {
|
|
@@ -755,7 +779,7 @@ function generateTokenJs(ctx) {
|
|
|
755
779
|
|
|
756
780
|
token.var = tokenVar
|
|
757
781
|
`,
|
|
758
|
-
dts:
|
|
782
|
+
dts: import_outdent10.default`
|
|
759
783
|
import type { Token } from '../types/token'
|
|
760
784
|
|
|
761
785
|
export declare function token(path: Token, fallback?: string): string & {
|
|
@@ -766,11 +790,11 @@ function generateTokenJs(ctx) {
|
|
|
766
790
|
}
|
|
767
791
|
|
|
768
792
|
// src/artifacts/preact-jsx/jsx.ts
|
|
769
|
-
var
|
|
793
|
+
var import_outdent11 = require("outdent");
|
|
770
794
|
function generatePreactJsxFactory(ctx) {
|
|
771
795
|
const { factoryName, componentName } = ctx.jsx;
|
|
772
796
|
return {
|
|
773
|
-
js:
|
|
797
|
+
js: import_outdent11.outdent`
|
|
774
798
|
import { h } from 'preact'
|
|
775
799
|
import { forwardRef } from 'preact/compat'
|
|
776
800
|
import { useMemo } from 'preact/hooks'
|
|
@@ -829,10 +853,10 @@ function generatePreactJsxFactory(ctx) {
|
|
|
829
853
|
}
|
|
830
854
|
|
|
831
855
|
// src/artifacts/preact-jsx/layout-grid.ts
|
|
832
|
-
var
|
|
856
|
+
var import_outdent12 = require("outdent");
|
|
833
857
|
function generatePreactLayoutGrid() {
|
|
834
858
|
return {
|
|
835
|
-
dts:
|
|
859
|
+
dts: import_outdent12.outdent`
|
|
836
860
|
import { FunctionComponent } from 'preact'
|
|
837
861
|
|
|
838
862
|
export type LayoutGridProps = {
|
|
@@ -845,7 +869,7 @@ function generatePreactLayoutGrid() {
|
|
|
845
869
|
|
|
846
870
|
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
847
871
|
`,
|
|
848
|
-
js:
|
|
872
|
+
js: import_outdent12.outdent`
|
|
849
873
|
import { h } from 'preact'
|
|
850
874
|
|
|
851
875
|
export function LayoutGrid(props) {
|
|
@@ -874,7 +898,7 @@ function generatePreactLayoutGrid() {
|
|
|
874
898
|
}
|
|
875
899
|
|
|
876
900
|
// src/artifacts/preact-jsx/pattern.ts
|
|
877
|
-
var
|
|
901
|
+
var import_outdent13 = require("outdent");
|
|
878
902
|
var import_ts_pattern2 = require("ts-pattern");
|
|
879
903
|
function generatePreactJsxPattern(ctx) {
|
|
880
904
|
const {
|
|
@@ -886,7 +910,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
886
910
|
const { typeName } = ctx.jsx;
|
|
887
911
|
return {
|
|
888
912
|
name: dashName,
|
|
889
|
-
js:
|
|
913
|
+
js: import_outdent13.outdent`
|
|
890
914
|
import { h } from 'preact'
|
|
891
915
|
import { forwardRef } from 'preact/compat'
|
|
892
916
|
${ctx.file.import(jsxFactory, "./factory")}
|
|
@@ -895,11 +919,11 @@ function generatePreactJsxPattern(ctx) {
|
|
|
895
919
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
896
920
|
${(0, import_ts_pattern2.match)(props.length).with(
|
|
897
921
|
0,
|
|
898
|
-
() =>
|
|
922
|
+
() => import_outdent13.outdent`
|
|
899
923
|
return h(${jsxFactory}.div, { ref, ...props })
|
|
900
924
|
`
|
|
901
925
|
).otherwise(
|
|
902
|
-
() =>
|
|
926
|
+
() => import_outdent13.outdent`
|
|
903
927
|
const { ${props.join(", ")}, ...restProps } = props
|
|
904
928
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
905
929
|
return h(${jsxFactory}.div, { ref, ...styleProps, ...restProps })
|
|
@@ -907,7 +931,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
907
931
|
)}
|
|
908
932
|
})
|
|
909
933
|
`,
|
|
910
|
-
dts:
|
|
934
|
+
dts: import_outdent13.outdent`
|
|
911
935
|
import type { FunctionComponent } from 'preact'
|
|
912
936
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
913
937
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -922,15 +946,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
922
946
|
}
|
|
923
947
|
|
|
924
948
|
// src/artifacts/preact-jsx/types.ts
|
|
925
|
-
var
|
|
949
|
+
var import_outdent14 = require("outdent");
|
|
926
950
|
function generatePreactJsxTypes(ctx) {
|
|
927
951
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
928
952
|
return {
|
|
929
|
-
jsxFactory:
|
|
953
|
+
jsxFactory: import_outdent14.outdent`
|
|
930
954
|
import type { ${upperName} } from '../types/jsx'
|
|
931
955
|
export declare const ${factoryName}: ${upperName}
|
|
932
956
|
`,
|
|
933
|
-
jsxType:
|
|
957
|
+
jsxType: import_outdent14.outdent`
|
|
934
958
|
import type { JSX, ComponentProps } from 'preact'
|
|
935
959
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
936
960
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -954,11 +978,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
954
978
|
}
|
|
955
979
|
|
|
956
980
|
// src/artifacts/react-jsx/jsx.ts
|
|
957
|
-
var
|
|
981
|
+
var import_outdent15 = require("outdent");
|
|
958
982
|
function generateReactJsxFactory(ctx) {
|
|
959
983
|
const { factoryName, componentName } = ctx.jsx;
|
|
960
984
|
return {
|
|
961
|
-
js:
|
|
985
|
+
js: import_outdent15.outdent`
|
|
962
986
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
963
987
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
964
988
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1016,10 +1040,10 @@ function generateReactJsxFactory(ctx) {
|
|
|
1016
1040
|
}
|
|
1017
1041
|
|
|
1018
1042
|
// src/artifacts/react-jsx/layout-grid.ts
|
|
1019
|
-
var
|
|
1043
|
+
var import_outdent16 = require("outdent");
|
|
1020
1044
|
function generateReactLayoutGrid() {
|
|
1021
1045
|
return {
|
|
1022
|
-
dts:
|
|
1046
|
+
dts: import_outdent16.outdent`
|
|
1023
1047
|
import type { FunctionComponent } from 'react'
|
|
1024
1048
|
|
|
1025
1049
|
export type LayoutGridProps = {
|
|
@@ -1032,7 +1056,7 @@ function generateReactLayoutGrid() {
|
|
|
1032
1056
|
|
|
1033
1057
|
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
1034
1058
|
`,
|
|
1035
|
-
js:
|
|
1059
|
+
js: import_outdent16.outdent`
|
|
1036
1060
|
import { createElement } from 'react'
|
|
1037
1061
|
|
|
1038
1062
|
export function LayoutGrid(props) {
|
|
@@ -1061,7 +1085,7 @@ function generateReactLayoutGrid() {
|
|
|
1061
1085
|
}
|
|
1062
1086
|
|
|
1063
1087
|
// src/artifacts/react-jsx/pattern.ts
|
|
1064
|
-
var
|
|
1088
|
+
var import_outdent17 = require("outdent");
|
|
1065
1089
|
var import_ts_pattern3 = require("ts-pattern");
|
|
1066
1090
|
function generateReactJsxPattern(ctx) {
|
|
1067
1091
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1070,7 +1094,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1070
1094
|
const { description } = pattern.config;
|
|
1071
1095
|
return {
|
|
1072
1096
|
name: dashName,
|
|
1073
|
-
js:
|
|
1097
|
+
js: import_outdent17.outdent`
|
|
1074
1098
|
import { createElement, forwardRef } from 'react'
|
|
1075
1099
|
${ctx.file.import(factoryName, "./factory")}
|
|
1076
1100
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1078,11 +1102,11 @@ function generateReactJsxPattern(ctx) {
|
|
|
1078
1102
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1079
1103
|
${(0, import_ts_pattern3.match)(props.length).with(
|
|
1080
1104
|
0,
|
|
1081
|
-
() =>
|
|
1105
|
+
() => import_outdent17.outdent`
|
|
1082
1106
|
return createElement(${factoryName}.div, { ref, ...props })
|
|
1083
1107
|
`
|
|
1084
1108
|
).otherwise(
|
|
1085
|
-
() =>
|
|
1109
|
+
() => import_outdent17.outdent`
|
|
1086
1110
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1087
1111
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1088
1112
|
return createElement(${factoryName}.div, { ref, ...styleProps, ...restProps })
|
|
@@ -1090,7 +1114,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1090
1114
|
)}
|
|
1091
1115
|
})
|
|
1092
1116
|
`,
|
|
1093
|
-
dts:
|
|
1117
|
+
dts: import_outdent17.outdent`
|
|
1094
1118
|
import type { FunctionComponent } from 'react'
|
|
1095
1119
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1096
1120
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1105,15 +1129,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1105
1129
|
}
|
|
1106
1130
|
|
|
1107
1131
|
// src/artifacts/react-jsx/types.ts
|
|
1108
|
-
var
|
|
1132
|
+
var import_outdent18 = require("outdent");
|
|
1109
1133
|
function generateReactJsxTypes(ctx) {
|
|
1110
1134
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1111
1135
|
return {
|
|
1112
|
-
jsxFactory:
|
|
1136
|
+
jsxFactory: import_outdent18.outdent`
|
|
1113
1137
|
import { ${upperName} } from '../types/jsx'
|
|
1114
1138
|
export declare const ${factoryName}: ${upperName}
|
|
1115
1139
|
`,
|
|
1116
|
-
jsxType:
|
|
1140
|
+
jsxType: import_outdent18.outdent`
|
|
1117
1141
|
import type { ElementType, ComponentProps } from 'react'
|
|
1118
1142
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1119
1143
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1135,11 +1159,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1135
1159
|
}
|
|
1136
1160
|
|
|
1137
1161
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1138
|
-
var
|
|
1162
|
+
var import_outdent19 = require("outdent");
|
|
1139
1163
|
function generateSolidJsxFactory(ctx) {
|
|
1140
1164
|
const { componentName, factoryName } = ctx.jsx;
|
|
1141
1165
|
return {
|
|
1142
|
-
js:
|
|
1166
|
+
js: import_outdent19.outdent`
|
|
1143
1167
|
import { Dynamic } from 'solid-js/web'
|
|
1144
1168
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1145
1169
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1208,10 +1232,10 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1208
1232
|
}
|
|
1209
1233
|
|
|
1210
1234
|
// src/artifacts/solid-jsx/layout-grid.ts
|
|
1211
|
-
var
|
|
1235
|
+
var import_outdent20 = require("outdent");
|
|
1212
1236
|
function generateSolidLayoutGrid() {
|
|
1213
1237
|
return {
|
|
1214
|
-
dts:
|
|
1238
|
+
dts: import_outdent20.outdent`
|
|
1215
1239
|
import type { ParentProps } from 'solid-js'
|
|
1216
1240
|
|
|
1217
1241
|
export type LayoutGridProps = {
|
|
@@ -1224,7 +1248,7 @@ function generateSolidLayoutGrid() {
|
|
|
1224
1248
|
|
|
1225
1249
|
export declare const LayoutGrid: ParentProps<LayoutGridProps>
|
|
1226
1250
|
`,
|
|
1227
|
-
js:
|
|
1251
|
+
js: import_outdent20.outdent`
|
|
1228
1252
|
import { createComponent, For } from 'solid-js/web'
|
|
1229
1253
|
|
|
1230
1254
|
export function LayoutGrid(props) {
|
|
@@ -1259,7 +1283,7 @@ function generateSolidLayoutGrid() {
|
|
|
1259
1283
|
}
|
|
1260
1284
|
|
|
1261
1285
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1262
|
-
var
|
|
1286
|
+
var import_outdent21 = require("outdent");
|
|
1263
1287
|
var import_ts_pattern4 = require("ts-pattern");
|
|
1264
1288
|
function generateSolidJsxPattern(ctx) {
|
|
1265
1289
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1268,7 +1292,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1268
1292
|
const { typeName, factoryName } = ctx.jsx;
|
|
1269
1293
|
return {
|
|
1270
1294
|
name: dashName,
|
|
1271
|
-
js:
|
|
1295
|
+
js: import_outdent21.outdent`
|
|
1272
1296
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1273
1297
|
import { createComponent } from 'solid-js/web'
|
|
1274
1298
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1277,11 +1301,11 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1277
1301
|
export function ${jsxName}(props) {
|
|
1278
1302
|
${(0, import_ts_pattern4.match)(props.length).with(
|
|
1279
1303
|
0,
|
|
1280
|
-
() =>
|
|
1304
|
+
() => import_outdent21.outdent`
|
|
1281
1305
|
return createComponent(${factoryName}.div, props)
|
|
1282
1306
|
`
|
|
1283
1307
|
).otherwise(
|
|
1284
|
-
() =>
|
|
1308
|
+
() => import_outdent21.outdent`
|
|
1285
1309
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1286
1310
|
const styleProps = ${styleFnName}(patternProps)
|
|
1287
1311
|
return createComponent(${factoryName}.div, mergeProps(styleProps, restProps))
|
|
@@ -1289,7 +1313,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1289
1313
|
)}
|
|
1290
1314
|
}
|
|
1291
1315
|
`,
|
|
1292
|
-
dts:
|
|
1316
|
+
dts: import_outdent21.outdent`
|
|
1293
1317
|
import { Component } from 'solid-js'
|
|
1294
1318
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1295
1319
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1304,15 +1328,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1304
1328
|
}
|
|
1305
1329
|
|
|
1306
1330
|
// src/artifacts/solid-jsx/types.ts
|
|
1307
|
-
var
|
|
1331
|
+
var import_outdent22 = require("outdent");
|
|
1308
1332
|
function generateSolidJsxTypes(ctx) {
|
|
1309
1333
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1310
1334
|
return {
|
|
1311
|
-
jsxFactory:
|
|
1335
|
+
jsxFactory: import_outdent22.outdent`
|
|
1312
1336
|
import type { ${upperName} } from '../types/jsx'
|
|
1313
1337
|
export declare const ${factoryName}: ${upperName}
|
|
1314
1338
|
`,
|
|
1315
|
-
jsxType:
|
|
1339
|
+
jsxType: import_outdent22.outdent`
|
|
1316
1340
|
import type { JSX, ComponentProps, Component } from 'solid-js'
|
|
1317
1341
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1318
1342
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1336,11 +1360,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1336
1360
|
}
|
|
1337
1361
|
|
|
1338
1362
|
// src/artifacts/vue-jsx/jsx.ts
|
|
1339
|
-
var
|
|
1363
|
+
var import_outdent23 = require("outdent");
|
|
1340
1364
|
function generateVueJsxFactory(ctx) {
|
|
1341
1365
|
const { factoryName } = ctx.jsx;
|
|
1342
1366
|
return {
|
|
1343
|
-
js:
|
|
1367
|
+
js: import_outdent23.outdent`
|
|
1344
1368
|
import { defineComponent, h, computed } from 'vue'
|
|
1345
1369
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1346
1370
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1405,10 +1429,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
1405
1429
|
}
|
|
1406
1430
|
|
|
1407
1431
|
// src/artifacts/vue-jsx/layout-grid.ts
|
|
1408
|
-
var
|
|
1432
|
+
var import_outdent24 = require("outdent");
|
|
1409
1433
|
function generateVueLayoutGrid() {
|
|
1410
1434
|
return {
|
|
1411
|
-
dts:
|
|
1435
|
+
dts: import_outdent24.outdent`
|
|
1412
1436
|
import type { FunctionalComponent } from 'vue'
|
|
1413
1437
|
|
|
1414
1438
|
export type LayoutGridProps = {
|
|
@@ -1421,7 +1445,7 @@ function generateVueLayoutGrid() {
|
|
|
1421
1445
|
|
|
1422
1446
|
export declare const LayoutGrid: FunctionalComponent<LayoutGridProps>
|
|
1423
1447
|
`,
|
|
1424
|
-
js:
|
|
1448
|
+
js: import_outdent24.outdent`
|
|
1425
1449
|
import { h, computed, defineComponent } from 'vue'
|
|
1426
1450
|
|
|
1427
1451
|
export const LayoutGrid = defineComponent({
|
|
@@ -1476,15 +1500,15 @@ function generateVueLayoutGrid() {
|
|
|
1476
1500
|
}
|
|
1477
1501
|
|
|
1478
1502
|
// src/artifacts/vue-jsx/types.ts
|
|
1479
|
-
var
|
|
1503
|
+
var import_outdent25 = require("outdent");
|
|
1480
1504
|
function generateVueJsxTypes(ctx) {
|
|
1481
1505
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1482
1506
|
return {
|
|
1483
|
-
jsxFactory:
|
|
1507
|
+
jsxFactory: import_outdent25.outdent`
|
|
1484
1508
|
import { ${upperName} } from '../types/jsx'
|
|
1485
1509
|
export declare const ${factoryName}: ${upperName}
|
|
1486
1510
|
`,
|
|
1487
|
-
jsxType:
|
|
1511
|
+
jsxType: import_outdent25.outdent`
|
|
1488
1512
|
import type { Component, FunctionalComponent } from 'vue'
|
|
1489
1513
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1490
1514
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1752,9 +1776,9 @@ function getGeneratedTypes() {
|
|
|
1752
1776
|
}
|
|
1753
1777
|
|
|
1754
1778
|
// src/artifacts/types/main.ts
|
|
1755
|
-
var
|
|
1779
|
+
var import_outdent26 = require("outdent");
|
|
1756
1780
|
var generateTypesEntry = () => ({
|
|
1757
|
-
global:
|
|
1781
|
+
global: import_outdent26.outdent`
|
|
1758
1782
|
import { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
1759
1783
|
import { GlobalStyleObject } from './system-types'
|
|
1760
1784
|
import { CompositionStyles } from './composition'
|
|
@@ -1766,7 +1790,7 @@ var generateTypesEntry = () => ({
|
|
|
1766
1790
|
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
|
|
1767
1791
|
}
|
|
1768
1792
|
`,
|
|
1769
|
-
index:
|
|
1793
|
+
index: import_outdent26.outdent`
|
|
1770
1794
|
import './global'
|
|
1771
1795
|
export { ConditionalValue } from './conditions'
|
|
1772
1796
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
@@ -1775,7 +1799,7 @@ var generateTypesEntry = () => ({
|
|
|
1775
1799
|
});
|
|
1776
1800
|
|
|
1777
1801
|
// src/artifacts/types/prop-types.ts
|
|
1778
|
-
var
|
|
1802
|
+
var import_outdent27 = require("outdent");
|
|
1779
1803
|
function generatePropTypes(ctx) {
|
|
1780
1804
|
const {
|
|
1781
1805
|
config: { strictTokens },
|
|
@@ -1783,7 +1807,7 @@ function generatePropTypes(ctx) {
|
|
|
1783
1807
|
} = ctx;
|
|
1784
1808
|
const strictText = `${strictTokens ? "" : " | NativeValue<T>"}`;
|
|
1785
1809
|
const result = [
|
|
1786
|
-
|
|
1810
|
+
import_outdent27.outdent`
|
|
1787
1811
|
import type { ConditionalValue } from './conditions';
|
|
1788
1812
|
import type { Properties as CSSProperties } from './csstype'
|
|
1789
1813
|
import type { Tokens } from './token'
|
|
@@ -1806,7 +1830,7 @@ function generatePropTypes(ctx) {
|
|
|
1806
1830
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
1807
1831
|
});
|
|
1808
1832
|
result.push("}");
|
|
1809
|
-
return
|
|
1833
|
+
return import_outdent27.outdent`
|
|
1810
1834
|
${result.join("\n")}
|
|
1811
1835
|
|
|
1812
1836
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -1819,10 +1843,10 @@ function generatePropTypes(ctx) {
|
|
|
1819
1843
|
|
|
1820
1844
|
// src/artifacts/types/style-props.ts
|
|
1821
1845
|
var import_is_valid_prop = require("@pandacss/is-valid-prop");
|
|
1822
|
-
var
|
|
1846
|
+
var import_outdent28 = __toESM(require("outdent"));
|
|
1823
1847
|
function generateStyleProps(ctx) {
|
|
1824
1848
|
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
|
|
1825
|
-
return
|
|
1849
|
+
return import_outdent28.default`
|
|
1826
1850
|
import { PropertyValue } from './prop-type'
|
|
1827
1851
|
import { Token } from './token'
|
|
1828
1852
|
|
|
@@ -1838,7 +1862,7 @@ function generateStyleProps(ctx) {
|
|
|
1838
1862
|
|
|
1839
1863
|
// src/artifacts/types/token-types.ts
|
|
1840
1864
|
var import_shared3 = require("@pandacss/shared");
|
|
1841
|
-
var
|
|
1865
|
+
var import_outdent29 = require("outdent");
|
|
1842
1866
|
var import_pluralize = __toESM(require("pluralize"));
|
|
1843
1867
|
function generateTokenTypes(ctx) {
|
|
1844
1868
|
const { tokens } = ctx;
|
|
@@ -1857,7 +1881,7 @@ function generateTokenTypes(ctx) {
|
|
|
1857
1881
|
}
|
|
1858
1882
|
result.add("} & { [token: string]: never }");
|
|
1859
1883
|
set.add(Array.from(result).join("\n"));
|
|
1860
|
-
return
|
|
1884
|
+
return import_outdent29.outdent.string(Array.from(set).join("\n\n"));
|
|
1861
1885
|
}
|
|
1862
1886
|
|
|
1863
1887
|
// src/artifacts/css/global-css.ts
|
|
@@ -1931,7 +1955,7 @@ var generateStaticCss = (ctx) => {
|
|
|
1931
1955
|
|
|
1932
1956
|
// src/artifacts/index.ts
|
|
1933
1957
|
function setupHelpers(ctx) {
|
|
1934
|
-
const code =
|
|
1958
|
+
const code = generateHelpers();
|
|
1935
1959
|
return {
|
|
1936
1960
|
files: [{ file: ctx.file.ext("helpers"), code: code.js }]
|
|
1937
1961
|
};
|
|
@@ -2018,8 +2042,8 @@ function setupRecipes(ctx) {
|
|
|
2018
2042
|
return;
|
|
2019
2043
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
2020
2044
|
const index = {
|
|
2021
|
-
js:
|
|
2022
|
-
dts:
|
|
2045
|
+
js: import_outdent30.default.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2046
|
+
dts: import_outdent30.default.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2023
2047
|
};
|
|
2024
2048
|
return {
|
|
2025
2049
|
dir: ctx.paths.recipe,
|
|
@@ -2036,8 +2060,8 @@ function setupPatterns(ctx) {
|
|
|
2036
2060
|
if (!files)
|
|
2037
2061
|
return;
|
|
2038
2062
|
const index = {
|
|
2039
|
-
js:
|
|
2040
|
-
dts:
|
|
2063
|
+
js: import_outdent30.default.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2064
|
+
dts: import_outdent30.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2041
2065
|
};
|
|
2042
2066
|
return {
|
|
2043
2067
|
dir: ctx.paths.pattern,
|
|
@@ -2058,15 +2082,15 @@ function setupJsx(ctx) {
|
|
|
2058
2082
|
const patterns = generateJsxPatterns(ctx);
|
|
2059
2083
|
const layoutGrid2 = generateLayoutGrid(ctx);
|
|
2060
2084
|
const index = {
|
|
2061
|
-
js:
|
|
2085
|
+
js: import_outdent30.default`
|
|
2062
2086
|
${ctx.file.export("./factory")}
|
|
2063
2087
|
${ctx.file.export("./layout-grid")}
|
|
2064
|
-
${
|
|
2088
|
+
${import_outdent30.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2065
2089
|
`,
|
|
2066
|
-
dts:
|
|
2090
|
+
dts: import_outdent30.default`
|
|
2067
2091
|
export * from './factory'
|
|
2068
2092
|
export * from './layout-grid'
|
|
2069
|
-
${
|
|
2093
|
+
${import_outdent30.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2070
2094
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2071
2095
|
`
|
|
2072
2096
|
};
|
|
@@ -2087,12 +2111,12 @@ function setupJsx(ctx) {
|
|
|
2087
2111
|
}
|
|
2088
2112
|
function setupCssIndex(ctx) {
|
|
2089
2113
|
const index = {
|
|
2090
|
-
js:
|
|
2114
|
+
js: import_outdent30.default`
|
|
2091
2115
|
${ctx.file.export("./css")}
|
|
2092
2116
|
${ctx.file.export("./cx")}
|
|
2093
2117
|
${ctx.file.export("./cva")}
|
|
2094
2118
|
`,
|
|
2095
|
-
dts:
|
|
2119
|
+
dts: import_outdent30.default`
|
|
2096
2120
|
export * from './css'
|
|
2097
2121
|
export * from './cx'
|
|
2098
2122
|
export * from './cva'
|
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 outdent30 from "outdent";
|
|
100
100
|
|
|
101
101
|
// src/artifacts/css/keyframe-css.ts
|
|
102
102
|
import { toCss } from "@pandacss/core";
|
|
@@ -527,14 +527,29 @@ function generateCx() {
|
|
|
527
527
|
};
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
+
// src/artifacts/js/helpers.ts
|
|
531
|
+
import { outdent as outdent7 } from "outdent";
|
|
532
|
+
|
|
530
533
|
// src/artifacts/generated/helpers.mjs.json
|
|
531
534
|
var helpers_mjs_default = {
|
|
532
535
|
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nfunction isImportant(value) {\n return typeof value === "string" ? /!(important)?$/.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(/!(important)?$/, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n result[key] = inner(child, childPath);\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/normalize-html.ts\nvar htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];\nfunction convert(key) {\n return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;\n}\nfunction normalizeHTMLProps(props) {\n return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));\n}\nnormalizeHTMLProps.keys = htmlProps;\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate.ts\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);\n});\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n mergeProps,\n normalizeHTMLProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
|
|
533
536
|
};
|
|
534
537
|
|
|
535
538
|
// src/artifacts/js/helpers.ts
|
|
536
|
-
function
|
|
537
|
-
return {
|
|
539
|
+
function generateHelpers() {
|
|
540
|
+
return {
|
|
541
|
+
js: outdent7`
|
|
542
|
+
${helpers_mjs_default.content}
|
|
543
|
+
|
|
544
|
+
export function __spreadValues(a, b){
|
|
545
|
+
return { ...a, ...b }
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export function __objRest(source, exclude){
|
|
549
|
+
return Object.fromEntries(Object.entries(source).filter(([key]) => !exclude.includes(key)))
|
|
550
|
+
}
|
|
551
|
+
`
|
|
552
|
+
};
|
|
538
553
|
}
|
|
539
554
|
|
|
540
555
|
// src/artifacts/generated/is-valid-prop.mjs.json
|
|
@@ -557,7 +572,7 @@ function generateisValidProp(ctx) {
|
|
|
557
572
|
// src/artifacts/js/pattern.ts
|
|
558
573
|
import { unionType } from "@pandacss/shared";
|
|
559
574
|
import { stringify as stringify2 } from "javascript-stringify";
|
|
560
|
-
import { outdent as
|
|
575
|
+
import { outdent as outdent8 } from "outdent";
|
|
561
576
|
import { match } from "ts-pattern";
|
|
562
577
|
function generatePattern(ctx) {
|
|
563
578
|
if (ctx.patterns.isEmpty())
|
|
@@ -565,9 +580,17 @@ function generatePattern(ctx) {
|
|
|
565
580
|
return ctx.patterns.details.map((pattern) => {
|
|
566
581
|
const { name, config, dashName, upperName, styleFnName, blocklistType } = pattern;
|
|
567
582
|
const { properties, transform, strict, description } = config;
|
|
583
|
+
const transformFn = stringify2({ transform }) ?? "";
|
|
584
|
+
const helperImports = ["mapObject"];
|
|
585
|
+
if (transformFn.includes("__spreadValues")) {
|
|
586
|
+
helperImports.push("__spreadValues");
|
|
587
|
+
}
|
|
588
|
+
if (transformFn.includes("__objRest")) {
|
|
589
|
+
helperImports.push("__objRest");
|
|
590
|
+
}
|
|
568
591
|
return {
|
|
569
592
|
name: dashName,
|
|
570
|
-
dts:
|
|
593
|
+
dts: outdent8`
|
|
571
594
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
572
595
|
import type { PropertyValue } from '../types/prop-type'
|
|
573
596
|
import type { Properties } from '../types/csstype'
|
|
@@ -591,7 +614,7 @@ function generatePattern(ctx) {
|
|
|
591
614
|
}).join("\n ")}
|
|
592
615
|
}
|
|
593
616
|
|
|
594
|
-
${strict ?
|
|
617
|
+
${strict ? outdent8`export declare function ${name}(options: ${upperName}Properties): string` : outdent8`
|
|
595
618
|
|
|
596
619
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
597
620
|
|
|
@@ -600,11 +623,12 @@ function generatePattern(ctx) {
|
|
|
600
623
|
`}
|
|
601
624
|
|
|
602
625
|
`,
|
|
603
|
-
js:
|
|
604
|
-
${ctx.file.import("
|
|
626
|
+
js: outdent8`
|
|
627
|
+
${ctx.file.import(helperImports.join(", "), "../helpers")}
|
|
605
628
|
${ctx.file.import("css", "../css/index")}
|
|
606
629
|
|
|
607
|
-
const ${name}Config = ${
|
|
630
|
+
const ${name}Config = ${transformFn.replace(`{transform`, `{
|
|
631
|
+
transform`)}
|
|
608
632
|
|
|
609
633
|
export const ${styleFnName} = (styles) => ${name}Config.transform(styles, { map: mapObject })
|
|
610
634
|
|
|
@@ -616,7 +640,7 @@ function generatePattern(ctx) {
|
|
|
616
640
|
|
|
617
641
|
// src/artifacts/js/recipe.ts
|
|
618
642
|
import { unionType as unionType2 } from "@pandacss/shared";
|
|
619
|
-
import { outdent as
|
|
643
|
+
import { outdent as outdent9 } from "outdent";
|
|
620
644
|
function generateRecipes(ctx) {
|
|
621
645
|
const {
|
|
622
646
|
recipes,
|
|
@@ -628,7 +652,7 @@ function generateRecipes(ctx) {
|
|
|
628
652
|
const createRecipeFn = {
|
|
629
653
|
name: "create-recipe",
|
|
630
654
|
dts: "",
|
|
631
|
-
js:
|
|
655
|
+
js: outdent9`
|
|
632
656
|
${ctx.file.import("createCss, withoutSpace, compact", "../helpers")}
|
|
633
657
|
|
|
634
658
|
export const createRecipe = (name, defaultVariants) => {
|
|
@@ -668,13 +692,13 @@ function generateRecipes(ctx) {
|
|
|
668
692
|
const { name, description, defaultVariants } = config;
|
|
669
693
|
return {
|
|
670
694
|
name: dashName,
|
|
671
|
-
js:
|
|
695
|
+
js: outdent9`
|
|
672
696
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
673
697
|
|
|
674
698
|
export const ${name} = createRecipe('${name}', ${JSON.stringify(defaultVariants ?? {})})
|
|
675
699
|
${name}.variants = ${JSON.stringify(variantKeyMap)}
|
|
676
700
|
`,
|
|
677
|
-
dts:
|
|
701
|
+
dts: outdent9`
|
|
678
702
|
import type { ConditionalValue } from '../types'
|
|
679
703
|
|
|
680
704
|
type ${upperName}Variant = {
|
|
@@ -700,7 +724,7 @@ function generateRecipes(ctx) {
|
|
|
700
724
|
}
|
|
701
725
|
|
|
702
726
|
// src/artifacts/js/token.ts
|
|
703
|
-
import
|
|
727
|
+
import outdent10 from "outdent";
|
|
704
728
|
function generateTokenJs(ctx) {
|
|
705
729
|
const { tokens } = ctx;
|
|
706
730
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -711,7 +735,7 @@ function generateTokenJs(ctx) {
|
|
|
711
735
|
});
|
|
712
736
|
const obj = Object.fromEntries(map);
|
|
713
737
|
return {
|
|
714
|
-
js:
|
|
738
|
+
js: outdent10`
|
|
715
739
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
716
740
|
|
|
717
741
|
export function token(path, fallback) {
|
|
@@ -724,7 +748,7 @@ function generateTokenJs(ctx) {
|
|
|
724
748
|
|
|
725
749
|
token.var = tokenVar
|
|
726
750
|
`,
|
|
727
|
-
dts:
|
|
751
|
+
dts: outdent10`
|
|
728
752
|
import type { Token } from '../types/token'
|
|
729
753
|
|
|
730
754
|
export declare function token(path: Token, fallback?: string): string & {
|
|
@@ -735,11 +759,11 @@ function generateTokenJs(ctx) {
|
|
|
735
759
|
}
|
|
736
760
|
|
|
737
761
|
// src/artifacts/preact-jsx/jsx.ts
|
|
738
|
-
import { outdent as
|
|
762
|
+
import { outdent as outdent11 } from "outdent";
|
|
739
763
|
function generatePreactJsxFactory(ctx) {
|
|
740
764
|
const { factoryName, componentName } = ctx.jsx;
|
|
741
765
|
return {
|
|
742
|
-
js:
|
|
766
|
+
js: outdent11`
|
|
743
767
|
import { h } from 'preact'
|
|
744
768
|
import { forwardRef } from 'preact/compat'
|
|
745
769
|
import { useMemo } from 'preact/hooks'
|
|
@@ -798,10 +822,10 @@ function generatePreactJsxFactory(ctx) {
|
|
|
798
822
|
}
|
|
799
823
|
|
|
800
824
|
// src/artifacts/preact-jsx/layout-grid.ts
|
|
801
|
-
import { outdent as
|
|
825
|
+
import { outdent as outdent12 } from "outdent";
|
|
802
826
|
function generatePreactLayoutGrid() {
|
|
803
827
|
return {
|
|
804
|
-
dts:
|
|
828
|
+
dts: outdent12`
|
|
805
829
|
import { FunctionComponent } from 'preact'
|
|
806
830
|
|
|
807
831
|
export type LayoutGridProps = {
|
|
@@ -814,7 +838,7 @@ function generatePreactLayoutGrid() {
|
|
|
814
838
|
|
|
815
839
|
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
816
840
|
`,
|
|
817
|
-
js:
|
|
841
|
+
js: outdent12`
|
|
818
842
|
import { h } from 'preact'
|
|
819
843
|
|
|
820
844
|
export function LayoutGrid(props) {
|
|
@@ -843,7 +867,7 @@ function generatePreactLayoutGrid() {
|
|
|
843
867
|
}
|
|
844
868
|
|
|
845
869
|
// src/artifacts/preact-jsx/pattern.ts
|
|
846
|
-
import { outdent as
|
|
870
|
+
import { outdent as outdent13 } from "outdent";
|
|
847
871
|
import { match as match2 } from "ts-pattern";
|
|
848
872
|
function generatePreactJsxPattern(ctx) {
|
|
849
873
|
const {
|
|
@@ -855,7 +879,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
855
879
|
const { typeName } = ctx.jsx;
|
|
856
880
|
return {
|
|
857
881
|
name: dashName,
|
|
858
|
-
js:
|
|
882
|
+
js: outdent13`
|
|
859
883
|
import { h } from 'preact'
|
|
860
884
|
import { forwardRef } from 'preact/compat'
|
|
861
885
|
${ctx.file.import(jsxFactory, "./factory")}
|
|
@@ -864,11 +888,11 @@ function generatePreactJsxPattern(ctx) {
|
|
|
864
888
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
865
889
|
${match2(props.length).with(
|
|
866
890
|
0,
|
|
867
|
-
() =>
|
|
891
|
+
() => outdent13`
|
|
868
892
|
return h(${jsxFactory}.div, { ref, ...props })
|
|
869
893
|
`
|
|
870
894
|
).otherwise(
|
|
871
|
-
() =>
|
|
895
|
+
() => outdent13`
|
|
872
896
|
const { ${props.join(", ")}, ...restProps } = props
|
|
873
897
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
874
898
|
return h(${jsxFactory}.div, { ref, ...styleProps, ...restProps })
|
|
@@ -876,7 +900,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
876
900
|
)}
|
|
877
901
|
})
|
|
878
902
|
`,
|
|
879
|
-
dts:
|
|
903
|
+
dts: outdent13`
|
|
880
904
|
import type { FunctionComponent } from 'preact'
|
|
881
905
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
882
906
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -891,15 +915,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
891
915
|
}
|
|
892
916
|
|
|
893
917
|
// src/artifacts/preact-jsx/types.ts
|
|
894
|
-
import { outdent as
|
|
918
|
+
import { outdent as outdent14 } from "outdent";
|
|
895
919
|
function generatePreactJsxTypes(ctx) {
|
|
896
920
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
897
921
|
return {
|
|
898
|
-
jsxFactory:
|
|
922
|
+
jsxFactory: outdent14`
|
|
899
923
|
import type { ${upperName} } from '../types/jsx'
|
|
900
924
|
export declare const ${factoryName}: ${upperName}
|
|
901
925
|
`,
|
|
902
|
-
jsxType:
|
|
926
|
+
jsxType: outdent14`
|
|
903
927
|
import type { JSX, ComponentProps } from 'preact'
|
|
904
928
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
905
929
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -923,11 +947,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
923
947
|
}
|
|
924
948
|
|
|
925
949
|
// src/artifacts/react-jsx/jsx.ts
|
|
926
|
-
import { outdent as
|
|
950
|
+
import { outdent as outdent15 } from "outdent";
|
|
927
951
|
function generateReactJsxFactory(ctx) {
|
|
928
952
|
const { factoryName, componentName } = ctx.jsx;
|
|
929
953
|
return {
|
|
930
|
-
js:
|
|
954
|
+
js: outdent15`
|
|
931
955
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
932
956
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
933
957
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -985,10 +1009,10 @@ function generateReactJsxFactory(ctx) {
|
|
|
985
1009
|
}
|
|
986
1010
|
|
|
987
1011
|
// src/artifacts/react-jsx/layout-grid.ts
|
|
988
|
-
import { outdent as
|
|
1012
|
+
import { outdent as outdent16 } from "outdent";
|
|
989
1013
|
function generateReactLayoutGrid() {
|
|
990
1014
|
return {
|
|
991
|
-
dts:
|
|
1015
|
+
dts: outdent16`
|
|
992
1016
|
import type { FunctionComponent } from 'react'
|
|
993
1017
|
|
|
994
1018
|
export type LayoutGridProps = {
|
|
@@ -1001,7 +1025,7 @@ function generateReactLayoutGrid() {
|
|
|
1001
1025
|
|
|
1002
1026
|
export declare const LayoutGrid: FunctionComponent<LayoutGridProps>
|
|
1003
1027
|
`,
|
|
1004
|
-
js:
|
|
1028
|
+
js: outdent16`
|
|
1005
1029
|
import { createElement } from 'react'
|
|
1006
1030
|
|
|
1007
1031
|
export function LayoutGrid(props) {
|
|
@@ -1030,7 +1054,7 @@ function generateReactLayoutGrid() {
|
|
|
1030
1054
|
}
|
|
1031
1055
|
|
|
1032
1056
|
// src/artifacts/react-jsx/pattern.ts
|
|
1033
|
-
import { outdent as
|
|
1057
|
+
import { outdent as outdent17 } from "outdent";
|
|
1034
1058
|
import { match as match3 } from "ts-pattern";
|
|
1035
1059
|
function generateReactJsxPattern(ctx) {
|
|
1036
1060
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1039,7 +1063,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1039
1063
|
const { description } = pattern.config;
|
|
1040
1064
|
return {
|
|
1041
1065
|
name: dashName,
|
|
1042
|
-
js:
|
|
1066
|
+
js: outdent17`
|
|
1043
1067
|
import { createElement, forwardRef } from 'react'
|
|
1044
1068
|
${ctx.file.import(factoryName, "./factory")}
|
|
1045
1069
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1047,11 +1071,11 @@ function generateReactJsxPattern(ctx) {
|
|
|
1047
1071
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1048
1072
|
${match3(props.length).with(
|
|
1049
1073
|
0,
|
|
1050
|
-
() =>
|
|
1074
|
+
() => outdent17`
|
|
1051
1075
|
return createElement(${factoryName}.div, { ref, ...props })
|
|
1052
1076
|
`
|
|
1053
1077
|
).otherwise(
|
|
1054
|
-
() =>
|
|
1078
|
+
() => outdent17`
|
|
1055
1079
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1056
1080
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1057
1081
|
return createElement(${factoryName}.div, { ref, ...styleProps, ...restProps })
|
|
@@ -1059,7 +1083,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1059
1083
|
)}
|
|
1060
1084
|
})
|
|
1061
1085
|
`,
|
|
1062
|
-
dts:
|
|
1086
|
+
dts: outdent17`
|
|
1063
1087
|
import type { FunctionComponent } from 'react'
|
|
1064
1088
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1065
1089
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1074,15 +1098,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1074
1098
|
}
|
|
1075
1099
|
|
|
1076
1100
|
// src/artifacts/react-jsx/types.ts
|
|
1077
|
-
import { outdent as
|
|
1101
|
+
import { outdent as outdent18 } from "outdent";
|
|
1078
1102
|
function generateReactJsxTypes(ctx) {
|
|
1079
1103
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1080
1104
|
return {
|
|
1081
|
-
jsxFactory:
|
|
1105
|
+
jsxFactory: outdent18`
|
|
1082
1106
|
import { ${upperName} } from '../types/jsx'
|
|
1083
1107
|
export declare const ${factoryName}: ${upperName}
|
|
1084
1108
|
`,
|
|
1085
|
-
jsxType:
|
|
1109
|
+
jsxType: outdent18`
|
|
1086
1110
|
import type { ElementType, ComponentProps } from 'react'
|
|
1087
1111
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1088
1112
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1104,11 +1128,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1104
1128
|
}
|
|
1105
1129
|
|
|
1106
1130
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1107
|
-
import { outdent as
|
|
1131
|
+
import { outdent as outdent19 } from "outdent";
|
|
1108
1132
|
function generateSolidJsxFactory(ctx) {
|
|
1109
1133
|
const { componentName, factoryName } = ctx.jsx;
|
|
1110
1134
|
return {
|
|
1111
|
-
js:
|
|
1135
|
+
js: outdent19`
|
|
1112
1136
|
import { Dynamic } from 'solid-js/web'
|
|
1113
1137
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1114
1138
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1177,10 +1201,10 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1177
1201
|
}
|
|
1178
1202
|
|
|
1179
1203
|
// src/artifacts/solid-jsx/layout-grid.ts
|
|
1180
|
-
import { outdent as
|
|
1204
|
+
import { outdent as outdent20 } from "outdent";
|
|
1181
1205
|
function generateSolidLayoutGrid() {
|
|
1182
1206
|
return {
|
|
1183
|
-
dts:
|
|
1207
|
+
dts: outdent20`
|
|
1184
1208
|
import type { ParentProps } from 'solid-js'
|
|
1185
1209
|
|
|
1186
1210
|
export type LayoutGridProps = {
|
|
@@ -1193,7 +1217,7 @@ function generateSolidLayoutGrid() {
|
|
|
1193
1217
|
|
|
1194
1218
|
export declare const LayoutGrid: ParentProps<LayoutGridProps>
|
|
1195
1219
|
`,
|
|
1196
|
-
js:
|
|
1220
|
+
js: outdent20`
|
|
1197
1221
|
import { createComponent, For } from 'solid-js/web'
|
|
1198
1222
|
|
|
1199
1223
|
export function LayoutGrid(props) {
|
|
@@ -1228,7 +1252,7 @@ function generateSolidLayoutGrid() {
|
|
|
1228
1252
|
}
|
|
1229
1253
|
|
|
1230
1254
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1231
|
-
import { outdent as
|
|
1255
|
+
import { outdent as outdent21 } from "outdent";
|
|
1232
1256
|
import { match as match4 } from "ts-pattern";
|
|
1233
1257
|
function generateSolidJsxPattern(ctx) {
|
|
1234
1258
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1237,7 +1261,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1237
1261
|
const { typeName, factoryName } = ctx.jsx;
|
|
1238
1262
|
return {
|
|
1239
1263
|
name: dashName,
|
|
1240
|
-
js:
|
|
1264
|
+
js: outdent21`
|
|
1241
1265
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1242
1266
|
import { createComponent } from 'solid-js/web'
|
|
1243
1267
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1246,11 +1270,11 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1246
1270
|
export function ${jsxName}(props) {
|
|
1247
1271
|
${match4(props.length).with(
|
|
1248
1272
|
0,
|
|
1249
|
-
() =>
|
|
1273
|
+
() => outdent21`
|
|
1250
1274
|
return createComponent(${factoryName}.div, props)
|
|
1251
1275
|
`
|
|
1252
1276
|
).otherwise(
|
|
1253
|
-
() =>
|
|
1277
|
+
() => outdent21`
|
|
1254
1278
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1255
1279
|
const styleProps = ${styleFnName}(patternProps)
|
|
1256
1280
|
return createComponent(${factoryName}.div, mergeProps(styleProps, restProps))
|
|
@@ -1258,7 +1282,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1258
1282
|
)}
|
|
1259
1283
|
}
|
|
1260
1284
|
`,
|
|
1261
|
-
dts:
|
|
1285
|
+
dts: outdent21`
|
|
1262
1286
|
import { Component } from 'solid-js'
|
|
1263
1287
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1264
1288
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1273,15 +1297,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1273
1297
|
}
|
|
1274
1298
|
|
|
1275
1299
|
// src/artifacts/solid-jsx/types.ts
|
|
1276
|
-
import { outdent as
|
|
1300
|
+
import { outdent as outdent22 } from "outdent";
|
|
1277
1301
|
function generateSolidJsxTypes(ctx) {
|
|
1278
1302
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1279
1303
|
return {
|
|
1280
|
-
jsxFactory:
|
|
1304
|
+
jsxFactory: outdent22`
|
|
1281
1305
|
import type { ${upperName} } from '../types/jsx'
|
|
1282
1306
|
export declare const ${factoryName}: ${upperName}
|
|
1283
1307
|
`,
|
|
1284
|
-
jsxType:
|
|
1308
|
+
jsxType: outdent22`
|
|
1285
1309
|
import type { JSX, ComponentProps, Component } from 'solid-js'
|
|
1286
1310
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1287
1311
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1305,11 +1329,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1305
1329
|
}
|
|
1306
1330
|
|
|
1307
1331
|
// src/artifacts/vue-jsx/jsx.ts
|
|
1308
|
-
import { outdent as
|
|
1332
|
+
import { outdent as outdent23 } from "outdent";
|
|
1309
1333
|
function generateVueJsxFactory(ctx) {
|
|
1310
1334
|
const { factoryName } = ctx.jsx;
|
|
1311
1335
|
return {
|
|
1312
|
-
js:
|
|
1336
|
+
js: outdent23`
|
|
1313
1337
|
import { defineComponent, h, computed } from 'vue'
|
|
1314
1338
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1315
1339
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1374,10 +1398,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
1374
1398
|
}
|
|
1375
1399
|
|
|
1376
1400
|
// src/artifacts/vue-jsx/layout-grid.ts
|
|
1377
|
-
import { outdent as
|
|
1401
|
+
import { outdent as outdent24 } from "outdent";
|
|
1378
1402
|
function generateVueLayoutGrid() {
|
|
1379
1403
|
return {
|
|
1380
|
-
dts:
|
|
1404
|
+
dts: outdent24`
|
|
1381
1405
|
import type { FunctionalComponent } from 'vue'
|
|
1382
1406
|
|
|
1383
1407
|
export type LayoutGridProps = {
|
|
@@ -1390,7 +1414,7 @@ function generateVueLayoutGrid() {
|
|
|
1390
1414
|
|
|
1391
1415
|
export declare const LayoutGrid: FunctionalComponent<LayoutGridProps>
|
|
1392
1416
|
`,
|
|
1393
|
-
js:
|
|
1417
|
+
js: outdent24`
|
|
1394
1418
|
import { h, computed, defineComponent } from 'vue'
|
|
1395
1419
|
|
|
1396
1420
|
export const LayoutGrid = defineComponent({
|
|
@@ -1445,15 +1469,15 @@ function generateVueLayoutGrid() {
|
|
|
1445
1469
|
}
|
|
1446
1470
|
|
|
1447
1471
|
// src/artifacts/vue-jsx/types.ts
|
|
1448
|
-
import { outdent as
|
|
1472
|
+
import { outdent as outdent25 } from "outdent";
|
|
1449
1473
|
function generateVueJsxTypes(ctx) {
|
|
1450
1474
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1451
1475
|
return {
|
|
1452
|
-
jsxFactory:
|
|
1476
|
+
jsxFactory: outdent25`
|
|
1453
1477
|
import { ${upperName} } from '../types/jsx'
|
|
1454
1478
|
export declare const ${factoryName}: ${upperName}
|
|
1455
1479
|
`,
|
|
1456
|
-
jsxType:
|
|
1480
|
+
jsxType: outdent25`
|
|
1457
1481
|
import type { Component, FunctionalComponent } from 'vue'
|
|
1458
1482
|
import type { JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1459
1483
|
import type { RecipeDefinition, RecipeRuntimeFn, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1721,9 +1745,9 @@ function getGeneratedTypes() {
|
|
|
1721
1745
|
}
|
|
1722
1746
|
|
|
1723
1747
|
// src/artifacts/types/main.ts
|
|
1724
|
-
import { outdent as
|
|
1748
|
+
import { outdent as outdent26 } from "outdent";
|
|
1725
1749
|
var generateTypesEntry = () => ({
|
|
1726
|
-
global:
|
|
1750
|
+
global: outdent26`
|
|
1727
1751
|
import { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
1728
1752
|
import { GlobalStyleObject } from './system-types'
|
|
1729
1753
|
import { CompositionStyles } from './composition'
|
|
@@ -1735,7 +1759,7 @@ var generateTypesEntry = () => ({
|
|
|
1735
1759
|
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
|
|
1736
1760
|
}
|
|
1737
1761
|
`,
|
|
1738
|
-
index:
|
|
1762
|
+
index: outdent26`
|
|
1739
1763
|
import './global'
|
|
1740
1764
|
export { ConditionalValue } from './conditions'
|
|
1741
1765
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
@@ -1744,7 +1768,7 @@ var generateTypesEntry = () => ({
|
|
|
1744
1768
|
});
|
|
1745
1769
|
|
|
1746
1770
|
// src/artifacts/types/prop-types.ts
|
|
1747
|
-
import { outdent as
|
|
1771
|
+
import { outdent as outdent27 } from "outdent";
|
|
1748
1772
|
function generatePropTypes(ctx) {
|
|
1749
1773
|
const {
|
|
1750
1774
|
config: { strictTokens },
|
|
@@ -1752,7 +1776,7 @@ function generatePropTypes(ctx) {
|
|
|
1752
1776
|
} = ctx;
|
|
1753
1777
|
const strictText = `${strictTokens ? "" : " | NativeValue<T>"}`;
|
|
1754
1778
|
const result = [
|
|
1755
|
-
|
|
1779
|
+
outdent27`
|
|
1756
1780
|
import type { ConditionalValue } from './conditions';
|
|
1757
1781
|
import type { Properties as CSSProperties } from './csstype'
|
|
1758
1782
|
import type { Tokens } from './token'
|
|
@@ -1775,7 +1799,7 @@ function generatePropTypes(ctx) {
|
|
|
1775
1799
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
1776
1800
|
});
|
|
1777
1801
|
result.push("}");
|
|
1778
|
-
return
|
|
1802
|
+
return outdent27`
|
|
1779
1803
|
${result.join("\n")}
|
|
1780
1804
|
|
|
1781
1805
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -1788,10 +1812,10 @@ function generatePropTypes(ctx) {
|
|
|
1788
1812
|
|
|
1789
1813
|
// src/artifacts/types/style-props.ts
|
|
1790
1814
|
import { allCssProperties } from "@pandacss/is-valid-prop";
|
|
1791
|
-
import
|
|
1815
|
+
import outdent28 from "outdent";
|
|
1792
1816
|
function generateStyleProps(ctx) {
|
|
1793
1817
|
const props = new Set(allCssProperties.concat(ctx.utility.keys()));
|
|
1794
|
-
return
|
|
1818
|
+
return outdent28`
|
|
1795
1819
|
import { PropertyValue } from './prop-type'
|
|
1796
1820
|
import { Token } from './token'
|
|
1797
1821
|
|
|
@@ -1807,7 +1831,7 @@ function generateStyleProps(ctx) {
|
|
|
1807
1831
|
|
|
1808
1832
|
// src/artifacts/types/token-types.ts
|
|
1809
1833
|
import { capitalize, unionType as unionType3 } from "@pandacss/shared";
|
|
1810
|
-
import { outdent as
|
|
1834
|
+
import { outdent as outdent29 } from "outdent";
|
|
1811
1835
|
import pluralize from "pluralize";
|
|
1812
1836
|
function generateTokenTypes(ctx) {
|
|
1813
1837
|
const { tokens } = ctx;
|
|
@@ -1826,7 +1850,7 @@ function generateTokenTypes(ctx) {
|
|
|
1826
1850
|
}
|
|
1827
1851
|
result.add("} & { [token: string]: never }");
|
|
1828
1852
|
set.add(Array.from(result).join("\n"));
|
|
1829
|
-
return
|
|
1853
|
+
return outdent29.string(Array.from(set).join("\n\n"));
|
|
1830
1854
|
}
|
|
1831
1855
|
|
|
1832
1856
|
// src/artifacts/css/global-css.ts
|
|
@@ -1900,7 +1924,7 @@ var generateStaticCss = (ctx) => {
|
|
|
1900
1924
|
|
|
1901
1925
|
// src/artifacts/index.ts
|
|
1902
1926
|
function setupHelpers(ctx) {
|
|
1903
|
-
const code =
|
|
1927
|
+
const code = generateHelpers();
|
|
1904
1928
|
return {
|
|
1905
1929
|
files: [{ file: ctx.file.ext("helpers"), code: code.js }]
|
|
1906
1930
|
};
|
|
@@ -1987,8 +2011,8 @@ function setupRecipes(ctx) {
|
|
|
1987
2011
|
return;
|
|
1988
2012
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
1989
2013
|
const index = {
|
|
1990
|
-
js:
|
|
1991
|
-
dts:
|
|
2014
|
+
js: outdent30.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2015
|
+
dts: outdent30.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
1992
2016
|
};
|
|
1993
2017
|
return {
|
|
1994
2018
|
dir: ctx.paths.recipe,
|
|
@@ -2005,8 +2029,8 @@ function setupPatterns(ctx) {
|
|
|
2005
2029
|
if (!files)
|
|
2006
2030
|
return;
|
|
2007
2031
|
const index = {
|
|
2008
|
-
js:
|
|
2009
|
-
dts:
|
|
2032
|
+
js: outdent30.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2033
|
+
dts: outdent30.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2010
2034
|
};
|
|
2011
2035
|
return {
|
|
2012
2036
|
dir: ctx.paths.pattern,
|
|
@@ -2027,15 +2051,15 @@ function setupJsx(ctx) {
|
|
|
2027
2051
|
const patterns = generateJsxPatterns(ctx);
|
|
2028
2052
|
const layoutGrid2 = generateLayoutGrid(ctx);
|
|
2029
2053
|
const index = {
|
|
2030
|
-
js:
|
|
2054
|
+
js: outdent30`
|
|
2031
2055
|
${ctx.file.export("./factory")}
|
|
2032
2056
|
${ctx.file.export("./layout-grid")}
|
|
2033
|
-
${
|
|
2057
|
+
${outdent30.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2034
2058
|
`,
|
|
2035
|
-
dts:
|
|
2059
|
+
dts: outdent30`
|
|
2036
2060
|
export * from './factory'
|
|
2037
2061
|
export * from './layout-grid'
|
|
2038
|
-
${
|
|
2062
|
+
${outdent30.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2039
2063
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2040
2064
|
`
|
|
2041
2065
|
};
|
|
@@ -2056,12 +2080,12 @@ function setupJsx(ctx) {
|
|
|
2056
2080
|
}
|
|
2057
2081
|
function setupCssIndex(ctx) {
|
|
2058
2082
|
const index = {
|
|
2059
|
-
js:
|
|
2083
|
+
js: outdent30`
|
|
2060
2084
|
${ctx.file.export("./css")}
|
|
2061
2085
|
${ctx.file.export("./cx")}
|
|
2062
2086
|
${ctx.file.export("./cva")}
|
|
2063
2087
|
`,
|
|
2064
|
-
dts:
|
|
2088
|
+
dts: outdent30`
|
|
2065
2089
|
export * from './css'
|
|
2066
2090
|
export * from './cx'
|
|
2067
2091
|
export * from './cva'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230215185427",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"pluralize": "8.0.0",
|
|
21
21
|
"postcss": "8.4.21",
|
|
22
22
|
"ts-pattern": "4.1.4",
|
|
23
|
-
"@pandacss/core": "0.0.0-dev-
|
|
24
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
25
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
26
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
27
|
-
"@pandacss/types": "0.0.0-dev-
|
|
28
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
23
|
+
"@pandacss/core": "0.0.0-dev-20230215185427",
|
|
24
|
+
"@pandacss/logger": "0.0.0-dev-20230215185427",
|
|
25
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230215185427",
|
|
26
|
+
"@pandacss/shared": "0.0.0-dev-20230215185427",
|
|
27
|
+
"@pandacss/types": "0.0.0-dev-20230215185427",
|
|
28
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20230215185427"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/pluralize": "0.0.29",
|
|
32
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
32
|
+
"@pandacss/fixture": "0.0.0-dev-20230215185427"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"prebuild": "tsx scripts/prebuild.ts",
|