@trops/dash-core 0.1.89 → 0.1.90

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.
@@ -591,6 +591,7 @@ const DASHBOARD_CONFIG_IMPORT$1 = "dashboard-config-import";
591
591
  const DASHBOARD_CONFIG_INSTALL$1 = "dashboard-config-install";
592
592
  const DASHBOARD_CONFIG_COMPATIBILITY$1 = "dashboard-config-compatibility";
593
593
  const DASHBOARD_CONFIG_PUBLISH$1 = "dashboard-config-publish";
594
+ const DASHBOARD_CONFIG_PREVIEW$1 = "dashboard-config-preview";
594
595
 
595
596
  var dashboardConfigEvents$1 = {
596
597
  DASHBOARD_CONFIG_EXPORT: DASHBOARD_CONFIG_EXPORT$1,
@@ -598,6 +599,7 @@ var dashboardConfigEvents$1 = {
598
599
  DASHBOARD_CONFIG_INSTALL: DASHBOARD_CONFIG_INSTALL$1,
599
600
  DASHBOARD_CONFIG_COMPATIBILITY: DASHBOARD_CONFIG_COMPATIBILITY$1,
600
601
  DASHBOARD_CONFIG_PUBLISH: DASHBOARD_CONFIG_PUBLISH$1,
602
+ DASHBOARD_CONFIG_PREVIEW: DASHBOARD_CONFIG_PREVIEW$1,
601
603
  };
602
604
 
603
605
  /**
@@ -8497,6 +8499,58 @@ function generateRegistryManifest(dashboardConfig, options = {}) {
8497
8499
  return manifest;
8498
8500
  }
8499
8501
 
8502
+ /**
8503
+ * Build a structured preview object from a dashboard registry package
8504
+ * or dashboard config. Provides all data needed for a rich preview UI.
8505
+ *
8506
+ * @param {Object} source - Registry package manifest or dashboard config
8507
+ * @returns {Object} Structured preview with metadata, widgets, wiring, providers
8508
+ */
8509
+ function buildDashboardPreview(source) {
8510
+ const preview = {
8511
+ name: source.displayName || source.name || "Dashboard",
8512
+ description: source.description || "",
8513
+ author: typeof source.author === "object"
8514
+ ? source.author.name || ""
8515
+ : source.author || "",
8516
+ authorId: typeof source.author === "object"
8517
+ ? source.author.id || ""
8518
+ : "",
8519
+ version: source.version || "",
8520
+ icon: source.icon || "grip",
8521
+ tags: source.tags || [],
8522
+ screenshots: source.screenshots || [],
8523
+ publishedAt: source.publishedAt || null,
8524
+ category: source.category || "general",
8525
+ widgets: (source.widgets || []).map((w) => ({
8526
+ name: w.name || w.id || w.package || "",
8527
+ package: w.package || "",
8528
+ version: w.version || "*",
8529
+ required: w.required !== false,
8530
+ author: w.author || "",
8531
+ })),
8532
+ eventWiring: (source.eventWiring || []).map((wire) => ({
8533
+ raw: wire,
8534
+ summary: `${wire.source?.widget || "?"}.${wire.source?.event || "?"} → ${wire.target?.widget || "?"}.${wire.target?.handler || wire.source?.event || "?"}`,
8535
+ })),
8536
+ providers: (source.providers || []).map((p) => ({
8537
+ type: p.type || "",
8538
+ providerClass: p.providerClass || "",
8539
+ required: p.required !== false,
8540
+ usedBy: p.usedBy || [],
8541
+ })),
8542
+ summary: {
8543
+ widgetCount: (source.widgets || []).length,
8544
+ eventCount: (source.eventWiring || []).length,
8545
+ providerCount: (source.providers || []).length,
8546
+ requiredWidgets: (source.widgets || []).filter((w) => w.required !== false).length,
8547
+ optionalWidgets: (source.widgets || []).filter((w) => w.required === false).length,
8548
+ },
8549
+ };
8550
+
8551
+ return preview;
8552
+ }
8553
+
8500
8554
  var dashboardConfigUtils$1 = {
8501
8555
  collectComponentNames: collectComponentNames$1,
8502
8556
  extractEventWiring: extractEventWiring$1,
@@ -8505,6 +8559,7 @@ var dashboardConfigUtils$1 = {
8505
8559
  applyEventWiringToLayout: applyEventWiringToLayout$1,
8506
8560
  checkDashboardCompatibility,
8507
8561
  generateRegistryManifest,
8562
+ buildDashboardPreview,
8508
8563
  };
8509
8564
 
8510
8565
  var widgetRegistry$1 = {exports: {}};
@@ -10625,12 +10680,59 @@ async function prepareDashboardForPublish$1(
10625
10680
  }
10626
10681
  }
10627
10682
 
10683
+ /**
10684
+ * Get a full preview of a dashboard package from the registry.
10685
+ * Combines the structured preview data with a compatibility check.
10686
+ *
10687
+ * @param {string} packageName - Registry package name
10688
+ * @param {Object} widgetRegistry - WidgetRegistry instance
10689
+ * @returns {Promise<Object>} Preview data with compatibility report
10690
+ */
10691
+ async function getDashboardPreview$1(packageName, widgetRegistry = null) {
10692
+ const { buildDashboardPreview, checkDashboardCompatibility } =
10693
+ dashboardConfigUtils$1;
10694
+ const { getPackage, fetchRegistryIndex } = registryController$1;
10695
+
10696
+ const pkg = await getPackage(packageName);
10697
+ if (!pkg) {
10698
+ return {
10699
+ success: false,
10700
+ error: `Dashboard package not found: ${packageName}`,
10701
+ };
10702
+ }
10703
+
10704
+ const preview = buildDashboardPreview(pkg);
10705
+
10706
+ // Get compatibility report
10707
+ const installedWidgets = widgetRegistry ? widgetRegistry.getWidgets() : [];
10708
+ let registryPackages = [];
10709
+ try {
10710
+ const index = await fetchRegistryIndex();
10711
+ registryPackages = index.packages || [];
10712
+ } catch (err) {
10713
+ // Non-fatal — preview still works without compatibility
10714
+ }
10715
+
10716
+ const compatibility = checkDashboardCompatibility(
10717
+ pkg.widgets || [],
10718
+ installedWidgets,
10719
+ registryPackages,
10720
+ );
10721
+
10722
+ return {
10723
+ success: true,
10724
+ preview,
10725
+ compatibility,
10726
+ };
10727
+ }
10728
+
10628
10729
  var dashboardConfigController$1 = {
10629
10730
  exportDashboardConfig: exportDashboardConfig$1,
10630
10731
  importDashboardConfig: importDashboardConfig$1,
10631
10732
  installDashboardFromRegistry: installDashboardFromRegistry$1,
10632
10733
  checkCompatibility: checkCompatibility$1,
10633
10734
  prepareDashboardForPublish: prepareDashboardForPublish$1,
10735
+ getDashboardPreview: getDashboardPreview$1,
10634
10736
  };
10635
10737
 
10636
10738
  /**
@@ -10725,6 +10827,7 @@ const {
10725
10827
  installDashboardFromRegistry,
10726
10828
  checkCompatibility,
10727
10829
  prepareDashboardForPublish,
10830
+ getDashboardPreview,
10728
10831
  } = dashboardConfigController$1;
10729
10832
 
10730
10833
  var controller = {
@@ -10773,6 +10876,7 @@ var controller = {
10773
10876
  installDashboardFromRegistry,
10774
10877
  checkCompatibility,
10775
10878
  prepareDashboardForPublish,
10879
+ getDashboardPreview,
10776
10880
  };
10777
10881
 
10778
10882
  const { ipcRenderer: ipcRenderer$i } = require$$0$1;
@@ -12154,6 +12258,7 @@ const {
12154
12258
  DASHBOARD_CONFIG_INSTALL,
12155
12259
  DASHBOARD_CONFIG_COMPATIBILITY,
12156
12260
  DASHBOARD_CONFIG_PUBLISH,
12261
+ DASHBOARD_CONFIG_PREVIEW,
12157
12262
  } = events$8;
12158
12263
 
12159
12264
  const dashboardConfigApi$2 = {
@@ -12227,6 +12332,16 @@ const dashboardConfigApi$2 = {
12227
12332
  workspaceId,
12228
12333
  options,
12229
12334
  }),
12335
+
12336
+ /**
12337
+ * Get a preview of a dashboard package from the registry.
12338
+ * Returns structured preview data and compatibility report.
12339
+ *
12340
+ * @param {string} packageName - Registry package name
12341
+ * @returns {Promise<Object>} Preview with metadata, widgets, wiring, compatibility
12342
+ */
12343
+ getDashboardPreview: (packageName) =>
12344
+ ipcRenderer$1.invoke(DASHBOARD_CONFIG_PREVIEW, { packageName }),
12230
12345
  };
12231
12346
 
12232
12347
  var dashboardConfigApi_1 = dashboardConfigApi$2;