@vibecook/ice 0.1.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 +21 -0
- package/README.md +76 -0
- package/dist/chunk-5S7GSXJG.js +6003 -0
- package/dist/chunk-5S7GSXJG.js.map +1 -0
- package/dist/chunk-BCJ47SX7.js +550 -0
- package/dist/chunk-BCJ47SX7.js.map +1 -0
- package/dist/chunk-FIAXPNNY.js +1446 -0
- package/dist/chunk-FIAXPNNY.js.map +1 -0
- package/dist/devtools.js +417 -0
- package/dist/devtools.js.map +1 -0
- package/dist/dom.js +41 -0
- package/dist/dom.js.map +1 -0
- package/dist/index.js +450 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel.js +63 -0
- package/dist/kernel.js.map +1 -0
- package/dist/r3f.js +1101 -0
- package/dist/r3f.js.map +1 -0
- package/dist/react.js +440 -0
- package/dist/react.js.map +1 -0
- package/dist/types/packages/core/src/boot/hmr.d.ts +12 -0
- package/dist/types/packages/core/src/catalog/camera-derived.d.ts +144 -0
- package/dist/types/packages/core/src/catalog/gesture.d.ts +254 -0
- package/dist/types/packages/core/src/catalog/graph.d.ts +55 -0
- package/dist/types/packages/core/src/catalog/index.d.ts +32 -0
- package/dist/types/packages/core/src/catalog/pointer.d.ts +111 -0
- package/dist/types/packages/core/src/catalog/scene.d.ts +34 -0
- package/dist/types/packages/core/src/catalog/selection-presence.d.ts +53 -0
- package/dist/types/packages/core/src/catalog/settings-resources.d.ts +46 -0
- package/dist/types/packages/core/src/doc/autosave.d.ts +69 -0
- package/dist/types/packages/core/src/doc/bootstrap.d.ts +74 -0
- package/dist/types/packages/core/src/doc/broadcast-relay.d.ts +52 -0
- package/dist/types/packages/core/src/doc/channels.d.ts +49 -0
- package/dist/types/packages/core/src/doc/doc-commit-sink.d.ts +22 -0
- package/dist/types/packages/core/src/doc/doc-kit.d.ts +50 -0
- package/dist/types/packages/core/src/doc/envelope.d.ts +36 -0
- package/dist/types/packages/core/src/doc/migrate.d.ts +69 -0
- package/dist/types/packages/core/src/doc/version-gate.d.ts +49 -0
- package/dist/types/packages/core/src/engine/commit-sink.d.ts +61 -0
- package/dist/types/packages/core/src/engine/engine.d.ts +62 -0
- package/dist/types/packages/core/src/engine/frame-info.d.ts +16 -0
- package/dist/types/packages/core/src/engine/instantiate.d.ts +45 -0
- package/dist/types/packages/core/src/engine/pipeline.d.ts +17 -0
- package/dist/types/packages/core/src/engine/reflectors.d.ts +56 -0
- package/dist/types/packages/core/src/facade/create-canvas-engine.d.ts +120 -0
- package/dist/types/packages/core/src/guards/dev.d.ts +2 -0
- package/dist/types/packages/core/src/guards/guarded-tx.d.ts +51 -0
- package/dist/types/packages/core/src/guards/live-writer.d.ts +33 -0
- package/dist/types/packages/core/src/guards/resource-writer.d.ts +17 -0
- package/dist/types/packages/core/src/helpers/phase-set.d.ts +70 -0
- package/dist/types/packages/core/src/helpers/version-stamps.d.ts +55 -0
- package/dist/types/packages/core/src/index.d.ts +63 -0
- package/dist/types/packages/core/src/input/measure-queue.d.ts +30 -0
- package/dist/types/packages/core/src/input/queue.d.ts +60 -0
- package/dist/types/packages/core/src/interaction/install.d.ts +58 -0
- package/dist/types/packages/core/src/nav/nested-canvas.d.ts +62 -0
- package/dist/types/packages/core/src/ops/cascade.d.ts +18 -0
- package/dist/types/packages/core/src/ops/claims.d.ts +15 -0
- package/dist/types/packages/core/src/ops/gestures.d.ts +10 -0
- package/dist/types/packages/core/src/ops/point-pick.d.ts +42 -0
- package/dist/types/packages/core/src/ops/port-geometry.d.ts +17 -0
- package/dist/types/packages/core/src/ops/selection.d.ts +14 -0
- package/dist/types/packages/core/src/presence/index.d.ts +7 -0
- package/dist/types/packages/core/src/presence/presence-kit.d.ts +39 -0
- package/dist/types/packages/core/src/presence/publish.d.ts +14 -0
- package/dist/types/packages/core/src/presence/remote-cursors.d.ts +18 -0
- package/dist/types/packages/core/src/schema/meta.d.ts +43 -0
- package/dist/types/packages/core/src/schema/prefab.d.ts +69 -0
- package/dist/types/packages/core/src/settings/defaults.d.ts +56 -0
- package/dist/types/packages/core/src/systems/camera-sim.d.ts +19 -0
- package/dist/types/packages/core/src/systems/chrome.d.ts +48 -0
- package/dist/types/packages/core/src/systems/cleanup.d.ts +19 -0
- package/dist/types/packages/core/src/systems/l0-input.d.ts +31 -0
- package/dist/types/packages/core/src/systems/l1-pick.d.ts +44 -0
- package/dist/types/packages/core/src/systems/l1-wires.d.ts +30 -0
- package/dist/types/packages/core/src/systems/l2-arbitrate.d.ts +40 -0
- package/dist/types/packages/core/src/systems/l2-recognize.d.ts +45 -0
- package/dist/types/packages/core/src/systems/l3-behave.d.ts +24 -0
- package/dist/types/packages/core/src/systems/l3-claim.d.ts +26 -0
- package/dist/types/packages/core/src/systems/l3-connect.d.ts +57 -0
- package/dist/types/packages/core/src/systems/l3-draw.d.ts +21 -0
- package/dist/types/packages/core/src/systems/l3-drop.d.ts +21 -0
- package/dist/types/packages/core/src/systems/l3-marquee.d.ts +35 -0
- package/dist/types/packages/core/src/systems/l3-ports.d.ts +30 -0
- package/dist/types/packages/core/src/systems/l3-resize.d.ts +17 -0
- package/dist/types/packages/core/src/systems/l3-snap.d.ts +19 -0
- package/dist/types/packages/core/src/systems/l4-cursor.d.ts +24 -0
- package/dist/types/packages/core/src/systems/measure-ingest.d.ts +26 -0
- package/dist/types/packages/core/src/tools/define-tool.d.ts +79 -0
- package/dist/types/packages/core/src/widget/define-widget.d.ts +124 -0
- package/dist/types/packages/core/src/widget/equip.d.ts +14 -0
- package/dist/types/packages/core/src/widget/mount-store.d.ts +47 -0
- package/dist/types/packages/core/src/widget/props.d.ts +98 -0
- package/dist/types/packages/core/src/widget/spawn.d.ts +30 -0
- package/dist/types/packages/devtools/src/index.d.ts +8 -0
- package/dist/types/packages/devtools/src/panel.d.ts +48 -0
- package/dist/types/packages/dom/src/host.d.ts +24 -0
- package/dist/types/packages/dom/src/index.d.ts +19 -0
- package/dist/types/packages/dom/src/loop.d.ts +11 -0
- package/dist/types/packages/dom/src/measure-adapter.d.ts +31 -0
- package/dist/types/packages/dom/src/measure-wiring.d.ts +49 -0
- package/dist/types/packages/dom/src/planes.d.ts +33 -0
- package/dist/types/packages/dom/src/pointer-adapter.d.ts +48 -0
- package/dist/types/packages/dom/src/reflectors/chrome.d.ts +33 -0
- package/dist/types/packages/dom/src/reflectors/cursor.d.ts +21 -0
- package/dist/types/packages/dom/src/reflectors/dom-widgets.d.ts +54 -0
- package/dist/types/packages/dom/src/reflectors/graybox.d.ts +31 -0
- package/dist/types/packages/dom/src/reflectors/grid.d.ts +63 -0
- package/dist/types/packages/dom/src/reflectors/plane-transform.d.ts +38 -0
- package/dist/types/packages/dom/src/reflectors/remote-cursors.d.ts +20 -0
- package/dist/types/packages/dom/src/reflectors/wires.d.ts +88 -0
- package/dist/types/packages/ice/src/devtools.d.ts +1 -0
- package/dist/types/packages/ice/src/dom.d.ts +1 -0
- package/dist/types/packages/ice/src/index.d.ts +1 -0
- package/dist/types/packages/ice/src/kernel.d.ts +1 -0
- package/dist/types/packages/ice/src/r3f.d.ts +1 -0
- package/dist/types/packages/ice/src/react.d.ts +1 -0
- package/dist/types/packages/kernel/src/anchors.d.ts +18 -0
- package/dist/types/packages/kernel/src/bezier.d.ts +38 -0
- package/dist/types/packages/kernel/src/coords.d.ts +67 -0
- package/dist/types/packages/kernel/src/eviction.d.ts +23 -0
- package/dist/types/packages/kernel/src/index.d.ts +13 -0
- package/dist/types/packages/kernel/src/shapes.d.ts +22 -0
- package/dist/types/packages/kernel/src/snap.d.ts +44 -0
- package/dist/types/packages/kernel/src/spatial-index.d.ts +16 -0
- package/dist/types/packages/kernel/src/zoom-bands.d.ts +19 -0
- package/dist/types/packages/r3f/src/bridge.d.ts +68 -0
- package/dist/types/packages/r3f/src/composite-material.d.ts +17 -0
- package/dist/types/packages/r3f/src/compositor-pass.d.ts +83 -0
- package/dist/types/packages/r3f/src/dev-write-trap.d.ts +30 -0
- package/dist/types/packages/r3f/src/gl-root.d.ts +21 -0
- package/dist/types/packages/r3f/src/gl-router.d.ts +60 -0
- package/dist/types/packages/r3f/src/index.d.ts +16 -0
- package/dist/types/packages/r3f/src/island-state.d.ts +68 -0
- package/dist/types/packages/r3f/src/island.d.ts +13 -0
- package/dist/types/packages/r3f/src/pool.d.ts +56 -0
- package/dist/types/packages/r3f/src/resource-registry.d.ts +30 -0
- package/dist/types/packages/r3f/src/use-island-frame.d.ts +24 -0
- package/dist/types/packages/react/src/engine-context.d.ts +31 -0
- package/dist/types/packages/react/src/hooks.d.ts +40 -0
- package/dist/types/packages/react/src/index.d.ts +14 -0
- package/dist/types/packages/react/src/infinite-canvas.d.ts +71 -0
- package/dist/types/packages/react/src/keymap.d.ts +42 -0
- package/dist/types/packages/react/src/use-commit.d.ts +35 -0
- package/dist/types/packages/react/src/use-presence.d.ts +23 -0
- package/dist/types/packages/react/src/use-tool.d.ts +4 -0
- package/dist/types/packages/react/src/widget-root.d.ts +33 -0
- package/package.json +112 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ice/react — widget content layer: portals from one root + Tier-3 hooks.
|
|
3
|
+
* Import wall: @ice/dom → @ice/core down only — never three/@react-three
|
|
4
|
+
* (enforced). react/react-dom are peers.
|
|
5
|
+
*/
|
|
6
|
+
export declare const REACT_VERSION = "0.0.0";
|
|
7
|
+
export { WidgetHiddenContext, useBreakpoint, useSelected, useWidgetProps, useWorldComponent, } from "./hooks";
|
|
8
|
+
export { WidgetRoot, type WidgetComponentProps, type WidgetHosts, type WidgetRootProps } from "./widget-root";
|
|
9
|
+
export { EngineProvider, useCanvasEngine, useOps, useWorld, type EngineProviderProps, } from "./engine-context";
|
|
10
|
+
export { useCommit, useUndoStatus, type Commit, type UndoStatus } from "./use-commit";
|
|
11
|
+
export { useTool, useToolState } from "./use-tool";
|
|
12
|
+
export { usePresencePeers, type PresencePeerView } from "./use-presence";
|
|
13
|
+
export { attachKeymap, type KeymapEntry } from "./keymap";
|
|
14
|
+
export { InfiniteCanvas, type InfiniteCanvasHandle, type InfiniteCanvasProps, } from "./infinite-canvas";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<InfiniteCanvas>` — the one-line canvas mount (design-005 §5): planes +
|
|
3
|
+
* adapters + reflectors + portal root, wired in node-board's PROVEN boot order
|
|
4
|
+
* (apps/nodeboard/src/app.tsx). The app supplies a constructed {@link
|
|
5
|
+
* CanvasEngine} (via `createCanvasEngine`); this component owns only the DOM
|
|
6
|
+
* host, the reflector registrations, the pointer/keymap adapters, the rAF loop,
|
|
7
|
+
* and the viewport sync — everything that must live next to a real container.
|
|
8
|
+
*
|
|
9
|
+
* Boot order (registration order = reflector flush order, mirrored exactly):
|
|
10
|
+
* host → planes → reflectors[ planeTransform · grid(P0) · wires(P0) ·
|
|
11
|
+
* domWidgets(P1/P3) · chrome(P4) · cursor · remoteCursors(P5) ] →
|
|
12
|
+
* pointer adapter → measurement (optional) → keymap → rAF loop → viewport RO.
|
|
13
|
+
*
|
|
14
|
+
* The dom-widgets reflector is BOTH a reflector and the host lookup WidgetRoot
|
|
15
|
+
* portals into; it is created before mount and stored in state so WidgetRoot
|
|
16
|
+
* renders once the hosts exist.
|
|
17
|
+
*
|
|
18
|
+
* Lifecycle: this component does NOT own the engine — it never calls
|
|
19
|
+
* `engine.dispose()` (the engine outlives the mount; the app owns it). Unmount
|
|
20
|
+
* detaches every adapter, unregisters every reflector, stops the loop, and
|
|
21
|
+
* disposes the host.
|
|
22
|
+
*
|
|
23
|
+
* Not handled here (by design):
|
|
24
|
+
* - GL / R3F: the `@ice/r3f` wall forbids `@ice/react` importing three, so a
|
|
25
|
+
* GL layer (GLViews) mounts APP-SIDE. Use {@link onReady} to receive the host
|
|
26
|
+
* + planes and mount it yourself (like apps/glboard).
|
|
27
|
+
* - Devtools: the import wall forbids `@ice/react` importing `@ice/devtools`.
|
|
28
|
+
* Wire the panel app-side against `engine.engine` (also via {@link onReady}).
|
|
29
|
+
* - Measurement: auto-sized widgets need a `MeasureQueue` passed to BOTH
|
|
30
|
+
* `createCanvasEngine({ measureQueue })` (ingest side) and this component's
|
|
31
|
+
* `measureQueue` prop (ResizeObserver side). Absent ⇒ measurement is skipped.
|
|
32
|
+
*/
|
|
33
|
+
import { type CanvasEngine, type MeasureQueue } from "@ice/core";
|
|
34
|
+
import { type CanvasHost, type GLRoute, type GridConfig, type Planes } from "@ice/dom";
|
|
35
|
+
import { type CSSProperties, type ReactElement, type ReactNode } from "react";
|
|
36
|
+
/** Handed to {@link InfiniteCanvasProps.onReady} for app-side GL/devtools wiring. */
|
|
37
|
+
export interface InfiniteCanvasHandle {
|
|
38
|
+
readonly engine: CanvasEngine;
|
|
39
|
+
readonly host: CanvasHost;
|
|
40
|
+
readonly planes: Planes;
|
|
41
|
+
}
|
|
42
|
+
export interface InfiniteCanvasProps {
|
|
43
|
+
/** A constructed engine (`createCanvasEngine(...)`); NOT disposed on unmount. */
|
|
44
|
+
readonly engine: CanvasEngine;
|
|
45
|
+
/**
|
|
46
|
+
* The ResizeObserver side of widget measurement. Pass the SAME queue given to
|
|
47
|
+
* `createCanvasEngine({ measureQueue })`. Absent ⇒ measurement skipped.
|
|
48
|
+
*/
|
|
49
|
+
readonly measureQueue?: MeasureQueue;
|
|
50
|
+
/** Called once after the host/reflectors/loop are live (app-side GL/devtools). */
|
|
51
|
+
readonly onReady?: (handle: InfiniteCanvasHandle) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Dot-grid tuning (theme dot color, spacing, fades). Applied live via the
|
|
54
|
+
* grid reflector's `configure` — changing it never re-boots the canvas
|
|
55
|
+
* (memoize in the caller to avoid redundant same-value redraws).
|
|
56
|
+
*/
|
|
57
|
+
readonly grid?: Partial<GridConfig>;
|
|
58
|
+
/**
|
|
59
|
+
* GL pointer routing (event-time island pick — @ice/r3f's
|
|
60
|
+
* createGLPointerRouter). Provide from the FIRST render (a stub delegating
|
|
61
|
+
* to a ref is fine — the real router usually arrives in onReady); the prop
|
|
62
|
+
* is read through a ref, so later identity changes take effect without
|
|
63
|
+
* re-attaching the adapter.
|
|
64
|
+
*/
|
|
65
|
+
readonly glRoute?: GLRoute;
|
|
66
|
+
readonly className?: string;
|
|
67
|
+
readonly style?: CSSProperties;
|
|
68
|
+
/** Overlays inside the viewport (toolbars, HUD) — rendered under the EngineProvider. */
|
|
69
|
+
readonly children?: ReactNode;
|
|
70
|
+
}
|
|
71
|
+
export declare function InfiniteCanvas({ engine, measureQueue, onReady, grid: gridConfig, glRoute, className, style, children, }: InfiniteCanvasProps): ReactElement;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default keymap (design-005 §4 "Keymap"; design-003 §2 — NO system-side
|
|
3
|
+
* keyboard logic, every entry resolves to an `ops.*`/`docs.*` call).
|
|
4
|
+
*
|
|
5
|
+
* Locked defaults:
|
|
6
|
+
* ⌫/Delete → ops.deleteSelection
|
|
7
|
+
* ⌘Z / Ctrl-Z → docs.undo
|
|
8
|
+
* ⇧⌘Z / ⇧Ctrl-Z → docs.redo
|
|
9
|
+
* ⌘D → ops.duplicateSelection
|
|
10
|
+
* ⌘A → ops.selectAll
|
|
11
|
+
* Esc → ops.cancelActiveGestures
|
|
12
|
+
* Arrows → nudge the selection ±1px (⇧ = ±10px) — ONE tx per press
|
|
13
|
+
* tool shortcuts → ops.setTool (v/h/c + any registered tool's shortcut)
|
|
14
|
+
*
|
|
15
|
+
* Space-hold pan is ALREADY owned by the pointer adapter (design-003 §2) — it is
|
|
16
|
+
* NOT rebound here. A keystroke is IGNORED when the event target is editable
|
|
17
|
+
* (input/textarea/select/contenteditable) so typing into widget fields never
|
|
18
|
+
* triggers a shortcut. `mod` = ⌘ on macOS, Ctrl elsewhere (metaKey || ctrlKey).
|
|
19
|
+
*
|
|
20
|
+
* Overrides replace a default by its key-signature `key|mod|shift`; a signature
|
|
21
|
+
* with no default is added. A matched entry `preventDefault()`s (the target was
|
|
22
|
+
* already filtered to non-editable, so no typing is swallowed).
|
|
23
|
+
*/
|
|
24
|
+
import { type CanvasEngine } from "@ice/core";
|
|
25
|
+
export interface KeymapEntry {
|
|
26
|
+
/** `event.key` to match (case-insensitive; e.g. "z", "Backspace", "ArrowUp"). */
|
|
27
|
+
readonly key: string;
|
|
28
|
+
/** Require ⌘/Ctrl (default false → must NOT be held). */
|
|
29
|
+
readonly mod?: boolean;
|
|
30
|
+
/** Require ⇧ (default false → must NOT be held). */
|
|
31
|
+
readonly shift?: boolean;
|
|
32
|
+
/** Resolve to an engine write path — no keyboard logic beyond dispatch. */
|
|
33
|
+
run(engine: CanvasEngine): void;
|
|
34
|
+
}
|
|
35
|
+
type KeyTarget = Pick<Window, "addEventListener" | "removeEventListener">;
|
|
36
|
+
/**
|
|
37
|
+
* Attach the default keymap (plus `overrides`) to `target` (default: `window`).
|
|
38
|
+
* Returns a detach function. No-op (returns a no-op detach) when there is no
|
|
39
|
+
* target — e.g. a headless environment with no `window`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function attachKeymap(engine: CanvasEngine, target?: KeyTarget, overrides?: readonly KeymapEntry[]): () => void;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useCommit` + `useUndoStatus` — the sanctioned widget durable-write path and
|
|
3
|
+
* the undo/redo status subscription (design-005 §2 M6 field amendment,
|
|
4
|
+
* 2026-07-10: "widgets also need a SANCTIONED commit path").
|
|
5
|
+
*
|
|
6
|
+
* A widget commits a prop edit through {@link useCommit}: it resolves the
|
|
7
|
+
* CURRENT doc session (`engine.docs.current()`) and runs a
|
|
8
|
+
* {@link guardedTransaction} against that session's store — one transaction per
|
|
9
|
+
* call, eligibility-guarded, absolute writes only. The session is resolved at
|
|
10
|
+
* CALL time (not hook time) so a widget rendered doc-less that gains a doc later
|
|
11
|
+
* commits correctly without re-mounting.
|
|
12
|
+
*/
|
|
13
|
+
import { type GuardedTx, type GuardedTxOpts } from "@ice/core";
|
|
14
|
+
/** A durable commit: run `fn` against the current doc session's store, one tx. */
|
|
15
|
+
export type Commit = (fn: (tx: GuardedTx) => void, opts?: GuardedTxOpts) => void;
|
|
16
|
+
/**
|
|
17
|
+
* The widget commit seam. The returned function throws with guidance when no
|
|
18
|
+
* document is attached (commits need a durable store — call
|
|
19
|
+
* `engine.docs.create()/open()/join()` first).
|
|
20
|
+
*/
|
|
21
|
+
export declare function useCommit(): Commit;
|
|
22
|
+
export interface UndoStatus {
|
|
23
|
+
readonly canUndo: boolean;
|
|
24
|
+
readonly canRedo: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Undo/redo availability for the current document (drives toolbar
|
|
28
|
+
* disablement) — the design-005 §5 path: the `DurableUndoStatus` RESOURCE
|
|
29
|
+
* (strata plan-undo U2, re-exported through @ice/core) via
|
|
30
|
+
* `observeResource`. A resource subscription is WORLD-level, so it survives
|
|
31
|
+
* document swaps — no remount needed, the earlier onHistoryChange-per-store
|
|
32
|
+
* caveat is gone. Fires at notify(), equality-suppressed; snapshot identity
|
|
33
|
+
* is stable while the flags are unchanged.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useUndoStatus(): UndoStatus;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `usePresencePeers` — the remote-collaborator roster (design-005 §5:
|
|
3
|
+
* "Not(Local) presence query").
|
|
4
|
+
*
|
|
5
|
+
* Queries `PresencePeer` entities that are NOT `Local` (the local peer carries
|
|
6
|
+
* `Local`, auto-applied by the ephemeral store and never transmitted) and pairs
|
|
7
|
+
* each with its `PresenceInfo` (name/color). Wakes on Tier-1 query membership
|
|
8
|
+
* churn (`observeQuery`) — peers joining/leaving. The snapshot is
|
|
9
|
+
* MEMBERSHIP-KEYED: identity stays stable across unrelated re-renders, and info
|
|
10
|
+
* is sampled when membership changes (steady-state presence info is set once at
|
|
11
|
+
* join; a mid-session rename reflects on the next membership change).
|
|
12
|
+
*/
|
|
13
|
+
import { type Entity } from "@ice/core";
|
|
14
|
+
export interface PresencePeerView {
|
|
15
|
+
readonly entity: Entity;
|
|
16
|
+
/** The peer's `PresenceInfo` (strata "string" fields are nullable until set). */
|
|
17
|
+
readonly info: {
|
|
18
|
+
readonly name: string | null;
|
|
19
|
+
readonly color: string | null;
|
|
20
|
+
} | undefined;
|
|
21
|
+
}
|
|
22
|
+
/** Remote presence peers (excludes the local peer); stable identity by membership. */
|
|
23
|
+
export declare function usePresencePeers(): readonly PresencePeerView[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** `[activeToolId, setTool]`. `setTool` routes through `ops.setTool`. */
|
|
2
|
+
export declare function useTool(): [string, (id: string) => void];
|
|
3
|
+
/** Sugar: is tool `id` the active one? (toolbar button pressed-state). */
|
|
4
|
+
export declare function useToolState(id: string): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WidgetRoot — portals from ONE app root (design-004 §2).
|
|
3
|
+
*
|
|
4
|
+
* Portal-list membership (mount/unmount/evict) is owned HERE, by React,
|
|
5
|
+
* subscribed to the engine's mount store via `useSyncExternalStore`; the
|
|
6
|
+
* imperative dom-widgets reflector owns only the host DIVs. Eviction is
|
|
7
|
+
* decided engine-side (LRU derive) and merely consumed. Each mounted entry
|
|
8
|
+
* portals its widget type's component (from the defineWidget registry) into
|
|
9
|
+
* the host's content element; hidden entries stay mounted (React state
|
|
10
|
+
* preserved — cull ≠ unmount) inside a `WidgetHiddenContext` so their prop
|
|
11
|
+
* subscriptions freeze (design-004 §2).
|
|
12
|
+
*
|
|
13
|
+
* A host div may not exist yet on the very first snapshot after mount (the
|
|
14
|
+
* host reflector runs in the same post-notify pass, ordered by reflector
|
|
15
|
+
* registration) — entries without a host render nothing this pass and pick
|
|
16
|
+
* up on the next notification.
|
|
17
|
+
*/
|
|
18
|
+
import { type Entity, type World, type WidgetMountStore } from "@ice/core";
|
|
19
|
+
import { type ReactElement } from "react";
|
|
20
|
+
export interface WidgetHosts {
|
|
21
|
+
/** The dom-widgets reflector's lookup (content element per entity). */
|
|
22
|
+
hostFor(entity: Entity): HTMLElement | undefined;
|
|
23
|
+
}
|
|
24
|
+
export interface WidgetRootProps {
|
|
25
|
+
readonly world: World;
|
|
26
|
+
readonly store: WidgetMountStore;
|
|
27
|
+
readonly hosts: WidgetHosts;
|
|
28
|
+
}
|
|
29
|
+
export interface WidgetComponentProps {
|
|
30
|
+
readonly entity: Entity;
|
|
31
|
+
readonly world: World;
|
|
32
|
+
}
|
|
33
|
+
export declare function WidgetRoot({ world, store, hosts }: WidgetRootProps): ReactElement;
|
package/package.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vibecook/ice",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "ICE — infinite canvas engine. Figma-grade infinite-canvas UX as a framework: defineWidget turns React/R3F components into canvas citizens — selectable, movable, resizable, wired into node graphs, CRDT-synced, undoable per gesture.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "James Yong <me@jamesyong42.com>",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/jamesyong-42/infinite-canvas-engine.git"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://jamesyong-42.github.io/infinite-canvas-engine/",
|
|
13
|
+
"bugs": "https://github.com/jamesyong-42/infinite-canvas-engine/issues",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"infinite-canvas",
|
|
16
|
+
"canvas",
|
|
17
|
+
"whiteboard",
|
|
18
|
+
"node-editor",
|
|
19
|
+
"ecs",
|
|
20
|
+
"crdt",
|
|
21
|
+
"local-first",
|
|
22
|
+
"collaboration",
|
|
23
|
+
"loro",
|
|
24
|
+
"react",
|
|
25
|
+
"r3f",
|
|
26
|
+
"three",
|
|
27
|
+
"gestures"
|
|
28
|
+
],
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"main": "./dist/index.js",
|
|
33
|
+
"types": "./dist/types/packages/ice/src/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/types/packages/ice/src/index.d.ts",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./kernel": {
|
|
40
|
+
"types": "./dist/types/packages/ice/src/kernel.d.ts",
|
|
41
|
+
"default": "./dist/kernel.js"
|
|
42
|
+
},
|
|
43
|
+
"./dom": {
|
|
44
|
+
"types": "./dist/types/packages/ice/src/dom.d.ts",
|
|
45
|
+
"default": "./dist/dom.js"
|
|
46
|
+
},
|
|
47
|
+
"./react": {
|
|
48
|
+
"types": "./dist/types/packages/ice/src/react.d.ts",
|
|
49
|
+
"default": "./dist/react.js"
|
|
50
|
+
},
|
|
51
|
+
"./r3f": {
|
|
52
|
+
"types": "./dist/types/packages/ice/src/r3f.d.ts",
|
|
53
|
+
"default": "./dist/r3f.js"
|
|
54
|
+
},
|
|
55
|
+
"./devtools": {
|
|
56
|
+
"types": "./dist/types/packages/ice/src/devtools.d.ts",
|
|
57
|
+
"default": "./dist/devtools.js"
|
|
58
|
+
},
|
|
59
|
+
"./package.json": "./package.json"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=20"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@vibecook/strata-ecs": "0.5.0",
|
|
69
|
+
"loro-crdt": "^1.13.6",
|
|
70
|
+
"rbush": "^3.0.1"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"@react-three/fiber": ">=9",
|
|
74
|
+
"react": ">=18",
|
|
75
|
+
"react-dom": ">=18",
|
|
76
|
+
"three": ">=0.160.0"
|
|
77
|
+
},
|
|
78
|
+
"peerDependenciesMeta": {
|
|
79
|
+
"@react-three/fiber": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"react": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"react-dom": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"three": {
|
|
89
|
+
"optional": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"devDependencies": {
|
|
93
|
+
"@react-three/fiber": "^9",
|
|
94
|
+
"@types/rbush": "^3.0.3",
|
|
95
|
+
"@types/react": "^19",
|
|
96
|
+
"@types/react-dom": "^19",
|
|
97
|
+
"@types/three": "^0.185.0",
|
|
98
|
+
"react": "^19",
|
|
99
|
+
"react-dom": "^19",
|
|
100
|
+
"three": "^0.185.0",
|
|
101
|
+
"@ice/core": "0.0.0",
|
|
102
|
+
"@ice/dom": "0.0.0",
|
|
103
|
+
"@ice/kernel": "0.0.0",
|
|
104
|
+
"@ice/r3f": "0.0.0",
|
|
105
|
+
"@ice/devtools": "0.0.0",
|
|
106
|
+
"@ice/react": "0.0.0"
|
|
107
|
+
},
|
|
108
|
+
"scripts": {
|
|
109
|
+
"typecheck": "tsc --noEmit",
|
|
110
|
+
"build": "tsup && tsc -p tsconfig.dts.json"
|
|
111
|
+
}
|
|
112
|
+
}
|