@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,981 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/**
|
|
4
|
+
* This is an autogenerated file created by the Stencil compiler.
|
|
5
|
+
* It contains typing information for all components that exist in this project.
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
+
import { KritzelCore } from "./classes/core/core.class";
|
|
9
|
+
import { KritzelWorkspace } from "./classes/core/workspace.class";
|
|
10
|
+
import { KritzelSyncConfig } from "./interfaces/sync-config.interface";
|
|
11
|
+
import { KritzelAssetStorageConfig } from "./interfaces/asset-storage-config.interface";
|
|
12
|
+
import { IKritzelUser } from "./interfaces/user.interface";
|
|
13
|
+
import { ContextMenuItem } from "./interfaces/context-menu-item.interface";
|
|
14
|
+
import { KritzelTheme, ThemeName } from "./interfaces/theme.interface";
|
|
15
|
+
import { KritzelLocale, KritzelTermKey, KritzelTermVars, LocaleCode } from "./interfaces/localization.interface";
|
|
16
|
+
import { KritzelDebugInfo } from "./interfaces/debug-info.interface";
|
|
17
|
+
import { KritzelEngineState } from "./interfaces/engine-state.interface";
|
|
18
|
+
import { KritzelBaseTool } from "./classes/tools/base-tool.class";
|
|
19
|
+
import { KritzelBaseObject } from "./classes/objects/base-object.class";
|
|
20
|
+
import { ObjectsAddedEvent, ObjectsInViewportChangeEvent, ObjectsRemovedEvent, ObjectsUpdatedEvent } from "./interfaces/object-change-event.interface";
|
|
21
|
+
import { KritzelUndoState } from "./interfaces/undo-state.interface";
|
|
22
|
+
import { KritzelViewportState } from "./interfaces/viewport-state.interface";
|
|
23
|
+
import { KritzelNotification } from "./interfaces/notification.interface";
|
|
24
|
+
import { KritzelContextMenuState } from "./interfaces/context-menu-state.interface";
|
|
25
|
+
import { KritzelBrushToolConfig, KritzelLineToolConfig, KritzelShapeToolConfig, KritzelTextToolConfig } from "./interfaces/toolbar-item.interface";
|
|
26
|
+
import { KritzelAlignment } from "./enums/alignment.enum";
|
|
27
|
+
import { Element, Event } from "./stencil-public-runtime";
|
|
28
|
+
import { KritzelImage } from "./classes/objects/image.class";
|
|
29
|
+
import { KritzelText } from "./classes/objects/text.class";
|
|
30
|
+
import { KritzelGroup } from "./classes/objects/group.class";
|
|
31
|
+
import { KritzelLine } from "./classes/objects/line.class";
|
|
32
|
+
import { KritzelShortcut } from "./interfaces/shortcut.interface";
|
|
33
|
+
import { KritzelObjectExportFormat } from "./interfaces/object-export.interface";
|
|
34
|
+
import { KritzelSettingsConfig } from "./interfaces/settings.interface";
|
|
35
|
+
export { KritzelCore } from "./classes/core/core.class";
|
|
36
|
+
export { KritzelWorkspace } from "./classes/core/workspace.class";
|
|
37
|
+
export { KritzelSyncConfig } from "./interfaces/sync-config.interface";
|
|
38
|
+
export { KritzelAssetStorageConfig } from "./interfaces/asset-storage-config.interface";
|
|
39
|
+
export { IKritzelUser } from "./interfaces/user.interface";
|
|
40
|
+
export { ContextMenuItem } from "./interfaces/context-menu-item.interface";
|
|
41
|
+
export { KritzelTheme, ThemeName } from "./interfaces/theme.interface";
|
|
42
|
+
export { KritzelLocale, KritzelTermKey, KritzelTermVars, LocaleCode } from "./interfaces/localization.interface";
|
|
43
|
+
export { KritzelDebugInfo } from "./interfaces/debug-info.interface";
|
|
44
|
+
export { KritzelEngineState } from "./interfaces/engine-state.interface";
|
|
45
|
+
export { KritzelBaseTool } from "./classes/tools/base-tool.class";
|
|
46
|
+
export { KritzelBaseObject } from "./classes/objects/base-object.class";
|
|
47
|
+
export { ObjectsAddedEvent, ObjectsInViewportChangeEvent, ObjectsRemovedEvent, ObjectsUpdatedEvent } from "./interfaces/object-change-event.interface";
|
|
48
|
+
export { KritzelUndoState } from "./interfaces/undo-state.interface";
|
|
49
|
+
export { KritzelViewportState } from "./interfaces/viewport-state.interface";
|
|
50
|
+
export { KritzelNotification } from "./interfaces/notification.interface";
|
|
51
|
+
export { KritzelContextMenuState } from "./interfaces/context-menu-state.interface";
|
|
52
|
+
export { KritzelBrushToolConfig, KritzelLineToolConfig, KritzelShapeToolConfig, KritzelTextToolConfig } from "./interfaces/toolbar-item.interface";
|
|
53
|
+
export { KritzelAlignment } from "./enums/alignment.enum";
|
|
54
|
+
export { Element, Event } from "./stencil-public-runtime";
|
|
55
|
+
export { KritzelImage } from "./classes/objects/image.class";
|
|
56
|
+
export { KritzelText } from "./classes/objects/text.class";
|
|
57
|
+
export { KritzelGroup } from "./classes/objects/group.class";
|
|
58
|
+
export { KritzelLine } from "./classes/objects/line.class";
|
|
59
|
+
export { KritzelShortcut } from "./interfaces/shortcut.interface";
|
|
60
|
+
export { KritzelObjectExportFormat } from "./interfaces/object-export.interface";
|
|
61
|
+
export { KritzelSettingsConfig } from "./interfaces/settings.interface";
|
|
62
|
+
export namespace Components {
|
|
63
|
+
interface KritzelAwarenessCursors {
|
|
64
|
+
"core": KritzelCore;
|
|
65
|
+
/**
|
|
66
|
+
* @default 8
|
|
67
|
+
*/
|
|
68
|
+
"edgeIndicatorPadding": number;
|
|
69
|
+
/**
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
"showEdgeIndicators": boolean;
|
|
73
|
+
}
|
|
74
|
+
interface KritzelCursorTrail {
|
|
75
|
+
"core": KritzelCore;
|
|
76
|
+
}
|
|
77
|
+
interface KritzelEngine {
|
|
78
|
+
/**
|
|
79
|
+
* Optional workspace ID to load. If provided, the engine will look up and load this workspace by ID.
|
|
80
|
+
*/
|
|
81
|
+
"activeWorkspaceId"?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Adds a new object to the canvas. The object will be assigned an ID, core reference, and z-index automatically.
|
|
84
|
+
* @param object - The object instance to add.
|
|
85
|
+
* @returns The added object.
|
|
86
|
+
*/
|
|
87
|
+
"addObject": <T extends KritzelBaseObject>(object: T) => Promise<T | null>;
|
|
88
|
+
/**
|
|
89
|
+
* Adds multiple objects to the canvas in a single batch operation. All objects are inserted within one Yjs transaction (single undo step), triggering only one rerender cycle. Intended for programmatic streaming scenarios where per-object overhead would cause stutter.
|
|
90
|
+
* @param objects - The object instances to add.
|
|
91
|
+
* @returns The added objects.
|
|
92
|
+
*/
|
|
93
|
+
"addObjects": <T extends KritzelBaseObject>(objects: T[]) => Promise<T[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Aligns the currently selected objects according to the specified alignment.
|
|
96
|
+
* @param alignment - The alignment direction (e.g., `CenterHorizontal`, `StartVertical`).
|
|
97
|
+
*/
|
|
98
|
+
"alignObjects": (alignment: KritzelAlignment) => Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Configuration for binary asset storage (e.g., images). The Yjs document only persists asset ids; the actual bytes are stored by the providers listed here. Defaults to IndexedDB-only storage. To support cross-device image sync alongside a networked sync provider (Hocuspocus, WebSocket), configure at least one remote asset provider such as `HttpAssetProvider` or `PresignedAssetProvider`.
|
|
101
|
+
*/
|
|
102
|
+
"assetStorageConfig"?: KritzelAssetStorageConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Pans and zooms the viewport to fit the nearest content, with padding. Useful when the user has panned away from all objects.
|
|
105
|
+
* @returns `true` if content was found and the viewport was adjusted, `false` otherwise.
|
|
106
|
+
*/
|
|
107
|
+
"backToContent": () => Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Starts a scene bootstrap phase by hiding the scene immediately.
|
|
110
|
+
*/
|
|
111
|
+
"beginSceneBootstrap": () => Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Moves an object one layer forward in the z-order.
|
|
114
|
+
* @param object - The object to move. If omitted, applies to the current selection.
|
|
115
|
+
*/
|
|
116
|
+
"bringForward": (object?: KritzelBaseObject<any>) => Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Moves an object to the very front of the z-order.
|
|
119
|
+
* @param object - The object to move. If omitted, applies to the current selection.
|
|
120
|
+
*/
|
|
121
|
+
"bringToFront": (object?: KritzelBaseObject<any>) => Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Checks whether the currently selected object supports a specific export format. Returns false when none or multiple objects are selected.
|
|
124
|
+
*/
|
|
125
|
+
"canExportSelectedObjectAs": (format: KritzelObjectExportFormat) => Promise<boolean>;
|
|
126
|
+
/**
|
|
127
|
+
* Cancels an active file picker opened by importFromFile.
|
|
128
|
+
*/
|
|
129
|
+
"cancelImportFromFile": () => Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Pans and zooms the viewport to fit ALL objects on the canvas, including those not currently rendered. Calculates the combined bounding box of all objects and centers the viewport to show them.
|
|
132
|
+
* @param animate - Whether to animate the viewport transition (default: true).
|
|
133
|
+
* @returns `true` if objects were found and the viewport was adjusted, `false` otherwise.
|
|
134
|
+
*/
|
|
135
|
+
"centerAllObjects": (animate?: boolean) => Promise<boolean>;
|
|
136
|
+
/**
|
|
137
|
+
* Pans and zooms the viewport to center on the given object.
|
|
138
|
+
* @param object - The object to center in the viewport.
|
|
139
|
+
* @returns The centered object.
|
|
140
|
+
*/
|
|
141
|
+
"centerObjectInViewport": (object: KritzelBaseObject) => Promise<KritzelBaseObject<HTMLElement | SVGElement>>;
|
|
142
|
+
/**
|
|
143
|
+
* Pans and zooms the viewport to fit the provided objects. Calculates the combined bounding box of the given objects and centers the viewport to show them.
|
|
144
|
+
* @param objects - The objects to center and fit in the viewport.
|
|
145
|
+
* @param animate - Whether to animate the viewport transition (default: true).
|
|
146
|
+
* @returns `true` if objects were provided and the viewport was adjusted, `false` otherwise.
|
|
147
|
+
*/
|
|
148
|
+
"centerObjects": (objects: KritzelBaseObject[], animate?: boolean) => Promise<boolean>;
|
|
149
|
+
/**
|
|
150
|
+
* Switches the active drawing tool by its registered name.
|
|
151
|
+
* @param toolName - The name the tool was registered with (e.g., 'brush', 'eraser').
|
|
152
|
+
*/
|
|
153
|
+
"changeActiveTool": (toolName: string) => Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Deselects all currently selected objects.
|
|
156
|
+
*/
|
|
157
|
+
"clearSelection": () => Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Declaratively configures the full locale catalog, replacing the available locale set. Pass `undefined` to restore the built-in locales (en/de/fr).
|
|
160
|
+
* @param locales - The full locale catalog, or `undefined` for built-ins.
|
|
161
|
+
*/
|
|
162
|
+
"configureLocales": (locales?: KritzelLocale[]) => Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Copies the currently selected objects to the internal clipboard.
|
|
165
|
+
*/
|
|
166
|
+
"copy": () => Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Creates a new workspace and emits a `workspacesChange` event. Emits `activeWorkspaceChange` if the created workspace is activated.
|
|
169
|
+
* @param workspace - The workspace instance to create.
|
|
170
|
+
* @returns The created workspace.
|
|
171
|
+
*/
|
|
172
|
+
"createWorkspace": (workspace: KritzelWorkspace) => Promise<KritzelWorkspace | null>;
|
|
173
|
+
/**
|
|
174
|
+
* The HTML element to apply cursor styles to. Defaults to `document.body` if not set.
|
|
175
|
+
*/
|
|
176
|
+
"cursorTarget"?: HTMLElement;
|
|
177
|
+
/**
|
|
178
|
+
* Cuts the currently selected objects to the internal clipboard (deletes them from the canvas).
|
|
179
|
+
*/
|
|
180
|
+
"cut": () => Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Debug info display options controlling which debug overlays are visible
|
|
183
|
+
*/
|
|
184
|
+
"debugInfo"?: KritzelDebugInfo;
|
|
185
|
+
/**
|
|
186
|
+
* Deletes the currently selected objects from the canvas.
|
|
187
|
+
*/
|
|
188
|
+
"delete": () => Promise<void>;
|
|
189
|
+
/**
|
|
190
|
+
* Deletes a workspace and emits a `workspacesChange` event.
|
|
191
|
+
* @param workspace - The workspace to delete.
|
|
192
|
+
*/
|
|
193
|
+
"deleteWorkspace": (workspace: KritzelWorkspace) => Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Disables all user interaction with the engine (pointer, keyboard, etc.).
|
|
196
|
+
*/
|
|
197
|
+
"disable": () => Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Exports the current workspace as a JSON file and triggers a browser download.
|
|
200
|
+
* @param filename - Optional custom filename (without extension). Defaults to workspace name with timestamp.
|
|
201
|
+
*/
|
|
202
|
+
"downloadAsJson": (filename?: string) => Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* Optional unique identifier for namespacing storage keys across multiple editor instances.
|
|
205
|
+
*/
|
|
206
|
+
"editorId"?: string;
|
|
207
|
+
/**
|
|
208
|
+
* Re-enables user interaction after a call to `disable()`.
|
|
209
|
+
*/
|
|
210
|
+
"enable": () => Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Ends a scene bootstrap phase by fading the scene back in.
|
|
213
|
+
*/
|
|
214
|
+
"endSceneBootstrap": () => Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* Exports the current workspace and all its objects as a JSON string. The exported data includes workspace metadata (id, name, viewport) and all canvas objects.
|
|
217
|
+
* @returns A JSON string representing the complete workspace state.
|
|
218
|
+
*/
|
|
219
|
+
"exportAsJson": () => Promise<string>;
|
|
220
|
+
/**
|
|
221
|
+
* Exports the currently selected object in the requested format and triggers a file download. Only supports single selection.
|
|
222
|
+
*/
|
|
223
|
+
"exportSelectedObject": (format: KritzelObjectExportFormat) => Promise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* Exports the current viewport as a PNG file and triggers a browser download.
|
|
226
|
+
*/
|
|
227
|
+
"exportViewportAsPng": () => Promise<void>;
|
|
228
|
+
/**
|
|
229
|
+
* Exports the current viewport as an SVG file and triggers a browser download.
|
|
230
|
+
*/
|
|
231
|
+
"exportViewportAsSvg": () => Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* The locale used to resolve terms missing from the active locale.
|
|
234
|
+
* @default 'en'
|
|
235
|
+
*/
|
|
236
|
+
"fallbackLocale": LocaleCode;
|
|
237
|
+
/**
|
|
238
|
+
* Returns all objects that match the given predicate function. Excludes internal selection-related objects (selection groups and selection boxes).
|
|
239
|
+
* @param predicate - A filter function called for each object. Return `true` to include.
|
|
240
|
+
* @returns An array of matching objects.
|
|
241
|
+
* @example ```ts // Find all text objects const texts = await engine.findObjects(obj => obj.__class__ === 'KritzelText'); // Find objects at a point const hits = await engine.findObjects(obj => obj.hitTest(100, 200)); // Combine criteria const filtered = await engine.findObjects(obj => obj.__class__ === 'KritzelPath' && obj.opacity < 0.5); ```
|
|
242
|
+
*/
|
|
243
|
+
"findObjects": <T extends KritzelBaseObject>(predicate: (obj: KritzelBaseObject<Element>) => boolean) => Promise<T[]>;
|
|
244
|
+
/**
|
|
245
|
+
* Returns the currently active workspace.
|
|
246
|
+
*/
|
|
247
|
+
"getActiveWorkspace": () => Promise<KritzelWorkspace>;
|
|
248
|
+
/**
|
|
249
|
+
* Returns all objects on the canvas across all layers.
|
|
250
|
+
*/
|
|
251
|
+
"getAllObjects": <T extends KritzelBaseObject>() => Promise<T[]>;
|
|
252
|
+
/**
|
|
253
|
+
* Gets the list of available locales as `{ code, label }` options for a selector.
|
|
254
|
+
*/
|
|
255
|
+
"getAvailableLocaleOptions": () => Promise<{ code: LocaleCode; label: string; }[]>;
|
|
256
|
+
/**
|
|
257
|
+
* Gets the list of available locale codes (built-in and registered).
|
|
258
|
+
*/
|
|
259
|
+
"getAvailableLocales": () => Promise<LocaleCode[]>;
|
|
260
|
+
/**
|
|
261
|
+
* Returns all registered keyboard shortcuts (without action/condition) for display in a help UI.
|
|
262
|
+
*/
|
|
263
|
+
"getDisplayableShortcuts": () => Promise<Omit<KritzelShortcut, "action" | "condition">[]>;
|
|
264
|
+
/**
|
|
265
|
+
* Gets whether the active workspace is publicly accessible.
|
|
266
|
+
* @returns True if the workspace is public, false otherwise
|
|
267
|
+
*/
|
|
268
|
+
"getIsPublic": () => Promise<boolean>;
|
|
269
|
+
/**
|
|
270
|
+
* Gets the currently active locale code.
|
|
271
|
+
*/
|
|
272
|
+
"getLocale": () => Promise<LocaleCode>;
|
|
273
|
+
/**
|
|
274
|
+
* Retrieves a canvas object by its unique ID.
|
|
275
|
+
* @param id - The object's unique identifier.
|
|
276
|
+
* @returns The matching object, or `null` if not found.
|
|
277
|
+
*/
|
|
278
|
+
"getObjectById": <T extends KritzelBaseObject>(id: string) => Promise<T | null>;
|
|
279
|
+
/**
|
|
280
|
+
* Returns all objects currently visible within the viewport bounds.
|
|
281
|
+
*/
|
|
282
|
+
"getObjectsInViewport": () => Promise<KritzelBaseObject[]>;
|
|
283
|
+
/**
|
|
284
|
+
* Returns the total number of objects on the canvas.
|
|
285
|
+
*/
|
|
286
|
+
"getObjectsTotalCount": () => Promise<number>;
|
|
287
|
+
/**
|
|
288
|
+
* Resolves every known term key for the active locale into a flat map. Useful for UI layers that need to localize many strings at once.
|
|
289
|
+
*/
|
|
290
|
+
"getResolvedTerms": () => Promise<Partial<Record<KritzelTermKey, string>>>;
|
|
291
|
+
/**
|
|
292
|
+
* Captures a screenshot of the current viewport as a data URL.
|
|
293
|
+
* @param format - The image format: `'png'` (default) or `'svg'`.
|
|
294
|
+
* @returns A data URL string of the captured image.
|
|
295
|
+
*/
|
|
296
|
+
"getScreenshot": (format?: "png" | "svg") => Promise<string | null>;
|
|
297
|
+
/**
|
|
298
|
+
* Returns export formats supported by the currently selected object. Only returns formats when exactly one object is selected.
|
|
299
|
+
*/
|
|
300
|
+
"getSelectedObjectSupportedExportFormats": () => Promise<KritzelObjectExportFormat[]>;
|
|
301
|
+
/**
|
|
302
|
+
* Returns the currently selected objects. Returns an empty array if nothing is selected.
|
|
303
|
+
*/
|
|
304
|
+
"getSelectedObjects": () => Promise<KritzelBaseObject<any>[]>;
|
|
305
|
+
/**
|
|
306
|
+
* Returns the current viewport state including position, scale, and dimensions.
|
|
307
|
+
* @returns The current viewport state.
|
|
308
|
+
*/
|
|
309
|
+
"getViewport": () => Promise<KritzelViewportState>;
|
|
310
|
+
/**
|
|
311
|
+
* Returns all available workspaces.
|
|
312
|
+
*/
|
|
313
|
+
"getWorkspaces": () => Promise<KritzelWorkspace[]>;
|
|
314
|
+
/**
|
|
315
|
+
* Context menu items shown when right-clicking the canvas background.
|
|
316
|
+
*/
|
|
317
|
+
"globalContextMenuItems"?: ContextMenuItem[];
|
|
318
|
+
/**
|
|
319
|
+
* Groups the currently selected objects into a single selection group.
|
|
320
|
+
*/
|
|
321
|
+
"group": () => Promise<void>;
|
|
322
|
+
/**
|
|
323
|
+
* Hides the context menu and resets any associated selection state.
|
|
324
|
+
*/
|
|
325
|
+
"hideContextMenu": () => Promise<void>;
|
|
326
|
+
/**
|
|
327
|
+
* Opens a file picker dialog and imports the selected JSON file into the workspace. This method creates a hidden file input, triggers the browser's file chooser, reads the selected JSON file, and imports it using importFromJson.
|
|
328
|
+
* @returns A promise that resolves when the import is complete or rejects on error/cancel.
|
|
329
|
+
*/
|
|
330
|
+
"importFromFile": () => Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Imports a workspace from a JSON string into a new workspace. Creates a new workspace with the imported data and automatically switches to it.
|
|
333
|
+
* @param json - A JSON string containing workspace data (from exportAsJson).
|
|
334
|
+
* @throws Error if the JSON is invalid or the format version is incompatible.
|
|
335
|
+
*/
|
|
336
|
+
"importFromJson": (json: string) => Promise<void>;
|
|
337
|
+
/**
|
|
338
|
+
* When false, non-modified wheel events do not pan the viewport.
|
|
339
|
+
* @default true
|
|
340
|
+
*/
|
|
341
|
+
"isPanningEnabled": boolean;
|
|
342
|
+
/**
|
|
343
|
+
* When false, Ctrl+wheel events do not zoom the viewport.
|
|
344
|
+
* @default true
|
|
345
|
+
*/
|
|
346
|
+
"isZoomingEnabled": boolean;
|
|
347
|
+
/**
|
|
348
|
+
* License key that, when valid, removes the "Powered by Kritzel" watermark.
|
|
349
|
+
*/
|
|
350
|
+
"licenseKey"?: string;
|
|
351
|
+
/**
|
|
352
|
+
* Loads objects from a workspace JSON string into the current workspace. Unlike importFromJson, this does not create a new workspace - it adds objects to the existing one. Useful for initializing a workspace with pre-existing content after the editor is ready.
|
|
353
|
+
* @param json - A JSON string containing workspace data (from exportAsJson).
|
|
354
|
+
* @returns The number of objects loaded.
|
|
355
|
+
* @throws Error if the JSON is invalid or the format version is incompatible.
|
|
356
|
+
*/
|
|
357
|
+
"loadObjectsFromJson": (json: string) => Promise<number>;
|
|
358
|
+
/**
|
|
359
|
+
* Loads the persisted settings object from localStorage.
|
|
360
|
+
* @returns The stored settings, or null if nothing is stored or the value is invalid.
|
|
361
|
+
*/
|
|
362
|
+
"loadSettings": () => Promise<Partial<KritzelSettingsConfig> | null>;
|
|
363
|
+
/**
|
|
364
|
+
* Loads a shared workspace by token. If the workspace exists locally, it switches to it. If it doesn't exist, it adds it to the local workspaces list and then switches to it.
|
|
365
|
+
* @param token - The connection token identifying the shared workspace
|
|
366
|
+
*/
|
|
367
|
+
"loadSharedWorkspace": (token: string) => Promise<void>;
|
|
368
|
+
/**
|
|
369
|
+
* The current locale (language) code to apply to the editor, e.g. 'en', 'de', 'fr'.
|
|
370
|
+
* @default 'en'
|
|
371
|
+
*/
|
|
372
|
+
"locale": LocaleCode;
|
|
373
|
+
/**
|
|
374
|
+
* An array of available locale definitions (with optional partial term overrides). Replaces the built-in locale set (en/de/fr) when provided, even if empty.
|
|
375
|
+
*/
|
|
376
|
+
"locales"?: KritzelLocale[];
|
|
377
|
+
/**
|
|
378
|
+
* When true, objects are drawn at a fixed visual size regardless of zoom level
|
|
379
|
+
* @default true
|
|
380
|
+
*/
|
|
381
|
+
"lockDrawingScale": boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Context menu items shown when right-clicking a selected object.
|
|
384
|
+
*/
|
|
385
|
+
"objectContextMenuItems"?: ContextMenuItem[];
|
|
386
|
+
/**
|
|
387
|
+
* Programmatically opens the context menu at a specified world-coordinate position. If `objectId` is provided and found, the object context menu is shown for that object. If no `objectId` is provided but a selection group already exists, the object context menu is shown. Otherwise, the global context menu is shown.
|
|
388
|
+
* @param options.x - The X position in world (canvas) coordinates.
|
|
389
|
+
* @param options.y - The Y position in world (canvas) coordinates.
|
|
390
|
+
* @param options.objectId - Optional ID of an object to select and show the object context menu for.
|
|
391
|
+
*/
|
|
392
|
+
"openContextMenu": (options: { x: number; y: number; objectId?: string; }) => Promise<void>;
|
|
393
|
+
/**
|
|
394
|
+
* Pans the viewport to center on the given world coordinates without changing the scale.
|
|
395
|
+
* @param x - X position in world coordinates to center on.
|
|
396
|
+
* @param y - Y position in world coordinates to center on.
|
|
397
|
+
*/
|
|
398
|
+
"panTo": (x: number, y: number) => Promise<void>;
|
|
399
|
+
/**
|
|
400
|
+
* Pans the viewport to center on the given object without changing the zoom level. Unlike `centerObjectInViewport`, this moves the camera — not the object.
|
|
401
|
+
* @param object - The object whose center the viewport should pan to.
|
|
402
|
+
*/
|
|
403
|
+
"panToObject": (object: KritzelBaseObject) => Promise<void>;
|
|
404
|
+
/**
|
|
405
|
+
* Pastes previously copied objects at the specified world coordinates.
|
|
406
|
+
* @param x - X position in world coordinates.
|
|
407
|
+
* @param y - Y position in world coordinates.
|
|
408
|
+
*/
|
|
409
|
+
"paste": (x: number, y: number) => Promise<void>;
|
|
410
|
+
/**
|
|
411
|
+
* Redoes the last undone action.
|
|
412
|
+
*/
|
|
413
|
+
"redo": () => Promise<void>;
|
|
414
|
+
/**
|
|
415
|
+
* Registers additional locale definitions (with optional partial term overrides).
|
|
416
|
+
* @param locales - The locale definitions to register.
|
|
417
|
+
*/
|
|
418
|
+
"registerLocales": (locales: KritzelLocale[]) => Promise<void>;
|
|
419
|
+
/**
|
|
420
|
+
* Registers a new drawing tool with the engine.
|
|
421
|
+
* @param toolName - Unique identifier for the tool (e.g., 'brush', 'eraser').
|
|
422
|
+
* @param toolClass - Constructor class extending `KritzelBaseTool`.
|
|
423
|
+
* @param toolConfig - Optional initial configuration to apply to the tool instance.
|
|
424
|
+
* @returns The registered tool instance, or `null` if registration failed.
|
|
425
|
+
*/
|
|
426
|
+
"registerTool": (toolName: string, toolClass: any, toolConfig?: KritzelTextToolConfig | KritzelBrushToolConfig | KritzelLineToolConfig | KritzelShapeToolConfig) => Promise<KritzelBaseTool | null>;
|
|
427
|
+
/**
|
|
428
|
+
* Reinitializes sync by performing a full teardown and re-initialization. Destroys the current Yjs documents and providers, then rebuilds everything from the current syncConfig. Data reloads from IndexedDB nearly instantly. Call this after updating the syncConfig prop (e.g. after authentication state changes).
|
|
429
|
+
*/
|
|
430
|
+
"reinitSync": () => Promise<void>;
|
|
431
|
+
/**
|
|
432
|
+
* Removes an object from the canvas.
|
|
433
|
+
* @param object - The object to remove.
|
|
434
|
+
* @returns The removed object.
|
|
435
|
+
*/
|
|
436
|
+
"removeObject": <T extends KritzelBaseObject>(object: T) => Promise<T | null>;
|
|
437
|
+
/**
|
|
438
|
+
* Removes multiple objects from the canvas in a single batch operation. All removals happen within one Yjs transaction (single undo step), triggering only one rerender cycle. Intended for programmatic streaming scenarios where per-object overhead would cause stutter.
|
|
439
|
+
* @param objects - The objects to remove.
|
|
440
|
+
* @returns The removed objects.
|
|
441
|
+
*/
|
|
442
|
+
"removeObjects": <T extends KritzelBaseObject>(objects: T[]) => Promise<T[]>;
|
|
443
|
+
/**
|
|
444
|
+
* Persists the given settings object to localStorage using the namespaced storage key.
|
|
445
|
+
* @param settings - The settings configuration to persist.
|
|
446
|
+
*/
|
|
447
|
+
"saveSettings": (settings: KritzelSettingsConfig) => Promise<void>;
|
|
448
|
+
/**
|
|
449
|
+
* Maximum zoom scale allowed. Clamped to the absolute maximum defined by the engine.
|
|
450
|
+
* @default 1000
|
|
451
|
+
*/
|
|
452
|
+
"scaleMax": number;
|
|
453
|
+
/**
|
|
454
|
+
* Minimum zoom scale allowed. Clamped to the absolute minimum defined by the engine.
|
|
455
|
+
* @default 0.0001
|
|
456
|
+
*/
|
|
457
|
+
"scaleMin": number;
|
|
458
|
+
/**
|
|
459
|
+
* Converts screen-relative pixel coordinates to world coordinates.
|
|
460
|
+
* @param x - X position in screen pixels (relative to the engine element).
|
|
461
|
+
* @param y - Y position in screen pixels (relative to the engine element).
|
|
462
|
+
* @returns World coordinates { x, y }.
|
|
463
|
+
*/
|
|
464
|
+
"screenToWorld": (x: number, y: number) => Promise<{ x: number; y: number; }>;
|
|
465
|
+
/**
|
|
466
|
+
* Selects all objects currently visible in the viewport. Switches to the selection tool automatically.
|
|
467
|
+
*/
|
|
468
|
+
"selectAllObjectsInViewport": () => Promise<void>;
|
|
469
|
+
/**
|
|
470
|
+
* Programmatically selects the given objects. Switches to the selection tool automatically.
|
|
471
|
+
* @param objects - The objects to select.
|
|
472
|
+
*/
|
|
473
|
+
"selectObjects": (objects: KritzelBaseObject[]) => Promise<void>;
|
|
474
|
+
/**
|
|
475
|
+
* Moves an object one layer backward in the z-order.
|
|
476
|
+
* @param object - The object to move. If omitted, applies to the current selection.
|
|
477
|
+
*/
|
|
478
|
+
"sendBackward": (object?: KritzelBaseObject<any>) => Promise<void>;
|
|
479
|
+
/**
|
|
480
|
+
* Moves an object to the very back of the z-order.
|
|
481
|
+
* @param object - The object to move. If omitted, applies to the current selection.
|
|
482
|
+
*/
|
|
483
|
+
"sendToBack": (object?: KritzelBaseObject<any>) => Promise<void>;
|
|
484
|
+
/**
|
|
485
|
+
* Switches the active workspace in the engine by ID.
|
|
486
|
+
* @param id - The unique ID of the workspace to activate
|
|
487
|
+
*/
|
|
488
|
+
"setActiveWorkspace": (id: string) => Promise<void>;
|
|
489
|
+
/**
|
|
490
|
+
* Sets the active locale (language) and re-renders the UI.
|
|
491
|
+
* @param code - The locale code to activate, e.g. 'de'.
|
|
492
|
+
*/
|
|
493
|
+
"setLocale": (code: LocaleCode) => Promise<void>;
|
|
494
|
+
/**
|
|
495
|
+
* Sets the viewport to center on the given world coordinates at the specified scale.
|
|
496
|
+
* @param x - X position in world coordinates to center on.
|
|
497
|
+
* @param y - Y position in world coordinates to center on.
|
|
498
|
+
* @param scale - Target scale level.
|
|
499
|
+
*/
|
|
500
|
+
"setViewport": (x: number, y: number, scale: number) => Promise<void>;
|
|
501
|
+
/**
|
|
502
|
+
* Configuration for real-time synchronization providers (e.g., IndexedDB, WebSocket).
|
|
503
|
+
*/
|
|
504
|
+
"syncConfig"?: KritzelSyncConfig;
|
|
505
|
+
/**
|
|
506
|
+
* Resolves a term key to its translated string for the active locale.
|
|
507
|
+
* @param key - The term key to resolve.
|
|
508
|
+
* @param vars - Optional values for `{placeholder}` interpolation.
|
|
509
|
+
*/
|
|
510
|
+
"t": (key: KritzelTermKey, vars?: KritzelTermVars) => Promise<string>;
|
|
511
|
+
/**
|
|
512
|
+
* The current theme to apply to the editor
|
|
513
|
+
* @default 'light'
|
|
514
|
+
*/
|
|
515
|
+
"theme": ThemeName;
|
|
516
|
+
/**
|
|
517
|
+
* An array of available themes for the editor.
|
|
518
|
+
*/
|
|
519
|
+
"themes"?: KritzelTheme[];
|
|
520
|
+
/**
|
|
521
|
+
* Manually triggers the `objectsSelectionChange` event.
|
|
522
|
+
*/
|
|
523
|
+
"triggerSelectionChange": () => Promise<void>;
|
|
524
|
+
/**
|
|
525
|
+
* Undoes the last action.
|
|
526
|
+
*/
|
|
527
|
+
"undo": () => Promise<void>;
|
|
528
|
+
/**
|
|
529
|
+
* Ungroups the currently selected group back into individual objects.
|
|
530
|
+
*/
|
|
531
|
+
"ungroup": () => Promise<void>;
|
|
532
|
+
/**
|
|
533
|
+
* Updates properties of an existing canvas object.
|
|
534
|
+
* @param object - The object to update.
|
|
535
|
+
* @param updatedProperties - A partial set of properties to apply.
|
|
536
|
+
* @returns The updated object.
|
|
537
|
+
*/
|
|
538
|
+
"updateObject": <T extends KritzelBaseObject>(object: T, updatedProperties: Partial<T>) => Promise<T | null>;
|
|
539
|
+
/**
|
|
540
|
+
* Applies a workspace as declared and emits a `workspacesChange` event. Metadata and viewport are always applied. When `workspace.objects` is set it is treated as the complete desired object set (`undefined` leaves objects untouched, `[]` removes them all); updating objects of a non-active workspace requires a configured sync provider.
|
|
541
|
+
* @param workspace - The workspace describing the desired state.
|
|
542
|
+
*/
|
|
543
|
+
"updateWorkspace": (workspace: KritzelWorkspace) => Promise<void>;
|
|
544
|
+
/**
|
|
545
|
+
* The current user for awareness broadcasting (name, id, cursor position).
|
|
546
|
+
*/
|
|
547
|
+
"user"?: IKritzelUser;
|
|
548
|
+
/**
|
|
549
|
+
* Bottom boundary of the viewport in world coordinates. Objects beyond this Y position cannot be panned to.
|
|
550
|
+
* @default Infinity
|
|
551
|
+
*/
|
|
552
|
+
"viewportBoundaryBottom": number;
|
|
553
|
+
/**
|
|
554
|
+
* Left boundary of the viewport in world coordinates. Objects beyond this X position cannot be panned to.
|
|
555
|
+
* @default -Infinity
|
|
556
|
+
*/
|
|
557
|
+
"viewportBoundaryLeft": number;
|
|
558
|
+
/**
|
|
559
|
+
* Right boundary of the viewport in world coordinates. Objects beyond this X position cannot be panned to.
|
|
560
|
+
* @default Infinity
|
|
561
|
+
*/
|
|
562
|
+
"viewportBoundaryRight": number;
|
|
563
|
+
/**
|
|
564
|
+
* Top boundary of the viewport in world coordinates. Objects beyond this Y position cannot be panned to.
|
|
565
|
+
* @default -Infinity
|
|
566
|
+
*/
|
|
567
|
+
"viewportBoundaryTop": number;
|
|
568
|
+
/**
|
|
569
|
+
* Authoritative workspace catalog for this engine instance. When provided, provider-only workspaces are hidden but not deleted.
|
|
570
|
+
*/
|
|
571
|
+
"workspaces"?: KritzelWorkspace[];
|
|
572
|
+
/**
|
|
573
|
+
* Converts world coordinates to screen-relative pixel coordinates.
|
|
574
|
+
* @param x - X position in world coordinates.
|
|
575
|
+
* @param y - Y position in world coordinates.
|
|
576
|
+
* @returns Screen coordinates { x, y } relative to the engine element.
|
|
577
|
+
*/
|
|
578
|
+
"worldToScreen": (x: number, y: number) => Promise<{ x: number; y: number; }>;
|
|
579
|
+
/**
|
|
580
|
+
* Zooms in by a fixed step, centered on the current viewport center, with a smooth animation.
|
|
581
|
+
* @param factor - Multiplicative zoom-in step.
|
|
582
|
+
* @param duration - Animation duration in milliseconds.
|
|
583
|
+
*/
|
|
584
|
+
"zoomIn": (factor: number, duration: number) => Promise<void>;
|
|
585
|
+
/**
|
|
586
|
+
* Zooms out by a fixed step, centered on the current viewport center, with a smooth animation.
|
|
587
|
+
* @param factor - Multiplicative zoom-out step.
|
|
588
|
+
* @param duration - Animation duration in milliseconds.
|
|
589
|
+
*/
|
|
590
|
+
"zoomOut": (factor: number, duration: number) => Promise<void>;
|
|
591
|
+
/**
|
|
592
|
+
* Zooms the viewport to the given scale level. Optionally centers on a world point; if omitted, zooms around the viewport center.
|
|
593
|
+
* @param scale - Target scale level.
|
|
594
|
+
* @param worldX - Optional X position in world coordinates to center on.
|
|
595
|
+
* @param worldY - Optional Y position in world coordinates to center on.
|
|
596
|
+
*/
|
|
597
|
+
"zoomTo": (scale: number, worldX?: number, worldY?: number) => Promise<void>;
|
|
598
|
+
}
|
|
599
|
+
interface KritzelIcon {
|
|
600
|
+
"label"?: string;
|
|
601
|
+
"name": string;
|
|
602
|
+
/**
|
|
603
|
+
* @default 24
|
|
604
|
+
*/
|
|
605
|
+
"size": number;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* "Powered by Kritzel" watermark shown in the bottom-right corner of the engine
|
|
609
|
+
* when the editor is not licensed.
|
|
610
|
+
* Rendered inside the engine's Shadow DOM and gated by the license manager on
|
|
611
|
+
* the engine's reactive render path, so removing the node simply causes it to
|
|
612
|
+
* reappear on the next render. The badge links to the Kritzel website.
|
|
613
|
+
*/
|
|
614
|
+
interface KritzelWatermark {
|
|
615
|
+
/**
|
|
616
|
+
* The core instance used to resolve localized terms.
|
|
617
|
+
*/
|
|
618
|
+
"core": KritzelCore;
|
|
619
|
+
/**
|
|
620
|
+
* Resolved "Powered by Kritzel" label. Passed in by the engine so the badge re-renders when the active locale changes. Falls back to resolving the term from the core when not provided.
|
|
621
|
+
*/
|
|
622
|
+
"label"?: string;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
export interface KritzelEngineCustomEvent<T> extends CustomEvent<T> {
|
|
626
|
+
detail: T;
|
|
627
|
+
target: HTMLKritzelEngineElement;
|
|
628
|
+
}
|
|
629
|
+
declare global {
|
|
630
|
+
interface HTMLKritzelAwarenessCursorsElement extends Components.KritzelAwarenessCursors, HTMLStencilElement {
|
|
631
|
+
}
|
|
632
|
+
var HTMLKritzelAwarenessCursorsElement: {
|
|
633
|
+
prototype: HTMLKritzelAwarenessCursorsElement;
|
|
634
|
+
new (): HTMLKritzelAwarenessCursorsElement;
|
|
635
|
+
};
|
|
636
|
+
interface HTMLKritzelCursorTrailElement extends Components.KritzelCursorTrail, HTMLStencilElement {
|
|
637
|
+
}
|
|
638
|
+
var HTMLKritzelCursorTrailElement: {
|
|
639
|
+
prototype: HTMLKritzelCursorTrailElement;
|
|
640
|
+
new (): HTMLKritzelCursorTrailElement;
|
|
641
|
+
};
|
|
642
|
+
interface HTMLKritzelEngineElementEventMap {
|
|
643
|
+
"isEngineReady": KritzelEngineState;
|
|
644
|
+
"activeToolChange": KritzelBaseTool;
|
|
645
|
+
"workspacesChange": KritzelWorkspace[];
|
|
646
|
+
"activeWorkspaceChange": KritzelWorkspace;
|
|
647
|
+
"longpress": PointerEvent;
|
|
648
|
+
"objectsChange": KritzelBaseObject[];
|
|
649
|
+
"objectsAdded": ObjectsAddedEvent;
|
|
650
|
+
"objectsRemoved": ObjectsRemovedEvent;
|
|
651
|
+
"objectsUpdated": ObjectsUpdatedEvent;
|
|
652
|
+
"objectsSelectionChange": KritzelBaseObject[];
|
|
653
|
+
"undoStateChange": KritzelUndoState;
|
|
654
|
+
"objectsInViewportChange": ObjectsInViewportChangeEvent;
|
|
655
|
+
"viewportChange": KritzelViewportState;
|
|
656
|
+
"awarenessChange": Map<number, Record<string, any>>;
|
|
657
|
+
"notificationsChange": KritzelNotification;
|
|
658
|
+
"contextMenuStateChange": KritzelContextMenuState;
|
|
659
|
+
"isLoadingChange": boolean;
|
|
660
|
+
}
|
|
661
|
+
interface HTMLKritzelEngineElement extends Components.KritzelEngine, HTMLStencilElement {
|
|
662
|
+
addEventListener<K extends keyof HTMLKritzelEngineElementEventMap>(type: K, listener: (this: HTMLKritzelEngineElement, ev: KritzelEngineCustomEvent<HTMLKritzelEngineElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
663
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
664
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
665
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
666
|
+
removeEventListener<K extends keyof HTMLKritzelEngineElementEventMap>(type: K, listener: (this: HTMLKritzelEngineElement, ev: KritzelEngineCustomEvent<HTMLKritzelEngineElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
667
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
668
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
669
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
670
|
+
}
|
|
671
|
+
var HTMLKritzelEngineElement: {
|
|
672
|
+
prototype: HTMLKritzelEngineElement;
|
|
673
|
+
new (): HTMLKritzelEngineElement;
|
|
674
|
+
};
|
|
675
|
+
interface HTMLKritzelIconElement extends Components.KritzelIcon, HTMLStencilElement {
|
|
676
|
+
}
|
|
677
|
+
var HTMLKritzelIconElement: {
|
|
678
|
+
prototype: HTMLKritzelIconElement;
|
|
679
|
+
new (): HTMLKritzelIconElement;
|
|
680
|
+
};
|
|
681
|
+
/**
|
|
682
|
+
* "Powered by Kritzel" watermark shown in the bottom-right corner of the engine
|
|
683
|
+
* when the editor is not licensed.
|
|
684
|
+
* Rendered inside the engine's Shadow DOM and gated by the license manager on
|
|
685
|
+
* the engine's reactive render path, so removing the node simply causes it to
|
|
686
|
+
* reappear on the next render. The badge links to the Kritzel website.
|
|
687
|
+
*/
|
|
688
|
+
interface HTMLKritzelWatermarkElement extends Components.KritzelWatermark, HTMLStencilElement {
|
|
689
|
+
}
|
|
690
|
+
var HTMLKritzelWatermarkElement: {
|
|
691
|
+
prototype: HTMLKritzelWatermarkElement;
|
|
692
|
+
new (): HTMLKritzelWatermarkElement;
|
|
693
|
+
};
|
|
694
|
+
interface HTMLElementTagNameMap {
|
|
695
|
+
"kritzel-awareness-cursors": HTMLKritzelAwarenessCursorsElement;
|
|
696
|
+
"kritzel-cursor-trail": HTMLKritzelCursorTrailElement;
|
|
697
|
+
"kritzel-engine": HTMLKritzelEngineElement;
|
|
698
|
+
"kritzel-icon": HTMLKritzelIconElement;
|
|
699
|
+
"kritzel-watermark": HTMLKritzelWatermarkElement;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
declare namespace LocalJSX {
|
|
703
|
+
interface KritzelAwarenessCursors {
|
|
704
|
+
"core": KritzelCore;
|
|
705
|
+
/**
|
|
706
|
+
* @default 8
|
|
707
|
+
*/
|
|
708
|
+
"edgeIndicatorPadding"?: number;
|
|
709
|
+
/**
|
|
710
|
+
* @default true
|
|
711
|
+
*/
|
|
712
|
+
"showEdgeIndicators"?: boolean;
|
|
713
|
+
}
|
|
714
|
+
interface KritzelCursorTrail {
|
|
715
|
+
"core": KritzelCore;
|
|
716
|
+
}
|
|
717
|
+
interface KritzelEngine {
|
|
718
|
+
/**
|
|
719
|
+
* Optional workspace ID to load. If provided, the engine will look up and load this workspace by ID.
|
|
720
|
+
*/
|
|
721
|
+
"activeWorkspaceId"?: string;
|
|
722
|
+
/**
|
|
723
|
+
* Configuration for binary asset storage (e.g., images). The Yjs document only persists asset ids; the actual bytes are stored by the providers listed here. Defaults to IndexedDB-only storage. To support cross-device image sync alongside a networked sync provider (Hocuspocus, WebSocket), configure at least one remote asset provider such as `HttpAssetProvider` or `PresignedAssetProvider`.
|
|
724
|
+
*/
|
|
725
|
+
"assetStorageConfig"?: KritzelAssetStorageConfig;
|
|
726
|
+
/**
|
|
727
|
+
* The HTML element to apply cursor styles to. Defaults to `document.body` if not set.
|
|
728
|
+
*/
|
|
729
|
+
"cursorTarget"?: HTMLElement;
|
|
730
|
+
/**
|
|
731
|
+
* Debug info display options controlling which debug overlays are visible
|
|
732
|
+
*/
|
|
733
|
+
"debugInfo"?: KritzelDebugInfo;
|
|
734
|
+
/**
|
|
735
|
+
* Optional unique identifier for namespacing storage keys across multiple editor instances.
|
|
736
|
+
*/
|
|
737
|
+
"editorId"?: string;
|
|
738
|
+
/**
|
|
739
|
+
* The locale used to resolve terms missing from the active locale.
|
|
740
|
+
* @default 'en'
|
|
741
|
+
*/
|
|
742
|
+
"fallbackLocale"?: LocaleCode;
|
|
743
|
+
/**
|
|
744
|
+
* Context menu items shown when right-clicking the canvas background.
|
|
745
|
+
*/
|
|
746
|
+
"globalContextMenuItems"?: ContextMenuItem[];
|
|
747
|
+
/**
|
|
748
|
+
* When false, non-modified wheel events do not pan the viewport.
|
|
749
|
+
* @default true
|
|
750
|
+
*/
|
|
751
|
+
"isPanningEnabled"?: boolean;
|
|
752
|
+
/**
|
|
753
|
+
* When false, Ctrl+wheel events do not zoom the viewport.
|
|
754
|
+
* @default true
|
|
755
|
+
*/
|
|
756
|
+
"isZoomingEnabled"?: boolean;
|
|
757
|
+
/**
|
|
758
|
+
* License key that, when valid, removes the "Powered by Kritzel" watermark.
|
|
759
|
+
*/
|
|
760
|
+
"licenseKey"?: string;
|
|
761
|
+
/**
|
|
762
|
+
* The current locale (language) code to apply to the editor, e.g. 'en', 'de', 'fr'.
|
|
763
|
+
* @default 'en'
|
|
764
|
+
*/
|
|
765
|
+
"locale"?: LocaleCode;
|
|
766
|
+
/**
|
|
767
|
+
* An array of available locale definitions (with optional partial term overrides). Replaces the built-in locale set (en/de/fr) when provided, even if empty.
|
|
768
|
+
*/
|
|
769
|
+
"locales"?: KritzelLocale[];
|
|
770
|
+
/**
|
|
771
|
+
* When true, objects are drawn at a fixed visual size regardless of zoom level
|
|
772
|
+
* @default true
|
|
773
|
+
*/
|
|
774
|
+
"lockDrawingScale"?: boolean;
|
|
775
|
+
/**
|
|
776
|
+
* Context menu items shown when right-clicking a selected object.
|
|
777
|
+
*/
|
|
778
|
+
"objectContextMenuItems"?: ContextMenuItem[];
|
|
779
|
+
/**
|
|
780
|
+
* Emitted when the active drawing tool changes.
|
|
781
|
+
*/
|
|
782
|
+
"onActiveToolChange"?: (event: KritzelEngineCustomEvent<KritzelBaseTool>) => void;
|
|
783
|
+
/**
|
|
784
|
+
* Emitted when the active workspace changes (e.g., after import).
|
|
785
|
+
*/
|
|
786
|
+
"onActiveWorkspaceChange"?: (event: KritzelEngineCustomEvent<KritzelWorkspace>) => void;
|
|
787
|
+
/**
|
|
788
|
+
* Emitted when the awareness state changes (remote user cursors, presence).
|
|
789
|
+
*/
|
|
790
|
+
"onAwarenessChange"?: (event: KritzelEngineCustomEvent<Map<number, Record<string, any>>>) => void;
|
|
791
|
+
/**
|
|
792
|
+
* Emitted when context-menu visibility, items, or position changes.
|
|
793
|
+
*/
|
|
794
|
+
"onContextMenuStateChange"?: (event: KritzelEngineCustomEvent<KritzelContextMenuState>) => void;
|
|
795
|
+
/**
|
|
796
|
+
* Emitted when the engine has fully initialized and is ready for interaction.
|
|
797
|
+
*/
|
|
798
|
+
"onIsEngineReady"?: (event: KritzelEngineCustomEvent<KritzelEngineState>) => void;
|
|
799
|
+
/**
|
|
800
|
+
* Emitted while the selected workspace's objects are being initialized and synchronized.
|
|
801
|
+
*/
|
|
802
|
+
"onIsLoadingChange"?: (event: KritzelEngineCustomEvent<boolean>) => void;
|
|
803
|
+
/**
|
|
804
|
+
* Emitted on long-press (touch/pen). Useful for showing custom context menus on mobile.
|
|
805
|
+
*/
|
|
806
|
+
"onLongpress"?: (event: KritzelEngineCustomEvent<PointerEvent>) => void;
|
|
807
|
+
/**
|
|
808
|
+
* Emitted when notifications change.
|
|
809
|
+
*/
|
|
810
|
+
"onNotificationsChange"?: (event: KritzelEngineCustomEvent<KritzelNotification>) => void;
|
|
811
|
+
/**
|
|
812
|
+
* Emitted when one or more objects are added to the canvas.
|
|
813
|
+
*/
|
|
814
|
+
"onObjectsAdded"?: (event: KritzelEngineCustomEvent<ObjectsAddedEvent>) => void;
|
|
815
|
+
/**
|
|
816
|
+
* Emitted when objects on the canvas are added, removed, or modified.
|
|
817
|
+
*/
|
|
818
|
+
"onObjectsChange"?: (event: KritzelEngineCustomEvent<KritzelBaseObject[]>) => void;
|
|
819
|
+
/**
|
|
820
|
+
* Emitted when the set of objects visible in the current viewport changes (e.g., after pan or zoom).
|
|
821
|
+
*/
|
|
822
|
+
"onObjectsInViewportChange"?: (event: KritzelEngineCustomEvent<ObjectsInViewportChangeEvent>) => void;
|
|
823
|
+
/**
|
|
824
|
+
* Emitted when one or more objects are removed from the canvas.
|
|
825
|
+
*/
|
|
826
|
+
"onObjectsRemoved"?: (event: KritzelEngineCustomEvent<ObjectsRemovedEvent>) => void;
|
|
827
|
+
/**
|
|
828
|
+
* Emitted when the set of selected objects changes.
|
|
829
|
+
*/
|
|
830
|
+
"onObjectsSelectionChange"?: (event: KritzelEngineCustomEvent<KritzelBaseObject[]>) => void;
|
|
831
|
+
/**
|
|
832
|
+
* Emitted when one or more objects are updated on the canvas.
|
|
833
|
+
*/
|
|
834
|
+
"onObjectsUpdated"?: (event: KritzelEngineCustomEvent<ObjectsUpdatedEvent>) => void;
|
|
835
|
+
/**
|
|
836
|
+
* Emitted when the undo/redo state changes, providing current undo availability.
|
|
837
|
+
*/
|
|
838
|
+
"onUndoStateChange"?: (event: KritzelEngineCustomEvent<KritzelUndoState>) => void;
|
|
839
|
+
/**
|
|
840
|
+
* Emitted when the viewport position, scale, or dimensions change (e.g., after pan, zoom, or resize).
|
|
841
|
+
*/
|
|
842
|
+
"onViewportChange"?: (event: KritzelEngineCustomEvent<KritzelViewportState>) => void;
|
|
843
|
+
/**
|
|
844
|
+
* Emitted when workspaces are created, updated, or deleted.
|
|
845
|
+
*/
|
|
846
|
+
"onWorkspacesChange"?: (event: KritzelEngineCustomEvent<KritzelWorkspace[]>) => void;
|
|
847
|
+
/**
|
|
848
|
+
* Maximum zoom scale allowed. Clamped to the absolute maximum defined by the engine.
|
|
849
|
+
* @default 1000
|
|
850
|
+
*/
|
|
851
|
+
"scaleMax"?: number;
|
|
852
|
+
/**
|
|
853
|
+
* Minimum zoom scale allowed. Clamped to the absolute minimum defined by the engine.
|
|
854
|
+
* @default 0.0001
|
|
855
|
+
*/
|
|
856
|
+
"scaleMin"?: number;
|
|
857
|
+
/**
|
|
858
|
+
* Configuration for real-time synchronization providers (e.g., IndexedDB, WebSocket).
|
|
859
|
+
*/
|
|
860
|
+
"syncConfig"?: KritzelSyncConfig;
|
|
861
|
+
/**
|
|
862
|
+
* The current theme to apply to the editor
|
|
863
|
+
* @default 'light'
|
|
864
|
+
*/
|
|
865
|
+
"theme"?: ThemeName;
|
|
866
|
+
/**
|
|
867
|
+
* An array of available themes for the editor.
|
|
868
|
+
*/
|
|
869
|
+
"themes"?: KritzelTheme[];
|
|
870
|
+
/**
|
|
871
|
+
* The current user for awareness broadcasting (name, id, cursor position).
|
|
872
|
+
*/
|
|
873
|
+
"user"?: IKritzelUser;
|
|
874
|
+
/**
|
|
875
|
+
* Bottom boundary of the viewport in world coordinates. Objects beyond this Y position cannot be panned to.
|
|
876
|
+
* @default Infinity
|
|
877
|
+
*/
|
|
878
|
+
"viewportBoundaryBottom"?: number;
|
|
879
|
+
/**
|
|
880
|
+
* Left boundary of the viewport in world coordinates. Objects beyond this X position cannot be panned to.
|
|
881
|
+
* @default -Infinity
|
|
882
|
+
*/
|
|
883
|
+
"viewportBoundaryLeft"?: number;
|
|
884
|
+
/**
|
|
885
|
+
* Right boundary of the viewport in world coordinates. Objects beyond this X position cannot be panned to.
|
|
886
|
+
* @default Infinity
|
|
887
|
+
*/
|
|
888
|
+
"viewportBoundaryRight"?: number;
|
|
889
|
+
/**
|
|
890
|
+
* Top boundary of the viewport in world coordinates. Objects beyond this Y position cannot be panned to.
|
|
891
|
+
* @default -Infinity
|
|
892
|
+
*/
|
|
893
|
+
"viewportBoundaryTop"?: number;
|
|
894
|
+
/**
|
|
895
|
+
* Authoritative workspace catalog for this engine instance. When provided, provider-only workspaces are hidden but not deleted.
|
|
896
|
+
*/
|
|
897
|
+
"workspaces"?: KritzelWorkspace[];
|
|
898
|
+
}
|
|
899
|
+
interface KritzelIcon {
|
|
900
|
+
"label"?: string;
|
|
901
|
+
"name"?: string;
|
|
902
|
+
/**
|
|
903
|
+
* @default 24
|
|
904
|
+
*/
|
|
905
|
+
"size"?: number;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* "Powered by Kritzel" watermark shown in the bottom-right corner of the engine
|
|
909
|
+
* when the editor is not licensed.
|
|
910
|
+
* Rendered inside the engine's Shadow DOM and gated by the license manager on
|
|
911
|
+
* the engine's reactive render path, so removing the node simply causes it to
|
|
912
|
+
* reappear on the next render. The badge links to the Kritzel website.
|
|
913
|
+
*/
|
|
914
|
+
interface KritzelWatermark {
|
|
915
|
+
/**
|
|
916
|
+
* The core instance used to resolve localized terms.
|
|
917
|
+
*/
|
|
918
|
+
"core": KritzelCore;
|
|
919
|
+
/**
|
|
920
|
+
* Resolved "Powered by Kritzel" label. Passed in by the engine so the badge re-renders when the active locale changes. Falls back to resolving the term from the core when not provided.
|
|
921
|
+
*/
|
|
922
|
+
"label"?: string;
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
interface KritzelAwarenessCursorsAttributes {
|
|
926
|
+
"showEdgeIndicators": boolean;
|
|
927
|
+
"edgeIndicatorPadding": number;
|
|
928
|
+
}
|
|
929
|
+
interface KritzelEngineAttributes {
|
|
930
|
+
"editorId": string;
|
|
931
|
+
"activeWorkspaceId": string;
|
|
932
|
+
"scaleMax": number;
|
|
933
|
+
"scaleMin": number;
|
|
934
|
+
"lockDrawingScale": boolean;
|
|
935
|
+
"theme": ThemeName;
|
|
936
|
+
"licenseKey": string;
|
|
937
|
+
"locale": LocaleCode;
|
|
938
|
+
"fallbackLocale": LocaleCode;
|
|
939
|
+
"viewportBoundaryLeft": number;
|
|
940
|
+
"viewportBoundaryRight": number;
|
|
941
|
+
"viewportBoundaryTop": number;
|
|
942
|
+
"viewportBoundaryBottom": number;
|
|
943
|
+
"isPanningEnabled": boolean;
|
|
944
|
+
"isZoomingEnabled": boolean;
|
|
945
|
+
}
|
|
946
|
+
interface KritzelIconAttributes {
|
|
947
|
+
"name": string;
|
|
948
|
+
"label": string;
|
|
949
|
+
"size": number;
|
|
950
|
+
}
|
|
951
|
+
interface KritzelWatermarkAttributes {
|
|
952
|
+
"label": string;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
interface IntrinsicElements {
|
|
956
|
+
"kritzel-awareness-cursors": Omit<KritzelAwarenessCursors, keyof KritzelAwarenessCursorsAttributes> & { [K in keyof KritzelAwarenessCursors & keyof KritzelAwarenessCursorsAttributes]?: KritzelAwarenessCursors[K] } & { [K in keyof KritzelAwarenessCursors & keyof KritzelAwarenessCursorsAttributes as `attr:${K}`]?: KritzelAwarenessCursorsAttributes[K] } & { [K in keyof KritzelAwarenessCursors & keyof KritzelAwarenessCursorsAttributes as `prop:${K}`]?: KritzelAwarenessCursors[K] };
|
|
957
|
+
"kritzel-cursor-trail": KritzelCursorTrail;
|
|
958
|
+
"kritzel-engine": Omit<KritzelEngine, keyof KritzelEngineAttributes> & { [K in keyof KritzelEngine & keyof KritzelEngineAttributes]?: KritzelEngine[K] } & { [K in keyof KritzelEngine & keyof KritzelEngineAttributes as `attr:${K}`]?: KritzelEngineAttributes[K] } & { [K in keyof KritzelEngine & keyof KritzelEngineAttributes as `prop:${K}`]?: KritzelEngine[K] };
|
|
959
|
+
"kritzel-icon": Omit<KritzelIcon, keyof KritzelIconAttributes> & { [K in keyof KritzelIcon & keyof KritzelIconAttributes]?: KritzelIcon[K] } & { [K in keyof KritzelIcon & keyof KritzelIconAttributes as `attr:${K}`]?: KritzelIconAttributes[K] } & { [K in keyof KritzelIcon & keyof KritzelIconAttributes as `prop:${K}`]?: KritzelIcon[K] };
|
|
960
|
+
"kritzel-watermark": Omit<KritzelWatermark, keyof KritzelWatermarkAttributes> & { [K in keyof KritzelWatermark & keyof KritzelWatermarkAttributes]?: KritzelWatermark[K] } & { [K in keyof KritzelWatermark & keyof KritzelWatermarkAttributes as `attr:${K}`]?: KritzelWatermarkAttributes[K] } & { [K in keyof KritzelWatermark & keyof KritzelWatermarkAttributes as `prop:${K}`]?: KritzelWatermark[K] };
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
export { LocalJSX as JSX };
|
|
964
|
+
declare module "@stencil/core" {
|
|
965
|
+
export namespace JSX {
|
|
966
|
+
interface IntrinsicElements {
|
|
967
|
+
"kritzel-awareness-cursors": LocalJSX.IntrinsicElements["kritzel-awareness-cursors"] & JSXBase.HTMLAttributes<HTMLKritzelAwarenessCursorsElement>;
|
|
968
|
+
"kritzel-cursor-trail": LocalJSX.IntrinsicElements["kritzel-cursor-trail"] & JSXBase.HTMLAttributes<HTMLKritzelCursorTrailElement>;
|
|
969
|
+
"kritzel-engine": LocalJSX.IntrinsicElements["kritzel-engine"] & JSXBase.HTMLAttributes<HTMLKritzelEngineElement>;
|
|
970
|
+
"kritzel-icon": LocalJSX.IntrinsicElements["kritzel-icon"] & JSXBase.HTMLAttributes<HTMLKritzelIconElement>;
|
|
971
|
+
/**
|
|
972
|
+
* "Powered by Kritzel" watermark shown in the bottom-right corner of the engine
|
|
973
|
+
* when the editor is not licensed.
|
|
974
|
+
* Rendered inside the engine's Shadow DOM and gated by the license manager on
|
|
975
|
+
* the engine's reactive render path, so removing the node simply causes it to
|
|
976
|
+
* reappear on the next render. The badge links to the Kritzel website.
|
|
977
|
+
*/
|
|
978
|
+
"kritzel-watermark": LocalJSX.IntrinsicElements["kritzel-watermark"] & JSXBase.HTMLAttributes<HTMLKritzelWatermarkElement>;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|