pxengine 0.1.10 → 0.1.12
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.cjs +223 -92
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +223 -92
- package/dist/registry.json +1177 -265
- package/package.json +10 -3
- package/src/atoms/AlertAtom.tsx +2 -0
- package/src/atoms/AvatarAtom.tsx +2 -1
- package/src/atoms/BadgeAtom.tsx +2 -0
- package/src/atoms/ButtonAtom.tsx +2 -0
- package/src/atoms/CardAtom.tsx +2 -0
- package/src/atoms/ChartAtom.tsx +2 -0
- package/src/atoms/InputAtom.tsx +56 -28
- package/src/atoms/TableAtom.tsx +2 -0
- package/src/atoms/TextAtom.tsx +2 -1
- package/src/render/PXEngineRenderer.tsx +124 -10
- package/src/types/atoms.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -31808,7 +31808,8 @@ var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
|
31808
31808
|
var TextAtom = ({
|
|
31809
31809
|
content,
|
|
31810
31810
|
variant = "p",
|
|
31811
|
-
className
|
|
31811
|
+
className,
|
|
31812
|
+
style
|
|
31812
31813
|
}) => {
|
|
31813
31814
|
const baseStyles = {
|
|
31814
31815
|
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl text-gray900",
|
|
@@ -31821,7 +31822,7 @@ var TextAtom = ({
|
|
|
31821
31822
|
label: "text-[10px] font-bold text-gray400 uppercase tracking-widest pl-1"
|
|
31822
31823
|
};
|
|
31823
31824
|
const Component2 = variant === "small" || variant === "muted" || variant === "label" ? "p" : variant;
|
|
31824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Component2, { className: cn(baseStyles[variant], className), children: content });
|
|
31825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Component2, { className: cn(baseStyles[variant], className), style, children: content });
|
|
31825
31826
|
};
|
|
31826
31827
|
|
|
31827
31828
|
// src/atoms/ButtonAtom.tsx
|
|
@@ -31834,7 +31835,8 @@ var ButtonAtom = ({
|
|
|
31834
31835
|
disabled = false,
|
|
31835
31836
|
isLoading = false,
|
|
31836
31837
|
onAction,
|
|
31837
|
-
className
|
|
31838
|
+
className,
|
|
31839
|
+
style
|
|
31838
31840
|
}) => {
|
|
31839
31841
|
const handleClick = (e) => {
|
|
31840
31842
|
e.preventDefault();
|
|
@@ -31857,6 +31859,7 @@ var ButtonAtom = ({
|
|
|
31857
31859
|
disabled: disabled || isLoading,
|
|
31858
31860
|
onClick: handleClick,
|
|
31859
31861
|
className: cn("rounded-full font-semibold", customClass, className),
|
|
31862
|
+
style,
|
|
31860
31863
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
31861
31864
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
31862
31865
|
label
|
|
@@ -31901,6 +31904,7 @@ var CardAtom = ({
|
|
|
31901
31904
|
children,
|
|
31902
31905
|
footer,
|
|
31903
31906
|
className,
|
|
31907
|
+
style,
|
|
31904
31908
|
renderComponent
|
|
31905
31909
|
}) => {
|
|
31906
31910
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
@@ -31910,6 +31914,7 @@ var CardAtom = ({
|
|
|
31910
31914
|
"rounded-[32px] border border-border/50 bg-card/80 text-card-foreground shadow-[0_8px_30px_rgb(0,0,0,0.04)] overflow-hidden backdrop-blur-xl ring-1 ring-border/5",
|
|
31911
31915
|
className
|
|
31912
31916
|
),
|
|
31917
|
+
style,
|
|
31913
31918
|
children: [
|
|
31914
31919
|
(title || description) && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(CardHeader, { children: [
|
|
31915
31920
|
title && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CardTitle, { className: "text-xl font-bold text-gray900", children: title }),
|
|
@@ -31933,7 +31938,8 @@ var InputAtom = ({
|
|
|
31933
31938
|
disabled,
|
|
31934
31939
|
options,
|
|
31935
31940
|
config,
|
|
31936
|
-
className
|
|
31941
|
+
className,
|
|
31942
|
+
style
|
|
31937
31943
|
}) => {
|
|
31938
31944
|
const containerClass = cn("flex flex-col gap-2 w-full", className);
|
|
31939
31945
|
const renderLabel = () => {
|
|
@@ -31945,82 +31951,116 @@ var InputAtom = ({
|
|
|
31945
31951
|
] });
|
|
31946
31952
|
};
|
|
31947
31953
|
const renderInput = () => {
|
|
31954
|
+
const commonProps = {
|
|
31955
|
+
placeholder,
|
|
31956
|
+
value: defaultValue,
|
|
31957
|
+
disabled,
|
|
31958
|
+
required,
|
|
31959
|
+
readOnly: true,
|
|
31960
|
+
className: cn(
|
|
31961
|
+
"rounded-xl border-border bg-background focus:ring-primary shadow-sm",
|
|
31962
|
+
className
|
|
31963
|
+
),
|
|
31964
|
+
style
|
|
31965
|
+
};
|
|
31948
31966
|
switch (inputType) {
|
|
31949
31967
|
case "textarea":
|
|
31950
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
31951
|
-
Textarea,
|
|
31952
|
-
{
|
|
31953
|
-
className: "rounded-xl border-border bg-background focus:ring-primary shadow-sm",
|
|
31954
|
-
placeholder,
|
|
31955
|
-
defaultValue,
|
|
31956
|
-
disabled,
|
|
31957
|
-
rows: config?.rows || 3
|
|
31958
|
-
}
|
|
31959
|
-
);
|
|
31968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Textarea, { ...commonProps, rows: config?.rows || 3 });
|
|
31960
31969
|
case "select":
|
|
31961
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Select, { defaultValue, disabled, children: [
|
|
31962
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
31970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Select, { value: defaultValue, disabled, children: [
|
|
31971
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
31972
|
+
SelectTrigger,
|
|
31973
|
+
{
|
|
31974
|
+
className: cn(
|
|
31975
|
+
"rounded-xl border-border bg-background shadow-sm",
|
|
31976
|
+
className
|
|
31977
|
+
),
|
|
31978
|
+
style,
|
|
31979
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectValue, { placeholder: placeholder || "Select option" })
|
|
31980
|
+
}
|
|
31981
|
+
),
|
|
31963
31982
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectContent, { className: "rounded-xl border-border shadow-xl", children: options?.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })
|
|
31964
31983
|
] });
|
|
31965
31984
|
case "slider":
|
|
31966
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "pt-2 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
31985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "pt-2 pb-1", style, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
31967
31986
|
Slider,
|
|
31968
31987
|
{
|
|
31969
|
-
|
|
31988
|
+
value: [defaultValue || config?.min || 0],
|
|
31970
31989
|
max: config?.max || 100,
|
|
31971
31990
|
min: config?.min || 0,
|
|
31972
31991
|
step: config?.step || 1,
|
|
31973
31992
|
disabled,
|
|
31974
|
-
className: "py-4"
|
|
31993
|
+
className: cn("py-4", className)
|
|
31975
31994
|
}
|
|
31976
31995
|
) });
|
|
31977
31996
|
case "checkbox":
|
|
31978
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
31979
|
-
|
|
31980
|
-
|
|
31981
|
-
|
|
31982
|
-
|
|
31983
|
-
|
|
31984
|
-
|
|
31985
|
-
|
|
31986
|
-
|
|
31987
|
-
|
|
31988
|
-
|
|
31989
|
-
|
|
31990
|
-
|
|
31991
|
-
|
|
31992
|
-
|
|
31993
|
-
|
|
31994
|
-
|
|
31995
|
-
|
|
31996
|
-
|
|
31997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
31998
|
+
"div",
|
|
31999
|
+
{
|
|
32000
|
+
className: cn(
|
|
32001
|
+
"flex items-center space-x-3 py-1.5 px-0.5 group cursor-pointer",
|
|
32002
|
+
className
|
|
32003
|
+
),
|
|
32004
|
+
style,
|
|
32005
|
+
children: [
|
|
32006
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32007
|
+
Checkbox,
|
|
32008
|
+
{
|
|
32009
|
+
id: label,
|
|
32010
|
+
checked: defaultValue,
|
|
32011
|
+
disabled,
|
|
32012
|
+
className: "rounded-[6px] border-border data-[state=checked]:bg-primary shadow-sm"
|
|
32013
|
+
}
|
|
32014
|
+
),
|
|
32015
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32016
|
+
"label",
|
|
32017
|
+
{
|
|
32018
|
+
htmlFor: label,
|
|
32019
|
+
className: "text-sm font-medium leading-none cursor-pointer text-foreground/90 group-hover:text-foreground transition-colors",
|
|
32020
|
+
children: label
|
|
32021
|
+
}
|
|
32022
|
+
)
|
|
32023
|
+
]
|
|
32024
|
+
}
|
|
32025
|
+
);
|
|
31997
32026
|
case "switch":
|
|
31998
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
31999
|
-
|
|
32000
|
-
|
|
32001
|
-
|
|
32002
|
-
|
|
32003
|
-
className
|
|
32004
|
-
|
|
32005
|
-
|
|
32006
|
-
|
|
32007
|
-
|
|
32008
|
-
|
|
32009
|
-
|
|
32010
|
-
|
|
32011
|
-
|
|
32012
|
-
|
|
32013
|
-
|
|
32014
|
-
|
|
32015
|
-
|
|
32016
|
-
|
|
32027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
32028
|
+
"div",
|
|
32029
|
+
{
|
|
32030
|
+
className: cn(
|
|
32031
|
+
"flex items-center justify-between py-1.5 px-0.5",
|
|
32032
|
+
className
|
|
32033
|
+
),
|
|
32034
|
+
style,
|
|
32035
|
+
children: [
|
|
32036
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32037
|
+
Label,
|
|
32038
|
+
{
|
|
32039
|
+
htmlFor: label,
|
|
32040
|
+
className: "cursor-pointer text-foreground/90",
|
|
32041
|
+
children: label
|
|
32042
|
+
}
|
|
32043
|
+
),
|
|
32044
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32045
|
+
Switch,
|
|
32046
|
+
{
|
|
32047
|
+
id: label,
|
|
32048
|
+
checked: defaultValue,
|
|
32049
|
+
disabled,
|
|
32050
|
+
className: "data-[state=checked]:bg-primary shadow-sm"
|
|
32051
|
+
}
|
|
32052
|
+
)
|
|
32053
|
+
]
|
|
32054
|
+
}
|
|
32055
|
+
);
|
|
32017
32056
|
case "radio":
|
|
32018
32057
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32019
32058
|
RadioGroup,
|
|
32020
32059
|
{
|
|
32021
|
-
defaultValue,
|
|
32060
|
+
value: defaultValue,
|
|
32022
32061
|
disabled,
|
|
32023
|
-
className: "gap-2.5",
|
|
32062
|
+
className: cn("gap-2.5", className),
|
|
32063
|
+
style,
|
|
32024
32064
|
children: options?.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center space-x-3", children: [
|
|
32025
32065
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32026
32066
|
RadioGroupItem,
|
|
@@ -32042,37 +32082,44 @@ var InputAtom = ({
|
|
|
32042
32082
|
}
|
|
32043
32083
|
);
|
|
32044
32084
|
case "otp":
|
|
32045
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32046
|
-
|
|
32085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32086
|
+
"div",
|
|
32047
32087
|
{
|
|
32048
|
-
|
|
32049
|
-
|
|
32050
|
-
|
|
32051
|
-
|
|
32052
|
-
InputOTPSlot,
|
|
32088
|
+
className: cn("flex justify-center py-2", className),
|
|
32089
|
+
style,
|
|
32090
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32091
|
+
InputOTP,
|
|
32053
32092
|
{
|
|
32054
|
-
|
|
32055
|
-
|
|
32056
|
-
|
|
32057
|
-
|
|
32058
|
-
|
|
32093
|
+
maxLength: config?.maxLength || 6,
|
|
32094
|
+
disabled,
|
|
32095
|
+
value: defaultValue,
|
|
32096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(InputOTPGroup, { className: "gap-2", children: Array.from({ length: config?.maxLength || 6 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32097
|
+
InputOTPSlot,
|
|
32098
|
+
{
|
|
32099
|
+
index: i,
|
|
32100
|
+
className: "rounded-xl border border-border bg-background shadow-sm"
|
|
32101
|
+
},
|
|
32102
|
+
i
|
|
32103
|
+
)) })
|
|
32104
|
+
}
|
|
32105
|
+
)
|
|
32059
32106
|
}
|
|
32060
|
-
)
|
|
32107
|
+
);
|
|
32061
32108
|
default:
|
|
32062
32109
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
32063
32110
|
Input,
|
|
32064
32111
|
{
|
|
32112
|
+
...commonProps,
|
|
32065
32113
|
type: inputType,
|
|
32066
|
-
|
|
32067
|
-
|
|
32068
|
-
|
|
32069
|
-
|
|
32070
|
-
className: "rounded-xl border-border bg-background focus:ring-primary shadow-sm h-11"
|
|
32114
|
+
className: cn(
|
|
32115
|
+
"rounded-xl border-border bg-background focus:ring-primary shadow-sm h-11",
|
|
32116
|
+
className
|
|
32117
|
+
)
|
|
32071
32118
|
}
|
|
32072
32119
|
);
|
|
32073
32120
|
}
|
|
32074
32121
|
};
|
|
32075
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: containerClass, children: [
|
|
32122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: containerClass, style, children: [
|
|
32076
32123
|
inputType !== "checkbox" && inputType !== "switch" && renderLabel(),
|
|
32077
32124
|
renderInput()
|
|
32078
32125
|
] });
|
|
@@ -32083,7 +32130,8 @@ var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
|
32083
32130
|
var BadgeAtom = ({
|
|
32084
32131
|
label,
|
|
32085
32132
|
variant = "default",
|
|
32086
|
-
className
|
|
32133
|
+
className,
|
|
32134
|
+
style
|
|
32087
32135
|
}) => {
|
|
32088
32136
|
const customVariants = {
|
|
32089
32137
|
purple: "bg-primary/10 text-primary border-primary/20 hover:bg-primary/20",
|
|
@@ -32101,6 +32149,7 @@ var BadgeAtom = ({
|
|
|
32101
32149
|
customClass,
|
|
32102
32150
|
className
|
|
32103
32151
|
),
|
|
32152
|
+
style,
|
|
32104
32153
|
children: label
|
|
32105
32154
|
}
|
|
32106
32155
|
);
|
|
@@ -32112,9 +32161,10 @@ var AvatarAtom = ({
|
|
|
32112
32161
|
src,
|
|
32113
32162
|
fallback,
|
|
32114
32163
|
alt,
|
|
32115
|
-
className
|
|
32164
|
+
className,
|
|
32165
|
+
style
|
|
32116
32166
|
}) => {
|
|
32117
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Avatar, { className: cn("h-10 w-10", className), children: [
|
|
32167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Avatar, { className: cn("h-10 w-10", className), style, children: [
|
|
32118
32168
|
src && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AvatarImage, { src, alt }),
|
|
32119
32169
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(AvatarFallback, { className: "bg-purple50 text-purple600 font-bold uppercase", children: fallback })
|
|
32120
32170
|
] });
|
|
@@ -32201,7 +32251,8 @@ var AlertAtom = ({
|
|
|
32201
32251
|
title,
|
|
32202
32252
|
description,
|
|
32203
32253
|
variant = "default",
|
|
32204
|
-
className
|
|
32254
|
+
className,
|
|
32255
|
+
style
|
|
32205
32256
|
}) => {
|
|
32206
32257
|
const IconMap = {
|
|
32207
32258
|
default: Info,
|
|
@@ -32223,6 +32274,7 @@ var AlertAtom = ({
|
|
|
32223
32274
|
{
|
|
32224
32275
|
variant: shadcnVariant,
|
|
32225
32276
|
className: cn("rounded-2xl", customClass, className),
|
|
32277
|
+
style,
|
|
32226
32278
|
children: [
|
|
32227
32279
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Icon3, { className: "h-4 w-4" }),
|
|
32228
32280
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AlertTitle, { className: "font-bold", children: title }),
|
|
@@ -32252,7 +32304,8 @@ var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
|
32252
32304
|
var TableAtom = ({
|
|
32253
32305
|
headers,
|
|
32254
32306
|
rows,
|
|
32255
|
-
className
|
|
32307
|
+
className,
|
|
32308
|
+
style
|
|
32256
32309
|
}) => {
|
|
32257
32310
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
32258
32311
|
"div",
|
|
@@ -32261,6 +32314,7 @@ var TableAtom = ({
|
|
|
32261
32314
|
"rounded-2xl border border-gray-100 overflow-hidden bg-white",
|
|
32262
32315
|
className
|
|
32263
32316
|
),
|
|
32317
|
+
style,
|
|
32264
32318
|
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Table3, { children: [
|
|
32265
32319
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableHeader, { className: "bg-gray-50/50", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableRow, { children: headers.map((header, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
32266
32320
|
TableHead,
|
|
@@ -33357,7 +33411,8 @@ var ChartAtom = ({
|
|
|
33357
33411
|
showTooltip = true,
|
|
33358
33412
|
showLegend = true,
|
|
33359
33413
|
stacked = false,
|
|
33360
|
-
className
|
|
33414
|
+
className,
|
|
33415
|
+
style
|
|
33361
33416
|
}) => {
|
|
33362
33417
|
const renderChart = () => {
|
|
33363
33418
|
switch (chartType) {
|
|
@@ -33498,6 +33553,7 @@ var ChartAtom = ({
|
|
|
33498
33553
|
{
|
|
33499
33554
|
config,
|
|
33500
33555
|
className: cn("min-h-[200px] w-full", className),
|
|
33556
|
+
style,
|
|
33501
33557
|
children: renderChart()
|
|
33502
33558
|
}
|
|
33503
33559
|
);
|
|
@@ -37512,6 +37568,68 @@ var renderNotFoundError = (componentName, key) => {
|
|
|
37512
37568
|
key
|
|
37513
37569
|
);
|
|
37514
37570
|
};
|
|
37571
|
+
var normalizeProps = (props) => {
|
|
37572
|
+
const normalized = {};
|
|
37573
|
+
const dynamicStyle = {};
|
|
37574
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
37575
|
+
if (key === "className" && typeof value === "string") {
|
|
37576
|
+
const classes = value.match(/(?:[^\s\[]|\[[^\]]*\])+/g) || [];
|
|
37577
|
+
classes.forEach((cls) => {
|
|
37578
|
+
const hexMatch = cls.match(
|
|
37579
|
+
/^(bg|text|border)-\[#([0-9a-fA-F]{3,6})(?:\/(\d+))?\]$/
|
|
37580
|
+
);
|
|
37581
|
+
if (hexMatch) {
|
|
37582
|
+
const [, type, hex, opacity] = hexMatch;
|
|
37583
|
+
const color = `#${hex}${opacity ? Math.round(parseInt(opacity) / 100 * 255).toString(16).padStart(2, "0") : ""}`;
|
|
37584
|
+
if (type === "bg") dynamicStyle.backgroundColor = color;
|
|
37585
|
+
if (type === "text") dynamicStyle.color = color;
|
|
37586
|
+
if (type === "border") dynamicStyle.borderColor = color;
|
|
37587
|
+
}
|
|
37588
|
+
const roundedMatch = cls.match(/^rounded-\[(.+)\]$/);
|
|
37589
|
+
if (roundedMatch) {
|
|
37590
|
+
dynamicStyle.borderRadius = roundedMatch[1].replace(/_/g, " ");
|
|
37591
|
+
}
|
|
37592
|
+
const paddingMatch = cls.match(/^(p|px|py)-\[(.+)\]$/);
|
|
37593
|
+
if (paddingMatch) {
|
|
37594
|
+
const [, type, val] = paddingMatch;
|
|
37595
|
+
const cssVal = val.replace(/_/g, " ");
|
|
37596
|
+
if (type === "p") dynamicStyle.padding = cssVal;
|
|
37597
|
+
if (type === "px") {
|
|
37598
|
+
dynamicStyle.paddingLeft = cssVal;
|
|
37599
|
+
dynamicStyle.paddingRight = cssVal;
|
|
37600
|
+
}
|
|
37601
|
+
if (type === "py") {
|
|
37602
|
+
dynamicStyle.paddingTop = cssVal;
|
|
37603
|
+
dynamicStyle.paddingBottom = cssVal;
|
|
37604
|
+
}
|
|
37605
|
+
}
|
|
37606
|
+
const shadowMatch = cls.match(/^shadow-\[(.+)\]$/);
|
|
37607
|
+
if (shadowMatch) {
|
|
37608
|
+
dynamicStyle.boxShadow = shadowMatch[1].replace(/_/g, " ");
|
|
37609
|
+
}
|
|
37610
|
+
});
|
|
37611
|
+
normalized[key] = value;
|
|
37612
|
+
return;
|
|
37613
|
+
}
|
|
37614
|
+
if (["type", "component", "name"].includes(key)) {
|
|
37615
|
+
return;
|
|
37616
|
+
}
|
|
37617
|
+
if (value === "true") {
|
|
37618
|
+
normalized[key] = true;
|
|
37619
|
+
return;
|
|
37620
|
+
}
|
|
37621
|
+
if (value === "false") {
|
|
37622
|
+
normalized[key] = false;
|
|
37623
|
+
return;
|
|
37624
|
+
}
|
|
37625
|
+
if (typeof value === "string" && value.trim() !== "" && !isNaN(Number(value)) && (value.includes(".") || value.length < 10 && !value.startsWith("0") || value === "0")) {
|
|
37626
|
+
normalized[key] = Number(value);
|
|
37627
|
+
return;
|
|
37628
|
+
}
|
|
37629
|
+
normalized[key] = value;
|
|
37630
|
+
});
|
|
37631
|
+
return { normalized, dynamicStyle };
|
|
37632
|
+
};
|
|
37515
37633
|
var PXEngineRenderer = ({
|
|
37516
37634
|
schema,
|
|
37517
37635
|
onAction
|
|
@@ -37537,7 +37655,8 @@ var PXEngineRenderer = ({
|
|
|
37537
37655
|
} = component;
|
|
37538
37656
|
const componentName = name || type || componentType;
|
|
37539
37657
|
if (!componentName || typeof componentName !== "string") return null;
|
|
37540
|
-
const
|
|
37658
|
+
const rawProps = { ...remainingProps, ...props };
|
|
37659
|
+
const { normalized: finalProps, dynamicStyle } = normalizeProps(rawProps);
|
|
37541
37660
|
if (id && !finalProps.id) {
|
|
37542
37661
|
finalProps.id = id;
|
|
37543
37662
|
}
|
|
@@ -37565,11 +37684,6 @@ var PXEngineRenderer = ({
|
|
|
37565
37684
|
}
|
|
37566
37685
|
if (!TargetComponent) {
|
|
37567
37686
|
if (CONTEXT_DEPENDENT_COMPONENTS.has(normalizedName)) {
|
|
37568
|
-
if (process.env.NODE_ENV === "development") {
|
|
37569
|
-
console.error(
|
|
37570
|
-
`[PXEngineRenderer] Cannot render context-dependent component: ${componentName}. Use ${COMPONENT_SUGGESTIONS[normalizedName] || `${componentName}Atom`} instead.`
|
|
37571
|
-
);
|
|
37572
|
-
}
|
|
37573
37687
|
return renderContextDependentError(
|
|
37574
37688
|
componentName,
|
|
37575
37689
|
normalizedName,
|
|
@@ -37584,12 +37698,29 @@ var PXEngineRenderer = ({
|
|
|
37584
37698
|
}
|
|
37585
37699
|
const resolvedNormalized = resolvedIdentifier.charAt(0).toUpperCase() + resolvedIdentifier.slice(1);
|
|
37586
37700
|
const atomName = resolvedNormalized.endsWith("Atom") ? resolvedNormalized : `${resolvedNormalized}Atom`;
|
|
37587
|
-
const
|
|
37701
|
+
const ATOMS_WITH_RENDER = /* @__PURE__ */ new Set([
|
|
37702
|
+
"LayoutAtom",
|
|
37703
|
+
"CardAtom",
|
|
37704
|
+
"TabsAtom",
|
|
37705
|
+
"AccordionAtom",
|
|
37706
|
+
"ScrollAreaAtom",
|
|
37707
|
+
"CarouselAtom",
|
|
37708
|
+
"AspectRatioAtom",
|
|
37709
|
+
"CollapsibleAtom",
|
|
37710
|
+
"TooltipAtom",
|
|
37711
|
+
"PopoverAtom",
|
|
37712
|
+
"DialogAtom",
|
|
37713
|
+
"SheetAtom",
|
|
37714
|
+
"ResizableAtom"
|
|
37715
|
+
]);
|
|
37716
|
+
const isAtomWithRenderProp = ATOMS_WITH_RENDER.has(atomName);
|
|
37717
|
+
const finalStyle = { ...dynamicStyle, ...finalProps.style || {} };
|
|
37588
37718
|
if (isAtomWithRenderProp) {
|
|
37589
37719
|
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
37590
37720
|
TargetComponent,
|
|
37591
37721
|
{
|
|
37592
37722
|
...finalProps,
|
|
37723
|
+
style: finalStyle,
|
|
37593
37724
|
onAction,
|
|
37594
37725
|
renderComponent: renderRecursive,
|
|
37595
37726
|
children
|
|
@@ -37597,7 +37728,7 @@ var PXEngineRenderer = ({
|
|
|
37597
37728
|
uniqueKey
|
|
37598
37729
|
);
|
|
37599
37730
|
} else {
|
|
37600
|
-
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(TargetComponent, { ...finalProps, children: Array.isArray(children) ? children.map((child, idx) => renderRecursive(child, idx)) : children }, uniqueKey);
|
|
37731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(TargetComponent, { ...finalProps, style: finalStyle, children: Array.isArray(children) ? children.map((child, idx) => renderRecursive(child, idx)) : children }, uniqueKey);
|
|
37601
37732
|
}
|
|
37602
37733
|
};
|
|
37603
37734
|
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)("div", { className: "px-engine-root relative w-full h-full", children: renderRecursive(root) });
|
package/dist/index.d.cts
CHANGED