pxengine 0.1.5 → 0.1.7
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 +31 -17
- package/dist/index.js +31 -17
- package/dist/registry.json +1 -1
- package/package.json +1 -1
- package/src/atoms/CardAtom.tsx +2 -2
- package/src/atoms/TextAtom.tsx +7 -7
- package/src/molecules/generic/ActionButton/ActionButton.tsx +1 -1
- package/src/render/PXEngineRenderer.tsx +48 -21
package/dist/index.cjs
CHANGED
|
@@ -7638,14 +7638,14 @@ var TextAtom = ({
|
|
|
7638
7638
|
className
|
|
7639
7639
|
}) => {
|
|
7640
7640
|
const baseStyles = {
|
|
7641
|
-
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl text-
|
|
7642
|
-
h2: "scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0 text-
|
|
7643
|
-
h3: "scroll-m-20 text-2xl font-semibold tracking-tight text-
|
|
7644
|
-
h4: "scroll-m-20 text-xl font-semibold tracking-tight text-
|
|
7645
|
-
p: "leading-7 [&:not(:first-child)]:mt-6 text-
|
|
7646
|
-
small: "text-sm font-medium leading-none text-
|
|
7641
|
+
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl text-gray900",
|
|
7642
|
+
h2: "scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0 text-gray900",
|
|
7643
|
+
h3: "scroll-m-20 text-2xl font-semibold tracking-tight text-gray900",
|
|
7644
|
+
h4: "scroll-m-20 text-xl font-semibold tracking-tight text-gray900",
|
|
7645
|
+
p: "leading-7 [&:not(:first-child)]:mt-6 text-gray700",
|
|
7646
|
+
small: "text-sm font-medium leading-none text-gray600",
|
|
7647
7647
|
muted: "text-sm text-muted-foreground",
|
|
7648
|
-
label: "text-[10px] font-bold text-
|
|
7648
|
+
label: "text-[10px] font-bold text-gray400 uppercase tracking-widest pl-1"
|
|
7649
7649
|
};
|
|
7650
7650
|
const Component = variant === "small" || variant === "muted" || variant === "label" ? "p" : variant;
|
|
7651
7651
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Component, { className: cn(baseStyles[variant], className), children: content });
|
|
@@ -7739,11 +7739,11 @@ var CardAtom = ({
|
|
|
7739
7739
|
),
|
|
7740
7740
|
children: [
|
|
7741
7741
|
(title || description) && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(CardHeader, { children: [
|
|
7742
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CardTitle, { className: "text-xl font-bold text-
|
|
7742
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CardTitle, { className: "text-xl font-bold text-gray900", children: title }),
|
|
7743
7743
|
description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CardDescription, { children: description })
|
|
7744
7744
|
] }),
|
|
7745
7745
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CardContent, { className: "space-y-4", children: children.map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react36.default.Fragment, { children: renderComponent(child, index) }, child.id || `card-content-${index}`)) }),
|
|
7746
|
-
footer && footer.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CardFooter, { className: "bg-
|
|
7746
|
+
footer && footer.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CardFooter, { className: "bg-gray50/50 border-t border-gray200 flex flex-wrap gap-2 pt-6", children: footer.map((footerChild, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react36.default.Fragment, { children: renderComponent(footerChild, index) }, footerChild.id || `card-footer-${index}`)) })
|
|
7747
7747
|
]
|
|
7748
7748
|
}
|
|
7749
7749
|
);
|
|
@@ -8782,7 +8782,7 @@ var ActionButton = import_react51.default.memo(
|
|
|
8782
8782
|
variant: "ghost",
|
|
8783
8783
|
size: "icon",
|
|
8784
8784
|
onClick: onPause,
|
|
8785
|
-
className: "h-10 w-10 rounded-full hover:bg-
|
|
8785
|
+
className: "h-10 w-10 rounded-full hover:bg-gray200 text-gray600",
|
|
8786
8786
|
title: isPaused ? "Resume auto-proceed" : "Pause auto-proceed",
|
|
8787
8787
|
children: isPaused ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Play, { className: "h-4 w-4 fill-current" }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Pause, { className: "h-4 w-4 fill-current" })
|
|
8788
8788
|
}
|
|
@@ -11750,13 +11750,25 @@ var PXEngineRenderer = ({
|
|
|
11750
11750
|
if (!componentName || typeof componentName !== "string") return null;
|
|
11751
11751
|
const uniqueKey = id || `${componentName}-${index || Math.random().toString(36).substr(2, 9)}`;
|
|
11752
11752
|
const normalizedName = componentName.charAt(0).toUpperCase() + componentName.slice(1);
|
|
11753
|
-
const
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11758
|
-
|
|
11759
|
-
|
|
11753
|
+
const resolveComponent = (identifier) => {
|
|
11754
|
+
const normalized = identifier.charAt(0).toUpperCase() + identifier.slice(1);
|
|
11755
|
+
const atomName2 = normalized.endsWith("Atom") ? normalized : `${normalized}Atom`;
|
|
11756
|
+
let Comp = atoms_exports[atomName2] || atoms_exports[normalized] || atoms_exports[identifier];
|
|
11757
|
+
if (!Comp) {
|
|
11758
|
+
Comp = molecules_exports[normalized] || molecules_exports[identifier];
|
|
11759
|
+
}
|
|
11760
|
+
if (!Comp && !CONTEXT_DEPENDENT_COMPONENTS.has(normalized)) {
|
|
11761
|
+
Comp = ui_exports[normalized] || ui_exports[identifier];
|
|
11762
|
+
}
|
|
11763
|
+
return Comp;
|
|
11764
|
+
};
|
|
11765
|
+
let TargetComponent = resolveComponent(componentName);
|
|
11766
|
+
let resolvedIdentifier = componentName;
|
|
11767
|
+
if (!TargetComponent && type && type !== componentName) {
|
|
11768
|
+
TargetComponent = resolveComponent(type);
|
|
11769
|
+
if (TargetComponent) {
|
|
11770
|
+
resolvedIdentifier = type;
|
|
11771
|
+
}
|
|
11760
11772
|
}
|
|
11761
11773
|
if (!TargetComponent) {
|
|
11762
11774
|
if (CONTEXT_DEPENDENT_COMPONENTS.has(normalizedName)) {
|
|
@@ -11777,6 +11789,8 @@ var PXEngineRenderer = ({
|
|
|
11777
11789
|
return renderNotFoundError(componentName, uniqueKey);
|
|
11778
11790
|
}
|
|
11779
11791
|
}
|
|
11792
|
+
const resolvedNormalized = resolvedIdentifier.charAt(0).toUpperCase() + resolvedIdentifier.slice(1);
|
|
11793
|
+
const atomName = resolvedNormalized.endsWith("Atom") ? resolvedNormalized : `${resolvedNormalized}Atom`;
|
|
11780
11794
|
const isAtomWithRenderProp = atomName in atoms_exports;
|
|
11781
11795
|
if (isAtomWithRenderProp) {
|
|
11782
11796
|
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
package/dist/index.js
CHANGED
|
@@ -7392,14 +7392,14 @@ var TextAtom = ({
|
|
|
7392
7392
|
className
|
|
7393
7393
|
}) => {
|
|
7394
7394
|
const baseStyles = {
|
|
7395
|
-
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl text-
|
|
7396
|
-
h2: "scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0 text-
|
|
7397
|
-
h3: "scroll-m-20 text-2xl font-semibold tracking-tight text-
|
|
7398
|
-
h4: "scroll-m-20 text-xl font-semibold tracking-tight text-
|
|
7399
|
-
p: "leading-7 [&:not(:first-child)]:mt-6 text-
|
|
7400
|
-
small: "text-sm font-medium leading-none text-
|
|
7395
|
+
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl text-gray900",
|
|
7396
|
+
h2: "scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0 text-gray900",
|
|
7397
|
+
h3: "scroll-m-20 text-2xl font-semibold tracking-tight text-gray900",
|
|
7398
|
+
h4: "scroll-m-20 text-xl font-semibold tracking-tight text-gray900",
|
|
7399
|
+
p: "leading-7 [&:not(:first-child)]:mt-6 text-gray700",
|
|
7400
|
+
small: "text-sm font-medium leading-none text-gray600",
|
|
7401
7401
|
muted: "text-sm text-muted-foreground",
|
|
7402
|
-
label: "text-[10px] font-bold text-
|
|
7402
|
+
label: "text-[10px] font-bold text-gray400 uppercase tracking-widest pl-1"
|
|
7403
7403
|
};
|
|
7404
7404
|
const Component = variant === "small" || variant === "muted" || variant === "label" ? "p" : variant;
|
|
7405
7405
|
return /* @__PURE__ */ jsx41(Component, { className: cn(baseStyles[variant], className), children: content });
|
|
@@ -7493,11 +7493,11 @@ var CardAtom = ({
|
|
|
7493
7493
|
),
|
|
7494
7494
|
children: [
|
|
7495
7495
|
(title || description) && /* @__PURE__ */ jsxs19(CardHeader, { children: [
|
|
7496
|
-
title && /* @__PURE__ */ jsx44(CardTitle, { className: "text-xl font-bold text-
|
|
7496
|
+
title && /* @__PURE__ */ jsx44(CardTitle, { className: "text-xl font-bold text-gray900", children: title }),
|
|
7497
7497
|
description && /* @__PURE__ */ jsx44(CardDescription, { children: description })
|
|
7498
7498
|
] }),
|
|
7499
7499
|
/* @__PURE__ */ jsx44(CardContent, { className: "space-y-4", children: children.map((child, index) => /* @__PURE__ */ jsx44(React65.Fragment, { children: renderComponent(child, index) }, child.id || `card-content-${index}`)) }),
|
|
7500
|
-
footer && footer.length > 0 && /* @__PURE__ */ jsx44(CardFooter, { className: "bg-
|
|
7500
|
+
footer && footer.length > 0 && /* @__PURE__ */ jsx44(CardFooter, { className: "bg-gray50/50 border-t border-gray200 flex flex-wrap gap-2 pt-6", children: footer.map((footerChild, index) => /* @__PURE__ */ jsx44(React65.Fragment, { children: renderComponent(footerChild, index) }, footerChild.id || `card-footer-${index}`)) })
|
|
7501
7501
|
]
|
|
7502
7502
|
}
|
|
7503
7503
|
);
|
|
@@ -8536,7 +8536,7 @@ var ActionButton = React80.memo(
|
|
|
8536
8536
|
variant: "ghost",
|
|
8537
8537
|
size: "icon",
|
|
8538
8538
|
onClick: onPause,
|
|
8539
|
-
className: "h-10 w-10 rounded-full hover:bg-
|
|
8539
|
+
className: "h-10 w-10 rounded-full hover:bg-gray200 text-gray600",
|
|
8540
8540
|
title: isPaused ? "Resume auto-proceed" : "Pause auto-proceed",
|
|
8541
8541
|
children: isPaused ? /* @__PURE__ */ jsx73(Play, { className: "h-4 w-4 fill-current" }) : /* @__PURE__ */ jsx73(Pause, { className: "h-4 w-4 fill-current" })
|
|
8542
8542
|
}
|
|
@@ -11504,13 +11504,25 @@ var PXEngineRenderer = ({
|
|
|
11504
11504
|
if (!componentName || typeof componentName !== "string") return null;
|
|
11505
11505
|
const uniqueKey = id || `${componentName}-${index || Math.random().toString(36).substr(2, 9)}`;
|
|
11506
11506
|
const normalizedName = componentName.charAt(0).toUpperCase() + componentName.slice(1);
|
|
11507
|
-
const
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11507
|
+
const resolveComponent = (identifier) => {
|
|
11508
|
+
const normalized = identifier.charAt(0).toUpperCase() + identifier.slice(1);
|
|
11509
|
+
const atomName2 = normalized.endsWith("Atom") ? normalized : `${normalized}Atom`;
|
|
11510
|
+
let Comp = atoms_exports[atomName2] || atoms_exports[normalized] || atoms_exports[identifier];
|
|
11511
|
+
if (!Comp) {
|
|
11512
|
+
Comp = molecules_exports[normalized] || molecules_exports[identifier];
|
|
11513
|
+
}
|
|
11514
|
+
if (!Comp && !CONTEXT_DEPENDENT_COMPONENTS.has(normalized)) {
|
|
11515
|
+
Comp = ui_exports[normalized] || ui_exports[identifier];
|
|
11516
|
+
}
|
|
11517
|
+
return Comp;
|
|
11518
|
+
};
|
|
11519
|
+
let TargetComponent = resolveComponent(componentName);
|
|
11520
|
+
let resolvedIdentifier = componentName;
|
|
11521
|
+
if (!TargetComponent && type && type !== componentName) {
|
|
11522
|
+
TargetComponent = resolveComponent(type);
|
|
11523
|
+
if (TargetComponent) {
|
|
11524
|
+
resolvedIdentifier = type;
|
|
11525
|
+
}
|
|
11514
11526
|
}
|
|
11515
11527
|
if (!TargetComponent) {
|
|
11516
11528
|
if (CONTEXT_DEPENDENT_COMPONENTS.has(normalizedName)) {
|
|
@@ -11531,6 +11543,8 @@ var PXEngineRenderer = ({
|
|
|
11531
11543
|
return renderNotFoundError(componentName, uniqueKey);
|
|
11532
11544
|
}
|
|
11533
11545
|
}
|
|
11546
|
+
const resolvedNormalized = resolvedIdentifier.charAt(0).toUpperCase() + resolvedIdentifier.slice(1);
|
|
11547
|
+
const atomName = resolvedNormalized.endsWith("Atom") ? resolvedNormalized : `${resolvedNormalized}Atom`;
|
|
11534
11548
|
const isAtomWithRenderProp = atomName in atoms_exports;
|
|
11535
11549
|
if (isAtomWithRenderProp) {
|
|
11536
11550
|
return /* @__PURE__ */ jsx90(
|
package/dist/registry.json
CHANGED
package/package.json
CHANGED
package/src/atoms/CardAtom.tsx
CHANGED
|
@@ -36,7 +36,7 @@ export const CardAtom: React.FC<Props> = ({
|
|
|
36
36
|
{(title || description) && (
|
|
37
37
|
<CardHeader>
|
|
38
38
|
{title && (
|
|
39
|
-
<CardTitle className="text-xl font-bold text-
|
|
39
|
+
<CardTitle className="text-xl font-bold text-gray900">
|
|
40
40
|
{title}
|
|
41
41
|
</CardTitle>
|
|
42
42
|
)}
|
|
@@ -51,7 +51,7 @@ export const CardAtom: React.FC<Props> = ({
|
|
|
51
51
|
))}
|
|
52
52
|
</CardContent>
|
|
53
53
|
{footer && footer.length > 0 && (
|
|
54
|
-
<CardFooter className="bg-
|
|
54
|
+
<CardFooter className="bg-gray50/50 border-t border-gray200 flex flex-wrap gap-2 pt-6">
|
|
55
55
|
{footer.map((footerChild, index) => (
|
|
56
56
|
<React.Fragment key={footerChild.id || `card-footer-${index}`}>
|
|
57
57
|
{renderComponent(footerChild, index)}
|
package/src/atoms/TextAtom.tsx
CHANGED
|
@@ -12,14 +12,14 @@ export const TextAtom: React.FC<TextAtomType> = ({
|
|
|
12
12
|
className,
|
|
13
13
|
}) => {
|
|
14
14
|
const baseStyles: Record<string, string> = {
|
|
15
|
-
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl text-
|
|
16
|
-
h2: "scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0 text-
|
|
17
|
-
h3: "scroll-m-20 text-2xl font-semibold tracking-tight text-
|
|
18
|
-
h4: "scroll-m-20 text-xl font-semibold tracking-tight text-
|
|
19
|
-
p: "leading-7 [&:not(:first-child)]:mt-6 text-
|
|
20
|
-
small: "text-sm font-medium leading-none text-
|
|
15
|
+
h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl text-gray900",
|
|
16
|
+
h2: "scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0 text-gray900",
|
|
17
|
+
h3: "scroll-m-20 text-2xl font-semibold tracking-tight text-gray900",
|
|
18
|
+
h4: "scroll-m-20 text-xl font-semibold tracking-tight text-gray900",
|
|
19
|
+
p: "leading-7 [&:not(:first-child)]:mt-6 text-gray700",
|
|
20
|
+
small: "text-sm font-medium leading-none text-gray600",
|
|
21
21
|
muted: "text-sm text-muted-foreground",
|
|
22
|
-
label: "text-[10px] font-bold text-
|
|
22
|
+
label: "text-[10px] font-bold text-gray400 uppercase tracking-widest pl-1",
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const Component =
|
|
@@ -113,7 +113,7 @@ export const ActionButton = React.memo<ActionButtonProps>(
|
|
|
113
113
|
variant="ghost"
|
|
114
114
|
size="icon"
|
|
115
115
|
onClick={onPause}
|
|
116
|
-
className="h-10 w-10 rounded-full hover:bg-
|
|
116
|
+
className="h-10 w-10 rounded-full hover:bg-gray200 text-gray600"
|
|
117
117
|
title={isPaused ? "Resume auto-proceed" : "Pause auto-proceed"}
|
|
118
118
|
>
|
|
119
119
|
{isPaused ? (
|
|
@@ -203,7 +203,7 @@ export const PXEngineRenderer: React.FC<PXEngineRendererProps> = ({
|
|
|
203
203
|
|
|
204
204
|
const { type, name, props = {}, children = [], id } = component;
|
|
205
205
|
|
|
206
|
-
// Determine the component name to search for
|
|
206
|
+
// Determine the component logic name to search for
|
|
207
207
|
const componentName = name || type;
|
|
208
208
|
if (!componentName || typeof componentName !== "string") return null;
|
|
209
209
|
|
|
@@ -212,32 +212,52 @@ export const PXEngineRenderer: React.FC<PXEngineRendererProps> = ({
|
|
|
212
212
|
id ||
|
|
213
213
|
`${componentName}-${index || Math.random().toString(36).substr(2, 9)}`;
|
|
214
214
|
|
|
215
|
-
// Normalize name to PascalCase
|
|
215
|
+
// Normalize name to PascalCase for the *primary* identifier
|
|
216
216
|
const normalizedName =
|
|
217
217
|
componentName.charAt(0).toUpperCase() + componentName.slice(1);
|
|
218
|
-
const atomName = normalizedName.endsWith("Atom")
|
|
219
|
-
? normalizedName
|
|
220
|
-
: `${normalizedName}Atom`;
|
|
221
218
|
|
|
222
|
-
|
|
219
|
+
/**
|
|
220
|
+
* Helper to resolve a component by a given identifier string.
|
|
221
|
+
* Checks Atoms -> Molecules -> UI Components.
|
|
222
|
+
*/
|
|
223
|
+
const resolveComponent = (identifier: string) => {
|
|
224
|
+
const normalized =
|
|
225
|
+
identifier.charAt(0).toUpperCase() + identifier.slice(1);
|
|
226
|
+
const atomName = normalized.endsWith("Atom")
|
|
227
|
+
? normalized
|
|
228
|
+
: `${normalized}Atom`;
|
|
223
229
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
230
|
+
// Priority 1: Atoms
|
|
231
|
+
let Comp =
|
|
232
|
+
(Atoms as any)[atomName] ||
|
|
233
|
+
(Atoms as any)[normalized] ||
|
|
234
|
+
(Atoms as any)[identifier];
|
|
229
235
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
236
|
+
// Priority 2: Molecules
|
|
237
|
+
if (!Comp) {
|
|
238
|
+
Comp = (Molecules as any)[normalized] || (Molecules as any)[identifier];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Priority 3: UI Components
|
|
242
|
+
if (!Comp && !CONTEXT_DEPENDENT_COMPONENTS.has(normalized)) {
|
|
243
|
+
Comp =
|
|
244
|
+
(UIComponents as any)[normalized] ||
|
|
245
|
+
(UIComponents as any)[identifier];
|
|
246
|
+
}
|
|
247
|
+
return Comp;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
// 1. Attempt using 'name' (or 'type' if name matches)
|
|
251
|
+
let TargetComponent = resolveComponent(componentName);
|
|
252
|
+
let resolvedIdentifier = componentName;
|
|
235
253
|
|
|
236
|
-
//
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
254
|
+
// 2. FALLBACK: If 'name' failed but 'type' is different, try 'type'
|
|
255
|
+
// This allows "name": "Dashboard" (descriptive) with "type": "layout" (functional)
|
|
256
|
+
if (!TargetComponent && type && type !== componentName) {
|
|
257
|
+
TargetComponent = resolveComponent(type);
|
|
258
|
+
if (TargetComponent) {
|
|
259
|
+
resolvedIdentifier = type;
|
|
260
|
+
}
|
|
241
261
|
}
|
|
242
262
|
|
|
243
263
|
// 4. Handle component not found or context-dependent
|
|
@@ -264,6 +284,13 @@ export const PXEngineRenderer: React.FC<PXEngineRendererProps> = ({
|
|
|
264
284
|
}
|
|
265
285
|
}
|
|
266
286
|
|
|
287
|
+
// Calculate atom name for the *resolved* component to check for render props
|
|
288
|
+
const resolvedNormalized =
|
|
289
|
+
resolvedIdentifier.charAt(0).toUpperCase() + resolvedIdentifier.slice(1);
|
|
290
|
+
const atomName = resolvedNormalized.endsWith("Atom")
|
|
291
|
+
? resolvedNormalized
|
|
292
|
+
: `${resolvedNormalized}Atom`;
|
|
293
|
+
|
|
267
294
|
// 4. Determine if component expects 'renderComponent' prop (for Atoms with children management)
|
|
268
295
|
const isAtomWithRenderProp = atomName in Atoms;
|
|
269
296
|
|