@catchlight/editor-web 0.0.0 → 0.6.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/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +26 -2
- package/THIRD-PARTY-NOTICES.md +331 -0
- package/dist/editor/CatchlightEditor.d.ts +21 -0
- package/dist/editor/CatchlightEditor.js +720 -0
- package/dist/editor/dialogs.d.ts +18 -0
- package/dist/editor/dialogs.js +71 -0
- package/dist/editor/import-panel.d.ts +6 -0
- package/dist/editor/import-panel.js +98 -0
- package/dist/editor/logo.svg +11 -0
- package/dist/editor/notification.d.ts +4 -0
- package/dist/editor/notification.js +24 -0
- package/dist/editor/stage.d.ts +13 -0
- package/dist/editor/stage.js +23 -0
- package/dist/editor/test/setup.d.ts +5 -0
- package/dist/editor/test/setup.js +5 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10 -0
- package/dist/lib/animations-panel.d.ts +10 -0
- package/dist/lib/animations-panel.js +48 -0
- package/dist/lib/authoring.d.ts +17 -0
- package/dist/lib/authoring.js +116 -0
- package/dist/lib/binding-grid.d.ts +19 -0
- package/dist/lib/binding-grid.js +92 -0
- package/dist/lib/bindings.d.ts +21 -0
- package/dist/lib/bindings.js +100 -0
- package/dist/lib/camera.d.ts +21 -0
- package/dist/lib/camera.js +61 -0
- package/dist/lib/controls-panel.d.ts +36 -0
- package/dist/lib/controls-panel.js +201 -0
- package/dist/lib/controls.d.ts +103 -0
- package/dist/lib/controls.js +163 -0
- package/dist/lib/editing.d.ts +126 -0
- package/dist/lib/editing.js +415 -0
- package/dist/lib/editor-context.d.ts +15 -0
- package/dist/lib/editor-context.js +23 -0
- package/dist/lib/expressions-panel.d.ts +10 -0
- package/dist/lib/expressions-panel.js +120 -0
- package/dist/lib/file-open.d.ts +11 -0
- package/dist/lib/file-open.js +25 -0
- package/dist/lib/file-save.d.ts +29 -0
- package/dist/lib/file-save.js +68 -0
- package/dist/lib/gizmo.d.ts +13 -0
- package/dist/lib/gizmo.js +247 -0
- package/dist/lib/image-markup.d.ts +12 -0
- package/dist/lib/image-markup.js +153 -0
- package/dist/lib/index.d.ts +71 -0
- package/dist/lib/index.js +44 -0
- package/dist/lib/inspector.d.ts +19 -0
- package/dist/lib/inspector.js +161 -0
- package/dist/lib/latest.d.ts +3 -0
- package/dist/lib/latest.js +9 -0
- package/dist/lib/layer-import.d.ts +38 -0
- package/dist/lib/layer-import.js +187 -0
- package/dist/lib/mesh-editor.d.ts +13 -0
- package/dist/lib/mesh-editor.js +337 -0
- package/dist/lib/model-panels.d.ts +23 -0
- package/dist/lib/model-panels.js +180 -0
- package/dist/lib/node-actions.d.ts +42 -0
- package/dist/lib/node-actions.js +115 -0
- package/dist/lib/node-drag.d.ts +18 -0
- package/dist/lib/node-drag.js +65 -0
- package/dist/lib/node-patch.d.ts +8 -0
- package/dist/lib/node-patch.js +10 -0
- package/dist/lib/node-tree.d.ts +36 -0
- package/dist/lib/node-tree.js +221 -0
- package/dist/lib/official.d.ts +82 -0
- package/dist/lib/official.js +197 -0
- package/dist/lib/param-actions.d.ts +48 -0
- package/dist/lib/param-actions.js +106 -0
- package/dist/lib/param-list.d.ts +36 -0
- package/dist/lib/param-list.js +73 -0
- package/dist/lib/param-slider.d.ts +44 -0
- package/dist/lib/param-slider.js +149 -0
- package/dist/lib/pose.d.ts +13 -0
- package/dist/lib/pose.js +32 -0
- package/dist/lib/posing-panel.d.ts +40 -0
- package/dist/lib/posing-panel.js +154 -0
- package/dist/lib/presence.d.ts +27 -0
- package/dist/lib/presence.js +98 -0
- package/dist/lib/properties-panel.d.ts +13 -0
- package/dist/lib/properties-panel.js +63 -0
- package/dist/lib/recording-panel.d.ts +4 -0
- package/dist/lib/recording-panel.js +161 -0
- package/dist/lib/replica.d.ts +18 -0
- package/dist/lib/replica.js +34 -0
- package/dist/lib/review.d.ts +113 -0
- package/dist/lib/review.js +529 -0
- package/dist/lib/rigging.d.ts +10 -0
- package/dist/lib/rigging.js +116 -0
- package/dist/lib/selection.d.ts +3 -0
- package/dist/lib/selection.js +2 -0
- package/dist/lib/session-list.d.ts +16 -0
- package/dist/lib/session-list.js +7 -0
- package/dist/lib/sessions.d.ts +8 -0
- package/dist/lib/sessions.js +29 -0
- package/dist/lib/test/harness.d.ts +32 -0
- package/dist/lib/test/harness.js +139 -0
- package/dist/lib/test/setup.d.ts +4 -0
- package/dist/lib/test/setup.js +5 -0
- package/dist/lib/versions.d.ts +69 -0
- package/dist/lib/versions.js +250 -0
- package/dist/lib/viewport.d.ts +57 -0
- package/dist/lib/viewport.js +315 -0
- package/dist/lib/workspace-layout.d.ts +24 -0
- package/dist/lib/workspace-layout.js +145 -0
- package/dist/lib/workspace.d.ts +29 -0
- package/dist/lib/workspace.js +263 -0
- package/dist/theme.css +4577 -0
- package/package.json +32 -6
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { fileKey } from "@catchlight/editor-core";
|
|
3
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { useEditor } from "./editor-context.js";
|
|
5
|
+
export function useFileSave(session) {
|
|
6
|
+
const editor = useEditor();
|
|
7
|
+
const save = useCallback(async (name) => {
|
|
8
|
+
if (!session)
|
|
9
|
+
throw new Error("Open a model before saving.");
|
|
10
|
+
const key = await editor.saveSession(session, name === undefined ? undefined : saveKey(name));
|
|
11
|
+
const bytes = await editor.readFile(key);
|
|
12
|
+
if (bytes)
|
|
13
|
+
downloadBytes(bytes, downloadName(key));
|
|
14
|
+
return { key, downloaded: bytes !== undefined };
|
|
15
|
+
}, [editor, session]);
|
|
16
|
+
return useMemo(() => ({ save }), [save]);
|
|
17
|
+
}
|
|
18
|
+
export function FileSaveRoot({ session, defaultName, onSaved, onError, children, ...rest }) {
|
|
19
|
+
const { save } = useFileSave(session);
|
|
20
|
+
const input = useRef(null);
|
|
21
|
+
const [busy, setBusy] = useState(false);
|
|
22
|
+
const handleSubmit = (event) => {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
if (busy)
|
|
25
|
+
return;
|
|
26
|
+
setBusy(true);
|
|
27
|
+
void save(input.current?.value ?? "")
|
|
28
|
+
.then((outcome) => onSaved?.(outcome), (cause) => {
|
|
29
|
+
if (onError)
|
|
30
|
+
onError(cause);
|
|
31
|
+
else
|
|
32
|
+
console.warn("catchlight: saving failed", cause);
|
|
33
|
+
})
|
|
34
|
+
.finally(() => setBusy(false));
|
|
35
|
+
};
|
|
36
|
+
return (_jsxs("form", { "data-catchlight-file-save": "", onSubmit: handleSubmit, ...rest, children: [_jsx("input", { type: "text", "data-catchlight-save-as": "", "aria-label": "Save as", placeholder: "name.clm", defaultValue: defaultName, ref: input, disabled: busy }), _jsx("button", { type: "submit", "data-catchlight-save-as-submit": "", disabled: busy, children: busy ? "Saving…" : (children ?? "Save As") })] }));
|
|
37
|
+
}
|
|
38
|
+
export const FileSave = { Root: FileSaveRoot };
|
|
39
|
+
export function saveKey(name) {
|
|
40
|
+
const key = fileKey(name);
|
|
41
|
+
return /\.clm$/i.test(key) ? key : `${key}.clm`;
|
|
42
|
+
}
|
|
43
|
+
export function downloadName(key) {
|
|
44
|
+
return key.split("/").pop() || "untitled.clm";
|
|
45
|
+
}
|
|
46
|
+
// An attached `download` anchor starts a save without a permission prompt;
|
|
47
|
+
// some browsers ignore a detached one. The object URL outlives the anchor
|
|
48
|
+
// because the download may still be starting.
|
|
49
|
+
export function downloadBytes(bytes, name) {
|
|
50
|
+
const blob = new Blob([bytes], {
|
|
51
|
+
type: "application/octet-stream",
|
|
52
|
+
});
|
|
53
|
+
const url = URL.createObjectURL(blob);
|
|
54
|
+
const anchor = document.createElement("a");
|
|
55
|
+
anchor.href = url;
|
|
56
|
+
anchor.download = name;
|
|
57
|
+
anchor.setAttribute("data-catchlight-download", "");
|
|
58
|
+
anchor.style.display = "none";
|
|
59
|
+
document.body.append(anchor);
|
|
60
|
+
try {
|
|
61
|
+
anchor.click();
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
anchor.remove();
|
|
65
|
+
setTimeout(() => URL.revokeObjectURL(url), REVOKE_AFTER_MS);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const REVOKE_AFTER_MS = 60_000;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** A gesture previews only scratch, then commits once. Cancel, loss of
|
|
2
|
+
* focus, and a model switch roll the preview back. */
|
|
3
|
+
import type { Camera, NodeId, Session } from "@catchlight/editor-core";
|
|
4
|
+
import type { Size } from "./camera.js";
|
|
5
|
+
import type { ErrorHandler } from "./authoring.js";
|
|
6
|
+
export declare function SelectionOverlay({ session, node, camera, size, mesh, onError, }: {
|
|
7
|
+
session: Session;
|
|
8
|
+
node: NodeId;
|
|
9
|
+
camera: Camera;
|
|
10
|
+
size: Size;
|
|
11
|
+
mesh: boolean;
|
|
12
|
+
onError: ErrorHandler;
|
|
13
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { screenAt, worldAt } from "./camera.js";
|
|
4
|
+
import { useNodeInfo } from "./replica.js";
|
|
5
|
+
import { useSelectionVertices } from "./workspace.js";
|
|
6
|
+
import { useEditing } from "./editing.js";
|
|
7
|
+
export function SelectionOverlay({ session, node, camera, size, mesh, onError, }) {
|
|
8
|
+
const edit = useEditing();
|
|
9
|
+
const info = useNodeInfo(session, node);
|
|
10
|
+
const meshInfo = useMemo(() => info?.vertex_count ? session.mesh(node) : undefined, [session, node, info]);
|
|
11
|
+
const vertices = useSelectionVertices(session, node);
|
|
12
|
+
const active = useRef(undefined);
|
|
13
|
+
const [dragging, setDragging] = useState(false);
|
|
14
|
+
const svg = useRef(null);
|
|
15
|
+
const points = [];
|
|
16
|
+
let left = Infinity, top = Infinity, right = -Infinity, bottom = -Infinity;
|
|
17
|
+
for (let i = 0; i < vertices.length; i += 2) {
|
|
18
|
+
const point = screenAt(camera, size, [vertices[i], vertices[i + 1]]);
|
|
19
|
+
points.push(point);
|
|
20
|
+
left = Math.min(left, point[0]);
|
|
21
|
+
top = Math.min(top, point[1]);
|
|
22
|
+
right = Math.max(right, point[0]);
|
|
23
|
+
bottom = Math.max(bottom, point[1]);
|
|
24
|
+
}
|
|
25
|
+
const cancel = () => {
|
|
26
|
+
const gesture = active.current;
|
|
27
|
+
active.current = undefined;
|
|
28
|
+
setDragging(false);
|
|
29
|
+
gesture?.recording?.dispose();
|
|
30
|
+
if (gesture && !session.closed) {
|
|
31
|
+
if (typeof gesture.kind === "number")
|
|
32
|
+
session.clearScratchDeform(node);
|
|
33
|
+
else
|
|
34
|
+
session.clearScratchTransform(node);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const latestCancel = useRef(cancel);
|
|
38
|
+
latestCancel.current = cancel;
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const escape = (e) => {
|
|
41
|
+
if ((e.key === "Escape" ||
|
|
42
|
+
((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z")) &&
|
|
43
|
+
active.current) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
e.stopImmediatePropagation();
|
|
46
|
+
latestCancel.current();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const blur = () => latestCancel.current();
|
|
50
|
+
window.addEventListener("keydown", escape, true);
|
|
51
|
+
window.addEventListener("blur", blur);
|
|
52
|
+
return () => {
|
|
53
|
+
window.removeEventListener("keydown", escape, true);
|
|
54
|
+
window.removeEventListener("blur", blur);
|
|
55
|
+
latestCancel.current();
|
|
56
|
+
};
|
|
57
|
+
}, [session, node, edit?.mode, edit?.recording, edit?.recordTool]);
|
|
58
|
+
const world = (e) => {
|
|
59
|
+
const rect = svg.current.getBoundingClientRect();
|
|
60
|
+
return worldAt(camera, size, [e.clientX - rect.left, e.clientY - rect.top]);
|
|
61
|
+
};
|
|
62
|
+
const start = (kind, e) => {
|
|
63
|
+
if (!info || e.button !== 0 || edit?.busy)
|
|
64
|
+
return;
|
|
65
|
+
if (typeof kind === "number" && !edit?.recording)
|
|
66
|
+
return;
|
|
67
|
+
if (edit?.mode === "record" && !edit.recording)
|
|
68
|
+
return;
|
|
69
|
+
const recording = edit?.mode === "record" ? edit.beginRecording() : undefined;
|
|
70
|
+
if (edit?.mode === "record" && !recording)
|
|
71
|
+
return;
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
const matrix = session.nodeWorldTransform(node);
|
|
75
|
+
if (!matrix) {
|
|
76
|
+
recording?.dispose();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
svg.current.setPointerCapture(e.pointerId);
|
|
80
|
+
active.current = {
|
|
81
|
+
kind,
|
|
82
|
+
recording,
|
|
83
|
+
pointer: e.pointerId,
|
|
84
|
+
from: world(e),
|
|
85
|
+
pivot: [matrix[12], matrix[13]],
|
|
86
|
+
info,
|
|
87
|
+
local: session.nodeLocalTransform(node),
|
|
88
|
+
};
|
|
89
|
+
setDragging(true);
|
|
90
|
+
};
|
|
91
|
+
const move = (e) => {
|
|
92
|
+
const drag = active.current;
|
|
93
|
+
if (!drag || drag.pointer !== e.pointerId)
|
|
94
|
+
return;
|
|
95
|
+
const at = world(e);
|
|
96
|
+
if (typeof drag.kind === "number") {
|
|
97
|
+
const delta = session.nodeDeltaFromWorld(node, at[0] - drag.from[0], at[1] - drag.from[1]);
|
|
98
|
+
if (!delta || !drag.info.vertex_count)
|
|
99
|
+
return;
|
|
100
|
+
const index = drag.kind;
|
|
101
|
+
const offsets = new Float32Array(drag.info.vertex_count * 2);
|
|
102
|
+
offsets[index * 2] = delta[0];
|
|
103
|
+
offsets[index * 2 + 1] = delta[1];
|
|
104
|
+
drag.offsets = offsets;
|
|
105
|
+
session.scratchDeform(node, offsets);
|
|
106
|
+
}
|
|
107
|
+
else if (drag.kind === "scale") {
|
|
108
|
+
const before = Math.hypot(drag.from[0] - drag.pivot[0], drag.from[1] - drag.pivot[1]);
|
|
109
|
+
if (before < 0.001)
|
|
110
|
+
return;
|
|
111
|
+
let ratio = Math.max(0.02, Math.hypot(at[0] - drag.pivot[0], at[1] - drag.pivot[1]) / before);
|
|
112
|
+
if (e.shiftKey)
|
|
113
|
+
ratio = Math.max(0.1, Math.round(ratio * 10) / 10);
|
|
114
|
+
drag.patch = {
|
|
115
|
+
scale: [drag.info.scale[0] * ratio, drag.info.scale[1] * ratio],
|
|
116
|
+
};
|
|
117
|
+
session.scratchTransform(node, {
|
|
118
|
+
scale: [
|
|
119
|
+
(drag.local?.[6] ?? drag.info.scale[0]) * ratio,
|
|
120
|
+
(drag.local?.[7] ?? drag.info.scale[1]) * ratio,
|
|
121
|
+
],
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
let angle = Math.atan2(at[1] - drag.pivot[1], at[0] - drag.pivot[0]) -
|
|
126
|
+
Math.atan2(drag.from[1] - drag.pivot[1], drag.from[0] - drag.pivot[0]);
|
|
127
|
+
angle = Math.atan2(Math.sin(angle), Math.cos(angle));
|
|
128
|
+
if (e.shiftKey)
|
|
129
|
+
angle = Math.round(angle / (Math.PI / 12)) * (Math.PI / 12);
|
|
130
|
+
drag.patch = {
|
|
131
|
+
rotate: [
|
|
132
|
+
drag.info.rotate[0],
|
|
133
|
+
drag.info.rotate[1],
|
|
134
|
+
drag.info.rotate[2] + angle,
|
|
135
|
+
],
|
|
136
|
+
};
|
|
137
|
+
session.scratchTransform(node, {
|
|
138
|
+
rotate: [
|
|
139
|
+
drag.local?.[3] ?? drag.info.rotate[0],
|
|
140
|
+
drag.local?.[4] ?? drag.info.rotate[1],
|
|
141
|
+
(drag.local?.[5] ?? drag.info.rotate[2]) + angle,
|
|
142
|
+
],
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const finish = (e) => {
|
|
147
|
+
const drag = active.current;
|
|
148
|
+
if (!drag || drag.pointer !== e.pointerId)
|
|
149
|
+
return;
|
|
150
|
+
active.current = undefined;
|
|
151
|
+
setDragging(false);
|
|
152
|
+
const changed = !!drag.offsets || !!drag.patch;
|
|
153
|
+
const work = drag.recording && changed
|
|
154
|
+
? edit.runGesture(drag.recording, () => drag.offsets
|
|
155
|
+
? drag.recording.deform(drag.offsets)
|
|
156
|
+
: drag.recording.patch(drag.patch, true))
|
|
157
|
+
: drag.patch && !drag.recording
|
|
158
|
+
? session.send({ cmd: "node_set", node, ...drag.patch })
|
|
159
|
+
: undefined;
|
|
160
|
+
if (!changed)
|
|
161
|
+
drag.recording?.dispose();
|
|
162
|
+
void work?.catch(onError).finally(() => {
|
|
163
|
+
if (!session.closed) {
|
|
164
|
+
if (typeof drag.kind === "number")
|
|
165
|
+
session.clearScratchDeform(node);
|
|
166
|
+
else
|
|
167
|
+
session.clearScratchTransform(node);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
const editVertex = (index, dx, dy) => {
|
|
172
|
+
if (!info?.vertex_count || !edit?.recording || edit.busy)
|
|
173
|
+
return;
|
|
174
|
+
const gesture = edit.beginRecording();
|
|
175
|
+
if (!gesture)
|
|
176
|
+
return;
|
|
177
|
+
const offsets = new Float32Array(info.vertex_count * 2);
|
|
178
|
+
offsets[index * 2] = dx;
|
|
179
|
+
offsets[index * 2 + 1] = dy;
|
|
180
|
+
void edit.runGesture(gesture, () => gesture.deform(offsets));
|
|
181
|
+
};
|
|
182
|
+
const patchTransform = (patch) => {
|
|
183
|
+
if (edit?.busy)
|
|
184
|
+
return;
|
|
185
|
+
if (edit?.mode === "record") {
|
|
186
|
+
if (edit.recording)
|
|
187
|
+
void edit.patch(patch, true);
|
|
188
|
+
}
|
|
189
|
+
else
|
|
190
|
+
void session.send({ cmd: "node_set", node, ...patch }).catch(onError);
|
|
191
|
+
};
|
|
192
|
+
if (!points.length)
|
|
193
|
+
return null;
|
|
194
|
+
return (_jsxs("svg", { ref: svg, "data-catchlight-selection-overlay": "", "data-recording": edit?.recording ? "" : undefined, "data-gesturing": dragging ? "" : undefined, width: size.width, height: size.height, viewBox: `0 0 ${size.width} ${size.height}`, onPointerMove: move, onPointerUp: finish, onPointerCancel: cancel, onLostPointerCapture: () => {
|
|
195
|
+
if (active.current)
|
|
196
|
+
cancel();
|
|
197
|
+
}, children: [_jsx("rect", { "data-catchlight-selection-box": "", x: left, y: top, width: right - left, height: bottom - top }), mesh && meshInfo ? (_jsxs("g", { "data-catchlight-mesh-lines": "", children: [meshInfo.indices.map((tri, i) => (_jsx("polygon", { points: tri
|
|
198
|
+
.map((index) => points[index]?.join(",") ?? "")
|
|
199
|
+
.join(" ") }, i))), points.map(([x, y], i) => (_jsxs("g", { "data-catchlight-record-vertex": "", children: [_jsx("circle", { cx: x, cy: y, r: "4", "data-catchlight-record-vertex-dot": "" }), _jsx("circle", { cx: x, cy: y, r: "11", "data-catchlight-vertex-handle": "", "data-vertex": i, tabIndex: 0, role: "button", "aria-label": `Mesh vertex ${i + 1}`, onPointerDown: (e) => start(i, e), onKeyDown: (e) => {
|
|
200
|
+
const amount = e.shiftKey ? 10 : 1;
|
|
201
|
+
const delta = {
|
|
202
|
+
ArrowLeft: [-amount, 0],
|
|
203
|
+
ArrowRight: [amount, 0],
|
|
204
|
+
ArrowUp: [0, amount],
|
|
205
|
+
ArrowDown: [0, -amount],
|
|
206
|
+
};
|
|
207
|
+
const change = delta[e.key];
|
|
208
|
+
if (change) {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
e.stopPropagation();
|
|
211
|
+
editVertex(i, ...change);
|
|
212
|
+
}
|
|
213
|
+
}, children: _jsxs("title", { children: ["Vertex ", i + 1, " \u00B7 drag to reshape"] }) })] }, i)))] })) : (_jsxs(_Fragment, { children: [[
|
|
214
|
+
[left, top],
|
|
215
|
+
[right, top],
|
|
216
|
+
[right, bottom],
|
|
217
|
+
[left, bottom],
|
|
218
|
+
].map(([x, y], i) => (_jsx("rect", { "data-catchlight-selection-corner": "", x: x - 3, y: y - 3, width: "6", height: "6", role: "button", tabIndex: 0, "aria-label": `Scale selection from corner ${i + 1}`, onPointerDown: (e) => start("scale", e), onKeyDown: (e) => {
|
|
219
|
+
if (!info)
|
|
220
|
+
return;
|
|
221
|
+
const factor = e.key === "ArrowUp" || e.key === "ArrowRight"
|
|
222
|
+
? 1.1
|
|
223
|
+
: e.key === "ArrowDown" || e.key === "ArrowLeft"
|
|
224
|
+
? 1 / 1.1
|
|
225
|
+
: 0;
|
|
226
|
+
if (factor) {
|
|
227
|
+
e.preventDefault();
|
|
228
|
+
e.stopPropagation();
|
|
229
|
+
patchTransform({
|
|
230
|
+
scale: [info.scale[0] * factor, info.scale[1] * factor],
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}, children: _jsx("title", { children: "Scale proportionally \u00B7 Shift to snap" }) }, i))), _jsx("path", { "data-catchlight-rotation-stem": "", d: `M${(left + right) / 2} ${top}v-24` }), _jsx("circle", { "data-catchlight-rotation-handle": "", cx: (left + right) / 2, cy: top - 24, r: "4", role: "button", tabIndex: 0, "aria-label": "Rotate selection", onPointerDown: (e) => start("rotate", e), onKeyDown: (e) => {
|
|
234
|
+
if (info && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
235
|
+
e.preventDefault();
|
|
236
|
+
e.stopPropagation();
|
|
237
|
+
patchTransform({
|
|
238
|
+
rotate: [
|
|
239
|
+
info.rotate[0],
|
|
240
|
+
info.rotate[1],
|
|
241
|
+
info.rotate[2] +
|
|
242
|
+
((e.key === "ArrowLeft" ? 1 : -1) * Math.PI) / 12,
|
|
243
|
+
],
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}, children: _jsx("title", { children: "Rotate \u00B7 Shift for 15\u00B0 steps" }) })] }))] }));
|
|
247
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks up an image before it is attached to a review comment: boxes, arrows,
|
|
3
|
+
* freehand strokes and a crop. Shapes are kept in image pixels and drawn as
|
|
4
|
+
* SVG over the image; `Done` bakes them into a new PNG.
|
|
5
|
+
*/
|
|
6
|
+
export interface ImageMarkupProps {
|
|
7
|
+
image: Blob;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
onDone: (marked: Blob) => void;
|
|
10
|
+
onError: (cause: unknown) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function ImageMarkup({ image, onCancel, onDone, onError }: ImageMarkupProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Marks up an image before it is attached to a review comment: boxes, arrows,
|
|
4
|
+
* freehand strokes and a crop. Shapes are kept in image pixels and drawn as
|
|
5
|
+
* SVG over the image; `Done` bakes them into a new PNG.
|
|
6
|
+
*/
|
|
7
|
+
import { useEffect, useRef, useState } from "react";
|
|
8
|
+
import { Icon, Modal } from "./controls.js";
|
|
9
|
+
const TOOLS = [
|
|
10
|
+
["box", "grid", "Box"],
|
|
11
|
+
["arrow", "arrow", "Arrow"],
|
|
12
|
+
["pen", "pen", "Draw"],
|
|
13
|
+
["crop", "fit", "Crop"],
|
|
14
|
+
];
|
|
15
|
+
const INK = "#ff4d5e";
|
|
16
|
+
export function ImageMarkup({ image, onCancel, onDone, onError }) {
|
|
17
|
+
const [url, setUrl] = useState();
|
|
18
|
+
const [size, setSize] = useState();
|
|
19
|
+
const [tool, setTool] = useState("box");
|
|
20
|
+
const [shapes, setShapes] = useState([]);
|
|
21
|
+
const [draft, setDraft] = useState();
|
|
22
|
+
const picture = useRef(null);
|
|
23
|
+
const surface = useRef(null);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const made = URL.createObjectURL(image);
|
|
26
|
+
setUrl(made);
|
|
27
|
+
return () => URL.revokeObjectURL(made);
|
|
28
|
+
}, [image]);
|
|
29
|
+
const at = (event) => {
|
|
30
|
+
const box = event.currentTarget.getBoundingClientRect();
|
|
31
|
+
const width = size?.width ?? 1;
|
|
32
|
+
const height = size?.height ?? 1;
|
|
33
|
+
const x = box.width > 0 ? ((event.clientX - box.left) / box.width) * width : 0;
|
|
34
|
+
const y = box.height > 0 ? ((event.clientY - box.top) / box.height) * height : 0;
|
|
35
|
+
return [Math.min(width, Math.max(0, x)), Math.min(height, Math.max(0, y))];
|
|
36
|
+
};
|
|
37
|
+
const begin = (event) => {
|
|
38
|
+
if (!size || event.button !== 0)
|
|
39
|
+
return;
|
|
40
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
41
|
+
const point = at(event);
|
|
42
|
+
setDraft({ tool, points: [point, point] });
|
|
43
|
+
};
|
|
44
|
+
const move = (event) => {
|
|
45
|
+
if (!draft)
|
|
46
|
+
return;
|
|
47
|
+
const point = at(event);
|
|
48
|
+
setDraft(draft.tool === "pen"
|
|
49
|
+
? { tool: "pen", points: [...draft.points, point] }
|
|
50
|
+
: { tool: draft.tool, points: [draft.points[0], point] });
|
|
51
|
+
};
|
|
52
|
+
const end = () => {
|
|
53
|
+
if (!draft)
|
|
54
|
+
return;
|
|
55
|
+
setDraft(undefined);
|
|
56
|
+
if (extent(draft) < 3)
|
|
57
|
+
return;
|
|
58
|
+
// One crop at a time: a new one replaces the last.
|
|
59
|
+
setShapes((was) => [...(draft.tool === "crop" ? was.filter((s) => s.tool !== "crop") : was), draft]);
|
|
60
|
+
};
|
|
61
|
+
const done = () => {
|
|
62
|
+
const source = picture.current;
|
|
63
|
+
if (!source || !size)
|
|
64
|
+
return;
|
|
65
|
+
bake(source, size, shapes).then(onDone, onError);
|
|
66
|
+
};
|
|
67
|
+
const drawn = draft ? [...shapes, draft] : shapes;
|
|
68
|
+
const stroke = size ? Math.max(2, Math.round(Math.max(size.width, size.height) / 300)) : 2;
|
|
69
|
+
return (_jsx(Modal, { title: "Mark up image", wide: true, onClose: onCancel, children: _jsxs("div", { "data-catchlight-markup": "", children: [_jsxs("div", { "data-catchlight-markup-tools": "", role: "group", "aria-label": "Markup tools", children: [TOOLS.map(([each, icon, label]) => (_jsxs("button", { type: "button", "aria-pressed": tool === each, onClick: () => setTool(each), children: [_jsx(Icon, { name: icon, width: "14", height: "14" }), label] }, each))), _jsxs("button", { type: "button", "data-catchlight-markup-undo": "", disabled: shapes.length === 0, onClick: () => setShapes((was) => was.slice(0, -1)), children: [_jsx(Icon, { name: "undo", width: "14", height: "14" }), "Undo"] })] }), _jsxs("div", { "data-catchlight-markup-stage": "", children: [url && (_jsx("img", { ref: picture, src: url, alt: "The image being marked up", draggable: false, onLoad: (event) => setSize({
|
|
70
|
+
width: event.currentTarget.naturalWidth,
|
|
71
|
+
height: event.currentTarget.naturalHeight,
|
|
72
|
+
}) })), size && (_jsx("svg", { ref: surface, "data-catchlight-markup-surface": "", "data-tool": tool, viewBox: `0 0 ${size.width} ${size.height}`, preserveAspectRatio: "none", onPointerDown: begin, onPointerMove: move, onPointerUp: end, onPointerCancel: () => setDraft(undefined), children: drawn.map((shape, index) => (_jsx(ShapeView, { shape: shape, stroke: stroke, size: size }, index))) }))] }), _jsxs("div", { "data-catchlight-dialog-actions": "", children: [_jsx("button", { type: "button", onClick: onCancel, children: "Cancel" }), _jsx("button", { type: "button", "data-primary": "", disabled: !size, onClick: done, children: "Done" })] })] }) }));
|
|
73
|
+
}
|
|
74
|
+
function extent(shape) {
|
|
75
|
+
const [first] = shape.points;
|
|
76
|
+
if (!first)
|
|
77
|
+
return 0;
|
|
78
|
+
return Math.max(...shape.points.map(([x, y]) => Math.max(Math.abs(x - first[0]), Math.abs(y - first[1]))));
|
|
79
|
+
}
|
|
80
|
+
function rect(shape) {
|
|
81
|
+
const [a, b] = shape.points;
|
|
82
|
+
return {
|
|
83
|
+
x: Math.min(a[0], b[0]),
|
|
84
|
+
y: Math.min(a[1], b[1]),
|
|
85
|
+
width: Math.abs(a[0] - b[0]),
|
|
86
|
+
height: Math.abs(a[1] - b[1]),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** The two barbs of an arrow's head, as points. */
|
|
90
|
+
function barbs(tail, head, length) {
|
|
91
|
+
const angle = Math.atan2(head[1] - tail[1], head[0] - tail[0]);
|
|
92
|
+
const barb = (turn) => [
|
|
93
|
+
head[0] - length * Math.cos(angle + turn),
|
|
94
|
+
head[1] - length * Math.sin(angle + turn),
|
|
95
|
+
];
|
|
96
|
+
return [barb(0.45), barb(-0.45)];
|
|
97
|
+
}
|
|
98
|
+
function ShapeView({ shape, stroke, size, }) {
|
|
99
|
+
const ink = { fill: "none", stroke: INK, strokeWidth: stroke, strokeLinecap: "round", strokeLinejoin: "round" };
|
|
100
|
+
if (shape.tool === "box")
|
|
101
|
+
return _jsx("rect", { "data-shape": "box", ...rect(shape), ...ink });
|
|
102
|
+
if (shape.tool === "pen")
|
|
103
|
+
return _jsx("polyline", { "data-shape": "pen", points: shape.points.map((p) => p.join(",")).join(" "), ...ink });
|
|
104
|
+
if (shape.tool === "arrow") {
|
|
105
|
+
const [tail, head] = shape.points;
|
|
106
|
+
const [left, right] = barbs(tail, head, stroke * 5);
|
|
107
|
+
return (_jsx("path", { "data-shape": "arrow", d: `M${tail.join(",")}L${head.join(",")}M${left.join(",")}L${head.join(",")}L${right.join(",")}`, ...ink }));
|
|
108
|
+
}
|
|
109
|
+
const kept = rect(shape);
|
|
110
|
+
return (_jsx("path", { "data-shape": "crop", fillRule: "evenodd", fill: "#000a", stroke: "#fff", strokeWidth: Math.max(1, stroke / 2), strokeDasharray: `${stroke * 3} ${stroke * 2}`, d: `M0,0H${size.width}V${size.height}H0ZM${kept.x},${kept.y}h${kept.width}v${kept.height}h${-kept.width}Z` }));
|
|
111
|
+
}
|
|
112
|
+
async function bake(source, size, shapes) {
|
|
113
|
+
const crop = shapes.find((shape) => shape.tool === "crop");
|
|
114
|
+
const kept = crop ? rect(crop) : { x: 0, y: 0, ...size };
|
|
115
|
+
const canvas = document.createElement("canvas");
|
|
116
|
+
canvas.width = Math.max(1, Math.round(kept.width));
|
|
117
|
+
canvas.height = Math.max(1, Math.round(kept.height));
|
|
118
|
+
const context = canvas.getContext("2d");
|
|
119
|
+
if (!context)
|
|
120
|
+
throw new Error("This browser cannot draw the marked-up image.");
|
|
121
|
+
context.translate(-kept.x, -kept.y);
|
|
122
|
+
context.drawImage(source, 0, 0, size.width, size.height);
|
|
123
|
+
context.strokeStyle = INK;
|
|
124
|
+
context.lineWidth = Math.max(2, Math.round(Math.max(size.width, size.height) / 300));
|
|
125
|
+
context.lineCap = "round";
|
|
126
|
+
context.lineJoin = "round";
|
|
127
|
+
for (const shape of shapes) {
|
|
128
|
+
if (shape.tool === "crop")
|
|
129
|
+
continue;
|
|
130
|
+
context.beginPath();
|
|
131
|
+
if (shape.tool === "box") {
|
|
132
|
+
const box = rect(shape);
|
|
133
|
+
context.rect(box.x, box.y, box.width, box.height);
|
|
134
|
+
}
|
|
135
|
+
else if (shape.tool === "pen") {
|
|
136
|
+
shape.points.forEach(([x, y], index) => index === 0 ? context.moveTo(x, y) : context.lineTo(x, y));
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const [tail, head] = shape.points;
|
|
140
|
+
const [left, right] = barbs(tail, head, context.lineWidth * 5);
|
|
141
|
+
context.moveTo(...tail);
|
|
142
|
+
context.lineTo(...head);
|
|
143
|
+
context.moveTo(...left);
|
|
144
|
+
context.lineTo(...head);
|
|
145
|
+
context.lineTo(...right);
|
|
146
|
+
}
|
|
147
|
+
context.stroke();
|
|
148
|
+
}
|
|
149
|
+
const blob = await new Promise((resolve) => canvas.toBlob(resolve, "image/png"));
|
|
150
|
+
if (!blob)
|
|
151
|
+
throw new Error("The marked-up image could not be saved.");
|
|
152
|
+
return blob;
|
|
153
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks over a `Session`, and unstyled parts over the
|
|
3
|
+
* hooks. Parts ship no class names or stylesheets; state is in `data-*`.
|
|
4
|
+
*/
|
|
5
|
+
export { EditorProvider, useEditor, useGpuTier } from "./editor-context.js";
|
|
6
|
+
export type { EditorProviderProps } from "./editor-context.js";
|
|
7
|
+
export { useNodeInfo, useParams, useReplica, useRevision, useTree, } from "./replica.js";
|
|
8
|
+
export { useLayerImport } from "./layer-import.js";
|
|
9
|
+
export type { ArtChoice, ArtSource, LayerImport } from "./layer-import.js";
|
|
10
|
+
export { useSessions } from "./sessions.js";
|
|
11
|
+
export type { Sessions } from "./sessions.js";
|
|
12
|
+
export { SelectionProvider, useSelection } from "./selection.js";
|
|
13
|
+
export type { Selection, SelectionProviderProps } from "./selection.js";
|
|
14
|
+
export { Viewport, ViewportRoot, useViewportCamera } from "./viewport.js";
|
|
15
|
+
export type { ViewportCamera, ViewportPointerEvent, ViewportRootProps, } from "./viewport.js";
|
|
16
|
+
export { DEFAULT_CAMERA, fitCamera, panTo, screenAt, wheelNotches, worldAt, worldPerPixel, zoomAbout, } from "./camera.js";
|
|
17
|
+
export type { Bounds, Point, Size } from "./camera.js";
|
|
18
|
+
export { useNodeDrag } from "./node-drag.js";
|
|
19
|
+
export type { NodeDrag } from "./node-drag.js";
|
|
20
|
+
export { ParamKeys, ParamKeysRoot, ParamSlider, ParamSliderRoot, useHeldByMotion, useMotionPaused, useMotionRunning, } from "./param-slider.js";
|
|
21
|
+
export type { ParamKeysRootProps, ParamSliderRootProps, } from "./param-slider.js";
|
|
22
|
+
export { ParamAdd, ParamAddRoot, ParamFields, ParamFieldsRoot, ParamList, ParamListRoot, } from "./param-list.js";
|
|
23
|
+
export type { ParamAddRootProps, ParamFieldsRootProps, ParamListRootProps, } from "./param-list.js";
|
|
24
|
+
export { useNodeActions } from "./node-actions.js";
|
|
25
|
+
export type { DropAt, NodeActions } from "./node-actions.js";
|
|
26
|
+
export { NODE_KINDS, NodeTree, NodeTreeActions, NodeTreeItem, NodeTreeRoot, } from "./node-tree.js";
|
|
27
|
+
export type { NodeTreeActionsProps, NodeTreeItemProps, NodeTreeRootProps, } from "./node-tree.js";
|
|
28
|
+
export { SessionList, SessionListRoot } from "./session-list.js";
|
|
29
|
+
export type { SessionListRootProps } from "./session-list.js";
|
|
30
|
+
export { FileOpen, FileOpenRoot } from "./file-open.js";
|
|
31
|
+
export type { FileOpenRootProps } from "./file-open.js";
|
|
32
|
+
export { BINDING_TARGETS, INTERPOLATE_MODES, bindingsOfParam, keyIndexNear, normalizedValue, useBindings, valueAtKey, } from "./bindings.js";
|
|
33
|
+
export { useParamActions } from "./param-actions.js";
|
|
34
|
+
export type { BindingCell, BindingAddress, NewParam, ParamActions, ParamPatch, } from "./param-actions.js";
|
|
35
|
+
export { BindingGrid, BindingGridRoot } from "./binding-grid.js";
|
|
36
|
+
export type { BindingGridRootProps } from "./binding-grid.js";
|
|
37
|
+
export { useNodePatch } from "./node-patch.js";
|
|
38
|
+
export type { NodePatchFn } from "./node-patch.js";
|
|
39
|
+
export { BLEND_MODES, Inspector, InspectorRoot } from "./inspector.js";
|
|
40
|
+
export type { InspectorRootProps } from "./inspector.js";
|
|
41
|
+
export { POSE_INTERVAL_MS, PresenceProvider, usePose } from "./presence.js";
|
|
42
|
+
export type { Pose, PoseSource, PresenceProviderProps } from "./presence.js";
|
|
43
|
+
export { readPose, usePosePublisher, useResetPose } from "./pose.js";
|
|
44
|
+
export { downloadBytes, downloadName, FileSave, FileSaveRoot, saveKey, useFileSave, } from "./file-save.js";
|
|
45
|
+
export type { FileSaver, FileSaveRootProps, SaveOutcome } from "./file-save.js";
|
|
46
|
+
export type { BindingInfo, BindingParams, Camera, NodeInfo, } from "@catchlight/editor-core";
|
|
47
|
+
export { Icon, IconButton, Field, SearchField, NumberField, TextField, Disclosure, EmptyState, Modal, } from "./controls.js";
|
|
48
|
+
export type { IconName } from "./controls.js";
|
|
49
|
+
export { useCommand, useSessionStatus, useModelQuery, importArtwork, flattenTree, kindLabels, kindIcons, } from "./authoring.js";
|
|
50
|
+
export type { ErrorHandler } from "./authoring.js";
|
|
51
|
+
export { MeshPanel, MotionResponsePanel, RiggingEmpty, } from "./rigging.js";
|
|
52
|
+
export { MaskPanel, SlotsPanel, WeldsPanel, ModelHealth, ExtensionsPanel, } from "./model-panels.js";
|
|
53
|
+
export { useOfficialRead, useHumanoid, useExpressions, useClips, useExtensionWarnings, useLiveInputs, usePlayingClip, usePlayhead, ExtensionWarnings, } from "./official.js";
|
|
54
|
+
export type { OfficialRead } from "./official.js";
|
|
55
|
+
export { ControlsPanel, CONTROL_GROUPS, groupControls } from "./controls-panel.js";
|
|
56
|
+
export type { ControlEntry } from "./controls-panel.js";
|
|
57
|
+
export { ExpressionsPanel } from "./expressions-panel.js";
|
|
58
|
+
export { AnimationsPanel, clipSeconds, describeLanes } from "./animations-panel.js";
|
|
59
|
+
export { ParamsPanel, BindingsPanel, MotionToggle, usePoseSweep, DeformPanel, } from "./posing-panel.js";
|
|
60
|
+
export { useWorkspaceActions, useCanvasSelection, useSelectionVertices, } from "./workspace.js";
|
|
61
|
+
export { PropertiesPanel, AssetsPanel, TextureThumbnail, } from "./properties-panel.js";
|
|
62
|
+
export { usePanelSize, useDismissMenus, usePreviewExport, captureCanvas, } from "./workspace-layout.js";
|
|
63
|
+
export { SelectionOverlay } from "./gizmo.js";
|
|
64
|
+
export { EditingProvider, useEditing } from "./editing.js";
|
|
65
|
+
export type { Editing, EditingMode } from "./editing.js";
|
|
66
|
+
export { MeshCanvas, MeshTools, MeshInspector, meshBounds, } from "./mesh-editor.js";
|
|
67
|
+
export { WorkspaceModes, EditingBar, RecordingInspector, RecordingKeys, } from "./recording-panel.js";
|
|
68
|
+
export { ReviewProvider, ReviewPanel, ReviewStatus, ReviewBadge, ReviewCommentButton, AgentPrompt, useReview, sameTarget, targetLabel, } from "./review.js";
|
|
69
|
+
export type { AgentPhase, ReviewPanelProps, ReviewProviderProps, ReviewState, Reviewer, TargetLabel, } from "./review.js";
|
|
70
|
+
export { useVersions, useVersionView, VersionSelect, VersionBanner, versionName, relativeTime, } from "./versions.js";
|
|
71
|
+
export type { VersionsState, VersionView, VersionSelectProps, VersionBannerProps, } from "./versions.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks over a `Session`, and unstyled parts over the
|
|
3
|
+
* hooks. Parts ship no class names or stylesheets; state is in `data-*`.
|
|
4
|
+
*/
|
|
5
|
+
export { EditorProvider, useEditor, useGpuTier } from "./editor-context.js";
|
|
6
|
+
export { useNodeInfo, useParams, useReplica, useRevision, useTree, } from "./replica.js";
|
|
7
|
+
export { useLayerImport } from "./layer-import.js";
|
|
8
|
+
export { useSessions } from "./sessions.js";
|
|
9
|
+
export { SelectionProvider, useSelection } from "./selection.js";
|
|
10
|
+
export { Viewport, ViewportRoot, useViewportCamera } from "./viewport.js";
|
|
11
|
+
export { DEFAULT_CAMERA, fitCamera, panTo, screenAt, wheelNotches, worldAt, worldPerPixel, zoomAbout, } from "./camera.js";
|
|
12
|
+
export { useNodeDrag } from "./node-drag.js";
|
|
13
|
+
export { ParamKeys, ParamKeysRoot, ParamSlider, ParamSliderRoot, useHeldByMotion, useMotionPaused, useMotionRunning, } from "./param-slider.js";
|
|
14
|
+
export { ParamAdd, ParamAddRoot, ParamFields, ParamFieldsRoot, ParamList, ParamListRoot, } from "./param-list.js";
|
|
15
|
+
export { useNodeActions } from "./node-actions.js";
|
|
16
|
+
export { NODE_KINDS, NodeTree, NodeTreeActions, NodeTreeItem, NodeTreeRoot, } from "./node-tree.js";
|
|
17
|
+
export { SessionList, SessionListRoot } from "./session-list.js";
|
|
18
|
+
export { FileOpen, FileOpenRoot } from "./file-open.js";
|
|
19
|
+
export { BINDING_TARGETS, INTERPOLATE_MODES, bindingsOfParam, keyIndexNear, normalizedValue, useBindings, valueAtKey, } from "./bindings.js";
|
|
20
|
+
export { useParamActions } from "./param-actions.js";
|
|
21
|
+
export { BindingGrid, BindingGridRoot } from "./binding-grid.js";
|
|
22
|
+
export { useNodePatch } from "./node-patch.js";
|
|
23
|
+
export { BLEND_MODES, Inspector, InspectorRoot } from "./inspector.js";
|
|
24
|
+
export { POSE_INTERVAL_MS, PresenceProvider, usePose } from "./presence.js";
|
|
25
|
+
export { readPose, usePosePublisher, useResetPose } from "./pose.js";
|
|
26
|
+
export { downloadBytes, downloadName, FileSave, FileSaveRoot, saveKey, useFileSave, } from "./file-save.js";
|
|
27
|
+
export { Icon, IconButton, Field, SearchField, NumberField, TextField, Disclosure, EmptyState, Modal, } from "./controls.js";
|
|
28
|
+
export { useCommand, useSessionStatus, useModelQuery, importArtwork, flattenTree, kindLabels, kindIcons, } from "./authoring.js";
|
|
29
|
+
export { MeshPanel, MotionResponsePanel, RiggingEmpty, } from "./rigging.js";
|
|
30
|
+
export { MaskPanel, SlotsPanel, WeldsPanel, ModelHealth, ExtensionsPanel, } from "./model-panels.js";
|
|
31
|
+
export { useOfficialRead, useHumanoid, useExpressions, useClips, useExtensionWarnings, useLiveInputs, usePlayingClip, usePlayhead, ExtensionWarnings, } from "./official.js";
|
|
32
|
+
export { ControlsPanel, CONTROL_GROUPS, groupControls } from "./controls-panel.js";
|
|
33
|
+
export { ExpressionsPanel } from "./expressions-panel.js";
|
|
34
|
+
export { AnimationsPanel, clipSeconds, describeLanes } from "./animations-panel.js";
|
|
35
|
+
export { ParamsPanel, BindingsPanel, MotionToggle, usePoseSweep, DeformPanel, } from "./posing-panel.js";
|
|
36
|
+
export { useWorkspaceActions, useCanvasSelection, useSelectionVertices, } from "./workspace.js";
|
|
37
|
+
export { PropertiesPanel, AssetsPanel, TextureThumbnail, } from "./properties-panel.js";
|
|
38
|
+
export { usePanelSize, useDismissMenus, usePreviewExport, captureCanvas, } from "./workspace-layout.js";
|
|
39
|
+
export { SelectionOverlay } from "./gizmo.js";
|
|
40
|
+
export { EditingProvider, useEditing } from "./editing.js";
|
|
41
|
+
export { MeshCanvas, MeshTools, MeshInspector, meshBounds, } from "./mesh-editor.js";
|
|
42
|
+
export { WorkspaceModes, EditingBar, RecordingInspector, RecordingKeys, } from "./recording-panel.js";
|
|
43
|
+
export { ReviewProvider, ReviewPanel, ReviewStatus, ReviewBadge, ReviewCommentButton, AgentPrompt, useReview, sameTarget, targetLabel, } from "./review.js";
|
|
44
|
+
export { useVersions, useVersionView, VersionSelect, VersionBanner, versionName, relativeTime, } from "./versions.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One node's settable fields, as `node_info` reports them for its kind.
|
|
3
|
+
*
|
|
4
|
+
* A field being typed is local state until it commits, so a revision landing
|
|
5
|
+
* mid-edit does not replace the text under the cursor. An unchanged blur
|
|
6
|
+
* authors nothing, so tabbing through the panel costs no undo entries.
|
|
7
|
+
*/
|
|
8
|
+
import type { BlendMode, Session } from "@catchlight/editor-core";
|
|
9
|
+
import type { ComponentProps } from "react";
|
|
10
|
+
/** Wire spellings, in `BlendMode` declaration order; `node_set` rejects any other name. */
|
|
11
|
+
export declare const BLEND_MODES: readonly BlendMode[];
|
|
12
|
+
export interface InspectorRootProps extends Omit<ComponentProps<"div">, "onError"> {
|
|
13
|
+
session: Session;
|
|
14
|
+
onError?: (cause: unknown) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function InspectorRoot({ session, onError, ...rest }: InspectorRootProps): import("react").JSX.Element;
|
|
17
|
+
export declare const Inspector: {
|
|
18
|
+
Root: typeof InspectorRoot;
|
|
19
|
+
};
|