js-draw 0.17.3 → 0.18.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/.github/workflows/firebase-hosting-merge.yml +2 -0
- package/.github/workflows/firebase-hosting-pull-request.yml +2 -0
- package/.github/workflows/github-pages.yml +2 -0
- package/CHANGELOG.md +10 -1
- package/README.md +17 -8
- package/build_tools/postDist.ts +71 -0
- package/dist/bundle.js +9 -1
- package/dist/cjs/build_tools/BundledFile.js +163 -0
- package/dist/cjs/build_tools/buildTranslationTemplate.js +119 -0
- package/dist/cjs/build_tools/bundle.js +10 -0
- package/dist/cjs/build_tools/postDist.js +72 -0
- package/dist/{src → cjs/src}/Color4.d.ts +1 -0
- package/dist/cjs/src/Color4.js +197 -0
- package/dist/{src → cjs/src}/Editor.d.ts +57 -1
- package/dist/cjs/src/Editor.js +904 -0
- package/dist/{src → cjs/src}/EditorImage.d.ts +4 -2
- package/dist/cjs/src/EditorImage.js +486 -0
- package/dist/cjs/src/EventDispatcher.js +57 -0
- package/dist/cjs/src/Pointer.js +84 -0
- package/dist/{src → cjs/src}/SVGLoader.d.ts +4 -0
- package/dist/cjs/src/SVGLoader.js +472 -0
- package/dist/cjs/src/UndoRedoHistory.js +93 -0
- package/dist/cjs/src/Viewport.js +264 -0
- package/dist/cjs/src/bundle/bundled.js +24 -0
- package/dist/cjs/src/commands/Command.js +34 -0
- package/dist/cjs/src/commands/Duplicate.js +39 -0
- package/dist/cjs/src/commands/Erase.js +63 -0
- package/dist/cjs/src/commands/SerializableCommand.js +42 -0
- package/dist/cjs/src/commands/UnresolvedCommand.js +28 -0
- package/dist/cjs/src/commands/invertCommand.js +49 -0
- package/dist/cjs/src/commands/lib.js +18 -0
- package/dist/cjs/src/commands/localization.js +24 -0
- package/dist/cjs/src/commands/uniteCommands.js +121 -0
- package/dist/cjs/src/components/AbstractComponent.js +258 -0
- package/dist/cjs/src/components/ImageBackground.js +146 -0
- package/dist/cjs/src/components/ImageComponent.js +152 -0
- package/dist/cjs/src/components/RestylableComponent.js +88 -0
- package/dist/cjs/src/components/SVGGlobalAttributesObject.js +65 -0
- package/dist/cjs/src/components/Stroke.js +191 -0
- package/dist/cjs/src/components/TextComponent.js +258 -0
- package/dist/cjs/src/components/UnknownSVGObject.js +50 -0
- package/dist/cjs/src/components/builders/ArrowBuilder.js +117 -0
- package/dist/cjs/src/components/builders/FreehandLineBuilder.js +173 -0
- package/dist/cjs/src/components/builders/LineBuilder.js +89 -0
- package/dist/cjs/src/components/builders/PressureSensitiveFreehandLineBuilder.js +347 -0
- package/dist/cjs/src/components/builders/RectangleBuilder.js +59 -0
- package/dist/cjs/src/components/builders/types.js +2 -0
- package/dist/cjs/src/components/lib.js +43 -0
- package/dist/cjs/src/components/localization.js +13 -0
- package/dist/cjs/src/components/util/StrokeSmoother.js +217 -0
- package/dist/cjs/src/components/util/describeComponentList.js +16 -0
- package/dist/{src → cjs/src}/lib.d.ts +2 -1
- package/dist/cjs/src/lib.js +63 -0
- package/dist/cjs/src/localization.js +13 -0
- package/dist/cjs/src/localizations/de.js +6 -0
- package/dist/cjs/src/localizations/en.js +6 -0
- package/dist/cjs/src/localizations/es.js +20 -0
- package/dist/cjs/src/localizations/getLocalizationTable.js +50 -0
- package/dist/cjs/src/math/LineSegment2.js +131 -0
- package/dist/cjs/src/math/Mat33.js +332 -0
- package/dist/cjs/src/math/Path.js +655 -0
- package/dist/cjs/src/math/Rect2.js +234 -0
- package/dist/cjs/src/math/Triangle.js +22 -0
- package/dist/cjs/src/math/Vec2.js +19 -0
- package/dist/cjs/src/math/Vec3.js +177 -0
- package/dist/cjs/src/math/lib.js +18 -0
- package/dist/cjs/src/math/rounding.js +135 -0
- package/dist/cjs/src/rendering/Display.js +214 -0
- package/dist/cjs/src/rendering/RenderingStyle.js +48 -0
- package/dist/cjs/src/rendering/TextRenderingStyle.js +29 -0
- package/dist/cjs/src/rendering/caching/CacheRecord.js +61 -0
- package/dist/cjs/src/rendering/caching/CacheRecordManager.js +50 -0
- package/dist/cjs/src/rendering/caching/RenderingCache.js +51 -0
- package/dist/cjs/src/rendering/caching/RenderingCacheNode.js +326 -0
- package/dist/cjs/src/rendering/caching/testUtils.js +27 -0
- package/dist/cjs/src/rendering/caching/types.js +2 -0
- package/dist/{src → cjs/src}/rendering/lib.d.ts +2 -0
- package/dist/cjs/src/rendering/lib.js +16 -0
- package/dist/cjs/src/rendering/localization.js +12 -0
- package/dist/cjs/src/rendering/renderers/AbstractRenderer.js +170 -0
- package/dist/{src → cjs/src}/rendering/renderers/CanvasRenderer.d.ts +25 -0
- package/dist/cjs/src/rendering/renderers/CanvasRenderer.js +236 -0
- package/dist/cjs/src/rendering/renderers/DummyRenderer.js +112 -0
- package/dist/{src → cjs/src}/rendering/renderers/SVGRenderer.d.ts +15 -0
- package/dist/cjs/src/rendering/renderers/SVGRenderer.js +311 -0
- package/dist/cjs/src/rendering/renderers/TextOnlyRenderer.js +63 -0
- package/dist/cjs/src/testing/beforeEachFile.js +12 -0
- package/dist/cjs/src/testing/createEditor.js +14 -0
- package/dist/cjs/src/testing/lib.d.ts +2 -0
- package/dist/cjs/src/testing/lib.js +10 -0
- package/dist/cjs/src/testing/loadExpectExtensions.js +28 -0
- package/dist/cjs/src/testing/sendPenEvent.d.ts +12 -0
- package/dist/cjs/src/testing/sendPenEvent.js +24 -0
- package/dist/cjs/src/testing/sendTouchEvent.d.ts +42 -0
- package/dist/cjs/src/testing/sendTouchEvent.js +87 -0
- package/dist/cjs/src/toolbar/HTMLToolbar.js +383 -0
- package/dist/cjs/src/toolbar/IconProvider.js +660 -0
- package/dist/cjs/src/toolbar/lib.js +24 -0
- package/dist/cjs/src/toolbar/localization.js +51 -0
- package/dist/cjs/src/toolbar/makeColorInput.js +120 -0
- package/dist/cjs/src/toolbar/types.js +2 -0
- package/dist/cjs/src/toolbar/widgets/ActionButtonWidget.js +31 -0
- package/dist/cjs/src/toolbar/widgets/BaseToolWidget.js +50 -0
- package/dist/cjs/src/toolbar/widgets/BaseWidget.js +313 -0
- package/dist/cjs/src/toolbar/widgets/DocumentPropertiesWidget.js +126 -0
- package/dist/cjs/src/toolbar/widgets/EraserToolWidget.js +63 -0
- package/dist/cjs/src/toolbar/widgets/HandToolWidget.js +201 -0
- package/dist/cjs/src/toolbar/widgets/InsertImageWidget.js +176 -0
- package/dist/cjs/src/toolbar/widgets/OverflowWidget.js +77 -0
- package/dist/cjs/src/toolbar/widgets/PenToolWidget.js +226 -0
- package/dist/cjs/src/toolbar/widgets/SelectionToolWidget.js +153 -0
- package/dist/cjs/src/toolbar/widgets/TextToolWidget.js +115 -0
- package/dist/cjs/src/toolbar/widgets/lib.js +26 -0
- package/dist/cjs/src/tools/BaseTool.js +66 -0
- package/dist/cjs/src/tools/Eraser.js +112 -0
- package/dist/cjs/src/tools/FindTool.js +121 -0
- package/dist/cjs/src/tools/PanZoom.js +421 -0
- package/dist/cjs/src/tools/PasteHandler.js +99 -0
- package/dist/cjs/src/tools/Pen.js +179 -0
- package/dist/cjs/src/tools/PipetteTool.js +45 -0
- package/dist/cjs/src/tools/SelectionTool/SelectAllShortcutHandler.js +28 -0
- package/dist/cjs/src/tools/SelectionTool/Selection.js +488 -0
- package/dist/cjs/src/tools/SelectionTool/SelectionHandle.js +85 -0
- package/dist/cjs/src/tools/SelectionTool/SelectionTool.js +405 -0
- package/dist/cjs/src/tools/SelectionTool/TransformMode.js +107 -0
- package/dist/cjs/src/tools/SelectionTool/types.js +14 -0
- package/dist/cjs/src/tools/TextTool.js +262 -0
- package/dist/cjs/src/tools/ToolController.js +187 -0
- package/dist/cjs/src/tools/ToolEnabledGroup.js +14 -0
- package/dist/cjs/src/tools/ToolSwitcherShortcut.js +38 -0
- package/dist/cjs/src/tools/ToolbarShortcutHandler.js +29 -0
- package/dist/cjs/src/tools/UndoRedoShortcut.js +28 -0
- package/dist/cjs/src/tools/lib.js +36 -0
- package/dist/cjs/src/tools/localization.js +30 -0
- package/dist/cjs/src/types.js +38 -0
- package/dist/cjs/src/util/assertions.js +51 -0
- package/dist/cjs/src/util/fileToBase64.js +15 -0
- package/dist/cjs/src/util/untilNextAnimationFrame.js +9 -0
- package/dist/cjs/src/util/waitForTimeout.js +9 -0
- package/dist/mjs/build_tools/BundledFile.d.ts +13 -0
- package/dist/{build_tools/buildTranslationTemplate.js → mjs/build_tools/buildTranslationTemplate.mjs} +1 -1
- package/dist/{build_tools/bundle.js → mjs/build_tools/bundle.mjs} +1 -1
- package/dist/mjs/build_tools/postDist.d.ts +1 -0
- package/dist/mjs/build_tools/postDist.mjs +67 -0
- package/dist/mjs/src/Color4.d.ts +61 -0
- package/dist/{src/Color4.js → mjs/src/Color4.mjs} +1 -0
- package/dist/mjs/src/Editor.d.ts +308 -0
- package/dist/{src/Editor.js → mjs/src/Editor.mjs} +86 -49
- package/dist/mjs/src/EditorImage.d.ts +97 -0
- package/dist/{src/EditorImage.js → mjs/src/EditorImage.mjs} +12 -10
- package/dist/mjs/src/EventDispatcher.d.ts +30 -0
- package/dist/mjs/src/Pointer.d.ts +24 -0
- package/dist/{src/Pointer.js → mjs/src/Pointer.mjs} +1 -1
- package/dist/mjs/src/SVGLoader.d.ts +48 -0
- package/dist/{src/SVGLoader.js → mjs/src/SVGLoader.mjs} +15 -11
- package/dist/mjs/src/UndoRedoHistory.d.ts +19 -0
- package/dist/{src/UndoRedoHistory.js → mjs/src/UndoRedoHistory.mjs} +1 -1
- package/dist/mjs/src/Viewport.d.ts +71 -0
- package/dist/{src/Viewport.js → mjs/src/Viewport.mjs} +5 -5
- package/dist/mjs/src/bundle/bundled.d.ts +4 -0
- package/dist/{src/bundle/bundled.js → mjs/src/bundle/bundled.mjs} +2 -2
- package/dist/mjs/src/commands/Command.d.ts +16 -0
- package/dist/mjs/src/commands/Duplicate.d.ts +14 -0
- package/dist/{src/commands/Duplicate.js → mjs/src/commands/Duplicate.mjs} +3 -3
- package/dist/mjs/src/commands/Erase.d.ts +14 -0
- package/dist/{src/commands/Erase.js → mjs/src/commands/Erase.mjs} +3 -3
- package/dist/mjs/src/commands/SerializableCommand.d.ts +12 -0
- package/dist/{src/commands/SerializableCommand.js → mjs/src/commands/SerializableCommand.mjs} +1 -1
- package/dist/mjs/src/commands/UnresolvedCommand.d.ts +14 -0
- package/dist/{src/commands/UnresolvedCommand.js → mjs/src/commands/UnresolvedCommand.mjs} +1 -1
- package/dist/mjs/src/commands/invertCommand.d.ts +4 -0
- package/dist/{src/commands/invertCommand.js → mjs/src/commands/invertCommand.mjs} +2 -2
- package/dist/mjs/src/commands/lib.mjs +7 -0
- package/dist/mjs/src/commands/localization.d.ts +23 -0
- package/dist/mjs/src/commands/uniteCommands.d.ts +4 -0
- package/dist/{src/commands/uniteCommands.js → mjs/src/commands/uniteCommands.mjs} +2 -2
- package/dist/mjs/src/components/AbstractComponent.d.ts +73 -0
- package/dist/{src/components/AbstractComponent.js → mjs/src/components/AbstractComponent.mjs} +4 -4
- package/dist/mjs/src/components/ImageBackground.d.ts +42 -0
- package/dist/{src/components/ImageBackground.js → mjs/src/components/ImageBackground.mjs} +5 -5
- package/dist/mjs/src/components/ImageComponent.d.ts +31 -0
- package/dist/{src/components/ImageComponent.js → mjs/src/components/ImageComponent.mjs} +3 -3
- package/dist/mjs/src/components/RestylableComponent.d.ts +24 -0
- package/dist/{src/components/RestylableComponent.js → mjs/src/components/RestylableComponent.mjs} +4 -4
- package/dist/mjs/src/components/SVGGlobalAttributesObject.d.ts +21 -0
- package/dist/{src/components/SVGGlobalAttributesObject.js → mjs/src/components/SVGGlobalAttributesObject.mjs} +3 -3
- package/dist/mjs/src/components/Stroke.d.ts +40 -0
- package/dist/{src/components/Stroke.js → mjs/src/components/Stroke.mjs} +5 -5
- package/dist/mjs/src/components/TextComponent.d.ts +53 -0
- package/dist/{src/components/TextComponent.js → mjs/src/components/TextComponent.mjs} +7 -7
- package/dist/mjs/src/components/UnknownSVGObject.d.ts +18 -0
- package/dist/{src/components/UnknownSVGObject.js → mjs/src/components/UnknownSVGObject.mjs} +3 -3
- package/dist/mjs/src/components/builders/ArrowBuilder.d.ts +19 -0
- package/dist/{src/components/builders/ArrowBuilder.js → mjs/src/components/builders/ArrowBuilder.mjs} +2 -2
- package/dist/mjs/src/components/builders/FreehandLineBuilder.d.ts +33 -0
- package/dist/{src/components/builders/FreehandLineBuilder.js → mjs/src/components/builders/FreehandLineBuilder.mjs} +7 -7
- package/dist/mjs/src/components/builders/LineBuilder.d.ts +18 -0
- package/dist/{src/components/builders/LineBuilder.js → mjs/src/components/builders/LineBuilder.mjs} +2 -2
- package/dist/mjs/src/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +36 -0
- package/dist/{src/components/builders/PressureSensitiveFreehandLineBuilder.js → mjs/src/components/builders/PressureSensitiveFreehandLineBuilder.mjs} +6 -6
- package/dist/mjs/src/components/builders/RectangleBuilder.d.ts +20 -0
- package/dist/{src/components/builders/RectangleBuilder.js → mjs/src/components/builders/RectangleBuilder.mjs} +4 -4
- package/dist/mjs/src/components/builders/types.d.ts +12 -0
- package/dist/mjs/src/components/builders/types.mjs +1 -0
- package/dist/{src/components/lib.js → mjs/src/components/lib.d.ts} +3 -3
- package/dist/mjs/src/components/lib.mjs +12 -0
- package/dist/mjs/src/components/localization.d.ts +11 -0
- package/dist/mjs/src/components/util/StrokeSmoother.d.ts +35 -0
- package/dist/{src/components/util/StrokeSmoother.js → mjs/src/components/util/StrokeSmoother.mjs} +3 -3
- package/dist/mjs/src/components/util/describeComponentList.d.ts +4 -0
- package/dist/{src/lib.js → mjs/src/lib.d.ts} +4 -3
- package/dist/mjs/src/lib.mjs +34 -0
- package/dist/mjs/src/localization.d.ts +14 -0
- package/dist/{src/localization.js → mjs/src/localization.mjs} +5 -5
- package/dist/mjs/src/localizations/de.d.ts +3 -0
- package/dist/{src/localizations/de.js → mjs/src/localizations/de.mjs} +1 -1
- package/dist/mjs/src/localizations/en.d.ts +3 -0
- package/dist/{src/localizations/en.js → mjs/src/localizations/en.mjs} +1 -1
- package/dist/mjs/src/localizations/es.d.ts +3 -0
- package/dist/{src/localizations/es.js → mjs/src/localizations/es.mjs} +1 -1
- package/dist/mjs/src/localizations/getLocalizationTable.d.ts +3 -0
- package/dist/{src/localizations/getLocalizationTable.js → mjs/src/localizations/getLocalizationTable.mjs} +4 -4
- package/dist/mjs/src/math/LineSegment2.d.ts +24 -0
- package/dist/{src/math/LineSegment2.js → mjs/src/math/LineSegment2.mjs} +2 -2
- package/dist/mjs/src/math/Mat33.d.ts +118 -0
- package/dist/{src/math/Mat33.js → mjs/src/math/Mat33.mjs} +2 -2
- package/dist/mjs/src/math/Path.d.ts +71 -0
- package/dist/{src/math/Path.js → mjs/src/math/Path.mjs} +5 -5
- package/dist/mjs/src/math/Rect2.d.ts +52 -0
- package/dist/{src/math/Rect2.js → mjs/src/math/Rect2.mjs} +2 -2
- package/dist/mjs/src/math/Triangle.d.ts +11 -0
- package/dist/mjs/src/math/Vec2.d.ts +13 -0
- package/dist/{src/math/Vec2.js → mjs/src/math/Vec2.mjs} +1 -1
- package/dist/mjs/src/math/Vec3.d.ts +106 -0
- package/dist/mjs/src/math/lib.mjs +7 -0
- package/dist/mjs/src/math/rounding.d.ts +4 -0
- package/dist/mjs/src/rendering/Display.d.ts +75 -0
- package/dist/{src/rendering/Display.js → mjs/src/rendering/Display.mjs} +7 -7
- package/dist/mjs/src/rendering/RenderingStyle.d.ts +31 -0
- package/dist/{src/rendering/RenderingStyle.js → mjs/src/rendering/RenderingStyle.mjs} +1 -1
- package/dist/mjs/src/rendering/TextRenderingStyle.d.ts +36 -0
- package/dist/{src/rendering/TextRenderingStyle.js → mjs/src/rendering/TextRenderingStyle.mjs} +1 -1
- package/dist/mjs/src/rendering/caching/CacheRecord.d.ts +20 -0
- package/dist/{src/rendering/caching/CacheRecord.js → mjs/src/rendering/caching/CacheRecord.mjs} +1 -1
- package/dist/mjs/src/rendering/caching/CacheRecordManager.d.ts +12 -0
- package/dist/{src/rendering/caching/CacheRecordManager.js → mjs/src/rendering/caching/CacheRecordManager.mjs} +1 -1
- package/dist/mjs/src/rendering/caching/RenderingCache.d.ts +11 -0
- package/dist/{src/rendering/caching/RenderingCache.js → mjs/src/rendering/caching/RenderingCache.mjs} +3 -3
- package/dist/mjs/src/rendering/caching/RenderingCacheNode.d.ts +29 -0
- package/dist/{src/rendering/caching/RenderingCacheNode.js → mjs/src/rendering/caching/RenderingCacheNode.mjs} +3 -3
- package/dist/mjs/src/rendering/caching/testUtils.d.ts +9 -0
- package/dist/{src/rendering/caching/testUtils.js → mjs/src/rendering/caching/testUtils.mjs} +4 -4
- package/dist/mjs/src/rendering/caching/types.d.ts +19 -0
- package/dist/mjs/src/rendering/caching/types.mjs +1 -0
- package/dist/{src/rendering/lib.js → mjs/src/rendering/lib.d.ts} +2 -0
- package/dist/mjs/src/rendering/lib.mjs +5 -0
- package/dist/mjs/src/rendering/localization.d.ts +10 -0
- package/dist/mjs/src/rendering/renderers/AbstractRenderer.d.ts +68 -0
- package/dist/{src/rendering/renderers/AbstractRenderer.js → mjs/src/rendering/renderers/AbstractRenderer.mjs} +3 -3
- package/dist/mjs/src/rendering/renderers/CanvasRenderer.d.ts +63 -0
- package/dist/{src/rendering/renderers/CanvasRenderer.js → mjs/src/rendering/renderers/CanvasRenderer.mjs} +32 -5
- package/dist/mjs/src/rendering/renderers/DummyRenderer.d.ts +35 -0
- package/dist/{src/rendering/renderers/DummyRenderer.js → mjs/src/rendering/renderers/DummyRenderer.mjs} +2 -2
- package/dist/mjs/src/rendering/renderers/SVGRenderer.d.ts +57 -0
- package/dist/{src/rendering/renderers/SVGRenderer.js → mjs/src/rendering/renderers/SVGRenderer.mjs} +33 -7
- package/dist/mjs/src/rendering/renderers/TextOnlyRenderer.d.ts +29 -0
- package/dist/{src/rendering/renderers/TextOnlyRenderer.js → mjs/src/rendering/renderers/TextOnlyRenderer.mjs} +2 -2
- package/dist/mjs/src/testing/beforeEachFile.d.ts +1 -0
- package/dist/{src/testing/beforeEachFile.js → mjs/src/testing/beforeEachFile.mjs} +1 -1
- package/dist/mjs/src/testing/createEditor.d.ts +4 -0
- package/dist/{src/testing/createEditor.js → mjs/src/testing/createEditor.mjs} +2 -2
- package/dist/mjs/src/testing/lib.d.ts +2 -0
- package/dist/mjs/src/testing/lib.mjs +2 -0
- package/dist/mjs/src/testing/loadExpectExtensions.d.ts +2 -0
- package/dist/mjs/src/testing/sendPenEvent.d.ts +12 -0
- package/dist/mjs/src/testing/sendPenEvent.mjs +19 -0
- package/dist/mjs/src/testing/sendTouchEvent.d.ts +42 -0
- package/dist/mjs/src/testing/sendTouchEvent.mjs +62 -0
- package/dist/mjs/src/toolbar/HTMLToolbar.d.ts +103 -0
- package/dist/{src/toolbar/HTMLToolbar.js → mjs/src/toolbar/HTMLToolbar.mjs} +17 -17
- package/dist/mjs/src/toolbar/IconProvider.d.ts +62 -0
- package/dist/{src/toolbar/IconProvider.js → mjs/src/toolbar/IconProvider.mjs} +4 -4
- package/dist/mjs/src/toolbar/lib.mjs +3 -0
- package/dist/mjs/src/toolbar/localization.d.ts +49 -0
- package/dist/mjs/src/toolbar/makeColorInput.d.ts +6 -0
- package/dist/{src/toolbar/makeColorInput.js → mjs/src/toolbar/makeColorInput.mjs} +3 -3
- package/dist/mjs/src/toolbar/types.d.ts +4 -0
- package/dist/mjs/src/toolbar/types.mjs +1 -0
- package/dist/mjs/src/toolbar/widgets/ActionButtonWidget.d.ts +15 -0
- package/dist/{src/toolbar/widgets/ActionButtonWidget.js → mjs/src/toolbar/widgets/ActionButtonWidget.mjs} +1 -1
- package/dist/mjs/src/toolbar/widgets/BaseToolWidget.d.ts +11 -0
- package/dist/{src/toolbar/widgets/BaseToolWidget.js → mjs/src/toolbar/widgets/BaseToolWidget.mjs} +2 -2
- package/dist/mjs/src/toolbar/widgets/BaseWidget.d.ts +72 -0
- package/dist/{src/toolbar/widgets/BaseWidget.js → mjs/src/toolbar/widgets/BaseWidget.mjs} +3 -3
- package/dist/mjs/src/toolbar/widgets/DocumentPropertiesWidget.d.ts +18 -0
- package/dist/{src/toolbar/widgets/DocumentPropertiesWidget.js → mjs/src/toolbar/widgets/DocumentPropertiesWidget.mjs} +9 -7
- package/dist/mjs/src/toolbar/widgets/EraserToolWidget.d.ts +17 -0
- package/dist/{src/toolbar/widgets/EraserToolWidget.js → mjs/src/toolbar/widgets/EraserToolWidget.mjs} +3 -3
- package/dist/mjs/src/toolbar/widgets/HandToolWidget.d.ts +17 -0
- package/dist/{src/toolbar/widgets/HandToolWidget.js → mjs/src/toolbar/widgets/HandToolWidget.mjs} +7 -7
- package/dist/mjs/src/toolbar/widgets/InsertImageWidget.d.ts +19 -0
- package/dist/{src/toolbar/widgets/InsertImageWidget.js → mjs/src/toolbar/widgets/InsertImageWidget.mjs} +8 -8
- package/dist/mjs/src/toolbar/widgets/OverflowWidget.d.ts +25 -0
- package/dist/{src/toolbar/widgets/OverflowWidget.js → mjs/src/toolbar/widgets/OverflowWidget.mjs} +1 -1
- package/dist/mjs/src/toolbar/widgets/PenToolWidget.d.ts +27 -0
- package/dist/{src/toolbar/widgets/PenToolWidget.js → mjs/src/toolbar/widgets/PenToolWidget.mjs} +11 -10
- package/dist/mjs/src/toolbar/widgets/SelectionToolWidget.d.ts +13 -0
- package/dist/{src/toolbar/widgets/SelectionToolWidget.js → mjs/src/toolbar/widgets/SelectionToolWidget.mjs} +8 -8
- package/dist/mjs/src/toolbar/widgets/TextToolWidget.d.ts +16 -0
- package/dist/{src/toolbar/widgets/TextToolWidget.js → mjs/src/toolbar/widgets/TextToolWidget.mjs} +9 -6
- package/dist/mjs/src/toolbar/widgets/lib.mjs +10 -0
- package/dist/mjs/src/tools/BaseTool.d.ts +22 -0
- package/dist/{src/tools/BaseTool.js → mjs/src/tools/BaseTool.mjs} +1 -1
- package/dist/mjs/src/tools/Eraser.d.ts +23 -0
- package/dist/{src/tools/Eraser.js → mjs/src/tools/Eraser.mjs} +8 -8
- package/dist/mjs/src/tools/FindTool.d.ts +21 -0
- package/dist/{src/tools/FindTool.js → mjs/src/tools/FindTool.mjs} +2 -2
- package/dist/mjs/src/tools/PanZoom.d.ts +52 -0
- package/dist/{src/tools/PanZoom.js → mjs/src/tools/PanZoom.mjs} +8 -8
- package/dist/mjs/src/tools/PasteHandler.d.ts +23 -0
- package/dist/{src/tools/PasteHandler.js → mjs/src/tools/PasteHandler.mjs} +7 -7
- package/dist/mjs/src/tools/Pen.d.ts +39 -0
- package/dist/{src/tools/Pen.js → mjs/src/tools/Pen.mjs} +5 -5
- package/dist/mjs/src/tools/PipetteTool.d.ts +18 -0
- package/dist/{src/tools/PipetteTool.js → mjs/src/tools/PipetteTool.mjs} +1 -1
- package/dist/mjs/src/tools/SelectionTool/SelectAllShortcutHandler.d.ts +8 -0
- package/dist/{src/tools/SelectionTool/SelectAllShortcutHandler.js → mjs/src/tools/SelectionTool/SelectAllShortcutHandler.mjs} +2 -2
- package/dist/mjs/src/tools/SelectionTool/Selection.d.ts +64 -0
- package/dist/{src/tools/SelectionTool/Selection.js → mjs/src/tools/SelectionTool/Selection.mjs} +12 -12
- package/dist/mjs/src/tools/SelectionTool/SelectionHandle.d.ts +38 -0
- package/dist/{src/tools/SelectionTool/SelectionHandle.js → mjs/src/tools/SelectionTool/SelectionHandle.mjs} +3 -3
- package/dist/mjs/src/tools/SelectionTool/SelectionTool.d.ts +36 -0
- package/dist/{src/tools/SelectionTool/SelectionTool.js → mjs/src/tools/SelectionTool/SelectionTool.mjs} +13 -14
- package/dist/mjs/src/tools/SelectionTool/TransformMode.d.ts +34 -0
- package/dist/{src/tools/SelectionTool/TransformMode.js → mjs/src/tools/SelectionTool/TransformMode.mjs} +4 -4
- package/dist/mjs/src/tools/SelectionTool/types.d.ts +9 -0
- package/dist/mjs/src/tools/TextTool.d.ts +33 -0
- package/dist/{src/tools/TextTool.js → mjs/src/tools/TextTool.mjs} +11 -11
- package/dist/mjs/src/tools/ToolController.d.ts +18 -0
- package/dist/{src/tools/ToolController.js → mjs/src/tools/ToolController.mjs} +16 -16
- package/dist/mjs/src/tools/ToolEnabledGroup.d.ts +6 -0
- package/dist/mjs/src/tools/ToolSwitcherShortcut.d.ts +16 -0
- package/dist/{src/tools/ToolSwitcherShortcut.js → mjs/src/tools/ToolSwitcherShortcut.mjs} +1 -1
- package/dist/mjs/src/tools/ToolbarShortcutHandler.d.ts +12 -0
- package/dist/{src/tools/ToolbarShortcutHandler.js → mjs/src/tools/ToolbarShortcutHandler.mjs} +1 -1
- package/dist/mjs/src/tools/UndoRedoShortcut.d.ts +8 -0
- package/dist/{src/tools/UndoRedoShortcut.js → mjs/src/tools/UndoRedoShortcut.mjs} +1 -1
- package/dist/{src/tools/lib.js → mjs/src/tools/lib.d.ts} +1 -1
- package/dist/mjs/src/tools/lib.mjs +16 -0
- package/dist/mjs/src/tools/localization.d.ts +28 -0
- package/dist/mjs/src/types.d.ts +151 -0
- package/dist/mjs/src/util/assertions.d.ts +23 -0
- package/dist/mjs/src/util/fileToBase64.d.ts +3 -0
- package/dist/mjs/src/util/untilNextAnimationFrame.d.ts +3 -0
- package/dist/mjs/src/util/waitForTimeout.d.ts +2 -0
- package/package.json +34 -33
- package/src/Color4.ts +2 -0
- package/src/Editor.ts +62 -28
- package/src/EditorImage.ts +4 -2
- package/src/SVGLoader.ts +4 -0
- package/src/lib.ts +2 -1
- package/src/rendering/lib.ts +2 -0
- package/src/rendering/renderers/CanvasRenderer.ts +27 -0
- package/src/rendering/renderers/SVGRenderer.ts +32 -1
- package/src/testing/lib.ts +3 -0
- package/src/testing/sendPenEvent.ts +31 -0
- package/src/testing/sendTouchEvent.ts +36 -1
- package/src/toolbar/toolbar.css +5 -0
- package/src/toolbar/widgets/DocumentPropertiesWidget.ts +4 -2
- package/src/toolbar/widgets/PenToolWidget.ts +1 -0
- package/src/toolbar/widgets/TextToolWidget.ts +4 -1
- package/src/tools/Eraser.test.ts +11 -10
- package/src/tools/PanZoom.test.ts +1 -1
- package/src/tools/Pen.test.ts +63 -62
- package/src/tools/SelectionTool/SelectionTool.test.ts +15 -14
- package/src/tools/SelectionTool/SelectionTool.ts +5 -7
- package/tsconfig.json +3 -2
- package/tsconfig.mjs.json +9 -0
- package/dist/src/testing/sendTouchEvent.d.ts +0 -6
- package/dist/src/testing/sendTouchEvent.js +0 -26
- /package/dist/{build_tools → cjs/build_tools}/BundledFile.d.ts +0 -0
- /package/dist/{build_tools → cjs/build_tools}/buildTranslationTemplate.d.ts +0 -0
- /package/dist/{build_tools → cjs/build_tools}/bundle.d.ts +0 -0
- /package/dist/{src/components/builders/types.js → cjs/build_tools/postDist.d.ts} +0 -0
- /package/dist/{src → cjs/src}/EventDispatcher.d.ts +0 -0
- /package/dist/{src → cjs/src}/Pointer.d.ts +0 -0
- /package/dist/{src → cjs/src}/UndoRedoHistory.d.ts +0 -0
- /package/dist/{src → cjs/src}/Viewport.d.ts +0 -0
- /package/dist/{src → cjs/src}/bundle/bundled.d.ts +0 -0
- /package/dist/{src → cjs/src}/commands/Command.d.ts +0 -0
- /package/dist/{src → cjs/src}/commands/Duplicate.d.ts +0 -0
- /package/dist/{src → cjs/src}/commands/Erase.d.ts +0 -0
- /package/dist/{src → cjs/src}/commands/SerializableCommand.d.ts +0 -0
- /package/dist/{src → cjs/src}/commands/UnresolvedCommand.d.ts +0 -0
- /package/dist/{src → cjs/src}/commands/invertCommand.d.ts +0 -0
- /package/dist/{src → cjs/src}/commands/lib.d.ts +0 -0
- /package/dist/{src → cjs/src}/commands/localization.d.ts +0 -0
- /package/dist/{src → cjs/src}/commands/uniteCommands.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/AbstractComponent.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/ImageBackground.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/ImageComponent.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/RestylableComponent.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/SVGGlobalAttributesObject.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/Stroke.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/TextComponent.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/UnknownSVGObject.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/builders/ArrowBuilder.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/builders/FreehandLineBuilder.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/builders/LineBuilder.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/builders/RectangleBuilder.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/builders/types.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/lib.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/localization.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/util/StrokeSmoother.d.ts +0 -0
- /package/dist/{src → cjs/src}/components/util/describeComponentList.d.ts +0 -0
- /package/dist/{src → cjs/src}/localization.d.ts +0 -0
- /package/dist/{src → cjs/src}/localizations/de.d.ts +0 -0
- /package/dist/{src → cjs/src}/localizations/en.d.ts +0 -0
- /package/dist/{src → cjs/src}/localizations/es.d.ts +0 -0
- /package/dist/{src → cjs/src}/localizations/getLocalizationTable.d.ts +0 -0
- /package/dist/{src → cjs/src}/math/LineSegment2.d.ts +0 -0
- /package/dist/{src → cjs/src}/math/Mat33.d.ts +0 -0
- /package/dist/{src → cjs/src}/math/Path.d.ts +0 -0
- /package/dist/{src → cjs/src}/math/Rect2.d.ts +0 -0
- /package/dist/{src → cjs/src}/math/Triangle.d.ts +0 -0
- /package/dist/{src → cjs/src}/math/Vec2.d.ts +0 -0
- /package/dist/{src → cjs/src}/math/Vec3.d.ts +0 -0
- /package/dist/{src → cjs/src}/math/lib.d.ts +0 -0
- /package/dist/{src → cjs/src}/math/rounding.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/Display.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/RenderingStyle.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/TextRenderingStyle.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/caching/CacheRecord.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/caching/CacheRecordManager.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/caching/RenderingCache.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/caching/RenderingCacheNode.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/caching/testUtils.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/caching/types.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/localization.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/renderers/AbstractRenderer.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/renderers/DummyRenderer.d.ts +0 -0
- /package/dist/{src → cjs/src}/rendering/renderers/TextOnlyRenderer.d.ts +0 -0
- /package/dist/{src → cjs/src}/testing/beforeEachFile.d.ts +0 -0
- /package/dist/{src → cjs/src}/testing/createEditor.d.ts +0 -0
- /package/dist/{src → cjs/src}/testing/loadExpectExtensions.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/HTMLToolbar.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/IconProvider.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/lib.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/localization.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/makeColorInput.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/types.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/ActionButtonWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/BaseToolWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/BaseWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/DocumentPropertiesWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/EraserToolWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/HandToolWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/InsertImageWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/OverflowWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/PenToolWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/SelectionToolWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/TextToolWidget.d.ts +0 -0
- /package/dist/{src → cjs/src}/toolbar/widgets/lib.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/BaseTool.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/Eraser.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/FindTool.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/PanZoom.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/PasteHandler.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/Pen.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/PipetteTool.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/SelectionTool/SelectAllShortcutHandler.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/SelectionTool/Selection.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/SelectionTool/SelectionHandle.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/SelectionTool/SelectionTool.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/SelectionTool/TransformMode.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/SelectionTool/types.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/TextTool.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/ToolController.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/ToolEnabledGroup.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/ToolSwitcherShortcut.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/ToolbarShortcutHandler.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/UndoRedoShortcut.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/lib.d.ts +0 -0
- /package/dist/{src → cjs/src}/tools/localization.d.ts +0 -0
- /package/dist/{src → cjs/src}/types.d.ts +0 -0
- /package/dist/{src → cjs/src}/util/assertions.d.ts +0 -0
- /package/dist/{src → cjs/src}/util/fileToBase64.d.ts +0 -0
- /package/dist/{src → cjs/src}/util/untilNextAnimationFrame.d.ts +0 -0
- /package/dist/{src → cjs/src}/util/waitForTimeout.d.ts +0 -0
- /package/dist/{build_tools/BundledFile.js → mjs/build_tools/BundledFile.mjs} +0 -0
- /package/dist/{src/rendering/caching/types.js → mjs/build_tools/buildTranslationTemplate.d.ts} +0 -0
- /package/dist/{src/toolbar/types.js → mjs/build_tools/bundle.d.ts} +0 -0
- /package/dist/{src/EventDispatcher.js → mjs/src/EventDispatcher.mjs} +0 -0
- /package/dist/{src/commands/Command.js → mjs/src/commands/Command.mjs} +0 -0
- /package/dist/{src/commands/lib.js → mjs/src/commands/lib.d.ts} +0 -0
- /package/dist/{src/commands/localization.js → mjs/src/commands/localization.mjs} +0 -0
- /package/dist/{src/components/localization.js → mjs/src/components/localization.mjs} +0 -0
- /package/dist/{src/components/util/describeComponentList.js → mjs/src/components/util/describeComponentList.mjs} +0 -0
- /package/dist/{src/math/Triangle.js → mjs/src/math/Triangle.mjs} +0 -0
- /package/dist/{src/math/Vec3.js → mjs/src/math/Vec3.mjs} +0 -0
- /package/dist/{src/math/lib.js → mjs/src/math/lib.d.ts} +0 -0
- /package/dist/{src/math/rounding.js → mjs/src/math/rounding.mjs} +0 -0
- /package/dist/{src/rendering/localization.js → mjs/src/rendering/localization.mjs} +0 -0
- /package/dist/{src/testing/loadExpectExtensions.js → mjs/src/testing/loadExpectExtensions.mjs} +0 -0
- /package/dist/{src/toolbar/lib.js → mjs/src/toolbar/lib.d.ts} +0 -0
- /package/dist/{src/toolbar/localization.js → mjs/src/toolbar/localization.mjs} +0 -0
- /package/dist/{src/toolbar/widgets/lib.js → mjs/src/toolbar/widgets/lib.d.ts} +0 -0
- /package/dist/{src/tools/SelectionTool/types.js → mjs/src/tools/SelectionTool/types.mjs} +0 -0
- /package/dist/{src/tools/ToolEnabledGroup.js → mjs/src/tools/ToolEnabledGroup.mjs} +0 -0
- /package/dist/{src/tools/localization.js → mjs/src/tools/localization.mjs} +0 -0
- /package/dist/{src/types.js → mjs/src/types.mjs} +0 -0
- /package/dist/{src/util/assertions.js → mjs/src/util/assertions.mjs} +0 -0
- /package/dist/{src/util/fileToBase64.js → mjs/src/util/fileToBase64.mjs} +0 -0
- /package/dist/{src/util/untilNextAnimationFrame.js → mjs/src/util/untilNextAnimationFrame.mjs} +0 -0
- /package/dist/{src/util/waitForTimeout.js → mjs/src/util/waitForTimeout.mjs} +0 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
import Editor from '../Editor';
|
2
|
+
import { ToolbarLocalization } from './localization';
|
3
|
+
import { ActionButtonIcon } from './types';
|
4
|
+
import BaseWidget from './widgets/BaseWidget';
|
5
|
+
export declare const toolbarCSSPrefix = "toolbar-";
|
6
|
+
interface SpacerOptions {
|
7
|
+
grow: number;
|
8
|
+
minSize: string;
|
9
|
+
maxSize: string;
|
10
|
+
}
|
11
|
+
export default class HTMLToolbar {
|
12
|
+
private editor;
|
13
|
+
private localizationTable;
|
14
|
+
private container;
|
15
|
+
private resizeObserver;
|
16
|
+
private listeners;
|
17
|
+
private widgetOrderCounter;
|
18
|
+
private widgetsById;
|
19
|
+
private widgetList;
|
20
|
+
private overflowWidget;
|
21
|
+
private static colorisStarted;
|
22
|
+
private updateColoris;
|
23
|
+
/** @internal */
|
24
|
+
constructor(editor: Editor, parent: HTMLElement, localizationTable?: ToolbarLocalization);
|
25
|
+
setupColorPickers(): void;
|
26
|
+
private reLayoutQueued;
|
27
|
+
private queueReLayout;
|
28
|
+
private reLayout;
|
29
|
+
/**
|
30
|
+
* Adds an `ActionButtonWidget` or `BaseToolWidget`. The widget should not have already have a parent
|
31
|
+
* (i.e. its `addTo` method should not have been called).
|
32
|
+
*
|
33
|
+
* @example
|
34
|
+
* ```ts
|
35
|
+
* const toolbar = editor.addToolbar();
|
36
|
+
* const insertImageWidget = new InsertImageWidget(editor);
|
37
|
+
* toolbar.addWidget(insertImageWidget);
|
38
|
+
* ```
|
39
|
+
*/
|
40
|
+
addWidget(widget: BaseWidget): void;
|
41
|
+
/**
|
42
|
+
* Adds a spacer.
|
43
|
+
*
|
44
|
+
* @example
|
45
|
+
* Adding a save button that moves to the very right edge of the toolbar
|
46
|
+
* while keeping the other buttons centered:
|
47
|
+
* ```ts
|
48
|
+
* const toolbar = editor.addToolbar(false);
|
49
|
+
*
|
50
|
+
* toolbar.addSpacer({ grow: 1 });
|
51
|
+
* toolbar.addDefaults();
|
52
|
+
* toolbar.addSpacer({ grow: 1 });
|
53
|
+
*
|
54
|
+
* toolbar.addActionButton({
|
55
|
+
* label: 'Save',
|
56
|
+
* icon: editor.icons.makeSaveIcon(),
|
57
|
+
* }, () => {
|
58
|
+
* saveCallback();
|
59
|
+
* });
|
60
|
+
* ```
|
61
|
+
*/
|
62
|
+
addSpacer(options?: Partial<SpacerOptions>): void;
|
63
|
+
serializeState(): string;
|
64
|
+
/**
|
65
|
+
* Deserialize toolbar widgets from the given state.
|
66
|
+
* Assumes that toolbar widgets are in the same order as when state was serialized.
|
67
|
+
*/
|
68
|
+
deserializeState(state: string): void;
|
69
|
+
/**
|
70
|
+
* Adds an action button with `title` to this toolbar (or to the given `parent` element).
|
71
|
+
*
|
72
|
+
* @return The added button.
|
73
|
+
*/
|
74
|
+
addActionButton(title: string | ActionButtonIcon, command: () => void, mustBeToplevel?: boolean): BaseWidget;
|
75
|
+
addUndoRedoButtons(): void;
|
76
|
+
addDefaultToolWidgets(): void;
|
77
|
+
addDefaultActionButtons(): void;
|
78
|
+
/**
|
79
|
+
* Adds a widget that toggles the overflow menu. Call `addOverflowWidget` to ensure
|
80
|
+
* that this widget is in the correct space (if shown).
|
81
|
+
*
|
82
|
+
* @example
|
83
|
+
* ```ts
|
84
|
+
* toolbar.addDefaultToolWidgets();
|
85
|
+
* toolbar.addOverflowWidget();
|
86
|
+
* toolbar.addDefaultActionButtons();
|
87
|
+
* ```
|
88
|
+
* shows the overflow widget between the default tool widgets and the default action buttons,
|
89
|
+
* if shown.
|
90
|
+
*/
|
91
|
+
addOverflowWidget(): void;
|
92
|
+
/**
|
93
|
+
* Adds both the default tool widgets and action buttons. Equivalent to
|
94
|
+
* ```ts
|
95
|
+
* toolbar.addDefaultToolWidgets();
|
96
|
+
* toolbar.addOverflowWidget();
|
97
|
+
* toolbar.addDefaultActionButtons();
|
98
|
+
* ```
|
99
|
+
*/
|
100
|
+
addDefaults(): void;
|
101
|
+
remove(): void;
|
102
|
+
}
|
103
|
+
export {};
|
@@ -1,21 +1,21 @@
|
|
1
|
-
import
|
1
|
+
import { EditorEventType } from '../types.mjs';
|
2
2
|
import { coloris, init as colorisInit } from '@melloware/coloris';
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import
|
16
|
-
import
|
17
|
-
import
|
18
|
-
import
|
3
|
+
import Color4 from '../Color4.mjs';
|
4
|
+
import { defaultToolbarLocalization } from './localization.mjs';
|
5
|
+
import SelectionTool from '../tools/SelectionTool/SelectionTool.mjs';
|
6
|
+
import PanZoomTool from '../tools/PanZoom.mjs';
|
7
|
+
import TextTool from '../tools/TextTool.mjs';
|
8
|
+
import EraserTool from '../tools/Eraser.mjs';
|
9
|
+
import PenTool from '../tools/Pen.mjs';
|
10
|
+
import PenToolWidget from './widgets/PenToolWidget.mjs';
|
11
|
+
import EraserWidget from './widgets/EraserToolWidget.mjs';
|
12
|
+
import SelectionToolWidget from './widgets/SelectionToolWidget.mjs';
|
13
|
+
import TextToolWidget from './widgets/TextToolWidget.mjs';
|
14
|
+
import HandToolWidget from './widgets/HandToolWidget.mjs';
|
15
|
+
import ActionButtonWidget from './widgets/ActionButtonWidget.mjs';
|
16
|
+
import InsertImageWidget from './widgets/InsertImageWidget.mjs';
|
17
|
+
import DocumentPropertiesWidget from './widgets/DocumentPropertiesWidget.mjs';
|
18
|
+
import OverflowWidget from './widgets/OverflowWidget.mjs';
|
19
19
|
export const toolbarCSSPrefix = 'toolbar-';
|
20
20
|
export default class HTMLToolbar {
|
21
21
|
/** @internal */
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import Color4 from '../Color4';
|
2
|
+
import { ComponentBuilderFactory } from '../components/builders/types';
|
3
|
+
import TextStyle from '../rendering/TextRenderingStyle';
|
4
|
+
import Pen from '../tools/Pen';
|
5
|
+
export type IconType = HTMLImageElement | SVGElement;
|
6
|
+
/**
|
7
|
+
* Provides icons that can be used in the toolbar, etc.
|
8
|
+
* Extend this class and override methods to customize icons.
|
9
|
+
*
|
10
|
+
* @example
|
11
|
+
* ```ts
|
12
|
+
* class CustomIconProvider extends jsdraw.IconProvider {
|
13
|
+
* // Use '☺' instead of the default dropdown symbol.
|
14
|
+
* public makeDropdownIcon() {
|
15
|
+
* const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
16
|
+
* icon.innerHTML = `
|
17
|
+
* <text x='5' y='55' style='fill: var(--icon-color); font-size: 50pt;'>☺</text>
|
18
|
+
* `;
|
19
|
+
* icon.setAttribute('viewBox', '0 0 100 100');
|
20
|
+
* return icon;
|
21
|
+
* }
|
22
|
+
* }
|
23
|
+
*
|
24
|
+
* const icons = new CustomIconProvider();
|
25
|
+
* const editor = new jsdraw.Editor(document.body, {
|
26
|
+
* iconProvider: icons,
|
27
|
+
* });
|
28
|
+
*
|
29
|
+
* // Add a toolbar that uses these icons
|
30
|
+
* editor.addToolbar();
|
31
|
+
* ```
|
32
|
+
*/
|
33
|
+
export default class IconProvider {
|
34
|
+
makeUndoIcon(): IconType;
|
35
|
+
makeRedoIcon(mirror?: boolean): IconType;
|
36
|
+
makeDropdownIcon(): IconType;
|
37
|
+
makeEraserIcon(eraserSize?: number): IconType;
|
38
|
+
makeSelectionIcon(): IconType;
|
39
|
+
/**
|
40
|
+
* @param pathData - SVG path data (e.g. `m10,10l30,30z`)
|
41
|
+
* @param fill - A valid CSS color (e.g. `var(--icon-color)` or `#f0f`). This can be `none`.
|
42
|
+
*/
|
43
|
+
protected makeIconFromPath(pathData: string, fill?: string, strokeColor?: string, strokeWidth?: string): IconType;
|
44
|
+
makeHandToolIcon(): IconType;
|
45
|
+
makeTouchPanningIcon(): IconType;
|
46
|
+
makeAllDevicePanningIcon(): IconType;
|
47
|
+
makeZoomIcon(): IconType;
|
48
|
+
makeRotationLockIcon(): IconType;
|
49
|
+
makeInsertImageIcon(): IconType;
|
50
|
+
makeTextIcon(textStyle: TextStyle): IconType;
|
51
|
+
makePenIcon(strokeSize: number, color: string | Color4, rounded?: boolean): IconType;
|
52
|
+
makeIconFromFactory(pen: Pen, factory: ComponentBuilderFactory): IconType;
|
53
|
+
makePipetteIcon(color?: Color4): IconType;
|
54
|
+
makeFormatSelectionIcon(): IconType;
|
55
|
+
makeResizeViewportIcon(): IconType;
|
56
|
+
makeDuplicateSelectionIcon(): IconType;
|
57
|
+
makePasteIcon(): IconType;
|
58
|
+
makeDeleteSelectionIcon(): IconType;
|
59
|
+
makeSaveIcon(): IconType;
|
60
|
+
makeConfigureDocumentIcon(): IconType;
|
61
|
+
makeOverflowIcon(): IconType;
|
62
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
1
|
+
import Color4 from '../Color4.mjs';
|
2
|
+
import { Vec2 } from '../math/Vec2.mjs';
|
3
|
+
import SVGRenderer from '../rendering/renderers/SVGRenderer.mjs';
|
4
|
+
import Viewport from '../Viewport.mjs';
|
5
5
|
const svgNamespace = 'http://www.w3.org/2000/svg';
|
6
6
|
const iconColorFill = `
|
7
7
|
style='fill: var(--icon-color);'
|
@@ -0,0 +1,49 @@
|
|
1
|
+
export interface ToolbarLocalization {
|
2
|
+
fontLabel: string;
|
3
|
+
textSize: string;
|
4
|
+
touchPanning: string;
|
5
|
+
lockRotation: string;
|
6
|
+
outlinedRectanglePen: string;
|
7
|
+
filledRectanglePen: string;
|
8
|
+
linePen: string;
|
9
|
+
arrowPen: string;
|
10
|
+
image: string;
|
11
|
+
inputAltText: string;
|
12
|
+
chooseFile: string;
|
13
|
+
cancel: string;
|
14
|
+
submit: string;
|
15
|
+
freehandPen: string;
|
16
|
+
pressureSensitiveFreehandPen: string;
|
17
|
+
selectObjectType: string;
|
18
|
+
colorLabel: string;
|
19
|
+
pen: string;
|
20
|
+
eraser: string;
|
21
|
+
select: string;
|
22
|
+
handTool: string;
|
23
|
+
thicknessLabel: string;
|
24
|
+
resizeImageToSelection: string;
|
25
|
+
deleteSelection: string;
|
26
|
+
duplicateSelection: string;
|
27
|
+
pickColorFromScreen: string;
|
28
|
+
clickToPickColorAnnouncement: string;
|
29
|
+
reformatSelection: string;
|
30
|
+
undo: string;
|
31
|
+
redo: string;
|
32
|
+
zoom: string;
|
33
|
+
resetView: string;
|
34
|
+
selectionToolKeyboardShortcuts: string;
|
35
|
+
paste: string;
|
36
|
+
documentProperties: string;
|
37
|
+
backgroundColor: string;
|
38
|
+
imageWidthOption: string;
|
39
|
+
imageHeightOption: string;
|
40
|
+
toggleOverflow: string;
|
41
|
+
errorImageHasZeroSize: string;
|
42
|
+
dropdownShown: (toolName: string) => string;
|
43
|
+
dropdownHidden: (toolName: string) => string;
|
44
|
+
zoomLevel: (zoomPercentage: number) => string;
|
45
|
+
colorChangedAnnouncement: (color: string) => string;
|
46
|
+
imageSize: (size: number, units: string) => string;
|
47
|
+
imageLoadError: (message: string) => string;
|
48
|
+
}
|
49
|
+
export declare const defaultToolbarLocalization: ToolbarLocalization;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import Color4 from '../Color4';
|
2
|
+
import Editor from '../Editor';
|
3
|
+
type OnColorChangeListener = (color: Color4) => void;
|
4
|
+
type SetColorCallback = (color: Color4 | string) => void;
|
5
|
+
export declare const makeColorInput: (editor: Editor, onColorChange: OnColorChangeListener) => [HTMLInputElement, HTMLElement, SetColorCallback];
|
6
|
+
export default makeColorInput;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
1
|
+
import Color4 from '../Color4.mjs';
|
2
|
+
import PipetteTool from '../tools/PipetteTool.mjs';
|
3
|
+
import { EditorEventType } from '../types.mjs';
|
4
4
|
// Returns [ color input, input container, callback to change the color value ].
|
5
5
|
export const makeColorInput = (editor, onColorChange) => {
|
6
6
|
const colorInputContainer = document.createElement('span');
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import Editor from '../../Editor';
|
2
|
+
import { ToolbarLocalization } from '../localization';
|
3
|
+
import BaseWidget from './BaseWidget';
|
4
|
+
export default class ActionButtonWidget extends BaseWidget {
|
5
|
+
protected makeIcon: () => Element | null;
|
6
|
+
protected title: string;
|
7
|
+
protected clickAction: () => void;
|
8
|
+
protected mustBeToplevel: boolean;
|
9
|
+
constructor(editor: Editor, id: string, makeIcon: () => Element | null, title: string, clickAction: () => void, localizationTable?: ToolbarLocalization, mustBeToplevel?: boolean);
|
10
|
+
protected handleClick(): void;
|
11
|
+
protected getTitle(): string;
|
12
|
+
protected createIcon(): Element | null;
|
13
|
+
protected fillDropdown(_dropdown: HTMLElement): boolean;
|
14
|
+
canBeInOverflowMenu(): boolean;
|
15
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import BaseWidget from './BaseWidget.mjs';
|
2
2
|
export default class ActionButtonWidget extends BaseWidget {
|
3
3
|
constructor(editor, id, makeIcon, title, clickAction, localizationTable, mustBeToplevel = false) {
|
4
4
|
super(editor, id, localizationTable);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import Editor from '../../Editor';
|
2
|
+
import BaseTool from '../../tools/BaseTool';
|
3
|
+
import { ToolbarLocalization } from '../localization';
|
4
|
+
import BaseWidget from './BaseWidget';
|
5
|
+
export default abstract class BaseToolWidget extends BaseWidget {
|
6
|
+
protected editor: Editor;
|
7
|
+
protected targetTool: BaseTool;
|
8
|
+
constructor(editor: Editor, targetTool: BaseTool, id: string, localizationTable?: ToolbarLocalization);
|
9
|
+
protected handleClick(): void;
|
10
|
+
addTo(parent: HTMLElement): HTMLElement;
|
11
|
+
}
|
package/dist/{src/toolbar/widgets/BaseToolWidget.js → mjs/src/toolbar/widgets/BaseToolWidget.mjs}
RENAMED
@@ -1,5 +1,5 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import { EditorEventType } from '../../types.mjs';
|
2
|
+
import BaseWidget from './BaseWidget.mjs';
|
3
3
|
export default class BaseToolWidget extends BaseWidget {
|
4
4
|
constructor(editor, targetTool, id, localizationTable) {
|
5
5
|
super(editor, id, localizationTable);
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import Editor from '../../Editor';
|
2
|
+
import { KeyPressEvent } from '../../types';
|
3
|
+
import { ToolbarLocalization } from '../localization';
|
4
|
+
export type SavedToolbuttonState = Record<string, any>;
|
5
|
+
export default abstract class BaseWidget {
|
6
|
+
#private;
|
7
|
+
protected editor: Editor;
|
8
|
+
protected id: string;
|
9
|
+
protected readonly container: HTMLElement;
|
10
|
+
private button;
|
11
|
+
private icon;
|
12
|
+
private dropdownContainer;
|
13
|
+
private dropdownIcon;
|
14
|
+
private label;
|
15
|
+
private disabled;
|
16
|
+
private subWidgets;
|
17
|
+
private toplevel;
|
18
|
+
protected readonly localizationTable: ToolbarLocalization;
|
19
|
+
constructor(editor: Editor, id: string, localizationTable?: ToolbarLocalization);
|
20
|
+
getId(): string;
|
21
|
+
/**
|
22
|
+
* Returns the ID of this widget in `container`. Adds a suffix to this' ID
|
23
|
+
* if an item in `container` already has this' ID.
|
24
|
+
*
|
25
|
+
* For example, if `this` has ID `foo` and if
|
26
|
+
* `container = { 'foo': somethingNotThis, 'foo-1': somethingElseNotThis }`, this method
|
27
|
+
* returns `foo-2` because elements with IDs `foo` and `foo-1` are already present in
|
28
|
+
* `container`.
|
29
|
+
*/
|
30
|
+
getUniqueIdIn(container: Record<string, BaseWidget>): string;
|
31
|
+
protected abstract getTitle(): string;
|
32
|
+
protected abstract createIcon(): Element | null;
|
33
|
+
protected fillDropdown(dropdown: HTMLElement): boolean;
|
34
|
+
protected setupActionBtnClickListener(button: HTMLElement): void;
|
35
|
+
protected onKeyPress(_event: KeyPressEvent): boolean;
|
36
|
+
protected abstract handleClick(): void;
|
37
|
+
protected get hasDropdown(): boolean;
|
38
|
+
protected addSubWidget(widget: BaseWidget): void;
|
39
|
+
private toolbarWidgetToggleListener;
|
40
|
+
addTo(parent: HTMLElement): HTMLElement;
|
41
|
+
protected updateIcon(): void;
|
42
|
+
setDisabled(disabled: boolean): void;
|
43
|
+
setSelected(selected: boolean): void;
|
44
|
+
protected setDropdownVisible(visible: boolean): void;
|
45
|
+
canBeInOverflowMenu(): boolean;
|
46
|
+
getButtonWidth(): number;
|
47
|
+
isHidden(): boolean;
|
48
|
+
setHidden(hidden: boolean): void;
|
49
|
+
protected repositionDropdown(): void;
|
50
|
+
/** Set whether the widget is contained within another. @internal */
|
51
|
+
setIsToplevel(toplevel: boolean): void;
|
52
|
+
protected isDropdownVisible(): boolean;
|
53
|
+
protected isSelected(): boolean;
|
54
|
+
private createDropdownIcon;
|
55
|
+
/**
|
56
|
+
* Serialize state associated with this widget.
|
57
|
+
* Override this method to allow saving/restoring from state on application load.
|
58
|
+
*
|
59
|
+
* Overriders should call `super` and include the output of `super.serializeState` in
|
60
|
+
* the output dictionary.
|
61
|
+
*
|
62
|
+
* Clients should not rely on the output from `saveState` being in any particular
|
63
|
+
* format.
|
64
|
+
*/
|
65
|
+
serializeState(): SavedToolbuttonState;
|
66
|
+
/**
|
67
|
+
* Restore widget state from serialized data. See also `saveState`.
|
68
|
+
*
|
69
|
+
* Overriders must call `super`.
|
70
|
+
*/
|
71
|
+
deserializeFrom(state: SavedToolbuttonState): void;
|
72
|
+
}
|
@@ -10,9 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
11
|
};
|
12
12
|
var _BaseWidget_hasDropdown;
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import
|
13
|
+
import ToolbarShortcutHandler from '../../tools/ToolbarShortcutHandler.mjs';
|
14
|
+
import { EditorEventType, InputEvtType } from '../../types.mjs';
|
15
|
+
import { toolbarCSSPrefix } from '../HTMLToolbar.mjs';
|
16
16
|
export default class BaseWidget {
|
17
17
|
constructor(editor, id, localizationTable) {
|
18
18
|
this.editor = editor;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import Editor from '../../Editor';
|
2
|
+
import { ToolbarLocalization } from '../localization';
|
3
|
+
import BaseWidget from './BaseWidget';
|
4
|
+
export default class DocumentPropertiesWidget extends BaseWidget {
|
5
|
+
private updateDropdownContent;
|
6
|
+
constructor(editor: Editor, localizationTable?: ToolbarLocalization);
|
7
|
+
protected getTitle(): string;
|
8
|
+
protected createIcon(): Element;
|
9
|
+
protected handleClick(): void;
|
10
|
+
private dropdownUpdateQueued;
|
11
|
+
private queueDropdownUpdate;
|
12
|
+
private updateDropdown;
|
13
|
+
private setBackgroundColor;
|
14
|
+
private getBackgroundColor;
|
15
|
+
private updateImportExportRectSize;
|
16
|
+
private static idCounter;
|
17
|
+
protected fillDropdown(dropdown: HTMLElement): boolean;
|
18
|
+
}
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
1
|
+
import { EditorImageEventType } from '../../EditorImage.mjs';
|
2
|
+
import Rect2 from '../../math/Rect2.mjs';
|
3
|
+
import { EditorEventType } from '../../types.mjs';
|
4
|
+
import { toolbarCSSPrefix } from '../HTMLToolbar.mjs';
|
5
|
+
import makeColorInput from '../makeColorInput.mjs';
|
6
|
+
import BaseWidget from './BaseWidget.mjs';
|
6
7
|
export default class DocumentPropertiesWidget extends BaseWidget {
|
7
8
|
constructor(editor, localizationTable) {
|
8
9
|
super(editor, 'zoom-widget', localizationTable);
|
@@ -61,6 +62,7 @@ export default class DocumentPropertiesWidget extends BaseWidget {
|
|
61
62
|
}
|
62
63
|
fillDropdown(dropdown) {
|
63
64
|
const container = document.createElement('div');
|
65
|
+
container.classList.add(`${toolbarCSSPrefix}spacedList`);
|
64
66
|
const backgroundColorRow = document.createElement('div');
|
65
67
|
const backgroundColorLabel = document.createElement('label');
|
66
68
|
backgroundColorLabel.innerText = this.localizationTable.backgroundColor;
|
@@ -69,7 +71,7 @@ export default class DocumentPropertiesWidget extends BaseWidget {
|
|
69
71
|
this.setBackgroundColor(color);
|
70
72
|
}
|
71
73
|
});
|
72
|
-
colorInput.id =
|
74
|
+
colorInput.id = `${toolbarCSSPrefix}docPropertiesColorInput-${DocumentPropertiesWidget.idCounter++}`;
|
73
75
|
backgroundColorLabel.htmlFor = colorInput.id;
|
74
76
|
backgroundColorRow.replaceChildren(backgroundColorLabel, backgroundColorInputContainer);
|
75
77
|
const addDimensionRow = (labelContent, onChange) => {
|
@@ -80,7 +82,7 @@ export default class DocumentPropertiesWidget extends BaseWidget {
|
|
80
82
|
label.innerText = labelContent;
|
81
83
|
input.type = 'number';
|
82
84
|
input.min = '0';
|
83
|
-
input.id =
|
85
|
+
input.id = `${toolbarCSSPrefix}docPropertiesDimensionRow-${DocumentPropertiesWidget.idCounter++}`;
|
84
86
|
label.htmlFor = input.id;
|
85
87
|
spacer.style.flexGrow = '1';
|
86
88
|
input.style.flexGrow = '2';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import Editor from '../../Editor';
|
2
|
+
import Eraser from '../../tools/Eraser';
|
3
|
+
import { ToolbarLocalization } from '../localization';
|
4
|
+
import BaseToolWidget from './BaseToolWidget';
|
5
|
+
import { SavedToolbuttonState } from './BaseWidget';
|
6
|
+
export default class EraserToolWidget extends BaseToolWidget {
|
7
|
+
private tool;
|
8
|
+
private thicknessInput;
|
9
|
+
constructor(editor: Editor, tool: Eraser, localizationTable?: ToolbarLocalization);
|
10
|
+
protected getTitle(): string;
|
11
|
+
protected createIcon(): Element;
|
12
|
+
private updateInputs;
|
13
|
+
private static nextThicknessInputId;
|
14
|
+
protected fillDropdown(dropdown: HTMLElement): boolean;
|
15
|
+
serializeState(): SavedToolbuttonState;
|
16
|
+
deserializeFrom(state: SavedToolbuttonState): void;
|
17
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
1
|
+
import { EditorEventType } from '../../types.mjs';
|
2
|
+
import { toolbarCSSPrefix } from '../HTMLToolbar.mjs';
|
3
|
+
import BaseToolWidget from './BaseToolWidget.mjs';
|
4
4
|
export default class EraserToolWidget extends BaseToolWidget {
|
5
5
|
constructor(editor, tool, localizationTable) {
|
6
6
|
super(editor, tool, 'eraser-tool-widget', localizationTable);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import Editor from '../../Editor';
|
2
|
+
import PanZoom from '../../tools/PanZoom';
|
3
|
+
import { ToolbarLocalization } from '../localization';
|
4
|
+
import BaseToolWidget from './BaseToolWidget';
|
5
|
+
import { SavedToolbuttonState } from './BaseWidget';
|
6
|
+
export default class HandToolWidget extends BaseToolWidget {
|
7
|
+
protected overridePanZoomTool: PanZoom;
|
8
|
+
private allowTogglingBaseTool;
|
9
|
+
constructor(editor: Editor, overridePanZoomTool: PanZoom, localizationTable: ToolbarLocalization);
|
10
|
+
private static getPrimaryHandTool;
|
11
|
+
protected getTitle(): string;
|
12
|
+
protected createIcon(): Element;
|
13
|
+
protected handleClick(): void;
|
14
|
+
setSelected(selected: boolean): void;
|
15
|
+
serializeState(): SavedToolbuttonState;
|
16
|
+
deserializeFrom(state: SavedToolbuttonState): void;
|
17
|
+
}
|
package/dist/{src/toolbar/widgets/HandToolWidget.js → mjs/src/toolbar/widgets/HandToolWidget.mjs}
RENAMED
@@ -1,10 +1,10 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
1
|
+
import Mat33 from '../../math/Mat33.mjs';
|
2
|
+
import PanZoom, { PanZoomMode } from '../../tools/PanZoom.mjs';
|
3
|
+
import { EditorEventType } from '../../types.mjs';
|
4
|
+
import Viewport from '../../Viewport.mjs';
|
5
|
+
import { toolbarCSSPrefix } from '../HTMLToolbar.mjs';
|
6
|
+
import BaseToolWidget from './BaseToolWidget.mjs';
|
7
|
+
import BaseWidget from './BaseWidget.mjs';
|
8
8
|
const makeZoomControl = (localizationTable, editor) => {
|
9
9
|
const zoomLevelRow = document.createElement('div');
|
10
10
|
const increaseButton = document.createElement('button');
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import Editor from '../../Editor';
|
2
|
+
import { ToolbarLocalization } from '../localization';
|
3
|
+
import ActionButtonWidget from './ActionButtonWidget';
|
4
|
+
export default class InsertImageWidget extends ActionButtonWidget {
|
5
|
+
private imageSelectionOverlay;
|
6
|
+
private imagePreview;
|
7
|
+
private imageFileInput;
|
8
|
+
private imageAltTextInput;
|
9
|
+
private statusView;
|
10
|
+
private imageBase64URL;
|
11
|
+
private submitButton;
|
12
|
+
constructor(editor: Editor, localization?: ToolbarLocalization);
|
13
|
+
private static nextInputId;
|
14
|
+
private fillOverlay;
|
15
|
+
private hideDialog;
|
16
|
+
private updateImageSizeDisplay;
|
17
|
+
private clearInputs;
|
18
|
+
private onClicked;
|
19
|
+
}
|
@@ -7,14 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
8
|
});
|
9
9
|
};
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import
|
16
|
-
import
|
17
|
-
import
|
10
|
+
import ImageComponent from '../../components/ImageComponent.mjs';
|
11
|
+
import Erase from '../../commands/Erase.mjs';
|
12
|
+
import EditorImage from '../../EditorImage.mjs';
|
13
|
+
import uniteCommands from '../../commands/uniteCommands.mjs';
|
14
|
+
import SelectionTool from '../../tools/SelectionTool/SelectionTool.mjs';
|
15
|
+
import Mat33 from '../../math/Mat33.mjs';
|
16
|
+
import fileToBase64 from '../../util/fileToBase64.mjs';
|
17
|
+
import ActionButtonWidget from './ActionButtonWidget.mjs';
|
18
18
|
export default class InsertImageWidget extends ActionButtonWidget {
|
19
19
|
constructor(editor, localization) {
|
20
20
|
localization !== null && localization !== void 0 ? localization : (localization = editor.localization);
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import Editor from '../../Editor';
|
2
|
+
import { ToolbarLocalization } from '../localization';
|
3
|
+
import BaseWidget from './BaseWidget';
|
4
|
+
export default class OverflowWidget extends BaseWidget {
|
5
|
+
private overflowChildren;
|
6
|
+
private overflowContainer;
|
7
|
+
constructor(editor: Editor, localizationTable?: ToolbarLocalization);
|
8
|
+
protected getTitle(): string;
|
9
|
+
protected createIcon(): Element | null;
|
10
|
+
protected handleClick(): void;
|
11
|
+
protected fillDropdown(dropdown: HTMLElement): boolean;
|
12
|
+
/**
|
13
|
+
* Removes all `BaseWidget`s from this and returns them.
|
14
|
+
*/
|
15
|
+
clearChildren(): BaseWidget[];
|
16
|
+
getChildWidgets(): BaseWidget[];
|
17
|
+
hasAsChild(widget: BaseWidget): boolean;
|
18
|
+
/**
|
19
|
+
* Adds `widget` to this.
|
20
|
+
* `widget`'s previous parent is still responsible
|
21
|
+
* for serializing/deserializing its state.
|
22
|
+
*/
|
23
|
+
addToOverflow(widget: BaseWidget): void;
|
24
|
+
canBeInOverflowMenu(): boolean;
|
25
|
+
}
|