@devicechain/widgets 0.26.0 → 0.27.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/aggregate-feed.d.ts +5 -2
- package/dist/binding-policy.d.ts +1 -0
- package/dist/chunks/{aggregate-feed-7JBQIYJE.js → aggregate-feed-HCF5FYIJ.js} +14 -4
- package/dist/chunks/aggregate-feed-HCF5FYIJ.js.map +7 -0
- package/dist/chunks/{aggregate-widgets-72HMPMBU.js → aggregate-widgets-EVJNAA26.js} +5 -5
- package/dist/chunks/{chunk-NYHNQ5VR.js → chunk-GUCEPNGM.js} +6 -2
- package/dist/chunks/{chunk-NYHNQ5VR.js.map → chunk-GUCEPNGM.js.map} +2 -2
- package/dist/chunks/chunk-QHTO5ZEM.js +35 -0
- package/dist/chunks/chunk-QHTO5ZEM.js.map +7 -0
- package/dist/chunks/{compare-feed-5OLZHFRL.js → compare-feed-MLHG7YFN.js} +8 -8
- package/dist/chunks/{event-markers-feed-B3MVFYUT.js → event-markers-feed-DMRW5GV5.js} +2 -2
- package/dist/chunks/{fleet-feed-D4T3LC25.js → fleet-feed-AKJ7QIMP.js} +5 -5
- package/dist/chunks/{history-widgets-MBR4YRBV.js → history-widgets-DZBMNMEX.js} +2 -2
- package/dist/chunks/{presence-widgets-M5VGG3OO.js → presence-widgets-7OGANOLB.js} +2 -2
- package/dist/host-context.d.ts +2 -0
- package/dist/host-context.js +13 -0
- package/dist/host-context.js.map +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +153 -173
- package/dist/index.js.map +4 -4
- package/package.json +11 -7
- package/dist/chunks/aggregate-feed-7JBQIYJE.js.map +0 -7
- /package/dist/chunks/{aggregate-widgets-72HMPMBU.js.map → aggregate-widgets-EVJNAA26.js.map} +0 -0
- /package/dist/chunks/{compare-feed-5OLZHFRL.js.map → compare-feed-MLHG7YFN.js.map} +0 -0
- /package/dist/chunks/{event-markers-feed-B3MVFYUT.js.map → event-markers-feed-DMRW5GV5.js.map} +0 -0
- /package/dist/chunks/{fleet-feed-D4T3LC25.js.map → fleet-feed-AKJ7QIMP.js.map} +0 -0
- /package/dist/chunks/{history-widgets-MBR4YRBV.js.map → history-widgets-DZBMNMEX.js.map} +0 -0
- /package/dist/chunks/{presence-widgets-M5VGG3OO.js.map → presence-widgets-7OGANOLB.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useHeld
|
|
3
|
+
} from "./chunks/chunk-XNEBAY4J.js";
|
|
1
4
|
import {
|
|
2
5
|
EntitySelector
|
|
3
6
|
} from "./chunks/chunk-FM7OI5TQ.js";
|
|
@@ -12,9 +15,31 @@ import {
|
|
|
12
15
|
lazyChunk
|
|
13
16
|
} from "./chunks/chunk-BMFQOTYG.js";
|
|
14
17
|
import {
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
alarmSubscription,
|
|
19
|
+
commandSubscription,
|
|
20
|
+
groupsAlarmsByDeviceType,
|
|
21
|
+
historyMode,
|
|
22
|
+
measurementIsMembersOnly,
|
|
23
|
+
measurementSpan,
|
|
24
|
+
measurementWindow,
|
|
25
|
+
membersMode,
|
|
26
|
+
presenceMode,
|
|
27
|
+
takesHistorySeed,
|
|
28
|
+
wantsEventMarkers
|
|
29
|
+
} from "./chunks/chunk-GUCEPNGM.js";
|
|
30
|
+
import {
|
|
31
|
+
MapRuntimeProvider,
|
|
32
|
+
TenantBasemapProvider,
|
|
33
|
+
useMapRuntime,
|
|
34
|
+
useTenantBasemap
|
|
35
|
+
} from "./chunks/chunk-QHTO5ZEM.js";
|
|
36
|
+
import {
|
|
37
|
+
accessStrings
|
|
38
|
+
} from "./chunks/chunk-BRH66T5F.js";
|
|
17
39
|
import "./chunks/chunk-JVC6JYUR.js";
|
|
40
|
+
import {
|
|
41
|
+
LevelReadout
|
|
42
|
+
} from "./chunks/chunk-EQOWBDS7.js";
|
|
18
43
|
import {
|
|
19
44
|
AlarmCount,
|
|
20
45
|
AlarmSeverity,
|
|
@@ -35,24 +60,6 @@ import {
|
|
|
35
60
|
parseParameterSchema,
|
|
36
61
|
validateParams
|
|
37
62
|
} from "./chunks/chunk-XSLFHCNI.js";
|
|
38
|
-
import {
|
|
39
|
-
alarmSubscription,
|
|
40
|
-
commandSubscription,
|
|
41
|
-
groupsAlarmsByDeviceType,
|
|
42
|
-
historyMode,
|
|
43
|
-
measurementIsMembersOnly,
|
|
44
|
-
measurementSpan,
|
|
45
|
-
measurementWindow,
|
|
46
|
-
membersMode,
|
|
47
|
-
presenceMode,
|
|
48
|
-
wantsEventMarkers
|
|
49
|
-
} from "./chunks/chunk-NYHNQ5VR.js";
|
|
50
|
-
import {
|
|
51
|
-
accessStrings
|
|
52
|
-
} from "./chunks/chunk-BRH66T5F.js";
|
|
53
|
-
import {
|
|
54
|
-
LevelReadout
|
|
55
|
-
} from "./chunks/chunk-EQOWBDS7.js";
|
|
56
63
|
|
|
57
64
|
// src/dashboard-renderer.tsx
|
|
58
65
|
import {
|
|
@@ -1271,7 +1278,7 @@ var builtinWidgetDescriptors = {
|
|
|
1271
1278
|
var builtinWidgetCatalog = createWidgetCatalog(Object.values(builtinWidgetDescriptors));
|
|
1272
1279
|
|
|
1273
1280
|
// src/widgets/aggregate-lazy.tsx
|
|
1274
|
-
var chunk = lazyChunk(() => import("./chunks/aggregate-widgets-
|
|
1281
|
+
var chunk = lazyChunk(() => import("./chunks/aggregate-widgets-EVJNAA26.js"));
|
|
1275
1282
|
var loadAggregateWidgets = chunk.load;
|
|
1276
1283
|
var statCardWidget = defineWidget({
|
|
1277
1284
|
descriptor: builtinWidgetDescriptors["stat-card"],
|
|
@@ -1330,7 +1337,7 @@ var commandButtonWidget = defineWidget3({
|
|
|
1330
1337
|
|
|
1331
1338
|
// src/widgets/history-lazy.tsx
|
|
1332
1339
|
import { defineWidget as defineWidget4 } from "@devicechain/widget-sdk";
|
|
1333
|
-
var chunk4 = lazyChunk(() => import("./chunks/history-widgets-
|
|
1340
|
+
var chunk4 = lazyChunk(() => import("./chunks/history-widgets-DZBMNMEX.js"));
|
|
1334
1341
|
var loadHistoryWidgets = chunk4.load;
|
|
1335
1342
|
var historyTableWidget = defineWidget4({
|
|
1336
1343
|
descriptor: builtinWidgetDescriptors["history-table"],
|
|
@@ -1339,7 +1346,7 @@ var historyTableWidget = defineWidget4({
|
|
|
1339
1346
|
|
|
1340
1347
|
// src/widgets/presence-lazy.tsx
|
|
1341
1348
|
import { defineWidget as defineWidget5 } from "@devicechain/widget-sdk";
|
|
1342
|
-
var chunk5 = lazyChunk(() => import("./chunks/presence-widgets-
|
|
1349
|
+
var chunk5 = lazyChunk(() => import("./chunks/presence-widgets-7OGANOLB.js"));
|
|
1343
1350
|
var loadPresenceWidgets = chunk5.load;
|
|
1344
1351
|
var deviceStatusWidget = defineWidget5({
|
|
1345
1352
|
descriptor: builtinWidgetDescriptors["device-status"],
|
|
@@ -1707,36 +1714,6 @@ var progressRingWidget = defineWidget11({
|
|
|
1707
1714
|
// src/widgets/map.tsx
|
|
1708
1715
|
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
1709
1716
|
import { renderableBasemap, resolveBasemap } from "@devicechain/client";
|
|
1710
|
-
|
|
1711
|
-
// src/basemap-context.tsx
|
|
1712
|
-
import { createContext, useContext } from "react";
|
|
1713
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1714
|
-
var TenantBasemapContext = createContext(null);
|
|
1715
|
-
function TenantBasemapProvider({
|
|
1716
|
-
basemap,
|
|
1717
|
-
children
|
|
1718
|
-
}) {
|
|
1719
|
-
return /* @__PURE__ */ jsx5(TenantBasemapContext.Provider, { value: basemap, children });
|
|
1720
|
-
}
|
|
1721
|
-
function useTenantBasemap() {
|
|
1722
|
-
return useContext(TenantBasemapContext);
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
// src/map-runtime-context.tsx
|
|
1726
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
1727
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1728
|
-
var MapRuntimeContext = createContext2(null);
|
|
1729
|
-
function MapRuntimeProvider({
|
|
1730
|
-
runtime,
|
|
1731
|
-
children
|
|
1732
|
-
}) {
|
|
1733
|
-
return /* @__PURE__ */ jsx6(MapRuntimeContext.Provider, { value: runtime, children });
|
|
1734
|
-
}
|
|
1735
|
-
function useMapRuntime() {
|
|
1736
|
-
return useContext2(MapRuntimeContext);
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
|
-
// src/widgets/map.tsx
|
|
1740
1717
|
import {
|
|
1741
1718
|
css as css4,
|
|
1742
1719
|
fontVar as fontVar4,
|
|
@@ -1839,7 +1816,7 @@ function loadLandStyle() {
|
|
|
1839
1816
|
}
|
|
1840
1817
|
|
|
1841
1818
|
// src/widgets/map.tsx
|
|
1842
|
-
import { jsx as
|
|
1819
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1843
1820
|
var mapLibrePromise;
|
|
1844
1821
|
function loadMapLibre(runtime) {
|
|
1845
1822
|
if (!mapLibrePromise) {
|
|
@@ -1871,7 +1848,7 @@ function MapWidget({ widget, data }) {
|
|
|
1871
1848
|
)
|
|
1872
1849
|
);
|
|
1873
1850
|
if (data.forbidden) {
|
|
1874
|
-
return /* @__PURE__ */
|
|
1851
|
+
return /* @__PURE__ */ jsx5(WidgetFrame5, { title, children: /* @__PURE__ */ jsx5(
|
|
1875
1852
|
MapNotice,
|
|
1876
1853
|
{
|
|
1877
1854
|
glyph: "\u{1F512}",
|
|
@@ -1881,7 +1858,7 @@ function MapWidget({ widget, data }) {
|
|
|
1881
1858
|
) });
|
|
1882
1859
|
}
|
|
1883
1860
|
if (!runtime) {
|
|
1884
|
-
return /* @__PURE__ */
|
|
1861
|
+
return /* @__PURE__ */ jsx5(WidgetFrame5, { title, children: /* @__PURE__ */ jsx5(
|
|
1885
1862
|
MapNotice,
|
|
1886
1863
|
{
|
|
1887
1864
|
glyph: "\u{1F9E9}",
|
|
@@ -1891,10 +1868,10 @@ function MapWidget({ widget, data }) {
|
|
|
1891
1868
|
) });
|
|
1892
1869
|
}
|
|
1893
1870
|
if (data.loading && positions.length === 0) {
|
|
1894
|
-
return /* @__PURE__ */
|
|
1871
|
+
return /* @__PURE__ */ jsx5(WidgetFrame5, { title, children: /* @__PURE__ */ jsx5(MapNotice, { heading: "Loading\u2026" }) });
|
|
1895
1872
|
}
|
|
1896
1873
|
if (positions.length === 0) {
|
|
1897
|
-
return /* @__PURE__ */
|
|
1874
|
+
return /* @__PURE__ */ jsx5(WidgetFrame5, { title, children: /* @__PURE__ */ jsx5(
|
|
1898
1875
|
MapNotice,
|
|
1899
1876
|
{
|
|
1900
1877
|
heading: data.deviceTokens.length === 0 ? "No devices selected" : "No positions reported",
|
|
@@ -1902,7 +1879,7 @@ function MapWidget({ widget, data }) {
|
|
|
1902
1879
|
}
|
|
1903
1880
|
) });
|
|
1904
1881
|
}
|
|
1905
|
-
return /* @__PURE__ */
|
|
1882
|
+
return /* @__PURE__ */ jsx5(WidgetFrame5, { title, flush: true, children: /* @__PURE__ */ jsx5(LiveMap, { basemap, positions, runtime, pick }) });
|
|
1906
1883
|
}
|
|
1907
1884
|
function PlainPanel({
|
|
1908
1885
|
positions,
|
|
@@ -1922,7 +1899,7 @@ function PlainPanel({
|
|
|
1922
1899
|
background: css4("muted")
|
|
1923
1900
|
},
|
|
1924
1901
|
children: [
|
|
1925
|
-
positions.map((position, i) => /* @__PURE__ */
|
|
1902
|
+
positions.map((position, i) => /* @__PURE__ */ jsx5(
|
|
1926
1903
|
Marker,
|
|
1927
1904
|
{
|
|
1928
1905
|
position,
|
|
@@ -1936,7 +1913,7 @@ function PlainPanel({
|
|
|
1936
1913
|
},
|
|
1937
1914
|
position.deviceToken
|
|
1938
1915
|
)),
|
|
1939
|
-
/* @__PURE__ */
|
|
1916
|
+
/* @__PURE__ */ jsx5(
|
|
1940
1917
|
"div",
|
|
1941
1918
|
{
|
|
1942
1919
|
"data-testid": "map-no-tiles-note",
|
|
@@ -2049,7 +2026,7 @@ function LiveMap({
|
|
|
2049
2026
|
};
|
|
2050
2027
|
}, [status, positionsKey(positions), selectable]);
|
|
2051
2028
|
if (status === "unavailable") {
|
|
2052
|
-
return /* @__PURE__ */
|
|
2029
|
+
return /* @__PURE__ */ jsx5(
|
|
2053
2030
|
PlainPanel,
|
|
2054
2031
|
{
|
|
2055
2032
|
positions,
|
|
@@ -2058,7 +2035,7 @@ function LiveMap({
|
|
|
2058
2035
|
}
|
|
2059
2036
|
);
|
|
2060
2037
|
}
|
|
2061
|
-
return /* @__PURE__ */
|
|
2038
|
+
return /* @__PURE__ */ jsx5("div", { ref: containerRef, "data-testid": "map-canvas", style: { width: "100%", height: "100%" } });
|
|
2062
2039
|
}
|
|
2063
2040
|
function positionsKey(positions) {
|
|
2064
2041
|
return positions.map((p) => `${p.deviceToken}:${p.latitude}:${p.longitude}:${p.heading ?? ""}`).join("|");
|
|
@@ -2087,7 +2064,7 @@ function Marker({
|
|
|
2087
2064
|
}) {
|
|
2088
2065
|
const label = describePosition(position);
|
|
2089
2066
|
if (pick) {
|
|
2090
|
-
return /* @__PURE__ */
|
|
2067
|
+
return /* @__PURE__ */ jsx5(
|
|
2091
2068
|
"button",
|
|
2092
2069
|
{
|
|
2093
2070
|
type: "button",
|
|
@@ -2097,11 +2074,11 @@ function Marker({
|
|
|
2097
2074
|
"aria-label": label,
|
|
2098
2075
|
onClick: () => pick(position.deviceToken),
|
|
2099
2076
|
style: { ...MARKER_HIT_STYLE, padding: 0, border: 0, background: "transparent", ...style },
|
|
2100
|
-
children: /* @__PURE__ */
|
|
2077
|
+
children: /* @__PURE__ */ jsx5("span", { style: { ...MARKER_DOT_STYLE, cursor: "inherit", display: "block" } })
|
|
2101
2078
|
}
|
|
2102
2079
|
);
|
|
2103
2080
|
}
|
|
2104
|
-
return /* @__PURE__ */
|
|
2081
|
+
return /* @__PURE__ */ jsx5(
|
|
2105
2082
|
"div",
|
|
2106
2083
|
{
|
|
2107
2084
|
"data-testid": "map-marker",
|
|
@@ -2130,9 +2107,9 @@ function MapNotice({ glyph, heading, detail }) {
|
|
|
2130
2107
|
color: css4("muted-foreground")
|
|
2131
2108
|
},
|
|
2132
2109
|
children: [
|
|
2133
|
-
glyph ? /* @__PURE__ */
|
|
2134
|
-
/* @__PURE__ */
|
|
2135
|
-
detail ? /* @__PURE__ */
|
|
2110
|
+
glyph ? /* @__PURE__ */ jsx5("div", { style: { fontSize: fontVar4("xl"), lineHeight: 1 }, "aria-hidden": "true", children: glyph }) : null,
|
|
2111
|
+
/* @__PURE__ */ jsx5("div", { style: { fontSize: fontVar4("md"), fontWeight: 600 }, children: heading }),
|
|
2112
|
+
detail ? /* @__PURE__ */ jsx5("div", { style: { fontSize: fontVar4("sm"), opacity: 0.8 }, children: detail }) : null
|
|
2136
2113
|
]
|
|
2137
2114
|
}
|
|
2138
2115
|
);
|
|
@@ -2173,7 +2150,7 @@ import {
|
|
|
2173
2150
|
WidgetFrame as WidgetFrame6
|
|
2174
2151
|
} from "@devicechain/widget-sdk";
|
|
2175
2152
|
import { buildLineOption, EChart as EChart2, loadChartEngine as loadChartEngine3, useChartTheme as useChartTheme2 } from "@devicechain/widget-sdk/echarts";
|
|
2176
|
-
import { jsx as
|
|
2153
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2177
2154
|
function TimeSeriesChart({ widget, data, markers }) {
|
|
2178
2155
|
const range = useWidgetTimeRange();
|
|
2179
2156
|
const pinned = optNumber4(widget.options, "windowSeconds");
|
|
@@ -2191,7 +2168,7 @@ function TimeSeriesChart({ widget, data, markers }) {
|
|
|
2191
2168
|
})
|
|
2192
2169
|
);
|
|
2193
2170
|
};
|
|
2194
|
-
return /* @__PURE__ */
|
|
2171
|
+
return /* @__PURE__ */ jsx6(WidgetFrame6, { title: optString6(widget.options, "title"), flush: true, exportRows, children: /* @__PURE__ */ jsx6(TimeSeriesBody, { widget, data, markers }) });
|
|
2195
2172
|
}
|
|
2196
2173
|
function TimeSeriesBody({ widget, data, markers }) {
|
|
2197
2174
|
const theme = useChartTheme2();
|
|
@@ -2209,7 +2186,7 @@ function TimeSeriesBody({ widget, data, markers }) {
|
|
|
2209
2186
|
const name = measurements && measurements.length > 1 ? void 0 : primaryMeasurementName3(widget);
|
|
2210
2187
|
const explain = useSettledEmpty(data.samples.length === 0);
|
|
2211
2188
|
if (explain) {
|
|
2212
|
-
return /* @__PURE__ */
|
|
2189
|
+
return /* @__PURE__ */ jsx6(
|
|
2213
2190
|
NoReading,
|
|
2214
2191
|
{
|
|
2215
2192
|
unbound: widget.datasource?.kind === "unbound",
|
|
@@ -2222,12 +2199,12 @@ function TimeSeriesBody({ widget, data, markers }) {
|
|
|
2222
2199
|
);
|
|
2223
2200
|
}
|
|
2224
2201
|
const chart = /* @__PURE__ */ jsxs4("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2225
|
-
/* @__PURE__ */
|
|
2226
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ jsx6(EChart2, { option }),
|
|
2203
|
+
/* @__PURE__ */ jsx6(SpanBadge, { widget, data })
|
|
2227
2204
|
] });
|
|
2228
2205
|
if (!markers) return chart;
|
|
2229
2206
|
return /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", width: "100%", height: "100%" }, children: [
|
|
2230
|
-
/* @__PURE__ */
|
|
2207
|
+
/* @__PURE__ */ jsx6("div", { style: { flex: 1, minHeight: 0 }, children: chart }),
|
|
2231
2208
|
markers.footer
|
|
2232
2209
|
] });
|
|
2233
2210
|
}
|
|
@@ -2258,7 +2235,7 @@ function SpanBadge({ widget, data }) {
|
|
|
2258
2235
|
const time = cutAt ? end - Date.parse(cutAt) > DAY_MS ? formatDateTime(cutAt, timeZone) : formatTimestamp2(cutAt, timeZone) : "";
|
|
2259
2236
|
const text = [showSpan ? label : "", cutAt ? words.from(time) : ""].filter(Boolean).join(" \xB7 ");
|
|
2260
2237
|
const title = [showSpan ? words.pinned(label) : "", cutAt ? words.cut(time, label) : ""].filter(Boolean).join(" ");
|
|
2261
|
-
return /* @__PURE__ */
|
|
2238
|
+
return /* @__PURE__ */ jsx6(
|
|
2262
2239
|
"span",
|
|
2263
2240
|
{
|
|
2264
2241
|
"data-chart-span": showSpan ? label : "",
|
|
@@ -2347,7 +2324,7 @@ import {
|
|
|
2347
2324
|
} from "@devicechain/widget-sdk";
|
|
2348
2325
|
|
|
2349
2326
|
// src/widget-containment.tsx
|
|
2350
|
-
import { Component, createContext
|
|
2327
|
+
import { Component, createContext, useCallback, useContext, useState as useState3 } from "react";
|
|
2351
2328
|
import { WidgetFrame as WidgetFrame7 } from "@devicechain/widget-sdk";
|
|
2352
2329
|
|
|
2353
2330
|
// src/widget-host.ts
|
|
@@ -2406,7 +2383,7 @@ function narrowCandidates(candidates, descriptor, report) {
|
|
|
2406
2383
|
}
|
|
2407
2384
|
|
|
2408
2385
|
// src/widget-containment.tsx
|
|
2409
|
-
import { jsx as
|
|
2386
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2410
2387
|
var MESSAGE_STYLE = {
|
|
2411
2388
|
display: "flex",
|
|
2412
2389
|
flexDirection: "column",
|
|
@@ -2426,10 +2403,10 @@ var BUTTON_STYLE = {
|
|
|
2426
2403
|
padding: "2px 8px",
|
|
2427
2404
|
cursor: "pointer"
|
|
2428
2405
|
};
|
|
2429
|
-
var ReportContext =
|
|
2406
|
+
var ReportContext = createContext(() => {
|
|
2430
2407
|
});
|
|
2431
2408
|
function useReportRejection() {
|
|
2432
|
-
return
|
|
2409
|
+
return useContext(ReportContext);
|
|
2433
2410
|
}
|
|
2434
2411
|
var WidgetErrorBoundary = class extends Component {
|
|
2435
2412
|
constructor() {
|
|
@@ -2450,11 +2427,11 @@ var WidgetErrorBoundary = class extends Component {
|
|
|
2450
2427
|
render() {
|
|
2451
2428
|
const { error } = this.state;
|
|
2452
2429
|
if (!error) return this.props.children;
|
|
2453
|
-
return /* @__PURE__ */
|
|
2454
|
-
/* @__PURE__ */
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2457
|
-
/* @__PURE__ */
|
|
2430
|
+
return /* @__PURE__ */ jsx7(WidgetFrame7, { title: this.props.title, children: /* @__PURE__ */ jsxs5("div", { style: MESSAGE_STYLE, role: "alert", children: [
|
|
2431
|
+
/* @__PURE__ */ jsx7("div", { style: { fontSize: 20, lineHeight: 1 }, "aria-hidden": "true", children: "\u26A0" }),
|
|
2432
|
+
/* @__PURE__ */ jsx7("div", { style: { fontSize: 13, fontWeight: 600 }, children: "This widget failed to render" }),
|
|
2433
|
+
/* @__PURE__ */ jsx7("div", { style: { fontSize: 11, opacity: 0.8, wordBreak: "break-word" }, children: error.message }),
|
|
2434
|
+
/* @__PURE__ */ jsx7("button", { type: "button", style: BUTTON_STYLE, onClick: this.reset, children: "Reset widget" })
|
|
2458
2435
|
] }) });
|
|
2459
2436
|
}
|
|
2460
2437
|
};
|
|
@@ -2465,7 +2442,7 @@ function WidgetContainment({ title, resetKey, children }) {
|
|
|
2465
2442
|
}, []);
|
|
2466
2443
|
const clear = useCallback(() => setMessages([]), []);
|
|
2467
2444
|
return /* @__PURE__ */ jsxs5("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
2468
|
-
/* @__PURE__ */
|
|
2445
|
+
/* @__PURE__ */ jsx7(ReportContext.Provider, { value: report, children: /* @__PURE__ */ jsx7(WidgetErrorBoundary, { title, resetKey, onReset: clear, children }) }),
|
|
2469
2446
|
messages.length > 0 && /* @__PURE__ */ jsxs5(
|
|
2470
2447
|
"div",
|
|
2471
2448
|
{
|
|
@@ -2485,8 +2462,8 @@ function WidgetContainment({ title, resetKey, children }) {
|
|
|
2485
2462
|
alignItems: "center"
|
|
2486
2463
|
},
|
|
2487
2464
|
children: [
|
|
2488
|
-
/* @__PURE__ */
|
|
2489
|
-
/* @__PURE__ */
|
|
2465
|
+
/* @__PURE__ */ jsx7("span", { style: { flex: 1, wordBreak: "break-word" }, children: messages.join(" \xB7 ") }),
|
|
2466
|
+
/* @__PURE__ */ jsx7("button", { type: "button", "aria-label": "Dismiss", onClick: clear, style: { cursor: "pointer" }, children: "\xD7" })
|
|
2490
2467
|
]
|
|
2491
2468
|
}
|
|
2492
2469
|
)
|
|
@@ -2494,12 +2471,12 @@ function WidgetContainment({ title, resetKey, children }) {
|
|
|
2494
2471
|
}
|
|
2495
2472
|
|
|
2496
2473
|
// src/connected-widget.tsx
|
|
2497
|
-
import { jsx as
|
|
2474
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2498
2475
|
function ConnectedWidget(props) {
|
|
2499
2476
|
const { widget } = props;
|
|
2500
2477
|
const registry = props.registry ?? defaultWidgetRegistry();
|
|
2501
2478
|
const resetKey = JSON.stringify([widget.type, widget.options ?? null, widget.datasource ?? null]);
|
|
2502
|
-
return /* @__PURE__ */
|
|
2479
|
+
return /* @__PURE__ */ jsx8(WidgetContainment, { title: optString7(widget.options, "title"), resetKey, children: /* @__PURE__ */ jsx8(ConnectedWidgetBody, { ...props, registry }) });
|
|
2503
2480
|
}
|
|
2504
2481
|
function ConnectedWidgetBody({ widget, hub, registry, actions, initialSamples, initialSamplesAsOf, onReconnect }) {
|
|
2505
2482
|
const range = useWidgetTimeRange2();
|
|
@@ -2510,16 +2487,16 @@ function ConnectedWidgetBody({ widget, hub, registry, actions, initialSamples, i
|
|
|
2510
2487
|
const availability = useDatasourceAvailability(hub, readsDatasource ? widget.datasource : void 0);
|
|
2511
2488
|
const supported = useDatasourceSupported(hub, readsDatasource ? widget.datasource : void 0);
|
|
2512
2489
|
if (!supported) {
|
|
2513
|
-
return /* @__PURE__ */
|
|
2490
|
+
return /* @__PURE__ */ jsx8(WidgetNotForCustomerUsersFrame, { widget });
|
|
2514
2491
|
}
|
|
2515
2492
|
if (availability === "unavailable") {
|
|
2516
|
-
return /* @__PURE__ */
|
|
2493
|
+
return /* @__PURE__ */ jsx8(WidgetUnavailableFrame, { widget });
|
|
2517
2494
|
}
|
|
2518
2495
|
if (widget.type === UNKNOWN_WIDGET_TYPE) {
|
|
2519
|
-
return /* @__PURE__ */
|
|
2496
|
+
return /* @__PURE__ */ jsx8(UnresolvedWidgetFrame, { storedType: widget.raw.type, reason: widget.reason });
|
|
2520
2497
|
}
|
|
2521
2498
|
if (!descriptor || !implementation) {
|
|
2522
|
-
return /* @__PURE__ */
|
|
2499
|
+
return /* @__PURE__ */ jsx8(
|
|
2523
2500
|
UnresolvedWidgetFrame,
|
|
2524
2501
|
{
|
|
2525
2502
|
storedType: widget.type,
|
|
@@ -2527,7 +2504,7 @@ function ConnectedWidgetBody({ widget, hub, registry, actions, initialSamples, i
|
|
|
2527
2504
|
}
|
|
2528
2505
|
);
|
|
2529
2506
|
}
|
|
2530
|
-
const body = /* @__PURE__ */
|
|
2507
|
+
const body = /* @__PURE__ */ jsx8(DeclaredScope, { hub, datasource: widget.datasource, children: /* @__PURE__ */ jsx8(HostScope, { descriptor, actions, children: (hostActions) => /* @__PURE__ */ jsx8(
|
|
2531
2508
|
ChannelBody,
|
|
2532
2509
|
{
|
|
2533
2510
|
widget,
|
|
@@ -2540,7 +2517,7 @@ function ConnectedWidgetBody({ widget, hub, registry, actions, initialSamples, i
|
|
|
2540
2517
|
onReconnect
|
|
2541
2518
|
}
|
|
2542
2519
|
) }) });
|
|
2543
|
-
return range?.absolute !== void 0 && showsCurrentStateOnly(descriptor) ? /* @__PURE__ */
|
|
2520
|
+
return range?.absolute !== void 0 && showsCurrentStateOnly(descriptor) ? /* @__PURE__ */ jsx8(CurrentStateBadge, { children: body }) : body;
|
|
2544
2521
|
}
|
|
2545
2522
|
function showsCurrentStateOnly(descriptor) {
|
|
2546
2523
|
return descriptor.channel === "alarm" || descriptor.channel === "location" || presenceMode(descriptor);
|
|
@@ -2553,7 +2530,7 @@ function CurrentStateBadge({ children }) {
|
|
|
2553
2530
|
const words = viewerLocale2()?.toLowerCase().startsWith("es") ? CURRENT_STATE_STRINGS.es : CURRENT_STATE_STRINGS.en;
|
|
2554
2531
|
return /* @__PURE__ */ jsxs6("div", { "data-current-state": "", style: { position: "relative", width: "100%", height: "100%", minWidth: 0, minHeight: 0 }, children: [
|
|
2555
2532
|
children,
|
|
2556
|
-
/* @__PURE__ */
|
|
2533
|
+
/* @__PURE__ */ jsx8(
|
|
2557
2534
|
"span",
|
|
2558
2535
|
{
|
|
2559
2536
|
"data-current-state-badge": "",
|
|
@@ -2617,7 +2594,7 @@ function DeclaredScope({ hub, datasource, children }) {
|
|
|
2617
2594
|
}, [asked, token, hub]);
|
|
2618
2595
|
const declared = got && got.token === token ? got.names : void 0;
|
|
2619
2596
|
const value = useMemo4(() => ({ declared, ask }), [declared, ask]);
|
|
2620
|
-
return /* @__PURE__ */
|
|
2597
|
+
return /* @__PURE__ */ jsx8(WidgetDeclaredMetricsProvider, { value, children });
|
|
2621
2598
|
}
|
|
2622
2599
|
function HostScope({
|
|
2623
2600
|
descriptor,
|
|
@@ -2633,44 +2610,44 @@ function HostScope({
|
|
|
2633
2610
|
() => narrowCandidates(candidates, descriptor, report),
|
|
2634
2611
|
[candidates, descriptor, report]
|
|
2635
2612
|
);
|
|
2636
|
-
return /* @__PURE__ */
|
|
2613
|
+
return /* @__PURE__ */ jsx8(WidgetSelectProvider, { select: narrowedSelect, children: /* @__PURE__ */ jsx8(WidgetCandidatesProvider, { candidates: narrowedCandidates, children: children(narrowed) }) });
|
|
2637
2614
|
}
|
|
2638
2615
|
function ChannelBody(props) {
|
|
2639
2616
|
switch (props.descriptor.channel) {
|
|
2640
2617
|
case "alarm":
|
|
2641
|
-
return /* @__PURE__ */
|
|
2618
|
+
return /* @__PURE__ */ jsx8(AlarmConnectedWidget, { ...props });
|
|
2642
2619
|
case "control":
|
|
2643
|
-
return /* @__PURE__ */
|
|
2620
|
+
return /* @__PURE__ */ jsx8(ControlConnectedWidget, { ...props });
|
|
2644
2621
|
case "location":
|
|
2645
|
-
return /* @__PURE__ */
|
|
2622
|
+
return /* @__PURE__ */ jsx8(LocationConnectedWidget, { ...props });
|
|
2646
2623
|
case "aggregate":
|
|
2647
|
-
return /* @__PURE__ */
|
|
2624
|
+
return /* @__PURE__ */ jsx8(AggregateConnectedWidget, { ...props });
|
|
2648
2625
|
case "selection":
|
|
2649
2626
|
case "none":
|
|
2650
|
-
return /* @__PURE__ */
|
|
2627
|
+
return /* @__PURE__ */ jsx8(StaticConnectedWidget, { ...props });
|
|
2651
2628
|
case "measurement":
|
|
2652
|
-
return /* @__PURE__ */
|
|
2629
|
+
return /* @__PURE__ */ jsx8(MeasurementConnectedWidget, { ...props });
|
|
2653
2630
|
}
|
|
2654
2631
|
}
|
|
2655
2632
|
function StaticConnectedWidget({ widget, Component: Component2, actions }) {
|
|
2656
|
-
return /* @__PURE__ */
|
|
2633
|
+
return /* @__PURE__ */ jsx8(Component2, { widget, data: null, actions });
|
|
2657
2634
|
}
|
|
2658
|
-
var FleetFeed = lazyChunk(() => import("./chunks/fleet-feed-
|
|
2659
|
-
var PresenceFeed = lazyChunk(() => import("./chunks/presence-widgets-
|
|
2660
|
-
var HistoryFeed = lazyChunk(() => import("./chunks/history-widgets-
|
|
2635
|
+
var FleetFeed = lazyChunk(() => import("./chunks/fleet-feed-AKJ7QIMP.js")).component("default", void 0, ChunkLoadingFrame);
|
|
2636
|
+
var PresenceFeed = lazyChunk(() => import("./chunks/presence-widgets-7OGANOLB.js")).component("PresenceFeed");
|
|
2637
|
+
var HistoryFeed = lazyChunk(() => import("./chunks/history-widgets-DZBMNMEX.js")).component("HistoryFeed");
|
|
2661
2638
|
function MeasurementConnectedWidget(props) {
|
|
2662
2639
|
if (presenceMode(props.descriptor)) {
|
|
2663
|
-
return /* @__PURE__ */
|
|
2640
|
+
return /* @__PURE__ */ jsx8(PresenceFeed, { hub: props.hub, widget: props.widget, descriptor: props.descriptor, Component: props.Component, actions: props.actions, ErrorFrame: WidgetErrorFrame });
|
|
2664
2641
|
}
|
|
2665
2642
|
const { widget, hub, descriptor, Component: Component2, actions } = props;
|
|
2666
2643
|
const members = membersMode(descriptor, widget);
|
|
2667
2644
|
if (members || widget.datasource?.kind === "anchor") {
|
|
2668
|
-
return /* @__PURE__ */
|
|
2645
|
+
return /* @__PURE__ */ jsx8(FleetFeed, { hub, widget, descriptor, Component: Component2, actions, ErrorFrame: WidgetErrorFrame, refuse: !members });
|
|
2669
2646
|
}
|
|
2670
2647
|
if (historyMode(descriptor)) {
|
|
2671
|
-
return /* @__PURE__ */
|
|
2648
|
+
return /* @__PURE__ */ jsx8(HistoryFeed, { hub, widget, descriptor, Component: Component2, actions });
|
|
2672
2649
|
}
|
|
2673
|
-
return /* @__PURE__ */
|
|
2650
|
+
return /* @__PURE__ */ jsx8(StreamConnectedWidget, { ...props });
|
|
2674
2651
|
}
|
|
2675
2652
|
function StreamConnectedWidget({ widget, hub, descriptor, Component: Component2, actions, initialSamples, initialSamplesAsOf, onReconnect }) {
|
|
2676
2653
|
const range = useWidgetTimeRange2();
|
|
@@ -2693,18 +2670,18 @@ function StreamConnectedWidget({ widget, hub, descriptor, Component: Component2,
|
|
|
2693
2670
|
staleAfterSeconds: resolveStaleAfterSeconds(widget.options)
|
|
2694
2671
|
};
|
|
2695
2672
|
}, [descriptor, widget.options, widget.datasource, data.latest]);
|
|
2696
|
-
if (data.error) return /* @__PURE__ */
|
|
2697
|
-
return /* @__PURE__ */
|
|
2673
|
+
if (data.error) return /* @__PURE__ */ jsx8(WidgetErrorFrame, { widget, error: data.error });
|
|
2674
|
+
return /* @__PURE__ */ jsx8(WidgetFreshnessProvider, { freshness, children: wantsEventMarkers(descriptor, widget) ? /* @__PURE__ */ jsx8(EventMarkersFeed, { hub, widget, descriptor, data, Component: Component2, actions }) : /* @__PURE__ */ jsx8(Component2, { widget, data, actions }) });
|
|
2698
2675
|
}
|
|
2699
|
-
var EventMarkersFeed = lazyChunk(() => import("./chunks/event-markers-feed-
|
|
2700
|
-
var AggregateFeed = lazyChunk(() => import("./chunks/aggregate-feed-
|
|
2701
|
-
function AggregateConnectedWidget(
|
|
2702
|
-
const props = {
|
|
2703
|
-
return widget.datasource?.kind === "anchor" ? /* @__PURE__ */
|
|
2676
|
+
var EventMarkersFeed = lazyChunk(() => import("./chunks/event-markers-feed-DMRW5GV5.js")).component("default");
|
|
2677
|
+
var AggregateFeed = lazyChunk(() => import("./chunks/aggregate-feed-HCF5FYIJ.js")).component("default");
|
|
2678
|
+
function AggregateConnectedWidget(channel) {
|
|
2679
|
+
const props = { ...channel, ErrorFrame: WidgetErrorFrame };
|
|
2680
|
+
return channel.widget.datasource?.kind === "anchor" ? /* @__PURE__ */ jsx8(FleetFeed, { ...props, refuse: true }) : /* @__PURE__ */ jsx8(AggregateFeed, { ...props });
|
|
2704
2681
|
}
|
|
2705
2682
|
var GroupedAlarm = lazyChunk(() => import("./chunks/alarm-widgets-X4PX5MYJ.js")).component("GroupedAlarm");
|
|
2706
2683
|
function AlarmConnectedWidget(props) {
|
|
2707
|
-
return groupsAlarmsByDeviceType(props.descriptor, props.widget) ? /* @__PURE__ */
|
|
2684
|
+
return groupsAlarmsByDeviceType(props.descriptor, props.widget) ? /* @__PURE__ */ jsx8(
|
|
2708
2685
|
GroupedAlarm,
|
|
2709
2686
|
{
|
|
2710
2687
|
hub: props.hub,
|
|
@@ -2715,29 +2692,29 @@ function AlarmConnectedWidget(props) {
|
|
|
2715
2692
|
actions: props.actions,
|
|
2716
2693
|
ErrorFrame: WidgetErrorFrame
|
|
2717
2694
|
}
|
|
2718
|
-
) : /* @__PURE__ */
|
|
2695
|
+
) : /* @__PURE__ */ jsx8(PlainAlarmConnectedWidget, { ...props });
|
|
2719
2696
|
}
|
|
2720
2697
|
function PlainAlarmConnectedWidget({ widget, hub, descriptor, Component: Component2, actions }) {
|
|
2721
2698
|
const range = useWidgetTimeRange2();
|
|
2722
2699
|
const live = useAlarmStream(hub, alarmSubscription(descriptor, widget));
|
|
2723
2700
|
const data = useHeld(live, range?.paused === true, (s) => !s.loading);
|
|
2724
2701
|
if (data.error && data.alarms.length === 0 && data.total === 0) {
|
|
2725
|
-
return /* @__PURE__ */
|
|
2702
|
+
return /* @__PURE__ */ jsx8(WidgetErrorFrame, { widget, error: data.error });
|
|
2726
2703
|
}
|
|
2727
|
-
return /* @__PURE__ */
|
|
2704
|
+
return /* @__PURE__ */ jsx8(Component2, { widget, data, actions });
|
|
2728
2705
|
}
|
|
2729
2706
|
function ControlConnectedWidget({ widget, hub, descriptor, Component: Component2, actions }) {
|
|
2730
2707
|
const data = useCommandStream(hub, commandSubscription(descriptor, widget));
|
|
2731
|
-
return /* @__PURE__ */
|
|
2708
|
+
return /* @__PURE__ */ jsx8(Component2, { widget, data, actions });
|
|
2732
2709
|
}
|
|
2733
2710
|
function LocationConnectedWidget({ widget, hub, Component: Component2, actions }) {
|
|
2734
2711
|
const range = useWidgetTimeRange2();
|
|
2735
2712
|
const live = useLocationStream(hub, { datasource: widget.datasource });
|
|
2736
2713
|
const data = useHeld(live, range?.paused === true, (s) => !s.loading);
|
|
2737
2714
|
if (data.error && data.locations.length === 0) {
|
|
2738
|
-
return /* @__PURE__ */
|
|
2715
|
+
return /* @__PURE__ */ jsx8(WidgetErrorFrame, { widget, error: data.error });
|
|
2739
2716
|
}
|
|
2740
|
-
return /* @__PURE__ */
|
|
2717
|
+
return /* @__PURE__ */ jsx8(Component2, { widget, data, actions });
|
|
2741
2718
|
}
|
|
2742
2719
|
var STATE_STYLE = {
|
|
2743
2720
|
display: "flex",
|
|
@@ -2758,17 +2735,17 @@ function UnresolvedWidgetFrame({
|
|
|
2758
2735
|
}) {
|
|
2759
2736
|
const storedType = typeof stored === "string" ? stored : "";
|
|
2760
2737
|
const heading = (reason?.code ?? "unregistered") === "unregistered" ? "This widget needs a newer viewer" : "This widget cannot be shown here";
|
|
2761
|
-
return /* @__PURE__ */
|
|
2738
|
+
return /* @__PURE__ */ jsx8(WidgetFrame8, { children: /* @__PURE__ */ jsxs6(
|
|
2762
2739
|
"div",
|
|
2763
2740
|
{
|
|
2764
2741
|
style: STATE_STYLE,
|
|
2765
2742
|
children: [
|
|
2766
|
-
/* @__PURE__ */
|
|
2743
|
+
/* @__PURE__ */ jsx8("div", { style: { fontSize: 13, fontWeight: 600 }, children: heading }),
|
|
2767
2744
|
storedType && !reason?.message.includes(storedType) && /* @__PURE__ */ jsxs6("div", { style: { fontSize: 11, opacity: 0.8 }, children: [
|
|
2768
2745
|
"Widget type: ",
|
|
2769
2746
|
storedType
|
|
2770
2747
|
] }),
|
|
2771
|
-
reason && /* @__PURE__ */
|
|
2748
|
+
reason && /* @__PURE__ */ jsx8("div", { style: { fontSize: 11, opacity: 0.8, wordBreak: "break-word" }, children: reason.message })
|
|
2772
2749
|
]
|
|
2773
2750
|
}
|
|
2774
2751
|
) });
|
|
@@ -2780,38 +2757,38 @@ function StatePane({
|
|
|
2780
2757
|
title,
|
|
2781
2758
|
detail
|
|
2782
2759
|
}) {
|
|
2783
|
-
return /* @__PURE__ */
|
|
2760
|
+
return /* @__PURE__ */ jsx8(WidgetFrame8, { title: optString7(widget.options, "title"), children: /* @__PURE__ */ jsx8(StateBody, { kind, glyph, title, detail }) });
|
|
2784
2761
|
}
|
|
2785
2762
|
function StateBody({ kind, glyph, title, detail }) {
|
|
2786
2763
|
const { height } = useWidgetScale3().size;
|
|
2787
2764
|
const measured = height > 0;
|
|
2788
2765
|
return /* @__PURE__ */ jsxs6("div", { role: "status", "data-empty-state": kind, style: STATE_STYLE, children: [
|
|
2789
|
-
!measured || height >= 84 ? /* @__PURE__ */
|
|
2790
|
-
/* @__PURE__ */
|
|
2791
|
-
detail && (!measured || height >= 64) ? /* @__PURE__ */
|
|
2766
|
+
!measured || height >= 84 ? /* @__PURE__ */ jsx8("div", { style: { fontSize: 20, lineHeight: 1 }, "aria-hidden": "true", children: glyph }) : null,
|
|
2767
|
+
/* @__PURE__ */ jsx8("div", { style: { fontSize: 13, fontWeight: 600 }, children: title }),
|
|
2768
|
+
detail && (!measured || height >= 64) ? /* @__PURE__ */ jsx8("div", { style: { fontSize: 11, opacity: 0.8, wordBreak: "break-word" }, children: detail }) : null
|
|
2792
2769
|
] });
|
|
2793
2770
|
}
|
|
2794
2771
|
function WidgetForbiddenFrame({ widget }) {
|
|
2795
|
-
return /* @__PURE__ */
|
|
2772
|
+
return /* @__PURE__ */ jsx8(StatePane, { widget, kind: "forbidden", glyph: "\u2298", title: accessStrings().forbidden });
|
|
2796
2773
|
}
|
|
2797
2774
|
function WidgetUnavailableFrame({ widget }) {
|
|
2798
|
-
return /* @__PURE__ */
|
|
2775
|
+
return /* @__PURE__ */ jsx8(StatePane, { widget, kind: "gone", glyph: "\u2298", title: "Device unavailable", detail: "The bound device no longer exists." });
|
|
2799
2776
|
}
|
|
2800
2777
|
function WidgetNotForCustomerUsersFrame({ widget }) {
|
|
2801
|
-
return /* @__PURE__ */
|
|
2778
|
+
return /* @__PURE__ */ jsx8(
|
|
2802
2779
|
StatePane,
|
|
2803
2780
|
{
|
|
2804
2781
|
widget,
|
|
2805
2782
|
kind: "unsupported",
|
|
2806
2783
|
glyph: "\u2298",
|
|
2807
2784
|
title: "Not available for customer users",
|
|
2808
|
-
detail: "This widget is bound to
|
|
2785
|
+
detail: "This widget is bound to something customer users cannot view."
|
|
2809
2786
|
}
|
|
2810
2787
|
);
|
|
2811
2788
|
}
|
|
2812
2789
|
function WidgetErrorFrame({ widget, error }) {
|
|
2813
|
-
if (isForbiddenError(error)) return /* @__PURE__ */
|
|
2814
|
-
return /* @__PURE__ */
|
|
2790
|
+
if (isForbiddenError(error)) return /* @__PURE__ */ jsx8(WidgetForbiddenFrame, { widget });
|
|
2791
|
+
return /* @__PURE__ */ jsx8(StatePane, { widget, kind: "error", glyph: "\u2026", title: "Data unavailable", detail: String(error) });
|
|
2815
2792
|
}
|
|
2816
2793
|
|
|
2817
2794
|
// src/dashboard-renderer.tsx
|
|
@@ -2822,7 +2799,7 @@ import {
|
|
|
2822
2799
|
WidgetThemeRootProvider,
|
|
2823
2800
|
WidgetTimeZoneProvider
|
|
2824
2801
|
} from "@devicechain/widget-sdk";
|
|
2825
|
-
import { Fragment as Fragment2, jsx as
|
|
2802
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2826
2803
|
function DashboardRenderer({
|
|
2827
2804
|
definition,
|
|
2828
2805
|
hub,
|
|
@@ -2872,8 +2849,8 @@ function DashboardRenderer({
|
|
|
2872
2849
|
"data-time-paused": range.paused ? "" : void 0,
|
|
2873
2850
|
style: { ...sizingStyle(effectiveSizing, bg), ...tokenStyle(scale) },
|
|
2874
2851
|
children: [
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
2852
|
+
/* @__PURE__ */ jsx9(WidgetTokenStyles, {}),
|
|
2853
|
+
/* @__PURE__ */ jsx9(WidgetDensityProvider, { scale, children: /* @__PURE__ */ jsx9(WidgetThemeRootProvider, { root: themeRoot, children: /* @__PURE__ */ jsx9(WidgetTimeZoneProvider, { timeZone, children: /* @__PURE__ */ jsx9(WidgetTimeRangeProvider, { range, children: /* @__PURE__ */ jsx9(WidgetSelectProvider2, { select, children: /* @__PURE__ */ jsx9(WidgetCandidatesProvider2, { candidates, children: /* @__PURE__ */ jsx9("div", { style: { padding: lengths.padding }, children: /* @__PURE__ */ jsx9("div", { style: { containerType: "inline-size" }, children: /* @__PURE__ */ jsx9(
|
|
2877
2854
|
"div",
|
|
2878
2855
|
{
|
|
2879
2856
|
"data-grid": "",
|
|
@@ -2886,7 +2863,7 @@ function DashboardRenderer({
|
|
|
2886
2863
|
width: "100%",
|
|
2887
2864
|
...{ "--dc-cell": lengths.cell }
|
|
2888
2865
|
},
|
|
2889
|
-
children: /* @__PURE__ */
|
|
2866
|
+
children: /* @__PURE__ */ jsx9(
|
|
2890
2867
|
PlacedWidgets,
|
|
2891
2868
|
{
|
|
2892
2869
|
widgets,
|
|
@@ -2894,7 +2871,7 @@ function DashboardRenderer({
|
|
|
2894
2871
|
columns,
|
|
2895
2872
|
grid: layout.grid,
|
|
2896
2873
|
lengths,
|
|
2897
|
-
render: (widget) => /* @__PURE__ */
|
|
2874
|
+
render: (widget) => /* @__PURE__ */ jsx9(WidgetFrameStyleProvider, { frame: resolveFrame(canvasFrame, widgetFrame(widget)), children: /* @__PURE__ */ jsx9(WidgetSubjectProvider, { label: widgetSubjectLabel(widget), children: /* @__PURE__ */ jsx9(
|
|
2898
2875
|
ConnectedWidget,
|
|
2899
2876
|
{
|
|
2900
2877
|
widget,
|
|
@@ -2983,15 +2960,15 @@ function PlacedWidgets({
|
|
|
2983
2960
|
relative(widget.id)
|
|
2984
2961
|
] }, widget.id)
|
|
2985
2962
|
));
|
|
2986
|
-
return /* @__PURE__ */
|
|
2963
|
+
return /* @__PURE__ */ jsx9(Fragment2, { children: placed.map(({ widget, placement }) => {
|
|
2987
2964
|
if (placement.mode !== "grid") return null;
|
|
2988
2965
|
const style = gridItemStyle(grid.get(widget.id) ?? placement, columns);
|
|
2989
2966
|
return /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
2990
|
-
/* @__PURE__ */
|
|
2967
|
+
/* @__PURE__ */ jsx9("div", { "data-widget": widget.id, style, children: render(widget) }),
|
|
2991
2968
|
dependents.has(widget.id) ? (
|
|
2992
2969
|
// The host's area again, as a layer for its relative widgets to be positioned in.
|
|
2993
2970
|
// It takes no pointer events itself, so the host underneath stays usable.
|
|
2994
|
-
/* @__PURE__ */
|
|
2971
|
+
/* @__PURE__ */ jsx9("div", { style: { ...style, position: "relative", pointerEvents: "none", zIndex: RELATIVE_Z }, children: relative(widget.id) })
|
|
2995
2972
|
) : null
|
|
2996
2973
|
] }, widget.id);
|
|
2997
2974
|
}) });
|
|
@@ -3048,7 +3025,8 @@ function windowTag(range) {
|
|
|
3048
3025
|
}
|
|
3049
3026
|
var RESEED_RETRY_MS = 3e4;
|
|
3050
3027
|
function seedKey(widget, registry) {
|
|
3051
|
-
|
|
3028
|
+
const descriptor = widget.type === UNKNOWN_WIDGET_TYPE2 ? void 0 : registry.descriptor(widget.type);
|
|
3029
|
+
if (!descriptor || !takesHistorySeed(descriptor, widget)) {
|
|
3052
3030
|
return void 0;
|
|
3053
3031
|
}
|
|
3054
3032
|
return JSON.stringify(widget.datasource ?? null);
|
|
@@ -3142,7 +3120,7 @@ import {
|
|
|
3142
3120
|
withSpan
|
|
3143
3121
|
} from "@devicechain/dashboards";
|
|
3144
3122
|
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3, useState as useState6 } from "react";
|
|
3145
|
-
import { Fragment as Fragment3, jsx as
|
|
3123
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3146
3124
|
function useBoardTimeRange(defaultSeconds, link = {}) {
|
|
3147
3125
|
const [state, setState] = useState6(() => initialTimeRange2(defaultSeconds, link));
|
|
3148
3126
|
const lastDefault = useRef3(defaultSeconds);
|
|
@@ -3244,10 +3222,10 @@ function PausedIndicator({
|
|
|
3244
3222
|
borderRadius: 4
|
|
3245
3223
|
},
|
|
3246
3224
|
children: [
|
|
3247
|
-
/* @__PURE__ */
|
|
3225
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u23F8" }),
|
|
3248
3226
|
labels.paused,
|
|
3249
|
-
time ? /* @__PURE__ */
|
|
3250
|
-
/* @__PURE__ */
|
|
3227
|
+
time ? /* @__PURE__ */ jsx10("span", { style: { fontWeight: 400, textTransform: "none" }, children: ` ${time}` }) : null,
|
|
3228
|
+
/* @__PURE__ */ jsx10("span", { "data-time-range-actions-live": "", style: { fontWeight: 400, textTransform: "none" }, children: `\xB7 ${labels.actionsLive}` })
|
|
3251
3229
|
]
|
|
3252
3230
|
}
|
|
3253
3231
|
);
|
|
@@ -3282,9 +3260,9 @@ function AbsoluteIndicator({
|
|
|
3282
3260
|
borderRadius: 4
|
|
3283
3261
|
},
|
|
3284
3262
|
children: [
|
|
3285
|
-
/* @__PURE__ */
|
|
3286
|
-
/* @__PURE__ */
|
|
3287
|
-
/* @__PURE__ */
|
|
3263
|
+
/* @__PURE__ */ jsx10("span", { style: { letterSpacing: 0.4, textTransform: "uppercase" }, children: l.fixed }),
|
|
3264
|
+
/* @__PURE__ */ jsx10("span", { "data-time-range-window": "", style: { fontWeight: 400 }, children: formatAbsoluteRange(absolute) }),
|
|
3265
|
+
/* @__PURE__ */ jsx10("span", { "data-time-range-actions-live": "", style: { fontWeight: 400 }, children: `\xB7 ${labels.actionsLive}` })
|
|
3288
3266
|
]
|
|
3289
3267
|
}
|
|
3290
3268
|
);
|
|
@@ -3351,8 +3329,8 @@ function TimeRangeBar({
|
|
|
3351
3329
|
"aria-label": labels.range,
|
|
3352
3330
|
style: { display: "inline-flex", alignItems: "center", gap: 6, flexWrap: "wrap" },
|
|
3353
3331
|
children: [
|
|
3354
|
-
!abs && preset === void 0 ? /* @__PURE__ */
|
|
3355
|
-
TIME_RANGE_PRESETS.map((p) => /* @__PURE__ */
|
|
3332
|
+
!abs && preset === void 0 ? /* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": "true", "data-range": spanLabel2(state.spanSeconds), style: button(true), children: spanLabel2(state.spanSeconds) }) : null,
|
|
3333
|
+
TIME_RANGE_PRESETS.map((p) => /* @__PURE__ */ jsx10(
|
|
3356
3334
|
"button",
|
|
3357
3335
|
{
|
|
3358
3336
|
type: "button",
|
|
@@ -3364,7 +3342,7 @@ function TimeRangeBar({
|
|
|
3364
3342
|
},
|
|
3365
3343
|
p.id
|
|
3366
3344
|
)),
|
|
3367
|
-
/* @__PURE__ */
|
|
3345
|
+
/* @__PURE__ */ jsx10(
|
|
3368
3346
|
"button",
|
|
3369
3347
|
{
|
|
3370
3348
|
type: "button",
|
|
@@ -3377,17 +3355,17 @@ function TimeRangeBar({
|
|
|
3377
3355
|
}
|
|
3378
3356
|
),
|
|
3379
3357
|
abs ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
3380
|
-
/* @__PURE__ */
|
|
3381
|
-
/* @__PURE__ */
|
|
3382
|
-
/* @__PURE__ */
|
|
3358
|
+
/* @__PURE__ */ jsx10("button", { type: "button", "data-time-range-live": "", onClick: () => controls.resume(), style: button(false), children: l.backToLive }),
|
|
3359
|
+
/* @__PURE__ */ jsx10("button", { type: "button", "data-time-range-copy": "", onClick: copyLink, style: button(false), children: copied ? l.linkCopied : l.copyLink }),
|
|
3360
|
+
/* @__PURE__ */ jsx10(AbsoluteIndicator, { absolute: abs, labels })
|
|
3383
3361
|
] }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
3384
|
-
/* @__PURE__ */
|
|
3385
|
-
state.paused ? /* @__PURE__ */
|
|
3362
|
+
/* @__PURE__ */ jsx10("button", { type: "button", "aria-pressed": state.paused, "data-time-range-pause": "", onClick: onPause, style: button(state.paused), children: state.paused ? labels.resume : labels.pause }),
|
|
3363
|
+
state.paused ? /* @__PURE__ */ jsx10(PausedIndicator, { pausedAt: state.pausedAt, labels }) : null
|
|
3386
3364
|
] })
|
|
3387
3365
|
]
|
|
3388
3366
|
}
|
|
3389
3367
|
),
|
|
3390
|
-
open && Picker ? /* @__PURE__ */
|
|
3368
|
+
open && Picker ? /* @__PURE__ */ jsx10("div", { style: { position: "absolute", right: 0, top: "100%", marginTop: 6, zIndex: 30 }, children: /* @__PURE__ */ jsx10(
|
|
3391
3369
|
Picker,
|
|
3392
3370
|
{
|
|
3393
3371
|
initial: abs,
|
|
@@ -3400,7 +3378,7 @@ function TimeRangeBar({
|
|
|
3400
3378
|
onCancel: () => setOpen(false)
|
|
3401
3379
|
}
|
|
3402
3380
|
) }) : null,
|
|
3403
|
-
loadFailed ? /* @__PURE__ */
|
|
3381
|
+
loadFailed ? /* @__PURE__ */ jsx10("div", { role: "alert", "data-time-range-load-failed": "", style: { fontSize: 12, color: "hsl(var(--destructive))" }, children: l.loadFailed }) : null,
|
|
3404
3382
|
notice && noticeShown ? /* @__PURE__ */ jsxs8(
|
|
3405
3383
|
"div",
|
|
3406
3384
|
{
|
|
@@ -3408,8 +3386,8 @@ function TimeRangeBar({
|
|
|
3408
3386
|
"data-time-range-notice": "",
|
|
3409
3387
|
style: { display: "flex", gap: 8, alignItems: "baseline", marginTop: 4, fontSize: 12, color: "hsl(var(--muted-foreground))" },
|
|
3410
3388
|
children: [
|
|
3411
|
-
/* @__PURE__ */
|
|
3412
|
-
/* @__PURE__ */
|
|
3389
|
+
/* @__PURE__ */ jsx10("span", { style: { minWidth: 0, overflowWrap: "anywhere" }, children: notice }),
|
|
3390
|
+
/* @__PURE__ */ jsx10("button", { type: "button", onClick: () => setNoticeShown(false), style: { ...button(false), flex: "0 0 auto" }, children: l.dismiss })
|
|
3413
3391
|
]
|
|
3414
3392
|
}
|
|
3415
3393
|
) : null
|
|
@@ -3515,7 +3493,7 @@ function useBoundDevices({
|
|
|
3515
3493
|
|
|
3516
3494
|
// src/bound-devices-notice.tsx
|
|
3517
3495
|
import { css as css7, fontVar as fontVar7 } from "@devicechain/widget-sdk";
|
|
3518
|
-
import { jsx as
|
|
3496
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3519
3497
|
function BoundDevicesNotice({ title, lines, dismissLabel, onDismiss, retryLabel, onRetry }) {
|
|
3520
3498
|
const button2 = {
|
|
3521
3499
|
minHeight: 44,
|
|
@@ -3547,11 +3525,11 @@ function BoundDevicesNotice({ title, lines, dismissLabel, onDismiss, retryLabel,
|
|
|
3547
3525
|
color: css7("foreground")
|
|
3548
3526
|
},
|
|
3549
3527
|
children: [
|
|
3550
|
-
/* @__PURE__ */
|
|
3551
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: fontVar7("lg"), fontWeight: 600 }, children: title }),
|
|
3529
|
+
/* @__PURE__ */ jsx11("ul", { style: { margin: 0, paddingLeft: 20, display: "flex", flexDirection: "column", gap: 4, fontSize: fontVar7("md") }, children: lines.map((line, i) => /* @__PURE__ */ jsx11("li", { style: { overflowWrap: "anywhere" }, children: line }, i)) }),
|
|
3552
3530
|
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", flexWrap: "wrap", gap: 8 }, children: [
|
|
3553
|
-
retryLabel && onRetry ? /* @__PURE__ */
|
|
3554
|
-
/* @__PURE__ */
|
|
3531
|
+
retryLabel && onRetry ? /* @__PURE__ */ jsx11("button", { type: "button", style: button2, onClick: onRetry, "data-testid": "bound-devices-retry", children: retryLabel }) : null,
|
|
3532
|
+
/* @__PURE__ */ jsx11("button", { type: "button", style: button2, onClick: onDismiss, "data-testid": "bound-devices-dismiss", children: dismissLabel })
|
|
3555
3533
|
] })
|
|
3556
3534
|
]
|
|
3557
3535
|
}
|
|
@@ -3877,6 +3855,7 @@ import {
|
|
|
3877
3855
|
useHubConnectionState,
|
|
3878
3856
|
HubConnectionBadge,
|
|
3879
3857
|
useResolvedBindings,
|
|
3858
|
+
useViewerBindings,
|
|
3880
3859
|
useSlotCandidates,
|
|
3881
3860
|
useCandidates,
|
|
3882
3861
|
css as css8
|
|
@@ -3982,6 +3961,7 @@ export {
|
|
|
3982
3961
|
useResolvedBindings,
|
|
3983
3962
|
useSlotCandidates,
|
|
3984
3963
|
useTenantBasemap,
|
|
3964
|
+
useViewerBindings,
|
|
3985
3965
|
useWidgetCandidates2 as useWidgetCandidates,
|
|
3986
3966
|
useWidgetSelect3 as useWidgetSelect,
|
|
3987
3967
|
useWidgetThemeRoot,
|