@deck.gl/widgets 9.3.0-alpha.1 → 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/context-menu-widget.d.ts +7 -5
- package/dist/context-menu-widget.d.ts.map +1 -1
- package/dist/context-menu-widget.js +2 -1
- package/dist/context-menu-widget.js.map +1 -1
- package/dist/dist.dev.js +687 -555
- 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 +468 -309
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +11 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/info-widget.d.ts +1 -0
- package/dist/info-widget.d.ts.map +1 -1
- package/dist/info-widget.js +6 -0
- package/dist/info-widget.js.map +1 -1
- package/dist/lib/components/dropdown-menu.d.ts +3 -2
- package/dist/lib/components/dropdown-menu.d.ts.map +1 -1
- package/dist/lib/components/dropdown-menu.js +12 -8
- 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.js +1 -1
- package/dist/lib/components/popover.js.map +1 -1
- 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 +1 -0
- package/dist/popup-widget.d.ts.map +1 -1
- package/dist/popup-widget.js +6 -0
- package/dist/popup-widget.js.map +1 -1
- 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 +2 -1
- package/dist/stats-widget.d.ts.map +1 -1
- package/dist/stats-widget.js +37 -8
- package/dist/stats-widget.js.map +1 -1
- package/dist/stylesheet.css +50 -13
- package/dist/timeline-widget.d.ts.map +1 -1
- package/dist/timeline-widget.js +6 -1
- 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.min.js +2 -2
- package/package.json +3 -3
- package/src/context-menu-widget.tsx +9 -9
- package/src/icon-widget.tsx +69 -0
- package/src/index.ts +11 -9
- package/src/info-widget.tsx +7 -0
- package/src/lib/components/dropdown-menu.tsx +22 -15
- package/src/lib/components/icon-button.tsx +15 -3
- package/src/lib/components/popover.tsx +1 -1
- package/src/lib/data-url.ts +5 -0
- package/src/popup-widget.tsx +7 -0
- package/src/selector-widget.tsx +111 -0
- package/src/splitter-widget.tsx +281 -96
- package/src/stats-widget.tsx +50 -9
- package/src/stylesheet.css +50 -13
- package/src/timeline-widget.tsx +8 -1
- package/src/toggle-widget.tsx +101 -0
- 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/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 -33
- package/dist/lib/components/icon-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/icon-menu.tsx +0 -70
- package/src/view-selector-widget.tsx +0 -151
package/dist/dist.dev.js
CHANGED
|
@@ -56,29 +56,31 @@ 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,
|
|
65
69
|
PopupWidget: () => PopupWidget,
|
|
66
70
|
ResetViewWidget: () => ResetViewWidget,
|
|
67
71
|
ScreenshotWidget: () => ScreenshotWidget,
|
|
68
72
|
ScrollbarWidget: () => ScrollbarWidget,
|
|
73
|
+
SelectorWidget: () => SelectorWidget,
|
|
74
|
+
ThemeWidget: () => ThemeWidget,
|
|
75
|
+
ToggleWidget: () => ToggleWidget,
|
|
69
76
|
ZoomWidget: () => ZoomWidget,
|
|
70
77
|
_ButtonGroup: () => ButtonGroup,
|
|
71
|
-
_ContextMenuWidget: () => ContextMenuWidget,
|
|
72
78
|
_CoordinatesGeocoder: () => CoordinatesGeocoder,
|
|
73
79
|
_CurrentLocationGeocoder: () => CurrentLocationGeocoder,
|
|
74
80
|
_DropdownMenu: () => DropdownMenu,
|
|
75
|
-
_FpsWidget: () => FpsWidget,
|
|
76
81
|
_GeocoderWidget: () => GeocoderWidget,
|
|
77
82
|
_GoogleGeocoder: () => GoogleGeocoder,
|
|
78
83
|
_IconButton: () => IconButton,
|
|
79
|
-
_IconMenu: () => IconMenu,
|
|
80
|
-
_InfoWidget: () => InfoWidget,
|
|
81
|
-
_LoadingWidget: () => LoadingWidget,
|
|
82
84
|
_MapboxGeocoder: () => MapboxGeocoder,
|
|
83
85
|
_OpenCageGeocoder: () => OpenCageGeocoder,
|
|
84
86
|
_RangeInput: () => RangeInput,
|
|
@@ -86,9 +88,7 @@ var __exports__ = (() => {
|
|
|
86
88
|
_SimpleMenu: () => SimpleMenu,
|
|
87
89
|
_SplitterWidget: () => SplitterWidget,
|
|
88
90
|
_StatsWidget: () => StatsWidget,
|
|
89
|
-
|
|
90
|
-
_TimelineWidget: () => TimelineWidget,
|
|
91
|
-
_ViewSelectorWidget: () => ViewSelectorWidget
|
|
91
|
+
_TimelineWidget: () => TimelineWidget
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
// ../core/bundle/peer-dependency.ts
|
|
@@ -268,37 +268,37 @@ var __exports__ = (() => {
|
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
function O(n2, u4, t3, i4, o3, r3, f4, e3, c3, s3) {
|
|
271
|
-
var a3,
|
|
271
|
+
var a3, h3, p3, v3, w3, _3, g2, m2, x2, C3, M2, P2, $2, I2, H, L2, T3 = u4.type;
|
|
272
272
|
if (void 0 !== u4.constructor)
|
|
273
273
|
return null;
|
|
274
274
|
128 & t3.__u && (c3 = !!(32 & t3.__u), r3 = [e3 = u4.__e = t3.__e]), (a3 = l.__b) && a3(u4);
|
|
275
275
|
n:
|
|
276
276
|
if ("function" == typeof T3)
|
|
277
277
|
try {
|
|
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 = (
|
|
279
|
-
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);
|
|
280
280
|
else {
|
|
281
|
-
if (x2 && null == T3.getDerivedStateFromProps && m2 !== v3 && null !=
|
|
282
|
-
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) {
|
|
283
283
|
n3 && (n3.__ = u4);
|
|
284
|
-
}), P2 = 0; P2 <
|
|
285
|
-
|
|
286
|
-
|
|
284
|
+
}), P2 = 0; P2 < h3._sb.length; P2++)
|
|
285
|
+
h3.__h.push(h3._sb[P2]);
|
|
286
|
+
h3._sb = [], h3.__h.length && f4.push(h3);
|
|
287
287
|
break n;
|
|
288
288
|
}
|
|
289
|
-
null !=
|
|
290
|
-
|
|
289
|
+
null != h3.componentWillUpdate && h3.componentWillUpdate(m2, h3.__s, M2), x2 && null != h3.componentDidUpdate && h3.__h.push(function() {
|
|
290
|
+
h3.componentDidUpdate(v3, w3, _3);
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
|
-
if (
|
|
294
|
-
for (
|
|
295
|
-
|
|
296
|
-
|
|
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 = [];
|
|
297
297
|
} else
|
|
298
298
|
do {
|
|
299
|
-
|
|
300
|
-
} while (
|
|
301
|
-
|
|
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);
|
|
302
302
|
} catch (n3) {
|
|
303
303
|
if (u4.__v = null, c3 || null != r3) {
|
|
304
304
|
for (u4.__u |= c3 ? 160 : 32; e3 && 8 === e3.nodeType && e3.nextSibling; )
|
|
@@ -444,17 +444,183 @@ var __exports__ = (() => {
|
|
|
444
444
|
return /* @__PURE__ */ u2("div", { className: `deck-widget-button-group ${orientation}`, children });
|
|
445
445
|
};
|
|
446
446
|
|
|
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
|
+
|
|
447
607
|
// src/lib/components/icon-button.tsx
|
|
448
608
|
var IconButton = (props) => {
|
|
449
|
-
const { className = "", label, onClick, children } = props;
|
|
450
|
-
|
|
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(
|
|
451
617
|
"button",
|
|
452
618
|
{
|
|
453
619
|
className: `deck-widget-icon-button ${className}`,
|
|
454
620
|
type: "button",
|
|
455
621
|
onClick,
|
|
456
622
|
title: label,
|
|
457
|
-
children: children ? children : /* @__PURE__ */ u2("div", { className: "deck-widget-icon" })
|
|
623
|
+
children: children ? children : /* @__PURE__ */ u2("div", { className: "deck-widget-icon", style: iconStyle })
|
|
458
624
|
}
|
|
459
625
|
) });
|
|
460
626
|
};
|
|
@@ -977,158 +1143,6 @@ var __exports__ = (() => {
|
|
|
977
1143
|
var import_core7 = __toESM(require_core(), 1);
|
|
978
1144
|
var import_core8 = __toESM(require_core(), 1);
|
|
979
1145
|
|
|
980
|
-
// ../../node_modules/preact/hooks/dist/hooks.module.js
|
|
981
|
-
var t2;
|
|
982
|
-
var r2;
|
|
983
|
-
var u3;
|
|
984
|
-
var i3;
|
|
985
|
-
var o2 = 0;
|
|
986
|
-
var f3 = [];
|
|
987
|
-
var c2 = l;
|
|
988
|
-
var e2 = c2.__b;
|
|
989
|
-
var a2 = c2.__r;
|
|
990
|
-
var v2 = c2.diffed;
|
|
991
|
-
var l2 = c2.__c;
|
|
992
|
-
var m = c2.unmount;
|
|
993
|
-
var s2 = c2.__;
|
|
994
|
-
function d2(n2, t3) {
|
|
995
|
-
c2.__h && c2.__h(r2, n2, o2 || t3), o2 = 0;
|
|
996
|
-
var u4 = r2.__H || (r2.__H = { __: [], __h: [] });
|
|
997
|
-
return n2 >= u4.__.length && u4.__.push({}), u4.__[n2];
|
|
998
|
-
}
|
|
999
|
-
function h2(n2) {
|
|
1000
|
-
return o2 = 1, p2(D, n2);
|
|
1001
|
-
}
|
|
1002
|
-
function p2(n2, u4, i4) {
|
|
1003
|
-
var o3 = d2(t2++, 2);
|
|
1004
|
-
if (o3.t = n2, !o3.__c && (o3.__ = [i4 ? i4(u4) : D(void 0, u4), function(n3) {
|
|
1005
|
-
var t3 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t3, n3);
|
|
1006
|
-
t3 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({}));
|
|
1007
|
-
}], o3.__c = r2, !r2.u)) {
|
|
1008
|
-
var f4 = function(n3, t3, r3) {
|
|
1009
|
-
if (!o3.__c.__H)
|
|
1010
|
-
return true;
|
|
1011
|
-
var u5 = o3.__c.__H.__.filter(function(n4) {
|
|
1012
|
-
return !!n4.__c;
|
|
1013
|
-
});
|
|
1014
|
-
if (u5.every(function(n4) {
|
|
1015
|
-
return !n4.__N;
|
|
1016
|
-
}))
|
|
1017
|
-
return !c3 || c3.call(this, n3, t3, r3);
|
|
1018
|
-
var i5 = false;
|
|
1019
|
-
return u5.forEach(function(n4) {
|
|
1020
|
-
if (n4.__N) {
|
|
1021
|
-
var t4 = n4.__[0];
|
|
1022
|
-
n4.__ = n4.__N, n4.__N = void 0, t4 !== n4.__[0] && (i5 = true);
|
|
1023
|
-
}
|
|
1024
|
-
}), !(!i5 && o3.__c.props === n3) && (!c3 || c3.call(this, n3, t3, r3));
|
|
1025
|
-
};
|
|
1026
|
-
r2.u = true;
|
|
1027
|
-
var c3 = r2.shouldComponentUpdate, e3 = r2.componentWillUpdate;
|
|
1028
|
-
r2.componentWillUpdate = function(n3, t3, r3) {
|
|
1029
|
-
if (this.__e) {
|
|
1030
|
-
var u5 = c3;
|
|
1031
|
-
c3 = void 0, f4(n3, t3, r3), c3 = u5;
|
|
1032
|
-
}
|
|
1033
|
-
e3 && e3.call(this, n3, t3, r3);
|
|
1034
|
-
}, r2.shouldComponentUpdate = f4;
|
|
1035
|
-
}
|
|
1036
|
-
return o3.__N || o3.__;
|
|
1037
|
-
}
|
|
1038
|
-
function y2(n2, u4) {
|
|
1039
|
-
var i4 = d2(t2++, 3);
|
|
1040
|
-
!c2.__s && C2(i4.__H, u4) && (i4.__ = n2, i4.i = u4, r2.__H.__h.push(i4));
|
|
1041
|
-
}
|
|
1042
|
-
function _2(n2, u4) {
|
|
1043
|
-
var i4 = d2(t2++, 4);
|
|
1044
|
-
!c2.__s && C2(i4.__H, u4) && (i4.__ = n2, i4.i = u4, r2.__h.push(i4));
|
|
1045
|
-
}
|
|
1046
|
-
function A2(n2) {
|
|
1047
|
-
return o2 = 5, T2(function() {
|
|
1048
|
-
return { current: n2 };
|
|
1049
|
-
}, []);
|
|
1050
|
-
}
|
|
1051
|
-
function T2(n2, r3) {
|
|
1052
|
-
var u4 = d2(t2++, 7);
|
|
1053
|
-
return C2(u4.__H, r3) && (u4.__ = n2(), u4.__H = r3, u4.__h = n2), u4.__;
|
|
1054
|
-
}
|
|
1055
|
-
function q2(n2, t3) {
|
|
1056
|
-
return o2 = 8, T2(function() {
|
|
1057
|
-
return n2;
|
|
1058
|
-
}, t3);
|
|
1059
|
-
}
|
|
1060
|
-
function j2() {
|
|
1061
|
-
for (var n2; n2 = f3.shift(); )
|
|
1062
|
-
if (n2.__P && n2.__H)
|
|
1063
|
-
try {
|
|
1064
|
-
n2.__H.__h.forEach(z2), n2.__H.__h.forEach(B2), n2.__H.__h = [];
|
|
1065
|
-
} catch (t3) {
|
|
1066
|
-
n2.__H.__h = [], c2.__e(t3, n2.__v);
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
c2.__b = function(n2) {
|
|
1070
|
-
r2 = null, e2 && e2(n2);
|
|
1071
|
-
}, c2.__ = function(n2, t3) {
|
|
1072
|
-
n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), s2 && s2(n2, t3);
|
|
1073
|
-
}, c2.__r = function(n2) {
|
|
1074
|
-
a2 && a2(n2), t2 = 0;
|
|
1075
|
-
var i4 = (r2 = n2.__c).__H;
|
|
1076
|
-
i4 && (u3 === r2 ? (i4.__h = [], r2.__h = [], i4.__.forEach(function(n3) {
|
|
1077
|
-
n3.__N && (n3.__ = n3.__N), n3.i = n3.__N = void 0;
|
|
1078
|
-
})) : (i4.__h.forEach(z2), i4.__h.forEach(B2), i4.__h = [], t2 = 0)), u3 = r2;
|
|
1079
|
-
}, c2.diffed = function(n2) {
|
|
1080
|
-
v2 && v2(n2);
|
|
1081
|
-
var t3 = n2.__c;
|
|
1082
|
-
t3 && t3.__H && (t3.__H.__h.length && (1 !== f3.push(t3) && i3 === c2.requestAnimationFrame || ((i3 = c2.requestAnimationFrame) || w2)(j2)), t3.__H.__.forEach(function(n3) {
|
|
1083
|
-
n3.i && (n3.__H = n3.i), n3.i = void 0;
|
|
1084
|
-
})), u3 = r2 = null;
|
|
1085
|
-
}, c2.__c = function(n2, t3) {
|
|
1086
|
-
t3.some(function(n3) {
|
|
1087
|
-
try {
|
|
1088
|
-
n3.__h.forEach(z2), n3.__h = n3.__h.filter(function(n4) {
|
|
1089
|
-
return !n4.__ || B2(n4);
|
|
1090
|
-
});
|
|
1091
|
-
} catch (r3) {
|
|
1092
|
-
t3.some(function(n4) {
|
|
1093
|
-
n4.__h && (n4.__h = []);
|
|
1094
|
-
}), t3 = [], c2.__e(r3, n3.__v);
|
|
1095
|
-
}
|
|
1096
|
-
}), l2 && l2(n2, t3);
|
|
1097
|
-
}, c2.unmount = function(n2) {
|
|
1098
|
-
m && m(n2);
|
|
1099
|
-
var t3, r3 = n2.__c;
|
|
1100
|
-
r3 && r3.__H && (r3.__H.__.forEach(function(n3) {
|
|
1101
|
-
try {
|
|
1102
|
-
z2(n3);
|
|
1103
|
-
} catch (n4) {
|
|
1104
|
-
t3 = n4;
|
|
1105
|
-
}
|
|
1106
|
-
}), r3.__H = void 0, t3 && c2.__e(t3, r3.__v));
|
|
1107
|
-
};
|
|
1108
|
-
var k2 = "function" == typeof requestAnimationFrame;
|
|
1109
|
-
function w2(n2) {
|
|
1110
|
-
var t3, r3 = function() {
|
|
1111
|
-
clearTimeout(u4), k2 && cancelAnimationFrame(t3), setTimeout(n2);
|
|
1112
|
-
}, u4 = setTimeout(r3, 100);
|
|
1113
|
-
k2 && (t3 = requestAnimationFrame(r3));
|
|
1114
|
-
}
|
|
1115
|
-
function z2(n2) {
|
|
1116
|
-
var t3 = r2, u4 = n2.__c;
|
|
1117
|
-
"function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t3;
|
|
1118
|
-
}
|
|
1119
|
-
function B2(n2) {
|
|
1120
|
-
var t3 = r2;
|
|
1121
|
-
n2.__c = n2.__(), r2 = t3;
|
|
1122
|
-
}
|
|
1123
|
-
function C2(n2, t3) {
|
|
1124
|
-
return !n2 || n2.length !== t3.length || t3.some(function(t4, r3) {
|
|
1125
|
-
return t4 !== n2[r3];
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
function D(n2, t3) {
|
|
1129
|
-
return "function" == typeof t3 ? t3(n2) : t3;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
1146
|
// src/lib/components/dropdown-menu.tsx
|
|
1133
1147
|
function getMenuItemValue(item) {
|
|
1134
1148
|
return typeof item === "string" ? item : item.value;
|
|
@@ -1154,20 +1168,23 @@ var __exports__ = (() => {
|
|
|
1154
1168
|
};
|
|
1155
1169
|
var SimpleMenu = (props) => {
|
|
1156
1170
|
const dropdownRef = A2(null);
|
|
1157
|
-
const handleClickOutside = (event) => {
|
|
1158
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1159
|
-
props.onClose();
|
|
1160
|
-
}
|
|
1161
|
-
};
|
|
1162
1171
|
y2(() => {
|
|
1172
|
+
const handleClickOutside = (event) => {
|
|
1173
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1174
|
+
props.onClose();
|
|
1175
|
+
}
|
|
1176
|
+
};
|
|
1163
1177
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1164
1178
|
return () => {
|
|
1165
1179
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
1166
1180
|
};
|
|
1167
1181
|
}, []);
|
|
1168
|
-
const handleSelect = (value) => {
|
|
1182
|
+
const handleSelect = (value, item) => {
|
|
1169
1183
|
if (value) {
|
|
1170
|
-
|
|
1184
|
+
if (typeof item === "object") {
|
|
1185
|
+
item.onSelect?.();
|
|
1186
|
+
}
|
|
1187
|
+
props.onSelect?.(value);
|
|
1171
1188
|
props.onClose();
|
|
1172
1189
|
}
|
|
1173
1190
|
};
|
|
@@ -1183,15 +1200,9 @@ var __exports__ = (() => {
|
|
|
1183
1200
|
"li",
|
|
1184
1201
|
{
|
|
1185
1202
|
className: `deck-widget-dropdown-item ${value ? "" : "disabled"}`,
|
|
1186
|
-
onClick: () => handleSelect(value),
|
|
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
|
},
|
|
@@ -1626,293 +1637,238 @@ var __exports__ = (() => {
|
|
|
1626
1637
|
|
|
1627
1638
|
// src/splitter-widget.tsx
|
|
1628
1639
|
var import_core10 = __toESM(require_core(), 1);
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
onDragEnd
|
|
1680
|
-
}) {
|
|
1681
|
-
const [split, setSplit] = h2(initialSplit);
|
|
1682
|
-
const dragging = A2(false);
|
|
1683
|
-
const containerRef = A2(null);
|
|
1684
|
-
const handleDragStart = (event) => {
|
|
1685
|
-
dragging.current = true;
|
|
1686
|
-
onDragStart?.();
|
|
1687
|
-
document.addEventListener("mousemove", handleDragging);
|
|
1688
|
-
document.addEventListener("mouseup", handleDragEnd);
|
|
1689
|
-
event.preventDefault();
|
|
1690
|
-
};
|
|
1691
|
-
const handleDragging = (event) => {
|
|
1692
|
-
if (!dragging.current || !containerRef.current)
|
|
1693
|
-
return;
|
|
1694
|
-
const rect = containerRef.current.getBoundingClientRect();
|
|
1695
|
-
let newSplit;
|
|
1696
|
-
if (orientation === "vertical") {
|
|
1697
|
-
newSplit = (event.clientX - rect.left) / rect.width;
|
|
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;
|
|
1698
1690
|
} else {
|
|
1699
|
-
|
|
1691
|
+
child1Height = height * l3.split;
|
|
1692
|
+
child2Y = y3 + child1Height;
|
|
1693
|
+
child2Height = height - child1Height;
|
|
1700
1694
|
}
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
const splitterStyle = orientation === "vertical" ? {
|
|
1714
|
-
position: "absolute",
|
|
1715
|
-
top: 0,
|
|
1716
|
-
bottom: 0,
|
|
1717
|
-
left: `${split * 100}%`,
|
|
1718
|
-
width: "4px",
|
|
1719
|
-
cursor: "col-resize",
|
|
1720
|
-
background: "#ccc",
|
|
1721
|
-
zIndex: 10,
|
|
1722
|
-
pointerEvents: "auto",
|
|
1723
|
-
boxShadow: "inset -1px 0 0 white, inset 1px 0 0 white"
|
|
1724
|
-
} : {
|
|
1725
|
-
position: "absolute",
|
|
1726
|
-
left: 0,
|
|
1727
|
-
right: 0,
|
|
1728
|
-
top: `${split * 100}%`,
|
|
1729
|
-
height: "4px",
|
|
1730
|
-
cursor: "row-resize",
|
|
1731
|
-
background: "#ccc",
|
|
1732
|
-
zIndex: 10,
|
|
1733
|
-
pointerEvents: "auto",
|
|
1734
|
-
boxShadow: "inset -1px 0 0 white, inset 1px 0 0 white"
|
|
1735
|
-
};
|
|
1736
|
-
const containerStyle = {
|
|
1737
|
-
position: "absolute",
|
|
1738
|
-
top: 0,
|
|
1739
|
-
left: 0,
|
|
1740
|
-
right: 0,
|
|
1741
|
-
bottom: 0
|
|
1742
|
-
};
|
|
1743
|
-
return /* @__PURE__ */ u2("div", { ref: containerRef, style: containerStyle, children: /* @__PURE__ */ u2(
|
|
1744
|
-
"div",
|
|
1745
|
-
{
|
|
1746
|
-
style: splitterStyle,
|
|
1747
|
-
onMouseDown: handleDragStart
|
|
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
|
+
);
|
|
1748
1707
|
}
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
1761
|
-
setMenuOpen(false);
|
|
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
|
+
);
|
|
1762
1719
|
}
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
return () => {
|
|
1767
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
1768
|
-
};
|
|
1769
|
-
}, [containerRef]);
|
|
1770
|
-
const [selectedItem, setSelectedItem] = h2(props.initialItem);
|
|
1771
|
-
const handleSelectItem = (item) => {
|
|
1772
|
-
setSelectedItem(item);
|
|
1773
|
-
setMenuOpen(false);
|
|
1774
|
-
props.onItemSelected(item);
|
|
1775
|
-
};
|
|
1776
|
-
const handleButtonClick = () => setMenuOpen(!menuOpen);
|
|
1777
|
-
const selectedMenuItem = props.menuItems.find((item) => item.value === selectedItem);
|
|
1778
|
-
const label = props.label || selectedMenuItem?.label || "";
|
|
1779
|
-
const icon = props.icon || selectedMenuItem?.icon;
|
|
1780
|
-
return /* @__PURE__ */ u2("div", { style: { position: "relative", display: "inline-block" }, ref: containerRef, children: [
|
|
1781
|
-
/* @__PURE__ */ u2(IconButton, { className: props.className, label, onClick: handleButtonClick, children: icon }),
|
|
1782
|
-
menuOpen && /* @__PURE__ */ u2("div", { className: "deck-widget-icon-menu", children: /* @__PURE__ */ u2(ButtonGroup, { orientation: "vertical", children: props.menuItems.map((item) => /* @__PURE__ */ u2(
|
|
1783
|
-
IconButton,
|
|
1784
|
-
{
|
|
1785
|
-
label: item.label,
|
|
1786
|
-
onClick: () => handleSelectItem(item.value),
|
|
1787
|
-
children: item.icon
|
|
1788
|
-
},
|
|
1789
|
-
item.value
|
|
1790
|
-
)) }) })
|
|
1791
|
-
] });
|
|
1720
|
+
}
|
|
1721
|
+
evaluateViewLayout(root, 0, 0, 100, 100);
|
|
1722
|
+
return views;
|
|
1792
1723
|
}
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
var ViewSelectorWidget = class extends import_core11.Widget {
|
|
1796
|
-
constructor(props = {}) {
|
|
1724
|
+
var SplitterWidget = class extends import_core10.Widget {
|
|
1725
|
+
constructor(props) {
|
|
1797
1726
|
super(props);
|
|
1798
|
-
this.className = "deck-widget-
|
|
1799
|
-
this.placement = "
|
|
1800
|
-
this.
|
|
1801
|
-
|
|
1802
|
-
this.updateHTML();
|
|
1803
|
-
this.props.onViewModeChange(viewMode);
|
|
1804
|
-
};
|
|
1805
|
-
this.viewMode = this.props.initialViewMode;
|
|
1806
|
-
this.setProps(this.props);
|
|
1727
|
+
this.className = "deck-widget-splitter";
|
|
1728
|
+
this.placement = "fill";
|
|
1729
|
+
this.needsUpdate = true;
|
|
1730
|
+
this.viewLayouts = parseViewLayout(this.props.viewLayout);
|
|
1807
1731
|
}
|
|
1808
1732
|
setProps(props) {
|
|
1809
|
-
|
|
1810
|
-
|
|
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
|
+
}
|
|
1811
1737
|
super.setProps(props);
|
|
1812
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
|
+
}
|
|
1813
1774
|
onRenderHTML(rootElement) {
|
|
1814
1775
|
B(
|
|
1815
|
-
/* @__PURE__ */ u2(
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
),
|
|
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
|
+
) }),
|
|
1827
1787
|
rootElement
|
|
1828
1788
|
);
|
|
1829
1789
|
}
|
|
1830
1790
|
};
|
|
1831
|
-
|
|
1832
|
-
...
|
|
1833
|
-
id: "
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1791
|
+
SplitterWidget.defaultProps = {
|
|
1792
|
+
...import_core10.Widget.defaultProps,
|
|
1793
|
+
id: "splitter-widget",
|
|
1794
|
+
viewLayout: void 0,
|
|
1795
|
+
onChange: () => {
|
|
1796
|
+
},
|
|
1797
|
+
onDragStart: () => {
|
|
1798
|
+
},
|
|
1799
|
+
onDragEnd: () => {
|
|
1839
1800
|
}
|
|
1840
1801
|
};
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1802
|
+
function Splitter({
|
|
1803
|
+
orientation,
|
|
1804
|
+
x: x2,
|
|
1805
|
+
y: y3,
|
|
1806
|
+
width,
|
|
1807
|
+
height,
|
|
1808
|
+
split,
|
|
1809
|
+
minSplit,
|
|
1810
|
+
maxSplit,
|
|
1811
|
+
onChange,
|
|
1812
|
+
onDragStart,
|
|
1813
|
+
onDragEnd
|
|
1814
|
+
}) {
|
|
1815
|
+
const [dragging, setDragging] = h2(false);
|
|
1816
|
+
const containerRef = A2(null);
|
|
1817
|
+
y2(() => {
|
|
1818
|
+
if (!dragging) {
|
|
1819
|
+
return void 0;
|
|
1853
1820
|
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
height
|
|
1863
|
-
stroke: "var(--button-icon-hover, rgb(24, 24, 26))",
|
|
1864
|
-
fill: "none",
|
|
1865
|
-
strokeWidth: "2"
|
|
1866
|
-
}
|
|
1867
|
-
),
|
|
1868
|
-
/* @__PURE__ */ u2(
|
|
1869
|
-
"rect",
|
|
1870
|
-
{
|
|
1871
|
-
x: "4",
|
|
1872
|
-
y: "13",
|
|
1873
|
-
width: "16",
|
|
1874
|
-
height: "7",
|
|
1875
|
-
stroke: "var(--button-icon-hover, rgb(24, 24, 26))",
|
|
1876
|
-
fill: "none",
|
|
1877
|
-
strokeWidth: "2"
|
|
1878
|
-
}
|
|
1879
|
-
)
|
|
1880
|
-
] }),
|
|
1881
|
-
"split-vertical": () => /* @__PURE__ */ u2("svg", { width: "24", height: "24", style: ICON_STYLE, children: [
|
|
1882
|
-
/* @__PURE__ */ u2(
|
|
1883
|
-
"rect",
|
|
1884
|
-
{
|
|
1885
|
-
x: "4",
|
|
1886
|
-
y: "4",
|
|
1887
|
-
width: "7",
|
|
1888
|
-
height: "16",
|
|
1889
|
-
stroke: "var(--button-icon-hover, rgb(24, 24, 26))",
|
|
1890
|
-
fill: "none",
|
|
1891
|
-
strokeWidth: "2"
|
|
1892
|
-
}
|
|
1893
|
-
),
|
|
1894
|
-
/* @__PURE__ */ u2(
|
|
1895
|
-
"rect",
|
|
1896
|
-
{
|
|
1897
|
-
x: "13",
|
|
1898
|
-
y: "4",
|
|
1899
|
-
width: "7",
|
|
1900
|
-
height: "16",
|
|
1901
|
-
stroke: "var(--button-icon-hover, rgb(24, 24, 26))",
|
|
1902
|
-
fill: "none",
|
|
1903
|
-
strokeWidth: "2"
|
|
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;
|
|
1904
1830
|
}
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
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]);
|
|
1847
|
+
const handleDragStart = (event) => {
|
|
1848
|
+
setDragging(true);
|
|
1849
|
+
onDragStart?.();
|
|
1850
|
+
event.preventDefault();
|
|
1851
|
+
};
|
|
1852
|
+
const splitterStyle = orientation === "horizontal" ? { left: `${split * 100}%` } : { top: `${split * 100}%` };
|
|
1853
|
+
const containerStyle = {
|
|
1854
|
+
position: "absolute",
|
|
1855
|
+
top: `${y3}%`,
|
|
1856
|
+
left: `${x2}%`,
|
|
1857
|
+
width: `${width}%`,
|
|
1858
|
+
height: `${height}%`
|
|
1859
|
+
};
|
|
1860
|
+
return /* @__PURE__ */ u2("div", { ref: containerRef, style: containerStyle, children: /* @__PURE__ */ u2(
|
|
1861
|
+
"div",
|
|
1862
|
+
{
|
|
1863
|
+
className: `deck-widget-splitter-handle deck-widget-splitter-handle--${orientation} ${dragging ? "active" : ""}`,
|
|
1864
|
+
style: splitterStyle,
|
|
1865
|
+
onPointerDown: handleDragStart
|
|
1866
|
+
}
|
|
1867
|
+
) });
|
|
1868
|
+
}
|
|
1913
1869
|
|
|
1914
1870
|
// src/info-widget.tsx
|
|
1915
|
-
var
|
|
1871
|
+
var import_core12 = __toESM(require_core(), 1);
|
|
1916
1872
|
|
|
1917
1873
|
// ../../node_modules/@floating-ui/core/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
1918
1874
|
var min = Math.min;
|
|
@@ -3314,7 +3270,7 @@ var __exports__ = (() => {
|
|
|
3314
3270
|
};
|
|
3315
3271
|
T2(() => {
|
|
3316
3272
|
updaterRef.current?.();
|
|
3317
|
-
}, [placement, arrowSize, pixelOffset]);
|
|
3273
|
+
}, [x2, y3, placement, arrowSize, pixelOffset]);
|
|
3318
3274
|
y2(() => {
|
|
3319
3275
|
if (contentRef.current) {
|
|
3320
3276
|
contentRef.current.style.visibility = "visible";
|
|
@@ -3400,7 +3356,7 @@ var __exports__ = (() => {
|
|
|
3400
3356
|
};
|
|
3401
3357
|
|
|
3402
3358
|
// src/info-widget.tsx
|
|
3403
|
-
var InfoWidget = class extends
|
|
3359
|
+
var InfoWidget = class extends import_core12.Widget {
|
|
3404
3360
|
constructor(props) {
|
|
3405
3361
|
super(props);
|
|
3406
3362
|
this.className = "deck-widget-info";
|
|
@@ -3415,6 +3371,11 @@ var __exports__ = (() => {
|
|
|
3415
3371
|
onAdd({ deck }) {
|
|
3416
3372
|
this.deck = deck;
|
|
3417
3373
|
}
|
|
3374
|
+
onRemove() {
|
|
3375
|
+
if (this.rootElement) {
|
|
3376
|
+
B(null, this.rootElement);
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3418
3379
|
onViewportChange(viewport) {
|
|
3419
3380
|
this.viewport = viewport;
|
|
3420
3381
|
this.updateHTML();
|
|
@@ -3484,7 +3445,7 @@ var __exports__ = (() => {
|
|
|
3484
3445
|
}
|
|
3485
3446
|
};
|
|
3486
3447
|
InfoWidget.defaultProps = {
|
|
3487
|
-
...
|
|
3448
|
+
...import_core12.Widget.defaultProps,
|
|
3488
3449
|
id: "info",
|
|
3489
3450
|
viewId: null,
|
|
3490
3451
|
mode: "hover",
|
|
@@ -3495,8 +3456,8 @@ var __exports__ = (() => {
|
|
|
3495
3456
|
};
|
|
3496
3457
|
|
|
3497
3458
|
// src/popup-widget.tsx
|
|
3498
|
-
var
|
|
3499
|
-
var PopupWidget = class extends
|
|
3459
|
+
var import_core13 = __toESM(require_core(), 1);
|
|
3460
|
+
var PopupWidget = class extends import_core13.Widget {
|
|
3500
3461
|
constructor(props) {
|
|
3501
3462
|
super(props);
|
|
3502
3463
|
this.className = "deck-widget-popup";
|
|
@@ -3511,6 +3472,11 @@ var __exports__ = (() => {
|
|
|
3511
3472
|
onAdd({ deck }) {
|
|
3512
3473
|
this.deck = deck;
|
|
3513
3474
|
}
|
|
3475
|
+
onRemove() {
|
|
3476
|
+
if (this.rootElement) {
|
|
3477
|
+
B(null, this.rootElement);
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3514
3480
|
onViewportChange(viewport) {
|
|
3515
3481
|
this.viewport = viewport;
|
|
3516
3482
|
this.updateHTML();
|
|
@@ -3582,7 +3548,7 @@ var __exports__ = (() => {
|
|
|
3582
3548
|
}
|
|
3583
3549
|
};
|
|
3584
3550
|
PopupWidget.defaultProps = {
|
|
3585
|
-
...
|
|
3551
|
+
...import_core13.Widget.defaultProps,
|
|
3586
3552
|
id: "info",
|
|
3587
3553
|
viewId: null,
|
|
3588
3554
|
position: [0, 0],
|
|
@@ -3599,8 +3565,8 @@ var __exports__ = (() => {
|
|
|
3599
3565
|
};
|
|
3600
3566
|
|
|
3601
3567
|
// src/context-menu-widget.tsx
|
|
3602
|
-
var
|
|
3603
|
-
var ContextMenuWidget = class extends
|
|
3568
|
+
var import_core14 = __toESM(require_core(), 1);
|
|
3569
|
+
var ContextMenuWidget = class extends import_core14.Widget {
|
|
3604
3570
|
constructor(props) {
|
|
3605
3571
|
super(props);
|
|
3606
3572
|
this.className = "deck-widget-context-menu";
|
|
@@ -3624,7 +3590,7 @@ var __exports__ = (() => {
|
|
|
3624
3590
|
index: -1,
|
|
3625
3591
|
pixelRatio: 1
|
|
3626
3592
|
};
|
|
3627
|
-
const menuItems = this.props.getMenuItems(pickInfo, this) ||
|
|
3593
|
+
const menuItems = this.props.getMenuItems?.(pickInfo, this) || this.props.menuItems;
|
|
3628
3594
|
this.menu = menuItems.length > 0 ? {
|
|
3629
3595
|
items: menuItems,
|
|
3630
3596
|
pickInfo
|
|
@@ -3672,9 +3638,10 @@ var __exports__ = (() => {
|
|
|
3672
3638
|
}
|
|
3673
3639
|
};
|
|
3674
3640
|
ContextMenuWidget.defaultProps = {
|
|
3675
|
-
...
|
|
3641
|
+
...import_core14.Widget.defaultProps,
|
|
3676
3642
|
id: "context",
|
|
3677
3643
|
viewId: null,
|
|
3644
|
+
menuItems: [],
|
|
3678
3645
|
getMenuItems: void 0,
|
|
3679
3646
|
onMenuItemSelected: () => {
|
|
3680
3647
|
},
|
|
@@ -3684,7 +3651,7 @@ var __exports__ = (() => {
|
|
|
3684
3651
|
};
|
|
3685
3652
|
|
|
3686
3653
|
// src/scrollbar-widget.tsx
|
|
3687
|
-
var
|
|
3654
|
+
var import_core15 = __toESM(require_core(), 1);
|
|
3688
3655
|
|
|
3689
3656
|
// src/lib/components/range-input.tsx
|
|
3690
3657
|
var wheelListenerOptions = { passive: false };
|
|
@@ -4037,7 +4004,7 @@ var __exports__ = (() => {
|
|
|
4037
4004
|
}
|
|
4038
4005
|
return value;
|
|
4039
4006
|
};
|
|
4040
|
-
var _ScrollbarWidget = class extends
|
|
4007
|
+
var _ScrollbarWidget = class extends import_core15.Widget {
|
|
4041
4008
|
constructor(props) {
|
|
4042
4009
|
const resolved = {
|
|
4043
4010
|
..._ScrollbarWidget.defaultProps,
|
|
@@ -4199,7 +4166,7 @@ var __exports__ = (() => {
|
|
|
4199
4166
|
};
|
|
4200
4167
|
var ScrollbarWidget = _ScrollbarWidget;
|
|
4201
4168
|
ScrollbarWidget.defaultProps = {
|
|
4202
|
-
...
|
|
4169
|
+
...import_core15.Widget.defaultProps,
|
|
4203
4170
|
contentBounds: null,
|
|
4204
4171
|
placement: "top-right",
|
|
4205
4172
|
viewId: null,
|
|
@@ -4223,9 +4190,187 @@ var __exports__ = (() => {
|
|
|
4223
4190
|
);
|
|
4224
4191
|
}
|
|
4225
4192
|
|
|
4226
|
-
// src/
|
|
4193
|
+
// src/icon-widget.tsx
|
|
4194
|
+
var import_core16 = __toESM(require_core(), 1);
|
|
4195
|
+
var IconWidget = class extends import_core16.Widget {
|
|
4196
|
+
constructor(props) {
|
|
4197
|
+
super(props);
|
|
4198
|
+
this.className = "";
|
|
4199
|
+
this.placement = "top-left";
|
|
4200
|
+
this.setProps(this.props);
|
|
4201
|
+
}
|
|
4202
|
+
setProps(props) {
|
|
4203
|
+
this.placement = props.placement ?? this.placement;
|
|
4204
|
+
this.viewId = props.viewId;
|
|
4205
|
+
super.setProps(props);
|
|
4206
|
+
}
|
|
4207
|
+
onRenderHTML(rootElement) {
|
|
4208
|
+
const { className, style, icon, color, label, onClick } = this.props;
|
|
4209
|
+
B(
|
|
4210
|
+
/* @__PURE__ */ u2(
|
|
4211
|
+
IconButton,
|
|
4212
|
+
{
|
|
4213
|
+
className,
|
|
4214
|
+
style,
|
|
4215
|
+
color,
|
|
4216
|
+
icon,
|
|
4217
|
+
label,
|
|
4218
|
+
onClick
|
|
4219
|
+
}
|
|
4220
|
+
),
|
|
4221
|
+
rootElement
|
|
4222
|
+
);
|
|
4223
|
+
}
|
|
4224
|
+
};
|
|
4225
|
+
IconWidget.defaultProps = {
|
|
4226
|
+
...import_core16.Widget.defaultProps,
|
|
4227
|
+
id: "icon",
|
|
4228
|
+
placement: "top-left",
|
|
4229
|
+
viewId: null,
|
|
4230
|
+
icon: "",
|
|
4231
|
+
label: "",
|
|
4232
|
+
color: "",
|
|
4233
|
+
onClick: void 0
|
|
4234
|
+
};
|
|
4235
|
+
|
|
4236
|
+
// src/toggle-widget.tsx
|
|
4227
4237
|
var import_core17 = __toESM(require_core(), 1);
|
|
4228
|
-
var
|
|
4238
|
+
var ToggleWidget = class extends import_core17.Widget {
|
|
4239
|
+
constructor(props) {
|
|
4240
|
+
super(props);
|
|
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;
|
|
4249
|
+
this.setProps(this.props);
|
|
4250
|
+
}
|
|
4251
|
+
setProps(props) {
|
|
4252
|
+
this.placement = props.placement ?? this.placement;
|
|
4253
|
+
this.viewId = props.viewId;
|
|
4254
|
+
super.setProps(props);
|
|
4255
|
+
}
|
|
4256
|
+
onRenderHTML(rootElement) {
|
|
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(
|
|
4270
|
+
/* @__PURE__ */ u2(
|
|
4271
|
+
IconButton,
|
|
4272
|
+
{
|
|
4273
|
+
className,
|
|
4274
|
+
style,
|
|
4275
|
+
icon: on ? onIcon : icon,
|
|
4276
|
+
label: on ? onLabel : label,
|
|
4277
|
+
color: on ? onColor : color,
|
|
4278
|
+
onClick: this._toggle
|
|
4279
|
+
}
|
|
4280
|
+
),
|
|
4281
|
+
rootElement
|
|
4282
|
+
);
|
|
4283
|
+
}
|
|
4284
|
+
};
|
|
4285
|
+
ToggleWidget.defaultProps = {
|
|
4286
|
+
...import_core17.Widget.defaultProps,
|
|
4287
|
+
id: "icon",
|
|
4288
|
+
placement: "top-left",
|
|
4289
|
+
viewId: null,
|
|
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
|
|
4298
|
+
};
|
|
4299
|
+
|
|
4300
|
+
// src/selector-widget.tsx
|
|
4301
|
+
var import_core18 = __toESM(require_core(), 1);
|
|
4302
|
+
var SelectorWidget = class extends import_core18.Widget {
|
|
4303
|
+
constructor(props) {
|
|
4304
|
+
super(props);
|
|
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;
|
|
4326
|
+
this.setProps(this.props);
|
|
4327
|
+
}
|
|
4328
|
+
setProps(props) {
|
|
4329
|
+
this.placement = props.placement ?? this.placement;
|
|
4330
|
+
this.viewId = props.viewId ?? this.viewId;
|
|
4331
|
+
super.setProps(props);
|
|
4332
|
+
}
|
|
4333
|
+
onRenderHTML(rootElement) {
|
|
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
|
+
);
|
|
4358
|
+
}
|
|
4359
|
+
};
|
|
4360
|
+
SelectorWidget.defaultProps = {
|
|
4361
|
+
...import_core18.Widget.defaultProps,
|
|
4362
|
+
id: "view-selector",
|
|
4363
|
+
placement: "top-left",
|
|
4364
|
+
viewId: null,
|
|
4365
|
+
initialValue: "",
|
|
4366
|
+
options: [],
|
|
4367
|
+
onChange: () => {
|
|
4368
|
+
}
|
|
4369
|
+
};
|
|
4370
|
+
|
|
4371
|
+
// src/timeline-widget.tsx
|
|
4372
|
+
var import_core19 = __toESM(require_core(), 1);
|
|
4373
|
+
var TimelineWidget = class extends import_core19.Widget {
|
|
4229
4374
|
constructor(props = {}) {
|
|
4230
4375
|
super(props);
|
|
4231
4376
|
this.id = "timeline";
|
|
@@ -4253,7 +4398,7 @@ var __exports__ = (() => {
|
|
|
4253
4398
|
loop
|
|
4254
4399
|
} = this.props;
|
|
4255
4400
|
if (step > 0) {
|
|
4256
|
-
let next = Math.
|
|
4401
|
+
let next = Math.round(this.currentTime / step) * step + step;
|
|
4257
4402
|
if (next > max3) {
|
|
4258
4403
|
if (this.currentTime < max3) {
|
|
4259
4404
|
next = max3;
|
|
@@ -4335,6 +4480,13 @@ var __exports__ = (() => {
|
|
|
4335
4480
|
}
|
|
4336
4481
|
play() {
|
|
4337
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
|
+
}
|
|
4338
4490
|
this.updateHTML();
|
|
4339
4491
|
this.tick();
|
|
4340
4492
|
}
|
|
@@ -4348,7 +4500,7 @@ var __exports__ = (() => {
|
|
|
4348
4500
|
}
|
|
4349
4501
|
};
|
|
4350
4502
|
TimelineWidget.defaultProps = {
|
|
4351
|
-
...
|
|
4503
|
+
...import_core19.Widget.defaultProps,
|
|
4352
4504
|
id: "timeline",
|
|
4353
4505
|
placement: "bottom-left",
|
|
4354
4506
|
viewId: null,
|
|
@@ -4365,8 +4517,8 @@ var __exports__ = (() => {
|
|
|
4365
4517
|
};
|
|
4366
4518
|
|
|
4367
4519
|
// src/screenshot-widget.tsx
|
|
4368
|
-
var
|
|
4369
|
-
var ScreenshotWidget = class extends
|
|
4520
|
+
var import_core20 = __toESM(require_core(), 1);
|
|
4521
|
+
var ScreenshotWidget = class extends import_core20.Widget {
|
|
4370
4522
|
constructor(props = {}) {
|
|
4371
4523
|
super(props);
|
|
4372
4524
|
this.className = "deck-widget-screenshot";
|
|
@@ -4415,7 +4567,7 @@ var __exports__ = (() => {
|
|
|
4415
4567
|
}
|
|
4416
4568
|
};
|
|
4417
4569
|
ScreenshotWidget.defaultProps = {
|
|
4418
|
-
...
|
|
4570
|
+
...import_core20.Widget.defaultProps,
|
|
4419
4571
|
id: "screenshot",
|
|
4420
4572
|
placement: "top-left",
|
|
4421
4573
|
viewId: null,
|
|
@@ -4426,8 +4578,8 @@ var __exports__ = (() => {
|
|
|
4426
4578
|
};
|
|
4427
4579
|
|
|
4428
4580
|
// src/theme-widget.tsx
|
|
4429
|
-
var
|
|
4430
|
-
var
|
|
4581
|
+
var import_core21 = __toESM(require_core(), 1);
|
|
4582
|
+
var import_core22 = __toESM(require_core(), 1);
|
|
4431
4583
|
|
|
4432
4584
|
// src/themes.ts
|
|
4433
4585
|
var LightTheme = {
|
|
@@ -4544,7 +4696,7 @@ var __exports__ = (() => {
|
|
|
4544
4696
|
};
|
|
4545
4697
|
|
|
4546
4698
|
// src/theme-widget.tsx
|
|
4547
|
-
var ThemeWidget = class extends
|
|
4699
|
+
var ThemeWidget = class extends import_core22.Widget {
|
|
4548
4700
|
constructor(props = {}) {
|
|
4549
4701
|
super(props);
|
|
4550
4702
|
this.className = "deck-widget-theme";
|
|
@@ -4561,17 +4713,17 @@ var __exports__ = (() => {
|
|
|
4561
4713
|
super.setProps(props);
|
|
4562
4714
|
switch (this.themeMode) {
|
|
4563
4715
|
case "light":
|
|
4564
|
-
if (props.lightModeTheme && !(0,
|
|
4716
|
+
if (props.lightModeTheme && !(0, import_core21._deepEqual)(props.lightModeTheme, lightModeTheme, 1)) {
|
|
4565
4717
|
this._setThemeMode("light");
|
|
4566
4718
|
}
|
|
4567
4719
|
break;
|
|
4568
4720
|
case "dark":
|
|
4569
|
-
if (props.darkModeTheme && !(0,
|
|
4721
|
+
if (props.darkModeTheme && !(0, import_core21._deepEqual)(props.darkModeTheme, darkModeTheme, 1)) {
|
|
4570
4722
|
this._setThemeMode("dark");
|
|
4571
4723
|
}
|
|
4572
4724
|
break;
|
|
4573
4725
|
default:
|
|
4574
|
-
|
|
4726
|
+
import_core21.log.warn(`Invalid theme mode ${this.themeMode}`)();
|
|
4575
4727
|
}
|
|
4576
4728
|
}
|
|
4577
4729
|
onRenderHTML(rootElement) {
|
|
@@ -4600,9 +4752,9 @@ var __exports__ = (() => {
|
|
|
4600
4752
|
const container = this.rootElement?.closest(".deck-widget-container");
|
|
4601
4753
|
if (container) {
|
|
4602
4754
|
const themeStyle = themeMode === "dark" ? this.props.darkModeTheme : this.props.lightModeTheme;
|
|
4603
|
-
(0,
|
|
4755
|
+
(0, import_core21._applyStyles)(container, themeStyle);
|
|
4604
4756
|
const label = this.themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
|
|
4605
|
-
|
|
4757
|
+
import_core21.log.log(1, `Switched theme to ${label}`, themeStyle)();
|
|
4606
4758
|
this.updateHTML();
|
|
4607
4759
|
}
|
|
4608
4760
|
}
|
|
@@ -4619,7 +4771,7 @@ var __exports__ = (() => {
|
|
|
4619
4771
|
}
|
|
4620
4772
|
};
|
|
4621
4773
|
ThemeWidget.defaultProps = {
|
|
4622
|
-
...
|
|
4774
|
+
...import_core22.Widget.defaultProps,
|
|
4623
4775
|
id: "theme",
|
|
4624
4776
|
placement: "top-left",
|
|
4625
4777
|
viewId: null,
|
|
@@ -4631,8 +4783,8 @@ var __exports__ = (() => {
|
|
|
4631
4783
|
};
|
|
4632
4784
|
|
|
4633
4785
|
// src/loading-widget.tsx
|
|
4634
|
-
var
|
|
4635
|
-
var LoadingWidget = class extends
|
|
4786
|
+
var import_core23 = __toESM(require_core(), 1);
|
|
4787
|
+
var LoadingWidget = class extends import_core23.Widget {
|
|
4636
4788
|
constructor(props = {}) {
|
|
4637
4789
|
super(props);
|
|
4638
4790
|
this.className = "deck-widget-loading";
|
|
@@ -4671,65 +4823,16 @@ var __exports__ = (() => {
|
|
|
4671
4823
|
}
|
|
4672
4824
|
};
|
|
4673
4825
|
LoadingWidget.defaultProps = {
|
|
4674
|
-
...
|
|
4826
|
+
...import_core23.Widget.defaultProps,
|
|
4675
4827
|
id: "loading",
|
|
4676
4828
|
placement: "top-left",
|
|
4677
4829
|
viewId: null,
|
|
4678
4830
|
label: "Loading layer data"
|
|
4679
4831
|
};
|
|
4680
4832
|
|
|
4681
|
-
// src/fps-widget.tsx
|
|
4682
|
-
var import_core22 = __toESM(require_core(), 1);
|
|
4683
|
-
var FpsWidget = class extends import_core22.Widget {
|
|
4684
|
-
constructor(props = {}) {
|
|
4685
|
-
super(props);
|
|
4686
|
-
this.className = "deck-widget-fps";
|
|
4687
|
-
this.placement = "top-left";
|
|
4688
|
-
this._lastFps = -1;
|
|
4689
|
-
this.setProps(this.props);
|
|
4690
|
-
}
|
|
4691
|
-
setProps(props) {
|
|
4692
|
-
this.placement = props.placement ?? this.placement;
|
|
4693
|
-
this.viewId = props.viewId ?? this.viewId;
|
|
4694
|
-
super.setProps(props);
|
|
4695
|
-
}
|
|
4696
|
-
onAdd({}) {
|
|
4697
|
-
this._lastFps = this._getFps();
|
|
4698
|
-
requestAnimationFrame(() => this._animate());
|
|
4699
|
-
}
|
|
4700
|
-
onRenderHTML(rootElement) {
|
|
4701
|
-
const fps = this._getFps();
|
|
4702
|
-
B(
|
|
4703
|
-
/* @__PURE__ */ u2(IconButton, { children: /* @__PURE__ */ u2("div", { className: "text", children: [
|
|
4704
|
-
"FPS",
|
|
4705
|
-
/* @__PURE__ */ u2("br", {}),
|
|
4706
|
-
fps
|
|
4707
|
-
] }) }),
|
|
4708
|
-
rootElement
|
|
4709
|
-
);
|
|
4710
|
-
}
|
|
4711
|
-
_animate() {
|
|
4712
|
-
const fps = this._getFps();
|
|
4713
|
-
if (this._lastFps !== fps) {
|
|
4714
|
-
this._lastFps = fps;
|
|
4715
|
-
this.updateHTML();
|
|
4716
|
-
}
|
|
4717
|
-
requestAnimationFrame(() => this._animate());
|
|
4718
|
-
}
|
|
4719
|
-
_getFps() {
|
|
4720
|
-
return Math.round(this.deck?.metrics.fps ?? 0);
|
|
4721
|
-
}
|
|
4722
|
-
};
|
|
4723
|
-
FpsWidget.defaultProps = {
|
|
4724
|
-
...import_core22.Widget.defaultProps,
|
|
4725
|
-
id: "fps",
|
|
4726
|
-
placement: "top-left",
|
|
4727
|
-
viewId: null
|
|
4728
|
-
};
|
|
4729
|
-
|
|
4730
4833
|
// src/stats-widget.tsx
|
|
4731
|
-
var
|
|
4732
|
-
var
|
|
4834
|
+
var import_core24 = __toESM(require_core(), 1);
|
|
4835
|
+
var import_core25 = __toESM(require_core2(), 1);
|
|
4733
4836
|
var DEFAULT_COUNT_FORMATTER = (stat) => `${stat.name}: ${stat.count}`;
|
|
4734
4837
|
function formatTime(time) {
|
|
4735
4838
|
return time < 1e3 ? `${time.toFixed(2)}ms` : `${(time / 1e3).toFixed(2)}s`;
|
|
@@ -4745,7 +4848,7 @@ var __exports__ = (() => {
|
|
|
4745
4848
|
fps: (stat) => `${stat.name}: ${Math.round(stat.getHz())}fps`,
|
|
4746
4849
|
memory: (stat) => `${stat.name}: ${formatMemory(stat.count)}`
|
|
4747
4850
|
};
|
|
4748
|
-
var StatsWidget = class extends
|
|
4851
|
+
var StatsWidget = class extends import_core24.Widget {
|
|
4749
4852
|
constructor(props = {}) {
|
|
4750
4853
|
super(props);
|
|
4751
4854
|
this.className = "deck-widget-stats";
|
|
@@ -4756,6 +4859,9 @@ var __exports__ = (() => {
|
|
|
4756
4859
|
this.collapsed = !this.collapsed;
|
|
4757
4860
|
this.updateHTML();
|
|
4758
4861
|
};
|
|
4862
|
+
this._getFps = () => {
|
|
4863
|
+
return Math.round(this.deck?.metrics.fps ?? 0);
|
|
4864
|
+
};
|
|
4759
4865
|
this._formatters = { ...DEFAULT_FORMATTERS };
|
|
4760
4866
|
this._resetOnUpdate = { ...this.props.resetOnUpdate };
|
|
4761
4867
|
this.collapsed = !props.defaultIsExpanded;
|
|
@@ -4775,15 +4881,21 @@ var __exports__ = (() => {
|
|
|
4775
4881
|
}
|
|
4776
4882
|
super.setProps(props);
|
|
4777
4883
|
}
|
|
4778
|
-
|
|
4779
|
-
this.
|
|
4884
|
+
onRemove() {
|
|
4885
|
+
if (this.rootElement) {
|
|
4886
|
+
B(null, this.rootElement);
|
|
4887
|
+
}
|
|
4780
4888
|
}
|
|
4781
4889
|
onRenderHTML(rootElement) {
|
|
4782
|
-
const stats = this._getStats();
|
|
4783
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();
|
|
4784
4896
|
const title = this.props.title || ("id" in stats ? stats.id : null) || "Stats";
|
|
4785
4897
|
const items = [];
|
|
4786
|
-
if (
|
|
4898
|
+
if (stats) {
|
|
4787
4899
|
stats.forEach((stat) => {
|
|
4788
4900
|
const lines = this._getLines(stat).split("\n");
|
|
4789
4901
|
if (this._resetOnUpdate && this._resetOnUpdate[stat.name]) {
|
|
@@ -4806,19 +4918,21 @@ var __exports__ = (() => {
|
|
|
4806
4918
|
onClick: this._toggleCollapsed,
|
|
4807
4919
|
children: [
|
|
4808
4920
|
/* @__PURE__ */ u2("b", { children: title }),
|
|
4809
|
-
/* @__PURE__ */ u2("button", { className: "deck-widget-dropdown-button", children: /* @__PURE__ */ u2("span", { className:
|
|
4921
|
+
/* @__PURE__ */ u2("button", { className: "deck-widget-dropdown-button", children: /* @__PURE__ */ u2("span", { className: "deck-widget-dropdown-icon open" }) })
|
|
4810
4922
|
]
|
|
4811
4923
|
}
|
|
4812
4924
|
),
|
|
4813
|
-
|
|
4925
|
+
/* @__PURE__ */ u2("div", { className: "deck-widget-stats-content", children: items })
|
|
4814
4926
|
] }),
|
|
4815
4927
|
rootElement
|
|
4816
4928
|
);
|
|
4817
4929
|
}
|
|
4818
4930
|
onRedraw() {
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
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
|
+
}
|
|
4822
4936
|
}
|
|
4823
4937
|
}
|
|
4824
4938
|
_getStats() {
|
|
@@ -4827,7 +4941,7 @@ var __exports__ = (() => {
|
|
|
4827
4941
|
const metrics = this.deck?.metrics ?? {};
|
|
4828
4942
|
return Object.entries(metrics);
|
|
4829
4943
|
case "luma":
|
|
4830
|
-
return Array.from(
|
|
4944
|
+
return Array.from(import_core25.luma.stats.stats.values())[0];
|
|
4831
4945
|
case "device":
|
|
4832
4946
|
const device = this.deck?.device;
|
|
4833
4947
|
const stats = device?.statsManager.stats.values();
|
|
@@ -4849,7 +4963,7 @@ var __exports__ = (() => {
|
|
|
4849
4963
|
}
|
|
4850
4964
|
};
|
|
4851
4965
|
StatsWidget.defaultProps = {
|
|
4852
|
-
...
|
|
4966
|
+
...import_core24.Widget.defaultProps,
|
|
4853
4967
|
type: "deck",
|
|
4854
4968
|
placement: "top-left",
|
|
4855
4969
|
viewId: null,
|
|
@@ -4861,6 +4975,24 @@ var __exports__ = (() => {
|
|
|
4861
4975
|
resetOnUpdate: {},
|
|
4862
4976
|
id: "stats"
|
|
4863
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
|
+
}
|
|
4864
4996
|
return __toCommonJS(bundle_exports);
|
|
4865
4997
|
})();
|
|
4866
4998
|
return __exports__;
|