mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
Migrates components and engine code from reading signals/engine.ts (cameraAspectRatio, editorState, gridVisibility, previewSrc) to reading the Zustand store. Components migrated to usePageEnigmaStore reads: - AspectRatioMenu (also dropped useSignals + collapsed two duplicated lookup ladders into ICON_BY_RATIO / LABEL_BY_RATIO) - PreviewFrameImage - Letterbox (no longer reactive via signals; reads camAspect from store) - StyleButtons (editorState, previewSrc, setEditorState) - Outliner (cameraAspectRatio) - SidePanelMenu (editorState + setEditorState) - ControlPanelSceneObject (editorState) - PreviewEngineCamera (cameraAspectRatio + editorState) - PageEditor (cameraAspectRatio for getScale; the signal version still flows into PromptBox3D as a prop) Engine code migrated to usePageEnigmaStore.getState(): - editor.ts: snapShotOfCurrentFrame reads cameraAspectRatio + grid; switchPreview / switchEdit set editorState - helper.ts: switchCameraView writes editorState - video_generation.ts: generateFrame writes previewSrc + editorState - SceneMetadata.ts: cameraAspectRatio for snapshot metadata - scene.ts: subscribes to store gridVisible (not the signal) signals/engine.ts becomes a thin compatibility layer for PromptBox3D's signal-typed props. Its setters dual-write into the store so any PromptBox3D-driven changes (grid toggle, aspect ratio dropdown) keep the store authoritative. editorState / previewSrc / setEditorState removed entirely -- nothing outside the store needs them anymore. Net effect on typecheck: 148 -> 147 errors in PageEnigma. Zero new errors introduced.
Frontend
This is an nx monorepo that can contain multiple apps and shared libraries.
All commands to run these projects are performed from this directory.
Install dependencies
npm install
Editor2d
Run dev server:
nx dev editor2d
artcraft
Run dev server:
nx dev artcraft
call when starting on main or a new branch:
./clean_modules
The names for @frontend and @storyteller come from the package.json file in the libs folder.
import { Login } from "@frontend/login";
import { api } from "@storyteller/api";
For shared UI components, import from @storyteller/ui-[componentname].
import { Button } from "@storyteller/ui-button";
import { Modal } from "@storyteller/ui-modal";
building:
npx nx build artcraft
npx nx build editor2d
dev:
npx nx dev artcraft
npx nx dev editor2d
# component build
1.
npx nx g @nx/react:library libs/components/toaster --import-path=@storyteller/ui-toaster --bundler=vite
npm install
2.import it first in code
3.nx sync
4.nx build
or
# frontend build
in frontend folder
% nx build -project type
% nx build artcraft
% nx dev artcraft