@deck.gl/widgets 9.2.11 → 9.3.0-alpha.2
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/compass-widget.js +5 -5
- package/dist/compass-widget.js.map +1 -1
- package/dist/context-menu-widget.d.ts +27 -20
- package/dist/context-menu-widget.d.ts.map +1 -1
- package/dist/context-menu-widget.js +45 -48
- package/dist/context-menu-widget.js.map +1 -1
- package/dist/dist.dev.js +3114 -869
- package/dist/fullscreen-widget.js +1 -1
- package/dist/fullscreen-widget.js.map +1 -1
- package/dist/geocoder-widget.d.ts +2 -4
- package/dist/geocoder-widget.d.ts.map +1 -1
- package/dist/geocoder-widget.js +16 -20
- package/dist/geocoder-widget.js.map +1 -1
- package/dist/gimbal-widget.d.ts +0 -3
- package/dist/gimbal-widget.d.ts.map +1 -1
- package/dist/gimbal-widget.js +4 -22
- package/dist/gimbal-widget.js.map +1 -1
- package/dist/icon-widget.d.ts +28 -0
- package/dist/icon-widget.d.ts.map +1 -0
- package/dist/icon-widget.js +35 -0
- package/dist/icon-widget.js.map +1 -0
- package/dist/index.cjs +1271 -561
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +16 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/info-widget.d.ts +39 -17
- package/dist/info-widget.d.ts.map +1 -1
- package/dist/info-widget.js +46 -130
- package/dist/info-widget.js.map +1 -1
- package/dist/lib/components/dropdown-menu.d.ts +12 -5
- package/dist/lib/components/dropdown-menu.d.ts.map +1 -1
- package/dist/lib/components/dropdown-menu.js +20 -11
- package/dist/lib/components/dropdown-menu.js.map +1 -1
- package/dist/lib/components/icon-button.d.ts +3 -0
- package/dist/lib/components/icon-button.d.ts.map +1 -1
- package/dist/lib/components/icon-button.js +10 -2
- package/dist/lib/components/icon-button.js.map +1 -1
- package/dist/lib/components/popover.d.ts +30 -0
- package/dist/lib/components/popover.d.ts.map +1 -0
- package/dist/lib/components/popover.js +93 -0
- package/dist/lib/components/popover.js.map +1 -0
- package/dist/lib/components/range-input.d.ts +26 -0
- package/dist/lib/components/range-input.d.ts.map +1 -0
- package/dist/lib/components/range-input.js +261 -0
- package/dist/lib/components/range-input.js.map +1 -0
- package/dist/lib/components/user-content.d.ts +8 -0
- package/dist/lib/components/user-content.d.ts.map +1 -0
- package/dist/lib/components/user-content.js +15 -0
- package/dist/lib/components/user-content.js.map +1 -0
- package/dist/lib/data-url.d.ts +5 -0
- package/dist/lib/data-url.d.ts.map +1 -0
- package/dist/lib/data-url.js +7 -0
- package/dist/lib/data-url.js.map +1 -0
- package/dist/popup-widget.d.ts +64 -0
- package/dist/popup-widget.d.ts.map +1 -0
- package/dist/popup-widget.js +76 -0
- package/dist/popup-widget.js.map +1 -0
- package/dist/reset-view-widget.d.ts +1 -1
- package/dist/reset-view-widget.d.ts.map +1 -1
- package/dist/reset-view-widget.js +12 -11
- package/dist/reset-view-widget.js.map +1 -1
- package/dist/scrollbar-widget.d.ts +68 -0
- package/dist/scrollbar-widget.d.ts.map +1 -0
- package/dist/scrollbar-widget.js +181 -0
- package/dist/scrollbar-widget.js.map +1 -0
- package/dist/selector-widget.d.ts +44 -0
- package/dist/selector-widget.d.ts.map +1 -0
- package/dist/selector-widget.js +64 -0
- package/dist/selector-widget.js.map +1 -0
- package/dist/splitter-widget.d.ts +52 -11
- package/dist/splitter-widget.d.ts.map +1 -1
- package/dist/splitter-widget.js +177 -76
- package/dist/splitter-widget.js.map +1 -1
- package/dist/stats-widget.d.ts +6 -1
- package/dist/stats-widget.d.ts.map +1 -1
- package/dist/stats-widget.js +39 -10
- package/dist/stats-widget.js.map +1 -1
- package/dist/stylesheet.css +291 -39
- package/dist/theme-widget.d.ts.map +1 -1
- package/dist/theme-widget.js +7 -5
- package/dist/theme-widget.js.map +1 -1
- package/dist/themes.d.ts +30 -0
- package/dist/themes.d.ts.map +1 -1
- package/dist/themes.js +28 -4
- package/dist/themes.js.map +1 -1
- package/dist/timeline-widget.d.ts +25 -6
- package/dist/timeline-widget.d.ts.map +1 -1
- package/dist/timeline-widget.js +51 -18
- package/dist/timeline-widget.js.map +1 -1
- package/dist/toggle-widget.d.ts +38 -0
- package/dist/toggle-widget.d.ts.map +1 -0
- package/dist/toggle-widget.js +47 -0
- package/dist/toggle-widget.js.map +1 -0
- package/dist/zoom-widget.d.ts +2 -8
- package/dist/zoom-widget.d.ts.map +1 -1
- package/dist/zoom-widget.js +23 -18
- package/dist/zoom-widget.js.map +1 -1
- package/dist.min.js +2 -2
- package/package.json +4 -3
- package/src/compass-widget.tsx +5 -5
- package/src/context-menu-widget.tsx +88 -78
- package/src/fullscreen-widget.tsx +1 -1
- package/src/geocoder-widget.tsx +17 -24
- package/src/gimbal-widget.tsx +4 -26
- package/src/icon-widget.tsx +69 -0
- package/src/index.ts +22 -15
- package/src/info-widget.tsx +100 -157
- package/src/lib/components/dropdown-menu.tsx +58 -29
- package/src/lib/components/icon-button.tsx +15 -3
- package/src/lib/components/popover.tsx +167 -0
- package/src/lib/components/range-input.tsx +432 -0
- package/src/lib/components/user-content.tsx +30 -0
- package/src/lib/data-url.ts +5 -0
- package/src/popup-widget.tsx +170 -0
- package/src/reset-view-widget.tsx +12 -11
- package/src/scrollbar-widget.tsx +288 -0
- package/src/selector-widget.tsx +111 -0
- package/src/splitter-widget.tsx +281 -96
- package/src/stats-widget.tsx +59 -12
- package/src/stylesheet.css +291 -39
- package/src/theme-widget.tsx +7 -5
- package/src/themes.ts +35 -4
- package/src/timeline-widget.tsx +103 -33
- package/src/toggle-widget.tsx +101 -0
- package/src/zoom-widget.tsx +25 -21
- package/dist/fps-widget.d.ts +0 -28
- package/dist/fps-widget.d.ts.map +0 -1
- package/dist/fps-widget.js +0 -51
- package/dist/fps-widget.js.map +0 -1
- package/dist/lib/components/grouped-icon-button.d.ts +0 -10
- package/dist/lib/components/grouped-icon-button.d.ts.map +0 -1
- package/dist/lib/components/grouped-icon-button.js +0 -7
- package/dist/lib/components/grouped-icon-button.js.map +0 -1
- package/dist/lib/components/icon-menu.d.ts +0 -16
- package/dist/lib/components/icon-menu.d.ts.map +0 -1
- package/dist/lib/components/icon-menu.js +0 -34
- package/dist/lib/components/icon-menu.js.map +0 -1
- package/dist/lib/components/simple-menu.d.ts +0 -16
- package/dist/lib/components/simple-menu.d.ts.map +0 -1
- package/dist/lib/components/simple-menu.js +0 -30
- package/dist/lib/components/simple-menu.js.map +0 -1
- package/dist/view-selector-widget.d.ts +0 -35
- package/dist/view-selector-widget.d.ts.map +0 -1
- package/dist/view-selector-widget.js +0 -63
- package/dist/view-selector-widget.js.map +0 -1
- package/src/fps-widget.tsx +0 -77
- package/src/lib/components/grouped-icon-button.tsx +0 -27
- package/src/lib/components/icon-menu.tsx +0 -71
- package/src/lib/components/simple-menu.tsx +0 -52
- package/src/view-selector-widget.tsx +0 -151
package/dist/dist.dev.js
CHANGED
|
@@ -56,37 +56,39 @@ var __exports__ = (() => {
|
|
|
56
56
|
var bundle_exports = {};
|
|
57
57
|
__export(bundle_exports, {
|
|
58
58
|
CompassWidget: () => CompassWidget,
|
|
59
|
+
ContextMenuWidget: () => ContextMenuWidget,
|
|
59
60
|
DarkGlassTheme: () => DarkGlassTheme,
|
|
60
61
|
DarkTheme: () => DarkTheme,
|
|
61
62
|
FullscreenWidget: () => FullscreenWidget,
|
|
62
63
|
GimbalWidget: () => GimbalWidget,
|
|
64
|
+
IconWidget: () => IconWidget,
|
|
65
|
+
InfoWidget: () => InfoWidget,
|
|
63
66
|
LightGlassTheme: () => LightGlassTheme,
|
|
64
67
|
LightTheme: () => LightTheme,
|
|
68
|
+
LoadingWidget: () => LoadingWidget,
|
|
69
|
+
PopupWidget: () => PopupWidget,
|
|
65
70
|
ResetViewWidget: () => ResetViewWidget,
|
|
66
71
|
ScreenshotWidget: () => ScreenshotWidget,
|
|
72
|
+
ScrollbarWidget: () => ScrollbarWidget,
|
|
73
|
+
SelectorWidget: () => SelectorWidget,
|
|
74
|
+
ThemeWidget: () => ThemeWidget,
|
|
75
|
+
ToggleWidget: () => ToggleWidget,
|
|
67
76
|
ZoomWidget: () => ZoomWidget,
|
|
68
77
|
_ButtonGroup: () => ButtonGroup,
|
|
69
|
-
_ContextMenuWidget: () => ContextMenuWidget,
|
|
70
78
|
_CoordinatesGeocoder: () => CoordinatesGeocoder,
|
|
71
79
|
_CurrentLocationGeocoder: () => CurrentLocationGeocoder,
|
|
72
80
|
_DropdownMenu: () => DropdownMenu,
|
|
73
|
-
_FpsWidget: () => FpsWidget,
|
|
74
81
|
_GeocoderWidget: () => GeocoderWidget,
|
|
75
82
|
_GoogleGeocoder: () => GoogleGeocoder,
|
|
76
|
-
_GroupedIconButton: () => GroupedIconButton,
|
|
77
83
|
_IconButton: () => IconButton,
|
|
78
|
-
_IconMenu: () => IconMenu,
|
|
79
|
-
_InfoWidget: () => InfoWidget,
|
|
80
|
-
_LoadingWidget: () => LoadingWidget,
|
|
81
84
|
_MapboxGeocoder: () => MapboxGeocoder,
|
|
82
85
|
_OpenCageGeocoder: () => OpenCageGeocoder,
|
|
86
|
+
_RangeInput: () => RangeInput,
|
|
83
87
|
_ScaleWidget: () => ScaleWidget,
|
|
84
88
|
_SimpleMenu: () => SimpleMenu,
|
|
85
89
|
_SplitterWidget: () => SplitterWidget,
|
|
86
90
|
_StatsWidget: () => StatsWidget,
|
|
87
|
-
|
|
88
|
-
_TimelineWidget: () => TimelineWidget,
|
|
89
|
-
_ViewSelectorWidget: () => ViewSelectorWidget
|
|
91
|
+
_TimelineWidget: () => TimelineWidget
|
|
90
92
|
});
|
|
91
93
|
|
|
92
94
|
// ../core/bundle/peer-dependency.ts
|
|
@@ -177,9 +179,9 @@ var __exports__ = (() => {
|
|
|
177
179
|
P.__r = 0;
|
|
178
180
|
}
|
|
179
181
|
function S(n2, l3, u4, t3, i4, o3, r3, f4, e3, c3, s3) {
|
|
180
|
-
var a3, v3, y3, d3, w3,
|
|
181
|
-
for (u4.__d = e3, $(u4, l3,
|
|
182
|
-
null != (y3 = u4.__k[a3]) && "boolean" != typeof y3 && "function" != typeof y3 && (v3 = -1 === y3.__i ? h :
|
|
182
|
+
var a3, v3, y3, d3, w3, _3 = t3 && t3.__k || p, g2 = l3.length;
|
|
183
|
+
for (u4.__d = e3, $(u4, l3, _3), e3 = u4.__d, a3 = 0; a3 < g2; a3++)
|
|
184
|
+
null != (y3 = u4.__k[a3]) && "boolean" != typeof y3 && "function" != typeof y3 && (v3 = -1 === y3.__i ? h : _3[y3.__i] || h, y3.__i = a3, O(n2, y3, v3, i4, o3, r3, f4, e3, c3, s3), d3 = y3.__e, y3.ref && v3.ref != y3.ref && (v3.ref && N(v3.ref, null, y3), s3.push(y3.ref, y3.__c || d3, y3)), null == w3 && null != d3 && (w3 = d3), 65536 & y3.__u || v3.__k === y3.__k ? e3 = I(y3, e3, n2) : "function" == typeof y3.type && void 0 !== y3.__d ? e3 = y3.__d : d3 && (e3 = d3.nextSibling), y3.__d = void 0, y3.__u &= -196609);
|
|
183
185
|
u4.__d = e3, u4.__e = w3;
|
|
184
186
|
}
|
|
185
187
|
function $(n2, l3, u4) {
|
|
@@ -266,37 +268,37 @@ var __exports__ = (() => {
|
|
|
266
268
|
};
|
|
267
269
|
}
|
|
268
270
|
function O(n2, u4, t3, i4, o3, r3, f4, e3, c3, s3) {
|
|
269
|
-
var a3,
|
|
271
|
+
var a3, h3, p3, v3, w3, _3, g2, m2, x2, C3, M2, P2, $2, I2, H, L2, T3 = u4.type;
|
|
270
272
|
if (void 0 !== u4.constructor)
|
|
271
273
|
return null;
|
|
272
274
|
128 & t3.__u && (c3 = !!(32 & t3.__u), r3 = [e3 = u4.__e = t3.__e]), (a3 = l.__b) && a3(u4);
|
|
273
275
|
n:
|
|
274
276
|
if ("function" == typeof T3)
|
|
275
277
|
try {
|
|
276
|
-
if (m2 = u4.props, x2 = "prototype" in T3 && T3.prototype.render, C3 = (a3 = T3.contextType) && i4[a3.__c], M2 = a3 ? C3 ? C3.props.value : a3.__ : i4, t3.__c ? g2 = (
|
|
277
|
-
x2 && null == T3.getDerivedStateFromProps && null !=
|
|
278
|
+
if (m2 = u4.props, x2 = "prototype" in T3 && T3.prototype.render, C3 = (a3 = T3.contextType) && i4[a3.__c], M2 = a3 ? C3 ? C3.props.value : a3.__ : i4, t3.__c ? g2 = (h3 = u4.__c = t3.__c).__ = h3.__E : (x2 ? u4.__c = h3 = new T3(m2, M2) : (u4.__c = h3 = new b(m2, M2), h3.constructor = T3, h3.render = q), C3 && C3.sub(h3), h3.props = m2, h3.state || (h3.state = {}), h3.context = M2, h3.__n = i4, p3 = h3.__d = true, h3.__h = [], h3._sb = []), x2 && null == h3.__s && (h3.__s = h3.state), x2 && null != T3.getDerivedStateFromProps && (h3.__s == h3.state && (h3.__s = d({}, h3.__s)), d(h3.__s, T3.getDerivedStateFromProps(m2, h3.__s))), v3 = h3.props, w3 = h3.state, h3.__v = u4, p3)
|
|
279
|
+
x2 && null == T3.getDerivedStateFromProps && null != h3.componentWillMount && h3.componentWillMount(), x2 && null != h3.componentDidMount && h3.__h.push(h3.componentDidMount);
|
|
278
280
|
else {
|
|
279
|
-
if (x2 && null == T3.getDerivedStateFromProps && m2 !== v3 && null !=
|
|
280
|
-
for (u4.__v !== t3.__v && (
|
|
281
|
+
if (x2 && null == T3.getDerivedStateFromProps && m2 !== v3 && null != h3.componentWillReceiveProps && h3.componentWillReceiveProps(m2, M2), !h3.__e && (null != h3.shouldComponentUpdate && false === h3.shouldComponentUpdate(m2, h3.__s, M2) || u4.__v === t3.__v)) {
|
|
282
|
+
for (u4.__v !== t3.__v && (h3.props = m2, h3.state = h3.__s, h3.__d = false), u4.__e = t3.__e, u4.__k = t3.__k, u4.__k.forEach(function(n3) {
|
|
281
283
|
n3 && (n3.__ = u4);
|
|
282
|
-
}), P2 = 0; P2 <
|
|
283
|
-
|
|
284
|
-
|
|
284
|
+
}), P2 = 0; P2 < h3._sb.length; P2++)
|
|
285
|
+
h3.__h.push(h3._sb[P2]);
|
|
286
|
+
h3._sb = [], h3.__h.length && f4.push(h3);
|
|
285
287
|
break n;
|
|
286
288
|
}
|
|
287
|
-
null !=
|
|
288
|
-
|
|
289
|
+
null != h3.componentWillUpdate && h3.componentWillUpdate(m2, h3.__s, M2), x2 && null != h3.componentDidUpdate && h3.__h.push(function() {
|
|
290
|
+
h3.componentDidUpdate(v3, w3, _3);
|
|
289
291
|
});
|
|
290
292
|
}
|
|
291
|
-
if (
|
|
292
|
-
for (
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
if (h3.context = M2, h3.props = m2, h3.__P = n2, h3.__e = false, $2 = l.__r, I2 = 0, x2) {
|
|
294
|
+
for (h3.state = h3.__s, h3.__d = false, $2 && $2(u4), a3 = h3.render(h3.props, h3.state, h3.context), H = 0; H < h3._sb.length; H++)
|
|
295
|
+
h3.__h.push(h3._sb[H]);
|
|
296
|
+
h3._sb = [];
|
|
295
297
|
} else
|
|
296
298
|
do {
|
|
297
|
-
|
|
298
|
-
} while (
|
|
299
|
-
|
|
299
|
+
h3.__d = false, $2 && $2(u4), a3 = h3.render(h3.props, h3.state, h3.context), h3.state = h3.__s;
|
|
300
|
+
} while (h3.__d && ++I2 < 25);
|
|
301
|
+
h3.state = h3.__s, null != h3.getChildContext && (i4 = d(d({}, i4), h3.getChildContext())), x2 && !p3 && null != h3.getSnapshotBeforeUpdate && (_3 = h3.getSnapshotBeforeUpdate(v3, w3)), S(n2, y(L2 = null != a3 && a3.type === k && null == a3.key ? a3.props.children : a3) ? L2 : [L2], u4, t3, i4, o3, r3, f4, e3, c3, s3), h3.base = u4.__e, u4.__u &= -161, h3.__h.length && f4.push(h3), g2 && (h3.__E = h3.__ = null);
|
|
300
302
|
} catch (n3) {
|
|
301
303
|
if (u4.__v = null, c3 || null != r3) {
|
|
302
304
|
for (u4.__u |= c3 ? 160 : 32; e3 && 8 === e3.nodeType && e3.nextSibling; )
|
|
@@ -325,7 +327,7 @@ var __exports__ = (() => {
|
|
|
325
327
|
});
|
|
326
328
|
}
|
|
327
329
|
function z(l3, u4, t3, i4, o3, r3, f4, e3, c3) {
|
|
328
|
-
var s3, a3, p3, v3, d3,
|
|
330
|
+
var s3, a3, p3, v3, d3, _3, g2, m2 = t3.props, k3 = u4.props, b2 = u4.type;
|
|
329
331
|
if ("svg" === b2 ? o3 = "http://www.w3.org/2000/svg" : "math" === b2 ? o3 = "http://www.w3.org/1998/Math/MathML" : o3 || (o3 = "http://www.w3.org/1999/xhtml"), null != r3) {
|
|
330
332
|
for (s3 = 0; s3 < r3.length; s3++)
|
|
331
333
|
if ((d3 = r3[s3]) && "setAttribute" in d3 == !!b2 && (b2 ? d3.localName === b2 : 3 === d3.nodeType)) {
|
|
@@ -355,13 +357,13 @@ var __exports__ = (() => {
|
|
|
355
357
|
A(l3, s3, null, d3, o3);
|
|
356
358
|
}
|
|
357
359
|
for (s3 in k3)
|
|
358
|
-
d3 = k3[s3], "children" == s3 ? v3 = d3 : "dangerouslySetInnerHTML" == s3 ? a3 = d3 : "value" == s3 ?
|
|
360
|
+
d3 = k3[s3], "children" == s3 ? v3 = d3 : "dangerouslySetInnerHTML" == s3 ? a3 = d3 : "value" == s3 ? _3 = d3 : "checked" == s3 ? g2 = d3 : "key" === s3 || e3 && "function" != typeof d3 || m2[s3] === d3 || A(l3, s3, d3, m2[s3], o3);
|
|
359
361
|
if (a3)
|
|
360
362
|
e3 || p3 && (a3.__html === p3.__html || a3.__html === l3.innerHTML) || (l3.innerHTML = a3.__html), u4.__k = [];
|
|
361
363
|
else if (p3 && (l3.innerHTML = ""), S(l3, y(v3) ? v3 : [v3], u4, t3, i4, "foreignObject" === b2 ? "http://www.w3.org/1999/xhtml" : o3, r3, f4, r3 ? r3[0] : t3.__k && x(t3, 0), e3, c3), null != r3)
|
|
362
364
|
for (s3 = r3.length; s3--; )
|
|
363
365
|
null != r3[s3] && w(r3[s3]);
|
|
364
|
-
e3 || (s3 = "value", void 0 !==
|
|
366
|
+
e3 || (s3 = "value", void 0 !== _3 && (_3 !== l3[s3] || "progress" === b2 && !_3 || "option" === b2 && _3 !== m2[s3]) && A(l3, s3, _3, m2[s3], o3), s3 = "checked", void 0 !== g2 && g2 !== l3[s3] && A(l3, s3, g2, m2[s3], o3));
|
|
365
367
|
}
|
|
366
368
|
return l3;
|
|
367
369
|
}
|
|
@@ -442,19 +444,185 @@ var __exports__ = (() => {
|
|
|
442
444
|
return /* @__PURE__ */ u2("div", { className: `deck-widget-button-group ${orientation}`, children });
|
|
443
445
|
};
|
|
444
446
|
|
|
445
|
-
//
|
|
446
|
-
var
|
|
447
|
-
|
|
448
|
-
|
|
447
|
+
// ../../node_modules/preact/hooks/dist/hooks.module.js
|
|
448
|
+
var t2;
|
|
449
|
+
var r2;
|
|
450
|
+
var u3;
|
|
451
|
+
var i3;
|
|
452
|
+
var o2 = 0;
|
|
453
|
+
var f3 = [];
|
|
454
|
+
var c2 = l;
|
|
455
|
+
var e2 = c2.__b;
|
|
456
|
+
var a2 = c2.__r;
|
|
457
|
+
var v2 = c2.diffed;
|
|
458
|
+
var l2 = c2.__c;
|
|
459
|
+
var m = c2.unmount;
|
|
460
|
+
var s2 = c2.__;
|
|
461
|
+
function d2(n2, t3) {
|
|
462
|
+
c2.__h && c2.__h(r2, n2, o2 || t3), o2 = 0;
|
|
463
|
+
var u4 = r2.__H || (r2.__H = { __: [], __h: [] });
|
|
464
|
+
return n2 >= u4.__.length && u4.__.push({}), u4.__[n2];
|
|
465
|
+
}
|
|
466
|
+
function h2(n2) {
|
|
467
|
+
return o2 = 1, p2(D, n2);
|
|
468
|
+
}
|
|
469
|
+
function p2(n2, u4, i4) {
|
|
470
|
+
var o3 = d2(t2++, 2);
|
|
471
|
+
if (o3.t = n2, !o3.__c && (o3.__ = [i4 ? i4(u4) : D(void 0, u4), function(n3) {
|
|
472
|
+
var t3 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t3, n3);
|
|
473
|
+
t3 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({}));
|
|
474
|
+
}], o3.__c = r2, !r2.u)) {
|
|
475
|
+
var f4 = function(n3, t3, r3) {
|
|
476
|
+
if (!o3.__c.__H)
|
|
477
|
+
return true;
|
|
478
|
+
var u5 = o3.__c.__H.__.filter(function(n4) {
|
|
479
|
+
return !!n4.__c;
|
|
480
|
+
});
|
|
481
|
+
if (u5.every(function(n4) {
|
|
482
|
+
return !n4.__N;
|
|
483
|
+
}))
|
|
484
|
+
return !c3 || c3.call(this, n3, t3, r3);
|
|
485
|
+
var i5 = false;
|
|
486
|
+
return u5.forEach(function(n4) {
|
|
487
|
+
if (n4.__N) {
|
|
488
|
+
var t4 = n4.__[0];
|
|
489
|
+
n4.__ = n4.__N, n4.__N = void 0, t4 !== n4.__[0] && (i5 = true);
|
|
490
|
+
}
|
|
491
|
+
}), !(!i5 && o3.__c.props === n3) && (!c3 || c3.call(this, n3, t3, r3));
|
|
492
|
+
};
|
|
493
|
+
r2.u = true;
|
|
494
|
+
var c3 = r2.shouldComponentUpdate, e3 = r2.componentWillUpdate;
|
|
495
|
+
r2.componentWillUpdate = function(n3, t3, r3) {
|
|
496
|
+
if (this.__e) {
|
|
497
|
+
var u5 = c3;
|
|
498
|
+
c3 = void 0, f4(n3, t3, r3), c3 = u5;
|
|
499
|
+
}
|
|
500
|
+
e3 && e3.call(this, n3, t3, r3);
|
|
501
|
+
}, r2.shouldComponentUpdate = f4;
|
|
502
|
+
}
|
|
503
|
+
return o3.__N || o3.__;
|
|
504
|
+
}
|
|
505
|
+
function y2(n2, u4) {
|
|
506
|
+
var i4 = d2(t2++, 3);
|
|
507
|
+
!c2.__s && C2(i4.__H, u4) && (i4.__ = n2, i4.i = u4, r2.__H.__h.push(i4));
|
|
508
|
+
}
|
|
509
|
+
function _2(n2, u4) {
|
|
510
|
+
var i4 = d2(t2++, 4);
|
|
511
|
+
!c2.__s && C2(i4.__H, u4) && (i4.__ = n2, i4.i = u4, r2.__h.push(i4));
|
|
512
|
+
}
|
|
513
|
+
function A2(n2) {
|
|
514
|
+
return o2 = 5, T2(function() {
|
|
515
|
+
return { current: n2 };
|
|
516
|
+
}, []);
|
|
517
|
+
}
|
|
518
|
+
function T2(n2, r3) {
|
|
519
|
+
var u4 = d2(t2++, 7);
|
|
520
|
+
return C2(u4.__H, r3) && (u4.__ = n2(), u4.__H = r3, u4.__h = n2), u4.__;
|
|
521
|
+
}
|
|
522
|
+
function q2(n2, t3) {
|
|
523
|
+
return o2 = 8, T2(function() {
|
|
524
|
+
return n2;
|
|
525
|
+
}, t3);
|
|
526
|
+
}
|
|
527
|
+
function j2() {
|
|
528
|
+
for (var n2; n2 = f3.shift(); )
|
|
529
|
+
if (n2.__P && n2.__H)
|
|
530
|
+
try {
|
|
531
|
+
n2.__H.__h.forEach(z2), n2.__H.__h.forEach(B2), n2.__H.__h = [];
|
|
532
|
+
} catch (t3) {
|
|
533
|
+
n2.__H.__h = [], c2.__e(t3, n2.__v);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
c2.__b = function(n2) {
|
|
537
|
+
r2 = null, e2 && e2(n2);
|
|
538
|
+
}, c2.__ = function(n2, t3) {
|
|
539
|
+
n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), s2 && s2(n2, t3);
|
|
540
|
+
}, c2.__r = function(n2) {
|
|
541
|
+
a2 && a2(n2), t2 = 0;
|
|
542
|
+
var i4 = (r2 = n2.__c).__H;
|
|
543
|
+
i4 && (u3 === r2 ? (i4.__h = [], r2.__h = [], i4.__.forEach(function(n3) {
|
|
544
|
+
n3.__N && (n3.__ = n3.__N), n3.i = n3.__N = void 0;
|
|
545
|
+
})) : (i4.__h.forEach(z2), i4.__h.forEach(B2), i4.__h = [], t2 = 0)), u3 = r2;
|
|
546
|
+
}, c2.diffed = function(n2) {
|
|
547
|
+
v2 && v2(n2);
|
|
548
|
+
var t3 = n2.__c;
|
|
549
|
+
t3 && t3.__H && (t3.__H.__h.length && (1 !== f3.push(t3) && i3 === c2.requestAnimationFrame || ((i3 = c2.requestAnimationFrame) || w2)(j2)), t3.__H.__.forEach(function(n3) {
|
|
550
|
+
n3.i && (n3.__H = n3.i), n3.i = void 0;
|
|
551
|
+
})), u3 = r2 = null;
|
|
552
|
+
}, c2.__c = function(n2, t3) {
|
|
553
|
+
t3.some(function(n3) {
|
|
554
|
+
try {
|
|
555
|
+
n3.__h.forEach(z2), n3.__h = n3.__h.filter(function(n4) {
|
|
556
|
+
return !n4.__ || B2(n4);
|
|
557
|
+
});
|
|
558
|
+
} catch (r3) {
|
|
559
|
+
t3.some(function(n4) {
|
|
560
|
+
n4.__h && (n4.__h = []);
|
|
561
|
+
}), t3 = [], c2.__e(r3, n3.__v);
|
|
562
|
+
}
|
|
563
|
+
}), l2 && l2(n2, t3);
|
|
564
|
+
}, c2.unmount = function(n2) {
|
|
565
|
+
m && m(n2);
|
|
566
|
+
var t3, r3 = n2.__c;
|
|
567
|
+
r3 && r3.__H && (r3.__H.__.forEach(function(n3) {
|
|
568
|
+
try {
|
|
569
|
+
z2(n3);
|
|
570
|
+
} catch (n4) {
|
|
571
|
+
t3 = n4;
|
|
572
|
+
}
|
|
573
|
+
}), r3.__H = void 0, t3 && c2.__e(t3, r3.__v));
|
|
574
|
+
};
|
|
575
|
+
var k2 = "function" == typeof requestAnimationFrame;
|
|
576
|
+
function w2(n2) {
|
|
577
|
+
var t3, r3 = function() {
|
|
578
|
+
clearTimeout(u4), k2 && cancelAnimationFrame(t3), setTimeout(n2);
|
|
579
|
+
}, u4 = setTimeout(r3, 100);
|
|
580
|
+
k2 && (t3 = requestAnimationFrame(r3));
|
|
581
|
+
}
|
|
582
|
+
function z2(n2) {
|
|
583
|
+
var t3 = r2, u4 = n2.__c;
|
|
584
|
+
"function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t3;
|
|
585
|
+
}
|
|
586
|
+
function B2(n2) {
|
|
587
|
+
var t3 = r2;
|
|
588
|
+
n2.__c = n2.__(), r2 = t3;
|
|
589
|
+
}
|
|
590
|
+
function C2(n2, t3) {
|
|
591
|
+
return !n2 || n2.length !== t3.length || t3.some(function(t4, r3) {
|
|
592
|
+
return t4 !== n2[r3];
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
function D(n2, t3) {
|
|
596
|
+
return "function" == typeof t3 ? t3(n2) : t3;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// src/lib/data-url.ts
|
|
600
|
+
function getCSSMask(imageUrl) {
|
|
601
|
+
if (!imageUrl)
|
|
602
|
+
return void 0;
|
|
603
|
+
const cssUrl = `url("${imageUrl.replace(/"/g, `'`)}")`;
|
|
604
|
+
return { maskImage: cssUrl, WebkitMaskImage: cssUrl };
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// src/lib/components/icon-button.tsx
|
|
608
|
+
var IconButton = (props) => {
|
|
609
|
+
const { className = "", style, color, icon, label, onClick, children } = props;
|
|
610
|
+
const iconStyle = T2(() => {
|
|
611
|
+
const css = getCSSMask(icon);
|
|
612
|
+
if (!color)
|
|
613
|
+
return css;
|
|
614
|
+
return { ...css, backgroundColor: color };
|
|
615
|
+
}, [color, icon]);
|
|
616
|
+
return /* @__PURE__ */ u2("div", { className: "deck-widget-button", style, children: /* @__PURE__ */ u2(
|
|
449
617
|
"button",
|
|
450
618
|
{
|
|
451
619
|
className: `deck-widget-icon-button ${className}`,
|
|
452
620
|
type: "button",
|
|
453
621
|
onClick,
|
|
454
622
|
title: label,
|
|
455
|
-
children: children ? children : /* @__PURE__ */ u2("div", { className: "deck-widget-icon" })
|
|
623
|
+
children: children ? children : /* @__PURE__ */ u2("div", { className: "deck-widget-icon", style: iconStyle })
|
|
456
624
|
}
|
|
457
|
-
);
|
|
625
|
+
) });
|
|
458
626
|
};
|
|
459
627
|
|
|
460
628
|
// src/zoom-widget.tsx
|
|
@@ -463,7 +631,6 @@ var __exports__ = (() => {
|
|
|
463
631
|
super(props);
|
|
464
632
|
this.className = "deck-widget-zoom";
|
|
465
633
|
this.placement = "top-left";
|
|
466
|
-
this.viewports = {};
|
|
467
634
|
this.setProps(this.props);
|
|
468
635
|
}
|
|
469
636
|
setProps(props) {
|
|
@@ -474,7 +641,7 @@ var __exports__ = (() => {
|
|
|
474
641
|
onRenderHTML(rootElement) {
|
|
475
642
|
const ui = /* @__PURE__ */ u2(ButtonGroup, { orientation: this.props.orientation, children: [
|
|
476
643
|
/* @__PURE__ */ u2(
|
|
477
|
-
|
|
644
|
+
IconButton,
|
|
478
645
|
{
|
|
479
646
|
onClick: () => this.handleZoomIn(),
|
|
480
647
|
label: this.props.zoomInLabel,
|
|
@@ -482,7 +649,7 @@ var __exports__ = (() => {
|
|
|
482
649
|
}
|
|
483
650
|
),
|
|
484
651
|
/* @__PURE__ */ u2(
|
|
485
|
-
|
|
652
|
+
IconButton,
|
|
486
653
|
{
|
|
487
654
|
onClick: () => this.handleZoomOut(),
|
|
488
655
|
label: this.props.zoomOutLabel,
|
|
@@ -492,13 +659,19 @@ var __exports__ = (() => {
|
|
|
492
659
|
] });
|
|
493
660
|
B(ui, rootElement);
|
|
494
661
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
662
|
+
handleZoom(viewId, nextZoom) {
|
|
663
|
+
const viewState = this.getViewState(viewId);
|
|
664
|
+
if (viewState) {
|
|
665
|
+
const { minZoom, maxZoom } = viewState;
|
|
666
|
+
if (Number.isFinite(minZoom)) {
|
|
667
|
+
nextZoom = Math.max(minZoom, nextZoom);
|
|
668
|
+
}
|
|
669
|
+
if (Number.isFinite(maxZoom)) {
|
|
670
|
+
nextZoom = Math.min(maxZoom, nextZoom);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
500
673
|
const nextViewState = {
|
|
501
|
-
...
|
|
674
|
+
...viewState,
|
|
502
675
|
zoom: nextZoom
|
|
503
676
|
};
|
|
504
677
|
if (this.props.transitionDuration > 0) {
|
|
@@ -510,19 +683,19 @@ var __exports__ = (() => {
|
|
|
510
683
|
this.setViewState(viewId, nextViewState);
|
|
511
684
|
}
|
|
512
685
|
handleZoomIn() {
|
|
513
|
-
|
|
514
|
-
|
|
686
|
+
const viewIds = this.viewId ? [this.viewId] : this.deck?.getViews().map((v3) => v3.id) ?? [];
|
|
687
|
+
for (const viewId of viewIds) {
|
|
688
|
+
const viewState = this.getViewState(viewId);
|
|
689
|
+
this.handleZoom(viewId, viewState.zoom + 1);
|
|
515
690
|
}
|
|
516
691
|
}
|
|
517
692
|
handleZoomOut() {
|
|
518
|
-
|
|
519
|
-
|
|
693
|
+
const viewIds = this.viewId ? [this.viewId] : this.deck?.getViews().map((v3) => v3.id) ?? [];
|
|
694
|
+
for (const viewId of viewIds) {
|
|
695
|
+
const viewState = this.getViewState(viewId);
|
|
696
|
+
this.handleZoom(viewId, viewState.zoom - 1);
|
|
520
697
|
}
|
|
521
698
|
}
|
|
522
|
-
/** @todo - move to deck or widget manager */
|
|
523
|
-
setViewState(viewId, viewState) {
|
|
524
|
-
this.deck._onViewStateChange({ viewId, viewState, interactionState: {} });
|
|
525
|
-
}
|
|
526
699
|
};
|
|
527
700
|
ZoomWidget.defaultProps = {
|
|
528
701
|
...import_core2.Widget.defaultProps,
|
|
@@ -537,23 +710,6 @@ var __exports__ = (() => {
|
|
|
537
710
|
|
|
538
711
|
// src/reset-view-widget.tsx
|
|
539
712
|
var import_core3 = __toESM(require_core(), 1);
|
|
540
|
-
|
|
541
|
-
// src/lib/components/icon-button.tsx
|
|
542
|
-
var IconButton = (props) => {
|
|
543
|
-
const { className = "", label, onClick, children } = props;
|
|
544
|
-
return /* @__PURE__ */ u2("div", { className: "deck-widget-button", children: /* @__PURE__ */ u2(
|
|
545
|
-
"button",
|
|
546
|
-
{
|
|
547
|
-
className: `deck-widget-icon-button ${className}`,
|
|
548
|
-
type: "button",
|
|
549
|
-
onClick,
|
|
550
|
-
title: label,
|
|
551
|
-
children: children ? children : /* @__PURE__ */ u2("div", { className: "deck-widget-icon" })
|
|
552
|
-
}
|
|
553
|
-
) });
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
// src/reset-view-widget.tsx
|
|
557
713
|
var ResetViewWidget = class extends import_core3.Widget {
|
|
558
714
|
constructor(props = {}) {
|
|
559
715
|
super(props);
|
|
@@ -581,17 +737,19 @@ var __exports__ = (() => {
|
|
|
581
737
|
}
|
|
582
738
|
handleClick() {
|
|
583
739
|
const initialViewState = this.props.initialViewState || this.deck?.props.initialViewState;
|
|
584
|
-
this.
|
|
740
|
+
this.resetViewState(initialViewState);
|
|
585
741
|
}
|
|
586
|
-
|
|
587
|
-
const
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
742
|
+
resetViewState(viewState) {
|
|
743
|
+
const viewIds = this.viewId ? [this.viewId] : this.deck?.getViews().map((v3) => v3.id) ?? [];
|
|
744
|
+
for (const viewId of viewIds) {
|
|
745
|
+
const nextViewState = {
|
|
746
|
+
...viewState?.[viewId] ?? viewState
|
|
747
|
+
// only works for geospatial?
|
|
748
|
+
// transitionDuration: this.props.transitionDuration,
|
|
749
|
+
// transitionInterpolator: new FlyToInterpolator()
|
|
750
|
+
};
|
|
751
|
+
this.setViewState(viewId, nextViewState);
|
|
752
|
+
}
|
|
595
753
|
}
|
|
596
754
|
};
|
|
597
755
|
ResetViewWidget.defaultProps = {
|
|
@@ -696,7 +854,7 @@ var __exports__ = (() => {
|
|
|
696
854
|
this.updateHTML();
|
|
697
855
|
}
|
|
698
856
|
resetOrbitView(viewport) {
|
|
699
|
-
const viewId = this.
|
|
857
|
+
const viewId = this.viewId || viewport?.id || "OrbitView";
|
|
700
858
|
const viewState = this.getViewState(viewId);
|
|
701
859
|
if ("rotationOrbit" in viewState || "rotationX" in viewState) {
|
|
702
860
|
const nextViewState = {
|
|
@@ -708,11 +866,12 @@ var __exports__ = (() => {
|
|
|
708
866
|
transitionProps: ["rotationOrbit", "rotationX"]
|
|
709
867
|
})
|
|
710
868
|
};
|
|
711
|
-
this.
|
|
869
|
+
this.setViewState(viewId, nextViewState);
|
|
712
870
|
}
|
|
713
871
|
}
|
|
714
872
|
getNormalizedRotation(viewport) {
|
|
715
|
-
const
|
|
873
|
+
const viewId = this.viewId || viewport?.id || "OrbitView";
|
|
874
|
+
const viewState = this.getViewState(viewId);
|
|
716
875
|
const [rz, rx] = this.getRotation(viewState);
|
|
717
876
|
const rotationOrbit = normalizeAndClampAngle(rz);
|
|
718
877
|
const rotationX = normalizeAndClampAngle(rx);
|
|
@@ -724,23 +883,6 @@ var __exports__ = (() => {
|
|
|
724
883
|
}
|
|
725
884
|
return [0, 0];
|
|
726
885
|
}
|
|
727
|
-
// Move to Widget/WidgetManager?
|
|
728
|
-
getViewId(viewport) {
|
|
729
|
-
const viewId = this.viewId || viewport?.id || "OrbitView";
|
|
730
|
-
return viewId;
|
|
731
|
-
}
|
|
732
|
-
getViewState(viewId) {
|
|
733
|
-
const viewManager = this.getViewManager();
|
|
734
|
-
const viewState = viewId && viewManager.getViewState(viewId) || viewManager.viewState;
|
|
735
|
-
return viewState;
|
|
736
|
-
}
|
|
737
|
-
getViewManager() {
|
|
738
|
-
const viewManager = this.deck?.viewManager;
|
|
739
|
-
if (!viewManager) {
|
|
740
|
-
throw new Error("wigdet must be added to a deck instance");
|
|
741
|
-
}
|
|
742
|
-
return viewManager;
|
|
743
|
-
}
|
|
744
886
|
};
|
|
745
887
|
GimbalWidget.defaultProps = {
|
|
746
888
|
...import_core4.Widget.defaultProps,
|
|
@@ -781,7 +923,7 @@ var __exports__ = (() => {
|
|
|
781
923
|
super.setProps(props);
|
|
782
924
|
}
|
|
783
925
|
onRenderHTML(rootElement) {
|
|
784
|
-
const viewId = this.viewId || Object.values(this.viewports)[0]?.id
|
|
926
|
+
const viewId = this.viewId || Object.values(this.viewports)[0]?.id;
|
|
785
927
|
const widgetViewport = this.viewports[viewId];
|
|
786
928
|
const [rz, rx] = this.getRotation(widgetViewport);
|
|
787
929
|
const ui = /* @__PURE__ */ u2("div", { className: "deck-widget-button", style: { perspective: 100 }, children: /* @__PURE__ */ u2(
|
|
@@ -830,16 +972,17 @@ var __exports__ = (() => {
|
|
|
830
972
|
return [0, 0];
|
|
831
973
|
}
|
|
832
974
|
handleCompassReset(viewport) {
|
|
833
|
-
const viewId = this.viewId || viewport.id
|
|
975
|
+
const viewId = this.viewId || viewport.id;
|
|
834
976
|
if (viewport instanceof import_core5.WebMercatorViewport) {
|
|
977
|
+
const viewState = this.getViewState(viewId);
|
|
835
978
|
const nextViewState = {
|
|
836
|
-
...
|
|
979
|
+
...viewState,
|
|
837
980
|
bearing: 0,
|
|
838
981
|
...this.getRotation(viewport)[0] === 0 ? { pitch: 0 } : {},
|
|
839
982
|
transitionDuration: this.props.transitionDuration,
|
|
840
983
|
transitionInterpolator: new import_core5.FlyToInterpolator()
|
|
841
984
|
};
|
|
842
|
-
this.
|
|
985
|
+
this.setViewState(viewId, nextViewState);
|
|
843
986
|
}
|
|
844
987
|
}
|
|
845
988
|
};
|
|
@@ -1000,202 +1143,70 @@ var __exports__ = (() => {
|
|
|
1000
1143
|
var import_core7 = __toESM(require_core(), 1);
|
|
1001
1144
|
var import_core8 = __toESM(require_core(), 1);
|
|
1002
1145
|
|
|
1003
|
-
//
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
var u3;
|
|
1007
|
-
var i3;
|
|
1008
|
-
var o2 = 0;
|
|
1009
|
-
var f3 = [];
|
|
1010
|
-
var c2 = l;
|
|
1011
|
-
var e2 = c2.__b;
|
|
1012
|
-
var a2 = c2.__r;
|
|
1013
|
-
var v2 = c2.diffed;
|
|
1014
|
-
var l2 = c2.__c;
|
|
1015
|
-
var m = c2.unmount;
|
|
1016
|
-
var s2 = c2.__;
|
|
1017
|
-
function d2(n2, t3) {
|
|
1018
|
-
c2.__h && c2.__h(r2, n2, o2 || t3), o2 = 0;
|
|
1019
|
-
var u4 = r2.__H || (r2.__H = { __: [], __h: [] });
|
|
1020
|
-
return n2 >= u4.__.length && u4.__.push({}), u4.__[n2];
|
|
1146
|
+
// src/lib/components/dropdown-menu.tsx
|
|
1147
|
+
function getMenuItemValue(item) {
|
|
1148
|
+
return typeof item === "string" ? item : item.value;
|
|
1021
1149
|
}
|
|
1022
|
-
function
|
|
1023
|
-
return
|
|
1150
|
+
function getMenuItemLabel(item) {
|
|
1151
|
+
return typeof item === "string" ? item : item.label;
|
|
1024
1152
|
}
|
|
1025
|
-
function
|
|
1026
|
-
|
|
1027
|
-
if (o3.t = n2, !o3.__c && (o3.__ = [i4 ? i4(u4) : D(void 0, u4), function(n3) {
|
|
1028
|
-
var t3 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t3, n3);
|
|
1029
|
-
t3 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({}));
|
|
1030
|
-
}], o3.__c = r2, !r2.u)) {
|
|
1031
|
-
var f4 = function(n3, t3, r3) {
|
|
1032
|
-
if (!o3.__c.__H)
|
|
1033
|
-
return true;
|
|
1034
|
-
var u5 = o3.__c.__H.__.filter(function(n4) {
|
|
1035
|
-
return !!n4.__c;
|
|
1036
|
-
});
|
|
1037
|
-
if (u5.every(function(n4) {
|
|
1038
|
-
return !n4.__N;
|
|
1039
|
-
}))
|
|
1040
|
-
return !c3 || c3.call(this, n3, t3, r3);
|
|
1041
|
-
var i5 = false;
|
|
1042
|
-
return u5.forEach(function(n4) {
|
|
1043
|
-
if (n4.__N) {
|
|
1044
|
-
var t4 = n4.__[0];
|
|
1045
|
-
n4.__ = n4.__N, n4.__N = void 0, t4 !== n4.__[0] && (i5 = true);
|
|
1046
|
-
}
|
|
1047
|
-
}), !(!i5 && o3.__c.props === n3) && (!c3 || c3.call(this, n3, t3, r3));
|
|
1048
|
-
};
|
|
1049
|
-
r2.u = true;
|
|
1050
|
-
var c3 = r2.shouldComponentUpdate, e3 = r2.componentWillUpdate;
|
|
1051
|
-
r2.componentWillUpdate = function(n3, t3, r3) {
|
|
1052
|
-
if (this.__e) {
|
|
1053
|
-
var u5 = c3;
|
|
1054
|
-
c3 = void 0, f4(n3, t3, r3), c3 = u5;
|
|
1055
|
-
}
|
|
1056
|
-
e3 && e3.call(this, n3, t3, r3);
|
|
1057
|
-
}, r2.shouldComponentUpdate = f4;
|
|
1058
|
-
}
|
|
1059
|
-
return o3.__N || o3.__;
|
|
1060
|
-
}
|
|
1061
|
-
function y2(n2, u4) {
|
|
1062
|
-
var i4 = d2(t2++, 3);
|
|
1063
|
-
!c2.__s && C2(i4.__H, u4) && (i4.__ = n2, i4.i = u4, r2.__H.__h.push(i4));
|
|
1064
|
-
}
|
|
1065
|
-
function A2(n2) {
|
|
1066
|
-
return o2 = 5, T2(function() {
|
|
1067
|
-
return { current: n2 };
|
|
1068
|
-
}, []);
|
|
1069
|
-
}
|
|
1070
|
-
function T2(n2, r3) {
|
|
1071
|
-
var u4 = d2(t2++, 7);
|
|
1072
|
-
return C2(u4.__H, r3) && (u4.__ = n2(), u4.__H = r3, u4.__h = n2), u4.__;
|
|
1073
|
-
}
|
|
1074
|
-
function j2() {
|
|
1075
|
-
for (var n2; n2 = f3.shift(); )
|
|
1076
|
-
if (n2.__P && n2.__H)
|
|
1077
|
-
try {
|
|
1078
|
-
n2.__H.__h.forEach(z2), n2.__H.__h.forEach(B2), n2.__H.__h = [];
|
|
1079
|
-
} catch (t3) {
|
|
1080
|
-
n2.__H.__h = [], c2.__e(t3, n2.__v);
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
c2.__b = function(n2) {
|
|
1084
|
-
r2 = null, e2 && e2(n2);
|
|
1085
|
-
}, c2.__ = function(n2, t3) {
|
|
1086
|
-
n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), s2 && s2(n2, t3);
|
|
1087
|
-
}, c2.__r = function(n2) {
|
|
1088
|
-
a2 && a2(n2), t2 = 0;
|
|
1089
|
-
var i4 = (r2 = n2.__c).__H;
|
|
1090
|
-
i4 && (u3 === r2 ? (i4.__h = [], r2.__h = [], i4.__.forEach(function(n3) {
|
|
1091
|
-
n3.__N && (n3.__ = n3.__N), n3.i = n3.__N = void 0;
|
|
1092
|
-
})) : (i4.__h.forEach(z2), i4.__h.forEach(B2), i4.__h = [], t2 = 0)), u3 = r2;
|
|
1093
|
-
}, c2.diffed = function(n2) {
|
|
1094
|
-
v2 && v2(n2);
|
|
1095
|
-
var t3 = n2.__c;
|
|
1096
|
-
t3 && t3.__H && (t3.__H.__h.length && (1 !== f3.push(t3) && i3 === c2.requestAnimationFrame || ((i3 = c2.requestAnimationFrame) || w2)(j2)), t3.__H.__.forEach(function(n3) {
|
|
1097
|
-
n3.i && (n3.__H = n3.i), n3.i = void 0;
|
|
1098
|
-
})), u3 = r2 = null;
|
|
1099
|
-
}, c2.__c = function(n2, t3) {
|
|
1100
|
-
t3.some(function(n3) {
|
|
1101
|
-
try {
|
|
1102
|
-
n3.__h.forEach(z2), n3.__h = n3.__h.filter(function(n4) {
|
|
1103
|
-
return !n4.__ || B2(n4);
|
|
1104
|
-
});
|
|
1105
|
-
} catch (r3) {
|
|
1106
|
-
t3.some(function(n4) {
|
|
1107
|
-
n4.__h && (n4.__h = []);
|
|
1108
|
-
}), t3 = [], c2.__e(r3, n3.__v);
|
|
1109
|
-
}
|
|
1110
|
-
}), l2 && l2(n2, t3);
|
|
1111
|
-
}, c2.unmount = function(n2) {
|
|
1112
|
-
m && m(n2);
|
|
1113
|
-
var t3, r3 = n2.__c;
|
|
1114
|
-
r3 && r3.__H && (r3.__H.__.forEach(function(n3) {
|
|
1115
|
-
try {
|
|
1116
|
-
z2(n3);
|
|
1117
|
-
} catch (n4) {
|
|
1118
|
-
t3 = n4;
|
|
1119
|
-
}
|
|
1120
|
-
}), r3.__H = void 0, t3 && c2.__e(t3, r3.__v));
|
|
1121
|
-
};
|
|
1122
|
-
var k2 = "function" == typeof requestAnimationFrame;
|
|
1123
|
-
function w2(n2) {
|
|
1124
|
-
var t3, r3 = function() {
|
|
1125
|
-
clearTimeout(u4), k2 && cancelAnimationFrame(t3), setTimeout(n2);
|
|
1126
|
-
}, u4 = setTimeout(r3, 100);
|
|
1127
|
-
k2 && (t3 = requestAnimationFrame(r3));
|
|
1128
|
-
}
|
|
1129
|
-
function z2(n2) {
|
|
1130
|
-
var t3 = r2, u4 = n2.__c;
|
|
1131
|
-
"function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t3;
|
|
1132
|
-
}
|
|
1133
|
-
function B2(n2) {
|
|
1134
|
-
var t3 = r2;
|
|
1135
|
-
n2.__c = n2.__(), r2 = t3;
|
|
1136
|
-
}
|
|
1137
|
-
function C2(n2, t3) {
|
|
1138
|
-
return !n2 || n2.length !== t3.length || t3.some(function(t4, r3) {
|
|
1139
|
-
return t4 !== n2[r3];
|
|
1140
|
-
});
|
|
1141
|
-
}
|
|
1142
|
-
function D(n2, t3) {
|
|
1143
|
-
return "function" == typeof t3 ? t3(n2) : t3;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
// src/lib/components/dropdown-menu.tsx
|
|
1147
|
-
function getMenuItemValue(item) {
|
|
1148
|
-
return typeof item === "string" ? item : item.value;
|
|
1149
|
-
}
|
|
1150
|
-
function getMenuItemLabel(item) {
|
|
1151
|
-
return typeof item === "string" ? item : item.label;
|
|
1152
|
-
}
|
|
1153
|
-
function getMenuItemIcon(item) {
|
|
1154
|
-
return typeof item === "string" ? void 0 : item.icon;
|
|
1153
|
+
function getMenuItemIcon(item) {
|
|
1154
|
+
return typeof item === "string" ? void 0 : item.icon;
|
|
1155
1155
|
}
|
|
1156
1156
|
var DropdownMenu = (props) => {
|
|
1157
1157
|
const [isOpen, setIsOpen] = h2(false);
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1158
|
+
return /* @__PURE__ */ u2(
|
|
1159
|
+
SimpleMenu,
|
|
1160
|
+
{
|
|
1161
|
+
...props,
|
|
1162
|
+
style: { ...props.style, position: "absolute" },
|
|
1163
|
+
isOpen,
|
|
1164
|
+
onClose: () => setIsOpen(false),
|
|
1165
|
+
trigger: /* @__PURE__ */ u2("button", { className: "deck-widget-dropdown-button", onClick: () => setIsOpen(!isOpen), children: /* @__PURE__ */ u2("span", { className: `deck-widget-dropdown-icon ${isOpen ? "open" : ""}` }) })
|
|
1163
1166
|
}
|
|
1164
|
-
|
|
1167
|
+
);
|
|
1168
|
+
};
|
|
1169
|
+
var SimpleMenu = (props) => {
|
|
1170
|
+
const dropdownRef = A2(null);
|
|
1165
1171
|
y2(() => {
|
|
1172
|
+
const handleClickOutside = (event) => {
|
|
1173
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1174
|
+
props.onClose();
|
|
1175
|
+
}
|
|
1176
|
+
};
|
|
1166
1177
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1167
1178
|
return () => {
|
|
1168
1179
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
1169
1180
|
};
|
|
1170
1181
|
}, []);
|
|
1171
|
-
const handleSelect = (item) => {
|
|
1172
|
-
|
|
1173
|
-
|
|
1182
|
+
const handleSelect = (value, item) => {
|
|
1183
|
+
if (value) {
|
|
1184
|
+
if (typeof item === "object") {
|
|
1185
|
+
item.onSelect?.();
|
|
1186
|
+
}
|
|
1187
|
+
props.onSelect?.(value);
|
|
1188
|
+
props.onClose();
|
|
1189
|
+
}
|
|
1174
1190
|
};
|
|
1175
1191
|
if (props.menuItems.length === 0) {
|
|
1176
1192
|
return null;
|
|
1177
1193
|
}
|
|
1178
|
-
return /* @__PURE__ */ u2("div", { className: "deck-widget-dropdown-container", ref: dropdownRef,
|
|
1179
|
-
|
|
1180
|
-
isOpen && /* @__PURE__ */ u2("ul", { className: "deck-widget-dropdown-menu", children: props.menuItems.map((item) => {
|
|
1194
|
+
return /* @__PURE__ */ u2("div", { className: "deck-widget-dropdown-container", ref: dropdownRef, children: [
|
|
1195
|
+
props.trigger,
|
|
1196
|
+
props.isOpen && /* @__PURE__ */ u2("ul", { className: "deck-widget-dropdown-menu", style: props.style, children: props.menuItems.map((item, i4) => {
|
|
1197
|
+
const value = getMenuItemValue(item);
|
|
1181
1198
|
const icon = getMenuItemIcon(item);
|
|
1182
1199
|
return /* @__PURE__ */ u2(
|
|
1183
1200
|
"li",
|
|
1184
1201
|
{
|
|
1185
|
-
className:
|
|
1186
|
-
onClick: () => handleSelect(item),
|
|
1202
|
+
className: `deck-widget-dropdown-item ${value ? "" : "disabled"}`,
|
|
1203
|
+
onClick: () => handleSelect(value, item),
|
|
1187
1204
|
children: [
|
|
1188
|
-
icon && /* @__PURE__ */ u2(
|
|
1189
|
-
"span",
|
|
1190
|
-
{
|
|
1191
|
-
className: "deck-widget-dropdown-item-icon",
|
|
1192
|
-
style: { maskImage: `url("${icon}")`, WebkitMaskImage: `url("${icon}")` }
|
|
1193
|
-
}
|
|
1194
|
-
),
|
|
1205
|
+
icon && /* @__PURE__ */ u2("span", { className: "deck-widget-dropdown-item-icon", style: getCSSMask(icon) }),
|
|
1195
1206
|
getMenuItemLabel(item)
|
|
1196
1207
|
]
|
|
1197
1208
|
},
|
|
1198
|
-
|
|
1209
|
+
i4
|
|
1199
1210
|
);
|
|
1200
1211
|
}) })
|
|
1201
1212
|
] });
|
|
@@ -1435,7 +1446,7 @@ var __exports__ = (() => {
|
|
|
1435
1446
|
try {
|
|
1436
1447
|
const coordinates = await CurrentLocationGeocoder.geocode();
|
|
1437
1448
|
if (coordinates) {
|
|
1438
|
-
this.
|
|
1449
|
+
this.flyTo(coordinates);
|
|
1439
1450
|
}
|
|
1440
1451
|
} catch (error) {
|
|
1441
1452
|
this.geocodeHistory.errorText = error instanceof Error ? error.message : "Location error";
|
|
@@ -1457,10 +1468,9 @@ var __exports__ = (() => {
|
|
|
1457
1468
|
this.updateHTML();
|
|
1458
1469
|
}
|
|
1459
1470
|
if (coordinates) {
|
|
1460
|
-
this.
|
|
1471
|
+
this.flyTo(coordinates);
|
|
1461
1472
|
}
|
|
1462
1473
|
};
|
|
1463
|
-
this.viewports = {};
|
|
1464
1474
|
this.setProps(this.props);
|
|
1465
1475
|
}
|
|
1466
1476
|
setProps(props) {
|
|
@@ -1493,22 +1503,20 @@ var __exports__ = (() => {
|
|
|
1493
1503
|
rootElement
|
|
1494
1504
|
);
|
|
1495
1505
|
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
const viewId
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1506
|
+
flyTo(viewState) {
|
|
1507
|
+
const viewIds = this.viewId ? [this.viewId] : this.deck?.getViews().map((v3) => v3.id) ?? [];
|
|
1508
|
+
for (const viewId of viewIds) {
|
|
1509
|
+
const currentViewState = this.getViewState(viewId);
|
|
1510
|
+
const nextViewState = {
|
|
1511
|
+
...currentViewState,
|
|
1512
|
+
...viewState
|
|
1513
|
+
};
|
|
1514
|
+
if (this.props.transitionDuration > 0) {
|
|
1515
|
+
nextViewState.transitionDuration = this.props.transitionDuration;
|
|
1516
|
+
nextViewState.transitionInterpolator = "latitude" in nextViewState ? new import_core8.FlyToInterpolator() : new import_core8.LinearInterpolator();
|
|
1517
|
+
}
|
|
1518
|
+
this.setViewState(viewId, nextViewState);
|
|
1507
1519
|
}
|
|
1508
|
-
this.deck._onViewStateChange({ viewId, viewState: nextViewState, interactionState: {} });
|
|
1509
|
-
}
|
|
1510
|
-
onViewportChange(viewport) {
|
|
1511
|
-
this.viewports[viewport.id] = viewport;
|
|
1512
1520
|
}
|
|
1513
1521
|
};
|
|
1514
1522
|
GeocoderWidget.defaultProps = {
|
|
@@ -1580,7 +1588,7 @@ var __exports__ = (() => {
|
|
|
1580
1588
|
super.setProps(props);
|
|
1581
1589
|
}
|
|
1582
1590
|
getContainer() {
|
|
1583
|
-
return this.props.container || this.deck?.getCanvas()?.parentElement;
|
|
1591
|
+
return this.props.container || this.deck?.props.parent || this.deck?.getCanvas()?.parentElement;
|
|
1584
1592
|
}
|
|
1585
1593
|
onFullscreenChange() {
|
|
1586
1594
|
const prevFullscreen = this.fullscreen;
|
|
@@ -1629,33 +1637,153 @@ var __exports__ = (() => {
|
|
|
1629
1637
|
|
|
1630
1638
|
// src/splitter-widget.tsx
|
|
1631
1639
|
var import_core10 = __toESM(require_core(), 1);
|
|
1640
|
+
function parseViewLayout(root) {
|
|
1641
|
+
const layoutsById = [];
|
|
1642
|
+
const isViewLayout = (v3) => "views" in v3;
|
|
1643
|
+
function createManagedViewLayout(l3) {
|
|
1644
|
+
const id = layoutsById.length;
|
|
1645
|
+
const minSplit = l3.minSplit ?? 0.05;
|
|
1646
|
+
const maxSplit = l3.maxSplit ?? 0.95;
|
|
1647
|
+
const split = Math.min(Math.max(l3.initialSplit ?? 0.5, minSplit), maxSplit);
|
|
1648
|
+
const managed = {
|
|
1649
|
+
id,
|
|
1650
|
+
orientation: l3.orientation,
|
|
1651
|
+
views: l3.views,
|
|
1652
|
+
split,
|
|
1653
|
+
editable: l3.editable ?? true,
|
|
1654
|
+
minSplit,
|
|
1655
|
+
maxSplit,
|
|
1656
|
+
x: 0,
|
|
1657
|
+
y: 0,
|
|
1658
|
+
width: 0,
|
|
1659
|
+
height: 0
|
|
1660
|
+
};
|
|
1661
|
+
layoutsById.push(managed);
|
|
1662
|
+
managed.views = [
|
|
1663
|
+
isViewLayout(l3.views[0]) ? createManagedViewLayout(l3.views[0]) : l3.views[0],
|
|
1664
|
+
isViewLayout(l3.views[1]) ? createManagedViewLayout(l3.views[1]) : l3.views[1]
|
|
1665
|
+
];
|
|
1666
|
+
return managed;
|
|
1667
|
+
}
|
|
1668
|
+
createManagedViewLayout(root);
|
|
1669
|
+
return layoutsById;
|
|
1670
|
+
}
|
|
1671
|
+
function evaluateViews(root) {
|
|
1672
|
+
const views = [];
|
|
1673
|
+
function evaluateViewLayout(l3, x2, y3, width, height) {
|
|
1674
|
+
l3.x = x2;
|
|
1675
|
+
l3.y = y3;
|
|
1676
|
+
l3.width = width;
|
|
1677
|
+
l3.height = height;
|
|
1678
|
+
const child1X = x2;
|
|
1679
|
+
const child1Y = y3;
|
|
1680
|
+
let child1Width = width;
|
|
1681
|
+
let child1Height = height;
|
|
1682
|
+
let child2X = x2;
|
|
1683
|
+
let child2Y = y3;
|
|
1684
|
+
let child2Width = width;
|
|
1685
|
+
let child2Height = height;
|
|
1686
|
+
if (l3.orientation === "horizontal") {
|
|
1687
|
+
child1Width = width * l3.split;
|
|
1688
|
+
child2X = x2 + child1Width;
|
|
1689
|
+
child2Width = width - child1Width;
|
|
1690
|
+
} else {
|
|
1691
|
+
child1Height = height * l3.split;
|
|
1692
|
+
child2Y = y3 + child1Height;
|
|
1693
|
+
child2Height = height - child1Height;
|
|
1694
|
+
}
|
|
1695
|
+
const [view1, view2] = l3.views;
|
|
1696
|
+
if ("views" in view1) {
|
|
1697
|
+
evaluateViewLayout(view1, child1X, child1Y, child1Width, child1Height);
|
|
1698
|
+
} else {
|
|
1699
|
+
views.push(
|
|
1700
|
+
view1.clone({
|
|
1701
|
+
x: `${child1X}%`,
|
|
1702
|
+
y: `${child1Y}%`,
|
|
1703
|
+
width: `${child1Width}%`,
|
|
1704
|
+
height: `${child1Height}%`
|
|
1705
|
+
})
|
|
1706
|
+
);
|
|
1707
|
+
}
|
|
1708
|
+
if ("views" in view2) {
|
|
1709
|
+
evaluateViewLayout(view2, child2X, child2Y, child2Width, child2Height);
|
|
1710
|
+
} else {
|
|
1711
|
+
views.push(
|
|
1712
|
+
view2.clone({
|
|
1713
|
+
x: `${child2X}%`,
|
|
1714
|
+
y: `${child2Y}%`,
|
|
1715
|
+
width: `${child2Width}%`,
|
|
1716
|
+
height: `${child2Height}%`
|
|
1717
|
+
})
|
|
1718
|
+
);
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
evaluateViewLayout(root, 0, 0, 100, 100);
|
|
1722
|
+
return views;
|
|
1723
|
+
}
|
|
1632
1724
|
var SplitterWidget = class extends import_core10.Widget {
|
|
1633
1725
|
constructor(props) {
|
|
1634
1726
|
super(props);
|
|
1635
1727
|
this.className = "deck-widget-splitter";
|
|
1636
1728
|
this.placement = "fill";
|
|
1729
|
+
this.needsUpdate = true;
|
|
1730
|
+
this.viewLayouts = parseViewLayout(this.props.viewLayout);
|
|
1637
1731
|
}
|
|
1638
1732
|
setProps(props) {
|
|
1733
|
+
if (props.viewLayout && !(0, import_core10._deepEqual)(props.viewLayout, this.props.viewLayout, -1)) {
|
|
1734
|
+
this.viewLayouts = parseViewLayout(props.viewLayout);
|
|
1735
|
+
this.views = void 0;
|
|
1736
|
+
}
|
|
1639
1737
|
super.setProps(props);
|
|
1640
1738
|
}
|
|
1739
|
+
onRedraw() {
|
|
1740
|
+
super.updateHTML();
|
|
1741
|
+
}
|
|
1742
|
+
// Usually widgets rerender their DOM elements here
|
|
1743
|
+
// In this case we need the widget UI to synchronize with deck view states
|
|
1744
|
+
// so we update deck props here and rerender DOM in the next onRedraw
|
|
1745
|
+
updateHTML() {
|
|
1746
|
+
if (!this.views) {
|
|
1747
|
+
this.views = evaluateViews(this.viewLayouts[0]);
|
|
1748
|
+
this.props.onChange(this.views.slice());
|
|
1749
|
+
}
|
|
1750
|
+
requestAnimationFrame(() => {
|
|
1751
|
+
this.doUpdate();
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
doUpdate() {
|
|
1755
|
+
if (this.deck) {
|
|
1756
|
+
const deckViews = this.deck.props.views;
|
|
1757
|
+
const isManagedExternally = (
|
|
1758
|
+
// is not empty
|
|
1759
|
+
deckViews && // is not set by us
|
|
1760
|
+
deckViews !== this.lastViews
|
|
1761
|
+
);
|
|
1762
|
+
if (!isManagedExternally && this.lastViews !== this.views) {
|
|
1763
|
+
this.lastViews = this.views;
|
|
1764
|
+
this.deck.setProps({ views: this.views });
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
onChange(newSplit, layout) {
|
|
1769
|
+
layout.split = newSplit;
|
|
1770
|
+
this.views = evaluateViews(this.viewLayouts[0]);
|
|
1771
|
+
this.props.onChange(this.views.slice());
|
|
1772
|
+
this.doUpdate();
|
|
1773
|
+
}
|
|
1641
1774
|
onRenderHTML(rootElement) {
|
|
1642
|
-
rootElement.style.position = "absolute";
|
|
1643
|
-
rootElement.style.top = "0";
|
|
1644
|
-
rootElement.style.left = "0";
|
|
1645
|
-
rootElement.style.width = "100%";
|
|
1646
|
-
rootElement.style.height = "100%";
|
|
1647
|
-
rootElement.style.margin = "0px";
|
|
1648
1775
|
B(
|
|
1649
|
-
/* @__PURE__ */ u2(
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1776
|
+
/* @__PURE__ */ u2(k, { children: this.viewLayouts.map(
|
|
1777
|
+
(layout) => layout.editable && /* @__PURE__ */ u2(
|
|
1778
|
+
Splitter,
|
|
1779
|
+
{
|
|
1780
|
+
...layout,
|
|
1781
|
+
onChange: (newSplit) => this.onChange(newSplit, layout),
|
|
1782
|
+
onDragStart: () => this.props.onDragStart(),
|
|
1783
|
+
onDragEnd: () => this.props.onDragStart()
|
|
1784
|
+
}
|
|
1785
|
+
)
|
|
1786
|
+
) }),
|
|
1659
1787
|
rootElement
|
|
1660
1788
|
);
|
|
1661
1789
|
}
|
|
@@ -1663,10 +1791,7 @@ var __exports__ = (() => {
|
|
|
1663
1791
|
SplitterWidget.defaultProps = {
|
|
1664
1792
|
...import_core10.Widget.defaultProps,
|
|
1665
1793
|
id: "splitter-widget",
|
|
1666
|
-
|
|
1667
|
-
viewId2: "",
|
|
1668
|
-
orientation: "vertical",
|
|
1669
|
-
initialSplit: 0.5,
|
|
1794
|
+
viewLayout: void 0,
|
|
1670
1795
|
onChange: () => {
|
|
1671
1796
|
},
|
|
1672
1797
|
onDragStart: () => {
|
|
@@ -1676,585 +1801,2692 @@ var __exports__ = (() => {
|
|
|
1676
1801
|
};
|
|
1677
1802
|
function Splitter({
|
|
1678
1803
|
orientation,
|
|
1679
|
-
|
|
1804
|
+
x: x2,
|
|
1805
|
+
y: y3,
|
|
1806
|
+
width,
|
|
1807
|
+
height,
|
|
1808
|
+
split,
|
|
1809
|
+
minSplit,
|
|
1810
|
+
maxSplit,
|
|
1680
1811
|
onChange,
|
|
1681
1812
|
onDragStart,
|
|
1682
1813
|
onDragEnd
|
|
1683
1814
|
}) {
|
|
1684
|
-
const [
|
|
1685
|
-
const dragging = A2(false);
|
|
1815
|
+
const [dragging, setDragging] = h2(false);
|
|
1686
1816
|
const containerRef = A2(null);
|
|
1817
|
+
y2(() => {
|
|
1818
|
+
if (!dragging) {
|
|
1819
|
+
return void 0;
|
|
1820
|
+
}
|
|
1821
|
+
const handleDragging = (event) => {
|
|
1822
|
+
if (!containerRef.current)
|
|
1823
|
+
return;
|
|
1824
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
1825
|
+
let newSplit;
|
|
1826
|
+
if (orientation === "horizontal") {
|
|
1827
|
+
newSplit = (event.clientX - rect.left) / rect.width;
|
|
1828
|
+
} else {
|
|
1829
|
+
newSplit = (event.clientY - rect.top) / rect.height;
|
|
1830
|
+
}
|
|
1831
|
+
newSplit = Math.min(Math.max(newSplit, minSplit), maxSplit);
|
|
1832
|
+
onChange?.(newSplit);
|
|
1833
|
+
};
|
|
1834
|
+
const handleDragEnd = () => {
|
|
1835
|
+
onDragEnd?.();
|
|
1836
|
+
setDragging(false);
|
|
1837
|
+
};
|
|
1838
|
+
document.addEventListener("pointermove", handleDragging);
|
|
1839
|
+
document.addEventListener("pointerup", handleDragEnd);
|
|
1840
|
+
document.addEventListener("pointerleave", handleDragEnd);
|
|
1841
|
+
return () => {
|
|
1842
|
+
document.removeEventListener("pointermove", handleDragging);
|
|
1843
|
+
document.removeEventListener("pointerup", handleDragEnd);
|
|
1844
|
+
document.removeEventListener("pointerleave", handleDragEnd);
|
|
1845
|
+
};
|
|
1846
|
+
}, [dragging]);
|
|
1687
1847
|
const handleDragStart = (event) => {
|
|
1688
|
-
|
|
1848
|
+
setDragging(true);
|
|
1689
1849
|
onDragStart?.();
|
|
1690
|
-
document.addEventListener("mousemove", handleDragging);
|
|
1691
|
-
document.addEventListener("mouseup", handleDragEnd);
|
|
1692
1850
|
event.preventDefault();
|
|
1693
1851
|
};
|
|
1694
|
-
const
|
|
1695
|
-
if (!dragging.current || !containerRef.current)
|
|
1696
|
-
return;
|
|
1697
|
-
const rect = containerRef.current.getBoundingClientRect();
|
|
1698
|
-
let newSplit;
|
|
1699
|
-
if (orientation === "vertical") {
|
|
1700
|
-
newSplit = (event.clientX - rect.left) / rect.width;
|
|
1701
|
-
} else {
|
|
1702
|
-
newSplit = (event.clientY - rect.top) / rect.height;
|
|
1703
|
-
}
|
|
1704
|
-
newSplit = Math.min(Math.max(newSplit, 0.05), 0.95);
|
|
1705
|
-
setSplit(newSplit);
|
|
1706
|
-
onChange?.(newSplit);
|
|
1707
|
-
};
|
|
1708
|
-
const handleDragEnd = (event) => {
|
|
1709
|
-
if (!dragging.current)
|
|
1710
|
-
return;
|
|
1711
|
-
dragging.current = false;
|
|
1712
|
-
onDragEnd?.();
|
|
1713
|
-
document.removeEventListener("mousemove", handleDragging);
|
|
1714
|
-
document.removeEventListener("mouseup", handleDragEnd);
|
|
1715
|
-
};
|
|
1716
|
-
const splitterStyle = orientation === "vertical" ? {
|
|
1717
|
-
position: "absolute",
|
|
1718
|
-
top: 0,
|
|
1719
|
-
bottom: 0,
|
|
1720
|
-
left: `${split * 100}%`,
|
|
1721
|
-
width: "4px",
|
|
1722
|
-
cursor: "col-resize",
|
|
1723
|
-
background: "#ccc",
|
|
1724
|
-
zIndex: 10,
|
|
1725
|
-
pointerEvents: "auto",
|
|
1726
|
-
boxShadow: "inset -1px 0 0 white, inset 1px 0 0 white"
|
|
1727
|
-
} : {
|
|
1728
|
-
position: "absolute",
|
|
1729
|
-
left: 0,
|
|
1730
|
-
right: 0,
|
|
1731
|
-
top: `${split * 100}%`,
|
|
1732
|
-
height: "4px",
|
|
1733
|
-
cursor: "row-resize",
|
|
1734
|
-
background: "#ccc",
|
|
1735
|
-
zIndex: 10,
|
|
1736
|
-
pointerEvents: "auto",
|
|
1737
|
-
boxShadow: "inset -1px 0 0 white, inset 1px 0 0 white"
|
|
1738
|
-
};
|
|
1852
|
+
const splitterStyle = orientation === "horizontal" ? { left: `${split * 100}%` } : { top: `${split * 100}%` };
|
|
1739
1853
|
const containerStyle = {
|
|
1740
1854
|
position: "absolute",
|
|
1741
|
-
top:
|
|
1742
|
-
left:
|
|
1743
|
-
|
|
1744
|
-
|
|
1855
|
+
top: `${y3}%`,
|
|
1856
|
+
left: `${x2}%`,
|
|
1857
|
+
width: `${width}%`,
|
|
1858
|
+
height: `${height}%`
|
|
1745
1859
|
};
|
|
1746
1860
|
return /* @__PURE__ */ u2("div", { ref: containerRef, style: containerStyle, children: /* @__PURE__ */ u2(
|
|
1747
1861
|
"div",
|
|
1748
1862
|
{
|
|
1863
|
+
className: `deck-widget-splitter-handle deck-widget-splitter-handle--${orientation} ${dragging ? "active" : ""}`,
|
|
1749
1864
|
style: splitterStyle,
|
|
1750
|
-
|
|
1865
|
+
onPointerDown: handleDragStart
|
|
1866
|
+
}
|
|
1867
|
+
) });
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
// src/info-widget.tsx
|
|
1871
|
+
var import_core12 = __toESM(require_core(), 1);
|
|
1872
|
+
|
|
1873
|
+
// ../../node_modules/@floating-ui/core/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
1874
|
+
var min = Math.min;
|
|
1875
|
+
var max = Math.max;
|
|
1876
|
+
var oppositeSideMap = {
|
|
1877
|
+
left: "right",
|
|
1878
|
+
right: "left",
|
|
1879
|
+
bottom: "top",
|
|
1880
|
+
top: "bottom"
|
|
1881
|
+
};
|
|
1882
|
+
var oppositeAlignmentMap = {
|
|
1883
|
+
start: "end",
|
|
1884
|
+
end: "start"
|
|
1885
|
+
};
|
|
1886
|
+
function clamp(start, value, end) {
|
|
1887
|
+
return max(start, min(value, end));
|
|
1888
|
+
}
|
|
1889
|
+
function evaluate(value, param) {
|
|
1890
|
+
return typeof value === "function" ? value(param) : value;
|
|
1891
|
+
}
|
|
1892
|
+
function getSide(placement) {
|
|
1893
|
+
return placement.split("-")[0];
|
|
1894
|
+
}
|
|
1895
|
+
function getAlignment(placement) {
|
|
1896
|
+
return placement.split("-")[1];
|
|
1897
|
+
}
|
|
1898
|
+
function getOppositeAxis(axis) {
|
|
1899
|
+
return axis === "x" ? "y" : "x";
|
|
1900
|
+
}
|
|
1901
|
+
function getAxisLength(axis) {
|
|
1902
|
+
return axis === "y" ? "height" : "width";
|
|
1903
|
+
}
|
|
1904
|
+
function getSideAxis(placement) {
|
|
1905
|
+
return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
|
|
1906
|
+
}
|
|
1907
|
+
function getAlignmentAxis(placement) {
|
|
1908
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
1909
|
+
}
|
|
1910
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
1911
|
+
if (rtl === void 0) {
|
|
1912
|
+
rtl = false;
|
|
1913
|
+
}
|
|
1914
|
+
const alignment = getAlignment(placement);
|
|
1915
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
1916
|
+
const length = getAxisLength(alignmentAxis);
|
|
1917
|
+
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
1918
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
1919
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
1920
|
+
}
|
|
1921
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
1922
|
+
}
|
|
1923
|
+
function getExpandedPlacements(placement) {
|
|
1924
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
1925
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
1926
|
+
}
|
|
1927
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
1928
|
+
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
1929
|
+
}
|
|
1930
|
+
function getSideList(side, isStart, rtl) {
|
|
1931
|
+
const lr = ["left", "right"];
|
|
1932
|
+
const rl = ["right", "left"];
|
|
1933
|
+
const tb = ["top", "bottom"];
|
|
1934
|
+
const bt = ["bottom", "top"];
|
|
1935
|
+
switch (side) {
|
|
1936
|
+
case "top":
|
|
1937
|
+
case "bottom":
|
|
1938
|
+
if (rtl)
|
|
1939
|
+
return isStart ? rl : lr;
|
|
1940
|
+
return isStart ? lr : rl;
|
|
1941
|
+
case "left":
|
|
1942
|
+
case "right":
|
|
1943
|
+
return isStart ? tb : bt;
|
|
1944
|
+
default:
|
|
1945
|
+
return [];
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
1949
|
+
const alignment = getAlignment(placement);
|
|
1950
|
+
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
1951
|
+
if (alignment) {
|
|
1952
|
+
list = list.map((side) => side + "-" + alignment);
|
|
1953
|
+
if (flipAlignment) {
|
|
1954
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
return list;
|
|
1958
|
+
}
|
|
1959
|
+
function getOppositePlacement(placement) {
|
|
1960
|
+
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
|
1961
|
+
}
|
|
1962
|
+
function expandPaddingObject(padding) {
|
|
1963
|
+
return {
|
|
1964
|
+
top: 0,
|
|
1965
|
+
right: 0,
|
|
1966
|
+
bottom: 0,
|
|
1967
|
+
left: 0,
|
|
1968
|
+
...padding
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
function getPaddingObject(padding) {
|
|
1972
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
1973
|
+
top: padding,
|
|
1974
|
+
right: padding,
|
|
1975
|
+
bottom: padding,
|
|
1976
|
+
left: padding
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
function rectToClientRect(rect) {
|
|
1980
|
+
const {
|
|
1981
|
+
x: x2,
|
|
1982
|
+
y: y3,
|
|
1983
|
+
width,
|
|
1984
|
+
height
|
|
1985
|
+
} = rect;
|
|
1986
|
+
return {
|
|
1987
|
+
width,
|
|
1988
|
+
height,
|
|
1989
|
+
top: y3,
|
|
1990
|
+
left: x2,
|
|
1991
|
+
right: x2 + width,
|
|
1992
|
+
bottom: y3 + height,
|
|
1993
|
+
x: x2,
|
|
1994
|
+
y: y3
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
// ../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
1999
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
2000
|
+
let {
|
|
2001
|
+
reference,
|
|
2002
|
+
floating
|
|
2003
|
+
} = _ref;
|
|
2004
|
+
const sideAxis = getSideAxis(placement);
|
|
2005
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
2006
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
2007
|
+
const side = getSide(placement);
|
|
2008
|
+
const isVertical = sideAxis === "y";
|
|
2009
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
2010
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
2011
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
2012
|
+
let coords;
|
|
2013
|
+
switch (side) {
|
|
2014
|
+
case "top":
|
|
2015
|
+
coords = {
|
|
2016
|
+
x: commonX,
|
|
2017
|
+
y: reference.y - floating.height
|
|
2018
|
+
};
|
|
2019
|
+
break;
|
|
2020
|
+
case "bottom":
|
|
2021
|
+
coords = {
|
|
2022
|
+
x: commonX,
|
|
2023
|
+
y: reference.y + reference.height
|
|
2024
|
+
};
|
|
2025
|
+
break;
|
|
2026
|
+
case "right":
|
|
2027
|
+
coords = {
|
|
2028
|
+
x: reference.x + reference.width,
|
|
2029
|
+
y: commonY
|
|
2030
|
+
};
|
|
2031
|
+
break;
|
|
2032
|
+
case "left":
|
|
2033
|
+
coords = {
|
|
2034
|
+
x: reference.x - floating.width,
|
|
2035
|
+
y: commonY
|
|
2036
|
+
};
|
|
2037
|
+
break;
|
|
2038
|
+
default:
|
|
2039
|
+
coords = {
|
|
2040
|
+
x: reference.x,
|
|
2041
|
+
y: reference.y
|
|
2042
|
+
};
|
|
2043
|
+
}
|
|
2044
|
+
switch (getAlignment(placement)) {
|
|
2045
|
+
case "start":
|
|
2046
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
2047
|
+
break;
|
|
2048
|
+
case "end":
|
|
2049
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
2050
|
+
break;
|
|
2051
|
+
}
|
|
2052
|
+
return coords;
|
|
2053
|
+
}
|
|
2054
|
+
var computePosition = async (reference, floating, config) => {
|
|
2055
|
+
const {
|
|
2056
|
+
placement = "bottom",
|
|
2057
|
+
strategy = "absolute",
|
|
2058
|
+
middleware = [],
|
|
2059
|
+
platform: platform2
|
|
2060
|
+
} = config;
|
|
2061
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
2062
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
2063
|
+
let rects = await platform2.getElementRects({
|
|
2064
|
+
reference,
|
|
2065
|
+
floating,
|
|
2066
|
+
strategy
|
|
2067
|
+
});
|
|
2068
|
+
let {
|
|
2069
|
+
x: x2,
|
|
2070
|
+
y: y3
|
|
2071
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
2072
|
+
let statefulPlacement = placement;
|
|
2073
|
+
let middlewareData = {};
|
|
2074
|
+
let resetCount = 0;
|
|
2075
|
+
for (let i4 = 0; i4 < validMiddleware.length; i4++) {
|
|
2076
|
+
const {
|
|
2077
|
+
name,
|
|
2078
|
+
fn
|
|
2079
|
+
} = validMiddleware[i4];
|
|
2080
|
+
const {
|
|
2081
|
+
x: nextX,
|
|
2082
|
+
y: nextY,
|
|
2083
|
+
data,
|
|
2084
|
+
reset
|
|
2085
|
+
} = await fn({
|
|
2086
|
+
x: x2,
|
|
2087
|
+
y: y3,
|
|
2088
|
+
initialPlacement: placement,
|
|
2089
|
+
placement: statefulPlacement,
|
|
2090
|
+
strategy,
|
|
2091
|
+
middlewareData,
|
|
2092
|
+
rects,
|
|
2093
|
+
platform: platform2,
|
|
2094
|
+
elements: {
|
|
2095
|
+
reference,
|
|
2096
|
+
floating
|
|
2097
|
+
}
|
|
2098
|
+
});
|
|
2099
|
+
x2 = nextX != null ? nextX : x2;
|
|
2100
|
+
y3 = nextY != null ? nextY : y3;
|
|
2101
|
+
middlewareData = {
|
|
2102
|
+
...middlewareData,
|
|
2103
|
+
[name]: {
|
|
2104
|
+
...middlewareData[name],
|
|
2105
|
+
...data
|
|
2106
|
+
}
|
|
2107
|
+
};
|
|
2108
|
+
if (reset && resetCount <= 50) {
|
|
2109
|
+
resetCount++;
|
|
2110
|
+
if (typeof reset === "object") {
|
|
2111
|
+
if (reset.placement) {
|
|
2112
|
+
statefulPlacement = reset.placement;
|
|
2113
|
+
}
|
|
2114
|
+
if (reset.rects) {
|
|
2115
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
2116
|
+
reference,
|
|
2117
|
+
floating,
|
|
2118
|
+
strategy
|
|
2119
|
+
}) : reset.rects;
|
|
2120
|
+
}
|
|
2121
|
+
({
|
|
2122
|
+
x: x2,
|
|
2123
|
+
y: y3
|
|
2124
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
2125
|
+
}
|
|
2126
|
+
i4 = -1;
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
return {
|
|
2130
|
+
x: x2,
|
|
2131
|
+
y: y3,
|
|
2132
|
+
placement: statefulPlacement,
|
|
2133
|
+
strategy,
|
|
2134
|
+
middlewareData
|
|
2135
|
+
};
|
|
2136
|
+
};
|
|
2137
|
+
async function detectOverflow(state, options) {
|
|
2138
|
+
var _await$platform$isEle;
|
|
2139
|
+
if (options === void 0) {
|
|
2140
|
+
options = {};
|
|
2141
|
+
}
|
|
2142
|
+
const {
|
|
2143
|
+
x: x2,
|
|
2144
|
+
y: y3,
|
|
2145
|
+
platform: platform2,
|
|
2146
|
+
rects,
|
|
2147
|
+
elements,
|
|
2148
|
+
strategy
|
|
2149
|
+
} = state;
|
|
2150
|
+
const {
|
|
2151
|
+
boundary = "clippingAncestors",
|
|
2152
|
+
rootBoundary = "viewport",
|
|
2153
|
+
elementContext = "floating",
|
|
2154
|
+
altBoundary = false,
|
|
2155
|
+
padding = 0
|
|
2156
|
+
} = evaluate(options, state);
|
|
2157
|
+
const paddingObject = getPaddingObject(padding);
|
|
2158
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
2159
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
2160
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
2161
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
2162
|
+
boundary,
|
|
2163
|
+
rootBoundary,
|
|
2164
|
+
strategy
|
|
2165
|
+
}));
|
|
2166
|
+
const rect = elementContext === "floating" ? {
|
|
2167
|
+
x: x2,
|
|
2168
|
+
y: y3,
|
|
2169
|
+
width: rects.floating.width,
|
|
2170
|
+
height: rects.floating.height
|
|
2171
|
+
} : rects.reference;
|
|
2172
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
2173
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
2174
|
+
x: 1,
|
|
2175
|
+
y: 1
|
|
2176
|
+
} : {
|
|
2177
|
+
x: 1,
|
|
2178
|
+
y: 1
|
|
2179
|
+
};
|
|
2180
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2181
|
+
elements,
|
|
2182
|
+
rect,
|
|
2183
|
+
offsetParent,
|
|
2184
|
+
strategy
|
|
2185
|
+
}) : rect);
|
|
2186
|
+
return {
|
|
2187
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
2188
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
2189
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
2190
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
2191
|
+
};
|
|
2192
|
+
}
|
|
2193
|
+
var arrow = (options) => ({
|
|
2194
|
+
name: "arrow",
|
|
2195
|
+
options,
|
|
2196
|
+
async fn(state) {
|
|
2197
|
+
const {
|
|
2198
|
+
x: x2,
|
|
2199
|
+
y: y3,
|
|
2200
|
+
placement,
|
|
2201
|
+
rects,
|
|
2202
|
+
platform: platform2,
|
|
2203
|
+
elements,
|
|
2204
|
+
middlewareData
|
|
2205
|
+
} = state;
|
|
2206
|
+
const {
|
|
2207
|
+
element,
|
|
2208
|
+
padding = 0
|
|
2209
|
+
} = evaluate(options, state) || {};
|
|
2210
|
+
if (element == null) {
|
|
2211
|
+
return {};
|
|
2212
|
+
}
|
|
2213
|
+
const paddingObject = getPaddingObject(padding);
|
|
2214
|
+
const coords = {
|
|
2215
|
+
x: x2,
|
|
2216
|
+
y: y3
|
|
2217
|
+
};
|
|
2218
|
+
const axis = getAlignmentAxis(placement);
|
|
2219
|
+
const length = getAxisLength(axis);
|
|
2220
|
+
const arrowDimensions = await platform2.getDimensions(element);
|
|
2221
|
+
const isYAxis = axis === "y";
|
|
2222
|
+
const minProp = isYAxis ? "top" : "left";
|
|
2223
|
+
const maxProp = isYAxis ? "bottom" : "right";
|
|
2224
|
+
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
2225
|
+
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
2226
|
+
const startDiff = coords[axis] - rects.reference[axis];
|
|
2227
|
+
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
2228
|
+
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
2229
|
+
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
|
|
2230
|
+
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
2231
|
+
}
|
|
2232
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
2233
|
+
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
2234
|
+
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
2235
|
+
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
2236
|
+
const min$1 = minPadding;
|
|
2237
|
+
const max3 = clientSize - arrowDimensions[length] - maxPadding;
|
|
2238
|
+
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
2239
|
+
const offset3 = clamp(min$1, center, max3);
|
|
2240
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset3 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
2241
|
+
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max3 : 0;
|
|
2242
|
+
return {
|
|
2243
|
+
[axis]: coords[axis] + alignmentOffset,
|
|
2244
|
+
data: {
|
|
2245
|
+
[axis]: offset3,
|
|
2246
|
+
centerOffset: center - offset3 - alignmentOffset,
|
|
2247
|
+
...shouldAddOffset && {
|
|
2248
|
+
alignmentOffset
|
|
2249
|
+
}
|
|
2250
|
+
},
|
|
2251
|
+
reset: shouldAddOffset
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
});
|
|
2255
|
+
var flip = function(options) {
|
|
2256
|
+
if (options === void 0) {
|
|
2257
|
+
options = {};
|
|
2258
|
+
}
|
|
2259
|
+
return {
|
|
2260
|
+
name: "flip",
|
|
2261
|
+
options,
|
|
2262
|
+
async fn(state) {
|
|
2263
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
2264
|
+
const {
|
|
2265
|
+
placement,
|
|
2266
|
+
middlewareData,
|
|
2267
|
+
rects,
|
|
2268
|
+
initialPlacement,
|
|
2269
|
+
platform: platform2,
|
|
2270
|
+
elements
|
|
2271
|
+
} = state;
|
|
2272
|
+
const {
|
|
2273
|
+
mainAxis: checkMainAxis = true,
|
|
2274
|
+
crossAxis: checkCrossAxis = true,
|
|
2275
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
2276
|
+
fallbackStrategy = "bestFit",
|
|
2277
|
+
fallbackAxisSideDirection = "none",
|
|
2278
|
+
flipAlignment = true,
|
|
2279
|
+
...detectOverflowOptions
|
|
2280
|
+
} = evaluate(options, state);
|
|
2281
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
2282
|
+
return {};
|
|
2283
|
+
}
|
|
2284
|
+
const side = getSide(placement);
|
|
2285
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
2286
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
2287
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
2288
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
2289
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
2290
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
2291
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
2292
|
+
}
|
|
2293
|
+
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
2294
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2295
|
+
const overflows = [];
|
|
2296
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
2297
|
+
if (checkMainAxis) {
|
|
2298
|
+
overflows.push(overflow[side]);
|
|
2299
|
+
}
|
|
2300
|
+
if (checkCrossAxis) {
|
|
2301
|
+
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
2302
|
+
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
2303
|
+
}
|
|
2304
|
+
overflowsData = [...overflowsData, {
|
|
2305
|
+
placement,
|
|
2306
|
+
overflows
|
|
2307
|
+
}];
|
|
2308
|
+
if (!overflows.every((side2) => side2 <= 0)) {
|
|
2309
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
2310
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
2311
|
+
const nextPlacement = placements2[nextIndex];
|
|
2312
|
+
if (nextPlacement) {
|
|
2313
|
+
return {
|
|
2314
|
+
data: {
|
|
2315
|
+
index: nextIndex,
|
|
2316
|
+
overflows: overflowsData
|
|
2317
|
+
},
|
|
2318
|
+
reset: {
|
|
2319
|
+
placement: nextPlacement
|
|
2320
|
+
}
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d3) => d3.overflows[0] <= 0).sort((a3, b2) => a3.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
2324
|
+
if (!resetPlacement) {
|
|
2325
|
+
switch (fallbackStrategy) {
|
|
2326
|
+
case "bestFit": {
|
|
2327
|
+
var _overflowsData$filter2;
|
|
2328
|
+
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d3) => {
|
|
2329
|
+
if (hasFallbackAxisSideDirection) {
|
|
2330
|
+
const currentSideAxis = getSideAxis(d3.placement);
|
|
2331
|
+
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
2332
|
+
// reading directions favoring greater width.
|
|
2333
|
+
currentSideAxis === "y";
|
|
2334
|
+
}
|
|
2335
|
+
return true;
|
|
2336
|
+
}).map((d3) => [d3.placement, d3.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a3, b2) => a3[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
2337
|
+
if (placement2) {
|
|
2338
|
+
resetPlacement = placement2;
|
|
2339
|
+
}
|
|
2340
|
+
break;
|
|
2341
|
+
}
|
|
2342
|
+
case "initialPlacement":
|
|
2343
|
+
resetPlacement = initialPlacement;
|
|
2344
|
+
break;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
if (placement !== resetPlacement) {
|
|
2348
|
+
return {
|
|
2349
|
+
reset: {
|
|
2350
|
+
placement: resetPlacement
|
|
2351
|
+
}
|
|
2352
|
+
};
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
return {};
|
|
2356
|
+
}
|
|
2357
|
+
};
|
|
2358
|
+
};
|
|
2359
|
+
async function convertValueToCoords(state, options) {
|
|
2360
|
+
const {
|
|
2361
|
+
placement,
|
|
2362
|
+
platform: platform2,
|
|
2363
|
+
elements
|
|
2364
|
+
} = state;
|
|
2365
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
2366
|
+
const side = getSide(placement);
|
|
2367
|
+
const alignment = getAlignment(placement);
|
|
2368
|
+
const isVertical = getSideAxis(placement) === "y";
|
|
2369
|
+
const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
|
|
2370
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
2371
|
+
const rawValue = evaluate(options, state);
|
|
2372
|
+
let {
|
|
2373
|
+
mainAxis,
|
|
2374
|
+
crossAxis,
|
|
2375
|
+
alignmentAxis
|
|
2376
|
+
} = typeof rawValue === "number" ? {
|
|
2377
|
+
mainAxis: rawValue,
|
|
2378
|
+
crossAxis: 0,
|
|
2379
|
+
alignmentAxis: null
|
|
2380
|
+
} : {
|
|
2381
|
+
mainAxis: 0,
|
|
2382
|
+
crossAxis: 0,
|
|
2383
|
+
alignmentAxis: null,
|
|
2384
|
+
...rawValue
|
|
2385
|
+
};
|
|
2386
|
+
if (alignment && typeof alignmentAxis === "number") {
|
|
2387
|
+
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
2388
|
+
}
|
|
2389
|
+
return isVertical ? {
|
|
2390
|
+
x: crossAxis * crossAxisMulti,
|
|
2391
|
+
y: mainAxis * mainAxisMulti
|
|
2392
|
+
} : {
|
|
2393
|
+
x: mainAxis * mainAxisMulti,
|
|
2394
|
+
y: crossAxis * crossAxisMulti
|
|
2395
|
+
};
|
|
2396
|
+
}
|
|
2397
|
+
var offset = function(options) {
|
|
2398
|
+
if (options === void 0) {
|
|
2399
|
+
options = 0;
|
|
2400
|
+
}
|
|
2401
|
+
return {
|
|
2402
|
+
name: "offset",
|
|
2403
|
+
options,
|
|
2404
|
+
async fn(state) {
|
|
2405
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
2406
|
+
const {
|
|
2407
|
+
x: x2,
|
|
2408
|
+
y: y3,
|
|
2409
|
+
placement,
|
|
2410
|
+
middlewareData
|
|
2411
|
+
} = state;
|
|
2412
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
2413
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
2414
|
+
return {};
|
|
2415
|
+
}
|
|
2416
|
+
return {
|
|
2417
|
+
x: x2 + diffCoords.x,
|
|
2418
|
+
y: y3 + diffCoords.y,
|
|
2419
|
+
data: {
|
|
2420
|
+
...diffCoords,
|
|
2421
|
+
placement
|
|
2422
|
+
}
|
|
2423
|
+
};
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
};
|
|
2427
|
+
var shift = function(options) {
|
|
2428
|
+
if (options === void 0) {
|
|
2429
|
+
options = {};
|
|
2430
|
+
}
|
|
2431
|
+
return {
|
|
2432
|
+
name: "shift",
|
|
2433
|
+
options,
|
|
2434
|
+
async fn(state) {
|
|
2435
|
+
const {
|
|
2436
|
+
x: x2,
|
|
2437
|
+
y: y3,
|
|
2438
|
+
placement
|
|
2439
|
+
} = state;
|
|
2440
|
+
const {
|
|
2441
|
+
mainAxis: checkMainAxis = true,
|
|
2442
|
+
crossAxis: checkCrossAxis = false,
|
|
2443
|
+
limiter = {
|
|
2444
|
+
fn: (_ref) => {
|
|
2445
|
+
let {
|
|
2446
|
+
x: x3,
|
|
2447
|
+
y: y4
|
|
2448
|
+
} = _ref;
|
|
2449
|
+
return {
|
|
2450
|
+
x: x3,
|
|
2451
|
+
y: y4
|
|
2452
|
+
};
|
|
2453
|
+
}
|
|
2454
|
+
},
|
|
2455
|
+
...detectOverflowOptions
|
|
2456
|
+
} = evaluate(options, state);
|
|
2457
|
+
const coords = {
|
|
2458
|
+
x: x2,
|
|
2459
|
+
y: y3
|
|
2460
|
+
};
|
|
2461
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
2462
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
2463
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
2464
|
+
let mainAxisCoord = coords[mainAxis];
|
|
2465
|
+
let crossAxisCoord = coords[crossAxis];
|
|
2466
|
+
if (checkMainAxis) {
|
|
2467
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
|
2468
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
2469
|
+
const min3 = mainAxisCoord + overflow[minSide];
|
|
2470
|
+
const max3 = mainAxisCoord - overflow[maxSide];
|
|
2471
|
+
mainAxisCoord = clamp(min3, mainAxisCoord, max3);
|
|
2472
|
+
}
|
|
2473
|
+
if (checkCrossAxis) {
|
|
2474
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
|
2475
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
2476
|
+
const min3 = crossAxisCoord + overflow[minSide];
|
|
2477
|
+
const max3 = crossAxisCoord - overflow[maxSide];
|
|
2478
|
+
crossAxisCoord = clamp(min3, crossAxisCoord, max3);
|
|
2479
|
+
}
|
|
2480
|
+
const limitedCoords = limiter.fn({
|
|
2481
|
+
...state,
|
|
2482
|
+
[mainAxis]: mainAxisCoord,
|
|
2483
|
+
[crossAxis]: crossAxisCoord
|
|
2484
|
+
});
|
|
2485
|
+
return {
|
|
2486
|
+
...limitedCoords,
|
|
2487
|
+
data: {
|
|
2488
|
+
x: limitedCoords.x - x2,
|
|
2489
|
+
y: limitedCoords.y - y3
|
|
2490
|
+
}
|
|
2491
|
+
};
|
|
2492
|
+
}
|
|
2493
|
+
};
|
|
2494
|
+
};
|
|
2495
|
+
|
|
2496
|
+
// ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
2497
|
+
var min2 = Math.min;
|
|
2498
|
+
var max2 = Math.max;
|
|
2499
|
+
var round = Math.round;
|
|
2500
|
+
var floor = Math.floor;
|
|
2501
|
+
var createCoords = (v3) => ({
|
|
2502
|
+
x: v3,
|
|
2503
|
+
y: v3
|
|
2504
|
+
});
|
|
2505
|
+
|
|
2506
|
+
// ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
2507
|
+
function hasWindow() {
|
|
2508
|
+
return typeof window !== "undefined";
|
|
2509
|
+
}
|
|
2510
|
+
function getNodeName(node) {
|
|
2511
|
+
if (isNode(node)) {
|
|
2512
|
+
return (node.nodeName || "").toLowerCase();
|
|
2513
|
+
}
|
|
2514
|
+
return "#document";
|
|
2515
|
+
}
|
|
2516
|
+
function getWindow(node) {
|
|
2517
|
+
var _node$ownerDocument;
|
|
2518
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
2519
|
+
}
|
|
2520
|
+
function getDocumentElement(node) {
|
|
2521
|
+
var _ref;
|
|
2522
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
2523
|
+
}
|
|
2524
|
+
function isNode(value) {
|
|
2525
|
+
if (!hasWindow()) {
|
|
2526
|
+
return false;
|
|
2527
|
+
}
|
|
2528
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
2529
|
+
}
|
|
2530
|
+
function isElement(value) {
|
|
2531
|
+
if (!hasWindow()) {
|
|
2532
|
+
return false;
|
|
2533
|
+
}
|
|
2534
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
2535
|
+
}
|
|
2536
|
+
function isHTMLElement(value) {
|
|
2537
|
+
if (!hasWindow()) {
|
|
2538
|
+
return false;
|
|
2539
|
+
}
|
|
2540
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
2541
|
+
}
|
|
2542
|
+
function isShadowRoot(value) {
|
|
2543
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
2544
|
+
return false;
|
|
2545
|
+
}
|
|
2546
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
2547
|
+
}
|
|
2548
|
+
function isOverflowElement(element) {
|
|
2549
|
+
const {
|
|
2550
|
+
overflow,
|
|
2551
|
+
overflowX,
|
|
2552
|
+
overflowY,
|
|
2553
|
+
display
|
|
2554
|
+
} = getComputedStyle(element);
|
|
2555
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
2556
|
+
}
|
|
2557
|
+
function isTableElement(element) {
|
|
2558
|
+
return ["table", "td", "th"].includes(getNodeName(element));
|
|
2559
|
+
}
|
|
2560
|
+
function isTopLayer(element) {
|
|
2561
|
+
return [":popover-open", ":modal"].some((selector) => {
|
|
2562
|
+
try {
|
|
2563
|
+
return element.matches(selector);
|
|
2564
|
+
} catch (e3) {
|
|
2565
|
+
return false;
|
|
2566
|
+
}
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2569
|
+
function isContainingBlock(elementOrCss) {
|
|
2570
|
+
const webkit = isWebKit();
|
|
2571
|
+
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
2572
|
+
return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
|
|
2573
|
+
}
|
|
2574
|
+
function getContainingBlock(element) {
|
|
2575
|
+
let currentNode = getParentNode(element);
|
|
2576
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2577
|
+
if (isContainingBlock(currentNode)) {
|
|
2578
|
+
return currentNode;
|
|
2579
|
+
} else if (isTopLayer(currentNode)) {
|
|
2580
|
+
return null;
|
|
2581
|
+
}
|
|
2582
|
+
currentNode = getParentNode(currentNode);
|
|
2583
|
+
}
|
|
2584
|
+
return null;
|
|
2585
|
+
}
|
|
2586
|
+
function isWebKit() {
|
|
2587
|
+
if (typeof CSS === "undefined" || !CSS.supports)
|
|
2588
|
+
return false;
|
|
2589
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
2590
|
+
}
|
|
2591
|
+
function isLastTraversableNode(node) {
|
|
2592
|
+
return ["html", "body", "#document"].includes(getNodeName(node));
|
|
2593
|
+
}
|
|
2594
|
+
function getComputedStyle(element) {
|
|
2595
|
+
return getWindow(element).getComputedStyle(element);
|
|
2596
|
+
}
|
|
2597
|
+
function getNodeScroll(element) {
|
|
2598
|
+
if (isElement(element)) {
|
|
2599
|
+
return {
|
|
2600
|
+
scrollLeft: element.scrollLeft,
|
|
2601
|
+
scrollTop: element.scrollTop
|
|
2602
|
+
};
|
|
2603
|
+
}
|
|
2604
|
+
return {
|
|
2605
|
+
scrollLeft: element.scrollX,
|
|
2606
|
+
scrollTop: element.scrollY
|
|
2607
|
+
};
|
|
2608
|
+
}
|
|
2609
|
+
function getParentNode(node) {
|
|
2610
|
+
if (getNodeName(node) === "html") {
|
|
2611
|
+
return node;
|
|
2612
|
+
}
|
|
2613
|
+
const result = (
|
|
2614
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
2615
|
+
node.assignedSlot || // DOM Element detected.
|
|
2616
|
+
node.parentNode || // ShadowRoot detected.
|
|
2617
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
2618
|
+
getDocumentElement(node)
|
|
2619
|
+
);
|
|
2620
|
+
return isShadowRoot(result) ? result.host : result;
|
|
2621
|
+
}
|
|
2622
|
+
function getNearestOverflowAncestor(node) {
|
|
2623
|
+
const parentNode = getParentNode(node);
|
|
2624
|
+
if (isLastTraversableNode(parentNode)) {
|
|
2625
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
2626
|
+
}
|
|
2627
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
2628
|
+
return parentNode;
|
|
2629
|
+
}
|
|
2630
|
+
return getNearestOverflowAncestor(parentNode);
|
|
2631
|
+
}
|
|
2632
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
2633
|
+
var _node$ownerDocument2;
|
|
2634
|
+
if (list === void 0) {
|
|
2635
|
+
list = [];
|
|
2636
|
+
}
|
|
2637
|
+
if (traverseIframes === void 0) {
|
|
2638
|
+
traverseIframes = true;
|
|
2639
|
+
}
|
|
2640
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
2641
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
2642
|
+
const win = getWindow(scrollableAncestor);
|
|
2643
|
+
if (isBody) {
|
|
2644
|
+
const frameElement = getFrameElement(win);
|
|
2645
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
2646
|
+
}
|
|
2647
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
2648
|
+
}
|
|
2649
|
+
function getFrameElement(win) {
|
|
2650
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
// ../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
2654
|
+
function getCssDimensions(element) {
|
|
2655
|
+
const css = getComputedStyle(element);
|
|
2656
|
+
let width = parseFloat(css.width) || 0;
|
|
2657
|
+
let height = parseFloat(css.height) || 0;
|
|
2658
|
+
const hasOffset = isHTMLElement(element);
|
|
2659
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
2660
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
2661
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
2662
|
+
if (shouldFallback) {
|
|
2663
|
+
width = offsetWidth;
|
|
2664
|
+
height = offsetHeight;
|
|
2665
|
+
}
|
|
2666
|
+
return {
|
|
2667
|
+
width,
|
|
2668
|
+
height,
|
|
2669
|
+
$: shouldFallback
|
|
2670
|
+
};
|
|
2671
|
+
}
|
|
2672
|
+
function unwrapElement(element) {
|
|
2673
|
+
return !isElement(element) ? element.contextElement : element;
|
|
2674
|
+
}
|
|
2675
|
+
function getScale(element) {
|
|
2676
|
+
const domElement = unwrapElement(element);
|
|
2677
|
+
if (!isHTMLElement(domElement)) {
|
|
2678
|
+
return createCoords(1);
|
|
2679
|
+
}
|
|
2680
|
+
const rect = domElement.getBoundingClientRect();
|
|
2681
|
+
const {
|
|
2682
|
+
width,
|
|
2683
|
+
height,
|
|
2684
|
+
$: $2
|
|
2685
|
+
} = getCssDimensions(domElement);
|
|
2686
|
+
let x2 = ($2 ? round(rect.width) : rect.width) / width;
|
|
2687
|
+
let y3 = ($2 ? round(rect.height) : rect.height) / height;
|
|
2688
|
+
if (!x2 || !Number.isFinite(x2)) {
|
|
2689
|
+
x2 = 1;
|
|
2690
|
+
}
|
|
2691
|
+
if (!y3 || !Number.isFinite(y3)) {
|
|
2692
|
+
y3 = 1;
|
|
2693
|
+
}
|
|
2694
|
+
return {
|
|
2695
|
+
x: x2,
|
|
2696
|
+
y: y3
|
|
2697
|
+
};
|
|
2698
|
+
}
|
|
2699
|
+
var noOffsets = /* @__PURE__ */ createCoords(0);
|
|
2700
|
+
function getVisualOffsets(element) {
|
|
2701
|
+
const win = getWindow(element);
|
|
2702
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
2703
|
+
return noOffsets;
|
|
2704
|
+
}
|
|
2705
|
+
return {
|
|
2706
|
+
x: win.visualViewport.offsetLeft,
|
|
2707
|
+
y: win.visualViewport.offsetTop
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
2711
|
+
if (isFixed === void 0) {
|
|
2712
|
+
isFixed = false;
|
|
2713
|
+
}
|
|
2714
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
2715
|
+
return false;
|
|
2716
|
+
}
|
|
2717
|
+
return isFixed;
|
|
2718
|
+
}
|
|
2719
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
2720
|
+
if (includeScale === void 0) {
|
|
2721
|
+
includeScale = false;
|
|
2722
|
+
}
|
|
2723
|
+
if (isFixedStrategy === void 0) {
|
|
2724
|
+
isFixedStrategy = false;
|
|
2725
|
+
}
|
|
2726
|
+
const clientRect = element.getBoundingClientRect();
|
|
2727
|
+
const domElement = unwrapElement(element);
|
|
2728
|
+
let scale = createCoords(1);
|
|
2729
|
+
if (includeScale) {
|
|
2730
|
+
if (offsetParent) {
|
|
2731
|
+
if (isElement(offsetParent)) {
|
|
2732
|
+
scale = getScale(offsetParent);
|
|
2733
|
+
}
|
|
2734
|
+
} else {
|
|
2735
|
+
scale = getScale(element);
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
2739
|
+
let x2 = (clientRect.left + visualOffsets.x) / scale.x;
|
|
2740
|
+
let y3 = (clientRect.top + visualOffsets.y) / scale.y;
|
|
2741
|
+
let width = clientRect.width / scale.x;
|
|
2742
|
+
let height = clientRect.height / scale.y;
|
|
2743
|
+
if (domElement) {
|
|
2744
|
+
const win = getWindow(domElement);
|
|
2745
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
2746
|
+
let currentWin = win;
|
|
2747
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
2748
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2749
|
+
const iframeScale = getScale(currentIFrame);
|
|
2750
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2751
|
+
const css = getComputedStyle(currentIFrame);
|
|
2752
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
2753
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
2754
|
+
x2 *= iframeScale.x;
|
|
2755
|
+
y3 *= iframeScale.y;
|
|
2756
|
+
width *= iframeScale.x;
|
|
2757
|
+
height *= iframeScale.y;
|
|
2758
|
+
x2 += left;
|
|
2759
|
+
y3 += top;
|
|
2760
|
+
currentWin = getWindow(currentIFrame);
|
|
2761
|
+
currentIFrame = getFrameElement(currentWin);
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
return rectToClientRect({
|
|
2765
|
+
width,
|
|
2766
|
+
height,
|
|
2767
|
+
x: x2,
|
|
2768
|
+
y: y3
|
|
2769
|
+
});
|
|
2770
|
+
}
|
|
2771
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
2772
|
+
let {
|
|
2773
|
+
elements,
|
|
2774
|
+
rect,
|
|
2775
|
+
offsetParent,
|
|
2776
|
+
strategy
|
|
2777
|
+
} = _ref;
|
|
2778
|
+
const isFixed = strategy === "fixed";
|
|
2779
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2780
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
2781
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
2782
|
+
return rect;
|
|
2783
|
+
}
|
|
2784
|
+
let scroll = {
|
|
2785
|
+
scrollLeft: 0,
|
|
2786
|
+
scrollTop: 0
|
|
2787
|
+
};
|
|
2788
|
+
let scale = createCoords(1);
|
|
2789
|
+
const offsets = createCoords(0);
|
|
2790
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2791
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2792
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
2793
|
+
scroll = getNodeScroll(offsetParent);
|
|
2794
|
+
}
|
|
2795
|
+
if (isHTMLElement(offsetParent)) {
|
|
2796
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
2797
|
+
scale = getScale(offsetParent);
|
|
2798
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2799
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
return {
|
|
2803
|
+
width: rect.width * scale.x,
|
|
2804
|
+
height: rect.height * scale.y,
|
|
2805
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
2806
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
function getClientRects(element) {
|
|
2810
|
+
return Array.from(element.getClientRects());
|
|
2811
|
+
}
|
|
2812
|
+
function getWindowScrollBarX(element, rect) {
|
|
2813
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
2814
|
+
if (!rect) {
|
|
2815
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
2816
|
+
}
|
|
2817
|
+
return rect.left + leftScroll;
|
|
2818
|
+
}
|
|
2819
|
+
function getDocumentRect(element) {
|
|
2820
|
+
const html = getDocumentElement(element);
|
|
2821
|
+
const scroll = getNodeScroll(element);
|
|
2822
|
+
const body = element.ownerDocument.body;
|
|
2823
|
+
const width = max2(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
2824
|
+
const height = max2(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2825
|
+
let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2826
|
+
const y3 = -scroll.scrollTop;
|
|
2827
|
+
if (getComputedStyle(body).direction === "rtl") {
|
|
2828
|
+
x2 += max2(html.clientWidth, body.clientWidth) - width;
|
|
2829
|
+
}
|
|
2830
|
+
return {
|
|
2831
|
+
width,
|
|
2832
|
+
height,
|
|
2833
|
+
x: x2,
|
|
2834
|
+
y: y3
|
|
2835
|
+
};
|
|
2836
|
+
}
|
|
2837
|
+
function getViewportRect(element, strategy) {
|
|
2838
|
+
const win = getWindow(element);
|
|
2839
|
+
const html = getDocumentElement(element);
|
|
2840
|
+
const visualViewport = win.visualViewport;
|
|
2841
|
+
let width = html.clientWidth;
|
|
2842
|
+
let height = html.clientHeight;
|
|
2843
|
+
let x2 = 0;
|
|
2844
|
+
let y3 = 0;
|
|
2845
|
+
if (visualViewport) {
|
|
2846
|
+
width = visualViewport.width;
|
|
2847
|
+
height = visualViewport.height;
|
|
2848
|
+
const visualViewportBased = isWebKit();
|
|
2849
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
2850
|
+
x2 = visualViewport.offsetLeft;
|
|
2851
|
+
y3 = visualViewport.offsetTop;
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
return {
|
|
2855
|
+
width,
|
|
2856
|
+
height,
|
|
2857
|
+
x: x2,
|
|
2858
|
+
y: y3
|
|
2859
|
+
};
|
|
2860
|
+
}
|
|
2861
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
2862
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
2863
|
+
const top = clientRect.top + element.clientTop;
|
|
2864
|
+
const left = clientRect.left + element.clientLeft;
|
|
2865
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
2866
|
+
const width = element.clientWidth * scale.x;
|
|
2867
|
+
const height = element.clientHeight * scale.y;
|
|
2868
|
+
const x2 = left * scale.x;
|
|
2869
|
+
const y3 = top * scale.y;
|
|
2870
|
+
return {
|
|
2871
|
+
width,
|
|
2872
|
+
height,
|
|
2873
|
+
x: x2,
|
|
2874
|
+
y: y3
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
2878
|
+
let rect;
|
|
2879
|
+
if (clippingAncestor === "viewport") {
|
|
2880
|
+
rect = getViewportRect(element, strategy);
|
|
2881
|
+
} else if (clippingAncestor === "document") {
|
|
2882
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
2883
|
+
} else if (isElement(clippingAncestor)) {
|
|
2884
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
2885
|
+
} else {
|
|
2886
|
+
const visualOffsets = getVisualOffsets(element);
|
|
2887
|
+
rect = {
|
|
2888
|
+
...clippingAncestor,
|
|
2889
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
2890
|
+
y: clippingAncestor.y - visualOffsets.y
|
|
2891
|
+
};
|
|
2892
|
+
}
|
|
2893
|
+
return rectToClientRect(rect);
|
|
2894
|
+
}
|
|
2895
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
2896
|
+
const parentNode = getParentNode(element);
|
|
2897
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
2898
|
+
return false;
|
|
2899
|
+
}
|
|
2900
|
+
return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2901
|
+
}
|
|
2902
|
+
function getClippingElementAncestors(element, cache) {
|
|
2903
|
+
const cachedResult = cache.get(element);
|
|
2904
|
+
if (cachedResult) {
|
|
2905
|
+
return cachedResult;
|
|
2906
|
+
}
|
|
2907
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
2908
|
+
let currentContainingBlockComputedStyle = null;
|
|
2909
|
+
const elementIsFixed = getComputedStyle(element).position === "fixed";
|
|
2910
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2911
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2912
|
+
const computedStyle = getComputedStyle(currentNode);
|
|
2913
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2914
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
2915
|
+
currentContainingBlockComputedStyle = null;
|
|
2916
|
+
}
|
|
2917
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2918
|
+
if (shouldDropCurrentNode) {
|
|
2919
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
2920
|
+
} else {
|
|
2921
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
2922
|
+
}
|
|
2923
|
+
currentNode = getParentNode(currentNode);
|
|
2924
|
+
}
|
|
2925
|
+
cache.set(element, result);
|
|
2926
|
+
return result;
|
|
2927
|
+
}
|
|
2928
|
+
function getClippingRect(_ref) {
|
|
2929
|
+
let {
|
|
2930
|
+
element,
|
|
2931
|
+
boundary,
|
|
2932
|
+
rootBoundary,
|
|
2933
|
+
strategy
|
|
2934
|
+
} = _ref;
|
|
2935
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
2936
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2937
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
2938
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
2939
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
2940
|
+
accRect.top = max2(rect.top, accRect.top);
|
|
2941
|
+
accRect.right = min2(rect.right, accRect.right);
|
|
2942
|
+
accRect.bottom = min2(rect.bottom, accRect.bottom);
|
|
2943
|
+
accRect.left = max2(rect.left, accRect.left);
|
|
2944
|
+
return accRect;
|
|
2945
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
2946
|
+
return {
|
|
2947
|
+
width: clippingRect.right - clippingRect.left,
|
|
2948
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
2949
|
+
x: clippingRect.left,
|
|
2950
|
+
y: clippingRect.top
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
function getDimensions(element) {
|
|
2954
|
+
const {
|
|
2955
|
+
width,
|
|
2956
|
+
height
|
|
2957
|
+
} = getCssDimensions(element);
|
|
2958
|
+
return {
|
|
2959
|
+
width,
|
|
2960
|
+
height
|
|
2961
|
+
};
|
|
2962
|
+
}
|
|
2963
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
2964
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2965
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
2966
|
+
const isFixed = strategy === "fixed";
|
|
2967
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
2968
|
+
let scroll = {
|
|
2969
|
+
scrollLeft: 0,
|
|
2970
|
+
scrollTop: 0
|
|
2971
|
+
};
|
|
2972
|
+
const offsets = createCoords(0);
|
|
2973
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2974
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
2975
|
+
scroll = getNodeScroll(offsetParent);
|
|
2976
|
+
}
|
|
2977
|
+
if (isOffsetParentAnElement) {
|
|
2978
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
2979
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2980
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2981
|
+
} else if (documentElement) {
|
|
2982
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
let htmlX = 0;
|
|
2986
|
+
let htmlY = 0;
|
|
2987
|
+
if (documentElement && !isOffsetParentAnElement && !isFixed) {
|
|
2988
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
2989
|
+
htmlY = htmlRect.top + scroll.scrollTop;
|
|
2990
|
+
htmlX = htmlRect.left + scroll.scrollLeft - // RTL <body> scrollbar.
|
|
2991
|
+
getWindowScrollBarX(documentElement, htmlRect);
|
|
2992
|
+
}
|
|
2993
|
+
const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlX;
|
|
2994
|
+
const y3 = rect.top + scroll.scrollTop - offsets.y - htmlY;
|
|
2995
|
+
return {
|
|
2996
|
+
x: x2,
|
|
2997
|
+
y: y3,
|
|
2998
|
+
width: rect.width,
|
|
2999
|
+
height: rect.height
|
|
3000
|
+
};
|
|
3001
|
+
}
|
|
3002
|
+
function isStaticPositioned(element) {
|
|
3003
|
+
return getComputedStyle(element).position === "static";
|
|
3004
|
+
}
|
|
3005
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
3006
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
|
3007
|
+
return null;
|
|
3008
|
+
}
|
|
3009
|
+
if (polyfill) {
|
|
3010
|
+
return polyfill(element);
|
|
3011
|
+
}
|
|
3012
|
+
let rawOffsetParent = element.offsetParent;
|
|
3013
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
3014
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
3015
|
+
}
|
|
3016
|
+
return rawOffsetParent;
|
|
3017
|
+
}
|
|
3018
|
+
function getOffsetParent(element, polyfill) {
|
|
3019
|
+
const win = getWindow(element);
|
|
3020
|
+
if (isTopLayer(element)) {
|
|
3021
|
+
return win;
|
|
3022
|
+
}
|
|
3023
|
+
if (!isHTMLElement(element)) {
|
|
3024
|
+
let svgOffsetParent = getParentNode(element);
|
|
3025
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
3026
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
3027
|
+
return svgOffsetParent;
|
|
3028
|
+
}
|
|
3029
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
3030
|
+
}
|
|
3031
|
+
return win;
|
|
3032
|
+
}
|
|
3033
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
3034
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
3035
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
3036
|
+
}
|
|
3037
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
3038
|
+
return win;
|
|
3039
|
+
}
|
|
3040
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
3041
|
+
}
|
|
3042
|
+
var getElementRects = async function(data) {
|
|
3043
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
3044
|
+
const getDimensionsFn = this.getDimensions;
|
|
3045
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
3046
|
+
return {
|
|
3047
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
3048
|
+
floating: {
|
|
3049
|
+
x: 0,
|
|
3050
|
+
y: 0,
|
|
3051
|
+
width: floatingDimensions.width,
|
|
3052
|
+
height: floatingDimensions.height
|
|
3053
|
+
}
|
|
3054
|
+
};
|
|
3055
|
+
};
|
|
3056
|
+
function isRTL(element) {
|
|
3057
|
+
return getComputedStyle(element).direction === "rtl";
|
|
3058
|
+
}
|
|
3059
|
+
var platform = {
|
|
3060
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
3061
|
+
getDocumentElement,
|
|
3062
|
+
getClippingRect,
|
|
3063
|
+
getOffsetParent,
|
|
3064
|
+
getElementRects,
|
|
3065
|
+
getClientRects,
|
|
3066
|
+
getDimensions,
|
|
3067
|
+
getScale,
|
|
3068
|
+
isElement,
|
|
3069
|
+
isRTL
|
|
3070
|
+
};
|
|
3071
|
+
function observeMove(element, onMove) {
|
|
3072
|
+
let io = null;
|
|
3073
|
+
let timeoutId;
|
|
3074
|
+
const root = getDocumentElement(element);
|
|
3075
|
+
function cleanup() {
|
|
3076
|
+
var _io;
|
|
3077
|
+
clearTimeout(timeoutId);
|
|
3078
|
+
(_io = io) == null || _io.disconnect();
|
|
3079
|
+
io = null;
|
|
3080
|
+
}
|
|
3081
|
+
function refresh(skip, threshold) {
|
|
3082
|
+
if (skip === void 0) {
|
|
3083
|
+
skip = false;
|
|
3084
|
+
}
|
|
3085
|
+
if (threshold === void 0) {
|
|
3086
|
+
threshold = 1;
|
|
3087
|
+
}
|
|
3088
|
+
cleanup();
|
|
3089
|
+
const {
|
|
3090
|
+
left,
|
|
3091
|
+
top,
|
|
3092
|
+
width,
|
|
3093
|
+
height
|
|
3094
|
+
} = element.getBoundingClientRect();
|
|
3095
|
+
if (!skip) {
|
|
3096
|
+
onMove();
|
|
3097
|
+
}
|
|
3098
|
+
if (!width || !height) {
|
|
3099
|
+
return;
|
|
3100
|
+
}
|
|
3101
|
+
const insetTop = floor(top);
|
|
3102
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
3103
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
3104
|
+
const insetLeft = floor(left);
|
|
3105
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
3106
|
+
const options = {
|
|
3107
|
+
rootMargin,
|
|
3108
|
+
threshold: max2(0, min2(1, threshold)) || 1
|
|
3109
|
+
};
|
|
3110
|
+
let isFirstUpdate = true;
|
|
3111
|
+
function handleObserve(entries) {
|
|
3112
|
+
const ratio = entries[0].intersectionRatio;
|
|
3113
|
+
if (ratio !== threshold) {
|
|
3114
|
+
if (!isFirstUpdate) {
|
|
3115
|
+
return refresh();
|
|
3116
|
+
}
|
|
3117
|
+
if (!ratio) {
|
|
3118
|
+
timeoutId = setTimeout(() => {
|
|
3119
|
+
refresh(false, 1e-7);
|
|
3120
|
+
}, 1e3);
|
|
3121
|
+
} else {
|
|
3122
|
+
refresh(false, ratio);
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
isFirstUpdate = false;
|
|
3126
|
+
}
|
|
3127
|
+
try {
|
|
3128
|
+
io = new IntersectionObserver(handleObserve, {
|
|
3129
|
+
...options,
|
|
3130
|
+
// Handle <iframe>s
|
|
3131
|
+
root: root.ownerDocument
|
|
3132
|
+
});
|
|
3133
|
+
} catch (e3) {
|
|
3134
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
3135
|
+
}
|
|
3136
|
+
io.observe(element);
|
|
3137
|
+
}
|
|
3138
|
+
refresh(true);
|
|
3139
|
+
return cleanup;
|
|
3140
|
+
}
|
|
3141
|
+
function autoUpdate(reference, floating, update, options) {
|
|
3142
|
+
if (options === void 0) {
|
|
3143
|
+
options = {};
|
|
3144
|
+
}
|
|
3145
|
+
const {
|
|
3146
|
+
ancestorScroll = true,
|
|
3147
|
+
ancestorResize = true,
|
|
3148
|
+
elementResize = typeof ResizeObserver === "function",
|
|
3149
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
3150
|
+
animationFrame = false
|
|
3151
|
+
} = options;
|
|
3152
|
+
const referenceEl = unwrapElement(reference);
|
|
3153
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
3154
|
+
ancestors.forEach((ancestor) => {
|
|
3155
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
3156
|
+
passive: true
|
|
3157
|
+
});
|
|
3158
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
3159
|
+
});
|
|
3160
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
3161
|
+
let reobserveFrame = -1;
|
|
3162
|
+
let resizeObserver = null;
|
|
3163
|
+
if (elementResize) {
|
|
3164
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
3165
|
+
let [firstEntry] = _ref;
|
|
3166
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
3167
|
+
resizeObserver.unobserve(floating);
|
|
3168
|
+
cancelAnimationFrame(reobserveFrame);
|
|
3169
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
3170
|
+
var _resizeObserver;
|
|
3171
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
3172
|
+
});
|
|
3173
|
+
}
|
|
3174
|
+
update();
|
|
3175
|
+
});
|
|
3176
|
+
if (referenceEl && !animationFrame) {
|
|
3177
|
+
resizeObserver.observe(referenceEl);
|
|
3178
|
+
}
|
|
3179
|
+
resizeObserver.observe(floating);
|
|
3180
|
+
}
|
|
3181
|
+
let frameId;
|
|
3182
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
3183
|
+
if (animationFrame) {
|
|
3184
|
+
frameLoop();
|
|
3185
|
+
}
|
|
3186
|
+
function frameLoop() {
|
|
3187
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
3188
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
3189
|
+
update();
|
|
3190
|
+
}
|
|
3191
|
+
prevRefRect = nextRefRect;
|
|
3192
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
3193
|
+
}
|
|
3194
|
+
update();
|
|
3195
|
+
return () => {
|
|
3196
|
+
var _resizeObserver2;
|
|
3197
|
+
ancestors.forEach((ancestor) => {
|
|
3198
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
3199
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
3200
|
+
});
|
|
3201
|
+
cleanupIo == null || cleanupIo();
|
|
3202
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
3203
|
+
resizeObserver = null;
|
|
3204
|
+
if (animationFrame) {
|
|
3205
|
+
cancelAnimationFrame(frameId);
|
|
3206
|
+
}
|
|
3207
|
+
};
|
|
3208
|
+
}
|
|
3209
|
+
var offset2 = offset;
|
|
3210
|
+
var shift2 = shift;
|
|
3211
|
+
var flip2 = flip;
|
|
3212
|
+
var arrow2 = arrow;
|
|
3213
|
+
var computePosition2 = (reference, floating, options) => {
|
|
3214
|
+
const cache = /* @__PURE__ */ new Map();
|
|
3215
|
+
const mergedOptions = {
|
|
3216
|
+
platform,
|
|
3217
|
+
...options
|
|
3218
|
+
};
|
|
3219
|
+
const platformWithCache = {
|
|
3220
|
+
...mergedOptions.platform,
|
|
3221
|
+
_c: cache
|
|
3222
|
+
};
|
|
3223
|
+
return computePosition(reference, floating, {
|
|
3224
|
+
...mergedOptions,
|
|
3225
|
+
platform: platformWithCache
|
|
3226
|
+
});
|
|
3227
|
+
};
|
|
3228
|
+
|
|
3229
|
+
// src/lib/components/popover.tsx
|
|
3230
|
+
var Popover = ({
|
|
3231
|
+
x: x2,
|
|
3232
|
+
y: y3,
|
|
3233
|
+
placement = "right",
|
|
3234
|
+
offset: pixelOffset = 0,
|
|
3235
|
+
arrow: arrowSize = false,
|
|
3236
|
+
arrowColor = "white",
|
|
3237
|
+
children
|
|
3238
|
+
}) => {
|
|
3239
|
+
const anchorRef = A2(null);
|
|
3240
|
+
const contentRef = A2(null);
|
|
3241
|
+
const arrowRef = A2(null);
|
|
3242
|
+
const updaterRef = A2();
|
|
3243
|
+
updaterRef.current = () => {
|
|
3244
|
+
if (!anchorRef.current || !contentRef.current)
|
|
3245
|
+
return;
|
|
3246
|
+
const arrowWidth = Array.isArray(arrowSize) ? arrowSize[0] : arrowSize || 0;
|
|
3247
|
+
const arrowHeight = Array.isArray(arrowSize) ? arrowSize[1] : arrowSize || 0;
|
|
3248
|
+
const padding = pixelOffset + Math.max(arrowHeight, arrowWidth);
|
|
3249
|
+
const middleware = placement.includes("-") ? [offset2(padding), flip2(), shift2()] : [offset2(padding), shift2(), flip2()];
|
|
3250
|
+
if (arrowRef.current)
|
|
3251
|
+
middleware.push(arrow2({ element: arrowRef.current }));
|
|
3252
|
+
computePosition2(anchorRef.current, contentRef.current, {
|
|
3253
|
+
placement,
|
|
3254
|
+
strategy: "fixed",
|
|
3255
|
+
middleware
|
|
3256
|
+
}).then((popoverPos) => {
|
|
3257
|
+
if (contentRef.current) {
|
|
3258
|
+
Object.assign(contentRef.current.style, {
|
|
3259
|
+
left: `${popoverPos.x}px`,
|
|
3260
|
+
top: `${popoverPos.y}px`
|
|
3261
|
+
});
|
|
3262
|
+
}
|
|
3263
|
+
const arrowData = popoverPos.middlewareData.arrow;
|
|
3264
|
+
if (arrowData && arrowRef.current) {
|
|
3265
|
+
const arrowStyle = createArrow(arrowWidth, arrowHeight, arrowColor, popoverPos.placement);
|
|
3266
|
+
arrowStyle.transform = `translate(${arrowData.x || 0}px, ${arrowData.y || 0}px)`;
|
|
3267
|
+
Object.assign(arrowRef.current.style, arrowStyle);
|
|
3268
|
+
}
|
|
3269
|
+
});
|
|
3270
|
+
};
|
|
3271
|
+
T2(() => {
|
|
3272
|
+
updaterRef.current?.();
|
|
3273
|
+
}, [x2, y3, placement, arrowSize, pixelOffset]);
|
|
3274
|
+
y2(() => {
|
|
3275
|
+
if (contentRef.current) {
|
|
3276
|
+
contentRef.current.style.visibility = "visible";
|
|
3277
|
+
}
|
|
3278
|
+
const cleanup = autoUpdate(
|
|
3279
|
+
anchorRef.current,
|
|
3280
|
+
contentRef.current,
|
|
3281
|
+
() => updaterRef.current?.()
|
|
3282
|
+
);
|
|
3283
|
+
return () => {
|
|
3284
|
+
cleanup();
|
|
3285
|
+
};
|
|
3286
|
+
}, []);
|
|
3287
|
+
return /* @__PURE__ */ u2("div", { style: { position: "absolute", left: x2, top: y3 }, ref: anchorRef, children: /* @__PURE__ */ u2(
|
|
3288
|
+
"div",
|
|
3289
|
+
{
|
|
3290
|
+
className: "deck-widget deck-widget-popover",
|
|
3291
|
+
style: { position: "fixed", visibility: "hidden", pointerEvents: "none" },
|
|
3292
|
+
ref: contentRef,
|
|
3293
|
+
children: [
|
|
3294
|
+
Boolean(arrowSize) && /* @__PURE__ */ u2(
|
|
3295
|
+
"div",
|
|
3296
|
+
{
|
|
3297
|
+
className: "deck-widget-popover-arrow",
|
|
3298
|
+
style: { position: "absolute" },
|
|
3299
|
+
ref: arrowRef
|
|
3300
|
+
}
|
|
3301
|
+
),
|
|
3302
|
+
children
|
|
3303
|
+
]
|
|
3304
|
+
}
|
|
3305
|
+
) });
|
|
3306
|
+
};
|
|
3307
|
+
function createArrow(width, height, color, placement) {
|
|
3308
|
+
const result = {
|
|
3309
|
+
width: 0,
|
|
3310
|
+
height: 0,
|
|
3311
|
+
top: "",
|
|
3312
|
+
bottom: "",
|
|
3313
|
+
left: "",
|
|
3314
|
+
right: ""
|
|
3315
|
+
};
|
|
3316
|
+
if (placement.startsWith("bottom")) {
|
|
3317
|
+
result.borderLeft = `${width / 2}px solid transparent`;
|
|
3318
|
+
result.borderRight = `${width / 2}px solid transparent`;
|
|
3319
|
+
result.borderBottom = `${height}px solid ${color}`;
|
|
3320
|
+
result.borderTop = "";
|
|
3321
|
+
result.top = `${-height}px`;
|
|
3322
|
+
} else if (placement.startsWith("top")) {
|
|
3323
|
+
result.borderLeft = `${width / 2}px solid transparent`;
|
|
3324
|
+
result.borderRight = `${width / 2}px solid transparent`;
|
|
3325
|
+
result.borderTop = `${height}px solid ${color}`;
|
|
3326
|
+
result.borderBottom = "";
|
|
3327
|
+
result.bottom = `${-height}px`;
|
|
3328
|
+
} else if (placement.startsWith("right")) {
|
|
3329
|
+
result.borderTop = `${width / 2}px solid transparent`;
|
|
3330
|
+
result.borderBottom = `${width / 2}px solid transparent`;
|
|
3331
|
+
result.borderRight = `${height}px solid ${color}`;
|
|
3332
|
+
result.borderLeft = "";
|
|
3333
|
+
result.left = `${-height}px`;
|
|
3334
|
+
} else if (placement.startsWith("left")) {
|
|
3335
|
+
result.borderTop = `${width / 2}px solid transparent`;
|
|
3336
|
+
result.borderBottom = `${width / 2}px solid transparent`;
|
|
3337
|
+
result.borderLeft = `${height}px solid ${color}`;
|
|
3338
|
+
result.borderRight = "";
|
|
3339
|
+
result.right = `${-height}px`;
|
|
3340
|
+
}
|
|
3341
|
+
return result;
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
// src/lib/components/user-content.tsx
|
|
3345
|
+
var UserContent = ({ text, html, element, ...props }) => {
|
|
3346
|
+
const containerRef = A2(null);
|
|
3347
|
+
y2(() => {
|
|
3348
|
+
if (containerRef.current && element) {
|
|
3349
|
+
containerRef.current.append(element);
|
|
3350
|
+
}
|
|
3351
|
+
return () => {
|
|
3352
|
+
element?.remove();
|
|
3353
|
+
};
|
|
3354
|
+
}, [element]);
|
|
3355
|
+
return /* @__PURE__ */ u2("div", { ref: containerRef, ...props, dangerouslySetInnerHTML: html ? { __html: html } : void 0, children: text });
|
|
3356
|
+
};
|
|
3357
|
+
|
|
3358
|
+
// src/info-widget.tsx
|
|
3359
|
+
var InfoWidget = class extends import_core12.Widget {
|
|
3360
|
+
constructor(props) {
|
|
3361
|
+
super(props);
|
|
3362
|
+
this.className = "deck-widget-info";
|
|
3363
|
+
this.placement = "fill";
|
|
3364
|
+
this.tooltip = null;
|
|
3365
|
+
this.setProps(this.props);
|
|
3366
|
+
}
|
|
3367
|
+
setProps(props) {
|
|
3368
|
+
this.viewId = props.viewId ?? this.viewId;
|
|
3369
|
+
super.setProps(props);
|
|
3370
|
+
}
|
|
3371
|
+
onAdd({ deck }) {
|
|
3372
|
+
this.deck = deck;
|
|
3373
|
+
}
|
|
3374
|
+
onRemove() {
|
|
3375
|
+
if (this.rootElement) {
|
|
3376
|
+
B(null, this.rootElement);
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
onViewportChange(viewport) {
|
|
3380
|
+
this.viewport = viewport;
|
|
3381
|
+
this.updateHTML();
|
|
3382
|
+
}
|
|
3383
|
+
onHover(info) {
|
|
3384
|
+
if (this.props.mode === "hover") {
|
|
3385
|
+
this.tooltip = this._getTooltip(info);
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
onClick(info) {
|
|
3389
|
+
if (this.props.mode === "click") {
|
|
3390
|
+
this.tooltip = this._getTooltip(info);
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
_getTooltip(info) {
|
|
3394
|
+
if (!this.props.getTooltip)
|
|
3395
|
+
return null;
|
|
3396
|
+
const content = this.props.getTooltip(info, this) ?? null;
|
|
3397
|
+
if (content === null)
|
|
3398
|
+
return null;
|
|
3399
|
+
const normalizedTooltip = typeof content === "string" ? { text: content } : content;
|
|
3400
|
+
const position = normalizedTooltip.position || info.coordinate;
|
|
3401
|
+
if (!position)
|
|
3402
|
+
return null;
|
|
3403
|
+
return {
|
|
3404
|
+
position,
|
|
3405
|
+
text: "",
|
|
3406
|
+
html: "",
|
|
3407
|
+
element: null,
|
|
3408
|
+
className: "",
|
|
3409
|
+
style: {},
|
|
3410
|
+
...normalizedTooltip
|
|
3411
|
+
};
|
|
3412
|
+
}
|
|
3413
|
+
onRenderHTML(rootElement) {
|
|
3414
|
+
if (!this.viewport || this.tooltip === null) {
|
|
3415
|
+
B(null, rootElement);
|
|
3416
|
+
return;
|
|
3417
|
+
}
|
|
3418
|
+
const style = {
|
|
3419
|
+
...this.props.style,
|
|
3420
|
+
...this.tooltip.style
|
|
3421
|
+
};
|
|
3422
|
+
const [x2, y3] = this.viewport.project(this.tooltip.position);
|
|
3423
|
+
const ui = /* @__PURE__ */ u2(
|
|
3424
|
+
Popover,
|
|
3425
|
+
{
|
|
3426
|
+
x: x2,
|
|
3427
|
+
y: y3,
|
|
3428
|
+
placement: this.props.placement,
|
|
3429
|
+
arrow: this.props.arrow,
|
|
3430
|
+
arrowColor: "var(--menu-background, #fff)",
|
|
3431
|
+
offset: this.props.offset,
|
|
3432
|
+
children: /* @__PURE__ */ u2(
|
|
3433
|
+
UserContent,
|
|
3434
|
+
{
|
|
3435
|
+
className: `deck-widget-popup-content ${this.tooltip.className} ${this.props.className}`,
|
|
3436
|
+
style,
|
|
3437
|
+
html: this.tooltip.html,
|
|
3438
|
+
text: this.tooltip.text,
|
|
3439
|
+
element: this.tooltip.element
|
|
3440
|
+
}
|
|
3441
|
+
)
|
|
3442
|
+
}
|
|
3443
|
+
);
|
|
3444
|
+
B(ui, rootElement);
|
|
3445
|
+
}
|
|
3446
|
+
};
|
|
3447
|
+
InfoWidget.defaultProps = {
|
|
3448
|
+
...import_core12.Widget.defaultProps,
|
|
3449
|
+
id: "info",
|
|
3450
|
+
viewId: null,
|
|
3451
|
+
mode: "hover",
|
|
3452
|
+
getTooltip: void 0,
|
|
3453
|
+
placement: "right",
|
|
3454
|
+
offset: 10,
|
|
3455
|
+
arrow: 10
|
|
3456
|
+
};
|
|
3457
|
+
|
|
3458
|
+
// src/popup-widget.tsx
|
|
3459
|
+
var import_core13 = __toESM(require_core(), 1);
|
|
3460
|
+
var PopupWidget = class extends import_core13.Widget {
|
|
3461
|
+
constructor(props) {
|
|
3462
|
+
super(props);
|
|
3463
|
+
this.className = "deck-widget-popup";
|
|
3464
|
+
this.placement = "fill";
|
|
3465
|
+
this.setProps(this.props);
|
|
3466
|
+
this.isOpen = this.props.defaultIsOpen;
|
|
3467
|
+
}
|
|
3468
|
+
setProps(props) {
|
|
3469
|
+
this.viewId = props.viewId ?? this.viewId;
|
|
3470
|
+
super.setProps(props);
|
|
3471
|
+
}
|
|
3472
|
+
onAdd({ deck }) {
|
|
3473
|
+
this.deck = deck;
|
|
3474
|
+
}
|
|
3475
|
+
onRemove() {
|
|
3476
|
+
if (this.rootElement) {
|
|
3477
|
+
B(null, this.rootElement);
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
onViewportChange(viewport) {
|
|
3481
|
+
this.viewport = viewport;
|
|
3482
|
+
this.updateHTML();
|
|
3483
|
+
}
|
|
3484
|
+
onClick() {
|
|
3485
|
+
if (this.props.closeOnClickOutside) {
|
|
3486
|
+
this._setIsOpen(false);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
_setIsOpen(isOpen) {
|
|
3490
|
+
if (this.isOpen === isOpen)
|
|
3491
|
+
return;
|
|
3492
|
+
this.isOpen = isOpen;
|
|
3493
|
+
this.props.onOpenChange?.(isOpen);
|
|
3494
|
+
this.updateHTML();
|
|
3495
|
+
}
|
|
3496
|
+
onRenderHTML(rootElement) {
|
|
3497
|
+
if (!this.viewport) {
|
|
3498
|
+
B(null, rootElement);
|
|
3499
|
+
return;
|
|
3500
|
+
}
|
|
3501
|
+
const { marker, content, style } = this.props;
|
|
3502
|
+
const [x2, y3] = this.viewport.project(this.props.position);
|
|
3503
|
+
const ui = /* @__PURE__ */ u2("div", { children: [
|
|
3504
|
+
marker && /* @__PURE__ */ u2(
|
|
3505
|
+
"div",
|
|
3506
|
+
{
|
|
3507
|
+
style: { position: "absolute", left: x2, top: y3, pointerEvents: "all", cursor: "pointer" },
|
|
3508
|
+
children: /* @__PURE__ */ u2(UserContent, { ...marker, onClick: () => this._setIsOpen(true) })
|
|
3509
|
+
}
|
|
3510
|
+
),
|
|
3511
|
+
this.isOpen && /* @__PURE__ */ u2(
|
|
3512
|
+
Popover,
|
|
3513
|
+
{
|
|
3514
|
+
x: x2,
|
|
3515
|
+
y: y3,
|
|
3516
|
+
placement: this.props.placement,
|
|
3517
|
+
arrow: this.props.arrow,
|
|
3518
|
+
arrowColor: "var(--menu-background, #fff)",
|
|
3519
|
+
offset: this.props.offset,
|
|
3520
|
+
children: /* @__PURE__ */ u2(
|
|
3521
|
+
"div",
|
|
3522
|
+
{
|
|
3523
|
+
className: `deck-widget-popup-content ${this.props.className}`,
|
|
3524
|
+
style,
|
|
3525
|
+
children: [
|
|
3526
|
+
this.props.closeButton && /* @__PURE__ */ u2(
|
|
3527
|
+
"div",
|
|
3528
|
+
{
|
|
3529
|
+
className: "deck-widget-popup-controls",
|
|
3530
|
+
style: { width: "100%", display: "flex", justifyContent: "end" },
|
|
3531
|
+
children: /* @__PURE__ */ u2(
|
|
3532
|
+
IconButton,
|
|
3533
|
+
{
|
|
3534
|
+
className: "deck-widget-popup-close-button",
|
|
3535
|
+
onClick: () => this._setIsOpen(false)
|
|
3536
|
+
}
|
|
3537
|
+
)
|
|
3538
|
+
}
|
|
3539
|
+
),
|
|
3540
|
+
/* @__PURE__ */ u2(UserContent, { ...typeof content === "string" ? { text: content } : content })
|
|
3541
|
+
]
|
|
3542
|
+
}
|
|
3543
|
+
)
|
|
3544
|
+
}
|
|
3545
|
+
)
|
|
3546
|
+
] });
|
|
3547
|
+
B(ui, rootElement);
|
|
3548
|
+
}
|
|
3549
|
+
};
|
|
3550
|
+
PopupWidget.defaultProps = {
|
|
3551
|
+
...import_core13.Widget.defaultProps,
|
|
3552
|
+
id: "info",
|
|
3553
|
+
viewId: null,
|
|
3554
|
+
position: [0, 0],
|
|
3555
|
+
marker: null,
|
|
3556
|
+
defaultIsOpen: true,
|
|
3557
|
+
content: "",
|
|
3558
|
+
placement: "right",
|
|
3559
|
+
offset: 10,
|
|
3560
|
+
arrow: 10,
|
|
3561
|
+
closeButton: true,
|
|
3562
|
+
closeOnClickOutside: false,
|
|
3563
|
+
onOpenChange: () => {
|
|
3564
|
+
}
|
|
3565
|
+
};
|
|
3566
|
+
|
|
3567
|
+
// src/context-menu-widget.tsx
|
|
3568
|
+
var import_core14 = __toESM(require_core(), 1);
|
|
3569
|
+
var ContextMenuWidget = class extends import_core14.Widget {
|
|
3570
|
+
constructor(props) {
|
|
3571
|
+
super(props);
|
|
3572
|
+
this.className = "deck-widget-context-menu";
|
|
3573
|
+
this.placement = "fill";
|
|
3574
|
+
this.menu = null;
|
|
3575
|
+
this.setProps(this.props);
|
|
3576
|
+
}
|
|
3577
|
+
onAdd({ deck }) {
|
|
3578
|
+
deck.getCanvas()?.addEventListener("contextmenu", (event) => this.handleContextMenu(event));
|
|
3579
|
+
}
|
|
3580
|
+
handleContextMenu(srcEvent) {
|
|
3581
|
+
const targetRect = srcEvent.target.getBoundingClientRect();
|
|
3582
|
+
const x2 = srcEvent.clientX - targetRect.x;
|
|
3583
|
+
const y3 = srcEvent.clientY - targetRect.y;
|
|
3584
|
+
const pickInfo = this.deck?.pickObject({ x: x2, y: y3 }) || {
|
|
3585
|
+
x: x2,
|
|
3586
|
+
y: y3,
|
|
3587
|
+
picked: false,
|
|
3588
|
+
layer: null,
|
|
3589
|
+
color: null,
|
|
3590
|
+
index: -1,
|
|
3591
|
+
pixelRatio: 1
|
|
3592
|
+
};
|
|
3593
|
+
const menuItems = this.props.getMenuItems?.(pickInfo, this) || this.props.menuItems;
|
|
3594
|
+
this.menu = menuItems.length > 0 ? {
|
|
3595
|
+
items: menuItems,
|
|
3596
|
+
pickInfo
|
|
3597
|
+
} : null;
|
|
3598
|
+
srcEvent.preventDefault();
|
|
3599
|
+
this.updateHTML();
|
|
3600
|
+
}
|
|
3601
|
+
onRenderHTML(rootElement) {
|
|
3602
|
+
if (!this.menu) {
|
|
3603
|
+
B(null, rootElement);
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
const { items, pickInfo } = this.menu;
|
|
3607
|
+
const style = {
|
|
3608
|
+
pointerEvents: "auto",
|
|
3609
|
+
position: "static",
|
|
3610
|
+
...this.props.style
|
|
3611
|
+
};
|
|
3612
|
+
const ui = /* @__PURE__ */ u2(
|
|
3613
|
+
Popover,
|
|
3614
|
+
{
|
|
3615
|
+
x: pickInfo.x,
|
|
3616
|
+
y: pickInfo.y,
|
|
3617
|
+
placement: this.props.placement,
|
|
3618
|
+
arrow: this.props.arrow,
|
|
3619
|
+
arrowColor: "var(--menu-background, #fff)",
|
|
3620
|
+
offset: this.props.offset,
|
|
3621
|
+
children: /* @__PURE__ */ u2(
|
|
3622
|
+
SimpleMenu,
|
|
3623
|
+
{
|
|
3624
|
+
menuItems: items,
|
|
3625
|
+
onSelect: (value) => this.props.onMenuItemSelected(value, pickInfo),
|
|
3626
|
+
style,
|
|
3627
|
+
isOpen: true,
|
|
3628
|
+
onClose: () => this.hide()
|
|
3629
|
+
}
|
|
3630
|
+
)
|
|
3631
|
+
}
|
|
3632
|
+
);
|
|
3633
|
+
B(ui, rootElement);
|
|
3634
|
+
}
|
|
3635
|
+
hide() {
|
|
3636
|
+
this.menu = null;
|
|
3637
|
+
this.updateHTML();
|
|
3638
|
+
}
|
|
3639
|
+
};
|
|
3640
|
+
ContextMenuWidget.defaultProps = {
|
|
3641
|
+
...import_core14.Widget.defaultProps,
|
|
3642
|
+
id: "context",
|
|
3643
|
+
viewId: null,
|
|
3644
|
+
menuItems: [],
|
|
3645
|
+
getMenuItems: void 0,
|
|
3646
|
+
onMenuItemSelected: () => {
|
|
3647
|
+
},
|
|
3648
|
+
placement: "bottom-start",
|
|
3649
|
+
offset: 10,
|
|
3650
|
+
arrow: false
|
|
3651
|
+
};
|
|
3652
|
+
|
|
3653
|
+
// src/scrollbar-widget.tsx
|
|
3654
|
+
var import_core15 = __toESM(require_core(), 1);
|
|
3655
|
+
|
|
3656
|
+
// src/lib/components/range-input.tsx
|
|
3657
|
+
var wheelListenerOptions = { passive: false };
|
|
3658
|
+
var clamp2 = (value, min3, max3) => {
|
|
3659
|
+
if (value < min3) {
|
|
3660
|
+
return min3;
|
|
3661
|
+
}
|
|
3662
|
+
if (value > max3) {
|
|
3663
|
+
return max3;
|
|
3664
|
+
}
|
|
3665
|
+
return value;
|
|
3666
|
+
};
|
|
3667
|
+
var getTrackDimension = (track, vertical) => {
|
|
3668
|
+
if (!track || !track.firstElementChild) {
|
|
3669
|
+
return [0, 0];
|
|
3670
|
+
}
|
|
3671
|
+
const rect = track.firstElementChild.getBoundingClientRect();
|
|
3672
|
+
if (vertical) {
|
|
3673
|
+
return [rect.top, rect.height];
|
|
3674
|
+
}
|
|
3675
|
+
return vertical ? [rect.top, rect.height] : [rect.left, rect.width];
|
|
3676
|
+
};
|
|
3677
|
+
var getEffectiveStep = (step, range) => {
|
|
3678
|
+
if (typeof step === "number" && !Number.isNaN(step) && step > 0) {
|
|
3679
|
+
return step;
|
|
3680
|
+
}
|
|
3681
|
+
return Math.max(1, range / 10 || 1);
|
|
3682
|
+
};
|
|
3683
|
+
var getEffectivePage = (pageSize, rangeSize) => {
|
|
3684
|
+
if (typeof pageSize === "number" && !Number.isNaN(pageSize) && pageSize > 0) {
|
|
3685
|
+
return pageSize;
|
|
3686
|
+
}
|
|
3687
|
+
return Math.max(1, rangeSize || 1);
|
|
3688
|
+
};
|
|
3689
|
+
function RangeInput(props) {
|
|
3690
|
+
const {
|
|
3691
|
+
className = "",
|
|
3692
|
+
min: min3,
|
|
3693
|
+
max: max3,
|
|
3694
|
+
step,
|
|
3695
|
+
value,
|
|
3696
|
+
orientation,
|
|
3697
|
+
pageSize,
|
|
3698
|
+
stepButtons = false,
|
|
3699
|
+
startButtonAriaLabel,
|
|
3700
|
+
endButtonAriaLabel,
|
|
3701
|
+
eventTarget,
|
|
3702
|
+
decorations = [],
|
|
3703
|
+
onChange
|
|
3704
|
+
} = props;
|
|
3705
|
+
const vertical = orientation !== "horizontal";
|
|
3706
|
+
const rootRef = A2(null);
|
|
3707
|
+
const trackRef = A2(null);
|
|
3708
|
+
const thumbRef = A2(null);
|
|
3709
|
+
const dragStateRef = A2(null);
|
|
3710
|
+
const [trackLength, setTrackLength] = h2(0);
|
|
3711
|
+
const range = max3 - min3;
|
|
3712
|
+
const rangeSize = Math.max(0, value[1] - value[0]);
|
|
3713
|
+
const maxStart = Math.max(0, range - rangeSize);
|
|
3714
|
+
const clampedStart = clamp2(value[0], min3, min3 + maxStart);
|
|
3715
|
+
const { thumbLength, thumbOffset } = T2(() => {
|
|
3716
|
+
if (trackLength <= 0 || range <= 0) {
|
|
3717
|
+
return { thumbLength: 0, thumbOffset: 0 };
|
|
3718
|
+
}
|
|
3719
|
+
if (range <= rangeSize) {
|
|
3720
|
+
return { thumbLength: 1, thumbOffset: 0 };
|
|
3721
|
+
}
|
|
3722
|
+
const nextThumbLength = rangeSize / range;
|
|
3723
|
+
const travel = Math.max(0, 1 - nextThumbLength);
|
|
3724
|
+
const ratio = maxStart <= 0 ? 0 : clamp2((clampedStart - min3) / maxStart, 0, 1);
|
|
3725
|
+
return {
|
|
3726
|
+
thumbLength: Math.max(0, Math.min(nextThumbLength, 1)),
|
|
3727
|
+
thumbOffset: travel * ratio
|
|
3728
|
+
};
|
|
3729
|
+
}, [trackLength, range, rangeSize, maxStart, clampedStart, min3]);
|
|
3730
|
+
const emitRange = q2(
|
|
3731
|
+
(nextStart) => {
|
|
3732
|
+
if (!onChange) {
|
|
3733
|
+
return;
|
|
3734
|
+
}
|
|
3735
|
+
const clamped = clamp2(nextStart, min3, min3 + maxStart);
|
|
3736
|
+
onChange([clamped, clamped + rangeSize]);
|
|
3737
|
+
},
|
|
3738
|
+
[onChange, min3, maxStart, rangeSize]
|
|
3739
|
+
);
|
|
3740
|
+
const handleStepNegative = q2(
|
|
3741
|
+
(event) => {
|
|
3742
|
+
event.stopPropagation();
|
|
3743
|
+
emitRange(clampedStart - getEffectiveStep(step, range));
|
|
3744
|
+
},
|
|
3745
|
+
[emitRange, clampedStart, step, range]
|
|
3746
|
+
);
|
|
3747
|
+
const handleStepPositive = q2(
|
|
3748
|
+
(event) => {
|
|
3749
|
+
event.stopPropagation();
|
|
3750
|
+
emitRange(clampedStart + getEffectiveStep(step, range));
|
|
3751
|
+
},
|
|
3752
|
+
[emitRange, clampedStart, step, range]
|
|
3753
|
+
);
|
|
3754
|
+
const handleTrackClick = q2(
|
|
3755
|
+
(event) => {
|
|
3756
|
+
if (event.button !== 0) {
|
|
3757
|
+
return;
|
|
3758
|
+
}
|
|
3759
|
+
const target = event.target;
|
|
3760
|
+
if (target?.dataset.scrollbarThumb === "true") {
|
|
3761
|
+
return;
|
|
3762
|
+
}
|
|
3763
|
+
const track = trackRef.current;
|
|
3764
|
+
if (!track) {
|
|
3765
|
+
return;
|
|
3766
|
+
}
|
|
3767
|
+
event.preventDefault();
|
|
3768
|
+
event.stopPropagation();
|
|
3769
|
+
const [trackStart] = getTrackDimension(track, vertical);
|
|
3770
|
+
const coordinate = vertical ? event.clientY - trackStart : event.clientX - trackStart;
|
|
3771
|
+
const span = Math.max(1, 1 - thumbLength) * trackLength;
|
|
3772
|
+
const thumbCenter = thumbLength / 2 * trackLength;
|
|
3773
|
+
const ratio = span <= 0 ? 0 : clamp2((coordinate - thumbCenter) / span, 0, 1);
|
|
3774
|
+
emitRange(min3 + ratio * maxStart);
|
|
3775
|
+
},
|
|
3776
|
+
[vertical, trackLength, thumbLength, emitRange, min3, maxStart]
|
|
3777
|
+
);
|
|
3778
|
+
const handleThumbPointerDown = (event) => {
|
|
3779
|
+
if (event.button !== 0) {
|
|
3780
|
+
return;
|
|
3781
|
+
}
|
|
3782
|
+
const track = trackRef.current;
|
|
3783
|
+
if (!track) {
|
|
3784
|
+
return;
|
|
3785
|
+
}
|
|
3786
|
+
dragStateRef.current = {
|
|
3787
|
+
pointerId: event.pointerId,
|
|
3788
|
+
startCoord: vertical ? event.clientY : event.clientX,
|
|
3789
|
+
startRatio: thumbOffset,
|
|
3790
|
+
min: min3,
|
|
3791
|
+
max: max3,
|
|
3792
|
+
maxStart
|
|
3793
|
+
};
|
|
3794
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
3795
|
+
event.preventDefault();
|
|
3796
|
+
event.stopPropagation();
|
|
3797
|
+
};
|
|
3798
|
+
const handleThumbPointerMove = q2(
|
|
3799
|
+
(event) => {
|
|
3800
|
+
const state = dragStateRef.current;
|
|
3801
|
+
if (!state || state.pointerId !== event.pointerId) {
|
|
3802
|
+
return;
|
|
3803
|
+
}
|
|
3804
|
+
const [trackStart, trackLength2] = getTrackDimension(trackRef.current, vertical);
|
|
3805
|
+
const coordinate = vertical ? event.clientY : event.clientX;
|
|
3806
|
+
const delta = coordinate - state.startCoord;
|
|
3807
|
+
const ratio = state.startRatio + delta / trackLength2;
|
|
3808
|
+
const nextStart = clamp2(ratio * (state.max - state.min), 0, state.maxStart) + state.min;
|
|
3809
|
+
emitRange(nextStart);
|
|
3810
|
+
event.preventDefault();
|
|
3811
|
+
},
|
|
3812
|
+
[emitRange, vertical]
|
|
3813
|
+
);
|
|
3814
|
+
const handleThumbPointerUp = q2((event) => {
|
|
3815
|
+
const state = dragStateRef.current;
|
|
3816
|
+
if (state && state.pointerId === event.pointerId) {
|
|
3817
|
+
dragStateRef.current = null;
|
|
3818
|
+
thumbRef.current?.releasePointerCapture(event.pointerId);
|
|
3819
|
+
event.preventDefault();
|
|
3820
|
+
}
|
|
3821
|
+
}, []);
|
|
3822
|
+
const handleKeyDown = q2(
|
|
3823
|
+
(event) => {
|
|
3824
|
+
switch (event.key) {
|
|
3825
|
+
case "ArrowUp":
|
|
3826
|
+
case "ArrowLeft":
|
|
3827
|
+
if (vertical && event.key === "ArrowUp" || !vertical && event.key === "ArrowLeft") {
|
|
3828
|
+
emitRange(clampedStart - getEffectiveStep(step, range));
|
|
3829
|
+
event.preventDefault();
|
|
3830
|
+
}
|
|
3831
|
+
break;
|
|
3832
|
+
case "ArrowDown":
|
|
3833
|
+
case "ArrowRight":
|
|
3834
|
+
if (vertical && event.key === "ArrowDown" || !vertical && event.key === "ArrowRight") {
|
|
3835
|
+
emitRange(clampedStart + getEffectiveStep(step, range));
|
|
3836
|
+
event.preventDefault();
|
|
3837
|
+
}
|
|
3838
|
+
break;
|
|
3839
|
+
case "PageUp":
|
|
3840
|
+
emitRange(clampedStart - getEffectivePage(pageSize, rangeSize));
|
|
3841
|
+
event.preventDefault();
|
|
3842
|
+
break;
|
|
3843
|
+
case "PageDown":
|
|
3844
|
+
emitRange(clampedStart + getEffectivePage(pageSize, rangeSize));
|
|
3845
|
+
event.preventDefault();
|
|
3846
|
+
break;
|
|
3847
|
+
case "Home":
|
|
3848
|
+
emitRange(min3);
|
|
3849
|
+
event.preventDefault();
|
|
3850
|
+
break;
|
|
3851
|
+
case "End":
|
|
3852
|
+
emitRange(min3 + maxStart);
|
|
3853
|
+
event.preventDefault();
|
|
3854
|
+
break;
|
|
3855
|
+
default:
|
|
3856
|
+
break;
|
|
3857
|
+
}
|
|
3858
|
+
},
|
|
3859
|
+
[vertical, emitRange, clampedStart, step, range, pageSize, rangeSize, min3, maxStart]
|
|
3860
|
+
);
|
|
3861
|
+
const handleWheel = q2(
|
|
3862
|
+
(event) => {
|
|
3863
|
+
event.preventDefault();
|
|
3864
|
+
event.stopPropagation();
|
|
3865
|
+
if (maxStart === 0) {
|
|
3866
|
+
return;
|
|
3867
|
+
}
|
|
3868
|
+
let delta = vertical ? event.deltaY : event.deltaX;
|
|
3869
|
+
if (!vertical && delta === 0) {
|
|
3870
|
+
delta = event.deltaY;
|
|
3871
|
+
}
|
|
3872
|
+
if (event.deltaMode === WheelEvent.DOM_DELTA_LINE) {
|
|
3873
|
+
delta *= getEffectiveStep(step, range);
|
|
3874
|
+
} else if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) {
|
|
3875
|
+
delta *= getEffectivePage(pageSize, rangeSize);
|
|
3876
|
+
}
|
|
3877
|
+
if (delta === 0) {
|
|
3878
|
+
return;
|
|
3879
|
+
}
|
|
3880
|
+
emitRange(clampedStart + delta);
|
|
3881
|
+
},
|
|
3882
|
+
[emitRange, clampedStart, maxStart, vertical, step, range, pageSize, rangeSize]
|
|
3883
|
+
);
|
|
3884
|
+
_2(() => {
|
|
3885
|
+
setTrackLength(getTrackDimension(trackRef.current, vertical)[1]);
|
|
3886
|
+
}, [vertical]);
|
|
3887
|
+
_2(() => {
|
|
3888
|
+
const track = trackRef.current;
|
|
3889
|
+
if (!track) {
|
|
3890
|
+
return void 0;
|
|
3891
|
+
}
|
|
3892
|
+
const update = () => {
|
|
3893
|
+
setTrackLength(getTrackDimension(track, vertical)[1]);
|
|
3894
|
+
};
|
|
3895
|
+
update();
|
|
3896
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
3897
|
+
const observer = new ResizeObserver(update);
|
|
3898
|
+
observer.observe(track);
|
|
3899
|
+
return () => observer.disconnect();
|
|
3900
|
+
}
|
|
3901
|
+
if (typeof window !== "undefined") {
|
|
3902
|
+
window.addEventListener("resize", update);
|
|
3903
|
+
return () => window.removeEventListener("resize", update);
|
|
3904
|
+
}
|
|
3905
|
+
return void 0;
|
|
3906
|
+
}, [vertical]);
|
|
3907
|
+
y2(() => {
|
|
3908
|
+
const eventRoot = eventTarget ?? rootRef.current;
|
|
3909
|
+
if (!eventRoot)
|
|
3910
|
+
return void 0;
|
|
3911
|
+
eventRoot.addEventListener("keydown", handleKeyDown);
|
|
3912
|
+
eventRoot.addEventListener("wheel", handleWheel, wheelListenerOptions);
|
|
3913
|
+
return () => {
|
|
3914
|
+
eventRoot.removeEventListener("keydown", handleKeyDown);
|
|
3915
|
+
eventRoot.removeEventListener("wheel", handleWheel, wheelListenerOptions);
|
|
3916
|
+
};
|
|
3917
|
+
}, [eventTarget, handleKeyDown, handleWheel]);
|
|
3918
|
+
const decorationElements = T2(() => {
|
|
3919
|
+
if (!decorations.length || range <= 0) {
|
|
3920
|
+
return [];
|
|
3921
|
+
}
|
|
3922
|
+
return decorations.map((decoration, index) => {
|
|
3923
|
+
const [start, end] = decoration.position;
|
|
3924
|
+
const startRatio = (start - min3) / range;
|
|
3925
|
+
const endRatio = (end - min3) / range;
|
|
3926
|
+
const offsetPct = Math.round(startRatio * 1e3) / 10;
|
|
3927
|
+
const sizePct = Math.max(0, Math.round((endRatio - startRatio) * 1e3) / 10);
|
|
3928
|
+
const style = vertical ? {
|
|
3929
|
+
left: "0",
|
|
3930
|
+
width: "100%",
|
|
3931
|
+
top: `${offsetPct}%`,
|
|
3932
|
+
height: `${sizePct}%`
|
|
3933
|
+
} : {
|
|
3934
|
+
top: "0",
|
|
3935
|
+
height: "100%",
|
|
3936
|
+
left: `${offsetPct}%`,
|
|
3937
|
+
width: `${sizePct}%`
|
|
3938
|
+
};
|
|
3939
|
+
return /* @__PURE__ */ u2("div", { className: "deck-widget-range__decoration", style, children: decoration.element }, `decoration-${index}`);
|
|
3940
|
+
});
|
|
3941
|
+
}, [decorations, range, min3, vertical]);
|
|
3942
|
+
return /* @__PURE__ */ u2(
|
|
3943
|
+
"div",
|
|
3944
|
+
{
|
|
3945
|
+
ref: rootRef,
|
|
3946
|
+
tabIndex: 0,
|
|
3947
|
+
role: "scrollbar",
|
|
3948
|
+
"aria-valuemin": min3,
|
|
3949
|
+
"aria-valuemax": min3 + maxStart,
|
|
3950
|
+
"aria-valuenow": clampedStart,
|
|
3951
|
+
"aria-orientation": orientation,
|
|
3952
|
+
className: `${className} deck-widget-range deck-widget-range--${orientation} ${maxStart === 0 ? "deck-widget-range--disabled" : ""}`,
|
|
3953
|
+
children: [
|
|
3954
|
+
stepButtons && /* @__PURE__ */ u2(
|
|
3955
|
+
"button",
|
|
3956
|
+
{
|
|
3957
|
+
type: "button",
|
|
3958
|
+
className: "deck-widget-range__button deck-widget-range__button--start",
|
|
3959
|
+
"aria-label": startButtonAriaLabel,
|
|
3960
|
+
disabled: clampedStart <= min3,
|
|
3961
|
+
onClick: handleStepNegative,
|
|
3962
|
+
children: /* @__PURE__ */ u2("span", { className: "deck-widget-icon" })
|
|
3963
|
+
}
|
|
3964
|
+
),
|
|
3965
|
+
/* @__PURE__ */ u2("div", { className: "deck-widget-range__track", ref: trackRef, onClick: handleTrackClick, children: [
|
|
3966
|
+
/* @__PURE__ */ u2("div", { className: "deck-widget-range__decorations", children: decorationElements }),
|
|
3967
|
+
/* @__PURE__ */ u2(
|
|
3968
|
+
"div",
|
|
3969
|
+
{
|
|
3970
|
+
className: "deck-widget-range__thumb",
|
|
3971
|
+
"data-scrollbar-thumb": "true",
|
|
3972
|
+
ref: thumbRef,
|
|
3973
|
+
style: vertical ? { height: `${thumbLength * 100}%`, top: `${thumbOffset * 100}%` } : { width: `${thumbLength * 100}%`, left: `${thumbOffset * 100}%` },
|
|
3974
|
+
onPointerDown: handleThumbPointerDown,
|
|
3975
|
+
onPointerMove: handleThumbPointerMove,
|
|
3976
|
+
onPointerUp: handleThumbPointerUp,
|
|
3977
|
+
onPointerCancel: handleThumbPointerUp
|
|
3978
|
+
}
|
|
3979
|
+
)
|
|
3980
|
+
] }),
|
|
3981
|
+
stepButtons && /* @__PURE__ */ u2(
|
|
3982
|
+
"button",
|
|
3983
|
+
{
|
|
3984
|
+
type: "button",
|
|
3985
|
+
className: "deck-widget-range__button deck-widget-range__button--end",
|
|
3986
|
+
"aria-label": endButtonAriaLabel,
|
|
3987
|
+
disabled: clampedStart >= min3 + maxStart,
|
|
3988
|
+
onClick: handleStepPositive,
|
|
3989
|
+
children: /* @__PURE__ */ u2("span", { className: "deck-widget-icon" })
|
|
3990
|
+
}
|
|
3991
|
+
)
|
|
3992
|
+
]
|
|
3993
|
+
}
|
|
3994
|
+
);
|
|
3995
|
+
}
|
|
3996
|
+
|
|
3997
|
+
// src/scrollbar-widget.tsx
|
|
3998
|
+
var clamp3 = (value, min3, max3) => {
|
|
3999
|
+
if (value < min3) {
|
|
4000
|
+
return min3;
|
|
4001
|
+
}
|
|
4002
|
+
if (value > max3) {
|
|
4003
|
+
return max3;
|
|
4004
|
+
}
|
|
4005
|
+
return value;
|
|
4006
|
+
};
|
|
4007
|
+
var _ScrollbarWidget = class extends import_core15.Widget {
|
|
4008
|
+
constructor(props) {
|
|
4009
|
+
const resolved = {
|
|
4010
|
+
..._ScrollbarWidget.defaultProps,
|
|
4011
|
+
...props
|
|
4012
|
+
};
|
|
4013
|
+
super(resolved);
|
|
4014
|
+
this.className = "deck-widget-scrollbar";
|
|
4015
|
+
this.placement = "fill";
|
|
4016
|
+
this.contentSize = 0;
|
|
4017
|
+
this.viewportSize = 0;
|
|
4018
|
+
this.scrollOffset = 0;
|
|
4019
|
+
this.handleRangeChange = (nextValue) => {
|
|
4020
|
+
this.emitScroll(nextValue[0]);
|
|
4021
|
+
};
|
|
4022
|
+
this.viewId = resolved.viewId ?? null;
|
|
4023
|
+
}
|
|
4024
|
+
onViewportChange(viewport) {
|
|
4025
|
+
this.viewport = viewport;
|
|
4026
|
+
this.onRenderHTML();
|
|
4027
|
+
}
|
|
4028
|
+
onRenderHTML() {
|
|
4029
|
+
const element = this.rootElement;
|
|
4030
|
+
if (!element) {
|
|
4031
|
+
return;
|
|
4032
|
+
}
|
|
4033
|
+
element.dataset.placement = this.props.placement;
|
|
4034
|
+
const viewport = this.viewport;
|
|
4035
|
+
this.updateViewport(viewport);
|
|
4036
|
+
const clampedOffset = this.getClampedOffset();
|
|
4037
|
+
const wheelTarget = this.getWheelEventTarget(this.props.captureWheel ? "global" : "local");
|
|
4038
|
+
const decorations = this.getDecorations(viewport);
|
|
4039
|
+
const isVertical = this.isVertical();
|
|
4040
|
+
const startLabel = this.props.startButtonAriaLabel ?? (isVertical ? "Scroll up" : "Scroll left");
|
|
4041
|
+
const endLabel = this.props.endButtonAriaLabel ?? (isVertical ? "Scroll down" : "Scroll right");
|
|
4042
|
+
const ui = /* @__PURE__ */ u2(
|
|
4043
|
+
RangeInput,
|
|
4044
|
+
{
|
|
4045
|
+
min: 0,
|
|
4046
|
+
max: Math.max(0, this.contentSize),
|
|
4047
|
+
step: this.getEffectiveStep(),
|
|
4048
|
+
pageSize: this.getEffectivePage(),
|
|
4049
|
+
value: [clampedOffset, clampedOffset + this.viewportSize],
|
|
4050
|
+
orientation: this.props.orientation,
|
|
4051
|
+
stepButtons: true,
|
|
4052
|
+
startButtonAriaLabel: startLabel,
|
|
4053
|
+
endButtonAriaLabel: endLabel,
|
|
4054
|
+
eventTarget: wheelTarget,
|
|
4055
|
+
decorations,
|
|
4056
|
+
onChange: this.handleRangeChange
|
|
4057
|
+
}
|
|
4058
|
+
);
|
|
4059
|
+
B(ui, element);
|
|
4060
|
+
}
|
|
4061
|
+
onRemove() {
|
|
4062
|
+
if (this.rootElement) {
|
|
4063
|
+
B(null, this.rootElement);
|
|
4064
|
+
}
|
|
4065
|
+
super.onRemove();
|
|
4066
|
+
}
|
|
4067
|
+
updateViewport(viewport) {
|
|
4068
|
+
if (!viewport) {
|
|
4069
|
+
this.contentSize = 0;
|
|
4070
|
+
this.scrollOffset = 0;
|
|
4071
|
+
this.viewportSize = 0;
|
|
4072
|
+
return;
|
|
4073
|
+
}
|
|
4074
|
+
const { contentBounds } = this.props;
|
|
4075
|
+
const isVertical = this.isVertical();
|
|
4076
|
+
const projectedBounds = contentBounds ? projectBounds(contentBounds, viewport, isVertical) : [0, 0];
|
|
4077
|
+
this.contentSize = projectedBounds[1] - projectedBounds[0];
|
|
4078
|
+
this.scrollOffset = -projectedBounds[0];
|
|
4079
|
+
this.viewportSize = isVertical ? viewport.height : viewport.width;
|
|
4080
|
+
}
|
|
4081
|
+
getDecorations(viewport) {
|
|
4082
|
+
const { decorations = [], contentBounds } = this.props;
|
|
4083
|
+
if (!viewport || !contentBounds || decorations.length === 0) {
|
|
4084
|
+
return [];
|
|
1751
4085
|
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
4086
|
+
const isVertical = this.isVertical();
|
|
4087
|
+
const [contentStart] = projectBounds(contentBounds, viewport, isVertical);
|
|
4088
|
+
return decorations.map((decoration) => {
|
|
4089
|
+
const [start, end] = projectBounds(decoration.contentBounds, viewport, isVertical);
|
|
4090
|
+
const onClick = decoration.onClick ? (e3) => {
|
|
4091
|
+
const handled = decoration.onClick?.(e3);
|
|
4092
|
+
if (handled) {
|
|
4093
|
+
e3.stopPropagation();
|
|
4094
|
+
e3.preventDefault();
|
|
4095
|
+
}
|
|
4096
|
+
} : void 0;
|
|
4097
|
+
return {
|
|
4098
|
+
position: [start - contentStart, end - contentStart],
|
|
4099
|
+
element: /* @__PURE__ */ u2(
|
|
4100
|
+
"div",
|
|
4101
|
+
{
|
|
4102
|
+
style: {
|
|
4103
|
+
pointerEvents: onClick ? "all" : "none",
|
|
4104
|
+
width: "100%",
|
|
4105
|
+
height: "100%",
|
|
4106
|
+
backgroundColor: decoration.color
|
|
4107
|
+
},
|
|
4108
|
+
title: decoration.title,
|
|
4109
|
+
onClick
|
|
4110
|
+
}
|
|
4111
|
+
)
|
|
4112
|
+
};
|
|
4113
|
+
});
|
|
4114
|
+
}
|
|
4115
|
+
getWheelEventTarget(mode) {
|
|
4116
|
+
if (mode === null)
|
|
4117
|
+
return null;
|
|
4118
|
+
if (mode === "local")
|
|
4119
|
+
return this.rootElement;
|
|
4120
|
+
return this.deck?.props.parent || this.deck?.getCanvas()?.parentElement || this.rootElement;
|
|
4121
|
+
}
|
|
4122
|
+
getMaxScroll() {
|
|
4123
|
+
return Math.max(0, this.contentSize - this.viewportSize);
|
|
4124
|
+
}
|
|
4125
|
+
getClampedOffset() {
|
|
4126
|
+
const maxScroll = this.getMaxScroll();
|
|
4127
|
+
return clamp3(this.scrollOffset, 0, maxScroll);
|
|
4128
|
+
}
|
|
4129
|
+
isVertical() {
|
|
4130
|
+
return this.props.orientation !== "horizontal";
|
|
4131
|
+
}
|
|
4132
|
+
getEffectiveStep() {
|
|
4133
|
+
if (typeof this.props.stepSize === "number" && !Number.isNaN(this.props.stepSize)) {
|
|
4134
|
+
return this.props.stepSize;
|
|
1765
4135
|
}
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
4136
|
+
return Math.max(1, this.viewportSize / 10 || 1);
|
|
4137
|
+
}
|
|
4138
|
+
getEffectivePage() {
|
|
4139
|
+
if (typeof this.props.pageSize === "number" && !Number.isNaN(this.props.pageSize)) {
|
|
4140
|
+
return this.props.pageSize;
|
|
4141
|
+
}
|
|
4142
|
+
return this.viewportSize;
|
|
4143
|
+
}
|
|
4144
|
+
emitScroll(next) {
|
|
4145
|
+
const maxScroll = this.getMaxScroll();
|
|
4146
|
+
const target = clamp3(Math.round(next), 0, maxScroll);
|
|
4147
|
+
const viewport = this.viewport;
|
|
4148
|
+
if (viewport && target !== this.getClampedOffset()) {
|
|
4149
|
+
const pixel = viewport.project(viewport.position);
|
|
4150
|
+
if (this.isVertical()) {
|
|
4151
|
+
pixel[1] -= target - this.scrollOffset;
|
|
4152
|
+
} else {
|
|
4153
|
+
pixel[0] -= target - this.scrollOffset;
|
|
4154
|
+
}
|
|
4155
|
+
const { target: newTarget } = viewport.panByPosition(viewport.position, pixel);
|
|
4156
|
+
this.deck._onViewStateChange({
|
|
4157
|
+
viewId: viewport.id,
|
|
4158
|
+
viewState: {
|
|
4159
|
+
...this.getViewState(viewport.id),
|
|
4160
|
+
target: newTarget
|
|
4161
|
+
},
|
|
4162
|
+
interactionState: {}
|
|
4163
|
+
});
|
|
4164
|
+
}
|
|
4165
|
+
}
|
|
4166
|
+
};
|
|
4167
|
+
var ScrollbarWidget = _ScrollbarWidget;
|
|
4168
|
+
ScrollbarWidget.defaultProps = {
|
|
4169
|
+
...import_core15.Widget.defaultProps,
|
|
4170
|
+
contentBounds: null,
|
|
4171
|
+
placement: "top-right",
|
|
4172
|
+
viewId: null,
|
|
4173
|
+
orientation: "vertical",
|
|
4174
|
+
stepSize: null,
|
|
4175
|
+
pageSize: null,
|
|
4176
|
+
startButtonAriaLabel: "",
|
|
4177
|
+
endButtonAriaLabel: "",
|
|
4178
|
+
captureWheel: false,
|
|
4179
|
+
decorations: []
|
|
4180
|
+
};
|
|
4181
|
+
function projectBounds(bounds, viewport, isVertical) {
|
|
4182
|
+
return bounds.map(([x2, y3]) => viewport.project([x2, y3, 0])).reduce(
|
|
4183
|
+
(range, [x2, y3]) => {
|
|
4184
|
+
const value = isVertical ? y3 : x2;
|
|
4185
|
+
range[0] = Math.min(range[0], value);
|
|
4186
|
+
range[1] = Math.max(range[1], value);
|
|
4187
|
+
return range;
|
|
4188
|
+
},
|
|
4189
|
+
[Infinity, -Infinity]
|
|
4190
|
+
);
|
|
1795
4191
|
}
|
|
1796
4192
|
|
|
1797
|
-
// src/
|
|
1798
|
-
var
|
|
1799
|
-
|
|
4193
|
+
// src/icon-widget.tsx
|
|
4194
|
+
var import_core16 = __toESM(require_core(), 1);
|
|
4195
|
+
var IconWidget = class extends import_core16.Widget {
|
|
4196
|
+
constructor(props) {
|
|
1800
4197
|
super(props);
|
|
1801
|
-
this.className = "
|
|
4198
|
+
this.className = "";
|
|
1802
4199
|
this.placement = "top-left";
|
|
1803
|
-
this.handleSelectMode = (viewMode) => {
|
|
1804
|
-
this.viewMode = viewMode;
|
|
1805
|
-
this.updateHTML();
|
|
1806
|
-
this.props.onViewModeChange(viewMode);
|
|
1807
|
-
};
|
|
1808
|
-
this.viewMode = this.props.initialViewMode;
|
|
1809
4200
|
this.setProps(this.props);
|
|
1810
4201
|
}
|
|
1811
4202
|
setProps(props) {
|
|
1812
4203
|
this.placement = props.placement ?? this.placement;
|
|
1813
|
-
this.viewId = props.viewId
|
|
4204
|
+
this.viewId = props.viewId;
|
|
1814
4205
|
super.setProps(props);
|
|
1815
4206
|
}
|
|
1816
4207
|
onRenderHTML(rootElement) {
|
|
4208
|
+
const { className, style, icon, color, label, onClick } = this.props;
|
|
1817
4209
|
B(
|
|
1818
4210
|
/* @__PURE__ */ u2(
|
|
1819
|
-
|
|
4211
|
+
IconButton,
|
|
1820
4212
|
{
|
|
1821
|
-
className
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
onItemSelected: this.handleSelectMode
|
|
4213
|
+
className,
|
|
4214
|
+
style,
|
|
4215
|
+
color,
|
|
4216
|
+
icon,
|
|
4217
|
+
label,
|
|
4218
|
+
onClick
|
|
1828
4219
|
}
|
|
1829
4220
|
),
|
|
1830
4221
|
rootElement
|
|
1831
4222
|
);
|
|
1832
4223
|
}
|
|
1833
4224
|
};
|
|
1834
|
-
|
|
1835
|
-
...
|
|
1836
|
-
id: "
|
|
4225
|
+
IconWidget.defaultProps = {
|
|
4226
|
+
...import_core16.Widget.defaultProps,
|
|
4227
|
+
id: "icon",
|
|
1837
4228
|
placement: "top-left",
|
|
1838
4229
|
viewId: null,
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
4230
|
+
icon: "",
|
|
4231
|
+
label: "",
|
|
4232
|
+
color: "",
|
|
4233
|
+
onClick: void 0
|
|
1843
4234
|
};
|
|
1844
|
-
var ICON_STYLE = { width: "24px", height: "24px" };
|
|
1845
|
-
var ICONS = {
|
|
1846
|
-
single: () => /* @__PURE__ */ u2("svg", { width: "24", height: "24", style: ICON_STYLE, children: /* @__PURE__ */ u2(
|
|
1847
|
-
"rect",
|
|
1848
|
-
{
|
|
1849
|
-
x: "4",
|
|
1850
|
-
y: "4",
|
|
1851
|
-
width: "16",
|
|
1852
|
-
height: "16",
|
|
1853
|
-
stroke: "var(--button-icon-hover, rgb(24, 24, 26))",
|
|
1854
|
-
fill: "none",
|
|
1855
|
-
strokeWidth: "2"
|
|
1856
|
-
}
|
|
1857
|
-
) }),
|
|
1858
|
-
"split-horizontal": () => /* @__PURE__ */ u2("svg", { width: "24", height: "24", style: ICON_STYLE, children: [
|
|
1859
|
-
/* @__PURE__ */ u2(
|
|
1860
|
-
"rect",
|
|
1861
|
-
{
|
|
1862
|
-
x: "4",
|
|
1863
|
-
y: "4",
|
|
1864
|
-
width: "16",
|
|
1865
|
-
height: "7",
|
|
1866
|
-
stroke: "var(--button-icon-hover, rgb(24, 24, 26))",
|
|
1867
|
-
fill: "none",
|
|
1868
|
-
strokeWidth: "2"
|
|
1869
|
-
}
|
|
1870
|
-
),
|
|
1871
|
-
/* @__PURE__ */ u2(
|
|
1872
|
-
"rect",
|
|
1873
|
-
{
|
|
1874
|
-
x: "4",
|
|
1875
|
-
y: "13",
|
|
1876
|
-
width: "16",
|
|
1877
|
-
height: "7",
|
|
1878
|
-
stroke: "var(--button-icon-hover, rgb(24, 24, 26))",
|
|
1879
|
-
fill: "none",
|
|
1880
|
-
strokeWidth: "2"
|
|
1881
|
-
}
|
|
1882
|
-
)
|
|
1883
|
-
] }),
|
|
1884
|
-
"split-vertical": () => /* @__PURE__ */ u2("svg", { width: "24", height: "24", style: ICON_STYLE, children: [
|
|
1885
|
-
/* @__PURE__ */ u2(
|
|
1886
|
-
"rect",
|
|
1887
|
-
{
|
|
1888
|
-
x: "4",
|
|
1889
|
-
y: "4",
|
|
1890
|
-
width: "7",
|
|
1891
|
-
height: "16",
|
|
1892
|
-
stroke: "var(--button-icon-hover, rgb(24, 24, 26))",
|
|
1893
|
-
fill: "none",
|
|
1894
|
-
strokeWidth: "2"
|
|
1895
|
-
}
|
|
1896
|
-
),
|
|
1897
|
-
/* @__PURE__ */ u2(
|
|
1898
|
-
"rect",
|
|
1899
|
-
{
|
|
1900
|
-
x: "13",
|
|
1901
|
-
y: "4",
|
|
1902
|
-
width: "7",
|
|
1903
|
-
height: "16",
|
|
1904
|
-
stroke: "var(--button-icon-hover, rgb(24, 24, 26))",
|
|
1905
|
-
fill: "none",
|
|
1906
|
-
strokeWidth: "2"
|
|
1907
|
-
}
|
|
1908
|
-
)
|
|
1909
|
-
] })
|
|
1910
|
-
};
|
|
1911
|
-
var MENU_ITEMS = [
|
|
1912
|
-
{ value: "single", icon: ICONS.single, label: "Single View" },
|
|
1913
|
-
{ value: "split-horizontal", icon: ICONS["split-horizontal"], label: "Split Horizontal" },
|
|
1914
|
-
{ value: "split-vertical", icon: ICONS["split-vertical"], label: "Split Vertical" }
|
|
1915
|
-
];
|
|
1916
4235
|
|
|
1917
|
-
// src/
|
|
1918
|
-
var
|
|
1919
|
-
var
|
|
4236
|
+
// src/toggle-widget.tsx
|
|
4237
|
+
var import_core17 = __toESM(require_core(), 1);
|
|
4238
|
+
var ToggleWidget = class extends import_core17.Widget {
|
|
1920
4239
|
constructor(props) {
|
|
1921
4240
|
super(props);
|
|
1922
|
-
this.className = "deck-widget-
|
|
1923
|
-
this.placement = "
|
|
4241
|
+
this.className = "deck-widget-toggle";
|
|
4242
|
+
this.placement = "top-left";
|
|
4243
|
+
this._toggle = () => {
|
|
4244
|
+
this.checked = !this.checked;
|
|
4245
|
+
this.props.onChange?.(this.checked);
|
|
4246
|
+
this.updateHTML();
|
|
4247
|
+
};
|
|
4248
|
+
this.checked = this.props.initialChecked;
|
|
1924
4249
|
this.setProps(this.props);
|
|
1925
4250
|
}
|
|
1926
4251
|
setProps(props) {
|
|
1927
|
-
this.
|
|
4252
|
+
this.placement = props.placement ?? this.placement;
|
|
4253
|
+
this.viewId = props.viewId;
|
|
1928
4254
|
super.setProps(props);
|
|
1929
4255
|
}
|
|
1930
|
-
onCreateRootElement() {
|
|
1931
|
-
const element = super.onCreateRootElement();
|
|
1932
|
-
const style = { margin: "0px", top: "0px", left: "0px", position: "absolute" };
|
|
1933
|
-
Object.entries(style).forEach(([key, value]) => element.style.setProperty(key, value));
|
|
1934
|
-
return element;
|
|
1935
|
-
}
|
|
1936
|
-
onViewportChange(viewport) {
|
|
1937
|
-
this.viewport = viewport;
|
|
1938
|
-
this.updateHTML();
|
|
1939
|
-
}
|
|
1940
|
-
onHover(info) {
|
|
1941
|
-
if (this.props.mode === "hover" && this.props.getTooltip) {
|
|
1942
|
-
const tooltip = this.props.getTooltip(info, this);
|
|
1943
|
-
this.setProps({
|
|
1944
|
-
visible: tooltip !== null,
|
|
1945
|
-
...tooltip,
|
|
1946
|
-
style: { zIndex: "1", ...tooltip?.style }
|
|
1947
|
-
});
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
onClick(info) {
|
|
1951
|
-
if (this.props.mode === "click" && this.props.getTooltip) {
|
|
1952
|
-
const tooltip = this.props.getTooltip(info, this);
|
|
1953
|
-
this.setProps({
|
|
1954
|
-
visible: tooltip !== null,
|
|
1955
|
-
...tooltip
|
|
1956
|
-
});
|
|
1957
|
-
return tooltip !== null;
|
|
1958
|
-
}
|
|
1959
|
-
return this.props.onClick?.(this, info) || false;
|
|
1960
|
-
}
|
|
1961
|
-
onAdd({ deck, viewId }) {
|
|
1962
|
-
this.deck = deck;
|
|
1963
|
-
if (!viewId) {
|
|
1964
|
-
this.viewport = deck.getViewports()[0];
|
|
1965
|
-
} else {
|
|
1966
|
-
this.viewport = deck.getViewports().find((viewport) => viewport.id === viewId);
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
4256
|
onRenderHTML(rootElement) {
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
const
|
|
1981
|
-
|
|
4257
|
+
const {
|
|
4258
|
+
className,
|
|
4259
|
+
style,
|
|
4260
|
+
icon,
|
|
4261
|
+
label,
|
|
4262
|
+
color,
|
|
4263
|
+
onIcon = icon,
|
|
4264
|
+
onLabel = label,
|
|
4265
|
+
onColor = color
|
|
4266
|
+
} = this.props;
|
|
4267
|
+
const on = this.checked;
|
|
4268
|
+
rootElement.dataset.checked = String(on);
|
|
4269
|
+
B(
|
|
1982
4270
|
/* @__PURE__ */ u2(
|
|
1983
|
-
|
|
4271
|
+
IconButton,
|
|
1984
4272
|
{
|
|
1985
|
-
className
|
|
1986
|
-
style
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
...this.props.style
|
|
1992
|
-
},
|
|
1993
|
-
children: this.props.text
|
|
4273
|
+
className,
|
|
4274
|
+
style,
|
|
4275
|
+
icon: on ? onIcon : icon,
|
|
4276
|
+
label: on ? onLabel : label,
|
|
4277
|
+
color: on ? onColor : color,
|
|
4278
|
+
onClick: this._toggle
|
|
1994
4279
|
}
|
|
1995
4280
|
),
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
B(ui, rootElement);
|
|
1999
|
-
requestAnimationFrame(() => {
|
|
2000
|
-
if (!this.props.visible || !rootElement.firstChild || !this.viewport)
|
|
2001
|
-
return;
|
|
2002
|
-
const container = rootElement.firstChild;
|
|
2003
|
-
const contentEl = container.querySelector(".popup-content");
|
|
2004
|
-
const arrowEl = container.querySelector(".popup-arrow");
|
|
2005
|
-
if (!contentEl || !arrowEl)
|
|
2006
|
-
return;
|
|
2007
|
-
const contentRect = contentEl.getBoundingClientRect();
|
|
2008
|
-
const popupWidth = contentRect.width;
|
|
2009
|
-
const popupHeight = contentRect.height;
|
|
2010
|
-
let computedLeft = x2 - popupWidth / 2;
|
|
2011
|
-
let computedTop;
|
|
2012
|
-
if (isAbove) {
|
|
2013
|
-
computedTop = y3 - gap - arrowHeight - popupHeight;
|
|
2014
|
-
} else {
|
|
2015
|
-
computedTop = y3 + gap + arrowHeight;
|
|
2016
|
-
}
|
|
2017
|
-
if (computedLeft < minOffset) {
|
|
2018
|
-
computedLeft = minOffset;
|
|
2019
|
-
}
|
|
2020
|
-
if (computedLeft + popupWidth > this.viewport.width - minOffset) {
|
|
2021
|
-
computedLeft = this.viewport.width - minOffset - popupWidth;
|
|
2022
|
-
}
|
|
2023
|
-
if (isAbove) {
|
|
2024
|
-
if (computedTop < minOffset) {
|
|
2025
|
-
computedTop = minOffset;
|
|
2026
|
-
}
|
|
2027
|
-
} else if (computedTop + popupHeight + arrowHeight > this.viewport.height - minOffset) {
|
|
2028
|
-
computedTop = this.viewport.height - minOffset - popupHeight - arrowHeight;
|
|
2029
|
-
}
|
|
2030
|
-
container.style.left = `${computedLeft}px`;
|
|
2031
|
-
container.style.top = `${computedTop}px`;
|
|
2032
|
-
container.style.transform = "";
|
|
2033
|
-
let arrowLeft = x2 - computedLeft - arrowWidth / 2;
|
|
2034
|
-
arrowLeft = Math.max(arrowLeft, 0);
|
|
2035
|
-
arrowLeft = Math.min(arrowLeft, popupWidth - arrowWidth);
|
|
2036
|
-
if (isAbove) {
|
|
2037
|
-
arrowEl.style.left = `${arrowLeft}px`;
|
|
2038
|
-
arrowEl.style.bottom = `-${arrowHeight}px`;
|
|
2039
|
-
arrowEl.style.top = "";
|
|
2040
|
-
arrowEl.style.borderLeft = `${arrowWidth / 2}px solid transparent`;
|
|
2041
|
-
arrowEl.style.borderRight = `${arrowWidth / 2}px solid transparent`;
|
|
2042
|
-
arrowEl.style.borderTop = `${arrowHeight}px solid ${background}`;
|
|
2043
|
-
arrowEl.style.borderBottom = "";
|
|
2044
|
-
} else {
|
|
2045
|
-
arrowEl.style.left = `${arrowLeft}px`;
|
|
2046
|
-
arrowEl.style.top = `-${arrowHeight}px`;
|
|
2047
|
-
arrowEl.style.bottom = "";
|
|
2048
|
-
arrowEl.style.borderLeft = `${arrowWidth / 2}px solid transparent`;
|
|
2049
|
-
arrowEl.style.borderRight = `${arrowWidth / 2}px solid transparent`;
|
|
2050
|
-
arrowEl.style.borderBottom = `${arrowHeight}px solid ${background}`;
|
|
2051
|
-
arrowEl.style.borderTop = "";
|
|
2052
|
-
}
|
|
2053
|
-
});
|
|
4281
|
+
rootElement
|
|
4282
|
+
);
|
|
2054
4283
|
}
|
|
2055
4284
|
};
|
|
2056
|
-
|
|
2057
|
-
...
|
|
2058
|
-
id: "
|
|
2059
|
-
|
|
2060
|
-
text: "",
|
|
2061
|
-
visible: false,
|
|
2062
|
-
minOffset: 0,
|
|
4285
|
+
ToggleWidget.defaultProps = {
|
|
4286
|
+
...import_core17.Widget.defaultProps,
|
|
4287
|
+
id: "icon",
|
|
4288
|
+
placement: "top-left",
|
|
2063
4289
|
viewId: null,
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
// src/lib/components/simple-menu.tsx
|
|
2073
|
-
var MENU_STYLE = {
|
|
2074
|
-
position: "absolute",
|
|
2075
|
-
top: "100%",
|
|
2076
|
-
left: 0,
|
|
2077
|
-
background: "white",
|
|
2078
|
-
border: "1px solid #ccc",
|
|
2079
|
-
borderRadius: "4px",
|
|
2080
|
-
marginTop: "var(--menu-gap, 4px)",
|
|
2081
|
-
zIndex: 100
|
|
2082
|
-
};
|
|
2083
|
-
var MENU_ITEM_STYLE = {
|
|
2084
|
-
background: "white",
|
|
2085
|
-
border: "none",
|
|
2086
|
-
padding: "4px",
|
|
2087
|
-
cursor: "pointer",
|
|
2088
|
-
pointerEvents: "auto"
|
|
2089
|
-
};
|
|
2090
|
-
var SimpleMenu = (props) => {
|
|
2091
|
-
const { menuItems, onItemSelected, position, style } = props;
|
|
2092
|
-
const styleOverride = {
|
|
2093
|
-
...MENU_STYLE,
|
|
2094
|
-
...style,
|
|
2095
|
-
left: `${position.x}px`,
|
|
2096
|
-
top: `${position.y}px`
|
|
2097
|
-
};
|
|
2098
|
-
return /* @__PURE__ */ u2("div", { style: styleOverride, children: menuItems.map(({ key, label }) => /* @__PURE__ */ u2(
|
|
2099
|
-
"button",
|
|
2100
|
-
{
|
|
2101
|
-
style: { ...MENU_ITEM_STYLE, display: "block" },
|
|
2102
|
-
onClick: (_2) => onItemSelected(key),
|
|
2103
|
-
children: label
|
|
2104
|
-
},
|
|
2105
|
-
key
|
|
2106
|
-
)) });
|
|
4290
|
+
initialChecked: false,
|
|
4291
|
+
icon: "",
|
|
4292
|
+
onIcon: void 0,
|
|
4293
|
+
label: "",
|
|
4294
|
+
onLabel: void 0,
|
|
4295
|
+
color: "",
|
|
4296
|
+
onColor: void 0,
|
|
4297
|
+
onChange: void 0
|
|
2107
4298
|
};
|
|
2108
4299
|
|
|
2109
|
-
// src/
|
|
2110
|
-
var
|
|
2111
|
-
var
|
|
2112
|
-
var ContextMenuWidget = class extends import_core13.Widget {
|
|
4300
|
+
// src/selector-widget.tsx
|
|
4301
|
+
var import_core18 = __toESM(require_core(), 1);
|
|
4302
|
+
var SelectorWidget = class extends import_core18.Widget {
|
|
2113
4303
|
constructor(props) {
|
|
2114
4304
|
super(props);
|
|
2115
|
-
this.className = "deck-widget-
|
|
2116
|
-
this.placement = "
|
|
2117
|
-
this.
|
|
2118
|
-
this.
|
|
4305
|
+
this.className = "deck-widget-selector";
|
|
4306
|
+
this.placement = "top-left";
|
|
4307
|
+
this.isOpen = false;
|
|
4308
|
+
this._toggleMenu = () => {
|
|
4309
|
+
if (this.isOpen) {
|
|
4310
|
+
this.isOpen = false;
|
|
4311
|
+
} else if (this.rootElement) {
|
|
4312
|
+
this.isOpen = {
|
|
4313
|
+
x: this.rootElement.offsetLeft,
|
|
4314
|
+
y: this.rootElement.offsetTop,
|
|
4315
|
+
placement: this.props.placement.includes("right") ? "left-start" : "right-start"
|
|
4316
|
+
};
|
|
4317
|
+
}
|
|
4318
|
+
this.updateHTML();
|
|
4319
|
+
};
|
|
4320
|
+
this._handleSelectMode = (value) => {
|
|
4321
|
+
this.value = value;
|
|
4322
|
+
this.props.onChange(value);
|
|
4323
|
+
this.updateHTML();
|
|
4324
|
+
};
|
|
4325
|
+
this.value = this.props.initialValue;
|
|
2119
4326
|
this.setProps(this.props);
|
|
2120
4327
|
}
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
margin: "0px",
|
|
2126
|
-
top: "0px",
|
|
2127
|
-
left: "0px",
|
|
2128
|
-
position: "absolute",
|
|
2129
|
-
pointerEvents: "auto"
|
|
2130
|
-
};
|
|
2131
|
-
Object.entries(style).forEach(([key, value]) => element.style.setProperty(key, value));
|
|
2132
|
-
deck.getCanvas()?.addEventListener("click", () => this.hide());
|
|
2133
|
-
deck.getCanvas()?.addEventListener("contextmenu", (event) => this.handleContextMenu(event));
|
|
2134
|
-
return element;
|
|
4328
|
+
setProps(props) {
|
|
4329
|
+
this.placement = props.placement ?? this.placement;
|
|
4330
|
+
this.viewId = props.viewId ?? this.viewId;
|
|
4331
|
+
super.setProps(props);
|
|
2135
4332
|
}
|
|
2136
4333
|
onRenderHTML(rootElement) {
|
|
2137
|
-
const
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
});
|
|
2162
|
-
this.updateHTML();
|
|
2163
|
-
srcEvent.preventDefault();
|
|
2164
|
-
return visible;
|
|
2165
|
-
}
|
|
2166
|
-
return false;
|
|
2167
|
-
}
|
|
2168
|
-
hide() {
|
|
2169
|
-
this.setProps({ visible: false });
|
|
4334
|
+
const selectedOption = this.props.options.find((opt) => opt.value === this.value) ?? this.props.options[0];
|
|
4335
|
+
B(
|
|
4336
|
+
/* @__PURE__ */ u2("div", { children: [
|
|
4337
|
+
/* @__PURE__ */ u2(
|
|
4338
|
+
IconButton,
|
|
4339
|
+
{
|
|
4340
|
+
icon: selectedOption.icon,
|
|
4341
|
+
label: selectedOption.label,
|
|
4342
|
+
onClick: this._toggleMenu
|
|
4343
|
+
}
|
|
4344
|
+
),
|
|
4345
|
+
this.isOpen && /* @__PURE__ */ u2(Popover, { ...this.isOpen, children: /* @__PURE__ */ u2(
|
|
4346
|
+
SimpleMenu,
|
|
4347
|
+
{
|
|
4348
|
+
isOpen: true,
|
|
4349
|
+
style: { pointerEvents: "auto", position: "static" },
|
|
4350
|
+
menuItems: this.props.options,
|
|
4351
|
+
onSelect: this._handleSelectMode,
|
|
4352
|
+
onClose: this._toggleMenu
|
|
4353
|
+
}
|
|
4354
|
+
) })
|
|
4355
|
+
] }),
|
|
4356
|
+
rootElement
|
|
4357
|
+
);
|
|
2170
4358
|
}
|
|
2171
4359
|
};
|
|
2172
|
-
|
|
2173
|
-
...
|
|
2174
|
-
id: "
|
|
4360
|
+
SelectorWidget.defaultProps = {
|
|
4361
|
+
...import_core18.Widget.defaultProps,
|
|
4362
|
+
id: "view-selector",
|
|
4363
|
+
placement: "top-left",
|
|
2175
4364
|
viewId: null,
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
// eslint-disable-next-line no-console
|
|
2181
|
-
onMenuItemSelected: (key, pickInfo) => console.log("Context menu item selected:", key, pickInfo)
|
|
4365
|
+
initialValue: "",
|
|
4366
|
+
options: [],
|
|
4367
|
+
onChange: () => {
|
|
4368
|
+
}
|
|
2182
4369
|
};
|
|
2183
4370
|
|
|
2184
4371
|
// src/timeline-widget.tsx
|
|
2185
|
-
var
|
|
2186
|
-
var TimelineWidget = class extends
|
|
4372
|
+
var import_core19 = __toESM(require_core(), 1);
|
|
4373
|
+
var TimelineWidget = class extends import_core19.Widget {
|
|
2187
4374
|
constructor(props = {}) {
|
|
2188
4375
|
super(props);
|
|
2189
4376
|
this.id = "timeline";
|
|
2190
4377
|
this.className = "deck-widget-timeline";
|
|
2191
|
-
this.placement = "
|
|
4378
|
+
this.placement = "fill";
|
|
2192
4379
|
this.playing = false;
|
|
2193
4380
|
this.timerId = null;
|
|
2194
4381
|
this.handlePlayPause = () => {
|
|
2195
4382
|
if (this.playing) {
|
|
2196
4383
|
this.stop();
|
|
2197
4384
|
} else {
|
|
2198
|
-
this.
|
|
4385
|
+
this.play();
|
|
2199
4386
|
}
|
|
2200
4387
|
};
|
|
2201
|
-
this.
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
this.
|
|
2205
|
-
this.props.onTimeChange(val);
|
|
4388
|
+
this.handleTimeChange = ([value]) => {
|
|
4389
|
+
this.currentTime = value;
|
|
4390
|
+
this.props.timeline?.setTime(value);
|
|
4391
|
+
this.props.onTimeChange(value);
|
|
2206
4392
|
this.updateHTML();
|
|
2207
4393
|
};
|
|
2208
4394
|
this.tick = () => {
|
|
2209
|
-
const
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
4395
|
+
const {
|
|
4396
|
+
timeRange: [min3, max3],
|
|
4397
|
+
step,
|
|
4398
|
+
loop
|
|
4399
|
+
} = this.props;
|
|
4400
|
+
if (step > 0) {
|
|
4401
|
+
let next = Math.round(this.currentTime / step) * step + step;
|
|
4402
|
+
if (next > max3) {
|
|
4403
|
+
if (this.currentTime < max3) {
|
|
4404
|
+
next = max3;
|
|
4405
|
+
} else if (loop) {
|
|
4406
|
+
next = min3;
|
|
4407
|
+
} else {
|
|
4408
|
+
next = max3;
|
|
4409
|
+
this.playing = false;
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
this.currentTime = next;
|
|
4413
|
+
this.props.onTimeChange(next);
|
|
4414
|
+
this.updateHTML();
|
|
2213
4415
|
}
|
|
2214
|
-
this.currentTime = next;
|
|
2215
|
-
this.props.onTimeChange(next);
|
|
2216
|
-
this.updateHTML();
|
|
2217
4416
|
if (this.playing) {
|
|
2218
4417
|
this.timerId = window.setTimeout(this.tick, this.props.playInterval);
|
|
4418
|
+
} else {
|
|
4419
|
+
this.timerId = null;
|
|
2219
4420
|
}
|
|
2220
4421
|
};
|
|
2221
4422
|
this.currentTime = this.props.initialTime ?? this.props.timeRange[0];
|
|
4423
|
+
this.props.timeline?.setTime(this.currentTime);
|
|
2222
4424
|
this.setProps(this.props);
|
|
2223
4425
|
}
|
|
2224
4426
|
setProps(props) {
|
|
2225
|
-
this.placement = props.placement ?? this.placement;
|
|
2226
4427
|
this.viewId = props.viewId ?? this.viewId;
|
|
2227
4428
|
super.setProps(props);
|
|
2228
4429
|
}
|
|
2229
4430
|
onAdd() {
|
|
2230
4431
|
this.playing = false;
|
|
2231
4432
|
this.timerId = null;
|
|
4433
|
+
if (this.props.autoPlay)
|
|
4434
|
+
this.play();
|
|
2232
4435
|
}
|
|
2233
4436
|
onRemove() {
|
|
2234
4437
|
this.stop();
|
|
2235
4438
|
}
|
|
2236
4439
|
onRenderHTML(rootElement) {
|
|
4440
|
+
const { timeRange, step, formatLabel } = this.props;
|
|
4441
|
+
const currentTime = this.currentTime;
|
|
4442
|
+
rootElement.dataset.placement = this.props.placement;
|
|
2237
4443
|
B(
|
|
2238
|
-
/* @__PURE__ */ u2("div", {
|
|
2239
|
-
|
|
4444
|
+
/* @__PURE__ */ u2("div", { className: "deck-widget-button-group", children: [
|
|
4445
|
+
this.playing ? /* @__PURE__ */ u2(
|
|
4446
|
+
IconButton,
|
|
4447
|
+
{
|
|
4448
|
+
label: "Pause",
|
|
4449
|
+
className: "deck-widget-timeline-pause",
|
|
4450
|
+
onClick: this.handlePlayPause
|
|
4451
|
+
}
|
|
4452
|
+
) : /* @__PURE__ */ u2(
|
|
4453
|
+
IconButton,
|
|
4454
|
+
{
|
|
4455
|
+
label: "Play",
|
|
4456
|
+
className: "deck-widget-timeline-play",
|
|
4457
|
+
onClick: this.handlePlayPause
|
|
4458
|
+
}
|
|
4459
|
+
),
|
|
2240
4460
|
/* @__PURE__ */ u2(
|
|
2241
|
-
|
|
4461
|
+
RangeInput,
|
|
2242
4462
|
{
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
4463
|
+
min: timeRange[0],
|
|
4464
|
+
max: timeRange[1],
|
|
4465
|
+
orientation: "horizontal",
|
|
4466
|
+
step,
|
|
4467
|
+
value: [currentTime, currentTime],
|
|
4468
|
+
onChange: this.handleTimeChange,
|
|
4469
|
+
decorations: [
|
|
4470
|
+
{
|
|
4471
|
+
position: [currentTime, currentTime + step],
|
|
4472
|
+
element: /* @__PURE__ */ u2("div", { className: "deck-widget-timeline-label deck-widget-timeline-label--current", children: formatLabel(currentTime) })
|
|
4473
|
+
}
|
|
4474
|
+
]
|
|
2250
4475
|
}
|
|
2251
4476
|
)
|
|
2252
4477
|
] }),
|
|
2253
4478
|
rootElement
|
|
2254
4479
|
);
|
|
2255
4480
|
}
|
|
2256
|
-
|
|
4481
|
+
play() {
|
|
2257
4482
|
this.playing = true;
|
|
4483
|
+
const {
|
|
4484
|
+
timeRange: [min3, max3]
|
|
4485
|
+
} = this.props;
|
|
4486
|
+
if (this.currentTime >= max3) {
|
|
4487
|
+
this.currentTime = min3;
|
|
4488
|
+
this.props.onTimeChange(min3);
|
|
4489
|
+
}
|
|
2258
4490
|
this.updateHTML();
|
|
2259
4491
|
this.tick();
|
|
2260
4492
|
}
|
|
@@ -2268,21 +4500,25 @@ var __exports__ = (() => {
|
|
|
2268
4500
|
}
|
|
2269
4501
|
};
|
|
2270
4502
|
TimelineWidget.defaultProps = {
|
|
2271
|
-
...
|
|
4503
|
+
...import_core19.Widget.defaultProps,
|
|
2272
4504
|
id: "timeline",
|
|
2273
4505
|
placement: "bottom-left",
|
|
2274
4506
|
viewId: null,
|
|
4507
|
+
timeline: null,
|
|
2275
4508
|
timeRange: [0, 100],
|
|
2276
4509
|
step: 1,
|
|
2277
4510
|
initialTime: void 0,
|
|
2278
4511
|
onTimeChange: () => {
|
|
2279
4512
|
},
|
|
2280
|
-
|
|
4513
|
+
autoPlay: false,
|
|
4514
|
+
loop: false,
|
|
4515
|
+
playInterval: 1e3,
|
|
4516
|
+
formatLabel: String
|
|
2281
4517
|
};
|
|
2282
4518
|
|
|
2283
4519
|
// src/screenshot-widget.tsx
|
|
2284
|
-
var
|
|
2285
|
-
var ScreenshotWidget = class extends
|
|
4520
|
+
var import_core20 = __toESM(require_core(), 1);
|
|
4521
|
+
var ScreenshotWidget = class extends import_core20.Widget {
|
|
2286
4522
|
constructor(props = {}) {
|
|
2287
4523
|
super(props);
|
|
2288
4524
|
this.className = "deck-widget-screenshot";
|
|
@@ -2331,7 +4567,7 @@ var __exports__ = (() => {
|
|
|
2331
4567
|
}
|
|
2332
4568
|
};
|
|
2333
4569
|
ScreenshotWidget.defaultProps = {
|
|
2334
|
-
...
|
|
4570
|
+
...import_core20.Widget.defaultProps,
|
|
2335
4571
|
id: "screenshot",
|
|
2336
4572
|
placement: "top-left",
|
|
2337
4573
|
viewId: null,
|
|
@@ -2342,8 +4578,8 @@ var __exports__ = (() => {
|
|
|
2342
4578
|
};
|
|
2343
4579
|
|
|
2344
4580
|
// src/theme-widget.tsx
|
|
2345
|
-
var
|
|
2346
|
-
var
|
|
4581
|
+
var import_core21 = __toESM(require_core(), 1);
|
|
4582
|
+
var import_core22 = __toESM(require_core(), 1);
|
|
2347
4583
|
|
|
2348
4584
|
// src/themes.ts
|
|
2349
4585
|
var LightTheme = {
|
|
@@ -2366,7 +4602,13 @@ var __exports__ = (() => {
|
|
|
2366
4602
|
"--menu-border": "unset",
|
|
2367
4603
|
"--menu-shadow": "0px 0px 8px 0px rgba(0, 0, 0, 0.25)",
|
|
2368
4604
|
"--menu-text": "rgb(24, 24, 26, 1)",
|
|
2369
|
-
"--menu-item-hover": "rgba(0, 0, 0, 0.08)"
|
|
4605
|
+
"--menu-item-hover": "rgba(0, 0, 0, 0.08)",
|
|
4606
|
+
"--range-step-button-size": "24px",
|
|
4607
|
+
"--range-track-size": "16px",
|
|
4608
|
+
"--range-thumb-size": "10px",
|
|
4609
|
+
"--range-track-color": "#d8d8e5",
|
|
4610
|
+
"--range-thumb-color": "#616166",
|
|
4611
|
+
"--range-decoration-active-color": "#f8dd50"
|
|
2370
4612
|
};
|
|
2371
4613
|
var DarkTheme = {
|
|
2372
4614
|
"--widget-margin": "12px",
|
|
@@ -2388,7 +4630,13 @@ var __exports__ = (() => {
|
|
|
2388
4630
|
"--menu-border": "unset",
|
|
2389
4631
|
"--menu-shadow": "0px 0px 8px 0px rgba(0, 0, 0, 0.25)",
|
|
2390
4632
|
"--menu-text": "rgb(215, 214, 229, 1)",
|
|
2391
|
-
"--menu-item-hover": "rgba(255, 255, 255, 0.1)"
|
|
4633
|
+
"--menu-item-hover": "rgba(255, 255, 255, 0.1)",
|
|
4634
|
+
"--range-step-button-size": "24px",
|
|
4635
|
+
"--range-track-size": "16px",
|
|
4636
|
+
"--range-thumb-size": "10px",
|
|
4637
|
+
"--range-track-color": "#2c2c30",
|
|
4638
|
+
"--range-thumb-color": "#9e9da8",
|
|
4639
|
+
"--range-decoration-active-color": "#dd7d2c"
|
|
2392
4640
|
};
|
|
2393
4641
|
var LightGlassTheme = {
|
|
2394
4642
|
"--widget-margin": "12px",
|
|
@@ -2410,7 +4658,13 @@ var __exports__ = (() => {
|
|
|
2410
4658
|
"--menu-border": "1px solid rgba(255, 255, 255, 0.6)",
|
|
2411
4659
|
"--menu-shadow": "0px 0px 8px 0px rgba(0, 0, 0, 0.25), 0px 0px 8px 0px rgba(0, 0, 0, 0.1) inset",
|
|
2412
4660
|
"--menu-text": "rgb(24, 24, 26, 1)",
|
|
2413
|
-
"--menu-item-hover": "rgba(0, 0, 0, 0.08)"
|
|
4661
|
+
"--menu-item-hover": "rgba(0, 0, 0, 0.08)",
|
|
4662
|
+
"--range-step-button-size": "24px",
|
|
4663
|
+
"--range-track-size": "16px",
|
|
4664
|
+
"--range-thumb-size": "10px",
|
|
4665
|
+
"--range-track-color": "rgba(215, 214, 229, 0.3)",
|
|
4666
|
+
"--range-thumb-color": "rgba(97, 97, 102, 1)",
|
|
4667
|
+
"--range-decoration-active-color": "rgba(255, 215, 0, 0.6)"
|
|
2414
4668
|
};
|
|
2415
4669
|
var DarkGlassTheme = {
|
|
2416
4670
|
"--widget-margin": "12px",
|
|
@@ -2432,11 +4686,17 @@ var __exports__ = (() => {
|
|
|
2432
4686
|
"--menu-border": "1px solid rgba(18, 18, 20, 0.75)",
|
|
2433
4687
|
"--menu-shadow": "0px 0px 8px 0px rgba(0, 0, 0, 0.25), 0px 0px 8px 0px rgba(0, 0, 0, 0.1) inset",
|
|
2434
4688
|
"--menu-text": "rgb(215, 214, 229, 1)",
|
|
2435
|
-
"--menu-item-hover": "rgba(255, 255, 255, 0.1)"
|
|
4689
|
+
"--menu-item-hover": "rgba(255, 255, 255, 0.1)",
|
|
4690
|
+
"--range-step-button-size": "24px",
|
|
4691
|
+
"--range-track-size": "16px",
|
|
4692
|
+
"--range-thumb-size": "10px",
|
|
4693
|
+
"--range-track-color": "rgba(24, 24, 26, 0.3)",
|
|
4694
|
+
"--range-thumb-color": "rgba(158, 157, 168, 1)",
|
|
4695
|
+
"--range-decoration-active-color": "rgba(255, 145, 0, 0.6)"
|
|
2436
4696
|
};
|
|
2437
4697
|
|
|
2438
4698
|
// src/theme-widget.tsx
|
|
2439
|
-
var ThemeWidget = class extends
|
|
4699
|
+
var ThemeWidget = class extends import_core22.Widget {
|
|
2440
4700
|
constructor(props = {}) {
|
|
2441
4701
|
super(props);
|
|
2442
4702
|
this.className = "deck-widget-theme";
|
|
@@ -2453,17 +4713,17 @@ var __exports__ = (() => {
|
|
|
2453
4713
|
super.setProps(props);
|
|
2454
4714
|
switch (this.themeMode) {
|
|
2455
4715
|
case "light":
|
|
2456
|
-
if (props.lightModeTheme && !(0,
|
|
4716
|
+
if (props.lightModeTheme && !(0, import_core21._deepEqual)(props.lightModeTheme, lightModeTheme, 1)) {
|
|
2457
4717
|
this._setThemeMode("light");
|
|
2458
4718
|
}
|
|
2459
4719
|
break;
|
|
2460
4720
|
case "dark":
|
|
2461
|
-
if (props.darkModeTheme && !(0,
|
|
4721
|
+
if (props.darkModeTheme && !(0, import_core21._deepEqual)(props.darkModeTheme, darkModeTheme, 1)) {
|
|
2462
4722
|
this._setThemeMode("dark");
|
|
2463
4723
|
}
|
|
2464
4724
|
break;
|
|
2465
4725
|
default:
|
|
2466
|
-
|
|
4726
|
+
import_core21.log.warn(`Invalid theme mode ${this.themeMode}`)();
|
|
2467
4727
|
}
|
|
2468
4728
|
}
|
|
2469
4729
|
onRenderHTML(rootElement) {
|
|
@@ -2492,20 +4752,26 @@ var __exports__ = (() => {
|
|
|
2492
4752
|
const container = this.rootElement?.closest(".deck-widget-container");
|
|
2493
4753
|
if (container) {
|
|
2494
4754
|
const themeStyle = themeMode === "dark" ? this.props.darkModeTheme : this.props.lightModeTheme;
|
|
2495
|
-
(0,
|
|
4755
|
+
(0, import_core21._applyStyles)(container, themeStyle);
|
|
2496
4756
|
const label = this.themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
|
|
2497
|
-
|
|
4757
|
+
import_core21.log.log(1, `Switched theme to ${label}`, themeStyle)();
|
|
2498
4758
|
this.updateHTML();
|
|
2499
4759
|
}
|
|
2500
4760
|
}
|
|
2501
4761
|
/** Read browser preference */
|
|
2502
4762
|
_getInitialThemeMode() {
|
|
2503
4763
|
const { initialThemeMode } = this.props;
|
|
2504
|
-
|
|
4764
|
+
if (initialThemeMode !== "auto") {
|
|
4765
|
+
return initialThemeMode;
|
|
4766
|
+
}
|
|
4767
|
+
if (typeof window === "undefined") {
|
|
4768
|
+
return "light";
|
|
4769
|
+
}
|
|
4770
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2505
4771
|
}
|
|
2506
4772
|
};
|
|
2507
4773
|
ThemeWidget.defaultProps = {
|
|
2508
|
-
...
|
|
4774
|
+
...import_core22.Widget.defaultProps,
|
|
2509
4775
|
id: "theme",
|
|
2510
4776
|
placement: "top-left",
|
|
2511
4777
|
viewId: null,
|
|
@@ -2517,8 +4783,8 @@ var __exports__ = (() => {
|
|
|
2517
4783
|
};
|
|
2518
4784
|
|
|
2519
4785
|
// src/loading-widget.tsx
|
|
2520
|
-
var
|
|
2521
|
-
var LoadingWidget = class extends
|
|
4786
|
+
var import_core23 = __toESM(require_core(), 1);
|
|
4787
|
+
var LoadingWidget = class extends import_core23.Widget {
|
|
2522
4788
|
constructor(props = {}) {
|
|
2523
4789
|
super(props);
|
|
2524
4790
|
this.className = "deck-widget-loading";
|
|
@@ -2557,67 +4823,16 @@ var __exports__ = (() => {
|
|
|
2557
4823
|
}
|
|
2558
4824
|
};
|
|
2559
4825
|
LoadingWidget.defaultProps = {
|
|
2560
|
-
...
|
|
4826
|
+
...import_core23.Widget.defaultProps,
|
|
2561
4827
|
id: "loading",
|
|
2562
4828
|
placement: "top-left",
|
|
2563
4829
|
viewId: null,
|
|
2564
4830
|
label: "Loading layer data"
|
|
2565
4831
|
};
|
|
2566
4832
|
|
|
2567
|
-
// src/fps-widget.tsx
|
|
2568
|
-
var import_core19 = __toESM(require_core(), 1);
|
|
2569
|
-
var FpsWidget = class extends import_core19.Widget {
|
|
2570
|
-
constructor(props = {}) {
|
|
2571
|
-
super(props);
|
|
2572
|
-
this.className = "deck-widget-fps";
|
|
2573
|
-
this.placement = "top-left";
|
|
2574
|
-
this._lastFps = -1;
|
|
2575
|
-
this.setProps(this.props);
|
|
2576
|
-
}
|
|
2577
|
-
setProps(props) {
|
|
2578
|
-
this.placement = props.placement ?? this.placement;
|
|
2579
|
-
this.viewId = props.viewId ?? this.viewId;
|
|
2580
|
-
super.setProps(props);
|
|
2581
|
-
}
|
|
2582
|
-
onAdd({}) {
|
|
2583
|
-
this._lastFps = this._getFps();
|
|
2584
|
-
requestAnimationFrame(() => this._animate());
|
|
2585
|
-
}
|
|
2586
|
-
onRenderHTML(rootElement) {
|
|
2587
|
-
const fps = this._getFps();
|
|
2588
|
-
B(
|
|
2589
|
-
/* @__PURE__ */ u2(IconButton, { children: /* @__PURE__ */ u2("div", { className: "text", children: [
|
|
2590
|
-
"FPS",
|
|
2591
|
-
/* @__PURE__ */ u2("br", {}),
|
|
2592
|
-
fps
|
|
2593
|
-
] }) }),
|
|
2594
|
-
rootElement
|
|
2595
|
-
);
|
|
2596
|
-
}
|
|
2597
|
-
_animate() {
|
|
2598
|
-
const fps = this._getFps();
|
|
2599
|
-
if (this._lastFps !== fps) {
|
|
2600
|
-
this._lastFps = fps;
|
|
2601
|
-
this.updateHTML();
|
|
2602
|
-
}
|
|
2603
|
-
requestAnimationFrame(() => this._animate());
|
|
2604
|
-
}
|
|
2605
|
-
_getFps() {
|
|
2606
|
-
return Math.round(this.deck?.metrics.fps ?? 0);
|
|
2607
|
-
}
|
|
2608
|
-
};
|
|
2609
|
-
FpsWidget.defaultProps = {
|
|
2610
|
-
...import_core19.Widget.defaultProps,
|
|
2611
|
-
id: "fps",
|
|
2612
|
-
placement: "top-left",
|
|
2613
|
-
viewId: null
|
|
2614
|
-
};
|
|
2615
|
-
|
|
2616
4833
|
// src/stats-widget.tsx
|
|
2617
|
-
var
|
|
2618
|
-
var
|
|
2619
|
-
var RIGHT_ARROW = "\u25B6";
|
|
2620
|
-
var DOWN_ARROW = "\u2B07";
|
|
4834
|
+
var import_core24 = __toESM(require_core(), 1);
|
|
4835
|
+
var import_core25 = __toESM(require_core2(), 1);
|
|
2621
4836
|
var DEFAULT_COUNT_FORMATTER = (stat) => `${stat.name}: ${stat.count}`;
|
|
2622
4837
|
function formatTime(time) {
|
|
2623
4838
|
return time < 1e3 ? `${time.toFixed(2)}ms` : `${(time / 1e3).toFixed(2)}s`;
|
|
@@ -2633,7 +4848,7 @@ var __exports__ = (() => {
|
|
|
2633
4848
|
fps: (stat) => `${stat.name}: ${Math.round(stat.getHz())}fps`,
|
|
2634
4849
|
memory: (stat) => `${stat.name}: ${formatMemory(stat.count)}`
|
|
2635
4850
|
};
|
|
2636
|
-
var StatsWidget = class extends
|
|
4851
|
+
var StatsWidget = class extends import_core24.Widget {
|
|
2637
4852
|
constructor(props = {}) {
|
|
2638
4853
|
super(props);
|
|
2639
4854
|
this.className = "deck-widget-stats";
|
|
@@ -2644,8 +4859,12 @@ var __exports__ = (() => {
|
|
|
2644
4859
|
this.collapsed = !this.collapsed;
|
|
2645
4860
|
this.updateHTML();
|
|
2646
4861
|
};
|
|
4862
|
+
this._getFps = () => {
|
|
4863
|
+
return Math.round(this.deck?.metrics.fps ?? 0);
|
|
4864
|
+
};
|
|
2647
4865
|
this._formatters = { ...DEFAULT_FORMATTERS };
|
|
2648
4866
|
this._resetOnUpdate = { ...this.props.resetOnUpdate };
|
|
4867
|
+
this.collapsed = !props.defaultIsExpanded;
|
|
2649
4868
|
this.setProps(props);
|
|
2650
4869
|
}
|
|
2651
4870
|
setProps(props) {
|
|
@@ -2662,15 +4881,21 @@ var __exports__ = (() => {
|
|
|
2662
4881
|
}
|
|
2663
4882
|
super.setProps(props);
|
|
2664
4883
|
}
|
|
2665
|
-
|
|
2666
|
-
this.
|
|
4884
|
+
onRemove() {
|
|
4885
|
+
if (this.rootElement) {
|
|
4886
|
+
B(null, this.rootElement);
|
|
4887
|
+
}
|
|
2667
4888
|
}
|
|
2668
4889
|
onRenderHTML(rootElement) {
|
|
2669
|
-
const stats = this._getStats();
|
|
2670
4890
|
const collapsed = this.collapsed;
|
|
4891
|
+
if (collapsed) {
|
|
4892
|
+
B(/* @__PURE__ */ u2(FpsIcon, { getFps: this._getFps, onClick: this._toggleCollapsed }), rootElement);
|
|
4893
|
+
return;
|
|
4894
|
+
}
|
|
4895
|
+
const stats = this._getStats();
|
|
2671
4896
|
const title = this.props.title || ("id" in stats ? stats.id : null) || "Stats";
|
|
2672
4897
|
const items = [];
|
|
2673
|
-
if (
|
|
4898
|
+
if (stats) {
|
|
2674
4899
|
stats.forEach((stat) => {
|
|
2675
4900
|
const lines = this._getLines(stat).split("\n");
|
|
2676
4901
|
if (this._resetOnUpdate && this._resetOnUpdate[stat.name]) {
|
|
@@ -2692,21 +4917,22 @@ var __exports__ = (() => {
|
|
|
2692
4917
|
style: { cursor: "pointer", pointerEvents: "auto" },
|
|
2693
4918
|
onClick: this._toggleCollapsed,
|
|
2694
4919
|
children: [
|
|
2695
|
-
|
|
2696
|
-
" ",
|
|
2697
|
-
title
|
|
4920
|
+
/* @__PURE__ */ u2("b", { children: title }),
|
|
4921
|
+
/* @__PURE__ */ u2("button", { className: "deck-widget-dropdown-button", children: /* @__PURE__ */ u2("span", { className: "deck-widget-dropdown-icon open" }) })
|
|
2698
4922
|
]
|
|
2699
4923
|
}
|
|
2700
4924
|
),
|
|
2701
|
-
|
|
4925
|
+
/* @__PURE__ */ u2("div", { className: "deck-widget-stats-content", children: items })
|
|
2702
4926
|
] }),
|
|
2703
4927
|
rootElement
|
|
2704
4928
|
);
|
|
2705
4929
|
}
|
|
2706
4930
|
onRedraw() {
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
this.
|
|
4931
|
+
if (!this.collapsed) {
|
|
4932
|
+
const framesPerUpdate = Math.max(1, this.props.framesPerUpdate || 1);
|
|
4933
|
+
if (this._counter++ % framesPerUpdate === 0) {
|
|
4934
|
+
this.updateHTML();
|
|
4935
|
+
}
|
|
2710
4936
|
}
|
|
2711
4937
|
}
|
|
2712
4938
|
_getStats() {
|
|
@@ -2715,7 +4941,7 @@ var __exports__ = (() => {
|
|
|
2715
4941
|
const metrics = this.deck?.metrics ?? {};
|
|
2716
4942
|
return Object.entries(metrics);
|
|
2717
4943
|
case "luma":
|
|
2718
|
-
return Array.from(
|
|
4944
|
+
return Array.from(import_core25.luma.stats.stats.values())[0];
|
|
2719
4945
|
case "device":
|
|
2720
4946
|
const device = this.deck?.device;
|
|
2721
4947
|
const stats = device?.statsManager.stats.values();
|
|
@@ -2737,10 +4963,11 @@ var __exports__ = (() => {
|
|
|
2737
4963
|
}
|
|
2738
4964
|
};
|
|
2739
4965
|
StatsWidget.defaultProps = {
|
|
2740
|
-
...
|
|
4966
|
+
...import_core24.Widget.defaultProps,
|
|
2741
4967
|
type: "deck",
|
|
2742
4968
|
placement: "top-left",
|
|
2743
4969
|
viewId: null,
|
|
4970
|
+
defaultIsExpanded: false,
|
|
2744
4971
|
stats: void 0,
|
|
2745
4972
|
title: "Stats",
|
|
2746
4973
|
framesPerUpdate: 1,
|
|
@@ -2748,6 +4975,24 @@ var __exports__ = (() => {
|
|
|
2748
4975
|
resetOnUpdate: {},
|
|
2749
4976
|
id: "stats"
|
|
2750
4977
|
};
|
|
4978
|
+
function FpsIcon({ getFps, onClick }) {
|
|
4979
|
+
const [fps, setFps] = h2(getFps());
|
|
4980
|
+
y2(() => {
|
|
4981
|
+
const onUpdate = () => {
|
|
4982
|
+
setFps(getFps());
|
|
4983
|
+
timer = requestAnimationFrame(onUpdate);
|
|
4984
|
+
};
|
|
4985
|
+
let timer = requestAnimationFrame(onUpdate);
|
|
4986
|
+
return () => {
|
|
4987
|
+
cancelAnimationFrame(timer);
|
|
4988
|
+
};
|
|
4989
|
+
}, [getFps]);
|
|
4990
|
+
return /* @__PURE__ */ u2(IconButton, { onClick, children: /* @__PURE__ */ u2("div", { className: "text", children: [
|
|
4991
|
+
"FPS",
|
|
4992
|
+
/* @__PURE__ */ u2("br", {}),
|
|
4993
|
+
fps
|
|
4994
|
+
] }) });
|
|
4995
|
+
}
|
|
2751
4996
|
return __toCommonJS(bundle_exports);
|
|
2752
4997
|
})();
|
|
2753
4998
|
return __exports__;
|