@trops/dash-core 0.1.117 → 0.1.119
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 +17 -0
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +79 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +78 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19189,7 +19189,8 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
19189
19189
|
var uuidString = DashReact.getUUID(params.uuid);
|
|
19190
19190
|
var widgetData = _objectSpread$m(_objectSpread$m({}, params), {}, {
|
|
19191
19191
|
uuidString: uuidString,
|
|
19192
|
-
providers: (config === null || config === void 0 ? void 0 : config.providers) || []
|
|
19192
|
+
providers: (config === null || config === void 0 ? void 0 : config.providers) || [],
|
|
19193
|
+
notifications: (config === null || config === void 0 ? void 0 : config.notifications) || []
|
|
19193
19194
|
});
|
|
19194
19195
|
|
|
19195
19196
|
// need to set the electron api here.
|
|
@@ -25149,6 +25150,7 @@ var ComponentManager = {
|
|
|
25149
25150
|
events: "events" in c ? c["events"] : [],
|
|
25150
25151
|
eventHandlers: "eventHandlers" in c ? c["eventHandlers"] : [],
|
|
25151
25152
|
providers: "providers" in c ? c["providers"] : [],
|
|
25153
|
+
notifications: "notifications" in c ? c["notifications"] : [],
|
|
25152
25154
|
icon: "icon" in c ? c["icon"] : null
|
|
25153
25155
|
};
|
|
25154
25156
|
}
|
|
@@ -39794,13 +39796,57 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39794
39796
|
onOpenSettings = _ref2.onOpenSettings,
|
|
39795
39797
|
onSignIn = _ref2.onSignIn,
|
|
39796
39798
|
onSignOut = _ref2.onSignOut;
|
|
39799
|
+
var buttonRef = React.useRef(null);
|
|
39800
|
+
var _useState = React.useState(false),
|
|
39801
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39802
|
+
doNotDisturb = _useState2[0],
|
|
39803
|
+
setDoNotDisturb = _useState2[1];
|
|
39797
39804
|
var displayName = authStatus === "authenticated" && authProfile ? authProfile.displayName || authProfile.username : "Account";
|
|
39805
|
+
|
|
39806
|
+
// Load initial DND state
|
|
39807
|
+
React.useEffect(function () {
|
|
39808
|
+
var _window$mainApi;
|
|
39809
|
+
var timeout = new Promise(function (_, reject) {
|
|
39810
|
+
return setTimeout(function () {
|
|
39811
|
+
return reject(new Error("timeout"));
|
|
39812
|
+
}, 2000);
|
|
39813
|
+
});
|
|
39814
|
+
var fetch = (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.notifications) === null || _window$mainApi === void 0 ? void 0 : _window$mainApi.getPreferences();
|
|
39815
|
+
if (fetch) {
|
|
39816
|
+
Promise.race([fetch, timeout]).then(function (prefs) {
|
|
39817
|
+
if (prefs) setDoNotDisturb(prefs.doNotDisturb);
|
|
39818
|
+
})["catch"](function () {});
|
|
39819
|
+
}
|
|
39820
|
+
}, []);
|
|
39821
|
+
|
|
39822
|
+
// Sync when toggled from macOS menu
|
|
39823
|
+
React.useEffect(function () {
|
|
39824
|
+
var _window$mainApi2, _window$mainApi2$onDn;
|
|
39825
|
+
var cleanup = (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.notifications) === null || _window$mainApi2 === void 0 || (_window$mainApi2$onDn = _window$mainApi2.onDndChanged) === null || _window$mainApi2$onDn === void 0 ? void 0 : _window$mainApi2$onDn.call(_window$mainApi2, function (dnd) {
|
|
39826
|
+
setDoNotDisturb(dnd);
|
|
39827
|
+
});
|
|
39828
|
+
return function () {
|
|
39829
|
+
if (cleanup) cleanup();
|
|
39830
|
+
};
|
|
39831
|
+
}, []);
|
|
39832
|
+
function handleToggleDnd() {
|
|
39833
|
+
var _window$mainApi3;
|
|
39834
|
+
var newValue = !doNotDisturb;
|
|
39835
|
+
setDoNotDisturb(newValue);
|
|
39836
|
+
(_window$mainApi3 = window.mainApi) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.notifications) === null || _window$mainApi3 === void 0 || (_window$mainApi3 = _window$mainApi3.setGlobal({
|
|
39837
|
+
doNotDisturb: newValue
|
|
39838
|
+
})) === null || _window$mainApi3 === void 0 || _window$mainApi3["catch"](function () {});
|
|
39839
|
+
}
|
|
39798
39840
|
return /*#__PURE__*/jsxRuntime.jsx(react.Popover, {
|
|
39799
39841
|
className: "relative",
|
|
39800
39842
|
children: function children(_ref3) {
|
|
39801
|
-
var
|
|
39843
|
+
var _rect$left;
|
|
39844
|
+
var open = _ref3.open,
|
|
39845
|
+
close = _ref3.close;
|
|
39846
|
+
var rect = open && buttonRef.current ? buttonRef.current.getBoundingClientRect() : null;
|
|
39802
39847
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
39803
39848
|
children: [/*#__PURE__*/jsxRuntime.jsxs(react.Popover.Button, {
|
|
39849
|
+
ref: buttonRef,
|
|
39804
39850
|
className: "flex items-center w-full gap-2 px-3 py-2 rounded-md text-sm opacity-80 hover:opacity-100 transition-colors duration-150 cursor-pointer hover:bg-white/5 focus:outline-none",
|
|
39805
39851
|
title: collapsed ? displayName : undefined,
|
|
39806
39852
|
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
@@ -39810,15 +39856,28 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39810
39856
|
className: "flex-1 text-left truncate",
|
|
39811
39857
|
children: displayName
|
|
39812
39858
|
})]
|
|
39813
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
39859
|
+
}), /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/jsxRuntime.jsxs(react.Transition, {
|
|
39860
|
+
show: open,
|
|
39814
39861
|
enter: "transition ease-out duration-100",
|
|
39815
39862
|
enterFrom: "transform opacity-0 scale-95",
|
|
39816
39863
|
enterTo: "transform opacity-100 scale-100",
|
|
39817
39864
|
leave: "transition ease-in duration-75",
|
|
39818
39865
|
leaveFrom: "transform opacity-100 scale-100",
|
|
39819
39866
|
leaveTo: "transform opacity-0 scale-95",
|
|
39820
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
39821
|
-
className: "
|
|
39867
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
39868
|
+
className: "fixed inset-0",
|
|
39869
|
+
style: {
|
|
39870
|
+
zIndex: 9998
|
|
39871
|
+
},
|
|
39872
|
+
onClick: close
|
|
39873
|
+
}), /*#__PURE__*/jsxRuntime.jsx(react.Popover.Panel, {
|
|
39874
|
+
"static": true,
|
|
39875
|
+
className: "fixed w-52 rounded-lg border border-white/10 bg-neutral-900 shadow-xl",
|
|
39876
|
+
style: {
|
|
39877
|
+
zIndex: 9999,
|
|
39878
|
+
left: (_rect$left = rect === null || rect === void 0 ? void 0 : rect.left) !== null && _rect$left !== void 0 ? _rect$left : 0,
|
|
39879
|
+
bottom: rect ? window.innerHeight - rect.top + 8 : 0
|
|
39880
|
+
},
|
|
39822
39881
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
39823
39882
|
className: "p-1.5 space-y-0.5",
|
|
39824
39883
|
children: [/*#__PURE__*/jsxRuntime.jsx(PopoverItem, {
|
|
@@ -39835,6 +39894,11 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39835
39894
|
changeThemeVariant(themeVariant === "dark" ? "light" : "dark");
|
|
39836
39895
|
close();
|
|
39837
39896
|
}
|
|
39897
|
+
}), /*#__PURE__*/jsxRuntime.jsx(PopoverItem, {
|
|
39898
|
+
icon: doNotDisturb ? "bell-slash" : "bell",
|
|
39899
|
+
label: "Do Not Disturb",
|
|
39900
|
+
onClick: handleToggleDnd,
|
|
39901
|
+
active: doNotDisturb
|
|
39838
39902
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
39839
39903
|
className: "border-t border-white/10 my-1"
|
|
39840
39904
|
}), authStatus === "authenticated" ? /*#__PURE__*/jsxRuntime.jsx(PopoverItem, {
|
|
@@ -39853,8 +39917,8 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39853
39917
|
}
|
|
39854
39918
|
})]
|
|
39855
39919
|
})
|
|
39856
|
-
})
|
|
39857
|
-
})]
|
|
39920
|
+
})]
|
|
39921
|
+
}), document.body)]
|
|
39858
39922
|
});
|
|
39859
39923
|
}
|
|
39860
39924
|
});
|
|
@@ -39862,16 +39926,21 @@ var FooterPopover = function FooterPopover(_ref2) {
|
|
|
39862
39926
|
var PopoverItem = function PopoverItem(_ref4) {
|
|
39863
39927
|
var icon = _ref4.icon,
|
|
39864
39928
|
label = _ref4.label,
|
|
39865
|
-
onClick = _ref4.onClick
|
|
39929
|
+
onClick = _ref4.onClick,
|
|
39930
|
+
_ref4$active = _ref4.active,
|
|
39931
|
+
active = _ref4$active === void 0 ? false : _ref4$active;
|
|
39866
39932
|
return /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
39867
39933
|
type: "button",
|
|
39868
39934
|
onClick: onClick,
|
|
39869
|
-
className: "flex items-center w-full gap-2 px-3 py-2 rounded-md text-sm text-white/80 hover:text-white hover:bg-white/10 transition-colors duration-150 cursor-pointer",
|
|
39935
|
+
className: "flex items-center w-full gap-2 px-3 py-2 rounded-md text-sm ".concat(active ? "text-white bg-white/10" : "text-white/80 hover:text-white hover:bg-white/10", " transition-colors duration-150 cursor-pointer"),
|
|
39870
39936
|
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
39871
39937
|
icon: icon,
|
|
39872
39938
|
className: "h-3.5 w-3.5 flex-shrink-0"
|
|
39873
39939
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
39940
|
+
className: "flex-1 text-left",
|
|
39874
39941
|
children: label
|
|
39942
|
+
}), active && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
39943
|
+
className: "h-1.5 w-1.5 rounded-full bg-amber-400 flex-shrink-0"
|
|
39875
39944
|
})]
|
|
39876
39945
|
});
|
|
39877
39946
|
};
|