@trops/dash-core 0.1.260 → 0.1.262

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.
@@ -33166,6 +33166,14 @@ async function processDashboardConfig(
33166
33166
  DASHBOARD_CONFIG_INSTALL_PROGRESS,
33167
33167
  } = requireDashboardConfigEvents();
33168
33168
 
33169
+ // Compute total progress items (widgets + optional theme)
33170
+ const hasTheme = !!(dashboardConfig.theme && dashboardConfig.theme.key);
33171
+ const widgetTotal = dashboardConfig.widgets
33172
+ ? dashboardConfig.widgets.length
33173
+ : 0;
33174
+ const themeIndex = widgetTotal;
33175
+ const progressTotal = widgetTotal + (hasTheme ? 1 : 0);
33176
+
33169
33177
  if (
33170
33178
  widgetRegistry &&
33171
33179
  dashboardConfig.widgets &&
@@ -33173,21 +33181,38 @@ async function processDashboardConfig(
33173
33181
  ) {
33174
33182
  const installedWidgets = widgetRegistry.getWidgets();
33175
33183
  const installedPackages = new Set(installedWidgets.map((w) => w.name));
33176
- const total = dashboardConfig.widgets.length;
33177
33184
 
33178
33185
  // Emit initial "pending" state for all widgets
33179
- for (let i = 0; i < total; i++) {
33186
+ for (let i = 0; i < widgetTotal; i++) {
33180
33187
  const dep = dashboardConfig.widgets[i];
33181
33188
  win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33182
33189
  packageName: dep.package,
33183
33190
  displayName: dep.displayName || dep.name || dep.package,
33184
33191
  status: "pending",
33185
33192
  index: i,
33186
- total,
33193
+ total: progressTotal,
33187
33194
  });
33188
33195
  }
33189
33196
 
33190
- for (let i = 0; i < total; i++) {
33197
+ // Emit initial "pending" state for theme (if present)
33198
+ if (hasTheme) {
33199
+ const themeDisplay =
33200
+ dashboardConfig.theme.name ||
33201
+ dashboardConfig.theme.key ||
33202
+ "Bundled Theme";
33203
+ win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33204
+ packageName:
33205
+ dashboardConfig.theme.registryPackage ||
33206
+ dashboardConfig.theme.key ||
33207
+ "theme",
33208
+ displayName: themeDisplay,
33209
+ status: "pending",
33210
+ index: themeIndex,
33211
+ total: progressTotal,
33212
+ });
33213
+ }
33214
+
33215
+ for (let i = 0; i < widgetTotal; i++) {
33191
33216
  const widgetDep = dashboardConfig.widgets[i];
33192
33217
  const packageName = widgetDep.package;
33193
33218
  const displayName =
@@ -33200,7 +33225,7 @@ async function processDashboardConfig(
33200
33225
  displayName,
33201
33226
  status: "already-installed",
33202
33227
  index: i,
33203
- total,
33228
+ total: progressTotal,
33204
33229
  });
33205
33230
  continue;
33206
33231
  }
@@ -33211,7 +33236,7 @@ async function processDashboardConfig(
33211
33236
  displayName,
33212
33237
  status: "downloading",
33213
33238
  index: i,
33214
- total,
33239
+ total: progressTotal,
33215
33240
  });
33216
33241
 
33217
33242
  // Try to find the widget in the registry and install it
@@ -33230,7 +33255,7 @@ async function processDashboardConfig(
33230
33255
  displayName,
33231
33256
  status: "installed",
33232
33257
  index: i,
33233
- total,
33258
+ total: progressTotal,
33234
33259
  });
33235
33260
  } else {
33236
33261
  installSummary.failed.push({
@@ -33242,7 +33267,7 @@ async function processDashboardConfig(
33242
33267
  displayName,
33243
33268
  status: "failed",
33244
33269
  index: i,
33245
- total,
33270
+ total: progressTotal,
33246
33271
  error: "Not found in registry",
33247
33272
  });
33248
33273
  }
@@ -33256,7 +33281,7 @@ async function processDashboardConfig(
33256
33281
  displayName,
33257
33282
  status: "failed",
33258
33283
  index: i,
33259
- total,
33284
+ total: progressTotal,
33260
33285
  error: installError.message,
33261
33286
  });
33262
33287
  }
@@ -33285,6 +33310,11 @@ async function processDashboardConfig(
33285
33310
  let themeInstalled = null;
33286
33311
  if (dashboardConfig.theme) {
33287
33312
  const bundledTheme = dashboardConfig.theme;
33313
+ const themeDisplay =
33314
+ bundledTheme.name || bundledTheme.key || "Bundled Theme";
33315
+ const themePackageName =
33316
+ bundledTheme.registryPackage || bundledTheme.key || "theme";
33317
+
33288
33318
  try {
33289
33319
  const themeResult = themeController$3.listThemesForApplication(win, appId);
33290
33320
  const existingThemes = themeResult.themes || {};
@@ -33293,6 +33323,14 @@ async function processDashboardConfig(
33293
33323
  if (themeKey) {
33294
33324
  if (bundledTheme.data && !existingThemes[themeKey]) {
33295
33325
  // Theme is new — install it
33326
+ win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33327
+ packageName: themePackageName,
33328
+ displayName: themeDisplay,
33329
+ status: "downloading",
33330
+ index: themeIndex,
33331
+ total: progressTotal,
33332
+ });
33333
+
33296
33334
  const themeData = { ...bundledTheme.data };
33297
33335
  if (bundledTheme.registryPackage) {
33298
33336
  themeData._registryMeta = {
@@ -33311,10 +33349,25 @@ async function processDashboardConfig(
33311
33349
  console.warn(
33312
33350
  `[DashboardConfigController] Theme save failed: ${saveResult.message}`,
33313
33351
  );
33352
+ win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33353
+ packageName: themePackageName,
33354
+ displayName: themeDisplay,
33355
+ status: "failed",
33356
+ index: themeIndex,
33357
+ total: progressTotal,
33358
+ error: saveResult.message,
33359
+ });
33314
33360
  } else {
33315
33361
  console.log(
33316
33362
  `[DashboardConfigController] Installed bundled theme: ${themeKey}`,
33317
33363
  );
33364
+ win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33365
+ packageName: themePackageName,
33366
+ displayName: themeDisplay,
33367
+ status: "installed",
33368
+ index: themeIndex,
33369
+ total: progressTotal,
33370
+ });
33318
33371
  }
33319
33372
  } else if (
33320
33373
  !bundledTheme.data &&
@@ -33322,6 +33375,14 @@ async function processDashboardConfig(
33322
33375
  !existingThemes[themeKey]
33323
33376
  ) {
33324
33377
  // Fallback: try to install from registry by package name
33378
+ win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33379
+ packageName: themePackageName,
33380
+ displayName: themeDisplay,
33381
+ status: "downloading",
33382
+ index: themeIndex,
33383
+ total: progressTotal,
33384
+ });
33385
+
33325
33386
  try {
33326
33387
  const {
33327
33388
  installThemeFromRegistry,
@@ -33334,15 +33395,37 @@ async function processDashboardConfig(
33334
33395
  console.log(
33335
33396
  `[DashboardConfigController] Installed theme from registry: ${bundledTheme.registryPackage}`,
33336
33397
  );
33398
+ win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33399
+ packageName: themePackageName,
33400
+ displayName: themeDisplay,
33401
+ status: "installed",
33402
+ index: themeIndex,
33403
+ total: progressTotal,
33404
+ });
33337
33405
  } catch (registryErr) {
33338
33406
  console.warn(
33339
33407
  `[DashboardConfigController] Could not install theme from registry: ${registryErr.message}`,
33340
33408
  );
33409
+ win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33410
+ packageName: themePackageName,
33411
+ displayName: themeDisplay,
33412
+ status: "failed",
33413
+ index: themeIndex,
33414
+ total: progressTotal,
33415
+ error: registryErr.message,
33416
+ });
33341
33417
  }
33342
33418
  } else if (existingThemes[themeKey]) {
33343
33419
  console.log(
33344
33420
  `[DashboardConfigController] Theme already exists: ${themeKey}`,
33345
33421
  );
33422
+ win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33423
+ packageName: themePackageName,
33424
+ displayName: themeDisplay,
33425
+ status: "already-installed",
33426
+ index: themeIndex,
33427
+ total: progressTotal,
33428
+ });
33346
33429
  }
33347
33430
  // Always bind workspace to theme key
33348
33431
  themeInstalled = themeKey;
@@ -33351,6 +33434,14 @@ async function processDashboardConfig(
33351
33434
  console.warn(
33352
33435
  `[DashboardConfigController] Could not install bundled theme: ${themeErr.message}`,
33353
33436
  );
33437
+ win.webContents.send(DASHBOARD_CONFIG_INSTALL_PROGRESS, {
33438
+ packageName: themePackageName,
33439
+ displayName: themeDisplay,
33440
+ status: "failed",
33441
+ index: themeIndex,
33442
+ total: progressTotal,
33443
+ error: themeErr.message,
33444
+ });
33354
33445
  }
33355
33446
  }
33356
33447
 
@@ -33617,6 +33708,18 @@ async function installDashboardFromRegistry$1(
33617
33708
 
33618
33709
  dashboardConfig = applyDefaults(dashboardConfig);
33619
33710
 
33711
+ // 5b. Inject theme metadata from registry if config has no theme section
33712
+ if (
33713
+ !dashboardConfig.theme &&
33714
+ registryPkg.theme &&
33715
+ registryPkg.theme.registryPackage
33716
+ ) {
33717
+ dashboardConfig.theme = {
33718
+ key: registryPkg.theme.key || registryPkg.theme.name,
33719
+ registryPackage: registryPkg.theme.registryPackage,
33720
+ };
33721
+ }
33722
+
33620
33723
  // 6. Delegate to shared import pipeline
33621
33724
  return await processDashboardConfig(
33622
33725
  win,