@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,79 @@
|
|
|
1
|
+
import { KritzelAsset } from '../../../interfaces/asset.interface';
|
|
2
|
+
import { IAssetStorageProvider, KritzelAssetPutMetadata } from '../../../interfaces/asset-provider.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Response shape expected from the upload endpoint. Fields are optional
|
|
5
|
+
* so that different server designs can be accommodated; if `id` is not
|
|
6
|
+
* returned, the pre-generated id passed via metadata is used.
|
|
7
|
+
*/
|
|
8
|
+
export interface HttpAssetUploadResponse {
|
|
9
|
+
id?: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Options for {@link HttpAssetProvider}.
|
|
14
|
+
*
|
|
15
|
+
* The host application owns authentication. Any credentials or tokens
|
|
16
|
+
* should be injected via the `headers` callback so the library never
|
|
17
|
+
* holds long-lived secrets.
|
|
18
|
+
*/
|
|
19
|
+
export interface HttpAssetProviderOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Returns the URL the asset should be POSTed to.
|
|
22
|
+
* Called once per upload; may be async to support signed endpoints.
|
|
23
|
+
*/
|
|
24
|
+
uploadUrl: (metadata: KritzelAssetPutMetadata) => string | Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the URL from which a given asset id can be loaded.
|
|
27
|
+
* This URL is used directly as the `<img src>`.
|
|
28
|
+
*/
|
|
29
|
+
resolveUrl: (id: string) => string | Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Optional custom headers (auth tokens, tenant ids, ...) attached to
|
|
32
|
+
* every request. Called per request so tokens can be refreshed.
|
|
33
|
+
*/
|
|
34
|
+
headers?: () => Record<string, string> | Promise<Record<string, string>>;
|
|
35
|
+
/**
|
|
36
|
+
* Quiet mode - suppress console output (optional, defaults to false)
|
|
37
|
+
*/
|
|
38
|
+
quiet?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Upload transport. Defaults to a single `POST` carrying a
|
|
41
|
+
* `multipart/form-data` body with the file and metadata as JSON.
|
|
42
|
+
* Override when the backend expects a different shape.
|
|
43
|
+
*/
|
|
44
|
+
upload?: (url: string, blob: Blob, metadata: KritzelAssetPutMetadata, headers: Record<string, string>) => Promise<HttpAssetUploadResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* Optional override for DELETE requests. Omit to disable deletion.
|
|
47
|
+
*/
|
|
48
|
+
deleteUrl?: (id: string) => string | Promise<string>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Remote asset storage provider backed by a plain HTTP endpoint.
|
|
52
|
+
*
|
|
53
|
+
* The host application is responsible for exposing a REST-ish backend
|
|
54
|
+
* that accepts a multipart upload and serves the stored asset at a
|
|
55
|
+
* stable URL. Authentication is injected via `headers`.
|
|
56
|
+
*/
|
|
57
|
+
export declare class HttpAssetProvider implements IAssetStorageProvider {
|
|
58
|
+
readonly type = "remote";
|
|
59
|
+
readonly name = "HttpAssetProvider";
|
|
60
|
+
private _options;
|
|
61
|
+
constructor(options: HttpAssetProviderOptions);
|
|
62
|
+
/**
|
|
63
|
+
* Factory helper enabling use as `HttpAssetProvider.with({ ... })` inside
|
|
64
|
+
* a `KritzelAssetStorageConfig.providers` array.
|
|
65
|
+
*/
|
|
66
|
+
static with(options: HttpAssetProviderOptions): {
|
|
67
|
+
create: () => IAssetStorageProvider;
|
|
68
|
+
};
|
|
69
|
+
init(): Promise<void>;
|
|
70
|
+
destroy(): void;
|
|
71
|
+
canResolve(_id: string): boolean;
|
|
72
|
+
put(blob: Blob, metadata: KritzelAssetPutMetadata): Promise<KritzelAsset>;
|
|
73
|
+
resolve(id: string): Promise<string>;
|
|
74
|
+
fetch(id: string): Promise<Blob>;
|
|
75
|
+
delete(id: string): Promise<void>;
|
|
76
|
+
private defaultUpload;
|
|
77
|
+
private extensionFromMime;
|
|
78
|
+
private generateUuid;
|
|
79
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { KritzelAsset } from '../../../interfaces/asset.interface';
|
|
2
|
+
import { IAssetStorageProvider, KritzelAssetPutMetadata } from '../../../interfaces/asset-provider.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Options for {@link IndexedDBAssetProvider}.
|
|
5
|
+
*/
|
|
6
|
+
export interface IndexedDBAssetProviderOptions {
|
|
7
|
+
/** Custom database name. Defaults to `kritzel-assets`. */
|
|
8
|
+
dbName?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Quiet mode - suppress console output (optional, defaults to false)
|
|
11
|
+
*/
|
|
12
|
+
quiet?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Local-only asset storage provider backed by IndexedDB.
|
|
16
|
+
*
|
|
17
|
+
* Stores asset blobs and metadata in a dedicated database (separate from
|
|
18
|
+
* the Yjs IndexedDB sync provider). Resolved URLs are `blob:` object URLs
|
|
19
|
+
* created on demand and cached to avoid redundant allocations.
|
|
20
|
+
*
|
|
21
|
+
* This provider is always-safe to include in an asset storage config; it
|
|
22
|
+
* doubles as an offline cache when combined with a remote provider.
|
|
23
|
+
*/
|
|
24
|
+
export declare class IndexedDBAssetProvider implements IAssetStorageProvider {
|
|
25
|
+
readonly type = "local";
|
|
26
|
+
readonly name = "IndexedDBAssetProvider";
|
|
27
|
+
private _dbName;
|
|
28
|
+
private _db;
|
|
29
|
+
/** In-memory cache of id -> object URL to avoid re-creating blob URLs. */
|
|
30
|
+
private _urlCache;
|
|
31
|
+
/** In-memory known-present ids to let `canResolve` answer synchronously. */
|
|
32
|
+
private _knownIds;
|
|
33
|
+
constructor(options?: IndexedDBAssetProviderOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Factory helper enabling use as `IndexedDBAssetProvider.with({ dbName: '...' })`
|
|
36
|
+
* inside a `KritzelAssetStorageConfig.providers` array.
|
|
37
|
+
*/
|
|
38
|
+
static with(options: IndexedDBAssetProviderOptions): {
|
|
39
|
+
create: () => IAssetStorageProvider;
|
|
40
|
+
};
|
|
41
|
+
init(): Promise<void>;
|
|
42
|
+
destroy(): void;
|
|
43
|
+
canResolve(id: string): boolean;
|
|
44
|
+
put(blob: Blob, metadata: KritzelAssetPutMetadata): Promise<KritzelAsset>;
|
|
45
|
+
resolve(id: string): Promise<string>;
|
|
46
|
+
fetch(id: string): Promise<Blob>;
|
|
47
|
+
delete(id: string): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the metadata record for a stored asset, or `undefined` when
|
|
50
|
+
* the asset is not present locally.
|
|
51
|
+
*/
|
|
52
|
+
getMetadata(id: string): Promise<KritzelAsset | undefined>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns every stored asset that still has one or more remote
|
|
55
|
+
* providers marked as pending. Used by the resolver on init to
|
|
56
|
+
* re-enqueue uploads that were interrupted (e.g. the user reloaded
|
|
57
|
+
* the tab while a background upload was retrying).
|
|
58
|
+
*/
|
|
59
|
+
listAssetsWithPendingRemotes(): Promise<KritzelAsset[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Replaces the `pendingRemotes` list on an asset's metadata record.
|
|
62
|
+
* Passing an empty array clears the pending flag entirely.
|
|
63
|
+
*/
|
|
64
|
+
setPendingRemotes(id: string, providerNames: string[]): Promise<void>;
|
|
65
|
+
private ensureDb;
|
|
66
|
+
private openDatabase;
|
|
67
|
+
private loadKnownIds;
|
|
68
|
+
private generateUuid;
|
|
69
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { KritzelAsset } from '../../../interfaces/asset.interface';
|
|
2
|
+
import { IAssetStorageProvider, KritzelAssetPutMetadata } from '../../../interfaces/asset-provider.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Pre-signed upload descriptor returned by the host application.
|
|
5
|
+
* `method` defaults to `PUT` which matches the common S3 pattern, but
|
|
6
|
+
* `POST` is also supported for S3 browser-based uploads with form fields.
|
|
7
|
+
*/
|
|
8
|
+
export interface KritzelPresignedUpload {
|
|
9
|
+
/** Stable asset id. Host may honor metadata.id or assign a new one. */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Fully-qualified URL bytes should be sent to. */
|
|
12
|
+
url: string;
|
|
13
|
+
/** HTTP method. Defaults to `PUT`. */
|
|
14
|
+
method?: 'PUT' | 'POST';
|
|
15
|
+
/** Extra form fields (S3 browser-based uploads). Only used for POST. */
|
|
16
|
+
fields?: Record<string, string>;
|
|
17
|
+
/** Extra request headers (e.g. `Content-Type`, `x-amz-*`). */
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Options for {@link PresignedAssetProvider}.
|
|
22
|
+
*
|
|
23
|
+
* This provider delegates upload URL signing and download URL signing to
|
|
24
|
+
* the host application. The library never sees storage credentials.
|
|
25
|
+
*/
|
|
26
|
+
export interface PresignedAssetProviderOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Returns a pre-signed upload descriptor for the given metadata. The
|
|
29
|
+
* host application typically calls its backend to obtain a signed URL.
|
|
30
|
+
*/
|
|
31
|
+
getUploadDescriptor: (metadata: KritzelAssetPutMetadata) => Promise<KritzelPresignedUpload>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a URL from which the given asset can be loaded (often a
|
|
34
|
+
* short-lived signed GET URL).
|
|
35
|
+
*/
|
|
36
|
+
getDownloadUrl: (id: string) => Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Optional delete hook. Called with the asset id; host signs and
|
|
39
|
+
* dispatches a DELETE to the underlying storage. Omit to disable.
|
|
40
|
+
*/
|
|
41
|
+
deleteAsset?: (id: string) => Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Quiet mode - suppress console output (optional, defaults to false)
|
|
44
|
+
*/
|
|
45
|
+
quiet?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Remote asset storage provider for pre-signed URL uploads (S3, GCS, ...).
|
|
49
|
+
*
|
|
50
|
+
* All auth and URL signing is performed by the host application via the
|
|
51
|
+
* callbacks in {@link PresignedAssetProviderOptions}. The library simply
|
|
52
|
+
* PUTs/POSTs bytes to the provided URL.
|
|
53
|
+
*/
|
|
54
|
+
export declare class PresignedAssetProvider implements IAssetStorageProvider {
|
|
55
|
+
readonly type = "remote";
|
|
56
|
+
readonly name = "PresignedAssetProvider";
|
|
57
|
+
private _options;
|
|
58
|
+
constructor(options: PresignedAssetProviderOptions);
|
|
59
|
+
static with(options: PresignedAssetProviderOptions): {
|
|
60
|
+
create: () => IAssetStorageProvider;
|
|
61
|
+
};
|
|
62
|
+
init(): Promise<void>;
|
|
63
|
+
destroy(): void;
|
|
64
|
+
canResolve(_id: string): boolean;
|
|
65
|
+
put(blob: Blob, metadata: KritzelAssetPutMetadata): Promise<KritzelAsset>;
|
|
66
|
+
resolve(id: string): Promise<string>;
|
|
67
|
+
fetch(id: string): Promise<Blob>;
|
|
68
|
+
delete(id: string): Promise<void>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PasteIntent } from '../../managers/clipboard.types';
|
|
2
|
+
import { KritzelPasteIntentProvider, KritzelPasteIntentProviderContext } from '../../../interfaces/paste-intent-provider.interface';
|
|
3
|
+
export declare class KritzelEventPasteIntentProvider implements KritzelPasteIntentProvider {
|
|
4
|
+
canHandle(context: KritzelPasteIntentProviderContext): boolean;
|
|
5
|
+
getPasteIntent(context: KritzelPasteIntentProviderContext): Promise<PasteIntent>;
|
|
6
|
+
private parseClipboardPayload;
|
|
7
|
+
private determineTextPasteIntent;
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PasteIntent } from '../../managers/clipboard.types';
|
|
2
|
+
import { KritzelPasteIntentProvider, KritzelPasteIntentProviderContext } from '../../../interfaces/paste-intent-provider.interface';
|
|
3
|
+
export declare class KritzelIosPasteIntentProvider implements KritzelPasteIntentProvider {
|
|
4
|
+
canHandle(context: KritzelPasteIntentProviderContext): boolean;
|
|
5
|
+
getPasteIntent(context: KritzelPasteIntentProviderContext): Promise<PasteIntent>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PasteIntent } from '../../managers/clipboard.types';
|
|
2
|
+
import { KritzelPasteIntentProvider, KritzelPasteIntentProviderContext } from '../../../interfaces/paste-intent-provider.interface';
|
|
3
|
+
export declare class KritzelNavigatorPasteIntentProvider implements KritzelPasteIntentProvider {
|
|
4
|
+
canHandle(context: KritzelPasteIntentProviderContext): boolean;
|
|
5
|
+
getPasteIntent(context: KritzelPasteIntentProviderContext): Promise<PasteIntent>;
|
|
6
|
+
private processClipboardItems;
|
|
7
|
+
private parseClipboardPayload;
|
|
8
|
+
private determineTextPasteIntent;
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { ISyncProvider } from '../../../interfaces/sync-provider.interface';
|
|
3
|
+
/**
|
|
4
|
+
* BroadcastChannel sync provider for cross-tab synchronization
|
|
5
|
+
* This is a lightweight alternative to y-webrtc for browser-tab-only sync
|
|
6
|
+
*/
|
|
7
|
+
export declare class BroadcastSyncProvider implements ISyncProvider {
|
|
8
|
+
static readonly type: "local";
|
|
9
|
+
readonly type = "local";
|
|
10
|
+
private readonly doc;
|
|
11
|
+
private readonly channel;
|
|
12
|
+
private _synced;
|
|
13
|
+
constructor(docName: string, doc: Y.Doc, _options?: {
|
|
14
|
+
quiet?: boolean;
|
|
15
|
+
});
|
|
16
|
+
private handleDocUpdate;
|
|
17
|
+
private handleMessage;
|
|
18
|
+
private broadcastSync;
|
|
19
|
+
connect(): Promise<void>;
|
|
20
|
+
disconnect(): void;
|
|
21
|
+
reconnect(): Promise<void>;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
|
+
import { HocuspocusProviderWebsocket } from '@hocuspocus/provider';
|
|
4
|
+
import { ISyncProvider, ProviderFactory } from '../../../interfaces/sync-provider.interface';
|
|
5
|
+
/**
|
|
6
|
+
* Options for Hocuspocus sync provider
|
|
7
|
+
*/
|
|
8
|
+
export interface HocuspocusOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Hocuspocus server URL (optional, defaults to ws://localhost:1234)
|
|
11
|
+
*/
|
|
12
|
+
url?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Document name (optional, defaults to docName)
|
|
15
|
+
*/
|
|
16
|
+
name?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Authentication token (optional)
|
|
19
|
+
*/
|
|
20
|
+
token?: string | (() => string) | (() => Promise<string>);
|
|
21
|
+
/**
|
|
22
|
+
* Shared WebSocket provider for multiplexing (optional)
|
|
23
|
+
* If provided, multiple documents will share the same WebSocket connection
|
|
24
|
+
*/
|
|
25
|
+
websocketProvider?: HocuspocusProviderWebsocket;
|
|
26
|
+
/**
|
|
27
|
+
* Quiet mode - suppress console output (optional, defaults to false)
|
|
28
|
+
*/
|
|
29
|
+
quiet?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Callback when connected (optional).
|
|
32
|
+
* Fires on every connection, including reconnections after a disconnect.
|
|
33
|
+
*/
|
|
34
|
+
onConnect?: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Callback when disconnected (optional)
|
|
37
|
+
*/
|
|
38
|
+
onDisconnect?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Callback when synced (optional)
|
|
41
|
+
*/
|
|
42
|
+
onSynced?: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Callback when authentication failed (optional)
|
|
45
|
+
*/
|
|
46
|
+
onAuthenticationFailed?: (data: any) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Callback when connection status changes (optional)
|
|
49
|
+
*/
|
|
50
|
+
onStatus?: (data: {
|
|
51
|
+
status: string;
|
|
52
|
+
}) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Force sync interval in milliseconds (optional, false to disable)
|
|
55
|
+
*/
|
|
56
|
+
forceSyncInterval?: false | number;
|
|
57
|
+
/**
|
|
58
|
+
* WebSocket polyfill for Node.js environments (optional)
|
|
59
|
+
*/
|
|
60
|
+
WebSocketPolyfill?: any;
|
|
61
|
+
/**
|
|
62
|
+
* Timeout in milliseconds for the initial connect() call (optional, defaults to 10000).
|
|
63
|
+
* Note: Even if the timeout fires, the underlying provider continues reconnecting in the background.
|
|
64
|
+
*/
|
|
65
|
+
connectionTimeout?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Base delay in milliseconds between reconnect attempts (optional, defaults to 1000)
|
|
68
|
+
*/
|
|
69
|
+
delay?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Exponential backoff multiplier for reconnect delay (optional, defaults to 2)
|
|
72
|
+
*/
|
|
73
|
+
factor?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Maximum number of reconnect attempts before giving up (optional, defaults to 0 = infinite)
|
|
76
|
+
*/
|
|
77
|
+
maxAttempts?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Minimum delay in milliseconds between reconnect attempts (optional)
|
|
80
|
+
*/
|
|
81
|
+
minDelay?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Maximum delay in milliseconds between reconnect attempts (optional)
|
|
84
|
+
*/
|
|
85
|
+
maxDelay?: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Options for creating a shared WebSocket connection
|
|
89
|
+
*/
|
|
90
|
+
export interface HocuspocusWebSocketOptions {
|
|
91
|
+
/**
|
|
92
|
+
* Hocuspocus server URL
|
|
93
|
+
*/
|
|
94
|
+
url: string;
|
|
95
|
+
/**
|
|
96
|
+
* WebSocket polyfill for Node.js environments (optional)
|
|
97
|
+
*/
|
|
98
|
+
WebSocketPolyfill?: any;
|
|
99
|
+
/**
|
|
100
|
+
* Callback when WebSocket connects (optional)
|
|
101
|
+
*/
|
|
102
|
+
onConnect?: () => void;
|
|
103
|
+
/**
|
|
104
|
+
* Callback when WebSocket disconnects (optional)
|
|
105
|
+
*/
|
|
106
|
+
onDisconnect?: () => void;
|
|
107
|
+
/**
|
|
108
|
+
* Callback when connection status changes (optional)
|
|
109
|
+
*/
|
|
110
|
+
onStatus?: (data: {
|
|
111
|
+
status: string;
|
|
112
|
+
}) => void;
|
|
113
|
+
}
|
|
114
|
+
export type ConnectionStatus = 'disconnected' | 'connecting' | 'connected' | 'synced';
|
|
115
|
+
/**
|
|
116
|
+
* Hocuspocus sync provider for real-time collaboration
|
|
117
|
+
* Supports multiplexing - multiple documents can share the same WebSocket connection
|
|
118
|
+
*/
|
|
119
|
+
export declare class HocuspocusSyncProvider implements ISyncProvider {
|
|
120
|
+
static readonly type: "network";
|
|
121
|
+
readonly type = "network";
|
|
122
|
+
private provider;
|
|
123
|
+
private isConnected;
|
|
124
|
+
private isSynced;
|
|
125
|
+
private usesSharedSocket;
|
|
126
|
+
private isDestroyed;
|
|
127
|
+
private connectTimeout;
|
|
128
|
+
private pendingConnectReject;
|
|
129
|
+
private connectionTimeoutMs;
|
|
130
|
+
private _connectionStatus;
|
|
131
|
+
private visibilityHandler;
|
|
132
|
+
private onlineHandler;
|
|
133
|
+
get awareness(): Awareness | null;
|
|
134
|
+
get rawProvider(): unknown;
|
|
135
|
+
get connectionStatus(): ConnectionStatus;
|
|
136
|
+
private static sharedWebSocketProvider;
|
|
137
|
+
constructor(docName: string, doc: Y.Doc, options?: HocuspocusOptions);
|
|
138
|
+
private setupBrowserEventListeners;
|
|
139
|
+
private removeBrowserEventListeners;
|
|
140
|
+
/**
|
|
141
|
+
* Create a shared WebSocket connection for multiplexing
|
|
142
|
+
* Call this once to create a shared connection that multiple providers can use
|
|
143
|
+
*/
|
|
144
|
+
static createSharedWebSocket(options: HocuspocusWebSocketOptions): HocuspocusProviderWebsocket;
|
|
145
|
+
/**
|
|
146
|
+
* Destroy the shared WebSocket connection
|
|
147
|
+
* Call this when you're done with all multiplexed providers
|
|
148
|
+
*/
|
|
149
|
+
static destroySharedWebSocket(): void;
|
|
150
|
+
/**
|
|
151
|
+
* Get the shared WebSocket provider instance (if it exists)
|
|
152
|
+
*/
|
|
153
|
+
static getSharedWebSocket(): HocuspocusProviderWebsocket | null;
|
|
154
|
+
/**
|
|
155
|
+
* Static factory method for creating HocuspocusSyncProvider with configuration options
|
|
156
|
+
* Returns a ProviderFactory that can be used in sync configuration
|
|
157
|
+
*/
|
|
158
|
+
static with(options?: HocuspocusOptions): ProviderFactory;
|
|
159
|
+
connect(): Promise<void>;
|
|
160
|
+
reconnect(): Promise<void>;
|
|
161
|
+
disconnect(): void;
|
|
162
|
+
destroy(): void;
|
|
163
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { ISyncProvider } from '../../../interfaces/sync-provider.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Options for InMemory sync provider
|
|
5
|
+
*/
|
|
6
|
+
export interface InMemoryOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Custom cache key (optional). Defaults to the docName.
|
|
9
|
+
*/
|
|
10
|
+
name?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* In-memory sync provider for session-scoped persistence.
|
|
14
|
+
*
|
|
15
|
+
* State survives the component being removed from the DOM and later
|
|
16
|
+
* re-added within the same page session, but is lost on page reload.
|
|
17
|
+
* Intended for documentation demos where durable IndexedDB persistence
|
|
18
|
+
* is not desired.
|
|
19
|
+
*/
|
|
20
|
+
export declare class InMemorySyncProvider implements ISyncProvider {
|
|
21
|
+
static readonly type: "local";
|
|
22
|
+
readonly type = "local";
|
|
23
|
+
private readonly doc;
|
|
24
|
+
private readonly cacheKey;
|
|
25
|
+
private isConnected;
|
|
26
|
+
constructor(docName: string, doc: Y.Doc, options?: InMemoryOptions);
|
|
27
|
+
private readonly handleUpdate;
|
|
28
|
+
connect(): Promise<void>;
|
|
29
|
+
disconnect(): void;
|
|
30
|
+
reconnect(): Promise<void>;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Clears the in-memory cache.
|
|
34
|
+
*
|
|
35
|
+
* @param name - If provided, only the entry with this cache key is removed.
|
|
36
|
+
* If omitted, all entries are cleared.
|
|
37
|
+
*/
|
|
38
|
+
static clear(name?: string): void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { ISyncProvider } from '../../../interfaces/sync-provider.interface';
|
|
3
|
+
/**
|
|
4
|
+
* Options for IndexedDB sync provider
|
|
5
|
+
*/
|
|
6
|
+
export interface IndexedDBOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Custom database name (optional)
|
|
9
|
+
*/
|
|
10
|
+
name?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* IndexedDB sync provider for local persistence
|
|
14
|
+
*/
|
|
15
|
+
export declare class IndexedDBSyncProvider implements ISyncProvider {
|
|
16
|
+
static readonly type: "local";
|
|
17
|
+
readonly type = "local";
|
|
18
|
+
private provider;
|
|
19
|
+
private isConnected;
|
|
20
|
+
constructor(docName: string, doc: Y.Doc, options?: IndexedDBOptions);
|
|
21
|
+
connect(): Promise<void>;
|
|
22
|
+
disconnect(): void;
|
|
23
|
+
reconnect(): Promise<void>;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as Y from 'yjs';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
3
|
+
import { ISyncProvider, ProviderFactory } from '../../../interfaces/sync-provider.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Options for WebSocket sync provider
|
|
6
|
+
*/
|
|
7
|
+
export interface WebSocketOptions {
|
|
8
|
+
/**
|
|
9
|
+
* WebSocket server URL (optional, defaults to ws://localhost:1234)
|
|
10
|
+
*/
|
|
11
|
+
url?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Room/document name (optional, defaults to docName)
|
|
14
|
+
*/
|
|
15
|
+
roomName?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Connection parameters (optional)
|
|
18
|
+
*/
|
|
19
|
+
params?: Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* WebSocket protocols (optional)
|
|
22
|
+
*/
|
|
23
|
+
protocols?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Custom WebSocket constructor (optional, for Node.js environments)
|
|
26
|
+
*/
|
|
27
|
+
WebSocketPolyfill?: any;
|
|
28
|
+
/**
|
|
29
|
+
* Awareness protocol options (optional)
|
|
30
|
+
*/
|
|
31
|
+
awareness?: any;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum number of connection attempts (optional, defaults to Infinity)
|
|
34
|
+
*/
|
|
35
|
+
maxBackoffTime?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Quiet mode - suppress console output (optional, defaults to false)
|
|
38
|
+
*/
|
|
39
|
+
quiet?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* WebSocket sync provider for real-time collaboration
|
|
43
|
+
*/
|
|
44
|
+
export declare class WebSocketSyncProvider implements ISyncProvider {
|
|
45
|
+
static readonly type: "network";
|
|
46
|
+
readonly type = "network";
|
|
47
|
+
private provider;
|
|
48
|
+
private isConnected;
|
|
49
|
+
private _quiet;
|
|
50
|
+
get awareness(): Awareness;
|
|
51
|
+
get rawProvider(): unknown;
|
|
52
|
+
constructor(docName: string, doc: Y.Doc, options?: WebSocketOptions);
|
|
53
|
+
/**
|
|
54
|
+
* Static factory method for creating WebSocketSyncProvider with configuration options
|
|
55
|
+
* Returns a ProviderFactory that can be used in sync configuration
|
|
56
|
+
*/
|
|
57
|
+
static with(options?: WebSocketOptions): ProviderFactory;
|
|
58
|
+
private setupEventListeners;
|
|
59
|
+
connect(): Promise<void>;
|
|
60
|
+
disconnect(): void;
|
|
61
|
+
reconnect(): Promise<void>;
|
|
62
|
+
destroy(): void;
|
|
63
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { KritzelDynamicObjectRenderer } from "../../interfaces/dynamic-object-renderer.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Global registry for dynamic object renderers.
|
|
4
|
+
* Allows wrapper frameworks (Angular, React, Vue) to register renderer implementations
|
|
5
|
+
* without coupling to core, and enables deterministic rehydration across reloads and
|
|
6
|
+
* clipboard paste operations.
|
|
7
|
+
*
|
|
8
|
+
* Renderer keys are opaque strings that must be stable (e.g., 'angular-todo', 'react-editor').
|
|
9
|
+
* When a dynamic object is deserialized with a rendererKey, the registry is consulted to
|
|
10
|
+
* resolve the renderer and mount with the persisted rendererData.
|
|
11
|
+
*/
|
|
12
|
+
export declare class KritzelDynamicObjectRendererRegistry {
|
|
13
|
+
private static get _renderers();
|
|
14
|
+
/**
|
|
15
|
+
* Registers a renderer implementation for a given key.
|
|
16
|
+
* @param key - Stable identifier for this renderer (e.g., 'angular-my-component')
|
|
17
|
+
* @param renderer - Renderer implementation with mount/unmount/update handlers
|
|
18
|
+
*/
|
|
19
|
+
static register(key: string, renderer: KritzelDynamicObjectRenderer): void;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a registered renderer by key.
|
|
22
|
+
* @param key - Renderer identifier
|
|
23
|
+
* @returns The registered renderer, or undefined if not found
|
|
24
|
+
*/
|
|
25
|
+
static get(key: string): KritzelDynamicObjectRenderer | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Unregisters a renderer by key.
|
|
28
|
+
* @param key - Renderer identifier to remove
|
|
29
|
+
* @returns True if the renderer was found and removed; false otherwise
|
|
30
|
+
*/
|
|
31
|
+
static unregister(key: string): boolean;
|
|
32
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { KritzelFontMap, KritzelFontRegistration, KritzelRegisteredFont } from '../../interfaces/font.interface';
|
|
2
|
+
export declare class KritzelFontRegistry {
|
|
3
|
+
private static get _fonts();
|
|
4
|
+
private static getFontFaceSet;
|
|
5
|
+
private static toCssFontFace;
|
|
6
|
+
private static getRegisteredFontFamilies;
|
|
7
|
+
static register(key: string, registration: KritzelFontRegistration): void;
|
|
8
|
+
static registerFonts(fonts: KritzelFontMap): void;
|
|
9
|
+
private static injectFontStylesheets;
|
|
10
|
+
static waitForFonts(fonts: KritzelFontMap): Promise<void>;
|
|
11
|
+
static get(key: string): KritzelRegisteredFont | undefined;
|
|
12
|
+
static has(key: string): boolean;
|
|
13
|
+
static unregister(key: string): boolean;
|
|
14
|
+
static list(): KritzelRegisteredFont[];
|
|
15
|
+
static resolveCssFontFamily(fontFamily: string): string;
|
|
16
|
+
static toRegisteredFont(registration: KritzelFontRegistration): KritzelRegisteredFont;
|
|
17
|
+
private static emitChange;
|
|
18
|
+
static get changeEventName(): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A static registry for managing SVG icons throughout the Kritzel library.
|
|
3
|
+
* Icons are stored as name-to-SVG-content mappings and can be retrieved by name.
|
|
4
|
+
*/
|
|
5
|
+
export declare class KritzelIconRegistry {
|
|
6
|
+
/** Internal storage for registered icons, mapping icon names to their SVG content. */
|
|
7
|
+
private static registry;
|
|
8
|
+
/**
|
|
9
|
+
* Registers a single icon with the given name and SVG content.
|
|
10
|
+
* If an icon with the same name already exists, it will be overwritten and a warning will be logged.
|
|
11
|
+
*
|
|
12
|
+
* @param name - The unique identifier for the icon.
|
|
13
|
+
* @param svgContent - The SVG markup string representing the icon.
|
|
14
|
+
*/
|
|
15
|
+
static register(name: string, svgContent: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves the SVG content for a registered icon by its name.
|
|
18
|
+
*
|
|
19
|
+
* @param name - The unique identifier of the icon to retrieve.
|
|
20
|
+
* @returns The SVG markup string if the icon exists, or `undefined` if not found.
|
|
21
|
+
*/
|
|
22
|
+
static get(name: string): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Registers multiple icons at once from an object mapping names to SVG content.
|
|
25
|
+
* This is a convenience method for bulk registration.
|
|
26
|
+
*
|
|
27
|
+
* @param icons - An object where keys are icon names and values are SVG markup strings.
|
|
28
|
+
*/
|
|
29
|
+
static registerIcons(icons: {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
}): void;
|
|
32
|
+
/**
|
|
33
|
+
* Checks whether an icon with the given name is registered.
|
|
34
|
+
*
|
|
35
|
+
* @param name - The unique identifier of the icon to check.
|
|
36
|
+
* @returns `true` if the icon exists in the registry, `false` otherwise.
|
|
37
|
+
*/
|
|
38
|
+
static has(name: string): boolean;
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KritzelCore } from '../core/core.class';
|
|
2
|
+
import { PasteIntent } from '../managers/clipboard.types';
|
|
3
|
+
import { KritzelPasteIntentProvider } from '../../interfaces/paste-intent-provider.interface';
|
|
4
|
+
export declare class KritzelPasteIntentProviderRegistry {
|
|
5
|
+
private readonly _core;
|
|
6
|
+
private readonly _providers;
|
|
7
|
+
constructor(_core: KritzelCore);
|
|
8
|
+
register(provider: KritzelPasteIntentProvider): void;
|
|
9
|
+
resolve(event?: ClipboardEvent): Promise<PasteIntent>;
|
|
10
|
+
}
|