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