@tenorlab/react-dashboard 1.3.2 → 1.3.5

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/core.d.ts ADDED
@@ -0,0 +1,277 @@
1
+ export declare const blankDashboardConfig: IDashboardConfig;
2
+
3
+ /**
4
+ * @name createDynamicEntry
5
+ * Helper function to create dynamic entries
6
+ * This helps keep the catalog registration clean
7
+ */
8
+ export declare const createDynamicEntry: (key: string, loader: TWidgetFactoryBase, metaData: TWidgetMetaInfoBase) => [string, IDynamicWidgetCatalogEntryBase];
9
+
10
+ /**
11
+ * @name createStaticEntry
12
+ * Helper function to create static entries
13
+ * This helps keep the catalog registration clean
14
+ */
15
+ export declare const createStaticEntry: <TFrameworkComponentType = any>(key: string, component: TFrameworkComponentType, metaData?: TWidgetMetaInfoBase) => [string, IDynamicWidgetCatalogEntryBase];
16
+
17
+ export declare const cssSettingsCatalog: IDashboardSettingEntry[];
18
+
19
+ /**
20
+ * @name cssVarsUtils
21
+ * @description Provides helpers method like getCssVariableValue, setCssVariableValue etc
22
+ */
23
+ export declare const cssVarsUtils: {
24
+ /**
25
+ * @name getCssVariableValue
26
+ * @description Return the value of a CSS custom property from the current HTML document
27
+ * @param cssPropertyName
28
+ * @returns
29
+ */
30
+ getCssVariableValue: (cssPropertyName: string) => string | null;
31
+ /**
32
+ * @name setCssVariableValue
33
+ * @description Sets the value of a CSS custom property on the current HTML document
34
+ * @param cssPropertyName
35
+ * @param value
36
+ */
37
+ setCssVariableValue: (cssPropertyName: string, value: string) => void;
38
+ /**
39
+ * @name restoreCssVarsFromSettings
40
+ * @description
41
+ * Sets the values of many CSS custom properties on the current HTML document
42
+ * from the list of dashboard settings provided
43
+ * @param settings, an array of IDashboardSettingEntry
44
+ */
45
+ restoreCssVarsFromSettings: (settings: IDashboardSettingEntry[]) => void;
46
+ };
47
+
48
+ export declare const DashboardMaxZoomScale: 1;
49
+
50
+ export declare const DashboardMinZoomScale: 0.7;
51
+
52
+ export declare const dashboardSettingsUtils: {
53
+ incrementOrDecrementValue: (item: IDashboardSettingEntry, direction: -1 | 1) => IDashboardSettingEntry;
54
+ };
55
+
56
+ export declare const DashboardZoomStep: 0.05;
57
+
58
+ /**
59
+ * @name ensureContainersSequence
60
+ * @description
61
+ * Ensures that the container widgets are numbered sequentially in the dashboardConfig, but the original order is preserved.
62
+ */
63
+ export declare const ensureContainersSequence: (dashboardConfig: IDashboardConfig) => IDashboardConfig;
64
+
65
+ export declare const ensureZoomScaleIsWithinRange: (value: number) => number;
66
+
67
+ export declare const getDefaultWidgetMetaFromKey: TGetDefaultWidgetMetaFromKey;
68
+
69
+ /**
70
+ * @name getDefaultWidgetMetaFromMap
71
+ * @description Helper to get widget meta info from the catalog by key.
72
+ */
73
+ export declare const getDefaultWidgetMetaFromMap: <TFrameworkElementType = any>(widgetKey: TDashboardWidgetKey, defaultWidgetMetaMap: Record<TDashboardWidgetKey, TWidgetMetaInfoBase<TFrameworkElementType>>, options?: {
74
+ title?: string;
75
+ description?: string;
76
+ }) => TWidgetMetaInfoBase<TFrameworkElementType>;
77
+
78
+ /**
79
+ * @name getDistinctCssClasses
80
+ * @description Ensures a distinct list off css classes, avoiding duplicates
81
+ * @param defaultClasses
82
+ * @param additionalClasses
83
+ * @returns the distinct list as a string
84
+ */
85
+ export declare const getDistinctCssClasses: (defaultClasses: string, ...additionalClasses: string[]) => string;
86
+
87
+ export declare const getMetaInfoFromFile: (widgetMetaModules: Record<string, Record<string, TWidgetMetaInfoBase>>, baseSrcPath: string, folder: string, key: string) => TWidgetMetaInfoBase | undefined;
88
+
89
+ export declare const getNewZoomScaleWithinRange: (currentZoomScale: number, direction: -1 | 1) => number;
90
+
91
+ /**
92
+ * @name getWidgetMetaFromCatalog
93
+ * @description Helper to get widget meta info from the catalog by key.
94
+ */
95
+ export declare const getWidgetMetaFromCatalog: <TFrameworkElementType = any, TFrameworkComponentType = any>(widgetKey: TDashboardWidgetKey, widgetsCatalog: TDashboardWidgetCatalogBase<TFrameworkElementType, TFrameworkComponentType>) => TWidgetMetaInfoBase<TFrameworkElementType>;
96
+
97
+ export declare interface IChildWidgetConfigEntry {
98
+ parentWidgetKey: TDashboardWidgetKey;
99
+ widgetKey: TDashboardWidgetKey;
100
+ }
101
+
102
+ export declare interface IDashboardConfig {
103
+ userID: number | string;
104
+ clientAppKey: string;
105
+ dashboardId: string;
106
+ dashboardName: string;
107
+ zoomScale: number;
108
+ responsiveGrid: boolean;
109
+ widgets: TDashboardWidgetKey[];
110
+ childWidgetsConfig: IChildWidgetConfigEntry[];
111
+ cssSettings: IDashboardSettingEntry[];
112
+ _version?: number;
113
+ _stateDescription?: string;
114
+ }
115
+
116
+ export declare interface IDashboardGridPropsBase {
117
+ isEditing: boolean;
118
+ zoomScale: number;
119
+ responsiveGrid: boolean;
120
+ }
121
+
122
+ export declare interface IDashboardSettingEntry {
123
+ key: string;
124
+ name: string;
125
+ description: string;
126
+ cssProperty: string;
127
+ step: number;
128
+ defaultUnit: string;
129
+ minValue: number;
130
+ defaultValue: string;
131
+ value: string;
132
+ }
133
+
134
+ export declare interface IDashboardStorageService {
135
+ getSavedDashboards: TGetSavedDashboards;
136
+ saveDashboards: TSaveDashboards;
137
+ }
138
+
139
+ export declare interface IDashboardWidgetPropsBase<TExtraProps = any> {
140
+ index: number;
141
+ maxIndex: number;
142
+ widgetKey: TDashboardWidgetKey;
143
+ parentWidgetKey?: TDashboardWidgetKey;
144
+ isEditing: boolean;
145
+ highlight?: boolean;
146
+ testId?: string;
147
+ title?: string;
148
+ size?: TWidgetSize;
149
+ borderCssClasses?: string;
150
+ backgroundCssClasses?: string;
151
+ hideTitle?: boolean;
152
+ noShadow?: boolean;
153
+ noBorder?: boolean;
154
+ noPadding?: boolean;
155
+ direction?: TWidgetDirection;
156
+ extraProps?: TExtraProps;
157
+ }
158
+
159
+ /**
160
+ * 2. Define the flexible Catalog Entry
161
+ * Definition of a single widget or container in the catalog.
162
+ * It must have EITHER a direct 'component' reference OR a 'loader' function.
163
+ *
164
+ * TFrameworkElementType: see TWidgetMetaInfoBase
165
+ * TFrameworkComponentType: i.e. React.ComponentType<any> (see TWidgetFactoryBase)
166
+ */
167
+ export declare interface IDynamicWidgetCatalogEntryBase<TFrameworkElementType = any, TFrameworkComponentType = any> {
168
+ key: TDashboardWidgetKey;
169
+ title: string;
170
+ isContainer?: boolean;
171
+ meta?: TWidgetMetaInfoBase<TFrameworkElementType>;
172
+ component?: TFrameworkComponentType;
173
+ loader?: TWidgetFactoryBase<TFrameworkComponentType>;
174
+ }
175
+
176
+ /**
177
+ * @name localWidgetDiscovery
178
+ * @description Scans local directories for widgets.
179
+ * If lazy is true, it registers loaders. If false, it registers static components.
180
+ */
181
+ export declare const localWidgetDiscovery: (baseSrcPath: string, // e.g., "/src/async-widgets" or "/src/bundled-widgets"
182
+ widgetModules: Record<string, any>, widgetMetaModules: Record<string, any>, lazy?: boolean) => [string, IDynamicWidgetCatalogEntryBase][];
183
+
184
+ export declare const parseContainerTitle: (containerWidgetKey: TDashboardWidgetKey) => string;
185
+
186
+ /**
187
+ * Enhanced helper to derive key and title from widget file paths.
188
+ * Handles:
189
+ * - widget-revenue-trends1 -> WidgetRevenueTrends1
190
+ * - widget-with-extraprops -> WidgetWithExtraprops
191
+ * - widget-revenue-trends-async -> WidgetRevenueTrendsAsync
192
+ */
193
+ export declare const parseKeyAndTitleFromFilePath: (path: string) => {
194
+ key: TDashboardWidgetKey;
195
+ title: string;
196
+ folder: string;
197
+ } | null;
198
+
199
+ export declare const remoteWidgetDiscovery: (manifestUrl: string) => Promise<{
200
+ entries: [string, IDynamicWidgetCatalogEntryBase][];
201
+ message: string;
202
+ details: string;
203
+ }>;
204
+
205
+ export declare const removeEmptyContainers: (dashboardConfig: IDashboardConfig) => IDashboardConfig;
206
+
207
+ /**
208
+ * @name resolveColorFromClass
209
+ * @description Resolves the current computed color using your existing CSS classes
210
+ * @param classNames, i.e. 'bg-primary'
211
+ * @param property to resolve, i.e. 'backgroundColor'
212
+ * @returns
213
+ */
214
+ export declare const resolveColorFromClass: (classNames: string | string[], property?: "color" | "backgroundColor") => string;
215
+
216
+ export declare type TDashboardUndoStatus = {
217
+ isUndoDisabled: boolean;
218
+ isRedoDisabled: boolean;
219
+ _currentIndex?: number;
220
+ _historyLength?: number;
221
+ };
222
+
223
+ export declare type TDashboardWidgetCatalogBase<TFrameworkElementType = any, TFrameworkComponentType = any> = Map<TDashboardWidgetKey, IDynamicWidgetCatalogEntryBase<TFrameworkElementType, TFrameworkComponentType>>;
224
+
225
+ export declare type TDashboardWidgetKey = string;
226
+
227
+ export declare type TGetDefaultWidgetMetaFromKey = (widgetKey: TDashboardWidgetKey, options?: TGetDefaultWidgetMetaFromKeyOptions) => TWidgetMetaInfoBase<any>;
228
+
229
+ export declare type TGetDefaultWidgetMetaFromKeyOptions = {
230
+ title?: string;
231
+ description?: string;
232
+ };
233
+
234
+ export declare type TGetSavedDashboards = (userID: number | string, clientAppKey: string, widgetCatalog: TDashboardWidgetCatalogBase, defaultDashboardConfig: IDashboardConfig) => Promise<IDashboardConfig[]>;
235
+
236
+ export declare type TManifestEntry = {
237
+ url: string;
238
+ meta: TWidgetMetaInfoBase;
239
+ };
240
+
241
+ export declare type TSaveDashboards = (userID: number | string, clientAppKey: string, dashboardConfigs: IDashboardConfig[], widgetCatalog: TDashboardWidgetCatalogBase) => Promise<boolean>;
242
+
243
+ export declare type TUndoHistoryEntry = {
244
+ undoIndex: number;
245
+ config: IDashboardConfig;
246
+ };
247
+
248
+ export declare type TWidgetCategory = 'Widget' | 'Chart' | 'Container';
249
+
250
+ export declare type TWidgetDirection = 'row' | 'column';
251
+
252
+ /**
253
+ * 1. Define the Async Loader type
254
+ * Type for the function that performs the asynchronous dynamic import.
255
+ * It must return a promise that resolves to the module containing the widget component
256
+ * as its default export (or a named export if you change the loading strategy).
257
+ *
258
+ * TFrameworkComponent could be "React.ComponentType<any>"" or "VueComponent" etc
259
+ */
260
+ export declare type TWidgetFactoryBase<TFrameworkComponent = any> = () => Promise<{
261
+ default: TFrameworkComponent;
262
+ }>;
263
+
264
+ export declare type TWidgetMetaInfoBase<TFrameworkElementType = any> = {
265
+ name: string;
266
+ description: string;
267
+ categories: TWidgetCategory[];
268
+ noDuplicatedWidgets?: boolean;
269
+ icon: TFrameworkElementType | undefined;
270
+ externalDependencies: string[];
271
+ };
272
+
273
+ export declare type TWidgetSize = 'default' | 'large' | 'xlarge';
274
+
275
+ export declare const useDashboardStorageService: () => IDashboardStorageService;
276
+
277
+ export { }
@@ -0,0 +1,360 @@
1
+ const w = [
2
+ {
3
+ key: "grid-gap",
4
+ name: "Gap",
5
+ description: "Set the gap between widgets in the dashboard grid",
6
+ cssProperty: "--bwj-dashboard-gap",
7
+ step: 0.1,
8
+ defaultUnit: "rem",
9
+ minValue: 0,
10
+ defaultValue: "1.25rem",
11
+ value: "1.25rem"
12
+ },
13
+ {
14
+ key: "widget-width",
15
+ name: "Widget Width",
16
+ description: "Set the min width for the widgets",
17
+ cssProperty: "--bwj-widget-width",
18
+ step: 0.1,
19
+ defaultUnit: "rem",
20
+ minValue: 6,
21
+ defaultValue: "21rem",
22
+ value: "21rem"
23
+ },
24
+ {
25
+ key: "widget-border-radius",
26
+ name: "Widget Border Radius",
27
+ description: "Set the border radius for the widgets",
28
+ cssProperty: "--bwj-widget-border-radius",
29
+ step: 0.1,
30
+ defaultUnit: "rem",
31
+ minValue: 0,
32
+ defaultValue: "0.33rem",
33
+ value: "0.33rem"
34
+ },
35
+ {
36
+ key: "widget-inner-padding-x",
37
+ name: "Widget Horiz Padding",
38
+ description: "Set the horizontal padding for the widgets",
39
+ cssProperty: "--bwj-widget-inner-px",
40
+ step: 0.1,
41
+ defaultUnit: "rem",
42
+ minValue: 0,
43
+ defaultValue: "1.0rem",
44
+ value: "1.0rem"
45
+ },
46
+ {
47
+ key: "widget-inner-padding-y",
48
+ name: "Widget Vertical Padding",
49
+ description: "Set the vertical padding for the widgets",
50
+ cssProperty: "--bwj-widget-inner-py",
51
+ step: 0.1,
52
+ defaultUnit: "rem",
53
+ minValue: 0,
54
+ defaultValue: "0.75rem",
55
+ value: "0.75rem"
56
+ },
57
+ {
58
+ key: "widget-header-padding-y",
59
+ name: "Widget Header Vertical Padding",
60
+ description: "Set the vertical padding for the widget headers",
61
+ cssProperty: "--bwj-widget-header-py",
62
+ step: 0.1,
63
+ defaultUnit: "rem",
64
+ minValue: 0,
65
+ defaultValue: "1.0rem",
66
+ value: "1.0rem"
67
+ },
68
+ {
69
+ key: "widget-title-font-size",
70
+ name: "Widget Title Font Size",
71
+ description: "Set the font size for the widget titles",
72
+ cssProperty: "--bwj-widget-title-size",
73
+ step: 0.1,
74
+ defaultUnit: "rem",
75
+ minValue: 0,
76
+ defaultValue: "1.0rem",
77
+ value: "1.0rem"
78
+ }
79
+ ], S = ["rem", "pc", "cm", "in", "em", "vh", "vw", "%"], b = (e, t) => S.includes(e) ? t : 1, E = {
80
+ incrementOrDecrementValue: (e, t) => {
81
+ const i = e.value.match(/([\d.]+)/), a = i ? parseFloat(i[1]) : 0, s = e.value.match(/([^\d.]+)/), n = s ? s[1] : e.defaultUnit, r = b(n, e.step) * t, c = `${Math.max(a + r, e.minValue).toFixed(1)}${n}`;
82
+ return {
83
+ ...e,
84
+ value: c
85
+ };
86
+ }
87
+ }, f = (e, t) => `dashboards_${t}_${e}`, v = async (e, t, i, a) => {
88
+ const s = localStorage.getItem(f(e, t));
89
+ if (s)
90
+ try {
91
+ const n = JSON.parse(s);
92
+ return n.length < 1 ? [a] : (n.forEach((r) => {
93
+ r.dashboardId || (r.dashboardId = "default"), r.dashboardName || (r.dashboardName = `Dashboard ${r.dashboardId}`), r.responsiveGrid = r.responsiveGrid ?? !1, (r.widgets || []).length < 1 && (r.widgets = a.widgets);
94
+ const c = (r.cssSettings || []).filter(
95
+ (o) => a.cssSettings.some((d) => d.key === o.key)
96
+ );
97
+ if (c.length < 1)
98
+ r.cssSettings = [...a.cssSettings];
99
+ else {
100
+ c.forEach((d) => {
101
+ d.value = (d.value || "").replace(/NaN/g, "");
102
+ const l = a.cssSettings.find(
103
+ (g) => g.key === d.key
104
+ );
105
+ l && (Object.keys(l).forEach((g) => {
106
+ g in d || (d[g] = l[g]);
107
+ }), d.step = l.step, d.minValue = l.minValue, d.defaultValue = l.defaultValue, d.defaultUnit = l.defaultUnit, /\d+/g.test(d.value) === !1 && (d.value = l ? l.value : "1.0rem"));
108
+ });
109
+ const o = a.cssSettings.filter((d) => !c.some(
110
+ (l) => l.key === d.key
111
+ ));
112
+ r.cssSettings = [...c, ...o];
113
+ }
114
+ r.widgets = r.widgets.filter(
115
+ (o) => o.includes("WidgetContainer") || i.has(o)
116
+ ), r.childWidgetsConfig = r.childWidgetsConfig.filter(
117
+ (o) => i.has(o.widgetKey)
118
+ ), r.zoomScale ? r.zoomScale < 0.7 && (r.zoomScale = 0.7) : r.zoomScale = 1;
119
+ }), n);
120
+ } catch (n) {
121
+ console.warn("Error parsing saved dashboard config:", n);
122
+ }
123
+ return [a];
124
+ }, C = async (e, t, i, a) => {
125
+ i.forEach((n) => {
126
+ if (n.userID = e, n.clientAppKey = t, n.responsiveGrid = n.responsiveGrid ?? !1, typeof n != "object")
127
+ throw new Error("Invalid dashboard configuration");
128
+ n.widgets = n.widgets.filter(
129
+ (r) => r.includes("WidgetContainer") || a.has(r)
130
+ ), n.childWidgetsConfig = n.childWidgetsConfig.filter(
131
+ (r) => a.has(r.widgetKey)
132
+ ), n.zoomScale ? n.zoomScale < 0.7 && (n.zoomScale = 0.7) : n.zoomScale = 1;
133
+ });
134
+ const s = JSON.stringify(i);
135
+ return localStorage.setItem(f(e, t), s), !0;
136
+ }, W = {
137
+ getSavedDashboards: v,
138
+ saveDashboards: C
139
+ }, P = () => W, z = {
140
+ userID: 0,
141
+ clientAppKey: "",
142
+ dashboardId: "default",
143
+ dashboardName: "Default",
144
+ zoomScale: 1,
145
+ responsiveGrid: !1,
146
+ widgets: [],
147
+ childWidgetsConfig: [],
148
+ cssSettings: [...w]
149
+ }, U = (e) => {
150
+ const t = `${e}`.split("_");
151
+ return t.length > 1 ? t[1].replace(/(\D)(\d+)/, "$1 $2") : "Container";
152
+ }, m = 0.7, p = 1, V = 0.05, D = (e) => {
153
+ let t = Number(e || 0);
154
+ return t < m && (t = m), t > p && (t = p), t;
155
+ }, j = (e, t) => {
156
+ let i = Number(Number((V * t).toFixed(2)).toFixed(2)), a = Number((Number(e) + i).toFixed(2));
157
+ return D(a);
158
+ }, N = (e) => {
159
+ let t = {
160
+ ...e
161
+ };
162
+ return t.widgets = t.widgets.filter((i) => {
163
+ if (`${i}`.includes("WidgetContainer")) {
164
+ const a = t.childWidgetsConfig.filter(
165
+ (s) => s.parentWidgetKey === i
166
+ );
167
+ if (!a || a.length === 0)
168
+ return t.widgets = t.widgets.filter(
169
+ (s) => s !== i
170
+ ), !1;
171
+ }
172
+ return !0;
173
+ }), t;
174
+ }, x = (e) => {
175
+ const t = e.widgets.filter(
176
+ (a) => a.includes("WidgetContainer")
177
+ ), i = {};
178
+ return t.forEach((a, s) => {
179
+ const n = `${a.split("_container")[0]}_container${s + 1}`;
180
+ i[a] = n;
181
+ }), e.widgets = e.widgets.map((a) => i[a] || a), e.childWidgetsConfig = e.childWidgetsConfig.map((a) => {
182
+ const s = a.parentWidgetKey, n = i[s];
183
+ return {
184
+ ...a,
185
+ // If a new key exists, use it. If not, keep the original key.
186
+ parentWidgetKey: n || s
187
+ };
188
+ }), e;
189
+ }, u = (e, t) => {
190
+ const i = `${e}`.includes("Container"), a = i ? ["Container"] : ["Widget"], s = t?.name || e, n = t?.description || (i ? "Container" : "Unknown");
191
+ return {
192
+ name: s,
193
+ description: n,
194
+ categories: a,
195
+ noDuplicatedWidgets: !0,
196
+ icon: void 0,
197
+ externalDependencies: []
198
+ };
199
+ }, I = (e, t, i) => t[e] || u(e, i), M = (e, t) => t.get(e)?.meta || u(e), k = (e, t, i) => {
200
+ const a = i || u(e);
201
+ return [
202
+ e,
203
+ {
204
+ key: e,
205
+ title: a.name,
206
+ isContainer: `${e}`.includes("Container"),
207
+ meta: a,
208
+ component: t
209
+ }
210
+ ];
211
+ }, h = (e, t, i) => {
212
+ const a = i || u(e);
213
+ return [
214
+ e,
215
+ {
216
+ key: e,
217
+ title: a.name,
218
+ isContainer: !1,
219
+ meta: a,
220
+ loader: t
221
+ }
222
+ ];
223
+ }, F = (e) => {
224
+ const t = e.match(/\/widget-([a-zA-Z0-9-]+)\/index\.ts$/);
225
+ if (t && t[1]) {
226
+ const i = t[1], a = i.split("-"), s = `Widget${a.map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join("")}`, n = a.map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" ");
227
+ return {
228
+ key: s,
229
+ title: n,
230
+ folder: i
231
+ };
232
+ }
233
+ return null;
234
+ }, $ = (e, t, i, a) => {
235
+ const s = `${t}/widget-${i}/meta.ts`, n = e[s];
236
+ if (!n)
237
+ return;
238
+ const r = `${a}Meta`;
239
+ return n[r] || void 0;
240
+ }, A = async (e) => new Promise(async (t, i) => {
241
+ const a = [];
242
+ try {
243
+ const s = await (await fetch(`${e}?${Math.random()}`)).json();
244
+ for (const n in s) {
245
+ const r = s[n], c = () => import(
246
+ /* @vite-ignore */
247
+ r.url
248
+ ), o = {
249
+ name: r.meta?.name || "Unknown",
250
+ description: r.meta?.description || "Remote Plugin",
251
+ categories: r.meta?.categories || ["Widget"],
252
+ noDuplicatedWidgets: r.meta?.noDuplicatedWidgets ?? !0,
253
+ icon: void 0,
254
+ // Or a logic to map a string name to a Lucide component
255
+ externalDependencies: r.meta?.externalDependencies || []
256
+ };
257
+ a.push(h(n, c, o));
258
+ }
259
+ t({
260
+ entries: a,
261
+ message: "",
262
+ details: ""
263
+ });
264
+ } catch (s) {
265
+ console.error("Remote plugin discovery failed:", s), i({
266
+ entries: [],
267
+ message: "Remote plugin discovery failed:",
268
+ details: typeof s == "object" ? JSON.stringify(s) : s
269
+ });
270
+ }
271
+ }), K = (e, t, i, a = !0) => {
272
+ const s = [];
273
+ for (const n in t) {
274
+ const r = t[n], c = F(n);
275
+ if (c && r) {
276
+ const { key: o, title: d, folder: l } = c;
277
+ let g = $(i, e, l, o);
278
+ if (g || (g = u(o, {
279
+ description: `Local ${a ? "dynamic" : "static"} widget`
280
+ })), a)
281
+ s.push(
282
+ h(o, r, g)
283
+ );
284
+ else {
285
+ const y = r.default || r;
286
+ s.push(k(o, y, g));
287
+ }
288
+ }
289
+ }
290
+ return s;
291
+ }, G = (e, t = "color") => {
292
+ if (typeof window > "u") return "#FFFFFF";
293
+ const i = document.createElement("div");
294
+ Array.isArray(e) ? e.forEach((s) => i.classList.add(s)) : e.split(" ").forEach((s) => i.classList.add(s)), i.style.display = "none", document.body.appendChild(i);
295
+ const a = window.getComputedStyle(i)[t];
296
+ return document.body.removeChild(i), a;
297
+ }, R = {
298
+ /**
299
+ * @name getCssVariableValue
300
+ * @description Return the value of a CSS custom property from the current HTML document
301
+ * @param cssPropertyName
302
+ * @returns
303
+ */
304
+ getCssVariableValue: (e) => {
305
+ const t = document.documentElement;
306
+ return getComputedStyle(t).getPropertyValue(e).trim() || null;
307
+ },
308
+ /**
309
+ * @name setCssVariableValue
310
+ * @description Sets the value of a CSS custom property on the current HTML document
311
+ * @param cssPropertyName
312
+ * @param value
313
+ */
314
+ setCssVariableValue: (e, t) => {
315
+ document.documentElement.style.setProperty(e, t);
316
+ },
317
+ /**
318
+ * @name restoreCssVarsFromSettings
319
+ * @description
320
+ * Sets the values of many CSS custom properties on the current HTML document
321
+ * from the list of dashboard settings provided
322
+ * @param settings, an array of IDashboardSettingEntry
323
+ */
324
+ restoreCssVarsFromSettings: (e) => {
325
+ const t = document.documentElement;
326
+ e.forEach((i) => {
327
+ t.style.setProperty(i.cssProperty, i.value);
328
+ });
329
+ }
330
+ }, Z = (e, ...t) => [
331
+ ...new Set(
332
+ [e || "", ...t].join(" ").trim().replace(/\n+/gi, " ").replace(/\s+/gi, " ").split(" ")
333
+ )
334
+ ].join(" ").trim();
335
+ export {
336
+ p as DashboardMaxZoomScale,
337
+ m as DashboardMinZoomScale,
338
+ V as DashboardZoomStep,
339
+ z as blankDashboardConfig,
340
+ h as createDynamicEntry,
341
+ k as createStaticEntry,
342
+ w as cssSettingsCatalog,
343
+ R as cssVarsUtils,
344
+ E as dashboardSettingsUtils,
345
+ x as ensureContainersSequence,
346
+ D as ensureZoomScaleIsWithinRange,
347
+ u as getDefaultWidgetMetaFromKey,
348
+ I as getDefaultWidgetMetaFromMap,
349
+ Z as getDistinctCssClasses,
350
+ $ as getMetaInfoFromFile,
351
+ j as getNewZoomScaleWithinRange,
352
+ M as getWidgetMetaFromCatalog,
353
+ K as localWidgetDiscovery,
354
+ U as parseContainerTitle,
355
+ F as parseKeyAndTitleFromFilePath,
356
+ A as remoteWidgetDiscovery,
357
+ N as removeEmptyContainers,
358
+ G as resolveColorFromClass,
359
+ P as useDashboardStorageService
360
+ };