@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,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine facade — owner of the outer frame (design-002 §1):
|
|
3
|
+
*
|
|
4
|
+
* step(now):
|
|
5
|
+
* setFrameInfo FrameInfo resource — value write, pre-tick
|
|
6
|
+
* world.sync() durable + presence drains land; projections place
|
|
7
|
+
* world.tick(...) the phase-group pipeline (pipeline.ts)
|
|
8
|
+
* publish hooks POST-TICK, PRE-NOTIFY: presence I/O home — eph
|
|
9
|
+
* structural ops are illegal for the whole tick, this
|
|
10
|
+
* step is theirs; `world.*` is legal here (outside the
|
|
11
|
+
* tick). Hooks throw LOUDLY (unlike reflectors) — a
|
|
12
|
+
* broken publish pre-notify must not be silently
|
|
13
|
+
* half-applied.
|
|
14
|
+
* notify() THE settled point — observers fire once per frame
|
|
15
|
+
* reflect reflector registry flush (post-notify, output-only)
|
|
16
|
+
*
|
|
17
|
+
* The engine is scheduler-free: `step(now)` is the whole surface, and the DOM
|
|
18
|
+
* package owns the rAF loop (core never touches the platform). Telemetry is
|
|
19
|
+
* opt-in — `world.observe` costs a `performance.now()` pair per system when
|
|
20
|
+
* armed, so benches leave it off.
|
|
21
|
+
*/
|
|
22
|
+
import type { World } from "@vibecook/strata-ecs";
|
|
23
|
+
import type { AnySystem } from "./pipeline";
|
|
24
|
+
import { type PhaseGroup } from "./pipeline";
|
|
25
|
+
import { type ReflectorDef } from "./reflectors";
|
|
26
|
+
export type PublishHook = (world: World) => void;
|
|
27
|
+
export interface SystemRunRecord {
|
|
28
|
+
readonly phase: string;
|
|
29
|
+
readonly system: string;
|
|
30
|
+
readonly ran: boolean;
|
|
31
|
+
readonly micros: number;
|
|
32
|
+
}
|
|
33
|
+
/** One frame's run/skip + timing readout (design-002 §4: F1's honest telemetry). */
|
|
34
|
+
export interface FrameTelemetry {
|
|
35
|
+
readonly tick: number;
|
|
36
|
+
readonly totalMicros: number;
|
|
37
|
+
readonly systems: readonly SystemRunRecord[];
|
|
38
|
+
readonly phaseFlushMicros: ReadonlyMap<string, number>;
|
|
39
|
+
readonly reflectorsFlushed: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
export interface EngineOpts {
|
|
42
|
+
/** Reflector fault sink (default: console.error, skip this frame). */
|
|
43
|
+
readonly onReflectorFault?: (name: string, err: unknown) => void;
|
|
44
|
+
}
|
|
45
|
+
export interface Engine {
|
|
46
|
+
readonly world: World;
|
|
47
|
+
/** Register systems into a canonical phase group. Returns a remover. */
|
|
48
|
+
addSystems(group: PhaseGroup, ...systems: readonly AnySystem[]): () => void;
|
|
49
|
+
/** Register a post-notify output reflector (design-002 §5). Returns an unregister. */
|
|
50
|
+
registerReflector(def: ReflectorDef): () => void;
|
|
51
|
+
/** All registered reflector names (devtools; telemetry-independent). */
|
|
52
|
+
reflectorNames(): readonly string[];
|
|
53
|
+
/** Register a publish-step hook (post-tick, pre-notify presence I/O). Returns a remover. */
|
|
54
|
+
onPublish(hook: PublishHook): () => void;
|
|
55
|
+
/** Run one full frame. `now` in ms (rAF timestamp or a test counter). */
|
|
56
|
+
step(now: number): void;
|
|
57
|
+
/** Arm per-system run/skip + µs collection (idempotent; costs timer calls per system). */
|
|
58
|
+
enableTelemetry(): void;
|
|
59
|
+
/** The most recent completed frame's readout (undefined until telemetry armed + one step). */
|
|
60
|
+
lastFrame(): FrameTelemetry | undefined;
|
|
61
|
+
}
|
|
62
|
+
export declare function createEngine(world: World, opts?: EngineOpts): Engine;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { World } from "@vibecook/strata-ecs";
|
|
2
|
+
/** { tick, dt ≤ dtClampMs (ms), now (ms timeline of the caller's clock) }. */
|
|
3
|
+
export declare const FrameInfo: import("@vibecook/strata-ecs").Resource<import("@vibecook/strata-ecs").ValueOf<{
|
|
4
|
+
readonly tick: import("@vibecook/strata-ecs").FieldSpec<"u32", true>;
|
|
5
|
+
readonly dt: import("@vibecook/strata-ecs").FieldSpec<"f32", true>;
|
|
6
|
+
readonly now: import("@vibecook/strata-ecs").FieldSpec<"f64", true>;
|
|
7
|
+
}>, {
|
|
8
|
+
readonly tick: import("@vibecook/strata-ecs").FieldSpec<"u32", true>;
|
|
9
|
+
readonly dt: import("@vibecook/strata-ecs").FieldSpec<"f32", true>;
|
|
10
|
+
readonly now: import("@vibecook/strata-ecs").FieldSpec<"f64", true>;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Advance the frame clock. First frame gets dt 0 (no previous `now` to diff
|
|
14
|
+
* against); negative deltas (clock adjustment) clamp to 0.
|
|
15
|
+
*/
|
|
16
|
+
export declare function setFrameInfo(world: World, now: number): void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prefab instantiation — THE spawn routing (design-001 §2: the class is the
|
|
3
|
+
* spawn path). Durable → tx · runtime → world/ctx · ephemeral → eph.
|
|
4
|
+
* Every spawn stamps `PrefabId` (uniform identity for guards + devtools;
|
|
5
|
+
* for durable prefabs it is the document identity stamp, §2 rule 5).
|
|
6
|
+
*/
|
|
7
|
+
import type { Entity, SystemCtx, Tag, World } from "@vibecook/strata-ecs";
|
|
8
|
+
import type { Mutator } from "@vibecook/strata-ecs/durable";
|
|
9
|
+
import { type ComponentInit, type Prefab } from "../schema/prefab";
|
|
10
|
+
/** Structural shape of the ephemeral store's write surface (components+tags only). */
|
|
11
|
+
export interface EphSpawner {
|
|
12
|
+
spawn(init?: {
|
|
13
|
+
components?: readonly ComponentInit[];
|
|
14
|
+
}): Entity;
|
|
15
|
+
addTag(e: Entity, t: Tag): void;
|
|
16
|
+
}
|
|
17
|
+
export type SpawnTarget = {
|
|
18
|
+
into: "world";
|
|
19
|
+
world: World;
|
|
20
|
+
} | {
|
|
21
|
+
into: "ctx";
|
|
22
|
+
ctx: SystemCtx;
|
|
23
|
+
} | {
|
|
24
|
+
into: "tx";
|
|
25
|
+
tx: Mutator;
|
|
26
|
+
} | {
|
|
27
|
+
into: "eph";
|
|
28
|
+
eph: EphSpawner;
|
|
29
|
+
};
|
|
30
|
+
export interface InstantiateOpts {
|
|
31
|
+
/**
|
|
32
|
+
* DRAFT spawn (design-001 §3, two-phase promote): a durable prefab spawned
|
|
33
|
+
* into the runtime store — its cells are plain session data (not in the doc,
|
|
34
|
+
* live writes free) until `promote` commits a durable twin. Explicit opt-in:
|
|
35
|
+
* without it, durable→world/ctx throws (never a silent downgrade, §6.3).
|
|
36
|
+
*/
|
|
37
|
+
draft?: boolean;
|
|
38
|
+
overrides?: readonly ComponentInit[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Spawn a prefab into the correct store. Wrong-store spawns fail loudly —
|
|
42
|
+
* notably: a durable prefab without an attached doc/tx has NO fallback
|
|
43
|
+
* (design-001 §6.3: never a silent world.spawn downgrade).
|
|
44
|
+
*/
|
|
45
|
+
export declare function instantiate(prefab: Prefab, target: SpawnTarget, opts?: InstantiateOpts | readonly ComponentInit[]): Entity;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Pipeline, System, TickSystem } from "@vibecook/strata-ecs";
|
|
2
|
+
/** Either system form (strata 0.5.0): chunk-bodied or once-per-dispatch tick. */
|
|
3
|
+
export type AnySystem = System | TickSystem;
|
|
4
|
+
/** The eleven strata phases, in run order (design-002 §2 table). */
|
|
5
|
+
export declare const PHASE_GROUPS: readonly ["input", "react", "ctl:spawn", "ctl:recognize", "ctl:arbitrate", "ctl:claim", "ctl:behave", "simulate", "derive", "present", "cleanup"];
|
|
6
|
+
export type PhaseGroup = (typeof PHASE_GROUPS)[number];
|
|
7
|
+
export interface PipelineRegistry {
|
|
8
|
+
/** Append systems to a group (run order = registration order). Returns a remover (HMR). */
|
|
9
|
+
add(group: PhaseGroup, ...systems: readonly AnySystem[]): () => void;
|
|
10
|
+
/**
|
|
11
|
+
* The pipeline value for this frame (design-002 §1: "pipeline is a value,
|
|
12
|
+
* rebuilt per frame"). Cached until the registry changes; empty groups are
|
|
13
|
+
* omitted (an empty phase would flush nothing anyway).
|
|
14
|
+
*/
|
|
15
|
+
assemble(): Pipeline;
|
|
16
|
+
}
|
|
17
|
+
export declare function createPipelineRegistry(): PipelineRegistry;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reflector registry (design-002 §5).
|
|
3
|
+
*
|
|
4
|
+
* Reflectors are the ONLY writers of DOM/GL/R3F, run AFTER `notify()`, and
|
|
5
|
+
* never write ECS (L10). The registry arms strata observers ONCE per reflector
|
|
6
|
+
* at registration; observer fires during `notify()` coalesce into a per-
|
|
7
|
+
* reflector dirty flag; `flushAll()` (called by `engine.step()` post-notify)
|
|
8
|
+
* flushes dirty (or `always`) reflectors in registration order.
|
|
9
|
+
*
|
|
10
|
+
* - **First paint**: every reflector registers dirty, so its first `flushAll`
|
|
11
|
+
* paints unconditionally — `observeResource` has no `immediate` option and a
|
|
12
|
+
* world populated before registration never stamps for it (same seed
|
|
13
|
+
* `observeQuery`'s `immediate` would give, applied uniformly).
|
|
14
|
+
* - **Fault isolation**: a throwing reflector is skipped this frame (its dirty
|
|
15
|
+
* flag clears — a faulty reflector must not re-fire hot on a static scene);
|
|
16
|
+
* system throws, by contrast, propagate loudly out of `world.tick()`.
|
|
17
|
+
* - **Write ban**: strata's emit-flag rejects ECS writes inside observer
|
|
18
|
+
* callbacks, but reflector `flush` runs after the emit window — DEV
|
|
19
|
+
* enforcement of the reflect write-ban is deferred (design-002 §8);
|
|
20
|
+
* the contract still binds.
|
|
21
|
+
* - Arming any observer permanently arms reactivity stamping (+17–28% on
|
|
22
|
+
* write-heavy paths — design-002 §4, budgeted).
|
|
23
|
+
*/
|
|
24
|
+
import type { Component, Query, Resource, World } from "@vibecook/strata-ecs";
|
|
25
|
+
export interface ReflectorQuerySpec {
|
|
26
|
+
readonly q: Query;
|
|
27
|
+
/** Narrow the Tier-1 wake set to these value columns (plus membership). */
|
|
28
|
+
readonly cols?: readonly Component[];
|
|
29
|
+
}
|
|
30
|
+
export interface ReflectorObserve {
|
|
31
|
+
readonly queries?: readonly ReflectorQuerySpec[];
|
|
32
|
+
readonly resources?: readonly Resource<any>[];
|
|
33
|
+
}
|
|
34
|
+
export interface ReflectorDef {
|
|
35
|
+
/** Display name (telemetry, fault reports). */
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly observe?: ReflectorObserve;
|
|
38
|
+
/** Flush every frame regardless of dirt (cheap-overlay style, v1 lesson). */
|
|
39
|
+
readonly always?: boolean;
|
|
40
|
+
/** Batched output writes; NEVER write ECS, never read layout (L10). */
|
|
41
|
+
readonly flush: (world: World) => void;
|
|
42
|
+
}
|
|
43
|
+
export interface ReflectorRegistry {
|
|
44
|
+
/** Arm observers and enroll; returns an unregister (unsubscribes, removes). */
|
|
45
|
+
register(def: ReflectorDef): () => void;
|
|
46
|
+
/** Post-notify: flush dirty/`always` reflectors in registration order. */
|
|
47
|
+
flushAll(): void;
|
|
48
|
+
/** Names flushed on the most recent `flushAll` (telemetry). */
|
|
49
|
+
lastFlushed(): readonly string[];
|
|
50
|
+
/** Every registered reflector, registration order (devtools enumeration —
|
|
51
|
+
* independent of telemetry; a reflector idle since boot still lists). */
|
|
52
|
+
names(): readonly string[];
|
|
53
|
+
}
|
|
54
|
+
export declare function createReflectorRegistry(world: World, opts?: {
|
|
55
|
+
onFault?: (name: string, err: unknown) => void;
|
|
56
|
+
}): ReflectorRegistry;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createCanvasEngine` — THE published construction path (design-005 §4).
|
|
3
|
+
*
|
|
4
|
+
* Construction wires: world + engine + the FULL interaction stack + the
|
|
5
|
+
* widget runtime + nested canvas + settings resources, doc-less. A document
|
|
6
|
+
* attaches later through `engine.docs.*` (doc-attached remains the default
|
|
7
|
+
* POSTURE: `docs.create()` is the first call of every editor app) — the
|
|
8
|
+
* commit seam is a FORWARDING sink whose target swaps per session, so the
|
|
9
|
+
* stack never rebuilds across doc open/close.
|
|
10
|
+
*
|
|
11
|
+
* `ops.*` is the catalog of engine-owned write paths (design-005 §4 table):
|
|
12
|
+
* app handlers call ops between frames (design-002 §3); each op is one
|
|
13
|
+
* transaction / one resource write / one tag sweep. Nothing here adds a
|
|
14
|
+
* write path that didn't already exist — ops BIND existing primitives to
|
|
15
|
+
* the current session.
|
|
16
|
+
*
|
|
17
|
+
* Budgets: `keepMounted` feeds the widget runtime; `fboBytes` is carried
|
|
18
|
+
* for the GL layer (GLViews reads it via the react facade). Port budgets
|
|
19
|
+
* remain reviewed constants (RUNTIME_BUDGETS) in v1 — recorded.
|
|
20
|
+
*/
|
|
21
|
+
import type { Entity, World } from "@vibecook/strata-ecs";
|
|
22
|
+
import { type Engine } from "../engine/engine";
|
|
23
|
+
import { type InteractionStack } from "../interaction/install";
|
|
24
|
+
import { type NestedCanvas } from "../nav/nested-canvas";
|
|
25
|
+
import { type WidgetRuntime } from "../widget/mount-store";
|
|
26
|
+
import { type SpawnWidgetOpts } from "../widget/spawn";
|
|
27
|
+
import { type Tool } from "../tools/define-tool";
|
|
28
|
+
import { type DocSession, type DocSessionOpts, type OpenDocResult } from "../doc/doc-kit";
|
|
29
|
+
import { type JoinDocOpts, type JoinResult } from "../doc/bootstrap";
|
|
30
|
+
import type { ByteChannel } from "../doc/channels";
|
|
31
|
+
import { type Autosave, type AutosaveOpts, type AutosaveStorageWrite } from "../doc/autosave";
|
|
32
|
+
import type { MeasureQueue } from "../input/measure-queue";
|
|
33
|
+
import { GESTURE_DEFAULTS, POINTER_DEFAULTS } from "../settings/defaults";
|
|
34
|
+
export interface CanvasEngineOpts {
|
|
35
|
+
/** Registered widget types (definition happens at defineWidget; this list is validated). */
|
|
36
|
+
readonly widgets?: readonly {
|
|
37
|
+
readonly type: string;
|
|
38
|
+
}[];
|
|
39
|
+
/** Registered tools (definition happens at defineTool; validated). */
|
|
40
|
+
readonly tools?: readonly Tool[];
|
|
41
|
+
readonly budgets?: {
|
|
42
|
+
readonly keepMounted?: number;
|
|
43
|
+
readonly fboBytes?: number;
|
|
44
|
+
};
|
|
45
|
+
readonly settings?: {
|
|
46
|
+
readonly zoom?: {
|
|
47
|
+
readonly min?: number;
|
|
48
|
+
readonly max?: number;
|
|
49
|
+
};
|
|
50
|
+
readonly gestures?: Partial<Record<keyof typeof GESTURE_DEFAULTS, number>>;
|
|
51
|
+
readonly pointers?: Partial<Record<keyof typeof POINTER_DEFAULTS, number>>;
|
|
52
|
+
readonly snap?: {
|
|
53
|
+
readonly enabled?: boolean;
|
|
54
|
+
readonly thresholdPx?: number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly policy?: {
|
|
58
|
+
/** The gate verdict a "migrate"-classified doc downgrades to when migration is off/fails. */
|
|
59
|
+
readonly versionGate?: "reject" | "readOnly" | "migrate";
|
|
60
|
+
};
|
|
61
|
+
/** The dom measure adapter's queue (wireMeasurement provides; optional headless). */
|
|
62
|
+
readonly measureQueue?: MeasureQueue;
|
|
63
|
+
}
|
|
64
|
+
export interface CanvasOps {
|
|
65
|
+
/** cancel active gestures → switch (design-003 §8; the strata-example lesson). */
|
|
66
|
+
setTool(id: string): void;
|
|
67
|
+
spawnWidget(type: string, opts: SpawnWidgetOpts): Entity;
|
|
68
|
+
deleteSelection(): void;
|
|
69
|
+
/** Twin spawns offset +16/+16; the clones become the selection. */
|
|
70
|
+
duplicateSelection(): Entity[];
|
|
71
|
+
setSelection(ids: readonly Entity[], mode?: "replace" | "add" | "toggle"): void;
|
|
72
|
+
clearSelection(): void;
|
|
73
|
+
selectAll(): void;
|
|
74
|
+
/** StackZ sweep, one tx: selection (or ids) to top/bottom. */
|
|
75
|
+
reorder(ids: readonly Entity[], mode: "top" | "bottom"): void;
|
|
76
|
+
zoomToFit(ids?: readonly Entity[]): void;
|
|
77
|
+
zoomTo(zoom: number, anchor?: {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
}): void;
|
|
81
|
+
panTo(x: number, y: number): void;
|
|
82
|
+
enterContainer(container: Entity): void;
|
|
83
|
+
exitContainer(): void;
|
|
84
|
+
cancelActiveGestures(): void;
|
|
85
|
+
}
|
|
86
|
+
export interface CanvasDocs {
|
|
87
|
+
create(opts?: DocSessionOpts): DocSession;
|
|
88
|
+
open(bytes: Uint8Array, opts?: DocSessionOpts): OpenDocResult;
|
|
89
|
+
/** §6.5 bootstrap + optional presence sugar over the same channel. */
|
|
90
|
+
join(channel: ByteChannel, opts?: Omit<JoinDocOpts, "presence"> & {
|
|
91
|
+
readonly presence?: {
|
|
92
|
+
name: string;
|
|
93
|
+
color: string;
|
|
94
|
+
};
|
|
95
|
+
}): Promise<JoinResult>;
|
|
96
|
+
current(): DocSession | undefined;
|
|
97
|
+
close(): void;
|
|
98
|
+
undo(): boolean;
|
|
99
|
+
redo(): boolean;
|
|
100
|
+
autosave(storage: AutosaveStorageWrite, opts?: Omit<AutosaveOpts, "storage" | "world">): Autosave;
|
|
101
|
+
}
|
|
102
|
+
export interface CanvasEngine {
|
|
103
|
+
readonly world: World;
|
|
104
|
+
readonly engine: Engine;
|
|
105
|
+
readonly stack: InteractionStack;
|
|
106
|
+
readonly runtime: WidgetRuntime & {
|
|
107
|
+
uninstall(): void;
|
|
108
|
+
};
|
|
109
|
+
readonly nav: NestedCanvas;
|
|
110
|
+
readonly ops: CanvasOps;
|
|
111
|
+
readonly docs: CanvasDocs;
|
|
112
|
+
readonly budgets: {
|
|
113
|
+
readonly keepMounted: number;
|
|
114
|
+
readonly fboBytes: number;
|
|
115
|
+
};
|
|
116
|
+
/** step(now) passthrough — the app's rAF loop drives this. */
|
|
117
|
+
step(now: number): void;
|
|
118
|
+
dispose(): void;
|
|
119
|
+
}
|
|
120
|
+
export declare function createCanvasEngine(opts?: CanvasEngineOpts): CanvasEngine;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Eligibility-guarded transactions (design-001 §2 rule 3): `tx.*` structural
|
|
3
|
+
* writes are validated against the target entity's prefab — a component
|
|
4
|
+
* outside the eligible set, a relation outside the eligible relations, or a
|
|
5
|
+
* runtime-declared resource in a tx is a DEV error.
|
|
6
|
+
*
|
|
7
|
+
* Prefab resolution: entities spawned in THIS tx via `spawnPrefab` are known
|
|
8
|
+
* from a tx-local map; pre-existing durable entities resolve via their
|
|
9
|
+
* projected `PrefabId`. Entities from raw `tx.spawn` are unknown → checks
|
|
10
|
+
* skip (the guard is best-effort by design; `spawnPrefab` is the paved road).
|
|
11
|
+
* Tags are not eligibility-checked in M2 (essential tags spawn with the
|
|
12
|
+
* prefab; optional-tag modeling is future work — documented).
|
|
13
|
+
*/
|
|
14
|
+
import type { Component, Entity, Relation, Resource, Tag, World } from "@vibecook/strata-ecs";
|
|
15
|
+
import type { Mutator } from "@vibecook/strata-ecs/durable";
|
|
16
|
+
import { type ComponentInit, type Prefab } from "../schema/prefab";
|
|
17
|
+
export interface GuardedTx {
|
|
18
|
+
spawnPrefab(prefab: Prefab, overrides?: readonly ComponentInit[]): Entity;
|
|
19
|
+
/** Raw spawn — entity is unknown to the guard (prefer spawnPrefab). */
|
|
20
|
+
spawn: Mutator["spawn"];
|
|
21
|
+
destroy(e: Entity): void;
|
|
22
|
+
addComponent<S>(e: Entity, c: Component<S>, v: S): void;
|
|
23
|
+
removeComponent(e: Entity, c: Component): void;
|
|
24
|
+
edit(e: Entity): {
|
|
25
|
+
set<S>(c: Component<S>, v: S): GuardedEditor;
|
|
26
|
+
};
|
|
27
|
+
addTag(e: Entity, t: Tag): void;
|
|
28
|
+
removeTag(e: Entity, t: Tag): void;
|
|
29
|
+
setRelation(e: Entity, r: Relation, target: Entity): void;
|
|
30
|
+
addRelation(e: Entity, r: Relation, target: Entity): void;
|
|
31
|
+
removeRelation(e: Entity, r: Relation, target?: Entity): void;
|
|
32
|
+
setResource<S>(res: Resource<S>, v: S): void;
|
|
33
|
+
}
|
|
34
|
+
interface GuardedEditor {
|
|
35
|
+
set<S>(c: Component<S>, v: S): GuardedEditor;
|
|
36
|
+
}
|
|
37
|
+
interface TxDoc {
|
|
38
|
+
transaction(fn: (tx: Mutator) => void, opts?: {
|
|
39
|
+
undoable?: boolean;
|
|
40
|
+
}): void;
|
|
41
|
+
}
|
|
42
|
+
export interface GuardedTxOpts {
|
|
43
|
+
/**
|
|
44
|
+
* strata 0.3.0 passthrough: `false` excludes this commit from the LOCAL
|
|
45
|
+
* undo stack (batch seeds, janitorial writes — retires the cardboard
|
|
46
|
+
* first-⌘Z-removes-a-seed quirk). Default true: one tx = one undo step.
|
|
47
|
+
*/
|
|
48
|
+
readonly undoable?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare function guardedTransaction(doc: TxDoc, world: World, run: (tx: GuardedTx) => void, opts?: GuardedTxOpts): void;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-cell gesture guard (design-001 §2 rule 4 + §3), as the engine's
|
|
3
|
+
* live-write path. strata worlds can't intercept writes, so behaviors write
|
|
4
|
+
* doc-SENSITIVE values through this facade:
|
|
5
|
+
*
|
|
6
|
+
* a world value-write to a cell that exists in the doc for that entity is
|
|
7
|
+
* legal iff the entity is currently allowed to diverge — an Active
|
|
8
|
+
* recognizer Captures/Drags it, or it carries a live TransformTween
|
|
9
|
+
* (fly-back holds the claim; design-003 review M3).
|
|
10
|
+
*
|
|
11
|
+
* "Cell in doc" is approximated conservatively from public API: entity is
|
|
12
|
+
* doc-bound (keyOf defined) AND the component is durable-eligible for its
|
|
13
|
+
* prefab. Eligible-but-uncommitted optionals are guarded too (documented).
|
|
14
|
+
* The divergence predicate is injected — M4 wires claims + tween; tests stub.
|
|
15
|
+
*/
|
|
16
|
+
import type { Component, Entity, World } from "@vibecook/strata-ecs";
|
|
17
|
+
export interface LiveWriterOpts {
|
|
18
|
+
/** `doc.keyOf` when a doc is attached; absent doc = nothing is doc-bound. */
|
|
19
|
+
keyOf: (e: Entity) => unknown;
|
|
20
|
+
/** May this entity's doc cells diverge right now? (claims ∪ tween) */
|
|
21
|
+
mayDiverge: (e: Entity) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Exact "is this cell in the doc?" (e.g. wired to `doc.getComponent`).
|
|
24
|
+
* When absent, the guard falls back to the eligibility approximation —
|
|
25
|
+
* stricter than design-001 §2 rule 4's letter: an eligible-but-uncommitted
|
|
26
|
+
* optional is guarded too (fails safe; matrix finding #2).
|
|
27
|
+
*/
|
|
28
|
+
cellInDoc?: (e: Entity, c: Component) => boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface LiveWriter {
|
|
31
|
+
set<S>(e: Entity, component: Component<S>, value: S): void;
|
|
32
|
+
}
|
|
33
|
+
export declare function createLiveWriter(world: World, opts: LiveWriterOpts): LiveWriter;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The paved-road runtime-resource write (design-001 §2 rule 7) — the mirror
|
|
3
|
+
* image of guarded-tx's `tx.setResource` check. A resource declares its write
|
|
4
|
+
* path once at `defineResource` (`durable` vs `runtime`), and the two ends
|
|
5
|
+
* enforce it symmetrically: `tx.setResource` rejects a RUNTIME resource inside
|
|
6
|
+
* a transaction; `writeRuntimeResource` rejects a DURABLE resource on the
|
|
7
|
+
* runtime world. Systems have no `ctx` resource API, so they write runtime
|
|
8
|
+
* resources through the closed-over `world.setResource` (design-002 §3) — this
|
|
9
|
+
* facade is that write, made DEV-checked.
|
|
10
|
+
*
|
|
11
|
+
* Unknown resources — anything not defined through `../schema/meta`'s
|
|
12
|
+
* `defineResource` wrapper — carry no schemaMeta, so the check finds nothing
|
|
13
|
+
* and the write passes untouched. The guard is best-effort by design, exactly
|
|
14
|
+
* like guarded-tx's prefab-eligibility checks.
|
|
15
|
+
*/
|
|
16
|
+
import type { Resource, World } from "@vibecook/strata-ecs";
|
|
17
|
+
export declare function writeRuntimeResource<S>(world: World, res: Resource<S>, v: S): void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PhaseSet — an exclusive tag-encoded state machine with one-tick transition markers
|
|
3
|
+
* (design-003 §4.2, design-002 §2/§3).
|
|
4
|
+
*
|
|
5
|
+
* A phase set is a small, fixed list of mutually-exclusive phases (e.g. a recognizer's
|
|
6
|
+
* `Possible → Active → Ended`). For each phase it mints two tags via the schema wrapper,
|
|
7
|
+
* named by PLAIN CONCATENATION so the doc vocabulary holds (design-001 §5.5: the catalog's
|
|
8
|
+
* gesture set is definePhaseSet("Gesture", ["Possible", …]) → "GesturePossible"):
|
|
9
|
+
* - a persistent phase tag `${name}${phase}` — "the entity is in this phase"
|
|
10
|
+
* - a one-tick `Just` marker `${name}Just${phase}` — "the entity ENTERED this phase this frame"
|
|
11
|
+
*
|
|
12
|
+
* Why two tags: terminal phases persist through the reap window (design-003 §4.1), so a
|
|
13
|
+
* behavior that acted on the persistent tag would fire on every frame the tag lingers.
|
|
14
|
+
* Behaviors therefore **edge-trigger on the `Just*` markers only** — discrete actions and
|
|
15
|
+
* terminal handling fire exactly once (design-003 §4.2: shift-tap toggles once, commits
|
|
16
|
+
* never double). The persistent tag is for per-frame work that legitimately repeats.
|
|
17
|
+
*
|
|
18
|
+
* Transition timing: `set` mutates through the caller's structural writer. When that writer
|
|
19
|
+
* is a {@link SystemCtx} the add/remove are DEFERRED to the current strata-phase flush
|
|
20
|
+
* (design-002 §3); consumers in a LATER sub-phase see the new phase the same frame, and
|
|
21
|
+
* that ordering is guaranteed by the sub-phase pipeline layout (design-002 §2), never by
|
|
22
|
+
* immediate application. When the writer is the `World` (app handlers / setup) the writes
|
|
23
|
+
* are immediate. The one-tick markers are cleared by the cleanup phase via
|
|
24
|
+
* {@link PhaseSet.clearMarkers} over {@link PhaseSet.allMarkerTags}.
|
|
25
|
+
*/
|
|
26
|
+
import type { Entity, Tag } from "@vibecook/strata-ecs";
|
|
27
|
+
/**
|
|
28
|
+
* The minimal structural-write surface `set`/`clearMarkers` need. Both `SystemCtx` (deferred
|
|
29
|
+
* to the phase flush) and `World` (immediate) satisfy it structurally — the transition is
|
|
30
|
+
* agnostic to which, and the timing follows from the writer (see the module doc).
|
|
31
|
+
*/
|
|
32
|
+
export interface StructuralTagWriter {
|
|
33
|
+
addTag(e: Entity, t: Tag): void;
|
|
34
|
+
removeTag(e: Entity, t: Tag): void;
|
|
35
|
+
}
|
|
36
|
+
/** The minimal read surface `current` needs — again satisfied by both `SystemCtx` and `World`. */
|
|
37
|
+
export interface TagReader {
|
|
38
|
+
hasTag(e: Entity, t: Tag): boolean;
|
|
39
|
+
}
|
|
40
|
+
/** The handle returned by {@link definePhaseSet}. `P` is the literal union of phase names. */
|
|
41
|
+
export interface PhaseSet<P extends string> {
|
|
42
|
+
/** The set name — the prefix of every minted tag. */
|
|
43
|
+
readonly name: string;
|
|
44
|
+
/** The phases in declaration order (the scan order of {@link PhaseSet.current}). */
|
|
45
|
+
readonly phases: readonly P[];
|
|
46
|
+
/** Persistent phase tags, keyed by phase name. */
|
|
47
|
+
readonly tags: Readonly<Record<P, Tag>>;
|
|
48
|
+
/** One-tick `Just<Phase>` marker tags, keyed by phase name. */
|
|
49
|
+
readonly justTags: Readonly<Record<P, Tag>>;
|
|
50
|
+
/** Every marker tag — the cleanup phase clears these once the frame's edges are consumed. */
|
|
51
|
+
readonly allMarkerTags: readonly Tag[];
|
|
52
|
+
/**
|
|
53
|
+
* Transition `e` into `next`: drop the current phase tag + its now-stale marker and add
|
|
54
|
+
* `next` + its fresh `Just` marker (exclusivity is enforced by clearing every phase tag,
|
|
55
|
+
* so a mis-set entity converges). Unknown `next` throws. A transition to the phase the
|
|
56
|
+
* entity is already in is a no-op with a DEV warn (detected only when `m` can also read —
|
|
57
|
+
* `SystemCtx`/`World` both can).
|
|
58
|
+
*/
|
|
59
|
+
set(m: StructuralTagWriter, e: Entity, next: P): void;
|
|
60
|
+
/** The entity's current phase, or `undefined` if it holds none. Small-N `hasTag` scan. */
|
|
61
|
+
current(world: TagReader, e: Entity): P | undefined;
|
|
62
|
+
/** Clear every one-tick marker off `e` (the cleanup-phase step). */
|
|
63
|
+
clearMarkers(m: StructuralTagWriter, e: Entity): void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Define an exclusive PhaseSet: one persistent tag + one one-tick `Just` marker per phase.
|
|
67
|
+
* Handles are process-global schema constants (hold them as module constants). See the module
|
|
68
|
+
* doc for transition timing and the edge-trigger contract.
|
|
69
|
+
*/
|
|
70
|
+
export declare function definePhaseSet<const P extends string>(name: string, phases: readonly P[]): PhaseSet<P>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version-stamp resources + the runIf guard built on them (design-002 §4).
|
|
3
|
+
*
|
|
4
|
+
* These are the same-tick laziness lever: a writing system bumps a version as a plain value
|
|
5
|
+
* write (v1's callback back-channels become world state — Laws 1/4), and a downstream system
|
|
6
|
+
* gates on {@link makeVersionGuard} in its `runIf`. The guard rule (design-002 §4): guards
|
|
7
|
+
* live in `runIf`, never the body — a `runIf`-skipped system runs no body and so blanket-stamps
|
|
8
|
+
* NONE of its declared writes (strata over-fires stampWrites for any system that RUNS, even one
|
|
9
|
+
* that early-outs). Bump/guard therefore form the "writer stamps → reader skips wholesale" pair.
|
|
10
|
+
*
|
|
11
|
+
* Resources are runtime (not durable): they are derived engine state, never persisted.
|
|
12
|
+
*/
|
|
13
|
+
import type { Resource, World } from "@vibecook/strata-ecs";
|
|
14
|
+
/** The shared shape of every version stamp — a wrap-around unsigned tick counter. */
|
|
15
|
+
export interface VersionValue {
|
|
16
|
+
v: number;
|
|
17
|
+
}
|
|
18
|
+
/** A resource carrying a {@link VersionValue}. */
|
|
19
|
+
export type VersionResource = Resource<VersionValue>;
|
|
20
|
+
/** Bumped by `pointerIngest` when the input queue drained anything (design-003 §2). */
|
|
21
|
+
export declare const PointerVersion: Resource<import("@vibecook/strata-ecs").ValueOf<{
|
|
22
|
+
readonly v: "u32";
|
|
23
|
+
}>, {
|
|
24
|
+
readonly v: "u32";
|
|
25
|
+
}>;
|
|
26
|
+
/** Bumped by `setSelection`/selection edits (design-003 §5). */
|
|
27
|
+
export declare const SelectionVersion: Resource<import("@vibecook/strata-ecs").ValueOf<{
|
|
28
|
+
readonly v: "u32";
|
|
29
|
+
}>, {
|
|
30
|
+
readonly v: "u32";
|
|
31
|
+
}>;
|
|
32
|
+
/** Bumped when the spatial index changes (inserts/moves/removes). */
|
|
33
|
+
export declare const SpatialVersion: Resource<import("@vibecook/strata-ecs").ValueOf<{
|
|
34
|
+
readonly v: "u32";
|
|
35
|
+
}>, {
|
|
36
|
+
readonly v: "u32";
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Increment a version stamp as a value write. Unset counts as 0, so the first bump lands 1.
|
|
40
|
+
* Wraps at 2^32 via `>>> 0` — a wrapped counter still compares unequal frame-to-frame, which
|
|
41
|
+
* is all the guard needs. Systems write resources through the closed-over `world.setResource`
|
|
42
|
+
* (there is no `ctx` resource API — design-002 §3).
|
|
43
|
+
*/
|
|
44
|
+
export declare function bumpVersion(world: World, res: VersionResource): void;
|
|
45
|
+
/**
|
|
46
|
+
* A `runIf`-compatible guard. Returns `true` iff any watched version differs from the value it
|
|
47
|
+
* last observed, and records the new values each call. The first invocation always returns
|
|
48
|
+
* `true` (it establishes the baseline — the gated system runs once at startup). A skipped system
|
|
49
|
+
* stamps nothing, so pairing this guard with narrow `access.write` is the whole laziness win.
|
|
50
|
+
*
|
|
51
|
+
* Typed `() => boolean` so callers (and tests) can invoke it directly; it is width-assignable to
|
|
52
|
+
* strata's `Condition` (`(ctx) => boolean`), so it drops straight into `runIf`.
|
|
53
|
+
*/
|
|
54
|
+
export type VersionGuard = () => boolean;
|
|
55
|
+
export declare function makeVersionGuard(world: World, resources: readonly VersionResource[]): VersionGuard;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ice/core — schema+prefabs+sovereignty · phase groups/pipeline · L0–L4 systems ·
|
|
3
|
+
* scene systems · doc kit · publish step · engine facade · reflector registry.
|
|
4
|
+
* Import wall: strata-ecs + @ice/kernel ONLY — never react/dom/three (enforced).
|
|
5
|
+
*/
|
|
6
|
+
export declare const CORE_VERSION = "0.0.0";
|
|
7
|
+
export { defineSchemaOnce, hmrInvalidateOnSchemaChange } from "./boot/hmr";
|
|
8
|
+
export { All, Any, Not, Related, createWorld, defineQuery, defineSystem, defineTickSystem, enumOf, field, Local, } from "@vibecook/strata-ecs";
|
|
9
|
+
export type { Batch, Component, Condition, Entity, Pipeline, Query, Relation, Resource, System, SystemCtx, Tag, TickSystem, World, } from "@vibecook/strata-ecs";
|
|
10
|
+
export { defineComponent, defineRelation, defineResource, defineTag, schemaMeta, type ComponentMeta, type RawSchema, type RelationMeta, type ResourceMeta, } from "./schema/meta";
|
|
11
|
+
export { definePrefab, init, PrefabId, prefabs, type ComponentInit, type FieldWrite, type Prefab, type PrefabClass, type PrefabDef, } from "./schema/prefab";
|
|
12
|
+
export { instantiate, type EphSpawner, type SpawnTarget } from "./engine/instantiate";
|
|
13
|
+
export { FrameInfo, setFrameInfo } from "./engine/frame-info";
|
|
14
|
+
export { createPipelineRegistry, PHASE_GROUPS, type AnySystem, type PhaseGroup, type PipelineRegistry } from "./engine/pipeline";
|
|
15
|
+
export { createReflectorRegistry, type ReflectorDef, type ReflectorObserve, type ReflectorQuerySpec, type ReflectorRegistry, } from "./engine/reflectors";
|
|
16
|
+
export { createEngine, type Engine, type EngineOpts, type FrameTelemetry, type PublishHook, type SystemRunRecord, } from "./engine/engine";
|
|
17
|
+
export { devGuardsEnabled, setDevGuards } from "./guards/dev";
|
|
18
|
+
export { createLiveWriter, type LiveWriter, type LiveWriterOpts } from "./guards/live-writer";
|
|
19
|
+
export { guardedTransaction, type GuardedTx, type GuardedTxOpts } from "./guards/guarded-tx";
|
|
20
|
+
export { writeRuntimeResource } from "./guards/resource-writer";
|
|
21
|
+
export * from "./catalog";
|
|
22
|
+
export * from "./helpers/phase-set";
|
|
23
|
+
export * from "./helpers/version-stamps";
|
|
24
|
+
export * from "./ops/selection";
|
|
25
|
+
export * from "./ops/cascade";
|
|
26
|
+
export * from "./ops/claims";
|
|
27
|
+
export * from "./ops/gestures";
|
|
28
|
+
export * from "./ops/point-pick";
|
|
29
|
+
export { createInputQueue, NO_MODS, type InputEvent, type InputEventKind, type InputMods, type InputQueue } from "./input/queue";
|
|
30
|
+
export { createRecordingCommitSink, type CommitIntent, type CommitCreate, type CommitReparent, type CommitSink, type CommitWrite, } from "./engine/commit-sink";
|
|
31
|
+
export { ensureCanvasSurface, installInteractionCore, installInteractionStack, type InteractionCore, type InteractionCoreOpts, type InteractionStack, } from "./interaction/install";
|
|
32
|
+
export type { MarqueeBuffer } from "./systems/l3-marquee";
|
|
33
|
+
export { DEFAULT_SPAWN_PROFILES, type SingleKindName, type SpawnProfiles } from "./systems/l2-recognize";
|
|
34
|
+
export { createCursorSync } from "./systems/l4-cursor";
|
|
35
|
+
export { createWireSync, type WireSyncSystem } from "./systems/l1-wires";
|
|
36
|
+
export { createPortMaterialize } from "./systems/l3-ports";
|
|
37
|
+
export { createConnectSystems, type ConnectSystems, type WirePreviewBuffer, } from "./systems/l3-connect";
|
|
38
|
+
export { ENGINE_SCHEMA_VERSION, ENVELOPE_MAGIC, ENVELOPE_VERSION, EnvelopeError, decodeEnvelope, encodeEnvelope, type EnvelopeHeader, } from "./doc/envelope";
|
|
39
|
+
export { gateVerdict, readDocVersionReport, stampEngineMeta, type DocVersionReport, type GateVerdict, } from "./doc/version-gate";
|
|
40
|
+
export { createDocCommitSink, createReadOnlyCommitSink } from "./doc/doc-commit-sink";
|
|
41
|
+
export { DurableUndoStatus } from "@vibecook/strata-ecs/durable";
|
|
42
|
+
export type { DurableUndoStatusValue } from "@vibecook/strata-ecs/durable";
|
|
43
|
+
export { createDocSession, openDocSession, type DocSession, type DocSessionOpts, type OpenDocResult, } from "./doc/doc-kit";
|
|
44
|
+
export { runMigrations, type MigrationCtx, type MigrationOutcome } from "./doc/migrate";
|
|
45
|
+
export { p, type JsonShape, type PropSpec, type PropsDecl, type StandardSchemaV1 } from "./widget/props";
|
|
46
|
+
export { WidgetEquipped, defineWidget, widgets, type SizeMode, type WidgetDef, type WidgetGroup, type WidgetInteraction, type WidgetPortDecl, type WidgetSurface, type WidgetType, } from "./widget/define-widget";
|
|
47
|
+
export { createWidgetEquipSystem } from "./widget/equip";
|
|
48
|
+
export { spawnWidget, widgetSpawnInits, type SpawnWidgetOpts } from "./widget/spawn";
|
|
49
|
+
export { createWidgetRuntime, installWidgetRuntime, type MountEntry, type WidgetMountStore, type WidgetRuntime, } from "./widget/mount-store";
|
|
50
|
+
export * from "./settings/defaults";
|
|
51
|
+
export { CameraInertia, createCameraSystems, type CameraSystems } from "./systems/camera-sim";
|
|
52
|
+
export { restoreAutosave, startAutosave, type Autosave, type AutosaveOpts, type AutosaveState, type AutosaveStatus, type AutosaveStorageRead, type AutosaveStorageWrite, type CancelScheduled, type RestoreResult, } from "./doc/autosave";
|
|
53
|
+
export { attachBroadcastRelay, type BroadcastRelay, type BroadcastRelayOpts, type RelayChannel, } from "./doc/broadcast-relay";
|
|
54
|
+
export { createMeasureQueue, type MeasureEvent, type MeasureQueue } from "./input/measure-queue";
|
|
55
|
+
export { createMeasureIngest } from "./systems/measure-ingest";
|
|
56
|
+
export { createBreakpointSystem, createSelectionChromeSystem } from "./systems/chrome";
|
|
57
|
+
export { createNestedCanvas, currentNavEntry, currentNavFrame, type NestedCanvas, type NestedCanvasOpts, } from "./nav/nested-canvas";
|
|
58
|
+
export { attachPresence, createPresencePublish, createRemoteCursorsSystem, DEFAULT_PRESENCE_TTL_MS, installPresence, type InstallPresenceOpts, type PresenceOpts, type PresencePublishOpts, type PresenceSession, } from "./presence";
|
|
59
|
+
export { joinDoc, type BootstrapClock, type JoinDocOpts, type JoinResult, } from "./doc/bootstrap";
|
|
60
|
+
export { broadcastChannelByteChannel, webSocketByteChannel, type ByteChannel, type OwnedByteChannel, type WebSocketLike, } from "./doc/channels";
|
|
61
|
+
export { createDrawTool, defineTool, tools, type CanvasDragRoute, type Tool, type ToolDef, type ToolGates, type ToolRoute, type WidgetDragRoute, } from "./tools/define-tool";
|
|
62
|
+
export { createCanvasEngine, type CanvasDocs, type CanvasEngine, type CanvasEngineOpts, type CanvasOps, } from "./facade/create-canvas-engine";
|
|
63
|
+
export { createDrawBehavior } from "./systems/l3-draw";
|