@kritzel/engine 0.4.31
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/LICENSE.md +50 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/engine.constants-CakmdKMW.js +28206 -0
- package/dist/cjs/index-BbbWU2aN.js +1742 -0
- package/dist/cjs/index.cjs.js +4232 -0
- package/dist/cjs/kritzel-awareness-cursors_5.cjs.entry.js +28004 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/stencil.cjs.js +25 -0
- package/dist/collection/classes/core/core.class.js +1389 -0
- package/dist/collection/classes/core/reviver.class.js +124 -0
- package/dist/collection/classes/core/store.class.js +337 -0
- package/dist/collection/classes/core/viewport.class.js +794 -0
- package/dist/collection/classes/core/workspace.class.js +112 -0
- package/dist/collection/classes/handlers/base.handler.js +20 -0
- package/dist/collection/classes/handlers/context-menu.handler.js +170 -0
- package/dist/collection/classes/handlers/hover.handler.js +35 -0
- package/dist/collection/classes/handlers/key.handler.js +162 -0
- package/dist/collection/classes/handlers/line-handle.handler.js +475 -0
- package/dist/collection/classes/handlers/move.handler.js +295 -0
- package/dist/collection/classes/handlers/resize.handler.js +327 -0
- package/dist/collection/classes/handlers/rotation.handler.js +174 -0
- package/dist/collection/classes/handlers/selection.handler.js +526 -0
- package/dist/collection/classes/managers/anchor.manager.js +1476 -0
- package/dist/collection/classes/managers/browser-permission.manager.js +64 -0
- package/dist/collection/classes/managers/clipboard.manager.js +346 -0
- package/dist/collection/classes/managers/clipboard.types.js +1 -0
- package/dist/collection/classes/managers/cursor.manager.js +139 -0
- package/dist/collection/classes/managers/license.manager.js +341 -0
- package/dist/collection/classes/managers/localization.manager.js +227 -0
- package/dist/collection/classes/managers/theme.manager.js +206 -0
- package/dist/collection/classes/objects/base-object.class.js +462 -0
- package/dist/collection/classes/objects/dynamic-object.class.js +437 -0
- package/dist/collection/classes/objects/group.class.js +590 -0
- package/dist/collection/classes/objects/image.class.js +500 -0
- package/dist/collection/classes/objects/line.class.js +789 -0
- package/dist/collection/classes/objects/path.class.js +578 -0
- package/dist/collection/classes/objects/selection-box.class.js +32 -0
- package/dist/collection/classes/objects/selection-group.class.js +752 -0
- package/dist/collection/classes/objects/shape.class.js +628 -0
- package/dist/collection/classes/objects/text.class.js +461 -0
- package/dist/collection/classes/providers/assets/asset-resolver.class.js +536 -0
- package/dist/collection/classes/providers/assets/http-asset-provider.class.js +111 -0
- package/dist/collection/classes/providers/assets/indexeddb-asset-provider.class.js +241 -0
- package/dist/collection/classes/providers/assets/presigned-asset-provider.class.js +86 -0
- package/dist/collection/classes/providers/paste-intent/event-paste-intent.provider.js +48 -0
- package/dist/collection/classes/providers/paste-intent/ios-paste-intent.provider.js +16 -0
- package/dist/collection/classes/providers/paste-intent/navigator-paste-intent.provider.js +86 -0
- package/dist/collection/classes/providers/sync/broadcast-sync-provider.class.js +100 -0
- package/dist/collection/classes/providers/sync/hocuspocus-sync-provider.class.js +333 -0
- package/dist/collection/classes/providers/sync/in-memory-sync-provider.class.js +69 -0
- package/dist/collection/classes/providers/sync/indexeddb-sync-provider.class.js +39 -0
- package/dist/collection/classes/providers/sync/websocket-sync-provider.class.js +110 -0
- package/dist/collection/classes/registries/dynamic-object-renderer.registry.js +52 -0
- package/dist/collection/classes/registries/font-registry.class.js +161 -0
- package/dist/collection/classes/registries/icon-registry.class.js +118 -0
- package/dist/collection/classes/registries/paste-intent-provider.registry.js +26 -0
- package/dist/collection/classes/registries/tool.registry.js +69 -0
- package/dist/collection/classes/structures/app-state-map.structure.js +461 -0
- package/dist/collection/classes/structures/object-map.structure.js +1103 -0
- package/dist/collection/classes/structures/quadtree.structure.js +251 -0
- package/dist/collection/classes/tools/base-tool.class.js +88 -0
- package/dist/collection/classes/tools/brush-tool.class.js +236 -0
- package/dist/collection/classes/tools/eraser-tool.class.js +133 -0
- package/dist/collection/classes/tools/image-tool.class.js +152 -0
- package/dist/collection/classes/tools/line-tool.class.js +249 -0
- package/dist/collection/classes/tools/selection-tool.class.js +611 -0
- package/dist/collection/classes/tools/shape-tool.class.js +251 -0
- package/dist/collection/classes/tools/text-tool.class.js +179 -0
- package/dist/collection/collection-manifest.json +17 -0
- package/dist/collection/components/kritzel-awareness-cursors/kritzel-awareness-cursors.css +115 -0
- package/dist/collection/components/kritzel-awareness-cursors/kritzel-awareness-cursors.js +380 -0
- package/dist/collection/components/kritzel-cursor-trail/kritzel-cursor-trail.css +10 -0
- package/dist/collection/components/kritzel-cursor-trail/kritzel-cursor-trail.js +153 -0
- package/dist/collection/components/kritzel-engine/kritzel-engine.css +81 -0
- package/dist/collection/components/kritzel-engine/kritzel-engine.js +6345 -0
- package/dist/collection/components/kritzel-icon/kritzel-icon.css +18 -0
- package/dist/collection/components/kritzel-icon/kritzel-icon.js +93 -0
- package/dist/collection/components/kritzel-watermark/kritzel-watermark.css +29 -0
- package/dist/collection/components/kritzel-watermark/kritzel-watermark.js +83 -0
- package/dist/collection/configs/default-asset-storage.config.js +9 -0
- package/dist/collection/configs/default-brush-tool.config.js +9 -0
- package/dist/collection/configs/default-engine-config.js +73 -0
- package/dist/collection/configs/default-line-tool.config.js +12 -0
- package/dist/collection/configs/default-shape-tool.config.js +15 -0
- package/dist/collection/configs/default-sync.config.js +6 -0
- package/dist/collection/configs/default-text-tool.config.js +12 -0
- package/dist/collection/constants/color-palette.constants.js +40 -0
- package/dist/collection/constants/core.constants.js +1 -0
- package/dist/collection/constants/engine.constants.js +4 -0
- package/dist/collection/constants/license.constants.js +25 -0
- package/dist/collection/constants/schema.constants.js +4 -0
- package/dist/collection/constants/storage.constants.js +1 -0
- package/dist/collection/constants/stroke-size.constants.js +2 -0
- package/dist/collection/constants/text-tool-fonts.constants.js +18 -0
- package/dist/collection/constants/version.js +6 -0
- package/dist/collection/enums/alignment.enum.js +9 -0
- package/dist/collection/enums/event-button.enum.js +6 -0
- package/dist/collection/enums/handle-type.enum.js +7 -0
- package/dist/collection/enums/shape-type.enum.js +6 -0
- package/dist/collection/events/active-workspace-change.event.js +1 -0
- package/dist/collection/events/editor-is-ready.event.js +1 -0
- package/dist/collection/events/login.event.js +1 -0
- package/dist/collection/helpers/alignment.helper.js +73 -0
- package/dist/collection/helpers/class.helper.js +5 -0
- package/dist/collection/helpers/color.helper.js +106 -0
- package/dist/collection/helpers/cursor.helper.js +57 -0
- package/dist/collection/helpers/devices.helper.js +28 -0
- package/dist/collection/helpers/event.helper.js +58 -0
- package/dist/collection/helpers/geometry.helper.js +149 -0
- package/dist/collection/helpers/html.helper.js +116 -0
- package/dist/collection/helpers/image-file.helper.js +6 -0
- package/dist/collection/helpers/keyboard.helper.js +55 -0
- package/dist/collection/helpers/localization.helper.js +25 -0
- package/dist/collection/helpers/math.helper.js +8 -0
- package/dist/collection/helpers/migration.helper.js +45 -0
- package/dist/collection/helpers/object.helper.js +29 -0
- package/dist/collection/helpers/svg-export.helper.js +655 -0
- package/dist/collection/helpers/theme.helper.js +77 -0
- package/dist/collection/helpers/tool-config.helper.js +63 -0
- package/dist/collection/helpers/wheel.helper.js +113 -0
- package/dist/collection/index.js +107 -0
- package/dist/collection/interfaces/anchor.interface.js +1 -0
- package/dist/collection/interfaces/arrow-head.interface.js +1 -0
- package/dist/collection/interfaces/asset-provider.interface.js +1 -0
- package/dist/collection/interfaces/asset-storage-config.interface.js +1 -0
- package/dist/collection/interfaces/asset.interface.js +1 -0
- package/dist/collection/interfaces/bounding-box.interface.js +1 -0
- package/dist/collection/interfaces/clonable.interface.js +1 -0
- package/dist/collection/interfaces/context-menu-item.interface.js +1 -0
- package/dist/collection/interfaces/context-menu-state.interface.js +1 -0
- package/dist/collection/interfaces/debug-info.interface.js +1 -0
- package/dist/collection/interfaces/dialog.interface.js +1 -0
- package/dist/collection/interfaces/document-metadata.interface.js +1 -0
- package/dist/collection/interfaces/dynamic-object-renderer.interface.js +1 -0
- package/dist/collection/interfaces/engine-state.interface.js +1 -0
- package/dist/collection/interfaces/font.interface.js +1 -0
- package/dist/collection/interfaces/localization.interface.js +1 -0
- package/dist/collection/interfaces/login-config.interface.js +1 -0
- package/dist/collection/interfaces/master-detail.interface.js +1 -0
- package/dist/collection/interfaces/menu-item.interface.js +1 -0
- package/dist/collection/interfaces/migration.interface.js +1 -0
- package/dist/collection/interfaces/notification.interface.js +1 -0
- package/dist/collection/interfaces/object-change-event.interface.js +1 -0
- package/dist/collection/interfaces/object-export.interface.js +1 -0
- package/dist/collection/interfaces/object.interface.js +1 -0
- package/dist/collection/interfaces/paste-intent-provider.interface.js +1 -0
- package/dist/collection/interfaces/point.interface.js +1 -0
- package/dist/collection/interfaces/polygon.interface.js +1 -0
- package/dist/collection/interfaces/remote-cursor.interface.js +1 -0
- package/dist/collection/interfaces/selection-state.interface.js +1 -0
- package/dist/collection/interfaces/serializable.interface.js +1 -0
- package/dist/collection/interfaces/settings.interface.js +1 -0
- package/dist/collection/interfaces/share.interface.js +1 -0
- package/dist/collection/interfaces/shortcut.interface.js +1 -0
- package/dist/collection/interfaces/sync-config.interface.js +21 -0
- package/dist/collection/interfaces/sync-provider.interface.js +1 -0
- package/dist/collection/interfaces/theme.interface.js +1 -0
- package/dist/collection/interfaces/tool-config.interface.js +1 -0
- package/dist/collection/interfaces/tool-type.interface.js +1 -0
- package/dist/collection/interfaces/tool.interface.js +1 -0
- package/dist/collection/interfaces/toolbar-item.interface.js +1 -0
- package/dist/collection/interfaces/undo-state.interface.js +1 -0
- package/dist/collection/interfaces/user.interface.js +1 -0
- package/dist/collection/interfaces/viewport-state.interface.js +1 -0
- package/dist/collection/locales/de-locale.js +119 -0
- package/dist/collection/locales/en-locale.js +120 -0
- package/dist/collection/locales/fr-locale.js +119 -0
- package/dist/collection/migrations/app-state.migrations.js +47 -0
- package/dist/collection/migrations/workspace.migrations.js +67 -0
- package/dist/collection/themes/dark-theme.js +340 -0
- package/dist/collection/themes/light-theme.js +346 -0
- package/dist/collection/types/deep-readonly.type.js +1 -0
- package/dist/collection/types/state.types.js +1 -0
- package/dist/components/index.d.ts +47 -0
- package/dist/components/index.js +4143 -0
- package/dist/components/kritzel-awareness-cursors.d.ts +11 -0
- package/dist/components/kritzel-awareness-cursors.js +6 -0
- package/dist/components/kritzel-cursor-trail.d.ts +11 -0
- package/dist/components/kritzel-cursor-trail.js +6 -0
- package/dist/components/kritzel-engine.d.ts +11 -0
- package/dist/components/kritzel-engine.js +52641 -0
- package/dist/components/kritzel-icon.d.ts +11 -0
- package/dist/components/kritzel-icon.js +6 -0
- package/dist/components/kritzel-watermark.d.ts +11 -0
- package/dist/components/kritzel-watermark.js +6 -0
- package/dist/components/p-B2Htv9ou.js +49 -0
- package/dist/components/p-BvRGQvVI.js +3456 -0
- package/dist/components/p-CfSx6HU_.js +1469 -0
- package/dist/components/p-YP8wAcF4.js +122 -0
- package/dist/components/p-fx6msYHJ.js +167 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/engine.constants-Bl5-pbq-.js +28143 -0
- package/dist/esm/index-BU9Mv7y0.js +1715 -0
- package/dist/esm/index.js +4134 -0
- package/dist/esm/kritzel-awareness-cursors_5.entry.js +27978 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/stencil.js +21 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil/index.esm.js +4134 -0
- package/dist/stencil/p-BU9Mv7y0.js +1702 -0
- package/dist/stencil/p-Bl5-pbq-.js +28143 -0
- package/dist/stencil/p-DQuL1Twl.js +3 -0
- package/dist/stencil/p-f0a8b7af.entry.js +27978 -0
- package/dist/stencil/stencil.esm.js +21 -0
- package/dist/types/classes/core/core.class.d.ts +532 -0
- package/dist/types/classes/core/reviver.class.d.ts +32 -0
- package/dist/types/classes/core/store.class.d.ts +198 -0
- package/dist/types/classes/core/viewport.class.d.ts +256 -0
- package/dist/types/classes/core/workspace.class.d.ts +95 -0
- package/dist/types/classes/handlers/base.handler.d.ts +18 -0
- package/dist/types/classes/handlers/context-menu.handler.d.ts +67 -0
- package/dist/types/classes/handlers/hover.handler.d.ts +23 -0
- package/dist/types/classes/handlers/key.handler.d.ts +44 -0
- package/dist/types/classes/handlers/line-handle.handler.d.ts +115 -0
- package/dist/types/classes/handlers/move.handler.d.ts +94 -0
- package/dist/types/classes/handlers/resize.handler.d.ts +95 -0
- package/dist/types/classes/handlers/rotation.handler.d.ts +50 -0
- package/dist/types/classes/handlers/selection.handler.d.ts +153 -0
- package/dist/types/classes/managers/anchor.manager.d.ts +513 -0
- package/dist/types/classes/managers/browser-permission.manager.d.ts +41 -0
- package/dist/types/classes/managers/clipboard.manager.d.ts +71 -0
- package/dist/types/classes/managers/clipboard.types.d.ts +23 -0
- package/dist/types/classes/managers/cursor.manager.d.ts +66 -0
- package/dist/types/classes/managers/license.manager.d.ts +147 -0
- package/dist/types/classes/managers/localization.manager.d.ts +145 -0
- package/dist/types/classes/managers/theme.manager.d.ts +112 -0
- package/dist/types/classes/objects/base-object.class.d.ts +266 -0
- package/dist/types/classes/objects/dynamic-object.class.d.ts +148 -0
- package/dist/types/classes/objects/group.class.d.ts +231 -0
- package/dist/types/classes/objects/image.class.d.ts +246 -0
- package/dist/types/classes/objects/line.class.d.ts +285 -0
- package/dist/types/classes/objects/path.class.d.ts +220 -0
- package/dist/types/classes/objects/selection-box.class.d.ts +19 -0
- package/dist/types/classes/objects/selection-group.class.d.ts +267 -0
- package/dist/types/classes/objects/shape.class.d.ts +322 -0
- package/dist/types/classes/objects/text.class.d.ts +197 -0
- package/dist/types/classes/providers/assets/asset-resolver.class.d.ts +141 -0
- package/dist/types/classes/providers/assets/http-asset-provider.class.d.ts +79 -0
- package/dist/types/classes/providers/assets/indexeddb-asset-provider.class.d.ts +69 -0
- package/dist/types/classes/providers/assets/presigned-asset-provider.class.d.ts +69 -0
- package/dist/types/classes/providers/paste-intent/event-paste-intent.provider.d.ts +8 -0
- package/dist/types/classes/providers/paste-intent/ios-paste-intent.provider.d.ts +6 -0
- package/dist/types/classes/providers/paste-intent/navigator-paste-intent.provider.d.ts +9 -0
- package/dist/types/classes/providers/sync/broadcast-sync-provider.class.d.ts +23 -0
- package/dist/types/classes/providers/sync/hocuspocus-sync-provider.class.d.ts +163 -0
- package/dist/types/classes/providers/sync/in-memory-sync-provider.class.d.ts +39 -0
- package/dist/types/classes/providers/sync/indexeddb-sync-provider.class.d.ts +25 -0
- package/dist/types/classes/providers/sync/websocket-sync-provider.class.d.ts +63 -0
- package/dist/types/classes/registries/dynamic-object-renderer.registry.d.ts +32 -0
- package/dist/types/classes/registries/font-registry.class.d.ts +19 -0
- package/dist/types/classes/registries/icon-registry.class.d.ts +39 -0
- package/dist/types/classes/registries/paste-intent-provider.registry.d.ts +10 -0
- package/dist/types/classes/registries/tool.registry.d.ts +53 -0
- package/dist/types/classes/structures/app-state-map.structure.d.ts +171 -0
- package/dist/types/classes/structures/object-map.structure.d.ts +403 -0
- package/dist/types/classes/structures/quadtree.structure.d.ts +128 -0
- package/dist/types/classes/tools/base-tool.class.d.ts +72 -0
- package/dist/types/classes/tools/brush-tool.class.d.ts +68 -0
- package/dist/types/classes/tools/eraser-tool.class.d.ts +38 -0
- package/dist/types/classes/tools/image-tool.class.d.ts +74 -0
- package/dist/types/classes/tools/line-tool.class.d.ts +63 -0
- package/dist/types/classes/tools/selection-tool.class.d.ts +188 -0
- package/dist/types/classes/tools/shape-tool.class.d.ts +90 -0
- package/dist/types/classes/tools/text-tool.class.d.ts +66 -0
- package/dist/types/components/kritzel-awareness-cursors/kritzel-awareness-cursors.d.ts +29 -0
- package/dist/types/components/kritzel-cursor-trail/kritzel-cursor-trail.d.ts +19 -0
- package/dist/types/components/kritzel-engine/kritzel-engine.d.ts +695 -0
- package/dist/types/components/kritzel-icon/kritzel-icon.d.ts +6 -0
- package/dist/types/components/kritzel-watermark/kritzel-watermark.d.ts +20 -0
- package/dist/types/components.d.ts +981 -0
- package/dist/types/configs/default-asset-storage.config.d.ts +8 -0
- package/dist/types/configs/default-brush-tool.config.d.ts +2 -0
- package/dist/types/configs/default-engine-config.d.ts +2 -0
- package/dist/types/configs/default-line-tool.config.d.ts +2 -0
- package/dist/types/configs/default-shape-tool.config.d.ts +2 -0
- package/dist/types/configs/default-sync.config.d.ts +5 -0
- package/dist/types/configs/default-text-tool.config.d.ts +2 -0
- package/dist/types/constants/color-palette.constants.d.ts +31 -0
- package/dist/types/constants/core.constants.d.ts +0 -0
- package/dist/types/constants/engine.constants.d.ts +4 -0
- package/dist/types/constants/license.constants.d.ts +25 -0
- package/dist/types/constants/schema.constants.d.ts +4 -0
- package/dist/types/constants/storage.constants.d.ts +1 -0
- package/dist/types/constants/stroke-size.constants.d.ts +2 -0
- package/dist/types/constants/text-tool-fonts.constants.d.ts +3 -0
- package/dist/types/constants/version.d.ts +6 -0
- package/dist/types/enums/alignment.enum.d.ts +8 -0
- package/dist/types/enums/event-button.enum.d.ts +5 -0
- package/dist/types/enums/handle-type.enum.d.ts +6 -0
- package/dist/types/enums/shape-type.enum.d.ts +5 -0
- package/dist/types/events/active-workspace-change.event.d.ts +7 -0
- package/dist/types/events/editor-is-ready.event.d.ts +18 -0
- package/dist/types/events/login.event.d.ts +3 -0
- package/dist/types/helpers/alignment.helper.d.ts +21 -0
- package/dist/types/helpers/class.helper.d.ts +3 -0
- package/dist/types/helpers/color.helper.d.ts +34 -0
- package/dist/types/helpers/cursor.helper.d.ts +22 -0
- package/dist/types/helpers/devices.helper.d.ts +8 -0
- package/dist/types/helpers/event.helper.d.ts +6 -0
- package/dist/types/helpers/geometry.helper.d.ts +38 -0
- package/dist/types/helpers/html.helper.d.ts +8 -0
- package/dist/types/helpers/image-file.helper.d.ts +3 -0
- package/dist/types/helpers/keyboard.helper.d.ts +6 -0
- package/dist/types/helpers/localization.helper.d.ts +18 -0
- package/dist/types/helpers/math.helper.d.ts +4 -0
- package/dist/types/helpers/migration.helper.d.ts +30 -0
- package/dist/types/helpers/object.helper.d.ts +9 -0
- package/dist/types/helpers/svg-export.helper.d.ts +231 -0
- package/dist/types/helpers/theme.helper.d.ts +42 -0
- package/dist/types/helpers/tool-config.helper.d.ts +4 -0
- package/dist/types/helpers/wheel.helper.d.ts +9 -0
- package/dist/types/index.d.ts +109 -0
- package/dist/types/interfaces/anchor.interface.d.ts +147 -0
- package/dist/types/interfaces/arrow-head.interface.d.ts +27 -0
- package/dist/types/interfaces/asset-provider.interface.d.ts +88 -0
- package/dist/types/interfaces/asset-storage-config.interface.d.ts +40 -0
- package/dist/types/interfaces/asset.interface.d.ts +43 -0
- package/dist/types/interfaces/bounding-box.interface.d.ts +8 -0
- package/dist/types/interfaces/clonable.interface.d.ts +3 -0
- package/dist/types/interfaces/context-menu-item.interface.d.ts +25 -0
- package/dist/types/interfaces/context-menu-state.interface.d.ts +16 -0
- package/dist/types/interfaces/debug-info.interface.d.ts +7 -0
- package/dist/types/interfaces/dialog.interface.d.ts +4 -0
- package/dist/types/interfaces/document-metadata.interface.d.ts +6 -0
- package/dist/types/interfaces/dynamic-object-renderer.interface.d.ts +40 -0
- package/dist/types/interfaces/engine-state.interface.d.ts +82 -0
- package/dist/types/interfaces/font.interface.d.ts +15 -0
- package/dist/types/interfaces/localization.interface.d.ts +143 -0
- package/dist/types/interfaces/login-config.interface.d.ts +24 -0
- package/dist/types/interfaces/master-detail.interface.d.ts +14 -0
- package/dist/types/interfaces/menu-item.interface.d.ts +27 -0
- package/dist/types/interfaces/migration.interface.d.ts +16 -0
- package/dist/types/interfaces/notification.interface.d.ts +10 -0
- package/dist/types/interfaces/object-change-event.interface.d.ts +31 -0
- package/dist/types/interfaces/object-export.interface.d.ts +20 -0
- package/dist/types/interfaces/object.interface.d.ts +53 -0
- package/dist/types/interfaces/paste-intent-provider.interface.d.ts +10 -0
- package/dist/types/interfaces/point.interface.d.ts +4 -0
- package/dist/types/interfaces/polygon.interface.d.ts +7 -0
- package/dist/types/interfaces/remote-cursor.interface.d.ts +18 -0
- package/dist/types/interfaces/selection-state.interface.d.ts +7 -0
- package/dist/types/interfaces/serializable.interface.d.ts +5 -0
- package/dist/types/interfaces/settings.interface.d.ts +25 -0
- package/dist/types/interfaces/share.interface.d.ts +9 -0
- package/dist/types/interfaces/shortcut.interface.d.ts +10 -0
- package/dist/types/interfaces/sync-config.interface.d.ts +41 -0
- package/dist/types/interfaces/sync-provider.interface.d.ts +66 -0
- package/dist/types/interfaces/theme.interface.d.ts +553 -0
- package/dist/types/interfaces/tool-config.interface.d.ts +24 -0
- package/dist/types/interfaces/tool-type.interface.d.ts +1 -0
- package/dist/types/interfaces/tool.interface.d.ts +8 -0
- package/dist/types/interfaces/toolbar-item.interface.d.ts +66 -0
- package/dist/types/interfaces/undo-state.interface.d.ts +6 -0
- package/dist/types/interfaces/user.interface.d.ts +22 -0
- package/dist/types/interfaces/viewport-state.interface.d.ts +7 -0
- package/dist/types/locales/de-locale.d.ts +5 -0
- package/dist/types/locales/en-locale.d.ts +6 -0
- package/dist/types/locales/fr-locale.d.ts +5 -0
- package/dist/types/migrations/app-state.migrations.d.ts +11 -0
- package/dist/types/migrations/workspace.migrations.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1873 -0
- package/dist/types/themes/dark-theme.d.ts +5 -0
- package/dist/types/themes/light-theme.d.ts +5 -0
- package/dist/types/types/deep-readonly.type.d.ts +7 -0
- package/dist/types/types/state.types.d.ts +3 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +101 -0
- package/readme.md +11 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { KritzelBaseObject } from './base-object.class';
|
|
2
|
+
import { KritzelPolygon } from '../../interfaces/polygon.interface';
|
|
3
|
+
import { KritzelPoint } from '../../interfaces/point.interface';
|
|
4
|
+
import { KritzelCore } from '../core/core.class';
|
|
5
|
+
import { ThemeAwareColor } from '../../constants/color-palette.constants';
|
|
6
|
+
import { KritzelObjectExportContext, KritzelObjectExportFormat } from '../../interfaces/object-export.interface';
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for creating a KritzelPath instance.
|
|
9
|
+
*/
|
|
10
|
+
export interface KritzelPathConfig {
|
|
11
|
+
points?: number[][];
|
|
12
|
+
translateX?: number;
|
|
13
|
+
translateY?: number;
|
|
14
|
+
/** Rotation in degrees at initialization time. */
|
|
15
|
+
rotation?: number;
|
|
16
|
+
scale?: number;
|
|
17
|
+
stroke?: ThemeAwareColor;
|
|
18
|
+
strokeWidth?: number;
|
|
19
|
+
fill?: ThemeAwareColor;
|
|
20
|
+
opacity?: number;
|
|
21
|
+
lineSlack?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare class KritzelPath extends KritzelBaseObject<SVGElement> {
|
|
24
|
+
__class__: string;
|
|
25
|
+
points: number[][];
|
|
26
|
+
d: string;
|
|
27
|
+
stroke: ThemeAwareColor;
|
|
28
|
+
strokeWidth: number;
|
|
29
|
+
lineSlack: number;
|
|
30
|
+
fill: ThemeAwareColor;
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
height: number;
|
|
34
|
+
width: number;
|
|
35
|
+
scale: number;
|
|
36
|
+
options: KritzelPathConfig | undefined;
|
|
37
|
+
isVisible: boolean;
|
|
38
|
+
isDebugInfoVisible: boolean;
|
|
39
|
+
isCompleted: boolean;
|
|
40
|
+
private _adjustedPoints;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the SVG viewBox string for local (object-relative) rendering.
|
|
43
|
+
*
|
|
44
|
+
* The path's `d` string is generated in local coordinates (offset so the
|
|
45
|
+
* object's top-left origin is at 0,0), so the viewBox always starts at 0,0.
|
|
46
|
+
* Keeping the SVG's internal coordinates small — independent of the object's
|
|
47
|
+
* world position — avoids float32 precision loss in the browser's SVG
|
|
48
|
+
* rasterizer (Skia), which otherwise fails to paint paths whose absolute
|
|
49
|
+
* world coordinates exceed ~2^24 (e.g. far from the origin at extreme zoom).
|
|
50
|
+
* @returns The viewBox attribute value in the format "0 0 width height"
|
|
51
|
+
*/
|
|
52
|
+
get viewBox(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new KritzelPath instance.
|
|
55
|
+
* @param config - Optional configuration object for the path
|
|
56
|
+
* @param config.points - Array of [x, y] coordinate pairs defining the path
|
|
57
|
+
* @param config.translateX - Horizontal translation offset (default: 0)
|
|
58
|
+
* @param config.translateY - Vertical translation offset (default: 0)
|
|
59
|
+
* @param config.scale - Scale factor for the path (default: 1)
|
|
60
|
+
* @param config.strokeWidth - Width of the stroke in pixels (default: 8)
|
|
61
|
+
* @param config.fill - Theme-aware fill color with light and dark variants
|
|
62
|
+
* @param config.lineSlack - Additional padding for bounding box calculations (default: 0.5)
|
|
63
|
+
*/
|
|
64
|
+
constructor(config?: KritzelPathConfig);
|
|
65
|
+
/**
|
|
66
|
+
* Factory method to create a new KritzelPath instance with a core reference.
|
|
67
|
+
* This is the preferred way to create paths that will be managed by the canvas.
|
|
68
|
+
* @param core - The KritzelCore instance that will manage this path
|
|
69
|
+
* @param options - Optional configuration options for the path
|
|
70
|
+
* @returns A new KritzelPath instance configured with the provided options
|
|
71
|
+
*/
|
|
72
|
+
static create(core: KritzelCore, options?: KritzelPathConfig): KritzelPath;
|
|
73
|
+
/**
|
|
74
|
+
* Creates a deep copy of this path object.
|
|
75
|
+
* The points array is cloned to ensure the copy is independent.
|
|
76
|
+
* @returns A new KritzelPath instance with copied properties
|
|
77
|
+
*/
|
|
78
|
+
copy(): KritzelPath;
|
|
79
|
+
/**
|
|
80
|
+
* Restores the path from a serialized object, then regenerates the SVG `d`
|
|
81
|
+
* string from the restored points.
|
|
82
|
+
*
|
|
83
|
+
* Regeneration is required because the `d` string is now emitted in local
|
|
84
|
+
* (object-relative) coordinates paired with a "0 0 width height" viewBox.
|
|
85
|
+
* Older persisted paths stored `d` in absolute world coordinates, which
|
|
86
|
+
* would be inconsistent with the local-coordinate viewBox and fail to
|
|
87
|
+
* rasterize far from the origin at extreme zoom. Recomputing `d` here makes
|
|
88
|
+
* both freshly created and previously persisted paths render identically.
|
|
89
|
+
* @param object - The serialized path data to restore from
|
|
90
|
+
* @returns This instance cast to type T
|
|
91
|
+
*/
|
|
92
|
+
deserialize<T>(object: any): T;
|
|
93
|
+
/**
|
|
94
|
+
* Resizes the path to fit within the specified dimensions.
|
|
95
|
+
* Scales all points proportionally and updates the SVG path.
|
|
96
|
+
* @param x - New X position for the path, or null to keep current
|
|
97
|
+
* @param y - New Y position for the path, or null to keep current
|
|
98
|
+
* @param width - New width for the path (must be > 1)
|
|
99
|
+
* @param height - New height for the path (must be > 1)
|
|
100
|
+
*/
|
|
101
|
+
resize(x: number | null, y: number | null, width: number, height: number): void;
|
|
102
|
+
/**
|
|
103
|
+
* Rotates the path by the specified angle.
|
|
104
|
+
* Invalidates cached adjusted points to force recalculation.
|
|
105
|
+
* @param value - Rotation angle in radians
|
|
106
|
+
*/
|
|
107
|
+
rotate(value: number): void;
|
|
108
|
+
/**
|
|
109
|
+
* Moves the path by calculating the delta between start and end positions.
|
|
110
|
+
* The delta is adjusted for the current viewport scale.
|
|
111
|
+
* @param startX - Starting X coordinate in screen space
|
|
112
|
+
* @param startY - Starting Y coordinate in screen space
|
|
113
|
+
* @param endX - Ending X coordinate in screen space
|
|
114
|
+
* @param endY - Ending Y coordinate in screen space
|
|
115
|
+
*/
|
|
116
|
+
move(startX: number, startY: number, endX: number, endY: number): void;
|
|
117
|
+
/**
|
|
118
|
+
* Tests whether a point intersects with the path's stroke.
|
|
119
|
+
* Uses distance-to-line-segment calculations for accurate hit detection.
|
|
120
|
+
* @param x - X coordinate to test in world space
|
|
121
|
+
* @param y - Y coordinate to test in world space
|
|
122
|
+
* @returns True if the point is within the stroke width of the path
|
|
123
|
+
*/
|
|
124
|
+
hitTest(x: number, y: number): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Tests whether a polygon intersects with the path.
|
|
127
|
+
* Checks for point containment, edge intersections, and proximity to stroke.
|
|
128
|
+
* @param polygon - The polygon to test against, defined by its corner points
|
|
129
|
+
* @returns True if any part of the polygon overlaps with the path's stroke
|
|
130
|
+
*/
|
|
131
|
+
hitTestPolygon(polygon: KritzelPolygon): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Updates the path's position to the specified coordinates.
|
|
134
|
+
* Invalidates cached adjusted points and triggers a store update.
|
|
135
|
+
* @param x - New X position in world space
|
|
136
|
+
* @param y - New Y position in world space
|
|
137
|
+
*/
|
|
138
|
+
updatePosition(x: number, y: number): void;
|
|
139
|
+
/**
|
|
140
|
+
* Lifecycle hook called after properties have been updated.
|
|
141
|
+
* Regenerates the SVG path and bounding box when strokeWidth changes.
|
|
142
|
+
* @param changedProperties - Array of property names that were modified
|
|
143
|
+
*/
|
|
144
|
+
onAfterUpdate(changedProperties: string[]): void;
|
|
145
|
+
/**
|
|
146
|
+
* Computes the world-space coordinates of all path points.
|
|
147
|
+
* Applies rotation around the path's center and adjusts for translation and scale.
|
|
148
|
+
* Results are cached in _adjustedPoints for performance.
|
|
149
|
+
* @returns Array of [x, y] coordinate pairs in world space
|
|
150
|
+
*/
|
|
151
|
+
private computeAdjustedPoints;
|
|
152
|
+
/**
|
|
153
|
+
* Calculates the shortest distance from a point to a line segment.
|
|
154
|
+
* Uses projection to find the closest point on the segment.
|
|
155
|
+
* @param x - X coordinate of the test point
|
|
156
|
+
* @param y - Y coordinate of the test point
|
|
157
|
+
* @param x1 - X coordinate of the line segment start
|
|
158
|
+
* @param y1 - Y coordinate of the line segment start
|
|
159
|
+
* @param x2 - X coordinate of the line segment end
|
|
160
|
+
* @param y2 - Y coordinate of the line segment end
|
|
161
|
+
* @returns The shortest distance from the point to the line segment
|
|
162
|
+
*/
|
|
163
|
+
private pointToLineSegmentDistance;
|
|
164
|
+
/**
|
|
165
|
+
* Updates width, height, x, y, translateX, and translateY based on current points.
|
|
166
|
+
* Uses the unrotated local points and stroke width for base dimensions.
|
|
167
|
+
* Called during initial setup to establish the path's dimensions and position.
|
|
168
|
+
*/
|
|
169
|
+
private updateDimensions;
|
|
170
|
+
/**
|
|
171
|
+
* Updates width, height, x, y based on current points and strokeWidth.
|
|
172
|
+
* Does NOT modify translateX/translateY (use updateDimensions for initial setup).
|
|
173
|
+
*/
|
|
174
|
+
private updateBoundingBox;
|
|
175
|
+
/**
|
|
176
|
+
* Generates the SVG path data string from the current points.
|
|
177
|
+
* Uses perfect-freehand to create a smooth, pressure-sensitive stroke.
|
|
178
|
+
* @returns SVG path data string (d attribute value)
|
|
179
|
+
*/
|
|
180
|
+
private generateSvgPath;
|
|
181
|
+
/**
|
|
182
|
+
* Converts raw input points into a smooth stroke outline using perfect-freehand.
|
|
183
|
+
* Applies pressure simulation and smoothing for a natural pen-like appearance.
|
|
184
|
+
* @param points - Array of [x, y] coordinate pairs representing the input path
|
|
185
|
+
* @param strokeWidth - The desired stroke width in pixels
|
|
186
|
+
* @returns Array of [x, y] coordinate pairs forming the stroke outline polygon
|
|
187
|
+
*/
|
|
188
|
+
private getStrokeFromPoints;
|
|
189
|
+
/**
|
|
190
|
+
* Converts stroke outline points into an SVG path data string.
|
|
191
|
+
* Uses quadratic bezier curves for smooth rendering.
|
|
192
|
+
* Coordinates are emitted relative to (offsetX, offsetY) so the resulting
|
|
193
|
+
* path lives in the object's local coordinate space (paired with a
|
|
194
|
+
* "0 0 width height" viewBox). This keeps SVG-internal coordinates small
|
|
195
|
+
* regardless of the object's world position, avoiding float32 rasterizer
|
|
196
|
+
* precision failures far from the origin.
|
|
197
|
+
* @param points - Array of [x, y] coordinate pairs forming the stroke outline
|
|
198
|
+
* @param offsetX - X origin to subtract from every coordinate (default 0)
|
|
199
|
+
* @param offsetY - Y origin to subtract from every coordinate (default 0)
|
|
200
|
+
* @param closed - Whether to close the path with 'Z' command (default: true)
|
|
201
|
+
* @returns SVG path data string with M, Q, and T commands
|
|
202
|
+
*/
|
|
203
|
+
private getSvgPathFromStroke;
|
|
204
|
+
/**
|
|
205
|
+
* Determines if the path appears too small on screen for detailed rendering.
|
|
206
|
+
* Used for level-of-detail optimizations.
|
|
207
|
+
* @returns True if the path's screen area is less than 500 square pixels
|
|
208
|
+
*/
|
|
209
|
+
isLowRes(): boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Finds the point where a line from outsidePoint to the path's center
|
|
212
|
+
* intersects the stroke edge. Used for arrow clipping at the actual stroke edge.
|
|
213
|
+
* Uses binary search refinement for accurate intersection detection.
|
|
214
|
+
* @param outsidePoint - A point outside the path to trace from
|
|
215
|
+
* @returns The intersection point on the stroke edge, or null if no intersection found
|
|
216
|
+
*/
|
|
217
|
+
getClipPoint(outsidePoint: KritzelPoint): KritzelPoint | null;
|
|
218
|
+
getSupportedExportFormats(): KritzelObjectExportFormat[];
|
|
219
|
+
exportAs(format: KritzelObjectExportFormat, context: KritzelObjectExportContext): Promise<string | null>;
|
|
220
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { KritzelCore } from '../core/core.class';
|
|
2
|
+
import { KritzelBaseObject } from './base-object.class';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a visual selection box used for multi-object selection on the canvas.
|
|
5
|
+
* The selection box is rendered as a semi-transparent rectangle with a border,
|
|
6
|
+
* typically shown when the user drags to select multiple objects.
|
|
7
|
+
*/
|
|
8
|
+
export declare class KritzelSelectionBox extends KritzelBaseObject<HTMLElement> {
|
|
9
|
+
__class__: string;
|
|
10
|
+
/**
|
|
11
|
+
* Factory method to create a new KritzelSelectionBox instance with default styling.
|
|
12
|
+
* Initializes the selection box with a blue semi-transparent background and border,
|
|
13
|
+
* positioned at the highest z-index to ensure visibility above all other objects.
|
|
14
|
+
*
|
|
15
|
+
* @param core - The KritzelCore instance providing access to the store and workspace state.
|
|
16
|
+
* @returns A fully initialized KritzelSelectionBox instance with default dimensions of 0x0.
|
|
17
|
+
*/
|
|
18
|
+
static create(core: KritzelCore): KritzelSelectionBox;
|
|
19
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { KritzelCore } from '../core/core.class';
|
|
2
|
+
import { KritzelBaseObject } from './base-object.class';
|
|
3
|
+
import { ThemeAwareColor } from '../../constants/color-palette.constants';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for creating a KritzelSelectionGroup instance.
|
|
6
|
+
*/
|
|
7
|
+
export interface KritzelSelectionGroupConfig {
|
|
8
|
+
rotation?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a snapshot of an object's transform state at a specific point in time.
|
|
12
|
+
* Used to preserve initial values during transform operations (rotate, resize)
|
|
13
|
+
* to avoid compounding errors from incremental updates.
|
|
14
|
+
*/
|
|
15
|
+
interface UnchangedObjectSnapshot {
|
|
16
|
+
/** The unique identifier of the object */
|
|
17
|
+
id: string;
|
|
18
|
+
/** The x-translation position of the object */
|
|
19
|
+
translateX: number;
|
|
20
|
+
/** The y-translation position of the object */
|
|
21
|
+
translateY: number;
|
|
22
|
+
/** The rotation angle of the object in radians */
|
|
23
|
+
rotation: number;
|
|
24
|
+
/** The content width of the object (excluding padding) */
|
|
25
|
+
width: number;
|
|
26
|
+
/** The content height of the object (excluding padding) */
|
|
27
|
+
height: number;
|
|
28
|
+
/** The total width of the object (including padding) */
|
|
29
|
+
totalWidth: number;
|
|
30
|
+
/** The total height of the object (including padding) */
|
|
31
|
+
totalHeight: number;
|
|
32
|
+
/** The scale factor applied to the object */
|
|
33
|
+
scale: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents a selection group that manages multiple selected objects on the canvas.
|
|
37
|
+
* The selection group allows batch operations like move, resize, and rotate on multiple objects simultaneously.
|
|
38
|
+
* It maintains its own bounding box that encompasses all selected objects.
|
|
39
|
+
*/
|
|
40
|
+
export declare class KritzelSelectionGroup extends KritzelBaseObject<HTMLElement> {
|
|
41
|
+
__class__: string;
|
|
42
|
+
constructor(config?: KritzelSelectionGroupConfig);
|
|
43
|
+
private _objectIds;
|
|
44
|
+
private _cachedObjects;
|
|
45
|
+
private _cachedObjectIdsHash;
|
|
46
|
+
unchangedObjectSnapshots: Map<string, UnchangedObjectSnapshot>;
|
|
47
|
+
snapshotRotation: number;
|
|
48
|
+
snapshotWidth: number;
|
|
49
|
+
snapshotHeight: number;
|
|
50
|
+
snapshotTranslateX: number;
|
|
51
|
+
snapshotTranslateY: number;
|
|
52
|
+
clientId?: number;
|
|
53
|
+
minX: number;
|
|
54
|
+
maxX: number;
|
|
55
|
+
minY: number;
|
|
56
|
+
maxY: number;
|
|
57
|
+
handleColor?: ThemeAwareColor;
|
|
58
|
+
handleStrokeColor?: ThemeAwareColor;
|
|
59
|
+
handleSize: number;
|
|
60
|
+
/** Timestamp of the last Yjs persist for children during a drag */
|
|
61
|
+
private _lastChildPersistTime;
|
|
62
|
+
/** Minimum interval (ms) between child Yjs persists during drag */
|
|
63
|
+
private static readonly CHILD_PERSIST_THROTTLE_MS;
|
|
64
|
+
/** Ignore tiny floating-point diffs when comparing refreshed bounds */
|
|
65
|
+
private static readonly DIMENSION_EPSILON;
|
|
66
|
+
/**
|
|
67
|
+
* Gets the array of object IDs contained in this selection group.
|
|
68
|
+
* @returns Array of string IDs for the selected objects
|
|
69
|
+
*/
|
|
70
|
+
get objectIds(): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Sets the array of object IDs contained in this selection group.
|
|
73
|
+
* Invalidates the cached objects array when changed.
|
|
74
|
+
* @param value - Array of string IDs to set as the selected objects
|
|
75
|
+
*/
|
|
76
|
+
set objectIds(value: string[]);
|
|
77
|
+
/**
|
|
78
|
+
* Invalidate the cached objects array. Call this when objects might have changed
|
|
79
|
+
* externally (e.g., after undo/redo operations).
|
|
80
|
+
*/
|
|
81
|
+
invalidateObjectsCache(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Retrieves the actual object instances from the store by their IDs.
|
|
84
|
+
* Uses caching to avoid redundant lookups - only recomputes when objectIds changes.
|
|
85
|
+
* Preserves the original insertion order of objects.
|
|
86
|
+
* @returns Array of KritzelBaseObject instances corresponding to the stored IDs
|
|
87
|
+
*/
|
|
88
|
+
get objects(): KritzelBaseObject<any>[];
|
|
89
|
+
private syncChildSelectionState;
|
|
90
|
+
private shouldSyncChildSelectionState;
|
|
91
|
+
/**
|
|
92
|
+
* Gets the number of objects in the selection group.
|
|
93
|
+
* @returns The count of selected objects
|
|
94
|
+
*/
|
|
95
|
+
get length(): number;
|
|
96
|
+
/**
|
|
97
|
+
* Factory method to create a new KritzelSelectionGroup instance.
|
|
98
|
+
* Initializes the selection group with default properties and associates it with the core instance.
|
|
99
|
+
* Default styling uses values from the theme system (selection section).
|
|
100
|
+
* @param core - The KritzelCore instance to associate with this selection group
|
|
101
|
+
* @returns A new KritzelSelectionGroup instance configured with default settings
|
|
102
|
+
*/
|
|
103
|
+
static create(core: KritzelCore, config?: {
|
|
104
|
+
rotation?: number;
|
|
105
|
+
}): KritzelSelectionGroup;
|
|
106
|
+
/**
|
|
107
|
+
* Adds multiple objects to the selection group.
|
|
108
|
+
* Only adds objects that are not already in the selection.
|
|
109
|
+
* Updates the group's rotation based on the number of selected objects:
|
|
110
|
+
* - Single object: inherits the object's rotation
|
|
111
|
+
* - Multiple objects: resets rotation to 0
|
|
112
|
+
* Refreshes bounding box dimensions after adding objects.
|
|
113
|
+
* @param objects - Array of KritzelBaseObject instances to add to the selection
|
|
114
|
+
*/
|
|
115
|
+
addObjects(objects: KritzelBaseObject<any>[]): void;
|
|
116
|
+
/**
|
|
117
|
+
* Toggles an object's presence in the selection group.
|
|
118
|
+
* If the object is already selected, it will be removed.
|
|
119
|
+
* If the object is not selected, it will be added.
|
|
120
|
+
* Updates group rotation and refreshes bounding box dimensions after the change.
|
|
121
|
+
* @param object - The KritzelBaseObject instance to toggle in the selection
|
|
122
|
+
*/
|
|
123
|
+
addOrRemove(object: KritzelBaseObject<any>): void;
|
|
124
|
+
/**
|
|
125
|
+
* Prepares the selection group and its children for a transform interaction (rotate/resize).
|
|
126
|
+
* Ensures snapshot state is aligned with the current visual state.
|
|
127
|
+
*/
|
|
128
|
+
beginTransform(): void;
|
|
129
|
+
/**
|
|
130
|
+
* Sets the isSelected flag to false for all objects in the selection group.
|
|
131
|
+
* Used when clearing or changing the selection state.
|
|
132
|
+
*
|
|
133
|
+
* For KritzelGroup members, also clears the isSelected flag on all nested
|
|
134
|
+
* descendants. A descendant can retain a lingering isSelected from the marquee
|
|
135
|
+
* preview before it was resolved to its parent group during selection, which
|
|
136
|
+
* would otherwise leave that object selected after the group is deselected and
|
|
137
|
+
* cause the whole group to be re-selected on the next interaction.
|
|
138
|
+
*/
|
|
139
|
+
deselectAllChildren(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Updates the workspace ID for the selection group and all its contained objects.
|
|
142
|
+
* Used when moving objects between workspaces or updating workspace associations.
|
|
143
|
+
* @param workspaceId - The new workspace ID to assign to the group and its children
|
|
144
|
+
*/
|
|
145
|
+
updateWorkspaceId(workspaceId: string): void;
|
|
146
|
+
/**
|
|
147
|
+
* Updates the z-index values for all objects in the selection group.
|
|
148
|
+
* Assigns sequential z-indices starting from the provided value.
|
|
149
|
+
* @param startZIndex - The starting z-index value; subsequent objects get startZIndex + 1, startZIndex + 2, etc.
|
|
150
|
+
*/
|
|
151
|
+
updateZIndices(startZIndex: number): void;
|
|
152
|
+
/**
|
|
153
|
+
* Updates the absolute position of the selection group and all its contained objects.
|
|
154
|
+
* Maintains the relative positions of child objects within the group.
|
|
155
|
+
* Also updates the unchangedObjectSnapshots to reflect the new positions.
|
|
156
|
+
* @param x - The new x-coordinate for the selection group's top-left corner
|
|
157
|
+
* @param y - The new y-coordinate for the selection group's top-left corner
|
|
158
|
+
*/
|
|
159
|
+
updatePosition(x: number, y: number): void;
|
|
160
|
+
/**
|
|
161
|
+
* Capture snapshots of current object states for undo/redo operations
|
|
162
|
+
* @param cachedObjects Optional pre-fetched objects array to avoid redundant getter calls
|
|
163
|
+
*/
|
|
164
|
+
captureUnchangedSnapshots(cachedObjects?: KritzelBaseObject<any>[]): void;
|
|
165
|
+
/**
|
|
166
|
+
* Serializes the selection group to a plain object for persistence or transmission.
|
|
167
|
+
* Excludes internal references like _core, element refs, and cached data.
|
|
168
|
+
* Converts the unchangedObjectSnapshots Map to a plain object for JSON compatibility.
|
|
169
|
+
* @returns A serializable object representation of the selection group
|
|
170
|
+
*/
|
|
171
|
+
serialize(): any;
|
|
172
|
+
/**
|
|
173
|
+
* Deserializes a plain object back into a KritzelSelectionGroup instance.
|
|
174
|
+
* Restores objectIds through the setter and reconstructs the unchangedObjectSnapshots Map.
|
|
175
|
+
* @template T - The return type for the deserialized object
|
|
176
|
+
* @param object - The serialized object containing the selection group data
|
|
177
|
+
* @returns The deserialized selection group instance cast to type T
|
|
178
|
+
*/
|
|
179
|
+
deserialize<T>(object: any): T;
|
|
180
|
+
/**
|
|
181
|
+
* Persists the selection group's current state to the store.
|
|
182
|
+
* Only updates the selection group itself, not child objects.
|
|
183
|
+
* Child objects are updated during their respective move/resize/rotate operations
|
|
184
|
+
* to avoid redundant Yjs updates.
|
|
185
|
+
*/
|
|
186
|
+
update(): void;
|
|
187
|
+
/**
|
|
188
|
+
* Moves the selection group and all its contained objects by calculating the delta from drag coordinates.
|
|
189
|
+
* Updates anchor points for any lines connected to the moved objects.
|
|
190
|
+
*
|
|
191
|
+
* Child objects are moved locally without writing to Yjs during the drag to avoid
|
|
192
|
+
* N+1 full serializations per frame, which can overwhelm the WebSocket server.
|
|
193
|
+
* Children must be persisted at drag end via {@link persistChildren}.
|
|
194
|
+
*
|
|
195
|
+
* @param startX - The starting x-coordinate of the drag operation (in screen space)
|
|
196
|
+
* @param startY - The starting y-coordinate of the drag operation (in screen space)
|
|
197
|
+
* @param endX - The ending x-coordinate of the drag operation (in screen space)
|
|
198
|
+
* @param endY - The ending y-coordinate of the drag operation (in screen space)
|
|
199
|
+
*/
|
|
200
|
+
move(startX: number, startY: number, endX: number, endY: number): void;
|
|
201
|
+
/**
|
|
202
|
+
* Persists all child objects to Yjs in a single transaction.
|
|
203
|
+
* Must be called after a drag operation completes to sync the final
|
|
204
|
+
* positions of children that were only updated locally during the drag.
|
|
205
|
+
*/
|
|
206
|
+
persistChildren(): void;
|
|
207
|
+
/**
|
|
208
|
+
* Returns true when the selection contains a line anchored to an object
|
|
209
|
+
* that is not part of this selection group.
|
|
210
|
+
*/
|
|
211
|
+
hasExternalAnchoredLineConnections(cachedObjects?: KritzelBaseObject<any>[]): boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Resizes the selection group and scales all contained objects proportionally.
|
|
214
|
+
* Uses snapshot values to avoid compounding errors during continuous drag operations.
|
|
215
|
+
* Handles rotation by transforming coordinates into and out of the group's local space.
|
|
216
|
+
* Updates anchor points for any lines connected to resized objects.
|
|
217
|
+
* @param x - The new x-coordinate for the selection group's position
|
|
218
|
+
* @param y - The new y-coordinate for the selection group's position
|
|
219
|
+
* @param width - The new width for the selection group
|
|
220
|
+
* @param height - The new height for the selection group
|
|
221
|
+
*/
|
|
222
|
+
resize(x: number, y: number, width: number, height: number): void;
|
|
223
|
+
/**
|
|
224
|
+
* Rotates the selection group and all contained objects around the group's center.
|
|
225
|
+
* Objects rotate around the group center while also adjusting their individual rotations.
|
|
226
|
+
* Uses snapshot values to calculate incremental rotation from the initial state.
|
|
227
|
+
* @param value - The new rotation angle in radians for the selection group
|
|
228
|
+
*/
|
|
229
|
+
rotate(value: number): void;
|
|
230
|
+
/**
|
|
231
|
+
* Creates a deep copy of the selection group including copies of all contained objects.
|
|
232
|
+
* Preserves z-index ordering by sorting children before copying.
|
|
233
|
+
* Copies maintain their relative positions within the new selection group.
|
|
234
|
+
* @returns A new KritzelSelectionGroup with copies of all contained objects
|
|
235
|
+
*/
|
|
236
|
+
copy(): KritzelBaseObject<HTMLElement>;
|
|
237
|
+
/**
|
|
238
|
+
* Refreshes the selection group's bounding box dimensions based on contained objects.
|
|
239
|
+
* @param cachedObjects Optional pre-fetched objects array to avoid redundant getter calls
|
|
240
|
+
* @param skipPersist If true, only updates local state without persisting to Yjs (used during undo/redo)
|
|
241
|
+
*/
|
|
242
|
+
refreshObjectDimensions(cachedObjects?: KritzelBaseObject<any>[], skipPersist?: boolean): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Calculates the horizontal offset from the group's center to an object's center using snapshot data.
|
|
245
|
+
* Used during rotation to maintain relative positioning of objects.
|
|
246
|
+
* @param snapshot - The snapshot containing the object's recorded position and dimensions
|
|
247
|
+
* @returns The x-axis offset from the group center to the object center
|
|
248
|
+
*/
|
|
249
|
+
private getOffsetXToCenterFromSnapshot;
|
|
250
|
+
/**
|
|
251
|
+
* Calculates the vertical offset from the group's center to an object's center using snapshot data.
|
|
252
|
+
* Used during rotation to maintain relative positioning of objects.
|
|
253
|
+
* @param snapshot - The snapshot containing the object's recorded position and dimensions
|
|
254
|
+
* @returns The y-axis offset from the group center to the object center
|
|
255
|
+
*/
|
|
256
|
+
private getOffsetYToCenterFromSnapshot;
|
|
257
|
+
/**
|
|
258
|
+
* Tests whether a point intersects with the selection group or any of its contained objects.
|
|
259
|
+
* For a single line object, delegates hit testing to the line's own hit test (more precise).
|
|
260
|
+
* For other cases, first checks the group's rotated polygon bounding box, then individual objects.
|
|
261
|
+
* @param x - The x-coordinate of the point to test (in world space)
|
|
262
|
+
* @param y - The y-coordinate of the point to test (in world space)
|
|
263
|
+
* @returns True if the point is inside the selection group or any contained object, false otherwise
|
|
264
|
+
*/
|
|
265
|
+
hitTest(x: number, y: number): boolean;
|
|
266
|
+
}
|
|
267
|
+
export {};
|