kritzel-stencil 0.0.129 → 0.0.131
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/dist/cjs/{index-C7Read21.js → index-BwINBV6L.js} +259 -191
- package/dist/cjs/index-BwINBV6L.js.map +1 -0
- package/dist/cjs/{index-CUSIflVf.js → index-nzUNdMPh.js} +43 -17
- package/dist/cjs/index-nzUNdMPh.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{kritzel-brush-style_22.cjs.entry.js → kritzel-brush-style_23.cjs.entry.js} +930 -841
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stencil.cjs.js +3 -3
- package/dist/cjs/stencil.cjs.js.map +1 -1
- package/dist/collection/classes/commands/add-object.command.js +3 -2
- package/dist/collection/classes/commands/add-object.command.js.map +1 -1
- package/dist/collection/classes/commands/add-selection-group.command.js +4 -3
- package/dist/collection/classes/commands/add-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/base.command.js +4 -2
- package/dist/collection/classes/commands/base.command.js.map +1 -1
- package/dist/collection/classes/commands/batch.command.js +1 -0
- package/dist/collection/classes/commands/batch.command.js.map +1 -1
- package/dist/collection/classes/commands/move-selection-group.command.js +6 -0
- package/dist/collection/classes/commands/move-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/remove-object.command.js +5 -4
- package/dist/collection/classes/commands/remove-object.command.js.map +1 -1
- package/dist/collection/classes/commands/remove-selection-group.command.js +3 -2
- package/dist/collection/classes/commands/remove-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/resize-selection-group.command.js +3 -0
- package/dist/collection/classes/commands/resize-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/rotate-selection-group.command.js +5 -2
- package/dist/collection/classes/commands/rotate-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/update-object.command.js +3 -0
- package/dist/collection/classes/commands/update-object.command.js.map +1 -1
- package/dist/collection/classes/commands/update-viewport.command.js +2 -0
- package/dist/collection/classes/commands/update-viewport.command.js.map +1 -1
- package/dist/collection/classes/database.class.js +6 -5
- package/dist/collection/classes/database.class.js.map +1 -1
- package/dist/collection/classes/handlers/base.handler.js +1 -0
- package/dist/collection/classes/handlers/base.handler.js.map +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js +2 -2
- package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
- package/dist/collection/classes/handlers/move.handler.js +8 -3
- package/dist/collection/classes/handlers/move.handler.js.map +1 -1
- package/dist/collection/classes/handlers/resize.handler.js +6 -6
- package/dist/collection/classes/handlers/resize.handler.js.map +1 -1
- package/dist/collection/classes/handlers/rotation.handler.js +2 -2
- package/dist/collection/classes/handlers/rotation.handler.js.map +1 -1
- package/dist/collection/classes/handlers/selection.handler.js +10 -8
- package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
- package/dist/collection/classes/history.class.js +4 -0
- package/dist/collection/classes/history.class.js.map +1 -1
- package/dist/collection/classes/objects/base-object.class.js +29 -16
- package/dist/collection/classes/objects/base-object.class.js.map +1 -1
- package/dist/collection/classes/objects/custom-element.class.js +3 -2
- package/dist/collection/classes/objects/custom-element.class.js.map +1 -1
- package/dist/collection/classes/objects/image.class.js +12 -12
- package/dist/collection/classes/objects/image.class.js.map +1 -1
- package/dist/collection/classes/objects/path.class.js +30 -28
- package/dist/collection/classes/objects/path.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-box.class.js +2 -5
- package/dist/collection/classes/objects/selection-box.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-group.class.js +13 -12
- package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
- package/dist/collection/classes/objects/text.class.js +11 -11
- package/dist/collection/classes/objects/text.class.js.map +1 -1
- package/dist/collection/classes/registries/icon-registry.class.js +1 -1
- package/dist/collection/classes/registries/icon-registry.class.js.map +1 -1
- package/dist/collection/classes/registries/tool.registry.js +1 -1
- package/dist/collection/classes/registries/tool.registry.js.map +1 -1
- package/dist/collection/classes/reviver.class.js +1 -0
- package/dist/collection/classes/reviver.class.js.map +1 -1
- package/dist/collection/classes/store.class.js +18 -30
- package/dist/collection/classes/store.class.js.map +1 -1
- package/dist/collection/classes/structures/circular-buffer.structure.js +5 -3
- package/dist/collection/classes/structures/circular-buffer.structure.js.map +1 -1
- package/dist/collection/classes/structures/object-map.structure.js +43 -0
- package/dist/collection/classes/structures/object-map.structure.js.map +1 -0
- package/dist/collection/classes/tools/base-tool.class.js +3 -2
- package/dist/collection/classes/tools/base-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/brush-tool.class.js +7 -7
- package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/eraser-tool.class.js +2 -3
- package/dist/collection/classes/tools/eraser-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/image-tool.class.js +3 -4
- package/dist/collection/classes/tools/image-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/selection-tool.class.js +12 -9
- package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/text-tool.class.js +26 -27
- package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
- package/dist/collection/classes/viewport.class.js +4 -3
- package/dist/collection/classes/viewport.class.js.map +1 -1
- package/dist/collection/classes/workspace.class.js +5 -0
- package/dist/collection/classes/workspace.class.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +6 -6
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js.map +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +7 -0
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +102 -88
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +137 -148
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +6 -7
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js.map +1 -1
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js +2 -3
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js.map +1 -1
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +5 -6
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js.map +1 -1
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +44 -40
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js.map +1 -1
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js +3 -5
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js.map +1 -1
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +17 -17
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js.map +1 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +4 -5
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js.map +1 -1
- package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js +3 -3
- package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js.map +1 -1
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.css +16 -169
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +176 -196
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js.map +1 -1
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.css +136 -0
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +267 -0
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js.map +1 -0
- package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +164 -48
- package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js.map +1 -1
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.css +83 -78
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +160 -130
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js.map +1 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +4 -5
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js.map +1 -1
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +13 -14
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js.map +1 -1
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +5 -3
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js.map +1 -1
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js +6 -6
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js.map +1 -1
- package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js +5 -5
- package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js.map +1 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +25 -32
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +1 -1
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +4 -1
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js.map +1 -1
- package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js +116 -95
- package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js.map +1 -1
- package/dist/collection/configs/default-engine-state.js +1 -1
- package/dist/collection/configs/default-engine-state.js.map +1 -1
- package/dist/collection/helpers/event.helper.js +2 -2
- package/dist/collection/helpers/event.helper.js.map +1 -1
- package/dist/collection/helpers/html.helper.js +1 -2
- package/dist/collection/helpers/html.helper.js.map +1 -1
- package/dist/collection/helpers/keyboard.helper.js +18 -0
- package/dist/collection/helpers/keyboard.helper.js.map +1 -1
- package/dist/collection/helpers/object.helper.js +2 -14
- package/dist/collection/helpers/object.helper.js.map +1 -1
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/interfaces/engine-state.interface.js.map +1 -1
- package/dist/collection/interfaces/menu-item.interface.js.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +5 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/kritzel-brush-style.js +1 -1
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-color.js +1 -1
- package/dist/components/kritzel-context-menu.js +1 -1
- package/dist/components/kritzel-control-brush-config.js +1 -1
- package/dist/components/kritzel-control-text-config.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-cursor-trail.js +1 -1
- package/dist/components/kritzel-dropdown.js +1 -1
- package/dist/components/kritzel-editor.js +145 -126
- package/dist/components/kritzel-editor.js.map +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-font-family.js +1 -1
- package/dist/components/kritzel-font-size.js +1 -1
- package/dist/components/kritzel-font.js +1 -1
- package/dist/components/kritzel-icon.js +1 -1
- package/dist/components/kritzel-menu-item.d.ts +11 -0
- package/dist/components/kritzel-menu-item.js +9 -0
- package/dist/components/kritzel-menu-item.js.map +1 -0
- package/dist/components/kritzel-menu.js +1 -1
- package/dist/components/kritzel-portal.js +1 -1
- package/dist/components/kritzel-split-button.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tooltip.js +1 -1
- package/dist/components/kritzel-utility-panel.js +1 -1
- package/dist/components/kritzel-workspace-manager.js +1 -1
- package/dist/components/{p-BU2q3PRS.js → p-B1BLgWL1.js} +9 -6
- package/dist/components/p-B1BLgWL1.js.map +1 -0
- package/dist/components/{p-5CJxFNEE.js → p-BB0_-X42.js} +5 -4
- package/dist/components/p-BB0_-X42.js.map +1 -0
- package/dist/components/{p-yZFrTtMQ.js → p-BB5R2k1o.js} +42 -48
- package/dist/components/p-BB5R2k1o.js.map +1 -0
- package/dist/components/p-BPz_H-EG.js +137 -0
- package/dist/components/p-BPz_H-EG.js.map +1 -0
- package/dist/components/{p-BqrTPNyu.js → p-BYanlgdq.js} +41 -15
- package/dist/components/p-BYanlgdq.js.map +1 -0
- package/dist/components/{p-BeVv4o5c.js → p-B_lb1FGi.js} +7 -2
- package/dist/components/p-B_lb1FGi.js.map +1 -0
- package/dist/components/p-BeljsQ-8.js +252 -0
- package/dist/components/p-BeljsQ-8.js.map +1 -0
- package/dist/components/{p-_ntxNi8v.js → p-BexTdWaX.js} +21 -19
- package/dist/components/p-BexTdWaX.js.map +1 -0
- package/dist/components/{p-BzSz74Ci.js → p-BgmKrd5Z.js} +8 -5
- package/dist/components/p-BgmKrd5Z.js.map +1 -0
- package/dist/components/{p-BZ-j_4CK.js → p-BhiYvSBc.js} +6 -6
- package/dist/components/p-BhiYvSBc.js.map +1 -0
- package/dist/components/{p-jG1e48OE.js → p-BrBQUN0Q.js} +16 -16
- package/dist/components/p-BrBQUN0Q.js.map +1 -0
- package/dist/components/{p-DtmZW6eP.js → p-BubxwvMA.js} +9 -7
- package/dist/components/p-BubxwvMA.js.map +1 -0
- package/dist/components/{p-D-zg05gA.js → p-BuewJQNl.js} +332 -393
- package/dist/components/p-BuewJQNl.js.map +1 -0
- package/dist/components/p-CGmS8wnN.js +186 -0
- package/dist/components/p-CGmS8wnN.js.map +1 -0
- package/dist/components/{p-BaKb8ZLg.js → p-CHxPWeZd.js} +15 -13
- package/dist/components/p-CHxPWeZd.js.map +1 -0
- package/dist/components/{p-rQeWFfPG.js → p-CMJ3P0Vw.js} +8 -7
- package/dist/components/p-CMJ3P0Vw.js.map +1 -0
- package/dist/components/{p-B7VrEdgP.js → p-DHSEK3rF.js} +141 -102
- package/dist/components/p-DHSEK3rF.js.map +1 -0
- package/dist/components/{p-BAPUTr3K.js → p-DMrtdhBD.js} +9 -8
- package/dist/components/p-DMrtdhBD.js.map +1 -0
- package/dist/components/p-DnUKql15.js +30 -0
- package/dist/components/p-DnUKql15.js.map +1 -0
- package/dist/components/p-DxTu1aoJ.js +237 -0
- package/dist/components/p-DxTu1aoJ.js.map +1 -0
- package/dist/components/{p-BLmFBe2a.js → p-p1Jkec_q.js} +7 -5
- package/dist/components/p-p1Jkec_q.js.map +1 -0
- package/dist/components/{p-V4ui5aWj.js → p-rIRXQdie.js} +11 -10
- package/dist/components/p-rIRXQdie.js.map +1 -0
- package/dist/components/{p-a7KmQzo4.js → p-t4NIsuX9.js} +15 -13
- package/dist/components/p-t4NIsuX9.js.map +1 -0
- package/dist/components/{p-BvlGgLAQ.js → p-trncBp_6.js} +47 -41
- package/dist/components/p-trncBp_6.js.map +1 -0
- package/dist/components/{p-BcQTDgzV.js → p-yZ48g7-u.js} +8 -7
- package/dist/components/p-yZ48g7-u.js.map +1 -0
- package/dist/esm/{index-J4NpPimy.js → index-B-oSk-v8.js} +259 -192
- package/dist/esm/index-B-oSk-v8.js.map +1 -0
- package/dist/esm/{index-NiIEUDzj.js → index-oCOlsFCN.js} +43 -17
- package/dist/esm/index-oCOlsFCN.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/{kritzel-brush-style_22.entry.js → kritzel-brush-style_23.entry.js} +929 -841
- package/dist/esm/loader.js +3 -3
- package/dist/esm/stencil.js +4 -4
- package/dist/esm/stencil.js.map +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/p-3bb80782.entry.js +2 -0
- package/dist/stencil/p-3bb80782.entry.js.map +1 -0
- package/dist/stencil/p-B-oSk-v8.js +2 -0
- package/dist/stencil/p-B-oSk-v8.js.map +1 -0
- package/dist/stencil/p-oCOlsFCN.js +3 -0
- package/dist/stencil/p-oCOlsFCN.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/stencil/stencil.esm.js.map +1 -1
- package/dist/types/classes/objects/path.class.d.ts +0 -2
- package/dist/types/classes/structures/object-map.structure.d.ts +11 -0
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +3 -0
- package/dist/types/components/shared/kritzel-menu/kritzel-menu.d.ts +18 -20
- package/dist/types/components/shared/kritzel-menu-item/kritzel-menu-item.d.ts +26 -0
- package/dist/types/components/shared/kritzel-portal/kritzel-portal.d.ts +15 -10
- package/dist/types/components/shared/kritzel-split-button/kritzel-split-button.d.ts +23 -15
- package/dist/types/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.d.ts +18 -14
- package/dist/types/components.d.ts +90 -61
- package/dist/types/helpers/keyboard.helper.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces/engine-state.interface.d.ts +2 -2
- package/dist/types/interfaces/menu-item.interface.d.ts +21 -7
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/package.json +1 -1
- package/dist/cjs/index-C7Read21.js.map +0 -1
- package/dist/cjs/index-CUSIflVf.js.map +0 -1
- package/dist/collection/classes/structures/octree.structure.js +0 -115
- package/dist/collection/classes/structures/octree.structure.js.map +0 -1
- package/dist/components/p-5CJxFNEE.js.map +0 -1
- package/dist/components/p-B7VrEdgP.js.map +0 -1
- package/dist/components/p-BAPUTr3K.js.map +0 -1
- package/dist/components/p-BLmFBe2a.js.map +0 -1
- package/dist/components/p-BU2q3PRS.js.map +0 -1
- package/dist/components/p-BZ-j_4CK.js.map +0 -1
- package/dist/components/p-BaKb8ZLg.js.map +0 -1
- package/dist/components/p-Bb6od8He.js +0 -42
- package/dist/components/p-Bb6od8He.js.map +0 -1
- package/dist/components/p-BcQTDgzV.js.map +0 -1
- package/dist/components/p-BeVv4o5c.js.map +0 -1
- package/dist/components/p-BmJbJwkH.js +0 -167
- package/dist/components/p-BmJbJwkH.js.map +0 -1
- package/dist/components/p-BqrTPNyu.js.map +0 -1
- package/dist/components/p-BvlGgLAQ.js.map +0 -1
- package/dist/components/p-BzSz74Ci.js.map +0 -1
- package/dist/components/p-C6OxvITm.js +0 -168
- package/dist/components/p-C6OxvITm.js.map +0 -1
- package/dist/components/p-D-zg05gA.js.map +0 -1
- package/dist/components/p-Dozs0Zfn.js +0 -115
- package/dist/components/p-Dozs0Zfn.js.map +0 -1
- package/dist/components/p-DtmZW6eP.js.map +0 -1
- package/dist/components/p-V4ui5aWj.js.map +0 -1
- package/dist/components/p-_ntxNi8v.js.map +0 -1
- package/dist/components/p-a7KmQzo4.js.map +0 -1
- package/dist/components/p-aaxf-h5S.js +0 -159
- package/dist/components/p-aaxf-h5S.js.map +0 -1
- package/dist/components/p-jG1e48OE.js.map +0 -1
- package/dist/components/p-rQeWFfPG.js.map +0 -1
- package/dist/components/p-yZFrTtMQ.js.map +0 -1
- package/dist/esm/index-J4NpPimy.js.map +0 -1
- package/dist/esm/index-NiIEUDzj.js.map +0 -1
- package/dist/stencil/p-43202395.entry.js +0 -2
- package/dist/stencil/p-43202395.entry.js.map +0 -1
- package/dist/stencil/p-J4NpPimy.js +0 -2
- package/dist/stencil/p-J4NpPimy.js.map +0 -1
- package/dist/stencil/p-NiIEUDzj.js +0 -3
- package/dist/stencil/p-NiIEUDzj.js.map +0 -1
- package/dist/types/classes/structures/octree.structure.d.ts +0 -18
package/dist/cjs/{kritzel-brush-style_22.cjs.entry.js → kritzel-brush-style_23.cjs.entry.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var index$1 = require('./index-
|
|
3
|
+
var index = require('./index-nzUNdMPh.js');
|
|
4
|
+
var index$1 = require('./index-BwINBV6L.js');
|
|
5
5
|
|
|
6
6
|
const kritzelBrushStyleCss = ":host{display:flex;align-items:flex-start;gap:8px;padding:8px;box-sizing:border-box;width:100%}.brush-style-button{display:flex;justify-content:center;align-items:center;width:42px;height:32px;padding:0;border:none;outline:none;background:none;cursor:default;border-radius:0;color:var(--control-text-color);font-weight:bold;-webkit-tap-highlight-color:transparent}.font-style-button:not(:last-child){border-right:1px solid #333333}.font-style-button:hover{background-color:var(--control-hover-bg)}.font-style-button:active{background-color:var(--control-active-bg)}.font-style-button.selected,.font-style-button.selected:hover,.font-style-button.selected:active{background-color:var(--control-selected-bg);color:var(--control-selected-color)}";
|
|
7
7
|
|
|
@@ -9,12 +9,13 @@ const KritzelBrushStyle = class {
|
|
|
9
9
|
constructor(hostRef) {
|
|
10
10
|
index.registerInstance(this, hostRef);
|
|
11
11
|
this.typeChange = index.createEvent(this, "typeChange");
|
|
12
|
-
this.type = 'pen';
|
|
13
|
-
this.brushOptions = [
|
|
14
|
-
{ value: 'pen', label: 'Pen' },
|
|
15
|
-
{ value: 'highlighter', label: 'Highlighter' },
|
|
16
|
-
];
|
|
17
12
|
}
|
|
13
|
+
type = 'pen';
|
|
14
|
+
brushOptions = [
|
|
15
|
+
{ value: 'pen', label: 'Pen' },
|
|
16
|
+
{ value: 'highlighter', label: 'Highlighter' },
|
|
17
|
+
];
|
|
18
|
+
typeChange;
|
|
18
19
|
handleDropdownValueChange(event) {
|
|
19
20
|
this.typeChange.emit(event.detail);
|
|
20
21
|
}
|
|
@@ -33,8 +34,9 @@ const kritzelColorCss = ":host{display:flex}.checkerboard-bg{background:repeatin
|
|
|
33
34
|
const KritzelColor = class {
|
|
34
35
|
constructor(hostRef) {
|
|
35
36
|
index.registerInstance(this, hostRef);
|
|
36
|
-
this.size = 24;
|
|
37
37
|
}
|
|
38
|
+
value;
|
|
39
|
+
size = 24;
|
|
38
40
|
isLightColor(hexColor) {
|
|
39
41
|
if (!hexColor)
|
|
40
42
|
return false;
|
|
@@ -90,11 +92,12 @@ const KritzelColorPalette = class {
|
|
|
90
92
|
constructor(hostRef) {
|
|
91
93
|
index.registerInstance(this, hostRef);
|
|
92
94
|
this.colorChange = index.createEvent(this, "colorChange");
|
|
93
|
-
this.colors = [];
|
|
94
|
-
this.selectedColor = null;
|
|
95
|
-
this.isExpanded = false;
|
|
96
|
-
this.isOpaque = false;
|
|
97
95
|
}
|
|
96
|
+
colors = [];
|
|
97
|
+
selectedColor = null;
|
|
98
|
+
isExpanded = false;
|
|
99
|
+
isOpaque = false;
|
|
100
|
+
colorChange;
|
|
98
101
|
handleColorClick(color) {
|
|
99
102
|
this.selectedColor = color;
|
|
100
103
|
this.colorChange.emit(color);
|
|
@@ -128,8 +131,12 @@ const KritzelContextMenu = class {
|
|
|
128
131
|
constructor(hostRef) {
|
|
129
132
|
index.registerInstance(this, hostRef);
|
|
130
133
|
this.actionSelected = index.createEvent(this, "actionSelected");
|
|
131
|
-
this.processedItems = [];
|
|
132
134
|
}
|
|
135
|
+
items;
|
|
136
|
+
objects;
|
|
137
|
+
actionSelected;
|
|
138
|
+
get hostElement() { return index.getElement(this); }
|
|
139
|
+
processedItems = [];
|
|
133
140
|
componentWillLoad() {
|
|
134
141
|
this.updateMenuItems();
|
|
135
142
|
}
|
|
@@ -164,7 +171,6 @@ const KritzelContextMenu = class {
|
|
|
164
171
|
render() {
|
|
165
172
|
return (index.h(index.Host, { key: '96569454f806a6d17380315b4d0200236fe22550' }, index.h("div", { key: '0e5899a2901e1e9ab9d657824e105121ce785bdc', class: "menu-container" }, this.processedItems.map(({ item, isDisabled }, index$1) => (index.h("button", { key: `${item.label}-${index$1}`, class: { 'menu-item': true, disabled: isDisabled }, onClick: () => this.handleItemClick(item, isDisabled), onTouchStart: () => this.handleItemClick(item, isDisabled), disabled: isDisabled }, item.icon && index.h("kritzel-icon", { name: item.icon, size: 16 }), index.h("span", { class: "label" }, item.label)))))));
|
|
166
173
|
}
|
|
167
|
-
get hostElement() { return index.getElement(this); }
|
|
168
174
|
static get watchers() { return {
|
|
169
175
|
"items": ["onItemsChanged"]
|
|
170
176
|
}; }
|
|
@@ -177,9 +183,11 @@ const KritzelControlBrushConfig = class {
|
|
|
177
183
|
constructor(hostRef) {
|
|
178
184
|
index.registerInstance(this, hostRef);
|
|
179
185
|
this.toolChange = index.createEvent(this, "toolChange");
|
|
180
|
-
this.isExpanded = false;
|
|
181
|
-
this.palette = [];
|
|
182
186
|
}
|
|
187
|
+
tool;
|
|
188
|
+
isExpanded = false;
|
|
189
|
+
toolChange;
|
|
190
|
+
palette = [];
|
|
183
191
|
handleToolChange(newTool) {
|
|
184
192
|
this.palette = newTool.palettes[newTool.type];
|
|
185
193
|
}
|
|
@@ -204,14 +212,14 @@ const KritzelControlBrushConfig = class {
|
|
|
204
212
|
this.toolChange.emit(this.tool);
|
|
205
213
|
}
|
|
206
214
|
render() {
|
|
207
|
-
return (index.h(index.Host, { key: '
|
|
215
|
+
return (index.h(index.Host, { key: 'a1f04aba4ed04e91c7b375e0f88bcff4fea1cba4' }, index.h("div", { key: 'c7cd734c96498c8cd6a27321fb6d11773e7aa8a9', style: {
|
|
208
216
|
display: 'flex',
|
|
209
217
|
flexDirection: 'row',
|
|
210
218
|
alignItems: 'center',
|
|
211
219
|
justifyContent: 'flex-start',
|
|
212
220
|
width: '100%',
|
|
213
221
|
gap: '8px',
|
|
214
|
-
} }, index.h("kritzel-brush-style", { key: '
|
|
222
|
+
} }, index.h("kritzel-brush-style", { key: '67958dc2a34302eb23fabbafea3c7dc7863f1984', type: this.tool.type, onTypeChange: event => this.handleTypeChange(event) }), index.h("button", { key: '5c84a72d9f337dff253a161abe19acb832275272', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand', style: this.palette.length > 6 ? { visibillity: 'visible' } : { visibility: 'hidden' } }, index.h("kritzel-icon", { key: 'b3e0c44db35b53a584757e18b507df09f30bfa8a', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), index.h("kritzel-color-palette", { key: 'eb098094ae69aa5901244f9686a3eb990271c07d', colors: this.palette, selectedColor: this.tool.color, isExpanded: this.isExpanded, isOpaque: true, onColorChange: color => this.handleColorChange(color) }), index.h("kritzel-stroke-size", { key: '18ae184b282ca2ec6511a6ac0065914edf66f91b', selectedSize: this.tool.size, onSizeChange: event => this.handleSizeChange(event) })));
|
|
215
223
|
}
|
|
216
224
|
static get watchers() { return {
|
|
217
225
|
"tool": ["handleToolChange"]
|
|
@@ -225,8 +233,10 @@ const KritzelControlTextConfig = class {
|
|
|
225
233
|
constructor(hostRef) {
|
|
226
234
|
index.registerInstance(this, hostRef);
|
|
227
235
|
this.toolChange = index.createEvent(this, "toolChange");
|
|
228
|
-
this.isExpanded = false;
|
|
229
236
|
}
|
|
237
|
+
tool;
|
|
238
|
+
isExpanded = false;
|
|
239
|
+
toolChange;
|
|
230
240
|
handleToggleExpand() {
|
|
231
241
|
this.isExpanded = !this.isExpanded;
|
|
232
242
|
}
|
|
@@ -243,14 +253,14 @@ const KritzelControlTextConfig = class {
|
|
|
243
253
|
this.toolChange.emit(this.tool);
|
|
244
254
|
}
|
|
245
255
|
render() {
|
|
246
|
-
return (index.h(index.Host, { key: '
|
|
256
|
+
return (index.h(index.Host, { key: 'a5c0e3eb4343637d758888d7d2a0843549fa0c25' }, index.h("div", { key: '1d4d42af117ed9da1a91d1747a7d6f6531e0de9b', style: {
|
|
247
257
|
display: 'flex',
|
|
248
258
|
flexDirection: 'row',
|
|
249
259
|
alignItems: 'center',
|
|
250
260
|
justifyContent: 'flex-start',
|
|
251
261
|
width: '100%',
|
|
252
262
|
gap: '8px',
|
|
253
|
-
} }, index.h("kritzel-font-family", { key: '
|
|
263
|
+
} }, index.h("kritzel-font-family", { key: 'b19e1edcbc7bafb0829d3e173d33cff37d2a5959', selectedFontFamily: this.tool.fontFamily, onFontFamilyChange: event => this.handleFamilyChange(event) }), index.h("button", { key: 'ca3dce970ee5dd1a7c8c617127777859b45380c4', class: "expand-toggle", onClick: () => this.handleToggleExpand(), title: this.isExpanded ? 'Collapse' : 'Expand' }, index.h("kritzel-icon", { key: '241d82cd06db8d20794a369a4df6e6a71531131a', name: this.isExpanded ? 'chevron-up' : 'chevron-down' }))), index.h("kritzel-color-palette", { key: 'ec82e5c09046e70e904cc1ec9716c53bec9cac2b', colors: this.tool.palette, selectedColor: this.tool.fontColor, isExpanded: this.isExpanded, onColorChange: event => this.handleColorChange(event) }), index.h("kritzel-font-size", { key: '1cbddf6e6de21bd62f3803cca9e21ef9e01f15c0', selectedSize: this.tool.fontSize, fontFamily: this.tool.fontFamily, onSizeChange: event => this.handleSizeChange(event) })));
|
|
254
264
|
}
|
|
255
265
|
};
|
|
256
266
|
KritzelControlTextConfig.style = kritzelControlTextConfigCss;
|
|
@@ -267,14 +277,15 @@ const KritzelControls = class {
|
|
|
267
277
|
constructor(hostRef) {
|
|
268
278
|
index.registerInstance(this, hostRef);
|
|
269
279
|
this.isControlsReady = index.createEvent(this, "isControlsReady");
|
|
270
|
-
this.controls = [];
|
|
271
|
-
this.activeControl = null;
|
|
272
|
-
this.isUtilityPanelVisible = true;
|
|
273
|
-
this.firstConfig = null;
|
|
274
|
-
this.isTooltipVisible = false;
|
|
275
|
-
this.isTouchDevice = KritzelDevicesHelper.isTouchDevice();
|
|
276
|
-
this.kritzelEngine = null;
|
|
277
280
|
}
|
|
281
|
+
controls = [];
|
|
282
|
+
activeControl = null;
|
|
283
|
+
isUtilityPanelVisible = true;
|
|
284
|
+
isControlsReady;
|
|
285
|
+
firstConfig = null;
|
|
286
|
+
isTooltipVisible = false;
|
|
287
|
+
isTouchDevice = KritzelDevicesHelper.isTouchDevice();
|
|
288
|
+
get host() { return index.getElement(this); }
|
|
278
289
|
handleDocumentClick(event) {
|
|
279
290
|
const element = event.target;
|
|
280
291
|
if (!this.kritzelEngine || element.closest('.kritzel-tooltip')) {
|
|
@@ -283,28 +294,25 @@ const KritzelControls = class {
|
|
|
283
294
|
this.isTooltipVisible = false;
|
|
284
295
|
}
|
|
285
296
|
handleKeyDown(event) {
|
|
286
|
-
var _a;
|
|
287
297
|
if (event.key === 'Escape') {
|
|
288
298
|
event.preventDefault();
|
|
289
299
|
this.closeTooltip();
|
|
290
|
-
|
|
300
|
+
this.kritzelEngine?.enable();
|
|
291
301
|
}
|
|
292
302
|
}
|
|
293
303
|
async handleActiveToolChange(event) {
|
|
294
|
-
var _a;
|
|
295
304
|
this.activeControl = this.controls.find(control => control.tool === event.detail) || null;
|
|
296
|
-
await
|
|
305
|
+
await this.kritzelEngine?.setFocus();
|
|
297
306
|
}
|
|
298
307
|
async closeTooltip() {
|
|
299
308
|
this.isTooltipVisible = false;
|
|
300
309
|
}
|
|
310
|
+
kritzelEngine = null;
|
|
301
311
|
get activeToolAsTextTool() {
|
|
302
|
-
|
|
303
|
-
return (_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.tool;
|
|
312
|
+
return this.activeControl?.tool;
|
|
304
313
|
}
|
|
305
314
|
get activeToolAsBrushTool() {
|
|
306
|
-
|
|
307
|
-
return (_a = this.activeControl) === null || _a === void 0 ? void 0 : _a.tool;
|
|
315
|
+
return this.activeControl?.tool;
|
|
308
316
|
}
|
|
309
317
|
async componentWillLoad() {
|
|
310
318
|
await this.initializeEngine();
|
|
@@ -344,48 +352,44 @@ const KritzelControls = class {
|
|
|
344
352
|
}
|
|
345
353
|
}
|
|
346
354
|
handleConfigClick(event) {
|
|
347
|
-
var _a;
|
|
348
355
|
event.stopPropagation();
|
|
349
356
|
this.isTooltipVisible = !this.isTooltipVisible;
|
|
350
|
-
|
|
357
|
+
this.kritzelEngine?.disable();
|
|
351
358
|
}
|
|
352
359
|
async handleToolChange(event) {
|
|
353
|
-
this.activeControl =
|
|
360
|
+
this.activeControl = { ...this.activeControl, tool: event.detail };
|
|
354
361
|
await this.kritzelEngine.changeActiveTool(this.activeControl.tool);
|
|
355
362
|
}
|
|
356
363
|
render() {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
return (index.h(index.Host, { key: 'af04746b6eaa04a51482cd9d25ba3ab303d631f1', class: {
|
|
364
|
+
const hasNoConfig = this.activeControl?.config === undefined || this.activeControl?.config === null;
|
|
365
|
+
return (index.h(index.Host, { key: '7ab1f3e176848cb9a34be7e7b90e13c2a861d78b', class: {
|
|
360
366
|
mobile: this.isTouchDevice,
|
|
361
|
-
} }, this.isUtilityPanelVisible && (index.h("kritzel-utility-panel", { key: '
|
|
367
|
+
} }, this.isUtilityPanelVisible && (index.h("kritzel-utility-panel", { key: 'f168b27cb9cc3a1a7d0028055cd58c60cec9776f', style: {
|
|
362
368
|
position: 'absolute',
|
|
363
369
|
bottom: '56px',
|
|
364
370
|
left: '12px',
|
|
365
|
-
}, onUndo: () =>
|
|
366
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
371
|
+
}, onUndo: () => this.kritzelEngine?.undo(), onRedo: () => this.kritzelEngine?.redo(), onDelete: () => this.kritzelEngine?.delete() })), index.h("div", { key: '9e568217b23632d73b051350d7f795f0cd7ab9ed', class: "kritzel-controls" }, this.controls.map(control => {
|
|
367
372
|
if (control.type === 'tool') {
|
|
368
373
|
return (index.h("button", { class: {
|
|
369
374
|
'kritzel-control': true,
|
|
370
|
-
'selected':
|
|
371
|
-
}, key: control.name, onClick: _event =>
|
|
375
|
+
'selected': this.activeControl?.name === control?.name,
|
|
376
|
+
}, key: control.name, onClick: _event => this.handleControlClick?.(control) }, index.h("kritzel-icon", { name: control.icon })));
|
|
372
377
|
}
|
|
373
378
|
if (control.type === 'divider') {
|
|
374
379
|
return index.h("div", { class: "kritzel-divider", key: control.name });
|
|
375
380
|
}
|
|
376
|
-
if (control.type === 'config' && control.name ===
|
|
377
|
-
return (index.h("div", { class: "kritzel-config-container", key: control.name }, index.h("kritzel-tooltip", { isVisible: this.isTooltipVisible, anchorElement:
|
|
381
|
+
if (control.type === 'config' && control.name === this.firstConfig?.name && this.activeControl) {
|
|
382
|
+
return (index.h("div", { class: "kritzel-config-container", key: control.name }, index.h("kritzel-tooltip", { isVisible: this.isTooltipVisible, anchorElement: this.host.shadowRoot?.querySelector('.kritzel-config-container') }, index.h("div", { style: { width: '294px', height: '100%' } }, this.activeControl.name === 'brush' && (index.h("kritzel-control-brush-config", { tool: this.activeToolAsBrushTool, onToolChange: event => this.handleToolChange?.(event) })), this.activeControl.name === 'text' && (index.h("kritzel-control-text-config", { tool: this.activeToolAsTextTool, onToolChange: event => this.handleToolChange?.(event) })))), index.h("div", { class: "kritzel-config", onClick: event => this.handleConfigClick?.(event), style: {
|
|
378
383
|
cursor: this.activeControl.config ? 'pointer' : 'default',
|
|
379
384
|
pointerEvents: hasNoConfig ? 'none' : 'auto',
|
|
380
|
-
} }, this.activeControl.tool instanceof index$1.KritzelBrushTool && (index.h("div", { class: "color-container" }, index.h("kritzel-color", { value:
|
|
385
|
+
} }, this.activeControl.tool instanceof index$1.KritzelBrushTool && (index.h("div", { class: "color-container" }, index.h("kritzel-color", { value: this.activeToolAsBrushTool?.color, size: this.activeToolAsBrushTool?.size, style: {
|
|
381
386
|
borderRadius: '50%',
|
|
382
387
|
border: 'none',
|
|
383
|
-
} }))), this.activeControl.tool instanceof index$1.KritzelTextTool && (index.h("div", { class: "font-container" }, index.h("kritzel-font", { fontFamily:
|
|
388
|
+
} }))), this.activeControl.tool instanceof index$1.KritzelTextTool && (index.h("div", { class: "font-container" }, index.h("kritzel-font", { fontFamily: this.activeToolAsTextTool?.fontFamily, size: this.activeToolAsTextTool?.fontSize, color: this.activeToolAsTextTool?.fontColor }))), hasNoConfig && index.h("div", { class: "no-config" }))));
|
|
384
389
|
}
|
|
385
390
|
}))));
|
|
386
391
|
}
|
|
387
392
|
static get assetsDirs() { return ["../assets"]; }
|
|
388
|
-
get host() { return index.getElement(this); }
|
|
389
393
|
};
|
|
390
394
|
KritzelControls.style = kritzelControlsCss;
|
|
391
395
|
|
|
@@ -394,11 +398,13 @@ const kritzelCursorTrailCss = ":host{display:block;position:fixed;top:0;left:0;w
|
|
|
394
398
|
const KritzelCursorTrail = class {
|
|
395
399
|
constructor(hostRef) {
|
|
396
400
|
index.registerInstance(this, hostRef);
|
|
397
|
-
this.cursorTrailPoints = [];
|
|
398
|
-
this.isLeftButtonDown = false;
|
|
399
|
-
this.TRAIL_DURATION_MS = 100;
|
|
400
|
-
this.MAX_TRAIL_POINTS = 50;
|
|
401
401
|
}
|
|
402
|
+
store;
|
|
403
|
+
cursorTrailPoints = [];
|
|
404
|
+
isLeftButtonDown = false;
|
|
405
|
+
trailCleanupIntervalId;
|
|
406
|
+
TRAIL_DURATION_MS = 100;
|
|
407
|
+
MAX_TRAIL_POINTS = 50;
|
|
402
408
|
componentDidLoad() {
|
|
403
409
|
this.trailCleanupIntervalId = window.setInterval(() => {
|
|
404
410
|
const now = Date.now();
|
|
@@ -484,44 +490,17 @@ const KritzelDropdown = class {
|
|
|
484
490
|
constructor(hostRef) {
|
|
485
491
|
index.registerInstance(this, hostRef);
|
|
486
492
|
this.valueChanged = index.createEvent(this, "valueChanged");
|
|
487
|
-
this.options = [];
|
|
488
|
-
this.selectStyles = {};
|
|
489
|
-
this.hasSuffixContent = false;
|
|
490
|
-
this.hasPrefixContent = false;
|
|
491
|
-
this.handleSelectChange = (event) => {
|
|
492
|
-
const newValue = event.target.value;
|
|
493
|
-
if (this.internalValue !== newValue) {
|
|
494
|
-
this.internalValue = newValue;
|
|
495
|
-
this.valueChanged.emit(this.internalValue);
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
this.evaluateSuffixContent = () => {
|
|
499
|
-
if (this.suffixSlotElement) {
|
|
500
|
-
const newHasContent = this.suffixSlotElement.assignedNodes({ flatten: true }).length > 0;
|
|
501
|
-
if (this.hasSuffixContent !== newHasContent) {
|
|
502
|
-
this.hasSuffixContent = newHasContent;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
else {
|
|
506
|
-
if (this.hasSuffixContent !== false) {
|
|
507
|
-
this.hasSuffixContent = false;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
this.evaluatePrefixContent = () => {
|
|
512
|
-
if (this.prefixSlotElement) {
|
|
513
|
-
const newHasContent = this.prefixSlotElement.assignedNodes({ flatten: true }).length > 0;
|
|
514
|
-
if (this.hasPrefixContent !== newHasContent) {
|
|
515
|
-
this.hasPrefixContent = newHasContent;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
else {
|
|
519
|
-
if (this.hasPrefixContent !== false) {
|
|
520
|
-
this.hasPrefixContent = false;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
493
|
}
|
|
494
|
+
options = [];
|
|
495
|
+
value;
|
|
496
|
+
width;
|
|
497
|
+
selectStyles = {};
|
|
498
|
+
internalValue;
|
|
499
|
+
hasSuffixContent = false;
|
|
500
|
+
hasPrefixContent = false;
|
|
501
|
+
valueChanged;
|
|
502
|
+
suffixSlotElement;
|
|
503
|
+
prefixSlotElement;
|
|
525
504
|
componentWillLoad() {
|
|
526
505
|
this.updateInternalValue(this.value, false);
|
|
527
506
|
this.evaluateSuffixContent();
|
|
@@ -553,13 +532,46 @@ const KritzelDropdown = class {
|
|
|
553
532
|
}
|
|
554
533
|
}
|
|
555
534
|
}
|
|
535
|
+
handleSelectChange = (event) => {
|
|
536
|
+
const newValue = event.target.value;
|
|
537
|
+
if (this.internalValue !== newValue) {
|
|
538
|
+
this.internalValue = newValue;
|
|
539
|
+
this.valueChanged.emit(this.internalValue);
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
evaluateSuffixContent = () => {
|
|
543
|
+
if (this.suffixSlotElement) {
|
|
544
|
+
const newHasContent = this.suffixSlotElement.assignedNodes({ flatten: true }).length > 0;
|
|
545
|
+
if (this.hasSuffixContent !== newHasContent) {
|
|
546
|
+
this.hasSuffixContent = newHasContent;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
if (this.hasSuffixContent !== false) {
|
|
551
|
+
this.hasSuffixContent = false;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
evaluatePrefixContent = () => {
|
|
556
|
+
if (this.prefixSlotElement) {
|
|
557
|
+
const newHasContent = this.prefixSlotElement.assignedNodes({ flatten: true }).length > 0;
|
|
558
|
+
if (this.hasPrefixContent !== newHasContent) {
|
|
559
|
+
this.hasPrefixContent = newHasContent;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
if (this.hasPrefixContent !== false) {
|
|
564
|
+
this.hasPrefixContent = false;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
};
|
|
556
568
|
render() {
|
|
557
569
|
const selectClasses = {
|
|
558
570
|
'custom-select': true,
|
|
559
571
|
'has-suffix-border': this.hasSuffixContent,
|
|
560
572
|
'has-prefix-border': this.hasPrefixContent,
|
|
561
573
|
};
|
|
562
|
-
return (index.h(index.Host, { key: '32c5f5a4f807c1e316c91b795c005b8d30ce6189' }, index.h("div", { key: 'b1cbeff18e688da4a2f7472be290b9527a619f07', class: "dropdown-wrapper" }, index.h("slot", { key: 'b3bbb7e21c6f5620cab41aa4b1c7206b6c75fd86', name: "prefix", ref: el => this.prefixSlotElement = el, onSlotchange: this.evaluatePrefixContent }), index.h("select", { key: '8b2dcdc125bee59cf29fce7c980b755e78d5816e', class: selectClasses, style:
|
|
574
|
+
return (index.h(index.Host, { key: '32c5f5a4f807c1e316c91b795c005b8d30ce6189' }, index.h("div", { key: 'b1cbeff18e688da4a2f7472be290b9527a619f07', class: "dropdown-wrapper" }, index.h("slot", { key: 'b3bbb7e21c6f5620cab41aa4b1c7206b6c75fd86', name: "prefix", ref: el => this.prefixSlotElement = el, onSlotchange: this.evaluatePrefixContent }), index.h("select", { key: '8b2dcdc125bee59cf29fce7c980b755e78d5816e', class: selectClasses, style: { ...this.selectStyles, width: this.width }, onInput: this.handleSelectChange }, this.options.map(option => (index.h("option", { value: option.value, style: option.style, selected: option.value === this.internalValue }, option.label)))), index.h("slot", { key: '8d83f0dea41ac959bf2392948efef33bb70d0154', name: "suffix", ref: el => this.suffixSlotElement = el, onSlotchange: this.evaluateSuffixContent }))));
|
|
563
575
|
}
|
|
564
576
|
static get watchers() { return {
|
|
565
577
|
"value": ["externalValueChanged"],
|
|
@@ -569,6 +581,7 @@ const KritzelDropdown = class {
|
|
|
569
581
|
KritzelDropdown.style = kritzelDropdownCss;
|
|
570
582
|
|
|
571
583
|
class KritzelIconRegistry {
|
|
584
|
+
static registry = new Map();
|
|
572
585
|
static register(name, svgContent) {
|
|
573
586
|
if (this.registry.has(name)) {
|
|
574
587
|
console.warn(`[IconRegistry] Icon "${name}" is already registered. It will be overwritten.`);
|
|
@@ -589,7 +602,6 @@ class KritzelIconRegistry {
|
|
|
589
602
|
return this.registry.has(name);
|
|
590
603
|
}
|
|
591
604
|
}
|
|
592
|
-
KritzelIconRegistry.registry = new Map();
|
|
593
605
|
KritzelIconRegistry.registerIcons({
|
|
594
606
|
'cursor': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z"/></svg>',
|
|
595
607
|
'pen': '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/></svg>',
|
|
@@ -618,99 +630,103 @@ KritzelIconRegistry.registerIcons({
|
|
|
618
630
|
const ABSOLUTE_SCALE_MAX = 1000;
|
|
619
631
|
const ABSOLUTE_SCALE_MIN = 0.0001;
|
|
620
632
|
|
|
621
|
-
const kritzelEditorCss = "kritzel-editor{display:flex;margin:0;position:relative;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}kritzel-workspace-manager{position:absolute;top:14px;left:14px}kritzel-controls{position:absolute;bottom:28px}";
|
|
633
|
+
const kritzelEditorCss = "kritzel-editor{display:flex;margin:0;position:relative;overflow:hidden;width:100%;height:100%;align-items:center;justify-content:center;touch-action:manipulation;user-select:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}kritzel-workspace-manager{position:absolute;top:14px;left:14px}kritzel-split-button{position:absolute;top:14px;left:14px;z-index:1}kritzel-controls{position:absolute;bottom:28px}";
|
|
622
634
|
|
|
623
635
|
const KritzelEditor = class {
|
|
624
636
|
constructor(hostRef) {
|
|
625
637
|
index.registerInstance(this, hostRef);
|
|
626
638
|
this.isReady = index.createEvent(this, "isReady");
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
639
|
+
}
|
|
640
|
+
scaleMax = ABSOLUTE_SCALE_MAX;
|
|
641
|
+
scaleMin = ABSOLUTE_SCALE_MIN;
|
|
642
|
+
controls = [
|
|
643
|
+
{
|
|
644
|
+
name: 'selection',
|
|
645
|
+
type: 'tool',
|
|
646
|
+
tool: index$1.KritzelSelectionTool,
|
|
647
|
+
icon: 'cursor',
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
name: 'brush',
|
|
651
|
+
type: 'tool',
|
|
652
|
+
tool: index$1.KritzelBrushTool,
|
|
653
|
+
icon: 'pen',
|
|
654
|
+
isDefault: true,
|
|
655
|
+
config: index$1.DEFAULT_BRUSH_CONFIG,
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: 'eraser',
|
|
659
|
+
type: 'tool',
|
|
660
|
+
tool: index$1.KritzelEraserTool,
|
|
661
|
+
icon: 'eraser',
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
name: 'text',
|
|
665
|
+
type: 'tool',
|
|
666
|
+
tool: index$1.KritzelTextTool,
|
|
667
|
+
icon: 'type',
|
|
668
|
+
config: index$1.DEFAULT_TEXT_CONFIG,
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
name: 'image',
|
|
672
|
+
type: 'tool',
|
|
673
|
+
tool: index$1.KritzelImageTool,
|
|
674
|
+
icon: 'image',
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
name: 'divider',
|
|
678
|
+
type: 'divider',
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
name: 'config',
|
|
682
|
+
type: 'config',
|
|
683
|
+
},
|
|
684
|
+
];
|
|
685
|
+
globalContextMenuItems = [
|
|
686
|
+
{
|
|
687
|
+
label: 'Paste',
|
|
688
|
+
icon: 'paste',
|
|
689
|
+
disabled: async () => (await this.engineRef.getCopiedObjects()).length === 0,
|
|
690
|
+
action: menu => this.engineRef.paste(menu.x, menu.y),
|
|
691
|
+
},
|
|
692
|
+
{ label: 'Select All', icon: 'select-all', action: () => this.selectAllObjectsInViewport() },
|
|
693
|
+
];
|
|
694
|
+
objectContextMenuItems = [
|
|
695
|
+
{
|
|
696
|
+
label: 'Edit',
|
|
697
|
+
icon: 'pen',
|
|
698
|
+
visible: (_, objects) => objects.length === 1 && objects[0].isEditable,
|
|
699
|
+
action: (_, objects) => {
|
|
700
|
+
if (objects.length === 1) {
|
|
701
|
+
const object = objects[0];
|
|
702
|
+
if (object.isEditable) {
|
|
703
|
+
object.edit();
|
|
692
704
|
}
|
|
693
|
-
}
|
|
694
|
-
},
|
|
695
|
-
{ label: 'Copy', icon: 'copy', action: () => this.engineRef.copy() },
|
|
696
|
-
{
|
|
697
|
-
label: 'Paste',
|
|
698
|
-
icon: 'paste',
|
|
699
|
-
disabled: async () => (await this.engineRef.getCopiedObjects()).length === 0,
|
|
700
|
-
action: (menu, _) => this.engineRef.paste(menu.x, menu.y),
|
|
705
|
+
}
|
|
701
706
|
},
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
this.
|
|
711
|
-
this.
|
|
712
|
-
this.
|
|
713
|
-
|
|
707
|
+
},
|
|
708
|
+
{ label: 'Copy', icon: 'copy', action: () => this.engineRef.copy() },
|
|
709
|
+
{
|
|
710
|
+
label: 'Paste',
|
|
711
|
+
icon: 'paste',
|
|
712
|
+
disabled: async () => (await this.engineRef.getCopiedObjects()).length === 0,
|
|
713
|
+
action: (menu, _) => this.engineRef.paste(menu.x, menu.y),
|
|
714
|
+
},
|
|
715
|
+
{ label: 'Delete', icon: 'delete', action: () => this.engineRef.delete() },
|
|
716
|
+
{ label: 'Bring to Front', icon: 'bring-to-front', action: () => this.engineRef.bringToFront() },
|
|
717
|
+
{ label: 'Send to Back', icon: 'send-to-back', action: () => this.engineRef.sendToBack() },
|
|
718
|
+
];
|
|
719
|
+
customSvgIcons = {};
|
|
720
|
+
isControlsVisible = true;
|
|
721
|
+
isUtilityPanelVisible = true;
|
|
722
|
+
isReady;
|
|
723
|
+
get host() { return index.getElement(this); }
|
|
724
|
+
isEngineReady = false;
|
|
725
|
+
isControlsReady = false;
|
|
726
|
+
isWorkspaceManagerReady = false;
|
|
727
|
+
workspaces = [];
|
|
728
|
+
activeWorkspace;
|
|
729
|
+
isVirtualKeyboardOpen = false;
|
|
714
730
|
onIsEngineReady(newValue) {
|
|
715
731
|
if (newValue && this.isControlsReady) {
|
|
716
732
|
this.checkIsReady();
|
|
@@ -753,8 +769,12 @@ const KritzelEditor = class {
|
|
|
753
769
|
event.preventDefault();
|
|
754
770
|
}
|
|
755
771
|
}
|
|
772
|
+
engineRef;
|
|
773
|
+
controlsRef;
|
|
774
|
+
splitButtonRef;
|
|
756
775
|
componentDidLoad() {
|
|
757
776
|
this.registerCustomSvgIcons();
|
|
777
|
+
this.listenForMobileKeyboard();
|
|
758
778
|
}
|
|
759
779
|
async checkIsReady() {
|
|
760
780
|
await customElements.whenDefined('kritzel-editor');
|
|
@@ -776,10 +796,15 @@ const KritzelEditor = class {
|
|
|
776
796
|
KritzelIconRegistry.register(name, svg);
|
|
777
797
|
}
|
|
778
798
|
}
|
|
799
|
+
listenForMobileKeyboard() {
|
|
800
|
+
index$1.KritzelKeyboardHelper.onKeyboardVisibleChanged(isOpen => {
|
|
801
|
+
console.log('Mobile keyboard visibility changed:', isOpen);
|
|
802
|
+
this.isVirtualKeyboardOpen = isOpen;
|
|
803
|
+
});
|
|
804
|
+
}
|
|
779
805
|
render() {
|
|
780
|
-
return (index.h(index.Host, { key: '
|
|
806
|
+
return (index.h(index.Host, { key: '0f51215c0ede25bf8edfbf1420fc8d6c64175b8a' }, index.h("kritzel-workspace-manager", { key: '14affeb4c161a401d9cca32d0681d576b67b5199', workspaces: this.workspaces, activeWorkspace: this.activeWorkspace, onWorkspaceChange: event => this.activeWorkspace = event.detail, onIsWorkspaceManagerReady: () => (this.isWorkspaceManagerReady = true) }), index.h("kritzel-engine", { key: '0e96fdbfbe412ea0a0bae49c693190b71e78f112', ref: el => (this.engineRef = el), workspace: this.activeWorkspace, scaleMax: this.scaleMax, scaleMin: this.scaleMin, globalContextMenuItems: this.globalContextMenuItems, objectContextMenuItems: this.objectContextMenuItems, onIsEngineReady: event => this.onEngineReady(event), onWorkspacesChange: event => this.workspaces = event.detail }), index.h("kritzel-controls", { key: '6098132ddf95b5dd4b1a1a6492b31f0ef43693c4', style: { display: this.isVirtualKeyboardOpen ? 'none' : (this.isControlsVisible ? 'flex' : 'none') }, ref: el => (this.controlsRef = el), controls: this.controls, isUtilityPanelVisible: this.isUtilityPanelVisible, onIsControlsReady: () => (this.isControlsReady = true) })));
|
|
781
807
|
}
|
|
782
|
-
get host() { return index.getElement(this); }
|
|
783
808
|
static get watchers() { return {
|
|
784
809
|
"isEngineReady": ["onIsEngineReady"],
|
|
785
810
|
"isControlsReady": ["onIsControlsReady"]
|
|
@@ -788,10 +813,11 @@ const KritzelEditor = class {
|
|
|
788
813
|
KritzelEditor.style = kritzelEditorCss;
|
|
789
814
|
|
|
790
815
|
class KritzelViewport {
|
|
816
|
+
_store;
|
|
817
|
+
initialTouchDistance = 0;
|
|
818
|
+
startX = 0;
|
|
819
|
+
startY = 0;
|
|
791
820
|
constructor(store, host) {
|
|
792
|
-
this.initialTouchDistance = 0;
|
|
793
|
-
this.startX = 0;
|
|
794
|
-
this.startY = 0;
|
|
795
821
|
this._store = store;
|
|
796
822
|
this._store.state.host = host;
|
|
797
823
|
this._store.state.viewportWidth = host.clientWidth;
|
|
@@ -938,6 +964,8 @@ class KritzelViewport {
|
|
|
938
964
|
}
|
|
939
965
|
|
|
940
966
|
class UpdateViewportCommand extends index$1.KritzelBaseCommand {
|
|
967
|
+
currentViewport;
|
|
968
|
+
previousViewport;
|
|
941
969
|
constructor(store, initiator, previousViewport, skipHistory = false) {
|
|
942
970
|
super(store, initiator, skipHistory);
|
|
943
971
|
this.previousViewport = previousViewport;
|
|
@@ -960,10 +988,12 @@ class UpdateViewportCommand extends index$1.KritzelBaseCommand {
|
|
|
960
988
|
}
|
|
961
989
|
|
|
962
990
|
class KritzelCircularBuffer {
|
|
991
|
+
buffer;
|
|
992
|
+
capacity;
|
|
993
|
+
head = 0;
|
|
994
|
+
tail = 0;
|
|
995
|
+
size = 0;
|
|
963
996
|
constructor(capacity) {
|
|
964
|
-
this.head = 0;
|
|
965
|
-
this.tail = 0;
|
|
966
|
-
this.size = 0;
|
|
967
997
|
this.capacity = capacity;
|
|
968
998
|
this.buffer = new Array(capacity).fill(null);
|
|
969
999
|
}
|
|
@@ -1006,6 +1036,10 @@ class KritzelCircularBuffer {
|
|
|
1006
1036
|
}
|
|
1007
1037
|
|
|
1008
1038
|
class KritzelHistory {
|
|
1039
|
+
_store;
|
|
1040
|
+
undoStack;
|
|
1041
|
+
redoStack;
|
|
1042
|
+
previousViewport;
|
|
1009
1043
|
constructor(store) {
|
|
1010
1044
|
this._store = store;
|
|
1011
1045
|
this.undoStack = new KritzelCircularBuffer(this._store.state.historyBufferSize);
|
|
@@ -1087,128 +1121,13 @@ class KritzelHistory {
|
|
|
1087
1121
|
}
|
|
1088
1122
|
}
|
|
1089
1123
|
|
|
1090
|
-
class KritzelOctree {
|
|
1091
|
-
constructor(bounds, capacity = 8) {
|
|
1092
|
-
this.objects = [];
|
|
1093
|
-
this.children = null;
|
|
1094
|
-
this.bounds = bounds;
|
|
1095
|
-
this.capacity = capacity;
|
|
1096
|
-
}
|
|
1097
|
-
reset() {
|
|
1098
|
-
this.objects = [];
|
|
1099
|
-
this.children = null;
|
|
1100
|
-
}
|
|
1101
|
-
insert(object) {
|
|
1102
|
-
if (!this.intersects(object.rotatedBoundingBox, this.bounds)) {
|
|
1103
|
-
return false;
|
|
1104
|
-
}
|
|
1105
|
-
if (this.objects.length < this.capacity && this.children === null) {
|
|
1106
|
-
this.objects.push(object);
|
|
1107
|
-
return true;
|
|
1108
|
-
}
|
|
1109
|
-
if (this.children === null) {
|
|
1110
|
-
this.subdivide();
|
|
1111
|
-
}
|
|
1112
|
-
for (const child of this.children) {
|
|
1113
|
-
if (child.insert(object)) {
|
|
1114
|
-
return true;
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
return false;
|
|
1118
|
-
}
|
|
1119
|
-
update(object) {
|
|
1120
|
-
const index = this.objects.findIndex(o => o.id === object.id);
|
|
1121
|
-
if (index !== -1) {
|
|
1122
|
-
this.objects[index] = object;
|
|
1123
|
-
return true;
|
|
1124
|
-
}
|
|
1125
|
-
if (this.children !== null) {
|
|
1126
|
-
for (const child of this.children) {
|
|
1127
|
-
if (child.update(object)) {
|
|
1128
|
-
return true;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
return false;
|
|
1133
|
-
}
|
|
1134
|
-
remove(predicate) {
|
|
1135
|
-
const index = this.objects.findIndex(o => predicate(o));
|
|
1136
|
-
if (index !== -1) {
|
|
1137
|
-
this.objects.splice(index, 1);
|
|
1138
|
-
}
|
|
1139
|
-
if (this.children !== null) {
|
|
1140
|
-
for (const child of this.children) {
|
|
1141
|
-
child.remove(predicate);
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
query(range) {
|
|
1146
|
-
const results = [];
|
|
1147
|
-
if (!this.intersects(range, this.bounds)) {
|
|
1148
|
-
return results;
|
|
1149
|
-
}
|
|
1150
|
-
for (const object of this.objects) {
|
|
1151
|
-
if (this.intersects(object.rotatedBoundingBox, range)) {
|
|
1152
|
-
results.push(object);
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
if (this.children !== null) {
|
|
1156
|
-
for (const child of this.children) {
|
|
1157
|
-
results.push(...child.query(range));
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
return results;
|
|
1161
|
-
}
|
|
1162
|
-
filter(predicate) {
|
|
1163
|
-
const results = this.objects.filter(o => predicate(o));
|
|
1164
|
-
if (this.children !== null) {
|
|
1165
|
-
for (const child of this.children) {
|
|
1166
|
-
results.push(...child.filter(predicate));
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
return results;
|
|
1170
|
-
}
|
|
1171
|
-
allObjects() {
|
|
1172
|
-
const results = [...this.objects];
|
|
1173
|
-
if (this.children !== null) {
|
|
1174
|
-
for (const child of this.children) {
|
|
1175
|
-
results.push(...child.allObjects());
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
return results;
|
|
1179
|
-
}
|
|
1180
|
-
subdivide() {
|
|
1181
|
-
const { x, y, z, width, height, depth } = this.bounds;
|
|
1182
|
-
const halfWidth = width / 2;
|
|
1183
|
-
const halfHeight = height / 2;
|
|
1184
|
-
const halfDepth = depth / 2;
|
|
1185
|
-
this.children = [
|
|
1186
|
-
new KritzelOctree({ x, y, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
|
|
1187
|
-
new KritzelOctree({ x: x + halfWidth, y, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
|
|
1188
|
-
new KritzelOctree({ x, y: y + halfHeight, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
|
|
1189
|
-
new KritzelOctree({ x: x + halfWidth, y: y + halfHeight, z, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
|
|
1190
|
-
new KritzelOctree({ x, y, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
|
|
1191
|
-
new KritzelOctree({ x: x + halfWidth, y, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
|
|
1192
|
-
new KritzelOctree({ x, y: y + halfHeight, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
|
|
1193
|
-
new KritzelOctree({ x: x + halfWidth, y: y + halfHeight, z: z + halfDepth, width: halfWidth, height: halfHeight, depth: halfDepth }, this.capacity),
|
|
1194
|
-
];
|
|
1195
|
-
}
|
|
1196
|
-
intersects(a, b) {
|
|
1197
|
-
return !(a.x >= b.x + b.width || // a is completely to the right of b
|
|
1198
|
-
a.x + a.width <= b.x || // a is completely to the left of b
|
|
1199
|
-
a.y >= b.y + b.height || // a is completely below b
|
|
1200
|
-
a.y + a.height <= b.y // a is completely above b
|
|
1201
|
-
);
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
1124
|
const DEFAULT_ENGINE_STATE = {
|
|
1206
1125
|
activeWorkspace: null,
|
|
1207
1126
|
activeTool: null,
|
|
1208
1127
|
activeText: null,
|
|
1209
1128
|
currentPath: null,
|
|
1210
1129
|
copiedObjects: null,
|
|
1211
|
-
|
|
1130
|
+
objectsMap: null,
|
|
1212
1131
|
selectionBox: null,
|
|
1213
1132
|
selectionGroup: null,
|
|
1214
1133
|
resizeHandleType: null,
|
|
@@ -1264,8 +1183,11 @@ const DEFAULT_ENGINE_STATE = {
|
|
|
1264
1183
|
};
|
|
1265
1184
|
|
|
1266
1185
|
class KritzelDatabase {
|
|
1186
|
+
db = null;
|
|
1187
|
+
dbName;
|
|
1188
|
+
dbVersion;
|
|
1189
|
+
isLoggingEnabled;
|
|
1267
1190
|
constructor(dbName, dbVersion, isLoggingEnabled = false) {
|
|
1268
|
-
this.db = null;
|
|
1269
1191
|
this.dbName = dbName;
|
|
1270
1192
|
this.dbVersion = dbVersion;
|
|
1271
1193
|
this.isLoggingEnabled = isLoggingEnabled;
|
|
@@ -1390,8 +1312,7 @@ class KritzelDatabase {
|
|
|
1390
1312
|
resolve(requestResult);
|
|
1391
1313
|
};
|
|
1392
1314
|
transaction.onabort = () => {
|
|
1393
|
-
|
|
1394
|
-
reject((_a = transaction.error) !== null && _a !== void 0 ? _a : new Error('Transaction aborted'));
|
|
1315
|
+
reject(transaction.error ?? new Error('Transaction aborted'));
|
|
1395
1316
|
};
|
|
1396
1317
|
transaction.onerror = () => {
|
|
1397
1318
|
reject(transaction.error);
|
|
@@ -1449,9 +1370,8 @@ class KritzelDatabase {
|
|
|
1449
1370
|
Promise.all(promises).then(() => resolve(results));
|
|
1450
1371
|
};
|
|
1451
1372
|
transaction.onabort = () => {
|
|
1452
|
-
var _a;
|
|
1453
1373
|
console.error('[IndexedDB] Batch transaction aborted:', transaction.error);
|
|
1454
|
-
reject(
|
|
1374
|
+
reject(transaction.error ?? new Error('Transaction aborted'));
|
|
1455
1375
|
};
|
|
1456
1376
|
transaction.onerror = () => {
|
|
1457
1377
|
console.error('[IndexedDB] Batch transaction error:', transaction.error);
|
|
@@ -1490,17 +1410,56 @@ class KritzelDatabase {
|
|
|
1490
1410
|
}
|
|
1491
1411
|
}
|
|
1492
1412
|
|
|
1493
|
-
class
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
this.
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
this.
|
|
1413
|
+
class KritzelObjectMap {
|
|
1414
|
+
map;
|
|
1415
|
+
constructor() {
|
|
1416
|
+
this.map = new Map();
|
|
1417
|
+
}
|
|
1418
|
+
reset() {
|
|
1419
|
+
this.map.clear();
|
|
1420
|
+
}
|
|
1421
|
+
insert(object) {
|
|
1422
|
+
if (!object.id) {
|
|
1423
|
+
return false;
|
|
1424
|
+
}
|
|
1425
|
+
this.map.set(object.id, object);
|
|
1426
|
+
return true;
|
|
1427
|
+
}
|
|
1428
|
+
update(object) {
|
|
1429
|
+
if (!object.id || !this.map.has(object.id)) {
|
|
1430
|
+
return false;
|
|
1431
|
+
}
|
|
1432
|
+
this.map.set(object.id, object);
|
|
1433
|
+
return true;
|
|
1434
|
+
}
|
|
1435
|
+
remove(predicate) {
|
|
1436
|
+
for (const [id, object] of this.map) {
|
|
1437
|
+
if (predicate(object)) {
|
|
1438
|
+
this.map.delete(id);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
filter(predicate) {
|
|
1443
|
+
const results = [];
|
|
1444
|
+
for (const object of this.map.values()) {
|
|
1445
|
+
if (predicate(object)) {
|
|
1446
|
+
results.push(object);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
return results;
|
|
1450
|
+
}
|
|
1451
|
+
allObjects() {
|
|
1452
|
+
return Array.from(this.map.values());
|
|
1500
1453
|
}
|
|
1501
1454
|
}
|
|
1502
1455
|
|
|
1503
1456
|
class KritzelStore {
|
|
1457
|
+
_kritzelEngine;
|
|
1458
|
+
_state;
|
|
1459
|
+
_history;
|
|
1460
|
+
_database;
|
|
1461
|
+
_listeners = new Map();
|
|
1462
|
+
objects = [];
|
|
1504
1463
|
get history() {
|
|
1505
1464
|
return this._history;
|
|
1506
1465
|
}
|
|
@@ -1511,10 +1470,10 @@ class KritzelStore {
|
|
|
1511
1470
|
return this._state;
|
|
1512
1471
|
}
|
|
1513
1472
|
get currentZIndex() {
|
|
1514
|
-
return this._state.
|
|
1473
|
+
return this._state.objectsMap.filter(o => !(o instanceof index$1.KritzelSelectionGroup) && !(o instanceof index$1.KrtizelSelectionBox)).length;
|
|
1515
1474
|
}
|
|
1516
1475
|
get allObjects() {
|
|
1517
|
-
return this._state.
|
|
1476
|
+
return this._state.objectsMap.allObjects();
|
|
1518
1477
|
}
|
|
1519
1478
|
get selectedObjects() {
|
|
1520
1479
|
return this.allObjects.filter(o => !(o instanceof index$1.KritzelSelectionGroup)).filter(o => o.isSelected);
|
|
@@ -1529,20 +1488,11 @@ class KritzelStore {
|
|
|
1529
1488
|
return this._state.isEnabled === false || this._state.isReady === false || this._state.activeWorkspace === null;
|
|
1530
1489
|
}
|
|
1531
1490
|
constructor(kritzelEngine) {
|
|
1532
|
-
this._listeners = new Map();
|
|
1533
|
-
this.objects = [];
|
|
1534
1491
|
this._state = DEFAULT_ENGINE_STATE;
|
|
1535
1492
|
this._kritzelEngine = kritzelEngine;
|
|
1536
1493
|
this._history = new KritzelHistory(this);
|
|
1537
1494
|
this._database = new KritzelDatabase('kritzelDB', 1, this._state.debugInfo.logDatabase);
|
|
1538
|
-
this._state.
|
|
1539
|
-
x: -Infinity,
|
|
1540
|
-
y: -Infinity,
|
|
1541
|
-
z: -Infinity,
|
|
1542
|
-
width: Infinity,
|
|
1543
|
-
height: Infinity,
|
|
1544
|
-
depth: Infinity,
|
|
1545
|
-
});
|
|
1495
|
+
this._state.objectsMap = new KritzelObjectMap();
|
|
1546
1496
|
}
|
|
1547
1497
|
async initializeDatabase() {
|
|
1548
1498
|
await this._database.open([
|
|
@@ -1555,11 +1505,10 @@ class KritzelStore {
|
|
|
1555
1505
|
this.rerender();
|
|
1556
1506
|
}
|
|
1557
1507
|
async initializeWorkspace(workspace) {
|
|
1558
|
-
var _a;
|
|
1559
1508
|
const workspaces = await this.getWorkspaces();
|
|
1560
1509
|
const mostRecentWorkspace = [...workspaces].sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime())[0];
|
|
1561
|
-
const fallbackWorkspace = new KritzelWorkspace(index$1.ObjectHelper.generateUUID(), 'New Workspace');
|
|
1562
|
-
this._state.activeWorkspace =
|
|
1510
|
+
const fallbackWorkspace = new index$1.KritzelWorkspace(index$1.ObjectHelper.generateUUID(), 'New Workspace');
|
|
1511
|
+
this._state.activeWorkspace = workspace ?? mostRecentWorkspace ?? fallbackWorkspace;
|
|
1563
1512
|
const isExistingWorkspace = await this.getWorkspace(this._state.activeWorkspace.id);
|
|
1564
1513
|
if (isExistingWorkspace) {
|
|
1565
1514
|
await this.updateWorkspace(this._state.activeWorkspace);
|
|
@@ -1574,13 +1523,13 @@ class KritzelStore {
|
|
|
1574
1523
|
await this.initializeWorkspaceObjects(this._state.activeWorkspace.id);
|
|
1575
1524
|
}
|
|
1576
1525
|
async initializeWorkspaceObjects(workspaceId) {
|
|
1577
|
-
this._state.
|
|
1526
|
+
this._state.objectsMap.reset();
|
|
1578
1527
|
this._history.reset();
|
|
1579
1528
|
const objectsFromDb = await this._database.getAllByRange('objects', IDBKeyRange.bound([workspaceId], [workspaceId, '\uffff']));
|
|
1580
1529
|
const reviver = new index$1.KritzelReviver(this);
|
|
1581
1530
|
objectsFromDb.forEach(element => {
|
|
1582
1531
|
const revivedObject = reviver.revive(element);
|
|
1583
|
-
this._state.
|
|
1532
|
+
this._state.objectsMap.insert(revivedObject);
|
|
1584
1533
|
});
|
|
1585
1534
|
this.rerender();
|
|
1586
1535
|
}
|
|
@@ -1671,6 +1620,7 @@ class KritzelStore {
|
|
|
1671
1620
|
const objectRange = IDBKeyRange.bound([workspace.id], [workspace.id, '\uffff']);
|
|
1672
1621
|
await this._database.deleteByRange('objects', objectRange);
|
|
1673
1622
|
await this._database.delete('workspaces', workspace.id);
|
|
1623
|
+
this.state.workspaces = this.state.workspaces.filter(ws => ws.id !== workspace.id);
|
|
1674
1624
|
}
|
|
1675
1625
|
rerender() {
|
|
1676
1626
|
if (this._kritzelEngine) {
|
|
@@ -1796,15 +1746,8 @@ class KritzelStore {
|
|
|
1796
1746
|
this.history.executeCommand(new index$1.AddSelectionGroupCommand(this, this, selectionGroup));
|
|
1797
1747
|
}
|
|
1798
1748
|
selectAllObjectsInViewport() {
|
|
1799
|
-
const objectsInViewport = this._state.
|
|
1800
|
-
.
|
|
1801
|
-
x: -this._state.translateX / this._state.scale,
|
|
1802
|
-
y: -this._state.translateY / this._state.scale,
|
|
1803
|
-
z: this._state.scale,
|
|
1804
|
-
width: this._state.viewportWidth / this._state.scale,
|
|
1805
|
-
height: this._state.viewportHeight / this._state.scale,
|
|
1806
|
-
depth: 100,
|
|
1807
|
-
})
|
|
1749
|
+
const objectsInViewport = this._state.objectsMap
|
|
1750
|
+
.filter(o => o.isInViewport())
|
|
1808
1751
|
.filter(o => !(o instanceof index$1.KritzelSelectionGroup) && !(o instanceof index$1.KrtizelSelectionBox) && !(o instanceof KritzelContextMenu));
|
|
1809
1752
|
if (objectsInViewport.length > 0) {
|
|
1810
1753
|
const selectionGroup = index$1.KritzelSelectionGroup.create(this);
|
|
@@ -1837,8 +1780,7 @@ class KritzelStore {
|
|
|
1837
1780
|
this.state.activeText = null;
|
|
1838
1781
|
}
|
|
1839
1782
|
getObjectFromPointerEvent(event, selector = '.object') {
|
|
1840
|
-
|
|
1841
|
-
const shadowRoot = (_a = this.state.host) === null || _a === void 0 ? void 0 : _a.shadowRoot;
|
|
1783
|
+
const shadowRoot = this.state.host?.shadowRoot;
|
|
1842
1784
|
if (!shadowRoot)
|
|
1843
1785
|
return null;
|
|
1844
1786
|
const clientX = event.clientX;
|
|
@@ -1853,8 +1795,7 @@ class KritzelStore {
|
|
|
1853
1795
|
return null;
|
|
1854
1796
|
}
|
|
1855
1797
|
getObjectsFromPointerEvent(event, selector = '.object') {
|
|
1856
|
-
|
|
1857
|
-
const shadowRoot = (_a = this.state.host) === null || _a === void 0 ? void 0 : _a.shadowRoot;
|
|
1798
|
+
const shadowRoot = this.state.host?.shadowRoot;
|
|
1858
1799
|
if (!shadowRoot)
|
|
1859
1800
|
return [];
|
|
1860
1801
|
const clientX = event.clientX;
|
|
@@ -1972,10 +1913,10 @@ class KritzelKeyHandler extends index$1.KritzelBaseHandler {
|
|
|
1972
1913
|
}
|
|
1973
1914
|
|
|
1974
1915
|
class KritzelContextMenuHandler extends index$1.KritzelBaseHandler {
|
|
1916
|
+
globalContextMenuItems = [];
|
|
1917
|
+
objectContextMenuItems = [];
|
|
1975
1918
|
constructor(store, globalContextMenuItems, objectContextMenuItems) {
|
|
1976
1919
|
super(store);
|
|
1977
|
-
this.globalContextMenuItems = [];
|
|
1978
|
-
this.objectContextMenuItems = [];
|
|
1979
1920
|
this.globalContextMenuItems = globalContextMenuItems;
|
|
1980
1921
|
this.objectContextMenuItems = objectContextMenuItems;
|
|
1981
1922
|
}
|
|
@@ -2024,6 +1965,17 @@ class KritzelClassHelper {
|
|
|
2024
1965
|
const kritzelEngineCss = ":host{display:block;position:relative;height:100%;width:100%;overflow:hidden;background-color:var(--kritzel-engine-background-color, #ffffff)}:host,:host *{touch-action:none;user-select:none}.debug-panel{position:absolute;pointer-events:none;top:0;right:0}.origin{position:relative;top:0;left:0;height:0;width:0;pointer-events:none;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top left;overflow:visible}.object{overflow:visible}textarea{all:unset;box-sizing:border-box;outline:none !important;border:none !important;overflow:visible}.resize-handle-overlay.top-left,.resize-handle-overlay.bottom-right{cursor:nwse-resize}.resize-handle-overlay.top-right,.resize-handle-overlay.bottom-left{cursor:nesw-resize}.rotation-handle-overlay{cursor:grab}";
|
|
2025
1966
|
|
|
2026
1967
|
const KritzelEngine = class {
|
|
1968
|
+
workspace;
|
|
1969
|
+
activeTool;
|
|
1970
|
+
globalContextMenuItems;
|
|
1971
|
+
objectContextMenuItems;
|
|
1972
|
+
scaleMax = ABSOLUTE_SCALE_MAX;
|
|
1973
|
+
scaleMin = ABSOLUTE_SCALE_MIN;
|
|
1974
|
+
isEngineReady;
|
|
1975
|
+
activeToolChange;
|
|
1976
|
+
workspacesChange;
|
|
1977
|
+
get host() { return index.getElement(this); }
|
|
1978
|
+
forceUpdate = 0;
|
|
2027
1979
|
onWorkspaceChange(newWorkspace) {
|
|
2028
1980
|
if (newWorkspace) {
|
|
2029
1981
|
this.store.initializeWorkspace(newWorkspace);
|
|
@@ -2049,6 +2001,11 @@ const KritzelEngine = class {
|
|
|
2049
2001
|
this.store.state.scaleMin = newValue;
|
|
2050
2002
|
}
|
|
2051
2003
|
}
|
|
2004
|
+
store;
|
|
2005
|
+
viewport;
|
|
2006
|
+
contextMenuHandler;
|
|
2007
|
+
keyHandler;
|
|
2008
|
+
contextMenuElement = null;
|
|
2052
2009
|
get isSelecting() {
|
|
2053
2010
|
return this.store.state.activeTool instanceof index$1.KritzelSelectionTool && this.store.state.isSelecting;
|
|
2054
2011
|
}
|
|
@@ -2060,10 +2017,6 @@ const KritzelEngine = class {
|
|
|
2060
2017
|
this.isEngineReady = index.createEvent(this, "isEngineReady");
|
|
2061
2018
|
this.activeToolChange = index.createEvent(this, "activeToolChange");
|
|
2062
2019
|
this.workspacesChange = index.createEvent(this, "workspacesChange");
|
|
2063
|
-
this.scaleMax = ABSOLUTE_SCALE_MAX;
|
|
2064
|
-
this.scaleMin = ABSOLUTE_SCALE_MIN;
|
|
2065
|
-
this.forceUpdate = 0;
|
|
2066
|
-
this.contextMenuElement = null;
|
|
2067
2020
|
this.store = new KritzelStore(this);
|
|
2068
2021
|
}
|
|
2069
2022
|
componentWillLoad() {
|
|
@@ -2083,7 +2036,6 @@ const KritzelEngine = class {
|
|
|
2083
2036
|
}
|
|
2084
2037
|
}
|
|
2085
2038
|
handleWheel(ev) {
|
|
2086
|
-
var _a, _b;
|
|
2087
2039
|
if (this.store.isDisabled) {
|
|
2088
2040
|
return;
|
|
2089
2041
|
}
|
|
@@ -2091,10 +2043,9 @@ const KritzelEngine = class {
|
|
|
2091
2043
|
this.hideContextMenu();
|
|
2092
2044
|
}
|
|
2093
2045
|
this.viewport.handleWheel(ev);
|
|
2094
|
-
|
|
2046
|
+
this.store.state?.activeTool?.handleWheel(ev);
|
|
2095
2047
|
}
|
|
2096
2048
|
handlePointerDown(ev) {
|
|
2097
|
-
var _a, _b;
|
|
2098
2049
|
if (this.store.isDisabled) {
|
|
2099
2050
|
return;
|
|
2100
2051
|
}
|
|
@@ -2111,36 +2062,33 @@ const KritzelEngine = class {
|
|
|
2111
2062
|
this.host.setPointerCapture(ev.pointerId);
|
|
2112
2063
|
this.store.state.pointers.set(ev.pointerId, ev);
|
|
2113
2064
|
this.viewport.handlePointerDown(ev);
|
|
2114
|
-
|
|
2065
|
+
this.store.state?.activeTool?.handlePointerDown(ev);
|
|
2115
2066
|
}
|
|
2116
2067
|
handlePointerMove(ev) {
|
|
2117
|
-
var _a, _b;
|
|
2118
2068
|
if (this.store.isDisabled) {
|
|
2119
2069
|
return;
|
|
2120
2070
|
}
|
|
2121
2071
|
this.store.state.pointers.set(ev.pointerId, ev);
|
|
2122
2072
|
this.viewport.handlePointerMove(ev);
|
|
2123
|
-
|
|
2073
|
+
this.store.state?.activeTool?.handlePointerMove(ev);
|
|
2124
2074
|
}
|
|
2125
2075
|
handlePointerUp(ev) {
|
|
2126
|
-
var _a, _b;
|
|
2127
2076
|
if (this.store.isDisabled) {
|
|
2128
2077
|
return;
|
|
2129
2078
|
}
|
|
2130
2079
|
this.store.state.pointers.delete(ev.pointerId);
|
|
2131
2080
|
this.host.releasePointerCapture(ev.pointerId);
|
|
2132
2081
|
this.viewport.handlePointerUp(ev);
|
|
2133
|
-
|
|
2082
|
+
this.store.state?.activeTool?.handlePointerUp(ev);
|
|
2134
2083
|
}
|
|
2135
2084
|
handlePointerCancel(ev) {
|
|
2136
|
-
var _a, _b;
|
|
2137
2085
|
if (this.store.isDisabled) {
|
|
2138
2086
|
return;
|
|
2139
2087
|
}
|
|
2140
2088
|
this.host.releasePointerCapture(ev.pointerId);
|
|
2141
2089
|
this.store.state.pointers.delete(ev.pointerId);
|
|
2142
2090
|
this.viewport.handlePointerUp(ev);
|
|
2143
|
-
|
|
2091
|
+
this.store.state?.activeTool?.handlePointerUp(ev);
|
|
2144
2092
|
}
|
|
2145
2093
|
handleContextMenu(ev) {
|
|
2146
2094
|
ev.preventDefault();
|
|
@@ -2189,11 +2137,10 @@ const KritzelEngine = class {
|
|
|
2189
2137
|
return Promise.resolve(registeredTool);
|
|
2190
2138
|
}
|
|
2191
2139
|
async changeActiveTool(tool) {
|
|
2192
|
-
|
|
2193
|
-
(_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
|
|
2140
|
+
this.store.state.activeTool?.onDeactivate();
|
|
2194
2141
|
this.store.setState('activeTool', tool);
|
|
2195
2142
|
this.store.deselectAllObjects();
|
|
2196
|
-
tool
|
|
2143
|
+
tool?.onActivate();
|
|
2197
2144
|
}
|
|
2198
2145
|
async setFocus() {
|
|
2199
2146
|
this.host.focus();
|
|
@@ -2270,15 +2217,13 @@ const KritzelEngine = class {
|
|
|
2270
2217
|
return this.store.state.selectionGroup ? this.store.state.selectionGroup.objects : [];
|
|
2271
2218
|
}
|
|
2272
2219
|
async selectObjects(objects) {
|
|
2273
|
-
|
|
2274
|
-
(_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
|
|
2220
|
+
this.store.state.activeTool?.onDeactivate();
|
|
2275
2221
|
this.store.setState('activeTool', index$1.KritzelToolRegistry.getTool('selection'));
|
|
2276
2222
|
this.store.deselectAllObjects();
|
|
2277
2223
|
this.store.selectObjects(objects);
|
|
2278
2224
|
}
|
|
2279
2225
|
async selectAllObjectsInViewport() {
|
|
2280
|
-
|
|
2281
|
-
(_a = this.store.state.activeTool) === null || _a === void 0 ? void 0 : _a.onDeactivate();
|
|
2226
|
+
this.store.state.activeTool?.onDeactivate();
|
|
2282
2227
|
this.store.setState('activeTool', index$1.KritzelToolRegistry.getTool('selection'));
|
|
2283
2228
|
this.store.deselectAllObjects();
|
|
2284
2229
|
this.store.selectAllObjectsInViewport();
|
|
@@ -2293,8 +2238,7 @@ const KritzelEngine = class {
|
|
|
2293
2238
|
return object;
|
|
2294
2239
|
}
|
|
2295
2240
|
async getCopiedObjects() {
|
|
2296
|
-
|
|
2297
|
-
return ((_a = this.store.state.copiedObjects) === null || _a === void 0 ? void 0 : _a.objects) || [];
|
|
2241
|
+
return this.store.state.copiedObjects?.objects || [];
|
|
2298
2242
|
}
|
|
2299
2243
|
async createWorkspace(workspace) {
|
|
2300
2244
|
return this.store.createWorkspace(workspace).then(() => {
|
|
@@ -2307,8 +2251,8 @@ const KritzelEngine = class {
|
|
|
2307
2251
|
});
|
|
2308
2252
|
}
|
|
2309
2253
|
async deleteWorkspace(workspace) {
|
|
2310
|
-
return this.store.deleteWorkspace(workspace).then(() => {
|
|
2311
|
-
this.workspacesChange.emit(this.store.state.workspaces
|
|
2254
|
+
return this.store.deleteWorkspace(workspace).then(async () => {
|
|
2255
|
+
this.workspacesChange.emit(this.store.state.workspaces);
|
|
2312
2256
|
});
|
|
2313
2257
|
}
|
|
2314
2258
|
async getWorkspaces() {
|
|
@@ -2332,149 +2276,134 @@ const KritzelEngine = class {
|
|
|
2332
2276
|
}
|
|
2333
2277
|
}
|
|
2334
2278
|
render() {
|
|
2335
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
|
|
2336
2279
|
const computedStyle = window.getComputedStyle(this.host);
|
|
2337
2280
|
const baseHandleSizePx = computedStyle.getPropertyValue('--kritzel-selection-handle-size').trim() || '6px';
|
|
2338
2281
|
const baseHandleSize = parseFloat(baseHandleSizePx);
|
|
2339
2282
|
const baseHandleTouchSize = baseHandleSize * 2 < 14 ? 14 : baseHandleSize;
|
|
2340
|
-
return (index.h(index.Host, { key: '
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("line", { x1: object.totalWidth / 2, y1: "0", x2: object.totalWidth / 2, y2: -((15 * object.scale) / ((_p = this.store.state) === null || _p === void 0 ? void 0 : _p.scale)), style: {
|
|
2445
|
-
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2446
|
-
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${(_q = this.store.state) === null || _q === void 0 ? void 0 : _q.scale})`,
|
|
2447
|
-
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "rotation-handle", cx: object.totalWidth / 2, cy: -((15 * object.scale) / ((_r = this.store.state) === null || _r === void 0 ? void 0 : _r.scale)), r: `${(baseHandleSize * object.scale) / ((_s = this.store.state) === null || _s === void 0 ? void 0 : _s.scale)}`, style: {
|
|
2448
|
-
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2449
|
-
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "rotation-handle-overlay", cx: object.totalWidth / 2, cy: -((15 * object.scale) / ((_t = this.store.state) === null || _t === void 0 ? void 0 : _t.scale)), r: `${(baseHandleTouchSize * object.scale) / ((_u = this.store.state) === null || _u === void 0 ? void 0 : _u.scale)}`, style: {
|
|
2450
|
-
fill: 'transparent',
|
|
2451
|
-
cursor: 'grab',
|
|
2452
|
-
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, index.h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.isDebugInfoVisible ? 'block' : 'none' } }, index.h("div", { style: { width: '100%', height: '100%' } }, index.h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), index.h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), index.h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), index.h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), index.h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation), index.h("div", { style: { whiteSpace: 'nowrap' } }, "x: ", object.x), index.h("div", { style: { whiteSpace: 'nowrap' } }, "y: ", object.y)))))));
|
|
2453
|
-
}), index.h("svg", { key: '86f9a08bea3ac2d261b14b2eec471fafd20ca11f', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
2454
|
-
height: (_z = this.store.state.currentPath) === null || _z === void 0 ? void 0 : _z.height.toString(),
|
|
2455
|
-
width: (_0 = this.store.state.currentPath) === null || _0 === void 0 ? void 0 : _0.width.toString(),
|
|
2283
|
+
return (index.h(index.Host, { key: 'fd353ff17bcde1a9ab646b6f463d1c6ce00a3dff' }, index.h("div", { key: '45bc2af8f1a3a2bfa3aa76a478c7bf208027da0c', class: "debug-panel", style: { display: this.store.state.debugInfo.showViewportInfo ? 'block' : 'none' } }, index.h("div", { key: '50e932febc35c7dbe852ad99d96ca4f0e0b742fc' }, "ActiveWorkspaceId: ", this.store.state?.activeWorkspace?.id), index.h("div", { key: 'af94b5061f0803588fece6cccdf540f46f13ca05' }, "ActiveWorkspaceName: ", this.store.state?.activeWorkspace?.name), index.h("div", { key: '89c0d21ce94f4eda72153554fadbd6942e785edc' }, "TranslateX: ", this.store.state?.translateX), index.h("div", { key: '340b5165265241972a7a940268c7940063ba8c12' }, "TranslateY: ", this.store.state?.translateY), index.h("div", { key: '428054b3ea4a1c327f03d6b37bfe6331dea6c57b' }, "ViewportWidth: ", this.store.state?.viewportWidth), index.h("div", { key: 'd67420ef633627413066a28b8ef9ac43c520015d' }, "ViewportHeight: ", this.store.state?.viewportHeight), index.h("div", { key: 'dedf9eb89c79fa496f7b6d0df9c646898f66b3d4' }, "ObjectsInViewport. ", this.store.objects.length), index.h("div", { key: '59bb8416941fd84305f2892f24098f6f4a084401' }, "Scale: ", this.store.state?.scale), index.h("div", { key: '6705a4cec22e4e33f75e296e17bc2952a3d1cba7' }, "ActiveTool: ", this.store.state?.activeTool?.name), index.h("div", { key: 'ca22e0a377a11fdca851b38f1bf425648cd3b9dd' }, "HasViewportChanged: ", this.store.state?.hasViewportChanged ? 'true' : 'false'), index.h("div", { key: '57508b9ee24a5af631e6bb1eace404c39af14f82' }, "IsEnabled: ", this.store.state?.isEnabled ? 'true' : 'false'), index.h("div", { key: 'f6cea367b5007f767afb25a033215abda734de9d' }, "IsScaling: ", this.store.state?.isScaling ? 'true' : 'false'), index.h("div", { key: '4386ef749facd2e54da7f58aa2713b87ed76f2df' }, "IsPanning: ", this.store.state?.isPanning ? 'true' : 'false'), index.h("div", { key: '1713185b36a50dfe0f9efa0c92394222db80a377' }, "IsFocused: ", this.store.state.isFocused ? 'true' : 'false'), index.h("div", { key: '5104f428b808e7d843712302ad2e58b619876bee' }, "IsSelecting: ", this.isSelecting ? 'true' : 'false'), index.h("div", { key: '2cb3b27a00627188e7082fa94169eb961a1ae6ed' }, "IsSelectionActive: ", this.isSelectionActive ? 'true' : 'false'), index.h("div", { key: '7407656e61be665f27e706738faa6d318e2c1d04' }, "IsResizeHandleSelected: ", this.store.state.isResizeHandleSelected ? 'true' : 'false'), index.h("div", { key: '701bf05c25cb3d3728af6602f694e6064627ea59' }, "IsRotationHandleSelected: ", this.store.state.isRotationHandleSelected ? 'true' : 'false'), index.h("div", { key: '772c345ea9c64ef800fdbb26919f1a54ca889025' }, "IsDrawing: ", this.store.state.isDrawing ? 'true' : 'false'), index.h("div", { key: 'dc687c8ba24182b8b61979ad334b989d3be72ec6' }, "IsWriting: ", this.store.state.isWriting ? 'true' : 'false'), index.h("div", { key: '10cbc575a7905396a76eca4e7b56be719755aeb4' }, "PointerX: ", this.store.state?.pointerX), index.h("div", { key: '4f21199328ffadddcc58b7d6b102a89e5079f676' }, "PointerY: ", this.store.state?.pointerY), index.h("div", { key: 'ac705f38cb323b8dc8cbf95f875657c5dec5c9ae' }, "SelectedObjects: ", this.store.state.selectionGroup?.objects.length || 0)), index.h("div", { key: '2ca55c53246e64520af6720a3f87d2357295ca7f', id: "origin", class: "origin", style: {
|
|
2284
|
+
transform: `matrix(${this.store.state?.scale}, 0, 0, ${this.store.state?.scale}, ${this.store.state?.translateX}, ${this.store.state?.translateY})`,
|
|
2285
|
+
} }, this.store.state.objectsMap.allObjects()?.map(object => {
|
|
2286
|
+
return (index.h("div", { key: object.id, style: { display: object.isInViewport() ? 'block' : 'none', transform: object?.transformationMatrix, transformOrigin: 'top left', zIndex: object.zIndex.toString(), position: 'absolute' } }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", id: object.id, class: "object", style: {
|
|
2287
|
+
height: object?.totalHeight.toString(),
|
|
2288
|
+
width: object?.totalWidth.toString(),
|
|
2289
|
+
left: '0',
|
|
2290
|
+
top: '0',
|
|
2291
|
+
position: 'absolute',
|
|
2292
|
+
transform: `rotate(${object.rotationDegrees}deg)`,
|
|
2293
|
+
transformOrigin: 'center',
|
|
2294
|
+
opacity: object.markedForRemoval ? '0.5' : object.opacity.toString(),
|
|
2295
|
+
pointerEvents: object.markedForRemoval ? 'none' : 'auto',
|
|
2296
|
+
} }, index.h("foreignObject", { x: "0", y: "0", width: object.totalWidth.toString(), height: object.totalHeight.toString(), style: {
|
|
2297
|
+
minHeight: '0',
|
|
2298
|
+
minWidth: '0',
|
|
2299
|
+
backgroundColor: object.backgroundColor,
|
|
2300
|
+
borderColor: object.borderColor,
|
|
2301
|
+
borderWidth: object.borderWidth + 'px',
|
|
2302
|
+
borderStyle: 'solid',
|
|
2303
|
+
padding: object.padding + 'px',
|
|
2304
|
+
overflow: 'visible',
|
|
2305
|
+
} }, KritzelClassHelper.isInstanceOf(object, 'KritzelPath') && (index.h("svg", { ref: el => (el ? object.mount(el) : object.unmount()), xmlns: "http://www.w3.org/2000/svg", style: {
|
|
2306
|
+
height: object?.height.toString(),
|
|
2307
|
+
width: object?.width.toString(),
|
|
2308
|
+
position: 'absolute',
|
|
2309
|
+
overflow: 'visible',
|
|
2310
|
+
}, viewBox: object?.viewBox }, index.h("path", { d: object?.d, fill: object.fill, stroke: object?.stroke }))), KritzelClassHelper.isInstanceOf(object, 'KritzelImage') && (index.h("img", { ref: el => (el ? object.mount(el) : object.unmount()), src: object.src, style: {
|
|
2311
|
+
width: '100%',
|
|
2312
|
+
height: '100%',
|
|
2313
|
+
userSelect: 'none',
|
|
2314
|
+
pointerEvents: 'none',
|
|
2315
|
+
}, draggable: false, onDragStart: e => e.preventDefault() })), KritzelClassHelper.isInstanceOf(object, 'KritzelText') && (index.h("textarea", { ref: el => (el ? object.mount(el) : object.unmount()), value: object.value, onKeyDown: event => object.handleKeyDown(event), onInput: event => object.handleInput(event), rows: object.rows, style: {
|
|
2316
|
+
width: '100%',
|
|
2317
|
+
height: '100%',
|
|
2318
|
+
color: object.fontColor,
|
|
2319
|
+
fontSize: object.fontSize?.toString() + 'px',
|
|
2320
|
+
fontFamily: object.fontFamily,
|
|
2321
|
+
border: 'none',
|
|
2322
|
+
outline: 'none',
|
|
2323
|
+
resize: 'none',
|
|
2324
|
+
overflow: 'hidden',
|
|
2325
|
+
display: 'block',
|
|
2326
|
+
padding: '1px',
|
|
2327
|
+
whiteSpace: 'nowrap',
|
|
2328
|
+
pointerEvents: object.isReadonly ? 'none' : 'auto',
|
|
2329
|
+
cursor: object.isReadonly ? 'default' : 'text',
|
|
2330
|
+
caretColor: object.isReadonly ? 'transparent' : 'auto',
|
|
2331
|
+
} })), KritzelClassHelper.isInstanceOf(object, 'KritzelCustomElement') && (index.h("div", { ref: el => (el ? object.mount(el) : object.unmount()), style: {
|
|
2332
|
+
width: '100%',
|
|
2333
|
+
height: '100%',
|
|
2334
|
+
pointerEvents: 'auto',
|
|
2335
|
+
overflow: 'hidden',
|
|
2336
|
+
display: 'block',
|
|
2337
|
+
} })), KritzelClassHelper.isInstanceOf(object, 'KritzelSelectionGroup') && (index.h("div", { ref: el => (el ? object.mount(el) : object.unmount()), style: {
|
|
2338
|
+
width: '100%',
|
|
2339
|
+
height: '100%',
|
|
2340
|
+
} })), KritzelClassHelper.isInstanceOf(object, 'KrtizelSelectionBox') && (index.h("div", { ref: el => (el ? object.mount(el) : object.unmount()), style: {
|
|
2341
|
+
width: '100%',
|
|
2342
|
+
height: '100%',
|
|
2343
|
+
} }))), index.h("line", { x1: "0", y1: "0", x2: object.totalWidth, y2: "0", style: {
|
|
2344
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2345
|
+
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${this.store.state?.scale})`,
|
|
2346
|
+
strokeLinecap: 'square',
|
|
2347
|
+
}, visibility: object.isSelected ? 'visible' : 'hidden' }), index.h("line", { x1: "0", y1: "0", x2: "0", y2: object.totalHeight, style: {
|
|
2348
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2349
|
+
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${this.store.state?.scale})`,
|
|
2350
|
+
strokeLinecap: 'square',
|
|
2351
|
+
}, visibility: object.isSelected ? 'visible' : 'hidden' }), index.h("line", { x1: "0", y1: object.totalHeight, x2: object.totalWidth, y2: object.totalHeight, style: {
|
|
2352
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2353
|
+
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${this.store.state?.scale})`,
|
|
2354
|
+
strokeLinecap: 'square',
|
|
2355
|
+
}, visibility: object.isSelected ? 'visible' : 'hidden' }), index.h("line", { x1: object.totalWidth, y1: "0", x2: object.totalWidth, y2: object.totalHeight, style: {
|
|
2356
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2357
|
+
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${this.store.state?.scale})`,
|
|
2358
|
+
strokeLinecap: 'square',
|
|
2359
|
+
}, visibility: object.isSelected ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle top-left", cx: "0", cy: "0", r: `${(baseHandleSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2360
|
+
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2361
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle-overlay top-left", cx: "0", cy: "0", r: `${(baseHandleTouchSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2362
|
+
fill: 'transparent',
|
|
2363
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2364
|
+
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2365
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle-overlay top-right", cx: object.totalWidth, cy: "0", r: `${(baseHandleTouchSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2366
|
+
fill: 'transparent',
|
|
2367
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2368
|
+
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2369
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle-overlay bottom-left", cx: "0", cy: object.totalHeight, r: `${(baseHandleTouchSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2370
|
+
fill: 'transparent',
|
|
2371
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2372
|
+
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2373
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "resize-handle-overlay bottom-right", cx: object.totalWidth, cy: object.totalHeight, r: `${(baseHandleTouchSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2374
|
+
fill: 'transparent',
|
|
2375
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("line", { x1: object.totalWidth / 2, y1: "0", x2: object.totalWidth / 2, y2: -((15 * object.scale) / this.store.state?.scale), style: {
|
|
2376
|
+
stroke: 'var(--kritzel-selection-border-color, #007AFF)',
|
|
2377
|
+
strokeWidth: `calc(var(--kritzel-selection-border-width, 2px) * ${object.scale} / ${this.store.state?.scale})`,
|
|
2378
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "rotation-handle", cx: object.totalWidth / 2, cy: -((15 * object.scale) / this.store.state?.scale), r: `${(baseHandleSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2379
|
+
fill: 'var(--kritzel-selection-handle-color, #000000)',
|
|
2380
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("circle", { class: "rotation-handle-overlay", cx: object.totalWidth / 2, cy: -((15 * object.scale) / this.store.state?.scale), r: `${(baseHandleTouchSize * object.scale) / this.store.state?.scale}`, style: {
|
|
2381
|
+
fill: 'transparent',
|
|
2382
|
+
cursor: 'grab',
|
|
2383
|
+
}, visibility: object.isSelected && !this.isSelecting ? 'visible' : 'hidden' }), index.h("g", { style: { display: this.store.state.debugInfo.showObjectInfo ? 'block' : 'none', pointerEvents: 'none' } }, index.h("foreignObject", { x: object.totalWidth.toString(), y: "0", width: "400px", height: "160px", style: { minHeight: '0', minWidth: '0', display: object.isDebugInfoVisible ? 'block' : 'none' } }, index.h("div", { style: { width: '100%', height: '100%' } }, index.h("div", { style: { whiteSpace: 'nowrap' } }, "zIndex: ", object.zIndex), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateX: ", object.translateX), index.h("div", { style: { whiteSpace: 'nowrap' } }, "translateY: ", object.translateY), index.h("div", { style: { whiteSpace: 'nowrap' } }, "width: ", object.width), index.h("div", { style: { whiteSpace: 'nowrap' } }, "height: ", object.height), index.h("div", { style: { whiteSpace: 'nowrap' } }, "scale: ", object.scale), index.h("div", { style: { whiteSpace: 'nowrap' } }, "rotation: ", object.rotation), index.h("div", { style: { whiteSpace: 'nowrap' } }, "x: ", object.x), index.h("div", { style: { whiteSpace: 'nowrap' } }, "y: ", object.y)))))));
|
|
2384
|
+
}), index.h("svg", { key: '0098f1b8233d45f49dc8bdcc13c08f20c04b65e1', class: "object", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
2385
|
+
height: this.store.state.currentPath?.height.toString(),
|
|
2386
|
+
width: this.store.state.currentPath?.width.toString(),
|
|
2456
2387
|
left: '0',
|
|
2457
2388
|
top: '0',
|
|
2458
|
-
zIndex:
|
|
2389
|
+
zIndex: this.store.state.currentPath?.zIndex.toString(),
|
|
2459
2390
|
position: 'absolute',
|
|
2460
|
-
transform:
|
|
2391
|
+
transform: this.store.state.currentPath?.transformationMatrix,
|
|
2461
2392
|
transformOrigin: 'top left',
|
|
2462
2393
|
overflow: 'visible',
|
|
2463
|
-
}, viewBox:
|
|
2394
|
+
}, viewBox: this.store.state.currentPath?.viewBox }, index.h("path", { key: '08310713fa8f2f1f695b1b61bb2b6e5a5f77f192', d: this.store.state.currentPath?.d, fill: this.store.state.currentPath?.fill, stroke: this.store.state.currentPath?.stroke }))), this.store.state.isContextMenuVisible && (index.h("kritzel-context-menu", { key: '2529447e26ba02689303be39cc593dfafc25b96c', class: "context-menu", ref: el => (this.contextMenuElement = el), items: this.store.state.contextMenuItems, objects: this.store.state.selectionGroup?.objects || [], style: {
|
|
2464
2395
|
position: 'fixed',
|
|
2465
2396
|
left: `${this.store.state.contextMenuX}px`,
|
|
2466
2397
|
top: `${this.store.state.contextMenuY}px`,
|
|
2467
2398
|
zIndex: '10000',
|
|
2468
2399
|
}, onActionSelected: event => {
|
|
2469
|
-
var _a;
|
|
2470
2400
|
event.detail.action({
|
|
2471
2401
|
x: (-this.store.state.translateX + this.store.state.contextMenuX) / this.store.state.scale,
|
|
2472
2402
|
y: (-this.store.state.translateY + this.store.state.contextMenuY) / this.store.state.scale,
|
|
2473
|
-
},
|
|
2403
|
+
}, this.store.state.selectionGroup?.objects);
|
|
2474
2404
|
this.hideContextMenu();
|
|
2475
|
-
} })),
|
|
2405
|
+
} })), this.store.state?.activeTool instanceof index$1.KritzelEraserTool && !this.store.state.isScaling && index.h("kritzel-cursor-trail", { key: '7c10277160eb1bc51581e4dfbdd4d0cdf626ed8c', store: this.store })));
|
|
2476
2406
|
}
|
|
2477
|
-
get host() { return index.getElement(this); }
|
|
2478
2407
|
static get watchers() { return {
|
|
2479
2408
|
"workspace": ["onWorkspaceChange"],
|
|
2480
2409
|
"scaleMax": ["validateScaleMax"],
|
|
@@ -2488,10 +2417,10 @@ const kritzelFontCss = ":host{display:block}.font-preview{color:var(--kritzel-fo
|
|
|
2488
2417
|
const KritzelFont = class {
|
|
2489
2418
|
constructor(hostRef) {
|
|
2490
2419
|
index.registerInstance(this, hostRef);
|
|
2491
|
-
this.fontFamily = 'Arial, sans-serif';
|
|
2492
|
-
this.size = 24;
|
|
2493
|
-
this.color = '#000000';
|
|
2494
2420
|
}
|
|
2421
|
+
fontFamily = 'Arial, sans-serif';
|
|
2422
|
+
size = 24;
|
|
2423
|
+
color = '#000000';
|
|
2495
2424
|
render() {
|
|
2496
2425
|
return (index.h(index.Host, { key: 'd318355704f1bf66468dd793e5e38da827076d3b' }, index.h("div", { key: '447b4fba97f5d1900060859943438733667aed08', class: "font-preview", style: {
|
|
2497
2426
|
fontFamily: this.fontFamily,
|
|
@@ -2508,22 +2437,21 @@ const KritzelFontFamily = class {
|
|
|
2508
2437
|
constructor(hostRef) {
|
|
2509
2438
|
index.registerInstance(this, hostRef);
|
|
2510
2439
|
this.fontFamilyChange = index.createEvent(this, "fontFamilyChange");
|
|
2511
|
-
this.fontOptions = [
|
|
2512
|
-
{ value: 'arial', label: 'Arial' },
|
|
2513
|
-
{ value: 'verdana', label: 'Verdana' },
|
|
2514
|
-
{ value: 'helvetica', label: 'Helvetica' },
|
|
2515
|
-
{ value: 'tahoma', label: 'Tahoma' },
|
|
2516
|
-
{ value: 'trebuchet ms', label: 'Trebuchet MS' },
|
|
2517
|
-
{ value: 'times new roman', label: 'Times New Roman' },
|
|
2518
|
-
{ value: 'georgia', label: 'Georgia' },
|
|
2519
|
-
{ value: 'garamond', label: 'Garamond' },
|
|
2520
|
-
{ value: 'courier new', label: 'Courier New' },
|
|
2521
|
-
{ value: 'brush script mt', label: 'Brush Script MT' },
|
|
2522
|
-
];
|
|
2523
|
-
this.handleDropdownValueChange = (event) => {
|
|
2524
|
-
this.fontFamilyChange.emit(event.detail);
|
|
2525
|
-
};
|
|
2526
2440
|
}
|
|
2441
|
+
fontOptions = [
|
|
2442
|
+
{ value: 'arial', label: 'Arial' },
|
|
2443
|
+
{ value: 'verdana', label: 'Verdana' },
|
|
2444
|
+
{ value: 'helvetica', label: 'Helvetica' },
|
|
2445
|
+
{ value: 'tahoma', label: 'Tahoma' },
|
|
2446
|
+
{ value: 'trebuchet ms', label: 'Trebuchet MS' },
|
|
2447
|
+
{ value: 'times new roman', label: 'Times New Roman' },
|
|
2448
|
+
{ value: 'georgia', label: 'Georgia' },
|
|
2449
|
+
{ value: 'garamond', label: 'Garamond' },
|
|
2450
|
+
{ value: 'courier new', label: 'Courier New' },
|
|
2451
|
+
{ value: 'brush script mt', label: 'Brush Script MT' },
|
|
2452
|
+
];
|
|
2453
|
+
selectedFontFamily;
|
|
2454
|
+
fontFamilyChange;
|
|
2527
2455
|
componentWillLoad() {
|
|
2528
2456
|
if (this.fontOptions && this.fontOptions.length > 0) {
|
|
2529
2457
|
const isValidCurrentFont = this.fontOptions.some(opt => opt.value === this.selectedFontFamily);
|
|
@@ -2532,6 +2460,9 @@ const KritzelFontFamily = class {
|
|
|
2532
2460
|
}
|
|
2533
2461
|
}
|
|
2534
2462
|
}
|
|
2463
|
+
handleDropdownValueChange = (event) => {
|
|
2464
|
+
this.fontFamilyChange.emit(event.detail);
|
|
2465
|
+
};
|
|
2535
2466
|
render() {
|
|
2536
2467
|
const dropdownOptions = this.fontOptions.map(option => ({
|
|
2537
2468
|
value: option.value,
|
|
@@ -2549,10 +2480,11 @@ const KritzelFontSize = class {
|
|
|
2549
2480
|
constructor(hostRef) {
|
|
2550
2481
|
index.registerInstance(this, hostRef);
|
|
2551
2482
|
this.sizeChange = index.createEvent(this, "sizeChange");
|
|
2552
|
-
this.sizes = [8, 10, 12, 16, 20, 24];
|
|
2553
|
-
this.selectedSize = null;
|
|
2554
|
-
this.fontFamily = 'Arial';
|
|
2555
2483
|
}
|
|
2484
|
+
sizes = [8, 10, 12, 16, 20, 24];
|
|
2485
|
+
selectedSize = null;
|
|
2486
|
+
fontFamily = 'Arial';
|
|
2487
|
+
sizeChange;
|
|
2556
2488
|
handleSizeClick(size) {
|
|
2557
2489
|
this.selectedSize = size;
|
|
2558
2490
|
this.sizeChange.emit(size);
|
|
@@ -2571,8 +2503,10 @@ const kritzelIconCss = ":host{display:inline-flex;justify-content:center;align-i
|
|
|
2571
2503
|
const KritzelIcon = class {
|
|
2572
2504
|
constructor(hostRef) {
|
|
2573
2505
|
index.registerInstance(this, hostRef);
|
|
2574
|
-
this.size = 24;
|
|
2575
2506
|
}
|
|
2507
|
+
name;
|
|
2508
|
+
label;
|
|
2509
|
+
size = 24;
|
|
2576
2510
|
render() {
|
|
2577
2511
|
const svgContent = KritzelIconRegistry.get(this.name);
|
|
2578
2512
|
if (!svgContent) {
|
|
@@ -2588,226 +2522,354 @@ const KritzelIcon = class {
|
|
|
2588
2522
|
};
|
|
2589
2523
|
KritzelIcon.style = kritzelIconCss;
|
|
2590
2524
|
|
|
2591
|
-
const kritzelMenuCss = ":host{display:flex;flex-direction:column;
|
|
2525
|
+
const kritzelMenuCss = ":host{position:relative;display:flex;flex-direction:column;background-color:var(--kritzel-menu-background-color, #ffffff);width:var(--kritzel-menu-width, 180px);padding:var(--kritzel-menu-padding, 8px);border-radius:var(--kritzel-menu-border-radius, 12px);box-shadow:var(--kritzel-menu-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-menu-border, 1px solid #ebebeb);z-index:2;gap:var(--kritzel-menu-gap, 4px);overflow-y:auto;scrollbar-color:#ebebeb transparent;scrollbar-width:thin;max-height:300px}.has-open-child-overlay{position:absolute;top:0;left:0;right:0;bottom:0;z-index:3}";
|
|
2592
2526
|
|
|
2593
2527
|
const KritzelMenu = class {
|
|
2594
2528
|
constructor(hostRef) {
|
|
2595
2529
|
index.registerInstance(this, hostRef);
|
|
2530
|
+
this.itemSelect = index.createEvent(this, "itemSelect");
|
|
2531
|
+
this.itemSave = index.createEvent(this, "itemSave");
|
|
2532
|
+
this.itemCancel = index.createEvent(this, "itemCancel");
|
|
2533
|
+
this.itemToggleChildMenu = index.createEvent(this, "itemToggleChildMenu");
|
|
2534
|
+
this.itemCloseChildMenu = index.createEvent(this, "itemCloseChildMenu");
|
|
2596
2535
|
this.close = index.createEvent(this, "close");
|
|
2597
|
-
this.items = [];
|
|
2598
|
-
this.parentIndex = null;
|
|
2599
|
-
this.parent = null;
|
|
2600
|
-
this.activeItemIndex = null;
|
|
2601
|
-
this.editingIndex = null;
|
|
2602
|
-
this.openChildMenuIndex = null;
|
|
2603
|
-
this.isTouchDevice = KritzelDevicesHelper.isTouchDevice();
|
|
2604
|
-
this.childMenuAnchor = null;
|
|
2605
|
-
this.childMenu = null;
|
|
2606
|
-
this.cancelButton = null;
|
|
2607
|
-
this.saveButton = null;
|
|
2608
|
-
}
|
|
2609
|
-
onEditingIndexChange(newValue) {
|
|
2610
|
-
if (newValue === null) {
|
|
2611
|
-
this.openChildMenuIndex = null;
|
|
2612
|
-
this.editInput = undefined;
|
|
2613
|
-
return;
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
handleWindowClick(event) {
|
|
2617
|
-
requestAnimationFrame(() => {
|
|
2618
|
-
if (this.childMenu === null) {
|
|
2619
|
-
return;
|
|
2620
|
-
}
|
|
2621
|
-
const target = event.target;
|
|
2622
|
-
if (!target.contains(this.childMenu)) {
|
|
2623
|
-
this.openChildMenuIndex = null;
|
|
2624
|
-
}
|
|
2625
|
-
});
|
|
2626
2536
|
}
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
var _a;
|
|
2642
|
-
if (event.key === 'Enter') {
|
|
2643
|
-
if (this.editingIndex !== null) {
|
|
2644
|
-
(_a = this.saveButton) === null || _a === void 0 ? void 0 : _a.click();
|
|
2645
|
-
return;
|
|
2646
|
-
}
|
|
2537
|
+
get host() { return index.getElement(this); }
|
|
2538
|
+
items;
|
|
2539
|
+
parent = null;
|
|
2540
|
+
itemSelect;
|
|
2541
|
+
itemSave;
|
|
2542
|
+
itemCancel;
|
|
2543
|
+
itemToggleChildMenu;
|
|
2544
|
+
itemCloseChildMenu;
|
|
2545
|
+
close;
|
|
2546
|
+
selectedIndex = null;
|
|
2547
|
+
async setFocus() {
|
|
2548
|
+
const firstItem = this.host.querySelector('kritzel-menu-item');
|
|
2549
|
+
if (firstItem) {
|
|
2550
|
+
firstItem.focus();
|
|
2647
2551
|
}
|
|
2648
2552
|
}
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
this.host.focus();
|
|
2652
|
-
});
|
|
2653
|
-
}
|
|
2654
|
-
isViewMode(index) {
|
|
2655
|
-
return this.editingIndex !== index;
|
|
2553
|
+
get openChildMenuItem() {
|
|
2554
|
+
return this.items.find(item => item.isChildMenuOpen);
|
|
2656
2555
|
}
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
if (item.disabled || this.editingIndex !== null || this.openChildMenuIndex !== null) {
|
|
2660
|
-
return;
|
|
2661
|
-
}
|
|
2662
|
-
(_a = item.select) === null || _a === void 0 ? void 0 : _a.call(item, item);
|
|
2556
|
+
get editingMenuItem() {
|
|
2557
|
+
return this.items.find(item => item.isEditing);
|
|
2663
2558
|
}
|
|
2559
|
+
onOverlayClick = (event) => {
|
|
2560
|
+
event.stopPropagation();
|
|
2561
|
+
this.itemCloseChildMenu.emit(this.openChildMenuItem);
|
|
2562
|
+
};
|
|
2563
|
+
handleItemSelect = (event) => {
|
|
2564
|
+
event.stopPropagation();
|
|
2565
|
+
this.itemSelect.emit(event.detail);
|
|
2566
|
+
};
|
|
2567
|
+
handleSave = (event) => {
|
|
2568
|
+
event.stopPropagation();
|
|
2569
|
+
this.itemSave.emit(event.detail);
|
|
2570
|
+
};
|
|
2571
|
+
handleCancel = (event) => {
|
|
2572
|
+
event.stopPropagation();
|
|
2573
|
+
this.itemCancel.emit(event.detail);
|
|
2574
|
+
};
|
|
2575
|
+
handleToggleChildMenu = (event) => {
|
|
2576
|
+
event.stopPropagation();
|
|
2577
|
+
this.itemToggleChildMenu.emit(event.detail);
|
|
2578
|
+
};
|
|
2579
|
+
handleCloseChildMenu = (event) => {
|
|
2580
|
+
event.stopPropagation();
|
|
2581
|
+
this.itemCloseChildMenu.emit(event.detail);
|
|
2582
|
+
};
|
|
2664
2583
|
render() {
|
|
2665
|
-
return (index.h(index.Host, { key: '
|
|
2666
|
-
'menu-item': true,
|
|
2667
|
-
'disabled': item.disabled,
|
|
2668
|
-
'inactive': this.openChildMenuIndex !== null && this.openChildMenuIndex !== index$1,
|
|
2669
|
-
'child-open': this.openChildMenuIndex === index$1,
|
|
2670
|
-
'edit-mode': this.editingIndex === index$1,
|
|
2671
|
-
'active': this.activeItemIndex === index$1,
|
|
2672
|
-
}, style: {
|
|
2673
|
-
pointerEvents: (this.editingIndex !== null && this.editingIndex !== index$1) || (this.openChildMenuIndex !== null && this.openChildMenuIndex !== index$1) ? 'none' : 'auto',
|
|
2674
|
-
}, onClick: () => this.handleSelect(item) }, this.isViewMode(index$1) === true && (index.h("div", { class: "view-container" }, index.h("span", { class: "menu-item-label" }, item.label), index.h("div", null, item.children && item.children.length > 0 && (index.h("button", { class: "menu-item-button", tabIndex: 0, onClick: event => {
|
|
2675
|
-
if (this.editingIndex !== null)
|
|
2676
|
-
return;
|
|
2677
|
-
event.stopPropagation();
|
|
2678
|
-
this.childMenuAnchor = this.openChildMenuIndex === index$1 ? null : event.currentTarget;
|
|
2679
|
-
this.openChildMenuIndex = this.openChildMenuIndex === index$1 ? null : index$1;
|
|
2680
|
-
} }, index.h("kritzel-icon", { name: "ellipsis-vertical", size: 16 }))), this.openChildMenuIndex === index$1 && (index.h("kritzel-portal", { anchor: this.childMenuAnchor, offsetY: 4, onClose: () => (this.openChildMenuIndex = null) }, index.h("kritzel-menu", { ref: el => {
|
|
2681
|
-
this.childMenu = el;
|
|
2682
|
-
}, style: { minWidth: '100px' }, items: item.children, parentIndex: index$1, parent: item, onClose: () => {
|
|
2683
|
-
var _a;
|
|
2684
|
-
this.openChildMenuIndex = null;
|
|
2685
|
-
(_a = this.childMenuAnchor) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2686
|
-
} })))))), this.isViewMode(index$1) === false && (index.h("div", { class: "edit-container" }, index.h("input", { tabIndex: 0, ref: el => {
|
|
2687
|
-
this.editInput = el;
|
|
2688
|
-
requestAnimationFrame(() => {
|
|
2689
|
-
var _a, _b;
|
|
2690
|
-
(_a = this.editInput) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2691
|
-
(_b = this.editInput) === null || _b === void 0 ? void 0 : _b.select();
|
|
2692
|
-
});
|
|
2693
|
-
}, type: "text", name: 'menu-item-' + index$1, value: item.label, onInput: e => (item.label = e.target.value) }), index.h("div", { style: { display: 'flex', gap: '8px' } }, index.h("div", { class: "menu-item-button", ref: el => (this.cancelButton = el), tabIndex: 0, onClick: () => {
|
|
2694
|
-
var _a;
|
|
2695
|
-
(_a = item.cancel) === null || _a === void 0 ? void 0 : _a.call(item, item);
|
|
2696
|
-
} }, index.h("kritzel-icon", { name: "x", size: 16 })), index.h("div", { class: "menu-item-button", ref: el => (this.saveButton = el), tabIndex: 0, onClick: () => {
|
|
2697
|
-
var _a;
|
|
2698
|
-
(_a = item.save) === null || _a === void 0 ? void 0 : _a.call(item, item);
|
|
2699
|
-
} }, index.h("kritzel-icon", { name: "check", size: 16 }))))))))));
|
|
2584
|
+
return (index.h(index.Host, { key: 'c82bde4dc70fdc79df7471bb10396394f6c3870a', onClick: e => e.stopPropagation() }, this.openChildMenuItem && index.h("div", { key: '5fe0323aaa0da44abe736c6ef5e0516113c7820d', class: "has-open-child-overlay", onClick: this.onOverlayClick }), this.items.map((item) => (index.h("kritzel-menu-item", { key: item.id, item: item, parent: this.parent, style: { pointerEvents: this.editingMenuItem && !item.isEditing ? 'none' : 'auto' }, onItemSelect: this.handleItemSelect, onItemSave: this.handleSave, onItemCancel: this.handleCancel, onItemToggleChildMenu: this.handleToggleChildMenu, onItemCloseChildMenu: this.handleCloseChildMenu })))));
|
|
2700
2585
|
}
|
|
2701
|
-
get host() { return index.getElement(this); }
|
|
2702
|
-
static get watchers() { return {
|
|
2703
|
-
"editingIndex": ["onEditingIndexChange"]
|
|
2704
|
-
}; }
|
|
2705
2586
|
};
|
|
2706
2587
|
KritzelMenu.style = kritzelMenuCss;
|
|
2707
2588
|
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2589
|
+
const kritzelMenuItemCss = ":host{position:relative;display:flex;align-items:center;justify-content:space-between;width:100%;padding:var(--kritzel-menu-item-padding, 8px);box-sizing:border-box;gap:16px;height:var(--kritzel-menu-item-height, 40px);min-height:var(--kritzel-menu-item-min-height, 40px);font-family:sans-serif;font-size:var(--kritzel-menu-item-font-size, 14px);border-radius:var(--kritzel-menu-item-border-radius, 12px);outline:none;cursor:default}:host(:hover) .menu-item-overlay,:host(:focus-within) .menu-item-overlay{background-color:var(--kritzel-menu-item-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.selected){background-color:var(--kritzel-menu-item-selected-bg, #007aff);color:var(--kritzel-menu-item-selected-color, #ffffff)}:host(.selected) .action-button{color:var(--kritzel-menu-item-selected-color, #ffffff)}:host(.selected.editing){background-color:var(--kritzel-menu-item-selected-bg, #007aff)}:host(.selected) .edit-input{color:var(--kritzel-menu-item-selected-color, #ffffff)}:host(.selected) .edit-input::selection{background-color:var(--kritzel-menu-item-input-selection-color, rgba(255, 255, 255, 0.16))}:host(.editing){background-color:var(--kritzel-menu-item-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.disabled){opacity:0.5;pointer-events:none}:host(.child-open){background-color:var(--kritzel-menu-item-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}:host(.child-open.selected){background-color:var(--kritzel-menu-item-selected-bg, #007aff)}.menu-item-overlay{position:absolute;inset:0;background-color:transparent;z-index:0;pointer-events:none;border-radius:var(--kritzel-menu-item-border-radius, 12px)}.menu-item-content{display:flex;align-items:center;gap:8px;position:relative;z-index:1;height:100%}.left{justify-content:flex-start;flex:1;min-width:0}.left>div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.right{justify-content:flex-end}.edit-input{flex:1;height:var(--kritzel-menu-item-input-height, 24px);padding:0;background-color:transparent;border-radius:0;border:none;border-bottom:1px solid var(--kritzel-menu-item-input-border, #ccc);font-size:var(--kritzel-context-menu-item-font-size, 14px);width:100%;min-width:0;box-sizing:border-box;outline:none}.edit-input::selection{background-color:var(--kritzel-menu-item-input-selection-color, #007bff);color:var(--kritzel-menu-item-input-selection-text-color, #ffffff)}.action-button{padding:4px;border-radius:8px;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;background-color:transparent;background:transparent;outline:none;-webkit-tap-highlight-color:transparent}.action-button:hover,.action-button:focus{background-color:var(--kritzel-menu-item-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.action-button.disabled{pointer-events:none;opacity:0.5}";
|
|
2590
|
+
|
|
2591
|
+
const KritzelMenuItem = class {
|
|
2592
|
+
constructor(hostRef) {
|
|
2593
|
+
index.registerInstance(this, hostRef);
|
|
2594
|
+
this.itemSelect = index.createEvent(this, "itemSelect");
|
|
2595
|
+
this.itemSave = index.createEvent(this, "itemSave");
|
|
2596
|
+
this.itemCancel = index.createEvent(this, "itemCancel");
|
|
2597
|
+
this.itemToggleChildMenu = index.createEvent(this, "itemToggleChildMenu");
|
|
2598
|
+
this.itemCloseChildMenu = index.createEvent(this, "itemCloseChildMenu");
|
|
2712
2599
|
}
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2600
|
+
get host() { return index.getElement(this); }
|
|
2601
|
+
item;
|
|
2602
|
+
onItemChange(newValue, oldValue) {
|
|
2603
|
+
if (newValue !== oldValue) {
|
|
2604
|
+
this.isDirty = false;
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
parent = null;
|
|
2608
|
+
itemSelect;
|
|
2609
|
+
itemSave;
|
|
2610
|
+
itemCancel;
|
|
2611
|
+
itemToggleChildMenu;
|
|
2612
|
+
itemCloseChildMenu;
|
|
2613
|
+
isDirty = false;
|
|
2614
|
+
inputRef;
|
|
2615
|
+
componentDidLoad() {
|
|
2616
|
+
if (this.item.isEditing && this.inputRef && !this.isDirty) {
|
|
2617
|
+
this.inputRef.focus();
|
|
2618
|
+
this.inputRef.select();
|
|
2725
2619
|
}
|
|
2726
|
-
return this.getScrollableParent(parent);
|
|
2727
2620
|
}
|
|
2728
|
-
|
|
2729
|
-
if (!
|
|
2730
|
-
|
|
2621
|
+
componentDidUpdate() {
|
|
2622
|
+
if (this.item.isEditing && this.inputRef && !this.isDirty) {
|
|
2623
|
+
this.inputRef.focus();
|
|
2624
|
+
this.inputRef.select();
|
|
2731
2625
|
}
|
|
2732
|
-
const scrollableParent = this.getScrollableParent(element);
|
|
2733
|
-
const rect = element.getBoundingClientRect();
|
|
2734
|
-
if (scrollableParent === window) {
|
|
2735
|
-
const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
2736
|
-
const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
|
|
2737
|
-
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= viewportHeight && rect.right <= viewportWidth;
|
|
2738
|
-
}
|
|
2739
|
-
const parentRect = scrollableParent.getBoundingClientRect();
|
|
2740
|
-
return rect.top >= parentRect.top && rect.left >= parentRect.left && rect.bottom <= parentRect.bottom && rect.right <= parentRect.right;
|
|
2741
2626
|
}
|
|
2742
|
-
|
|
2627
|
+
handleItemSelect = (event) => {
|
|
2628
|
+
event.stopPropagation();
|
|
2629
|
+
this.itemSelect.emit({ item: this.item, parent: this.parent });
|
|
2630
|
+
};
|
|
2631
|
+
handleInputChange = (event) => {
|
|
2632
|
+
event.stopPropagation();
|
|
2633
|
+
const target = event.target;
|
|
2634
|
+
this.item.label = target.value;
|
|
2635
|
+
this.isDirty = true;
|
|
2636
|
+
};
|
|
2637
|
+
handleSave = (event) => {
|
|
2638
|
+
event.stopPropagation();
|
|
2639
|
+
this.host.focus();
|
|
2640
|
+
this.itemSave.emit(this.item);
|
|
2641
|
+
};
|
|
2642
|
+
handleCancel = (event) => {
|
|
2643
|
+
event.stopPropagation();
|
|
2644
|
+
this.host.focus();
|
|
2645
|
+
this.itemCancel.emit(this.item);
|
|
2646
|
+
};
|
|
2647
|
+
handleMenuToggle = (event) => {
|
|
2648
|
+
event.stopPropagation();
|
|
2649
|
+
this.itemToggleChildMenu.emit({ item: this.item, childMenuAnchor: event.target });
|
|
2650
|
+
};
|
|
2651
|
+
handleMenuClose = () => {
|
|
2652
|
+
this.itemCloseChildMenu.emit(this.item);
|
|
2653
|
+
};
|
|
2654
|
+
renderViewMode() {
|
|
2655
|
+
return [
|
|
2656
|
+
index.h("div", { class: "menu-item-content left" }, index.h("div", null, this.item.label)),
|
|
2657
|
+
index.h("div", { class: "menu-item-content right" }, this.item.children &&
|
|
2658
|
+
this.item.children.length > 0 && [
|
|
2659
|
+
index.h("button", { id: "child-menu-toggle", class: "action-button", onClick: this.handleMenuToggle, disabled: this.item.isDisabled }, index.h("kritzel-icon", { name: "ellipsis-vertical", size: 16 })),
|
|
2660
|
+
index.h("kritzel-portal", { anchor: this.item.childMenuAnchor, offsetY: 4, onClose: this.handleMenuClose }, index.h("kritzel-menu", { items: this.item.children, parent: this.item, onItemSelect: event => this.itemSelect.emit(event.detail), onItemSave: event => this.itemSave.emit(event.detail), onItemCancel: event => this.itemCancel.emit(event.detail), onClose: this.handleMenuClose })),
|
|
2661
|
+
]),
|
|
2662
|
+
];
|
|
2663
|
+
}
|
|
2664
|
+
renderEditMode() {
|
|
2665
|
+
return [
|
|
2666
|
+
index.h("div", { class: "menu-item-content left" }, index.h("input", { ref: el => (this.inputRef = el), type: "text", class: "edit-input", value: this.item.label, onInput: this.handleInputChange })),
|
|
2667
|
+
index.h("div", { class: "menu-item-content right" }, index.h("div", { tabIndex: !this.isDirty && !this.item.isNewItem ? -1 : 0, class: { 'action-button': true, 'disabled': !this.isDirty && !this.item.isNewItem }, onClick: this.handleSave }, index.h("kritzel-icon", { name: "check", size: 16 })), index.h("div", { tabIndex: 0, class: "action-button", onClick: this.handleCancel }, index.h("kritzel-icon", { name: "x", size: 16 }))),
|
|
2668
|
+
];
|
|
2669
|
+
}
|
|
2670
|
+
render() {
|
|
2671
|
+
return (index.h(index.Host, { key: '5440ed43726d00ab65e7f423f065c1a3fa74e39e', tabIndex: 0, class: {
|
|
2672
|
+
'selected': this.item.isSelected,
|
|
2673
|
+
'editing': this.item.isEditing,
|
|
2674
|
+
'disabled': this.item.isDisabled,
|
|
2675
|
+
'child-open': this.item.isChildMenuOpen,
|
|
2676
|
+
}, onClick: this.handleItemSelect }, index.h("div", { key: '69542710179216a1df47bde5d474a72e4a07aa5b', class: "menu-item-overlay" }), this.item.isEditing ? this.renderEditMode() : this.renderViewMode()));
|
|
2677
|
+
}
|
|
2678
|
+
static get watchers() { return {
|
|
2679
|
+
"item": ["onItemChange"]
|
|
2680
|
+
}; }
|
|
2681
|
+
};
|
|
2682
|
+
KritzelMenuItem.style = kritzelMenuItemCss;
|
|
2743
2683
|
|
|
2744
|
-
const DEFAULT_OFFSET = 0;
|
|
2745
|
-
const MIN_LEFT_POSITION = 0;
|
|
2746
|
-
const Z_INDEX = '9005';
|
|
2747
|
-
const ID_PORTAL = 'portal';
|
|
2748
2684
|
const KritzelPortal = class {
|
|
2749
2685
|
constructor(hostRef) {
|
|
2750
2686
|
index.registerInstance(this, hostRef);
|
|
2751
2687
|
this.close = index.createEvent(this, "close");
|
|
2752
|
-
this.autoFocus = true;
|
|
2753
|
-
this.moved = false;
|
|
2754
|
-
this.handleScroll = () => {
|
|
2755
|
-
const isAnchorInViewport = KritzelHTMLHelper.isElementInViewport(this.anchor);
|
|
2756
|
-
if (!isAnchorInViewport) {
|
|
2757
|
-
this.close.emit();
|
|
2758
|
-
return;
|
|
2759
|
-
}
|
|
2760
|
-
this.calculatePosition();
|
|
2761
|
-
};
|
|
2762
2688
|
}
|
|
2689
|
+
get host() { return index.getElement(this); }
|
|
2690
|
+
anchor;
|
|
2763
2691
|
anchorChanged(newValue) {
|
|
2764
2692
|
if (newValue) {
|
|
2693
|
+
this.openPortal();
|
|
2765
2694
|
this.calculatePosition();
|
|
2695
|
+
if (this.autoFocus) {
|
|
2696
|
+
this.focusFirstElement();
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
else {
|
|
2700
|
+
this.closePortal();
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
offsetX;
|
|
2704
|
+
offsetY;
|
|
2705
|
+
autoFocus = true;
|
|
2706
|
+
close;
|
|
2707
|
+
handleOutsideClick(event) {
|
|
2708
|
+
event.stopPropagation();
|
|
2709
|
+
const isLastPortal = this.lastAddedPortal === this.portal;
|
|
2710
|
+
if (!isLastPortal)
|
|
2711
|
+
return;
|
|
2712
|
+
const target = event.target;
|
|
2713
|
+
if (!this.host.contains(target)) {
|
|
2714
|
+
this.close.emit();
|
|
2715
|
+
this.closePortal();
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
handleKeyDown(event) {
|
|
2719
|
+
event.stopPropagation();
|
|
2720
|
+
const isLastPortal = this.lastAddedPortal === this.portal;
|
|
2721
|
+
if (!isLastPortal)
|
|
2722
|
+
return;
|
|
2723
|
+
if (event.key === 'Escape') {
|
|
2724
|
+
this.anchor.focus();
|
|
2725
|
+
this.close.emit();
|
|
2726
|
+
this.closePortal();
|
|
2727
|
+
}
|
|
2728
|
+
if (event.key === 'Tab') {
|
|
2729
|
+
this.trapFocus(event);
|
|
2730
|
+
}
|
|
2731
|
+
if (event.key === 'Enter') {
|
|
2732
|
+
const activeElement = this.getDeepActiveElement();
|
|
2733
|
+
if (activeElement?.click) {
|
|
2734
|
+
event.preventDefault();
|
|
2735
|
+
activeElement.click();
|
|
2736
|
+
}
|
|
2766
2737
|
}
|
|
2767
2738
|
}
|
|
2768
2739
|
handleResize() {
|
|
2769
2740
|
this.calculatePosition();
|
|
2770
2741
|
}
|
|
2742
|
+
portal;
|
|
2743
|
+
id = `portal-${index$1.ObjectHelper.generateUUID()}`;
|
|
2744
|
+
defaultOffset = 0;
|
|
2745
|
+
minLeft = 0;
|
|
2746
|
+
focusFirstElement() {
|
|
2747
|
+
requestAnimationFrame(() => {
|
|
2748
|
+
this.firstFocusableElement?.focus?.();
|
|
2749
|
+
});
|
|
2750
|
+
}
|
|
2751
|
+
getDeepActiveElement() {
|
|
2752
|
+
let activeEl = document.activeElement;
|
|
2753
|
+
while (activeEl?.shadowRoot?.activeElement) {
|
|
2754
|
+
activeEl = activeEl.shadowRoot.activeElement;
|
|
2755
|
+
}
|
|
2756
|
+
return activeEl;
|
|
2757
|
+
}
|
|
2758
|
+
trapFocus(event) {
|
|
2759
|
+
const focusableElements = this.getFocusableElements(this.host);
|
|
2760
|
+
if (focusableElements.length === 0)
|
|
2761
|
+
return;
|
|
2762
|
+
const firstFocusable = focusableElements[0];
|
|
2763
|
+
const lastFocusable = focusableElements[focusableElements.length - 1];
|
|
2764
|
+
const activeElement = this.getDeepActiveElement();
|
|
2765
|
+
if (event.shiftKey) {
|
|
2766
|
+
/* shift + tab */
|
|
2767
|
+
if (activeElement === firstFocusable) {
|
|
2768
|
+
lastFocusable.focus();
|
|
2769
|
+
event.preventDefault();
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
else {
|
|
2773
|
+
/* tab */
|
|
2774
|
+
if (activeElement === lastFocusable) {
|
|
2775
|
+
firstFocusable.focus();
|
|
2776
|
+
event.preventDefault();
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
getFocusableElements(root) {
|
|
2781
|
+
if (!root)
|
|
2782
|
+
return [];
|
|
2783
|
+
const focusableElements = [];
|
|
2784
|
+
const focusableSelector = 'a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details, [tabindex]:not([tabindex="-1"])';
|
|
2785
|
+
const isVisible = (el) => {
|
|
2786
|
+
return el.offsetParent !== null;
|
|
2787
|
+
};
|
|
2788
|
+
// Check if the root element itself is focusable
|
|
2789
|
+
if (root.matches(focusableSelector) && !root.hasAttribute('disabled') && isVisible(root)) {
|
|
2790
|
+
focusableElements.push(root);
|
|
2791
|
+
}
|
|
2792
|
+
// Function to recursively find focusable elements
|
|
2793
|
+
const findFocusable = (element) => {
|
|
2794
|
+
// Search in shadow root
|
|
2795
|
+
if (element.shadowRoot) {
|
|
2796
|
+
Array.from(element.shadowRoot.querySelectorAll(focusableSelector)).forEach(el => {
|
|
2797
|
+
if (isVisible(el)) {
|
|
2798
|
+
focusableElements.push(el);
|
|
2799
|
+
}
|
|
2800
|
+
});
|
|
2801
|
+
Array.from(element.shadowRoot.children).forEach(findFocusable);
|
|
2802
|
+
}
|
|
2803
|
+
// Search in light DOM
|
|
2804
|
+
Array.from(element.querySelectorAll(focusableSelector)).forEach(el => {
|
|
2805
|
+
if (!focusableElements.includes(el) && isVisible(el)) {
|
|
2806
|
+
focusableElements.push(el);
|
|
2807
|
+
}
|
|
2808
|
+
});
|
|
2809
|
+
// Handle slotted content
|
|
2810
|
+
if (element.tagName === 'SLOT') {
|
|
2811
|
+
element.assignedElements({ flatten: true }).forEach(el => findFocusable(el));
|
|
2812
|
+
}
|
|
2813
|
+
Array.from(element.children).forEach(findFocusable);
|
|
2814
|
+
};
|
|
2815
|
+
findFocusable(root);
|
|
2816
|
+
// Return unique elements in document order
|
|
2817
|
+
return [...new Set(focusableElements)];
|
|
2818
|
+
}
|
|
2819
|
+
get firstFocusableElement() {
|
|
2820
|
+
const slotEl = this.host.shadowRoot?.querySelector('slot');
|
|
2821
|
+
const firstAssigned = slotEl?.assignedElements({ flatten: true })[0];
|
|
2822
|
+
if (!firstAssigned)
|
|
2823
|
+
return null;
|
|
2824
|
+
const focusable = this.getFocusableElements(firstAssigned);
|
|
2825
|
+
return focusable[0] ?? firstAssigned;
|
|
2826
|
+
}
|
|
2827
|
+
get lastAddedPortal() {
|
|
2828
|
+
const portals = Array.from(document.querySelectorAll('[id^="portal-"]'));
|
|
2829
|
+
return portals.length ? portals[portals.length - 1] : null;
|
|
2830
|
+
}
|
|
2771
2831
|
calculateLeft() {
|
|
2772
|
-
var _a;
|
|
2773
2832
|
if (!this.anchor || !this.portal)
|
|
2774
2833
|
return 0;
|
|
2775
2834
|
const refRect = this.anchor.getBoundingClientRect();
|
|
2776
2835
|
const portalRect = this.portal.getBoundingClientRect();
|
|
2777
|
-
const offset =
|
|
2836
|
+
const offset = this.offsetX ?? this.defaultOffset;
|
|
2778
2837
|
let left = refRect.left + offset;
|
|
2779
|
-
const maxLeft = window.innerWidth - portalRect.width -
|
|
2780
|
-
if (left <
|
|
2781
|
-
left =
|
|
2838
|
+
const maxLeft = window.innerWidth - portalRect.width - this.minLeft;
|
|
2839
|
+
if (left < this.minLeft)
|
|
2840
|
+
left = this.minLeft;
|
|
2782
2841
|
if (left > maxLeft)
|
|
2783
2842
|
left = maxLeft;
|
|
2784
2843
|
return Math.round(left + window.scrollX);
|
|
2785
2844
|
}
|
|
2786
2845
|
calculateTop() {
|
|
2787
|
-
var _a;
|
|
2788
2846
|
if (!this.anchor || !this.portal)
|
|
2789
2847
|
return 0;
|
|
2790
2848
|
const refRect = this.anchor.getBoundingClientRect();
|
|
2791
2849
|
const portalRect = this.portal.getBoundingClientRect();
|
|
2792
|
-
const offset =
|
|
2850
|
+
const offset = this.offsetY ?? this.defaultOffset;
|
|
2793
2851
|
let top = refRect.bottom + offset;
|
|
2794
2852
|
if (top + portalRect.height > window.innerHeight) {
|
|
2795
2853
|
top = refRect.top - portalRect.height - offset;
|
|
2796
2854
|
}
|
|
2797
2855
|
return Math.round(top + window.scrollY);
|
|
2798
2856
|
}
|
|
2799
|
-
|
|
2857
|
+
openPortal() {
|
|
2800
2858
|
this.portal = document.createElement('div');
|
|
2801
|
-
this.portal.setAttribute('id',
|
|
2802
|
-
this.portal.style.zIndex =
|
|
2859
|
+
this.portal.setAttribute('id', this.id);
|
|
2860
|
+
this.portal.style.zIndex = '1';
|
|
2803
2861
|
this.portal.style.position = 'absolute';
|
|
2804
2862
|
this.portal.style.top = '0px';
|
|
2805
2863
|
this.portal.style.left = '0px';
|
|
2864
|
+
this.portal.appendChild(this.host);
|
|
2806
2865
|
document.body.append(this.portal);
|
|
2807
2866
|
}
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2867
|
+
closePortal() {
|
|
2868
|
+
const portal = document.getElementById(this.id);
|
|
2869
|
+
if (!portal)
|
|
2870
|
+
return;
|
|
2871
|
+
document.body.removeChild(portal);
|
|
2872
|
+
this.host.remove();
|
|
2811
2873
|
}
|
|
2812
2874
|
calculatePosition() {
|
|
2813
2875
|
if (!this.anchor || !this.portal)
|
|
@@ -2817,89 +2879,91 @@ const KritzelPortal = class {
|
|
|
2817
2879
|
this.portal.style.top = `${top}px`;
|
|
2818
2880
|
this.portal.style.left = `${left}px`;
|
|
2819
2881
|
}
|
|
2820
|
-
componentWillLoad() {
|
|
2821
|
-
this.createPortal();
|
|
2822
|
-
}
|
|
2823
|
-
componentDidLoad() {
|
|
2824
|
-
var _a;
|
|
2825
|
-
this.moveElementToPortal();
|
|
2826
|
-
if (this.anchor) {
|
|
2827
|
-
this.calculatePosition();
|
|
2828
|
-
this.scrollableParent = KritzelHTMLHelper.getScrollableParent(this.anchor);
|
|
2829
|
-
(_a = this.scrollableParent) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', this.handleScroll);
|
|
2830
|
-
}
|
|
2831
|
-
}
|
|
2832
|
-
disconnectedCallback() {
|
|
2833
|
-
var _a;
|
|
2834
|
-
this.moved ? this.portal.remove() : (this.moved = true);
|
|
2835
|
-
(_a = this.scrollableParent) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', this.handleScroll);
|
|
2836
|
-
}
|
|
2837
2882
|
render() {
|
|
2838
|
-
return (index.h(index.Host, { key: '
|
|
2883
|
+
return (index.h(index.Host, { key: '968f0360b9396da16f5b970293ba20f8a1dcc09a', style: { display: this.anchor ? 'block' : 'none' } }, index.h("slot", { key: '0fe1569bde60a834e9226d7c838d113a64151164' })));
|
|
2839
2884
|
}
|
|
2840
2885
|
static get watchers() { return {
|
|
2841
2886
|
"anchor": ["anchorChanged"]
|
|
2842
2887
|
}; }
|
|
2843
2888
|
};
|
|
2844
2889
|
|
|
2845
|
-
const kritzelSplitButtonCss = ":host{position:relative;display:flex;align-items:center;font-family:sans-serif;z-index:1;padding:var(--kritzel-
|
|
2890
|
+
const kritzelSplitButtonCss = ":host{position:relative;display:flex;align-items:center;font-family:sans-serif;z-index:1;padding:var(--kritzel-split-button-padding, 4px);background-color:var(--kritzel-split-button-background-color, #ffffff);border-radius:var(--kritzel-split-button-border-radius, 12px);box-shadow:var(--kritzel-split-button-box-shadow, 0 0 3px rgba(0, 0, 0, 0.08));border:var(--kritzel-split-button-border, 1px solid #ebebeb);gap:var(--kritzel-split-button-gap, 4px)}:host(:focus){outline:none}:host(.mobile){--kritzel-split-button-hover-background-color:transparent}button{border:none;background-color:transparent;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;text-align:center;display:flex;align-items:center;justify-content:center;pointer-events:all;-webkit-tap-highlight-color:transparent}.split-main-button,.split-menu-button{height:auto;display:flex;align-items:center;padding:var(--kritzel-split-button-padding, 8px);background-color:var(--kritzel-split-button-background-color, #ffffff);border-radius:var(--kritzel-split-button-border-radius, 12px);font-size:var(--kritzel-split-button-font-size, 14px)}.split-main-button:hover,.split-menu-button:hover{background-color:var(--kritzel-split-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.split-main-button:focus,.split-menu-button:focus{outline:none;background-color:var(--kritzel-split-button-hover-background-color, hsl(0, 0%, 0%, 4.3%))}.split-main-button{gap:var(--kritzel-split-button-gap, 4px)}.split-menu-button{border-left:none;justify-content:center}.split-divider{width:var(--kritzel-split-button-divider-width, 1px);height:24px;background-color:var(--kritzel-split-button-divider-background-color, hsl(0, 0%, 0%, 4.3%))}:disabled{pointer-events:none;opacity:0.5}";
|
|
2846
2891
|
|
|
2847
2892
|
const KritzelSplitButton = class {
|
|
2848
2893
|
constructor(hostRef) {
|
|
2849
2894
|
index.registerInstance(this, hostRef);
|
|
2850
2895
|
this.buttonClick = index.createEvent(this, "buttonClick");
|
|
2851
|
-
this.
|
|
2852
|
-
this.
|
|
2853
|
-
this.
|
|
2854
|
-
this.
|
|
2855
|
-
this.
|
|
2856
|
-
this.
|
|
2857
|
-
this.activeItemIndex = null;
|
|
2858
|
-
this.editingIndex = null;
|
|
2859
|
-
this.isMenuOpen = false;
|
|
2860
|
-
this.isTouchDevice = KritzelDevicesHelper.isTouchDevice();
|
|
2861
|
-
this.handleDocumentClick = (event) => {
|
|
2862
|
-
const path = (event.composedPath && event.composedPath()) || [];
|
|
2863
|
-
const clickedInside = path.some(node => (node === null || node === void 0 ? void 0 : node.tagName) === 'KRITZEL-SPLIT-BUTTON' || (node === null || node === void 0 ? void 0 : node.tagName) === 'KRITZEL-MENU');
|
|
2864
|
-
if (!clickedInside) {
|
|
2865
|
-
this.closeMenu();
|
|
2866
|
-
}
|
|
2867
|
-
else if (this.isMenuOpen) {
|
|
2868
|
-
document.addEventListener('click', this.handleDocumentClick, { once: true });
|
|
2869
|
-
}
|
|
2870
|
-
};
|
|
2871
|
-
this.toggleMenu = () => {
|
|
2872
|
-
if (this.isMenuOpen) {
|
|
2873
|
-
this.closeMenu();
|
|
2874
|
-
}
|
|
2875
|
-
else {
|
|
2876
|
-
this.openMenu();
|
|
2877
|
-
}
|
|
2878
|
-
};
|
|
2879
|
-
this.handleButtonClick = () => {
|
|
2880
|
-
if (!this.disabled) {
|
|
2881
|
-
this.buttonClick.emit();
|
|
2882
|
-
}
|
|
2883
|
-
};
|
|
2896
|
+
this.itemSelect = index.createEvent(this, "itemSelect");
|
|
2897
|
+
this.itemSave = index.createEvent(this, "itemSave");
|
|
2898
|
+
this.itemCancel = index.createEvent(this, "itemCancel");
|
|
2899
|
+
this.itemToggleChildMenu = index.createEvent(this, "itemToggleChildMenu");
|
|
2900
|
+
this.itemCloseChildMenu = index.createEvent(this, "itemCloseChildMenu");
|
|
2901
|
+
this.close = index.createEvent(this, "close");
|
|
2884
2902
|
}
|
|
2885
|
-
|
|
2886
|
-
|
|
2903
|
+
get host() { return index.getElement(this); }
|
|
2904
|
+
buttonIcon = 'plus';
|
|
2905
|
+
dropdownIcon = 'chevron-down';
|
|
2906
|
+
items = [];
|
|
2907
|
+
mainButtonDisabled = false;
|
|
2908
|
+
menuButtonDisabled = false;
|
|
2909
|
+
buttonClick;
|
|
2910
|
+
itemSelect;
|
|
2911
|
+
itemSave;
|
|
2912
|
+
itemCancel;
|
|
2913
|
+
itemToggleChildMenu;
|
|
2914
|
+
itemCloseChildMenu;
|
|
2915
|
+
close;
|
|
2916
|
+
isMenuOpen = false;
|
|
2917
|
+
isTouchDevice = KritzelDevicesHelper.isTouchDevice();
|
|
2918
|
+
anchorElement;
|
|
2919
|
+
splitMenuButtonRef;
|
|
2920
|
+
menuRef;
|
|
2921
|
+
async open() {
|
|
2922
|
+
if (this.isMenuOpen)
|
|
2887
2923
|
return;
|
|
2888
|
-
this.
|
|
2889
|
-
this.menuOpened.emit();
|
|
2890
|
-
document.addEventListener('click', this.handleDocumentClick, { once: true });
|
|
2924
|
+
this.openMenu(new MouseEvent('click'));
|
|
2891
2925
|
}
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2926
|
+
handleButtonClick = (event) => {
|
|
2927
|
+
event.stopPropagation();
|
|
2928
|
+
this.buttonClick.emit();
|
|
2929
|
+
};
|
|
2930
|
+
toggleMenu = (event) => {
|
|
2931
|
+
event.stopPropagation();
|
|
2932
|
+
if (this.isMenuOpen) {
|
|
2933
|
+
this.closeMenu();
|
|
2934
|
+
}
|
|
2935
|
+
else {
|
|
2936
|
+
this.openMenu(event);
|
|
2937
|
+
}
|
|
2938
|
+
};
|
|
2939
|
+
openMenu = (event) => {
|
|
2940
|
+
event.stopPropagation();
|
|
2941
|
+
this.isMenuOpen = true;
|
|
2942
|
+
this.anchorElement = this.host;
|
|
2943
|
+
};
|
|
2944
|
+
closeMenu = () => {
|
|
2895
2945
|
this.isMenuOpen = false;
|
|
2896
|
-
this.
|
|
2897
|
-
this.
|
|
2898
|
-
}
|
|
2946
|
+
this.anchorElement = null;
|
|
2947
|
+
this.close.emit();
|
|
2948
|
+
};
|
|
2949
|
+
handleItemSelect = event => {
|
|
2950
|
+
this.itemSelect.emit(event.detail);
|
|
2951
|
+
};
|
|
2952
|
+
handleItemSave = event => {
|
|
2953
|
+
this.itemSave.emit(event.detail);
|
|
2954
|
+
};
|
|
2955
|
+
handleItemCancel = event => {
|
|
2956
|
+
this.itemCancel.emit(event.detail);
|
|
2957
|
+
};
|
|
2958
|
+
handleItemToggleChildMenu = event => {
|
|
2959
|
+
this.itemToggleChildMenu.emit(event.detail);
|
|
2960
|
+
};
|
|
2961
|
+
handleItemCloseChildMenu = event => {
|
|
2962
|
+
this.itemCloseChildMenu.emit(event.detail);
|
|
2963
|
+
};
|
|
2899
2964
|
render() {
|
|
2900
|
-
return (index.h(index.Host, { key: '
|
|
2965
|
+
return (index.h(index.Host, { key: 'be79d702d2c400d1feedeb89eca6fc78559f30f3', class: { mobile: this.isTouchDevice } }, index.h("button", { key: 'e4a74c56c122ea617f44f1d7e31672d1f913de46', class: "split-main-button", tabIndex: 0, onClick: this.handleButtonClick, disabled: this.mainButtonDisabled }, this.buttonIcon && index.h("kritzel-icon", { key: '44bd79270e7cc4a17b45133b5c513642013e5a66', name: this.buttonIcon })), index.h("div", { key: '2392e8c6f75510c529585a69c861b2fcafdef5ce', class: "split-divider" }), index.h("button", { key: 'bcdf61c2a195271771479de385db3b4982f6cad2', ref: el => (this.splitMenuButtonRef = el), class: "split-menu-button", tabIndex: 0, onClick: this.toggleMenu, disabled: this.menuButtonDisabled }, index.h("kritzel-icon", { key: '90383a8690111c97054fb8ac93b91cb6644de137', name: this.dropdownIcon })), index.h("kritzel-portal", { key: 'c6a4c32ab731fede13e1382bff9dbd68794b1103', anchor: this.anchorElement, offsetY: 4, onClose: this.closeMenu }, index.h("kritzel-menu", { key: '8b792c9a2d4af60ba464bb80551c5358e21bfa96', ref: el => (this.menuRef = el), items: this.items, onItemSelect: this.handleItemSelect, onItemSave: this.handleItemSave, onItemCancel: this.handleItemCancel, onItemToggleChildMenu: this.handleItemToggleChildMenu, onItemCloseChildMenu: this.handleItemCloseChildMenu, onClose: this.closeMenu }))));
|
|
2901
2966
|
}
|
|
2902
|
-
get host() { return index.getElement(this); }
|
|
2903
2967
|
};
|
|
2904
2968
|
KritzelSplitButton.style = kritzelSplitButtonCss;
|
|
2905
2969
|
|
|
@@ -2909,15 +2973,16 @@ const KritzelStrokeSize = class {
|
|
|
2909
2973
|
constructor(hostRef) {
|
|
2910
2974
|
index.registerInstance(this, hostRef);
|
|
2911
2975
|
this.sizeChange = index.createEvent(this, "sizeChange");
|
|
2912
|
-
this.sizes = [4, 6, 8, 12, 16, 24];
|
|
2913
|
-
this.selectedSize = null;
|
|
2914
2976
|
}
|
|
2977
|
+
sizes = [4, 6, 8, 12, 16, 24];
|
|
2978
|
+
selectedSize = null;
|
|
2979
|
+
sizeChange;
|
|
2915
2980
|
handleSizeClick(size) {
|
|
2916
2981
|
this.selectedSize = size;
|
|
2917
2982
|
this.sizeChange.emit(size);
|
|
2918
2983
|
}
|
|
2919
2984
|
render() {
|
|
2920
|
-
return (index.h(index.Host, { key: '
|
|
2985
|
+
return (index.h(index.Host, { key: 'f9f0fe49963655a2beeffe5c369ccbe018c8aa5e' }, this.sizes.map(size => (index.h("div", { class: {
|
|
2921
2986
|
'size-container': true,
|
|
2922
2987
|
'selected': this.selectedSize === size,
|
|
2923
2988
|
}, onClick: () => this.handleSizeClick(size) }, index.h("kritzel-color", { value: '#000000', size: size }))))));
|
|
@@ -2931,13 +2996,15 @@ const MOBILE_BREAKPOINT = 768;
|
|
|
2931
2996
|
const KritzelTooltip = class {
|
|
2932
2997
|
constructor(hostRef) {
|
|
2933
2998
|
index.registerInstance(this, hostRef);
|
|
2934
|
-
this.isVisible = false;
|
|
2935
|
-
this.arrowSize = 8;
|
|
2936
|
-
this.offsetY = 24;
|
|
2937
|
-
this.positionX = 0;
|
|
2938
|
-
this.arrowOffset = '0px';
|
|
2939
|
-
this.isMobileView = window.innerWidth < MOBILE_BREAKPOINT;
|
|
2940
2999
|
}
|
|
3000
|
+
isVisible = false;
|
|
3001
|
+
anchorElement;
|
|
3002
|
+
arrowSize = 8;
|
|
3003
|
+
offsetY = 24;
|
|
3004
|
+
get el() { return index.getElement(this); }
|
|
3005
|
+
positionX = 0;
|
|
3006
|
+
arrowOffset = '0px';
|
|
3007
|
+
isMobileView = window.innerWidth < MOBILE_BREAKPOINT;
|
|
2941
3008
|
handleWindowResize() {
|
|
2942
3009
|
this.isMobileView = window.innerWidth < MOBILE_BREAKPOINT;
|
|
2943
3010
|
this.calculateAdjustedPosition();
|
|
@@ -2950,10 +3017,9 @@ const KritzelTooltip = class {
|
|
|
2950
3017
|
this.calculateAdjustedPosition();
|
|
2951
3018
|
}
|
|
2952
3019
|
calculateAdjustedPosition() {
|
|
2953
|
-
var _a;
|
|
2954
3020
|
if (this.isVisible && this.anchorElement) {
|
|
2955
3021
|
const anchorRect = this.anchorElement.getBoundingClientRect();
|
|
2956
|
-
const tooltipContent =
|
|
3022
|
+
const tooltipContent = this.el.shadowRoot?.querySelector('.tooltip-content');
|
|
2957
3023
|
if (!this.isMobileView) {
|
|
2958
3024
|
this.positionX = anchorRect.left + anchorRect.width / 2;
|
|
2959
3025
|
this.arrowOffset = `calc(${50}% - ${this.arrowSize}px)`;
|
|
@@ -2966,23 +3032,23 @@ const KritzelTooltip = class {
|
|
|
2966
3032
|
}
|
|
2967
3033
|
}
|
|
2968
3034
|
render() {
|
|
2969
|
-
return (index.h(index.Host, { key: '
|
|
3035
|
+
return (index.h(index.Host, { key: '6eb67bcfd08234affe3724dff4d94ddf7907a1a7', style: {
|
|
2970
3036
|
position: 'fixed',
|
|
2971
3037
|
zIndex: '9999',
|
|
2972
3038
|
transition: 'opacity 0.3s ease-in-out, transform 0.3s ease-in-out',
|
|
2973
3039
|
visibility: this.isVisible ? 'visible' : 'hidden',
|
|
2974
3040
|
left: !this.isMobileView ? `${this.positionX}px` : '50%',
|
|
2975
3041
|
marginBottom: `${this.offsetY + this.arrowSize}px`,
|
|
2976
|
-
} }, index.h("div", { key: '
|
|
3042
|
+
} }, index.h("div", { key: '9314b30b71200776e3728027b2ac7332cf4ab669', class: "tooltip-content", onClick: event => event.stopPropagation() }, index.h("slot", { key: '80cb8d0a8a91d9c816580cedc02fc9382fb07f8c' }), index.h("div", { key: '87fb2399463a0eb7beb1ca0f2c2867d8ff033f3a', class: "tooltip-arrow-wrapper", style: {
|
|
2977
3043
|
position: 'fixed',
|
|
2978
3044
|
left: this.arrowOffset,
|
|
2979
3045
|
bottom: `-${this.arrowSize * 2}px`,
|
|
2980
|
-
} }, index.h("div", { key: '
|
|
3046
|
+
} }, index.h("div", { key: 'fc3953ad9b6aa5a4b2228653573fc3a7e37c0487', class: "tooltip-arrow", style: {
|
|
2981
3047
|
borderLeft: `${this.arrowSize}px solid transparent`,
|
|
2982
3048
|
borderRight: `${this.arrowSize}px solid transparent`,
|
|
2983
3049
|
borderTop: `${this.arrowSize}px solid var(--kritzel-controls-tooltip-background-color, #ffffff)`,
|
|
2984
3050
|
filter: 'drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2))',
|
|
2985
|
-
} }), index.h("div", { key: '
|
|
3051
|
+
} }), index.h("div", { key: '5b8e4e3eb90c4c47c47fa47dc96e4149794e1732', class: "tooltip-arrow-rect", style: {
|
|
2986
3052
|
position: 'relative',
|
|
2987
3053
|
width: `${this.arrowSize * 2}px`,
|
|
2988
3054
|
height: `${this.arrowSize}px`,
|
|
@@ -2990,7 +3056,6 @@ const KritzelTooltip = class {
|
|
|
2990
3056
|
bottom: `${this.arrowSize * 2}px`,
|
|
2991
3057
|
} })))));
|
|
2992
3058
|
}
|
|
2993
|
-
get el() { return index.getElement(this); }
|
|
2994
3059
|
};
|
|
2995
3060
|
KritzelTooltip.style = kritzelTooltipCss;
|
|
2996
3061
|
|
|
@@ -3003,6 +3068,9 @@ const KritzelUtilityPanel = class {
|
|
|
3003
3068
|
this.redo = index.createEvent(this, "redo");
|
|
3004
3069
|
this.delete = index.createEvent(this, "delete");
|
|
3005
3070
|
}
|
|
3071
|
+
undo;
|
|
3072
|
+
redo;
|
|
3073
|
+
delete;
|
|
3006
3074
|
handleUndo(event) {
|
|
3007
3075
|
if (event.cancelable) {
|
|
3008
3076
|
event.preventDefault();
|
|
@@ -3016,7 +3084,7 @@ const KritzelUtilityPanel = class {
|
|
|
3016
3084
|
this.redo.emit();
|
|
3017
3085
|
}
|
|
3018
3086
|
render() {
|
|
3019
|
-
return (index.h(index.Host, { key: '
|
|
3087
|
+
return (index.h(index.Host, { key: '134058928a840d11fdc39849b35f08b21840fc0c' }, index.h("button", { key: '8d80cb496983b0709c06bacb12ca6819789aa47d', class: "utility-button", onClick: event => this.handleUndo(event) }, index.h("kritzel-icon", { key: 'c6733ef61ab6a272f80a580243fdd15063b8bf0c', name: "undo" })), index.h("button", { key: 'dc6147152bccd43ea54b9af20d019d305e550987', class: "utility-button", onClick: event => this.handleRedo(event) }, index.h("kritzel-icon", { key: '3ab8bced0f398a8d5f053cb0f388199fd2148bfc', name: "redo" })), index.h("div", { key: 'ebbfd25fb69faf2b669de20dc74a3dcabc01f489', class: "utility-separator" }), index.h("button", { key: 'd86caf8a7f2c2bc899b09871f555973137693eb9', class: "utility-button" }, index.h("kritzel-icon", { key: 'e1b4e9eef3d3ab2a2ddd1688818d4bcd2d7226c1', name: "delete", onClick: () => this.delete.emit() }))));
|
|
3020
3088
|
}
|
|
3021
3089
|
};
|
|
3022
3090
|
KritzelUtilityPanel.style = kritzelUtilityPanelCss;
|
|
@@ -3028,55 +3096,20 @@ const KritzelWorkspaceManager = class {
|
|
|
3028
3096
|
index.registerInstance(this, hostRef);
|
|
3029
3097
|
this.isWorkspaceManagerReady = index.createEvent(this, "isWorkspaceManagerReady");
|
|
3030
3098
|
this.workspaceChange = index.createEvent(this, "workspaceChange");
|
|
3031
|
-
this.workspaces = [];
|
|
3032
|
-
this.editingIndex = null;
|
|
3033
|
-
this.newWorkspace = null;
|
|
3034
|
-
this.kritzelEngine = null;
|
|
3035
|
-
this.handleNewWorkspace = async () => {
|
|
3036
|
-
var _a;
|
|
3037
|
-
await ((_a = this.splitButtonRef) === null || _a === void 0 ? void 0 : _a.openMenu());
|
|
3038
|
-
requestAnimationFrame(() => {
|
|
3039
|
-
this.newWorkspace = new KritzelWorkspace(index$1.ObjectHelper.generateUUID(), 'New Workspace');
|
|
3040
|
-
this.editingIndex = 0;
|
|
3041
|
-
});
|
|
3042
|
-
};
|
|
3043
|
-
this.handleMenuClosed = () => {
|
|
3044
|
-
this.editingIndex = null;
|
|
3045
|
-
this.newWorkspace = null;
|
|
3046
|
-
};
|
|
3047
|
-
this.handleSave = async (item) => {
|
|
3048
|
-
const workspace = item.value;
|
|
3049
|
-
const updatedWorkspace = Object.assign(Object.assign({}, workspace), { name: item.label });
|
|
3050
|
-
if (this.newWorkspace) {
|
|
3051
|
-
await this.kritzelEngine.createWorkspace(updatedWorkspace);
|
|
3052
|
-
this.editingIndex = null;
|
|
3053
|
-
this.newWorkspace = null;
|
|
3054
|
-
this.selectWorkspace(updatedWorkspace);
|
|
3055
|
-
}
|
|
3056
|
-
else {
|
|
3057
|
-
await this.kritzelEngine.updateWorkspace(updatedWorkspace);
|
|
3058
|
-
this.editingIndex = null;
|
|
3059
|
-
this.newWorkspace = null;
|
|
3060
|
-
}
|
|
3061
|
-
};
|
|
3062
|
-
this.handleRename = (index) => {
|
|
3063
|
-
this.editingIndex = index;
|
|
3064
|
-
};
|
|
3065
|
-
this.handleDelete = async (workspaceToDelete) => {
|
|
3066
|
-
var _a;
|
|
3067
|
-
await this.kritzelEngine.deleteWorkspace(workspaceToDelete);
|
|
3068
|
-
if (((_a = this.activeWorkspace) === null || _a === void 0 ? void 0 : _a.id) === workspaceToDelete.id) {
|
|
3069
|
-
const newActiveWorkspace = this.sortedWorkspaces.find(w => w.id !== workspaceToDelete.id) || null;
|
|
3070
|
-
this.selectWorkspace(newActiveWorkspace);
|
|
3071
|
-
}
|
|
3072
|
-
};
|
|
3073
3099
|
}
|
|
3100
|
+
get host() { return index.getElement(this); }
|
|
3101
|
+
activeWorkspace;
|
|
3102
|
+
workspaces = [];
|
|
3103
|
+
isWorkspaceManagerReady;
|
|
3104
|
+
workspaceChange;
|
|
3105
|
+
childMenuAnchor = null;
|
|
3106
|
+
openChildMenuItem = null;
|
|
3107
|
+
newWorkspace = null;
|
|
3108
|
+
editingItemId = null;
|
|
3109
|
+
kritzelEngineRef = null;
|
|
3110
|
+
splitButtonRef;
|
|
3074
3111
|
get sortedWorkspaces() {
|
|
3075
|
-
|
|
3076
|
-
return [this.newWorkspace, ...uniqueWorkspaces].filter(ws => ws !== null).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
|
|
3077
|
-
}
|
|
3078
|
-
get activeItemIndex() {
|
|
3079
|
-
return this.sortedWorkspaces.findIndex(ws => { var _a; return ws.id === ((_a = this.activeWorkspace) === null || _a === void 0 ? void 0 : _a.id); });
|
|
3112
|
+
return [this.newWorkspace, ...this.workspaces].filter(ws => ws != null).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
|
|
3080
3113
|
}
|
|
3081
3114
|
async componentWillLoad() {
|
|
3082
3115
|
await this.initializeEngine();
|
|
@@ -3084,45 +3117,100 @@ const KritzelWorkspaceManager = class {
|
|
|
3084
3117
|
}
|
|
3085
3118
|
async initializeEngine() {
|
|
3086
3119
|
await customElements.whenDefined('kritzel-engine');
|
|
3087
|
-
this.
|
|
3088
|
-
if (!this.
|
|
3120
|
+
this.kritzelEngineRef = this.host.parentElement.querySelector('kritzel-engine');
|
|
3121
|
+
if (!this.kritzelEngineRef) {
|
|
3089
3122
|
throw new Error('kritzel-engine not found in parent element.');
|
|
3090
3123
|
}
|
|
3091
3124
|
}
|
|
3092
|
-
|
|
3093
|
-
this.
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3125
|
+
async select(item, parent) {
|
|
3126
|
+
if (this.editingItemId) {
|
|
3127
|
+
return;
|
|
3128
|
+
}
|
|
3129
|
+
if (item.action) {
|
|
3130
|
+
item.action(item, parent);
|
|
3098
3131
|
return;
|
|
3099
|
-
|
|
3100
|
-
this.workspaceChange.emit(
|
|
3132
|
+
}
|
|
3133
|
+
this.workspaceChange.emit(item.value);
|
|
3134
|
+
}
|
|
3135
|
+
async add() {
|
|
3136
|
+
this.newWorkspace = new index$1.KritzelWorkspace(index$1.ObjectHelper.generateUUID(), 'New Workspace');
|
|
3137
|
+
this.editingItemId = this.newWorkspace.id;
|
|
3138
|
+
await this.splitButtonRef.open();
|
|
3139
|
+
}
|
|
3140
|
+
edit(item) {
|
|
3141
|
+
this.openChildMenuItem = null;
|
|
3142
|
+
this.childMenuAnchor = null;
|
|
3143
|
+
requestAnimationFrame(() => {
|
|
3144
|
+
this.editingItemId = item.id;
|
|
3145
|
+
});
|
|
3146
|
+
}
|
|
3147
|
+
async save(item) {
|
|
3148
|
+
if (this.newWorkspace) {
|
|
3149
|
+
await this.kritzelEngineRef.createWorkspace({ ...item.value, name: item.label });
|
|
3150
|
+
this.workspaceChange.emit(this.newWorkspace);
|
|
3151
|
+
}
|
|
3152
|
+
else {
|
|
3153
|
+
await this.kritzelEngineRef.updateWorkspace({ ...item.value, name: item.label });
|
|
3154
|
+
}
|
|
3155
|
+
this.editingItemId = null;
|
|
3156
|
+
this.newWorkspace = null;
|
|
3157
|
+
}
|
|
3158
|
+
cancel() {
|
|
3159
|
+
this.newWorkspace = null;
|
|
3160
|
+
this.editingItemId = null;
|
|
3161
|
+
}
|
|
3162
|
+
async delete(item) {
|
|
3163
|
+
this.openChildMenuItem = null;
|
|
3164
|
+
this.childMenuAnchor = null;
|
|
3165
|
+
await this.kritzelEngineRef.deleteWorkspace(item.value);
|
|
3166
|
+
}
|
|
3167
|
+
toggleChildMenu(item, anchor) {
|
|
3168
|
+
this.openChildMenuItem = item;
|
|
3169
|
+
this.childMenuAnchor = anchor;
|
|
3170
|
+
}
|
|
3171
|
+
closeChildMenu() {
|
|
3172
|
+
this.openChildMenuItem = null;
|
|
3173
|
+
this.childMenuAnchor = null;
|
|
3174
|
+
}
|
|
3175
|
+
closeMenu() {
|
|
3176
|
+
this.cancel();
|
|
3177
|
+
this.closeChildMenu();
|
|
3101
3178
|
}
|
|
3102
3179
|
render() {
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3180
|
+
console.log('render workspace manager');
|
|
3181
|
+
const menuItems = this.sortedWorkspaces
|
|
3182
|
+
.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime())
|
|
3183
|
+
.filter(ws => ws !== null)
|
|
3184
|
+
.map(ws => {
|
|
3185
|
+
return {
|
|
3186
|
+
id: ws.id,
|
|
3187
|
+
label: ws.name,
|
|
3188
|
+
value: ws,
|
|
3189
|
+
isEditing: this.editingItemId === ws.id,
|
|
3190
|
+
isSelected: this.activeWorkspace?.id === ws.id,
|
|
3191
|
+
isNewItem: this.newWorkspace?.id === ws.id,
|
|
3192
|
+
isChildMenuOpen: this.openChildMenuItem?.id === ws.id,
|
|
3193
|
+
childMenuAnchor: this.openChildMenuItem?.id === ws.id ? this.childMenuAnchor : null,
|
|
3194
|
+
children: [
|
|
3195
|
+
{
|
|
3196
|
+
id: `${ws.id}-rename`,
|
|
3197
|
+
label: 'Rename',
|
|
3198
|
+
value: 'rename',
|
|
3199
|
+
action: (_item, parent) => this.edit(parent),
|
|
3200
|
+
},
|
|
3201
|
+
{
|
|
3202
|
+
id: `${ws.id}-delete`,
|
|
3203
|
+
label: 'Delete',
|
|
3204
|
+
value: 'delete',
|
|
3205
|
+
action: (_item, parent) => this.delete(parent),
|
|
3206
|
+
},
|
|
3207
|
+
],
|
|
3208
|
+
};
|
|
3209
|
+
});
|
|
3210
|
+
return (index.h(index.Host, null, index.h("kritzel-split-button", { ref: el => (this.splitButtonRef = el), items: menuItems, mainButtonDisabled: this.editingItemId != null, onButtonClick: () => this.add(), onItemSelect: event => this.select(event.detail.item, event.detail.parent), onItemToggleChildMenu: event => this.toggleChildMenu(event.detail.item, event.detail.childMenuAnchor), onItemSave: event => this.save(event.detail), onItemCancel: () => this.cancel(), onItemCloseChildMenu: () => this.closeChildMenu(), onClose: () => {
|
|
3211
|
+
this.closeMenu();
|
|
3212
|
+
} })));
|
|
3124
3213
|
}
|
|
3125
|
-
get host() { return index.getElement(this); }
|
|
3126
3214
|
};
|
|
3127
3215
|
KritzelWorkspaceManager.style = kritzelWorkspaceManagerCss;
|
|
3128
3216
|
|
|
@@ -3142,10 +3230,11 @@ exports.kritzel_font_family = KritzelFontFamily;
|
|
|
3142
3230
|
exports.kritzel_font_size = KritzelFontSize;
|
|
3143
3231
|
exports.kritzel_icon = KritzelIcon;
|
|
3144
3232
|
exports.kritzel_menu = KritzelMenu;
|
|
3233
|
+
exports.kritzel_menu_item = KritzelMenuItem;
|
|
3145
3234
|
exports.kritzel_portal = KritzelPortal;
|
|
3146
3235
|
exports.kritzel_split_button = KritzelSplitButton;
|
|
3147
3236
|
exports.kritzel_stroke_size = KritzelStrokeSize;
|
|
3148
3237
|
exports.kritzel_tooltip = KritzelTooltip;
|
|
3149
3238
|
exports.kritzel_utility_panel = KritzelUtilityPanel;
|
|
3150
3239
|
exports.kritzel_workspace_manager = KritzelWorkspaceManager;
|
|
3151
|
-
//# sourceMappingURL=kritzel-brush-style.kritzel-color.kritzel-color-palette.kritzel-context-menu.kritzel-control-brush-config.kritzel-control-text-config.kritzel-controls.kritzel-cursor-trail.kritzel-dropdown.kritzel-editor.kritzel-engine.kritzel-font.kritzel-font-family.kritzel-font-size.kritzel-icon.kritzel-menu.kritzel-portal.kritzel-split-button.kritzel-stroke-size.kritzel-tooltip.kritzel-utility-panel.kritzel-workspace-manager.entry.cjs.js.map
|
|
3240
|
+
//# sourceMappingURL=kritzel-brush-style.kritzel-color.kritzel-color-palette.kritzel-context-menu.kritzel-control-brush-config.kritzel-control-text-config.kritzel-controls.kritzel-cursor-trail.kritzel-dropdown.kritzel-editor.kritzel-engine.kritzel-font.kritzel-font-family.kritzel-font-size.kritzel-icon.kritzel-menu.kritzel-menu-item.kritzel-portal.kritzel-split-button.kritzel-stroke-size.kritzel-tooltip.kritzel-utility-panel.kritzel-workspace-manager.entry.cjs.js.map
|