pxengine 0.1.6 → 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 CHANGED
@@ -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 atomName = normalizedName.endsWith("Atom") ? normalizedName : `${normalizedName}Atom`;
11754
- let TargetComponent = atoms_exports[atomName] || atoms_exports[normalizedName] || atoms_exports[componentName];
11755
- if (!TargetComponent) {
11756
- TargetComponent = molecules_exports[normalizedName] || molecules_exports[componentName];
11757
- }
11758
- if (!TargetComponent && !CONTEXT_DEPENDENT_COMPONENTS.has(normalizedName)) {
11759
- TargetComponent = ui_exports[normalizedName] || ui_exports[componentName];
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
@@ -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 atomName = normalizedName.endsWith("Atom") ? normalizedName : `${normalizedName}Atom`;
11508
- let TargetComponent = atoms_exports[atomName] || atoms_exports[normalizedName] || atoms_exports[componentName];
11509
- if (!TargetComponent) {
11510
- TargetComponent = molecules_exports[normalizedName] || molecules_exports[componentName];
11511
- }
11512
- if (!TargetComponent && !CONTEXT_DEPENDENT_COMPONENTS.has(normalizedName)) {
11513
- TargetComponent = ui_exports[normalizedName] || ui_exports[componentName];
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(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pxengine/ui",
3
3
  "version": "1.0.0",
4
- "lastUpdated": "2026-01-29T11:11:35.549Z",
4
+ "lastUpdated": "2026-01-30T05:20:50.325Z",
5
5
  "components": {
6
6
  "AccordionAtom": {
7
7
  "name": "AccordionAtom",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pxengine",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "Shadcn-based UI component library for agent-driven interfaces",
6
6
  "main": "./dist/index.cjs",
@@ -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
- // 3. Resolve Component from registries (PRIORITY ORDER - safest first)
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
- // Priority 1: Atoms (schema-safe, self-contained)
225
- let TargetComponent =
226
- (Atoms as any)[atomName] ||
227
- (Atoms as any)[normalizedName] ||
228
- (Atoms as any)[componentName];
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
- // Priority 2: Molecules (schema-safe, composite)
231
- if (!TargetComponent) {
232
- TargetComponent =
233
- (Molecules as any)[normalizedName] || (Molecules as any)[componentName];
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
- // Priority 3: UI Components (ONLY if NOT context-dependent)
237
- if (!TargetComponent && !CONTEXT_DEPENDENT_COMPONENTS.has(normalizedName)) {
238
- TargetComponent =
239
- (UIComponents as any)[normalizedName] ||
240
- (UIComponents as any)[componentName];
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