@volter/editor-live 0.5.65 → 0.5.67
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/BUNDLED_NOTICES +4 -4
- package/dist/editor-document.d.ts +7 -0
- package/dist/editor.d.ts +18 -4
- package/dist/index.js +92 -10
- package/dist/index.js.map +2 -2
- package/package.json +3 -3
- package/src/editor-document.ts +14 -1
- package/src/editor.ts +28 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/editor-live",
|
|
3
3
|
"author": "Volter AI, Inc.",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.67",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"node": ">=22"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@volter/editor-sdk": "0.5.
|
|
34
|
-
"@volter/editor-project": "0.5.
|
|
33
|
+
"@volter/editor-sdk": "0.5.67",
|
|
34
|
+
"@volter/editor-project": "0.5.67",
|
|
35
35
|
"undici": "^7.28.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
package/src/editor-document.ts
CHANGED
|
@@ -59,6 +59,8 @@ export interface DocumentKeyOptions extends DocumentGestureOptions {
|
|
|
59
59
|
metaKey?: boolean;
|
|
60
60
|
shiftKey?: boolean;
|
|
61
61
|
altKey?: boolean;
|
|
62
|
+
/** Hold the key this long before releasing it (a person holding W). */
|
|
63
|
+
holdMs?: number;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
export interface DocumentPasteOptions extends DocumentGestureOptions {
|
|
@@ -114,14 +116,19 @@ export class LiveEditorDocument {
|
|
|
114
116
|
* — not `element.click()`, which a `pointerdown` listener never sees. */
|
|
115
117
|
async click(
|
|
116
118
|
selector: string,
|
|
117
|
-
options?: DocumentGestureOptions & { clicks?: number },
|
|
119
|
+
options?: DocumentGestureOptions & { clicks?: number; at?: [number, number] },
|
|
118
120
|
): Promise<DocumentProbeResult> {
|
|
121
|
+
// An option this door does not know is refused, never dropped: a dropped `position` clicked
|
|
122
|
+
// the element's centre and answered as if it had clicked where it was asked.
|
|
123
|
+
const unknown = Object.keys(options ?? {}).filter((key) => !['scope', 'index', 'clicks', 'at'].includes(key));
|
|
124
|
+
if (unknown.length > 0) throw new Error(`click has no option ${unknown.map((key) => `\`${key}\``).join(', ')}; its options are scope, index, clicks and at ([x, y] fractions of the element's box).`);
|
|
119
125
|
return this.#probe({
|
|
120
126
|
action: 'click',
|
|
121
127
|
selector,
|
|
122
128
|
...(options?.scope === undefined ? {} : { scope: options.scope }),
|
|
123
129
|
...(options?.index === undefined ? {} : { index: options.index }),
|
|
124
130
|
...(options?.clicks === undefined ? {} : { clicks: options.clicks }),
|
|
131
|
+
...(options?.at === undefined ? {} : { at: options.at }),
|
|
125
132
|
});
|
|
126
133
|
}
|
|
127
134
|
|
|
@@ -163,6 +170,10 @@ export class LiveEditorDocument {
|
|
|
163
170
|
ctrlKey?: boolean;
|
|
164
171
|
metaKey?: boolean;
|
|
165
172
|
shiftKey?: boolean;
|
|
173
|
+
/** 0 primary (default), 1 middle, 2 secondary. */
|
|
174
|
+
button?: 0 | 1 | 2;
|
|
175
|
+
/** `via`/`to` may leave the element's box after the press (a handle drag). */
|
|
176
|
+
leave?: boolean;
|
|
166
177
|
},
|
|
167
178
|
): Promise<DocumentProbeResult> {
|
|
168
179
|
return this.#probe({
|
|
@@ -178,6 +189,8 @@ export class LiveEditorDocument {
|
|
|
178
189
|
...(options.ctrlKey === undefined ? {} : { ctrlKey: options.ctrlKey }),
|
|
179
190
|
...(options.metaKey === undefined ? {} : { metaKey: options.metaKey }),
|
|
180
191
|
...(options.shiftKey === undefined ? {} : { shiftKey: options.shiftKey }),
|
|
192
|
+
...(options.button === undefined ? {} : { button: options.button }),
|
|
193
|
+
...(options.leave === undefined ? {} : { leave: options.leave }),
|
|
181
194
|
});
|
|
182
195
|
}
|
|
183
196
|
|
package/src/editor.ts
CHANGED
|
@@ -99,7 +99,7 @@ export function inferAssetKind(path: string): AssetKind {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export class LiveEditor {
|
|
102
|
-
/** `#`-private, not `private`: `volter-editor eval --list` enumerates this object's
|
|
102
|
+
/** `#`-private, not `private`: `volter-model-editor eval --list` enumerates this object's
|
|
103
103
|
* real runtime members, and TypeScript's erased `private` would leave the
|
|
104
104
|
* raw `EditorClient` advertised beside them. */
|
|
105
105
|
readonly #client: EditorClient;
|
|
@@ -120,7 +120,7 @@ export class LiveEditor {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
* THE BLENDER LANE'S VERBS, from `volter-editor eval`.
|
|
123
|
+
* THE BLENDER LANE'S VERBS, from `volter-model-editor eval`.
|
|
124
124
|
*
|
|
125
125
|
* Blender runs headless in the editor tab's worker (ARCHITECTURE-CORE, "THE
|
|
126
126
|
* BLENDER IN THE TAB IS BLENDER") and answers `blender-start`,
|
|
@@ -132,7 +132,7 @@ export class LiveEditor {
|
|
|
132
132
|
* per question — the same discovery failure `eval-surface.ts`'s header
|
|
133
133
|
* records, in a lane that had not noticed it yet.
|
|
134
134
|
*
|
|
135
|
-
* volter-editor eval "await editor.blender('blender-execute', { code: 'import bpy; print(len(bpy.data.objects))' })"
|
|
135
|
+
* volter-model-editor eval "await editor.blender('blender-execute', { code: 'import bpy; print(len(bpy.data.objects))' })"
|
|
136
136
|
*
|
|
137
137
|
* `blender-status` is the only verb that creates nothing: it answers whether
|
|
138
138
|
* this tab already has a session without starting one.
|
|
@@ -178,6 +178,9 @@ export class LiveEditor {
|
|
|
178
178
|
* `@volter/editor-sdk`'s `CaptureDimensions`.
|
|
179
179
|
* Supply a view to present and photograph it in one editor request.
|
|
180
180
|
*/
|
|
181
|
+
/** The active document's RENDER alone, at the size asked for: what the document draws,
|
|
182
|
+
* without what the viewport draws over it (its navigation gizmo, its readouts). To see a
|
|
183
|
+
* stage as the person does, use `captureEditorChrome({ region: 'document' })`. */
|
|
181
184
|
async captureActiveDocument(
|
|
182
185
|
size?: CaptureDimensions,
|
|
183
186
|
view?: EditorView,
|
|
@@ -325,8 +328,8 @@ export class LiveEditor {
|
|
|
325
328
|
}
|
|
326
329
|
|
|
327
330
|
/**
|
|
328
|
-
* Apply a STYLE BUNDLE by id — the chrome's palette, material
|
|
329
|
-
*
|
|
331
|
+
* Apply a STYLE BUNDLE by id — the chrome's palette, material and icon set in
|
|
332
|
+
* one gesture, the session door beside
|
|
330
333
|
* `View → <Style> Style`. A bundle the open project does not offer refuses
|
|
331
334
|
* and names the vocabulary; `currentView().style` reports the one worn.
|
|
332
335
|
*/
|
|
@@ -334,6 +337,21 @@ export class LiveEditor {
|
|
|
334
337
|
await this.#client.setStyle(id);
|
|
335
338
|
}
|
|
336
339
|
|
|
340
|
+
/**
|
|
341
|
+
* A document stage's viewport PRESENTATION — its draw mode, lighting, backdrop and overlays
|
|
342
|
+
* (`@volter/editor-sdk/kit/viewport-presentation`) — resolved. With `layer`, that choice is
|
|
343
|
+
* recorded for the view first, as a person's toolbar change would be, e.g.
|
|
344
|
+
* `presentation('model:src/models/cube.blend', { all: { lighting: { studioPreset: 'kit' } } })`.
|
|
345
|
+
* With a STRING, the named view of that id (`*.view.ts`, e.g. `'godot'`) is put on the view
|
|
346
|
+
* whole; the answer's `viewPresets` lists the ones registered.
|
|
347
|
+
*/
|
|
348
|
+
async presentation(
|
|
349
|
+
documentId: string,
|
|
350
|
+
layer?: Parameters<EditorClient['viewportPresentation']>[1],
|
|
351
|
+
): ReturnType<EditorClient['viewportPresentation']> {
|
|
352
|
+
return this.#client.viewportPresentation(documentId, layer);
|
|
353
|
+
}
|
|
354
|
+
|
|
337
355
|
/**
|
|
338
356
|
* Set the MATERIAL apart from the bundle that usually carries it.
|
|
339
357
|
* Appearance is palette × material, independent axes by ruling, so
|
|
@@ -651,6 +669,11 @@ export class LiveEditor {
|
|
|
651
669
|
return this.#client.redo();
|
|
652
670
|
}
|
|
653
671
|
|
|
672
|
+
/** Reload the editor's page and resolve once the new document answers. */
|
|
673
|
+
async reloadPage(): Promise<void> {
|
|
674
|
+
await this.#client.reloadPage();
|
|
675
|
+
}
|
|
676
|
+
|
|
654
677
|
/** Mirrors `vgai status` — the full live editor state as JSON. */
|
|
655
678
|
async status(): Promise<EditorState> {
|
|
656
679
|
return this.#client.getState();
|