@foxglove/embed 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FoxgloveViewer.d.ts +68 -2
- package/dist/FoxgloveViewer.d.ts.map +1 -1
- package/dist/FoxgloveViewer.js +99 -2
- package/dist/FoxgloveViewer.js.map +1 -1
- package/dist/commands.d.ts +49 -2
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +5 -0
- package/dist/commands.js.map +1 -1
- package/dist/layout.generated.d.ts +16 -0
- package/dist/layout.generated.d.ts.map +1 -1
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/FoxgloveViewer.ts +143 -2
- package/src/commands.ts +57 -2
- package/src/layout.generated.ts +16 -0
- package/src/types.ts +300 -0
package/src/types.ts
CHANGED
|
@@ -74,6 +74,306 @@ export type FoxgloveViewerEventMap = {
|
|
|
74
74
|
error: CustomEvent<string>;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* A modifier key that must be held alongside the primary key.
|
|
79
|
+
*
|
|
80
|
+
* `"PrimaryModifier"` resolves to Command on macOS and Control on other platforms.
|
|
81
|
+
*/
|
|
82
|
+
export type ShortcutModifier = "Meta" | "Control" | "Alt" | "Shift" | "PrimaryModifier";
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Valid `event.key` values for key bindings matched by logical key.
|
|
86
|
+
*
|
|
87
|
+
* Only unmodified key values are allowed — these are the values produced
|
|
88
|
+
* without holding Shift or AltGr. This ensures the browser's Keyboard API
|
|
89
|
+
* (`navigator.keyboard.getLayoutMap()`) can resolve them across layouts.
|
|
90
|
+
*
|
|
91
|
+
* @see https://www.w3.org/TR/uievents-key/
|
|
92
|
+
*/
|
|
93
|
+
export type EventKeyValue =
|
|
94
|
+
// Letters (lowercase only — normalizeKey lowercases uppercase)
|
|
95
|
+
| "a"
|
|
96
|
+
| "b"
|
|
97
|
+
| "c"
|
|
98
|
+
| "d"
|
|
99
|
+
| "e"
|
|
100
|
+
| "f"
|
|
101
|
+
| "g"
|
|
102
|
+
| "h"
|
|
103
|
+
| "i"
|
|
104
|
+
| "j"
|
|
105
|
+
| "k"
|
|
106
|
+
| "l"
|
|
107
|
+
| "m"
|
|
108
|
+
| "n"
|
|
109
|
+
| "o"
|
|
110
|
+
| "p"
|
|
111
|
+
| "q"
|
|
112
|
+
| "r"
|
|
113
|
+
| "s"
|
|
114
|
+
| "t"
|
|
115
|
+
| "u"
|
|
116
|
+
| "v"
|
|
117
|
+
| "w"
|
|
118
|
+
| "x"
|
|
119
|
+
| "y"
|
|
120
|
+
| "z"
|
|
121
|
+
// Digits
|
|
122
|
+
| "0"
|
|
123
|
+
| "1"
|
|
124
|
+
| "2"
|
|
125
|
+
| "3"
|
|
126
|
+
| "4"
|
|
127
|
+
| "5"
|
|
128
|
+
| "6"
|
|
129
|
+
| "7"
|
|
130
|
+
| "8"
|
|
131
|
+
| "9"
|
|
132
|
+
// Punctuation (US QWERTY unmodified)
|
|
133
|
+
| "-"
|
|
134
|
+
| "="
|
|
135
|
+
| "["
|
|
136
|
+
| "]"
|
|
137
|
+
| "\\"
|
|
138
|
+
| ";"
|
|
139
|
+
| "'"
|
|
140
|
+
| "`"
|
|
141
|
+
| ","
|
|
142
|
+
| "."
|
|
143
|
+
| "/"
|
|
144
|
+
// Editing & whitespace
|
|
145
|
+
| "Enter"
|
|
146
|
+
| "Escape"
|
|
147
|
+
| "Backspace"
|
|
148
|
+
| "Tab"
|
|
149
|
+
| " "
|
|
150
|
+
| "Delete"
|
|
151
|
+
| "Insert"
|
|
152
|
+
// Navigation
|
|
153
|
+
| "Home"
|
|
154
|
+
| "End"
|
|
155
|
+
| "PageUp"
|
|
156
|
+
| "PageDown"
|
|
157
|
+
| "ArrowUp"
|
|
158
|
+
| "ArrowDown"
|
|
159
|
+
| "ArrowLeft"
|
|
160
|
+
| "ArrowRight"
|
|
161
|
+
// Lock keys
|
|
162
|
+
| "CapsLock"
|
|
163
|
+
// Function keys
|
|
164
|
+
| "F1"
|
|
165
|
+
| "F2"
|
|
166
|
+
| "F3"
|
|
167
|
+
| "F4"
|
|
168
|
+
| "F5"
|
|
169
|
+
| "F6"
|
|
170
|
+
| "F7"
|
|
171
|
+
| "F8"
|
|
172
|
+
| "F9"
|
|
173
|
+
| "F10"
|
|
174
|
+
| "F11"
|
|
175
|
+
| "F12"
|
|
176
|
+
| "F13"
|
|
177
|
+
| "F14"
|
|
178
|
+
| "F15"
|
|
179
|
+
| "F16"
|
|
180
|
+
| "F17"
|
|
181
|
+
| "F18"
|
|
182
|
+
| "F19"
|
|
183
|
+
| "F20"
|
|
184
|
+
| "F21"
|
|
185
|
+
| "F22"
|
|
186
|
+
| "F23"
|
|
187
|
+
| "F24";
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Valid `event.code` values for key bindings matched by physical key code.
|
|
191
|
+
*
|
|
192
|
+
* @see https://www.w3.org/TR/uievents-code/
|
|
193
|
+
*/
|
|
194
|
+
export type EventCodeValue =
|
|
195
|
+
// Layout-dependent (letters)
|
|
196
|
+
| "KeyA"
|
|
197
|
+
| "KeyB"
|
|
198
|
+
| "KeyC"
|
|
199
|
+
| "KeyD"
|
|
200
|
+
| "KeyE"
|
|
201
|
+
| "KeyF"
|
|
202
|
+
| "KeyG"
|
|
203
|
+
| "KeyH"
|
|
204
|
+
| "KeyI"
|
|
205
|
+
| "KeyJ"
|
|
206
|
+
| "KeyK"
|
|
207
|
+
| "KeyL"
|
|
208
|
+
| "KeyM"
|
|
209
|
+
| "KeyN"
|
|
210
|
+
| "KeyO"
|
|
211
|
+
| "KeyP"
|
|
212
|
+
| "KeyQ"
|
|
213
|
+
| "KeyR"
|
|
214
|
+
| "KeyS"
|
|
215
|
+
| "KeyT"
|
|
216
|
+
| "KeyU"
|
|
217
|
+
| "KeyV"
|
|
218
|
+
| "KeyW"
|
|
219
|
+
| "KeyX"
|
|
220
|
+
| "KeyY"
|
|
221
|
+
| "KeyZ"
|
|
222
|
+
// Layout-dependent (digits)
|
|
223
|
+
| "Digit0"
|
|
224
|
+
| "Digit1"
|
|
225
|
+
| "Digit2"
|
|
226
|
+
| "Digit3"
|
|
227
|
+
| "Digit4"
|
|
228
|
+
| "Digit5"
|
|
229
|
+
| "Digit6"
|
|
230
|
+
| "Digit7"
|
|
231
|
+
| "Digit8"
|
|
232
|
+
| "Digit9"
|
|
233
|
+
// Layout-dependent (punctuation)
|
|
234
|
+
| "Minus"
|
|
235
|
+
| "Equal"
|
|
236
|
+
| "BracketLeft"
|
|
237
|
+
| "BracketRight"
|
|
238
|
+
| "Backslash"
|
|
239
|
+
| "Semicolon"
|
|
240
|
+
| "Quote"
|
|
241
|
+
| "Backquote"
|
|
242
|
+
| "Comma"
|
|
243
|
+
| "Period"
|
|
244
|
+
| "Slash"
|
|
245
|
+
// Editing & whitespace
|
|
246
|
+
| "Enter"
|
|
247
|
+
| "Escape"
|
|
248
|
+
| "Backspace"
|
|
249
|
+
| "Tab"
|
|
250
|
+
| "Space"
|
|
251
|
+
| "Delete"
|
|
252
|
+
| "Insert"
|
|
253
|
+
// Navigation
|
|
254
|
+
| "Home"
|
|
255
|
+
| "End"
|
|
256
|
+
| "PageUp"
|
|
257
|
+
| "PageDown"
|
|
258
|
+
| "ArrowUp"
|
|
259
|
+
| "ArrowDown"
|
|
260
|
+
| "ArrowLeft"
|
|
261
|
+
| "ArrowRight"
|
|
262
|
+
// Lock keys
|
|
263
|
+
| "CapsLock"
|
|
264
|
+
// Function keys
|
|
265
|
+
| "F1"
|
|
266
|
+
| "F2"
|
|
267
|
+
| "F3"
|
|
268
|
+
| "F4"
|
|
269
|
+
| "F5"
|
|
270
|
+
| "F6"
|
|
271
|
+
| "F7"
|
|
272
|
+
| "F8"
|
|
273
|
+
| "F9"
|
|
274
|
+
| "F10"
|
|
275
|
+
| "F11"
|
|
276
|
+
| "F12"
|
|
277
|
+
| "F13"
|
|
278
|
+
| "F14"
|
|
279
|
+
| "F15"
|
|
280
|
+
| "F16"
|
|
281
|
+
| "F17"
|
|
282
|
+
| "F18"
|
|
283
|
+
| "F19"
|
|
284
|
+
| "F20"
|
|
285
|
+
| "F21"
|
|
286
|
+
| "F22"
|
|
287
|
+
| "F23"
|
|
288
|
+
| "F24";
|
|
289
|
+
|
|
290
|
+
export type FoxgloveCommandId =
|
|
291
|
+
| "player.togglePlayback"
|
|
292
|
+
| "player.seekBackwardMedium"
|
|
293
|
+
| "player.seekForwardMedium"
|
|
294
|
+
| "player.seekBackwardSmall"
|
|
295
|
+
| "player.seekForwardSmall"
|
|
296
|
+
| "player.seekBackwardLarge"
|
|
297
|
+
| "player.seekForwardLarge"
|
|
298
|
+
| "player.seekStart"
|
|
299
|
+
| "player.seekEnd"
|
|
300
|
+
| "player.speedUp"
|
|
301
|
+
| "player.speedDown"
|
|
302
|
+
| "player.createEvent"
|
|
303
|
+
| "panel.threeDee.togglePerspective"
|
|
304
|
+
| "panel.threeDee.resetCamera"
|
|
305
|
+
| "panel.threeDee.toggleInspector"
|
|
306
|
+
| "panel.threeDee.moveForward"
|
|
307
|
+
| "panel.threeDee.moveLeft"
|
|
308
|
+
| "panel.threeDee.moveBackward"
|
|
309
|
+
| "panel.threeDee.moveRight"
|
|
310
|
+
| "panel.threeDee.rotateUp"
|
|
311
|
+
| "panel.threeDee.rotateDown"
|
|
312
|
+
| "panel.threeDee.rotateLeft"
|
|
313
|
+
| "panel.threeDee.rotateRight"
|
|
314
|
+
| "sidebar.left.toggleVisibility"
|
|
315
|
+
| "sidebar.right.toggleVisibility";
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* A key that triggers a keybinding.
|
|
319
|
+
*
|
|
320
|
+
* Physical key codes like `"KeyW"` match by physical position (layout-independent).
|
|
321
|
+
*
|
|
322
|
+
* Character keys like `"p"` match by the character produced (layout-dependent).
|
|
323
|
+
*
|
|
324
|
+
* Named keys like `"Escape"` are unambiguous — identical in both modes.
|
|
325
|
+
*/
|
|
326
|
+
export type ShortcutKey = EventKeyValue | EventCodeValue;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* A key combination consisting of a {@link ShortcutKey} plus optional modifier keys.
|
|
330
|
+
*
|
|
331
|
+
* Physical key codes like `"KeyW"`, `"Space"` match by `event.code` (physical position).
|
|
332
|
+
*
|
|
333
|
+
* Character keys like `"p"`, `" "` match by `event.key` (logical key).
|
|
334
|
+
*
|
|
335
|
+
* Named keys like `"Escape"`, `"Enter"` are layout-independent and matched by `event.key`.
|
|
336
|
+
* `"PrimaryModifier"` resolves to Command on macOS and Control elsewhere.
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* // Match by character `a` and modifier `PrimaryModifier` (Command on macOS, Control elsewhere)
|
|
340
|
+
* // The key will depend on the keyboard layout. On a QWERTY layout, this will match the key to the left of the S key.
|
|
341
|
+
* // On an AZERTY layout, this will match the key to the left of the Z key.
|
|
342
|
+
* { key: "a", modifiers: ["PrimaryModifier"] }
|
|
343
|
+
*
|
|
344
|
+
* // Match by physical key code `KeyA` and modifier `PrimaryModifier` (Command on macOS, Control elsewhere)
|
|
345
|
+
* // The key won't depend on the keyboard layout. On a QWERTY layout, this will match the key to the left of the A key.
|
|
346
|
+
* // On an AZERTY layout, this will match the key to the left of the S key.
|
|
347
|
+
* { key: "KeyA", modifiers: ["PrimaryModifier"] }
|
|
348
|
+
*
|
|
349
|
+
* // Match by named key `Escape`. This is layout-independent and will match the same key regardless of the keyboard layout.
|
|
350
|
+
* { key: "Escape" }
|
|
351
|
+
*
|
|
352
|
+
* @see ShortcutKey
|
|
353
|
+
*/
|
|
354
|
+
export interface KeybindingBase {
|
|
355
|
+
/** The key that triggers this keybinding. */
|
|
356
|
+
key: ShortcutKey;
|
|
357
|
+
/** Modifier keys required alongside the primary key. Defaults to no modifiers if omitted. */
|
|
358
|
+
modifiers?: ShortcutModifier[];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface CommandKeybinding extends KeybindingBase {
|
|
362
|
+
/** A built-in viewer command to invoke, or `"noop"` to suppress the key without action. */
|
|
363
|
+
command: FoxgloveCommandId | "noop";
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface HandlerKeybinding extends KeybindingBase {
|
|
367
|
+
/** A function to call when the key combination is pressed. */
|
|
368
|
+
handler: () => void;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* A keybinding defines a key combination that triggers a built-in
|
|
373
|
+
* viewer command or a custom handler function.
|
|
374
|
+
*/
|
|
375
|
+
export type Keybinding = CommandKeybinding | HandlerKeybinding;
|
|
376
|
+
|
|
77
377
|
export type FoxgloveViewerEventType = keyof FoxgloveViewerEventMap;
|
|
78
378
|
|
|
79
379
|
export type SelectLayoutParams =
|