@trops/dash-core 0.1.133 → 0.1.135

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.
@@ -10440,7 +10440,7 @@ function getAuthStatus$1() {
10440
10440
  *
10441
10441
  * @returns {Promise<Object|null>} User profile or null
10442
10442
  */
10443
- async function getRegistryProfile$1() {
10443
+ async function getRegistryProfile$2() {
10444
10444
  const stored = getStoredToken$1();
10445
10445
  if (!stored) return null;
10446
10446
 
@@ -10615,7 +10615,7 @@ var registryAuthController$1 = {
10615
10615
  pollForToken: pollForToken$1,
10616
10616
  getStoredToken: getStoredToken$1,
10617
10617
  getAuthStatus: getAuthStatus$1,
10618
- getRegistryProfile: getRegistryProfile$1,
10618
+ getRegistryProfile: getRegistryProfile$2,
10619
10619
  updateRegistryProfile: updateRegistryProfile$1,
10620
10620
  getRegistryPackages: getRegistryPackages$1,
10621
10621
  updateRegistryPackage: updateRegistryPackage$1,
@@ -10734,7 +10734,10 @@ const AdmZip$1 = require$$3$3;
10734
10734
  const themeController$2 = themeController_1;
10735
10735
  const registryController$1 = registryController$2;
10736
10736
  const registryApiController$1 = registryApiController$2;
10737
- const { getAuthStatus } = registryAuthController$1;
10737
+ const {
10738
+ getAuthStatus,
10739
+ getRegistryProfile: getRegistryProfile$1,
10740
+ } = registryAuthController$1;
10738
10741
 
10739
10742
  /**
10740
10743
  * Sanitize a name for use as a filename (lowercase, hyphens only).
@@ -10755,13 +10758,14 @@ function sanitizeName(name) {
10755
10758
  * @returns {Object} Registry manifest
10756
10759
  */
10757
10760
  function generateThemeRegistryManifest(themeData, themeKey, options = {}) {
10758
- const sanitizedName = sanitizeName(themeKey);
10761
+ const humanName = themeData.name || themeKey;
10762
+ const sanitizedName = sanitizeName(humanName);
10759
10763
  const colors = extractColors(themeData);
10760
10764
 
10761
10765
  return {
10762
10766
  scope: options.scope || "",
10763
10767
  name: sanitizedName,
10764
- displayName: themeKey,
10768
+ displayName: humanName,
10765
10769
  author: options.authorName || "",
10766
10770
  description: options.description || "",
10767
10771
  version: "1.0.0",
@@ -10824,7 +10828,10 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10824
10828
  // Read the theme data
10825
10829
  const themesResult = themeController$2.listThemesForApplication(win, appId);
10826
10830
  if (themesResult.error) {
10827
- return { success: false, error: "Failed to read themes: " + themesResult.message };
10831
+ return {
10832
+ success: false,
10833
+ error: "Failed to read themes: " + themesResult.message,
10834
+ };
10828
10835
  }
10829
10836
 
10830
10837
  const themeData = themesResult.themes[themeKey];
@@ -10832,16 +10839,24 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10832
10839
  return { success: false, error: `Theme "${themeKey}" not found` };
10833
10840
  }
10834
10841
 
10835
- // Get auth status for scope
10842
+ // Get auth status and profile for scope
10836
10843
  const auth = getAuthStatus();
10837
- const scope = auth.profile?.username || options.scope || "";
10838
- if (!scope) {
10844
+ if (!auth.authenticated) {
10839
10845
  return {
10840
10846
  success: false,
10841
10847
  error: "Not authenticated with registry",
10842
10848
  authRequired: true,
10843
10849
  };
10844
10850
  }
10851
+ const profile = await getRegistryProfile$1();
10852
+ const scope = profile?.username || options.scope || "";
10853
+ if (!scope) {
10854
+ return {
10855
+ success: false,
10856
+ error: "Could not determine registry username",
10857
+ authRequired: true,
10858
+ };
10859
+ }
10845
10860
 
10846
10861
  // Generate manifest
10847
10862
  const manifest = generateThemeRegistryManifest(themeData, themeKey, {
@@ -10851,10 +10866,15 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10851
10866
  });
10852
10867
 
10853
10868
  // Validate colors
10854
- if (!manifest.colors.primary || !manifest.colors.secondary || !manifest.colors.tertiary) {
10869
+ if (
10870
+ !manifest.colors.primary ||
10871
+ !manifest.colors.secondary ||
10872
+ !manifest.colors.tertiary
10873
+ ) {
10855
10874
  return {
10856
10875
  success: false,
10857
- error: "Theme must have primary, secondary, and tertiary colors defined",
10876
+ error:
10877
+ "Theme must have primary, secondary, and tertiary colors defined",
10858
10878
  };
10859
10879
  }
10860
10880
 
@@ -10895,7 +10915,10 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10895
10915
  filePath,
10896
10916
  manifest,
10897
10917
  );
10898
- console.log("[ThemeRegistryController] Registry publish result:", registryResult);
10918
+ console.log(
10919
+ "[ThemeRegistryController] Registry publish result:",
10920
+ registryResult,
10921
+ );
10899
10922
  }
10900
10923
 
10901
10924
  return {
@@ -10905,7 +10928,10 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
10905
10928
  registryResult,
10906
10929
  };
10907
10930
  } catch (err) {
10908
- console.error("[ThemeRegistryController] Error preparing theme for publish:", err);
10931
+ console.error(
10932
+ "[ThemeRegistryController] Error preparing theme for publish:",
10933
+ err,
10934
+ );
10909
10935
  return { success: false, error: err.message };
10910
10936
  }
10911
10937
  }
@@ -10926,7 +10952,10 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
10926
10952
  // Look up the package
10927
10953
  const pkg = await registryController$1.getPackage(packageName);
10928
10954
  if (!pkg) {
10929
- return { success: false, error: `Theme package "${packageName}" not found in registry` };
10955
+ return {
10956
+ success: false,
10957
+ error: `Theme package "${packageName}" not found in registry`,
10958
+ };
10930
10959
  }
10931
10960
 
10932
10961
  // Resolve download URL
@@ -10945,7 +10974,10 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
10945
10974
  return { success: false, error: "Download URL must use HTTPS" };
10946
10975
  }
10947
10976
 
10948
- console.log("[ThemeRegistryController] Downloading theme from:", downloadUrl);
10977
+ console.log(
10978
+ "[ThemeRegistryController] Downloading theme from:",
10979
+ downloadUrl,
10980
+ );
10949
10981
 
10950
10982
  // Download the ZIP
10951
10983
  const response = await fetch(downloadUrl);
@@ -10968,11 +11000,17 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
10968
11000
  );
10969
11001
 
10970
11002
  if (!themeEntry) {
10971
- return { success: false, error: "ZIP does not contain a .theme.json file" };
11003
+ return {
11004
+ success: false,
11005
+ error: "ZIP does not contain a .theme.json file",
11006
+ };
10972
11007
  }
10973
11008
 
10974
11009
  // Validate entry path (security: prevent path traversal)
10975
- if (themeEntry.entryName.includes("..") || path$2.isAbsolute(themeEntry.entryName)) {
11010
+ if (
11011
+ themeEntry.entryName.includes("..") ||
11012
+ path$2.isAbsolute(themeEntry.entryName)
11013
+ ) {
10976
11014
  return { success: false, error: "Invalid file path in ZIP" };
10977
11015
  }
10978
11016
 
@@ -10982,7 +11020,10 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
10982
11020
  try {
10983
11021
  themeData = JSON.parse(themeJson);
10984
11022
  } catch (parseErr) {
10985
- return { success: false, error: "Invalid JSON in theme file: " + parseErr.message };
11023
+ return {
11024
+ success: false,
11025
+ error: "Invalid JSON in theme file: " + parseErr.message,
11026
+ };
10986
11027
  }
10987
11028
 
10988
11029
  // Add registry metadata
@@ -11004,7 +11045,10 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
11004
11045
  );
11005
11046
 
11006
11047
  if (saveResult.error) {
11007
- return { success: false, error: "Failed to save theme: " + saveResult.message };
11048
+ return {
11049
+ success: false,
11050
+ error: "Failed to save theme: " + saveResult.message,
11051
+ };
11008
11052
  }
11009
11053
 
11010
11054
  console.log("[ThemeRegistryController] Theme installed:", themeKey);
@@ -11032,7 +11076,10 @@ function getThemePublishPreview$1(appId, themeKey) {
11032
11076
  try {
11033
11077
  const themesResult = themeController$2.listThemesForApplication(null, appId);
11034
11078
  if (themesResult.error) {
11035
- return { success: false, error: "Failed to read themes: " + themesResult.message };
11079
+ return {
11080
+ success: false,
11081
+ error: "Failed to read themes: " + themesResult.message,
11082
+ };
11036
11083
  }
11037
11084
 
11038
11085
  const themeData = themesResult.themes[themeKey];