@trops/dash-core 0.1.209 → 0.1.211
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 +24 -8
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +171 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +171 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -35727,8 +35727,29 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35727
35727
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
35728
35728
|
installResult = _useState4[0],
|
|
35729
35729
|
setInstallResult = _useState4[1];
|
|
35730
|
+
var _useState5 = useState(null),
|
|
35731
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
35732
|
+
authFlow = _useState6[0],
|
|
35733
|
+
setAuthFlow = _useState6[1];
|
|
35734
|
+
var _useState7 = useState(false),
|
|
35735
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
35736
|
+
isPolling = _useState8[0],
|
|
35737
|
+
setIsPolling = _useState8[1];
|
|
35738
|
+
var _useState9 = useState(null),
|
|
35739
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
35740
|
+
authError = _useState0[0],
|
|
35741
|
+
setAuthError = _useState0[1];
|
|
35742
|
+
var pollIntervalRef = useRef(null);
|
|
35730
35743
|
var pkg = themePackage;
|
|
35731
35744
|
if (!pkg) return null;
|
|
35745
|
+
|
|
35746
|
+
// Clean up polling on unmount
|
|
35747
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
35748
|
+
useEffect(function () {
|
|
35749
|
+
return function () {
|
|
35750
|
+
if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
|
|
35751
|
+
};
|
|
35752
|
+
}, []);
|
|
35732
35753
|
var rawColors = pkg.colors || {};
|
|
35733
35754
|
// Also check top-level fields for themes that store colors directly
|
|
35734
35755
|
var colors = {
|
|
@@ -35754,11 +35775,25 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35754
35775
|
case 1:
|
|
35755
35776
|
setIsInstalling(true);
|
|
35756
35777
|
setInstallResult(null);
|
|
35778
|
+
setAuthFlow(null);
|
|
35779
|
+
setAuthError(null);
|
|
35757
35780
|
_context.prev = 2;
|
|
35758
35781
|
_context.next = 3;
|
|
35759
35782
|
return window.mainApi.themes.installThemeFromRegistry(appId, pkg.name);
|
|
35760
35783
|
case 3:
|
|
35761
35784
|
result = _context.sent;
|
|
35785
|
+
if (!(result !== null && result !== void 0 && result.authRequired)) {
|
|
35786
|
+
_context.next = 4;
|
|
35787
|
+
break;
|
|
35788
|
+
}
|
|
35789
|
+
// Auth needed — show inline auth prompt
|
|
35790
|
+
setIsInstalling(false);
|
|
35791
|
+
setInstallResult({
|
|
35792
|
+
status: "auth",
|
|
35793
|
+
message: result.error || "Sign in to install this theme."
|
|
35794
|
+
});
|
|
35795
|
+
return _context.abrupt("return");
|
|
35796
|
+
case 4:
|
|
35762
35797
|
setInstallResult({
|
|
35763
35798
|
status: result !== null && result !== void 0 && result.success ? "success" : "error",
|
|
35764
35799
|
message: result !== null && result !== void 0 && result.success ? "Theme \"".concat(result.themeKey || pkg.displayName || pkg.name, "\" installed successfully.") : (result === null || result === void 0 ? void 0 : result.error) || "Installation failed."
|
|
@@ -35772,27 +35807,104 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35772
35807
|
onInstallComplete(result);
|
|
35773
35808
|
}
|
|
35774
35809
|
}
|
|
35775
|
-
_context.next =
|
|
35810
|
+
_context.next = 6;
|
|
35776
35811
|
break;
|
|
35777
|
-
case
|
|
35778
|
-
_context.prev =
|
|
35812
|
+
case 5:
|
|
35813
|
+
_context.prev = 5;
|
|
35779
35814
|
_t = _context["catch"](2);
|
|
35780
35815
|
setInstallResult({
|
|
35781
35816
|
status: "error",
|
|
35782
35817
|
message: _t.message || "Failed to install theme."
|
|
35783
35818
|
});
|
|
35784
|
-
case 5:
|
|
35785
|
-
_context.prev = 5;
|
|
35786
|
-
setIsInstalling(false);
|
|
35787
|
-
return _context.finish(5);
|
|
35788
35819
|
case 6:
|
|
35820
|
+
_context.prev = 6;
|
|
35821
|
+
setIsInstalling(false);
|
|
35822
|
+
return _context.finish(6);
|
|
35823
|
+
case 7:
|
|
35789
35824
|
case "end":
|
|
35790
35825
|
return _context.stop();
|
|
35791
35826
|
}
|
|
35792
|
-
}, _callee, null, [[2,
|
|
35827
|
+
}, _callee, null, [[2, 5, 6, 7]]);
|
|
35793
35828
|
}));
|
|
35794
35829
|
return _handleInstall.apply(this, arguments);
|
|
35795
35830
|
}
|
|
35831
|
+
function handleSignIn() {
|
|
35832
|
+
return _handleSignIn.apply(this, arguments);
|
|
35833
|
+
}
|
|
35834
|
+
function _handleSignIn() {
|
|
35835
|
+
_handleSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
35836
|
+
var flow, interval;
|
|
35837
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
35838
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
35839
|
+
case 0:
|
|
35840
|
+
setAuthError(null);
|
|
35841
|
+
_context3.prev = 1;
|
|
35842
|
+
_context3.next = 2;
|
|
35843
|
+
return window.mainApi.registryAuth.initiateLogin();
|
|
35844
|
+
case 2:
|
|
35845
|
+
flow = _context3.sent;
|
|
35846
|
+
setAuthFlow(flow);
|
|
35847
|
+
|
|
35848
|
+
// Open verification URL in browser
|
|
35849
|
+
if (flow.verificationUrlComplete) {
|
|
35850
|
+
window.mainApi.shell.openExternal(flow.verificationUrlComplete);
|
|
35851
|
+
}
|
|
35852
|
+
|
|
35853
|
+
// Start polling for token
|
|
35854
|
+
setIsPolling(true);
|
|
35855
|
+
interval = (flow.interval || 5) * 1000;
|
|
35856
|
+
pollIntervalRef.current = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
35857
|
+
var pollResult;
|
|
35858
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
35859
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
35860
|
+
case 0:
|
|
35861
|
+
_context2.prev = 0;
|
|
35862
|
+
_context2.next = 1;
|
|
35863
|
+
return window.mainApi.registryAuth.pollToken(flow.deviceCode);
|
|
35864
|
+
case 1:
|
|
35865
|
+
pollResult = _context2.sent;
|
|
35866
|
+
if (pollResult.status === "authorized") {
|
|
35867
|
+
clearInterval(pollIntervalRef.current);
|
|
35868
|
+
pollIntervalRef.current = null;
|
|
35869
|
+
setIsPolling(false);
|
|
35870
|
+
setAuthFlow(null);
|
|
35871
|
+
// DASH-144: Auto-retry install after successful auth
|
|
35872
|
+
handleInstall();
|
|
35873
|
+
} else if (pollResult.status === "expired") {
|
|
35874
|
+
clearInterval(pollIntervalRef.current);
|
|
35875
|
+
pollIntervalRef.current = null;
|
|
35876
|
+
setIsPolling(false);
|
|
35877
|
+
setAuthFlow(null);
|
|
35878
|
+
setAuthError("Authorization expired. Please try again.");
|
|
35879
|
+
}
|
|
35880
|
+
_context2.next = 3;
|
|
35881
|
+
break;
|
|
35882
|
+
case 2:
|
|
35883
|
+
_context2.prev = 2;
|
|
35884
|
+
_context2["catch"](0);
|
|
35885
|
+
clearInterval(pollIntervalRef.current);
|
|
35886
|
+
pollIntervalRef.current = null;
|
|
35887
|
+
setIsPolling(false);
|
|
35888
|
+
case 3:
|
|
35889
|
+
case "end":
|
|
35890
|
+
return _context2.stop();
|
|
35891
|
+
}
|
|
35892
|
+
}, _callee2, null, [[0, 2]]);
|
|
35893
|
+
})), interval);
|
|
35894
|
+
_context3.next = 4;
|
|
35895
|
+
break;
|
|
35896
|
+
case 3:
|
|
35897
|
+
_context3.prev = 3;
|
|
35898
|
+
_context3["catch"](1);
|
|
35899
|
+
setAuthError("Could not reach the registry. Check your connection and try again.");
|
|
35900
|
+
case 4:
|
|
35901
|
+
case "end":
|
|
35902
|
+
return _context3.stop();
|
|
35903
|
+
}
|
|
35904
|
+
}, _callee3, null, [[1, 3]]);
|
|
35905
|
+
}));
|
|
35906
|
+
return _handleSignIn.apply(this, arguments);
|
|
35907
|
+
}
|
|
35796
35908
|
var colorEntries = [{
|
|
35797
35909
|
label: "Primary",
|
|
35798
35910
|
value: colors.primary
|
|
@@ -35871,7 +35983,7 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35871
35983
|
children: tag
|
|
35872
35984
|
}, tag);
|
|
35873
35985
|
})
|
|
35874
|
-
}), installResult && /*#__PURE__*/jsx("div", {
|
|
35986
|
+
}), installResult && installResult.status !== "auth" && /*#__PURE__*/jsx("div", {
|
|
35875
35987
|
className: "p-2 rounded border ".concat(installResult.status === "success" ? "bg-green-900/20 border-green-700" : "bg-red-900/30 border-red-700"),
|
|
35876
35988
|
children: /*#__PURE__*/jsxs("div", {
|
|
35877
35989
|
className: "flex items-center gap-2",
|
|
@@ -35883,8 +35995,57 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35883
35995
|
children: installResult.message
|
|
35884
35996
|
})]
|
|
35885
35997
|
})
|
|
35998
|
+
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) === "auth" && /*#__PURE__*/jsxs("div", {
|
|
35999
|
+
className: "space-y-3",
|
|
36000
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
36001
|
+
className: "bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-3",
|
|
36002
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
36003
|
+
className: "flex items-start gap-2",
|
|
36004
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
36005
|
+
icon: "lock",
|
|
36006
|
+
className: "h-3.5 w-3.5 text-yellow-400 mt-0.5 flex-shrink-0"
|
|
36007
|
+
}), /*#__PURE__*/jsx("span", {
|
|
36008
|
+
className: "text-sm text-yellow-300/90",
|
|
36009
|
+
children: installResult.message
|
|
36010
|
+
})]
|
|
36011
|
+
})
|
|
36012
|
+
}), !authFlow && !isPolling && /*#__PURE__*/jsxs(Fragment, {
|
|
36013
|
+
children: [/*#__PURE__*/jsx("button", {
|
|
36014
|
+
type: "button",
|
|
36015
|
+
onClick: handleSignIn,
|
|
36016
|
+
className: "px-4 py-2 rounded-lg text-sm bg-blue-500/20 border border-blue-500/30 text-blue-300 hover:bg-blue-500/30 transition-colors cursor-pointer",
|
|
36017
|
+
children: "Sign in to Registry"
|
|
36018
|
+
}), authError && /*#__PURE__*/jsx("div", {
|
|
36019
|
+
className: "bg-red-500/10 border border-red-500/20 rounded-lg p-3",
|
|
36020
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
36021
|
+
className: "flex items-start gap-2",
|
|
36022
|
+
children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
|
|
36023
|
+
icon: "circle-xmark",
|
|
36024
|
+
className: "h-3.5 w-3.5 text-red-400 mt-0.5 flex-shrink-0"
|
|
36025
|
+
}), /*#__PURE__*/jsx("span", {
|
|
36026
|
+
className: "text-xs text-red-300/90",
|
|
36027
|
+
children: authError
|
|
36028
|
+
})]
|
|
36029
|
+
})
|
|
36030
|
+
})]
|
|
36031
|
+
}), authFlow && isPolling && /*#__PURE__*/jsxs("div", {
|
|
36032
|
+
className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
|
|
36033
|
+
children: [/*#__PURE__*/jsx("p", {
|
|
36034
|
+
className: "text-xs text-blue-300/90",
|
|
36035
|
+
children: "Enter this code in your browser:"
|
|
36036
|
+
}), /*#__PURE__*/jsx("div", {
|
|
36037
|
+
className: "text-center",
|
|
36038
|
+
children: /*#__PURE__*/jsx("span", {
|
|
36039
|
+
className: "text-2xl font-mono font-bold tracking-widest text-white",
|
|
36040
|
+
children: authFlow.userCode
|
|
36041
|
+
})
|
|
36042
|
+
}), /*#__PURE__*/jsx("p", {
|
|
36043
|
+
className: "text-xs text-blue-300/70 text-center",
|
|
36044
|
+
children: "Waiting for authorization \u2014 install will resume automatically..."
|
|
36045
|
+
})]
|
|
36046
|
+
})]
|
|
35886
36047
|
})]
|
|
35887
|
-
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && /*#__PURE__*/jsx("div", {
|
|
36048
|
+
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "auth" && /*#__PURE__*/jsx("div", {
|
|
35888
36049
|
className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
|
|
35889
36050
|
children: /*#__PURE__*/jsx(Button, {
|
|
35890
36051
|
title: isInstalling ? "Installing..." : "Install Theme",
|