@trops/dash-core 0.1.364 → 0.1.365

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.
@@ -471,6 +471,7 @@ const REGISTRY_CHECK_UPDATES = "registry:check-updates";
471
471
  const REGISTRY_SEARCH_DASHBOARDS = "registry:search-dashboards";
472
472
  const REGISTRY_SEARCH_THEMES = "registry:search-themes";
473
473
  const REGISTRY_PUBLISH_WIDGET = "registry:publish-widget";
474
+ const REGISTRY_INSPECT_WIDGET_PACKAGE = "registry:inspect-widget-package";
474
475
 
475
476
  var registryEvents$1 = {
476
477
  REGISTRY_FETCH_INDEX,
@@ -480,6 +481,7 @@ var registryEvents$1 = {
480
481
  REGISTRY_SEARCH_DASHBOARDS,
481
482
  REGISTRY_SEARCH_THEMES,
482
483
  REGISTRY_PUBLISH_WIDGET,
484
+ REGISTRY_INSPECT_WIDGET_PACKAGE,
483
485
  };
484
486
 
485
487
  /**
@@ -72091,8 +72093,67 @@ async function prepareWidgetForPublish$1(appId, packageId, options = {}) {
72091
72093
  }
72092
72094
  }
72093
72095
 
72096
+ /**
72097
+ * Inspect a locally-installed widget package and return a summary of
72098
+ * metadata the publish UI can display — package.json fields, the
72099
+ * caller's scope, and the list of component widgets the package exposes.
72100
+ *
72101
+ * @param {string} packageId - Widget packageId (e.g. "@scope/name")
72102
+ * @returns {Promise<Object>} { success, packageId, scope, name, version, displayName, description, components: [...] }
72103
+ */
72104
+ async function inspectWidgetPackage$1(packageId) {
72105
+ try {
72106
+ const registry = widgetRegistryModule.getWidgetRegistry();
72107
+ const widget = registry.getWidget(packageId);
72108
+ if (!widget || !widget.path) {
72109
+ return {
72110
+ success: false,
72111
+ error: `Widget package not found locally: ${packageId}`,
72112
+ };
72113
+ }
72114
+
72115
+ let pkgJson = {};
72116
+ const pkgJsonPath = path.join(widget.path, "package.json");
72117
+ if (fs.existsSync(pkgJsonPath)) {
72118
+ try {
72119
+ pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
72120
+ } catch {
72121
+ /* ignore */
72122
+ }
72123
+ }
72124
+ const parsed = parsePackageName(pkgJson.name || packageId);
72125
+
72126
+ let widgetConfigs = widget.widgets || [];
72127
+ if (!widgetConfigs.length) {
72128
+ widgetConfigs = await scanWidgetConfigs(widget.path);
72129
+ }
72130
+
72131
+ const components = widgetConfigs.map((cfg) => ({
72132
+ name: cfg.component || cfg.name,
72133
+ displayName: cfg.name || cfg.component,
72134
+ description: cfg.description || "",
72135
+ icon: cfg.icon || "square",
72136
+ }));
72137
+
72138
+ return {
72139
+ success: true,
72140
+ packageId,
72141
+ localScope: parsed.scope || widget.scope || null,
72142
+ name: parsed.name,
72143
+ version: pkgJson.version || widget.version || null,
72144
+ displayName: pkgJson.displayName || widget.displayName || parsed.name,
72145
+ description: pkgJson.description || widget.description || "",
72146
+ path: widget.path,
72147
+ components,
72148
+ };
72149
+ } catch (err) {
72150
+ return { success: false, error: err.message };
72151
+ }
72152
+ }
72153
+
72094
72154
  var widgetRegistryController = {
72095
72155
  prepareWidgetForPublish: prepareWidgetForPublish$1,
72156
+ inspectWidgetPackage: inspectWidgetPackage$1,
72096
72157
  };
72097
72158
 
72098
72159
  /**
@@ -72205,7 +72266,10 @@ const {
72205
72266
  installThemeFromRegistry,
72206
72267
  getThemePublishPreview,
72207
72268
  } = themeRegistryController$1;
72208
- const { prepareWidgetForPublish } = widgetRegistryController;
72269
+ const {
72270
+ prepareWidgetForPublish,
72271
+ inspectWidgetPackage,
72272
+ } = widgetRegistryController;
72209
72273
  const {
72210
72274
  assignRoles,
72211
72275
  matchTailwindFamily,
@@ -72294,6 +72358,7 @@ var controller = {
72294
72358
  installThemeFromRegistry,
72295
72359
  getThemePublishPreview,
72296
72360
  prepareWidgetForPublish,
72361
+ inspectWidgetPackage,
72297
72362
  assignRoles,
72298
72363
  matchTailwindFamily,
72299
72364
  generateThemeFromPalette,
@@ -73418,6 +73483,25 @@ const registryApi$2 = {
73418
73483
  throw error;
73419
73484
  }
73420
73485
  },
73486
+
73487
+ /**
73488
+ * Inspect a locally-installed widget package and return its metadata
73489
+ * + list of component widgets. Used by the publish modal to show
73490
+ * "what's getting published" before the user hits Publish.
73491
+ *
73492
+ * @param {string} packageId - Widget packageId (e.g. "@scope/name")
73493
+ * @returns {Promise<Object>} { success, packageId, localScope, name, version, displayName, description, components: [{name, displayName, description, icon}] }
73494
+ */
73495
+ inspectWidgetPackage: async (packageId) => {
73496
+ try {
73497
+ return await ipcRenderer$h.invoke("registry:inspect-widget-package", {
73498
+ packageId,
73499
+ });
73500
+ } catch (error) {
73501
+ console.error("[RegistryApi] Error inspecting package:", error);
73502
+ throw error;
73503
+ }
73504
+ },
73421
73505
  };
73422
73506
 
73423
73507
  var registryApi_1 = registryApi$2;