@appkit/dek-lib 0.10.0 → 0.11.0
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/components/Board/Board.d.ts +3 -2
- package/dist/index.es.js +451 -373
- package/dist/index.umd.js +450 -372
- package/dist/lib/utils/getPluginApi.d.ts +3 -0
- package/dist/plugins/base/boards/DevBoard.d.ts +3 -1
- package/dist/plugins/base/boards/MainBoard.d.ts +3 -1
- package/dist/plugins/base/components/Greeting/Greeting.d.ts +3 -1
- package/dist/plugins/base/plugin.d.ts +4 -13
- package/dist/plugins/base/screens/AboutScreen.d.ts +3 -1
- package/dist/plugins/base/screens/SettingsScreen/Backgrounds.d.ts +5 -1
- package/dist/plugins/base/screens/SettingsScreen/Boards.d.ts +5 -1
- package/dist/plugins/base/screens/SettingsScreen/Messages.d.ts +5 -1
- package/dist/plugins/base/screens/SettingsScreen/PluginDev.d.ts +5 -1
- package/dist/plugins/base/screens/SettingsScreen/SettingsScreen.d.ts +3 -2
- package/dist/plugins/base/screens/SettingsScreen/Theme.d.ts +5 -1
- package/dist/plugins/base/screens/dev/ComponentScreen/ComponentScreen.d.ts +3 -1
- package/dist/plugins/home-assistant/MediaView/MediaView.d.ts +3 -1
- package/package.json +1 -1
- package/dist/plugins/base/screens/SettingsScreen.d.ts +0 -2
package/dist/index.es.js
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
import * as React$3 from "react";
|
|
8
|
-
import React__default, {
|
|
8
|
+
import React__default, { useRef as useRef$1, useMemo, useEffect as useEffect$1, useState as useState$1, useLayoutEffect as useLayoutEffect$1, useCallback, useDebugValue, createContext, forwardRef, isValidElement, createElement, cloneElement, useContext, Fragment, createRef } from "react";
|
|
9
9
|
import styled, { createGlobalStyle, ThemeProvider } from "styled-components";
|
|
10
10
|
import * as ReactDOM from "react-dom";
|
|
11
11
|
import ReactDOM__default from "react-dom";
|
|
@@ -703,324 +703,6 @@ const jsxRuntimeModule = /* @__PURE__ */ _mergeNamespaces({
|
|
|
703
703
|
__proto__: null,
|
|
704
704
|
default: jsxRuntime
|
|
705
705
|
}, [jsxRuntimeExports]);
|
|
706
|
-
function useEventCallback$1(fn2) {
|
|
707
|
-
const ref = useRef$1(() => {
|
|
708
|
-
throw new Error("Cannot call an event handler while rendering.");
|
|
709
|
-
});
|
|
710
|
-
useIsomorphicLayoutEffect$2(() => {
|
|
711
|
-
ref.current = fn2;
|
|
712
|
-
}, [fn2]);
|
|
713
|
-
return useCallback((...args) => ref.current(...args), [ref]);
|
|
714
|
-
}
|
|
715
|
-
function useEventListener$1(eventName, handler, element, options) {
|
|
716
|
-
const savedHandler = useRef$1(handler);
|
|
717
|
-
useIsomorphicLayoutEffect$2(() => {
|
|
718
|
-
savedHandler.current = handler;
|
|
719
|
-
}, [handler]);
|
|
720
|
-
useEffect$1(() => {
|
|
721
|
-
var _a2;
|
|
722
|
-
const targetElement = (_a2 = element === null || element === void 0 ? void 0 : element.current) !== null && _a2 !== void 0 ? _a2 : window;
|
|
723
|
-
if (!(targetElement && targetElement.addEventListener))
|
|
724
|
-
return;
|
|
725
|
-
const listener = (event) => savedHandler.current(event);
|
|
726
|
-
targetElement.addEventListener(eventName, listener, options);
|
|
727
|
-
return () => {
|
|
728
|
-
targetElement.removeEventListener(eventName, listener, options);
|
|
729
|
-
};
|
|
730
|
-
}, [eventName, element, options]);
|
|
731
|
-
}
|
|
732
|
-
const useIsomorphicLayoutEffect$2 = typeof window !== "undefined" ? useLayoutEffect$1 : useEffect$1;
|
|
733
|
-
function useLocalStorage$1(key, initialValue) {
|
|
734
|
-
const readValue = useCallback(() => {
|
|
735
|
-
if (typeof window === "undefined") {
|
|
736
|
-
return initialValue;
|
|
737
|
-
}
|
|
738
|
-
try {
|
|
739
|
-
const item = window.localStorage.getItem(key);
|
|
740
|
-
return item ? parseJSON$1(item) : initialValue;
|
|
741
|
-
} catch (error2) {
|
|
742
|
-
console.warn(`Error reading localStorage key “${key}”:`, error2);
|
|
743
|
-
return initialValue;
|
|
744
|
-
}
|
|
745
|
-
}, [initialValue, key]);
|
|
746
|
-
const [storedValue, setStoredValue] = useState$1(readValue);
|
|
747
|
-
const setValue = useEventCallback$1((value) => {
|
|
748
|
-
if (typeof window === "undefined") {
|
|
749
|
-
console.warn(`Tried setting localStorage key “${key}” even though environment is not a client`);
|
|
750
|
-
}
|
|
751
|
-
try {
|
|
752
|
-
const newValue = value instanceof Function ? value(storedValue) : value;
|
|
753
|
-
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
754
|
-
setStoredValue(newValue);
|
|
755
|
-
window.dispatchEvent(new Event("local-storage"));
|
|
756
|
-
} catch (error2) {
|
|
757
|
-
console.warn(`Error setting localStorage key “${key}”:`, error2);
|
|
758
|
-
}
|
|
759
|
-
});
|
|
760
|
-
useEffect$1(() => {
|
|
761
|
-
setStoredValue(readValue());
|
|
762
|
-
}, []);
|
|
763
|
-
const handleStorageChange = useCallback((event) => {
|
|
764
|
-
if ((event === null || event === void 0 ? void 0 : event.key) && event.key !== key) {
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
setStoredValue(readValue());
|
|
768
|
-
}, [key, readValue]);
|
|
769
|
-
useEventListener$1("storage", handleStorageChange);
|
|
770
|
-
useEventListener$1("local-storage", handleStorageChange);
|
|
771
|
-
return [storedValue, setValue];
|
|
772
|
-
}
|
|
773
|
-
function parseJSON$1(value) {
|
|
774
|
-
try {
|
|
775
|
-
return value === "undefined" ? void 0 : JSON.parse(value !== null && value !== void 0 ? value : "");
|
|
776
|
-
} catch (_a2) {
|
|
777
|
-
console.log("parsing error on", { value });
|
|
778
|
-
return void 0;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
function extractErrorMessage$1(err) {
|
|
782
|
-
return err instanceof Error ? err.message : JSON.stringify(err);
|
|
783
|
-
}
|
|
784
|
-
function setState(plugin, key, value) {
|
|
785
|
-
const localData = getStateRoot(plugin);
|
|
786
|
-
localData[key] = value;
|
|
787
|
-
localStorage.setItem(
|
|
788
|
-
`api:${plugin.toLowerCase()}`,
|
|
789
|
-
JSON.stringify(localData)
|
|
790
|
-
);
|
|
791
|
-
window.dispatchEvent(new Event("local-storage"));
|
|
792
|
-
}
|
|
793
|
-
function getState(plugin, key) {
|
|
794
|
-
const localData = getStateRoot(plugin);
|
|
795
|
-
return localData[key];
|
|
796
|
-
}
|
|
797
|
-
function getStateRoot(plugin) {
|
|
798
|
-
const local = localStorage.getItem(`api:${plugin.toLowerCase()}`);
|
|
799
|
-
return tryParseJson(local || "{}");
|
|
800
|
-
}
|
|
801
|
-
function tryParseJson(jsonString, defaultValue = {}) {
|
|
802
|
-
try {
|
|
803
|
-
return JSON.parse(jsonString);
|
|
804
|
-
} catch (err) {
|
|
805
|
-
console.warn(`Failed parsing JSON: ${extractErrorMessage$1(err)}`);
|
|
806
|
-
return defaultValue;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
function useState(plugin) {
|
|
810
|
-
const [state2] = useLocalStorage$1(`api:${plugin.toLowerCase()}`, "{}");
|
|
811
|
-
return state2;
|
|
812
|
-
}
|
|
813
|
-
function isJsonString(str) {
|
|
814
|
-
if (typeof str !== "string") {
|
|
815
|
-
return false;
|
|
816
|
-
}
|
|
817
|
-
if (str.length === 0) {
|
|
818
|
-
return false;
|
|
819
|
-
}
|
|
820
|
-
if (str[0] !== "{" && str[0] !== "[") {
|
|
821
|
-
return false;
|
|
822
|
-
}
|
|
823
|
-
if (str[str.length - 1] !== "}" && str[str.length - 1] !== "]") {
|
|
824
|
-
return false;
|
|
825
|
-
}
|
|
826
|
-
return true;
|
|
827
|
-
}
|
|
828
|
-
class Api {
|
|
829
|
-
trace(message, ...data) {
|
|
830
|
-
console.log(`DEK-TRACE: ${message}`, ...data);
|
|
831
|
-
this.globals.messages.push({
|
|
832
|
-
type: "trace",
|
|
833
|
-
body: message,
|
|
834
|
-
data,
|
|
835
|
-
at: Date.now()
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
warn(message, ...data) {
|
|
839
|
-
console.warn(`DEK-WARN: ${message}`, ...data);
|
|
840
|
-
this.globals.messages.push({
|
|
841
|
-
type: "error",
|
|
842
|
-
body: message,
|
|
843
|
-
data,
|
|
844
|
-
at: Date.now()
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
error(message, ...data) {
|
|
848
|
-
console.error(`DEK-ERROR: ${message}`, ...data);
|
|
849
|
-
this.globals.messages.push({
|
|
850
|
-
type: "error",
|
|
851
|
-
body: message,
|
|
852
|
-
data,
|
|
853
|
-
at: Date.now()
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
messages() {
|
|
857
|
-
return this.globals.messages;
|
|
858
|
-
}
|
|
859
|
-
plugin(name) {
|
|
860
|
-
return this.createPluginWrapper(name);
|
|
861
|
-
}
|
|
862
|
-
get registry() {
|
|
863
|
-
return this.globals.registry;
|
|
864
|
-
}
|
|
865
|
-
get boardKey() {
|
|
866
|
-
return this.globals.navigateParams.boardKey || "#error";
|
|
867
|
-
}
|
|
868
|
-
get boards() {
|
|
869
|
-
return this.globals.boards;
|
|
870
|
-
}
|
|
871
|
-
get board() {
|
|
872
|
-
return this.boards.find((board) => board.key === this.boardKey) || {
|
|
873
|
-
zones: []
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
get layout() {
|
|
877
|
-
return this.board.layout || `<Screen><Text>Missing layout</Text></Screen>`;
|
|
878
|
-
}
|
|
879
|
-
get commandGroups() {
|
|
880
|
-
return this.globals.commandGroups;
|
|
881
|
-
}
|
|
882
|
-
navigate(path) {
|
|
883
|
-
this.globals.setLocation(`/${this.boardKey}${path}`);
|
|
884
|
-
}
|
|
885
|
-
get navigateParams() {
|
|
886
|
-
return this.globals.navigateParams;
|
|
887
|
-
}
|
|
888
|
-
navigateBack() {
|
|
889
|
-
history.back();
|
|
890
|
-
}
|
|
891
|
-
open(boardKey) {
|
|
892
|
-
this.globals.setLocation(`/${boardKey}`);
|
|
893
|
-
}
|
|
894
|
-
createPluginWrapper(integrationKey) {
|
|
895
|
-
const plugin = this.getPluginInstance(integrationKey);
|
|
896
|
-
const available = !!plugin;
|
|
897
|
-
return {
|
|
898
|
-
available,
|
|
899
|
-
info: {
|
|
900
|
-
components: (plugin == null ? void 0 : plugin.components) ? plugin.components.map((component) => component.key) : [],
|
|
901
|
-
screens: (plugin == null ? void 0 : plugin.screens) ? plugin.screens.map((screen) => screen.path) : []
|
|
902
|
-
},
|
|
903
|
-
component: (key, props) => this.getComponent(integrationKey, key, props),
|
|
904
|
-
componentSchema: (key) => this.getComponentSchema(integrationKey, key),
|
|
905
|
-
screen: (path) => this.getScreen(integrationKey, path),
|
|
906
|
-
board: (key) => this.getBoard(integrationKey, key),
|
|
907
|
-
api: (plugin == null ? void 0 : plugin.api) || {},
|
|
908
|
-
state: {
|
|
909
|
-
get: (key, defaultValue) => {
|
|
910
|
-
if (!available) {
|
|
911
|
-
return defaultValue;
|
|
912
|
-
}
|
|
913
|
-
return getState(integrationKey, key) || defaultValue;
|
|
914
|
-
},
|
|
915
|
-
set: (key, value) => {
|
|
916
|
-
if (!available) {
|
|
917
|
-
return;
|
|
918
|
-
}
|
|
919
|
-
setState(integrationKey, key, value);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
get globals() {
|
|
925
|
-
return window.__dek_globals;
|
|
926
|
-
}
|
|
927
|
-
get plugins() {
|
|
928
|
-
const plugins = {};
|
|
929
|
-
Object.keys(this.globals.pluginInstances).forEach((key) => {
|
|
930
|
-
plugins[key] = this.createPluginWrapper(key);
|
|
931
|
-
});
|
|
932
|
-
return plugins;
|
|
933
|
-
}
|
|
934
|
-
getPluginInstance(integrationKey) {
|
|
935
|
-
return this.globals.pluginInstances[integrationKey];
|
|
936
|
-
}
|
|
937
|
-
getComponent(integrationKey, componentKey, props) {
|
|
938
|
-
const plugin = this.getPluginInstance(integrationKey);
|
|
939
|
-
if (plugin) {
|
|
940
|
-
const component = plugin.components && plugin.components.find(
|
|
941
|
-
(c2) => c2.key.toLowerCase() === componentKey.toLowerCase()
|
|
942
|
-
);
|
|
943
|
-
if (!component) {
|
|
944
|
-
return;
|
|
945
|
-
}
|
|
946
|
-
return component.element({ ...props, plugin });
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
getComponentSchema(integrationKey, componentKey) {
|
|
950
|
-
const plugin = this.getPluginInstance(integrationKey);
|
|
951
|
-
if (plugin) {
|
|
952
|
-
const component = plugin.components && plugin.components.find(
|
|
953
|
-
(c2) => c2.key.toLowerCase() === componentKey.toLowerCase()
|
|
954
|
-
);
|
|
955
|
-
if (component) {
|
|
956
|
-
return component.schema || {};
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
return {};
|
|
960
|
-
}
|
|
961
|
-
getScreen(integrationKey, screenPath) {
|
|
962
|
-
if (integrationKey) {
|
|
963
|
-
const plugin = this.getPluginInstance(integrationKey);
|
|
964
|
-
if (plugin) {
|
|
965
|
-
const component = plugin.screens && plugin.screens.find(
|
|
966
|
-
(s2) => s2.path.toLowerCase() === screenPath.toLowerCase()
|
|
967
|
-
);
|
|
968
|
-
if (!component) {
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
return component.element({ plugin });
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
getBoard(integrationKey, boardKey) {
|
|
976
|
-
if (integrationKey) {
|
|
977
|
-
const plugin = this.getPluginInstance(integrationKey);
|
|
978
|
-
if (plugin) {
|
|
979
|
-
const component = plugin.boards && plugin.boards.find(
|
|
980
|
-
(c2) => c2.key.toLowerCase() === boardKey.toLowerCase()
|
|
981
|
-
);
|
|
982
|
-
if (!component) {
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
return component.element({ plugin });
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
const api = new Api();
|
|
991
|
-
window.__dek_api = api;
|
|
992
|
-
function usePluginApi() {
|
|
993
|
-
return window.__dek_api;
|
|
994
|
-
}
|
|
995
|
-
function usePluginState(plugin, key, defaultValue) {
|
|
996
|
-
const state2 = useState(plugin);
|
|
997
|
-
let value;
|
|
998
|
-
if (state2 && state2[key]) {
|
|
999
|
-
value = state2[key];
|
|
1000
|
-
if (isJsonString(value)) {
|
|
1001
|
-
value = tryParseJson(value, defaultValue);
|
|
1002
|
-
}
|
|
1003
|
-
} else {
|
|
1004
|
-
value = defaultValue;
|
|
1005
|
-
}
|
|
1006
|
-
return [
|
|
1007
|
-
value,
|
|
1008
|
-
(newValue) => {
|
|
1009
|
-
if (typeof newValue === "object") {
|
|
1010
|
-
newValue = JSON.stringify(newValue);
|
|
1011
|
-
}
|
|
1012
|
-
setState(plugin, key, newValue);
|
|
1013
|
-
}
|
|
1014
|
-
];
|
|
1015
|
-
}
|
|
1016
|
-
function __debug() {
|
|
1017
|
-
}
|
|
1018
|
-
const dekPluginModule = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1019
|
-
__proto__: null,
|
|
1020
|
-
__debug,
|
|
1021
|
-
usePluginApi,
|
|
1022
|
-
usePluginState
|
|
1023
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1024
706
|
var _8 = Object.defineProperty;
|
|
1025
707
|
var P8 = (t2, r4, e4) => r4 in t2 ? _8(t2, r4, { enumerable: true, configurable: true, writable: true, value: e4 }) : t2[r4] = e4;
|
|
1026
708
|
var h0 = (t2, r4, e4) => (P8(t2, typeof r4 != "symbol" ? r4 + "" : r4, e4), e4);
|
|
@@ -42105,6 +41787,9 @@ var reactJsxParser_min = { exports: {} };
|
|
|
42105
41787
|
})(reactJsxParser_min);
|
|
42106
41788
|
var reactJsxParser_minExports = reactJsxParser_min.exports;
|
|
42107
41789
|
const JsxParser = /* @__PURE__ */ getDefaultExportFromCjs(reactJsxParser_minExports);
|
|
41790
|
+
function getPluginApi(integrationKey = "base") {
|
|
41791
|
+
return window.__dek_api_factory(integrationKey);
|
|
41792
|
+
}
|
|
42108
41793
|
function isNumeric(str) {
|
|
42109
41794
|
if (typeof str != "string") {
|
|
42110
41795
|
return false;
|
|
@@ -42141,7 +41826,7 @@ const parsePropsForComponent = (api2, props) => {
|
|
|
42141
41826
|
return finalProps;
|
|
42142
41827
|
};
|
|
42143
41828
|
const Zone = (props) => {
|
|
42144
|
-
const api2 =
|
|
41829
|
+
const api2 = getPluginApi();
|
|
42145
41830
|
let label = "";
|
|
42146
41831
|
if (props.id) {
|
|
42147
41832
|
label = `${props.id}`;
|
|
@@ -42234,8 +41919,7 @@ const LayoutRenderer = ({ layout }) => {
|
|
|
42234
41919
|
}
|
|
42235
41920
|
);
|
|
42236
41921
|
};
|
|
42237
|
-
const Board = ({ layout }) => {
|
|
42238
|
-
const api2 = usePluginApi();
|
|
41922
|
+
const Board = ({ api: api2, layout }) => {
|
|
42239
41923
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutRenderer, { layout: layout || api2.layout });
|
|
42240
41924
|
};
|
|
42241
41925
|
const e = Symbol(), t = Symbol(), r = "a", n = "w";
|
|
@@ -58211,6 +57895,407 @@ async function updateData(email, password, plugin) {
|
|
|
58211
57895
|
updateStateData(userData);
|
|
58212
57896
|
updateStateLoading(false);
|
|
58213
57897
|
}
|
|
57898
|
+
var __defProp2 = Object.defineProperty;
|
|
57899
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
57900
|
+
var __publicField2 = (obj, key, value) => {
|
|
57901
|
+
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
57902
|
+
return value;
|
|
57903
|
+
};
|
|
57904
|
+
function useEventCallback$1(fn2) {
|
|
57905
|
+
const ref = useRef$1(() => {
|
|
57906
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
57907
|
+
});
|
|
57908
|
+
useIsomorphicLayoutEffect$2(() => {
|
|
57909
|
+
ref.current = fn2;
|
|
57910
|
+
}, [fn2]);
|
|
57911
|
+
return useCallback((...args) => ref.current(...args), [ref]);
|
|
57912
|
+
}
|
|
57913
|
+
function useEventListener$1(eventName, handler, element, options) {
|
|
57914
|
+
const savedHandler = useRef$1(handler);
|
|
57915
|
+
useIsomorphicLayoutEffect$2(() => {
|
|
57916
|
+
savedHandler.current = handler;
|
|
57917
|
+
}, [handler]);
|
|
57918
|
+
useEffect$1(() => {
|
|
57919
|
+
var _a2;
|
|
57920
|
+
const targetElement = (_a2 = element === null || element === void 0 ? void 0 : element.current) !== null && _a2 !== void 0 ? _a2 : window;
|
|
57921
|
+
if (!(targetElement && targetElement.addEventListener))
|
|
57922
|
+
return;
|
|
57923
|
+
const listener = (event) => savedHandler.current(event);
|
|
57924
|
+
targetElement.addEventListener(eventName, listener, options);
|
|
57925
|
+
return () => {
|
|
57926
|
+
targetElement.removeEventListener(eventName, listener, options);
|
|
57927
|
+
};
|
|
57928
|
+
}, [eventName, element, options]);
|
|
57929
|
+
}
|
|
57930
|
+
const useIsomorphicLayoutEffect$2 = typeof window !== "undefined" ? useLayoutEffect$1 : useEffect$1;
|
|
57931
|
+
function useLocalStorage$1(key, initialValue) {
|
|
57932
|
+
const readValue = useCallback(() => {
|
|
57933
|
+
if (typeof window === "undefined") {
|
|
57934
|
+
return initialValue;
|
|
57935
|
+
}
|
|
57936
|
+
try {
|
|
57937
|
+
const item = window.localStorage.getItem(key);
|
|
57938
|
+
return item ? parseJSON$1(item) : initialValue;
|
|
57939
|
+
} catch (error2) {
|
|
57940
|
+
console.warn(`Error reading localStorage key “${key}”:`, error2);
|
|
57941
|
+
return initialValue;
|
|
57942
|
+
}
|
|
57943
|
+
}, [initialValue, key]);
|
|
57944
|
+
const [storedValue, setStoredValue] = useState$1(readValue);
|
|
57945
|
+
const setValue = useEventCallback$1((value) => {
|
|
57946
|
+
if (typeof window === "undefined") {
|
|
57947
|
+
console.warn(`Tried setting localStorage key “${key}” even though environment is not a client`);
|
|
57948
|
+
}
|
|
57949
|
+
try {
|
|
57950
|
+
const newValue = value instanceof Function ? value(storedValue) : value;
|
|
57951
|
+
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
57952
|
+
setStoredValue(newValue);
|
|
57953
|
+
window.dispatchEvent(new Event("local-storage"));
|
|
57954
|
+
} catch (error2) {
|
|
57955
|
+
console.warn(`Error setting localStorage key “${key}”:`, error2);
|
|
57956
|
+
}
|
|
57957
|
+
});
|
|
57958
|
+
useEffect$1(() => {
|
|
57959
|
+
setStoredValue(readValue());
|
|
57960
|
+
}, []);
|
|
57961
|
+
const handleStorageChange = useCallback((event) => {
|
|
57962
|
+
if ((event === null || event === void 0 ? void 0 : event.key) && event.key !== key) {
|
|
57963
|
+
return;
|
|
57964
|
+
}
|
|
57965
|
+
setStoredValue(readValue());
|
|
57966
|
+
}, [key, readValue]);
|
|
57967
|
+
useEventListener$1("storage", handleStorageChange);
|
|
57968
|
+
useEventListener$1("local-storage", handleStorageChange);
|
|
57969
|
+
return [storedValue, setValue];
|
|
57970
|
+
}
|
|
57971
|
+
function parseJSON$1(value) {
|
|
57972
|
+
try {
|
|
57973
|
+
return value === "undefined" ? void 0 : JSON.parse(value !== null && value !== void 0 ? value : "");
|
|
57974
|
+
} catch (_a2) {
|
|
57975
|
+
console.log("parsing error on", { value });
|
|
57976
|
+
return void 0;
|
|
57977
|
+
}
|
|
57978
|
+
}
|
|
57979
|
+
function extractErrorMessage$1(err) {
|
|
57980
|
+
return err instanceof Error ? err.message : JSON.stringify(err);
|
|
57981
|
+
}
|
|
57982
|
+
function setState(integrationKey, key, value) {
|
|
57983
|
+
const localData = getStateRoot(integrationKey);
|
|
57984
|
+
localData[key] = value;
|
|
57985
|
+
localStorage.setItem(
|
|
57986
|
+
`api:${integrationKey.toLowerCase()}`,
|
|
57987
|
+
JSON.stringify(localData)
|
|
57988
|
+
);
|
|
57989
|
+
window.dispatchEvent(new Event("local-storage"));
|
|
57990
|
+
}
|
|
57991
|
+
function getState(integrationKey, key) {
|
|
57992
|
+
const localData = getStateRoot(integrationKey);
|
|
57993
|
+
return localData[key];
|
|
57994
|
+
}
|
|
57995
|
+
function getStateRoot(integrationKey) {
|
|
57996
|
+
const local = localStorage.getItem(`api:${integrationKey.toLowerCase()}`);
|
|
57997
|
+
return tryParseJson(local || "{}");
|
|
57998
|
+
}
|
|
57999
|
+
function tryParseJson(jsonString, defaultValue = {}) {
|
|
58000
|
+
try {
|
|
58001
|
+
return JSON.parse(jsonString);
|
|
58002
|
+
} catch (err) {
|
|
58003
|
+
console.warn(`Failed parsing JSON: ${extractErrorMessage$1(err)}`);
|
|
58004
|
+
return defaultValue;
|
|
58005
|
+
}
|
|
58006
|
+
}
|
|
58007
|
+
function useState(plugin) {
|
|
58008
|
+
const [state2] = useLocalStorage$1(`api:${plugin.toLowerCase()}`, "{}");
|
|
58009
|
+
return state2;
|
|
58010
|
+
}
|
|
58011
|
+
function isJsonString(str) {
|
|
58012
|
+
if (typeof str !== "string") {
|
|
58013
|
+
return false;
|
|
58014
|
+
}
|
|
58015
|
+
if (str.length === 0) {
|
|
58016
|
+
return false;
|
|
58017
|
+
}
|
|
58018
|
+
if (str[0] !== "{" && str[0] !== "[") {
|
|
58019
|
+
return false;
|
|
58020
|
+
}
|
|
58021
|
+
if (str[str.length - 1] !== "}" && str[str.length - 1] !== "]") {
|
|
58022
|
+
return false;
|
|
58023
|
+
}
|
|
58024
|
+
return true;
|
|
58025
|
+
}
|
|
58026
|
+
class Api {
|
|
58027
|
+
constructor(integrationKey) {
|
|
58028
|
+
__publicField2(this, "integrationKey");
|
|
58029
|
+
this.integrationKey = integrationKey;
|
|
58030
|
+
}
|
|
58031
|
+
get internal() {
|
|
58032
|
+
return window.__dek_api;
|
|
58033
|
+
}
|
|
58034
|
+
trace(message, ...data) {
|
|
58035
|
+
this.internal.trace(this.integrationKey, message, ...data);
|
|
58036
|
+
}
|
|
58037
|
+
warn(message, ...data) {
|
|
58038
|
+
this.internal.warn(this.integrationKey, message, ...data);
|
|
58039
|
+
}
|
|
58040
|
+
error(message, ...data) {
|
|
58041
|
+
this.internal.error(this.integrationKey, message, ...data);
|
|
58042
|
+
}
|
|
58043
|
+
messages() {
|
|
58044
|
+
return this.internal.messages();
|
|
58045
|
+
}
|
|
58046
|
+
plugin(name) {
|
|
58047
|
+
return this.internal.plugin(name);
|
|
58048
|
+
}
|
|
58049
|
+
get registry() {
|
|
58050
|
+
return this.internal.registry;
|
|
58051
|
+
}
|
|
58052
|
+
get boardKey() {
|
|
58053
|
+
return this.internal.boardKey;
|
|
58054
|
+
}
|
|
58055
|
+
get boards() {
|
|
58056
|
+
return this.internal.boards;
|
|
58057
|
+
}
|
|
58058
|
+
get board() {
|
|
58059
|
+
return this.internal.board;
|
|
58060
|
+
}
|
|
58061
|
+
get layout() {
|
|
58062
|
+
return this.internal.layout;
|
|
58063
|
+
}
|
|
58064
|
+
get commandGroups() {
|
|
58065
|
+
return this.internal.commandGroups;
|
|
58066
|
+
}
|
|
58067
|
+
navigate(path) {
|
|
58068
|
+
this.internal.navigate(path);
|
|
58069
|
+
}
|
|
58070
|
+
get navigateParams() {
|
|
58071
|
+
return this.internal.navigateParams;
|
|
58072
|
+
}
|
|
58073
|
+
navigateBack() {
|
|
58074
|
+
this.internal.navigateBack();
|
|
58075
|
+
}
|
|
58076
|
+
open(boardKey) {
|
|
58077
|
+
this.internal.open(boardKey);
|
|
58078
|
+
}
|
|
58079
|
+
get plugins() {
|
|
58080
|
+
return this.internal.plugins;
|
|
58081
|
+
}
|
|
58082
|
+
get api() {
|
|
58083
|
+
return this.plugin(this.integrationKey).api;
|
|
58084
|
+
}
|
|
58085
|
+
get state() {
|
|
58086
|
+
return this.plugin(this.integrationKey).state;
|
|
58087
|
+
}
|
|
58088
|
+
get info() {
|
|
58089
|
+
return this.plugin(this.integrationKey).info;
|
|
58090
|
+
}
|
|
58091
|
+
component(key, props) {
|
|
58092
|
+
return this.plugin(this.integrationKey).component(key, props);
|
|
58093
|
+
}
|
|
58094
|
+
componentSchema(key) {
|
|
58095
|
+
return this.plugin(this.integrationKey).componentSchema(key);
|
|
58096
|
+
}
|
|
58097
|
+
screen(path) {
|
|
58098
|
+
return this.plugin(this.integrationKey).screen(path);
|
|
58099
|
+
}
|
|
58100
|
+
}
|
|
58101
|
+
class ApiInternal {
|
|
58102
|
+
trace(integrationKey, message, ...data) {
|
|
58103
|
+
console.log(`DEK-TRACE[${integrationKey}]: ${message}`, ...data);
|
|
58104
|
+
this.globals.messages.push({
|
|
58105
|
+
type: "trace",
|
|
58106
|
+
body: message,
|
|
58107
|
+
data,
|
|
58108
|
+
at: Date.now()
|
|
58109
|
+
});
|
|
58110
|
+
}
|
|
58111
|
+
warn(integrationKey, message, ...data) {
|
|
58112
|
+
console.warn(`DEK-WARN[${integrationKey}]: ${message}`, ...data);
|
|
58113
|
+
this.globals.messages.push({
|
|
58114
|
+
type: "error",
|
|
58115
|
+
body: message,
|
|
58116
|
+
data,
|
|
58117
|
+
at: Date.now()
|
|
58118
|
+
});
|
|
58119
|
+
}
|
|
58120
|
+
error(integrationKey, message, ...data) {
|
|
58121
|
+
console.error(`DEK-ERROR[${integrationKey}]: ${message}`, ...data);
|
|
58122
|
+
this.globals.messages.push({
|
|
58123
|
+
type: "error",
|
|
58124
|
+
body: message,
|
|
58125
|
+
data,
|
|
58126
|
+
at: Date.now()
|
|
58127
|
+
});
|
|
58128
|
+
}
|
|
58129
|
+
messages() {
|
|
58130
|
+
return this.globals.messages;
|
|
58131
|
+
}
|
|
58132
|
+
plugin(name) {
|
|
58133
|
+
return this.createPluginWrapper(name);
|
|
58134
|
+
}
|
|
58135
|
+
get registry() {
|
|
58136
|
+
return this.globals.registry;
|
|
58137
|
+
}
|
|
58138
|
+
get boardKey() {
|
|
58139
|
+
return this.globals.navigateParams.boardKey || "#error";
|
|
58140
|
+
}
|
|
58141
|
+
get boards() {
|
|
58142
|
+
return this.globals.boards;
|
|
58143
|
+
}
|
|
58144
|
+
get board() {
|
|
58145
|
+
return this.boards.find((board) => board.key === this.boardKey) || {
|
|
58146
|
+
zones: []
|
|
58147
|
+
};
|
|
58148
|
+
}
|
|
58149
|
+
get layout() {
|
|
58150
|
+
return this.board.layout || `<Screen><Text>Missing layout</Text></Screen>`;
|
|
58151
|
+
}
|
|
58152
|
+
get commandGroups() {
|
|
58153
|
+
return this.globals.commandGroups;
|
|
58154
|
+
}
|
|
58155
|
+
navigate(path) {
|
|
58156
|
+
this.globals.setLocation(`/${this.boardKey}${path}`);
|
|
58157
|
+
}
|
|
58158
|
+
get navigateParams() {
|
|
58159
|
+
return this.globals.navigateParams;
|
|
58160
|
+
}
|
|
58161
|
+
navigateBack() {
|
|
58162
|
+
history.back();
|
|
58163
|
+
}
|
|
58164
|
+
open(boardKey) {
|
|
58165
|
+
this.globals.setLocation(`/${boardKey}`);
|
|
58166
|
+
}
|
|
58167
|
+
createPluginWrapper(integrationKey) {
|
|
58168
|
+
const plugin = this.getPluginInstance(integrationKey);
|
|
58169
|
+
const available = !!plugin;
|
|
58170
|
+
return {
|
|
58171
|
+
available,
|
|
58172
|
+
info: {
|
|
58173
|
+
components: (plugin == null ? void 0 : plugin.components) ? plugin.components.map((component) => component.key) : [],
|
|
58174
|
+
screens: (plugin == null ? void 0 : plugin.screens) ? plugin.screens.map((screen) => screen.path) : []
|
|
58175
|
+
},
|
|
58176
|
+
component: (key, props) => this.getComponent(integrationKey, key, props),
|
|
58177
|
+
componentSchema: (key) => this.getComponentSchema(integrationKey, key),
|
|
58178
|
+
screen: (path) => this.getScreen(integrationKey, path),
|
|
58179
|
+
board: (key) => this.getBoard(integrationKey, key),
|
|
58180
|
+
api: (plugin == null ? void 0 : plugin.api) || {},
|
|
58181
|
+
state: {
|
|
58182
|
+
get: (key, defaultValue) => {
|
|
58183
|
+
if (!available) {
|
|
58184
|
+
return defaultValue;
|
|
58185
|
+
}
|
|
58186
|
+
return getState(integrationKey, key) || defaultValue;
|
|
58187
|
+
},
|
|
58188
|
+
set: (key, value) => {
|
|
58189
|
+
if (!available) {
|
|
58190
|
+
return;
|
|
58191
|
+
}
|
|
58192
|
+
setState(integrationKey, key, value);
|
|
58193
|
+
}
|
|
58194
|
+
}
|
|
58195
|
+
};
|
|
58196
|
+
}
|
|
58197
|
+
get globals() {
|
|
58198
|
+
return window.__dek_globals;
|
|
58199
|
+
}
|
|
58200
|
+
get plugins() {
|
|
58201
|
+
const plugins = {};
|
|
58202
|
+
Object.keys(this.globals.pluginInstances).forEach((key) => {
|
|
58203
|
+
plugins[key] = this.createPluginWrapper(key);
|
|
58204
|
+
});
|
|
58205
|
+
return plugins;
|
|
58206
|
+
}
|
|
58207
|
+
getPluginInstance(integrationKey) {
|
|
58208
|
+
return this.globals.pluginInstances[integrationKey];
|
|
58209
|
+
}
|
|
58210
|
+
getComponent(integrationKey, componentKey, props) {
|
|
58211
|
+
const plugin = this.getPluginInstance(integrationKey);
|
|
58212
|
+
if (plugin) {
|
|
58213
|
+
const component = plugin.components && plugin.components.find(
|
|
58214
|
+
(c2) => c2.key.toLowerCase() === componentKey.toLowerCase()
|
|
58215
|
+
);
|
|
58216
|
+
if (!component) {
|
|
58217
|
+
return;
|
|
58218
|
+
}
|
|
58219
|
+
return component.element({
|
|
58220
|
+
...props,
|
|
58221
|
+
plugin,
|
|
58222
|
+
api: new Api(integrationKey)
|
|
58223
|
+
});
|
|
58224
|
+
}
|
|
58225
|
+
}
|
|
58226
|
+
getComponentSchema(integrationKey, componentKey) {
|
|
58227
|
+
const plugin = this.getPluginInstance(integrationKey);
|
|
58228
|
+
if (plugin) {
|
|
58229
|
+
const component = plugin.components && plugin.components.find(
|
|
58230
|
+
(c2) => c2.key.toLowerCase() === componentKey.toLowerCase()
|
|
58231
|
+
);
|
|
58232
|
+
if (component) {
|
|
58233
|
+
return component.schema || {};
|
|
58234
|
+
}
|
|
58235
|
+
}
|
|
58236
|
+
return {};
|
|
58237
|
+
}
|
|
58238
|
+
getScreen(integrationKey, screenPath) {
|
|
58239
|
+
if (integrationKey) {
|
|
58240
|
+
const plugin = this.getPluginInstance(integrationKey);
|
|
58241
|
+
if (plugin) {
|
|
58242
|
+
const component = plugin.screens && plugin.screens.find(
|
|
58243
|
+
(s2) => s2.path.toLowerCase() === screenPath.toLowerCase()
|
|
58244
|
+
);
|
|
58245
|
+
if (!component) {
|
|
58246
|
+
return;
|
|
58247
|
+
}
|
|
58248
|
+
return component.element({ plugin, api: new Api(integrationKey) });
|
|
58249
|
+
}
|
|
58250
|
+
}
|
|
58251
|
+
}
|
|
58252
|
+
getBoard(integrationKey, boardKey) {
|
|
58253
|
+
if (integrationKey) {
|
|
58254
|
+
const plugin = this.getPluginInstance(integrationKey);
|
|
58255
|
+
if (plugin) {
|
|
58256
|
+
const component = plugin.boards && plugin.boards.find(
|
|
58257
|
+
(c2) => c2.key.toLowerCase() === boardKey.toLowerCase()
|
|
58258
|
+
);
|
|
58259
|
+
if (!component) {
|
|
58260
|
+
return;
|
|
58261
|
+
}
|
|
58262
|
+
return component.element({ plugin, api: new Api(integrationKey) });
|
|
58263
|
+
}
|
|
58264
|
+
}
|
|
58265
|
+
}
|
|
58266
|
+
}
|
|
58267
|
+
const api = new ApiInternal();
|
|
58268
|
+
window.__dek_api = api;
|
|
58269
|
+
window.__dek_api_factory = (integrationKey) => new Api(integrationKey);
|
|
58270
|
+
function usePluginState(api2, key, defaultValue) {
|
|
58271
|
+
const integrationKey = api2.integrationKey;
|
|
58272
|
+
const state2 = useState(integrationKey);
|
|
58273
|
+
let value;
|
|
58274
|
+
if (state2 && state2[key]) {
|
|
58275
|
+
value = state2[key];
|
|
58276
|
+
if (isJsonString(value)) {
|
|
58277
|
+
value = tryParseJson(value, defaultValue);
|
|
58278
|
+
}
|
|
58279
|
+
} else {
|
|
58280
|
+
value = defaultValue;
|
|
58281
|
+
}
|
|
58282
|
+
return [
|
|
58283
|
+
value,
|
|
58284
|
+
(newValue) => {
|
|
58285
|
+
if (typeof newValue === "object") {
|
|
58286
|
+
newValue = JSON.stringify(newValue);
|
|
58287
|
+
}
|
|
58288
|
+
setState(integrationKey, key, newValue);
|
|
58289
|
+
}
|
|
58290
|
+
];
|
|
58291
|
+
}
|
|
58292
|
+
function __debug() {
|
|
58293
|
+
}
|
|
58294
|
+
const dekPluginModule = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
58295
|
+
__proto__: null,
|
|
58296
|
+
__debug,
|
|
58297
|
+
usePluginState
|
|
58298
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
58214
58299
|
const USER_PLUGIN_AND_INTEGRATIONS_QUERY = gql(`
|
|
58215
58300
|
query userPluginsAndIntegrations {
|
|
58216
58301
|
currentUser {
|
|
@@ -58240,7 +58325,7 @@ async function fetchUserPlugins(email, password) {
|
|
|
58240
58325
|
result.integrations.push({
|
|
58241
58326
|
key: "base",
|
|
58242
58327
|
pluginName: "base",
|
|
58243
|
-
pluginVersion: "0.
|
|
58328
|
+
pluginVersion: "0.11.0",
|
|
58244
58329
|
pluginConfig: []
|
|
58245
58330
|
});
|
|
58246
58331
|
return result;
|
|
@@ -58353,7 +58438,7 @@ const WeatherIcon = ({ type }) => {
|
|
|
58353
58438
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container$9, { "aria-label": "weather-icon", $top: info.top, $left: info.left, children: info.element });
|
|
58354
58439
|
};
|
|
58355
58440
|
const WeatherComponent = () => {
|
|
58356
|
-
const api2 =
|
|
58441
|
+
const api2 = getPluginApi();
|
|
58357
58442
|
const entities = useEntities();
|
|
58358
58443
|
const [weatherData, setWeatherData] = React__default.useState();
|
|
58359
58444
|
const data = transformWeatherData(entities["weather.forecast_home"]);
|
|
@@ -58415,16 +58500,15 @@ const Header = ({ height = 70 }) => {
|
|
|
58415
58500
|
};
|
|
58416
58501
|
const About = () => {
|
|
58417
58502
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(x0, { padding: 20, direction: "vert", children: [
|
|
58418
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(hF1, { children: `Dek ${"0.
|
|
58503
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(hF1, { children: `Dek ${"0.11.0"}` }),
|
|
58419
58504
|
/* @__PURE__ */ jsxRuntimeExports.jsx(X4, { children: "From Appkit" })
|
|
58420
58505
|
] });
|
|
58421
58506
|
};
|
|
58422
|
-
const Backgrounds = () => {
|
|
58423
|
-
const [backgroundKey] = usePluginState(
|
|
58507
|
+
const Backgrounds = ({ api: api2 }) => {
|
|
58508
|
+
const [backgroundKey] = usePluginState(api2, "backgroundKey", "image");
|
|
58424
58509
|
const propsKey = `backgroundProps-${backgroundKey}`;
|
|
58425
|
-
const [backgroundProps] = usePluginState(
|
|
58510
|
+
const [backgroundProps] = usePluginState(api2, propsKey, {});
|
|
58426
58511
|
const [selectedKey, setSelectedKey] = useState$1(backgroundKey);
|
|
58427
|
-
const api2 = usePluginApi();
|
|
58428
58512
|
const backgrounds = api2.registry.collection("backgrounds");
|
|
58429
58513
|
const backgroundItems = backgrounds.items;
|
|
58430
58514
|
const backgroundPropsSchema = backgroundItems[selectedKey].props;
|
|
@@ -58522,8 +58606,7 @@ const Backgrounds = () => {
|
|
|
58522
58606
|
}) })
|
|
58523
58607
|
] });
|
|
58524
58608
|
};
|
|
58525
|
-
const Boards = () => {
|
|
58526
|
-
const api2 = usePluginApi();
|
|
58609
|
+
const Boards = ({ api: api2 }) => {
|
|
58527
58610
|
const boards = api2.boards;
|
|
58528
58611
|
console.log("boards", boards);
|
|
58529
58612
|
const openBoard = (boardKey) => {
|
|
@@ -58541,8 +58624,7 @@ const Boards = () => {
|
|
|
58541
58624
|
) }, key)) })
|
|
58542
58625
|
] });
|
|
58543
58626
|
};
|
|
58544
|
-
const Messages = () => {
|
|
58545
|
-
const api2 = usePluginApi();
|
|
58627
|
+
const Messages = ({ api: api2 }) => {
|
|
58546
58628
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(x0, { direction: "vert", vscroll: "auto", paddingTop: 20, children: api2.messages().map((msg, idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
58547
58629
|
X4,
|
|
58548
58630
|
{
|
|
@@ -58553,8 +58635,7 @@ const Messages = () => {
|
|
|
58553
58635
|
idx
|
|
58554
58636
|
)) });
|
|
58555
58637
|
};
|
|
58556
|
-
const PluginDev = () => {
|
|
58557
|
-
const api2 = usePluginApi();
|
|
58638
|
+
const PluginDev = ({ api: api2 }) => {
|
|
58558
58639
|
const plugin = api2.plugin("plugin");
|
|
58559
58640
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(x0, { children: [
|
|
58560
58641
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(x0, { padding: 20, collapse: true, direction: "vert", children: [
|
|
@@ -58588,9 +58669,9 @@ const PluginDev = () => {
|
|
|
58588
58669
|
) })
|
|
58589
58670
|
] });
|
|
58590
58671
|
};
|
|
58591
|
-
const Theme = () => {
|
|
58672
|
+
const Theme = ({ api: api2 }) => {
|
|
58592
58673
|
const [selectedKey, setSelectedKey] = useState$1("tile");
|
|
58593
|
-
const [themeState, setThemeState] = usePluginState(
|
|
58674
|
+
const [themeState, setThemeState] = usePluginState(api2, "theme", {});
|
|
58594
58675
|
const handleSelection = (key) => {
|
|
58595
58676
|
setSelectedKey(key);
|
|
58596
58677
|
};
|
|
@@ -58669,8 +58750,7 @@ const Theme = () => {
|
|
|
58669
58750
|
] })
|
|
58670
58751
|
] });
|
|
58671
58752
|
};
|
|
58672
|
-
const SettingsScreen = ({ isPluginDev }) => {
|
|
58673
|
-
const api2 = usePluginApi();
|
|
58753
|
+
const SettingsScreen = ({ api: api2, isPluginDev }) => {
|
|
58674
58754
|
const isPrivatePluginDev = !isPluginDev && api2.plugin("plugin").available;
|
|
58675
58755
|
const [selectedKey, setSelectedKey] = useState$1(
|
|
58676
58756
|
isPluginDev ? "plugin-dev" : "boards"
|
|
@@ -58719,18 +58799,18 @@ const SettingsScreen = ({ isPluginDev }) => {
|
|
|
58719
58799
|
initialKey: selectedKey
|
|
58720
58800
|
}
|
|
58721
58801
|
),
|
|
58722
|
-
selectedKey === "plugin-dev" && /* @__PURE__ */ jsxRuntimeExports.jsx(PluginDev, {}),
|
|
58723
|
-
selectedKey === "backgrounds" && /* @__PURE__ */ jsxRuntimeExports.jsx(Backgrounds, {}),
|
|
58724
|
-
selectedKey === "theme" && /* @__PURE__ */ jsxRuntimeExports.jsx(Theme, {}),
|
|
58725
|
-
selectedKey === "messages" && /* @__PURE__ */ jsxRuntimeExports.jsx(Messages, {}),
|
|
58802
|
+
selectedKey === "plugin-dev" && /* @__PURE__ */ jsxRuntimeExports.jsx(PluginDev, { api: api2 }),
|
|
58803
|
+
selectedKey === "backgrounds" && /* @__PURE__ */ jsxRuntimeExports.jsx(Backgrounds, { api: api2 }),
|
|
58804
|
+
selectedKey === "theme" && /* @__PURE__ */ jsxRuntimeExports.jsx(Theme, { api: api2 }),
|
|
58805
|
+
selectedKey === "messages" && /* @__PURE__ */ jsxRuntimeExports.jsx(Messages, { api: api2 }),
|
|
58726
58806
|
selectedKey === "about" && /* @__PURE__ */ jsxRuntimeExports.jsx(About, {}),
|
|
58727
|
-
selectedKey === "boards" && /* @__PURE__ */ jsxRuntimeExports.jsx(Boards, {})
|
|
58807
|
+
selectedKey === "boards" && /* @__PURE__ */ jsxRuntimeExports.jsx(Boards, { api: api2 })
|
|
58728
58808
|
] }),
|
|
58729
58809
|
/* @__PURE__ */ jsxRuntimeExports.jsx(_G1, { title, noclose: isPluginDev })
|
|
58730
58810
|
] });
|
|
58731
58811
|
};
|
|
58732
|
-
const DevBoard = () => {
|
|
58733
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsScreen, { isPluginDev: true });
|
|
58812
|
+
const DevBoard = (props) => {
|
|
58813
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsScreen, { isPluginDev: true, ...props });
|
|
58734
58814
|
};
|
|
58735
58815
|
const EmptyBoard = () => {
|
|
58736
58816
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(OG1, { overlay: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(x0, { paddingTop: 100, paddingHorz: 20, collapse: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -58744,8 +58824,8 @@ const EmptyBoard = () => {
|
|
|
58744
58824
|
}
|
|
58745
58825
|
) }) });
|
|
58746
58826
|
};
|
|
58747
|
-
const MainBoard = () => {
|
|
58748
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Board, {});
|
|
58827
|
+
const MainBoard = (props) => {
|
|
58828
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Board, { ...props });
|
|
58749
58829
|
};
|
|
58750
58830
|
//! moment.js
|
|
58751
58831
|
//! version : 2.29.4
|
|
@@ -62713,8 +62793,7 @@ const greetings = {
|
|
|
62713
62793
|
"Time to rest"
|
|
62714
62794
|
]
|
|
62715
62795
|
};
|
|
62716
|
-
const Greeting = () => {
|
|
62717
|
-
const api2 = usePluginApi();
|
|
62796
|
+
const Greeting = ({ api: api2 }) => {
|
|
62718
62797
|
const calendarPlugin = api2.plugin("calendar");
|
|
62719
62798
|
const events2 = calendarPlugin.api.useEvents();
|
|
62720
62799
|
const getGreeting = () => {
|
|
@@ -63027,8 +63106,7 @@ const ImageBackground = ({ itemKey = "fibre", opacity }) => {
|
|
|
63027
63106
|
opacity = opacity === void 0 ? background.opacity : opacity;
|
|
63028
63107
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container$3, { "aria-label": "background", $imageUrl: background.uri, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Overlay, { $opacity: opacity || 0 }) });
|
|
63029
63108
|
};
|
|
63030
|
-
const AboutScreen = () => {
|
|
63031
|
-
const api2 = usePluginApi();
|
|
63109
|
+
const AboutScreen = ({ api: api2 }) => {
|
|
63032
63110
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(OG1, { overlay: true, children: [
|
|
63033
63111
|
/* @__PURE__ */ jsxRuntimeExports.jsx(_G1, { title: "About" }),
|
|
63034
63112
|
/* @__PURE__ */ jsxRuntimeExports.jsx(x0, { paddingTop: 100, paddingHorz: 20, collapse: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -89651,9 +89729,8 @@ var _default = lib.default = ace_1.default;
|
|
|
89651
89729
|
const AceEditorStyled = styled(_default)`
|
|
89652
89730
|
background: #ffffff66;
|
|
89653
89731
|
`;
|
|
89654
|
-
const ComponentScreen = () => {
|
|
89732
|
+
const ComponentScreen = ({ api: api2 }) => {
|
|
89655
89733
|
const params = useParams();
|
|
89656
|
-
const api2 = usePluginApi();
|
|
89657
89734
|
const [propsString, setPropsString] = useLocalStorage(
|
|
89658
89735
|
"component-" + params.componentKey,
|
|
89659
89736
|
""
|
|
@@ -89948,15 +90025,15 @@ let Plugin$2 = class Plugin {
|
|
|
89948
90025
|
return [
|
|
89949
90026
|
{
|
|
89950
90027
|
path: "/settings",
|
|
89951
|
-
element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsScreen, {})
|
|
90028
|
+
element: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsScreen, { ...props })
|
|
89952
90029
|
},
|
|
89953
90030
|
{
|
|
89954
90031
|
path: "/about",
|
|
89955
|
-
element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(AboutScreen, {})
|
|
90032
|
+
element: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(AboutScreen, { ...props })
|
|
89956
90033
|
},
|
|
89957
90034
|
{
|
|
89958
90035
|
path: "/dev/component/:componentKey",
|
|
89959
|
-
element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentScreen, {})
|
|
90036
|
+
element: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentScreen, { ...props })
|
|
89960
90037
|
}
|
|
89961
90038
|
];
|
|
89962
90039
|
}
|
|
@@ -89988,11 +90065,11 @@ let Plugin$2 = class Plugin {
|
|
|
89988
90065
|
return [
|
|
89989
90066
|
{
|
|
89990
90067
|
key: "main",
|
|
89991
|
-
element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(MainBoard, {})
|
|
90068
|
+
element: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(MainBoard, { ...props })
|
|
89992
90069
|
},
|
|
89993
90070
|
{
|
|
89994
90071
|
key: "dev",
|
|
89995
|
-
element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(DevBoard, {})
|
|
90072
|
+
element: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(DevBoard, { ...props })
|
|
89996
90073
|
},
|
|
89997
90074
|
{
|
|
89998
90075
|
key: "empty",
|
|
@@ -93607,13 +93684,13 @@ const ControlSpacer = styled.div`
|
|
|
93607
93684
|
styled(x0)`
|
|
93608
93685
|
color: red;
|
|
93609
93686
|
`;
|
|
93610
|
-
const MediaView = ({ entityId, showLargeContent = false }) => {
|
|
93687
|
+
const MediaView = ({ api: api2, entityId, showLargeContent = false }) => {
|
|
93611
93688
|
const entity = useEntity(entityId);
|
|
93612
93689
|
const [loading, setLoading] = useState$1(false);
|
|
93613
93690
|
const [coverArtUrl, setCoverArtUrl] = useState$1("");
|
|
93614
93691
|
const [playingState, setPLayingState] = useState$1("");
|
|
93615
93692
|
const [lastAlbumArt, setLastAlbumArt] = usePluginState(
|
|
93616
|
-
|
|
93693
|
+
api2,
|
|
93617
93694
|
"last-album-art",
|
|
93618
93695
|
""
|
|
93619
93696
|
);
|
|
@@ -93799,14 +93876,14 @@ function constructPluginInstance(integration, plugin, pluginConfig = {}) {
|
|
|
93799
93876
|
}
|
|
93800
93877
|
return new plugin(pluginConfigMerged, registry);
|
|
93801
93878
|
}
|
|
93802
|
-
async function initializePluginInstance(pluginInstance) {
|
|
93879
|
+
async function initializePluginInstance(pluginInstance, integrationKey) {
|
|
93803
93880
|
if (pluginInstance && pluginInstance.load) {
|
|
93804
|
-
await pluginInstance.load(
|
|
93881
|
+
await pluginInstance.load(getPluginApi(integrationKey));
|
|
93805
93882
|
}
|
|
93806
93883
|
}
|
|
93807
93884
|
async function initializePluginInstances() {
|
|
93808
93885
|
for (const key of Object.keys(loadedDekPluginInstances)) {
|
|
93809
|
-
await initializePluginInstance(loadedDekPluginInstances[key]);
|
|
93886
|
+
await initializePluginInstance(loadedDekPluginInstances[key], key);
|
|
93810
93887
|
}
|
|
93811
93888
|
}
|
|
93812
93889
|
async function loadPlugins({
|
|
@@ -93887,9 +93964,9 @@ async function unloadPlugins() {
|
|
|
93887
93964
|
async function updateLocalPlugin(plugin, pluginConfig) {
|
|
93888
93965
|
updateStateLoading(true);
|
|
93889
93966
|
const integration = {
|
|
93890
|
-
pluginName: "
|
|
93967
|
+
pluginName: "plugin",
|
|
93891
93968
|
pluginVersion: "latest",
|
|
93892
|
-
key: "
|
|
93969
|
+
key: "plugin",
|
|
93893
93970
|
pluginConfig: []
|
|
93894
93971
|
};
|
|
93895
93972
|
loadedLocalPlugin = plugin;
|
|
@@ -93899,7 +93976,7 @@ async function updateLocalPlugin(plugin, pluginConfig) {
|
|
|
93899
93976
|
pluginConfig
|
|
93900
93977
|
);
|
|
93901
93978
|
if (loadedLocalPluginInstance && loadedLocalPluginInstance.load) {
|
|
93902
|
-
await loadedLocalPluginInstance.load(
|
|
93979
|
+
await loadedLocalPluginInstance.load(getPluginApi("plugin"));
|
|
93903
93980
|
}
|
|
93904
93981
|
updateStatePlugins(getAllPlugins(), getAllPluginInstances());
|
|
93905
93982
|
updateStateLoading(false);
|
|
@@ -93943,10 +94020,10 @@ function useUserConfig(email, password, plugin, pluginConfig) {
|
|
|
93943
94020
|
return userConfig;
|
|
93944
94021
|
}
|
|
93945
94022
|
const Background = () => {
|
|
93946
|
-
const api2 =
|
|
93947
|
-
const [backgroundKey] = usePluginState(
|
|
94023
|
+
const api2 = getPluginApi();
|
|
94024
|
+
const [backgroundKey] = usePluginState(api2, "backgroundKey", "image");
|
|
93948
94025
|
const propsKey = `backgroundProps-${backgroundKey}`;
|
|
93949
|
-
const [backgroundProps] = usePluginState(
|
|
94026
|
+
const [backgroundProps] = usePluginState(api2, propsKey, {});
|
|
93950
94027
|
const backgrounds = api2.registry.collection("backgrounds");
|
|
93951
94028
|
if (backgrounds && backgrounds.items && backgrounds.items[backgroundKey]) {
|
|
93952
94029
|
return backgrounds.items[backgroundKey].component(backgroundProps);
|
|
@@ -94889,7 +94966,7 @@ SwitchTransition.defaultProps = {
|
|
|
94889
94966
|
};
|
|
94890
94967
|
const SwitchTransition$1 = SwitchTransition;
|
|
94891
94968
|
const RouteResolver = ({ route }) => {
|
|
94892
|
-
const api2 =
|
|
94969
|
+
const api2 = getPluginApi();
|
|
94893
94970
|
const resolveRouteElement = (route2) => {
|
|
94894
94971
|
if (route2.type === "screen") {
|
|
94895
94972
|
return api2.plugin(route2.plugin).screen(route2.path);
|
|
@@ -95128,7 +95205,8 @@ body {
|
|
|
95128
95205
|
|
|
95129
95206
|
`;
|
|
95130
95207
|
const BoardStyles = ({ transitionDelay: transitionDelay2 }) => {
|
|
95131
|
-
const
|
|
95208
|
+
const api2 = getPluginApi();
|
|
95209
|
+
const [themeState] = usePluginState(api2, "theme", {});
|
|
95132
95210
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
95133
95211
|
/* @__PURE__ */ jsxRuntimeExports.jsx(wG1, {}),
|
|
95134
95212
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -95162,7 +95240,7 @@ const CommandItem = styled.div`
|
|
|
95162
95240
|
margin-top: 10px;
|
|
95163
95241
|
`;
|
|
95164
95242
|
const CommandGroup = ({ groupKey }) => {
|
|
95165
|
-
const api2 =
|
|
95243
|
+
const api2 = getPluginApi();
|
|
95166
95244
|
const group = api2.commandGroups.find(
|
|
95167
95245
|
(g) => g.key == groupKey
|
|
95168
95246
|
);
|