Consolidate core-v2 modules and move scene logic onto classes

- Merge the small modules into 12 files: shared, choreography,
  navigation, scene/{types,graph,scene}, gesture/{definition,recognizer}.
- SceneGraph now owns the begin/update/commit/cancel history rules as
  methods, with the step helpers as private methods.
- createOriginScene returns a markRaw'd Scene class; operation handles
  are an OperationHandle class instead of inline object literals.
- GestureRecognizer gains static create()/policyFor() factories, absorbing
  the separate policy module.
- Pure helpers used by classes (matchesStart, pointOf, stepSpring,
  composeNodeStyle, nodeEffectLayers, shouldCommit, ...) are exported
  consts so they can be tested directly.
- Add haptics tests showing where navigator.vibrate can be triggered.

Public exports, types, and behavior are unchanged; the differential
suites against main still pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Faarh2Ts6StJPcz2mRiHiR
This commit is contained in:
Claude
2026-10-16 02:49:56 +00:00
parent 329271691c
commit 511e58c198
35 changed files with 2177 additions and 1989 deletions
+15 -15
View File
@@ -294,23 +294,23 @@ component ancestry.
## Source layout
The package is layered; each layer depends only on the ones above it.
Each module depends only on the ones listed above it.
| Directory | Responsibility |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| `shared/` | Geometry and environment helpers |
| `view/` | `originView()` component recipes |
| `choreography/` | Effect types, `defineOriginChoreography()`, presets, and `composeEffects()` style compositing |
| `actions/` | `forward()`, `back()`, `replace()`, `above()`, `under()`, `originAction()` |
| `scene/` | `graph.ts` storage, `transitions.ts` history rules, `compositor.ts` styles, `spring.ts` settling motion |
| `composables/` | `useOrigin()` and the node-scope injection key |
| `gesture/` | Builder, definition→policy normalization, start admission, pointer tracking, and the recognizer |
| `components/` | `OriginScene`, `OriginGesture`, `OriginGestureSurface`, and the internal node host |
| File | Responsibility |
| ----------------------- | ------------------------------------------------------------------------------------------------- |
| `shared.ts` | Geometry and environment helpers |
| `choreography.ts` | Effect types, `defineOriginChoreography()`, presets, and `composeEffects()` style compositing |
| `navigation.ts` | `originView()` recipes and `forward()`, `back()`, `replace()`, `above()`, `under()` actions |
| `scene/types.ts` | Public scene types |
| `scene/graph.ts` | `SceneGraph`: node and edge storage plus the begin/commit/cancel history rules (all synchronous) |
| `scene/scene.ts` | `Scene` and `OperationHandle`: mounting, measuring, settling spring, compositing, and `useOrigin` |
| `gesture/definition.ts` | Gesture types, component props, and the immutable `gesture` builder |
| `gesture/recognizer.ts` | Pointer-down admission, `DirectionalTracker`, `GestureRecognizer`, and `useOriginGesture` |
| `components/` | `OriginScene`, `OriginGesture`, `OriginGestureSurface`, and the internal node host |
`createOriginScene()` wires the scene modules together: the graph holds nodes
and operation edges, transitions rewrite it synchronously when operations
begin, commit, or cancel, and the scene adds the asynchronous parts (waiting
for Vue to mount a target, measuring, and running the settling spring).
Pure helpers used by a class (for example `matchesStart`, `stepSpring`, or
`composeNodeStyle`) are module-level `export const`s that the class calls, so
they can be tested directly without widening the class's interface.
## Current experimental boundaries