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