@bravostudioai/react 0.1.0 → 0.1.1

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.
Files changed (37) hide show
  1. package/dist/components/EncoreApp.js +145 -131
  2. package/dist/components/EncoreApp.js.map +1 -1
  3. package/dist/contexts/EncoreRouterContext.js +13 -0
  4. package/dist/contexts/EncoreRouterContext.js.map +1 -0
  5. package/dist/hooks/usePusherUpdates.js +4 -2
  6. package/dist/hooks/usePusherUpdates.js.map +1 -1
  7. package/dist/lib/dynamicModules.js +75 -85
  8. package/dist/lib/dynamicModules.js.map +1 -1
  9. package/dist/lib/moduleRegistry.js +20 -0
  10. package/dist/lib/moduleRegistry.js.map +1 -0
  11. package/dist/lib/packages.js +1 -3
  12. package/dist/lib/packages.js.map +1 -1
  13. package/dist/src/codegen/generator.d.ts +10 -0
  14. package/dist/src/codegen/generator.d.ts.map +1 -0
  15. package/dist/src/codegen/parser.d.ts +37 -0
  16. package/dist/src/codegen/parser.d.ts.map +1 -0
  17. package/dist/src/codegen/types.d.ts +53 -0
  18. package/dist/src/codegen/types.d.ts.map +1 -0
  19. package/dist/src/components/EncoreApp.d.ts.map +1 -1
  20. package/dist/src/contexts/EncoreRouterContext.d.ts +10 -0
  21. package/dist/src/contexts/EncoreRouterContext.d.ts.map +1 -0
  22. package/dist/src/hooks/useAuthRedirect.d.ts.map +1 -1
  23. package/dist/src/lib/dynamicModules.d.ts +1 -5
  24. package/dist/src/lib/dynamicModules.d.ts.map +1 -1
  25. package/dist/src/lib/moduleRegistry.d.ts +9 -0
  26. package/dist/src/lib/moduleRegistry.d.ts.map +1 -0
  27. package/dist/src/lib/packages.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/cli/commands/generate.ts +88 -2723
  30. package/src/codegen/generator.ts +877 -0
  31. package/src/codegen/index.ts +3 -0
  32. package/src/codegen/parser.ts +1614 -0
  33. package/src/codegen/types.ts +58 -0
  34. package/src/components/EncoreApp.tsx +20 -1
  35. package/src/contexts/EncoreRouterContext.ts +28 -0
  36. package/src/hooks/useAuthRedirect.ts +56 -55
  37. package/src/lib/packages.ts +8 -15
@@ -1 +1 @@
1
- {"version":3,"file":"usePusherUpdates.js","sources":["../../src/hooks/usePusherUpdates.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport Pusher from \"pusher-js\";\nimport { mutate } from \"swr\";\nimport { clearModuleCache } from \"../lib/dynamicModules\";\n\ntype PusherConfig = {\n key?: string;\n cluster?: string;\n encrypted?: boolean;\n};\n\ntype UsePusherUpdatesOptions = {\n appId: string;\n pageId?: string;\n enabled?: boolean;\n onUpdate?: () => void;\n};\n\n// Get Pusher config from environment variables\nconst getPusherConfig = (): PusherConfig => {\n return {\n key: \"7b0611d0051677eed996\",\n cluster: \"us2\",\n encrypted: true,\n };\n};\n\n/**\n * Hook to listen for EncoreApp component updates via Pusher\n * Channel name format: `${appId}-${pageId}`\n * When an update event is received, it invalidates SWR cache and triggers a reload\n */\nexport function usePusherUpdates({\n appId,\n pageId,\n enabled = true,\n onUpdate,\n}: UsePusherUpdatesOptions) {\n const pusherRef = useRef<Pusher | null>(null);\n const channelRef = useRef<ReturnType<Pusher[\"subscribe\"]> | null>(null);\n\n useEffect(() => {\n // Only connect if enabled and we have both appId and pageId\n if (!enabled || !appId || !pageId) {\n return;\n }\n\n const config = getPusherConfig();\n\n // Skip if Pusher key is not configured\n if (!config.key) {\n console.warn(\n \"[Pusher] not configured. Pusher updates disabled.\"\n );\n return;\n }\n\n // Initialize Pusher\n const pusher = new Pusher(config.key, {\n cluster: config.cluster || \"us2\",\n forceTLS: config.encrypted,\n });\n\n pusherRef.current = pusher;\n\n // Channel name format: appId-pageId (e.g., \"01KA23JMNBQ2V9NR7K0VXKT5TF-01KA23JMPBZSG2YRJ6M5X87SKJ\")\n const channelName = `${appId}`;\n console.log(`[Pusher] Subscribing to channel: ${channelName}`);\n\n // Subscribe to the channel\n const channel = pusher.subscribe(channelName);\n channelRef.current = channel;\n\n // Handle subscription success\n channel.bind(\"pusher:subscription_succeeded\", () => {\n console.log(`[Pusher] Successfully subscribed to channel: ${channelName}`);\n });\n\n // Handle subscription error\n channel.bind(\"pusher:subscription_error\", (status: number) => {\n console.error(\n `[Pusher] Subscription error for channel ${channelName}:`,\n status\n );\n });\n\n // Listen for update events\n // You can customize the event name based on your backend's Pusher event names\n // Common event names: 'update', 'component-updated', 'app-updated', etc.\n const handleUpdate = (data: unknown) => {\n console.log(`[Pusher] Update received for ${channelName}:`, data);\n\n // Clear the module cache for the component to force reload\n const componentName = `${appId}/draft/components/${pageId}`;\n clearModuleCache(componentName);\n\n // Invalidate SWR cache for both app and page data\n const appUrl = `/devices/apps/${appId}`;\n const pageUrl = `/devices/apps/${appId}/node/${pageId}`;\n\n // Mutate both URLs to trigger refetch\n mutate(appUrl).catch((err) => {\n console.error(\"[Pusher] Error invalidating app cache:\", err);\n });\n mutate(pageUrl).catch((err) => {\n console.error(\"[Pusher] Error invalidating page cache:\", err);\n });\n\n // Also invalidate URLs with useLocal query param if they exist\n mutate(`${appUrl}?useLocal=1`).catch(() => {\n // Ignore errors for optional URLs\n });\n mutate(`${pageUrl}?useLocal=1`).catch(() => {\n // Ignore errors for optional URLs\n });\n\n // Call the onUpdate callback if provided\n onUpdate?.();\n };\n\n // Bind to update events\n // Adjust the event name(s) based on what your backend sends\n channel.bind(\"update\", handleUpdate);\n channel.bind(\"component-updated\", handleUpdate);\n channel.bind(\"app-updated\", handleUpdate);\n\n // Cleanup function\n return () => {\n console.log(`[Pusher] Unsubscribing from channel: ${channelName}`);\n\n // Unbind all event handlers\n if (channelRef.current) {\n channelRef.current.unbind_all();\n }\n\n // Unsubscribe from channel\n if (channelRef.current && pusherRef.current) {\n pusherRef.current.unsubscribe(channelName);\n }\n\n // Disconnect Pusher if no other channels are subscribed\n if (pusherRef.current) {\n pusherRef.current.disconnect();\n pusherRef.current = null;\n }\n\n channelRef.current = null;\n };\n }, [appId, pageId, enabled, onUpdate]);\n\n // Return channel ref for advanced usage\n return {\n channel: channelRef.current,\n pusher: pusherRef.current,\n };\n}\n\n"],"names":["getPusherConfig","usePusherUpdates","appId","pageId","enabled","onUpdate","pusherRef","useRef","channelRef","useEffect","config","pusher","Pusher","channelName","channel","status","handleUpdate","data","componentName","clearModuleCache","appUrl","pageUrl","mutate","err"],"mappings":";;;;AAmBA,MAAMA,IAAkB,OACf;AAAA,EACL,KAAK;AAAA,EACL,SAAS;AAAA,EACT,WAAW;AAAA;AASR,SAASC,EAAiB;AAAA,EAC/B,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,UAAAC;AACF,GAA4B;AAC1B,QAAMC,IAAYC,EAAsB,IAAI,GACtCC,IAAaD,EAA+C,IAAI;AAEtE,SAAAE,EAAU,MAAM;AAEd,QAAI,CAACL,KAAW,CAACF,KAAS,CAACC;AACzB;AAGF,UAAMO,IAASV,EAAA,GAWTW,IAAS,IAAIC,EAAOF,EAAO,KAAK;AAAA,MACpC,SAASA,EAAO;AAAA,MAChB,UAAUA,EAAO;AAAA,IAAA,CAClB;AAED,IAAAJ,EAAU,UAAUK;AAGpB,UAAME,IAAc,GAAGX,CAAK;AAC5B,YAAQ,IAAI,oCAAoCW,CAAW,EAAE;AAG7D,UAAMC,IAAUH,EAAO,UAAUE,CAAW;AAC5C,IAAAL,EAAW,UAAUM,GAGrBA,EAAQ,KAAK,iCAAiC,MAAM;AAClD,cAAQ,IAAI,gDAAgDD,CAAW,EAAE;AAAA,IAC3E,CAAC,GAGDC,EAAQ,KAAK,6BAA6B,CAACC,MAAmB;AAC5D,cAAQ;AAAA,QACN,2CAA2CF,CAAW;AAAA,QACtDE;AAAA,MAAA;AAAA,IAEJ,CAAC;AAKD,UAAMC,IAAe,CAACC,MAAkB;AACtC,cAAQ,IAAI,gCAAgCJ,CAAW,KAAKI,CAAI;AAGhE,YAAMC,IAAgB,GAAGhB,CAAK,qBAAqBC,CAAM;AACzD,MAAAgB,EAAiBD,CAAa;AAG9B,YAAME,IAAS,iBAAiBlB,CAAK,IAC/BmB,IAAU,iBAAiBnB,CAAK,SAASC,CAAM;AAGrD,MAAAmB,EAAOF,CAAM,EAAE,MAAM,CAACG,MAAQ;AAC5B,gBAAQ,MAAM,0CAA0CA,CAAG;AAAA,MAC7D,CAAC,GACDD,EAAOD,CAAO,EAAE,MAAM,CAACE,MAAQ;AAC7B,gBAAQ,MAAM,2CAA2CA,CAAG;AAAA,MAC9D,CAAC,GAGDD,EAAO,GAAGF,CAAM,aAAa,EAAE,MAAM,MAAM;AAAA,MAE3C,CAAC,GACDE,EAAO,GAAGD,CAAO,aAAa,EAAE,MAAM,MAAM;AAAA,MAE5C,CAAC,GAGDhB,IAAA;AAAA,IACF;AAIA,WAAAS,EAAQ,KAAK,UAAUE,CAAY,GACnCF,EAAQ,KAAK,qBAAqBE,CAAY,GAC9CF,EAAQ,KAAK,eAAeE,CAAY,GAGjC,MAAM;AACX,cAAQ,IAAI,wCAAwCH,CAAW,EAAE,GAG7DL,EAAW,WACbA,EAAW,QAAQ,WAAA,GAIjBA,EAAW,WAAWF,EAAU,WAClCA,EAAU,QAAQ,YAAYO,CAAW,GAIvCP,EAAU,YACZA,EAAU,QAAQ,WAAA,GAClBA,EAAU,UAAU,OAGtBE,EAAW,UAAU;AAAA,IACvB;AAAA,EACF,GAAG,CAACN,GAAOC,GAAQC,GAASC,CAAQ,CAAC,GAG9B;AAAA,IACL,SAASG,EAAW;AAAA,IACpB,QAAQF,EAAU;AAAA,EAAA;AAEtB;"}
1
+ {"version":3,"file":"usePusherUpdates.js","sources":["../../src/hooks/usePusherUpdates.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport Pusher from \"pusher-js\";\nimport { mutate } from \"swr\";\nimport { clearModuleCache } from \"../lib/moduleRegistry\";\n\ntype PusherConfig = {\n key?: string;\n cluster?: string;\n encrypted?: boolean;\n};\n\ntype UsePusherUpdatesOptions = {\n appId: string;\n pageId?: string;\n enabled?: boolean;\n onUpdate?: () => void;\n};\n\n// Get Pusher config from environment variables\nconst getPusherConfig = (): PusherConfig => {\n return {\n key: \"7b0611d0051677eed996\",\n cluster: \"us2\",\n encrypted: true,\n };\n};\n\n/**\n * Hook to listen for EncoreApp component updates via Pusher\n * Channel name format: `${appId}-${pageId}`\n * When an update event is received, it invalidates SWR cache and triggers a reload\n */\nexport function usePusherUpdates({\n appId,\n pageId,\n enabled = true,\n onUpdate,\n}: UsePusherUpdatesOptions) {\n const pusherRef = useRef<Pusher | null>(null);\n const channelRef = useRef<ReturnType<Pusher[\"subscribe\"]> | null>(null);\n\n useEffect(() => {\n // Only connect if enabled and we have both appId and pageId\n if (!enabled || !appId || !pageId) {\n return;\n }\n\n const config = getPusherConfig();\n\n // Skip if Pusher key is not configured\n if (!config.key) {\n console.warn(\"[Pusher] not configured. Pusher updates disabled.\");\n return;\n }\n\n // Initialize Pusher\n const pusher = new Pusher(config.key, {\n cluster: config.cluster || \"us2\",\n forceTLS: config.encrypted,\n });\n\n pusherRef.current = pusher;\n\n // Channel name format: appId-pageId (e.g., \"01KA23JMNBQ2V9NR7K0VXKT5TF-01KA23JMPBZSG2YRJ6M5X87SKJ\")\n const channelName = `${appId}`;\n console.log(`[Pusher] Subscribing to channel: ${channelName}`);\n\n // Subscribe to the channel\n const channel = pusher.subscribe(channelName);\n channelRef.current = channel;\n\n // Handle subscription success\n channel.bind(\"pusher:subscription_succeeded\", () => {\n console.log(\n `[Pusher] Successfully subscribed to channel: ${channelName}`\n );\n });\n\n // Handle subscription error\n channel.bind(\"pusher:subscription_error\", (status: number) => {\n console.error(\n `[Pusher] Subscription error for channel ${channelName}:`,\n status\n );\n });\n\n // Listen for update events\n // You can customize the event name based on your backend's Pusher event names\n // Common event names: 'update', 'component-updated', 'app-updated', etc.\n const handleUpdate = (data: unknown) => {\n console.log(`[Pusher] Update received for ${channelName}:`, data);\n\n // Clear the module cache for the component to force reload\n const componentName = `${appId}/draft/components/${pageId}`;\n clearModuleCache(componentName);\n\n // Invalidate SWR cache for both app and page data\n const appUrl = `/devices/apps/${appId}`;\n const pageUrl = `/devices/apps/${appId}/node/${pageId}`;\n\n // Mutate both URLs to trigger refetch\n mutate(appUrl).catch((err) => {\n console.error(\"[Pusher] Error invalidating app cache:\", err);\n });\n mutate(pageUrl).catch((err) => {\n console.error(\"[Pusher] Error invalidating page cache:\", err);\n });\n\n // Also invalidate URLs with useLocal query param if they exist\n mutate(`${appUrl}?useLocal=1`).catch(() => {\n // Ignore errors for optional URLs\n });\n mutate(`${pageUrl}?useLocal=1`).catch(() => {\n // Ignore errors for optional URLs\n });\n\n // Call the onUpdate callback if provided\n onUpdate?.();\n };\n\n // Bind to update events\n // Adjust the event name(s) based on what your backend sends\n channel.bind(\"update\", handleUpdate);\n channel.bind(\"component-updated\", handleUpdate);\n channel.bind(\"app-updated\", handleUpdate);\n\n // Cleanup function\n return () => {\n console.log(`[Pusher] Unsubscribing from channel: ${channelName}`);\n\n // Unbind all event handlers\n if (channelRef.current) {\n channelRef.current.unbind_all();\n }\n\n // Unsubscribe from channel\n if (channelRef.current && pusherRef.current) {\n pusherRef.current.unsubscribe(channelName);\n }\n\n // Disconnect Pusher if no other channels are subscribed\n if (pusherRef.current) {\n pusherRef.current.disconnect();\n pusherRef.current = null;\n }\n\n channelRef.current = null;\n };\n }, [appId, pageId, enabled, onUpdate]);\n\n // Return channel ref for advanced usage\n return {\n channel: channelRef.current,\n pusher: pusherRef.current,\n };\n}\n"],"names":["getPusherConfig","usePusherUpdates","appId","pageId","enabled","onUpdate","pusherRef","useRef","channelRef","useEffect","config","pusher","Pusher","channelName","channel","status","handleUpdate","data","componentName","clearModuleCache","appUrl","pageUrl","mutate","err"],"mappings":";;;;AAmBA,MAAMA,IAAkB,OACf;AAAA,EACL,KAAK;AAAA,EACL,SAAS;AAAA,EACT,WAAW;AAAA;AASR,SAASC,EAAiB;AAAA,EAC/B,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC,IAAU;AAAA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O,GAAGD,CAAO,aAAa,EAAE,MAAM,MAAM;AAAA,MAE5C,CAAC,GAGDhB,IAAA;AAAA,IACF;AAIA,WAAAS,EAAQ,KAAK,UAAUE,CAAY,GACnCF,EAAQ,KAAK,qBAAqBE,CAAY,GAC9CF,EAAQ,KAAK,eAAeE,CAAY,GAGjC,MAAM;AACX,cAAQ,IAAI,wCAAwCH,CAAW,EAAE,GAG7DL,EAAW,WACbA,EAAW,QAAQ,WAAA,GAIjBA,EAAW,WAAWF,EAAU,WAClCA,EAAU,QAAQ,YAAYO,CAAW,GAIvCP,EAAU,YACZA,EAAU,QAAQ,WAAA,GAClBA,EAAU,UAAU,OAGtBE,EAAW,UAAU;AAAA,IACvB;AAAA,EACF,GAAG,CAACN,GAAOC,GAAQC,GAASC,CAAQ,CAAC,GAG9B;AAAA,IACL,SAASG,EAAW;AAAA,IACpB,QAAQF,EAAU;AAAA,EAAA;AAEtB;"}
@@ -1,58 +1,51 @@
1
- import p from "./packages.js";
2
- import { isLocalMode as $ } from "./localMode.js";
1
+ import f from "./packages.js";
2
+ import { isLocalMode as p } from "./localMode.js";
3
3
  import { CONST_COMPONENTS_CDN_URL as E } from "../packages/encore-lib/constants.js";
4
- const M = {}, i = Object.keys(p).reduce(
5
- (e, r) => (e[r] = p[r], e),
6
- {}
7
- );
8
- function _(e, r) {
9
- i[e] = r;
10
- }
11
- function h(e) {
12
- return i[e]().exports;
13
- }
14
- function g(e) {
15
- return e in i;
16
- }
17
- function y(e, r) {
18
- return new Promise((d, m) => {
19
- const n = (t, s) => {
20
- typeof t == "function" && (s = t, t = []), Promise.all(
21
- t.map(async (c) => c === "require" ? ((o) => {
22
- if (!g(o))
4
+ import { haveModule as $, getModuleExports as h, registerModule as y } from "./moduleRegistry.js";
5
+ import { clearModuleCache as b } from "./moduleRegistry.js";
6
+ const M = {};
7
+ Object.keys(f).forEach((t) => {
8
+ y(t, f[t]);
9
+ });
10
+ function g(t, s) {
11
+ return new Promise((i, m) => {
12
+ const r = (e, a) => {
13
+ typeof e == "function" && (a = e, e = []), Promise.all(
14
+ e.map(async (n) => n === "require" ? ((o) => {
15
+ if (!$(o))
23
16
  throw new Error(`Module ${o} not found`);
24
17
  return h(o);
25
- }) : c === "exports" ? {} : (g(c) || await x(c), h(c)))
26
- ).then((c) => {
27
- const o = {}, u = s.apply(null, c) || o;
28
- d({ default: u });
18
+ }) : n === "exports" ? {} : ($(n) || await L(n), h(n)))
19
+ ).then((n) => {
20
+ const o = {}, l = a.apply(null, n) || o;
21
+ i({ default: l });
29
22
  }).catch(m);
30
23
  };
31
- n.amd = !0;
24
+ r.amd = !0;
32
25
  try {
33
- let t = r;
34
- t = t.replace(
26
+ let e = s;
27
+ e = e.replace(
35
28
  /t\.createElement\("undefined",(\{[^}]*nodeData:\{[^}]*type:"container:slider"[^}]*\}[^}]*\})/g,
36
- (c, o) => `t.createElement(e.SliderComponent,${o}`
37
- ), t = t.replace(
29
+ (n, o) => `t.createElement(e.SliderComponent,${o}`
30
+ ), e = e.replace(
38
31
  /t\.createElement\("undefined",(\{[^}]*nodeData:\{([^}]*type:"([^"]+)")?[^}]*\}[^}]*\})/g,
39
- (c, o, l, u) => {
40
- const a = o.match(/type:"([^"]+)"/), f = a ? a[1] : null;
41
- return `t.createElement(${f ? `(e["${f}"] || e.DefaultLayerComponent)` : "e.DefaultLayerComponent"},${o}`;
32
+ (n, o, u, l) => {
33
+ const c = o.match(/type:"([^"]+)"/), d = c ? c[1] : null;
34
+ return `t.createElement(${d ? `(e["${d}"] || e.DefaultLayerComponent)` : "e.DefaultLayerComponent"},${o}`;
42
35
  }
43
- ), t = t.replace(
36
+ ), e = e.replace(
44
37
  /t\.createElement\("undefined"/g,
45
38
  "t.createElement(e.DefaultLayerComponent"
46
39
  );
47
- const s = Function(
40
+ const a = Function(
48
41
  "define",
49
42
  `
50
43
  try {
51
- ${t}
52
- //# sourceURL=dynamic-module://${e}.js
44
+ ${e}
45
+ //# sourceURL=dynamic-module://${t}.js
53
46
  } catch (error) {
54
47
  console.error('[Module Evaluation Error]', {
55
- moduleName: '${e}',
48
+ moduleName: '${t}',
56
49
  error: error.message,
57
50
  stack: error.stack,
58
51
  lineNumber: error.lineNumber,
@@ -62,71 +55,68 @@ function y(e, r) {
62
55
  }
63
56
  `
64
57
  );
65
- console.debug(`[Module Loading] Attempting to load module: ${e}`), s(n), console.debug(`[Module Loading] Successfully loaded module: ${e}`);
66
- } catch (t) {
58
+ console.debug(`[Module Loading] Attempting to load module: ${t}`), a(r), console.debug(`[Module Loading] Successfully loaded module: ${t}`);
59
+ } catch (e) {
67
60
  console.error("[Module Loading Failed]", {
68
- moduleName: e,
69
- error: t,
70
- errorType: t.constructor.name,
71
- message: t.message,
72
- stack: t.stack,
73
- code: r.slice(0, 500) + (r.length > 500 ? "..." : "")
61
+ moduleName: t,
62
+ error: e,
63
+ errorType: e.constructor.name,
64
+ message: e.message,
65
+ stack: e.stack,
66
+ code: s.slice(0, 500) + (s.length > 500 ? "..." : "")
74
67
  // Show first 500 chars of code
75
- }), m(t);
68
+ }), m(e);
76
69
  }
77
70
  });
78
71
  }
79
- async function L(e) {
80
- if (console.log(`🔍 fetchDep called for ${e}. isLocalMode: ${$()}`), $()) {
81
- const n = e.match(/^([^/]+)\/draft\/components\/([^/]+)$/);
82
- if (n) {
83
- const t = n[1], s = n[2], c = M?.VITE_FLEX_LAYOUT_ABS || null, o = [
84
- `/flex-layout/${t}/${s}.js`,
85
- c ? `/@fs/${c}/${t}/${s}.js` : null
86
- ].filter(Boolean), l = [];
87
- for (const u of o)
72
+ async function _(t) {
73
+ if (console.log(`🔍 fetchDep called for ${t}. isLocalMode: ${p()}`), p()) {
74
+ const r = t.match(/^([^/]+)\/draft\/components\/([^/]+)$/);
75
+ if (r) {
76
+ const e = r[1], a = r[2], n = M?.VITE_FLEX_LAYOUT_ABS || null, o = [
77
+ `/flex-layout/${e}/${a}.js`,
78
+ n ? `/@fs/${n}/${e}/${a}.js` : null
79
+ ].filter(Boolean), u = [];
80
+ for (const l of o)
88
81
  try {
89
- const a = await fetch(u);
90
- if (!a.ok) {
91
- l.push(`${u}: ${a.status} ${a.statusText}`);
82
+ const c = await fetch(l);
83
+ if (!c.ok) {
84
+ u.push(`${l}: ${c.status} ${c.statusText}`);
92
85
  continue;
93
86
  }
94
- const f = await a.text();
95
- return await y(
96
- `${t}/draft/components/${s}`,
97
- f
87
+ const d = await c.text();
88
+ return await g(
89
+ `${e}/draft/components/${a}`,
90
+ d
98
91
  );
99
- } catch (a) {
100
- l.push(`${u}: ${a.message || String(a)}`);
92
+ } catch (c) {
93
+ u.push(`${l}: ${c.message || String(c)}`);
101
94
  }
102
95
  throw new Error(
103
- `Local component not found for ${e}. Tried: ${o.join(
96
+ `Local component not found for ${t}. Tried: ${o.join(
104
97
  ", "
105
- )}. Errors: ${l.join("; ")}`
98
+ )}. Errors: ${u.join("; ")}`
106
99
  );
107
100
  }
108
101
  }
109
- const r = Math.round(Date.now() / 1e3), d = `${E}/${e}.js?cacheBuster=${r}`;
110
- console.log(`[Module Loading] Fetching remote component from: ${d}`);
111
- const m = await fetch(d).then(async (n) => {
112
- if (!n.ok)
113
- throw n.status === 403 ? new Error(
114
- `Error: Could not fetch component '${e}'. Try regenerating components.`
115
- ) : new Error(`Network error (${n.status}): ${await n.text()}`);
116
- return n.text();
102
+ const s = Math.round(Date.now() / 1e3), i = `${E}/${t}.js?cacheBuster=${s}`;
103
+ console.log(`[Module Loading] Fetching remote component from: ${i}`);
104
+ const m = await fetch(i).then(async (r) => {
105
+ if (!r.ok)
106
+ throw r.status === 403 ? new Error(
107
+ `Error: Could not fetch component '${t}'. Try regenerating components.`
108
+ ) : new Error(`Network error (${r.status}): ${await r.text()}`);
109
+ return r.text();
117
110
  });
118
- return await y(e, m);
119
- }
120
- async function x(e) {
121
- const r = await L(e);
122
- _(e, () => ({ exports: r.default }));
111
+ return await g(t, m);
123
112
  }
124
- function D(e) {
125
- e in i && (delete i[e], console.log(`[Module Cache] Cleared module: ${e}`));
113
+ async function L(t) {
114
+ const s = await _(t);
115
+ y(t, () => ({ exports: s.default }));
126
116
  }
127
117
  export {
128
- D as clearModuleCache,
129
- L as fetchDep,
130
- y as loadAMDModule
118
+ b as clearModuleCache,
119
+ _ as fetchDep,
120
+ g as loadAMDModule
131
121
  };
132
122
  //# sourceMappingURL=dynamicModules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dynamicModules.js","sources":["../../src/lib/dynamicModules.ts"],"sourcesContent":["import packages from \"./packages\";\nimport { isLocalMode } from \"./localMode\";\nimport { CONST_COMPONENTS_CDN_URL } from \"../../constants\";\n\nconst _this = Object.keys(packages).reduce(\n (acc: Record<string, any>, p: string) => {\n acc[p] = packages[p];\n return acc;\n },\n {}\n);\n\nfunction registerModule(name: string, module: any) {\n _this[name] = module;\n}\n\nfunction getModuleExports(name: string) {\n return _this[name]().exports;\n}\n\nfunction haveModule(name: string): boolean {\n return name in _this;\n}\n\nexport function loadAMDModule(name: string, code: string) {\n return new Promise<any>((resolve, reject) => {\n const define = (deps: string[], factory: (...va: unknown[]) => unknown) => {\n if (typeof deps === \"function\") {\n factory = deps;\n deps = [];\n }\n\n Promise.all(\n deps.map(async (dep) => {\n if (dep === \"require\") {\n // Return a mock require function for AMD modules\n return ((id: string) => {\n if (!haveModule(id)) {\n throw new Error(`Module ${id} not found`);\n }\n return getModuleExports(id);\n }) as typeof require;\n }\n if (dep === \"exports\") return {};\n if (!haveModule(dep)) await fetchAndRegister(dep);\n return getModuleExports(dep);\n })\n )\n .then((resolvedDeps: unknown[]) => {\n const exports = {};\n const module = factory.apply(null, resolvedDeps);\n const result = module || exports;\n resolve({ default: result });\n })\n .catch(reject);\n };\n\n define.amd = true;\n\n try {\n // Patch code to replace hardcoded \"undefined\" component references\n // This fixes remote component files that were generated before certain components existed\n let patchedCode = code;\n\n // Replace t.createElement(\"undefined\", props) for container:slider with e.SliderComponent\n // Note: Components are passed as the second parameter 'e' in AMD modules: define([\"react\",\"@/bravo/components\"],(function(t,e){...}))\n patchedCode = patchedCode.replace(\n /t\\.createElement\\(\"undefined\",(\\{[^}]*nodeData:\\{[^}]*type:\"container:slider\"[^}]*\\}[^}]*\\})/g,\n (_match, propsStr) => {\n return `t.createElement(e.SliderComponent,${propsStr}`;\n }\n );\n\n // Fallback for any other undefined components - use the type-based lookup\n patchedCode = patchedCode.replace(\n /t\\.createElement\\(\"undefined\",(\\{[^}]*nodeData:\\{([^}]*type:\"([^\"]+)\")?[^}]*\\}[^}]*\\})/g,\n (_match, propsStr, _typeStr, _type) => {\n const typeMatch = propsStr.match(/type:\"([^\"]+)\"/);\n const componentType = typeMatch ? typeMatch[1] : null;\n const componentLookup = componentType\n ? `(e[\"${componentType}\"] || e.DefaultLayerComponent)`\n : \"e.DefaultLayerComponent\";\n return `t.createElement(${componentLookup},${propsStr}`;\n }\n );\n\n // Final fallback for any remaining \"undefined\"\n patchedCode = patchedCode.replace(\n /t\\.createElement\\(\"undefined\"/g,\n \"t.createElement(e.DefaultLayerComponent\"\n );\n\n // Wrap with error boundary\n // Note: Components are already passed as the second parameter 'e' via AMD dependencies,\n // so we don't need to inject them separately\n const wrapper = Function(\n \"define\",\n `\n try {\n ${patchedCode}\\n//# sourceURL=dynamic-module://${name}.js\n } catch (error) {\n console.error('[Module Evaluation Error]', {\n moduleName: '${name}',\n error: error.message,\n stack: error.stack,\n lineNumber: error.lineNumber,\n columnNumber: error.columnNumber\n });\n throw error;\n }\n `\n );\n\n console.debug(`[Module Loading] Attempting to load module: ${name}`);\n wrapper(define);\n console.debug(`[Module Loading] Successfully loaded module: ${name}`);\n } catch (e: any) {\n // Enhanced error logging\n console.error(\"[Module Loading Failed]\", {\n moduleName: name,\n error: e,\n errorType: e.constructor.name,\n message: e.message,\n stack: e.stack,\n code: code.slice(0, 500) + (code.length > 500 ? \"...\" : \"\"), // Show first 500 chars of code\n });\n reject(e);\n }\n });\n}\n\nexport async function fetchDep(name: string) {\n // Local mode: map Encore component name to local JSX/JS under /flex-layout\n console.log(`🔍 fetchDep called for ${name}. isLocalMode: ${isLocalMode()}`);\n if (isLocalMode()) {\n // Expecting `${appId}/draft/components/${pageId}`\n const m = name.match(/^([^/]+)\\/draft\\/components\\/([^/]+)$/);\n if (m) {\n const appId = m[1];\n const pageId = m[2];\n // Load from public as AMD (do not import() public files; Vite forbids importing from /public)\n const absBase = (import.meta as any)?.env?.VITE_FLEX_LAYOUT_ABS || null;\n const candidates = [\n `/flex-layout/${appId}/${pageId}.js`,\n absBase ? `/@fs/${absBase}/${appId}/${pageId}.js` : null,\n ].filter(Boolean) as string[];\n\n // Fetch as text and evaluate via AMD define shim\n const errors: string[] = [];\n for (const url of candidates) {\n try {\n const response = await fetch(url);\n if (!response.ok) {\n errors.push(`${url}: ${response.status} ${response.statusText}`);\n continue;\n }\n const code = await response.text();\n const amd = await loadAMDModule(\n `${appId}/draft/components/${pageId}`,\n code\n );\n return amd;\n } catch (e: any) {\n errors.push(`${url}: ${e.message || String(e)}`);\n }\n }\n throw new Error(\n `Local component not found for ${name}. Tried: ${candidates.join(\n \", \"\n )}. Errors: ${errors.join(\"; \")}`\n );\n }\n }\n // Remote mode: use AMD loader\n const cacheBuster = Math.round(Date.now() / 1000);\n const url = `${CONST_COMPONENTS_CDN_URL}/${name}.js?cacheBuster=${cacheBuster}`;\n console.log(`[Module Loading] Fetching remote component from: ${url}`);\n const text = await fetch(url).then(async (a) => {\n if (!a.ok) {\n if (a.status === 403) {\n throw new Error(\n `Error: Could not fetch component '${name}'. Try regenerating components.`\n );\n } else {\n throw new Error(`Network error (${a.status}): ${await a.text()}`);\n }\n }\n return a.text();\n });\n\n return await loadAMDModule(name, text);\n // } catch (error) {\n // return {\n // default() {\n // console.log(error);\n // throw new Error(\"Failed to render\");\n // },\n // };\n // }\n}\n\nasync function fetchAndRegister(dep: string) {\n const result = await fetchDep(dep);\n registerModule(dep, () => ({ exports: result.default }));\n}\n\n/**\n * Clear a module from the cache to force reload on next fetch\n * @param name Module name (e.g., `${appId}/draft/components/${pageId}`)\n */\nexport function clearModuleCache(name: string): void {\n if (name in _this) {\n delete _this[name];\n console.log(`[Module Cache] Cleared module: ${name}`);\n }\n}\n"],"names":["_this","packages","acc","p","registerModule","name","module","getModuleExports","haveModule","loadAMDModule","code","resolve","reject","define","deps","factory","dep","id","fetchAndRegister","resolvedDeps","exports","result","patchedCode","_match","propsStr","_typeStr","_type","typeMatch","componentType","wrapper","e","fetchDep","isLocalMode","m","appId","pageId","absBase","__vite_import_meta_env__","candidates","errors","url","response","cacheBuster","CONST_COMPONENTS_CDN_URL","text","a","clearModuleCache"],"mappings":";;;cAIMA,IAAQ,OAAO,KAAKC,CAAQ,EAAE;AAAA,EAClC,CAACC,GAA0BC,OACzBD,EAAIC,CAAC,IAAIF,EAASE,CAAC,GACZD;AAAA,EAET,CAAA;AACF;AAEA,SAASE,EAAeC,GAAcC,GAAa;AACjD,EAAAN,EAAMK,CAAI,IAAIC;AAChB;AAEA,SAASC,EAAiBF,GAAc;AACtC,SAAOL,EAAMK,CAAI,EAAA,EAAI;AACvB;AAEA,SAASG,EAAWH,GAAuB;AACzC,SAAOA,KAAQL;AACjB;AAEO,SAASS,EAAcJ,GAAcK,GAAc;AACxD,SAAO,IAAI,QAAa,CAACC,GAASC,MAAW;AAC3C,UAAMC,IAAS,CAACC,GAAgBC,MAA2C;AACzE,MAAI,OAAOD,KAAS,eAClBC,IAAUD,GACVA,IAAO,CAAA,IAGT,QAAQ;AAAA,QACNA,EAAK,IAAI,OAAOE,MACVA,MAAQ,aAEF,CAACC,MAAe;AACtB,cAAI,CAACT,EAAWS,CAAE;AAChB,kBAAM,IAAI,MAAM,UAAUA,CAAE,YAAY;AAE1C,iBAAOV,EAAiBU,CAAE;AAAA,QAC5B,KAEED,MAAQ,YAAkB,CAAA,KACzBR,EAAWQ,CAAG,KAAG,MAAME,EAAiBF,CAAG,GACzCT,EAAiBS,CAAG,EAC5B;AAAA,MAAA,EAEA,KAAK,CAACG,MAA4B;AACjC,cAAMC,IAAU,CAA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,CAAG,EAAE,KAAK,OAAOK,MAAM;AAC9C,QAAI,CAACA,EAAE;AACL,YAAIA,EAAE,WAAW,MACT,IAAI;AAAA,QACR,qCAAqCxC,CAAI;AAAA,MAAA,IAGrC,IAAI,MAAM,kBAAkBwC,EAAE,MAAM,MAAM,MAAMA,EAAE,KAAA,CAAM,EAAE;AAGpE,WAAOA,EAAE,KAAA;AAAA,EACX,CAAC;AAED,SAAO,MAAMpC,EAAcJ,GAAMuC,CAAI;AASvC;AAEA,eAAe1B,EAAiBF,GAAa;AAC3C,QAAMK,IAAS,MAAMU,EAASf,CAAG;AACjC,EAAAZ,EAAeY,GAAK,OAAO,EAAE,SAASK,EAAO,UAAU;AACzD;AAMO,SAASyB,EAAiBzC,GAAoB;AACnD,EAAIA,KAAQL,MACV,OAAOA,EAAMK,CAAI,GACjB,QAAQ,IAAI,kCAAkCA,CAAI,EAAE;AAExD;"}
1
+ {"version":3,"file":"dynamicModules.js","sources":["../../src/lib/dynamicModules.ts"],"sourcesContent":["import packages from \"./packages\";\nimport { isLocalMode } from \"./localMode\";\nimport { CONST_COMPONENTS_CDN_URL } from \"../../constants\";\nimport { registerModule, getModuleExports, haveModule } from \"./moduleRegistry\";\n\n// Initialize registry with default packages\nObject.keys(packages).forEach((p) => {\n registerModule(p, packages[p]);\n});\n\nexport function loadAMDModule(name: string, code: string) {\n return new Promise<any>((resolve, reject) => {\n const define = (deps: string[], factory: (...va: unknown[]) => unknown) => {\n if (typeof deps === \"function\") {\n factory = deps;\n deps = [];\n }\n\n Promise.all(\n deps.map(async (dep) => {\n if (dep === \"require\") {\n // Return a mock require function for AMD modules\n return ((id: string) => {\n if (!haveModule(id)) {\n throw new Error(`Module ${id} not found`);\n }\n return getModuleExports(id);\n }) as typeof require;\n }\n if (dep === \"exports\") return {};\n if (!haveModule(dep)) await fetchAndRegister(dep);\n return getModuleExports(dep);\n })\n )\n .then((resolvedDeps: unknown[]) => {\n const exports = {};\n const module = factory.apply(null, resolvedDeps);\n const result = module || exports;\n resolve({ default: result });\n })\n .catch(reject);\n };\n\n define.amd = true;\n\n try {\n // Patch code to replace hardcoded \"undefined\" component references\n // This fixes remote component files that were generated before certain components existed\n let patchedCode = code;\n\n // Replace t.createElement(\"undefined\", props) for container:slider with e.SliderComponent\n // Note: Components are passed as the second parameter 'e' in AMD modules: define([\"react\",\"@/bravo/components\"],(function(t,e){...}))\n patchedCode = patchedCode.replace(\n /t\\.createElement\\(\"undefined\",(\\{[^}]*nodeData:\\{[^}]*type:\"container:slider\"[^}]*\\}[^}]*\\})/g,\n (_match, propsStr) => {\n return `t.createElement(e.SliderComponent,${propsStr}`;\n }\n );\n\n // Fallback for any other undefined components - use the type-based lookup\n patchedCode = patchedCode.replace(\n /t\\.createElement\\(\"undefined\",(\\{[^}]*nodeData:\\{([^}]*type:\"([^\"]+)\")?[^}]*\\}[^}]*\\})/g,\n (_match, propsStr, _typeStr, _type) => {\n const typeMatch = propsStr.match(/type:\"([^\"]+)\"/);\n const componentType = typeMatch ? typeMatch[1] : null;\n const componentLookup = componentType\n ? `(e[\"${componentType}\"] || e.DefaultLayerComponent)`\n : \"e.DefaultLayerComponent\";\n return `t.createElement(${componentLookup},${propsStr}`;\n }\n );\n\n // Final fallback for any remaining \"undefined\"\n patchedCode = patchedCode.replace(\n /t\\.createElement\\(\"undefined\"/g,\n \"t.createElement(e.DefaultLayerComponent\"\n );\n\n // Wrap with error boundary\n // Note: Components are already passed as the second parameter 'e' via AMD dependencies,\n // so we don't need to inject them separately\n const wrapper = Function(\n \"define\",\n `\n try {\n ${patchedCode}\\n//# sourceURL=dynamic-module://${name}.js\n } catch (error) {\n console.error('[Module Evaluation Error]', {\n moduleName: '${name}',\n error: error.message,\n stack: error.stack,\n lineNumber: error.lineNumber,\n columnNumber: error.columnNumber\n });\n throw error;\n }\n `\n );\n\n console.debug(`[Module Loading] Attempting to load module: ${name}`);\n wrapper(define);\n console.debug(`[Module Loading] Successfully loaded module: ${name}`);\n } catch (e: any) {\n // Enhanced error logging\n console.error(\"[Module Loading Failed]\", {\n moduleName: name,\n error: e,\n errorType: e.constructor.name,\n message: e.message,\n stack: e.stack,\n code: code.slice(0, 500) + (code.length > 500 ? \"...\" : \"\"), // Show first 500 chars of code\n });\n reject(e);\n }\n });\n}\n\nexport async function fetchDep(name: string) {\n // Local mode: map Encore component name to local JSX/JS under /flex-layout\n console.log(`🔍 fetchDep called for ${name}. isLocalMode: ${isLocalMode()}`);\n if (isLocalMode()) {\n // Expecting `${appId}/draft/components/${pageId}`\n const m = name.match(/^([^/]+)\\/draft\\/components\\/([^/]+)$/);\n if (m) {\n const appId = m[1];\n const pageId = m[2];\n // Load from public as AMD (do not import() public files; Vite forbids importing from /public)\n const absBase = (import.meta as any)?.env?.VITE_FLEX_LAYOUT_ABS || null;\n const candidates = [\n `/flex-layout/${appId}/${pageId}.js`,\n absBase ? `/@fs/${absBase}/${appId}/${pageId}.js` : null,\n ].filter(Boolean) as string[];\n\n // Fetch as text and evaluate via AMD define shim\n const errors: string[] = [];\n for (const url of candidates) {\n try {\n const response = await fetch(url);\n if (!response.ok) {\n errors.push(`${url}: ${response.status} ${response.statusText}`);\n continue;\n }\n const code = await response.text();\n const amd = await loadAMDModule(\n `${appId}/draft/components/${pageId}`,\n code\n );\n return amd;\n } catch (e: any) {\n errors.push(`${url}: ${e.message || String(e)}`);\n }\n }\n throw new Error(\n `Local component not found for ${name}. Tried: ${candidates.join(\n \", \"\n )}. Errors: ${errors.join(\"; \")}`\n );\n }\n }\n // Remote mode: use AMD loader\n const cacheBuster = Math.round(Date.now() / 1000);\n const url = `${CONST_COMPONENTS_CDN_URL}/${name}.js?cacheBuster=${cacheBuster}`;\n console.log(`[Module Loading] Fetching remote component from: ${url}`);\n const text = await fetch(url).then(async (a) => {\n if (!a.ok) {\n if (a.status === 403) {\n throw new Error(\n `Error: Could not fetch component '${name}'. Try regenerating components.`\n );\n } else {\n throw new Error(`Network error (${a.status}): ${await a.text()}`);\n }\n }\n return a.text();\n });\n\n return await loadAMDModule(name, text);\n // } catch (error) {\n // return {\n // default() {\n // console.log(error);\n // throw new Error(\"Failed to render\");\n // },\n // };\n // }\n}\n\nasync function fetchAndRegister(dep: string) {\n const result = await fetchDep(dep);\n registerModule(dep, () => ({ exports: result.default }));\n}\n\nexport { clearModuleCache } from \"./moduleRegistry\";\n"],"names":["packages","p","registerModule","loadAMDModule","name","code","resolve","reject","define","deps","factory","dep","id","haveModule","getModuleExports","fetchAndRegister","resolvedDeps","exports","result","patchedCode","_match","propsStr","_typeStr","_type","typeMatch","componentType","wrapper","fetchDep","isLocalMode","m","appId","pageId","absBase","__vite_import_meta_env__","candidates","errors","url","response","e","cacheBuster","CONST_COMPONENTS_CDN_URL","text","a"],"mappings":";;;;;;AAMA,OAAO,KAAKA,CAAQ,EAAE,QAAQ,CAACC,MAAM;AACnC,EAAAC,EAAeD,GAAGD,EAASC,CAAC,CAAC;AAC/B,CAAC;AAEM,SAASE,EAAcC,GAAcC,GAAc;AACxD,SAAO,IAAI,QAAa,CAACC,GAASC,MAAW;AAC3C,UAAMC,IAAS,CAACC,GAAgBC,MAA2C;AACzE,MAAI,OAAOD,KAAS,eAClBC,IAAUD,GACVA,IAAO,CAAA,IAGT,QAAQ;AAAA,QACNA,EAAK,IAAI,OAAOE,MACVA,MAAQ,aAEF,CAACC,MAAe;AACtB,cAAI,CAACC,EAAWD,CAAE;AAChB,kBAAM,IAAI,MAAM,UAAUA,CAAE,YAAY;AAE1C,iBAAOE,EAAiBF,CAAE;AAAA,QAC5B,KAEED,MAAQ,YAAkB,CAAA,KACzBE,EAAWF,CAAG,KAAG,MAAMI,EAAiBJ,CAAG,GACzCG,EAAiBH,CAAG,EAC5B;AAAA,MAAA,EAEA,KAAK,CAACK,MAA4B;AACjC,cAAMC,IAAU,CAAA,GAEVC,IADSR,EAAQ,MAAM,MAAMM,CAAY,KACtBC;AACzB,QAAAX,EAAQ,EAAE,SAASY,GAAQ;AAAA,MAC7B,CAAC,EACA,MAAMX,CAAM;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AAI,MAAM,kBAAkBsC,EAAE,MAAM,MAAM,MAAMA,EAAE,KAAA,CAAM,EAAE;AAGpE,WAAOA,EAAE,KAAA;AAAA,EACX,CAAC;AAED,SAAO,MAAMvC,EAAcC,GAAMqC,CAAI;AASvC;AAEA,eAAe1B,EAAiBJ,GAAa;AAC3C,QAAMO,IAAS,MAAMS,EAAShB,CAAG;AACjC,EAAAT,EAAeS,GAAK,OAAO,EAAE,SAASO,EAAO,UAAU;AACzD;"}
@@ -0,0 +1,20 @@
1
+ const o = {};
2
+ function r(e, t) {
3
+ o[e] = t;
4
+ }
5
+ function n(e) {
6
+ return o[e]().exports;
7
+ }
8
+ function u(e) {
9
+ return e in o;
10
+ }
11
+ function l(e) {
12
+ e in o && (delete o[e], console.log(`[Module Cache] Cleared module: ${e}`));
13
+ }
14
+ export {
15
+ l as clearModuleCache,
16
+ n as getModuleExports,
17
+ u as haveModule,
18
+ r as registerModule
19
+ };
20
+ //# sourceMappingURL=moduleRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moduleRegistry.js","sources":["../../src/lib/moduleRegistry.ts"],"sourcesContent":["const registry: Record<string, any> = {};\n\nexport function registerModule(name: string, module: any) {\n registry[name] = module;\n}\n\nexport function getModuleExports(name: string) {\n return registry[name]().exports;\n}\n\nexport function haveModule(name: string): boolean {\n return name in registry;\n}\n\n/**\n * Clear a module from the cache to force reload on next fetch\n * @param name Module name (e.g., `${appId}/draft/components/${pageId}`)\n */\nexport function clearModuleCache(name: string): void {\n if (name in registry) {\n delete registry[name];\n console.log(`[Module Cache] Cleared module: ${name}`);\n }\n}\n"],"names":["registry","registerModule","name","module","getModuleExports","haveModule","clearModuleCache"],"mappings":"AAAA,MAAMA,IAAgC,CAAA;AAE/B,SAASC,EAAeC,GAAcC,GAAa;AACxD,EAAAH,EAASE,CAAI,IAAIC;AACnB;AAEO,SAASC,EAAiBF,GAAc;AAC7C,SAAOF,EAASE,CAAI,EAAA,EAAI;AAC1B;AAEO,SAASG,EAAWH,GAAuB;AAChD,SAAOA,KAAQF;AACjB;AAMO,SAASM,EAAiBJ,GAAoB;AACnD,EAAIA,KAAQF,MACV,OAAOA,EAASE,CAAI,GACpB,QAAQ,IAAI,kCAAkCA,CAAI,EAAE;AAExD;"}
@@ -5,9 +5,7 @@ import * as t from "../app.js";
5
5
  const a = {
6
6
  "@/bravo/app": () => ({ exports: t }),
7
7
  // Disabled: app module doesn't exist
8
- // "react-router-dom": () => ({
9
- // exports: { Link, useSearchParams, useNavigate, useLocation },
10
- // }),
8
+ // React router dom removed
11
9
  axios: () => ({ exports: r }),
12
10
  react: () => ({ exports: o })
13
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"packages.js","sources":["../../src/lib/packages.ts"],"sourcesContent":["import React from \"react\";\n// import {\n// Link,\n// useSearchParams,\n// useNavigate,\n// useLocation,\n// } from \"react-router-dom\";\nimport axios from \"axios\";\nimport EncoreComponents from \"../components\";\nimport * as EncoreApp from \"../app\"\n// Note: ../app module doesn't exist in encore-lib, commenting out for now\n\nexport type Package = {\n exports: unknown;\n};\n\n// These are the packages that will be available to remotely loaded code\nconst Packages: Record<string, () => Package> = {\n \"@/bravo/app\": () => ({ exports: EncoreApp }), // Disabled: app module doesn't exist\n // \"react-router-dom\": () => ({\n // exports: { Link, useSearchParams, useNavigate, useLocation },\n // }),\n axios: () => ({ exports: axios }),\n react: () => ({ exports: React }),\n};\n\n// Enable this if you want to use components from local project\nconst USE_LOCAL_BRAVO_RN = true;\nif (USE_LOCAL_BRAVO_RN) {\n Packages[\"@/bravo/components\"] = () => ({ exports: EncoreComponents });\n}\n\nexport default Packages;\n"],"names":["Packages","EncoreApp","axios","React","EncoreComponents"],"mappings":";;;;AAiBA,MAAMA,IAA0C;AAAA,EAC5C,eAAe,OAAO,EAAE,SAASC;;;;;EAIjC,OAAO,OAAO,EAAE,SAASC;EACzB,OAAO,OAAO,EAAE,SAASC,EAAA;AAC7B;AAKIH,EAAS,oBAAoB,IAAI,OAAO,EAAE,SAASI,EAAA;"}
1
+ {"version":3,"file":"packages.js","sources":["../../src/lib/packages.ts"],"sourcesContent":["import React from \"react\";\n// React router dom dependency removed\nimport axios from \"axios\";\nimport EncoreComponents from \"../components\";\nimport * as EncoreApp from \"../app\";\n// Note: ../app module doesn't exist in encore-lib, commenting out for now\n\nexport type Package = {\n exports: unknown;\n};\n\n// These are the packages that will be available to remotely loaded code\nconst Packages: Record<string, () => Package> = {\n \"@/bravo/app\": () => ({ exports: EncoreApp }), // Disabled: app module doesn't exist\n // React router dom removed\n axios: () => ({ exports: axios }),\n react: () => ({ exports: React }),\n};\n\n// Enable this if you want to use components from local project\nconst USE_LOCAL_BRAVO_RN = true;\nif (USE_LOCAL_BRAVO_RN) {\n Packages[\"@/bravo/components\"] = () => ({ exports: EncoreComponents });\n}\n\nexport default Packages;\n"],"names":["Packages","EncoreApp","axios","React","EncoreComponents"],"mappings":";;;;AAYA,MAAMA,IAA0C;AAAA,EAC9C,eAAe,OAAO,EAAE,SAASC;;;EAEjC,OAAO,OAAO,EAAE,SAASC;EACzB,OAAO,OAAO,EAAE,SAASC,EAAA;AAC3B;AAKEH,EAAS,oBAAoB,IAAI,OAAO,EAAE,SAASI,EAAA;"}
@@ -0,0 +1,10 @@
1
+ import { ComponentInfo, SliderInfo, InputGroupInfo, FormInfo, SelectInputInfo, ActionButtonInfo } from "./types";
2
+ export interface ComponentMetadata {
3
+ props: string[];
4
+ events: string[];
5
+ jsx: string;
6
+ }
7
+ export declare function generateComponentCode(appId: string, pageId: string, componentName: string, sliders: SliderInfo[], standaloneComponents: ComponentInfo[], inputGroups: InputGroupInfo[], forms: FormInfo[], selectInputs: SelectInputInfo[], actionButtons: ActionButtonInfo[], isProduction?: boolean): string;
8
+ export declare function generateReadme(appId: string, pageId: string, appName: string, pageName: string, componentName: string, sliders: SliderInfo[], standaloneComponents: ComponentInfo[], inputGroups: InputGroupInfo[], forms: FormInfo[], selectInputs: SelectInputInfo[], actionButtons: ActionButtonInfo[]): string;
9
+ export declare function generateComponentMetadata(_appName: string, pageName: string, sliders: SliderInfo[], standaloneComponents: ComponentInfo[], inputGroups: InputGroupInfo[], forms: FormInfo[], selectInputs: SelectInputInfo[], actionButtons: ActionButtonInfo[]): ComponentMetadata;
10
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/codegen/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,QAAQ,EACR,eAAe,EACf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAOjB,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,UAAU,EAAE,EACrB,oBAAoB,EAAE,aAAa,EAAE,EACrC,WAAW,EAAE,cAAc,EAAE,EAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,YAAY,EAAE,eAAe,EAAE,EAC/B,aAAa,EAAE,gBAAgB,EAAE,EACjC,YAAY,GAAE,OAAe,GAC5B,MAAM,CA2ZR;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,UAAU,EAAE,EACrB,oBAAoB,EAAE,aAAa,EAAE,EACrC,WAAW,EAAE,cAAc,EAAE,EAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,YAAY,EAAE,eAAe,EAAE,EAC/B,aAAa,EAAE,gBAAgB,EAAE,GAChC,MAAM,CAwVR;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,UAAU,EAAE,EACrB,oBAAoB,EAAE,aAAa,EAAE,EACrC,WAAW,EAAE,cAAc,EAAE,EAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,YAAY,EAAE,eAAe,EAAE,EAC/B,aAAa,EAAE,gBAAgB,EAAE,GAChC,iBAAiB,CAiEnB"}
@@ -0,0 +1,37 @@
1
+ import { ComponentInfo, SliderInfo, InputGroupInfo, FormInfo, SelectInputInfo, ActionButtonInfo } from "./types";
2
+ export declare function sanitizePropName(name: string): string;
3
+ export declare function generateQualifiedPropName(componentName: string, parentPath: string[]): string;
4
+ /**
5
+ * Finds the minimal distinguishing path suffix for a component when compared to others.
6
+ * Returns the shortest suffix (from root side, working towards leaf) that makes this path unique.
7
+ *
8
+ * The algorithm finds where paths first diverge from the root, then takes the minimal
9
+ * distinguishing part from that divergence point towards the leaf.
10
+ */
11
+ export declare function findMinimalDistinguishingPath(thisPath: string[], otherPaths: string[][]): string[];
12
+ /**
13
+ * Helper to compare two arrays for equality
14
+ */
15
+ export declare function arraysEqual(a: string[], b: string[]): boolean;
16
+ export declare function getComponentPropType(componentType: string, _componentName: string): string;
17
+ export declare function getComponentPropName(componentType: string): string;
18
+ export declare function findSlidersAndDataBindings(pageData: any): SliderInfo[];
19
+ export declare function findStandaloneComponents(pageData: any): ComponentInfo[];
20
+ export declare function findInputGroups(pageData: any): InputGroupInfo[];
21
+ export declare function findForms(pageData: any): FormInfo[];
22
+ /**
23
+ * Finds standalone select input components (input-select) that are NOT inside forms.
24
+ * These should be exposed as controlled inputs with value and onChange props.
25
+ */
26
+ export declare function findStandaloneSelectInputs(pageData: any, forms: FormInfo[]): SelectInputInfo[];
27
+ /**
28
+ * Finds action buttons - components that have action tags (action:remote, action:link, etc.)
29
+ * or have actions defined. These should be exposed with onClick handlers.
30
+ */
31
+ export declare function findActionButtons(pageData: any): ActionButtonInfo[];
32
+ /**
33
+ * Qualifies form input prop names to ensure uniqueness within each form.
34
+ * Only qualifies where necessary, using minimal distinguishing paths.
35
+ */
36
+ export declare function qualifyFormInputs(forms: FormInfo[]): void;
37
+ //# sourceMappingURL=parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/codegen/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,QAAQ,EACR,eAAe,EACf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA0BrD;AAED,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,CA8BR;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAAE,EAClB,UAAU,EAAE,MAAM,EAAE,EAAE,GACrB,MAAM,EAAE,CA6DV;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAG7D;AAED,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,GACrB,MAAM,CAgBR;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAQlE;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,GAAG,GAAG,UAAU,EAAE,CA6atE;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,GAAG,GAAG,aAAa,EAAE,CA4SvE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,GAAG,GAAG,cAAc,EAAE,CA0D/D;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,GAAG,GAAG,QAAQ,EAAE,CAkJnD;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,GAAG,EACb,KAAK,EAAE,QAAQ,EAAE,GAChB,eAAe,EAAE,CAqEnB;AAkDD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,GAAG,GAAG,gBAAgB,EAAE,CAgFnE;AAoDD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAoNzD"}
@@ -0,0 +1,53 @@
1
+ export interface ComponentInfo {
2
+ id: string;
3
+ name: string;
4
+ type: string;
5
+ tags: string[];
6
+ propName: string;
7
+ propType: string;
8
+ }
9
+ export interface ArrayContainerInfo {
10
+ id: string;
11
+ name: string;
12
+ propName: string;
13
+ components: ComponentInfo[];
14
+ }
15
+ export interface SliderInfo {
16
+ id: string;
17
+ name: string;
18
+ arrayContainer: ArrayContainerInfo | null;
19
+ }
20
+ export interface InputGroupInfo {
21
+ groupName: string;
22
+ groupType: string;
23
+ elements: Array<{
24
+ id: string;
25
+ name: string;
26
+ }>;
27
+ }
28
+ export interface FormInfo {
29
+ formId: string;
30
+ formName: string;
31
+ submitButtonId?: string;
32
+ inputs: Array<{
33
+ id: string;
34
+ name: string;
35
+ type: string;
36
+ propName: string;
37
+ _parentPath?: string[];
38
+ }>;
39
+ }
40
+ export interface SelectInputInfo {
41
+ id: string;
42
+ name: string;
43
+ propName: string;
44
+ _parentPath?: string[];
45
+ }
46
+ export interface ActionButtonInfo {
47
+ id: string;
48
+ name: string;
49
+ propName: string;
50
+ actionType: string;
51
+ _parentPath?: string[];
52
+ }
53
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/codegen/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MAA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oreRouterContextType = {
3
+ navigate: (path: string) => void;
4
+ pathname: string;
5
+ searchParams: URLSearchParams;
6
+ };
7
+ declare const EncoreRouterContext: React.Context<EncoreRouterContextType>;
8
+ export declare const useEncoreRouter: () => EncoreRouterContextType;
9
+ export default EncoreRouterContext;
10
+ //# sourceMappingURL=EncoreRouterContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EncoreRouterContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/EncoreRouterContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AAgBF,QAAA,MAAM,mBAAmB,wCACoC,CAAC;AAE9D,eAAO,MAAM,eAAe,+BAAwC,CAAC;AAErE,eAAe,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAuthRedirect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAuthRedirect.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,eAAe,YAuDpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"useAuthRedirect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAuthRedirect.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,eAAe,YAwDpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,8 +1,4 @@
1
1
  export declare function loadAMDModule(name: string, code: string): Promise<any>;
2
2
  export declare function fetchDep(name: string): Promise<any>;
3
- /**
4
- * Clear a module from the cache to force reload on next fetch
5
- * @param name Module name (e.g., `${appId}/draft/components/${pageId}`)
6
- */
7
- export declare function clearModuleCache(name: string): void;
3
+ export { clearModuleCache } from "./moduleRegistry";
8
4
  //# sourceMappingURL=dynamicModules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dynamicModules.d.ts","sourceRoot":"","sources":["../../../src/lib/dynamicModules.ts"],"names":[],"mappings":"AAwBA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,gBAyGvD;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,gBAoE1C;AAOD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAKnD"}
1
+ {"version":3,"file":"dynamicModules.d.ts","sourceRoot":"","sources":["../../../src/lib/dynamicModules.ts"],"names":[],"mappings":"AAUA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,gBAyGvD;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,gBAoE1C;AAOD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare function registerModule(name: string, module: any): void;
2
+ export declare function getModuleExports(name: string): any;
3
+ export declare function haveModule(name: string): boolean;
4
+ /**
5
+ * Clear a module from the cache to force reload on next fetch
6
+ * @param name Module name (e.g., `${appId}/draft/components/${pageId}`)
7
+ */
8
+ export declare function clearModuleCache(name: string): void;
9
+ //# sourceMappingURL=moduleRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moduleRegistry.d.ts","sourceRoot":"","sources":["../../../src/lib/moduleRegistry.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,QAEvD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,OAE5C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAKnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../src/lib/packages.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,OAAO,GAAG;IAClB,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAGF,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAO3C,CAAC;AAQF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../src/lib/packages.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAGF,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAK3C,CAAC;AAQF,eAAe,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bravostudioai/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/src/index.d.ts",