@trops/dash-core 0.1.257 → 0.1.260

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.
@@ -31458,9 +31458,20 @@ var schedulerController_1 = schedulerController$2;
31458
31458
  }
31459
31459
  }
31460
31460
 
31461
- const response = await fetch(downloadUrl, fetchOpts);
31462
- if (!response.ok)
31461
+ let response;
31462
+ try {
31463
+ response = await fetch(downloadUrl, fetchOpts);
31464
+ } catch (fetchErr) {
31465
+ throw new Error(
31466
+ "Could not reach the download server. Check your connection and try again.",
31467
+ );
31468
+ }
31469
+ if (!response.ok) {
31470
+ if (response.status === 401) {
31471
+ throw new Error("Authentication required to download this widget");
31472
+ }
31463
31473
  throw new Error(`Failed to fetch: ${response.statusText}`);
31474
+ }
31464
31475
 
31465
31476
  const contentType = response.headers.get("content-type") || "";
31466
31477
  let buffer = Buffer.from(await response.arrayBuffer());
@@ -33279,51 +33290,62 @@ async function processDashboardConfig(
33279
33290
  const existingThemes = themeResult.themes || {};
33280
33291
  const themeKey = bundledTheme.key;
33281
33292
 
33282
- if (bundledTheme.data && themeKey && !existingThemes[themeKey]) {
33283
- // Embed registry origin metadata if present
33284
- const themeData = { ...bundledTheme.data };
33285
- if (bundledTheme.registryPackage) {
33286
- themeData._registryMeta = {
33287
- source: "dashboard-import",
33288
- packageName: bundledTheme.registryPackage,
33289
- installedAt: new Date().toISOString(),
33290
- };
33291
- }
33292
- themeController$3.saveThemeForApplication(
33293
- win,
33294
- appId,
33295
- themeKey,
33296
- themeData,
33297
- );
33298
- themeInstalled = themeKey;
33299
- console.log(
33300
- `[DashboardConfigController] Installed bundled theme: ${themeKey}`,
33301
- );
33302
- } else if (
33303
- !bundledTheme.data &&
33304
- bundledTheme.registryPackage &&
33305
- themeKey &&
33306
- !existingThemes[themeKey]
33307
- ) {
33308
- // Fallback: try to install from registry by package name
33309
- try {
33310
- const {
33311
- installThemeFromRegistry,
33312
- } = themeRegistryController$1;
33313
- await installThemeFromRegistry(
33293
+ if (themeKey) {
33294
+ if (bundledTheme.data && !existingThemes[themeKey]) {
33295
+ // Theme is new install it
33296
+ const themeData = { ...bundledTheme.data };
33297
+ if (bundledTheme.registryPackage) {
33298
+ themeData._registryMeta = {
33299
+ source: "dashboard-import",
33300
+ packageName: bundledTheme.registryPackage,
33301
+ installedAt: new Date().toISOString(),
33302
+ };
33303
+ }
33304
+ const saveResult = themeController$3.saveThemeForApplication(
33314
33305
  win,
33315
33306
  appId,
33316
- bundledTheme.registryPackage,
33307
+ themeKey,
33308
+ themeData,
33317
33309
  );
33318
- themeInstalled = themeKey;
33310
+ if (saveResult.error) {
33311
+ console.warn(
33312
+ `[DashboardConfigController] Theme save failed: ${saveResult.message}`,
33313
+ );
33314
+ } else {
33315
+ console.log(
33316
+ `[DashboardConfigController] Installed bundled theme: ${themeKey}`,
33317
+ );
33318
+ }
33319
+ } else if (
33320
+ !bundledTheme.data &&
33321
+ bundledTheme.registryPackage &&
33322
+ !existingThemes[themeKey]
33323
+ ) {
33324
+ // Fallback: try to install from registry by package name
33325
+ try {
33326
+ const {
33327
+ installThemeFromRegistry,
33328
+ } = themeRegistryController$1;
33329
+ await installThemeFromRegistry(
33330
+ win,
33331
+ appId,
33332
+ bundledTheme.registryPackage,
33333
+ );
33334
+ console.log(
33335
+ `[DashboardConfigController] Installed theme from registry: ${bundledTheme.registryPackage}`,
33336
+ );
33337
+ } catch (registryErr) {
33338
+ console.warn(
33339
+ `[DashboardConfigController] Could not install theme from registry: ${registryErr.message}`,
33340
+ );
33341
+ }
33342
+ } else if (existingThemes[themeKey]) {
33319
33343
  console.log(
33320
- `[DashboardConfigController] Installed theme from registry: ${bundledTheme.registryPackage}`,
33321
- );
33322
- } catch (registryErr) {
33323
- console.warn(
33324
- `[DashboardConfigController] Could not install theme from registry: ${registryErr.message}`,
33344
+ `[DashboardConfigController] Theme already exists: ${themeKey}`,
33325
33345
  );
33326
33346
  }
33347
+ // Always bind workspace to theme key
33348
+ themeInstalled = themeKey;
33327
33349
  }
33328
33350
  } catch (themeErr) {
33329
33351
  console.warn(