@widgetic/canvas 0.5.34 → 0.5.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +105 -36
  2. package/dist/canvas/DomCanvas.svelte +454 -0
  3. package/dist/canvas/DomCanvas.svelte.d.ts +222 -0
  4. package/dist/canvas/autosaveScheduler.d.ts +58 -0
  5. package/dist/canvas/autosaveScheduler.js +157 -0
  6. package/dist/canvas/boardFrame.d.ts +13 -0
  7. package/dist/canvas/boardFrame.js +13 -0
  8. package/dist/canvas/boardSurface.d.ts +9 -0
  9. package/dist/canvas/boardSurface.js +9 -0
  10. package/dist/canvas/chromeLayout.d.ts +76 -0
  11. package/dist/canvas/chromeLayout.js +121 -0
  12. package/dist/canvas/emptyBoardHint.d.ts +17 -0
  13. package/dist/canvas/emptyBoardHint.js +12 -0
  14. package/dist/canvas/eventScope.d.ts +1 -1
  15. package/dist/canvas/eventScope.js +1 -1
  16. package/dist/canvas/host/CanvasHost.d.ts +351 -0
  17. package/dist/canvas/host/CanvasHost.js +1740 -0
  18. package/dist/canvas/host/CanvasHostApi.d.ts +30 -0
  19. package/dist/canvas/host/CanvasHostApi.js +95 -0
  20. package/dist/canvas/host/browserServices.d.ts +46 -0
  21. package/dist/canvas/host/browserServices.js +167 -0
  22. package/dist/canvas/host/conversion.d.ts +51 -0
  23. package/dist/canvas/host/conversion.js +123 -0
  24. package/dist/canvas/host/hostObject.d.ts +40 -0
  25. package/dist/canvas/host/hostObject.js +93 -0
  26. package/dist/canvas/host/pageEvents.d.ts +24 -0
  27. package/dist/canvas/host/pageEvents.js +35 -0
  28. package/dist/canvas/host/screenRects.d.ts +66 -0
  29. package/dist/canvas/host/screenRects.js +102 -0
  30. package/dist/canvas/host/strokeSnap.d.ts +67 -0
  31. package/dist/canvas/host/strokeSnap.js +165 -0
  32. package/dist/canvas/index.d.ts +9 -7
  33. package/dist/canvas/index.js +9 -7
  34. package/dist/canvas/openMarks.d.ts +17 -0
  35. package/dist/canvas/openMarks.js +26 -0
  36. package/dist/canvas/panZoomPosition.d.ts +15 -0
  37. package/dist/canvas/panZoomPosition.js +16 -0
  38. package/dist/canvas/preferredTextFont.d.ts +12 -0
  39. package/dist/canvas/preferredTextFont.js +38 -0
  40. package/dist/canvas/shapes/ShapeLibrary.d.ts +1 -1
  41. package/dist/canvas/shapes/ShapeLibrary.js +13 -1
  42. package/dist/canvas/shapes/strokeShapeSnap.d.ts +14 -12
  43. package/dist/canvas/shapes/strokeShapeSnap.js +10 -8
  44. package/dist/canvas/toolbarPosition.d.ts +24 -0
  45. package/dist/canvas/toolbarPosition.js +24 -0
  46. package/dist/canvas/types.d.ts +14 -0
  47. package/dist/canvas/ui/CanvasContextMenu.svelte +173 -0
  48. package/dist/canvas/ui/CanvasContextMenu.svelte.d.ts +12 -0
  49. package/dist/canvas/ui/CanvasHint.svelte +20 -0
  50. package/dist/canvas/ui/CanvasHint.svelte.d.ts +18 -0
  51. package/dist/canvas/ui/CanvasToolbar.svelte +95 -0
  52. package/dist/canvas/ui/CanvasToolbar.svelte.d.ts +14 -0
  53. package/dist/canvas/ui/ColorField.svelte +155 -0
  54. package/dist/canvas/ui/ColorField.svelte.d.ts +14 -0
  55. package/dist/canvas/ui/LoadNotice.svelte +39 -0
  56. package/dist/canvas/ui/LoadNotice.svelte.d.ts +8 -0
  57. package/dist/canvas/ui/SelectionPanel.svelte +300 -0
  58. package/dist/canvas/ui/SelectionPanel.svelte.d.ts +20 -0
  59. package/dist/canvas/ui/SelectorBar.svelte +82 -0
  60. package/dist/canvas/ui/SelectorBar.svelte.d.ts +12 -0
  61. package/dist/canvas/ui/ShapesMenu.svelte +185 -0
  62. package/dist/canvas/ui/ShapesMenu.svelte.d.ts +15 -0
  63. package/dist/canvas/ui/ShortcutsPanel.svelte +124 -0
  64. package/dist/canvas/ui/ShortcutsPanel.svelte.d.ts +7 -0
  65. package/dist/canvas/ui/ToolButton.svelte +78 -0
  66. package/dist/canvas/ui/ToolButton.svelte.d.ts +20 -0
  67. package/dist/canvas/ui/WidgetActions.svelte +152 -0
  68. package/dist/canvas/ui/WidgetActions.svelte.d.ts +19 -0
  69. package/dist/canvas/ui/ZoomControl.svelte +89 -0
  70. package/dist/canvas/ui/ZoomControl.svelte.d.ts +18 -0
  71. package/dist/canvas/ui/colorModel.d.ts +18 -0
  72. package/dist/canvas/ui/colorModel.js +85 -0
  73. package/dist/canvas/ui/colorPickerMessages.d.ts +5 -0
  74. package/dist/canvas/ui/colorPickerMessages.js +15 -0
  75. package/dist/canvas/ui/floatingCard.d.ts +107 -0
  76. package/dist/canvas/ui/floatingCard.js +107 -0
  77. package/dist/canvas/ui/floatingLayer.d.ts +21 -0
  78. package/dist/canvas/ui/floatingLayer.js +52 -0
  79. package/dist/canvas/ui/icons.d.ts +12 -0
  80. package/dist/canvas/ui/icons.js +7 -0
  81. package/dist/canvas/ui/keyHints.d.ts +27 -0
  82. package/dist/canvas/ui/keyHints.js +43 -0
  83. package/dist/canvas/ui/popoverSide.d.ts +5 -0
  84. package/dist/canvas/ui/popoverSide.js +20 -0
  85. package/dist/canvas/ui/selectionTraits.d.ts +61 -0
  86. package/dist/canvas/ui/selectionTraits.js +99 -0
  87. package/dist/canvas/view/CanvasStage.svelte +132 -0
  88. package/dist/canvas/view/CanvasStage.svelte.d.ts +21 -0
  89. package/dist/canvas/view/EraserTrail.svelte +50 -0
  90. package/dist/canvas/view/EraserTrail.svelte.d.ts +9 -0
  91. package/dist/canvas/view/ObjectView.svelte +245 -0
  92. package/dist/canvas/view/ObjectView.svelte.d.ts +21 -0
  93. package/dist/canvas/view/SelectionOverlay.svelte +487 -0
  94. package/dist/canvas/view/SelectionOverlay.svelte.d.ts +17 -0
  95. package/dist/canvas/view/TextEditor.svelte +76 -0
  96. package/dist/canvas/view/TextEditor.svelte.d.ts +9 -0
  97. package/dist/canvas/view/WidgetChromeLayer.svelte +83 -0
  98. package/dist/canvas/view/WidgetChromeLayer.svelte.d.ts +13 -0
  99. package/dist/canvas/view/erasingMarks.d.ts +13 -0
  100. package/dist/canvas/view/erasingMarks.js +34 -0
  101. package/dist/canvas/view/geometry.d.ts +169 -0
  102. package/dist/canvas/view/geometry.js +272 -0
  103. package/dist/components/CanvasBoardPlaceholder.svelte +5 -3
  104. package/dist/components/CanvasBoardPlaceholder.svelte.d.ts +3 -3
  105. package/dist/components/index.js +1 -1
  106. package/dist/components/input-controls/ColorIC.svelte +2 -2
  107. package/dist/engine/EngineCore.d.ts +273 -0
  108. package/dist/engine/EngineCore.js +1051 -0
  109. package/dist/engine/codec/canvasDocument.d.ts +57 -0
  110. package/dist/engine/codec/canvasDocument.js +471 -0
  111. package/dist/engine/codec/hostReadableKeys.d.ts +25 -0
  112. package/dist/engine/codec/hostReadableKeys.js +25 -0
  113. package/dist/engine/core/arrange.d.ts +20 -0
  114. package/dist/engine/core/arrange.js +81 -0
  115. package/dist/engine/core/arrow.d.ts +91 -0
  116. package/dist/engine/core/arrow.js +182 -0
  117. package/dist/engine/core/brush.d.ts +68 -0
  118. package/dist/engine/core/brush.js +173 -0
  119. package/dist/engine/core/defaults.d.ts +70 -0
  120. package/dist/engine/core/defaults.js +158 -0
  121. package/dist/engine/core/freehand.d.ts +130 -0
  122. package/dist/engine/core/freehand.js +430 -0
  123. package/dist/engine/core/geometry.d.ts +44 -0
  124. package/dist/engine/core/geometry.js +216 -0
  125. package/dist/engine/core/history.d.ts +39 -0
  126. package/dist/engine/core/history.js +69 -0
  127. package/dist/engine/core/hitTest.d.ts +54 -0
  128. package/dist/engine/core/hitTest.js +298 -0
  129. package/dist/engine/core/matrix.d.ts +47 -0
  130. package/dist/engine/core/matrix.js +101 -0
  131. package/dist/engine/core/pathData.d.ts +50 -0
  132. package/dist/engine/core/pathData.js +550 -0
  133. package/dist/engine/core/rotationReset.d.ts +10 -0
  134. package/dist/engine/core/rotationReset.js +17 -0
  135. package/dist/engine/core/scene.d.ts +99 -0
  136. package/dist/engine/core/scene.js +450 -0
  137. package/dist/engine/core/scribble.d.ts +64 -0
  138. package/dist/engine/core/scribble.js +121 -0
  139. package/dist/engine/core/shapePaths.d.ts +34 -0
  140. package/dist/engine/core/shapePaths.js +69 -0
  141. package/dist/engine/core/shapeTools.d.ts +80 -0
  142. package/dist/engine/core/shapeTools.js +161 -0
  143. package/dist/engine/core/snapping.d.ts +64 -0
  144. package/dist/engine/core/snapping.js +164 -0
  145. package/dist/engine/core/style.d.ts +40 -0
  146. package/dist/engine/core/style.js +151 -0
  147. package/dist/engine/core/transform.d.ts +79 -0
  148. package/dist/engine/core/transform.js +258 -0
  149. package/dist/engine/core/types.d.ts +238 -0
  150. package/dist/engine/core/types.js +31 -0
  151. package/dist/engine/core/viewport.d.ts +32 -0
  152. package/dist/engine/core/viewport.js +84 -0
  153. package/dist/engine/input/PointerController.d.ts +38 -0
  154. package/dist/engine/input/PointerController.js +545 -0
  155. package/dist/engine/input/arrowHandles.d.ts +38 -0
  156. package/dist/engine/input/arrowHandles.js +60 -0
  157. package/dist/engine/input/gestures.d.ts +79 -0
  158. package/dist/engine/input/gestures.js +769 -0
  159. package/dist/engine/input/hoverCursor.d.ts +29 -0
  160. package/dist/engine/input/hoverCursor.js +23 -0
  161. package/dist/engine/input/keyboard.d.ts +75 -0
  162. package/dist/engine/input/keyboard.js +264 -0
  163. package/dist/engine/input/selectionHandles.d.ts +89 -0
  164. package/dist/engine/input/selectionHandles.js +169 -0
  165. package/dist/engine/input/types.d.ts +82 -0
  166. package/dist/engine/input/types.js +5 -0
  167. package/dist/engine/render/rasterize.d.ts +74 -0
  168. package/dist/engine/render/rasterize.js +273 -0
  169. package/dist/engine/state.d.ts +124 -0
  170. package/dist/engine/state.js +47 -0
  171. package/dist/engine/text/layoutText.d.ts +53 -0
  172. package/dist/engine/text/layoutText.js +170 -0
  173. package/dist/engine/widgets.d.ts +124 -0
  174. package/dist/engine/widgets.js +345 -0
  175. package/dist/i18n/labels.d.ts +4 -15
  176. package/dist/i18n/labels.js +33 -53
  177. package/dist/i18n/language.d.ts +3 -3
  178. package/dist/i18n/messages.d.ts +51 -122
  179. package/dist/i18n/messages.js +58 -131
  180. package/dist/i18n/shortcuts.d.ts +0 -1
  181. package/dist/i18n/shortcuts.js +2 -11
  182. package/dist/index.d.ts +6 -2
  183. package/dist/index.js +6 -2
  184. package/package.json +30 -5
  185. package/dist/canvas/Canvas.svelte +0 -13299
  186. package/dist/canvas/Canvas.svelte.d.ts +0 -281
  187. package/dist/canvas/CanvasToolbar.svelte +0 -1498
  188. package/dist/canvas/CanvasToolbar.svelte.d.ts +0 -69
  189. package/dist/canvas/ContextMenu.svelte +0 -305
  190. package/dist/canvas/ContextMenu.svelte.d.ts +0 -42
  191. package/dist/canvas/PanZoomPanel.svelte +0 -478
  192. package/dist/canvas/PanZoomPanel.svelte.d.ts +0 -38
  193. package/dist/canvas/WidgetSelectionLayer.svelte +0 -156
  194. package/dist/canvas/WidgetSelectionLayer.svelte.d.ts +0 -11
  195. package/dist/canvas/props-panel/PropsPanel.svelte +0 -2075
  196. package/dist/canvas/props-panel/PropsPanel.svelte.d.ts +0 -84
  197. package/dist/canvas/props-panel/TextPropsICSection.svelte +0 -242
  198. package/dist/canvas/props-panel/TextPropsICSection.svelte.d.ts +0 -40
  199. package/dist/canvas/shadowRootText.d.ts +0 -5
  200. package/dist/canvas/shadowRootText.js +0 -43
  201. package/dist/canvas/shapes/FrameShape.d.ts +0 -97
  202. package/dist/canvas/shapes/FrameShape.js +0 -953
  203. package/dist/canvas/shapes/ImageShape.d.ts +0 -47
  204. package/dist/canvas/shapes/ImageShape.js +0 -339
  205. package/dist/canvas/shapes/WidgetShape.d.ts +0 -30
  206. package/dist/canvas/shapes/WidgetShape.js +0 -200
  207. package/dist/canvas/widgetPreviewGeometry.d.ts +0 -19
  208. package/dist/canvas/widgetPreviewGeometry.js +0 -66
  209. package/dist/i18n/shapeWords.d.ts +0 -30
  210. package/dist/i18n/shapeWords.js +0 -36
  211. package/dist/i18n/slots.d.ts +0 -20
  212. package/dist/i18n/slots.js +0 -40
@@ -10,8 +10,7 @@
10
10
  * so a language can be added a screen at a time.
11
11
  *
12
12
  * Words that are NOT here, on purpose:
13
- * - the names of widgets, frames, files and fonts, and what the visitor typed into a text: they are shown as they were
14
- * written;
13
+ * - the names of widgets, files and fonts, and what the visitor typed into a text: they are shown as they were written;
15
14
  * - the English names the canvas keeps for the things it saves ("libraryShape", "Symbol Shapes", a shape's key): they
16
15
  * are data, and a screen says them with the messages below.
17
16
  */
@@ -19,55 +18,47 @@ export const CANVAS_MESSAGES = {
19
18
  // ===== The canvas itself =====
20
19
  'canvas.state.loading': 'Loading canvas…',
21
20
  'canvas.state.initFailed': 'Canvas failed to initialize.',
22
- /** Said in a dialog of the browser when a picture cannot be loaded from the address the visitor typed. */
23
- 'canvas.error.imageFromUrl': 'Failed to load image from URL. Make sure the URL is correct and allows cross-origin requests.',
21
+ /** The name of the drawing surface, for a screen reader. */
22
+ 'canvas.state.boardLabel': 'Canvas board',
23
+ /** Said over a board that could not be opened: it was saved by the earlier canvas, whose format this one does not read. */
24
+ 'canvas.state.unsupported': 'This canvas was made with an older version and cannot be opened. It stays as it is until you add something new.',
25
+ /** Said over a board whose saved text could not be read at all. */
26
+ 'canvas.state.invalid': 'This canvas could not be read. It stays as it is until you add something new.',
27
+ 'canvas.state.dismiss': 'Dismiss',
28
+ // ===== What an empty board says =====
29
+ 'canvas.hint.title': 'Start with a sketch',
24
30
  // ===== What a new thing says before the visitor changes it (saved with the canvas, in the language it was made in) =====
25
31
  /** Gray hint drawn on an empty text shape. It is not stored as the text: a new text box starts empty. */
26
32
  'canvas.defaults.textBox': 'Type here',
27
- /** The name written above a new frame. */
28
- 'canvas.defaults.frameLabel': 'Frame',
29
- /** The name a frame gets when it is made into a widget without one. */
30
- 'canvas.defaults.untitledFrame': 'Untitled Frame',
31
33
  'canvas.defaults.untitledShape': 'Untitled Shape',
32
- // ===== Words drawn onto the canvas itself (on an empty image or video, and on a widget that has no picture yet) =====
33
- 'canvas.draw.dropImage': 'Drop image',
34
- 'canvas.draw.dropVideo': 'Drop video',
35
- /** Between "Drop image" and "double click": "Drop image / or / double click". */
36
- 'canvas.draw.or': 'or',
37
- 'canvas.draw.doubleClick': 'double click',
34
+ // ===== Words drawn onto the canvas itself (on a widget card) =====
38
35
  /** What a widget on the canvas is called until it has a name. */
39
36
  'canvas.draw.widgetName': 'Widget',
40
37
  'canvas.draw.widgetPreview': 'Widget preview',
41
38
  // ===== The names of the tools (also the names of the buttons that choose them) =====
39
+ /** The name of the bar of tools, for a screen reader. */
40
+ 'canvas.toolbar.label': 'Canvas tools',
42
41
  'canvas.tool.select': 'Select',
43
42
  'canvas.tool.hand': 'Hand / Pan',
44
43
  'canvas.tool.erase': 'Erase',
45
44
  'canvas.tool.draw': 'Draw',
46
45
  'canvas.tool.arrow': 'Arrow',
47
46
  'canvas.tool.rectangle': 'Rectangle',
47
+ 'canvas.tool.roundedRectangle': 'Rounded rectangle',
48
48
  'canvas.tool.triangle': 'Triangle',
49
49
  'canvas.tool.ellipse': 'Ellipse',
50
50
  'canvas.tool.circle': 'Circle',
51
- 'canvas.tool.frame': 'Frame',
52
51
  'canvas.tool.text': 'Text',
53
52
  'canvas.tool.selector': 'Selector',
54
53
  'canvas.tool.image': 'Image',
55
- 'canvas.tool.video': 'Video',
54
+ 'canvas.tool.svg': 'SVG',
56
55
  'canvas.tool.shapes': 'Shapes',
57
- 'canvas.tool.moreShapes': 'More Shapes',
56
+ 'canvas.tool.moreShapes': 'More shapes',
58
57
  'canvas.tool.undo': 'Undo',
59
58
  'canvas.tool.redo': 'Redo',
60
- /** The hint of a button that has a shortcut: "Draw (D)". `{name}` is the name of the tool, `{key}` its key. */
61
- 'canvas.tool.withKey': '{name} ({key})',
62
- /** The hints of the two buttons whose shortcut has Ctrl in it. */
63
- 'canvas.tool.undoTitle': 'Undo (Ctrl+Z)',
64
- 'canvas.tool.redoTitle': 'Redo (Ctrl+Shift+Z)',
65
- 'canvas.tool.stickyOn': 'Tool Lock: ON — drawing tool stays active',
66
- 'canvas.tool.stickyOff': 'Tool Lock: OFF — reverts to Select after placing',
67
- 'canvas.tool.stickyLabel': 'Toggle sticky tool mode',
68
59
  // ===== The menu of shapes under the toolbar =====
69
- /** The group of frame, image and video in the menu of shapes. */
70
- 'canvas.menu.mediaShapes': 'Media Shapes',
60
+ /** The group of image and SVG in the menu of shapes. */
61
+ 'canvas.menu.media': 'Media',
71
62
  /** The groups of the shape library. */
72
63
  'canvas.category.geometric': 'Geometric Shapes',
73
64
  'canvas.category.arrows': 'Arrow Shapes',
@@ -76,6 +67,7 @@ export const CANVAS_MESSAGES = {
76
67
  'canvas.category.symbols': 'Symbol Shapes',
77
68
  // ===== The names of the shapes in the shape library =====
78
69
  'canvas.shape.hexagon': 'Hexagon',
70
+ 'canvas.shape.pentagon': 'Pentagon',
79
71
  'canvas.shape.oval': 'Oval',
80
72
  'canvas.shape.play': 'Play',
81
73
  'canvas.shape.pause': 'Pause',
@@ -101,7 +93,7 @@ export const CANVAS_MESSAGES = {
101
93
  'canvas.shape.rhombus': 'Rhombus',
102
94
  'canvas.shape.lightning': 'Lightning',
103
95
  'canvas.shape.shield': 'Shield',
104
- // ===== Actions on what is selected (the toolbar, the context menu and the list of shortcuts all use these) =====
96
+ // ===== Actions on what is selected (the context menu and the list of shortcuts both use these) =====
105
97
  'canvas.action.cut': 'Cut',
106
98
  'canvas.action.copy': 'Copy',
107
99
  'canvas.action.paste': 'Paste',
@@ -110,24 +102,15 @@ export const CANVAS_MESSAGES = {
110
102
  'canvas.action.group': 'Group',
111
103
  'canvas.action.ungroup': 'Ungroup',
112
104
  'canvas.action.selectAll': 'Select All',
113
- 'canvas.action.clearAll': 'Clear All',
114
105
  // ===== The order of the layers =====
115
106
  'canvas.layer.title': 'Layer Order',
116
107
  'canvas.layer.front': 'Bring to Front',
117
108
  'canvas.layer.forward': 'Bring Forward',
118
109
  'canvas.layer.backward': 'Send Backward',
119
110
  'canvas.layer.back': 'Send to Back',
120
- /** The short names on the four buttons of the properties panel. */
121
- 'canvas.layer.frontShort': 'Front',
122
- 'canvas.layer.upShort': 'Up',
123
- 'canvas.layer.downShort': 'Down',
124
- 'canvas.layer.backShort': 'Back',
125
111
  // ===== The list of keyboard shortcuts =====
126
112
  'canvas.shortcuts.title': 'Keyboard Shortcuts',
127
113
  'canvas.shortcuts.close': 'Close keyboard shortcuts',
128
- /** The line under the list. `{key}` is the "?" key, `{hint}` the note after it (next message), `{icon}` the keyboard icon. */
129
- 'canvas.shortcuts.footer': 'Press {key} {hint} or click {icon} in the zoom panel to toggle',
130
- 'canvas.shortcuts.footerHint': '(Shift + /)',
131
114
  'canvas.shortcuts.groupTools': 'Tools',
132
115
  'canvas.shortcuts.groupSelection': 'Selection',
133
116
  'canvas.shortcuts.groupHistory': 'History',
@@ -142,9 +125,8 @@ export const CANVAS_MESSAGES = {
142
125
  'canvas.shortcuts.pan': 'Pan canvas',
143
126
  'canvas.shortcuts.move1': 'Move selected (1px)',
144
127
  'canvas.shortcuts.move10': 'Move selected (10px)',
145
- 'canvas.shortcuts.frameResize': 'Resize, keep children size',
146
- 'canvas.shortcuts.frameEdit': 'Enter / exit frame edit',
147
128
  /** The names of keys that are words. Letters and symbols are not here: they are the same on every keyboard. */
129
+ 'canvas.key.ctrl': 'Ctrl',
148
130
  'canvas.key.ctrlCmd': 'Ctrl/Cmd',
149
131
  'canvas.key.alt': 'Alt',
150
132
  'canvas.key.shift': 'Shift',
@@ -152,108 +134,53 @@ export const CANVAS_MESSAGES = {
152
134
  'canvas.key.space': 'Space',
153
135
  'canvas.key.click': 'Click',
154
136
  'canvas.key.drag': 'Drag',
155
- 'canvas.key.dragCorner': 'Drag corner',
156
- 'canvas.key.doubleClick': 'Double-click',
157
- // ===== The zoom panel =====
158
- 'canvas.zoom.expandTitle': 'Zoom {percent}% — click to expand',
159
- 'canvas.zoom.expandLabel': 'Expand zoom controls',
160
- 'canvas.zoom.gridTitle': 'Toggle Grid [G]',
161
- 'canvas.zoom.gridLabel': 'Toggle grid',
162
- 'canvas.zoom.panTitle': 'Hand / Pan [H]',
163
- 'canvas.zoom.panLabel': 'Hand / pan tool',
164
- /** The small label next to the zoom controls while the hand tool is on. */
165
- 'canvas.zoom.panBanner': 'Dragging the canvas',
166
- 'canvas.zoom.outTitle': 'Zoom Out [Ctrl/Cmd] + [−]',
137
+ // ===== The zoom control =====
138
+ /** The name of the group of zoom buttons, for a screen reader. */
139
+ 'canvas.zoom.groupLabel': 'Zoom',
167
140
  'canvas.zoom.outLabel': 'Zoom out',
168
- 'canvas.zoom.inTitle': 'Zoom In [Ctrl/Cmd] + [+]',
169
141
  'canvas.zoom.inLabel': 'Zoom in',
170
- /** The number field with the zoom level: what it does when it is clicked, and what it is. */
171
- 'canvas.zoom.resetTitle': 'Reset zoom to 100% [Ctrl/Cmd] + [0]',
172
142
  'canvas.zoom.resetLabel': 'Reset zoom to 100%',
173
- 'canvas.zoom.levelLabel': 'Zoom level (percent)',
174
- /** The "1:1" button. */
175
- 'canvas.zoom.oneToOneTitle': 'Reset Zoom 100% [Ctrl/Cmd] + [0]',
176
- 'canvas.zoom.fitTitle': 'Fit Content to View [Ctrl/Cmd] + [9]',
177
143
  'canvas.zoom.fitLabel': 'Fit content to view',
178
- 'canvas.zoom.shortcutsTitle': 'Keyboard Shortcuts [?]',
179
- 'canvas.zoom.shortcutsLabel': 'Toggle keyboard shortcuts panel',
180
- 'canvas.zoom.unsavedTitle': 'Unsaved changes — click to save [Cmd+S]',
181
- 'canvas.zoom.savedTitle': 'All changes saved [Cmd+S]',
182
- 'canvas.zoom.minimize': 'Minimize Zoom Panel',
183
- // ===== The properties panel: header and sections =====
184
- 'canvas.props.shape': 'SHAPE:',
185
- 'canvas.props.showAll': 'Show all properties',
186
- 'canvas.props.showFewer': 'Show fewer properties',
187
- 'canvas.props.close': 'Close properties panel',
188
- /** What a container holds: "Children: 3". */
189
- 'canvas.props.children': 'Children: {count}',
190
- 'canvas.props.actions': 'Actions',
191
- 'canvas.props.general': 'General Properties',
192
- 'canvas.props.dimensions': 'Dimensions',
193
- 'canvas.props.width': 'Width',
194
- 'canvas.props.height': 'Height',
195
- 'canvas.props.proportionsFixed': 'Proportions locked (shape constraint)',
196
- 'canvas.props.proportionsUnlock': 'Unlock proportions',
197
- 'canvas.props.proportionsLock': 'Lock proportions',
198
- 'canvas.props.textProperties': 'Text Properties',
199
- 'canvas.props.labelProperties': 'Label Properties',
200
- 'canvas.props.boxProperties': 'Box Properties',
201
- 'canvas.props.groupBox': 'Group Box',
202
- 'canvas.props.labelText': 'Text/Description',
203
- 'canvas.props.labelPlaceholder': 'Describe this frame (used as widget description & prompt context)',
204
- 'canvas.props.textBackground': 'Text Background',
205
- // ===== What the selected thing is called in the header of the properties panel =====
144
+ 'canvas.zoom.unsavedTitle': 'Unsaved changes — click to save',
145
+ 'canvas.zoom.savedTitle': 'All changes saved',
146
+ // ===== The selection panel: the card that edits what is selected =====
147
+ /** The name of the panel, for a screen reader. */
148
+ 'canvas.panel.label': 'Selection properties',
149
+ 'canvas.panel.close': 'Close panel',
150
+ 'canvas.panel.open': 'Open selection properties',
151
+ /** The title of the panel when nothing is selected and the page offers an action for the whole sketch. */
152
+ 'canvas.panel.actions': 'Actions',
153
+ 'canvas.panel.fill': 'Fill',
154
+ 'canvas.panel.stroke': 'Stroke',
155
+ 'canvas.panel.strokeWidth': 'Stroke width',
156
+ 'canvas.panel.roundness': 'Roundness',
157
+ 'canvas.panel.opacity': 'Opacity',
158
+ 'canvas.panel.fontSize': 'Font size',
159
+ /** The names of the two buttons of a stepper that changes a number by one. */
160
+ 'canvas.panel.decrease': 'Decrease',
161
+ 'canvas.panel.increase': 'Increase',
162
+ /** What a field says when the things selected do not agree on it. */
163
+ 'canvas.panel.mixed': 'Mixed',
164
+ /** What a colour field says when the colour is none (nothing is painted). */
165
+ 'canvas.panel.none': 'None',
166
+ 'canvas.panel.noColor': 'No color',
167
+ 'canvas.panel.pickColor': 'Pick a color',
168
+ 'canvas.panel.hex': 'Hex color',
169
+ /** Words the design-system colour picker speaks and shows (see `ColorPickerMessages`). */
170
+ 'canvas.colorPicker.area': 'Saturation and brightness',
171
+ 'canvas.colorPicker.areaValue': 'Saturation {s}%, brightness {v}%',
172
+ 'canvas.colorPicker.hue': 'Hue',
173
+ 'canvas.colorPicker.add': 'Add',
174
+ 'canvas.colorPicker.swatch': 'Use {hex}',
175
+ // ===== What the selected thing is called in the header of the selection panel =====
206
176
  'canvas.type.none': 'None',
207
177
  'canvas.type.widget': 'Widget',
208
178
  'canvas.type.drawing': 'Drawing',
209
- 'canvas.type.line': 'Line',
210
179
  'canvas.type.group': 'Group',
211
180
  'canvas.type.selection': 'Selection',
212
181
  /** A shape of the library that was drawn: "Star (Drawing)". */
213
182
  'canvas.type.drawingOf': '{name} (Drawing)',
214
- 'canvas.type.customShape': 'Custom Shape (Drawing)',
215
- // ===== The properties panel: the fields =====
216
- 'canvas.field.opacity': 'Opacity',
217
- 'canvas.field.cornerRoundness': 'Corner Roundness',
218
- 'canvas.field.backgroundColor': 'Background Color',
219
- 'canvas.field.backgroundOpacity': 'Background Opacity',
220
- 'canvas.field.fillColor': 'Fill Color',
221
- 'canvas.field.fillOpacity': 'Fill Opacity',
222
- 'canvas.field.strokeColor': 'Stroke Color',
223
- 'canvas.field.strokeWidth': 'Stroke Width',
224
- 'canvas.field.strokeType': 'Stroke Type',
225
- 'canvas.field.strokeSolid': 'Solid',
226
- 'canvas.field.strokeDashed': 'Dashed',
227
- 'canvas.field.strokeDotted': 'Dotted',
228
- 'canvas.field.fontSize': 'Font Size',
229
- 'canvas.field.textPadding': 'Text Padding',
230
- 'canvas.field.textColor': 'Text Color',
231
- 'canvas.field.textStrokeColor': 'Text Stroke Color',
232
- 'canvas.field.textStrokeWidth': 'Text Stroke Width',
233
- 'canvas.field.groupFillColor': 'Group Fill Color',
234
- 'canvas.field.groupFillOpacity': 'Group Fill Opacity',
235
- 'canvas.field.groupStrokeColor': 'Group Stroke Color',
236
- 'canvas.field.groupStrokeWidth': 'Group Stroke Width',
237
- 'canvas.field.groupStrokeType': 'Group Stroke Type',
238
- // ===== The properties panel: aligning the selection on the canvas =====
239
- 'canvas.arrange.title': 'Align',
240
- 'canvas.arrange.left': 'Align Left',
241
- 'canvas.arrange.centerH': 'Align Center (horizontal)',
242
- 'canvas.arrange.right': 'Align Right',
243
- 'canvas.arrange.top': 'Align Top',
244
- 'canvas.arrange.middleV': 'Align Middle (vertical)',
245
- 'canvas.arrange.bottom': 'Align Bottom',
246
- // ===== The properties panel: the picture of an image =====
247
- 'canvas.image.source': 'IMAGE SOURCE',
248
- 'canvas.image.file': 'File:',
249
- 'canvas.image.noFile': 'No file selected',
250
- 'canvas.image.changeFile': 'Change File',
251
- 'canvas.image.chooseFile': 'Choose File',
252
- 'canvas.image.url': 'URL:',
253
- 'canvas.image.pasteUrl': 'Paste URL...',
254
- 'canvas.image.newUrl': 'New URL...',
255
- 'canvas.image.load': 'Load',
256
- // ===== The properties panel: widgets =====
183
+ // ===== Widgets =====
257
184
  'canvas.widget.createPreview': 'Create Preview',
258
185
  'canvas.widget.capture': 'Capture',
259
186
  'canvas.widget.linked': 'Widget Linked',
@@ -278,7 +205,7 @@ export const CANVAS_MESSAGES = {
278
205
  'canvas.control.value': 'Value',
279
206
  'canvas.control.openPicker': 'Open color picker',
280
207
  'canvas.control.removeColor': 'Remove color',
281
- 'canvas.control.fontFamily': 'Font Family',
208
+ 'canvas.control.fontFamily': 'Font family',
282
209
  'canvas.control.textStyle': 'Text Style',
283
210
  'canvas.control.bold': 'Bold',
284
211
  /** The letters on the buttons for bold, italic and underline. */
@@ -14,7 +14,6 @@ export declare const TOOL_KEYS: {
14
14
  readonly rectangle: "R";
15
15
  readonly triangle: "G";
16
16
  readonly ellipse: "O";
17
- readonly frame: "F";
18
17
  readonly text: "T";
19
18
  readonly image: "I";
20
19
  };
@@ -11,7 +11,6 @@ export const TOOL_KEYS = {
11
11
  rectangle: 'R',
12
12
  triangle: 'G',
13
13
  ellipse: 'O',
14
- frame: 'F',
15
14
  text: 'T',
16
15
  image: 'I'
17
16
  };
@@ -34,7 +33,6 @@ export const SHORTCUT_GROUPS = [
34
33
  { keys: [cap(TOOL_KEYS.rectangle)], label: 'canvas.tool.rectangle' },
35
34
  { keys: [cap(TOOL_KEYS.triangle)], label: 'canvas.tool.triangle' },
36
35
  { keys: [cap(TOOL_KEYS.ellipse)], label: 'canvas.tool.ellipse' },
37
- { keys: [cap(TOOL_KEYS.frame)], label: 'canvas.tool.frame' },
38
36
  { keys: [cap(TOOL_KEYS.text)], label: 'canvas.tool.text' },
39
37
  { keys: [cap(TOOL_KEYS.image)], label: 'canvas.tool.image' }
40
38
  ]
@@ -80,15 +78,8 @@ export const SHORTCUT_GROUPS = [
80
78
  shortcuts: [
81
79
  { keys: [cap(']')], label: 'canvas.layer.forward' },
82
80
  { keys: [cap('[')], label: 'canvas.layer.backward' },
83
- { keys: [CTRL, PLUS, cap(']')], label: 'canvas.layer.front' },
84
- { keys: [CTRL, PLUS, cap('[')], label: 'canvas.layer.back' }
85
- ]
86
- },
87
- {
88
- title: 'canvas.tool.frame',
89
- shortcuts: [
90
- { keys: [ALT, PLUS, named('canvas.key.dragCorner')], label: 'canvas.shortcuts.frameResize' },
91
- { keys: [named('canvas.key.doubleClick')], label: 'canvas.shortcuts.frameEdit' }
81
+ { keys: [CTRL, PLUS, SHIFT, PLUS, cap(']')], label: 'canvas.layer.front' },
82
+ { keys: [CTRL, PLUS, SHIFT, PLUS, cap('[')], label: 'canvas.layer.back' }
92
83
  ]
93
84
  }
94
85
  ];
package/dist/index.d.ts CHANGED
@@ -1,13 +1,17 @@
1
1
  /**
2
2
  * Root barrel — re-exports everything.
3
3
  *
4
- * WARNING: This barrel includes Canvas.svelte (10K+ lines).
4
+ * NOTE: This barrel includes the canvas component and its engine, a good deal more than the components barrel.
5
5
  * In consuming apps, prefer:
6
6
  * - Static: import { Tooltip } from '@widgetic/canvas/components'
7
7
  * - Dynamic: const { Canvas } = await import('@widgetic/canvas')
8
8
  */
9
- export { Canvas, CanvasToolbar, ContextMenu, PanZoomPanel, PropsPanel } from './canvas';
9
+ export { Canvas } from './canvas';
10
10
  export type { WidgetConversionPayload, StrokeRecognizer, StrokeRecognitionRequest, StrokeRecognitionResult } from './canvas';
11
+ export { TOOLBAR_POSITIONS, DEFAULT_TOOLBAR_POSITION } from './canvas';
12
+ export type { ToolbarPosition } from './canvas';
13
+ export { PAN_ZOOM_POSITIONS, DEFAULT_PAN_ZOOM_POSITION } from './canvas';
14
+ export type { PanZoomPosition } from './canvas';
11
15
  export { setShapeImageStore, getShapeImageStore } from './canvas';
12
16
  export type { ShapeImageStore } from './canvas';
13
17
  export { Tooltip, ColorIC, FontSelectorIC, SliderUnitIC, TextAlignIC, TextStyleIC } from './components';
package/dist/index.js CHANGED
@@ -1,13 +1,17 @@
1
1
  /**
2
2
  * Root barrel — re-exports everything.
3
3
  *
4
- * WARNING: This barrel includes Canvas.svelte (10K+ lines).
4
+ * NOTE: This barrel includes the canvas component and its engine, a good deal more than the components barrel.
5
5
  * In consuming apps, prefer:
6
6
  * - Static: import { Tooltip } from '@widgetic/canvas/components'
7
7
  * - Dynamic: const { Canvas } = await import('@widgetic/canvas')
8
8
  */
9
9
  // Canvas (heavy — dynamic import recommended)
10
- export { Canvas, CanvasToolbar, ContextMenu, PanZoomPanel, PropsPanel } from './canvas';
10
+ export { Canvas } from './canvas';
11
+ // Where the drawing toolbar stands: one of eight places on the board (the `toolbarPosition` option of <Canvas>)
12
+ export { TOOLBAR_POSITIONS, DEFAULT_TOOLBAR_POSITION } from './canvas';
13
+ // Where the zoom control stands: one of the same eight places (the `panZoomPosition` option of <Canvas>)
14
+ export { PAN_ZOOM_POSITIONS, DEFAULT_PAN_ZOOM_POSITION } from './canvas';
11
15
  // Widget thumbnails live outside the canvas JSON when the host installs a store
12
16
  export { setShapeImageStore, getShapeImageStore } from './canvas';
13
17
  // Lightweight components (safe for static import)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/canvas",
3
- "version": "0.5.34",
3
+ "version": "0.5.36",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "package": "NODE_ENV=production svelte-package",
55
55
  "publish-to-npm": "node ../dev-tools/bin/publish-package.mjs",
56
56
  "package:watch": "NODE_ENV=development svelte-package --watch",
57
- "test": "node --test \"scripts/*.test.ts\" \"tests/*.test.mjs\"",
57
+ "test": "node --test \"scripts/*.test.ts\" \"tests/*.test.mjs\" \"tests/engine/*.test.mjs\" \"tests/host/*.test.mjs\" \"tests/view/*.test.mjs\" \"tests/ui/*.test.mjs\"",
58
58
  "preview": "vite preview",
59
59
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
60
60
  "check:peers": "check-design-system-peers ..",
@@ -70,18 +70,44 @@
70
70
  "@sveltejs/package": "^2.5.8",
71
71
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
72
72
  "@tailwindcss/postcss": "^4.1.4",
73
- "@widgetic/design-system": "^0.5.21",
73
+ "@tiptap/core": "^2.9.1",
74
+ "@tiptap/extension-bubble-menu": "^2.9.1",
75
+ "@tiptap/extension-code-block-lowlight": "^2.9.1",
76
+ "@tiptap/extension-color": "^2.9.1",
77
+ "@tiptap/extension-floating-menu": "^2.27.2",
78
+ "@tiptap/extension-heading": "^2.9.1",
79
+ "@tiptap/extension-highlight": "^2.9.1",
80
+ "@tiptap/extension-image": "^2.9.1",
81
+ "@tiptap/extension-link": "^2.9.1",
82
+ "@tiptap/extension-subscript": "^2.9.1",
83
+ "@tiptap/extension-superscript": "^2.9.1",
84
+ "@tiptap/extension-table": "^2.9.1",
85
+ "@tiptap/extension-table-cell": "^2.9.1",
86
+ "@tiptap/extension-table-header": "^2.9.1",
87
+ "@tiptap/extension-table-row": "^2.9.1",
88
+ "@tiptap/extension-task-item": "^2.9.1",
89
+ "@tiptap/extension-task-list": "^2.9.1",
90
+ "@tiptap/extension-text": "^2.9.1",
91
+ "@tiptap/extension-text-align": "^2.9.1",
92
+ "@tiptap/extension-text-style": "^2.9.1",
93
+ "@tiptap/extension-typography": "^2.9.1",
94
+ "@tiptap/extension-underline": "^2.9.1",
95
+ "@tiptap/pm": "^2.9.1",
96
+ "@tiptap/starter-kit": "^2.9.1",
97
+ "@widgetic/design-system": "^0.5.30",
74
98
  "@widgetic/dev-tools": "^0.3.0",
75
99
  "eslint": "^9.18.0",
76
100
  "eslint-config-prettier": "^10.0.1",
77
101
  "eslint-plugin-svelte": "^3.0.0",
78
102
  "globals": "^16.0.0",
103
+ "lowlight": "^3.2.0",
79
104
  "postcss": "^8.5.3",
80
105
  "prettier": "^3.4.2",
81
106
  "prettier-plugin-svelte": "^3.3.3",
82
107
  "prettier-plugin-tailwindcss": "^0.6.11",
83
108
  "svelte": "^5.25.6",
84
109
  "svelte-check": "^4.0.0",
110
+ "svelte-tiptap": "^2.0.3",
85
111
  "tailwind-merge": "^2.5.2",
86
112
  "tailwind-variants": "^0.2.1",
87
113
  "tailwindcss": "^4.1.4",
@@ -91,7 +117,6 @@
91
117
  },
92
118
  "dependencies": {
93
119
  "@tailwindcss/typography": "^0.5.19",
94
- "fabric": "^7.4.0",
95
120
  "tailwindcss-animate": "^1.0.7"
96
121
  },
97
122
  "overrides": {
@@ -113,7 +138,7 @@
113
138
  "url": "https://gitlab.com/widgeticai/Frontend/canvas.git"
114
139
  },
115
140
  "peerDependencies": {
116
- "@widgetic/design-system": ">=0.3.0",
141
+ "@widgetic/design-system": ">=0.5.30",
117
142
  "svelte": "^5.0.0"
118
143
  }
119
144
  }