sns-boardview v0.0.32
sns-boardview
a "preact" editor component for "shareable-note-stickers"

Overview
While shareable-note-stickers implements the underlying data model for a shareable hierarchical collection of "boards" containing scriptable widgets (called "stickers"), this module provides a preact component that displays one of these boards of stickers and offers all methods to visually select and edit them.
While the data model is principally shareable, you will have to add a "sharing adapter" such as the sns-collabs-adapter to actually provide that feature.
Finally, to get a real application, you'll have to combine both modules and add a proper user interface - similar to NoteStickers.
Because of this modularity, it is not too difficult to use a different sharing framework (such as Y.js or automerge), modify the user interface according to your personal needs or even develop a headless tool that analyzes and/or changes the shared data without user intervention.
Usage
"sns-boardview" is intended for being used as a module within a "host application". In order to use it, simply import the SNS_BoardView class:
import { SNS_BoardView } from '[sns-boardview](https://rozek.github.io/sns-boardview/dist/sns-boardview.modern.js)'Then, as part of your user interface, instantiate the SNS_BoardView like any other preact component:
html`<${SNS_BoardView}
PUX=${...}
Mode=${...} Board=${...} StickerList=${...}
LassoMode="..." selectedStickers=${...}
onSelectionChange=${(selectedStickers:SNS_Sticker[]) => {...}}
onGeometryChange=${(StickerList:SNS_Sticker[],GeometryList:SNS_Geometry[]) => {...}}
SnapToGrid=${...} GridWidth=${...} GridHeight=${...}
/>`Attributes
SNS_BoardView handles the following attributes:
PUX- specifies a previously created ProtoUX instanceClasses- specifies an optional string with additional CSS classes that should be used to style thisSNS_BoardViewBoard- specifies theSNS_Boardthat should be shown (and may benullif there is noSNS_Projector the currentSNS_Projectdoes not yet contain any boards)StickerList- specifies the actual list of stickers that should be shown (usually, its just theBoard.StickerList)Placeholder- specifies a text that is shown whenBoardis not defined (ornull)Mode- ineditmode, all stickers can be principally selected and layouted (unless they arelockedor notvisible). In 'run' mode, only the those stickers can be selected and layouted that supportbuiltinSelectionorbuiltinDraggingSelectionLimit-SNS_BoardViewallows multiple stickers to be selected simultaneously. If you want to limit the number of selected stickers, just provide the limit hereselectedStickers- specifies a callback with the signatureselectedStickers:SNS_Sticker[]that is invoked (with the new list of selected stickers) whenever the list of selected stickers has changedonSelectionChange- specifies a callback with the signatureSticker:SNS_Stickerthat is invoked whenever a sticker was deselectedonStickerSelected- specifies a callback with the signatureSticker:SNS_Stickerthat is invoked whenever a sticker was selectedonStickerDeselected- specifies a callback with the signatureSticker:SNS_Stickerthat is invoked whenever a sticker was deselectedSelectionFrameStyle- specifies CSS settings to style selection frames (default isdotted 2px orangered)SelectionHandleStyle- specifies CSS settings to style selection handles (default isbackground:orangered; border:solid 1px darkgray)LassoMode- when set toenclosethe selection lasso has to fully enclose a sticker in order to select it, when set totouch, the lasso only has to "touch" itonGeometryChange- specifies a callback with the signatureStickerList:SNS_Sticker[], GeometryList:SNS_Geometry[]that is invoked whenever theselectedStickerswhere moved or sized by theSNS_BoardViewSnapToGrid- when set totrue,SNS_BoardViewconstrains the position and size of visually layouted stickers to multiples ofGridWidthin horizontal and multiples ofGridHeightin vertical directionGridWidth- specifies the horizontal distance between adjacent grid points whileSnapToGridistrueGridHeight- specifies the vertical distance between adjacent grid points whileSnapToGridistrue
Methods
Actually, SNS_BoardView offers only one meaningful method:
rerender ()- call this method whenever the specifiedBoard, itsStickerListor any of its contents have changed. preact will then take care that only those HTML elements will be rerendered that need to.
License
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago