feat: add multi-page support to design documents#24
Open
I-am-abdulazeez wants to merge 16 commits into
Open
Conversation
…to v3, use type predicates for objectSupportsFill and objectSupportsOutlineStroke avnac-scene.ts
…ad use-scene-document-lifecycle.ts
…ly use-editor-layer-controls.ts
…ai-design-controller.ts
…vnac-scene-render.ts
…lbar editor-selection-toolbar.tsx
…elper scene-editor.tsx
…and page management in editor-pages-panel.tsx
…ge-1 closure on page 2+
|
@I-am-abdulazeez is attempting to deploy a commit to the Akinkunmi Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds multi-page support to Avnac design documents. Previously, each document had a single flat canvas. This PR introduces a
pagesarray to the document model, a new page management UI, and wires the entire editor to operate on whichever page is currently active.A short demo of the feature in action:
20260429-1432-40.6833573.mp4
Changes
Data model (
avnac-scene.ts,avnac-document.ts)AvnacPagetype — each page holds its ownartboard,bg, andobjectsAVNAC_DOC_VERSIONfrom2→3AvnacDocumentnow holdspages: AvnacPage[]instead of flatartboard/bg/objectscreateEmptyAvnacPageandcloneAvnacPagehelpersmigrateV2Documentso any existing saved file is automatically upgraded — no data lossparseAvnacDocumentandgetAvnacDocumentStorageKindto handle v3, v2, and legacy formatsEditor state (
editor-store.tsx,use-scene-document-lifecycle.ts)activePageId: stringandsetActivePageIdto the Zustand storeactivePageIdfrompages[0]on document loadEditor wiring (
scene-editor.tsx,canvas-stage.tsx,editor-selection-toolbar.tsx)activePagefromdoc.pages+activePageIdthroughout the editorupdateActivePagehelper — all mutations toartboard,bg, andobjectsnow go through the active page onlyLayer controls (
use-editor-layer-controls.ts)AI design controller (
use-ai-design-controller.ts)AvnacPageinstead ofAvnacDocument, since it only ever operates on the current pageRender & preview (
avnac-scene-render.ts,avnac-document-preview.ts)preloadFontsForDocument,renderAvnacDocumentToCanvas, andrenderAvnacDocumentToDataUrlaccept eitherAvnacDocumentorAvnacPagevia a discriminated unionpages[0]Persistence (
avnac-editor-idb.ts)idbListDocumentsreadsartboardWidth/artboardHeightfrompages[0]for the file gridPages panel UI (
editor-pages-panel.tsx— new file)Route tree (
routeTree.gen.ts)Testing
+button — panel scrolls, fade appears, left arrow appearsSummary by cubic
Add multi-page support to design documents with a new v3 model (
pages[]) and a Pages panel. The editor, export, and preview now target the active page.New Features
AvnacPage;AvnacDocumentnow haspages: AvnacPage[]with helperscreateEmptyAvnacPageandcloneAvnacPage.activePageIdin store, mutations only update the active page; layers and selection toolbar read page artboard/bg.pages[0]); font preload and render acceptAvnacDocument | AvnacPage.pages[0]and guards invalid storage kind on writes.Migration
AVNAC_DOC_VERSIONfrom 2 to 3; v2 and legacy files auto-migrate on open with no data loss.use-ai-design-controllernow takesAvnacPage;preloadFontsForDocumentandrender*acceptAvnacDocument | AvnacPage.Written for commit d08e67e. Summary will update on new commits. Review in cubic