@nuraly/runtime 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.
@@ -1,4 +1,4 @@
1
- import { M as o, e as a, d as r, c as s, b as M } from "./micro-app-entry-DDsAWUJh.js";
1
+ import { M as o, e as a, d as r, c as s, b as M } from "./micro-app-entry-xdTX5-ut.js";
2
2
  export {
3
3
  o as MicroApp,
4
4
  a as MicroAppMessageBus,
package/dist/micro-app.js CHANGED
@@ -9456,9 +9456,27 @@ let MicroApp = class extends LitElement {
9456
9456
  */
9457
9457
  willUpdate(changedProperties) {
9458
9458
  super.willUpdate(changedProperties);
9459
+ console.log("[MicroApp DEBUG] willUpdate called", {
9460
+ changedProperties: Array.from(changedProperties.keys()),
9461
+ uuid: this.uuid,
9462
+ page_uuid: this.page_uuid,
9463
+ useIsolatedContext: this.useIsolatedContext,
9464
+ hasStoreContext: !!this.storeContext,
9465
+ appComponentsLength: this.appComponents?.length,
9466
+ appPagesLength: this.appPages?.length,
9467
+ componentsLength: this.components.length,
9468
+ componentsToRenderLength: this.componentsToRender.length
9469
+ });
9459
9470
  if (this.useIsolatedContext) {
9460
9471
  const dataJustProvided = changedProperties.has("appComponents") && this.appComponents || changedProperties.has("appPages") && this.appPages;
9472
+ console.log("[MicroApp DEBUG] Isolated context check", {
9473
+ dataJustProvided,
9474
+ hasAppComponents: !!this.appComponents,
9475
+ hasAppPages: !!this.appPages,
9476
+ hasStoreContext: !!this.storeContext
9477
+ });
9461
9478
  if (dataJustProvided && !this.storeContext) {
9479
+ console.log("[MicroApp DEBUG] Calling initializeIsolatedContext from willUpdate");
9462
9480
  this.initializeIsolatedContext();
9463
9481
  return;
9464
9482
  }
@@ -9474,16 +9492,42 @@ let MicroApp = class extends LitElement {
9474
9492
  * Updates componentsToRender based on the current selection.
9475
9493
  */
9476
9494
  updateComponentsToRender() {
9495
+ console.log("[MicroApp DEBUG] 📝 updateComponentsToRender called", {
9496
+ componentToRenderUUID: this.componentToRenderUUID,
9497
+ componentsLength: this.components.length
9498
+ });
9477
9499
  this.componentsToRender = this.componentToRenderUUID ? this.components.filter((component) => component.uuid === this.componentToRenderUUID) : this.components;
9500
+ console.log("[MicroApp DEBUG] componentsToRender updated", {
9501
+ componentsToRenderLength: this.componentsToRender.length,
9502
+ componentsToRender: this.componentsToRender.map((c) => ({
9503
+ uuid: c.uuid,
9504
+ type: c.component_type
9505
+ }))
9506
+ });
9478
9507
  }
9479
9508
  connectedCallback() {
9480
9509
  super.connectedCallback();
9510
+ console.log("[MicroApp DEBUG] 🔌 connectedCallback called", {
9511
+ uuid: this.uuid,
9512
+ page_uuid: this.page_uuid,
9513
+ useIsolatedContext: this.useIsolatedContext,
9514
+ hasAppComponents: !!this.appComponents,
9515
+ appComponentsLength: this.appComponents?.length,
9516
+ hasAppPages: !!this.appPages,
9517
+ appPagesLength: this.appPages?.length,
9518
+ mode: this.mode,
9519
+ prod: this.prod
9520
+ });
9481
9521
  ToastContainer.getInstance();
9482
9522
  if (this.useIsolatedContext) {
9483
9523
  if (this.appComponents || this.appPages) {
9524
+ console.log("[MicroApp DEBUG] Calling initializeIsolatedContext from connectedCallback (has pre-loaded data)");
9484
9525
  this.initializeIsolatedContext();
9526
+ } else {
9527
+ console.log("[MicroApp DEBUG] Skipping initializeIsolatedContext in connectedCallback (no pre-loaded data yet)");
9485
9528
  }
9486
9529
  } else {
9530
+ console.log("[MicroApp DEBUG] Using legacy mode (useIsolatedContext=false)");
9487
9531
  this.setupSubscriptions();
9488
9532
  if (!ExecuteInstance.Vars.currentPlatform) {
9489
9533
  ExecuteInstance.VarsProxy.currentPlatform = getInitPlatform();
@@ -9605,33 +9649,69 @@ let MicroApp = class extends LitElement {
9605
9649
  */
9606
9650
  async initializeIsolatedContext() {
9607
9651
  try {
9652
+ console.log("[MicroApp DEBUG] 🚀 Starting initializeIsolatedContext", {
9653
+ uuid: this.uuid,
9654
+ page_uuid: this.page_uuid,
9655
+ appComponents: this.appComponents?.length,
9656
+ appPages: this.appPages?.length
9657
+ });
9608
9658
  this.microAppId = `${this.uuid}_${v4()}`;
9659
+ console.log("[MicroApp DEBUG] Generated microAppId:", this.microAppId);
9609
9660
  this.storeContext = new MicroAppStoreContext(
9610
9661
  this.microAppId,
9611
9662
  this.uuid,
9612
9663
  this.appComponents,
9613
9664
  this.appPages
9614
9665
  );
9666
+ console.log("[MicroApp DEBUG] ✅ StoreContext created");
9615
9667
  this.runtimeContext = new MicroAppRuntimeContext(this.storeContext);
9668
+ console.log("[MicroApp DEBUG] ✅ RuntimeContext created");
9616
9669
  this.pageManager = new MicroAppPageManager(this.storeContext);
9617
9670
  this.storeContext.setPageManager(this.pageManager);
9671
+ console.log("[MicroApp DEBUG] ✅ PageManager created");
9618
9672
  this.messageBus = MicroAppMessageBus.getInstance();
9673
+ console.log("[MicroApp DEBUG] ✅ MessageBus obtained");
9619
9674
  this.messageUnsubscribe = this.messageBus.subscribe(this.microAppId, (message) => {
9620
9675
  this.handleMessage(message);
9621
9676
  });
9677
+ console.log("[MicroApp DEBUG] ✅ Subscribed to messages");
9622
9678
  await this.storeContext.loadApplication();
9679
+ const loadedComponents = this.storeContext.getComponents();
9680
+ console.log("[MicroApp DEBUG] ✅ Application data loaded", {
9681
+ componentsCount: loadedComponents.length,
9682
+ components: loadedComponents.map((c) => ({ uuid: c.uuid, type: c.component_type, root: c.root }))
9683
+ });
9623
9684
  await this.pageManager.loadPages();
9685
+ const loadedPages = this.storeContext.getPages();
9686
+ console.log("[MicroApp DEBUG] ✅ Pages loaded", {
9687
+ pagesCount: loadedPages.length,
9688
+ pages: loadedPages.map((p) => ({ uuid: p.uuid, name: p.name }))
9689
+ });
9624
9690
  this.runtimeContext.registerComponents();
9691
+ console.log("[MicroApp DEBUG] ✅ Components registered in runtime");
9625
9692
  const componentsWithChildren = this.storeContext.getComponents();
9626
9693
  $components.setKey(this.uuid, componentsWithChildren);
9694
+ console.log("[MicroApp DEBUG] ✅ Components synced to global store", {
9695
+ key: this.uuid,
9696
+ count: componentsWithChildren.length
9697
+ });
9627
9698
  this.setupIsolatedSubscriptions();
9699
+ console.log("[MicroApp DEBUG] ✅ Subscriptions setup");
9628
9700
  this.refreshIsolatedComponents();
9701
+ console.log("[MicroApp DEBUG] ✅ Components refreshed", {
9702
+ componentsLength: this.components.length,
9703
+ componentsToRenderLength: this.componentsToRender.length,
9704
+ components: this.components.map((c) => ({ uuid: c.uuid, type: c.component_type })),
9705
+ componentsToRender: this.componentsToRender.map((c) => ({ uuid: c.uuid, type: c.component_type }))
9706
+ });
9629
9707
  if (!this.runtimeContext.getVar("currentPlatform")) {
9630
9708
  this.runtimeContext.setVar("currentPlatform", getInitPlatform());
9631
9709
  }
9632
9710
  EditorInstance.setEditorMode(this.prod);
9711
+ console.log("[MicroApp DEBUG] 🎉 initializeIsolatedContext completed successfully");
9633
9712
  } catch (error) {
9634
- console.error(`[MicroApp] Failed to initialize isolated context:`, error);
9713
+ console.error(`[MicroApp DEBUG] Failed to initialize isolated context:`, error);
9714
+ console.error("[MicroApp DEBUG] Error stack:", error instanceof Error ? error.stack : "No stack");
9635
9715
  }
9636
9716
  }
9637
9717
  /**
@@ -9672,10 +9752,38 @@ let MicroApp = class extends LitElement {
9672
9752
  * Refresh components from isolated store
9673
9753
  */
9674
9754
  refreshIsolatedComponents() {
9675
- if (!this.storeContext || !this.pageManager) return;
9755
+ console.log("[MicroApp DEBUG] 🔄 refreshIsolatedComponents called", {
9756
+ hasStoreContext: !!this.storeContext,
9757
+ hasPageManager: !!this.pageManager,
9758
+ page_uuid: this.page_uuid
9759
+ });
9760
+ if (!this.storeContext || !this.pageManager) {
9761
+ console.log("[MicroApp DEBUG] ⚠️ refreshIsolatedComponents early return - missing context");
9762
+ return;
9763
+ }
9676
9764
  const allComponents = this.storeContext.getComponents();
9677
9765
  const currentPage = this.pageManager.getCurrentPage();
9766
+ console.log("[MicroApp DEBUG] Components and page info", {
9767
+ allComponentsCount: allComponents.length,
9768
+ allComponents: allComponents.map((c) => ({
9769
+ uuid: c.uuid,
9770
+ type: c.component_type,
9771
+ root: c.root,
9772
+ pageId: c.pageId
9773
+ })),
9774
+ currentPage: currentPage ? { uuid: currentPage.uuid, name: currentPage.name } : null,
9775
+ page_uuid: this.page_uuid
9776
+ });
9678
9777
  this.components = this.page_uuid ? allComponents.filter((component) => component.pageId === this.page_uuid && component.root === true) : currentPage ? allComponents.filter((component) => component.pageId === currentPage.uuid && component.root === true) : allComponents.filter((component) => component.root === true);
9778
+ console.log("[MicroApp DEBUG] Filtered components", {
9779
+ filterMode: this.page_uuid ? "by page_uuid" : currentPage ? "by currentPage" : "all root",
9780
+ componentsCount: this.components.length,
9781
+ components: this.components.map((c) => ({
9782
+ uuid: c.uuid,
9783
+ type: c.component_type,
9784
+ root: c.root
9785
+ }))
9786
+ });
9679
9787
  this.updateComponentsToRender();
9680
9788
  }
9681
9789
  /**
@@ -9710,10 +9818,30 @@ let MicroApp = class extends LitElement {
9710
9818
  return ExecuteInstance;
9711
9819
  }
9712
9820
  render() {
9713
- if (!this.uuid || !this.componentsToRender.length) return nothing;
9821
+ console.log("[MicroApp DEBUG] 🎨 render() called", {
9822
+ uuid: this.uuid,
9823
+ hasUuid: !!this.uuid,
9824
+ componentsToRenderLength: this.componentsToRender.length,
9825
+ componentsToRender: this.componentsToRender.map((c) => ({
9826
+ uuid: c.uuid,
9827
+ type: c.component_type,
9828
+ root: c.root,
9829
+ pageId: c.pageId
9830
+ })),
9831
+ willReturnNothing: !this.uuid || !this.componentsToRender.length,
9832
+ isPreviewMode: this.isPreviewMode()
9833
+ });
9834
+ if (!this.uuid || !this.componentsToRender.length) {
9835
+ console.log("[MicroApp DEBUG] ⚠️ render() returning nothing because:", {
9836
+ noUuid: !this.uuid,
9837
+ noComponentsToRender: !this.componentsToRender.length
9838
+ });
9839
+ return nothing;
9840
+ }
9841
+ console.log("[MicroApp DEBUG] ✅ render() will render components");
9714
9842
  return html`
9715
- <div
9716
-
9843
+ <div
9844
+
9717
9845
  style=${styleMap({
9718
9846
  "height": "100%"
9719
9847
  })}>
@@ -1,4 +1,4 @@
1
- import { m as i } from "./CodeEditor-G6E8PUI7.js";
1
+ import { m as i } from "./CodeEditor-YsOapSut.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
@@ -1,4 +1,4 @@
1
- import { m } from "./CodeEditor-G6E8PUI7.js";
1
+ import { m } from "./CodeEditor-YsOapSut.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
@@ -1,4 +1,4 @@
1
- import { t as O, m as I } from "./CodeEditor-G6E8PUI7.js";
1
+ import { t as O, m as I } from "./CodeEditor-YsOapSut.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
@@ -1,4 +1,4 @@
1
- import { m as s } from "./CodeEditor-G6E8PUI7.js";
1
+ import { m as s } from "./CodeEditor-YsOapSut.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
@@ -1,4 +1,4 @@
1
- import { m as r } from "./CodeEditor-G6E8PUI7.js";
1
+ import { m as r } from "./CodeEditor-YsOapSut.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
@@ -1,4 +1,4 @@
1
- import { m as l } from "./CodeEditor-G6E8PUI7.js";
1
+ import { m as l } from "./CodeEditor-YsOapSut.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuraly/runtime",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Nuraly Visual App Builder Runtime - State management, handler execution, and component system with bundled micro-app support",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
package/vite.config.ts CHANGED
@@ -5,6 +5,10 @@ import { resolve } from 'path';
5
5
  const isBundleBuild = process.env.BUILD_BUNDLE === 'true';
6
6
 
7
7
  export default defineConfig({
8
+ define: {
9
+ // Replace process.env.NODE_ENV with a static value for browser bundles
10
+ 'process.env.NODE_ENV': JSON.stringify('production')
11
+ },
8
12
  build: {
9
13
  target: 'esnext', // Support top-level await
10
14
  // Don't empty outDir on bundle build to preserve regular build artifacts