@catchlight/editor-web 0.5.0 → 0.7.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.
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /** A close moves the screen to a live session before an effect frees the old replica. */
3
3
  import { opensLayers, opensModel } from "@catchlight/editor-core";
4
4
  import { AnimationsPanel, AssetsPanel, EditingProvider, useEditing, WorkspaceModes, EditingBar, MeshTools, MeshInspector, RecordingInspector, RecordingKeys, meshBounds, fitCamera, BindingsPanel, ControlsPanel, Disclosure, EditorProvider, EmptyState, ExpressionsPanel, ExtensionsPanel, FileOpen, FileSave, Icon, IconButton, Modal, ModelHealth, NodeTree, MotionToggle, ParamsPanel, PresenceProvider, PropertiesPanel, ReviewPanel, ReviewProvider, ReviewStatus, useReview, SearchField, SessionList, WeldsPanel, downloadName, kindIcons, kindLabels, useEditor, useFileSave, useLayerImport, useParams, usePosePublisher, usePlayingClip, usePoseSweep, useSelection, useSessions, useViewportCamera, useWorkspaceActions, usePanelSize, useDismissMenus, usePreviewExport, captureCanvas, useVersions, useVersionView, VersionBanner, VersionSelect, } from "../lib/index.js";
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Icon, Modal, useEditor } from "../lib/index.js";
3
3
  import { useEffect, useId, useRef, useState } from "react";
4
4
  const STEPS = [
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /** Follows the active native dialog into the top layer so a failure stays visible. */
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { createPortal } from "react-dom";
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Viewport, MeshCanvas, useEditing, SelectionOverlay, useCanvasSelection, useEditor, useSelection, } from "../lib/index.js";
2
+ import { Viewport, MeshCanvas, useEditing, SelectionOverlay, useCanvasSelection, useEditor, useGpuTier, useSelection, } from "../lib/index.js";
3
3
  import { useCallback, useEffect, useState } from "react";
4
4
  export function Stage({ session, view, meshView, tool, grid, canvas, onError, }) {
5
5
  const edit = useEditing();
@@ -18,7 +18,6 @@ export function Stage({ session, view, meshView, tool, grid, canvas, onError, })
18
18
  }
19
19
  export function Environment() {
20
20
  const editor = useEditor();
21
- const [tier, setTier] = useState(editor.gpuTier());
22
- useEffect(() => editor.onGpuChanged(() => setTier(editor.gpuTier())), [editor]);
21
+ const tier = useGpuTier();
23
22
  return (_jsxs("span", { "data-catchlight-environment": "", children: [_jsx("i", {}), _jsx("span", { "data-catchlight-backend": "", title: "Where edits are applied", children: editor.backendKind() }), _jsx("span", { children: "\u00B7" }), _jsx("span", { "data-catchlight-tier": "", title: "Graphics backend", children: tier ?? "Starting graphics…" })] }));
24
23
  }
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from "react";
3
3
  import { EmptyState, IconButton, NumberField, round } from "./controls.js";
4
4
  import { ExtensionWarnings, HUMANOID, NonstandardDialog, UnreadNotice, WarningMark, useExtensionWarnings, useHumanoid, useOfficialCommand, useLiveInputs, warningsOn, } from "./official.js";
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /** Unstyled editor controls. Invalid numeric text never becomes a command. */
3
+ // The native copies of these icons are crates/catchlight-ui/icons/*.svg; change both.
3
4
  import { useEffect, useId, useRef, useState } from "react";
4
5
  const paths = {
5
6
  select: "m5 3 14 10-7 1-3 7Z",
@@ -48,8 +48,8 @@ declare function useEditingController(session: Session | undefined, onError: Err
48
48
  mesh: MeshDraftView | undefined;
49
49
  meshSelection: number[];
50
50
  setMeshSelection: import("react").Dispatch<import("react").SetStateAction<number[]>>;
51
- meshTool: "add" | "move" | "connect";
52
- setMeshTool: import("react").Dispatch<import("react").SetStateAction<"add" | "move" | "connect">>;
51
+ meshTool: "add" | "connect" | "move";
52
+ setMeshTool: import("react").Dispatch<import("react").SetStateAction<"add" | "connect" | "move">>;
53
53
  meshError: string | undefined;
54
54
  stale: boolean;
55
55
  meshAction: (action: (d: MeshDraft) => void) => void;
@@ -104,8 +104,8 @@ export declare function useEditing(): {
104
104
  mesh: MeshDraftView | undefined;
105
105
  meshSelection: number[];
106
106
  setMeshSelection: import("react").Dispatch<import("react").SetStateAction<number[]>>;
107
- meshTool: "add" | "move" | "connect";
108
- setMeshTool: import("react").Dispatch<import("react").SetStateAction<"add" | "move" | "connect">>;
107
+ meshTool: "add" | "connect" | "move";
108
+ setMeshTool: import("react").Dispatch<import("react").SetStateAction<"add" | "connect" | "move">>;
109
109
  meshError: string | undefined;
110
110
  stale: boolean;
111
111
  meshAction: (action: (d: MeshDraft) => void) => void;
@@ -7,3 +7,9 @@ export interface EditorProviderProps {
7
7
  export declare function EditorProvider({ editor, children }: EditorProviderProps): ReactNode;
8
8
  /** Throws without an `EditorProvider`. */
9
9
  export declare function useEditor(): Editor;
10
+ /**
11
+ * `"webgpu"` or `"webgl2"` once the first viewport has a device, for display.
12
+ * The device can arrive before this subscribes: WebGL2 resolves within a
13
+ * microtask of the first attach.
14
+ */
15
+ export declare function useGpuTier(): string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from "react";
2
+ import { createContext, useCallback, useContext, useSyncExternalStore } from "react";
3
3
  const EditorContext = createContext(undefined);
4
4
  export function EditorProvider({ editor, children }) {
5
5
  return _jsx(EditorContext.Provider, { value: editor, children: children });
@@ -11,3 +11,13 @@ export function useEditor() {
11
11
  throw new Error("no <EditorProvider>: every catchlight hook needs an Editor");
12
12
  return editor;
13
13
  }
14
+ /**
15
+ * `"webgpu"` or `"webgl2"` once the first viewport has a device, for display.
16
+ * The device can arrive before this subscribes: WebGL2 resolves within a
17
+ * microtask of the first attach.
18
+ */
19
+ export function useGpuTier() {
20
+ const editor = useEditor();
21
+ const subscribe = useCallback((changed) => editor.onGpuChanged(changed), [editor]);
22
+ return useSyncExternalStore(subscribe, () => editor.gpuTier());
23
+ }
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Fragment, useRef, useState } from "react";
3
3
  import { Icon, IconButton, Modal, NumberField, round } from "./controls.js";
4
4
  import { EXPRESSIONS, ExtensionWarnings, HelpMark, NonstandardDialog, UnreadNotice, WarningMark, plural, useExpressions, useExtensionWarnings, useHumanoid, useOfficialCommand, useLiveInputs, warningsOn, } from "./official.js";
package/dist/lib/gizmo.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { screenAt, worldAt } from "./camera.js";
4
4
  import { useNodeInfo } from "./replica.js";
@@ -2,7 +2,7 @@
2
2
  * Hooks over a `Session`, and unstyled parts over the
3
3
  * hooks. Parts ship no class names or stylesheets; state is in `data-*`.
4
4
  */
5
- export { EditorProvider, useEditor } from "./editor-context.js";
5
+ export { EditorProvider, useEditor, useGpuTier } from "./editor-context.js";
6
6
  export type { EditorProviderProps } from "./editor-context.js";
7
7
  export { useNodeInfo, useParams, useReplica, useRevision, useTree, } from "./replica.js";
8
8
  export { useLayerImport } from "./layer-import.js";
package/dist/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Hooks over a `Session`, and unstyled parts over the
3
3
  * hooks. Parts ship no class names or stylesheets; state is in `data-*`.
4
4
  */
5
- export { EditorProvider, useEditor } from "./editor-context.js";
5
+ export { EditorProvider, useEditor, useGpuTier } from "./editor-context.js";
6
6
  export { useNodeInfo, useParams, useReplica, useRevision, useTree, } from "./replica.js";
7
7
  export { useLayerImport } from "./layer-import.js";
8
8
  export { useSessions } from "./sessions.js";
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useState } from "react";
3
3
  import { useNodePatch } from "./node-patch.js";
4
4
  import { useNodeInfo, useReplica } from "./replica.js";
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  import { useEditing } from "./editing.js";
4
4
  import { fitCamera, panTo, screenAt, worldAt, zoomAbout, wheelNotches, ZOOM_PER_NOTCH, } from "./camera.js";
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ReviewBadge, ReviewCommentButton } from "./review.js";
3
3
  import { useState } from "react";
4
4
  import { useCommand, useModelQuery, useSessionStatus, flattenTree, } from "./authoring.js";
@@ -1,4 +1,4 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /**
3
3
  * Reads, live inputs and edits shared by the panels over the official
4
4
  * extensions: humanoid controls, expressions and visemes, and animations.
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ReviewCommentButton } from "./review.js";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { useSelection } from "./selection.js";
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  /** A shelf displays at most 256 combined cells; larger unions keep continuous
3
3
  * pose controls and step each axis without expanding their product. */
4
4
  import { useRef } from "react";
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore, } from "react";
3
3
  import { kindIcons } from "./authoring.js";
4
4
  import { useLatest } from "./latest.js";
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { Disclosure, EmptyState, Field, Icon, NumberField, } from "./controls.js";
4
4
  import { flattenTree, useCommand } from "./authoring.js";
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
3
3
  import { Icon } from "./controls.js";
4
4
  import { useEditor } from "./editor-context.js";
@@ -7,8 +7,8 @@ export declare function useWorkspaceActions(session: Session | undefined, onErro
7
7
  canDuplicate: boolean;
8
8
  canUndo: boolean;
9
9
  canRedo: boolean;
10
- undo: () => false | void | 0 | Promise<void>;
11
- redo: () => false | void | 0 | Promise<void>;
10
+ undo: () => void | 0 | false | Promise<void>;
11
+ redo: () => void | 0 | false | Promise<void>;
12
12
  remove: () => "" | Promise<void> | undefined;
13
13
  duplicate: () => "" | Promise<void> | undefined;
14
14
  add: (kind: NodeKind) => Promise<void> | undefined;
package/dist/theme.css CHANGED
@@ -1,5 +1,8 @@
1
1
  /* Catchlight's default theme. Hosts override tokens or compose the unstyled
2
2
  * React parts; every rule stays inside this layer and the .catchlight root. */
3
+ /* The native apps' palette in crates/catchlight-ui/src/theme.rs must match
4
+ * the colours, radii, gutter, font sizes and control and row heights here.
5
+ * Nothing generates either file; change both together. */
3
6
  @layer catchlight {
4
7
  .catchlight {
5
8
  /* The blues are the gradient stops in assets/logo.svg. */
@@ -32,6 +35,7 @@
32
35
  --cl-border: #20262d;
33
36
  --cl-border-strong: #333d48;
34
37
  --cl-divider: #1e242b;
38
+ --cl-row-hover: #ffffff05;
35
39
  --cl-text: #e7ebef;
36
40
  --cl-text-secondary: #b3bcc6;
37
41
  --cl-text-dim: #8491a0;
@@ -46,6 +50,8 @@
46
50
  --cl-shadow: 0 16px 64px #0008, 0 1px 4px #0006;
47
51
  --cl-island-shadow: 0 6px 18px #0006, 0 1px 2px #0006;
48
52
  --cl-control-height: 28px;
53
+ /* The dock's denser rows. */
54
+ --cl-control-height-compact: 24px;
49
55
  --cl-row-height: 28px;
50
56
  --cl-label-width: 70px;
51
57
  --cl-panel-width: 248px;
@@ -749,7 +755,7 @@
749
755
  border: 1px solid transparent;
750
756
  }
751
757
  .catchlight [data-catchlight-node-row]:hover {
752
- background: #ffffff05;
758
+ background: var(--cl-row-hover);
753
759
  }
754
760
  .catchlight
755
761
  [data-catchlight-node][data-selected]
@@ -1094,7 +1100,7 @@
1094
1100
  border: 1px solid transparent;
1095
1101
  }
1096
1102
  .catchlight [data-catchlight-param-card]:hover {
1097
- background: #ffffff05;
1103
+ background: var(--cl-row-hover);
1098
1104
  }
1099
1105
  .catchlight [data-catchlight-param-card][data-selected] {
1100
1106
  background: var(--cl-accent-soft);
@@ -1638,7 +1644,6 @@
1638
1644
  border-radius: 6px;
1639
1645
  overflow-wrap: anywhere;
1640
1646
  border: 0;
1641
- border-left: 3px solid var(--cl-warn);
1642
1647
  background: color-mix(in srgb, var(--cl-warn) 10%, var(--cl-mantle));
1643
1648
  padding: 8px 10px;
1644
1649
  }
@@ -2712,7 +2717,6 @@
2712
2717
  }
2713
2718
  .catchlight [data-recording] > [data-catchlight-record-target] {
2714
2719
  background: var(--cl-record-soft);
2715
- box-shadow: inset 3px 0 var(--cl-record);
2716
2720
  }
2717
2721
  .catchlight [data-catchlight-record-target] > small {
2718
2722
  display: block;
@@ -3845,7 +3849,7 @@
3845
3849
  border: 1px solid transparent;
3846
3850
  }
3847
3851
  .catchlight [data-catchlight-control-card]:hover {
3848
- background: #ffffff05;
3852
+ background: var(--cl-row-hover);
3849
3853
  }
3850
3854
  .catchlight [data-catchlight-control-card][data-live] {
3851
3855
  background: var(--cl-accent-soft);
@@ -3945,7 +3949,7 @@
3945
3949
  border-radius: 6px;
3946
3950
  }
3947
3951
  .catchlight [data-catchlight-body-mark]:hover {
3948
- background: #ffffff05;
3952
+ background: var(--cl-row-hover);
3949
3953
  }
3950
3954
  .catchlight [data-catchlight-body-mark-name] {
3951
3955
  flex: 0 0 76px;
@@ -4077,7 +4081,7 @@
4077
4081
  border: 1px solid transparent;
4078
4082
  }
4079
4083
  .catchlight [data-catchlight-expression-row]:hover {
4080
- background: #ffffff05;
4084
+ background: var(--cl-row-hover);
4081
4085
  }
4082
4086
  .catchlight [data-catchlight-expression-row][data-live] {
4083
4087
  background: var(--cl-accent-soft);
@@ -4230,7 +4234,7 @@
4230
4234
  border: 1px solid transparent;
4231
4235
  }
4232
4236
  .catchlight [data-catchlight-clip]:hover {
4233
- background: #ffffff05;
4237
+ background: var(--cl-row-hover);
4234
4238
  }
4235
4239
  .catchlight [data-catchlight-clip][data-playing] {
4236
4240
  background: var(--cl-accent-soft);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@catchlight/editor-web",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  "./theme.css": "./dist/theme.css"
14
14
  },
15
15
  "peerDependencies": {
16
- "@catchlight/editor-core": "^0.5.0",
17
- "@catchlight/player": "^0.5.0",
16
+ "@catchlight/editor-core": "^0.7.0",
17
+ "@catchlight/player": "^0.7.0",
18
18
  "react": "^19",
19
19
  "react-dom": "^19"
20
20
  },