js-draw 0.25.0 → 1.0.0

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 (810) hide show
  1. package/README.md +60 -20
  2. package/build-config.json +22 -21
  3. package/dist/Editor.css +1281 -0
  4. package/dist/bundle.js +3 -3
  5. package/dist/bundledStyles.js +1 -1
  6. package/dist/cjs/Editor.d.ts +91 -12
  7. package/dist/cjs/Editor.js +619 -590
  8. package/dist/cjs/EditorImage.d.ts +5 -2
  9. package/dist/cjs/EditorImage.js +258 -297
  10. package/dist/cjs/EventDispatcher.js +17 -19
  11. package/dist/cjs/Pointer.d.ts +3 -1
  12. package/dist/cjs/Pointer.js +44 -45
  13. package/dist/cjs/SVGLoader.d.ts +7 -1
  14. package/dist/cjs/SVGLoader.js +373 -474
  15. package/dist/cjs/UndoRedoHistory.js +28 -40
  16. package/dist/cjs/Viewport.d.ts +1 -4
  17. package/dist/cjs/Viewport.js +150 -193
  18. package/dist/cjs/bundle/bundled.js +4 -1
  19. package/dist/cjs/commands/Command.js +22 -49
  20. package/dist/cjs/commands/Duplicate.js +28 -44
  21. package/dist/cjs/commands/Erase.js +36 -54
  22. package/dist/cjs/commands/SerializableCommand.js +20 -35
  23. package/dist/cjs/commands/UnresolvedCommand.js +14 -29
  24. package/dist/cjs/commands/invertCommand.js +29 -51
  25. package/dist/cjs/commands/lib.js +9 -6
  26. package/dist/cjs/commands/localization.d.ts +1 -1
  27. package/dist/cjs/commands/localization.js +9 -9
  28. package/dist/cjs/commands/uniteCommands.js +57 -87
  29. package/dist/cjs/components/AbstractComponent.d.ts +11 -3
  30. package/dist/cjs/components/AbstractComponent.js +141 -169
  31. package/dist/cjs/components/BackgroundComponent.d.ts +3 -6
  32. package/dist/cjs/components/BackgroundComponent.js +124 -149
  33. package/dist/cjs/components/ImageComponent.d.ts +3 -5
  34. package/dist/cjs/components/ImageComponent.js +95 -175
  35. package/dist/cjs/components/RestylableComponent.d.ts +1 -1
  36. package/dist/cjs/components/RestylableComponent.js +41 -56
  37. package/dist/cjs/components/SVGGlobalAttributesObject.d.ts +1 -3
  38. package/dist/cjs/components/SVGGlobalAttributesObject.js +34 -51
  39. package/dist/cjs/components/Stroke.d.ts +4 -6
  40. package/dist/cjs/components/Stroke.js +95 -121
  41. package/dist/cjs/components/TextComponent.d.ts +2 -4
  42. package/dist/cjs/components/TextComponent.js +189 -234
  43. package/dist/cjs/components/UnknownSVGObject.d.ts +1 -3
  44. package/dist/cjs/components/UnknownSVGObject.js +30 -43
  45. package/dist/cjs/components/builders/ArrowBuilder.d.ts +1 -1
  46. package/dist/cjs/components/builders/ArrowBuilder.js +43 -42
  47. package/dist/cjs/components/builders/CircleBuilder.js +43 -43
  48. package/dist/cjs/components/builders/FreehandLineBuilder.d.ts +3 -2
  49. package/dist/cjs/components/builders/FreehandLineBuilder.js +73 -86
  50. package/dist/cjs/components/builders/LineBuilder.d.ts +1 -1
  51. package/dist/cjs/components/builders/LineBuilder.js +38 -36
  52. package/dist/cjs/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +1 -1
  53. package/dist/cjs/components/builders/PressureSensitiveFreehandLineBuilder.js +131 -139
  54. package/dist/cjs/components/builders/RectangleBuilder.d.ts +1 -1
  55. package/dist/cjs/components/builders/RectangleBuilder.js +31 -31
  56. package/dist/cjs/components/builders/types.d.ts +1 -1
  57. package/dist/cjs/components/lib.d.ts +3 -1
  58. package/dist/cjs/components/lib.js +10 -7
  59. package/dist/cjs/components/localization.js +4 -4
  60. package/dist/cjs/components/util/StrokeSmoother.d.ts +1 -2
  61. package/dist/cjs/components/util/StrokeSmoother.js +67 -72
  62. package/dist/cjs/components/util/describeComponentList.d.ts +1 -1
  63. package/dist/cjs/components/util/describeComponentList.js +4 -5
  64. package/dist/cjs/dialogs/makeAboutDialog.d.ts +15 -0
  65. package/dist/cjs/dialogs/makeAboutDialog.js +54 -0
  66. package/dist/cjs/inputEvents.d.ts +84 -0
  67. package/dist/cjs/inputEvents.js +40 -0
  68. package/dist/cjs/lib.d.ts +29 -13
  69. package/dist/cjs/lib.js +38 -23
  70. package/dist/cjs/localization.js +19 -18
  71. package/dist/cjs/localizations/de.js +117 -13
  72. package/dist/cjs/localizations/en.js +4 -13
  73. package/dist/cjs/localizations/es.js +62 -23
  74. package/dist/cjs/localizations/getLocalizationTable.js +15 -13
  75. package/dist/cjs/rendering/Display.d.ts +1 -2
  76. package/dist/cjs/rendering/Display.js +70 -83
  77. package/dist/cjs/rendering/RenderablePathSpec.d.ts +15 -0
  78. package/dist/cjs/rendering/RenderablePathSpec.js +70 -0
  79. package/dist/cjs/rendering/RenderingStyle.d.ts +4 -4
  80. package/dist/cjs/rendering/RenderingStyle.js +18 -28
  81. package/dist/cjs/rendering/TextRenderingStyle.d.ts +10 -10
  82. package/dist/cjs/rendering/TextRenderingStyle.js +13 -18
  83. package/dist/cjs/rendering/caching/CacheRecord.d.ts +1 -2
  84. package/dist/cjs/rendering/caching/CacheRecord.js +20 -22
  85. package/dist/cjs/rendering/caching/CacheRecordManager.d.ts +1 -1
  86. package/dist/cjs/rendering/caching/CacheRecordManager.js +17 -15
  87. package/dist/cjs/rendering/caching/RenderingCache.js +19 -19
  88. package/dist/cjs/rendering/caching/RenderingCacheNode.d.ts +1 -1
  89. package/dist/cjs/rendering/caching/RenderingCacheNode.js +98 -118
  90. package/dist/cjs/rendering/caching/testUtils.js +24 -23
  91. package/dist/cjs/rendering/caching/types.d.ts +3 -3
  92. package/dist/cjs/rendering/lib.js +8 -5
  93. package/dist/cjs/rendering/localization.js +5 -5
  94. package/dist/cjs/rendering/renderers/AbstractRenderer.d.ts +2 -11
  95. package/dist/cjs/rendering/renderers/AbstractRenderer.js +53 -57
  96. package/dist/cjs/rendering/renderers/CanvasRenderer.d.ts +3 -5
  97. package/dist/cjs/rendering/renderers/CanvasRenderer.js +91 -106
  98. package/dist/cjs/rendering/renderers/DummyRenderer.d.ts +1 -4
  99. package/dist/cjs/rendering/renderers/DummyRenderer.js +56 -76
  100. package/dist/cjs/rendering/renderers/SVGRenderer.d.ts +5 -5
  101. package/dist/cjs/rendering/renderers/SVGRenderer.js +194 -176
  102. package/dist/cjs/rendering/renderers/TextOnlyRenderer.d.ts +1 -3
  103. package/dist/cjs/rendering/renderers/TextOnlyRenderer.js +47 -72
  104. package/dist/cjs/shortcuts/KeyBinding.d.ts +5 -0
  105. package/dist/cjs/shortcuts/KeyBinding.js +94 -70
  106. package/dist/cjs/shortcuts/KeyboardShortcutManager.d.ts +1 -1
  107. package/dist/cjs/shortcuts/KeyboardShortcutManager.js +36 -45
  108. package/dist/cjs/shortcuts/lib.js +5 -2
  109. package/dist/cjs/testing/createEditor.js +7 -4
  110. package/dist/cjs/testing/getUniquePointerId.js +4 -5
  111. package/dist/cjs/testing/lib.js +5 -2
  112. package/dist/cjs/testing/sendPenEvent.d.ts +2 -2
  113. package/dist/cjs/testing/sendPenEvent.js +10 -7
  114. package/dist/cjs/testing/sendTouchEvent.d.ts +2 -2
  115. package/dist/cjs/testing/sendTouchEvent.js +34 -16
  116. package/dist/cjs/toolbar/AbstractToolbar.d.ts +166 -0
  117. package/dist/cjs/toolbar/AbstractToolbar.js +410 -0
  118. package/dist/cjs/toolbar/DropdownToolbar.d.ts +43 -0
  119. package/dist/cjs/toolbar/DropdownToolbar.js +176 -0
  120. package/dist/cjs/toolbar/EdgeToolbar.d.ts +47 -0
  121. package/dist/cjs/toolbar/EdgeToolbar.js +422 -0
  122. package/dist/cjs/toolbar/IconProvider.d.ts +54 -30
  123. package/dist/cjs/toolbar/IconProvider.js +652 -224
  124. package/dist/cjs/toolbar/constants.d.ts +1 -0
  125. package/dist/cjs/toolbar/constants.js +4 -0
  126. package/dist/cjs/toolbar/lib.d.ts +4 -2
  127. package/dist/cjs/toolbar/lib.js +10 -3
  128. package/dist/cjs/toolbar/localization.d.ts +9 -2
  129. package/dist/cjs/toolbar/localization.js +26 -19
  130. package/dist/cjs/toolbar/types.d.ts +7 -0
  131. package/dist/cjs/toolbar/widgets/ActionButtonWidget.d.ts +1 -1
  132. package/dist/cjs/toolbar/widgets/ActionButtonWidget.js +23 -39
  133. package/dist/cjs/toolbar/widgets/BaseToolWidget.d.ts +1 -1
  134. package/dist/cjs/toolbar/widgets/BaseToolWidget.js +35 -37
  135. package/dist/cjs/toolbar/widgets/BaseWidget.d.ts +60 -5
  136. package/dist/cjs/toolbar/widgets/BaseWidget.js +232 -177
  137. package/dist/cjs/toolbar/widgets/DocumentPropertiesWidget.js +130 -117
  138. package/dist/cjs/toolbar/widgets/EraserToolWidget.d.ts +1 -3
  139. package/dist/cjs/toolbar/widgets/EraserToolWidget.js +45 -73
  140. package/dist/cjs/toolbar/widgets/HandToolWidget.d.ts +1 -0
  141. package/dist/cjs/toolbar/widgets/HandToolWidget.js +126 -141
  142. package/dist/cjs/toolbar/widgets/InsertImageWidget.d.ts +9 -7
  143. package/dist/cjs/toolbar/widgets/InsertImageWidget.js +147 -212
  144. package/dist/cjs/toolbar/widgets/OverflowWidget.js +33 -61
  145. package/dist/cjs/toolbar/widgets/PenToolWidget.d.ts +8 -1
  146. package/dist/cjs/toolbar/widgets/PenToolWidget.js +162 -234
  147. package/dist/cjs/toolbar/widgets/SelectionToolWidget.d.ts +3 -1
  148. package/dist/cjs/toolbar/widgets/SelectionToolWidget.js +105 -177
  149. package/dist/cjs/toolbar/widgets/TextToolWidget.js +64 -87
  150. package/dist/cjs/toolbar/widgets/components/makeColorInput.d.ts +10 -0
  151. package/dist/cjs/toolbar/{makeColorInput.js → widgets/components/makeColorInput.js} +57 -34
  152. package/dist/cjs/toolbar/widgets/components/makeFileInput.d.ts +12 -0
  153. package/dist/cjs/toolbar/widgets/components/makeFileInput.js +111 -0
  154. package/dist/cjs/toolbar/widgets/components/makeGridSelector.d.ts +24 -0
  155. package/dist/cjs/toolbar/widgets/components/makeGridSelector.js +127 -0
  156. package/dist/cjs/toolbar/widgets/components/makeSeparator.d.ts +7 -0
  157. package/dist/cjs/toolbar/widgets/components/makeSeparator.js +16 -0
  158. package/dist/cjs/toolbar/widgets/components/makeThicknessSlider.d.ts +8 -0
  159. package/dist/cjs/toolbar/widgets/components/makeThicknessSlider.js +47 -0
  160. package/dist/cjs/toolbar/widgets/keybindings.js +8 -5
  161. package/dist/cjs/toolbar/widgets/layout/DropdownLayoutManager.d.ts +21 -0
  162. package/dist/cjs/toolbar/widgets/layout/DropdownLayoutManager.js +199 -0
  163. package/dist/cjs/toolbar/widgets/layout/EdgeToolbarLayoutManager.d.ts +14 -0
  164. package/dist/cjs/toolbar/widgets/layout/EdgeToolbarLayoutManager.js +60 -0
  165. package/dist/cjs/toolbar/widgets/layout/types.d.ts +63 -0
  166. package/dist/cjs/toolbar/widgets/layout/types.js +2 -0
  167. package/dist/cjs/toolbar/widgets/lib.d.ts +1 -1
  168. package/dist/cjs/toolbar/widgets/lib.js +15 -11
  169. package/dist/cjs/tools/BaseTool.d.ts +28 -9
  170. package/dist/cjs/tools/BaseTool.js +128 -51
  171. package/dist/cjs/tools/Eraser.d.ts +8 -1
  172. package/dist/cjs/tools/Eraser.js +82 -92
  173. package/dist/cjs/tools/FindTool.d.ts +1 -1
  174. package/dist/cjs/tools/FindTool.js +61 -77
  175. package/dist/cjs/tools/InputFilter/FunctionMapper.d.ts +12 -0
  176. package/dist/cjs/tools/InputFilter/FunctionMapper.js +21 -0
  177. package/dist/cjs/tools/InputFilter/InputMapper.d.ts +23 -0
  178. package/dist/cjs/tools/InputFilter/InputMapper.js +38 -0
  179. package/dist/cjs/tools/InputFilter/InputPipeline.d.ts +15 -0
  180. package/dist/cjs/tools/InputFilter/InputPipeline.js +54 -0
  181. package/dist/cjs/tools/InputFilter/InputStabilizer.d.ts +29 -0
  182. package/dist/cjs/tools/InputFilter/InputStabilizer.js +181 -0
  183. package/dist/cjs/tools/InputFilter/StrokeKeyboardControl.d.ts +21 -0
  184. package/dist/cjs/tools/InputFilter/StrokeKeyboardControl.js +84 -0
  185. package/dist/cjs/tools/PanZoom.d.ts +4 -2
  186. package/dist/cjs/tools/PanZoom.js +186 -248
  187. package/dist/cjs/tools/PasteHandler.d.ts +1 -1
  188. package/dist/cjs/tools/PasteHandler.js +49 -148
  189. package/dist/cjs/tools/Pen.d.ts +12 -11
  190. package/dist/cjs/tools/Pen.js +123 -158
  191. package/dist/cjs/tools/PipetteTool.d.ts +11 -2
  192. package/dist/cjs/tools/PipetteTool.js +51 -48
  193. package/dist/cjs/tools/SelectionTool/SelectAllShortcutHandler.d.ts +1 -1
  194. package/dist/cjs/tools/SelectionTool/SelectAllShortcutHandler.js +15 -30
  195. package/dist/cjs/tools/SelectionTool/Selection.d.ts +5 -5
  196. package/dist/cjs/tools/SelectionTool/Selection.js +308 -415
  197. package/dist/cjs/tools/SelectionTool/SelectionHandle.d.ts +15 -5
  198. package/dist/cjs/tools/SelectionTool/SelectionHandle.js +63 -37
  199. package/dist/cjs/tools/SelectionTool/SelectionTool.d.ts +4 -4
  200. package/dist/cjs/tools/SelectionTool/SelectionTool.js +164 -187
  201. package/dist/cjs/tools/SelectionTool/TransformMode.d.ts +1 -1
  202. package/dist/cjs/tools/SelectionTool/TransformMode.js +65 -66
  203. package/dist/cjs/tools/SoundUITool.d.ts +2 -1
  204. package/dist/cjs/tools/SoundUITool.js +70 -84
  205. package/dist/cjs/tools/TextTool.d.ts +5 -3
  206. package/dist/cjs/tools/TextTool.js +169 -173
  207. package/dist/cjs/tools/ToolController.d.ts +16 -2
  208. package/dist/cjs/tools/ToolController.js +124 -100
  209. package/dist/cjs/tools/ToolEnabledGroup.js +6 -9
  210. package/dist/cjs/tools/ToolSwitcherShortcut.d.ts +1 -1
  211. package/dist/cjs/tools/ToolSwitcherShortcut.js +16 -32
  212. package/dist/cjs/tools/ToolbarShortcutHandler.d.ts +1 -1
  213. package/dist/cjs/tools/ToolbarShortcutHandler.js +17 -33
  214. package/dist/cjs/tools/UndoRedoShortcut.d.ts +1 -1
  215. package/dist/cjs/tools/UndoRedoShortcut.js +12 -27
  216. package/dist/cjs/tools/keybindings.js +21 -18
  217. package/dist/cjs/tools/lib.js +17 -14
  218. package/dist/cjs/tools/localization.d.ts +2 -1
  219. package/dist/cjs/tools/localization.js +8 -7
  220. package/dist/cjs/types.d.ts +22 -80
  221. package/dist/cjs/types.js +8 -16
  222. package/dist/cjs/util/ReactiveValue.d.ts +65 -0
  223. package/dist/cjs/util/ReactiveValue.js +166 -0
  224. package/dist/cjs/util/assertions.js +5 -8
  225. package/dist/cjs/util/fileToBase64.js +6 -6
  226. package/dist/cjs/util/guessKeyCodeFromKey.d.ts +9 -0
  227. package/dist/cjs/util/guessKeyCodeFromKey.js +32 -0
  228. package/dist/cjs/util/listPrefixMatch.d.ts +6 -0
  229. package/dist/cjs/util/listPrefixMatch.js +17 -0
  230. package/dist/cjs/util/stopPropagationOfScrollingWheelEvents.d.ts +2 -0
  231. package/dist/cjs/util/stopPropagationOfScrollingWheelEvents.js +17 -0
  232. package/dist/cjs/util/untilNextAnimationFrame.js +3 -3
  233. package/dist/cjs/util/waitForAll.js +3 -3
  234. package/dist/cjs/util/waitForTimeout.js +3 -3
  235. package/dist/cjs/version.d.ts +4 -0
  236. package/dist/cjs/version.js +5 -0
  237. package/dist/mjs/Editor.d.ts +91 -12
  238. package/dist/mjs/Editor.mjs +565 -563
  239. package/dist/mjs/EditorImage.d.ts +5 -2
  240. package/dist/mjs/EditorImage.mjs +248 -291
  241. package/dist/mjs/EventDispatcher.mjs +17 -20
  242. package/dist/mjs/Pointer.d.ts +3 -1
  243. package/dist/mjs/Pointer.mjs +43 -45
  244. package/dist/mjs/SVGLoader.d.ts +7 -1
  245. package/dist/mjs/SVGLoader.mjs +338 -466
  246. package/dist/mjs/UndoRedoHistory.mjs +27 -39
  247. package/dist/mjs/Viewport.d.ts +1 -4
  248. package/dist/mjs/Viewport.mjs +139 -187
  249. package/dist/mjs/commands/Command.mjs +21 -49
  250. package/dist/mjs/commands/Duplicate.mjs +22 -41
  251. package/dist/mjs/commands/Erase.mjs +30 -51
  252. package/dist/mjs/commands/SerializableCommand.mjs +16 -34
  253. package/dist/mjs/commands/UnresolvedCommand.mjs +10 -29
  254. package/dist/mjs/commands/invertCommand.mjs +24 -49
  255. package/dist/mjs/commands/localization.d.ts +1 -1
  256. package/dist/mjs/commands/localization.mjs +10 -10
  257. package/dist/mjs/commands/uniteCommands.mjs +52 -85
  258. package/dist/mjs/components/AbstractComponent.d.ts +11 -3
  259. package/dist/mjs/components/AbstractComponent.mjs +135 -166
  260. package/dist/mjs/components/BackgroundComponent.d.ts +3 -6
  261. package/dist/mjs/components/BackgroundComponent.mjs +107 -136
  262. package/dist/mjs/components/ImageComponent.d.ts +3 -5
  263. package/dist/mjs/components/ImageComponent.mjs +90 -174
  264. package/dist/mjs/components/RestylableComponent.d.ts +1 -1
  265. package/dist/mjs/components/RestylableComponent.mjs +35 -53
  266. package/dist/mjs/components/SVGGlobalAttributesObject.d.ts +1 -3
  267. package/dist/mjs/components/SVGGlobalAttributesObject.mjs +29 -50
  268. package/dist/mjs/components/Stroke.d.ts +4 -6
  269. package/dist/mjs/components/Stroke.mjs +89 -119
  270. package/dist/mjs/components/TextComponent.d.ts +2 -4
  271. package/dist/mjs/components/TextComponent.mjs +180 -228
  272. package/dist/mjs/components/UnknownSVGObject.d.ts +1 -3
  273. package/dist/mjs/components/UnknownSVGObject.mjs +26 -43
  274. package/dist/mjs/components/builders/ArrowBuilder.d.ts +1 -1
  275. package/dist/mjs/components/builders/ArrowBuilder.mjs +32 -35
  276. package/dist/mjs/components/builders/CircleBuilder.mjs +35 -38
  277. package/dist/mjs/components/builders/FreehandLineBuilder.d.ts +3 -2
  278. package/dist/mjs/components/builders/FreehandLineBuilder.mjs +52 -69
  279. package/dist/mjs/components/builders/LineBuilder.d.ts +1 -1
  280. package/dist/mjs/components/builders/LineBuilder.mjs +30 -32
  281. package/dist/mjs/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +1 -1
  282. package/dist/mjs/components/builders/PressureSensitiveFreehandLineBuilder.mjs +103 -115
  283. package/dist/mjs/components/builders/RectangleBuilder.d.ts +1 -1
  284. package/dist/mjs/components/builders/RectangleBuilder.mjs +27 -31
  285. package/dist/mjs/components/builders/types.d.ts +1 -1
  286. package/dist/mjs/components/lib.d.ts +3 -1
  287. package/dist/mjs/components/lib.mjs +1 -1
  288. package/dist/mjs/components/localization.mjs +5 -5
  289. package/dist/mjs/components/util/StrokeSmoother.d.ts +1 -2
  290. package/dist/mjs/components/util/StrokeSmoother.mjs +63 -69
  291. package/dist/mjs/components/util/describeComponentList.d.ts +1 -1
  292. package/dist/mjs/components/util/describeComponentList.mjs +4 -5
  293. package/dist/mjs/dialogs/makeAboutDialog.d.ts +15 -0
  294. package/dist/mjs/dialogs/makeAboutDialog.mjs +52 -0
  295. package/dist/mjs/inputEvents.d.ts +84 -0
  296. package/dist/mjs/inputEvents.mjs +34 -0
  297. package/dist/mjs/lib.d.ts +29 -13
  298. package/dist/mjs/lib.mjs +30 -13
  299. package/dist/mjs/localization.mjs +14 -13
  300. package/dist/mjs/localizations/de.mjs +116 -12
  301. package/dist/mjs/localizations/en.mjs +3 -12
  302. package/dist/mjs/localizations/es.mjs +61 -22
  303. package/dist/mjs/localizations/getLocalizationTable.mjs +12 -13
  304. package/dist/mjs/rendering/Display.d.ts +1 -2
  305. package/dist/mjs/rendering/Display.mjs +62 -79
  306. package/dist/mjs/rendering/RenderablePathSpec.d.ts +15 -0
  307. package/dist/mjs/rendering/RenderablePathSpec.mjs +64 -0
  308. package/dist/mjs/rendering/RenderingStyle.d.ts +4 -4
  309. package/dist/mjs/rendering/RenderingStyle.mjs +16 -26
  310. package/dist/mjs/rendering/TextRenderingStyle.d.ts +10 -10
  311. package/dist/mjs/rendering/TextRenderingStyle.mjs +12 -17
  312. package/dist/mjs/rendering/caching/CacheRecord.d.ts +1 -2
  313. package/dist/mjs/rendering/caching/CacheRecord.mjs +20 -23
  314. package/dist/mjs/rendering/caching/CacheRecordManager.d.ts +1 -1
  315. package/dist/mjs/rendering/caching/CacheRecordManager.mjs +13 -15
  316. package/dist/mjs/rendering/caching/RenderingCache.mjs +13 -17
  317. package/dist/mjs/rendering/caching/RenderingCacheNode.d.ts +1 -1
  318. package/dist/mjs/rendering/caching/RenderingCacheNode.mjs +94 -115
  319. package/dist/mjs/rendering/caching/testUtils.mjs +19 -21
  320. package/dist/mjs/rendering/caching/types.d.ts +3 -3
  321. package/dist/mjs/rendering/localization.mjs +6 -6
  322. package/dist/mjs/rendering/renderers/AbstractRenderer.d.ts +2 -11
  323. package/dist/mjs/rendering/renderers/AbstractRenderer.mjs +47 -52
  324. package/dist/mjs/rendering/renderers/CanvasRenderer.d.ts +3 -5
  325. package/dist/mjs/rendering/renderers/CanvasRenderer.mjs +84 -103
  326. package/dist/mjs/rendering/renderers/DummyRenderer.d.ts +1 -4
  327. package/dist/mjs/rendering/renderers/DummyRenderer.mjs +51 -75
  328. package/dist/mjs/rendering/renderers/SVGRenderer.d.ts +5 -5
  329. package/dist/mjs/rendering/renderers/SVGRenderer.mjs +185 -171
  330. package/dist/mjs/rendering/renderers/TextOnlyRenderer.d.ts +1 -3
  331. package/dist/mjs/rendering/renderers/TextOnlyRenderer.mjs +43 -72
  332. package/dist/mjs/shortcuts/KeyBinding.d.ts +5 -0
  333. package/dist/mjs/shortcuts/KeyBinding.mjs +94 -71
  334. package/dist/mjs/shortcuts/KeyboardShortcutManager.d.ts +1 -1
  335. package/dist/mjs/shortcuts/KeyboardShortcutManager.mjs +32 -44
  336. package/dist/mjs/testing/createEditor.mjs +2 -2
  337. package/dist/mjs/testing/getUniquePointerId.mjs +4 -5
  338. package/dist/mjs/testing/sendPenEvent.d.ts +2 -2
  339. package/dist/mjs/testing/sendPenEvent.mjs +5 -5
  340. package/dist/mjs/testing/sendTouchEvent.d.ts +2 -2
  341. package/dist/mjs/testing/sendTouchEvent.mjs +8 -16
  342. package/dist/mjs/toolbar/AbstractToolbar.d.ts +166 -0
  343. package/dist/mjs/toolbar/AbstractToolbar.mjs +405 -0
  344. package/dist/mjs/toolbar/DropdownToolbar.d.ts +43 -0
  345. package/dist/mjs/toolbar/DropdownToolbar.mjs +168 -0
  346. package/dist/mjs/toolbar/EdgeToolbar.d.ts +47 -0
  347. package/dist/mjs/toolbar/EdgeToolbar.mjs +414 -0
  348. package/dist/mjs/toolbar/IconProvider.d.ts +54 -30
  349. package/dist/mjs/toolbar/IconProvider.mjs +644 -219
  350. package/dist/mjs/toolbar/constants.d.ts +1 -0
  351. package/dist/mjs/toolbar/constants.mjs +1 -0
  352. package/dist/mjs/toolbar/lib.d.ts +4 -2
  353. package/dist/mjs/toolbar/lib.mjs +3 -1
  354. package/dist/mjs/toolbar/localization.d.ts +9 -2
  355. package/dist/mjs/toolbar/localization.mjs +27 -20
  356. package/dist/mjs/toolbar/types.d.ts +7 -0
  357. package/dist/mjs/toolbar/widgets/ActionButtonWidget.d.ts +1 -1
  358. package/dist/mjs/toolbar/widgets/ActionButtonWidget.mjs +19 -39
  359. package/dist/mjs/toolbar/widgets/BaseToolWidget.d.ts +1 -1
  360. package/dist/mjs/toolbar/widgets/BaseToolWidget.mjs +30 -36
  361. package/dist/mjs/toolbar/widgets/BaseWidget.d.ts +60 -5
  362. package/dist/mjs/toolbar/widgets/BaseWidget.mjs +227 -176
  363. package/dist/mjs/toolbar/widgets/DocumentPropertiesWidget.mjs +98 -111
  364. package/dist/mjs/toolbar/widgets/EraserToolWidget.d.ts +1 -3
  365. package/dist/mjs/toolbar/widgets/EraserToolWidget.mjs +41 -73
  366. package/dist/mjs/toolbar/widgets/HandToolWidget.d.ts +1 -0
  367. package/dist/mjs/toolbar/widgets/HandToolWidget.mjs +94 -136
  368. package/dist/mjs/toolbar/widgets/InsertImageWidget.d.ts +9 -7
  369. package/dist/mjs/toolbar/widgets/InsertImageWidget.mjs +140 -208
  370. package/dist/mjs/toolbar/widgets/OverflowWidget.mjs +30 -62
  371. package/dist/mjs/toolbar/widgets/PenToolWidget.d.ts +8 -1
  372. package/dist/mjs/toolbar/widgets/PenToolWidget.mjs +150 -225
  373. package/dist/mjs/toolbar/widgets/SelectionToolWidget.d.ts +3 -1
  374. package/dist/mjs/toolbar/widgets/SelectionToolWidget.mjs +97 -173
  375. package/dist/mjs/toolbar/widgets/TextToolWidget.mjs +59 -85
  376. package/dist/mjs/toolbar/widgets/components/makeColorInput.d.ts +10 -0
  377. package/dist/mjs/toolbar/{makeColorInput.mjs → widgets/components/makeColorInput.mjs} +53 -33
  378. package/dist/mjs/toolbar/widgets/components/makeFileInput.d.ts +12 -0
  379. package/dist/mjs/toolbar/widgets/components/makeFileInput.mjs +106 -0
  380. package/dist/mjs/toolbar/widgets/components/makeGridSelector.d.ts +24 -0
  381. package/dist/mjs/toolbar/widgets/components/makeGridSelector.mjs +122 -0
  382. package/dist/mjs/toolbar/widgets/components/makeSeparator.d.ts +7 -0
  383. package/dist/mjs/toolbar/widgets/components/makeSeparator.mjs +14 -0
  384. package/dist/mjs/toolbar/widgets/components/makeThicknessSlider.d.ts +8 -0
  385. package/dist/mjs/toolbar/widgets/components/makeThicknessSlider.mjs +45 -0
  386. package/dist/mjs/toolbar/widgets/keybindings.mjs +5 -5
  387. package/dist/mjs/toolbar/widgets/layout/DropdownLayoutManager.d.ts +21 -0
  388. package/dist/mjs/toolbar/widgets/layout/DropdownLayoutManager.mjs +193 -0
  389. package/dist/mjs/toolbar/widgets/layout/EdgeToolbarLayoutManager.d.ts +14 -0
  390. package/dist/mjs/toolbar/widgets/layout/EdgeToolbarLayoutManager.mjs +57 -0
  391. package/dist/mjs/toolbar/widgets/layout/types.d.ts +63 -0
  392. package/dist/mjs/toolbar/widgets/lib.d.ts +1 -1
  393. package/dist/mjs/toolbar/widgets/lib.mjs +1 -1
  394. package/dist/mjs/tools/BaseTool.d.ts +28 -9
  395. package/dist/mjs/tools/BaseTool.mjs +127 -50
  396. package/dist/mjs/tools/Eraser.d.ts +8 -1
  397. package/dist/mjs/tools/Eraser.mjs +72 -86
  398. package/dist/mjs/tools/FindTool.d.ts +1 -1
  399. package/dist/mjs/tools/FindTool.mjs +55 -75
  400. package/dist/mjs/tools/InputFilter/FunctionMapper.d.ts +12 -0
  401. package/dist/mjs/tools/InputFilter/FunctionMapper.mjs +15 -0
  402. package/dist/mjs/tools/InputFilter/InputMapper.d.ts +23 -0
  403. package/dist/mjs/tools/InputFilter/InputMapper.mjs +36 -0
  404. package/dist/mjs/tools/InputFilter/InputPipeline.d.ts +15 -0
  405. package/dist/mjs/tools/InputFilter/InputPipeline.mjs +49 -0
  406. package/dist/mjs/tools/InputFilter/InputStabilizer.d.ts +29 -0
  407. package/dist/mjs/tools/InputFilter/InputStabilizer.mjs +175 -0
  408. package/dist/mjs/tools/InputFilter/StrokeKeyboardControl.d.ts +21 -0
  409. package/dist/mjs/tools/InputFilter/StrokeKeyboardControl.mjs +78 -0
  410. package/dist/mjs/tools/PanZoom.d.ts +4 -2
  411. package/dist/mjs/tools/PanZoom.mjs +169 -235
  412. package/dist/mjs/tools/PasteHandler.d.ts +1 -1
  413. package/dist/mjs/tools/PasteHandler.mjs +42 -145
  414. package/dist/mjs/tools/Pen.d.ts +12 -11
  415. package/dist/mjs/tools/Pen.mjs +115 -154
  416. package/dist/mjs/tools/PipetteTool.d.ts +11 -2
  417. package/dist/mjs/tools/PipetteTool.mjs +47 -48
  418. package/dist/mjs/tools/SelectionTool/SelectAllShortcutHandler.d.ts +1 -1
  419. package/dist/mjs/tools/SelectionTool/SelectAllShortcutHandler.mjs +9 -28
  420. package/dist/mjs/tools/SelectionTool/Selection.d.ts +5 -5
  421. package/dist/mjs/tools/SelectionTool/Selection.mjs +268 -401
  422. package/dist/mjs/tools/SelectionTool/SelectionHandle.d.ts +15 -5
  423. package/dist/mjs/tools/SelectionTool/SelectionHandle.mjs +62 -37
  424. package/dist/mjs/tools/SelectionTool/SelectionTool.d.ts +4 -4
  425. package/dist/mjs/tools/SelectionTool/SelectionTool.mjs +153 -179
  426. package/dist/mjs/tools/SelectionTool/TransformMode.d.ts +1 -1
  427. package/dist/mjs/tools/SelectionTool/TransformMode.mjs +52 -59
  428. package/dist/mjs/tools/SoundUITool.d.ts +2 -1
  429. package/dist/mjs/tools/SoundUITool.mjs +66 -84
  430. package/dist/mjs/tools/TextTool.d.ts +5 -3
  431. package/dist/mjs/tools/TextTool.mjs +155 -163
  432. package/dist/mjs/tools/ToolController.d.ts +16 -2
  433. package/dist/mjs/tools/ToolController.mjs +81 -84
  434. package/dist/mjs/tools/ToolEnabledGroup.mjs +6 -10
  435. package/dist/mjs/tools/ToolSwitcherShortcut.d.ts +1 -1
  436. package/dist/mjs/tools/ToolSwitcherShortcut.mjs +12 -32
  437. package/dist/mjs/tools/ToolbarShortcutHandler.d.ts +1 -1
  438. package/dist/mjs/tools/ToolbarShortcutHandler.mjs +13 -33
  439. package/dist/mjs/tools/UndoRedoShortcut.d.ts +1 -1
  440. package/dist/mjs/tools/UndoRedoShortcut.mjs +7 -26
  441. package/dist/mjs/tools/keybindings.mjs +34 -34
  442. package/dist/mjs/tools/localization.d.ts +2 -1
  443. package/dist/mjs/tools/localization.mjs +9 -8
  444. package/dist/mjs/types.d.ts +22 -80
  445. package/dist/mjs/types.mjs +7 -15
  446. package/dist/mjs/util/ReactiveValue.d.ts +65 -0
  447. package/dist/mjs/util/ReactiveValue.mjs +161 -0
  448. package/dist/mjs/util/assertions.mjs +5 -8
  449. package/dist/mjs/util/fileToBase64.mjs +6 -6
  450. package/dist/mjs/util/guessKeyCodeFromKey.d.ts +9 -0
  451. package/dist/mjs/util/guessKeyCodeFromKey.mjs +30 -0
  452. package/dist/mjs/util/listPrefixMatch.d.ts +6 -0
  453. package/dist/mjs/util/listPrefixMatch.mjs +15 -0
  454. package/dist/mjs/util/stopPropagationOfScrollingWheelEvents.d.ts +2 -0
  455. package/dist/mjs/util/stopPropagationOfScrollingWheelEvents.mjs +15 -0
  456. package/dist/mjs/util/untilNextAnimationFrame.mjs +3 -3
  457. package/dist/mjs/util/waitForAll.mjs +3 -3
  458. package/dist/mjs/util/waitForTimeout.mjs +3 -3
  459. package/dist/mjs/version.d.ts +4 -0
  460. package/dist/mjs/version.mjs +3 -0
  461. package/package.json +11 -22
  462. package/src/Coloris.css +8 -8
  463. package/src/Editor.scss +148 -0
  464. package/src/dialogs/dialogs.scss +36 -0
  465. package/src/dialogs/makeAboutDialog.scss +41 -0
  466. package/src/styles.js +1 -1
  467. package/src/toolbar/{toolbar.css → AbstractToolbar.scss} +47 -85
  468. package/src/toolbar/DropdownToolbar.scss +46 -0
  469. package/src/toolbar/EdgeToolbar.scss +511 -0
  470. package/src/toolbar/toolbar.scss +11 -0
  471. package/src/toolbar/widgets/DocumentPropertiesWidget.scss +7 -0
  472. package/src/toolbar/widgets/HandToolWidget.scss +14 -0
  473. package/src/toolbar/widgets/InsertImageWidget.scss +41 -0
  474. package/src/toolbar/widgets/PenToolWidget.css +0 -51
  475. package/src/toolbar/widgets/SelectionToolWidget.scss +6 -0
  476. package/src/toolbar/widgets/components/components.scss +5 -0
  477. package/src/toolbar/widgets/components/makeColorInput.scss +82 -0
  478. package/src/toolbar/widgets/components/makeFileInput.scss +77 -0
  479. package/src/toolbar/widgets/components/makeGridSelector.scss +60 -0
  480. package/src/toolbar/widgets/components/makeSeparator.scss +14 -0
  481. package/src/toolbar/widgets/components/makeThicknessSlider.scss +9 -0
  482. package/src/tools/FindTool.css +3 -3
  483. package/src/tools/SelectionTool/SelectionTool.css +23 -11
  484. package/src/tools/tools.scss +4 -0
  485. package/tsconfig.json +1 -1
  486. package/typedoc.json +4 -0
  487. package/dist/cjs/Color4.d.ts +0 -69
  488. package/dist/cjs/Color4.js +0 -263
  489. package/dist/cjs/Editor.loadFrom.test.d.ts +0 -1
  490. package/dist/cjs/Editor.toSVG.test.d.ts +0 -1
  491. package/dist/cjs/EditorImage.test.d.ts +0 -1
  492. package/dist/cjs/EventDispatcher.test.d.ts +0 -1
  493. package/dist/cjs/SVGLoader.test.d.ts +0 -1
  494. package/dist/cjs/UndoRedoHistory.test.d.ts +0 -1
  495. package/dist/cjs/commands/uniteCommands.test.d.ts +0 -1
  496. package/dist/cjs/components/AbstractComponent.transformBy.test.d.ts +0 -1
  497. package/dist/cjs/components/BackgroundComponent.test.d.ts +0 -1
  498. package/dist/cjs/components/Stroke.test.d.ts +0 -1
  499. package/dist/cjs/components/TextComponent.test.d.ts +0 -1
  500. package/dist/cjs/components/UnknownSVGObject.test.d.ts +0 -1
  501. package/dist/cjs/components/builders/FreehandLineBuilder.test.d.ts +0 -1
  502. package/dist/cjs/localizations/getLocalizationTable.test.d.ts +0 -1
  503. package/dist/cjs/math/Mat33.d.ts +0 -123
  504. package/dist/cjs/math/Mat33.js +0 -340
  505. package/dist/cjs/math/Mat33.test.d.ts +0 -1
  506. package/dist/cjs/math/Vec2.d.ts +0 -33
  507. package/dist/cjs/math/Vec2.js +0 -37
  508. package/dist/cjs/math/Vec2.test.d.ts +0 -1
  509. package/dist/cjs/math/Vec3.d.ts +0 -106
  510. package/dist/cjs/math/Vec3.js +0 -183
  511. package/dist/cjs/math/Vec3.test.d.ts +0 -1
  512. package/dist/cjs/math/lib.d.ts +0 -7
  513. package/dist/cjs/math/lib.js +0 -15
  514. package/dist/cjs/math/polynomial/solveQuadratic.d.ts +0 -9
  515. package/dist/cjs/math/polynomial/solveQuadratic.js +0 -39
  516. package/dist/cjs/math/polynomial/solveQuadratic.test.d.ts +0 -1
  517. package/dist/cjs/math/rounding.d.ts +0 -4
  518. package/dist/cjs/math/rounding.js +0 -140
  519. package/dist/cjs/math/rounding.test.d.ts +0 -1
  520. package/dist/cjs/math/shapes/Abstract2DShape.d.ts +0 -49
  521. package/dist/cjs/math/shapes/Abstract2DShape.js +0 -42
  522. package/dist/cjs/math/shapes/BezierJSWrapper.d.ts +0 -36
  523. package/dist/cjs/math/shapes/BezierJSWrapper.js +0 -109
  524. package/dist/cjs/math/shapes/CubicBezier.d.ts +0 -17
  525. package/dist/cjs/math/shapes/CubicBezier.js +0 -50
  526. package/dist/cjs/math/shapes/LineSegment2.d.ts +0 -70
  527. package/dist/cjs/math/shapes/LineSegment2.js +0 -204
  528. package/dist/cjs/math/shapes/LineSegment2.test.d.ts +0 -1
  529. package/dist/cjs/math/shapes/Path.d.ts +0 -93
  530. package/dist/cjs/math/shapes/Path.fromString.test.d.ts +0 -1
  531. package/dist/cjs/math/shapes/Path.js +0 -865
  532. package/dist/cjs/math/shapes/Path.test.d.ts +0 -1
  533. package/dist/cjs/math/shapes/Path.toString.test.d.ts +0 -1
  534. package/dist/cjs/math/shapes/PointShape2D.d.ts +0 -18
  535. package/dist/cjs/math/shapes/PointShape2D.js +0 -46
  536. package/dist/cjs/math/shapes/QuadraticBezier.d.ts +0 -34
  537. package/dist/cjs/math/shapes/QuadraticBezier.js +0 -133
  538. package/dist/cjs/math/shapes/QuadraticBezier.test.d.ts +0 -1
  539. package/dist/cjs/math/shapes/Rect2.d.ts +0 -57
  540. package/dist/cjs/math/shapes/Rect2.js +0 -311
  541. package/dist/cjs/math/shapes/Rect2.test.d.ts +0 -1
  542. package/dist/cjs/math/shapes/Triangle.d.ts +0 -46
  543. package/dist/cjs/math/shapes/Triangle.js +0 -148
  544. package/dist/cjs/math/shapes/Triangle.test.d.ts +0 -1
  545. package/dist/cjs/rendering/RenderingStyle.test.d.ts +0 -1
  546. package/dist/cjs/rendering/caching/CacheRecord.test.d.ts +0 -1
  547. package/dist/cjs/rendering/caching/RenderingCache.test.d.ts +0 -1
  548. package/dist/cjs/rendering/renderers/DummyRenderer.test.d.ts +0 -1
  549. package/dist/cjs/rendering/renderers/TextOnlyRenderer.test.d.ts +0 -1
  550. package/dist/cjs/shortcuts/KeyBinding.test.d.ts +0 -1
  551. package/dist/cjs/shortcuts/KeyboardShortcutManager.test.d.ts +0 -1
  552. package/dist/cjs/toolbar/HTMLToolbar.d.ts +0 -105
  553. package/dist/cjs/toolbar/HTMLToolbar.js +0 -465
  554. package/dist/cjs/toolbar/makeColorInput.d.ts +0 -6
  555. package/dist/cjs/tools/Eraser.test.d.ts +0 -1
  556. package/dist/cjs/tools/PanZoom.test.d.ts +0 -1
  557. package/dist/cjs/tools/Pen.test.d.ts +0 -1
  558. package/dist/cjs/tools/SelectionTool/SelectionTool.test.d.ts +0 -1
  559. package/dist/cjs/tools/UndoRedoShortcut.test.d.ts +0 -1
  560. package/dist/mjs/Color4.d.ts +0 -69
  561. package/dist/mjs/Color4.mjs +0 -260
  562. package/dist/mjs/Color4.test.d.ts +0 -1
  563. package/dist/mjs/Editor.loadFrom.test.d.ts +0 -1
  564. package/dist/mjs/Editor.toSVG.test.d.ts +0 -1
  565. package/dist/mjs/EditorImage.test.d.ts +0 -1
  566. package/dist/mjs/EventDispatcher.test.d.ts +0 -1
  567. package/dist/mjs/SVGLoader.test.d.ts +0 -1
  568. package/dist/mjs/UndoRedoHistory.test.d.ts +0 -1
  569. package/dist/mjs/commands/uniteCommands.test.d.ts +0 -1
  570. package/dist/mjs/components/AbstractComponent.transformBy.test.d.ts +0 -1
  571. package/dist/mjs/components/BackgroundComponent.test.d.ts +0 -1
  572. package/dist/mjs/components/Stroke.test.d.ts +0 -1
  573. package/dist/mjs/components/TextComponent.test.d.ts +0 -1
  574. package/dist/mjs/components/UnknownSVGObject.test.d.ts +0 -1
  575. package/dist/mjs/components/builders/FreehandLineBuilder.test.d.ts +0 -1
  576. package/dist/mjs/localizations/getLocalizationTable.test.d.ts +0 -1
  577. package/dist/mjs/math/Mat33.d.ts +0 -123
  578. package/dist/mjs/math/Mat33.mjs +0 -338
  579. package/dist/mjs/math/Mat33.test.d.ts +0 -1
  580. package/dist/mjs/math/Vec2.d.ts +0 -33
  581. package/dist/mjs/math/Vec2.mjs +0 -34
  582. package/dist/mjs/math/Vec2.test.d.ts +0 -1
  583. package/dist/mjs/math/Vec3.d.ts +0 -106
  584. package/dist/mjs/math/Vec3.mjs +0 -181
  585. package/dist/mjs/math/Vec3.test.d.ts +0 -1
  586. package/dist/mjs/math/lib.d.ts +0 -7
  587. package/dist/mjs/math/lib.mjs +0 -7
  588. package/dist/mjs/math/polynomial/solveQuadratic.d.ts +0 -9
  589. package/dist/mjs/math/polynomial/solveQuadratic.mjs +0 -37
  590. package/dist/mjs/math/polynomial/solveQuadratic.test.d.ts +0 -1
  591. package/dist/mjs/math/rounding.d.ts +0 -4
  592. package/dist/mjs/math/rounding.mjs +0 -133
  593. package/dist/mjs/math/rounding.test.d.ts +0 -1
  594. package/dist/mjs/math/shapes/Abstract2DShape.d.ts +0 -49
  595. package/dist/mjs/math/shapes/Abstract2DShape.mjs +0 -40
  596. package/dist/mjs/math/shapes/BezierJSWrapper.d.ts +0 -36
  597. package/dist/mjs/math/shapes/BezierJSWrapper.mjs +0 -107
  598. package/dist/mjs/math/shapes/CubicBezier.d.ts +0 -17
  599. package/dist/mjs/math/shapes/CubicBezier.mjs +0 -48
  600. package/dist/mjs/math/shapes/LineSegment2.d.ts +0 -70
  601. package/dist/mjs/math/shapes/LineSegment2.mjs +0 -202
  602. package/dist/mjs/math/shapes/LineSegment2.test.d.ts +0 -1
  603. package/dist/mjs/math/shapes/Path.d.ts +0 -93
  604. package/dist/mjs/math/shapes/Path.fromString.test.d.ts +0 -1
  605. package/dist/mjs/math/shapes/Path.mjs +0 -862
  606. package/dist/mjs/math/shapes/Path.test.d.ts +0 -1
  607. package/dist/mjs/math/shapes/Path.toString.test.d.ts +0 -1
  608. package/dist/mjs/math/shapes/PointShape2D.d.ts +0 -18
  609. package/dist/mjs/math/shapes/PointShape2D.mjs +0 -44
  610. package/dist/mjs/math/shapes/QuadraticBezier.d.ts +0 -34
  611. package/dist/mjs/math/shapes/QuadraticBezier.mjs +0 -131
  612. package/dist/mjs/math/shapes/QuadraticBezier.test.d.ts +0 -1
  613. package/dist/mjs/math/shapes/Rect2.d.ts +0 -57
  614. package/dist/mjs/math/shapes/Rect2.mjs +0 -309
  615. package/dist/mjs/math/shapes/Rect2.test.d.ts +0 -1
  616. package/dist/mjs/math/shapes/Triangle.d.ts +0 -46
  617. package/dist/mjs/math/shapes/Triangle.mjs +0 -146
  618. package/dist/mjs/math/shapes/Triangle.test.d.ts +0 -1
  619. package/dist/mjs/rendering/RenderingStyle.test.d.ts +0 -1
  620. package/dist/mjs/rendering/caching/CacheRecord.test.d.ts +0 -1
  621. package/dist/mjs/rendering/caching/RenderingCache.test.d.ts +0 -1
  622. package/dist/mjs/rendering/renderers/DummyRenderer.test.d.ts +0 -1
  623. package/dist/mjs/rendering/renderers/TextOnlyRenderer.test.d.ts +0 -1
  624. package/dist/mjs/shortcuts/KeyBinding.test.d.ts +0 -1
  625. package/dist/mjs/shortcuts/KeyboardShortcutManager.test.d.ts +0 -1
  626. package/dist/mjs/toolbar/HTMLToolbar.d.ts +0 -105
  627. package/dist/mjs/toolbar/HTMLToolbar.mjs +0 -462
  628. package/dist/mjs/toolbar/makeColorInput.d.ts +0 -6
  629. package/dist/mjs/tools/Eraser.test.d.ts +0 -1
  630. package/dist/mjs/tools/PanZoom.test.d.ts +0 -1
  631. package/dist/mjs/tools/Pen.test.d.ts +0 -1
  632. package/dist/mjs/tools/SelectionTool/SelectionTool.test.d.ts +0 -1
  633. package/dist/mjs/tools/UndoRedoShortcut.test.d.ts +0 -1
  634. package/dist-test/test_imports/package-lock.json +0 -13
  635. package/dist-test/test_imports/package.json +0 -12
  636. package/dist-test/test_imports/test-imports.js +0 -17
  637. package/dist-test/test_imports/test-require.cjs +0 -19
  638. package/src/Color4.test.ts +0 -47
  639. package/src/Color4.ts +0 -304
  640. package/src/Editor.css +0 -98
  641. package/src/Editor.loadFrom.test.ts +0 -24
  642. package/src/Editor.toSVG.test.ts +0 -111
  643. package/src/Editor.ts +0 -1171
  644. package/src/EditorImage.test.ts +0 -120
  645. package/src/EditorImage.ts +0 -603
  646. package/src/EventDispatcher.test.ts +0 -123
  647. package/src/EventDispatcher.ts +0 -72
  648. package/src/Pointer.ts +0 -167
  649. package/src/SVGLoader.test.ts +0 -114
  650. package/src/SVGLoader.ts +0 -610
  651. package/src/UndoRedoHistory.test.ts +0 -33
  652. package/src/UndoRedoHistory.ts +0 -102
  653. package/src/Viewport.ts +0 -325
  654. package/src/bundle/bundled.ts +0 -7
  655. package/src/commands/Command.ts +0 -45
  656. package/src/commands/Duplicate.ts +0 -75
  657. package/src/commands/Erase.ts +0 -94
  658. package/src/commands/SerializableCommand.ts +0 -49
  659. package/src/commands/UnresolvedCommand.ts +0 -37
  660. package/src/commands/invertCommand.ts +0 -58
  661. package/src/commands/lib.ts +0 -16
  662. package/src/commands/localization.ts +0 -47
  663. package/src/commands/uniteCommands.test.ts +0 -23
  664. package/src/commands/uniteCommands.ts +0 -140
  665. package/src/components/AbstractComponent.transformBy.test.ts +0 -22
  666. package/src/components/AbstractComponent.ts +0 -374
  667. package/src/components/BackgroundComponent.test.ts +0 -45
  668. package/src/components/BackgroundComponent.ts +0 -353
  669. package/src/components/ImageComponent.ts +0 -178
  670. package/src/components/RestylableComponent.ts +0 -161
  671. package/src/components/SVGGlobalAttributesObject.ts +0 -81
  672. package/src/components/Stroke.test.ts +0 -139
  673. package/src/components/Stroke.ts +0 -296
  674. package/src/components/TextComponent.test.ts +0 -204
  675. package/src/components/TextComponent.ts +0 -432
  676. package/src/components/UnknownSVGObject.test.ts +0 -10
  677. package/src/components/UnknownSVGObject.ts +0 -60
  678. package/src/components/builders/ArrowBuilder.ts +0 -107
  679. package/src/components/builders/CircleBuilder.ts +0 -102
  680. package/src/components/builders/FreehandLineBuilder.test.ts +0 -25
  681. package/src/components/builders/FreehandLineBuilder.ts +0 -212
  682. package/src/components/builders/LineBuilder.ts +0 -77
  683. package/src/components/builders/PressureSensitiveFreehandLineBuilder.ts +0 -454
  684. package/src/components/builders/RectangleBuilder.ts +0 -74
  685. package/src/components/builders/types.ts +0 -15
  686. package/src/components/lib.ts +0 -31
  687. package/src/components/localization.ts +0 -24
  688. package/src/components/util/StrokeSmoother.ts +0 -302
  689. package/src/components/util/describeComponentList.ts +0 -18
  690. package/src/lib.ts +0 -69
  691. package/src/localization.ts +0 -34
  692. package/src/localizations/de.ts +0 -146
  693. package/src/localizations/en.ts +0 -8
  694. package/src/localizations/es.ts +0 -74
  695. package/src/localizations/getLocalizationTable.test.ts +0 -27
  696. package/src/localizations/getLocalizationTable.ts +0 -74
  697. package/src/math/Mat33.test.ts +0 -244
  698. package/src/math/Mat33.ts +0 -442
  699. package/src/math/Vec2.test.ts +0 -30
  700. package/src/math/Vec2.ts +0 -40
  701. package/src/math/Vec3.test.ts +0 -44
  702. package/src/math/Vec3.ts +0 -218
  703. package/src/math/lib.ts +0 -15
  704. package/src/math/polynomial/solveQuadratic.test.ts +0 -39
  705. package/src/math/polynomial/solveQuadratic.ts +0 -43
  706. package/src/math/rounding.test.ts +0 -65
  707. package/src/math/rounding.ts +0 -156
  708. package/src/math/shapes/Abstract2DShape.ts +0 -63
  709. package/src/math/shapes/BezierJSWrapper.ts +0 -93
  710. package/src/math/shapes/CubicBezier.ts +0 -35
  711. package/src/math/shapes/LineSegment2.test.ts +0 -99
  712. package/src/math/shapes/LineSegment2.ts +0 -231
  713. package/src/math/shapes/Path.fromString.test.ts +0 -223
  714. package/src/math/shapes/Path.test.ts +0 -309
  715. package/src/math/shapes/Path.toString.test.ts +0 -77
  716. package/src/math/shapes/Path.ts +0 -1027
  717. package/src/math/shapes/PointShape2D.ts +0 -33
  718. package/src/math/shapes/QuadraticBezier.test.ts +0 -31
  719. package/src/math/shapes/QuadraticBezier.ts +0 -141
  720. package/src/math/shapes/Rect2.test.ts +0 -209
  721. package/src/math/shapes/Rect2.ts +0 -344
  722. package/src/math/shapes/Triangle.test.ts +0 -61
  723. package/src/math/shapes/Triangle.ts +0 -139
  724. package/src/rendering/Display.ts +0 -248
  725. package/src/rendering/RenderingStyle.test.ts +0 -68
  726. package/src/rendering/RenderingStyle.ts +0 -55
  727. package/src/rendering/TextRenderingStyle.ts +0 -55
  728. package/src/rendering/caching/CacheRecord.test.ts +0 -49
  729. package/src/rendering/caching/CacheRecord.ts +0 -77
  730. package/src/rendering/caching/CacheRecordManager.ts +0 -71
  731. package/src/rendering/caching/RenderingCache.test.ts +0 -44
  732. package/src/rendering/caching/RenderingCache.ts +0 -66
  733. package/src/rendering/caching/RenderingCacheNode.ts +0 -405
  734. package/src/rendering/caching/testUtils.ts +0 -35
  735. package/src/rendering/caching/types.ts +0 -34
  736. package/src/rendering/lib.ts +0 -8
  737. package/src/rendering/localization.ts +0 -20
  738. package/src/rendering/renderers/AbstractRenderer.ts +0 -242
  739. package/src/rendering/renderers/CanvasRenderer.ts +0 -307
  740. package/src/rendering/renderers/DummyRenderer.test.ts +0 -42
  741. package/src/rendering/renderers/DummyRenderer.ts +0 -145
  742. package/src/rendering/renderers/SVGRenderer.ts +0 -377
  743. package/src/rendering/renderers/TextOnlyRenderer.test.ts +0 -34
  744. package/src/rendering/renderers/TextOnlyRenderer.ts +0 -71
  745. package/src/shortcuts/KeyBinding.test.ts +0 -51
  746. package/src/shortcuts/KeyBinding.ts +0 -218
  747. package/src/shortcuts/KeyboardShortcutManager.test.ts +0 -95
  748. package/src/shortcuts/KeyboardShortcutManager.ts +0 -163
  749. package/src/shortcuts/lib.ts +0 -3
  750. package/src/testing/createEditor.ts +0 -11
  751. package/src/testing/getUniquePointerId.ts +0 -18
  752. package/src/testing/lib.ts +0 -3
  753. package/src/testing/sendPenEvent.ts +0 -36
  754. package/src/testing/sendTouchEvent.ts +0 -71
  755. package/src/toolbar/HTMLToolbar.ts +0 -567
  756. package/src/toolbar/IconProvider.ts +0 -805
  757. package/src/toolbar/lib.ts +0 -4
  758. package/src/toolbar/localization.ts +0 -114
  759. package/src/toolbar/makeColorInput.ts +0 -159
  760. package/src/toolbar/types.ts +0 -5
  761. package/src/toolbar/widgets/ActionButtonWidget.ts +0 -39
  762. package/src/toolbar/widgets/BaseToolWidget.ts +0 -65
  763. package/src/toolbar/widgets/BaseWidget.ts +0 -428
  764. package/src/toolbar/widgets/DocumentPropertiesWidget.ts +0 -234
  765. package/src/toolbar/widgets/EraserToolWidget.ts +0 -85
  766. package/src/toolbar/widgets/HandToolWidget.ts +0 -250
  767. package/src/toolbar/widgets/InsertImageWidget.css +0 -44
  768. package/src/toolbar/widgets/InsertImageWidget.ts +0 -223
  769. package/src/toolbar/widgets/OverflowWidget.ts +0 -92
  770. package/src/toolbar/widgets/PenToolWidget.ts +0 -409
  771. package/src/toolbar/widgets/SelectionToolWidget.ts +0 -197
  772. package/src/toolbar/widgets/TextToolWidget.ts +0 -145
  773. package/src/toolbar/widgets/keybindings.ts +0 -21
  774. package/src/toolbar/widgets/lib.ts +0 -13
  775. package/src/tools/BaseTool.ts +0 -97
  776. package/src/tools/Eraser.test.ts +0 -103
  777. package/src/tools/Eraser.ts +0 -160
  778. package/src/tools/FindTool.ts +0 -153
  779. package/src/tools/PanZoom.test.ts +0 -349
  780. package/src/tools/PanZoom.ts +0 -502
  781. package/src/tools/PasteHandler.ts +0 -95
  782. package/src/tools/Pen.test.ts +0 -262
  783. package/src/tools/Pen.ts +0 -300
  784. package/src/tools/PipetteTool.ts +0 -55
  785. package/src/tools/SelectionTool/SelectAllShortcutHandler.ts +0 -29
  786. package/src/tools/SelectionTool/Selection.ts +0 -611
  787. package/src/tools/SelectionTool/SelectionHandle.ts +0 -108
  788. package/src/tools/SelectionTool/SelectionTool.test.ts +0 -261
  789. package/src/tools/SelectionTool/SelectionTool.ts +0 -496
  790. package/src/tools/SelectionTool/TransformMode.ts +0 -114
  791. package/src/tools/SelectionTool/types.ts +0 -11
  792. package/src/tools/SoundUITool.ts +0 -212
  793. package/src/tools/TextTool.ts +0 -340
  794. package/src/tools/ToolController.ts +0 -200
  795. package/src/tools/ToolEnabledGroup.ts +0 -14
  796. package/src/tools/ToolSwitcherShortcut.ts +0 -39
  797. package/src/tools/ToolbarShortcutHandler.ts +0 -39
  798. package/src/tools/UndoRedoShortcut.test.ts +0 -56
  799. package/src/tools/UndoRedoShortcut.ts +0 -24
  800. package/src/tools/keybindings.ts +0 -85
  801. package/src/tools/lib.ts +0 -22
  802. package/src/tools/localization.ts +0 -74
  803. package/src/tools/tools.css +0 -4
  804. package/src/types.ts +0 -239
  805. package/src/util/assertions.ts +0 -55
  806. package/src/util/fileToBase64.ts +0 -18
  807. package/src/util/untilNextAnimationFrame.ts +0 -9
  808. package/src/util/waitForAll.ts +0 -18
  809. package/src/util/waitForTimeout.ts +0 -9
  810. /package/dist/{cjs/Color4.test.d.ts → mjs/toolbar/widgets/layout/types.mjs} +0 -0
@@ -1,40 +1,74 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ var _IconProvider_instances, _IconProvider_makeXIcon;
17
11
  Object.defineProperty(exports, "__esModule", { value: true });
18
- var Color4_1 = require("../Color4");
19
- var Vec2_1 = require("../math/Vec2");
20
- var SVGRenderer_1 = require("../rendering/renderers/SVGRenderer");
21
- var Viewport_1 = require("../Viewport");
22
- var svgNamespace = 'http://www.w3.org/2000/svg';
23
- var iconColorFill = "\n\tstyle='fill: var(--icon-color);'\n";
24
- var iconColorStrokeFill = "\n\tstyle='fill: var(--icon-color); stroke: var(--icon-color);'\n";
25
- var checkerboardIdCounter = 0;
26
- var makeCheckerboardPattern = function () {
27
- var id = "checkerboard-".concat(checkerboardIdCounter++);
28
- var patternDef = "\n\t\t<pattern\n\t\t\tid='".concat(id, "'\n\t\t\tviewBox='0,0,10,10'\n\t\t\twidth='20%'\n\t\t\theight='20%'\n\t\t\tpatternUnits='userSpaceOnUse'\n\t\t>\n\t\t\t<rect x=0 y=0 width=10 height=10 fill='white'/>\n\t\t\t<rect x=0 y=0 width=5 height=5 fill='gray'/>\n\t\t\t<rect x=5 y=5 width=5 height=5 fill='gray'/>\n\t\t</pattern>\n\t");
29
- var patternRef = "url(#".concat(id, ")");
30
- return { patternDef: patternDef, patternRef: patternRef };
12
+ const math_1 = require("@js-draw/math");
13
+ const SVGRenderer_1 = __importDefault(require("../rendering/renderers/SVGRenderer"));
14
+ const Viewport_1 = __importDefault(require("../Viewport"));
15
+ const FreehandLineBuilder_1 = require("../components/builders/FreehandLineBuilder");
16
+ const svgNamespace = 'http://www.w3.org/2000/svg';
17
+ const iconColorFill = `
18
+ style='fill: var(--icon-color);'
19
+ `;
20
+ const iconColorStrokeFill = `
21
+ style='fill: var(--icon-color); stroke: var(--icon-color);'
22
+ `;
23
+ let checkerboardIdCounter = 0;
24
+ const makeCheckerboardPattern = () => {
25
+ const id = `checkerboard-${checkerboardIdCounter++}`;
26
+ const patternDef = `
27
+ <pattern
28
+ id='${id}'
29
+ viewBox='0,0,10,10'
30
+ width='20%'
31
+ height='20%'
32
+ patternUnits='userSpaceOnUse'
33
+ >
34
+ <rect x='0' y='0' width='10' height='10' fill='white'/>
35
+ <rect x='0' y='0' width='5' height='5' fill='gray'/>
36
+ <rect x='5' y='5' width='5' height='5' fill='gray'/>
37
+ </pattern>
38
+ `;
39
+ const patternRef = `url(#${id})`;
40
+ return { patternDef, patternRef };
41
+ };
42
+ const makeRedoIcon = (mirror) => {
43
+ const icon = document.createElementNS(svgNamespace, 'svg');
44
+ icon.innerHTML = `
45
+ <style>
46
+ .toolbar-svg-undo-redo-icon {
47
+ stroke: var(--icon-color);
48
+ stroke-width: 12;
49
+ stroke-linejoin: round;
50
+ stroke-linecap: round;
51
+ fill: none;
52
+
53
+ transform-origin: center;
54
+ }
55
+ </style>
56
+ <path
57
+ d='M20,20 A15,15 0 0 1 70,80 L80,90 L60,70 L65,90 L87,90 L65,80'
58
+ class='toolbar-svg-undo-redo-icon'
59
+ style='${mirror ? 'transform: scale(-1, 1);' : ''}'/>
60
+ `;
61
+ icon.setAttribute('viewBox', '0 0 100 100');
62
+ return icon;
31
63
  };
32
64
  /**
33
65
  * Provides icons that can be used in the toolbar, etc.
34
66
  * Extend this class and override methods to customize icons.
35
67
  *
36
68
  * @example
37
- * ```ts
69
+ * ```ts,runnable
70
+ * import * as jsdraw from 'js-draw';
71
+ *
38
72
  * class CustomIconProvider extends jsdraw.IconProvider {
39
73
  * // Use '☺' instead of the default dropdown symbol.
40
74
  * public makeDropdownIcon() {
@@ -53,89 +87,208 @@ var makeCheckerboardPattern = function () {
53
87
  * });
54
88
  *
55
89
  * // Add a toolbar that uses these icons
56
- * editor.addToolbar();
90
+ * jsdraw.makeDropdownToolbar(editor).addDefaults();
57
91
  * ```
58
92
  */
59
- var IconProvider = /** @class */ (function () {
60
- function IconProvider() {
93
+ class IconProvider {
94
+ constructor() {
95
+ _IconProvider_instances.add(this);
96
+ }
97
+ makeUndoIcon() {
98
+ return makeRedoIcon(true);
61
99
  }
62
- IconProvider.prototype.makeUndoIcon = function () {
63
- return this.makeRedoIcon(true);
64
- };
65
100
  // @param mirror - reflect across the x-axis. This parameter is internal.
66
101
  // @returns a redo icon.
67
- IconProvider.prototype.makeRedoIcon = function (mirror) {
68
- if (mirror === void 0) { mirror = false; }
69
- var icon = document.createElementNS(svgNamespace, 'svg');
70
- icon.innerHTML = "\n\t\t\t<style>\n\t\t\t\t.toolbar-svg-undo-redo-icon {\n\t\t\t\t\tstroke: var(--icon-color);\n\t\t\t\t\tstroke-width: 12;\n\t\t\t\t\tstroke-linejoin: round;\n\t\t\t\t\tstroke-linecap: round;\n\t\t\t\t\tfill: none;\n\t\n\t\t\t\t\ttransform-origin: center;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<path\n\t\t\t\td='M20,20 A15,15 0 0 1 70,80 L80,90 L60,70 L65,90 L87,90 L65,80'\n\t\t\t\tclass='toolbar-svg-undo-redo-icon'\n\t\t\t\tstyle='".concat(mirror ? 'transform: scale(-1, 1);' : '', "'/>\n\t\t");
71
- icon.setAttribute('viewBox', '0 0 100 100');
72
- return icon;
73
- };
74
- IconProvider.prototype.makeDropdownIcon = function () {
75
- var icon = document.createElementNS(svgNamespace, 'svg');
76
- icon.innerHTML = "\n\t\t<g>\n\t\t\t<path\n\t\t\t\td='M5,10 L50,90 L95,10 Z'\n\t\t\t\t".concat(iconColorFill, "\n\t\t\t/>\n\t\t</g>\n\t\t");
77
- icon.setAttribute('viewBox', '0 0 100 100');
102
+ makeRedoIcon() {
103
+ return makeRedoIcon(false);
104
+ }
105
+ makeDropdownIcon() {
106
+ const icon = document.createElementNS(svgNamespace, 'svg');
107
+ icon.innerHTML = `
108
+ <g>
109
+ <path
110
+ d='M5,10 L50,90 L95,10 Z'
111
+ ${iconColorFill}
112
+ />
113
+ </g>
114
+ `;
115
+ icon.setAttribute('viewBox', '-10 -10 110 110');
78
116
  return icon;
79
- };
80
- IconProvider.prototype.makeEraserIcon = function (eraserSize) {
81
- var icon = document.createElementNS(svgNamespace, 'svg');
82
- eraserSize !== null && eraserSize !== void 0 ? eraserSize : (eraserSize = 10);
83
- var scaledSize = eraserSize / 4;
84
- var eraserColor = '#ff70af';
117
+ }
118
+ makeEraserIcon(eraserSize) {
119
+ const icon = document.createElementNS(svgNamespace, 'svg');
120
+ eraserSize ??= 10;
121
+ const scaledSize = eraserSize / 4;
122
+ const eraserColor = '#ff70af';
85
123
  // Draw an eraser-like shape. Created with Inkscape
86
- icon.innerHTML = "\n\t\t<g>\n\t\t\t<path\n\t\t\t\tstyle=\"fill:".concat(eraserColor, "\"\n\t\t\t\tstroke=\"black\"\n\t\t\t\ttransform=\"rotate(41.35)\"\n\t\t\t\td=\"M 52.5 27\n\t\t\t\t\tC 50 28.9 48.9 31.7 48.9 34.8\n\t\t\t\t\tL 48.9 39.8\n\t\t\t\t\tC 48.9 45.3 53.4 49.8 58.9 49.8\n\t\t\t\t\tL 103.9 49.8\n\t\t\t\t\tC 105.8 49.8 107.6 49.2 109.1 48.3\n\t\t\t\t\tL 110.2 ").concat(scaledSize + 49.5, " L 159.7 ").concat(scaledSize + 5, "\n\t\t\t\t\tL 157.7 ").concat(-scaledSize + 5.2, " L 112.4 ").concat(49.5 - scaledSize, "\n\t\t\t\t\tC 113.4 43.5 113.9 41.7 113.9 39.8\n\t\t\t\t\tL 113.9 34.8\n\t\t\t\t\tC 113.9 29.3 109.4 24.8 103.9 24.8\n\t\t\t\t\tL 58.9 24.8\n\t\t\t\t\tC 56.5 24.8 54.3 25.7 52.5 27\n\t\t\t\t\tz \"\n\t\t\t\tid=\"path438\" />\n\n\t\t\t<rect\n\t\t\t\tstroke=\"#cc8077\"\n\t\t\t\t").concat(iconColorFill, "\n\t\t\t\tid=\"rect218\"\n\t\t\t\twidth=\"65\"\n\t\t\t\theight=\"75\"\n\t\t\t\tx=\"48.9\"\n\t\t\t\ty=\"-38.7\"\n\t\t\t\ttransform=\"rotate(41.35)\" />\n\t\t</g>\n\t\t");
124
+ icon.innerHTML = `
125
+ <g>
126
+ <path
127
+ style="fill:${eraserColor}"
128
+ stroke="black"
129
+ transform="rotate(41.35)"
130
+ d="M 52.5 27
131
+ C 50 28.9 48.9 31.7 48.9 34.8
132
+ L 48.9 39.8
133
+ C 48.9 45.3 53.4 49.8 58.9 49.8
134
+ L 103.9 49.8
135
+ C 105.8 49.8 107.6 49.2 109.1 48.3
136
+ L 110.2 ${scaledSize + 49.5} L 159.7 ${scaledSize + 5}
137
+ L 157.7 ${-scaledSize + 5.2} L 112.4 ${49.5 - scaledSize}
138
+ C 113.4 43.5 113.9 41.7 113.9 39.8
139
+ L 113.9 34.8
140
+ C 113.9 29.3 109.4 24.8 103.9 24.8
141
+ L 58.9 24.8
142
+ C 56.5 24.8 54.3 25.7 52.5 27
143
+ z "
144
+ id="path438" />
145
+
146
+ <rect
147
+ stroke="#cc8077"
148
+ ${iconColorFill}
149
+ id="rect218"
150
+ width="65"
151
+ height="75"
152
+ x="48.9"
153
+ y="-38.7"
154
+ transform="rotate(41.35)" />
155
+ </g>
156
+ `;
87
157
  icon.setAttribute('viewBox', '0 0 120 120');
88
158
  return icon;
89
- };
90
- IconProvider.prototype.makeSelectionIcon = function () {
91
- var icon = document.createElementNS(svgNamespace, 'svg');
159
+ }
160
+ makeSelectionIcon() {
161
+ const icon = document.createElementNS(svgNamespace, 'svg');
92
162
  // Draw a cursor-like shape
93
- icon.innerHTML = "\n\t\t<g>\n\t\t\t<rect x=10 y=10 width=70 height=70 fill='pink' stroke='black'/>\n\t\t\t<rect x=75 y=75 width=10 height=10 fill='white' stroke='black'/>\n\t\t</g>\n\t\t";
163
+ icon.innerHTML = `
164
+ <g>
165
+ <rect x=10 y=10 width=70 height=70 fill='pink' stroke='black'/>
166
+ <rect x=75 y=75 width=10 height=10 fill='white' stroke='black'/>
167
+ </g>
168
+ `;
94
169
  icon.setAttribute('viewBox', '0 0 100 100');
95
170
  return icon;
96
- };
97
- /**
98
- * @param pathData - SVG path data (e.g. `m10,10l30,30z`)
99
- * @param fill - A valid CSS color (e.g. `var(--icon-color)` or `#f0f`). This can be `none`.
100
- */
101
- IconProvider.prototype.makeIconFromPath = function (pathData, fill, strokeColor, strokeWidth) {
102
- if (fill === void 0) { fill = 'var(--icon-color)'; }
103
- if (strokeColor === void 0) { strokeColor = 'none'; }
104
- if (strokeWidth === void 0) { strokeWidth = '0px'; }
105
- var icon = document.createElementNS(svgNamespace, 'svg');
106
- var path = document.createElementNS(svgNamespace, 'path');
107
- path.setAttribute('d', pathData);
108
- path.style.fill = fill;
109
- path.style.stroke = strokeColor;
110
- path.style.strokeWidth = strokeWidth;
111
- icon.appendChild(path);
112
- icon.setAttribute('viewBox', '0 0 100 100');
113
- return icon;
114
- };
115
- IconProvider.prototype.makeHandToolIcon = function () {
116
- var fill = 'none';
117
- var strokeColor = 'var(--icon-color)';
118
- var strokeWidth = '3';
171
+ }
172
+ makeHandToolIcon() {
173
+ const fill = 'none';
174
+ const strokeColor = 'var(--icon-color)';
175
+ const strokeWidth = '3';
119
176
  // Draw a cursor-like shape
120
- return this.makeIconFromPath("\n\t\t\tm 10,60\n\t\t\t\t5,30\n\t\t\tH 90\n\t\t\tV 30\n\t\t\tC 90,20 75,20 75,30\n\t\t\tV 60\n\t\t\t\t20\n\t\t\tC 75,10 60,10 60,20\n\t\t\tV 60\n\t\t\t\t15\n\t\t\tC 60,5 45,5 45,15\n\t\t\tV 60\n\t\t\t\t25\n\t\t\tC 45,15 30,15 30,25\n\t\t\tV 60\n\t\t\t\t75\n\t\t\tL 25,60\n\t\t\tC 20,45 10,50 10,60\n\t\t\tZ\n\t\t", fill, strokeColor, strokeWidth);
121
- };
122
- IconProvider.prototype.makeTouchPanningIcon = function () {
123
- var fill = 'none';
124
- var strokeColor = 'var(--icon-color)';
125
- var strokeWidth = '3';
126
- return this.makeIconFromPath("\n\t\t\tM 5,5.5\n\t\t\tV 17.2\n\t\t\tL 16.25,5.46\n\t\t\tZ\n\t\n\t\t\tm 33.75,0\n\t\t\tL 50,17\n\t\t\tV 5.5\n\t\t\tZ\n\t\n\t\t\tM 5,40.7\n\t\t\tv 11.7\n\t\t\th 11.25\n\t\t\tz\n\t\n\t\t\tM 26,19\n\t\t\tC 19.8,19.4 17.65,30.4 21.9,34.8\n\t\t\tL 50,70\n\t\t\tH 27.5\n\t\t\tc -11.25,0 -11.25,17.6 0,17.6\n\t\t\tH 61.25\n\t\t\tC 94.9,87.8 95,87.6 95,40.7 78.125,23 67,29 55.6,46.5\n\t\t\tL 33.1,23\n\t\t\tC 30.3125,20.128192 27.9,19 25.830078,19.119756\n\t\t\tZ\n\t\t", fill, strokeColor, strokeWidth);
127
- };
128
- IconProvider.prototype.makeAllDevicePanningIcon = function () {
129
- var fill = 'none';
130
- var strokeColor = 'var(--icon-color)';
131
- var strokeWidth = '3';
132
- return this.makeIconFromPath("\n\t\t\tM 5 5\n\t\t\tL 5 17.5\n\t\t\t\t17.5 5\n\t\t\t\t5 5\n\t\t\tz\n\t\n\t\t\tM 42.5 5\n\t\t\tL 55 17.5\n\t\t\t\t55 5\n\t\t\t\t42.5 5\n\t\t\tz\n\t\n\t\t\tM 70 10\n\t\t\tL 70 21\n\t\t\t\t61 15\n\t\t\t\t55.5 23\n\t\t\t\t66 30\n\t\t\t\t56 37\n\t\t\t\t61 45\n\t\t\t\t70 39\n\t\t\t\t70 50\n\t\t\t\t80 50\n\t\t\t\t80 39\n\t\t\t\t89 45\n\t\t\t\t95 36\n\t\t\t\t84 30\n\t\t\t\t95 23\n\t\t\t\t89 15\n\t\t\t\t80 21\n\t\t\t\t80 10\n\t\t\t\t70 10\n\t\t\tz\n\t\n\t\t\tM 27.5 26.25\n\t\t\tL 27.5 91.25\n\t\t\tL 43.75 83.125\n\t\t\tL 52 99\n\t\t\tL 68 91\n\t\t\tL 60 75\n\t\t\tL 76.25 66.875\n\t\t\tL 27.5 26.25\n\t\t\tz\n\t\n\t\t\tM 5 42.5\n\t\t\tL 5 55\n\t\t\tL 17.5 55\n\t\t\tL 5 42.5\n\t\t\tz\n\t\t", fill, strokeColor, strokeWidth);
133
- };
134
- IconProvider.prototype.makeZoomIcon = function () {
135
- var icon = document.createElementNS(svgNamespace, 'svg');
177
+ return this.makeIconFromPath(`
178
+ m 10,60
179
+ 5,30
180
+ H 90
181
+ V 30
182
+ C 90,20 75,20 75,30
183
+ V 60
184
+ 20
185
+ C 75,10 60,10 60,20
186
+ V 60
187
+ 15
188
+ C 60,5 45,5 45,15
189
+ V 60
190
+ 25
191
+ C 45,15 30,15 30,25
192
+ V 60
193
+ 75
194
+ L 25,60
195
+ C 20,45 10,50 10,60
196
+ Z
197
+ `, fill, strokeColor, strokeWidth);
198
+ }
199
+ makeTouchPanningIcon() {
200
+ const fill = 'none';
201
+ const strokeColor = 'var(--icon-color)';
202
+ const strokeWidth = '3';
203
+ return this.makeIconFromPath(`
204
+ M 5,5.5
205
+ V 17.2
206
+ L 16.25,5.46
207
+ Z
208
+
209
+ m 33.75,0
210
+ L 50,17
211
+ V 5.5
212
+ Z
213
+
214
+ M 5,40.7
215
+ v 11.7
216
+ h 11.25
217
+ z
218
+
219
+ M 26,19
220
+ C 19.8,19.4 17.65,30.4 21.9,34.8
221
+ L 50,70
222
+ H 27.5
223
+ c -11.25,0 -11.25,17.6 0,17.6
224
+ H 61.25
225
+ C 94.9,87.8 95,87.6 95,40.7 78.125,23 67,29 55.6,46.5
226
+ L 33.1,23
227
+ C 30.3125,20.128192 27.9,19 25.830078,19.119756
228
+ Z
229
+ `, fill, strokeColor, strokeWidth);
230
+ }
231
+ /** Unused by js-draw. @deprecated */
232
+ makeAllDevicePanningIcon() {
233
+ const fill = 'none';
234
+ const strokeColor = 'var(--icon-color)';
235
+ const strokeWidth = '3';
236
+ return this.makeIconFromPath(`
237
+ M 5 5
238
+ L 5 17.5
239
+ 17.5 5
240
+ 5 5
241
+ z
242
+
243
+ M 42.5 5
244
+ L 55 17.5
245
+ 55 5
246
+ 42.5 5
247
+ z
248
+
249
+ M 70 10
250
+ L 70 21
251
+ 61 15
252
+ 55.5 23
253
+ 66 30
254
+ 56 37
255
+ 61 45
256
+ 70 39
257
+ 70 50
258
+ 80 50
259
+ 80 39
260
+ 89 45
261
+ 95 36
262
+ 84 30
263
+ 95 23
264
+ 89 15
265
+ 80 21
266
+ 80 10
267
+ 70 10
268
+ z
269
+
270
+ M 27.5 26.25
271
+ L 27.5 91.25
272
+ L 43.75 83.125
273
+ L 52 99
274
+ L 68 91
275
+ L 60 75
276
+ L 76.25 66.875
277
+ L 27.5 26.25
278
+ z
279
+
280
+ M 5 42.5
281
+ L 5 55
282
+ L 17.5 55
283
+ L 5 42.5
284
+ z
285
+ `, fill, strokeColor, strokeWidth);
286
+ }
287
+ makeZoomIcon() {
288
+ const icon = document.createElementNS(svgNamespace, 'svg');
136
289
  icon.setAttribute('viewBox', '0 0 100 100');
137
- var addTextNode = function (text, x, y) {
138
- var textNode = document.createElementNS(svgNamespace, 'text');
290
+ const addTextNode = (text, x, y) => {
291
+ const textNode = document.createElementNS(svgNamespace, 'text');
139
292
  textNode.appendChild(document.createTextNode(text));
140
293
  textNode.setAttribute('x', x.toString());
141
294
  textNode.setAttribute('y', y.toString());
@@ -149,122 +302,244 @@ var IconProvider = /** @class */ (function () {
149
302
  addTextNode('+', 40, 45);
150
303
  addTextNode('-', 70, 75);
151
304
  return icon;
152
- };
153
- IconProvider.prototype.makeRotationLockIcon = function () {
154
- var icon = this.makeIconFromPath("\n\t\t\tM 40.1 25.1 \n\t\t\tC 32.5 25 27.9 34.1 27.9 34.1 \n\t\t\tL 25.7 30 \n\t\t\tL 28 44.7 \n\t\t\tL 36.6 40.3 \n\t\t\tL 32.3 38.3 \n\t\t\tC 33.6 28 38.1 25.2 45.1 31.8 \n\t\t\tL 49.4 29.6 \n\t\t\tC 45.9 26.3 42.8 25.1 40.1 25.1 \n\t\t\tz\n\n\t\t\tM 51.7 34.2 \n\t\t\tL 43.5 39.1 \n\t\t\tL 48 40.8 \n\t\t\tC 47.4 51.1 43.1 54.3 35.7 48.2 \n\t\t\tL 31.6 50.7 \n\t\t\tC 45.5 62.1 52.6 44.6 52.6 44.6 \n\t\t\tL 55.1 48.6 \n\t\t\tL 51.7 34.2 \n\t\t\tz\n\n\t\t\tM 56.9 49.9 \n\t\t\tC 49.8 49.9 49.2 57.3 49.3 60.9 \n\t\t\tL 47.6 60.9 \n\t\t\tL 47.6 73.7 \n\t\t\tL 66.1 73.7 \n\t\t\tL 66.1 60.9 \n\t\t\tL 64.4 60.9 \n\t\t\tC 64.5 57.3 63.9 49.9 56.9 49.9 \n\t\t\tz\n\n\t\t\tM 56.9 53.5 \n\t\t\tC 60.8 53.5 61 58.2 60.8 60.9 \n\t\t\tL 52.9 60.9 \n\t\t\tC 52.7 58.2 52.9 53.5 56.9 53.5 \n\t\t\tz\n\t\t");
305
+ }
306
+ makeRotationLockIcon() {
307
+ const icon = this.makeIconFromPath(`
308
+ M 40.1 25.1
309
+ C 32.5 25 27.9 34.1 27.9 34.1
310
+ L 25.7 30
311
+ L 28 44.7
312
+ L 36.6 40.3
313
+ L 32.3 38.3
314
+ C 33.6 28 38.1 25.2 45.1 31.8
315
+ L 49.4 29.6
316
+ C 45.9 26.3 42.8 25.1 40.1 25.1
317
+ z
318
+
319
+ M 51.7 34.2
320
+ L 43.5 39.1
321
+ L 48 40.8
322
+ C 47.4 51.1 43.1 54.3 35.7 48.2
323
+ L 31.6 50.7
324
+ C 45.5 62.1 52.6 44.6 52.6 44.6
325
+ L 55.1 48.6
326
+ L 51.7 34.2
327
+ z
328
+
329
+ M 56.9 49.9
330
+ C 49.8 49.9 49.2 57.3 49.3 60.9
331
+ L 47.6 60.9
332
+ L 47.6 73.7
333
+ L 66.1 73.7
334
+ L 66.1 60.9
335
+ L 64.4 60.9
336
+ C 64.5 57.3 63.9 49.9 56.9 49.9
337
+ z
338
+
339
+ M 56.9 53.5
340
+ C 60.8 53.5 61 58.2 60.8 60.9
341
+ L 52.9 60.9
342
+ C 52.7 58.2 52.9 53.5 56.9 53.5
343
+ z
344
+ `);
155
345
  icon.setAttribute('viewBox', '10 10 70 70');
156
346
  return icon;
157
- };
158
- IconProvider.prototype.makeInsertImageIcon = function () {
159
- return this.makeIconFromPath("\n\t\t\tM 5 10 L 5 90 L 95 90 L 95 10 L 5 10 z\n\t\t\tM 10 15 L 90 15 L 90 50 L 70 75 L 40 50 L 10 75 L 10 15 z\n\t\t\tM 22.5 25 A 7.5 7.5 0 0 0 15 32.5 A 7.5 7.5 0 0 0 22.5 40 A 7.5 7.5 0 0 0 30 32.5 A 7.5 7.5 0 0 0 22.5 25 z \n\t\t");
160
- };
161
- IconProvider.prototype.makeTextIcon = function (textStyle) {
162
- var _a, _b;
163
- var icon = document.createElementNS(svgNamespace, 'svg');
347
+ }
348
+ makeInsertImageIcon() {
349
+ return this.makeIconFromPath(`
350
+ M 5 10 L 5 90 L 95 90 L 95 10 L 5 10 z
351
+ M 10 15 L 90 15 L 90 50 L 70 75 L 40 50 L 10 75 L 10 15 z
352
+ M 22.5 25 A 7.5 7.5 0 0 0 15 32.5 A 7.5 7.5 0 0 0 22.5 40 A 7.5 7.5 0 0 0 30 32.5 A 7.5 7.5 0 0 0 22.5 25 z
353
+ `);
354
+ }
355
+ makeUploadFileIcon() {
356
+ return this.makeIconFromPath(`
357
+ M 48,10 32,34 43,33 42,68
358
+ H 54
359
+ L 53,33 64,34 Z
360
+
361
+ M 8,66 V 86 H 88 V 66 H 78 V 76 H 18 V 66 Z
362
+ `);
363
+ }
364
+ makeTextIcon(textStyle) {
365
+ const icon = document.createElementNS(svgNamespace, 'svg');
164
366
  icon.setAttribute('viewBox', '0 0 100 100');
165
- var textNode = document.createElementNS(svgNamespace, 'text');
367
+ const textNode = document.createElementNS(svgNamespace, 'text');
166
368
  textNode.appendChild(document.createTextNode('T'));
167
369
  textNode.style.fontFamily = textStyle.fontFamily;
168
- textNode.style.fontWeight = (_a = textStyle.fontWeight) !== null && _a !== void 0 ? _a : '';
169
- textNode.style.fontVariant = (_b = textStyle.fontVariant) !== null && _b !== void 0 ? _b : '';
370
+ textNode.style.fontWeight = textStyle.fontWeight ?? '';
371
+ textNode.style.fontVariant = textStyle.fontVariant ?? '';
170
372
  textNode.style.fill = textStyle.renderingStyle.fill.toHexString();
171
373
  textNode.style.textAnchor = 'middle';
172
374
  textNode.setAttribute('x', '50');
173
375
  textNode.setAttribute('y', '75');
174
376
  textNode.style.fontSize = '65px';
175
- textNode.style.filter = 'drop-shadow(0px 0px 10px var(--primary-shadow-color))';
377
+ textNode.style.filter = 'drop-shadow(0px 0px 10px var(--shadow-color))';
176
378
  icon.appendChild(textNode);
177
379
  return icon;
178
- };
179
- IconProvider.prototype.makePenIcon = function (strokeSize, color, rounded) {
180
- if (color instanceof Color4_1.default) {
181
- color = color.toHexString();
182
- }
183
- var icon = document.createElementNS(svgNamespace, 'svg');
380
+ }
381
+ makePenIcon(penStyle) {
382
+ // Use a square-root scale to prevent the pen's tip from overflowing.
383
+ const strokeSize = Math.round(Math.sqrt(penStyle.thickness) * 4);
384
+ const color = penStyle.color;
385
+ const rounded = this.isRoundedTipPen(penStyle);
386
+ const icon = document.createElementNS(svgNamespace, 'svg');
184
387
  icon.setAttribute('viewBox', '0 0 100 100');
185
- var tipThickness = strokeSize / 2;
186
- var inkTipPath = "\n\t\t\tM ".concat(15 - tipThickness, ",").concat(80 - tipThickness, "\n\t\t\t ").concat(15 - tipThickness, ",").concat(80 + tipThickness, "\n\t\t\t 30,83\n\t\t\t 15,65\n\t\t\tZ\n\t\t");
187
- var trailStartEndY = 80 + tipThickness;
188
- var inkTrailPath = "\n\t\t\tm ".concat(15 - tipThickness * 1.1, ",").concat(trailStartEndY, "\n\t\t\tc 35,10 55,15 60,30\n\t\t\tl ").concat(35 + tipThickness * 1.2, ",").concat(-10 - tipThickness, "\n\t\t\tC 80.47,98.32 50.5,").concat(90 + tipThickness, " 20,").concat(trailStartEndY, " Z\n\t\t");
189
- var colorBubblePath = "\n\t\t\tM 72.45,35.67\n\t\t\tA 10,15 41.8 0 1 55,40.2 10,15 41.8 0 1 57.55,22.3 10,15 41.8 0 1 75,17.8 10,15 41.8 0 1 72.5,35.67\n\t\t\tZ\n\t\t";
190
- var gripMainPath = 'M 85,-25 25,35 h 10 v 10 h 10 v 10 h 10 v 10 h 10 l -5,10 60,-60 z';
191
- var gripShadow1Path = 'M 25,35 H 35 L 90,-15 85,-25 Z';
192
- var gripShadow2Path = 'M 60,75 65,65 H 55 l 55,-55 10,5 z';
388
+ const tipThickness = strokeSize / 2;
389
+ const inkTipPath = `
390
+ M ${15 - tipThickness},${80 - tipThickness}
391
+ ${15 - tipThickness},${80 + tipThickness}
392
+ 30,83
393
+ 15,65
394
+ Z
395
+ `;
396
+ const trailStartEndY = 80 + tipThickness;
397
+ const inkTrailPath = `
398
+ m ${15 - tipThickness * 1.1},${trailStartEndY}
399
+ c 35,10 55,15 60,30
400
+ l ${35 + tipThickness * 1.2},${-10 - tipThickness}
401
+ C 80.47,98.32 50.5,${90 + tipThickness} 20,${trailStartEndY} Z
402
+ `;
403
+ const colorBubblePath = `
404
+ M 72.45,35.67
405
+ A 10,15 41.8 0 1 55,40.2 10,15 41.8 0 1 57.55,22.3 10,15 41.8 0 1 75,17.8 10,15 41.8 0 1 72.5,35.67
406
+ Z
407
+ `;
408
+ let gripMainPath = 'M 85,-25 25,35 h 10 v 10 h 10 v 10 h 10 v 10 h 10 l -5,10 60,-60 z';
409
+ let gripShadow1Path = 'M 25,35 H 35 L 90,-15 85,-25 Z';
410
+ let gripShadow2Path = 'M 60,75 65,65 H 55 l 55,-55 10,5 z';
193
411
  if (rounded) {
194
412
  gripMainPath = 'M 85,-25 25,35 c 15,0 40,30 35,40 l 60,-60 z';
195
413
  gripShadow1Path = 'm 25,35 c 3.92361,0.384473 7.644275,0.980572 10,3 l 55,-53 -5,-10 z';
196
414
  gripShadow2Path = 'M 60,75 C 61,66 59,65 56,59 l 54,-54 10,10 z';
197
415
  }
198
- var penTipPath = "M 25,35 ".concat(10 - tipThickness / 4, ",").concat(70 - tipThickness / 2, " 20,75 25,85 60,75 70,55 45,25 Z");
199
- var pencilTipColor = Color4_1.default.fromHex('#f4d7d7');
200
- var tipColor = pencilTipColor.mix(Color4_1.default.fromString(color), tipThickness / 40 - 0.1).toHexString();
201
- var checkerboardPattern = makeCheckerboardPattern();
202
- var ink = "\n\t\t\t<path\n\t\t\t\tfill=\"".concat(checkerboardPattern.patternRef, "\"\n\t\t\t\td=\"").concat(inkTipPath, "\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"").concat(checkerboardPattern.patternRef, "\"\n\t\t\t\td=\"").concat(inkTrailPath, "\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"").concat(color, "\"\n\t\t\t\td=\"").concat(inkTipPath, "\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"").concat(color, "\"\n\t\t\t\td=\"").concat(inkTrailPath, "\"\n\t\t\t/>\n\t\t");
203
- var penTip = "\n\t\t\t<path\n\t\t\t\tfill=\"".concat(checkerboardPattern.patternRef, "\"\n\t\t\t\td=\"").concat(penTipPath, "\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"").concat(tipColor, "\"\n\t\t\t\tstroke=\"").concat(color, "\"\n\t\t\t\td=\"").concat(penTipPath, "\"\n\t\t\t/>\n\t\t");
204
- var grip = "\n\t\t\t<path\n\t\t\t\t".concat(iconColorStrokeFill, "\n\t\t\t\td=\"").concat(gripMainPath, "\"\n\t\t\t/>\n\n\t\t\t<!-- shadows -->\n\t\t\t<path\n\t\t\t\tfill=\"rgba(150, 150, 150, 0.3)\"\n\t\t\t\td=\"").concat(gripShadow1Path, "\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"rgba(100, 100, 100, 0.2)\"\n\t\t\t\td=\"").concat(gripShadow2Path, "\"\n\t\t\t/>\n\n\t\t\t<!-- color bubble -->\n\t\t\t<path\n\t\t\t\tfill=\"").concat(checkerboardPattern.patternRef, "\"\n\t\t\t\td=\"").concat(colorBubblePath, "\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"").concat(color, "\"\n\t\t\t\td=\"").concat(colorBubblePath, "\"\n\t\t\t/>\n\t\t");
205
- icon.innerHTML = "\n\t\t<defs>\n\t\t\t".concat(checkerboardPattern.patternDef, "\n\t\t</defs>\n\t\t<g>\n\t\t\t").concat(ink, "\n\t\t\t").concat(penTip, "\n\t\t\t").concat(grip, "\n\t\t</g>\n\t\t");
416
+ const penTipPath = `M 25,35 ${10 - tipThickness / 4},${70 - tipThickness / 2} 20,75 25,85 60,75 70,55 45,25 Z`;
417
+ const pencilTipColor = math_1.Color4.fromHex('#f4d7d7');
418
+ const tipColor = pencilTipColor.mix(color, tipThickness / 40 - 0.1).toHexString();
419
+ const checkerboardPattern = makeCheckerboardPattern();
420
+ const ink = `
421
+ <path
422
+ fill="${checkerboardPattern.patternRef}"
423
+ d="${inkTipPath}"
424
+ />
425
+ <path
426
+ fill="${checkerboardPattern.patternRef}"
427
+ d="${inkTrailPath}"
428
+ />
429
+ <path
430
+ fill="${color}"
431
+ d="${inkTipPath}"
432
+ />
433
+ <path
434
+ fill="${color}"
435
+ d="${inkTrailPath}"
436
+ />
437
+ `;
438
+ const penTip = `
439
+ <path
440
+ fill="${checkerboardPattern.patternRef}"
441
+ d="${penTipPath}"
442
+ />
443
+ <path
444
+ fill="${tipColor}"
445
+ stroke="${color}"
446
+ d="${penTipPath}"
447
+ />
448
+ `;
449
+ const grip = `
450
+ <path
451
+ ${iconColorStrokeFill}
452
+ d="${gripMainPath}"
453
+ />
454
+
455
+ <!-- shadows -->
456
+ <path
457
+ fill="rgba(150, 150, 150, 0.3)"
458
+ d="${gripShadow1Path}"
459
+ />
460
+ <path
461
+ fill="rgba(100, 100, 100, 0.2)"
462
+ d="${gripShadow2Path}"
463
+ />
464
+
465
+ <!-- color bubble -->
466
+ <path
467
+ fill="${checkerboardPattern.patternRef}"
468
+ d="${colorBubblePath}"
469
+ />
470
+ <path
471
+ fill="${color}"
472
+ d="${colorBubblePath}"
473
+ />
474
+ `;
475
+ icon.innerHTML = `
476
+ <defs>
477
+ ${checkerboardPattern.patternDef}
478
+ </defs>
479
+ <g>
480
+ ${ink}
481
+ ${penTip}
482
+ ${grip}
483
+ </g>
484
+ `;
206
485
  return icon;
207
- };
208
- IconProvider.prototype.makeIconFromFactory = function (pen, factory,
209
- // If true, attempts to guess the location of a transparency grid
210
- includeTransparencyGrid) {
211
- if (includeTransparencyGrid === void 0) { includeTransparencyGrid = false; }
486
+ }
487
+ makeIconFromFactory(penStyle) {
212
488
  // Increase the thickness we use to generate the icon less with larger actual thicknesses.
213
489
  // We want the icon to be recognisable with a large range of thicknesses.
214
- var thickness = Math.sqrt(pen.getThickness()) * 3;
215
- var nowTime = (new Date()).getTime();
216
- var startPoint = {
217
- pos: Vec2_1.Vec2.of(10, 10),
490
+ const thickness = Math.sqrt(penStyle.thickness) * 3;
491
+ const nowTime = performance.now();
492
+ const startPoint = {
493
+ pos: math_1.Vec2.of(10, 10),
218
494
  width: thickness,
219
- color: pen.getColor(),
495
+ color: penStyle.color,
220
496
  time: nowTime - 100,
221
497
  };
222
- var endPoint = {
223
- pos: Vec2_1.Vec2.of(90, 90),
498
+ const endPoint = {
499
+ pos: math_1.Vec2.of(90, 90),
224
500
  width: thickness,
225
- color: pen.getColor(),
501
+ color: penStyle.color,
226
502
  time: nowTime,
227
503
  };
228
- var viewport = new Viewport_1.default(function () { });
229
- var builder = factory(startPoint, viewport);
504
+ const viewport = new Viewport_1.default(() => { });
505
+ const builder = penStyle.factory(startPoint, viewport);
230
506
  builder.addPoint(endPoint);
231
- var icon = document.createElementNS(svgNamespace, 'svg');
507
+ const icon = document.createElementNS(svgNamespace, 'svg');
232
508
  icon.setAttribute('viewBox', '0 0 100 100');
233
- viewport.updateScreenSize(Vec2_1.Vec2.of(100, 100));
234
- var renderer;
509
+ viewport.updateScreenSize(math_1.Vec2.of(100, 100));
510
+ let renderer;
511
+ // Any transparency? Include a checkerboard grid.
512
+ const includeTransparencyGrid = penStyle.color.a < 1;
235
513
  if (includeTransparencyGrid) {
236
- var checkerboardPattern_1 = makeCheckerboardPattern();
237
- var defs = document.createElementNS(svgNamespace, 'defs');
238
- defs.innerHTML = checkerboardPattern_1.patternDef;
514
+ const checkerboardPattern = makeCheckerboardPattern();
515
+ const defs = document.createElementNS(svgNamespace, 'defs');
516
+ defs.innerHTML = checkerboardPattern.patternDef;
239
517
  icon.appendChild(defs);
240
- var background_1 = document.createElementNS(svgNamespace, 'g');
241
- icon.appendChild(background_1);
242
- renderer = new /** @class */ (function (_super) {
243
- __extends(class_1, _super);
244
- function class_1() {
245
- return _super.call(this, icon, viewport) || this;
518
+ const background = document.createElementNS(svgNamespace, 'g');
519
+ icon.appendChild(background);
520
+ renderer = new class extends SVGRenderer_1.default {
521
+ constructor() {
522
+ super(icon, viewport);
246
523
  }
247
- class_1.prototype.addPathToSVG = function () {
248
- var addedPath = _super.prototype.addPathToSVG.call(this);
524
+ addPathToSVG() {
525
+ const addedPath = super.addPathToSVG();
249
526
  if (addedPath) {
250
527
  // Add a copy of the path on the background
251
- var copy = addedPath.cloneNode(true);
528
+ const copy = addedPath.cloneNode(true);
252
529
  copy.style.zIndex = '-1';
253
- // Make the
254
- if (copy.hasAttribute('fill')
255
- && copy.getAttribute('fill') !== 'transparent'
256
- && copy.getAttribute('fill') !== 'none') {
257
- copy.setAttribute('fill', checkerboardPattern_1.patternRef);
258
- }
259
530
  if (copy.hasAttribute('stroke')) {
260
- copy.setAttribute('stroke', checkerboardPattern_1.patternRef);
531
+ copy.setAttribute('stroke', checkerboardPattern.patternRef);
261
532
  }
262
- background_1.appendChild(copy);
533
+ // Note: Assumes that the component wouldn't normally be both stroked
534
+ // and filled.
535
+ else if (copy.hasAttribute('fill')) {
536
+ copy.setAttribute('fill', checkerboardPattern.patternRef);
537
+ }
538
+ background.appendChild(copy);
263
539
  }
264
540
  return addedPath;
265
- };
266
- return class_1;
267
- }(SVGRenderer_1.default))();
541
+ }
542
+ }();
268
543
  }
269
544
  else {
270
545
  renderer = new SVGRenderer_1.default(icon, viewport);
@@ -272,69 +547,222 @@ var IconProvider = /** @class */ (function () {
272
547
  builder.preview(renderer);
273
548
  // If only a single path was rendered, try to give it a checkerboard background to
274
549
  // emphasize transparency. TODO: This is very fragile
275
- var bbox = builder.getBBox();
276
- icon.setAttribute('viewBox', "".concat(bbox.x, " ").concat(bbox.y, " ").concat(bbox.w, " ").concat(bbox.h));
550
+ const bbox = builder.getBBox();
551
+ icon.setAttribute('viewBox', `${bbox.x} ${bbox.y} ${bbox.w} ${bbox.h}`);
277
552
  return icon;
278
- };
279
- IconProvider.prototype.makePipetteIcon = function (color) {
280
- var icon = document.createElementNS(svgNamespace, 'svg');
281
- var pipette = document.createElementNS(svgNamespace, 'path');
282
- pipette.setAttribute('d', "\n\t\t\tM 47,6\n\t\t\tC 35,5 25,15 35,30\n\t\t\tc -9.2,1.3 -15,0 -15,3\n\t\t\t\t0,2 5,5 15,7\n\t\t\tV 81\n\t\t\tL 40,90\n\t\t\th 6\n\t\t\tL 40,80\n\t\t\tV 40\n\t\t\th 15\n\t\t\tv 40\n\t\t\tl -6,10\n\t\t\th 6\n\t\t\tl 5,-9.2\n\t\t\tV 40\n\t\t\tC 70,38 75,35 75,33\n\t\t\t\t75,30 69.2,31.2 60,30\n\t\t\t\t65,15 65,5 47,6\n\t\t\tZ\n\t\t");
283
- pipette.style.fill = 'var(--icon-color)';
553
+ }
554
+ makePipetteIcon(color) {
555
+ const icon = document.createElementNS(svgNamespace, 'svg');
556
+ const mainGroup = document.createElementNS(svgNamespace, 'g');
557
+ mainGroup.style.rotate = '45deg';
558
+ mainGroup.style.transformOrigin = 'center';
559
+ const pipette = document.createElementNS(svgNamespace, 'g');
560
+ pipette.innerHTML = `
561
+ <path
562
+ style="fill: var(--icon-color); stroke-linecap:round; stroke-linejoin:round;"
563
+ d="
564
+ m 32,12 v 68
565
+ c 0,1 0.5,2 1.33,2.5 1.67,1.15 3.67,2.1 5.17,3.2 1.4,1.1 2.3,2.1 2.5,3.1 0.6,2.1 1,4.6 1,6.2 0,3.7 5.45,4.1 6,0.4 l 0.9,-6.8
566
+ c 0.3,-0.9 1.1,-1.9 2.6,-2.9 1.5,-1.1 3.4,-2 5.1,-3.2
567
+ C 57.5,82 58,81 58,80
568
+ V 12 Z m 20,25 v 41.3
569
+ c 0,1.7 -2.5,1.6 -4,2.7 -1,0.76 -2.1,1.5 -3,2.6
570
+ C 44,82.5 43.02,81.75 42,81 40.51,79.92 38,80 38,78.34
571
+ V 51 Z
572
+ "
573
+ />
574
+ <rect
575
+ style="fill: var(--icon-color);"
576
+ width="32"
577
+ height="9"
578
+ x="29"
579
+ y="2"
580
+ ry="4.5"
581
+ />
582
+ <path
583
+ style="fill: var(--icon-color);"
584
+ d="m 45,-25 c -5.54,0 -11,4.26 -11,9 V 0 h 22 v -16 c 0,-4.74 -5.46,-9 -11,-9 z"
585
+ />
586
+ `;
284
587
  if (color) {
285
- var checkerboardPattern = makeCheckerboardPattern();
286
- var defs = document.createElementNS(svgNamespace, 'defs');
588
+ const checkerboardPattern = makeCheckerboardPattern();
589
+ const defs = document.createElementNS(svgNamespace, 'defs');
287
590
  defs.innerHTML = checkerboardPattern.patternDef;
288
591
  icon.appendChild(defs);
289
- var fluidBackground = document.createElementNS(svgNamespace, 'path');
290
- var fluid = document.createElementNS(svgNamespace, 'path');
291
- var fluidPathData = "\n\t\t\t\tm 40,50 c 5,5 10,0 15,-5 V 80 L 50,90 H 45 L 40,80 Z\n\t\t\t";
592
+ const fluidBackground = document.createElementNS(svgNamespace, 'path');
593
+ const fluid = document.createElementNS(svgNamespace, 'path');
594
+ const fluidPathData = `
595
+ M 35,36 H 55 V 78.678012 83 L 45,87 35,83 Z
596
+ `;
292
597
  fluid.setAttribute('d', fluidPathData);
293
598
  fluidBackground.setAttribute('d', fluidPathData);
294
599
  fluid.style.fill = color.toHexString();
295
600
  fluidBackground.style.fill = checkerboardPattern.patternRef;
296
- icon.appendChild(fluidBackground);
297
- icon.appendChild(fluid);
601
+ mainGroup.appendChild(fluidBackground);
602
+ mainGroup.appendChild(fluid);
298
603
  }
299
- icon.appendChild(pipette);
300
- icon.setAttribute('viewBox', '0 0 100 100');
604
+ mainGroup.appendChild(pipette);
605
+ icon.appendChild(mainGroup);
606
+ icon.setAttribute('viewBox', '5 -40 140 140');
301
607
  return icon;
302
- };
303
- IconProvider.prototype.makeFormatSelectionIcon = function () {
304
- return this.makeIconFromPath("\n\t\t\tM 5 10\n\t\t\tL 5 20 L 10 20 L 10 15 L 20 15 L 20 40 L 15 40 L 15 45 L 35 45 L 35 40 L 30 40 L 30 15 L 40 15 L 40 20 L 45 20 L 45 15 L 45 10 L 5 10 z\n\t\t\tM 90 10 C 90 10 86.5 13.8 86 14 C 86 14 76.2 24.8 76 25 L 60 25 L 60 65 C 75 70 85 70 90 65 L 90 25 L 80 25 L 76.7 25 L 90 10 z\n\t\t\tM 60 25 L 55 25 L 50 30 L 60 25 z\n\t\t\tM 10 55 L 10 90 L 41 90 L 41 86 L 45 86 L 45 55 L 10 55 z\n\t\t\tM 42 87 L 42 93 L 48 93 L 48 87 L 42 87 z \n\t\t");
305
- };
306
- IconProvider.prototype.makeResizeViewportIcon = function () {
307
- return this.makeIconFromPath("\n\t\t\tM 75 5 75 10 90 10 90 25 95 25 95 5 75 5 z\n\t\t\tM 15 15 15 30 20 30 20 20 30 20 30 15 15 15 z\n\t\t\tM 84 15 82 17 81 16 81 20 85 20 84 19 86 17 84 15 z\n\t\t\tM 26 24 24 26 26 28 25 29 29 29 29 25 28 26 26 24 z\n\t\t\tM 25 71 26 72 24 74 26 76 28 74 29 75 29 71 25 71 z\n\t\t\tM 15 75 15 85 25 85 25 80 20 80 20 75 15 75 z\n\t\t\tM 90 75 90 90 75 90 75 95 95 95 95 75 90 75 z\n\t\t\tM 81 81 81 85 82 84 84 86 86 84 84 82 85 81 81 81 z\n\t\t");
308
- };
309
- IconProvider.prototype.makeDuplicateSelectionIcon = function () {
310
- return this.makeIconFromPath("\n\t\t\tM 45,10 45,55 90,55 90,10 45,10 z\n\t\t\tM 10,25 10,90 70,90 70,60 40,60 40,25 10,25 z \n\t\t");
311
- };
312
- IconProvider.prototype.makePasteIcon = function () {
313
- var icon = this.makeIconFromPath("\n\t\t\tM 50 0 L 50 5 L 35 5 L 40 24.75 L 20 25 L 20 100 L 85 100 L 100 90 L 100 24 L 75.1 24.3 L 80 5 L 65 5 L 65 0 L 50 0 z\n\t\t\tM 10 15 L 10 115 L 110 115 L 110 15 L 85 15 L 83 20 L 105 20 L 105 110 L 15 110 L 15 20 L 32 20 L 30 15 L 10 15 z\n\t\t\tM 25 35 L 90 35 L 90 40 L 25 40 L 25 35 z\n\t\t\tM 25 45 L 90 45 L 90 50 L 25 50 L 25 45 z\n\t\t\tM 25 55 L 85 55 L 85 60 L 25 60 L 25 55 z\n\t\t\tM 25 65 L 90 65 L 90 70 L 25 70 L 25 65 z \n\t\t");
608
+ }
609
+ /** Unused. @deprecated */
610
+ makeFormatSelectionIcon() {
611
+ return this.makeIconFromPath(`
612
+ M 5 10
613
+ L 5 20 L 10 20 L 10 15 L 20 15 L 20 40 L 15 40 L 15 45 L 35 45 L 35 40 L 30 40 L 30 15 L 40 15 L 40 20 L 45 20 L 45 15 L 45 10 L 5 10 z
614
+ M 90 10 C 90 10 86.5 13.8 86 14 C 86 14 76.2 24.8 76 25 L 60 25 L 60 65 C 75 70 85 70 90 65 L 90 25 L 80 25 L 76.7 25 L 90 10 z
615
+ M 60 25 L 55 25 L 50 30 L 60 25 z
616
+ M 10 55 L 10 90 L 41 90 L 41 86 L 45 86 L 45 55 L 10 55 z
617
+ M 42 87 L 42 93 L 48 93 L 48 87 L 42 87 z
618
+ `);
619
+ }
620
+ makeResizeImageToSelectionIcon() {
621
+ return this.makeIconFromPath(`
622
+ M 75 5 75 10 90 10 90 25 95 25 95 5 75 5 z
623
+ M 15 15 15 30 20 30 20 20 30 20 30 15 15 15 z
624
+ M 84 15 82 17 81 16 81 20 85 20 84 19 86 17 84 15 z
625
+ M 26 24 24 26 26 28 25 29 29 29 29 25 28 26 26 24 z
626
+ M 25 71 26 72 24 74 26 76 28 74 29 75 29 71 25 71 z
627
+ M 15 75 15 85 25 85 25 80 20 80 20 75 15 75 z
628
+ M 90 75 90 90 75 90 75 95 95 95 95 75 90 75 z
629
+ M 81 81 81 85 82 84 84 86 86 84 84 82 85 81 81 81 z
630
+ `);
631
+ }
632
+ /** Renamed to {@link makeResizeImageToSelectionIcon} @deprecated */
633
+ makeResizeViewportIcon() {
634
+ return this.makeResizeImageToSelectionIcon();
635
+ }
636
+ makeDuplicateSelectionIcon() {
637
+ return this.makeIconFromPath(`
638
+ M 45,10 45,55 90,55 90,10 45,10 z
639
+ M 10,25 10,90 70,90 70,60 40,60 40,25 10,25 z
640
+ `);
641
+ }
642
+ /** Unused. @deprecated */
643
+ makePasteIcon() {
644
+ const icon = this.makeIconFromPath(`
645
+ M 50 0 L 50 5 L 35 5 L 40 24.75 L 20 25 L 20 100 L 85 100 L 100 90 L 100 24 L 75.1 24.3 L 80 5 L 65 5 L 65 0 L 50 0 z
646
+ M 10 15 L 10 115 L 110 115 L 110 15 L 85 15 L 83 20 L 105 20 L 105 110 L 15 110 L 15 20 L 32 20 L 30 15 L 10 15 z
647
+ M 25 35 L 90 35 L 90 40 L 25 40 L 25 35 z
648
+ M 25 45 L 90 45 L 90 50 L 25 50 L 25 45 z
649
+ M 25 55 L 85 55 L 85 60 L 25 60 L 25 55 z
650
+ M 25 65 L 90 65 L 90 70 L 25 70 L 25 65 z
651
+ `);
314
652
  icon.setAttribute('viewBox', '0 0 120 120');
315
653
  return icon;
316
- };
317
- IconProvider.prototype.makeDeleteSelectionIcon = function () {
318
- var strokeWidth = '5px';
319
- var strokeColor = 'var(--icon-color)';
320
- var fillColor = 'none';
321
- return this.makeIconFromPath("\n\t\t\tM 10,10 90,90\n\t\t\tM 10,90 90,10\n\t\t", fillColor, strokeColor, strokeWidth);
322
- };
323
- IconProvider.prototype.makeSaveIcon = function () {
324
- var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
325
- svg.innerHTML = "\n\t\t\t<style>\n\t\t\t\t.toolbar-save-icon {\n\t\t\t\t\tstroke: var(--icon-color);\n\t\t\t\t\tstroke-width: 10;\n\t\t\t\t\tstroke-linejoin: round;\n\t\t\t\t\tstroke-linecap: round;\n\t\t\t\t\tfill: none;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<path\n\t\t\t\td='\n\t\t\t\t\tM 15,55 30,70 85,20\n\t\t\t\t'\n\t\t\t\tclass='toolbar-save-icon'\n\t\t\t/>\n\t\t";
654
+ }
655
+ makeDeleteSelectionIcon() {
656
+ return __classPrivateFieldGet(this, _IconProvider_instances, "m", _IconProvider_makeXIcon).call(this);
657
+ }
658
+ makeCloseIcon() {
659
+ return __classPrivateFieldGet(this, _IconProvider_instances, "m", _IconProvider_makeXIcon).call(this);
660
+ }
661
+ makeSaveIcon() {
662
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
663
+ svg.innerHTML = `
664
+ <style>
665
+ .toolbar-save-icon {
666
+ stroke: var(--icon-color);
667
+ stroke-width: 6;
668
+ stroke-linejoin: round;
669
+ stroke-linecap: round;
670
+ fill: none;
671
+ }
672
+ </style>
673
+ <path
674
+ d='
675
+ M 15,55 30,70 85,20
676
+ '
677
+ class='toolbar-save-icon'
678
+ />
679
+ `;
326
680
  svg.setAttribute('viewBox', '0 0 100 100');
327
681
  return svg;
328
- };
329
- IconProvider.prototype.makeConfigureDocumentIcon = function () {
330
- var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
331
- svg.innerHTML = "\n\t\t\t<path\n\t\t\t\td='\n\t\t\t\t\tM 5,5 V 95 H 95 V 5 Z m 5,5 H 90 V 90 H 10 Z\n\t\t\t\t\tm 5,10 V 30 H 50 V 25 H 20 v -5 z\n\t\t\t\t\tm 40,0 V 50 H 85 V 20 Z\n\t\t\t\t\tm 2,2 H 83 V 39 L 77,28 70,42 64,35 57,45 Z\n\t\t\t\t\tm 8.5,5 C 64.67,27 64,27.67 64,28.5 64,29.33 64.67,30 65.5,30 66.33,30 67,29.33 67,28.5 67,27.67 66.33,27 65.5,27 Z\n\t\t\t\t\tM 15,40 v 5 h 35 v -5 z\n\t\t\t\t\tm 0,15 v 5 h 70 v -5 z\n\t\t\t\t\tm 0,15 v 5 h 70 v -5 z\n\t\t\t\t'\n\t\t\t\tstyle='fill: var(--icon-color);'\n\t\t\t/>\n\t\t";
682
+ }
683
+ makeConfigureDocumentIcon() {
684
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
685
+ svg.innerHTML = `
686
+ <path
687
+ d='
688
+ M 5,5 V 95 H 95 V 5 Z m 5,5 H 90 V 90 H 10 Z
689
+ m 5,10 V 30 H 50 V 25 H 20 v -5 z
690
+ m 40,0 V 50 H 85 V 20 Z
691
+ m 2,2 H 83 V 39 L 77,28 70,42 64,35 57,45 Z
692
+ m 8.5,5 C 64.67,27 64,27.67 64,28.5 64,29.33 64.67,30 65.5,30 66.33,30 67,29.33 67,28.5 67,27.67 66.33,27 65.5,27 Z
693
+ M 15,40 v 5 h 35 v -5 z
694
+ m 0,15 v 5 h 70 v -5 z
695
+ m 0,15 v 5 h 70 v -5 z
696
+ '
697
+ style='fill: var(--icon-color);'
698
+ />
699
+ `;
332
700
  svg.setAttribute('viewBox', '0 0 100 100');
333
701
  return svg;
334
- };
335
- IconProvider.prototype.makeOverflowIcon = function () {
336
- return this.makeIconFromPath("\n\t\t\tM 15 40\n\t\t\tA 12.5 12.5 0 0 0 2.5 52.5\n\t\t\tA 12.5 12.5 0 0 0 15 65\n\t\t\tA 12.5 12.5 0 0 0 27.5 52.5\n\t\t\tA 12.5 12.5 0 0 0 15 40\n\t\t\tz\n\t\n\t\t\tM 50 40\n\t\t\tA 12.5 12.5 0 0 0 37.5 52.5\n\t\t\tA 12.5 12.5 0 0 0 50 65\n\t\t\tA 12.5 12.5 0 0 0 62.5 52.5\n\t\t\tA 12.5 12.5 0 0 0 50 40\n\t\t\tz\n\t\t\t\n\t\t\tM 85 40\n\t\t\tA 12.5 12.5 0 0 0 72.5 52.5\n\t\t\tA 12.5 12.5 0 0 0 85 65\n\t\t\tA 12.5 12.5 0 0 0 97.5 52.5\n\t\t\tA 12.5 12.5 0 0 0 85 40\n\t\t\tz\n\t\t");
337
- };
338
- return IconProvider;
339
- }());
702
+ }
703
+ makeOverflowIcon() {
704
+ return this.makeIconFromPath(`
705
+ M 15 40
706
+ A 12.5 12.5 0 0 0 2.5 52.5
707
+ A 12.5 12.5 0 0 0 15 65
708
+ A 12.5 12.5 0 0 0 27.5 52.5
709
+ A 12.5 12.5 0 0 0 15 40
710
+ z
711
+
712
+ M 50 40
713
+ A 12.5 12.5 0 0 0 37.5 52.5
714
+ A 12.5 12.5 0 0 0 50 65
715
+ A 12.5 12.5 0 0 0 62.5 52.5
716
+ A 12.5 12.5 0 0 0 50 40
717
+ z
718
+
719
+ M 85 40
720
+ A 12.5 12.5 0 0 0 72.5 52.5
721
+ A 12.5 12.5 0 0 0 85 65
722
+ A 12.5 12.5 0 0 0 97.5 52.5
723
+ A 12.5 12.5 0 0 0 85 40
724
+ z
725
+ `);
726
+ }
727
+ /**
728
+ * @param pathData - SVG path data (e.g. `m10,10l30,30z`)
729
+ * @param fill - A valid CSS color (e.g. `var(--icon-color)` or `#f0f`). This can be `none`.
730
+ */
731
+ makeIconFromPath(pathData, fill = 'var(--icon-color)', strokeColor = 'none', strokeWidth = '0px') {
732
+ const icon = document.createElementNS(svgNamespace, 'svg');
733
+ const path = document.createElementNS(svgNamespace, 'path');
734
+ path.setAttribute('d', pathData);
735
+ path.style.fill = fill;
736
+ path.style.stroke = strokeColor;
737
+ path.style.strokeWidth = strokeWidth;
738
+ icon.appendChild(path);
739
+ icon.setAttribute('viewBox', '0 0 100 100');
740
+ return icon;
741
+ }
742
+ /**
743
+ * @returns An object with both the definition of a checkerboard pattern and the syntax to
744
+ * reference that pattern. The defs provided by this function should be wrapped within a
745
+ * `<defs></defs>` element.
746
+ */
747
+ makeCheckerboardPattern() {
748
+ return makeCheckerboardPattern();
749
+ }
750
+ /**
751
+ * @returns true if the given `penStyle` is known to match a rounded tip type of pen.
752
+ */
753
+ isRoundedTipPen(penStyle) {
754
+ return penStyle.factory === FreehandLineBuilder_1.makeFreehandLineBuilder;
755
+ }
756
+ /** Must be overridden by icon packs that need attribution. */
757
+ licenseInfo() { return null; }
758
+ }
759
+ _IconProvider_instances = new WeakSet(), _IconProvider_makeXIcon = function _IconProvider_makeXIcon() {
760
+ const strokeWidth = '6px';
761
+ const strokeColor = 'var(--icon-color)';
762
+ const fillColor = 'none';
763
+ return this.makeIconFromPath(`
764
+ M 15,15 85,85
765
+ M 15,85 85,15
766
+ `, fillColor, strokeColor, strokeWidth);
767
+ };
340
768
  exports.default = IconProvider;