@trops/dash-core 0.1.233 → 0.1.235

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.
@@ -29114,9 +29114,14 @@ function extractEventWiring$1(layout) {
29114
29114
  *
29115
29115
  * @param {string[]} componentNames - Widget component names from layout
29116
29116
  * @param {Object} widgetRegistry - WidgetRegistry instance (optional, needs getWidgets())
29117
+ * @param {Object} componentConfigs - Map of component name → .dash.js config (optional, for built-in widgets)
29117
29118
  * @returns {Array} Widget dependency objects for the dashboard config
29118
29119
  */
29119
- function buildWidgetDependencies$1(componentNames, widgetRegistry = null) {
29120
+ function buildWidgetDependencies$1(
29121
+ componentNames,
29122
+ widgetRegistry = null,
29123
+ componentConfigs = null,
29124
+ ) {
29120
29125
  const widgets = [];
29121
29126
  const seen = new Set();
29122
29127
 
@@ -29124,16 +29129,27 @@ function buildWidgetDependencies$1(componentNames, widgetRegistry = null) {
29124
29129
  if (seen.has(name)) continue;
29125
29130
  seen.add(name);
29126
29131
 
29132
+ let scope = "";
29127
29133
  let packageName = "";
29134
+ let widgetName = name;
29128
29135
  let version = "*";
29129
29136
  let author = "";
29130
29137
 
29138
+ // Check if name is already a scoped ID (scope.packageName.widgetName)
29139
+ const parts = name.split(".");
29140
+ if (parts.length === 3) {
29141
+ scope = parts[0];
29142
+ packageName = parts[1];
29143
+ widgetName = parts[2];
29144
+ }
29145
+
29131
29146
  // Try to resolve from widget registry
29132
29147
  if (widgetRegistry) {
29133
29148
  const installedWidgets = widgetRegistry.getWidgets();
29134
29149
  for (const w of installedWidgets) {
29135
29150
  if (w.componentNames && w.componentNames.includes(name)) {
29136
- packageName = w.name || "";
29151
+ if (!scope && w.scope) scope = w.scope;
29152
+ if (!packageName || packageName === name) packageName = w.name || "";
29137
29153
  version = w.version || "*";
29138
29154
  author =
29139
29155
  typeof w.author === "string" ? w.author : w.author?.name || "";
@@ -29142,9 +29158,34 @@ function buildWidgetDependencies$1(componentNames, widgetRegistry = null) {
29142
29158
  }
29143
29159
  }
29144
29160
 
29161
+ // Fallback: resolve from component configs (built-in widgets)
29162
+ if (componentConfigs && componentConfigs[name]) {
29163
+ const config = componentConfigs[name];
29164
+ if (!scope && config.scope) scope = config.scope;
29165
+ if ((!packageName || packageName === name) && config.packageName)
29166
+ packageName = config.packageName;
29167
+ if (config.id && !scope) {
29168
+ const idParts = config.id.split(".");
29169
+ if (idParts.length === 3) {
29170
+ scope = idParts[0];
29171
+ packageName = idParts[1];
29172
+ }
29173
+ }
29174
+ }
29175
+
29176
+ const id =
29177
+ scope && packageName && widgetName
29178
+ ? `${scope}.${packageName}.${widgetName}`
29179
+ : packageName
29180
+ ? `${packageName}.${widgetName}`
29181
+ : widgetName;
29182
+
29145
29183
  widgets.push({
29146
- id: packageName ? `${packageName}.${name}` : name,
29147
- package: packageName || name,
29184
+ id,
29185
+ scope: scope || "",
29186
+ packageName: packageName || widgetName,
29187
+ widgetName,
29188
+ package: packageName || widgetName,
29148
29189
  version,
29149
29190
  required: true,
29150
29191
  author: author || "",
@@ -29268,11 +29309,18 @@ function checkDashboardCompatibility(
29268
29309
  installedWidgets = [],
29269
29310
  registryPackages = [],
29270
29311
  ) {
29312
+ // Build lookup maps using composite keys (scope.packageName.componentName)
29313
+ const installedByKey = new Map();
29271
29314
  const installedByName = new Map();
29272
29315
  for (const w of installedWidgets) {
29273
29316
  if (w.name) {
29274
29317
  installedByName.set(w.name, w);
29275
29318
  }
29319
+ if (w.scope && w.name && w.componentNames) {
29320
+ for (const cn of w.componentNames) {
29321
+ installedByKey.set(`${w.scope}.${w.name}.${cn}`, w);
29322
+ }
29323
+ }
29276
29324
  }
29277
29325
 
29278
29326
  const registryByName = new Map();
@@ -29289,19 +29337,31 @@ function checkDashboardCompatibility(
29289
29337
  let hasUnavailableRequired = false;
29290
29338
 
29291
29339
  for (const dep of dashboardWidgets) {
29292
- const packageName = dep.package;
29340
+ // Build composite key for scoped matching
29341
+ const key =
29342
+ dep.scope && dep.packageName && dep.widgetName
29343
+ ? `${dep.scope}.${dep.packageName}.${dep.widgetName}`
29344
+ : null;
29345
+ const packageName = dep.package || dep.packageName || "";
29293
29346
  const required = dep.required !== false;
29294
- const installed = installedByName.get(packageName);
29347
+
29348
+ // Try composite key first, then fall back to package name
29349
+ const installed = key
29350
+ ? installedByKey.get(key) || installedByName.get(packageName)
29351
+ : installedByName.get(packageName);
29352
+
29353
+ // Use the dep's id or key for the status map
29354
+ const statusKey = dep.id || key || packageName;
29295
29355
 
29296
29356
  if (installed) {
29297
29357
  installedCount++;
29298
- widgets[packageName] = "installed";
29358
+ widgets[statusKey] = "installed";
29299
29359
  } else if (registryByName.has(packageName)) {
29300
29360
  toInstallCount++;
29301
- widgets[packageName] = "available";
29361
+ widgets[statusKey] = "available";
29302
29362
  } else {
29303
29363
  unavailableCount++;
29304
- widgets[packageName] = "unavailable";
29364
+ widgets[statusKey] = "unavailable";
29305
29365
  if (required) {
29306
29366
  hasUnavailableRequired = true;
29307
29367
  }
@@ -29360,6 +29420,9 @@ function generateRegistryManifest(dashboardConfig, options = {}) {
29360
29420
  publishedAt: new Date().toISOString(),
29361
29421
  widgets: (dashboardConfig.widgets || []).map((w) => ({
29362
29422
  id: w.id,
29423
+ scope: w.scope || "",
29424
+ packageName: w.packageName || w.package || "",
29425
+ widgetName: w.widgetName || (w.id ? w.id.split(".").pop() : w.package),
29363
29426
  name: w.id ? w.id.split(".").pop() : w.package,
29364
29427
  package: w.package,
29365
29428
  version: w.version || "*",
@@ -31364,6 +31427,11 @@ var schedulerController_1 = schedulerController$2;
31364
31427
  registeredAt: new Date().toISOString(),
31365
31428
  };
31366
31429
 
31430
+ // Persist scope from manifest/config if available
31431
+ if (config.scope) {
31432
+ widgetEntry.scope = config.scope;
31433
+ }
31434
+
31367
31435
  this.widgets.set(widgetName, widgetEntry);
31368
31436
  this.saveRegistry();
31369
31437
  console.log(`[WidgetRegistry] Registered widget: ${widgetName}`);
@@ -31424,6 +31492,8 @@ var schedulerController_1 = schedulerController$2;
31424
31492
  // has full display data without needing ComponentManager.
31425
31493
  if (result?.config && existingEntry) {
31426
31494
  const cfg = result.config;
31495
+ if (cfg.scope && !existingEntry.scope)
31496
+ existingEntry.scope = cfg.scope;
31427
31497
  if (cfg.icon && !existingEntry.icon) existingEntry.icon = cfg.icon;
31428
31498
  if (cfg.providers?.length && !existingEntry.providers?.length)
31429
31499
  existingEntry.providers = cfg.providers;
@@ -33334,7 +33404,22 @@ async function prepareDashboardForPublish$1(
33334
33404
  // 3. Build the dashboard config (reuse export logic)
33335
33405
  const componentNames = collectComponentNames(layout);
33336
33406
  const eventWiring = extractEventWiring(layout);
33337
- const widgets = buildWidgetDependencies(componentNames, widgetRegistry);
33407
+
33408
+ // Build componentConfigs map from renderer-supplied data
33409
+ // This resolves scope/packageName for built-in widgets that aren't in widgetRegistry
33410
+ let componentConfigs = null;
33411
+ if (options.componentConfigs) {
33412
+ componentConfigs = {};
33413
+ for (const [key, config] of Object.entries(options.componentConfigs)) {
33414
+ componentConfigs[key] = config;
33415
+ }
33416
+ }
33417
+
33418
+ const widgets = buildWidgetDependencies(
33419
+ componentNames,
33420
+ widgetRegistry,
33421
+ componentConfigs,
33422
+ );
33338
33423
  const providers = buildProviderRequirements(componentNames, widgetRegistry);
33339
33424
 
33340
33425
  const dashboardConfig = applyDefaults({