Repository navigation
feat(view3d): state holder for the PuzlWerk main view (A4) - #83
Conversation
The CUBE group (Scramble, Random State, Undo, Reset) and the move history move from the existing presentation into cubeToolbarSections.tsx with unchanged markup, so the PuzlWerk main view can show the same parts. Component tests render them without a DOM. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Pure functions hold the cube, move list and color frame for the main view on the PuzlWerk viewer: a finished turn, undo, reset, a shown cube (random state), scramble turns and the app turn of a played gesture. The test checks the held cube against the wire state read back through the bridge player for sizes 2 to 15. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…k view usePuzlwerkTurns records the turns the viewer plays (gesture, undo, scramble steps), reports each state to the app like useCubeTurns and runs scramble, random state, undo and reset. The main play plays one app turn through the bridge player. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The toolbar of the flag view shows FACES, CUBE (Scramble, Random State, Undo, Reset) and the "Moves: ..." history like the existing view. The view starts at the state the app holds, resets to the source cube and reports every state change through onTurnStateChange. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Gesture turn, scramble, stop, undo, reset and random state (2 to 15) on the flag view. The stage after playing equals the stage made again from the held state (screenshot comparison); the 2D net's verdict checks validity. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A whole-cube turn must carry the frame; the wire oracle gets a timeout that holds on a loaded machine. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A scramble that did not stop adds about a move every half second at 5x5; waiting three seconds makes the check fail for it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Review: FINDINGS head=dcdf98e1716694a2451b37ff6798999d1e7f898d patch-id=e7a0b45629e97a9fd3d1e02d8087a0c64cb710f5 pr=83 |
A scramble step or undo that finished after Reset, Random State, a new source or size, or unmount was still recorded on the new state and reported. A generation counter, bumped by each of those, is checked after the player's turn; a turn of an older generation is dropped. Tests drive the hook with a controllable player (stand-in for preact hooks in test/support), cover the player's app turn for the cube size, and an e2e probe resets a running scramble twelve times (the old code left a move in four). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Review: FINDINGS head=1f27dee9bbca19282959c57ab9658be0819ad678 patch-id=035d3e2ce53f90d89d26f313124707f83e6b1954 pr=83 |
The generation counter rose for a new source of the same size only in an effect, which preact runs after the paint; a scramble step ending in between was recorded and reported on the new source. The counter now rises in the render that brings a new source (compared by identity), and the view asks for the same when it makes another player for a new palette or seam setting. The hook test harness can defer effects like preact; tests cover the gap between render and effect, the view's request, and a dispose during a running turn. An e2e probe clicks "Solved cube" during a 5x5 scramble. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Review: CLEAR head=f3b326ec5fafcf313caaefdfd59febbc84c2cc16 patch-id=a599d47d21e57a2c22619b390546f15170c38971 pr=83 |
Purpose: the main view behind
?viewer=puzlwerkgets the CUBE group, the move list ("Moves: ...") and a state holder (undo, reset, scramble, random state,onTurnStateChange). The default view is unchanged.bounded, default-off early integration per owner decision 2026-11-19; not the M1/M2 approval.
Changes:
cubeToolbarSections.tsx: CUBE group and move history, shared by the existing and the PuzlWerk toolbar (markup unchanged).puzlwerkMainState.ts: pure state (cube, moves, color frame): turn, undo, reset, shown cube, scramble turns, gesture turn from the viewer's play events.usePuzlwerkTurns.ts,puzlwerkPlay.ts: records gesture, undo and scramble turns, reports each state to the app, plays app turns through the bridge player; a turn that ends after Reset, Random State, a new source (counted in the render) or size, a new palette or unmount is dropped (generation counter).puzlwerkToolbar.tsx,puzlwerkCubeView.tsx,cubeDisplayCard.tsx: FACES, CUBE, history, toggles; the view starts at the app state and resets to the source.Tests (worktree, Node 22.23.4, SwiftShader Chromium):
npx vitest run: 2160 passed, 47 failed (known LFS photo files: fixtures, liveFaceAppearance, gridAlignmentRealCrops); new: puzlwerkMainState 58 (held state = wire state read back, sizes 2..15), usePuzlwerkTurns 15 (controllable player, deferred effects), puzlwerkPlay 6, cubeToolbarSections 9, puzlwerkToolbar 5.npm run typecheck,npm run lint,npm run format:check: exit 0.main-view-state.spec.ts: 12 passed (gesture, scramble, stop, undo, reset, random state 2/3/4/7/15; reset/random state x12 and Solved cube x14 during a scramble; the old code left a move in 4 of 12 and 13 of 24). Existing:main-view-bars/flag/hints20 passed;cubeView3D-view+cubeView3D-controls29 passed.npm run build), base -> this: index 392.04 -> 395.09 kB, cubeView3D 47.47 -> 39.66 kB, puzlwerkCubeView 783.91 -> 788.21 kB; new shared chunk TurnFeel.gen 11.94 kB. No viewer code in index or cubeView3D.Not verified: real GPU, owner look; Random State has no spin animation (state swaps at once).
Blocker: none.
Refs #29
Refs wstein/cubistry#21
No session links.
🤖 Generated with Claude Code