Repository navigation
feat(sdk): add sticky note node and placement tool action (#1232) - #1233
Conversation
Contribution License Agreement - Valid 🟢All commits contain valid signoff. As a confirmation, remember that you are agreeing to our Contribution License Agreement. |
2ccefc3 to
72e6aec
Compare
|
Thanks for the contribution, @jmcaamanog. The visual primitive looks good, and the tool follows the rectangle-tool lifecycle well. Checks are green on my side too: the SDK suite passes, and eslint, prettier, 1. Use the shape-label engine for the text (main request) Rectangle/ellipse/polygon don't render text themselves. They share the shape-label engine (#1226). The sticky note currently has
Doing this now avoids a breaking prop rename later ( 2. Live resize There is no 3. Tool
4. Smaller points
5. Tests Nothing currently covers 6. Housekeeping
Happy to help with any of this, and the rectangle implementation is the reference to copy. |
…h#1232) - Add WeaveStickyNoteNode with 3D dog-ear folded corner and pastel palette - Integrate shape-label engine (InditexTech#1226) for inline editing and label* props - Implement live resize with scaleReset and onUpdate to avoid distortions - Add WeaveStickyNoteToolAction with click-to-place and drag-to-size - Export node, action, and computeStickyNoteLabelMinSize in index.common.ts - Expand unit test suites to 41 automated tests (100% passing) - Update code/CHANGELOG.md under [Unreleased] referencing InditexTech#1232 - Rebase cleanly on origin/main (5.7.1) and ensure REUSE 3.3 compliance Signed-off-by: jmcaamanog <jose.caamano@live.com>
72e6aec to
f691868
Compare
|
Hi @jesusmpc, thanks a lot for the detailed review and guidance! We have fully refactored the sticky note implementation following the
|
Default sticky note text to top-left aligned Inter 16px with 16px padding instead of the generic centered Arial 14px shape-label defaults, using the existing DEFAULT_STICKY_NOTE_* constants. Export STICKY_NOTE_LABEL_DEFAULTS, STICKY_NOTE_AUTHOR_MARGIN and DEFAULT_STICKY_NOTE_PADDING and reuse them in computeStickyNoteLabelMinSize so the minimum size matches the layout. Refs InditexTech#1232 Signed-off-by: Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>
|
Hi @jmcaamanog, while testing this PR end to end in the showcase (frontend/backend), we found a few things about the default look, so we pushed a small commit to the branch (04daf01, maintainer edits). Thanks again for the work here, and please shout if you would rather handle any of it differently. What we changed
Backwards compatibility. Padding and label props are stored per note, so notes created with the previous defaults keep their look. Only newly created notes get the new defaults. Still open from the earlier review (not touched in this commit): the We are testing this in InditexTech/weavejs-frontend#226 and InditexTech/weavejs-backend#164 (sticky note tool with color swatches and padding controls). We will report anything else we find there. |
With labelVerticalAlign 'middle' the text box only excluded the dog-ear fold and author row at the bottom, so the text sat above the visual center of the sheet. Reserve the same space on top for middle alignment so the text is centered on the sheet while still never reaching the fold. Top and bottom alignment are unchanged. The grow callbacks and computeStickyNoteLabelMinSize use the same reserve. Refs InditexTech#1232 Signed-off-by: Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>
|
Follow-up commit 01f2116 (pushed to the branch with maintainer edits): with |
…InditexTech#1232) - Extract resolveNoteBounds helper to deduplicate handleMovement/handleSettingSize - Remove unused DEFAULT_STICKY_NOTE_TEXT constant from sticky-note/constants.ts - Type WeaveStickyNoteProperties.transform with WeaveNodeTransformerProperties - Test custom config.transform propagation through getTransformerProperties() - Add main & SDK API docs pages and nav entries for sticky-note node & tool Signed-off-by: jmcaamanog <jose.caamano@live.com>
|
Hi @jesusmpc, thanks a lot for integrating and testing this end-to-end in We rebased our follow-up commit on top of
Verification (run locally after all edits):
|
Middle vertical alignment now centers the text within the padding only, ignoring the dog-ear fold and author row, so it is visually centered on the sheet. Top and bottom alignment keep the text clear of the fold and author. Refs InditexTech#1232 Signed-off-by: Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>
Refs InditexTech#1232 Signed-off-by: Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>
Refs InditexTech#1232 Signed-off-by: Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>
|
Thanks @jmcaamanog for pushing 6c9792b while we were working on the same review points, it overlapped with some of our changes, so we rebased on top of it and kept your versions (shared tool bounds, types, docs pages). What we pushed on top (c6217be):
Review points status: the transformer edit trigger turned out to be a non-issue (rectangle, ellipse and polygon only use |
Middle vertical alignment only reserves the author row below the text, so the text is centered in the visible free space (and on the sheet when there is no author). The dog-ear fold is a corner triangle that left-aligned text rarely reaches, so it is not reserved. Top and bottom alignment still keep the text clear of the fold and the author row. Refs InditexTech#1232 Signed-off-by: Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>
|
Follow-up (863eed2): after trying the variants in the showcase, |
A filled, stroked and shadowed shape is drawn through an intermediate buffer canvas by Konva. On the skia server backend this left the sheet blank (white, no shadow) in server exports of larger notes, while the text and fold still rendered. Disable perfectDrawEnabled and shadowForStrokeEnabled on the sheet: the shadow of the 1px stroke is imperceptible and it also avoids extra offscreen canvases on large boards. Refs InditexTech#1232 Signed-off-by: Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>
|
Found while testing server-side export (backend renders rooms with the skia canvas backend): larger sticky notes exported with a blank sheet (white, no color, no shadow) while the text, author and fold still rendered. Cause: the main sheet is filled + stroked + shadowed, which makes Konva draw it through an intermediate buffer canvas, and on the skia backend that left the sheet empty (a 200x214 note rendered fine, a 322x436 one did not; disabling the shadow or the stroke fixed it). Fixed in b95ad0b by setting Side note for server rendering: apps that render rooms on the server need |
Signed-off-by: Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>
Description
Resolves #1232.
Following the architectural guidance from @jesusmpc in InditexTech/weavejs-frontend#200, this PR implements the Sticky Note canvas primitive and its interactive placement tool action directly within the core
@inditextech/weave-sdk.Changes Included
WeaveStickyNoteNode(code/packages/sdk/src/nodes/sticky-note/):#FEF08A), Mint (#A7F3D0), Rose (#FECDD3), Lavender (#DDD6FE), Sky (#BAE6FD), Amber (#FDE68A), Coral (#FFEDD5), and White (#F9FAFB).@AUTHOR).defaultState,addNodeState,updateNodeState) and schema validation with Zod (getSchema).WeaveStickyNoteToolAction(code/packages/sdk/src/actions/sticky-note-tool/):measureContainer.Public API Exports:
WeaveStickyNoteNodeandWeaveStickyNoteToolAction(along with constants and types) incode/packages/sdk/src/index.common.ts.Compliance: