@trops/dash-core 0.1.365 → 0.1.367

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.
@@ -63033,10 +63033,36 @@ function collectComponentNamesFromWorkspace$1(workspace) {
63033
63033
  return Array.from(names);
63034
63034
  }
63035
63035
 
63036
+ /**
63037
+ * Extract event wiring across a workspace's main layout, every page
63038
+ * layout, and the sidebar layout. Mirrors collectComponentNamesFromWorkspace
63039
+ * — the single-layout `extractEventWiring` misses widgets on non-active
63040
+ * pages or in the sidebar.
63041
+ *
63042
+ * @param {Object} workspace - Workspace object
63043
+ * @returns {Array} Event wiring array
63044
+ */
63045
+ function extractEventWiringFromWorkspace$1(workspace) {
63046
+ const wiring = [];
63047
+ const pushAll = (layout) => {
63048
+ if (!Array.isArray(layout)) return;
63049
+ for (const entry of extractEventWiring$1(layout)) wiring.push(entry);
63050
+ };
63051
+
63052
+ pushAll(workspace?.layout);
63053
+ pushAll(workspace?.sidebarLayout);
63054
+ if (Array.isArray(workspace?.pages)) {
63055
+ for (const page of workspace.pages) pushAll(page?.layout);
63056
+ }
63057
+
63058
+ return wiring;
63059
+ }
63060
+
63036
63061
  var dashboardConfigUtils$1 = {
63037
63062
  collectComponentNames: collectComponentNames$1,
63038
63063
  collectComponentNamesFromWorkspace: collectComponentNamesFromWorkspace$1,
63039
63064
  extractEventWiring: extractEventWiring$1,
63065
+ extractEventWiringFromWorkspace: extractEventWiringFromWorkspace$1,
63040
63066
  buildWidgetDependencies: buildWidgetDependencies$1,
63041
63067
  buildProviderRequirements: buildProviderRequirements$1,
63042
63068
  applyEventWiringToLayout: applyEventWiringToLayout$1,
@@ -63787,6 +63813,7 @@ const {
63787
63813
  collectComponentNames,
63788
63814
  collectComponentNamesFromWorkspace,
63789
63815
  extractEventWiring,
63816
+ extractEventWiringFromWorkspace,
63790
63817
  buildWidgetDependencies,
63791
63818
  buildProviderRequirements,
63792
63819
  applyEventWiringToLayout,
@@ -63839,9 +63866,11 @@ async function exportDashboardConfig$1(
63839
63866
 
63840
63867
  const layout = workspace.layout || [];
63841
63868
 
63842
- // 2. Collect components, extract wiring, resolve deps
63843
- const componentNames = collectComponentNames(layout);
63844
- const eventWiring = extractEventWiring(layout);
63869
+ // 2. Collect components, extract wiring, resolve deps — walk main
63870
+ // layout, every page, and the sidebar so multi-page / sidebar
63871
+ // dashboards export the full picture.
63872
+ const componentNames = collectComponentNamesFromWorkspace(workspace);
63873
+ const eventWiring = extractEventWiringFromWorkspace(workspace);
63845
63874
  const widgets = buildWidgetDependencies(componentNames, widgetRegistry);
63846
63875
  const providers = buildProviderRequirements(componentNames, widgetRegistry);
63847
63876
 
@@ -63863,6 +63892,16 @@ async function exportDashboardConfig$1(
63863
63892
  label: workspace.label || workspace.name,
63864
63893
  version: workspace.version || 1,
63865
63894
  layout,
63895
+ ...(Array.isArray(workspace.pages) && workspace.pages.length > 0
63896
+ ? { pages: workspace.pages, activePageId: workspace.activePageId }
63897
+ : {}),
63898
+ ...(Array.isArray(workspace.sidebarLayout) &&
63899
+ workspace.sidebarLayout.length > 0
63900
+ ? {
63901
+ sidebarLayout: workspace.sidebarLayout,
63902
+ sidebarEnabled: workspace.sidebarEnabled !== false,
63903
+ }
63904
+ : {}),
63866
63905
  menuId: workspace.menuId || 1,
63867
63906
  },
63868
63907
  widgets,
@@ -64949,11 +64988,16 @@ async function getDashboardPublishPlan$1(
64949
64988
  return { success: false, error: deps.error };
64950
64989
  }
64951
64990
 
64991
+ // Dedupe by scope/name — many components can share the same package,
64992
+ // and there's no point sending duplicate refs to the registry.
64952
64993
  const refs = [];
64994
+ const seenRefs = new Set();
64953
64995
  for (const w of deps.widgets) {
64954
- if (w.scope && w.packageName) {
64955
- refs.push({ scope: w.scope, name: w.packageName });
64956
- }
64996
+ if (!w.scope || !w.packageName) continue;
64997
+ const key = `${w.scope}/${w.packageName}`;
64998
+ if (seenRefs.has(key)) continue;
64999
+ seenRefs.add(key);
65000
+ refs.push({ scope: w.scope, name: w.packageName });
64957
65001
  }
64958
65002
  if (deps.theme && deps.theme.scope && deps.theme.name) {
64959
65003
  refs.push({ scope: deps.theme.scope, name: deps.theme.name });
@@ -65072,9 +65116,9 @@ async function prepareDashboardForPublish$1(
65072
65116
 
65073
65117
  const layout = workspace.layout || [];
65074
65118
 
65075
- // 3. Build the dashboard config (reuse export logic)
65076
- const componentNames = collectComponentNames(layout);
65077
- const eventWiring = extractEventWiring(layout);
65119
+ // 3. Build the dashboard config walk main + pages + sidebar
65120
+ const componentNames = collectComponentNamesFromWorkspace(workspace);
65121
+ const eventWiring = extractEventWiringFromWorkspace(workspace);
65078
65122
 
65079
65123
  // Build componentConfigs map from renderer-supplied data
65080
65124
  // This resolves scope/packageName for built-in widgets that aren't in widgetRegistry
@@ -65110,6 +65154,16 @@ async function prepareDashboardForPublish$1(
65110
65154
  label: workspace.label || workspace.name,
65111
65155
  version: workspace.version || 1,
65112
65156
  layout,
65157
+ ...(Array.isArray(workspace.pages) && workspace.pages.length > 0
65158
+ ? { pages: workspace.pages, activePageId: workspace.activePageId }
65159
+ : {}),
65160
+ ...(Array.isArray(workspace.sidebarLayout) &&
65161
+ workspace.sidebarLayout.length > 0
65162
+ ? {
65163
+ sidebarLayout: workspace.sidebarLayout,
65164
+ sidebarEnabled: workspace.sidebarEnabled !== false,
65165
+ }
65166
+ : {}),
65113
65167
  menuId: workspace.menuId || 1,
65114
65168
  },
65115
65169
  widgets,
@@ -65446,8 +65500,7 @@ function getDashboardPublishPreview$1(appId, workspaceId, widgetRegistry = null)
65446
65500
  return { success: false, error: `Workspace not found: ${workspaceId}` };
65447
65501
  }
65448
65502
 
65449
- const layout = workspace.layout || [];
65450
- const componentNames = collectComponentNames(layout);
65503
+ const componentNames = collectComponentNamesFromWorkspace(workspace);
65451
65504
  const widgets = buildWidgetDependencies(componentNames, widgetRegistry);
65452
65505
 
65453
65506
  return {