@trops/dash-core 0.1.259 → 0.1.261
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.
- package/dist/electron/index.js +162 -48
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +32 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +32 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -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 <
|
|
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
|
-
|
|
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,61 +33310,138 @@ 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 || {};
|
|
33291
33321
|
const themeKey = bundledTheme.key;
|
|
33292
33322
|
|
|
33293
|
-
if (
|
|
33294
|
-
|
|
33295
|
-
|
|
33296
|
-
|
|
33297
|
-
|
|
33298
|
-
|
|
33299
|
-
|
|
33300
|
-
|
|
33301
|
-
|
|
33302
|
-
|
|
33303
|
-
|
|
33304
|
-
|
|
33305
|
-
|
|
33306
|
-
|
|
33307
|
-
|
|
33308
|
-
|
|
33309
|
-
|
|
33310
|
-
|
|
33311
|
-
|
|
33312
|
-
|
|
33313
|
-
} else if (
|
|
33314
|
-
!bundledTheme.data &&
|
|
33315
|
-
bundledTheme.registryPackage &&
|
|
33316
|
-
themeKey &&
|
|
33317
|
-
!existingThemes[themeKey]
|
|
33318
|
-
) {
|
|
33319
|
-
// Fallback: try to install from registry by package name
|
|
33320
|
-
try {
|
|
33321
|
-
const {
|
|
33322
|
-
installThemeFromRegistry,
|
|
33323
|
-
} = themeRegistryController$1;
|
|
33324
|
-
await installThemeFromRegistry(
|
|
33323
|
+
if (themeKey) {
|
|
33324
|
+
if (bundledTheme.data && !existingThemes[themeKey]) {
|
|
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
|
+
|
|
33334
|
+
const themeData = { ...bundledTheme.data };
|
|
33335
|
+
if (bundledTheme.registryPackage) {
|
|
33336
|
+
themeData._registryMeta = {
|
|
33337
|
+
source: "dashboard-import",
|
|
33338
|
+
packageName: bundledTheme.registryPackage,
|
|
33339
|
+
installedAt: new Date().toISOString(),
|
|
33340
|
+
};
|
|
33341
|
+
}
|
|
33342
|
+
const saveResult = themeController$3.saveThemeForApplication(
|
|
33325
33343
|
win,
|
|
33326
33344
|
appId,
|
|
33327
|
-
|
|
33345
|
+
themeKey,
|
|
33346
|
+
themeData,
|
|
33328
33347
|
);
|
|
33329
|
-
|
|
33348
|
+
if (saveResult.error) {
|
|
33349
|
+
console.warn(
|
|
33350
|
+
`[DashboardConfigController] Theme save failed: ${saveResult.message}`,
|
|
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
|
+
});
|
|
33360
|
+
} else {
|
|
33361
|
+
console.log(
|
|
33362
|
+
`[DashboardConfigController] Installed bundled theme: ${themeKey}`,
|
|
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
|
+
});
|
|
33371
|
+
}
|
|
33372
|
+
} else if (
|
|
33373
|
+
!bundledTheme.data &&
|
|
33374
|
+
bundledTheme.registryPackage &&
|
|
33375
|
+
!existingThemes[themeKey]
|
|
33376
|
+
) {
|
|
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
|
+
|
|
33386
|
+
try {
|
|
33387
|
+
const {
|
|
33388
|
+
installThemeFromRegistry,
|
|
33389
|
+
} = themeRegistryController$1;
|
|
33390
|
+
await installThemeFromRegistry(
|
|
33391
|
+
win,
|
|
33392
|
+
appId,
|
|
33393
|
+
bundledTheme.registryPackage,
|
|
33394
|
+
);
|
|
33395
|
+
console.log(
|
|
33396
|
+
`[DashboardConfigController] Installed theme from registry: ${bundledTheme.registryPackage}`,
|
|
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
|
+
});
|
|
33405
|
+
} catch (registryErr) {
|
|
33406
|
+
console.warn(
|
|
33407
|
+
`[DashboardConfigController] Could not install theme from registry: ${registryErr.message}`,
|
|
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
|
+
});
|
|
33417
|
+
}
|
|
33418
|
+
} else if (existingThemes[themeKey]) {
|
|
33330
33419
|
console.log(
|
|
33331
|
-
`[DashboardConfigController]
|
|
33332
|
-
);
|
|
33333
|
-
} catch (registryErr) {
|
|
33334
|
-
console.warn(
|
|
33335
|
-
`[DashboardConfigController] Could not install theme from registry: ${registryErr.message}`,
|
|
33420
|
+
`[DashboardConfigController] Theme already exists: ${themeKey}`,
|
|
33336
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
|
+
});
|
|
33337
33429
|
}
|
|
33430
|
+
// Always bind workspace to theme key
|
|
33431
|
+
themeInstalled = themeKey;
|
|
33338
33432
|
}
|
|
33339
33433
|
} catch (themeErr) {
|
|
33340
33434
|
console.warn(
|
|
33341
33435
|
`[DashboardConfigController] Could not install bundled theme: ${themeErr.message}`,
|
|
33342
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
|
+
});
|
|
33343
33445
|
}
|
|
33344
33446
|
}
|
|
33345
33447
|
|
|
@@ -33606,6 +33708,18 @@ async function installDashboardFromRegistry$1(
|
|
|
33606
33708
|
|
|
33607
33709
|
dashboardConfig = applyDefaults(dashboardConfig);
|
|
33608
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
|
+
|
|
33609
33723
|
// 6. Delegate to shared import pipeline
|
|
33610
33724
|
return await processDashboardConfig(
|
|
33611
33725
|
win,
|