@deck.gl/widgets 9.1.11 → 9.2.0-alpha.1
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.d.ts +11 -34
- package/dist/compass-widget.d.ts.map +1 -1
- package/dist/compass-widget.js +27 -62
- package/dist/compass-widget.js.map +1 -1
- package/dist/context-menu-widget.d.ts +37 -0
- package/dist/context-menu-widget.d.ts.map +1 -0
- package/dist/context-menu-widget.js +74 -0
- package/dist/context-menu-widget.js.map +1 -0
- package/dist/dist.dev.js +2271 -581
- package/dist/fps-widget.d.ts +29 -0
- package/dist/fps-widget.d.ts.map +1 -0
- package/dist/fps-widget.js +51 -0
- package/dist/fps-widget.js.map +1 -0
- package/dist/fullscreen-widget.d.ts +15 -33
- package/dist/fullscreen-widget.d.ts.map +1 -1
- package/dist/fullscreen-widget.js +20 -51
- package/dist/fullscreen-widget.js.map +1 -1
- package/dist/geocoder-widget.d.ts +51 -0
- package/dist/geocoder-widget.d.ts.map +1 -0
- package/dist/geocoder-widget.js +138 -0
- package/dist/geocoder-widget.js.map +1 -0
- package/dist/gimbal-widget.d.ts +33 -0
- package/dist/gimbal-widget.d.ts.map +1 -0
- package/dist/gimbal-widget.js +116 -0
- package/dist/gimbal-widget.js.map +1 -0
- package/dist/index.cjs +1587 -341
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +37 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -7
- package/dist/index.js.map +1 -1
- package/dist/info-widget.d.ts +37 -0
- package/dist/info-widget.d.ts.map +1 -0
- package/dist/info-widget.js +183 -0
- package/dist/info-widget.js.map +1 -0
- package/dist/lib/components/button-group.d.ts +8 -0
- package/dist/lib/components/button-group.d.ts.map +1 -0
- package/dist/lib/components/button-group.js +7 -0
- package/dist/lib/components/button-group.js.map +1 -0
- package/dist/lib/components/dropdown-menu.d.ts +8 -0
- package/dist/lib/components/dropdown-menu.d.ts.map +1 -0
- package/dist/lib/components/dropdown-menu.js +55 -0
- package/dist/lib/components/dropdown-menu.js.map +1 -0
- package/dist/lib/components/grouped-icon-button.d.ts +8 -0
- package/dist/lib/components/grouped-icon-button.d.ts.map +1 -0
- package/dist/lib/components/grouped-icon-button.js +7 -0
- package/dist/lib/components/grouped-icon-button.js.map +1 -0
- package/dist/lib/components/icon-button.d.ts +11 -0
- package/dist/lib/components/icon-button.d.ts.map +1 -0
- package/dist/lib/components/icon-button.js +7 -0
- package/dist/lib/components/icon-button.js.map +1 -0
- package/dist/lib/components/icon-menu.d.ts +16 -0
- package/dist/lib/components/icon-menu.d.ts.map +1 -0
- package/dist/lib/components/icon-menu.js +49 -0
- package/dist/lib/components/icon-menu.js.map +1 -0
- package/dist/lib/components/simple-menu.d.ts +16 -0
- package/dist/lib/components/simple-menu.d.ts.map +1 -0
- package/dist/lib/components/simple-menu.js +30 -0
- package/dist/lib/components/simple-menu.js.map +1 -0
- package/dist/lib/geocode/geocoder-history.d.ts +23 -0
- package/dist/lib/geocode/geocoder-history.d.ts.map +1 -0
- package/dist/lib/geocode/geocoder-history.js +64 -0
- package/dist/lib/geocode/geocoder-history.js.map +1 -0
- package/dist/lib/geocode/geocoder.d.ts +15 -0
- package/dist/lib/geocode/geocoder.d.ts.map +1 -0
- package/dist/lib/geocode/geocoder.js +5 -0
- package/dist/lib/geocode/geocoder.js.map +1 -0
- package/dist/lib/geocode/geocoders.d.ts +68 -0
- package/dist/lib/geocode/geocoders.d.ts.map +1 -0
- package/dist/lib/geocode/geocoders.js +182 -0
- package/dist/lib/geocode/geocoders.js.map +1 -0
- package/dist/loading-widget.d.ts +26 -0
- package/dist/loading-widget.d.ts.map +1 -0
- package/dist/loading-widget.js +41 -0
- package/dist/loading-widget.js.map +1 -0
- package/dist/reset-view-widget.d.ts +4 -4
- package/dist/reset-view-widget.d.ts.map +1 -1
- package/dist/reset-view-widget.js +7 -10
- package/dist/reset-view-widget.js.map +1 -1
- package/dist/scale-widget.d.ts +28 -0
- package/dist/scale-widget.d.ts.map +1 -0
- package/dist/scale-widget.js +111 -0
- package/dist/scale-widget.js.map +1 -0
- package/dist/screenshot-widget.d.ts +4 -4
- package/dist/screenshot-widget.d.ts.map +1 -1
- package/dist/screenshot-widget.js +7 -14
- package/dist/screenshot-widget.js.map +1 -1
- package/dist/splitter-widget.d.ts +32 -0
- package/dist/splitter-widget.d.ts.map +1 -0
- package/dist/splitter-widget.js +123 -0
- package/dist/splitter-widget.js.map +1 -0
- package/dist/stats-widget.d.ts +36 -0
- package/dist/stats-widget.d.ts.map +1 -0
- package/dist/stats-widget.js +115 -0
- package/dist/stats-widget.js.map +1 -0
- package/dist/stylesheet.css +121 -4
- package/dist/theme-widget.d.ts +31 -0
- package/dist/theme-widget.d.ts.map +1 -0
- package/dist/theme-widget.js +83 -0
- package/dist/theme-widget.js.map +1 -0
- package/dist/themes.d.ts +65 -36
- package/dist/themes.d.ts.map +1 -1
- package/dist/themes.js +20 -8
- package/dist/themes.js.map +1 -1
- package/dist/timeline-widget.d.ts +59 -0
- package/dist/timeline-widget.d.ts.map +1 -0
- package/dist/timeline-widget.js +83 -0
- package/dist/timeline-widget.js.map +1 -0
- package/dist/view-selector-widget.d.ts +33 -0
- package/dist/view-selector-widget.d.ts.map +1 -0
- package/dist/view-selector-widget.js +62 -0
- package/dist/view-selector-widget.js.map +1 -0
- package/dist/zoom-widget.d.ts +14 -43
- package/dist/zoom-widget.d.ts.map +1 -1
- package/dist/zoom-widget.js +14 -56
- package/dist/zoom-widget.js.map +1 -1
- package/dist.min.js +3 -1
- package/package.json +4 -3
- package/src/compass-widget.tsx +44 -106
- package/src/context-menu-widget.tsx +115 -0
- package/src/fps-widget.tsx +67 -0
- package/src/fullscreen-widget.tsx +33 -86
- package/src/geocoder-widget.tsx +209 -0
- package/src/gimbal-widget.tsx +188 -0
- package/src/index.ts +58 -8
- package/src/info-widget.tsx +225 -0
- package/src/lib/components/button-group.tsx +16 -0
- package/src/lib/components/dropdown-menu.tsx +98 -0
- package/src/lib/components/grouped-icon-button.tsx +24 -0
- package/src/lib/components/icon-button.tsx +30 -0
- package/src/lib/components/icon-menu.tsx +89 -0
- package/src/lib/components/simple-menu.tsx +52 -0
- package/src/lib/geocode/geocoder-history.ts +73 -0
- package/src/lib/geocode/geocoder.ts +15 -0
- package/src/lib/geocode/geocoders.ts +199 -0
- package/src/loading-widget.tsx +67 -0
- package/src/reset-view-widget.tsx +8 -11
- package/src/scale-widget.tsx +183 -0
- package/src/screenshot-widget.tsx +9 -11
- package/src/splitter-widget.tsx +179 -0
- package/src/stats-widget.tsx +166 -0
- package/src/stylesheet.css +121 -4
- package/src/theme-widget.tsx +120 -0
- package/src/themes.ts +45 -12
- package/src/timeline-widget.tsx +155 -0
- package/src/view-selector-widget.tsx +108 -0
- package/src/zoom-widget.tsx +39 -113
- package/dist/components.d.ts +0 -4
- package/dist/components.d.ts.map +0 -1
- package/dist/components.js +0 -17
- package/dist/components.js.map +0 -1
- package/dist/widget-impl.d.ts +0 -29
- package/dist/widget-impl.d.ts.map +0 -1
- package/dist/widget-impl.js +0 -60
- package/dist/widget-impl.js.map +0 -1
- package/src/components.tsx +0 -38
- package/src/widget-impl.ts +0 -88
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot-widget.d.ts","sourceRoot":"","sources":["../src/screenshot-widget.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"screenshot-widget.d.ts","sourceRoot":"","sources":["../src/screenshot-widget.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAGlD,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG;IAChD,8DAA8D;IAC9D,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB;IACnB,WAAW,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IACzC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,MAAM,CAAC,qBAAqB,CAAC;IACjE,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAQlD;IAEF,SAAS,SAA4B;IACrC,SAAS,EAAE,eAAe,CAAc;gBAE5B,KAAK,GAAE,qBAA0B;IAK7C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,qBAAqB,CAAC;IAK9C,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAW5C,WAAW;IAYX,sEAAsE;IACtE,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAK/D,0BAA0B;IAC1B,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;CAMzD"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
-
// deck.gl
|
|
3
|
-
// SPDX-License-Identifier: MIT
|
|
4
|
-
// Copyright (c) vis.gl contributors
|
|
5
|
-
/* global document */
|
|
6
|
-
import { WidgetImpl } from "./widget-impl.js";
|
|
7
2
|
import { render } from 'preact';
|
|
8
|
-
import {
|
|
3
|
+
import { Widget } from '@deck.gl/core';
|
|
4
|
+
import { IconButton } from "./lib/components/icon-button.js";
|
|
9
5
|
/**
|
|
10
6
|
* A button widget that captures a screenshot of the current canvas and downloads it as a (png) file.
|
|
11
7
|
* @note only captures canvas contents, not HTML DOM or CSS styles
|
|
12
8
|
*/
|
|
13
|
-
export class ScreenshotWidget extends
|
|
9
|
+
export class ScreenshotWidget extends Widget {
|
|
14
10
|
constructor(props = {}) {
|
|
15
|
-
super(
|
|
11
|
+
super(props, ScreenshotWidget.defaultProps);
|
|
16
12
|
this.className = 'deck-widget-screenshot';
|
|
17
13
|
this.placement = 'top-left';
|
|
18
14
|
this.placement = props.placement ?? this.placement;
|
|
@@ -21,11 +17,8 @@ export class ScreenshotWidget extends WidgetImpl {
|
|
|
21
17
|
this.placement = props.placement ?? this.placement;
|
|
22
18
|
super.setProps(props);
|
|
23
19
|
}
|
|
24
|
-
onRenderHTML() {
|
|
25
|
-
|
|
26
|
-
if (!element)
|
|
27
|
-
return;
|
|
28
|
-
render(_jsx(IconButton, { className: "deck-widget-camera", label: this.props.label, onClick: this.handleClick.bind(this) }), element);
|
|
20
|
+
onRenderHTML(rootElement) {
|
|
21
|
+
render(_jsx(IconButton, { className: "deck-widget-camera", label: this.props.label, onClick: this.handleClick.bind(this) }), rootElement);
|
|
29
22
|
}
|
|
30
23
|
handleClick() {
|
|
31
24
|
// Allow user to override the capture logic
|
|
@@ -52,7 +45,7 @@ export class ScreenshotWidget extends WidgetImpl {
|
|
|
52
45
|
}
|
|
53
46
|
}
|
|
54
47
|
ScreenshotWidget.defaultProps = {
|
|
55
|
-
...
|
|
48
|
+
...Widget.defaultProps,
|
|
56
49
|
id: 'screenshot',
|
|
57
50
|
placement: 'top-left',
|
|
58
51
|
label: 'Screenshot',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot-widget.js","sourceRoot":"","sources":["../src/screenshot-widget.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"screenshot-widget.js","sourceRoot":"","sources":["../src/screenshot-widget.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,MAAM,EAAc,MAAM,eAAe,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,wCAAqC;AAgBxD;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,MAA6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AC1B,eAAe,CAAC,OAAe,EAAE,QAAgB;QAC/C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;;AA1DM,6BAAY,GAAoC;IACrD,GAAG,MAAM,CAAC,YAAY;IACtB,EAAE,EAAE,YAAY;IAChB,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,gBAAgB;IAC1B,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,SAAU;CACtB,AARkB,CAQjB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Widget, WidgetProps } from '@deck.gl/core';
|
|
2
|
+
/** Properties for the SplitterWidget */
|
|
3
|
+
export type SplitterWidgetProps = WidgetProps & {
|
|
4
|
+
/** The view id for the first (resizable) view */
|
|
5
|
+
viewId1: string;
|
|
6
|
+
/** The view id for the second view */
|
|
7
|
+
viewId2: string;
|
|
8
|
+
/** Orientation of the splitter: vertical (default) or horizontal */
|
|
9
|
+
orientation?: 'vertical' | 'horizontal';
|
|
10
|
+
/** The initial split percentage (0 to 1) for the first view, default 0.5 */
|
|
11
|
+
initialSplit?: number;
|
|
12
|
+
/** Callback invoked when the splitter is dragged with the new split value */
|
|
13
|
+
onChange?: (newSplit: number) => void;
|
|
14
|
+
/** Callback invoked when dragging starts */
|
|
15
|
+
onDragStart?: () => void;
|
|
16
|
+
/** Callback invoked when dragging ends */
|
|
17
|
+
onDragEnd?: () => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A draggable splitter widget that appears as a vertical or horizontal line
|
|
21
|
+
* across the deck.gl canvas. It positions itself based on the split percentage
|
|
22
|
+
* of the first view and provides callbacks when dragged.
|
|
23
|
+
*/
|
|
24
|
+
export declare class SplitterWidget extends Widget<SplitterWidgetProps> {
|
|
25
|
+
static defaultProps: Required<SplitterWidgetProps>;
|
|
26
|
+
className: string;
|
|
27
|
+
placement: "fill";
|
|
28
|
+
constructor(props: SplitterWidgetProps);
|
|
29
|
+
setProps(props: Partial<SplitterWidgetProps>): void;
|
|
30
|
+
onRenderHTML(rootElement: HTMLElement): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=splitter-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitter-widget.d.ts","sourceRoot":"","sources":["../src/splitter-widget.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAElD,wCAAwC;AACxC,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACxC,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,MAAM,CAAC,mBAAmB,CAAC;IAC7D,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAUhD;IAEF,SAAS,SAA0B;IACnC,SAAS,SAAmB;gBAEhB,KAAK,EAAE,mBAAmB;IAKtC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC;IAI5C,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;CAqB7C"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
// SplitterWidget.tsx
|
|
3
|
+
// deck.gl
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
|
+
// Copyright (c) vis.gl contributors
|
|
6
|
+
import { render } from 'preact';
|
|
7
|
+
import { useState, useRef } from 'preact/hooks';
|
|
8
|
+
import { Widget } from '@deck.gl/core';
|
|
9
|
+
/**
|
|
10
|
+
* A draggable splitter widget that appears as a vertical or horizontal line
|
|
11
|
+
* across the deck.gl canvas. It positions itself based on the split percentage
|
|
12
|
+
* of the first view and provides callbacks when dragged.
|
|
13
|
+
*/
|
|
14
|
+
export class SplitterWidget extends Widget {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
// No placement prop is used.
|
|
17
|
+
super(props, SplitterWidget.defaultProps);
|
|
18
|
+
this.className = 'deck-widget-splitter';
|
|
19
|
+
this.placement = 'fill';
|
|
20
|
+
}
|
|
21
|
+
setProps(props) {
|
|
22
|
+
super.setProps(props);
|
|
23
|
+
}
|
|
24
|
+
onRenderHTML(rootElement) {
|
|
25
|
+
// Ensure the widget container fills the deck.gl canvas.
|
|
26
|
+
// TODO - Move styling to CSS
|
|
27
|
+
rootElement.style.position = 'absolute';
|
|
28
|
+
rootElement.style.top = '0';
|
|
29
|
+
rootElement.style.left = '0';
|
|
30
|
+
rootElement.style.width = '100%';
|
|
31
|
+
rootElement.style.height = '100%';
|
|
32
|
+
rootElement.style.margin = '0px';
|
|
33
|
+
render(_jsx(Splitter, { orientation: this.props.orientation, initialSplit: this.props.initialSplit, onChange: this.props.onChange, onDragStart: this.props.onDragStart, onDragEnd: this.props.onDragEnd }), rootElement);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
SplitterWidget.defaultProps = {
|
|
37
|
+
...Widget.defaultProps,
|
|
38
|
+
id: 'splitter-widget',
|
|
39
|
+
viewId1: '',
|
|
40
|
+
viewId2: '',
|
|
41
|
+
orientation: 'vertical',
|
|
42
|
+
initialSplit: 0.5,
|
|
43
|
+
onChange: () => { },
|
|
44
|
+
onDragStart: () => { },
|
|
45
|
+
onDragEnd: () => { }
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A functional component that renders a draggable splitter line.
|
|
49
|
+
* It computes its position based on the provided split percentage and
|
|
50
|
+
* updates it during mouse drag events.
|
|
51
|
+
*/
|
|
52
|
+
function Splitter({ orientation, initialSplit, onChange, onDragStart, onDragEnd }) {
|
|
53
|
+
const [split, setSplit] = useState(initialSplit);
|
|
54
|
+
const dragging = useRef(false);
|
|
55
|
+
const containerRef = useRef(null);
|
|
56
|
+
const handleDragStart = (event) => {
|
|
57
|
+
dragging.current = true;
|
|
58
|
+
onDragStart?.();
|
|
59
|
+
document.addEventListener('mousemove', handleDragging);
|
|
60
|
+
document.addEventListener('mouseup', handleDragEnd);
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
};
|
|
63
|
+
const handleDragging = (event) => {
|
|
64
|
+
if (!dragging.current || !containerRef.current)
|
|
65
|
+
return;
|
|
66
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
67
|
+
let newSplit;
|
|
68
|
+
if (orientation === 'vertical') {
|
|
69
|
+
newSplit = (event.clientX - rect.left) / rect.width;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
newSplit = (event.clientY - rect.top) / rect.height;
|
|
73
|
+
}
|
|
74
|
+
// Clamp newSplit between 5% and 95%
|
|
75
|
+
newSplit = Math.min(Math.max(newSplit, 0.05), 0.95);
|
|
76
|
+
setSplit(newSplit);
|
|
77
|
+
onChange?.(newSplit);
|
|
78
|
+
};
|
|
79
|
+
const handleDragEnd = (event) => {
|
|
80
|
+
if (!dragging.current)
|
|
81
|
+
return;
|
|
82
|
+
dragging.current = false;
|
|
83
|
+
onDragEnd?.();
|
|
84
|
+
document.removeEventListener('mousemove', handleDragging);
|
|
85
|
+
document.removeEventListener('mouseup', handleDragEnd);
|
|
86
|
+
};
|
|
87
|
+
// The splitter line style based on orientation and the current split percentage.
|
|
88
|
+
const splitterStyle = orientation === 'vertical'
|
|
89
|
+
? {
|
|
90
|
+
position: 'absolute',
|
|
91
|
+
top: 0,
|
|
92
|
+
bottom: 0,
|
|
93
|
+
left: `${split * 100}%`,
|
|
94
|
+
width: '4px',
|
|
95
|
+
cursor: 'col-resize',
|
|
96
|
+
background: '#ccc',
|
|
97
|
+
zIndex: 10,
|
|
98
|
+
pointerEvents: 'auto',
|
|
99
|
+
boxShadow: 'inset -1px 0 0 white, inset 1px 0 0 white'
|
|
100
|
+
}
|
|
101
|
+
: {
|
|
102
|
+
position: 'absolute',
|
|
103
|
+
left: 0,
|
|
104
|
+
right: 0,
|
|
105
|
+
top: `${split * 100}%`,
|
|
106
|
+
height: '4px',
|
|
107
|
+
cursor: 'row-resize',
|
|
108
|
+
background: '#ccc',
|
|
109
|
+
zIndex: 10,
|
|
110
|
+
pointerEvents: 'auto',
|
|
111
|
+
boxShadow: 'inset -1px 0 0 white, inset 1px 0 0 white'
|
|
112
|
+
};
|
|
113
|
+
// Container style to fill the entire deck.gl canvas.
|
|
114
|
+
const containerStyle = {
|
|
115
|
+
position: 'absolute',
|
|
116
|
+
top: 0,
|
|
117
|
+
left: 0,
|
|
118
|
+
right: 0,
|
|
119
|
+
bottom: 0
|
|
120
|
+
};
|
|
121
|
+
return (_jsx("div", { ref: containerRef, style: containerStyle, children: _jsx("div", { style: splitterStyle, onMouseDown: handleDragStart }) }));
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=splitter-widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitter-widget.js","sourceRoot":"","sources":["../src/splitter-widget.tsx"],"names":[],"mappings":";AAAA,qBAAqB;AACrB,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAI,MAAM,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAE,MAAM,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2C;SACvD,CAAC;IAER,qDAAqD;IACrD,MAAM,cAAc,GAAwB;QAC1C,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC;IAEF,OAAO,CACL,cAAK,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,YAC3C,cACE,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,eAAuD,GACpE,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Widget, WidgetPlacement, WidgetProps } from '@deck.gl/core';
|
|
2
|
+
import type { Stats, Stat } from '@probe.gl/stats';
|
|
3
|
+
export declare const DEFAULT_FORMATTERS: Record<string, (stat: Stat) => string>;
|
|
4
|
+
export type StatsWidgetProps = WidgetProps & {
|
|
5
|
+
type?: 'deck' | 'luma' | 'device' | 'custom';
|
|
6
|
+
/** Stats object to visualize. */
|
|
7
|
+
stats?: Stats;
|
|
8
|
+
/** Title shown in the header of the pop-up. Defaults to stats.id. */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** How many redraws to wait between updates. */
|
|
11
|
+
framesPerUpdate?: number;
|
|
12
|
+
/** Custom formatters for stat values. */
|
|
13
|
+
formatters?: Record<string, string | ((stat: Stat) => string)>;
|
|
14
|
+
/** Whether to reset particular stats after each update. */
|
|
15
|
+
resetOnUpdate?: Record<string, boolean>;
|
|
16
|
+
};
|
|
17
|
+
/** Displays probe.gl stats in a floating pop-up. */
|
|
18
|
+
export declare class StatsWidget extends Widget<StatsWidgetProps> {
|
|
19
|
+
static defaultProps: Required<StatsWidgetProps>;
|
|
20
|
+
className: string;
|
|
21
|
+
placement: WidgetPlacement;
|
|
22
|
+
private _counter;
|
|
23
|
+
private _formatters;
|
|
24
|
+
private _resetOnUpdate;
|
|
25
|
+
collapsed: boolean;
|
|
26
|
+
_stats: Stats;
|
|
27
|
+
constructor(props?: StatsWidgetProps);
|
|
28
|
+
setProps(props: Partial<StatsWidgetProps>): void;
|
|
29
|
+
onAdd(): void;
|
|
30
|
+
onRenderHTML(rootElement: HTMLElement): void;
|
|
31
|
+
onRedraw(): void;
|
|
32
|
+
protected _getStats(): Stats;
|
|
33
|
+
protected _toggleCollapsed: () => void;
|
|
34
|
+
protected _getLines(stat: Stat): string[];
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=stats-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats-widget.d.ts","sourceRoot":"","sources":["../src/stats-widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAGnE,OAAO,KAAK,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAgBjD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAMrE,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC7C,iCAAiC;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC;IAC/D,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC,CAAC;AAEF,oDAAoD;AACpD,qBAAa,WAAY,SAAQ,MAAM,CAAC,gBAAgB,CAAC;IACvD,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAS7C;IAEF,SAAS,SAAuB;IAChC,SAAS,EAAiB,eAAe,CAAC;IAE1C,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,WAAW,CAAyC;IAC5D,OAAO,CAAC,cAAc,CAA0B;IAChD,SAAS,EAAE,OAAO,CAAQ;IAC1B,MAAM,EAAE,KAAK,CAAC;gBAEF,KAAK,GAAE,gBAAqB;IAQxC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAehD,KAAK,IAAI,IAAI;IAKb,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAqC5C,QAAQ,IAAI,IAAI;IAQhB,SAAS,CAAC,SAAS,IAAI,KAAK;IAmB5B,SAAS,CAAC,gBAAgB,QAAO,IAAI,CAGnC;IAEF,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE;CAK1C"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { Widget } from '@deck.gl/core';
|
|
3
|
+
import { luma } from '@luma.gl/core';
|
|
4
|
+
import { render } from 'preact';
|
|
5
|
+
const RIGHT_ARROW = '\u25b6';
|
|
6
|
+
const DOWN_ARROW = '\u2b07';
|
|
7
|
+
const DEFAULT_COUNT_FORMATTER = (stat) => `${stat.name}: ${stat.count}`;
|
|
8
|
+
function formatTime(time) {
|
|
9
|
+
return time < 1000 ? `${time.toFixed(2)}ms` : `${(time / 1000).toFixed(2)}s`;
|
|
10
|
+
}
|
|
11
|
+
function formatMemory(bytes) {
|
|
12
|
+
const mb = bytes / 1e6;
|
|
13
|
+
return `${mb.toFixed(1)} MB`;
|
|
14
|
+
}
|
|
15
|
+
export const DEFAULT_FORMATTERS = {
|
|
16
|
+
count: DEFAULT_COUNT_FORMATTER,
|
|
17
|
+
averageTime: (stat) => `${stat.name}: ${formatTime(stat.getAverageTime())}`,
|
|
18
|
+
totalTime: (stat) => `${stat.name}: ${formatTime(stat.time)}`,
|
|
19
|
+
fps: (stat) => `${stat.name}: ${Math.round(stat.getHz())}fps`,
|
|
20
|
+
memory: (stat) => `${stat.name}: ${formatMemory(stat.count)}`
|
|
21
|
+
};
|
|
22
|
+
/** Displays probe.gl stats in a floating pop-up. */
|
|
23
|
+
export class StatsWidget extends Widget {
|
|
24
|
+
constructor(props = {}) {
|
|
25
|
+
super(props, StatsWidget.defaultProps);
|
|
26
|
+
this.className = 'deck-widget-stats';
|
|
27
|
+
this.placement = 'top-left';
|
|
28
|
+
this._counter = 0;
|
|
29
|
+
this.collapsed = true;
|
|
30
|
+
this._toggleCollapsed = () => {
|
|
31
|
+
this.collapsed = !this.collapsed;
|
|
32
|
+
this.updateHTML();
|
|
33
|
+
};
|
|
34
|
+
this._formatters = { ...DEFAULT_FORMATTERS };
|
|
35
|
+
this.setProps(props);
|
|
36
|
+
this._resetOnUpdate = { ...this.props.resetOnUpdate };
|
|
37
|
+
this._stats = this.props.stats;
|
|
38
|
+
}
|
|
39
|
+
setProps(props) {
|
|
40
|
+
super.setProps(props);
|
|
41
|
+
this._stats = this._getStats();
|
|
42
|
+
if (props.formatters) {
|
|
43
|
+
for (const name in props.formatters) {
|
|
44
|
+
const f = props.formatters[name];
|
|
45
|
+
this._formatters[name] =
|
|
46
|
+
typeof f === 'string' ? DEFAULT_FORMATTERS[f] || DEFAULT_COUNT_FORMATTER : f;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (props.resetOnUpdate) {
|
|
50
|
+
this._resetOnUpdate = { ...props.resetOnUpdate };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
onAdd() {
|
|
54
|
+
this._stats = this._getStats();
|
|
55
|
+
this.updateHTML();
|
|
56
|
+
}
|
|
57
|
+
onRenderHTML(rootElement) {
|
|
58
|
+
const stats = this._stats;
|
|
59
|
+
const collapsed = this.collapsed;
|
|
60
|
+
const title = this.props.title || stats?.id || 'Stats';
|
|
61
|
+
const items = [];
|
|
62
|
+
if (!collapsed && stats) {
|
|
63
|
+
stats.forEach(stat => {
|
|
64
|
+
const lines = this._getLines(stat);
|
|
65
|
+
if (this._resetOnUpdate && this._resetOnUpdate[stat.name]) {
|
|
66
|
+
stat.reset();
|
|
67
|
+
}
|
|
68
|
+
lines.forEach((line, i) => {
|
|
69
|
+
items.push(_jsx("div", { style: { whiteSpace: 'pre' }, children: line }, `${stat.name}-${i}`));
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
render(_jsxs("div", { className: "deck-widget-stats-container", style: { cursor: 'default' }, children: [_jsxs("div", { className: "deck-widget-stats-header", style: { cursor: 'pointer', pointerEvents: 'auto' }, onClick: this._toggleCollapsed, children: [collapsed ? RIGHT_ARROW : DOWN_ARROW, " ", title] }), !collapsed && _jsx("div", { className: "deck-widget-stats-content deck-widget-common", children: items })] }), rootElement);
|
|
74
|
+
}
|
|
75
|
+
onRedraw() {
|
|
76
|
+
const framesPerUpdate = Math.max(1, this.props.framesPerUpdate || 1);
|
|
77
|
+
if (this._counter++ % framesPerUpdate === 0) {
|
|
78
|
+
console.log('Redrawing stats widget');
|
|
79
|
+
this.updateHTML();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
_getStats() {
|
|
83
|
+
switch (this.props.type) {
|
|
84
|
+
case 'deck':
|
|
85
|
+
// @ts-expect-error stats is protected
|
|
86
|
+
return this.deck?.stats;
|
|
87
|
+
case 'luma':
|
|
88
|
+
return Array.from(luma.stats.stats.values())[0];
|
|
89
|
+
case 'device':
|
|
90
|
+
// @ts-expect-error is protected
|
|
91
|
+
const device = this.deck?.device;
|
|
92
|
+
const stats = device?.statsManager.stats.values();
|
|
93
|
+
return stats ? Array.from(stats)[0] : undefined;
|
|
94
|
+
case 'custom':
|
|
95
|
+
return this.props.stats;
|
|
96
|
+
default:
|
|
97
|
+
throw new Error(`Unknown stats type: ${this.props.type}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
_getLines(stat) {
|
|
101
|
+
const formatter = this._formatters[stat.name] || this._formatters[stat.type || ''] || DEFAULT_COUNT_FORMATTER;
|
|
102
|
+
return formatter(stat).split('\n');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
StatsWidget.defaultProps = {
|
|
106
|
+
...Widget.defaultProps,
|
|
107
|
+
type: 'deck',
|
|
108
|
+
stats: undefined,
|
|
109
|
+
title: 'Stats',
|
|
110
|
+
framesPerUpdate: 1,
|
|
111
|
+
formatters: {},
|
|
112
|
+
resetOnUpdate: {},
|
|
113
|
+
id: 'stats'
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=stats-widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats-widget.js","sourceRoot":"","sources":["../src/stats-widget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAA+B,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AACnC,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAG9B,MAAM,WAAW,GAAG,QAAQ,CAAC;AAC7B,MAAM,UAAU,GAAG,QAAQ,CAAC;AAE5B,MAAM,uBAAuB,GAAG,CAAC,IAAU,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;AAEtF,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/E,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,EAAE,GAAG,KAAK,GAAG,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B,EAAE,EAAE,OAAO;CACZ,AATkB,CASjB"}
|
package/dist/stylesheet.css
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
flex-direction: column;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/* Common button styles */
|
|
38
|
+
/* Common button background styles */
|
|
39
39
|
.deck-widget-button-group button,
|
|
40
40
|
.deck-widget-button button {
|
|
41
41
|
width: calc(var(--button-size, 28px) - 2px);
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
border-bottom-left-radius: 0;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
/* Icon button styles */
|
|
82
|
+
/* Icon button foreground styles */
|
|
83
83
|
.deck-widget button .deck-widget-icon {
|
|
84
84
|
background-color: var(--button-icon-idle, #616166);
|
|
85
85
|
background-position: 50%;
|
|
@@ -116,6 +116,16 @@
|
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
@keyframes spin {
|
|
120
|
+
to {
|
|
121
|
+
transform: rotate(360deg);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.deck-widget.deck-widget-loading button.deck-widget-spinner-icon .deck-widget-icon {
|
|
126
|
+
animation: spin 1s linear infinite;
|
|
127
|
+
}
|
|
128
|
+
|
|
119
129
|
.deck-pseudo-fullscreen {
|
|
120
130
|
height: 100% !important;
|
|
121
131
|
left: 0 !important;
|
|
@@ -152,10 +162,117 @@
|
|
|
152
162
|
.deck-widget.deck-widget-screenshot button.deck-widget-camera .deck-widget-icon {
|
|
153
163
|
mask-image: var(
|
|
154
164
|
--icon-camera,
|
|
155
|
-
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="black"><path d="M480-260q75 0 127.5-52.5T660-440q0-75-52.5-127.5T480-620q-75 0-127.5 52.5T300-440q0 75 52.5 127.5T480-260Zm0-80q-42 0-71-29t-29-71q0-42 29-71t71-29q42 0 71 29t29 71q0 42-29 71t-71 29ZM160-120q-33 0-56.5-23.5T80-200v-480q0-33 23.5-56.5T160-760h126l74-80h240l74 80h126q33 0 56.5 23.5T880-680v480q0 33-23.5 56.5T800-120H160Zm0-80h640v-480H638l-73-80H395l-73 80H160v480Zm320-240Z"/></svg>')
|
|
165
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 -960 960 960" fill="black"><path d="M480-260q75 0 127.5-52.5T660-440q0-75-52.5-127.5T480-620q-75 0-127.5 52.5T300-440q0 75 52.5 127.5T480-260Zm0-80q-42 0-71-29t-29-71q0-42 29-71t71-29q42 0 71 29t29 71q0 42-29 71t-71 29ZM160-120q-33 0-56.5-23.5T80-200v-480q0-33 23.5-56.5T160-760h126l74-80h240l74 80h126q33 0 56.5 23.5T880-680v480q0 33-23.5 56.5T800-120H160Zm0-80h640v-480H638l-73-80H395l-73 80H160v480Zm320-240Z"/></svg>')
|
|
156
166
|
);
|
|
157
167
|
-webkit-mask-image: var(
|
|
158
168
|
--icon-camera,
|
|
159
|
-
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="black"><path d="M480-260q75 0 127.5-52.5T660-440q0-75-52.5-127.5T480-620q-75 0-127.5 52.5T300-440q0 75 52.5 127.5T480-260Zm0-80q-42 0-71-29t-29-71q0-42 29-71t71-29q42 0 71 29t29 71q0 42-29 71t-71 29ZM160-120q-33 0-56.5-23.5T80-200v-480q0-33 23.5-56.5T160-760h126l74-80h240l74 80h126q33 0 56.5 23.5T880-680v480q0 33-23.5 56.5T800-120H160Zm0-80h640v-480H638l-73-80H395l-73 80H160v480Zm320-240Z"/></svg>')
|
|
169
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 -960 960 960" fill="black"><path d="M480-260q75 0 127.5-52.5T660-440q0-75-52.5-127.5T480-620q-75 0-127.5 52.5T300-440q0 75 52.5 127.5T480-260Zm0-80q-42 0-71-29t-29-71q0-42 29-71t71-29q42 0 71 29t29 71q0 42-29 71t-71 29ZM160-120q-33 0-56.5-23.5T80-200v-480q0-33 23.5-56.5T160-760h126l74-80h240l74 80h126q33 0 56.5 23.5T880-680v480q0 33-23.5 56.5T800-120H160Zm0-80h640v-480H638l-73-80H395l-73 80H160v480Zm320-240Z"/></svg>')
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* Theme widget styles */
|
|
174
|
+
.deck-widget.deck-widget-theme button.deck-widget-sun .deck-widget-icon {
|
|
175
|
+
mask-image: var(
|
|
176
|
+
--icon-sun,
|
|
177
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="black" stroke="black"><g ><circle cx="12" cy="12" r="6" /><line x1="12" y1="1" x2="12" y2="3" /><line x1="12" y1="21" x2="12" y2="23" /><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" /><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" /><line x1="1" y1="12" x2="3" y2="12" /><line x1="21" y1="12" x2="23" y2="12" /><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" /><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" /></g></svg>')
|
|
160
178
|
);
|
|
161
179
|
}
|
|
180
|
+
|
|
181
|
+
.deck-widget.deck-widget-theme button.deck-widget-moon .deck-widget-icon {
|
|
182
|
+
mask-image: var(
|
|
183
|
+
--icon-moon,
|
|
184
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" ><circle cx="12" cy="12" r="6" fill="black" mask="url(%23moon-mask)" /><mask id="moon-mask" viewBox="0 0 24 24" ><rect x="0" y="0" width="24" height="24" fill="white" /><circle cx="24" cy="10" r="12" fill="black"/></mask></svg>')
|
|
185
|
+
);
|
|
186
|
+
-webbit-mask-image: var(
|
|
187
|
+
--icon-moon,
|
|
188
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24"><circle x="12" cy="12" r="6" /></svg>')
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* Reset view styles */
|
|
193
|
+
.deck-widget.deck-widget-reset-view button.deck-widget-reset-focus .deck-widget-icon {
|
|
194
|
+
mask-image: var(
|
|
195
|
+
--icon-camera,
|
|
196
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="black"><path d="M480-320v-100q0-25 17.5-42.5T540-480h100v60H540v100h-60Zm60 240q-25 0-42.5-17.5T480-140v-100h60v100h100v60H540Zm280-240v-100H720v-60h100q25 0 42.5 17.5T880-420v100h-60ZM720-80v-60h100v-100h60v100q0 25-17.5 42.5T820-80H720Zm111-480h-83q-26-88-99-144t-169-56q-117 0-198.5 81.5T200-480q0 72 32.5 132t87.5 98v-110h80v240H160v-80h94q-62-50-98-122.5T120-480q0-75 28.5-140.5t77-114q48.5-48.5 114-77T480-840q129 0 226.5 79.5T831-560Z"/></svg>')
|
|
197
|
+
);
|
|
198
|
+
-webkit-mask-image: var(
|
|
199
|
+
--icon-camera,
|
|
200
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="black"><path d="M480-320v-100q0-25 17.5-42.5T540-480h100v60H540v100h-60Zm60 240q-25 0-42.5-17.5T480-140v-100h60v100h100v60H540Zm280-240v-100H720v-60h100q25 0 42.5 17.5T880-420v100h-60ZM720-80v-60h100v-100h60v100q0 25-17.5 42.5T820-80H720Zm111-480h-83q-26-88-99-144t-169-56q-117 0-198.5 81.5T200-480q0 72 32.5 132t87.5 98v-110h80v240H160v-80h94q-62-50-98-122.5T120-480q0-75 28.5-140.5t77-114q48.5-48.5 114-77T480-840q129 0 226.5 79.5T831-560Z"/></svg>')
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* Timeline widget styles */
|
|
205
|
+
.deck-widget.deck-widget-timeline {
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
pointer-events: 'auto';
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.deck-widget.deck-widget-timeline .timeline-slider {
|
|
212
|
+
margin: 0 8px;
|
|
213
|
+
flex: 1;
|
|
214
|
+
pointer-events: 'auto';
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.deck-widget.deck-widget-timeline button.timeline-play-pause {
|
|
219
|
+
background: var(--button-background, #fff);
|
|
220
|
+
border: var(--button-inner-stroke, unset);
|
|
221
|
+
border-radius: var(--button-corner-radius, 4px);
|
|
222
|
+
width: var(--button-size, 28px);
|
|
223
|
+
height: var(--button-size, 28px);
|
|
224
|
+
cursor: pointer;
|
|
225
|
+
display: flex;
|
|
226
|
+
align-items: center;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
padding: 0;
|
|
229
|
+
pointer-events: 'auto';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.deck-widget-spinner-icon {
|
|
233
|
+
mask-image: var(
|
|
234
|
+
--loading-icon,
|
|
235
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" ><path d="M21 12a9 9 0 1 1-6.219-8.56" /></svg>')
|
|
236
|
+
);
|
|
237
|
+
-webkit-mask-image: var(
|
|
238
|
+
--loading-icon,
|
|
239
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" ><path d="M21 12a9 9 0 1 1-6.219-8.56" /></svg>')
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.deck-widget .deck-widget-scale {
|
|
244
|
+
background-color: var(--button-icon-idle, #616166);
|
|
245
|
+
background-position: 50%;
|
|
246
|
+
display: block;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.deck-widget .deck-widget-geolocate {
|
|
250
|
+
pointer-events: auto;
|
|
251
|
+
cursor: pointer;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Reusable styles for widgets
|
|
256
|
+
*/
|
|
257
|
+
.deck-widget-common {
|
|
258
|
+
font-family:
|
|
259
|
+
'SF Mono',
|
|
260
|
+
/* macOS */
|
|
261
|
+
'Menlo',
|
|
262
|
+
/* macOS */
|
|
263
|
+
'Consolas',
|
|
264
|
+
/* Windows */
|
|
265
|
+
'DejaVu Sans Mono',
|
|
266
|
+
/* Linux */
|
|
267
|
+
'Liberation Mono',
|
|
268
|
+
/* Linux */
|
|
269
|
+
monospace;
|
|
270
|
+
background-color: var(--button-background, #fff);
|
|
271
|
+
color: #333;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.deck-widget-stats-container {
|
|
275
|
+
font-size: 0.7rem;
|
|
276
|
+
/* Approximately 14px */
|
|
277
|
+
line-height: 1.6;
|
|
278
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Widget, WidgetProps, WidgetPlacement } from '@deck.gl/core';
|
|
2
|
+
import type { DeckWidgetTheme } from "./themes.js";
|
|
3
|
+
export type ThemeWidgetProps = WidgetProps & {
|
|
4
|
+
/** Widget positioning within the view. Default 'top-left'. */
|
|
5
|
+
placement?: WidgetPlacement;
|
|
6
|
+
/** Tooltip message when dark mode is selected. */
|
|
7
|
+
lightModeLabel?: string;
|
|
8
|
+
/** Styles for light mode theme */
|
|
9
|
+
lightModeTheme?: DeckWidgetTheme;
|
|
10
|
+
/** Tooltip message when light mode is selected. */
|
|
11
|
+
darkModeLabel?: string;
|
|
12
|
+
/** Styles for dark mode theme */
|
|
13
|
+
darkModeTheme?: DeckWidgetTheme;
|
|
14
|
+
/** Initial theme mode. 'auto' reads the browser default setting */
|
|
15
|
+
initialThemeMode?: 'auto' | 'light' | 'dark';
|
|
16
|
+
};
|
|
17
|
+
export declare class ThemeWidget extends Widget<ThemeWidgetProps> {
|
|
18
|
+
static defaultProps: Required<ThemeWidgetProps>;
|
|
19
|
+
className: string;
|
|
20
|
+
placement: WidgetPlacement;
|
|
21
|
+
themeMode: 'light' | 'dark';
|
|
22
|
+
constructor(props?: ThemeWidgetProps);
|
|
23
|
+
setProps(props: Partial<ThemeWidgetProps>): void;
|
|
24
|
+
onRenderHTML(rootElement: HTMLElement): void;
|
|
25
|
+
onAdd(): void;
|
|
26
|
+
_handleClick(): void;
|
|
27
|
+
_setThemeMode(themeMode: 'light' | 'dark'): void;
|
|
28
|
+
/** Read browser preference */
|
|
29
|
+
_getInitialThemeMode(): 'light' | 'dark';
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=theme-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-widget.d.ts","sourceRoot":"","sources":["../src/theme-widget.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAInE,OAAO,KAAK,EAAC,eAAe,EAAC,oBAAiB;AAG9C,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,8DAA8D;IAC9D,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CAC9C,CAAC;AAEF,qBAAa,WAAY,SAAQ,MAAM,CAAC,gBAAgB,CAAC;IACvD,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAS7C;IAEF,SAAS,SAAuB;IAChC,SAAS,EAAE,eAAe,CAAc;IACxC,SAAS,EAAE,OAAO,GAAG,MAAM,CAAU;gBAEzB,KAAK,GAAE,gBAAqB;IAOxC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAoBzC,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAc5C,KAAK;IAKL,YAAY;IAKZ,aAAa,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM;IAgBzC,8BAA8B;IAC9B,oBAAoB,IAAI,OAAO,GAAG,MAAM;CAQzC"}
|