js-draw 0.17.4 → 0.18.1

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 (413) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/bundle.js +9 -1
  3. package/package.json +35 -33
  4. package/tsconfig.json +3 -2
  5. package/tsconfig.mjs.json +9 -0
  6. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
  7. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  8. package/.github/ISSUE_TEMPLATE/translation.yml +0 -902
  9. package/.github/pull_request_template.md +0 -15
  10. package/.github/workflows/firebase-hosting-merge.yml +0 -32
  11. package/.github/workflows/firebase-hosting-pull-request.yml +0 -32
  12. package/.github/workflows/github-pages.yml +0 -56
  13. package/.husky/pre-commit +0 -4
  14. package/build_tools/BundledFile.ts +0 -167
  15. package/build_tools/buildTranslationTemplate.ts +0 -121
  16. package/build_tools/bundle.ts +0 -11
  17. package/dist/build_tools/BundledFile.d.ts +0 -13
  18. package/dist/build_tools/BundledFile.js +0 -157
  19. package/dist/build_tools/buildTranslationTemplate.d.ts +0 -1
  20. package/dist/build_tools/buildTranslationTemplate.js +0 -94
  21. package/dist/build_tools/bundle.d.ts +0 -1
  22. package/dist/build_tools/bundle.js +0 -5
  23. package/dist/src/Color4.d.ts +0 -60
  24. package/dist/src/Color4.js +0 -192
  25. package/dist/src/Editor.d.ts +0 -308
  26. package/dist/src/Editor.js +0 -874
  27. package/dist/src/EditorImage.d.ts +0 -97
  28. package/dist/src/EditorImage.js +0 -477
  29. package/dist/src/EventDispatcher.d.ts +0 -30
  30. package/dist/src/EventDispatcher.js +0 -54
  31. package/dist/src/Pointer.d.ts +0 -24
  32. package/dist/src/Pointer.js +0 -80
  33. package/dist/src/SVGLoader.d.ts +0 -48
  34. package/dist/src/SVGLoader.js +0 -442
  35. package/dist/src/UndoRedoHistory.d.ts +0 -19
  36. package/dist/src/UndoRedoHistory.js +0 -91
  37. package/dist/src/Viewport.d.ts +0 -71
  38. package/dist/src/Viewport.js +0 -256
  39. package/dist/src/bundle/bundled.d.ts +0 -4
  40. package/dist/src/bundle/bundled.js +0 -5
  41. package/dist/src/commands/Command.d.ts +0 -16
  42. package/dist/src/commands/Command.js +0 -30
  43. package/dist/src/commands/Duplicate.d.ts +0 -14
  44. package/dist/src/commands/Duplicate.js +0 -33
  45. package/dist/src/commands/Erase.d.ts +0 -14
  46. package/dist/src/commands/Erase.js +0 -57
  47. package/dist/src/commands/SerializableCommand.d.ts +0 -12
  48. package/dist/src/commands/SerializableCommand.js +0 -36
  49. package/dist/src/commands/UnresolvedCommand.d.ts +0 -14
  50. package/dist/src/commands/UnresolvedCommand.js +0 -22
  51. package/dist/src/commands/invertCommand.d.ts +0 -4
  52. package/dist/src/commands/invertCommand.js +0 -44
  53. package/dist/src/commands/lib.d.ts +0 -7
  54. package/dist/src/commands/lib.js +0 -7
  55. package/dist/src/commands/localization.d.ts +0 -23
  56. package/dist/src/commands/localization.js +0 -21
  57. package/dist/src/commands/uniteCommands.d.ts +0 -4
  58. package/dist/src/commands/uniteCommands.js +0 -116
  59. package/dist/src/components/AbstractComponent.d.ts +0 -73
  60. package/dist/src/components/AbstractComponent.js +0 -252
  61. package/dist/src/components/ImageBackground.d.ts +0 -42
  62. package/dist/src/components/ImageBackground.js +0 -139
  63. package/dist/src/components/ImageComponent.d.ts +0 -31
  64. package/dist/src/components/ImageComponent.js +0 -146
  65. package/dist/src/components/RestylableComponent.d.ts +0 -24
  66. package/dist/src/components/RestylableComponent.js +0 -80
  67. package/dist/src/components/SVGGlobalAttributesObject.d.ts +0 -21
  68. package/dist/src/components/SVGGlobalAttributesObject.js +0 -59
  69. package/dist/src/components/Stroke.d.ts +0 -40
  70. package/dist/src/components/Stroke.js +0 -185
  71. package/dist/src/components/TextComponent.d.ts +0 -53
  72. package/dist/src/components/TextComponent.js +0 -252
  73. package/dist/src/components/UnknownSVGObject.d.ts +0 -18
  74. package/dist/src/components/UnknownSVGObject.js +0 -44
  75. package/dist/src/components/builders/ArrowBuilder.d.ts +0 -19
  76. package/dist/src/components/builders/ArrowBuilder.js +0 -86
  77. package/dist/src/components/builders/FreehandLineBuilder.d.ts +0 -33
  78. package/dist/src/components/builders/FreehandLineBuilder.js +0 -165
  79. package/dist/src/components/builders/LineBuilder.d.ts +0 -18
  80. package/dist/src/components/builders/LineBuilder.js +0 -58
  81. package/dist/src/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +0 -36
  82. package/dist/src/components/builders/PressureSensitiveFreehandLineBuilder.js +0 -339
  83. package/dist/src/components/builders/RectangleBuilder.d.ts +0 -20
  84. package/dist/src/components/builders/RectangleBuilder.js +0 -50
  85. package/dist/src/components/builders/types.d.ts +0 -12
  86. package/dist/src/components/builders/types.js +0 -1
  87. package/dist/src/components/lib.d.ts +0 -12
  88. package/dist/src/components/lib.js +0 -12
  89. package/dist/src/components/localization.d.ts +0 -11
  90. package/dist/src/components/localization.js +0 -10
  91. package/dist/src/components/util/StrokeSmoother.d.ts +0 -35
  92. package/dist/src/components/util/StrokeSmoother.js +0 -210
  93. package/dist/src/components/util/describeComponentList.d.ts +0 -4
  94. package/dist/src/components/util/describeComponentList.js +0 -14
  95. package/dist/src/lib.d.ts +0 -34
  96. package/dist/src/lib.js +0 -34
  97. package/dist/src/localization.d.ts +0 -14
  98. package/dist/src/localization.js +0 -10
  99. package/dist/src/localizations/de.d.ts +0 -3
  100. package/dist/src/localizations/de.js +0 -4
  101. package/dist/src/localizations/en.d.ts +0 -3
  102. package/dist/src/localizations/en.js +0 -4
  103. package/dist/src/localizations/es.d.ts +0 -3
  104. package/dist/src/localizations/es.js +0 -18
  105. package/dist/src/localizations/getLocalizationTable.d.ts +0 -3
  106. package/dist/src/localizations/getLocalizationTable.js +0 -45
  107. package/dist/src/math/LineSegment2.d.ts +0 -24
  108. package/dist/src/math/LineSegment2.js +0 -125
  109. package/dist/src/math/Mat33.d.ts +0 -118
  110. package/dist/src/math/Mat33.js +0 -326
  111. package/dist/src/math/Path.d.ts +0 -71
  112. package/dist/src/math/Path.js +0 -648
  113. package/dist/src/math/Rect2.d.ts +0 -52
  114. package/dist/src/math/Rect2.js +0 -228
  115. package/dist/src/math/Triangle.d.ts +0 -11
  116. package/dist/src/math/Triangle.js +0 -19
  117. package/dist/src/math/Vec2.d.ts +0 -13
  118. package/dist/src/math/Vec2.js +0 -13
  119. package/dist/src/math/Vec3.d.ts +0 -106
  120. package/dist/src/math/Vec3.js +0 -174
  121. package/dist/src/math/lib.d.ts +0 -7
  122. package/dist/src/math/lib.js +0 -7
  123. package/dist/src/math/rounding.d.ts +0 -4
  124. package/dist/src/math/rounding.js +0 -128
  125. package/dist/src/rendering/Display.d.ts +0 -75
  126. package/dist/src/rendering/Display.js +0 -207
  127. package/dist/src/rendering/RenderingStyle.d.ts +0 -31
  128. package/dist/src/rendering/RenderingStyle.js +0 -38
  129. package/dist/src/rendering/TextRenderingStyle.d.ts +0 -36
  130. package/dist/src/rendering/TextRenderingStyle.js +0 -23
  131. package/dist/src/rendering/caching/CacheRecord.d.ts +0 -20
  132. package/dist/src/rendering/caching/CacheRecord.js +0 -55
  133. package/dist/src/rendering/caching/CacheRecordManager.d.ts +0 -12
  134. package/dist/src/rendering/caching/CacheRecordManager.js +0 -43
  135. package/dist/src/rendering/caching/RenderingCache.d.ts +0 -11
  136. package/dist/src/rendering/caching/RenderingCache.js +0 -45
  137. package/dist/src/rendering/caching/RenderingCacheNode.d.ts +0 -29
  138. package/dist/src/rendering/caching/RenderingCacheNode.js +0 -320
  139. package/dist/src/rendering/caching/testUtils.d.ts +0 -9
  140. package/dist/src/rendering/caching/testUtils.js +0 -20
  141. package/dist/src/rendering/caching/types.d.ts +0 -19
  142. package/dist/src/rendering/caching/types.js +0 -1
  143. package/dist/src/rendering/lib.d.ts +0 -5
  144. package/dist/src/rendering/lib.js +0 -5
  145. package/dist/src/rendering/localization.d.ts +0 -10
  146. package/dist/src/rendering/localization.js +0 -9
  147. package/dist/src/rendering/renderers/AbstractRenderer.d.ts +0 -68
  148. package/dist/src/rendering/renderers/AbstractRenderer.js +0 -144
  149. package/dist/src/rendering/renderers/CanvasRenderer.d.ts +0 -63
  150. package/dist/src/rendering/renderers/CanvasRenderer.js +0 -230
  151. package/dist/src/rendering/renderers/DummyRenderer.d.ts +0 -35
  152. package/dist/src/rendering/renderers/DummyRenderer.js +0 -106
  153. package/dist/src/rendering/renderers/SVGRenderer.d.ts +0 -57
  154. package/dist/src/rendering/renderers/SVGRenderer.js +0 -304
  155. package/dist/src/rendering/renderers/TextOnlyRenderer.d.ts +0 -29
  156. package/dist/src/rendering/renderers/TextOnlyRenderer.js +0 -57
  157. package/dist/src/testing/beforeEachFile.d.ts +0 -1
  158. package/dist/src/testing/beforeEachFile.js +0 -7
  159. package/dist/src/testing/createEditor.d.ts +0 -4
  160. package/dist/src/testing/createEditor.js +0 -9
  161. package/dist/src/testing/lib.d.ts +0 -2
  162. package/dist/src/testing/lib.js +0 -2
  163. package/dist/src/testing/loadExpectExtensions.d.ts +0 -2
  164. package/dist/src/testing/loadExpectExtensions.js +0 -24
  165. package/dist/src/testing/sendPenEvent.d.ts +0 -12
  166. package/dist/src/testing/sendPenEvent.js +0 -19
  167. package/dist/src/testing/sendTouchEvent.d.ts +0 -42
  168. package/dist/src/testing/sendTouchEvent.js +0 -62
  169. package/dist/src/toolbar/HTMLToolbar.d.ts +0 -103
  170. package/dist/src/toolbar/HTMLToolbar.js +0 -376
  171. package/dist/src/toolbar/IconProvider.d.ts +0 -62
  172. package/dist/src/toolbar/IconProvider.js +0 -654
  173. package/dist/src/toolbar/lib.d.ts +0 -3
  174. package/dist/src/toolbar/lib.js +0 -3
  175. package/dist/src/toolbar/localization.d.ts +0 -49
  176. package/dist/src/toolbar/localization.js +0 -48
  177. package/dist/src/toolbar/makeColorInput.d.ts +0 -6
  178. package/dist/src/toolbar/makeColorInput.js +0 -113
  179. package/dist/src/toolbar/types.d.ts +0 -4
  180. package/dist/src/toolbar/types.js +0 -1
  181. package/dist/src/toolbar/widgets/ActionButtonWidget.d.ts +0 -15
  182. package/dist/src/toolbar/widgets/ActionButtonWidget.js +0 -25
  183. package/dist/src/toolbar/widgets/BaseToolWidget.d.ts +0 -11
  184. package/dist/src/toolbar/widgets/BaseToolWidget.js +0 -44
  185. package/dist/src/toolbar/widgets/BaseWidget.d.ts +0 -72
  186. package/dist/src/toolbar/widgets/BaseWidget.js +0 -307
  187. package/dist/src/toolbar/widgets/DocumentPropertiesWidget.d.ts +0 -18
  188. package/dist/src/toolbar/widgets/DocumentPropertiesWidget.js +0 -120
  189. package/dist/src/toolbar/widgets/EraserToolWidget.d.ts +0 -17
  190. package/dist/src/toolbar/widgets/EraserToolWidget.js +0 -57
  191. package/dist/src/toolbar/widgets/HandToolWidget.d.ts +0 -17
  192. package/dist/src/toolbar/widgets/HandToolWidget.js +0 -172
  193. package/dist/src/toolbar/widgets/InsertImageWidget.d.ts +0 -19
  194. package/dist/src/toolbar/widgets/InsertImageWidget.js +0 -170
  195. package/dist/src/toolbar/widgets/OverflowWidget.d.ts +0 -25
  196. package/dist/src/toolbar/widgets/OverflowWidget.js +0 -71
  197. package/dist/src/toolbar/widgets/PenToolWidget.d.ts +0 -27
  198. package/dist/src/toolbar/widgets/PenToolWidget.js +0 -220
  199. package/dist/src/toolbar/widgets/SelectionToolWidget.d.ts +0 -13
  200. package/dist/src/toolbar/widgets/SelectionToolWidget.js +0 -147
  201. package/dist/src/toolbar/widgets/TextToolWidget.d.ts +0 -16
  202. package/dist/src/toolbar/widgets/TextToolWidget.js +0 -109
  203. package/dist/src/toolbar/widgets/lib.d.ts +0 -10
  204. package/dist/src/toolbar/widgets/lib.js +0 -10
  205. package/dist/src/tools/BaseTool.d.ts +0 -22
  206. package/dist/src/tools/BaseTool.js +0 -63
  207. package/dist/src/tools/Eraser.d.ts +0 -23
  208. package/dist/src/tools/Eraser.js +0 -106
  209. package/dist/src/tools/FindTool.d.ts +0 -21
  210. package/dist/src/tools/FindTool.js +0 -114
  211. package/dist/src/tools/PanZoom.d.ts +0 -52
  212. package/dist/src/tools/PanZoom.js +0 -414
  213. package/dist/src/tools/PasteHandler.d.ts +0 -23
  214. package/dist/src/tools/PasteHandler.js +0 -93
  215. package/dist/src/tools/Pen.d.ts +0 -39
  216. package/dist/src/tools/Pen.js +0 -173
  217. package/dist/src/tools/PipetteTool.d.ts +0 -18
  218. package/dist/src/tools/PipetteTool.js +0 -39
  219. package/dist/src/tools/SelectionTool/SelectAllShortcutHandler.d.ts +0 -8
  220. package/dist/src/tools/SelectionTool/SelectAllShortcutHandler.js +0 -22
  221. package/dist/src/tools/SelectionTool/Selection.d.ts +0 -64
  222. package/dist/src/tools/SelectionTool/Selection.js +0 -459
  223. package/dist/src/tools/SelectionTool/SelectionHandle.d.ts +0 -38
  224. package/dist/src/tools/SelectionTool/SelectionHandle.js +0 -81
  225. package/dist/src/tools/SelectionTool/SelectionTool.d.ts +0 -36
  226. package/dist/src/tools/SelectionTool/SelectionTool.js +0 -398
  227. package/dist/src/tools/SelectionTool/TransformMode.d.ts +0 -34
  228. package/dist/src/tools/SelectionTool/TransformMode.js +0 -98
  229. package/dist/src/tools/SelectionTool/types.d.ts +0 -9
  230. package/dist/src/tools/SelectionTool/types.js +0 -11
  231. package/dist/src/tools/TextTool.d.ts +0 -33
  232. package/dist/src/tools/TextTool.js +0 -256
  233. package/dist/src/tools/ToolController.d.ts +0 -18
  234. package/dist/src/tools/ToolController.js +0 -158
  235. package/dist/src/tools/ToolEnabledGroup.d.ts +0 -6
  236. package/dist/src/tools/ToolEnabledGroup.js +0 -11
  237. package/dist/src/tools/ToolSwitcherShortcut.d.ts +0 -16
  238. package/dist/src/tools/ToolSwitcherShortcut.js +0 -32
  239. package/dist/src/tools/ToolbarShortcutHandler.d.ts +0 -12
  240. package/dist/src/tools/ToolbarShortcutHandler.js +0 -23
  241. package/dist/src/tools/UndoRedoShortcut.d.ts +0 -8
  242. package/dist/src/tools/UndoRedoShortcut.js +0 -22
  243. package/dist/src/tools/lib.d.ts +0 -16
  244. package/dist/src/tools/lib.js +0 -16
  245. package/dist/src/tools/localization.d.ts +0 -28
  246. package/dist/src/tools/localization.js +0 -27
  247. package/dist/src/types.d.ts +0 -151
  248. package/dist/src/types.js +0 -35
  249. package/dist/src/util/assertions.d.ts +0 -23
  250. package/dist/src/util/assertions.js +0 -45
  251. package/dist/src/util/fileToBase64.d.ts +0 -3
  252. package/dist/src/util/fileToBase64.js +0 -13
  253. package/dist/src/util/untilNextAnimationFrame.d.ts +0 -3
  254. package/dist/src/util/untilNextAnimationFrame.js +0 -7
  255. package/dist/src/util/waitForTimeout.d.ts +0 -2
  256. package/dist/src/util/waitForTimeout.js +0 -7
  257. package/src/Color4.test.ts +0 -40
  258. package/src/Color4.ts +0 -234
  259. package/src/Editor.css +0 -86
  260. package/src/Editor.loadFrom.test.ts +0 -24
  261. package/src/Editor.toSVG.test.ts +0 -111
  262. package/src/Editor.ts +0 -1122
  263. package/src/EditorImage.test.ts +0 -120
  264. package/src/EditorImage.ts +0 -603
  265. package/src/EventDispatcher.test.ts +0 -123
  266. package/src/EventDispatcher.ts +0 -71
  267. package/src/Pointer.ts +0 -127
  268. package/src/SVGLoader.test.ts +0 -114
  269. package/src/SVGLoader.ts +0 -511
  270. package/src/UndoRedoHistory.test.ts +0 -33
  271. package/src/UndoRedoHistory.ts +0 -102
  272. package/src/Viewport.ts +0 -319
  273. package/src/bundle/bundled.ts +0 -7
  274. package/src/commands/Command.ts +0 -45
  275. package/src/commands/Duplicate.ts +0 -48
  276. package/src/commands/Erase.ts +0 -74
  277. package/src/commands/SerializableCommand.ts +0 -49
  278. package/src/commands/UnresolvedCommand.ts +0 -37
  279. package/src/commands/invertCommand.ts +0 -51
  280. package/src/commands/lib.ts +0 -16
  281. package/src/commands/localization.ts +0 -47
  282. package/src/commands/uniteCommands.test.ts +0 -23
  283. package/src/commands/uniteCommands.ts +0 -135
  284. package/src/components/AbstractComponent.transformBy.test.ts +0 -22
  285. package/src/components/AbstractComponent.ts +0 -364
  286. package/src/components/ImageBackground.test.ts +0 -35
  287. package/src/components/ImageBackground.ts +0 -176
  288. package/src/components/ImageComponent.ts +0 -171
  289. package/src/components/RestylableComponent.ts +0 -142
  290. package/src/components/SVGGlobalAttributesObject.ts +0 -81
  291. package/src/components/Stroke.test.ts +0 -139
  292. package/src/components/Stroke.ts +0 -245
  293. package/src/components/TextComponent.test.ts +0 -99
  294. package/src/components/TextComponent.ts +0 -315
  295. package/src/components/UnknownSVGObject.test.ts +0 -10
  296. package/src/components/UnknownSVGObject.ts +0 -60
  297. package/src/components/builders/ArrowBuilder.ts +0 -107
  298. package/src/components/builders/FreehandLineBuilder.ts +0 -212
  299. package/src/components/builders/LineBuilder.ts +0 -77
  300. package/src/components/builders/PressureSensitiveFreehandLineBuilder.ts +0 -454
  301. package/src/components/builders/RectangleBuilder.ts +0 -74
  302. package/src/components/builders/types.ts +0 -15
  303. package/src/components/lib.ts +0 -25
  304. package/src/components/localization.ts +0 -22
  305. package/src/components/util/StrokeSmoother.ts +0 -293
  306. package/src/components/util/describeComponentList.ts +0 -18
  307. package/src/lib.ts +0 -37
  308. package/src/localization.ts +0 -34
  309. package/src/localizations/de.ts +0 -98
  310. package/src/localizations/en.ts +0 -8
  311. package/src/localizations/es.ts +0 -74
  312. package/src/localizations/getLocalizationTable.test.ts +0 -27
  313. package/src/localizations/getLocalizationTable.ts +0 -55
  314. package/src/math/LineSegment2.test.ts +0 -99
  315. package/src/math/LineSegment2.ts +0 -160
  316. package/src/math/Mat33.test.ts +0 -244
  317. package/src/math/Mat33.ts +0 -437
  318. package/src/math/Path.fromString.test.ts +0 -223
  319. package/src/math/Path.test.ts +0 -198
  320. package/src/math/Path.toString.test.ts +0 -77
  321. package/src/math/Path.ts +0 -790
  322. package/src/math/Rect2.test.ts +0 -204
  323. package/src/math/Rect2.ts +0 -315
  324. package/src/math/Triangle.ts +0 -29
  325. package/src/math/Vec2.test.ts +0 -30
  326. package/src/math/Vec2.ts +0 -18
  327. package/src/math/Vec3.test.ts +0 -44
  328. package/src/math/Vec3.ts +0 -218
  329. package/src/math/lib.ts +0 -15
  330. package/src/math/rounding.test.ts +0 -65
  331. package/src/math/rounding.ts +0 -156
  332. package/src/rendering/Display.ts +0 -249
  333. package/src/rendering/RenderingStyle.test.ts +0 -68
  334. package/src/rendering/RenderingStyle.ts +0 -55
  335. package/src/rendering/TextRenderingStyle.ts +0 -45
  336. package/src/rendering/caching/CacheRecord.test.ts +0 -49
  337. package/src/rendering/caching/CacheRecord.ts +0 -77
  338. package/src/rendering/caching/CacheRecordManager.ts +0 -71
  339. package/src/rendering/caching/RenderingCache.test.ts +0 -44
  340. package/src/rendering/caching/RenderingCache.ts +0 -66
  341. package/src/rendering/caching/RenderingCacheNode.ts +0 -405
  342. package/src/rendering/caching/testUtils.ts +0 -35
  343. package/src/rendering/caching/types.ts +0 -34
  344. package/src/rendering/lib.ts +0 -6
  345. package/src/rendering/localization.ts +0 -20
  346. package/src/rendering/renderers/AbstractRenderer.ts +0 -222
  347. package/src/rendering/renderers/CanvasRenderer.ts +0 -296
  348. package/src/rendering/renderers/DummyRenderer.test.ts +0 -42
  349. package/src/rendering/renderers/DummyRenderer.ts +0 -136
  350. package/src/rendering/renderers/SVGRenderer.ts +0 -354
  351. package/src/rendering/renderers/TextOnlyRenderer.ts +0 -70
  352. package/src/styles.js +0 -7
  353. package/src/testing/beforeEachFile.ts +0 -8
  354. package/src/testing/createEditor.ts +0 -11
  355. package/src/testing/global.d.ts +0 -17
  356. package/src/testing/lib.ts +0 -3
  357. package/src/testing/loadExpectExtensions.ts +0 -25
  358. package/src/testing/sendPenEvent.ts +0 -31
  359. package/src/testing/sendTouchEvent.ts +0 -78
  360. package/src/toolbar/HTMLToolbar.ts +0 -492
  361. package/src/toolbar/IconProvider.ts +0 -736
  362. package/src/toolbar/lib.ts +0 -4
  363. package/src/toolbar/localization.ts +0 -106
  364. package/src/toolbar/makeColorInput.ts +0 -145
  365. package/src/toolbar/toolbar.css +0 -213
  366. package/src/toolbar/types.ts +0 -5
  367. package/src/toolbar/widgets/ActionButtonWidget.ts +0 -39
  368. package/src/toolbar/widgets/BaseToolWidget.ts +0 -56
  369. package/src/toolbar/widgets/BaseWidget.ts +0 -377
  370. package/src/toolbar/widgets/DocumentPropertiesWidget.ts +0 -167
  371. package/src/toolbar/widgets/EraserToolWidget.ts +0 -85
  372. package/src/toolbar/widgets/HandToolWidget.ts +0 -250
  373. package/src/toolbar/widgets/InsertImageWidget.css +0 -44
  374. package/src/toolbar/widgets/InsertImageWidget.ts +0 -223
  375. package/src/toolbar/widgets/OverflowWidget.css +0 -27
  376. package/src/toolbar/widgets/OverflowWidget.ts +0 -92
  377. package/src/toolbar/widgets/PenToolWidget.ts +0 -288
  378. package/src/toolbar/widgets/SelectionToolWidget.ts +0 -190
  379. package/src/toolbar/widgets/TextToolWidget.ts +0 -145
  380. package/src/toolbar/widgets/lib.ts +0 -13
  381. package/src/tools/BaseTool.ts +0 -76
  382. package/src/tools/Eraser.test.ts +0 -103
  383. package/src/tools/Eraser.ts +0 -139
  384. package/src/tools/FindTool.css +0 -7
  385. package/src/tools/FindTool.ts +0 -152
  386. package/src/tools/PanZoom.test.ts +0 -310
  387. package/src/tools/PanZoom.ts +0 -520
  388. package/src/tools/PasteHandler.ts +0 -95
  389. package/src/tools/Pen.test.ts +0 -194
  390. package/src/tools/Pen.ts +0 -226
  391. package/src/tools/PipetteTool.ts +0 -55
  392. package/src/tools/SelectionTool/SelectAllShortcutHandler.ts +0 -28
  393. package/src/tools/SelectionTool/Selection.ts +0 -607
  394. package/src/tools/SelectionTool/SelectionHandle.ts +0 -108
  395. package/src/tools/SelectionTool/SelectionTool.css +0 -23
  396. package/src/tools/SelectionTool/SelectionTool.test.ts +0 -261
  397. package/src/tools/SelectionTool/SelectionTool.ts +0 -480
  398. package/src/tools/SelectionTool/TransformMode.ts +0 -114
  399. package/src/tools/SelectionTool/types.ts +0 -11
  400. package/src/tools/TextTool.ts +0 -326
  401. package/src/tools/ToolController.ts +0 -178
  402. package/src/tools/ToolEnabledGroup.ts +0 -14
  403. package/src/tools/ToolSwitcherShortcut.ts +0 -39
  404. package/src/tools/ToolbarShortcutHandler.ts +0 -34
  405. package/src/tools/UndoRedoShortcut.test.ts +0 -56
  406. package/src/tools/UndoRedoShortcut.ts +0 -25
  407. package/src/tools/lib.ts +0 -21
  408. package/src/tools/localization.ts +0 -66
  409. package/src/types.ts +0 -234
  410. package/src/util/assertions.ts +0 -55
  411. package/src/util/fileToBase64.ts +0 -18
  412. package/src/util/untilNextAnimationFrame.ts +0 -9
  413. package/src/util/waitForTimeout.ts +0 -9
@@ -1,736 +0,0 @@
1
- import Color4 from '../Color4';
2
- import { ComponentBuilderFactory } from '../components/builders/types';
3
- import { Vec2 } from '../math/Vec2';
4
- import SVGRenderer from '../rendering/renderers/SVGRenderer';
5
- import TextStyle from '../rendering/TextRenderingStyle';
6
- import Pen from '../tools/Pen';
7
- import { StrokeDataPoint } from '../types';
8
- import Viewport from '../Viewport';
9
-
10
- export type IconType = HTMLImageElement|SVGElement;
11
-
12
- const svgNamespace = 'http://www.w3.org/2000/svg';
13
- const iconColorFill = `
14
- style='fill: var(--icon-color);'
15
- `;
16
- const iconColorStrokeFill = `
17
- style='fill: var(--icon-color); stroke: var(--icon-color);'
18
- `;
19
- const checkerboardPatternDef = `
20
- <pattern
21
- id='checkerboard'
22
- viewBox='0,0,10,10'
23
- width='20%'
24
- height='20%'
25
- patternUnits='userSpaceOnUse'
26
- >
27
- <rect x=0 y=0 width=10 height=10 fill='white'/>
28
- <rect x=0 y=0 width=5 height=5 fill='gray'/>
29
- <rect x=5 y=5 width=5 height=5 fill='gray'/>
30
- </pattern>
31
- `;
32
- const checkerboardPatternRef = 'url(#checkerboard)';
33
-
34
- /**
35
- * Provides icons that can be used in the toolbar, etc.
36
- * Extend this class and override methods to customize icons.
37
- *
38
- * @example
39
- * ```ts
40
- * class CustomIconProvider extends jsdraw.IconProvider {
41
- * // Use '☺' instead of the default dropdown symbol.
42
- * public makeDropdownIcon() {
43
- * const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
44
- * icon.innerHTML = `
45
- * <text x='5' y='55' style='fill: var(--icon-color); font-size: 50pt;'>☺</text>
46
- * `;
47
- * icon.setAttribute('viewBox', '0 0 100 100');
48
- * return icon;
49
- * }
50
- * }
51
- *
52
- * const icons = new CustomIconProvider();
53
- * const editor = new jsdraw.Editor(document.body, {
54
- * iconProvider: icons,
55
- * });
56
- *
57
- * // Add a toolbar that uses these icons
58
- * editor.addToolbar();
59
- * ```
60
- */
61
- export default class IconProvider {
62
-
63
- public makeUndoIcon(): IconType {
64
- return this.makeRedoIcon(true);
65
- }
66
-
67
- // @param mirror - reflect across the x-axis. This parameter is internal.
68
- // @returns a redo icon.
69
- public makeRedoIcon(mirror: boolean = false): IconType {
70
- const icon = document.createElementNS(svgNamespace, 'svg');
71
- icon.innerHTML = `
72
- <style>
73
- .toolbar-svg-undo-redo-icon {
74
- stroke: var(--icon-color);
75
- stroke-width: 12;
76
- stroke-linejoin: round;
77
- stroke-linecap: round;
78
- fill: none;
79
-
80
- transform-origin: center;
81
- }
82
- </style>
83
- <path
84
- d='M20,20 A15,15 0 0 1 70,80 L80,90 L60,70 L65,90 L87,90 L65,80'
85
- class='toolbar-svg-undo-redo-icon'
86
- style='${mirror ? 'transform: scale(-1, 1);' : ''}'/>
87
- `;
88
- icon.setAttribute('viewBox', '0 0 100 100');
89
- return icon;
90
- }
91
-
92
- public makeDropdownIcon(): IconType {
93
- const icon = document.createElementNS(svgNamespace, 'svg');
94
- icon.innerHTML = `
95
- <g>
96
- <path
97
- d='M5,10 L50,90 L95,10 Z'
98
- ${iconColorFill}
99
- />
100
- </g>
101
- `;
102
- icon.setAttribute('viewBox', '0 0 100 100');
103
- return icon;
104
- }
105
-
106
- public makeEraserIcon(eraserSize?: number): IconType {
107
- const icon = document.createElementNS(svgNamespace, 'svg');
108
- eraserSize ??= 10;
109
-
110
- const scaledSize = eraserSize / 4;
111
- const eraserColor = '#ff70af';
112
-
113
- // Draw an eraser-like shape. Created with Inkscape
114
- icon.innerHTML = `
115
- <g>
116
- <path
117
- style="fill:${eraserColor}"
118
- stroke="black"
119
- transform="rotate(41.35)"
120
- d="M 52.5 27
121
- C 50 28.9 48.9 31.7 48.9 34.8
122
- L 48.9 39.8
123
- C 48.9 45.3 53.4 49.8 58.9 49.8
124
- L 103.9 49.8
125
- C 105.8 49.8 107.6 49.2 109.1 48.3
126
- L 110.2 ${scaledSize + 49.5} L 159.7 ${scaledSize + 5}
127
- L 157.7 ${-scaledSize + 5.2} L 112.4 ${49.5 - scaledSize}
128
- C 113.4 43.5 113.9 41.7 113.9 39.8
129
- L 113.9 34.8
130
- C 113.9 29.3 109.4 24.8 103.9 24.8
131
- L 58.9 24.8
132
- C 56.5 24.8 54.3 25.7 52.5 27
133
- z "
134
- id="path438" />
135
-
136
- <rect
137
- stroke="#cc8077"
138
- ${iconColorFill}
139
- id="rect218"
140
- width="65"
141
- height="75"
142
- x="48.9"
143
- y="-38.7"
144
- transform="rotate(41.35)" />
145
- </g>
146
- `;
147
- icon.setAttribute('viewBox', '0 0 120 120');
148
- return icon;
149
- }
150
-
151
- public makeSelectionIcon(): IconType {
152
- const icon = document.createElementNS(svgNamespace, 'svg');
153
-
154
- // Draw a cursor-like shape
155
- icon.innerHTML = `
156
- <g>
157
- <rect x=10 y=10 width=70 height=70 fill='pink' stroke='black'/>
158
- <rect x=75 y=75 width=10 height=10 fill='white' stroke='black'/>
159
- </g>
160
- `;
161
- icon.setAttribute('viewBox', '0 0 100 100');
162
-
163
- return icon;
164
- }
165
-
166
- /**
167
- * @param pathData - SVG path data (e.g. `m10,10l30,30z`)
168
- * @param fill - A valid CSS color (e.g. `var(--icon-color)` or `#f0f`). This can be `none`.
169
- */
170
- protected makeIconFromPath(
171
- pathData: string,
172
- fill: string = 'var(--icon-color)',
173
- strokeColor: string = 'none',
174
- strokeWidth: string = '0px',
175
- ): IconType {
176
- const icon = document.createElementNS(svgNamespace, 'svg');
177
- const path = document.createElementNS(svgNamespace, 'path');
178
- path.setAttribute('d', pathData);
179
- path.style.fill = fill;
180
- path.style.stroke = strokeColor;
181
- path.style.strokeWidth = strokeWidth;
182
- icon.appendChild(path);
183
- icon.setAttribute('viewBox', '0 0 100 100');
184
-
185
- return icon;
186
- }
187
-
188
- public makeHandToolIcon(): IconType {
189
- const fill = 'none';
190
- const strokeColor = 'var(--icon-color)';
191
- const strokeWidth = '3';
192
-
193
- // Draw a cursor-like shape
194
- return this.makeIconFromPath(`
195
- m 10,60
196
- 5,30
197
- H 90
198
- V 30
199
- C 90,20 75,20 75,30
200
- V 60
201
- 20
202
- C 75,10 60,10 60,20
203
- V 60
204
- 15
205
- C 60,5 45,5 45,15
206
- V 60
207
- 25
208
- C 45,15 30,15 30,25
209
- V 60
210
- 75
211
- L 25,60
212
- C 20,45 10,50 10,60
213
- Z
214
- `, fill, strokeColor, strokeWidth);
215
- }
216
-
217
- public makeTouchPanningIcon(): IconType {
218
- const fill = 'none';
219
- const strokeColor = 'var(--icon-color)';
220
- const strokeWidth = '3';
221
-
222
- return this.makeIconFromPath(`
223
- M 5,5.5
224
- V 17.2
225
- L 16.25,5.46
226
- Z
227
-
228
- m 33.75,0
229
- L 50,17
230
- V 5.5
231
- Z
232
-
233
- M 5,40.7
234
- v 11.7
235
- h 11.25
236
- z
237
-
238
- M 26,19
239
- C 19.8,19.4 17.65,30.4 21.9,34.8
240
- L 50,70
241
- H 27.5
242
- c -11.25,0 -11.25,17.6 0,17.6
243
- H 61.25
244
- C 94.9,87.8 95,87.6 95,40.7 78.125,23 67,29 55.6,46.5
245
- L 33.1,23
246
- C 30.3125,20.128192 27.9,19 25.830078,19.119756
247
- Z
248
- `, fill, strokeColor, strokeWidth);
249
- }
250
-
251
- public makeAllDevicePanningIcon(): IconType {
252
- const fill = 'none';
253
- const strokeColor = 'var(--icon-color)';
254
- const strokeWidth = '3';
255
- return this.makeIconFromPath(`
256
- M 5 5
257
- L 5 17.5
258
- 17.5 5
259
- 5 5
260
- z
261
-
262
- M 42.5 5
263
- L 55 17.5
264
- 55 5
265
- 42.5 5
266
- z
267
-
268
- M 70 10
269
- L 70 21
270
- 61 15
271
- 55.5 23
272
- 66 30
273
- 56 37
274
- 61 45
275
- 70 39
276
- 70 50
277
- 80 50
278
- 80 39
279
- 89 45
280
- 95 36
281
- 84 30
282
- 95 23
283
- 89 15
284
- 80 21
285
- 80 10
286
- 70 10
287
- z
288
-
289
- M 27.5 26.25
290
- L 27.5 91.25
291
- L 43.75 83.125
292
- L 52 99
293
- L 68 91
294
- L 60 75
295
- L 76.25 66.875
296
- L 27.5 26.25
297
- z
298
-
299
- M 5 42.5
300
- L 5 55
301
- L 17.5 55
302
- L 5 42.5
303
- z
304
- `, fill, strokeColor, strokeWidth);
305
- }
306
-
307
- public makeZoomIcon(): IconType {
308
- const icon = document.createElementNS(svgNamespace, 'svg');
309
- icon.setAttribute('viewBox', '0 0 100 100');
310
-
311
- const addTextNode = (text: string, x: number, y: number) => {
312
- const textNode = document.createElementNS(svgNamespace, 'text');
313
- textNode.appendChild(document.createTextNode(text));
314
- textNode.setAttribute('x', x.toString());
315
- textNode.setAttribute('y', y.toString());
316
- textNode.style.textAlign = 'center';
317
- textNode.style.textAnchor = 'middle';
318
- textNode.style.fontSize = '55px';
319
- textNode.style.fill = 'var(--icon-color)';
320
- textNode.style.fontFamily = 'monospace';
321
-
322
- icon.appendChild(textNode);
323
- };
324
-
325
- addTextNode('+', 40, 45);
326
- addTextNode('-', 70, 75);
327
-
328
- return icon;
329
- }
330
-
331
- public makeRotationLockIcon(): IconType {
332
- const icon = this.makeIconFromPath(`
333
- M 40.1 25.1
334
- C 32.5 25 27.9 34.1 27.9 34.1
335
- L 25.7 30
336
- L 28 44.7
337
- L 36.6 40.3
338
- L 32.3 38.3
339
- C 33.6 28 38.1 25.2 45.1 31.8
340
- L 49.4 29.6
341
- C 45.9 26.3 42.8 25.1 40.1 25.1
342
- z
343
-
344
- M 51.7 34.2
345
- L 43.5 39.1
346
- L 48 40.8
347
- C 47.4 51.1 43.1 54.3 35.7 48.2
348
- L 31.6 50.7
349
- C 45.5 62.1 52.6 44.6 52.6 44.6
350
- L 55.1 48.6
351
- L 51.7 34.2
352
- z
353
-
354
- M 56.9 49.9
355
- C 49.8 49.9 49.2 57.3 49.3 60.9
356
- L 47.6 60.9
357
- L 47.6 73.7
358
- L 66.1 73.7
359
- L 66.1 60.9
360
- L 64.4 60.9
361
- C 64.5 57.3 63.9 49.9 56.9 49.9
362
- z
363
-
364
- M 56.9 53.5
365
- C 60.8 53.5 61 58.2 60.8 60.9
366
- L 52.9 60.9
367
- C 52.7 58.2 52.9 53.5 56.9 53.5
368
- z
369
- `);
370
-
371
- icon.setAttribute('viewBox', '10 10 70 70');
372
-
373
- return icon;
374
- }
375
-
376
- public makeInsertImageIcon(): IconType {
377
- return this.makeIconFromPath(`
378
- M 5 10 L 5 90 L 95 90 L 95 10 L 5 10 z
379
- M 10 15 L 90 15 L 90 50 L 70 75 L 40 50 L 10 75 L 10 15 z
380
- 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
381
- `);
382
- }
383
-
384
- public makeTextIcon(textStyle: TextStyle): IconType {
385
- const icon = document.createElementNS(svgNamespace, 'svg');
386
- icon.setAttribute('viewBox', '0 0 100 100');
387
-
388
- const textNode = document.createElementNS(svgNamespace, 'text');
389
- textNode.appendChild(document.createTextNode('T'));
390
-
391
- textNode.style.fontFamily = textStyle.fontFamily;
392
- textNode.style.fontWeight = textStyle.fontWeight ?? '';
393
- textNode.style.fontVariant = textStyle.fontVariant ?? '';
394
- textNode.style.fill = textStyle.renderingStyle.fill.toHexString();
395
-
396
- textNode.style.textAnchor = 'middle';
397
- textNode.setAttribute('x', '50');
398
- textNode.setAttribute('y', '75');
399
- textNode.style.fontSize = '65px';
400
- textNode.style.filter = 'drop-shadow(0px 0px 10px var(--primary-shadow-color))';
401
-
402
- icon.appendChild(textNode);
403
-
404
- return icon;
405
- }
406
-
407
- public makePenIcon(strokeSize: number, color: string|Color4, rounded?: boolean): IconType {
408
- if (color instanceof Color4) {
409
- color = color.toHexString();
410
- }
411
-
412
- const icon = document.createElementNS(svgNamespace, 'svg');
413
- icon.setAttribute('viewBox', '0 0 100 100');
414
- const tipThickness = strokeSize / 2;
415
-
416
- const inkTipPath = `
417
- M ${15 - tipThickness},${80 - tipThickness}
418
- ${15 - tipThickness},${80 + tipThickness}
419
- 30,83
420
- 15,65
421
- Z
422
- `;
423
- const trailStartEndY = 80 + tipThickness;
424
- const inkTrailPath = `
425
- m ${15 - tipThickness * 1.1},${trailStartEndY}
426
- c 35,10 55,15 60,30
427
- l ${35 + tipThickness * 1.2},${-10 - tipThickness}
428
- C 80.47,98.32 50.5,${90 + tipThickness} 20,${trailStartEndY} Z
429
- `;
430
-
431
- const colorBubblePath = `
432
- M 72.45,35.67
433
- 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
434
- Z
435
- `;
436
-
437
- 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';
438
- let gripShadow1Path = 'M 25,35 H 35 L 90,-15 85,-25 Z';
439
- let gripShadow2Path = 'M 60,75 65,65 H 55 l 55,-55 10,5 z';
440
-
441
- if (rounded) {
442
- gripMainPath = 'M 85,-25 25,35 c 15,0 40,30 35,40 l 60,-60 z';
443
- gripShadow1Path = 'm 25,35 c 3.92361,0.384473 7.644275,0.980572 10,3 l 55,-53 -5,-10 z';
444
- gripShadow2Path = 'M 60,75 C 61,66 59,65 56,59 l 54,-54 10,10 z';
445
- }
446
-
447
- const penTipPath = `M 25,35 ${10 - tipThickness / 4},${70 - tipThickness / 2} 20,75 25,85 60,75 70,55 45,25 Z`;
448
-
449
- const pencilTipColor = Color4.fromHex('#f4d7d7');
450
- const tipColor = pencilTipColor.mix(
451
- Color4.fromString(color), tipThickness / 40 - 0.1
452
- ).toHexString();
453
-
454
- const ink = `
455
- <path
456
- fill="${checkerboardPatternRef}"
457
- d="${inkTipPath}"
458
- />
459
- <path
460
- fill="${checkerboardPatternRef}"
461
- d="${inkTrailPath}"
462
- />
463
- <path
464
- fill="${color}"
465
- d="${inkTipPath}"
466
- />
467
- <path
468
- fill="${color}"
469
- d="${inkTrailPath}"
470
- />
471
- `;
472
-
473
- const penTip = `
474
- <path
475
- fill="${checkerboardPatternRef}"
476
- d="${penTipPath}"
477
- />
478
- <path
479
- fill="${tipColor}"
480
- stroke="${color}"
481
- d="${penTipPath}"
482
- />
483
- `;
484
-
485
- const grip = `
486
- <path
487
- ${iconColorStrokeFill}
488
- d="${gripMainPath}"
489
- />
490
-
491
- <!-- shadows -->
492
- <path
493
- fill="rgba(150, 150, 150, 0.3)"
494
- d="${gripShadow1Path}"
495
- />
496
- <path
497
- fill="rgba(100, 100, 100, 0.2)"
498
- d="${gripShadow2Path}"
499
- />
500
-
501
- <!-- color bubble -->
502
- <path
503
- fill="${checkerboardPatternRef}"
504
- d="${colorBubblePath}"
505
- />
506
- <path
507
- fill="${color}"
508
- d="${colorBubblePath}"
509
- />
510
- `;
511
-
512
- icon.innerHTML = `
513
- <defs>
514
- ${checkerboardPatternDef}
515
- </defs>
516
- <g>
517
- ${ink}
518
- ${penTip}
519
- ${grip}
520
- </g>
521
- `;
522
- return icon;
523
- }
524
-
525
- public makeIconFromFactory(pen: Pen, factory: ComponentBuilderFactory): IconType {
526
- // Increase the thickness we use to generate the icon less with larger actual thicknesses.
527
- // We want the icon to be recognisable with a large range of thicknesses.
528
- const thickness = Math.sqrt(pen.getThickness()) * 3;
529
-
530
- const nowTime = (new Date()).getTime();
531
- const startPoint: StrokeDataPoint = {
532
- pos: Vec2.of(10, 10),
533
- width: thickness,
534
- color: pen.getColor(),
535
- time: nowTime - 100,
536
- };
537
- const endPoint: StrokeDataPoint = {
538
- pos: Vec2.of(90, 90),
539
- width: thickness,
540
- color: pen.getColor(),
541
- time: nowTime,
542
- };
543
-
544
- const viewport = new Viewport(() => {});
545
- const builder = factory(startPoint, viewport);
546
- builder.addPoint(endPoint);
547
-
548
- const icon = document.createElementNS(svgNamespace, 'svg');
549
- icon.setAttribute('viewBox', '0 0 100 100');
550
- viewport.updateScreenSize(Vec2.of(100, 100));
551
-
552
- const renderer = new SVGRenderer(icon, viewport);
553
- builder.preview(renderer);
554
-
555
- return icon;
556
- }
557
-
558
- public makePipetteIcon(color?: Color4): IconType {
559
- const icon = document.createElementNS(svgNamespace, 'svg');
560
- const pipette = document.createElementNS(svgNamespace, 'path');
561
-
562
- pipette.setAttribute('d', `
563
- M 47,6
564
- C 35,5 25,15 35,30
565
- c -9.2,1.3 -15,0 -15,3
566
- 0,2 5,5 15,7
567
- V 81
568
- L 40,90
569
- h 6
570
- L 40,80
571
- V 40
572
- h 15
573
- v 40
574
- l -6,10
575
- h 6
576
- l 5,-9.2
577
- V 40
578
- C 70,38 75,35 75,33
579
- 75,30 69.2,31.2 60,30
580
- 65,15 65,5 47,6
581
- Z
582
- `);
583
- pipette.style.fill = 'var(--icon-color)';
584
-
585
- if (color) {
586
- const defs = document.createElementNS(svgNamespace, 'defs');
587
- defs.innerHTML = checkerboardPatternDef;
588
- icon.appendChild(defs);
589
-
590
- const fluidBackground = document.createElementNS(svgNamespace, 'path');
591
- const fluid = document.createElementNS(svgNamespace, 'path');
592
-
593
- const fluidPathData = `
594
- m 40,50 c 5,5 10,0 15,-5 V 80 L 50,90 H 45 L 40,80 Z
595
- `;
596
-
597
- fluid.setAttribute('d', fluidPathData);
598
- fluidBackground.setAttribute('d', fluidPathData);
599
-
600
- fluid.style.fill = color.toHexString();
601
- fluidBackground.style.fill = checkerboardPatternRef;
602
-
603
- icon.appendChild(fluidBackground);
604
- icon.appendChild(fluid);
605
- }
606
- icon.appendChild(pipette);
607
-
608
- icon.setAttribute('viewBox', '0 0 100 100');
609
- return icon;
610
- }
611
-
612
- public makeFormatSelectionIcon(): IconType {
613
- return this.makeIconFromPath(`
614
- M 5 10
615
- 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
616
- 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
617
- M 60 25 L 55 25 L 50 30 L 60 25 z
618
- M 10 55 L 10 90 L 41 90 L 41 86 L 45 86 L 45 55 L 10 55 z
619
- M 42 87 L 42 93 L 48 93 L 48 87 L 42 87 z
620
- `);
621
- }
622
-
623
- public makeResizeViewportIcon(): IconType {
624
- return this.makeIconFromPath(`
625
- M 75 5 75 10 90 10 90 25 95 25 95 5 75 5 z
626
- M 15 15 15 30 20 30 20 20 30 20 30 15 15 15 z
627
- M 84 15 82 17 81 16 81 20 85 20 84 19 86 17 84 15 z
628
- M 26 24 24 26 26 28 25 29 29 29 29 25 28 26 26 24 z
629
- M 25 71 26 72 24 74 26 76 28 74 29 75 29 71 25 71 z
630
- M 15 75 15 85 25 85 25 80 20 80 20 75 15 75 z
631
- M 90 75 90 90 75 90 75 95 95 95 95 75 90 75 z
632
- M 81 81 81 85 82 84 84 86 86 84 84 82 85 81 81 81 z
633
- `);
634
- }
635
-
636
- public makeDuplicateSelectionIcon(): IconType {
637
- return this.makeIconFromPath(`
638
- M 45,10 45,55 90,55 90,10 45,10 z
639
- M 10,25 10,90 70,90 70,60 40,60 40,25 10,25 z
640
- `);
641
- }
642
-
643
- public makePasteIcon(): IconType {
644
- const icon = this.makeIconFromPath(`
645
- M 50 0 L 50 5 L 35 5 L 40 24.75 L 20 25 L 20 100 L 85 100 L 100 90 L 100 24 L 75.1 24.3 L 80 5 L 65 5 L 65 0 L 50 0 z
646
- M 10 15 L 10 115 L 110 115 L 110 15 L 85 15 L 83 20 L 105 20 L 105 110 L 15 110 L 15 20 L 32 20 L 30 15 L 10 15 z
647
- M 25 35 L 90 35 L 90 40 L 25 40 L 25 35 z
648
- M 25 45 L 90 45 L 90 50 L 25 50 L 25 45 z
649
- M 25 55 L 85 55 L 85 60 L 25 60 L 25 55 z
650
- M 25 65 L 90 65 L 90 70 L 25 70 L 25 65 z
651
- `);
652
- icon.setAttribute('viewBox', '0 0 120 120');
653
- return icon;
654
- }
655
-
656
- public makeDeleteSelectionIcon(): IconType {
657
- const strokeWidth = '5px';
658
- const strokeColor = 'var(--icon-color)';
659
- const fillColor = 'none';
660
-
661
- return this.makeIconFromPath(`
662
- M 10,10 90,90
663
- M 10,90 90,10
664
- `, fillColor, strokeColor, strokeWidth);
665
- }
666
-
667
- public makeSaveIcon(): IconType {
668
- const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
669
- svg.innerHTML = `
670
- <style>
671
- .toolbar-save-icon {
672
- stroke: var(--icon-color);
673
- stroke-width: 10;
674
- stroke-linejoin: round;
675
- stroke-linecap: round;
676
- fill: none;
677
- }
678
- </style>
679
- <path
680
- d='
681
- M 15,55 30,70 85,20
682
- '
683
- class='toolbar-save-icon'
684
- />
685
- `;
686
- svg.setAttribute('viewBox', '0 0 100 100');
687
- return svg;
688
- }
689
-
690
- public makeConfigureDocumentIcon(): IconType {
691
- const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
692
- svg.innerHTML = `
693
- <path
694
- d='
695
- M 5,5 V 95 H 95 V 5 Z m 5,5 H 90 V 90 H 10 Z
696
- m 5,10 V 30 H 50 V 25 H 20 v -5 z
697
- m 40,0 V 50 H 85 V 20 Z
698
- m 2,2 H 83 V 39 L 77,28 70,42 64,35 57,45 Z
699
- 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
700
- M 15,40 v 5 h 35 v -5 z
701
- m 0,15 v 5 h 70 v -5 z
702
- m 0,15 v 5 h 70 v -5 z
703
- '
704
- style='fill: var(--icon-color);'
705
- />
706
- `;
707
- svg.setAttribute('viewBox', '0 0 100 100');
708
- return svg;
709
- }
710
-
711
- public makeOverflowIcon(): IconType {
712
- return this.makeIconFromPath(`
713
- M 15 40
714
- A 12.5 12.5 0 0 0 2.5 52.5
715
- A 12.5 12.5 0 0 0 15 65
716
- A 12.5 12.5 0 0 0 27.5 52.5
717
- A 12.5 12.5 0 0 0 15 40
718
- z
719
-
720
- M 50 40
721
- A 12.5 12.5 0 0 0 37.5 52.5
722
- A 12.5 12.5 0 0 0 50 65
723
- A 12.5 12.5 0 0 0 62.5 52.5
724
- A 12.5 12.5 0 0 0 50 40
725
- z
726
-
727
- M 85 40
728
- A 12.5 12.5 0 0 0 72.5 52.5
729
- A 12.5 12.5 0 0 0 85 65
730
- A 12.5 12.5 0 0 0 97.5 52.5
731
- A 12.5 12.5 0 0 0 85 40
732
- z
733
- `);
734
- }
735
-
736
- }