@zylem/editor 0.9.0 → 0.9.3
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/zylem-editor.d.ts +88 -16
- package/dist/zylem-editor.js +108 -23
- package/package.json +6 -6
package/dist/zylem-editor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _zylem_bridge from '@zylem/bridge';
|
|
2
|
-
import { BridgePose, EntitySelectMode, BridgeVec3, BridgeQuat, SnapSettingsPayload, BridgeDebugTool, SceneOperationPayload, EntityTypeDescriptor } from '@zylem/bridge';
|
|
2
|
+
import { BridgePose, EntitySelectMode, BridgeVec3, BridgeQuat, LevelBuffer, SnapSettingsPayload, BridgeDebugTool, SceneOperationPayload, EntityTypeDescriptor } from '@zylem/bridge';
|
|
3
3
|
import { LucideProps } from 'lucide-solid';
|
|
4
4
|
import { Component } from 'solid-js';
|
|
5
5
|
|
|
@@ -34,7 +34,7 @@ declare function sendEntitySelect(uuid: string | null): void;
|
|
|
34
34
|
* consumers.
|
|
35
35
|
*/
|
|
36
36
|
declare function sendEntitySelectMany(uuids: string[], mode?: EntitySelectMode): void;
|
|
37
|
-
/** Focus/frame the
|
|
37
|
+
/** Focus/frame the active editor camera on an entity. */
|
|
38
38
|
declare function sendEntityFocus(uuid: string): void;
|
|
39
39
|
/** Write a stage variable in the running game. */
|
|
40
40
|
declare function sendStageVariable(key: string, value: unknown): void;
|
|
@@ -52,6 +52,8 @@ declare function sendEntityTransform(uuid: string, transform: {
|
|
|
52
52
|
}): void;
|
|
53
53
|
/** Arm the game's add tool with a catalog type, or `null` to disarm it. */
|
|
54
54
|
declare function sendAddType(typeId: string | null, props?: Record<string, unknown>): void;
|
|
55
|
+
/** Stream a recorded level into the running stage. */
|
|
56
|
+
declare function sendLevelLoad(buffer: LevelBuffer): void;
|
|
55
57
|
/** Spawn a catalog entity without a placement click. */
|
|
56
58
|
declare function sendEntityCreate(typeId: string, options?: {
|
|
57
59
|
props?: Record<string, unknown>;
|
|
@@ -61,6 +63,8 @@ declare function sendEntityCreate(typeId: string, options?: {
|
|
|
61
63
|
declare function sendSnapSettings(snap: SnapSettingsPayload): void;
|
|
62
64
|
/** Show or hide the game's construction-plane grid. */
|
|
63
65
|
declare function sendGridVisible(visible: boolean): void;
|
|
66
|
+
/** Make a game or editor camera the main view. */
|
|
67
|
+
declare function sendCameraActivate(id: string): void;
|
|
64
68
|
|
|
65
69
|
/**
|
|
66
70
|
* Connection lifecycle for the editor side of the bridge.
|
|
@@ -165,6 +169,11 @@ interface DockRect {
|
|
|
165
169
|
height: number;
|
|
166
170
|
}
|
|
167
171
|
declare const DOCK_SIDES: readonly DockSide[];
|
|
172
|
+
/**
|
|
173
|
+
* The toolbar window. When it is the only panel on its edge it takes that
|
|
174
|
+
* whole edge, and every other dock lays out in the space left over.
|
|
175
|
+
*/
|
|
176
|
+
declare const TOOLBAR_PANEL_ID = "toolbar";
|
|
168
177
|
declare const findDockedSide: (registry: DockRegistry, panelId: DockPanelId) => DockSide | null;
|
|
169
178
|
interface DockLayoutOptions {
|
|
170
179
|
/** Smallest slot extent along a zone's long axis. */
|
|
@@ -176,6 +185,11 @@ interface DockLayoutOptions {
|
|
|
176
185
|
* Left and right zones take the full viewport height and win over top and
|
|
177
186
|
* bottom, which inset horizontally to the space between them. Panels sharing a
|
|
178
187
|
* zone split its long axis evenly.
|
|
188
|
+
*
|
|
189
|
+
* The toolbar is the exception when it is alone on its edge: that strip runs
|
|
190
|
+
* the full length of the edge, and the rules above apply to everyone else
|
|
191
|
+
* inside the leftover rectangle. Sharing its edge with another panel drops
|
|
192
|
+
* the exception and the toolbar splits that edge like any other panel.
|
|
179
193
|
*/
|
|
180
194
|
declare const computeDockLayout: (registry: DockRegistry, viewport: Viewport, options?: DockLayoutOptions) => Record<DockPanelId, DockRect>;
|
|
181
195
|
|
|
@@ -234,6 +248,7 @@ declare const gameState: GameState;
|
|
|
234
248
|
|
|
235
249
|
/** Registry id of the main editor panel; detached sections use their panel id. */
|
|
236
250
|
declare const MAIN_PANEL_ID = "main";
|
|
251
|
+
|
|
237
252
|
interface DetachedPanelState {
|
|
238
253
|
position: {
|
|
239
254
|
x: number;
|
|
@@ -273,6 +288,9 @@ declare const debugStore: {
|
|
|
273
288
|
panelZOrder: string[];
|
|
274
289
|
docks: DockRegistry;
|
|
275
290
|
dockDefaultsApplied: boolean;
|
|
291
|
+
toolbarSeeded: boolean;
|
|
292
|
+
toolbarCollapsed: boolean;
|
|
293
|
+
mainCollapsed: boolean;
|
|
276
294
|
draggingPanelId: string | null;
|
|
277
295
|
dropTargetIndex: number | null;
|
|
278
296
|
};
|
|
@@ -389,6 +407,55 @@ declare function redo(): boolean;
|
|
|
389
407
|
*/
|
|
390
408
|
declare function clearHistory(): void;
|
|
391
409
|
|
|
410
|
+
/**
|
|
411
|
+
* Level-editor mode.
|
|
412
|
+
*
|
|
413
|
+
* Build mode owns a buffer of catalog placements. Turning it on seeds that
|
|
414
|
+
* buffer from the stage currently loaded; turning it off freezes the buffer
|
|
415
|
+
* so later stage changes do not rewrite a level the user has stepped out of.
|
|
416
|
+
* Turning it on again reseeds.
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* How a recorded entry was placed.
|
|
421
|
+
*
|
|
422
|
+
* `level` is the only role marked for bake. The editor does not merge meshes;
|
|
423
|
+
* the game bakes later. `actor` and `doodad` are recorded and left out of that set.
|
|
424
|
+
*/
|
|
425
|
+
type LevelRole = 'actor' | 'level' | 'doodad';
|
|
426
|
+
/** Role and actor props, kept beside `LevelEntry` because the bridge entry has neither. */
|
|
427
|
+
interface LevelAnnotation {
|
|
428
|
+
role: LevelRole;
|
|
429
|
+
props: Record<string, string>;
|
|
430
|
+
}
|
|
431
|
+
interface LevelState {
|
|
432
|
+
active: boolean;
|
|
433
|
+
/** Present after Build has been turned on at least once. Frozen while inactive. */
|
|
434
|
+
buffer: LevelBuffer | null;
|
|
435
|
+
/** Keyed by entry id. Entries that leave the buffer lose their annotation. */
|
|
436
|
+
annotations: Record<string, LevelAnnotation>;
|
|
437
|
+
/**
|
|
438
|
+
* Role stamped on entries that appear while the Add tool is armed.
|
|
439
|
+
* Cleared when the tool leaves Add, so a later stage update is not mis-tagged.
|
|
440
|
+
*/
|
|
441
|
+
placementRole: LevelRole | null;
|
|
442
|
+
}
|
|
443
|
+
/** A plain copy of the buffer, safe to post across a frame or write to a file. */
|
|
444
|
+
interface LevelSnapshot {
|
|
445
|
+
buffer: LevelBuffer;
|
|
446
|
+
annotations: Record<string, LevelAnnotation>;
|
|
447
|
+
/** Stage id the buffer was recorded against, when the game has published one. */
|
|
448
|
+
stageId: string | null;
|
|
449
|
+
}
|
|
450
|
+
declare const levelState: LevelState;
|
|
451
|
+
/**
|
|
452
|
+
* Copy the recorded level out of the editor.
|
|
453
|
+
*
|
|
454
|
+
* `null` when Build has never been turned on. A buffer frozen by leaving Build
|
|
455
|
+
* mode is still returned. The copy is plain data, not the live proxy.
|
|
456
|
+
*/
|
|
457
|
+
declare function snapshotLevelBuffer(): LevelSnapshot | null;
|
|
458
|
+
|
|
392
459
|
/**
|
|
393
460
|
* Stage export.
|
|
394
461
|
*
|
|
@@ -501,18 +568,19 @@ declare function selectTransformTool(tool: TransformTool): boolean;
|
|
|
501
568
|
/** Toggle a gizmo mode from its button: a second press returns to the neutral tool. */
|
|
502
569
|
declare function toggleTransformTool(tool: TransformTool): boolean;
|
|
503
570
|
/**
|
|
504
|
-
* Arm placement with a catalog type
|
|
505
|
-
*
|
|
571
|
+
* Arm placement with a catalog type and the role those new entries are tagged
|
|
572
|
+
* with. Arming an armed tool leaves it armed — Escape is the way out — so
|
|
573
|
+
* placing ten of something is one arm and ten clicks.
|
|
506
574
|
*
|
|
507
575
|
* @returns `false` when the catalog has no such type.
|
|
508
576
|
*/
|
|
509
|
-
declare function armAddType(typeId: string): boolean;
|
|
577
|
+
declare function armAddType(typeId: string, role?: LevelRole): boolean;
|
|
510
578
|
/**
|
|
511
579
|
* Arm placement with what the Add button's face shows.
|
|
512
580
|
*
|
|
513
581
|
* @returns `false` on an empty catalog, the one state with nothing to arm.
|
|
514
582
|
*/
|
|
515
|
-
declare function armAddTool(): boolean;
|
|
583
|
+
declare function armAddTool(role?: LevelRole): boolean;
|
|
516
584
|
/** Open the Add palette, if a toolbar is showing one. */
|
|
517
585
|
declare function openAddPalette(): boolean;
|
|
518
586
|
declare function toggleSnap(): void;
|
|
@@ -524,9 +592,9 @@ declare function togglePlayback(): void;
|
|
|
524
592
|
* Keyboard shortcuts for the toolbar.
|
|
525
593
|
*
|
|
526
594
|
* The tool row follows the Godot/Unreal layout — Q select, W move, E rotate,
|
|
527
|
-
* R scale — with mnemonics for the rest: A add, X delete, D debug,
|
|
528
|
-
* G grid. Every key sits under the left hand on a QWERTY board, so
|
|
529
|
-
* hand can stay on the mouse.
|
|
595
|
+
* R scale — with mnemonics for the rest: A add, B build, X delete, D debug,
|
|
596
|
+
* S snap, G grid. Every key sits under the left hand on a QWERTY board, so
|
|
597
|
+
* the right hand can stay on the mouse.
|
|
530
598
|
*
|
|
531
599
|
* The keys are live whenever the editor panel is open, playing or paused: the
|
|
532
600
|
* panel being up is the signal that the keyboard is addressing the editor. The
|
|
@@ -551,6 +619,9 @@ declare const TOOLBAR_SHORTCUTS: {
|
|
|
551
619
|
readonly debug: {
|
|
552
620
|
readonly key: "d";
|
|
553
621
|
};
|
|
622
|
+
readonly build: {
|
|
623
|
+
readonly key: "b";
|
|
624
|
+
};
|
|
554
625
|
readonly select: {
|
|
555
626
|
readonly key: "q";
|
|
556
627
|
};
|
|
@@ -595,7 +666,7 @@ declare const TOOLBAR_SHORTCUTS: {
|
|
|
595
666
|
};
|
|
596
667
|
type ToolbarShortcutId = keyof typeof TOOLBAR_SHORTCUTS;
|
|
597
668
|
/** The shortcuts this module runs; undo and redo are `history-shortcuts`'. */
|
|
598
|
-
declare const TOOLBAR_ACTIONS: readonly ["debug", "select", "translate", "rotate", "scale", "add", "addPalette", "delete", "snap", "grid", "playback"];
|
|
669
|
+
declare const TOOLBAR_ACTIONS: readonly ["debug", "build", "select", "translate", "rotate", "scale", "add", "addPalette", "delete", "snap", "grid", "playback"];
|
|
599
670
|
type ToolbarAction = (typeof TOOLBAR_ACTIONS)[number];
|
|
600
671
|
/**
|
|
601
672
|
* A chord as tooltip text: `W`, `Shift+A`, `Cmd+Enter`.
|
|
@@ -804,7 +875,7 @@ declare class ZylemEditorElement extends HTMLElement {
|
|
|
804
875
|
openPanel(): void;
|
|
805
876
|
closePanel(): void;
|
|
806
877
|
togglePanel(): void;
|
|
807
|
-
/** Whether
|
|
878
|
+
/** Whether either editor window is showing. Collapsed counts as showing; closed does not. */
|
|
808
879
|
isPanelOpen(): boolean;
|
|
809
880
|
/**
|
|
810
881
|
* Dock a panel to a viewport edge, or pass `null` to float it again.
|
|
@@ -915,13 +986,14 @@ interface MountZylemEditorOptions extends EditorStateBridgeOptions {
|
|
|
915
986
|
*/
|
|
916
987
|
launcherMode?: EditorLauncherMode;
|
|
917
988
|
/**
|
|
918
|
-
* Dock layout to seed on first run, keyed by viewport edge. `'
|
|
919
|
-
*
|
|
920
|
-
* the
|
|
989
|
+
* Dock layout to seed on first run, keyed by viewport edge. `'toolbar'` is
|
|
990
|
+
* the tool strip, `'main'` is the panel container, and any other id is a
|
|
991
|
+
* section such as `'console'`. A host that omits the toolbar still gets it
|
|
992
|
+
* on top. Ignored once the user has a saved layout.
|
|
921
993
|
*
|
|
922
994
|
* @example
|
|
923
995
|
* ```ts
|
|
924
|
-
* mountZylemEditor({ defaultDocks: {
|
|
996
|
+
* mountZylemEditor({ defaultDocks: { top: ['toolbar'], left: ['main'] } });
|
|
925
997
|
* ```
|
|
926
998
|
*/
|
|
927
999
|
defaultDocks?: EditorDockDefaults;
|
|
@@ -966,4 +1038,4 @@ type SceneOperationListener = (op: SceneOperationPayload) => void;
|
|
|
966
1038
|
*/
|
|
967
1039
|
declare function onSceneOperation(listener: SceneOperationListener): () => void;
|
|
968
1040
|
|
|
969
|
-
export { type CatalogState, type ClickTool, DEFAULT_ROTATE_SNAP, DOCK_SIDES, type DockPanelId, type DockRect, type DockRegistry, type DockSide, type DockZoneState, type EditorDockDefaults, type EditorEvent, type EditorEventType, type EditorStateBridge, type EditorStateBridgeOptions, type EditorUpdatePayload, type HistoryState, Icon, MAIN_PANEL_ID, MAX_HISTORY_DEPTH, type MountZylemEditorOptions, type MountedZylemEditor, type SceneOperationListener, type ShortcutChord, type StageExport, type StageExportEntity, TOOLBAR_SHORTCUTS, type ToolbarAction, type ToolbarShortcutId, type ToolbarShortcutOptions, type TransformState, type TransformTool, type TransformToolGuardOptions, type ZylemEditorConfig, ZylemEditorElement, armAddTool, armAddType, attachEditorStateBridge, channel as bridgeChannel, buildStageExport, canRedo, canUndo, catalogState, clearHistory, computeDockLayout, connectEditorBridge, copyStageExport, debugState, debugStore, disarmTools, disconnectEditorBridge, dispatchEditorUpdate, dispatchToEditor, dockPanelToSide, editorEvents, findDockedSide, formatShortcut, gameState, getDockedSide, historyState, installToolbarShortcuts, installTransformToolGuard, mountZylemEditor, onSceneOperation, openAddPalette, redo, redoLabel, registerZylemEditor, releaseOrphanedTransformTool, runToolbarAction, selectTool, selectTransformTool, sendAddType, sendDebugEnabled, sendEntityCreate, sendEntityFocus, sendEntitySelect, sendEntitySelectMany, sendEntityTransform, sendGridVisible, sendPlayback, sendSnapSettings, sendStageVariable, sendTool, setArmedType, setEntityCatalog, setGridVisible, setSnapEnabled, setSnapIncrements, stageExportToString, stageState, toggleDebug, toggleGrid, togglePlayback, toggleSnap, toggleTool, toggleTransformTool, transformState, undo, undoLabel, undockPanelFromSides };
|
|
1041
|
+
export { type CatalogState, type ClickTool, DEFAULT_ROTATE_SNAP, DOCK_SIDES, type DockPanelId, type DockRect, type DockRegistry, type DockSide, type DockZoneState, type EditorDockDefaults, type EditorEvent, type EditorEventType, type EditorStateBridge, type EditorStateBridgeOptions, type EditorUpdatePayload, type HistoryState, Icon, type LevelSnapshot, MAIN_PANEL_ID, MAX_HISTORY_DEPTH, type MountZylemEditorOptions, type MountedZylemEditor, type SceneOperationListener, type ShortcutChord, type StageExport, type StageExportEntity, TOOLBAR_PANEL_ID, TOOLBAR_SHORTCUTS, type ToolbarAction, type ToolbarShortcutId, type ToolbarShortcutOptions, type TransformState, type TransformTool, type TransformToolGuardOptions, type ZylemEditorConfig, ZylemEditorElement, armAddTool, armAddType, attachEditorStateBridge, channel as bridgeChannel, buildStageExport, canRedo, canUndo, catalogState, clearHistory, computeDockLayout, connectEditorBridge, copyStageExport, debugState, debugStore, disarmTools, disconnectEditorBridge, dispatchEditorUpdate, dispatchToEditor, dockPanelToSide, editorEvents, findDockedSide, formatShortcut, gameState, getDockedSide, historyState, installToolbarShortcuts, installTransformToolGuard, levelState, mountZylemEditor, onSceneOperation, openAddPalette, redo, redoLabel, registerZylemEditor, releaseOrphanedTransformTool, runToolbarAction, selectTool, selectTransformTool, sendAddType, sendCameraActivate, sendDebugEnabled, sendEntityCreate, sendEntityFocus, sendEntitySelect, sendEntitySelectMany, sendEntityTransform, sendGridVisible, sendLevelLoad, sendPlayback, sendSnapSettings, sendStageVariable, sendTool, setArmedType, setEntityCatalog, setGridVisible, setSnapEnabled, setSnapIncrements, snapshotLevelBuffer, stageExportToString, stageState, toggleDebug, toggleGrid, togglePlayback, toggleSnap, toggleTool, toggleTransformTool, transformState, undo, undoLabel, undockPanelFromSides };
|