@deck.gl-community/widgets 9.3.1-alpha.0 → 9.3.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.
Files changed (33) hide show
  1. package/dist/index.cjs +1858 -2188
  2. package/dist/index.cjs.map +4 -4
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/lib/settings/settings.d.ts +33 -7
  8. package/dist/lib/settings/settings.d.ts.map +1 -1
  9. package/dist/lib/settings/settings.js.map +1 -1
  10. package/dist/widget-panels/keyboard-shortcuts-widget.d.ts +0 -25
  11. package/dist/widget-panels/keyboard-shortcuts-widget.d.ts.map +1 -1
  12. package/dist/widget-panels/keyboard-shortcuts-widget.js +2 -147
  13. package/dist/widget-panels/keyboard-shortcuts-widget.js.map +1 -1
  14. package/dist/widget-panels/settings-panel.js +1 -1
  15. package/dist/widget-panels/settings-panel.js.map +1 -1
  16. package/dist/widget-panels/settings-panel.test.js +1 -1
  17. package/dist/widget-panels/settings-panel.test.js.map +1 -1
  18. package/package.json +2 -2
  19. package/src/index.ts +5 -8
  20. package/src/lib/settings/settings.ts +40 -15
  21. package/src/widget-panels/keyboard-shortcuts-widget.tsx +1 -247
  22. package/src/widget-panels/settings-panel.test.tsx +1 -1
  23. package/src/widget-panels/settings-panel.tsx +1 -1
  24. package/dist/widgets/keyboard-shortcuts-widget.d.ts +0 -28
  25. package/dist/widgets/keyboard-shortcuts-widget.d.ts.map +0 -1
  26. package/dist/widgets/keyboard-shortcuts-widget.js +0 -125
  27. package/dist/widgets/keyboard-shortcuts-widget.js.map +0 -1
  28. package/dist/widgets/settings-widget.d.ts +0 -64
  29. package/dist/widgets/settings-widget.d.ts.map +0 -1
  30. package/dist/widgets/settings-widget.js +0 -148
  31. package/dist/widgets/settings-widget.js.map +0 -1
  32. package/src/widgets/keyboard-shortcuts-widget.tsx +0 -245
  33. package/src/widgets/settings-widget.tsx +0 -277
@@ -1,17 +1,42 @@
1
- import type {
2
- SettingsWidgetOption,
3
- SettingsWidgetSchema,
4
- SettingsWidgetSectionDescriptor,
5
- SettingsWidgetSettingDescriptor,
6
- SettingsWidgetState,
7
- SettingsWidgetValue
8
- } from '../../widgets/settings-widget';
9
-
10
- export type SettingValue = SettingsWidgetValue;
11
- export type SettingDescriptor = SettingsWidgetSettingDescriptor;
12
- export type SettingsSectionDescriptor = SettingsWidgetSectionDescriptor;
13
- export type SettingsSchema = SettingsWidgetSchema;
14
- export type SettingsState = SettingsWidgetState;
1
+ export type SettingValue = boolean | number | string;
2
+
3
+ export type SettingsOption =
4
+ | SettingValue
5
+ | {
6
+ label: string;
7
+ value: SettingValue;
8
+ };
9
+
10
+ export type SettingDescriptor = {
11
+ /** Path in the settings object (dot notation supported). */
12
+ name: string;
13
+ /** Human-friendly label shown in the control list. Defaults to `name`. */
14
+ label?: string;
15
+ description?: string;
16
+ type: 'boolean' | 'number' | 'string' | 'select';
17
+ min?: number;
18
+ max?: number;
19
+ step?: number;
20
+ options?: SettingsOption[];
21
+ defaultValue?: SettingValue;
22
+ };
23
+
24
+ export type SettingsSectionDescriptor = {
25
+ /** Optional stable id for preserving collapse state across re-renders. */
26
+ id?: string;
27
+ name: string;
28
+ description?: string;
29
+ /** Whether this section starts collapsed when first seen. Defaults to true. */
30
+ initiallyCollapsed?: boolean;
31
+ settings: SettingDescriptor[];
32
+ };
33
+
34
+ export type SettingsSchema = {
35
+ title?: string;
36
+ sections: SettingsSectionDescriptor[];
37
+ };
38
+
39
+ export type SettingsState = Record<string, unknown>;
15
40
 
16
41
  export function clamp(value: number, min?: number, max?: number): number {
17
42
  let clamped = value;
@@ -70,7 +95,7 @@ export function buildInitialCollapsedState(
70
95
  }, {});
71
96
  }
72
97
 
73
- export function normalizeOption(option: SettingsWidgetOption): {
98
+ export function normalizeOption(option: SettingsOption): {
74
99
  label: string;
75
100
  value: SettingValue;
76
101
  } {
@@ -1,21 +1,11 @@
1
1
  /** @jsxImportSource preact */
2
- import {Widget} from '@deck.gl/core';
3
- import {render} from 'preact';
4
2
 
5
- import {DEFAULT_SHORTCUTS, formatKey} from '../keyboard-shortcuts/keyboard-shortcuts';
6
- import {KeyboardShortcutsManager} from '../keyboard-shortcuts/keyboard-shortcuts-manager';
3
+ import {formatKey} from '../keyboard-shortcuts/keyboard-shortcuts';
7
4
 
8
5
  import type {KeyboardShortcut} from '../keyboard-shortcuts/keyboard-shortcuts';
9
6
  import type {WidgetPanel, WidgetPanelTheme} from './widget-containers';
10
- import type {WidgetPlacement, WidgetProps} from '@deck.gl/core';
11
7
  import type {JSX} from 'preact';
12
8
 
13
- export type KeyboardShortcutsWidgetProps = WidgetProps & {
14
- placement?: WidgetPlacement;
15
- keyboardShortcuts: KeyboardShortcut[];
16
- installShortcuts?: boolean;
17
- };
18
-
19
9
  export type KeyboardShortcutsPanelProps = {
20
10
  /** Optional list of keyboard shortcuts to render in the panel. */
21
11
  keyboardShortcuts?: KeyboardShortcut[];
@@ -38,156 +28,6 @@ export class KeyboardShortcutsPanel implements WidgetPanel {
38
28
  }
39
29
  }
40
30
 
41
- export class KeyboardShortcutsWidget extends Widget<KeyboardShortcutsWidgetProps> {
42
- static override defaultProps = {
43
- ...Widget.defaultProps,
44
- id: 'keyboard-bindings',
45
- placement: 'top-left',
46
- keyboardShortcuts: []
47
- } satisfies Required<WidgetProps> &
48
- Required<Pick<KeyboardShortcutsWidgetProps, 'placement' | 'keyboardShortcuts'>> &
49
- KeyboardShortcutsWidgetProps;
50
-
51
- className = 'deck-widget-keyboard-bindings';
52
- placement: WidgetPlacement = KeyboardShortcutsWidget.defaultProps.placement;
53
-
54
- #isOpen = false;
55
- #rootElement: HTMLElement | null = null;
56
- #keyboardShortcuts: KeyboardShortcut[] = KeyboardShortcutsWidget.defaultProps.keyboardShortcuts;
57
- #keyboardShortcutsManager: KeyboardShortcutsManager | null = null;
58
-
59
- constructor(props: KeyboardShortcutsWidgetProps) {
60
- super({...KeyboardShortcutsWidget.defaultProps, ...props});
61
- this.#keyboardShortcuts = props.keyboardShortcuts;
62
- if (props.placement !== undefined) {
63
- this.placement = props.placement;
64
- }
65
- }
66
-
67
- override setProps(props: Partial<KeyboardShortcutsWidgetProps>): void {
68
- if (props.keyboardShortcuts !== undefined) {
69
- this.#keyboardShortcuts = props.keyboardShortcuts;
70
- this.#restartKeyboardShortcutsManager();
71
- this.#renderRootElement();
72
- }
73
- if (props.installShortcuts !== undefined) {
74
- this.#restartKeyboardShortcutsManager();
75
- }
76
- if (props.placement !== undefined) {
77
- this.placement = props.placement;
78
- }
79
- super.setProps(props);
80
- }
81
-
82
- override onAdd(): void {
83
- this.#restartKeyboardShortcutsManager();
84
- }
85
-
86
- override onRenderHTML(rootElement: HTMLElement): void {
87
- this.#rootElement = rootElement;
88
-
89
- const className = ['deck-widget', this.className, this.props.className]
90
- .filter(Boolean)
91
- .join(' ');
92
- rootElement.className = className;
93
-
94
- this.#renderRootElement();
95
- }
96
-
97
- override onRemove(): void {
98
- if (this.#rootElement) {
99
- render(null, this.#rootElement);
100
- }
101
- if (this.#keyboardShortcutsManager) {
102
- this.#keyboardShortcutsManager.stop();
103
- this.#keyboardShortcutsManager = null;
104
- }
105
- }
106
-
107
- #restartKeyboardShortcutsManager(): void {
108
- if (this.#keyboardShortcutsManager) {
109
- this.#keyboardShortcutsManager.stop();
110
- this.#keyboardShortcutsManager = null;
111
- }
112
- // @ts-expect-error Accessing protected member 'eventManager'.
113
- const eventManager = this.deck?.eventManager;
114
- if (eventManager && this.props.installShortcuts) {
115
- this.#keyboardShortcutsManager = new KeyboardShortcutsManager(
116
- eventManager,
117
- this.#getEffectiveKeyboardShortcuts()
118
- );
119
- this.#keyboardShortcutsManager.start();
120
- }
121
- }
122
-
123
- #renderRootElement(): void {
124
- if (!this.#rootElement) {
125
- return;
126
- }
127
-
128
- render(
129
- <KeyboardShortcutsWidgetView
130
- isOpen={this.#isOpen}
131
- keyboardShortcuts={this.#getEffectiveKeyboardShortcuts()}
132
- onClose={this.#handleClose}
133
- onOpen={this.#handleOpen}
134
- />,
135
- this.#rootElement
136
- );
137
- }
138
-
139
- #getEffectiveKeyboardShortcuts(): KeyboardShortcut[] {
140
- return [
141
- ...DEFAULT_SHORTCUTS.map((shortcut) => ({
142
- ...shortcut,
143
- onKeyPress: this.#handleOpen
144
- })),
145
- ...this.#keyboardShortcuts
146
- ];
147
- }
148
-
149
- #handleOpen = (): void => {
150
- if (this.#isOpen) {
151
- return;
152
- }
153
-
154
- this.#isOpen = true;
155
- this.#renderRootElement();
156
- };
157
-
158
- #handleClose = (): void => {
159
- if (!this.#isOpen) {
160
- return;
161
- }
162
-
163
- this.#isOpen = false;
164
- this.#renderRootElement();
165
- };
166
- }
167
-
168
- const MODAL_BACKDROP_STYLE: JSX.CSSProperties = {
169
- position: 'fixed',
170
- inset: 0,
171
- display: 'flex',
172
- alignItems: 'center',
173
- justifyContent: 'center',
174
- backgroundColor: 'rgba(15, 23, 42, 0.28)',
175
- pointerEvents: 'auto',
176
- zIndex: 1000
177
- };
178
-
179
- const MODAL_STYLE: JSX.CSSProperties = {
180
- width: 'min(640px, calc(100vw - 24px))',
181
- maxHeight: 'min(520px, calc(100vh - 24px))',
182
- borderRadius: '14px',
183
- border: '1px solid rgba(148, 163, 184, 0.75)',
184
- backgroundColor: 'rgba(255, 255, 255, 0.98)',
185
- boxShadow: '0 14px 40px rgba(15, 23, 42, 0.28)',
186
- display: 'flex',
187
- flexDirection: 'column',
188
- overflow: 'hidden'
189
- };
190
-
191
31
  const KEY_STYLE: JSX.CSSProperties = {
192
32
  borderRadius: '6px',
193
33
  border: '1px solid rgba(148, 163, 184, 0.85)',
@@ -197,7 +37,6 @@ const KEY_STYLE: JSX.CSSProperties = {
197
37
  color: 'var(--button-text, #0f172a)',
198
38
  whiteSpace: 'nowrap'
199
39
  };
200
- const ICON_COLOR = 'var(--button-icon-idle, var(--button-text, currentColor))';
201
40
  const SHORTCUT_BADGE_STYLE: JSX.CSSProperties = {
202
41
  display: 'inline-flex',
203
42
  alignItems: 'center',
@@ -250,91 +89,6 @@ const SHORTCUT_CHORD_STYLE: JSX.CSSProperties = {
250
89
  whiteSpace: 'nowrap'
251
90
  };
252
91
 
253
- function KeyboardShortcutsWidgetView({
254
- isOpen,
255
- keyboardShortcuts,
256
- onClose,
257
- onOpen
258
- }: {
259
- isOpen: boolean;
260
- keyboardShortcuts: KeyboardShortcut[];
261
- onClose: () => void;
262
- onOpen: () => void;
263
- }) {
264
- return (
265
- <>
266
- <div className="deck-widget-button">
267
- <button
268
- className="deck-widget-icon-button"
269
- style={{color: 'var(--button-text, currentColor)'}}
270
- type="button"
271
- title="Keyboard shortcuts"
272
- aria-label="Keyboard shortcuts"
273
- onClick={onOpen}
274
- >
275
- <span
276
- style={{
277
- fontSize: '12px',
278
- fontWeight: 700,
279
- color: ICON_COLOR
280
- }}
281
- >
282
- <kbd
283
- style={{
284
- color: ICON_COLOR
285
- }}
286
- >
287
- ?
288
- </kbd>
289
- </span>
290
- </button>
291
- </div>
292
-
293
- {isOpen && (
294
- <div style={MODAL_BACKDROP_STYLE} onClick={onClose}>
295
- <div
296
- style={MODAL_STYLE}
297
- role="dialog"
298
- aria-label="Keyboard Shortcuts"
299
- onClick={(event) => event.stopPropagation()}
300
- >
301
- <div
302
- style={{
303
- display: 'flex',
304
- alignItems: 'center',
305
- justifyContent: 'space-between',
306
- borderBottom: '1px solid rgba(226, 232, 240, 1)',
307
- padding: '10px 12px'
308
- }}
309
- >
310
- <div style={{fontSize: '14px', fontWeight: 700, color: 'rgb(30, 41, 59)'}}>
311
- Keyboard Shortcuts
312
- </div>
313
- <button
314
- type="button"
315
- onClick={onClose}
316
- style={{
317
- border: 0,
318
- background: 'transparent',
319
- color: 'rgb(71, 85, 105)',
320
- cursor: 'pointer',
321
- fontSize: '18px',
322
- lineHeight: '18px'
323
- }}
324
- aria-label="Close keyboard shortcuts"
325
- title="Close"
326
- >
327
- ×
328
- </button>
329
- </div>
330
- <KeyboardSettingsPanelContent keyboardShortcuts={keyboardShortcuts} />
331
- </div>
332
- </div>
333
- )}
334
- </>
335
- );
336
- }
337
-
338
92
  function KeyboardSettingsPanelContent({
339
93
  keyboardShortcuts
340
94
  }: {
@@ -151,7 +151,7 @@ describe('SettingsPanel', () => {
151
151
 
152
152
  expect(root.querySelector('select')).toBeNull();
153
153
 
154
- const selectButton = getRequiredButton(root, '#settings-widget-input-mode');
154
+ const selectButton = getRequiredButton(root, '#settings-panel-input-mode');
155
155
  selectButton.click();
156
156
  await Promise.resolve();
157
157
 
@@ -257,7 +257,7 @@ function StringSettingControl({inputId, label, value, onApply}: StringSettingCon
257
257
  function SettingsControl({setting, value, onValueChange}: SettingsControlProps) {
258
258
  const label = setting.label ?? setting.name;
259
259
  const tooltip = setting.description?.trim();
260
- const inputId = `settings-widget-input-${setting.name.replace(/[^a-zA-Z0-9_-]/g, '-')}`;
260
+ const inputId = `settings-panel-input-${setting.name.replace(/[^a-zA-Z0-9_-]/g, '-')}`;
261
261
 
262
262
  const handleBooleanChange: JSX.GenericEventHandler<HTMLInputElement> = (event) => {
263
263
  onValueChange(event.currentTarget.checked);
@@ -1,28 +0,0 @@
1
- /** @jsxImportSource preact */
2
- import { Widget } from '@deck.gl/core';
3
- import type { KeyboardShortcut } from "../keyboard-shortcuts/keyboard-shortcuts.js";
4
- import type { WidgetPlacement, WidgetProps } from '@deck.gl/core';
5
- export type KeyboardShortcutsWidgetProps = WidgetProps & {
6
- placement?: WidgetPlacement;
7
- keyboardShortcuts: KeyboardShortcut[];
8
- installShortcuts?: boolean;
9
- };
10
- export declare class KeyboardShortcutsWidget extends Widget<KeyboardShortcutsWidgetProps> {
11
- #private;
12
- static defaultProps: {
13
- id: string;
14
- placement: "top-left";
15
- keyboardShortcuts: any[];
16
- style: Partial<CSSStyleDeclaration>;
17
- className: string;
18
- _container: string | HTMLDivElement | null;
19
- };
20
- className: string;
21
- placement: WidgetPlacement;
22
- constructor(props: KeyboardShortcutsWidgetProps);
23
- setProps(props: Partial<KeyboardShortcutsWidgetProps>): void;
24
- onAdd(): void;
25
- onRenderHTML(rootElement: HTMLElement): void;
26
- onRemove(): void;
27
- }
28
- //# sourceMappingURL=keyboard-shortcuts-widget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyboard-shortcuts-widget.d.ts","sourceRoot":"","sources":["../../src/widgets/keyboard-shortcuts-widget.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAOrC,OAAO,KAAK,EAAC,gBAAgB,EAAC,oDAAiD;AAC/E,OAAO,KAAK,EAAC,eAAe,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAGhE,MAAM,MAAM,4BAA4B,GAAG,WAAW,GAAG;IACvD,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,qBAAa,uBAAwB,SAAQ,MAAM,CAAC,4BAA4B,CAAC;;IAC/E,OAAgB,YAAY;;;;;;;MAOG;IAE/B,SAAS,SAAmC;IAC5C,SAAS,EAAE,eAAe,CAAkD;gBAMhE,KAAK,EAAE,4BAA4B;IAQtC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAAG,IAAI;IAU5D,KAAK,IAAI,IAAI;IAYb,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAc5C,QAAQ,IAAI,IAAI;CAS1B"}
@@ -1,125 +0,0 @@
1
- var _a;
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
3
- /** @jsxImportSource preact */
4
- import { Widget } from '@deck.gl/core';
5
- import { render } from 'preact';
6
- import { useState } from 'preact/hooks';
7
- import { formatKey } from "../keyboard-shortcuts/keyboard-shortcuts.js";
8
- import { KeyboardShortcutsManager } from "../keyboard-shortcuts/keyboard-shortcuts-manager.js";
9
- export class KeyboardShortcutsWidget extends Widget {
10
- static defaultProps = {
11
- ...Widget.defaultProps,
12
- id: 'keyboard-bindings',
13
- placement: 'top-left',
14
- keyboardShortcuts: []
15
- };
16
- className = 'deck-widget-keyboard-bindings';
17
- placement = _a.defaultProps.placement;
18
- #rootElement = null;
19
- #keyboardShortcuts = _a.defaultProps.keyboardShortcuts;
20
- #keyboardShortcutsManager = null;
21
- constructor(props) {
22
- super({ ..._a.defaultProps, ...props });
23
- this.#keyboardShortcuts = props.keyboardShortcuts;
24
- if (props.placement !== undefined) {
25
- this.placement = props.placement;
26
- }
27
- }
28
- setProps(props) {
29
- if (props.keyboardShortcuts !== undefined) {
30
- this.#keyboardShortcuts = props.keyboardShortcuts;
31
- }
32
- if (props.placement !== undefined) {
33
- this.placement = props.placement;
34
- }
35
- super.setProps(props);
36
- }
37
- onAdd() {
38
- // @ts-expect-error Accessing protected member 'eventManager'.
39
- const eventManager = this.deck?.eventManager;
40
- if (eventManager && this.props.installShortcuts) {
41
- this.#keyboardShortcutsManager = new KeyboardShortcutsManager(eventManager, this.#keyboardShortcuts);
42
- this.#keyboardShortcutsManager.start();
43
- }
44
- }
45
- onRenderHTML(rootElement) {
46
- this.#rootElement = rootElement;
47
- const className = ['deck-widget', this.className, this.props.className]
48
- .filter(Boolean)
49
- .join(' ');
50
- rootElement.className = className;
51
- render(_jsx(KeyboardShortcutsWidgetView, { keyboardShortcuts: this.#keyboardShortcuts }), rootElement);
52
- }
53
- onRemove() {
54
- if (this.#rootElement) {
55
- render(null, this.#rootElement);
56
- }
57
- if (this.#keyboardShortcutsManager) {
58
- this.#keyboardShortcutsManager.stop();
59
- this.#keyboardShortcutsManager = null;
60
- }
61
- }
62
- }
63
- _a = KeyboardShortcutsWidget;
64
- const MODAL_BACKDROP_STYLE = {
65
- position: 'fixed',
66
- inset: 0,
67
- display: 'flex',
68
- alignItems: 'center',
69
- justifyContent: 'center',
70
- backgroundColor: 'rgba(15, 23, 42, 0.28)',
71
- pointerEvents: 'auto',
72
- zIndex: 1000
73
- };
74
- const MODAL_STYLE = {
75
- width: 'min(420px, calc(100vw - 24px))',
76
- maxHeight: 'min(460px, calc(100vh - 24px))',
77
- borderRadius: '10px',
78
- border: '1px solid rgba(148, 163, 184, 0.75)',
79
- backgroundColor: 'rgba(255, 255, 255, 0.98)',
80
- boxShadow: '0 14px 40px rgba(15, 23, 42, 0.28)',
81
- display: 'flex',
82
- flexDirection: 'column',
83
- overflow: 'hidden'
84
- };
85
- const KEY_STYLE = {
86
- borderRadius: '6px',
87
- border: '1px solid rgba(148, 163, 184, 0.85)',
88
- backgroundColor: 'rgba(248, 250, 252, 1)',
89
- padding: '2px 8px',
90
- fontSize: '11px',
91
- color: 'rgb(51, 65, 85)',
92
- whiteSpace: 'nowrap'
93
- };
94
- function KeyboardShortcutsWidgetView({ keyboardShortcuts }) {
95
- const [isOpen, setIsOpen] = useState(false);
96
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: "deck-widget-button", children: _jsx("button", { className: "deck-widget-icon-button", type: "button", title: "Keyboard shortcuts", "aria-label": "Keyboard shortcuts", onClick: () => setIsOpen(true), children: _jsx("span", { style: {
97
- fontSize: '12px',
98
- fontWeight: 700,
99
- color: 'var(--deck-widget-icon-color, #0f172a)'
100
- }, children: _jsx("kbd", { style: {
101
- color: 'var(--deck-widget-icon-color, #0f172a)'
102
- }, children: "?" }) }) }) }), isOpen && (_jsx("div", { style: MODAL_BACKDROP_STYLE, onClick: () => setIsOpen(false), children: _jsxs("div", { style: MODAL_STYLE, role: "dialog", "aria-label": "Keyboard Shortcuts", onClick: (event) => event.stopPropagation(), children: [_jsxs("div", { style: {
103
- display: 'flex',
104
- alignItems: 'center',
105
- justifyContent: 'space-between',
106
- borderBottom: '1px solid rgba(226, 232, 240, 1)',
107
- padding: '10px 12px'
108
- }, children: [_jsx("div", { style: { fontSize: '14px', fontWeight: 700, color: 'rgb(30, 41, 59)' }, children: "Keyboard Shortcuts" }), _jsx("button", { type: "button", onClick: () => setIsOpen(false), style: {
109
- border: 0,
110
- background: 'transparent',
111
- color: 'rgb(71, 85, 105)',
112
- cursor: 'pointer',
113
- fontSize: '18px',
114
- lineHeight: '18px'
115
- }, "aria-label": "Close keyboard shortcuts", title: "Close", children: "\u00D7" })] }), _jsx("div", { style: { overflowY: 'auto', padding: '10px 12px' }, children: _jsx("div", { style: { display: 'grid', gap: '8px' }, children: keyboardShortcuts.map((shortcut, index) => (_jsxs("div", { style: {
116
- display: 'flex',
117
- alignItems: 'center',
118
- justifyContent: 'space-between',
119
- gap: '8px'
120
- }, children: [_jsx(ShortcutKey, { shortcut: shortcut }), _jsx("span", { style: { fontSize: '12px', color: 'rgb(71, 85, 105)' }, children: shortcut.name })] }, `${shortcut.name}-${shortcut.key}-${index}`))) }) })] }) }))] }));
121
- }
122
- function ShortcutKey({ shortcut }) {
123
- return (_jsxs("div", { style: { color: 'rgb(51, 65, 85)', fontSize: '11px' }, children: [shortcut.commandKey && (_jsxs("span", { children: [_jsx("kbd", { style: KEY_STYLE, children: "\u2318" }), ' + '] })), shortcut.ctrlKey && (_jsxs("span", { children: [_jsx("kbd", { style: KEY_STYLE, children: "^" }), ' + '] })), shortcut.shiftKey && (_jsxs("span", { children: [_jsx("kbd", { style: KEY_STYLE, children: "Shift" }), ' + '] })), shortcut.key && _jsx("kbd", { style: KEY_STYLE, children: formatKey(shortcut.key) }), shortcut.dragMouse && 'drag mouse'] }));
124
- }
125
- //# sourceMappingURL=keyboard-shortcuts-widget.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyboard-shortcuts-widget.js","sourceRoot":"","sources":["../../src/widgets/keyboard-shortcuts-widget.tsx"],"names":[],"mappings":";;AAAA,8BAA8B;AAC9B,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AACrC,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,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AS,WAAW,CAAC,EAAC,QAAQ,EAA+B;IAC3D,OAAO,CACL,eAAK,KAAK,EAAE,EAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,EAAC,aACrD,QAAQ,CAAC,UAAU,IAAI,CACtB,2BACE,cAAK,KAAK,EAAE,SAAS,uBAAS,EAC7B,KAAK,IACD,CACR,EACA,QAAQ,CAAC,OAAO,IAAI,CACnB,2BACE,cAAK,KAAK,EAAE,SAAS,kBAAS,EAC7B,KAAK,IACD,CACR,EACA,QAAQ,CAAC,QAAQ,IAAI,CACpB,2BACE,cAAK,KAAK,EAAE,SAAS,sBAAa,EACjC,KAAK,IACD,CACR,EACA,QAAQ,CAAC,GAAG,IAAI,cAAK,KAAK,EAAE,SAAS,YAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAO,EACtE,QAAQ,CAAC,SAAS,IAAI,YAAY,IAC/B,CACP,CAAC;AACJ,CAAC"}
@@ -1,64 +0,0 @@
1
- /** @jsxImportSource preact */
2
- import { Widget } from '@deck.gl/core';
3
- import type { WidgetPlacement, WidgetProps } from '@deck.gl/core';
4
- export type SettingsWidgetValue = boolean | number | string;
5
- export type SettingsWidgetSettingType = 'boolean' | 'number' | 'string' | 'select';
6
- export type SettingsWidgetOption = SettingsWidgetValue | {
7
- label: string;
8
- value: SettingsWidgetValue;
9
- };
10
- export type SettingsWidgetSettingDescriptor = {
11
- /** Path in the settings object (dot notation supported). */
12
- name: string;
13
- /** Human-friendly label shown in the control list. Defaults to `name`. */
14
- label?: string;
15
- description?: string;
16
- type: SettingsWidgetSettingType;
17
- min?: number;
18
- max?: number;
19
- step?: number;
20
- options?: SettingsWidgetOption[];
21
- defaultValue?: SettingsWidgetValue;
22
- };
23
- export type SettingsWidgetSectionDescriptor = {
24
- /** Optional stable id for preserving collapse state across re-renders. */
25
- id?: string;
26
- name: string;
27
- description?: string;
28
- /** Whether this section starts collapsed when first seen. Defaults to true. */
29
- initiallyCollapsed?: boolean;
30
- settings: SettingsWidgetSettingDescriptor[];
31
- };
32
- export type SettingsWidgetSchema = {
33
- title?: string;
34
- sections: SettingsWidgetSectionDescriptor[];
35
- };
36
- export type SettingsWidgetState = Record<string, unknown>;
37
- export type SettingsWidgetProps = WidgetProps & {
38
- placement?: WidgetPlacement;
39
- label?: string;
40
- schema?: SettingsWidgetSchema;
41
- settings?: SettingsWidgetState;
42
- onSettingsChange?: (settings: SettingsWidgetState) => void;
43
- };
44
- export declare class SettingsWidget extends Widget<SettingsWidgetProps> {
45
- #private;
46
- static defaultProps: {
47
- id: string;
48
- placement: "top-left";
49
- label: string;
50
- schema: SettingsWidgetSchema;
51
- settings: SettingsWidgetState;
52
- onSettingsChange: any;
53
- style: Partial<CSSStyleDeclaration>;
54
- className: string;
55
- _container: string | HTMLDivElement | null;
56
- };
57
- className: string;
58
- placement: WidgetPlacement;
59
- constructor(props?: SettingsWidgetProps);
60
- setProps(props: Partial<SettingsWidgetProps>): void;
61
- onRenderHTML(rootElement: HTMLElement): void;
62
- onRemove(): void;
63
- }
64
- //# sourceMappingURL=settings-widget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings-widget.d.ts","sourceRoot":"","sources":["../../src/widgets/settings-widget.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAOrC,OAAO,KAAK,EAAC,eAAe,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAGhE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5D,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEnF,MAAM,MAAM,oBAAoB,GAC5B,mBAAmB,GACnB;IACE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC;AAEN,MAAM,MAAM,+BAA+B,GAAG;IAC5C,4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