Repository navigation
refactor(sticker): the sticker tool is the third feature module, with a canvas overlay, a sidebar view and a layer source - #259
Merged
Conversation
… a canvas overlay, a sidebar view and a layer source
PR 3 of docs/feature-modules-plan.md (§8). Zero behaviour change: the
rail, the Stickers view, the Text tool's sticker picker, the agent's
show_in_app and the IPC table all do what they did.
Moved (git mv): electron/ipc/stickers.js → features/sticker/electron/
(the helper path now comes from host.nativeBin), and StickerPanel,
StickerRegionOverlay, StickerView, useStickerViewKeys and the region hook
(now useStickerTool, the tool's whole state) → features/sticker/renderer/.
The old state/useStickerTool.js is gone: the decoded-image cache it
composed is the editor core's, so EditorOverlay calls
useStickerImageCache(layers) itself.
New manifest fields and the tables that read them (features/index.js):
- helper: "extract-sticker" — capabilities.js's hand-written table is
down to depth and people;
- editorTool.overlay — editorToolFeatures rows carry an Overlay, and
EditorOverlay mounts the active tool's one with { imageRect, tool };
- sidebarView — Sidebar.jsx lists sidebarViews (activeView / onOpenView
props replace stickerMode / onOpenStickerBrowser), App.jsx hosts the
active one's View and Inspector and takes the Lightbox items and the
keys from the feature's useView; show_in_app's enum is built from the
manifests;
- layerSource — TextPanel shows a button per layerSources row and
StickerPickerModal lists the chosen source's images.
Hooks stay explicit imports (the decision §8 left open), with two small
tables (featureTools, featureViewStates) feeding the table-driven parts.
i18n, the Library settings' sticker-folder row and the Swift source stay
where they are. features/sticker/electron/stickers.test.js covers the
moved handlers; the IPC, capability and tool-schema guards pass as
before.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
PR 3 of docs/feature-modules-plan.md §8, after #257 (LUT) and #258 (AI Repaint). From
main, zero behaviour change.Moved (
git mv)electron/ipc/stickers.js→features/sticker/electron/stickers.js. The helper path comes fromhost.nativeBinnow instead of anisPackagedbranch of its own. Newstickers.test.js(5 tests): channels match the manifest; save → list → star → delete round trip with thumbnails; thumbnail backfill;detect's three refusals; scratch cleanup only removes the feature's own folders.StickerPanel.jsx,StickerRegionOverlay.jsx,StickerView.jsx,hooks/useStickerViewKeys.js→features/sticker/renderer/.state/useStickerRegion.jsmoved and becameuseStickerTool.js(the tool's whole state). The oldstate/useStickerTool.jsis deleted: it only composed the region withuseStickerImageCache, and the image cache is the editor core's (layers carry stickers whether or not this module is present), soEditorOverlaycallsuseStickerImageCache(layers)directly.New manifest fields, and who reads them
helper: "extract-sticker"electron/features.js→ capability off when the binary is missing;capabilities.js's hand-written table is down todepth/peopleeditorTool.overlay: truefeatures/index.jsaddsOverlayto theeditorToolFeaturesrow;EditorOverlayrenders the active tool's overlay with{ imageRect, tool }(featureTools = { lut, sticker }keyed by rail key)sidebarView: { id: "stickers", labelKey, unavailable: "locked" }sidebarViewstable;Sidebar.jsxmaps it (propsactiveView/onOpenView(id)replacestickerMode/onOpenStickerBrowser);App.jsxhosts<View>/<Inspector>and takes the Lightbox items, index and keyboard handler from the feature'suseView;show_in_app'sviewenum is built from the manifests (same 5 values)layerSource: { id: "stickers", labelKey, hideLabelKey }layerSourcestable;TextPanelrenders one picker button per row,StickerPickerModaltakes asourceand usessource.list()/source.thumbUrl()Decisions §8 left open
featureToolsandfeatureViewStateshand the results to the table-driven parts. AuseFeatureToolswith an eslint exception can wait for the manifest freeze.<Suspense>like LUT's.mount: "always"stays hand-written.editorStateModeluntouched: the region never enters history.Not moved
native/extract-sticker.swift(build scripts know the path); i18n (stickerViewnamespace,sidebar.stickers,sticker.*— after the three PRs, per §11); the Library settings' "sticker library" open-folder row (a cache-storage row backed by the host'sappSettings.jskind table, shown on Windows too); the web bridge'sstickerList: async () => [].IPC_METHODSis still 183 rows.Verified
npm run lintclean;test:electron295 (was 290);test:renderer432;npm run build(StickerPanel is its own chunk).02-navigation,03-editor,04-sticker,08-mcp-http,19-editor-layers,24-handwriting,31-ui-regressions,43-sticker-library: 44 passed.npm run e2eis running; result in the thread.e2e:coverage,npm run pack.Docs: plan status line, §8 as-built record and timetable;
docs/README.mdrows;apps/desktop/features/README.mdlayout and reader list.🤖 Generated with Claude Code