@dashadmin/dash-boilerplate 1.3.25 → 1.3.28
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/README.md +35 -0
- package/dist/index.cjs +1234 -0
- package/dist/index.js +871 -534
- package/package.json +55 -57
- package/dist/components/AppWrapperLight.js +0 -5
- package/dist/components/CustomErrorBoundary.js +0 -1
- package/dist/components/DefaultFallbacks.js +0 -1
- package/dist/components/GlobalSmallLoader.js +0 -55
- package/dist/components/index.js +0 -1
- package/dist/i18n/I18nBridgeProviderLight.js +0 -1
- package/dist/i18n/createSimpleI18nProvider.js +0 -1
- package/dist/i18n/index.js +0 -1
- package/dist/i18n/types.js +0 -0
- package/dist/theme/DashThemeProviderLight.js +0 -1
- package/dist/theme/index.js +0 -1
- package/dist/utils/DashBootstrapUtils.js +0 -1
- package/dist/utils/cssVariables.js +0 -1
- package/dist/utils/electronStore.js +0 -1
- package/dist/utils/index.js +0 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
+
};
|
|
41
|
+
var __copyProps = (to, from, except, desc) => {
|
|
42
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
+
for (let key of __getOwnPropNames(from))
|
|
44
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
+
}
|
|
47
|
+
return to;
|
|
48
|
+
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
57
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
59
|
+
var __async = (__this, __arguments, generator) => {
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
var fulfilled = (value) => {
|
|
62
|
+
try {
|
|
63
|
+
step(generator.next(value));
|
|
64
|
+
} catch (e) {
|
|
65
|
+
reject(e);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var rejected = (value) => {
|
|
69
|
+
try {
|
|
70
|
+
step(generator.throw(value));
|
|
71
|
+
} catch (e) {
|
|
72
|
+
reject(e);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
76
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/index.ts
|
|
81
|
+
var index_exports = {};
|
|
82
|
+
__export(index_exports, {
|
|
83
|
+
AppWrapperLight: () => AppWrapperLight,
|
|
84
|
+
CustomErrorBoundary: () => CustomErrorBoundary,
|
|
85
|
+
DEFAULT_LAYOUT_DIMENSIONS: () => DEFAULT_LAYOUT_DIMENSIONS,
|
|
86
|
+
DashThemeContext: () => DashThemeContext,
|
|
87
|
+
DashThemeProviderLight: () => DashThemeProviderLight,
|
|
88
|
+
DefaultAppLoadErrorFallback: () => DefaultAppLoadErrorFallback,
|
|
89
|
+
DefaultInitializationErrorFallback: () => DefaultInitializationErrorFallback,
|
|
90
|
+
GlobalLoaderHtmlMarkup: () => GlobalLoaderHtmlMarkup,
|
|
91
|
+
GlobalSmallLoader: () => GlobalSmallLoader,
|
|
92
|
+
I18nBridgeContext: () => I18nBridgeContext,
|
|
93
|
+
I18nBridgeProviderLight: () => I18nBridgeProviderLight,
|
|
94
|
+
createDefaultPanelSettings: () => createDefaultPanelSettings,
|
|
95
|
+
createLazyAppLoader: () => createLazyAppLoader,
|
|
96
|
+
createSimpleI18nProvider: () => createSimpleI18nProvider,
|
|
97
|
+
getCssVariableNumber: () => getCssVariableNumber2,
|
|
98
|
+
getCssVariableString: () => getCssVariableString,
|
|
99
|
+
getElectronStoreValue: () => getElectronStoreValue,
|
|
100
|
+
getLayoutDimensionsFromCss: () => getLayoutDimensionsFromCss,
|
|
101
|
+
initializeThemeEarly: () => initializeThemeEarly,
|
|
102
|
+
injectCriticalStyles: () => injectCriticalStyles,
|
|
103
|
+
isElectron: () => isElectron,
|
|
104
|
+
setElectronStoreValue: () => setElectronStoreValue,
|
|
105
|
+
syncElectronStore: () => syncElectronStore,
|
|
106
|
+
syncElectronStoreToLocalStorage: () => syncElectronStoreToLocalStorage,
|
|
107
|
+
useAppInitialization: () => useAppInitialization,
|
|
108
|
+
useBridgedChangeLocaleLight: () => useBridgedChangeLocaleLight,
|
|
109
|
+
useBridgedLocaleLight: () => useBridgedLocaleLight,
|
|
110
|
+
useBridgedLocalesLight: () => useBridgedLocalesLight,
|
|
111
|
+
useDashThemeContextLight: () => useDashThemeContextLight,
|
|
112
|
+
useEarlyThemeInit: () => useEarlyThemeInit,
|
|
113
|
+
useI18nBridgeLight: () => useI18nBridgeLight,
|
|
114
|
+
useInitializeReduxFromPersisted: () => useInitializeReduxFromPersisted,
|
|
115
|
+
useLogoutEventListener: () => useLogoutEventListener,
|
|
116
|
+
usePathnameTracker: () => usePathnameTracker,
|
|
117
|
+
usePendingRedirect: () => usePendingRedirect,
|
|
118
|
+
useTranslateLight: () => useTranslateLight,
|
|
119
|
+
useUrlLocaleDetection: () => useUrlLocaleDetection
|
|
120
|
+
});
|
|
121
|
+
module.exports = __toCommonJS(index_exports);
|
|
122
|
+
|
|
123
|
+
// src/i18n/createSimpleI18nProvider.ts
|
|
124
|
+
var getNestedValue = (obj, path) => {
|
|
125
|
+
return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
|
|
126
|
+
};
|
|
127
|
+
var interpolate = (text, options) => {
|
|
128
|
+
if (!options || !text) return text;
|
|
129
|
+
return Object.keys(options).reduce((acc, key) => {
|
|
130
|
+
return acc.replace(new RegExp(`%\\{${key}\\}`, "g"), String(options[key]));
|
|
131
|
+
}, text);
|
|
132
|
+
};
|
|
133
|
+
var defaultLocales = [
|
|
134
|
+
{ locale: "en", name: "English" },
|
|
135
|
+
{ locale: "es", name: "Espa\xF1ol" }
|
|
136
|
+
];
|
|
137
|
+
var createSimpleI18nProvider = (options) => {
|
|
138
|
+
const {
|
|
139
|
+
translations,
|
|
140
|
+
initialLocale = "es",
|
|
141
|
+
fallbackLocale = "en",
|
|
142
|
+
locales = defaultLocales,
|
|
143
|
+
onLocaleChange
|
|
144
|
+
} = options;
|
|
145
|
+
let currentLocale = initialLocale;
|
|
146
|
+
const translate = (key, interpolationOptions) => {
|
|
147
|
+
const messages = translations[currentLocale] || translations[fallbackLocale] || {};
|
|
148
|
+
const text = getNestedValue(messages, key);
|
|
149
|
+
if (typeof text === "string") {
|
|
150
|
+
return interpolate(text, interpolationOptions);
|
|
151
|
+
}
|
|
152
|
+
if (currentLocale !== fallbackLocale) {
|
|
153
|
+
const fallbackMessages = translations[fallbackLocale] || {};
|
|
154
|
+
const fallbackText = getNestedValue(fallbackMessages, key);
|
|
155
|
+
if (typeof fallbackText === "string") {
|
|
156
|
+
return interpolate(fallbackText, interpolationOptions);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return key;
|
|
160
|
+
};
|
|
161
|
+
const changeLocale = (newLocale) => __async(null, null, function* () {
|
|
162
|
+
if (translations[newLocale]) {
|
|
163
|
+
currentLocale = newLocale;
|
|
164
|
+
localStorage.setItem("dash-user-locale", newLocale);
|
|
165
|
+
onLocaleChange == null ? void 0 : onLocaleChange(newLocale);
|
|
166
|
+
return Promise.resolve();
|
|
167
|
+
}
|
|
168
|
+
return Promise.reject(new Error(`Locale '${newLocale}' not found`));
|
|
169
|
+
});
|
|
170
|
+
const getLocale = () => currentLocale;
|
|
171
|
+
const getLocales = () => locales;
|
|
172
|
+
const getMessages = (locale) => {
|
|
173
|
+
return translations[locale] || {};
|
|
174
|
+
};
|
|
175
|
+
return {
|
|
176
|
+
translate,
|
|
177
|
+
changeLocale,
|
|
178
|
+
getLocale,
|
|
179
|
+
getLocales,
|
|
180
|
+
getMessages
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// src/i18n/I18nBridgeProviderLight.tsx
|
|
185
|
+
var import_react = require("react");
|
|
186
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
187
|
+
var LOCALE_CHANGE_EVENT = "dash:locale-change";
|
|
188
|
+
var defaultContextValue = {
|
|
189
|
+
i18nProvider: null,
|
|
190
|
+
locale: "es",
|
|
191
|
+
setI18nProvider: () => {
|
|
192
|
+
},
|
|
193
|
+
setLocale: () => {
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
var I18nBridgeContext = (0, import_react.createContext)(defaultContextValue);
|
|
197
|
+
var I18nBridgeProviderLight = ({
|
|
198
|
+
children,
|
|
199
|
+
defaultLocale = "es"
|
|
200
|
+
}) => {
|
|
201
|
+
const [i18nProvider, setI18nProviderState] = (0, import_react.useState)(null);
|
|
202
|
+
const [locale, setLocale] = (0, import_react.useState)(() => {
|
|
203
|
+
if (typeof window !== "undefined") {
|
|
204
|
+
return localStorage.getItem("dash-user-locale") || defaultLocale;
|
|
205
|
+
}
|
|
206
|
+
return defaultLocale;
|
|
207
|
+
});
|
|
208
|
+
const setI18nProvider = (0, import_react.useCallback)((provider) => __async(null, null, function* () {
|
|
209
|
+
var _a, _b;
|
|
210
|
+
console.log("\u{1F310} I18nBridgeProviderLight: Setting bridged i18nProvider", {
|
|
211
|
+
providerLocale: (_a = provider == null ? void 0 : provider.getLocale) == null ? void 0 : _a.call(provider),
|
|
212
|
+
desiredLocale: locale
|
|
213
|
+
});
|
|
214
|
+
setI18nProviderState(provider);
|
|
215
|
+
const providerLocale = (_b = provider == null ? void 0 : provider.getLocale) == null ? void 0 : _b.call(provider);
|
|
216
|
+
if (providerLocale && providerLocale !== locale && (provider == null ? void 0 : provider.changeLocale)) {
|
|
217
|
+
console.log(`\u{1F310} I18nBridgeProviderLight: Provider locale (${providerLocale}) differs from desired (${locale}), switching...`);
|
|
218
|
+
try {
|
|
219
|
+
yield provider.changeLocale(locale);
|
|
220
|
+
console.log(`\u{1F310} I18nBridgeProviderLight: Successfully switched provider to ${locale}`);
|
|
221
|
+
} catch (e) {
|
|
222
|
+
console.warn("\u{1F310} I18nBridgeProviderLight: Failed to switch provider locale:", e);
|
|
223
|
+
}
|
|
224
|
+
} else if (provider == null ? void 0 : provider.getLocale) {
|
|
225
|
+
setLocale(provider.getLocale());
|
|
226
|
+
}
|
|
227
|
+
}), [locale]);
|
|
228
|
+
(0, import_react.useEffect)(() => {
|
|
229
|
+
const handleLocaleChange = (event) => __async(null, null, function* () {
|
|
230
|
+
var _a;
|
|
231
|
+
const customEvent = event;
|
|
232
|
+
const newLocale = (_a = customEvent.detail) == null ? void 0 : _a.locale;
|
|
233
|
+
if (newLocale && newLocale !== locale) {
|
|
234
|
+
console.log("\u{1F310} I18nBridgeProviderLight: Received locale change event:", newLocale);
|
|
235
|
+
if (i18nProvider == null ? void 0 : i18nProvider.changeLocale) {
|
|
236
|
+
try {
|
|
237
|
+
yield i18nProvider.changeLocale(newLocale);
|
|
238
|
+
} catch (e) {
|
|
239
|
+
console.warn("Failed to change provider locale:", e);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
setLocale(newLocale);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
window.addEventListener(LOCALE_CHANGE_EVENT, handleLocaleChange);
|
|
246
|
+
return () => {
|
|
247
|
+
window.removeEventListener(LOCALE_CHANGE_EVENT, handleLocaleChange);
|
|
248
|
+
};
|
|
249
|
+
}, [i18nProvider, locale]);
|
|
250
|
+
const contextValue = (0, import_react.useMemo)(() => ({
|
|
251
|
+
i18nProvider,
|
|
252
|
+
locale,
|
|
253
|
+
setI18nProvider,
|
|
254
|
+
setLocale
|
|
255
|
+
}), [i18nProvider, locale, setI18nProvider]);
|
|
256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(I18nBridgeContext.Provider, { value: contextValue, children });
|
|
257
|
+
};
|
|
258
|
+
var useI18nBridgeLight = () => {
|
|
259
|
+
const context = (0, import_react.useContext)(I18nBridgeContext);
|
|
260
|
+
return context;
|
|
261
|
+
};
|
|
262
|
+
var useBridgedLocalesLight = () => {
|
|
263
|
+
const { i18nProvider } = useI18nBridgeLight();
|
|
264
|
+
const locales = (0, import_react.useMemo)(() => {
|
|
265
|
+
if (!(i18nProvider == null ? void 0 : i18nProvider.getLocales)) {
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
268
|
+
return i18nProvider.getLocales();
|
|
269
|
+
}, [i18nProvider]);
|
|
270
|
+
return locales;
|
|
271
|
+
};
|
|
272
|
+
var useBridgedChangeLocaleLight = () => {
|
|
273
|
+
const { i18nProvider, setLocale } = useI18nBridgeLight();
|
|
274
|
+
const changeLocale = (0, import_react.useCallback)((locale) => __async(null, null, function* () {
|
|
275
|
+
if (i18nProvider == null ? void 0 : i18nProvider.changeLocale) {
|
|
276
|
+
yield i18nProvider.changeLocale(locale);
|
|
277
|
+
setLocale(locale);
|
|
278
|
+
}
|
|
279
|
+
}), [i18nProvider, setLocale]);
|
|
280
|
+
return changeLocale;
|
|
281
|
+
};
|
|
282
|
+
var useBridgedLocaleLight = () => {
|
|
283
|
+
const { locale } = useI18nBridgeLight();
|
|
284
|
+
return locale;
|
|
285
|
+
};
|
|
286
|
+
var useTranslateLight = () => {
|
|
287
|
+
const { i18nProvider } = useI18nBridgeLight();
|
|
288
|
+
const translate = (0, import_react.useCallback)((key, options) => {
|
|
289
|
+
if (i18nProvider == null ? void 0 : i18nProvider.translate) {
|
|
290
|
+
return i18nProvider.translate(key, options);
|
|
291
|
+
}
|
|
292
|
+
return key;
|
|
293
|
+
}, [i18nProvider]);
|
|
294
|
+
return translate;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// src/components/GlobalSmallLoader.tsx
|
|
298
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
299
|
+
var loaderSvgMarkup = `<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="32px" height="32px" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" viewBox="0 0 16 16"><g><path style="opacity:1" fill="#FFFFFF" d="M11.506 12.388q0.306 0.011 0.617 0.008v1.281h-0.89a2 2 0 0 1 -0.898 -0.215 1.24 1.24 0 0 1 -0.629 -0.761 2.5 2.5 0 0 1 -0.094 -0.554q-0.006 -1.082 -0.004 -2.163h-0.609q0.002 -0.398 -0.004 -0.796a616 616 0 0 0 -1.676 2.023 657 657 0 0 0 2.069 2.46q-0.935 0.012 -1.874 0.008L6.003 11.61q-0.006 1.035 -0.004 2.069H4.485q0.004 -2.983 -0.008 -5.966 -0.661 -0.21 -0.863 -0.875a2 2 0 0 1 -0.039 -0.258q-0.008 -2.108 0 -4.217 0.12 -0.356 0.48 -0.246 0.153 0.079 0.191 0.246l0.008 3.272q0.05 0.116 0.168 0.066 0.035 -0.027 0.051 -0.066l0.008 -3.264q0.095 -0.329 0.433 -0.269 0.191 0.059 0.238 0.254l0.008 3.272q0.065 0.14 0.195 0.055l0.023 -0.039 0.008 -3.264q0.086 -0.321 0.418 -0.285 0.197 0.057 0.254 0.254a352 352 0 0 1 0.016 3.295q0.062 0.109 0.176 0.051 0.029 -0.028 0.043 -0.066l0.008 -3.28q0.045 -0.17 0.207 -0.238 0.25 -0.074 0.41 0.129a0.5 0.5 0 0 1 0.047 0.109q0.014 1.063 0.012 2.128 0.002 1.088 -0.012 2.175 -0.137 0.844 -0.96 1.078a301 301 0 0 0 0 3.006q0.753 -1.005 1.503 -2.011 1.05 -0.006 2.101 -0.004 0.002 -0.519 -0.004 -1.039a1.82 1.82 0 0 1 -1.281 -1.101q-0.197 -0.504 -0.211 -1.046a4.7 4.7 0 0 1 0.383 -2.03q0.242 -0.547 0.668 -0.964 0.395 -0.364 0.929 -0.445 0.695 -0.056 1.218 0.398 0.476 0.438 0.73 1.035 0.513 1.212 0.32 2.514a2.26 2.26 0 0 1 -0.484 1.07 1.75 1.75 0 0 1 -0.754 0.5v1.109h0.992v1.265h-0.992q-0.002 1.042 0.004 2.085 0.05 0.323 0.379 0.32"/></g></svg>`;
|
|
300
|
+
var KTIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { dangerouslySetInnerHTML: { __html: loaderSvgMarkup } });
|
|
301
|
+
var GlobalSmallLoader = ({
|
|
302
|
+
message,
|
|
303
|
+
showMessage = false
|
|
304
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
305
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "initial-loader", children: [
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "initial-loader-spinner" }),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "initial-loader-icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(KTIcon, {}) })
|
|
308
|
+
] }),
|
|
309
|
+
showMessage && message && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "initial-loader-text", children: message })
|
|
310
|
+
] });
|
|
311
|
+
var GlobalLoaderHtmlMarkup = `<div class="initial-loader">
|
|
312
|
+
<div class="initial-loader-spinner">
|
|
313
|
+
<span class="initial-loader-icon">
|
|
314
|
+
${loaderSvgMarkup}
|
|
315
|
+
</span>
|
|
316
|
+
</div>
|
|
317
|
+
<div class="initial-loader-text"></div>
|
|
318
|
+
</div>`;
|
|
319
|
+
var injectCriticalStyles = () => {
|
|
320
|
+
if (typeof document === "undefined") return;
|
|
321
|
+
if (document.getElementById("critical-loading-styles")) return;
|
|
322
|
+
const style = document.createElement("style");
|
|
323
|
+
style.id = "critical-loading-styles";
|
|
324
|
+
style.textContent = `
|
|
325
|
+
.initial-loader {
|
|
326
|
+
position: fixed;
|
|
327
|
+
top: 0;
|
|
328
|
+
left: 0;
|
|
329
|
+
right: 0;
|
|
330
|
+
bottom: 0;
|
|
331
|
+
display: flex;
|
|
332
|
+
flex-direction: column;
|
|
333
|
+
justify-content: center;
|
|
334
|
+
align-items: center;
|
|
335
|
+
color: var(--text-color, #fff);
|
|
336
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
337
|
+
z-index: 9999;
|
|
338
|
+
}
|
|
339
|
+
.initial-loader-spinner {
|
|
340
|
+
width: 40px;
|
|
341
|
+
height: 40px;
|
|
342
|
+
border: 3px solid rgba(255,255,255,0.1);
|
|
343
|
+
border-top-color: var(--primary-color, #3f51b5);
|
|
344
|
+
border-radius: 50%;
|
|
345
|
+
animation: spin 1s linear infinite;
|
|
346
|
+
position: relative;
|
|
347
|
+
display: flex;
|
|
348
|
+
justify-content: center;
|
|
349
|
+
align-items: center;
|
|
350
|
+
}
|
|
351
|
+
.initial-loader-icon {
|
|
352
|
+
position: absolute;
|
|
353
|
+
top: 50%;
|
|
354
|
+
left: 50%;
|
|
355
|
+
width: 16px;
|
|
356
|
+
height: 16px;
|
|
357
|
+
transform: translate(-50%, -50%);
|
|
358
|
+
display: flex;
|
|
359
|
+
align-items: center;
|
|
360
|
+
justify-content: center;
|
|
361
|
+
pointer-events: none;
|
|
362
|
+
}
|
|
363
|
+
.initial-loader-text {
|
|
364
|
+
margin-top: 16px;
|
|
365
|
+
font-size: 14px;
|
|
366
|
+
opacity: 0.7;
|
|
367
|
+
}
|
|
368
|
+
@keyframes spin {
|
|
369
|
+
to { transform: rotate(360deg); }
|
|
370
|
+
}
|
|
371
|
+
`;
|
|
372
|
+
document.head.appendChild(style);
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
// src/components/CustomErrorBoundary.tsx
|
|
376
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
377
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
378
|
+
var CustomErrorBoundary = class extends import_react2.default.Component {
|
|
379
|
+
constructor(props) {
|
|
380
|
+
super(props);
|
|
381
|
+
__publicField(this, "handleReload", () => {
|
|
382
|
+
window.location.reload();
|
|
383
|
+
});
|
|
384
|
+
this.state = { hasError: false };
|
|
385
|
+
}
|
|
386
|
+
static getDerivedStateFromError(error) {
|
|
387
|
+
return { hasError: true, error };
|
|
388
|
+
}
|
|
389
|
+
componentDidCatch(error, errorInfo) {
|
|
390
|
+
var _a, _b;
|
|
391
|
+
console.error("CustomErrorBoundary caught error:", error, errorInfo);
|
|
392
|
+
(_b = (_a = this.props).onError) == null ? void 0 : _b.call(_a, error, errorInfo);
|
|
393
|
+
}
|
|
394
|
+
render() {
|
|
395
|
+
var _a;
|
|
396
|
+
if (this.state.hasError) {
|
|
397
|
+
if (this.props.fallback) {
|
|
398
|
+
return this.props.fallback;
|
|
399
|
+
}
|
|
400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
401
|
+
"div",
|
|
402
|
+
{
|
|
403
|
+
style: {
|
|
404
|
+
display: "flex",
|
|
405
|
+
justifyContent: "center",
|
|
406
|
+
alignItems: "center",
|
|
407
|
+
height: "100vh",
|
|
408
|
+
backgroundColor: "var(--bodybg-primary, #121212)",
|
|
409
|
+
color: "var(--text-color, #ffffff)",
|
|
410
|
+
flexDirection: "column",
|
|
411
|
+
gap: "20px"
|
|
412
|
+
},
|
|
413
|
+
children: [
|
|
414
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: "Something went wrong" }),
|
|
415
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: { opacity: 0.8 }, children: (_a = this.state.error) == null ? void 0 : _a.message }),
|
|
416
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
417
|
+
"button",
|
|
418
|
+
{
|
|
419
|
+
onClick: this.handleReload,
|
|
420
|
+
style: {
|
|
421
|
+
padding: "10px 20px",
|
|
422
|
+
backgroundColor: "var(--primary-color, #007bff)",
|
|
423
|
+
color: "white",
|
|
424
|
+
border: "none",
|
|
425
|
+
borderRadius: "4px",
|
|
426
|
+
cursor: "pointer",
|
|
427
|
+
fontSize: "14px",
|
|
428
|
+
fontWeight: 500
|
|
429
|
+
},
|
|
430
|
+
children: "Reload Page"
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
return this.props.children;
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
// src/components/AppWrapperLight.tsx
|
|
442
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
443
|
+
var import_react_error_boundary = require("react-error-boundary");
|
|
444
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
445
|
+
var ErrorFallback = ({ error, resetErrorBoundary }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
446
|
+
"div",
|
|
447
|
+
{
|
|
448
|
+
style: {
|
|
449
|
+
display: "flex",
|
|
450
|
+
flexDirection: "column",
|
|
451
|
+
alignItems: "center",
|
|
452
|
+
justifyContent: "center",
|
|
453
|
+
height: "100vh",
|
|
454
|
+
gap: "16px",
|
|
455
|
+
color: "var(--text-color)",
|
|
456
|
+
backgroundColor: "var(--bodybg-primary)"
|
|
457
|
+
},
|
|
458
|
+
children: [
|
|
459
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h1", { style: { margin: 0, fontSize: "1.5rem" }, children: "Something went wrong" }),
|
|
460
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { style: { margin: 0, opacity: 0.8 }, children: (error == null ? void 0 : error.message) || "Unknown error" }),
|
|
461
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
462
|
+
"button",
|
|
463
|
+
{
|
|
464
|
+
onClick: resetErrorBoundary,
|
|
465
|
+
style: {
|
|
466
|
+
padding: "8px 24px",
|
|
467
|
+
backgroundColor: "var(--primary-color)",
|
|
468
|
+
color: "var(--primary-contrast)",
|
|
469
|
+
border: "none",
|
|
470
|
+
borderRadius: "4px",
|
|
471
|
+
cursor: "pointer",
|
|
472
|
+
fontSize: "14px",
|
|
473
|
+
fontWeight: 500
|
|
474
|
+
},
|
|
475
|
+
children: "Try Again"
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
var SimpleLoader = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
482
|
+
"div",
|
|
483
|
+
{
|
|
484
|
+
style: {
|
|
485
|
+
display: "flex",
|
|
486
|
+
justifyContent: "center",
|
|
487
|
+
alignItems: "center",
|
|
488
|
+
height: "100vh",
|
|
489
|
+
backgroundColor: "var(--bodybg-primary)"
|
|
490
|
+
},
|
|
491
|
+
children: [
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
493
|
+
"div",
|
|
494
|
+
{
|
|
495
|
+
className: "loading-spinner",
|
|
496
|
+
style: {
|
|
497
|
+
width: "40px",
|
|
498
|
+
height: "40px",
|
|
499
|
+
border: "3px solid rgba(255,255,255,0.1)",
|
|
500
|
+
borderTopColor: "var(--primary-color)",
|
|
501
|
+
borderRadius: "50%",
|
|
502
|
+
animation: "spin 1s linear infinite"
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
),
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
|
|
507
|
+
@keyframes spin {
|
|
508
|
+
to { transform: rotate(360deg); }
|
|
509
|
+
}
|
|
510
|
+
` })
|
|
511
|
+
]
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
var AppWrapperLight = ({
|
|
515
|
+
children,
|
|
516
|
+
onReset,
|
|
517
|
+
showSplash = true
|
|
518
|
+
}) => {
|
|
519
|
+
const [isPending, startTransition] = (0, import_react3.useTransition)();
|
|
520
|
+
const [isInitialRender, setIsInitialRender] = (0, import_react3.useState)(true);
|
|
521
|
+
import_react3.default.useEffect(() => {
|
|
522
|
+
startTransition(() => {
|
|
523
|
+
setIsInitialRender(false);
|
|
524
|
+
});
|
|
525
|
+
}, []);
|
|
526
|
+
const handleReset = () => {
|
|
527
|
+
if (onReset) {
|
|
528
|
+
onReset();
|
|
529
|
+
} else {
|
|
530
|
+
window.location.reload();
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_error_boundary.ErrorBoundary, { FallbackComponent: ErrorFallback, onReset: handleReset, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react3.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SimpleLoader, {}), children }) }),
|
|
535
|
+
showSplash && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: !isPending && !isInitialRender ? "dash-splash fade-out" : "dash-splash" })
|
|
536
|
+
] });
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
// src/components/DefaultFallbacks.tsx
|
|
540
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
541
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
542
|
+
var defaultContainerStyle = {
|
|
543
|
+
display: "flex",
|
|
544
|
+
flexDirection: "column",
|
|
545
|
+
justifyContent: "center",
|
|
546
|
+
alignItems: "center",
|
|
547
|
+
minHeight: "100vh",
|
|
548
|
+
gap: "16px",
|
|
549
|
+
color: "var(--text-color, #333)",
|
|
550
|
+
backgroundColor: "var(--background-color, #fff)"
|
|
551
|
+
};
|
|
552
|
+
var defaultErrorMessageStyle = {
|
|
553
|
+
margin: 0,
|
|
554
|
+
fontSize: "1.25rem",
|
|
555
|
+
fontWeight: 500,
|
|
556
|
+
color: "#f44336"
|
|
557
|
+
};
|
|
558
|
+
var defaultButtonStyle = {
|
|
559
|
+
marginTop: "16px",
|
|
560
|
+
padding: "8px 16px",
|
|
561
|
+
backgroundColor: "#1976d2",
|
|
562
|
+
color: "white",
|
|
563
|
+
border: "none",
|
|
564
|
+
borderRadius: "4px",
|
|
565
|
+
cursor: "pointer",
|
|
566
|
+
fontSize: "14px",
|
|
567
|
+
fontWeight: 500
|
|
568
|
+
};
|
|
569
|
+
var DefaultInitializationErrorFallback = ({
|
|
570
|
+
error,
|
|
571
|
+
message = "Failed to initialize application",
|
|
572
|
+
onRetry = () => window.location.reload(),
|
|
573
|
+
retryLabel = "Retry",
|
|
574
|
+
containerStyle,
|
|
575
|
+
messageStyle,
|
|
576
|
+
buttonStyle
|
|
577
|
+
}) => {
|
|
578
|
+
const errorMessage = error instanceof Error ? error.message : error || message;
|
|
579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: __spreadValues(__spreadValues({}, defaultContainerStyle), containerStyle), children: [
|
|
580
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h6", { style: __spreadValues(__spreadValues({}, defaultErrorMessageStyle), messageStyle), children: errorMessage }),
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
582
|
+
"button",
|
|
583
|
+
{
|
|
584
|
+
onClick: onRetry,
|
|
585
|
+
style: __spreadValues(__spreadValues({}, defaultButtonStyle), buttonStyle),
|
|
586
|
+
children: retryLabel
|
|
587
|
+
}
|
|
588
|
+
)
|
|
589
|
+
] });
|
|
590
|
+
};
|
|
591
|
+
var DefaultAppLoadErrorFallback = ({
|
|
592
|
+
message = "Failed to load application",
|
|
593
|
+
onRetry = () => window.location.reload(),
|
|
594
|
+
retryLabel = "Retry",
|
|
595
|
+
containerStyle,
|
|
596
|
+
messageStyle,
|
|
597
|
+
buttonStyle
|
|
598
|
+
}) => {
|
|
599
|
+
const appLoadContainerStyle = {
|
|
600
|
+
display: "flex",
|
|
601
|
+
flexDirection: "column",
|
|
602
|
+
justifyContent: "center",
|
|
603
|
+
alignItems: "center",
|
|
604
|
+
height: "100vh",
|
|
605
|
+
color: "#000000",
|
|
606
|
+
gap: "12px"
|
|
607
|
+
};
|
|
608
|
+
const appLoadButtonStyle = {
|
|
609
|
+
padding: "8px 24px",
|
|
610
|
+
backgroundColor: "#57005aff",
|
|
611
|
+
color: "#fff",
|
|
612
|
+
border: "none",
|
|
613
|
+
borderRadius: "4px",
|
|
614
|
+
cursor: "pointer"
|
|
615
|
+
};
|
|
616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: __spreadValues(__spreadValues({}, appLoadContainerStyle), containerStyle), children: [
|
|
617
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { style: messageStyle, children: message }),
|
|
618
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
619
|
+
"button",
|
|
620
|
+
{
|
|
621
|
+
onClick: onRetry,
|
|
622
|
+
style: __spreadValues(__spreadValues({}, appLoadButtonStyle), buttonStyle),
|
|
623
|
+
children: retryLabel
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
] });
|
|
627
|
+
};
|
|
628
|
+
var createLazyAppLoader = ({
|
|
629
|
+
importFn,
|
|
630
|
+
delay = 100,
|
|
631
|
+
ErrorFallback: ErrorFallback2 = DefaultAppLoadErrorFallback,
|
|
632
|
+
errorMessage = "Failed to load application"
|
|
633
|
+
}) => {
|
|
634
|
+
return import_react4.default.lazy(() => {
|
|
635
|
+
return new Promise((resolve) => {
|
|
636
|
+
setTimeout(() => {
|
|
637
|
+
importFn().then((mod) => {
|
|
638
|
+
resolve({ default: mod.default });
|
|
639
|
+
}).catch((error) => {
|
|
640
|
+
console.error("Failed to load application:", error);
|
|
641
|
+
resolve({
|
|
642
|
+
default: () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
643
|
+
ErrorFallback2,
|
|
644
|
+
{
|
|
645
|
+
error,
|
|
646
|
+
message: errorMessage
|
|
647
|
+
}
|
|
648
|
+
)
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
}, delay);
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
// src/theme/DashThemeProviderLight.tsx
|
|
657
|
+
var import_react5 = require("react");
|
|
658
|
+
var import_CssBaseline = __toESM(require("@mui/material/CssBaseline"), 1);
|
|
659
|
+
var import_material = require("@mui/material");
|
|
660
|
+
var import_dash_utils = require("dash-utils");
|
|
661
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
662
|
+
var getCssVariableNumber = (varName, defaultValue) => {
|
|
663
|
+
if (typeof document === "undefined") return defaultValue;
|
|
664
|
+
const value = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
665
|
+
const parsed = parseInt(value, 10);
|
|
666
|
+
return isNaN(parsed) ? defaultValue : parsed;
|
|
667
|
+
};
|
|
668
|
+
var getCssVariable = (varName) => {
|
|
669
|
+
if (typeof document === "undefined") return null;
|
|
670
|
+
const value = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
671
|
+
return value || null;
|
|
672
|
+
};
|
|
673
|
+
var getThemeColors = (mode) => {
|
|
674
|
+
const colors = {};
|
|
675
|
+
const suffix = `--${mode}`;
|
|
676
|
+
const primaryColor = getCssVariable(`--primary-color${suffix}`);
|
|
677
|
+
if (primaryColor) colors.primaryColor = primaryColor;
|
|
678
|
+
const primaryContrast = getCssVariable(`--primary-contrast${suffix}`);
|
|
679
|
+
if (primaryContrast) colors.primaryContrast = primaryContrast;
|
|
680
|
+
const secondaryColor = getCssVariable(`--secondary-color${suffix}`);
|
|
681
|
+
if (secondaryColor) colors.secondaryColor = secondaryColor;
|
|
682
|
+
const bodyBgPrimary = getCssVariable(`--bodybg-primary${suffix}`);
|
|
683
|
+
if (bodyBgPrimary) colors.bodyBgPrimary = bodyBgPrimary;
|
|
684
|
+
const bodyBgSecondary = getCssVariable(`--bodybg-secondary${suffix}`);
|
|
685
|
+
if (bodyBgSecondary) colors.bodyBgSecondary = bodyBgSecondary;
|
|
686
|
+
const componentBg = getCssVariable(`--component-bg${suffix}`);
|
|
687
|
+
if (componentBg) colors.componentBg = componentBg;
|
|
688
|
+
const textColor = getCssVariable(`--text-color${suffix}`);
|
|
689
|
+
if (textColor) colors.textColor = textColor;
|
|
690
|
+
const textContrast = getCssVariable(`--text-contrast${suffix}`);
|
|
691
|
+
if (textContrast) colors.textContrast = textContrast;
|
|
692
|
+
const headingColor = getCssVariable(`--heading-color${suffix}`);
|
|
693
|
+
if (headingColor) colors.headingColor = headingColor;
|
|
694
|
+
const linkColor = getCssVariable(`--link-color${suffix}`);
|
|
695
|
+
if (linkColor) colors.linkColor = linkColor;
|
|
696
|
+
const borderColor = getCssVariable(`--border-color${suffix}`);
|
|
697
|
+
if (borderColor) colors.borderColor = borderColor;
|
|
698
|
+
return colors;
|
|
699
|
+
};
|
|
700
|
+
var createMinimalTheme = (mode, extendedOptions) => {
|
|
701
|
+
const colors = getThemeColors(mode);
|
|
702
|
+
const fontSizeBase = getCssVariableNumber("--font-size-base", 14);
|
|
703
|
+
const borderRadiusBase = getCssVariableNumber("--border-radius-base", 6);
|
|
704
|
+
const _a = extendedOptions || {}, { palette: _p, colorSchemes: _cs, defaultColorScheme: _dcs } = _a, safeExtendedOptions = __objRest(_a, ["palette", "colorSchemes", "defaultColorScheme"]);
|
|
705
|
+
return (0, import_material.createTheme)(__spreadValues({
|
|
706
|
+
breakpoints: {
|
|
707
|
+
keys: ["xs", "sm", "md", "lg", "xl"],
|
|
708
|
+
values: { xs: 0, sm: 600, md: 900, lg: 1200, xl: 1536 }
|
|
709
|
+
},
|
|
710
|
+
palette: {
|
|
711
|
+
mode,
|
|
712
|
+
primary: {
|
|
713
|
+
main: colors.primaryColor,
|
|
714
|
+
contrastText: colors.primaryContrast
|
|
715
|
+
},
|
|
716
|
+
secondary: {
|
|
717
|
+
main: colors.secondaryColor
|
|
718
|
+
},
|
|
719
|
+
background: {
|
|
720
|
+
default: colors.bodyBgPrimary,
|
|
721
|
+
paper: colors.componentBg
|
|
722
|
+
},
|
|
723
|
+
text: {
|
|
724
|
+
primary: colors.textColor,
|
|
725
|
+
secondary: colors.textContrast
|
|
726
|
+
},
|
|
727
|
+
divider: colors.borderColor
|
|
728
|
+
},
|
|
729
|
+
typography: {
|
|
730
|
+
fontFamily: '"Montserrat", "Roboto", "Helvetica", "Arial", sans-serif',
|
|
731
|
+
fontSize: fontSizeBase
|
|
732
|
+
},
|
|
733
|
+
shape: {
|
|
734
|
+
borderRadius: borderRadiusBase
|
|
735
|
+
},
|
|
736
|
+
components: {
|
|
737
|
+
MuiButton: {
|
|
738
|
+
styleOverrides: {
|
|
739
|
+
root: {
|
|
740
|
+
transition: "all 0.2s ease-in-out",
|
|
741
|
+
textTransform: "none"
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
MuiCssBaseline: {
|
|
746
|
+
styleOverrides: {
|
|
747
|
+
body: {
|
|
748
|
+
backgroundColor: colors.bodyBgPrimary,
|
|
749
|
+
color: colors.textColor
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
MuiPaper: {
|
|
754
|
+
styleOverrides: {
|
|
755
|
+
root: {
|
|
756
|
+
backgroundImage: "none"
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}, safeExtendedOptions));
|
|
762
|
+
};
|
|
763
|
+
var DashThemeContext = (0, import_react5.createContext)(null);
|
|
764
|
+
var useDashThemeContextLight = () => {
|
|
765
|
+
const context = (0, import_react5.useContext)(DashThemeContext);
|
|
766
|
+
if (!context) {
|
|
767
|
+
throw new Error("useDashThemeContextLight must be used within a DashThemeProviderLight");
|
|
768
|
+
}
|
|
769
|
+
return context;
|
|
770
|
+
};
|
|
771
|
+
var DashThemeProviderLight = ({
|
|
772
|
+
children,
|
|
773
|
+
extendedOptions,
|
|
774
|
+
defaultMode
|
|
775
|
+
}) => {
|
|
776
|
+
const [currentMode, setCurrentMode] = (0, import_react5.useState)(() => {
|
|
777
|
+
if (typeof document === "undefined") return defaultMode || "dark";
|
|
778
|
+
const stored = document.documentElement.getAttribute("data-theme");
|
|
779
|
+
return stored === "light" || stored === "dark" ? stored : defaultMode || "dark";
|
|
780
|
+
});
|
|
781
|
+
const [themeVersion, setThemeVersion] = (0, import_react5.useState)(0);
|
|
782
|
+
const theme = (0, import_react5.useMemo)(() => {
|
|
783
|
+
return createMinimalTheme(currentMode, extendedOptions);
|
|
784
|
+
}, [currentMode, extendedOptions, themeVersion]);
|
|
785
|
+
const setMode = (mode) => {
|
|
786
|
+
setCurrentMode(mode);
|
|
787
|
+
if (typeof document !== "undefined") {
|
|
788
|
+
document.documentElement.setAttribute("data-theme", mode);
|
|
789
|
+
localStorage.setItem("theme", mode);
|
|
790
|
+
(0, import_dash_utils.updateDomCssVariables)(mode);
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
const toggleMode = () => {
|
|
794
|
+
setMode(currentMode === "dark" ? "light" : "dark");
|
|
795
|
+
};
|
|
796
|
+
const refreshTheme = () => {
|
|
797
|
+
setThemeVersion((v) => v + 1);
|
|
798
|
+
};
|
|
799
|
+
(0, import_react5.useEffect)(() => {
|
|
800
|
+
if (typeof document === "undefined") return;
|
|
801
|
+
const observer = new MutationObserver((mutations) => {
|
|
802
|
+
mutations.forEach((mutation) => {
|
|
803
|
+
if (mutation.type === "attributes" && mutation.attributeName === "data-theme") {
|
|
804
|
+
const newMode = document.documentElement.getAttribute("data-theme");
|
|
805
|
+
if (newMode === "light" || newMode === "dark") {
|
|
806
|
+
if (newMode !== currentMode) {
|
|
807
|
+
setCurrentMode(newMode);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
observer.observe(document.documentElement, {
|
|
814
|
+
attributes: true,
|
|
815
|
+
attributeFilter: ["data-theme"]
|
|
816
|
+
});
|
|
817
|
+
return () => observer.disconnect();
|
|
818
|
+
}, [currentMode]);
|
|
819
|
+
(0, import_react5.useEffect)(() => {
|
|
820
|
+
if (typeof document === "undefined") return;
|
|
821
|
+
(0, import_dash_utils.updateDomCssVariables)(currentMode);
|
|
822
|
+
}, [currentMode]);
|
|
823
|
+
(0, import_react5.useEffect)(() => {
|
|
824
|
+
if (typeof window === "undefined") return;
|
|
825
|
+
const handler = () => {
|
|
826
|
+
console.log("DashThemeProviderLight: Refreshing theme from CSS variables");
|
|
827
|
+
refreshTheme();
|
|
828
|
+
};
|
|
829
|
+
window.addEventListener("DASHTRefreshTheme", handler);
|
|
830
|
+
return () => window.removeEventListener("DASHTRefreshTheme", handler);
|
|
831
|
+
}, []);
|
|
832
|
+
const contextValue = (0, import_react5.useMemo)(
|
|
833
|
+
() => ({
|
|
834
|
+
theme,
|
|
835
|
+
currentMode,
|
|
836
|
+
setMode,
|
|
837
|
+
toggleMode,
|
|
838
|
+
refreshTheme
|
|
839
|
+
}),
|
|
840
|
+
[theme, currentMode]
|
|
841
|
+
);
|
|
842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_material.ThemeProvider, { theme, children: [
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_CssBaseline.default, {}),
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DashThemeContext.Provider, { value: contextValue, children })
|
|
845
|
+
] });
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
// src/utils/DashBootstrapUtils.ts
|
|
849
|
+
var import_react6 = require("react");
|
|
850
|
+
var import_react_redux = require("react-redux");
|
|
851
|
+
var import_dash_auth = require("dash-auth");
|
|
852
|
+
var import_dash_admin_state = require("dash-admin-state");
|
|
853
|
+
var import_Auth = require("dash-admin-state/src/redux/reducers/Auth");
|
|
854
|
+
var import_DASHAuthenticationService = __toESM(require("dash-admin/src/contexts/auth/DASHAuthenticationService"), 1);
|
|
855
|
+
var import_dash_utils2 = require("dash-utils");
|
|
856
|
+
var useInitializeReduxFromPersisted = (currentAuthState) => {
|
|
857
|
+
const dispatch = (0, import_react_redux.useDispatch)();
|
|
858
|
+
(0, import_react6.useEffect)(() => {
|
|
859
|
+
const initializeReduxFromPersisted = () => {
|
|
860
|
+
console.log("\u{1F50D} Bootstrap: Checking for persisted auth data...");
|
|
861
|
+
const storedUser = import_dash_auth.AuthPersistenceService.getUser();
|
|
862
|
+
const storedToken = import_dash_auth.AuthPersistenceService.getToken();
|
|
863
|
+
const isAuthenticated = JSON.parse(import_dash_utils2.dashStorage.getItem("authenticated") || "false");
|
|
864
|
+
const persistedAuth = import_dash_auth.AuthPersistenceService.getAuth();
|
|
865
|
+
console.log("\u{1F50D} Bootstrap: Persisted data check:", {
|
|
866
|
+
hasStoredUser: !!storedUser,
|
|
867
|
+
hasStoredToken: !!storedToken,
|
|
868
|
+
isAuthenticated,
|
|
869
|
+
hasPersistedAuth: !!persistedAuth,
|
|
870
|
+
currentReduxAuth: currentAuthState
|
|
871
|
+
});
|
|
872
|
+
if (isAuthenticated && storedUser && storedToken && !currentAuthState) {
|
|
873
|
+
console.log("\u{1F504} Bootstrap: Restoring auth session to Redux from localStorage");
|
|
874
|
+
let userObject = storedUser;
|
|
875
|
+
if (typeof storedUser === "string") {
|
|
876
|
+
console.error("\u274C Bootstrap: Stored user is string, this should not happen");
|
|
877
|
+
try {
|
|
878
|
+
userObject = JSON.parse(storedUser);
|
|
879
|
+
} catch (e) {
|
|
880
|
+
console.error("\u274C Bootstrap: Cannot parse user string, clearing auth data");
|
|
881
|
+
import_dash_auth.AuthPersistenceService.clearAuth();
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
dispatch(
|
|
886
|
+
import_dash_admin_state.DASH_REDUX_ACTIONS.updateAuth(import_Auth.ACTION_UPDATE_AUTH, {
|
|
887
|
+
user: userObject,
|
|
888
|
+
authenticated: true,
|
|
889
|
+
auth: (persistedAuth == null ? void 0 : persistedAuth.auth) || null
|
|
890
|
+
})
|
|
891
|
+
);
|
|
892
|
+
console.log("\u2705 Bootstrap: Redux state restored from persisted data");
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
initializeReduxFromPersisted();
|
|
896
|
+
}, [dispatch, currentAuthState]);
|
|
897
|
+
};
|
|
898
|
+
var useLogoutEventListener = () => {
|
|
899
|
+
const dispatch = (0, import_react_redux.useDispatch)();
|
|
900
|
+
(0, import_react6.useEffect)(() => {
|
|
901
|
+
const handleLogoutEvent = (event) => {
|
|
902
|
+
console.log("\u{1F510} Bootstrap: Received logout event", event.detail);
|
|
903
|
+
dispatch(
|
|
904
|
+
import_dash_admin_state.DASH_REDUX_ACTIONS.updateAuth(import_Auth.ACTION_UPDATE_AUTH, {
|
|
905
|
+
user: null,
|
|
906
|
+
authenticated: false,
|
|
907
|
+
auth: null
|
|
908
|
+
})
|
|
909
|
+
);
|
|
910
|
+
import_dash_auth.AuthPersistenceService.clearAuth();
|
|
911
|
+
localStorage.clear();
|
|
912
|
+
};
|
|
913
|
+
window.addEventListener("auth:logout", handleLogoutEvent);
|
|
914
|
+
return () => {
|
|
915
|
+
window.removeEventListener("auth:logout", handleLogoutEvent);
|
|
916
|
+
};
|
|
917
|
+
}, [dispatch]);
|
|
918
|
+
};
|
|
919
|
+
var useAppInitialization = () => {
|
|
920
|
+
const [isLoading, setIsLoading] = (0, import_react6.useState)(true);
|
|
921
|
+
const [initializationError, setInitializationError] = (0, import_react6.useState)(null);
|
|
922
|
+
const dispatch = (0, import_react_redux.useDispatch)();
|
|
923
|
+
(0, import_react6.useEffect)(() => {
|
|
924
|
+
const initializeApp = () => __async(null, null, function* () {
|
|
925
|
+
var _a, _b;
|
|
926
|
+
try {
|
|
927
|
+
console.log("\u{1F680} Bootstrap: Starting app initialization...");
|
|
928
|
+
yield (0, import_dash_auth.syncDeviceStoreToLocalStorage)();
|
|
929
|
+
const initResult = yield import_DASHAuthenticationService.default.initializeApp(true);
|
|
930
|
+
console.log("\u{1F50D} Bootstrap: Initialization result:", initResult);
|
|
931
|
+
if (initResult.success) {
|
|
932
|
+
console.log("\u2705 Bootstrap: Auto-login successful");
|
|
933
|
+
dispatch(
|
|
934
|
+
import_dash_admin_state.DASH_REDUX_ACTIONS.updateAuth(import_Auth.ACTION_UPDATE_AUTH, {
|
|
935
|
+
user: initResult.user,
|
|
936
|
+
authenticated: true,
|
|
937
|
+
auth: initResult.auth || null
|
|
938
|
+
})
|
|
939
|
+
);
|
|
940
|
+
(_b = window.DashIPCService) == null ? void 0 : _b.speak(`${(_a = initResult.user) == null ? void 0 : _a.name}, Bienvenido!`);
|
|
941
|
+
yield (0, import_dash_auth.syncLocalStorageToDeviceStore)();
|
|
942
|
+
setInitializationError(null);
|
|
943
|
+
if (initResult.redirectAfterLogin) {
|
|
944
|
+
console.log("\u{1F504} Bootstrap: Emitting auth:redirect event", initResult.redirectAfterLogin);
|
|
945
|
+
const event = new CustomEvent("auth:redirect", {
|
|
946
|
+
detail: { to: initResult.redirectAfterLogin }
|
|
947
|
+
});
|
|
948
|
+
window.dispatchEvent(event);
|
|
949
|
+
}
|
|
950
|
+
} else {
|
|
951
|
+
console.log("\u2139\uFE0F Bootstrap: No valid authentication found");
|
|
952
|
+
const authData = import_dash_auth.AuthPersistenceService.getAuth();
|
|
953
|
+
if (authData && authData.auth) {
|
|
954
|
+
console.log("\u{1F504} Bootstrap: Found persisted auth data, attempting token initialization...");
|
|
955
|
+
try {
|
|
956
|
+
const tokenInitResult = yield import_DASHAuthenticationService.default.initializeFromToken();
|
|
957
|
+
if (tokenInitResult.success) {
|
|
958
|
+
console.log("\u2705 Bootstrap: Token initialization successful");
|
|
959
|
+
dispatch(
|
|
960
|
+
import_dash_admin_state.DASH_REDUX_ACTIONS.updateAuth(import_Auth.ACTION_UPDATE_AUTH, {
|
|
961
|
+
user: tokenInitResult.user,
|
|
962
|
+
authenticated: true,
|
|
963
|
+
auth: tokenInitResult.auth || null
|
|
964
|
+
})
|
|
965
|
+
);
|
|
966
|
+
yield (0, import_dash_auth.syncLocalStorageToDeviceStore)();
|
|
967
|
+
setInitializationError(null);
|
|
968
|
+
if (tokenInitResult.redirectAfterLogin) {
|
|
969
|
+
console.log(
|
|
970
|
+
"\u{1F504} Bootstrap: Emitting auth:redirect event",
|
|
971
|
+
tokenInitResult.redirectAfterLogin
|
|
972
|
+
);
|
|
973
|
+
const event = new CustomEvent("auth:redirect", {
|
|
974
|
+
detail: { to: tokenInitResult.redirectAfterLogin }
|
|
975
|
+
});
|
|
976
|
+
window.dispatchEvent(event);
|
|
977
|
+
}
|
|
978
|
+
} else {
|
|
979
|
+
console.log("\u274C Bootstrap: Token initialization failed:", tokenInitResult.error);
|
|
980
|
+
setInitializationError(null);
|
|
981
|
+
import_dash_auth.AuthPersistenceService.clearAuth();
|
|
982
|
+
}
|
|
983
|
+
} catch (error) {
|
|
984
|
+
console.error("\u274C Bootstrap: Token initialization error:", error);
|
|
985
|
+
setInitializationError(null);
|
|
986
|
+
import_dash_auth.AuthPersistenceService.clearAuth();
|
|
987
|
+
}
|
|
988
|
+
} else {
|
|
989
|
+
console.log("\u2139\uFE0F Bootstrap: No persisted auth data found");
|
|
990
|
+
import_dash_auth.AuthPersistenceService.clearAuth();
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
} catch (error) {
|
|
994
|
+
console.error("\u274C Bootstrap: App initialization failed:", error);
|
|
995
|
+
setInitializationError("Failed to initialize application");
|
|
996
|
+
} finally {
|
|
997
|
+
setIsLoading(false);
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
if (isLoading) {
|
|
1001
|
+
initializeApp();
|
|
1002
|
+
}
|
|
1003
|
+
}, [dispatch, isLoading]);
|
|
1004
|
+
return { isLoading, initializationError };
|
|
1005
|
+
};
|
|
1006
|
+
var usePendingRedirect = () => {
|
|
1007
|
+
(0, import_react6.useEffect)(() => {
|
|
1008
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
1009
|
+
const redirectTo = searchParams.get("redirect");
|
|
1010
|
+
if (redirectTo && redirectTo !== "/login") {
|
|
1011
|
+
console.log("\u2139\uFE0F RedirectTO: Setting redirect to by searchParams to:", redirectTo);
|
|
1012
|
+
import_DASHAuthenticationService.default.setPendingRedirect(redirectTo);
|
|
1013
|
+
}
|
|
1014
|
+
}, []);
|
|
1015
|
+
};
|
|
1016
|
+
var LOCALE_CHANGE_EVENT2 = "dash:locale-change";
|
|
1017
|
+
var useUrlLocaleDetection = (availableLocales = ["es", "en"], defaultLocale = "es") => {
|
|
1018
|
+
const dispatch = (0, import_react_redux.useDispatch)();
|
|
1019
|
+
(0, import_react6.useEffect)(() => {
|
|
1020
|
+
if (typeof window === "undefined") return;
|
|
1021
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
1022
|
+
const langParam = searchParams.get("lang");
|
|
1023
|
+
const storedLocale = localStorage.getItem("dash-user-locale");
|
|
1024
|
+
let targetLocale = defaultLocale;
|
|
1025
|
+
if (langParam && availableLocales.includes(langParam)) {
|
|
1026
|
+
targetLocale = langParam;
|
|
1027
|
+
} else if (storedLocale && availableLocales.includes(storedLocale)) {
|
|
1028
|
+
targetLocale = storedLocale;
|
|
1029
|
+
}
|
|
1030
|
+
const isNewLocale = storedLocale !== targetLocale;
|
|
1031
|
+
if (isNewLocale) {
|
|
1032
|
+
console.log(`\u{1F310} Bootstrap: Locale change detected: ${storedLocale} -> ${targetLocale}`);
|
|
1033
|
+
localStorage.setItem("dash-user-locale", targetLocale);
|
|
1034
|
+
} else {
|
|
1035
|
+
console.log(`\u{1F310} Bootstrap: Initializing locale from storage: ${targetLocale}`);
|
|
1036
|
+
}
|
|
1037
|
+
console.log(`\u{1F310} Bootstrap: Dispatching locale to Redux: ${targetLocale}`);
|
|
1038
|
+
dispatch(import_dash_admin_state.DASH_REDUX_ACTIONS.switchLanguage(targetLocale));
|
|
1039
|
+
console.log(`\u{1F310} Bootstrap: Emitting locale change event: ${targetLocale}`);
|
|
1040
|
+
window.dispatchEvent(new CustomEvent(LOCALE_CHANGE_EVENT2, {
|
|
1041
|
+
detail: { locale: targetLocale }
|
|
1042
|
+
}));
|
|
1043
|
+
}, [dispatch, availableLocales, defaultLocale]);
|
|
1044
|
+
};
|
|
1045
|
+
var usePathnameTracker = () => {
|
|
1046
|
+
const [pathname, setPathname] = (0, import_react6.useState)(
|
|
1047
|
+
typeof window !== "undefined" ? window.location.pathname : "/"
|
|
1048
|
+
);
|
|
1049
|
+
(0, import_react6.useEffect)(() => {
|
|
1050
|
+
if (typeof window === "undefined") return;
|
|
1051
|
+
const handleUrlChange = () => {
|
|
1052
|
+
const newPathname = window.location.pathname;
|
|
1053
|
+
if (newPathname !== pathname) {
|
|
1054
|
+
console.log("\u{1F50D} Bootstrap: URL changed from", pathname, "to", newPathname);
|
|
1055
|
+
setPathname(newPathname);
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
window.addEventListener("popstate", handleUrlChange);
|
|
1059
|
+
return () => window.removeEventListener("popstate", handleUrlChange);
|
|
1060
|
+
}, [pathname]);
|
|
1061
|
+
return pathname;
|
|
1062
|
+
};
|
|
1063
|
+
var useEarlyThemeInit = (defaultTheme = "dark") => {
|
|
1064
|
+
(0, import_react6.useEffect)(() => {
|
|
1065
|
+
if (typeof document === "undefined") return;
|
|
1066
|
+
const stored = localStorage.getItem("theme");
|
|
1067
|
+
const theme = stored === "light" || stored === "dark" ? stored : defaultTheme;
|
|
1068
|
+
document.documentElement.setAttribute("data-theme", theme);
|
|
1069
|
+
if (!stored) {
|
|
1070
|
+
localStorage.setItem("theme", theme);
|
|
1071
|
+
}
|
|
1072
|
+
}, [defaultTheme]);
|
|
1073
|
+
};
|
|
1074
|
+
var initializeThemeEarly = (defaultTheme) => {
|
|
1075
|
+
if (typeof document === "undefined" || typeof localStorage === "undefined") return;
|
|
1076
|
+
const stored = localStorage.getItem("theme");
|
|
1077
|
+
const theme = stored === "light" || stored === "dark" ? stored : defaultTheme;
|
|
1078
|
+
document.documentElement.setAttribute("data-theme", theme);
|
|
1079
|
+
if (!stored) {
|
|
1080
|
+
localStorage.setItem("theme", theme);
|
|
1081
|
+
}
|
|
1082
|
+
try {
|
|
1083
|
+
(0, import_dash_utils2.updateDomCssVariables)(theme);
|
|
1084
|
+
console.log("\u{1F3A8} Bootstrap: Initialized theme variables for:", theme);
|
|
1085
|
+
} catch (error) {
|
|
1086
|
+
console.warn("Failed to initialize theme variables:", error);
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
var syncElectronStore = () => __async(null, null, function* () {
|
|
1090
|
+
if (typeof window === "undefined") return;
|
|
1091
|
+
const electronStore = window.electronStore;
|
|
1092
|
+
if (electronStore) {
|
|
1093
|
+
const all = yield electronStore.syncToLocalStorage();
|
|
1094
|
+
Object.entries(all).forEach(([key, value]) => {
|
|
1095
|
+
window.localStorage.setItem(key, JSON.stringify(value));
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1100
|
+
// src/utils/electronStore.ts
|
|
1101
|
+
var syncElectronStoreToLocalStorage = () => __async(null, null, function* () {
|
|
1102
|
+
if (typeof window === "undefined") return;
|
|
1103
|
+
if (window.electronStore) {
|
|
1104
|
+
try {
|
|
1105
|
+
const all = yield window.electronStore.syncToLocalStorage();
|
|
1106
|
+
Object.entries(all).forEach(([key, value]) => {
|
|
1107
|
+
window.localStorage.setItem(key, JSON.stringify(value));
|
|
1108
|
+
});
|
|
1109
|
+
console.log("\u2705 Electron store synced to localStorage");
|
|
1110
|
+
} catch (error) {
|
|
1111
|
+
console.error("\u274C Failed to sync Electron store:", error);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
var isElectron = () => {
|
|
1116
|
+
return typeof window !== "undefined" && !!window.electronStore;
|
|
1117
|
+
};
|
|
1118
|
+
var getElectronStoreValue = (key, defaultValue) => __async(null, null, function* () {
|
|
1119
|
+
if (typeof window === "undefined") return defaultValue;
|
|
1120
|
+
if (window.electronStore) {
|
|
1121
|
+
try {
|
|
1122
|
+
return yield window.electronStore.get(key);
|
|
1123
|
+
} catch (e) {
|
|
1124
|
+
return defaultValue;
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
const stored = localStorage.getItem(key);
|
|
1128
|
+
if (stored) {
|
|
1129
|
+
try {
|
|
1130
|
+
return JSON.parse(stored);
|
|
1131
|
+
} catch (e) {
|
|
1132
|
+
return stored;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
return defaultValue;
|
|
1136
|
+
});
|
|
1137
|
+
var setElectronStoreValue = (key, value) => __async(null, null, function* () {
|
|
1138
|
+
if (typeof window === "undefined") return;
|
|
1139
|
+
if (window.electronStore) {
|
|
1140
|
+
try {
|
|
1141
|
+
yield window.electronStore.set(key, value);
|
|
1142
|
+
} catch (error) {
|
|
1143
|
+
console.error("Failed to set Electron store value:", error);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
// src/utils/cssVariables.ts
|
|
1150
|
+
var getCssVariableNumber2 = (varName, defaultValue) => {
|
|
1151
|
+
if (typeof document === "undefined") return defaultValue;
|
|
1152
|
+
const value = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
1153
|
+
const parsed = parseInt(value, 10);
|
|
1154
|
+
return isNaN(parsed) ? defaultValue : parsed;
|
|
1155
|
+
};
|
|
1156
|
+
var getCssVariableString = (varName, defaultValue = "") => {
|
|
1157
|
+
if (typeof document === "undefined") return defaultValue;
|
|
1158
|
+
const value = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
1159
|
+
return value || defaultValue;
|
|
1160
|
+
};
|
|
1161
|
+
var DEFAULT_LAYOUT_DIMENSIONS = {
|
|
1162
|
+
sidebarLargeWidth: 255,
|
|
1163
|
+
sidebarSmallWidth: 64,
|
|
1164
|
+
sidebarHorizontalHeight: 120,
|
|
1165
|
+
logoVerticalMaxWidth: 130,
|
|
1166
|
+
logoVerticalMaxHeight: 130,
|
|
1167
|
+
logoHorizontalMaxWidth: 200,
|
|
1168
|
+
logoHorizontalMaxHeight: 60
|
|
1169
|
+
};
|
|
1170
|
+
var getLayoutDimensionsFromCss = () => {
|
|
1171
|
+
return {
|
|
1172
|
+
sidebarLargeWidth: getCssVariableNumber2("--sidebar-large-width", DEFAULT_LAYOUT_DIMENSIONS.sidebarLargeWidth),
|
|
1173
|
+
sidebarSmallWidth: getCssVariableNumber2("--sidebar-small-width", DEFAULT_LAYOUT_DIMENSIONS.sidebarSmallWidth),
|
|
1174
|
+
sidebarHorizontalHeight: getCssVariableNumber2("--sidebar-horizontal-height", DEFAULT_LAYOUT_DIMENSIONS.sidebarHorizontalHeight),
|
|
1175
|
+
logoVerticalMaxWidth: getCssVariableNumber2("--logo-vertical-max-width", DEFAULT_LAYOUT_DIMENSIONS.logoVerticalMaxWidth),
|
|
1176
|
+
logoVerticalMaxHeight: getCssVariableNumber2("--logo-vertical-max-height", DEFAULT_LAYOUT_DIMENSIONS.logoVerticalMaxHeight),
|
|
1177
|
+
logoHorizontalMaxWidth: getCssVariableNumber2("--logo-horizontal-max-width", DEFAULT_LAYOUT_DIMENSIONS.logoHorizontalMaxWidth),
|
|
1178
|
+
logoHorizontalMaxHeight: getCssVariableNumber2("--logo-horizontal-max-height", DEFAULT_LAYOUT_DIMENSIONS.logoHorizontalMaxHeight)
|
|
1179
|
+
};
|
|
1180
|
+
};
|
|
1181
|
+
var createDefaultPanelSettings = (options = {}) => {
|
|
1182
|
+
const dimensions = __spreadValues(__spreadValues(__spreadValues({}, DEFAULT_LAYOUT_DIMENSIONS), getLayoutDimensionsFromCss()), options.layoutDimensions);
|
|
1183
|
+
return __spreadProps(__spreadValues({
|
|
1184
|
+
appName: options.appName || "Dash App",
|
|
1185
|
+
horizontalLogo: options.horizontalLogo,
|
|
1186
|
+
squaredLogo: options.squaredLogo,
|
|
1187
|
+
loginBackground: options.loginBackground,
|
|
1188
|
+
sidebarPosition: options.sidebarPosition || "left"
|
|
1189
|
+
}, dimensions), {
|
|
1190
|
+
// Padding configuration (derived from sidebar sizes)
|
|
1191
|
+
paddingHorizontal: dimensions.sidebarLargeWidth,
|
|
1192
|
+
paddingVertical: dimensions.sidebarHorizontalHeight
|
|
1193
|
+
});
|
|
1194
|
+
};
|
|
1195
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1196
|
+
0 && (module.exports = {
|
|
1197
|
+
AppWrapperLight,
|
|
1198
|
+
CustomErrorBoundary,
|
|
1199
|
+
DEFAULT_LAYOUT_DIMENSIONS,
|
|
1200
|
+
DashThemeContext,
|
|
1201
|
+
DashThemeProviderLight,
|
|
1202
|
+
DefaultAppLoadErrorFallback,
|
|
1203
|
+
DefaultInitializationErrorFallback,
|
|
1204
|
+
GlobalLoaderHtmlMarkup,
|
|
1205
|
+
GlobalSmallLoader,
|
|
1206
|
+
I18nBridgeContext,
|
|
1207
|
+
I18nBridgeProviderLight,
|
|
1208
|
+
createDefaultPanelSettings,
|
|
1209
|
+
createLazyAppLoader,
|
|
1210
|
+
createSimpleI18nProvider,
|
|
1211
|
+
getCssVariableNumber,
|
|
1212
|
+
getCssVariableString,
|
|
1213
|
+
getElectronStoreValue,
|
|
1214
|
+
getLayoutDimensionsFromCss,
|
|
1215
|
+
initializeThemeEarly,
|
|
1216
|
+
injectCriticalStyles,
|
|
1217
|
+
isElectron,
|
|
1218
|
+
setElectronStoreValue,
|
|
1219
|
+
syncElectronStore,
|
|
1220
|
+
syncElectronStoreToLocalStorage,
|
|
1221
|
+
useAppInitialization,
|
|
1222
|
+
useBridgedChangeLocaleLight,
|
|
1223
|
+
useBridgedLocaleLight,
|
|
1224
|
+
useBridgedLocalesLight,
|
|
1225
|
+
useDashThemeContextLight,
|
|
1226
|
+
useEarlyThemeInit,
|
|
1227
|
+
useI18nBridgeLight,
|
|
1228
|
+
useInitializeReduxFromPersisted,
|
|
1229
|
+
useLogoutEventListener,
|
|
1230
|
+
usePathnameTracker,
|
|
1231
|
+
usePendingRedirect,
|
|
1232
|
+
useTranslateLight,
|
|
1233
|
+
useUrlLocaleDetection
|
|
1234
|
+
});
|