@trops/dash-core 0.1.210 → 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/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.js
CHANGED
|
@@ -35745,8 +35745,29 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35745
35745
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
35746
35746
|
installResult = _useState4[0],
|
|
35747
35747
|
setInstallResult = _useState4[1];
|
|
35748
|
+
var _useState5 = React.useState(null),
|
|
35749
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
35750
|
+
authFlow = _useState6[0],
|
|
35751
|
+
setAuthFlow = _useState6[1];
|
|
35752
|
+
var _useState7 = React.useState(false),
|
|
35753
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
35754
|
+
isPolling = _useState8[0],
|
|
35755
|
+
setIsPolling = _useState8[1];
|
|
35756
|
+
var _useState9 = React.useState(null),
|
|
35757
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
35758
|
+
authError = _useState0[0],
|
|
35759
|
+
setAuthError = _useState0[1];
|
|
35760
|
+
var pollIntervalRef = React.useRef(null);
|
|
35748
35761
|
var pkg = themePackage;
|
|
35749
35762
|
if (!pkg) return null;
|
|
35763
|
+
|
|
35764
|
+
// Clean up polling on unmount
|
|
35765
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
35766
|
+
React.useEffect(function () {
|
|
35767
|
+
return function () {
|
|
35768
|
+
if (pollIntervalRef.current) clearInterval(pollIntervalRef.current);
|
|
35769
|
+
};
|
|
35770
|
+
}, []);
|
|
35750
35771
|
var rawColors = pkg.colors || {};
|
|
35751
35772
|
// Also check top-level fields for themes that store colors directly
|
|
35752
35773
|
var colors = {
|
|
@@ -35772,11 +35793,25 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35772
35793
|
case 1:
|
|
35773
35794
|
setIsInstalling(true);
|
|
35774
35795
|
setInstallResult(null);
|
|
35796
|
+
setAuthFlow(null);
|
|
35797
|
+
setAuthError(null);
|
|
35775
35798
|
_context.prev = 2;
|
|
35776
35799
|
_context.next = 3;
|
|
35777
35800
|
return window.mainApi.themes.installThemeFromRegistry(appId, pkg.name);
|
|
35778
35801
|
case 3:
|
|
35779
35802
|
result = _context.sent;
|
|
35803
|
+
if (!(result !== null && result !== void 0 && result.authRequired)) {
|
|
35804
|
+
_context.next = 4;
|
|
35805
|
+
break;
|
|
35806
|
+
}
|
|
35807
|
+
// Auth needed — show inline auth prompt
|
|
35808
|
+
setIsInstalling(false);
|
|
35809
|
+
setInstallResult({
|
|
35810
|
+
status: "auth",
|
|
35811
|
+
message: result.error || "Sign in to install this theme."
|
|
35812
|
+
});
|
|
35813
|
+
return _context.abrupt("return");
|
|
35814
|
+
case 4:
|
|
35780
35815
|
setInstallResult({
|
|
35781
35816
|
status: result !== null && result !== void 0 && result.success ? "success" : "error",
|
|
35782
35817
|
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."
|
|
@@ -35790,27 +35825,104 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35790
35825
|
onInstallComplete(result);
|
|
35791
35826
|
}
|
|
35792
35827
|
}
|
|
35793
|
-
_context.next =
|
|
35828
|
+
_context.next = 6;
|
|
35794
35829
|
break;
|
|
35795
|
-
case
|
|
35796
|
-
_context.prev =
|
|
35830
|
+
case 5:
|
|
35831
|
+
_context.prev = 5;
|
|
35797
35832
|
_t = _context["catch"](2);
|
|
35798
35833
|
setInstallResult({
|
|
35799
35834
|
status: "error",
|
|
35800
35835
|
message: _t.message || "Failed to install theme."
|
|
35801
35836
|
});
|
|
35802
|
-
case 5:
|
|
35803
|
-
_context.prev = 5;
|
|
35804
|
-
setIsInstalling(false);
|
|
35805
|
-
return _context.finish(5);
|
|
35806
35837
|
case 6:
|
|
35838
|
+
_context.prev = 6;
|
|
35839
|
+
setIsInstalling(false);
|
|
35840
|
+
return _context.finish(6);
|
|
35841
|
+
case 7:
|
|
35807
35842
|
case "end":
|
|
35808
35843
|
return _context.stop();
|
|
35809
35844
|
}
|
|
35810
|
-
}, _callee, null, [[2,
|
|
35845
|
+
}, _callee, null, [[2, 5, 6, 7]]);
|
|
35811
35846
|
}));
|
|
35812
35847
|
return _handleInstall.apply(this, arguments);
|
|
35813
35848
|
}
|
|
35849
|
+
function handleSignIn() {
|
|
35850
|
+
return _handleSignIn.apply(this, arguments);
|
|
35851
|
+
}
|
|
35852
|
+
function _handleSignIn() {
|
|
35853
|
+
_handleSignIn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
35854
|
+
var flow, interval;
|
|
35855
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
35856
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
35857
|
+
case 0:
|
|
35858
|
+
setAuthError(null);
|
|
35859
|
+
_context3.prev = 1;
|
|
35860
|
+
_context3.next = 2;
|
|
35861
|
+
return window.mainApi.registryAuth.initiateLogin();
|
|
35862
|
+
case 2:
|
|
35863
|
+
flow = _context3.sent;
|
|
35864
|
+
setAuthFlow(flow);
|
|
35865
|
+
|
|
35866
|
+
// Open verification URL in browser
|
|
35867
|
+
if (flow.verificationUrlComplete) {
|
|
35868
|
+
window.mainApi.shell.openExternal(flow.verificationUrlComplete);
|
|
35869
|
+
}
|
|
35870
|
+
|
|
35871
|
+
// Start polling for token
|
|
35872
|
+
setIsPolling(true);
|
|
35873
|
+
interval = (flow.interval || 5) * 1000;
|
|
35874
|
+
pollIntervalRef.current = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
35875
|
+
var pollResult;
|
|
35876
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
35877
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
35878
|
+
case 0:
|
|
35879
|
+
_context2.prev = 0;
|
|
35880
|
+
_context2.next = 1;
|
|
35881
|
+
return window.mainApi.registryAuth.pollToken(flow.deviceCode);
|
|
35882
|
+
case 1:
|
|
35883
|
+
pollResult = _context2.sent;
|
|
35884
|
+
if (pollResult.status === "authorized") {
|
|
35885
|
+
clearInterval(pollIntervalRef.current);
|
|
35886
|
+
pollIntervalRef.current = null;
|
|
35887
|
+
setIsPolling(false);
|
|
35888
|
+
setAuthFlow(null);
|
|
35889
|
+
// DASH-144: Auto-retry install after successful auth
|
|
35890
|
+
handleInstall();
|
|
35891
|
+
} else if (pollResult.status === "expired") {
|
|
35892
|
+
clearInterval(pollIntervalRef.current);
|
|
35893
|
+
pollIntervalRef.current = null;
|
|
35894
|
+
setIsPolling(false);
|
|
35895
|
+
setAuthFlow(null);
|
|
35896
|
+
setAuthError("Authorization expired. Please try again.");
|
|
35897
|
+
}
|
|
35898
|
+
_context2.next = 3;
|
|
35899
|
+
break;
|
|
35900
|
+
case 2:
|
|
35901
|
+
_context2.prev = 2;
|
|
35902
|
+
_context2["catch"](0);
|
|
35903
|
+
clearInterval(pollIntervalRef.current);
|
|
35904
|
+
pollIntervalRef.current = null;
|
|
35905
|
+
setIsPolling(false);
|
|
35906
|
+
case 3:
|
|
35907
|
+
case "end":
|
|
35908
|
+
return _context2.stop();
|
|
35909
|
+
}
|
|
35910
|
+
}, _callee2, null, [[0, 2]]);
|
|
35911
|
+
})), interval);
|
|
35912
|
+
_context3.next = 4;
|
|
35913
|
+
break;
|
|
35914
|
+
case 3:
|
|
35915
|
+
_context3.prev = 3;
|
|
35916
|
+
_context3["catch"](1);
|
|
35917
|
+
setAuthError("Could not reach the registry. Check your connection and try again.");
|
|
35918
|
+
case 4:
|
|
35919
|
+
case "end":
|
|
35920
|
+
return _context3.stop();
|
|
35921
|
+
}
|
|
35922
|
+
}, _callee3, null, [[1, 3]]);
|
|
35923
|
+
}));
|
|
35924
|
+
return _handleSignIn.apply(this, arguments);
|
|
35925
|
+
}
|
|
35814
35926
|
var colorEntries = [{
|
|
35815
35927
|
label: "Primary",
|
|
35816
35928
|
value: colors.primary
|
|
@@ -35889,7 +36001,7 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35889
36001
|
children: tag
|
|
35890
36002
|
}, tag);
|
|
35891
36003
|
})
|
|
35892
|
-
}), installResult && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36004
|
+
}), installResult && installResult.status !== "auth" && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35893
36005
|
className: "p-2 rounded border ".concat(installResult.status === "success" ? "bg-green-900/20 border-green-700" : "bg-red-900/30 border-red-700"),
|
|
35894
36006
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
35895
36007
|
className: "flex items-center gap-2",
|
|
@@ -35901,8 +36013,57 @@ var RegistryThemeDetail = function RegistryThemeDetail(_ref2) {
|
|
|
35901
36013
|
children: installResult.message
|
|
35902
36014
|
})]
|
|
35903
36015
|
})
|
|
36016
|
+
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) === "auth" && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
36017
|
+
className: "space-y-3",
|
|
36018
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36019
|
+
className: "bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-3",
|
|
36020
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
36021
|
+
className: "flex items-start gap-2",
|
|
36022
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
36023
|
+
icon: "lock",
|
|
36024
|
+
className: "h-3.5 w-3.5 text-yellow-400 mt-0.5 flex-shrink-0"
|
|
36025
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
36026
|
+
className: "text-sm text-yellow-300/90",
|
|
36027
|
+
children: installResult.message
|
|
36028
|
+
})]
|
|
36029
|
+
})
|
|
36030
|
+
}), !authFlow && !isPolling && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
36031
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
36032
|
+
type: "button",
|
|
36033
|
+
onClick: handleSignIn,
|
|
36034
|
+
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",
|
|
36035
|
+
children: "Sign in to Registry"
|
|
36036
|
+
}), authError && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36037
|
+
className: "bg-red-500/10 border border-red-500/20 rounded-lg p-3",
|
|
36038
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
36039
|
+
className: "flex items-start gap-2",
|
|
36040
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
36041
|
+
icon: "circle-xmark",
|
|
36042
|
+
className: "h-3.5 w-3.5 text-red-400 mt-0.5 flex-shrink-0"
|
|
36043
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
36044
|
+
className: "text-xs text-red-300/90",
|
|
36045
|
+
children: authError
|
|
36046
|
+
})]
|
|
36047
|
+
})
|
|
36048
|
+
})]
|
|
36049
|
+
}), authFlow && isPolling && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
36050
|
+
className: "bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 space-y-3",
|
|
36051
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("p", {
|
|
36052
|
+
className: "text-xs text-blue-300/90",
|
|
36053
|
+
children: "Enter this code in your browser:"
|
|
36054
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36055
|
+
className: "text-center",
|
|
36056
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
36057
|
+
className: "text-2xl font-mono font-bold tracking-widest text-white",
|
|
36058
|
+
children: authFlow.userCode
|
|
36059
|
+
})
|
|
36060
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
36061
|
+
className: "text-xs text-blue-300/70 text-center",
|
|
36062
|
+
children: "Waiting for authorization \u2014 install will resume automatically..."
|
|
36063
|
+
})]
|
|
36064
|
+
})]
|
|
35904
36065
|
})]
|
|
35905
|
-
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36066
|
+
}), (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "success" && (installResult === null || installResult === void 0 ? void 0 : installResult.status) !== "auth" && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35906
36067
|
className: "flex items-center justify-end px-6 py-3 border-t ".concat(currentTheme["border-primary-medium"]),
|
|
35907
36068
|
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
35908
36069
|
title: isInstalling ? "Installing..." : "Install Theme",
|