@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,231 @@
|
|
|
1
|
+
import { KritzelBaseObject } from '../classes/objects/base-object.class';
|
|
2
|
+
import { ThemeName } from '../interfaces/theme.interface';
|
|
3
|
+
import { KritzelBoundingBox } from '../interfaces/bounding-box.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Options for SVG export.
|
|
6
|
+
*/
|
|
7
|
+
export interface SvgExportOptions {
|
|
8
|
+
/** Theme to use for resolving theme-aware colors. Defaults to current theme. */
|
|
9
|
+
theme?: ThemeName;
|
|
10
|
+
/** Padding around the exported content in world units. Defaults to 0. */
|
|
11
|
+
padding?: number;
|
|
12
|
+
/** Whether to include XML declaration. Defaults to true. */
|
|
13
|
+
includeXmlDeclaration?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Enables raster-safe serialization for objects that normally rely on
|
|
16
|
+
* `<foreignObject>` (currently text). Use this when the generated SVG is
|
|
17
|
+
* rendered into an `<img>` and then drawn to a canvas for PNG export.
|
|
18
|
+
*/
|
|
19
|
+
rasterSafeForCanvas?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Map of image object id -> inlined `data:` URL used to embed image
|
|
22
|
+
* bytes directly into the exported markup. Required for the bytes to
|
|
23
|
+
* survive rasterization (e.g. SVG -> PNG), because browsers refuse to
|
|
24
|
+
* load external/`blob:` resources referenced from an SVG loaded into
|
|
25
|
+
* an `<img>` element. Populate via {@link KritzelSvgExportHelper.resolveImageDataUrls}.
|
|
26
|
+
*/
|
|
27
|
+
imageDataUrls?: Map<string, string>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Minimal structural contract for the asset resolver dependency used by
|
|
31
|
+
* the export inlining path. Declared structurally to keep this helper
|
|
32
|
+
* decoupled from the concrete resolver implementation.
|
|
33
|
+
*/
|
|
34
|
+
export interface SvgExportAssetResolver {
|
|
35
|
+
fetchBlob(id: string): Promise<Blob>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Helper class for exporting Kritzel objects to SVG format.
|
|
39
|
+
* Generates clean, standards-compliant SVG markup from canvas objects.
|
|
40
|
+
*/
|
|
41
|
+
export declare class KritzelSvgExportHelper {
|
|
42
|
+
/**
|
|
43
|
+
* Calculates the combined bounding box that encompasses all objects.
|
|
44
|
+
* Uses rotatedBoundingBox to account for object rotation.
|
|
45
|
+
* @param objects - Array of objects to calculate bounds for
|
|
46
|
+
* @returns Combined bounding box, or null if no objects provided
|
|
47
|
+
*/
|
|
48
|
+
static calculateCombinedBounds(objects: KritzelBaseObject[]): KritzelBoundingBox | null;
|
|
49
|
+
/**
|
|
50
|
+
* Generates a complete SVG document string from the given objects.
|
|
51
|
+
* @param objects - Objects to export
|
|
52
|
+
* @param options - Export options
|
|
53
|
+
* @returns SVG document string
|
|
54
|
+
*/
|
|
55
|
+
static generateSvg(objects: KritzelBaseObject[], options?: SvgExportOptions): string;
|
|
56
|
+
/**
|
|
57
|
+
* Flattens a list of objects, expanding groups into their children recursively.
|
|
58
|
+
* @param objects - Objects to flatten
|
|
59
|
+
* @returns Flat array of all objects including group children
|
|
60
|
+
*/
|
|
61
|
+
private static flattenObjects;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves every image referenced by the given objects (including those
|
|
64
|
+
* nested inside groups) to an inlined `data:` URL, keyed by object id.
|
|
65
|
+
*
|
|
66
|
+
* This is required for export flows that rasterize the SVG (e.g. PNG
|
|
67
|
+
* export): an SVG loaded into an `<img>` element will NOT load external
|
|
68
|
+
* or `blob:` resources, so a `<image href="blob:...">` renders as a
|
|
69
|
+
* broken-image placeholder. Embedding the bytes as a base64 `data:` URL
|
|
70
|
+
* makes the image self-contained and survive rasterization.
|
|
71
|
+
*
|
|
72
|
+
* Resolution is best-effort: images that fail to resolve are simply
|
|
73
|
+
* omitted from the map, and the SVG falls back to whatever `href` the
|
|
74
|
+
* synchronous path would have produced.
|
|
75
|
+
* @param objects - Objects to inline images for
|
|
76
|
+
* @param assetResolver - Resolver used to fetch asset bytes; optional
|
|
77
|
+
* @returns Map of image object id -> inlined `data:` URL
|
|
78
|
+
*/
|
|
79
|
+
static resolveImageDataUrls(objects: KritzelBaseObject[], assetResolver?: SvgExportAssetResolver): Promise<Map<string, string>>;
|
|
80
|
+
/**
|
|
81
|
+
* Reads a Blob into a base64 `data:` URL.
|
|
82
|
+
* @param blob - The blob to encode
|
|
83
|
+
* @returns Promise resolving to the data URL string
|
|
84
|
+
*/
|
|
85
|
+
private static blobToDataUrl;
|
|
86
|
+
/**
|
|
87
|
+
* Encodes a byte array to base64 across browser and Node-like runtimes.
|
|
88
|
+
*/
|
|
89
|
+
private static uint8ToBase64;
|
|
90
|
+
/**
|
|
91
|
+
* Collects SVG defs (markers, patterns, etc.) needed by the objects.
|
|
92
|
+
* @param objects - Objects to collect defs for
|
|
93
|
+
* @param theme - Theme for color resolution
|
|
94
|
+
* @returns Array of def element strings
|
|
95
|
+
*/
|
|
96
|
+
private static collectDefs;
|
|
97
|
+
/**
|
|
98
|
+
* Generates an SVG marker element for line arrows.
|
|
99
|
+
* @param line - The line object
|
|
100
|
+
* @param end - Which end of the line ('start' or 'end')
|
|
101
|
+
* @param theme - Theme for color resolution
|
|
102
|
+
* @returns SVG marker element string
|
|
103
|
+
*/
|
|
104
|
+
private static generateArrowMarker;
|
|
105
|
+
/**
|
|
106
|
+
* Converts a Kritzel object to its SVG element representation.
|
|
107
|
+
* @param object - The object to convert
|
|
108
|
+
* @param theme - Theme for color resolution
|
|
109
|
+
* @param imageDataUrls - Optional map of image id -> inlined data URL
|
|
110
|
+
* @returns SVG element string, or empty string if object type is not supported
|
|
111
|
+
*/
|
|
112
|
+
static objectToSvgElement(object: KritzelBaseObject, theme?: ThemeName, imageDataUrls?: Map<string, string>, rasterSafeForCanvas?: boolean): string;
|
|
113
|
+
/**
|
|
114
|
+
* Converts a KritzelPath to SVG.
|
|
115
|
+
* @param path - The path object
|
|
116
|
+
* @param theme - Theme for color resolution
|
|
117
|
+
* @returns SVG element string
|
|
118
|
+
*/
|
|
119
|
+
private static pathToSvg;
|
|
120
|
+
/**
|
|
121
|
+
* Converts a KritzelLine to SVG.
|
|
122
|
+
* @param line - The line object
|
|
123
|
+
* @param theme - Theme for color resolution
|
|
124
|
+
* @returns SVG element string
|
|
125
|
+
*/
|
|
126
|
+
private static lineToSvg;
|
|
127
|
+
/**
|
|
128
|
+
* Converts a KritzelShape to SVG.
|
|
129
|
+
* @param shape - The shape object
|
|
130
|
+
* @param theme - Theme for color resolution
|
|
131
|
+
* @returns SVG element string
|
|
132
|
+
*/
|
|
133
|
+
private static shapeToSvg;
|
|
134
|
+
/**
|
|
135
|
+
* Converts a KritzelText to SVG using foreignObject for rich text support.
|
|
136
|
+
* @param text - The text object
|
|
137
|
+
* @param theme - Theme for color resolution
|
|
138
|
+
* @returns SVG element string
|
|
139
|
+
*/
|
|
140
|
+
private static textToSvg;
|
|
141
|
+
/**
|
|
142
|
+
* Converts a KritzelText to SVG using pure SVG text primitives.
|
|
143
|
+
* This path avoids `<foreignObject>`, which taints canvases when the
|
|
144
|
+
* generated SVG is rasterized through `<img>` and `drawImage`.
|
|
145
|
+
*/
|
|
146
|
+
private static textToSvgRasterSafe;
|
|
147
|
+
/**
|
|
148
|
+
* Converts a KritzelImage to SVG.
|
|
149
|
+
*
|
|
150
|
+
* Prefers an inlined `data:` URL from `imageDataUrls` (keyed by object
|
|
151
|
+
* id) when provided, so the embedded bytes survive rasterization to
|
|
152
|
+
* PNG. Falls back to `resolvedSrc` (populated by the renderer via the
|
|
153
|
+
* asset resolver) and finally the legacy inline `src` field for
|
|
154
|
+
* documents persisted before the asset layer existed.
|
|
155
|
+
*
|
|
156
|
+
* Note: a `blob:` `resolvedSrc` renders correctly on-canvas but becomes
|
|
157
|
+
* a broken-image placeholder once the SVG is loaded into an `<img>` and
|
|
158
|
+
* drawn to a canvas. Callers that rasterize the SVG must pass
|
|
159
|
+
* `imageDataUrls` (see {@link KritzelSvgExportHelper.resolveImageDataUrls}).
|
|
160
|
+
* @param image - The image object
|
|
161
|
+
* @param imageDataUrls - Optional map of image id -> inlined data URL
|
|
162
|
+
* @returns SVG element string
|
|
163
|
+
*/
|
|
164
|
+
private static imageToSvg;
|
|
165
|
+
/**
|
|
166
|
+
* Converts a KritzelDynamicObject to SVG.
|
|
167
|
+
* SVG mode: embeds HTML in foreignObject (best-effort).
|
|
168
|
+
* PNG/raster mode: renders placeholder rect with warning.
|
|
169
|
+
* @param obj - The dynamic object
|
|
170
|
+
* @param rasterSafeForCanvas - If true, render placeholder (for PNG export)
|
|
171
|
+
* @returns SVG element string
|
|
172
|
+
*/
|
|
173
|
+
private static dynamicObjectToSvg;
|
|
174
|
+
/**
|
|
175
|
+
* Converts a KritzelGroup to SVG by recursively converting children.
|
|
176
|
+
* @param group - The group object
|
|
177
|
+
* @param theme - Theme for color resolution
|
|
178
|
+
* @param imageDataUrls - Optional map of image id -> inlined data URL
|
|
179
|
+
* @returns SVG element string
|
|
180
|
+
*/
|
|
181
|
+
private static groupToSvg;
|
|
182
|
+
/**
|
|
183
|
+
* Builds a transform attribute string for an object.
|
|
184
|
+
* Combines translation and rotation.
|
|
185
|
+
* @param object - The object to build transform for
|
|
186
|
+
* @returns Transform attribute value string
|
|
187
|
+
*/
|
|
188
|
+
private static buildTransform;
|
|
189
|
+
/**
|
|
190
|
+
* Returns a safe non-zero scale for export geometry calculations.
|
|
191
|
+
*/
|
|
192
|
+
private static getObjectScale;
|
|
193
|
+
/**
|
|
194
|
+
* Converts ProseMirror JSON content to HTML string.
|
|
195
|
+
* @param content - ProseMirror document JSON
|
|
196
|
+
* @param context - The text or shape object for styling context
|
|
197
|
+
* @param theme - Theme for color resolution
|
|
198
|
+
* @returns HTML string
|
|
199
|
+
*/
|
|
200
|
+
private static prosemirrorToHtml;
|
|
201
|
+
/**
|
|
202
|
+
* Converts a ProseMirror node to HTML.
|
|
203
|
+
* @param node - ProseMirror node JSON
|
|
204
|
+
* @param theme - Theme for color resolution
|
|
205
|
+
* @returns HTML string
|
|
206
|
+
*/
|
|
207
|
+
private static nodeToHtml;
|
|
208
|
+
/**
|
|
209
|
+
* Converts ProseMirror JSON content to plain-text lines.
|
|
210
|
+
* Used by raster-safe SVG export, which cannot depend on HTML/foreignObject.
|
|
211
|
+
*/
|
|
212
|
+
private static prosemirrorToPlainTextLines;
|
|
213
|
+
/**
|
|
214
|
+
* Converts a ProseMirror node tree into plain text.
|
|
215
|
+
*/
|
|
216
|
+
private static nodeToPlainText;
|
|
217
|
+
/**
|
|
218
|
+
* Applies a ProseMirror mark to text.
|
|
219
|
+
* @param text - The text to wrap
|
|
220
|
+
* @param mark - The mark to apply
|
|
221
|
+
* @param theme - Theme for color resolution
|
|
222
|
+
* @returns Wrapped HTML string
|
|
223
|
+
*/
|
|
224
|
+
private static applyMark;
|
|
225
|
+
/**
|
|
226
|
+
* Escapes HTML special characters.
|
|
227
|
+
* @param str - String to escape
|
|
228
|
+
* @returns Escaped string
|
|
229
|
+
*/
|
|
230
|
+
private static escapeHtml;
|
|
231
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { KritzelTheme } from '../interfaces/theme.interface';
|
|
2
|
+
export declare class ThemeHelper {
|
|
3
|
+
private static readonly appliedVariableNames;
|
|
4
|
+
/**
|
|
5
|
+
* Converts a camelCase string to kebab-case.
|
|
6
|
+
* @example ThemeHelper.camelToKebab('controlHoverBackgroundColor') → 'control-hover-background-color'
|
|
7
|
+
* @example ThemeHelper.camelToKebab('backgroundColor') → 'background-color'
|
|
8
|
+
* @example ThemeHelper.camelToKebab('gap') → 'gap'
|
|
9
|
+
*/
|
|
10
|
+
static camelToKebab(str: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Recursively flattens a theme object into a map of CSS variable names to values.
|
|
13
|
+
* Skips the 'name' property at the root level since it's the theme identifier, not a CSS value.
|
|
14
|
+
*
|
|
15
|
+
* @param theme - The theme object to flatten
|
|
16
|
+
* @param prefix - The CSS variable prefix (default: '--kritzel')
|
|
17
|
+
* @returns A Map of CSS variable names to their values
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ThemeHelper.flattenThemeToVariables(lightTheme)
|
|
21
|
+
* // Returns Map {
|
|
22
|
+
* // '--kritzel-global-pointer-cursor' => 'pointer',
|
|
23
|
+
* // '--kritzel-toolbar-gap' => '8px',
|
|
24
|
+
* // ...
|
|
25
|
+
* // }
|
|
26
|
+
*/
|
|
27
|
+
static flattenThemeToVariables(theme: KritzelTheme, prefix?: string): Map<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* Applies a map of CSS variables to an HTML element.
|
|
30
|
+
*
|
|
31
|
+
* @param element - The target HTML element
|
|
32
|
+
* @param variables - A Map of CSS variable names to values
|
|
33
|
+
*/
|
|
34
|
+
static applyVariablesToElement(element: HTMLElement, variables: Map<string, string>): void;
|
|
35
|
+
/**
|
|
36
|
+
* Convenience method that flattens a theme and applies it to an element in one call.
|
|
37
|
+
*
|
|
38
|
+
* @param element - The target HTML element
|
|
39
|
+
* @param theme - The theme object to apply
|
|
40
|
+
*/
|
|
41
|
+
static applyThemeToElement(element: HTMLElement, theme: KritzelTheme): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KritzelDynamicObject } from '../classes/objects/dynamic-object.class';
|
|
2
|
+
export declare class KritzelWheelHelper {
|
|
3
|
+
static shouldKeepWheelInDynamicObject(ev: WheelEvent, dynamicObject: KritzelDynamicObject): boolean;
|
|
4
|
+
private static getScrollableContainerFromEventPath;
|
|
5
|
+
private static isScrollableElement;
|
|
6
|
+
private static canElementConsumeWheel;
|
|
7
|
+
private static canElementConsumeVerticalWheel;
|
|
8
|
+
private static canElementConsumeHorizontalWheel;
|
|
9
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview entry point for your component library
|
|
3
|
+
*
|
|
4
|
+
* This is the entry point for your component library. Use this file to export utilities,
|
|
5
|
+
* constants or data structure that accompany your components.
|
|
6
|
+
*
|
|
7
|
+
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
8
|
+
* to consume components of this package as outlined in the `README.md`.
|
|
9
|
+
*/
|
|
10
|
+
export type * from './components';
|
|
11
|
+
export type HTMLKritzelEngineElement = HTMLElementTagNameMap['kritzel-engine'];
|
|
12
|
+
export * from './classes/objects/base-object.class';
|
|
13
|
+
export * from './classes/objects/text.class';
|
|
14
|
+
export * from './classes/objects/path.class';
|
|
15
|
+
export * from './classes/objects/image.class';
|
|
16
|
+
export * from './classes/objects/line.class';
|
|
17
|
+
export * from './classes/objects/group.class';
|
|
18
|
+
export * from './classes/objects/shape.class';
|
|
19
|
+
export * from './classes/objects/dynamic-object.class';
|
|
20
|
+
export * from './classes/objects/selection-group.class';
|
|
21
|
+
export * from './classes/objects/selection-box.class';
|
|
22
|
+
export * from './classes/tools/base-tool.class';
|
|
23
|
+
export * from './classes/tools/brush-tool.class';
|
|
24
|
+
export * from './classes/tools/line-tool.class';
|
|
25
|
+
export * from './classes/tools/eraser-tool.class';
|
|
26
|
+
export * from './classes/tools/image-tool.class';
|
|
27
|
+
export * from './classes/tools/text-tool.class';
|
|
28
|
+
export * from './classes/tools/shape-tool.class';
|
|
29
|
+
export * from './helpers/cursor.helper';
|
|
30
|
+
export * from './helpers/keyboard.helper';
|
|
31
|
+
export * from './helpers/devices.helper';
|
|
32
|
+
export * from './helpers/theme.helper';
|
|
33
|
+
export * from './helpers/object.helper';
|
|
34
|
+
export * from './helpers/color.helper';
|
|
35
|
+
export * from './helpers/html.helper';
|
|
36
|
+
export * from './helpers/tool-config.helper';
|
|
37
|
+
export * from './classes/tools/selection-tool.class';
|
|
38
|
+
export * from './classes/providers/sync/broadcast-sync-provider.class';
|
|
39
|
+
export * from './classes/providers/sync/in-memory-sync-provider.class';
|
|
40
|
+
export * from './classes/providers/sync/indexeddb-sync-provider.class';
|
|
41
|
+
export * from './classes/providers/sync/websocket-sync-provider.class';
|
|
42
|
+
export * from './classes/providers/sync/hocuspocus-sync-provider.class';
|
|
43
|
+
export * from './classes/providers/assets/asset-resolver.class';
|
|
44
|
+
export * from './classes/providers/assets/indexeddb-asset-provider.class';
|
|
45
|
+
export * from './classes/providers/assets/http-asset-provider.class';
|
|
46
|
+
export * from './classes/providers/assets/presigned-asset-provider.class';
|
|
47
|
+
export * from './classes/core/workspace.class';
|
|
48
|
+
export * from './classes/managers/anchor.manager';
|
|
49
|
+
export * from './classes/managers/theme.manager';
|
|
50
|
+
export * from './classes/managers/localization.manager';
|
|
51
|
+
export * from './classes/managers/license.manager';
|
|
52
|
+
export * from './classes/registries/dynamic-object-renderer.registry';
|
|
53
|
+
export * from './classes/registries/font-registry.class';
|
|
54
|
+
export * from './classes/registries/icon-registry.class';
|
|
55
|
+
export * from './interfaces/toolbar-item.interface';
|
|
56
|
+
export * from './interfaces/menu-item.interface';
|
|
57
|
+
export * from './interfaces/object-export.interface';
|
|
58
|
+
export * from './interfaces/object-change-event.interface';
|
|
59
|
+
export * from './interfaces/dynamic-object-renderer.interface';
|
|
60
|
+
export * from './interfaces/sync-provider.interface';
|
|
61
|
+
export * from './interfaces/sync-config.interface';
|
|
62
|
+
export * from './interfaces/asset.interface';
|
|
63
|
+
export * from './interfaces/asset-provider.interface';
|
|
64
|
+
export * from './interfaces/asset-storage-config.interface';
|
|
65
|
+
export * from './interfaces/login-config.interface';
|
|
66
|
+
export * from './interfaces/document-metadata.interface';
|
|
67
|
+
export * from './interfaces/anchor.interface';
|
|
68
|
+
export * from './interfaces/viewport-state.interface';
|
|
69
|
+
export * from './interfaces/context-menu-state.interface';
|
|
70
|
+
export * from './interfaces/user.interface';
|
|
71
|
+
export * from './interfaces/theme.interface';
|
|
72
|
+
export * from './interfaces/localization.interface';
|
|
73
|
+
export * from './interfaces/shortcut.interface';
|
|
74
|
+
export * from './interfaces/share.interface';
|
|
75
|
+
export * from './interfaces/engine-state.interface';
|
|
76
|
+
export * from './interfaces/debug-info.interface';
|
|
77
|
+
export * from './interfaces/bounding-box.interface';
|
|
78
|
+
export * from './interfaces/polygon.interface';
|
|
79
|
+
export * from './interfaces/font.interface';
|
|
80
|
+
export * from './interfaces/settings.interface';
|
|
81
|
+
export * from './interfaces/dialog.interface';
|
|
82
|
+
export * from './interfaces/master-detail.interface';
|
|
83
|
+
export * from './interfaces/tool-config.interface';
|
|
84
|
+
export * from './interfaces/arrow-head.interface';
|
|
85
|
+
export * from './events/active-workspace-change.event';
|
|
86
|
+
export * from './events/editor-is-ready.event';
|
|
87
|
+
export * from './events/login.event';
|
|
88
|
+
export * from './configs/default-brush-tool.config';
|
|
89
|
+
export * from './configs/default-text-tool.config';
|
|
90
|
+
export * from './configs/default-line-tool.config';
|
|
91
|
+
export * from './configs/default-shape-tool.config';
|
|
92
|
+
export * from './configs/default-asset-storage.config';
|
|
93
|
+
export * from './configs/default-sync.config';
|
|
94
|
+
export * from './themes/light-theme';
|
|
95
|
+
export * from './themes/dark-theme';
|
|
96
|
+
export * from './locales/en-locale';
|
|
97
|
+
export * from './locales/de-locale';
|
|
98
|
+
export * from './locales/fr-locale';
|
|
99
|
+
export * from './enums/alignment.enum';
|
|
100
|
+
export * from './enums/shape-type.enum';
|
|
101
|
+
export * from './interfaces/migration.interface';
|
|
102
|
+
export * from './helpers/migration.helper';
|
|
103
|
+
export * from './migrations/app-state.migrations';
|
|
104
|
+
export * from './migrations/workspace.migrations';
|
|
105
|
+
export * from './constants/schema.constants';
|
|
106
|
+
export * from './constants/color-palette.constants';
|
|
107
|
+
export * from './constants/text-tool-fonts.constants';
|
|
108
|
+
export * from './constants/engine.constants';
|
|
109
|
+
export * from './constants/version';
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an anchor connection from a line endpoint to another object's center.
|
|
3
|
+
*/
|
|
4
|
+
export interface LineAnchor {
|
|
5
|
+
/** The ID of the object that this line endpoint is anchored to */
|
|
6
|
+
objectId: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Entry in the anchor index that tracks which lines are anchored to an object.
|
|
10
|
+
*/
|
|
11
|
+
export interface AnchorIndexEntry {
|
|
12
|
+
/** The ID of the line that has an anchor */
|
|
13
|
+
lineId: string;
|
|
14
|
+
/** Which endpoint of the line is anchored */
|
|
15
|
+
endpoint: 'start' | 'end';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents a potential snap target during line endpoint dragging.
|
|
19
|
+
*/
|
|
20
|
+
export interface SnapTarget {
|
|
21
|
+
/** The ID of the object that can be snapped to */
|
|
22
|
+
objectId: string;
|
|
23
|
+
/** The center X coordinate of the snap target in world coordinates */
|
|
24
|
+
centerX: number;
|
|
25
|
+
/** The center Y coordinate of the snap target in world coordinates */
|
|
26
|
+
centerY: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Shared visualization payload for snap preview and active snap states.
|
|
30
|
+
*/
|
|
31
|
+
export interface SnapIndicatorCandidate {
|
|
32
|
+
/** The ID of the object being snapped to */
|
|
33
|
+
objectId: string;
|
|
34
|
+
/** Which endpoint of the line is being snapped */
|
|
35
|
+
endpoint: 'start' | 'end';
|
|
36
|
+
/** The center X coordinate for the snap indicator */
|
|
37
|
+
centerX: number;
|
|
38
|
+
/** The center Y coordinate for the snap indicator */
|
|
39
|
+
centerY: number;
|
|
40
|
+
/** The X coordinate of the line endpoint (world coords) */
|
|
41
|
+
lineEndpointX: number;
|
|
42
|
+
/** The Y coordinate of the line endpoint (world coords) */
|
|
43
|
+
lineEndpointY: number;
|
|
44
|
+
/** The X coordinate where the line intersects the object's edge (world coords) */
|
|
45
|
+
edgeX?: number;
|
|
46
|
+
/** The Y coordinate where the line intersects the object's edge (world coords) */
|
|
47
|
+
edgeY?: number;
|
|
48
|
+
/** The stroke color of the line being snapped */
|
|
49
|
+
lineStroke?: string;
|
|
50
|
+
/** The stroke width of the line being snapped */
|
|
51
|
+
lineStrokeWidth?: number;
|
|
52
|
+
/** Arrow offset to apply to the edge point (in world coords) */
|
|
53
|
+
arrowOffset?: number;
|
|
54
|
+
/** Arrow style for the snapping endpoint */
|
|
55
|
+
arrowStyle?: 'triangle' | 'open' | 'diamond' | 'circle';
|
|
56
|
+
/** Arrow fill color */
|
|
57
|
+
arrowFill?: string;
|
|
58
|
+
/** The X coordinate of the control point (world coords), if any */
|
|
59
|
+
controlX?: number;
|
|
60
|
+
/** The Y coordinate of the control point (world coords), if any */
|
|
61
|
+
controlY?: number;
|
|
62
|
+
/** The t parameter on the curve where the edge intersection occurs (0-1) */
|
|
63
|
+
t?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents the current snap candidate state during dragging.
|
|
67
|
+
*/
|
|
68
|
+
export interface SnapCandidate extends SnapIndicatorCandidate {
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Represents a preview candidate shown before active snapping is engaged.
|
|
72
|
+
*/
|
|
73
|
+
export interface SnapPreviewCandidate extends SnapIndicatorCandidate {
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Visualization data for rendering anchor indicator lines.
|
|
77
|
+
*/
|
|
78
|
+
export interface AnchorVisualization {
|
|
79
|
+
/** The X coordinate where the line intersects the object's edge */
|
|
80
|
+
edgeX: number;
|
|
81
|
+
/** The Y coordinate where the line intersects the object's edge */
|
|
82
|
+
edgeY: number;
|
|
83
|
+
/** The center X coordinate of the anchored object */
|
|
84
|
+
centerX: number;
|
|
85
|
+
/** The center Y coordinate of the anchored object */
|
|
86
|
+
centerY: number;
|
|
87
|
+
/** Optional SVG path describing the curved dashed segment */
|
|
88
|
+
pathD?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Render data for anchor lines visualization (dashed lines from edge to center).
|
|
92
|
+
*/
|
|
93
|
+
export interface AnchorLinesRenderData {
|
|
94
|
+
/** The stroke width of the line */
|
|
95
|
+
lineStrokeWidth: number;
|
|
96
|
+
/** The stroke width for the indicator circle */
|
|
97
|
+
indicatorStrokeWidth: string;
|
|
98
|
+
/** The dash array for the dashed line */
|
|
99
|
+
dashArray: string;
|
|
100
|
+
/** The radius of the indicator circle */
|
|
101
|
+
indicatorRadius: number;
|
|
102
|
+
/** Visualization data for the start anchor, if any */
|
|
103
|
+
startAnchorViz: AnchorVisualization | null;
|
|
104
|
+
/** Visualization data for the end anchor, if any */
|
|
105
|
+
endAnchorViz: AnchorVisualization | null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Render data for snap indicator visualization.
|
|
109
|
+
*/
|
|
110
|
+
export interface SnapIndicatorRenderData {
|
|
111
|
+
/** The radius of the indicator circle */
|
|
112
|
+
indicatorRadius: number;
|
|
113
|
+
/** The stroke width for the indicator circle */
|
|
114
|
+
indicatorStrokeWidth: string;
|
|
115
|
+
/** The stroke width for the line */
|
|
116
|
+
lineStrokeWidth: string;
|
|
117
|
+
/** The dash array for the dashed line */
|
|
118
|
+
dashArray: string;
|
|
119
|
+
/** The stroke color of the line */
|
|
120
|
+
lineStroke: string;
|
|
121
|
+
/** The center X coordinate */
|
|
122
|
+
centerX: number;
|
|
123
|
+
/** The center Y coordinate */
|
|
124
|
+
centerY: number;
|
|
125
|
+
/** The X coordinate of the line endpoint */
|
|
126
|
+
lineEndpointX: number;
|
|
127
|
+
/** The Y coordinate of the line endpoint */
|
|
128
|
+
lineEndpointY: number;
|
|
129
|
+
/** The X coordinate where the line intersects the object's edge */
|
|
130
|
+
edgeX?: number;
|
|
131
|
+
/** The Y coordinate where the line intersects the object's edge */
|
|
132
|
+
edgeY?: number;
|
|
133
|
+
/** Arrow offset to apply to the edge point */
|
|
134
|
+
arrowOffset?: number;
|
|
135
|
+
/** Arrow style for the snapping endpoint */
|
|
136
|
+
arrowStyle?: 'triangle' | 'open' | 'diamond' | 'circle';
|
|
137
|
+
/** Arrow fill color */
|
|
138
|
+
arrowFill?: string;
|
|
139
|
+
/** The X coordinate for the end of the solid line part (accounting for arrow offset) */
|
|
140
|
+
solidLineEndX?: number;
|
|
141
|
+
/** The Y coordinate for the end of the solid line part (accounting for arrow offset) */
|
|
142
|
+
solidLineEndY?: number;
|
|
143
|
+
/** SVG points string for the arrow head at the edge */
|
|
144
|
+
arrowPoints?: string;
|
|
145
|
+
/** SVG path d string for the dashed line part (if curved) */
|
|
146
|
+
snapLinePath?: string;
|
|
147
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ThemeAwareColor } from '../constants/color-palette.constants';
|
|
2
|
+
/**
|
|
3
|
+
* Arrow head style types
|
|
4
|
+
*/
|
|
5
|
+
export type ArrowHeadStyle = 'triangle' | 'open' | 'diamond' | 'circle';
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for a single arrow head
|
|
8
|
+
*/
|
|
9
|
+
export interface ArrowHeadConfig {
|
|
10
|
+
/** Whether to display the arrow head */
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
/** Arrow head style (defaults to 'triangle') */
|
|
13
|
+
style?: ArrowHeadStyle;
|
|
14
|
+
/** Size of the arrow head in pixels (defaults to strokeWidth * 3) */
|
|
15
|
+
size?: number;
|
|
16
|
+
/** Fill color (defaults to stroke color of the line) */
|
|
17
|
+
fill?: ThemeAwareColor;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for arrow heads at both ends of a line
|
|
21
|
+
*/
|
|
22
|
+
export interface LineArrowConfig {
|
|
23
|
+
/** Arrow head at the start of the line */
|
|
24
|
+
start?: ArrowHeadConfig;
|
|
25
|
+
/** Arrow head at the end of the line */
|
|
26
|
+
end?: ArrowHeadConfig;
|
|
27
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { KritzelAsset } from './asset.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Distinguishes local-only asset providers (IndexedDB) from network providers
|
|
4
|
+
* (HTTP, presigned S3, etc.) that replicate assets across devices.
|
|
5
|
+
*/
|
|
6
|
+
export type AssetProviderType = 'local' | 'remote';
|
|
7
|
+
/**
|
|
8
|
+
* Metadata supplied when uploading a new asset. The provider is free to
|
|
9
|
+
* use or ignore hints (e.g. width/height) but MUST persist `mimeType`.
|
|
10
|
+
*/
|
|
11
|
+
export interface KritzelAssetPutMetadata {
|
|
12
|
+
mimeType: string;
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
durationMs?: number;
|
|
16
|
+
originalFilename?: string;
|
|
17
|
+
kind?: KritzelAsset['kind'];
|
|
18
|
+
/**
|
|
19
|
+
* Optional pre-assigned asset id. When provided, the provider should
|
|
20
|
+
* use this id instead of generating one. This allows the resolver to
|
|
21
|
+
* coordinate ids across a write-through (local + remote) pipeline.
|
|
22
|
+
*/
|
|
23
|
+
id?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Contract every asset storage provider implements.
|
|
27
|
+
*
|
|
28
|
+
* Providers are pluggable and may be combined in a chain (see AssetResolver).
|
|
29
|
+
* Local providers (e.g. IndexedDB) are always-on and serve as a cache and
|
|
30
|
+
* offline buffer. Remote providers replicate assets across devices so the
|
|
31
|
+
* Yjs CRDT can stay small (it only stores the asset id, not the bytes).
|
|
32
|
+
*/
|
|
33
|
+
export interface IAssetStorageProvider {
|
|
34
|
+
/** Whether this provider stores bytes locally or over the network. */
|
|
35
|
+
readonly type: AssetProviderType;
|
|
36
|
+
/** Human-readable provider name used in logs / diagnostics. */
|
|
37
|
+
readonly name: string;
|
|
38
|
+
/**
|
|
39
|
+
* Initializes the provider. Called once by the resolver before first use.
|
|
40
|
+
* Local providers typically open an IDB connection here; remote providers
|
|
41
|
+
* may perform a health check or no-op.
|
|
42
|
+
*/
|
|
43
|
+
init(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Destroys the provider and releases any held resources.
|
|
46
|
+
*/
|
|
47
|
+
destroy(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Returns true if this provider is capable of resolving the given asset id.
|
|
50
|
+
* Remote providers usually return true unconditionally (they don't know
|
|
51
|
+
* without a round-trip); local providers may return true only when the
|
|
52
|
+
* asset is actually cached.
|
|
53
|
+
*/
|
|
54
|
+
canResolve(id: string): boolean | Promise<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Persists the given bytes and returns the resulting asset descriptor.
|
|
57
|
+
* If `metadata.id` is provided, the provider MUST use that id.
|
|
58
|
+
*/
|
|
59
|
+
put(blob: Blob, metadata: KritzelAssetPutMetadata): Promise<KritzelAsset>;
|
|
60
|
+
/**
|
|
61
|
+
* Returns a URL usable directly as an `<img src>` / `<video src>`.
|
|
62
|
+
* Local providers typically return a `blob:` URL; remote providers return
|
|
63
|
+
* an HTTPS URL (possibly signed).
|
|
64
|
+
*/
|
|
65
|
+
resolve(id: string): Promise<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Returns the raw bytes for the given asset. Used for export flows that
|
|
68
|
+
* need to embed the bytes (e.g. SVG export with inline images).
|
|
69
|
+
*/
|
|
70
|
+
fetch(id: string): Promise<Blob>;
|
|
71
|
+
/**
|
|
72
|
+
* Optional deletion support. Providers without deletion (e.g. immutable
|
|
73
|
+
* CDNs) may omit this.
|
|
74
|
+
*/
|
|
75
|
+
delete?(id: string): Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Factory function type for creating asset provider instances.
|
|
79
|
+
* Mirrors the shape used by sync providers for consistency.
|
|
80
|
+
*/
|
|
81
|
+
export interface AssetProviderFactory {
|
|
82
|
+
create(): IAssetStorageProvider;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Configuration value accepted by `KritzelAssetStorageConfig.providers`:
|
|
86
|
+
* either a zero-arg class constructor or a factory object.
|
|
87
|
+
*/
|
|
88
|
+
export type AssetProviderConfig = (new () => IAssetStorageProvider) | AssetProviderFactory;
|