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