@formicoidea/labre-core 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_pkgs/affine-block-attachment/attachment-block.js +1 -1
- package/dist/_pkgs/affine-block-callout/callout-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-callout/callout-block.js +26 -4
- package/dist/_pkgs/affine-block-callout/callout-keymap.js +59 -19
- package/dist/_pkgs/affine-block-callout/commands/callout-to-paragraph.d.ts +20 -0
- package/dist/_pkgs/affine-block-callout/commands/callout-to-paragraph.js +60 -0
- package/dist/_pkgs/affine-block-callout/commands/split-callout.d.ts +17 -0
- package/dist/_pkgs/affine-block-callout/commands/split-callout.js +42 -0
- package/dist/_pkgs/affine-block-callout/configs/slash-menu.js +9 -6
- package/dist/_pkgs/affine-block-callout/emoji-margin.d.ts +9 -0
- package/dist/_pkgs/affine-block-callout/emoji-margin.js +36 -0
- package/dist/_pkgs/affine-block-callout/emoji-menu.d.ts +5 -1
- package/dist/_pkgs/affine-block-callout/emoji-menu.js +5 -0
- package/dist/_pkgs/affine-block-code/code-block-inline.js +1 -1
- package/dist/_pkgs/affine-block-code/code-block.d.ts +14 -0
- package/dist/_pkgs/affine-block-code/code-block.js +44 -6
- package/dist/_pkgs/affine-block-code/code-toolbar/components/code-toolbar.d.ts +2 -0
- package/dist/_pkgs/affine-block-code/code-toolbar/components/code-toolbar.js +23 -14
- package/dist/_pkgs/affine-block-code/code-toolbar/components/more-menu.d.ts +16 -0
- package/dist/_pkgs/affine-block-code/code-toolbar/components/more-menu.js +93 -0
- package/dist/_pkgs/affine-block-code/code-toolbar/config.js +54 -5
- package/dist/_pkgs/affine-block-code/code-toolbar/index.js +1 -1
- package/dist/_pkgs/affine-block-code/effects.d.ts +2 -0
- package/dist/_pkgs/affine-block-code/effects.js +2 -0
- package/dist/_pkgs/affine-block-code/highlight/affine-code-unit.js +6 -1
- package/dist/_pkgs/affine-block-code/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-code/index.js +1 -0
- package/dist/_pkgs/affine-block-code/line-numbers.d.ts +25 -0
- package/dist/_pkgs/affine-block-code/line-numbers.js +27 -0
- package/dist/_pkgs/affine-block-code/styles.js +31 -0
- package/dist/_pkgs/affine-block-data-view/data-view-block.js +1 -0
- package/dist/_pkgs/affine-block-database/components/title/index.js +4 -1
- package/dist/_pkgs/affine-block-database/configs/slash-menu.js +28 -1
- package/dist/_pkgs/affine-block-database/data-source.js +1 -2
- package/dist/_pkgs/affine-block-database/database-block.js +13 -0
- package/dist/_pkgs/affine-block-database/external-data-source.js +1 -1
- package/dist/_pkgs/affine-block-database/properties/paste-url.d.ts +24 -0
- package/dist/_pkgs/affine-block-database/properties/paste-url.js +98 -0
- package/dist/_pkgs/affine-block-database/properties/rich-text/cell-renderer.js +9 -19
- package/dist/_pkgs/affine-block-database/properties/title/text.js +20 -25
- package/dist/_pkgs/affine-block-database/views/index.js +1 -0
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +11 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.d.ts +3 -0
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +48 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/font-size.d.ts +17 -0
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/font-size.js +24 -0
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-service.js +1 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +2 -2
- package/dist/_pkgs/affine-block-embed-doc/common/doc-trashed.d.ts +9 -0
- package/dist/_pkgs/affine-block-embed-doc/common/doc-trashed.js +10 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +8 -4
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/utils.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.d.ts +4 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +23 -4
- package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +13 -0
- package/dist/_pkgs/affine-block-frame/frame-manager.js +34 -2
- package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
- package/dist/_pkgs/affine-block-image/components/page-image-block.js +1 -1
- package/dist/_pkgs/affine-block-image/image-edgeless-block.js +1 -1
- package/dist/_pkgs/affine-block-latex/styles.js +6 -1
- package/dist/_pkgs/affine-block-list/utils/forward-delete.js +1 -1
- package/dist/_pkgs/affine-block-note/commands/select-block.js +1 -1
- package/dist/_pkgs/affine-block-note/commands/select-blocks-between.js +1 -1
- package/dist/_pkgs/affine-block-note/move-block.js +1 -1
- package/dist/_pkgs/affine-block-note/note-edgeless-block.d.ts +9 -0
- package/dist/_pkgs/affine-block-note/note-edgeless-block.js +29 -1
- package/dist/_pkgs/affine-block-paragraph/utils/forward-delete.js +2 -2
- package/dist/_pkgs/affine-block-paragraph/utils/merge-with-prev.js +1 -1
- package/dist/_pkgs/affine-block-root/commands/pivot-commands.d.ts +37 -0
- package/dist/_pkgs/affine-block-root/commands/pivot-commands.js +168 -0
- package/dist/_pkgs/affine-block-root/commands/reading-commands.d.ts +23 -0
- package/dist/_pkgs/affine-block-root/commands/reading-commands.js +107 -0
- package/dist/_pkgs/affine-block-root/commands/tag-commands.d.ts +47 -0
- package/dist/_pkgs/affine-block-root/commands/tag-commands.js +159 -0
- package/dist/_pkgs/affine-block-root/configs/toolbar.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +10 -3
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/render-linked-doc.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +27 -2
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +11 -2
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-service.js +14 -0
- package/dist/_pkgs/affine-block-root/edgeless/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/edgeless/index.js +1 -0
- package/dist/_pkgs/affine-block-root/edgeless/reserved-keys.d.ts +21 -0
- package/dist/_pkgs/affine-block-root/edgeless/reserved-keys.js +34 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/clipboard-utils.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +7 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +11 -2
- package/dist/_pkgs/affine-block-root/index.d.ts +4 -1
- package/dist/_pkgs/affine-block-root/index.js +4 -1
- package/dist/_pkgs/affine-block-root/keyboard/commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-root/keyboard/commands.js +147 -0
- package/dist/_pkgs/affine-block-root/view.js +13 -4
- package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.js +1 -1
- package/dist/_pkgs/affine-block-surface/adapters/plain-text/element-adapter/type.js +1 -1
- package/dist/_pkgs/affine-block-surface/commands/reassociate-connectors.js +0 -1
- package/dist/_pkgs/affine-block-surface/effects.js +6 -0
- package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +21 -3
- package/dist/_pkgs/affine-block-surface/element-model/index.js +14 -2
- package/dist/_pkgs/affine-block-surface/extensions/audit.d.ts +107 -0
- package/dist/_pkgs/affine-block-surface/extensions/audit.js +489 -0
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.d.ts +14 -0
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +37 -5
- package/dist/_pkgs/affine-block-surface/extensions/editor-anchored-panel.d.ts +133 -0
- package/dist/_pkgs/affine-block-surface/extensions/editor-anchored-panel.js +327 -0
- package/dist/_pkgs/affine-block-surface/extensions/element-renderer.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +17 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +17 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +172 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +393 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +306 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.js +64 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality-widget.d.ts +146 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality-widget.js +528 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality.d.ts +109 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality.js +84 -0
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.d.ts +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-toolbar.d.ts +15 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-toolbar.js +158 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +145 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +588 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +494 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +767 -0
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.d.ts +45 -0
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.js +177 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +107 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +958 -0
- package/dist/_pkgs/affine-block-surface/extensions/tags-toolbar.d.ts +10 -0
- package/dist/_pkgs/affine-block-surface/extensions/tags-toolbar.js +295 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation-toolbar.d.ts +27 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation-toolbar.js +361 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +2129 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation.js +4620 -0
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.d.ts +330 -0
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.js +1004 -0
- package/dist/_pkgs/affine-block-surface/extensions/violation-timeline.d.ts +80 -0
- package/dist/_pkgs/affine-block-surface/extensions/violation-timeline.js +123 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.d.ts +610 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.js +206 -0
- package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +188 -0
- package/dist/_pkgs/affine-block-surface/framework-background/facts.js +284 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +5 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.js +5 -0
- package/dist/_pkgs/affine-block-surface/framework-background/interaction.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/framework-background/interaction.js +24 -0
- package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +99 -0
- package/dist/_pkgs/affine-block-surface/framework-background/labels.js +193 -0
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.d.ts +8 -0
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +399 -0
- package/dist/_pkgs/affine-block-surface/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +69 -3
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +333 -44
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +18 -2
- package/dist/_pkgs/affine-block-surface/renderer/overlay.js +1 -1
- package/dist/_pkgs/affine-block-surface/tool/default-tool.js +8 -0
- package/dist/_pkgs/affine-block-surface/utils/font.js +9 -3
- package/dist/_pkgs/affine-block-surface/view.d.ts +17 -0
- package/dist/_pkgs/affine-block-surface/view.js +57 -2
- package/dist/_pkgs/affine-block-surface-ref/portal/note.js +2 -2
- package/dist/_pkgs/affine-block-table/commands.js +1 -1
- package/dist/_pkgs/affine-block-table/selection-controller.d.ts +6 -0
- package/dist/_pkgs/affine-block-table/selection-controller.js +24 -1
- package/dist/_pkgs/affine-block-table/table-block.js +8 -2
- package/dist/_pkgs/affine-block-table/table-cell.js +5 -6
- package/dist/_pkgs/affine-block-table/table-keymap.d.ts +18 -0
- package/dist/_pkgs/affine-block-table/table-keymap.js +41 -0
- package/dist/_pkgs/affine-block-table/utils.d.ts +7 -0
- package/dist/_pkgs/affine-block-table/utils.js +12 -0
- package/dist/_pkgs/affine-block-table/view.js +2 -0
- package/dist/_pkgs/affine-components/caption/captioned-block-component.js +2 -1
- package/dist/_pkgs/affine-components/context-menu/button.d.ts +7 -0
- package/dist/_pkgs/affine-components/context-menu/button.js +7 -2
- package/dist/_pkgs/affine-components/context-menu/input.d.ts +4 -0
- package/dist/_pkgs/affine-components/context-menu/input.js +12 -0
- package/dist/_pkgs/affine-components/context-menu/menu-all.d.ts +2 -0
- package/dist/_pkgs/affine-components/context-menu/menu-renderer.js +8 -1
- package/dist/_pkgs/affine-components/context-menu/sub-menu.js +3 -0
- package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +1 -1
- package/dist/_pkgs/affine-components/embed-card-modal/embed-card-edit-modal.js +1 -1
- package/dist/_pkgs/affine-components/filterable-list/styles.js +1 -1
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/highlight-duotone-icon.js +8 -8
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/text-duotone-icon.js +11 -11
- package/dist/_pkgs/affine-components/icon-picker/affine-icon-picker-panel.d.ts +28 -0
- package/dist/_pkgs/affine-components/icon-picker/affine-icon-picker-panel.js +231 -0
- package/dist/_pkgs/affine-components/icon-picker/emoji-data.d.ts +40 -0
- package/dist/_pkgs/affine-components/icon-picker/emoji-data.js +99 -0
- package/dist/_pkgs/affine-components/icon-picker/emoji-picker-panel.d.ts +32 -0
- package/dist/_pkgs/affine-components/icon-picker/emoji-picker-panel.js +276 -0
- package/dist/_pkgs/affine-components/icon-picker/icon-data.d.ts +34 -0
- package/dist/_pkgs/affine-components/icon-picker/icon-data.js +83 -0
- package/dist/_pkgs/affine-components/icon-picker/icon-picker.d.ts +39 -0
- package/dist/_pkgs/affine-components/icon-picker/icon-picker.js +233 -0
- package/dist/_pkgs/affine-components/icon-picker/index.d.ts +8 -0
- package/dist/_pkgs/affine-components/icon-picker/index.js +15 -0
- package/dist/_pkgs/affine-components/icon-picker/recent-store.d.ts +8 -0
- package/dist/_pkgs/affine-components/icon-picker/recent-store.js +41 -0
- package/dist/_pkgs/affine-components/icon-picker/styles.d.ts +5 -0
- package/dist/_pkgs/affine-components/icon-picker/styles.js +166 -0
- package/dist/_pkgs/affine-components/icon-picker/types.d.ts +22 -0
- package/dist/_pkgs/affine-components/icon-picker/types.js +10 -0
- package/dist/_pkgs/affine-components/icons/text.js +426 -426
- package/dist/_pkgs/affine-components/open-doc-dropdown-menu/dropdown-menu.d.ts +1 -0
- package/dist/_pkgs/affine-components/peek/peekable.js +1 -1
- package/dist/_pkgs/affine-components/portal/portal.d.ts +1 -1
- package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -0
- package/dist/_pkgs/affine-components/toolbar/index.js +1 -0
- package/dist/_pkgs/affine-components/toolbar/menu-button.js +2 -1
- package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +55 -0
- package/dist/_pkgs/affine-components/toolbar/picker-menu.js +47 -0
- package/dist/_pkgs/affine-components/toolbar/toolbar.js +11 -10
- package/dist/_pkgs/affine-foundation/view.js +11 -2
- package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.js +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/header/frames-setting-menu.js +1 -1
- package/dist/_pkgs/affine-fragment-outline/mobile-outline-panel.js +1 -1
- package/dist/_pkgs/affine-gfx-brush/index.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-brush/index.js +1 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/brush.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/brush.js +11 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/highlighter.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/highlighter.js +11 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/index.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/index.js +2 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/shared.d.ts +14 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/shared.js +54 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/index.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/index.js +4 -0
- package/dist/_pkgs/affine-gfx-brush/toolbar/components/pen/pen-tool-button.js +1 -1
- package/dist/_pkgs/affine-gfx-brush/view.d.ts +14 -0
- package/dist/_pkgs/affine-gfx-brush/view.js +29 -3
- package/dist/_pkgs/affine-gfx-connector/connector-manager.js +39 -16
- package/dist/_pkgs/affine-gfx-connector/connector-tool.d.ts +26 -1
- package/dist/_pkgs/affine-gfx-connector/connector-tool.js +12 -3
- package/dist/_pkgs/affine-gfx-connector/connector-watcher.js +1 -4
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.d.ts +123 -0
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +282 -0
- package/dist/_pkgs/affine-gfx-connector/direction/direction-widget.d.ts +65 -0
- package/dist/_pkgs/affine-gfx-connector/direction/direction-widget.js +395 -0
- package/dist/_pkgs/affine-gfx-connector/direction/index.d.ts +4 -0
- package/dist/_pkgs/affine-gfx-connector/direction/index.js +4 -0
- package/dist/_pkgs/affine-gfx-connector/direction/invert-direction.d.ts +72 -0
- package/dist/_pkgs/affine-gfx-connector/direction/invert-direction.js +185 -0
- package/dist/_pkgs/affine-gfx-connector/direction/typed-edge.d.ts +69 -0
- package/dist/_pkgs/affine-gfx-connector/direction/typed-edge.js +66 -0
- package/dist/_pkgs/affine-gfx-connector/effects.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-connector/effects.js +2 -0
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +78 -41
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/index.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-connector/index.js +1 -0
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.d.ts +50 -0
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +68 -2
- package/dist/_pkgs/affine-gfx-connector/view.js +16 -0
- package/dist/_pkgs/affine-gfx-group/command/group-api.js +150 -62
- package/dist/_pkgs/affine-gfx-group/text/edgeless-group-title-editor.js +4 -1
- package/dist/_pkgs/affine-gfx-mindmap/adapter/markdown/index.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/adapter/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +583 -4
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.js +23 -23
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.js +5 -1
- package/dist/_pkgs/affine-gfx-mindmap/view/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-note/overlay/overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-note/toolbar/note-senior-button.js +1 -1
- package/dist/_pkgs/affine-gfx-pointer/tools/pan-tool.d.ts +16 -0
- package/dist/_pkgs/affine-gfx-pointer/tools/pan-tool.js +102 -32
- package/dist/_pkgs/affine-gfx-shape/commands.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-shape/commands.js +33 -0
- package/dist/_pkgs/affine-gfx-shape/consts.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/draggable/shape-draggable.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/polygon.js +17 -9
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/utils.js +8 -3
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape-dom/index.js +48 -19
- package/dist/_pkgs/affine-gfx-shape/element-view.js +19 -12
- package/dist/_pkgs/affine-gfx-shape/index.d.ts +1 -1
- package/dist/_pkgs/affine-gfx-shape/index.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-vertex-editing-overlay.js +12 -7
- package/dist/_pkgs/affine-gfx-shape/overlay/shape-overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +4 -2
- package/dist/_pkgs/affine-gfx-shape/shape-tool.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.d.ts +26 -0
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +124 -15
- package/dist/_pkgs/affine-gfx-shape/view.js +3 -3
- package/dist/_pkgs/affine-gfx-template/builtin/other.js +66 -17
- package/dist/_pkgs/affine-gfx-template/toolbar/overlay-scrollbar.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-tool-button.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-template/toolbar/template-tool-button.js +18 -1
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +9 -5
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +1 -1
- package/dist/_pkgs/affine-inline-latex/command.js +46 -26
- package/dist/_pkgs/affine-inline-latex/latex-node/latex-node.d.ts +10 -0
- package/dist/_pkgs/affine-inline-latex/latex-node/latex-node.js +23 -0
- package/dist/_pkgs/affine-inline-link/command.js +1 -1
- package/dist/_pkgs/affine-inline-link/link-node/affine-link.js +4 -1
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +29 -1
- package/dist/_pkgs/affine-inline-preset/command/format-block.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/format-native.js +2 -2
- package/dist/_pkgs/affine-inline-preset/command/format-text.js +1 -1
- package/dist/_pkgs/affine-inline-preset/inline-spec.js +1 -1
- package/dist/_pkgs/affine-inline-reference/reference-node/reference-node.js +1 -1
- package/dist/_pkgs/affine-model/blocks/code/code-model.d.ts +1 -0
- package/dist/_pkgs/affine-model/blocks/code/code-model.js +1 -0
- package/dist/_pkgs/affine-model/elements/bpmn/node.d.ts +40 -7
- package/dist/_pkgs/affine-model/elements/bpmn/node.js +4 -2
- package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +74 -17
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +55 -26
- package/dist/_pkgs/affine-model/elements/c4/board.d.ts +88 -0
- package/dist/_pkgs/affine-model/elements/c4/board.js +128 -0
- package/dist/_pkgs/affine-model/elements/c4/boundary.d.ts +63 -0
- package/dist/_pkgs/affine-model/elements/c4/boundary.js +134 -0
- package/dist/_pkgs/affine-model/elements/c4/index.d.ts +3 -0
- package/dist/_pkgs/affine-model/elements/c4/index.js +3 -0
- package/dist/_pkgs/affine-model/elements/c4/node.d.ts +97 -0
- package/dist/_pkgs/affine-model/elements/c4/node.js +130 -0
- package/dist/_pkgs/affine-model/elements/connector/connector.js +25 -1
- package/dist/_pkgs/affine-model/elements/context-map/context-map.d.ts +27 -0
- package/dist/_pkgs/affine-model/elements/context-map/context-map.js +94 -0
- package/dist/_pkgs/affine-model/elements/context-map/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/context-map/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +34 -17
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +28 -26
- package/dist/_pkgs/affine-model/elements/edgy/board.d.ts +32 -0
- package/dist/_pkgs/affine-model/elements/edgy/board.js +112 -0
- package/dist/_pkgs/affine-model/elements/edgy/facets.d.ts +12 -0
- package/dist/_pkgs/affine-model/elements/edgy/facets.js +25 -1
- package/dist/_pkgs/affine-model/elements/edgy/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/edgy/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +36 -0
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +103 -0
- package/dist/_pkgs/affine-model/elements/event-storming/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/event-storming/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +42 -0
- package/dist/_pkgs/affine-model/elements/framework-background/background.js +42 -0
- package/dist/_pkgs/affine-model/elements/framework-background/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/framework-background/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/index.d.ts +14 -1
- package/dist/_pkgs/affine-model/elements/index.js +4 -0
- package/dist/_pkgs/affine-model/elements/mindmap/mindmap.js +8 -3
- package/dist/_pkgs/affine-model/elements/mindmap/style.d.ts +10 -0
- package/dist/_pkgs/affine-model/elements/mindmap/style.js +8 -0
- package/dist/_pkgs/affine-model/elements/shape/api/polygon.js +2 -8
- package/dist/_pkgs/affine-model/elements/wardley/wardley.d.ts +21 -29
- package/dist/_pkgs/affine-model/elements/wardley/wardley.js +41 -48
- package/dist/_pkgs/affine-shared/adapters/html/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/delta-converter.d.ts +6 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/delta-converter.js +161 -3
- package/dist/_pkgs/affine-shared/adapters/markdown/markdown.js +5 -1
- package/dist/_pkgs/affine-shared/adapters/notion-html/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/notion-html/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/plain-text/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/plain-text/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/types/delta-converter.d.ts +1 -0
- package/dist/_pkgs/affine-shared/adapters/utils/color.d.ts +24 -0
- package/dist/_pkgs/affine-shared/adapters/utils/color.js +283 -0
- package/dist/_pkgs/affine-shared/adapters/utils/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/adapters/utils/index.js +1 -0
- package/dist/_pkgs/affine-shared/commands/block-crud/get-selected-blocks.js +10 -2
- package/dist/_pkgs/affine-shared/commands/model-crud/draft-selected-models.js +1 -1
- package/dist/_pkgs/affine-shared/commands/selection/focus-block-end.js +1 -1
- package/dist/_pkgs/affine-shared/commands/selection/focus-block-start.js +1 -1
- package/dist/_pkgs/affine-shared/consts/index.d.ts +10 -0
- package/dist/_pkgs/affine-shared/consts/index.js +10 -0
- package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.d.ts +55 -0
- package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.js +35 -0
- package/dist/_pkgs/affine-shared/services/audit-service.d.ts +311 -0
- package/dist/_pkgs/affine-shared/services/audit-service.js +228 -0
- package/dist/_pkgs/affine-shared/services/command-usage-service.d.ts +31 -0
- package/dist/_pkgs/affine-shared/services/command-usage-service.js +109 -0
- package/dist/_pkgs/affine-shared/services/comment-service/block-comment-manager.js +1 -1
- package/dist/_pkgs/affine-shared/services/doc-display-meta-service.js +1 -1
- package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +7 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.js +11 -0
- package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.js +1 -1
- package/dist/_pkgs/affine-shared/services/font-loader/font-loader-service.d.ts +26 -1
- package/dist/_pkgs/affine-shared/services/font-loader/font-loader-service.js +124 -7
- package/dist/_pkgs/affine-shared/services/index.d.ts +7 -0
- package/dist/_pkgs/affine-shared/services/index.js +7 -0
- package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.d.ts +129 -0
- package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +312 -0
- package/dist/_pkgs/affine-shared/services/pivot-properties-service.d.ts +217 -0
- package/dist/_pkgs/affine-shared/services/pivot-properties-service.js +114 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/code-block.d.ts +1 -1
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +255 -1
- package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/telemetry-service/types.d.ts +6 -1
- package/dist/_pkgs/affine-shared/services/toolbar-service/action.d.ts +10 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/layout.d.ts +134 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/layout.js +146 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/registry.d.ts +44 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/registry.js +161 -3
- package/dist/_pkgs/affine-shared/services/translation-service/index.d.ts +68 -0
- package/dist/_pkgs/affine-shared/services/translation-service/index.js +39 -0
- package/dist/_pkgs/affine-shared/services/universe-tag-defs-service.d.ts +155 -0
- package/dist/_pkgs/affine-shared/services/universe-tag-defs-service.js +256 -0
- package/dist/_pkgs/affine-shared/test-utils/affine-template.js +1 -1
- package/dist/_pkgs/affine-shared/utils/dom/point-to-range.d.ts +4 -0
- package/dist/_pkgs/affine-shared/utils/dom/point-to-range.js +58 -2
- package/dist/_pkgs/affine-shared/utils/dom/viewport.d.ts +60 -0
- package/dist/_pkgs/affine-shared/utils/dom/viewport.js +58 -0
- package/dist/_pkgs/affine-shared/utils/edgeless.js +1 -1
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +34 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +48 -7
- package/dist/_pkgs/affine-shared/utils/print-to-pdf.d.ts +21 -0
- package/dist/_pkgs/affine-shared/utils/print-to-pdf.js +166 -32
- package/dist/_pkgs/affine-shared/utils/zod-schema.d.ts +7 -0
- package/dist/_pkgs/affine-shared/utils/zod-schema.js +25 -1
- package/dist/_pkgs/affine-widget-drag-handle/utils.js +1 -1
- package/dist/_pkgs/affine-widget-drag-handle/watchers/edgeless-watcher.d.ts +19 -10
- package/dist/_pkgs/affine-widget-drag-handle/watchers/edgeless-watcher.js +122 -23
- package/dist/_pkgs/affine-widget-drag-handle/watchers/pointer-event-watcher.d.ts +2 -0
- package/dist/_pkgs/affine-widget-drag-handle/watchers/pointer-event-watcher.js +25 -4
- package/dist/_pkgs/affine-widget-edgeless-auto-connect/index.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/auto-complete-panel.js +10 -5
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-auto-complete.d.ts +15 -1
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-auto-complete.js +37 -32
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-element-link.js +5 -4
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-selected-rect.js +19 -9
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.d.ts +16 -2
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +19 -2
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.d.ts +14 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.js +40 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +158 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +572 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.d.ts +46 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +66 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.d.ts +13 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.js +50 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.d.ts +6 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.js +15 -5
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/extension/index.d.ts +7 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +5 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +5 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +57 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +140 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +9 -0
- package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +4 -1
- package/dist/_pkgs/affine-widget-keyboard-toolbar/icons.js +98 -98
- package/dist/_pkgs/affine-widget-keyboard-toolbar/keyboard-tool-panel.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/import-doc/import-doc.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/linked-doc-popover.js +2 -15
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.d.ts +10 -1
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.js +133 -6
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.d.ts +10 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.js +120 -3
- package/dist/_pkgs/affine-widget-linked-doc/utils.d.ts +12 -0
- package/dist/_pkgs/affine-widget-linked-doc/utils.js +33 -0
- package/dist/_pkgs/affine-widget-page-dragging-area/index.js +1 -1
- package/dist/_pkgs/affine-widget-remote-selection/doc/doc-remote-selection.js +1 -1
- package/dist/_pkgs/affine-widget-remote-selection/edgeless/index.js +6 -4
- package/dist/_pkgs/affine-widget-slash-menu/slash-menu-popover.js +8 -4
- package/dist/_pkgs/affine-widget-slash-menu/utils.d.ts +9 -0
- package/dist/_pkgs/affine-widget-slash-menu/utils.js +24 -0
- package/dist/_pkgs/affine-widget-toolbar/toolbar.d.ts +6 -0
- package/dist/_pkgs/affine-widget-toolbar/toolbar.js +40 -8
- package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +146 -3
- package/dist/_pkgs/affine-widget-toolbar/utils.js +744 -58
- package/dist/_pkgs/data-view/core/common/property-menu.js +3 -16
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +4 -0
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +28 -1
- package/dist/_pkgs/data-view/core/data-view.d.ts +3 -1
- package/dist/_pkgs/data-view/core/data-view.js +25 -3
- package/dist/_pkgs/data-view/core/detail/field.js +2 -2
- package/dist/_pkgs/data-view/core/detail/selection.d.ts +4 -2
- package/dist/_pkgs/data-view/core/detail/selection.js +23 -7
- package/dist/_pkgs/data-view/core/effect.js +2 -0
- package/dist/_pkgs/data-view/core/filter/eval.js +36 -23
- package/dist/_pkgs/data-view/core/filter/filter-fn/matcher.d.ts +7 -0
- package/dist/_pkgs/data-view/core/filter/filter-fn/matcher.js +12 -0
- package/dist/_pkgs/data-view/core/group-by/compare-date-keys.d.ts +11 -0
- package/dist/_pkgs/data-view/core/group-by/compare-date-keys.js +55 -0
- package/dist/_pkgs/data-view/core/group-by/define.d.ts +6 -0
- package/dist/_pkgs/data-view/core/group-by/define.js +114 -0
- package/dist/_pkgs/data-view/core/group-by/matcher.d.ts +7 -0
- package/dist/_pkgs/data-view/core/group-by/matcher.js +13 -0
- package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +11 -11
- package/dist/_pkgs/data-view/core/group-by/renderer/date-group.d.ts +9 -0
- package/dist/_pkgs/data-view/core/group-by/renderer/date-group.js +97 -0
- package/dist/_pkgs/data-view/core/group-by/setting.js +86 -7
- package/dist/_pkgs/data-view/core/group-by/trait.d.ts +34 -0
- package/dist/_pkgs/data-view/core/group-by/trait.js +106 -10
- package/dist/_pkgs/data-view/core/utils/menu-title.js +17 -17
- package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/property-presets/number/define.js +2 -1
- package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/view-presets/calendar/calendar-view-manager.d.ts +70 -0
- package/dist/_pkgs/data-view/view-presets/calendar/calendar-view-manager.js +449 -0
- package/dist/_pkgs/data-view/view-presets/calendar/define.d.ts +10 -0
- package/dist/_pkgs/data-view/view-presets/calendar/define.js +27 -0
- package/dist/_pkgs/data-view/view-presets/calendar/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/calendar/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/calendar/index.d.ts +6 -0
- package/dist/_pkgs/data-view/view-presets/calendar/index.js +6 -0
- package/dist/_pkgs/data-view/view-presets/calendar/layout.d.ts +37 -0
- package/dist/_pkgs/data-view/view-presets/calendar/layout.js +138 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/actions.d.ts +7 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/actions.js +64 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/dnd.d.ts +32 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/dnd.js +159 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/effect.js +7 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/hit-test.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/hit-test.js +28 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/styles.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/styles.js +707 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/view.d.ts +89 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/view.js +849 -0
- package/dist/_pkgs/data-view/view-presets/calendar/renderer.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/calendar/renderer.js +8 -0
- package/dist/_pkgs/data-view/view-presets/calendar/source.d.ts +8 -0
- package/dist/_pkgs/data-view/view-presets/calendar/source.js +3 -0
- package/dist/_pkgs/data-view/view-presets/calendar/types.d.ts +79 -0
- package/dist/_pkgs/data-view/view-presets/calendar/types.js +1 -0
- package/dist/_pkgs/data-view/view-presets/convert.js +28 -0
- package/dist/_pkgs/data-view/view-presets/effect.js +2 -0
- package/dist/_pkgs/data-view/view-presets/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/index.js +3 -0
- package/dist/_pkgs/data-view/view-presets/kanban/kanban-view-manager.js +3 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +2 -2
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.d.ts +18 -0
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.js +36 -0
- package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +2 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.d.ts +11 -0
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +89 -4
- package/dist/_pkgs/data-view/view-presets/table/pc/cell.d.ts +3 -0
- package/dist/_pkgs/data-view/view-presets/table/pc/cell.js +11 -2
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.js +39 -33
- package/dist/_pkgs/data-view/view-presets/table/pc/group.d.ts +10 -0
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +86 -5
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.js +39 -33
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +18 -18
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.d.ts +3 -0
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.js +8 -0
- package/dist/_pkgs/data-view/view-presets/table/table-view-manager.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/utils.d.ts +3 -0
- package/dist/_pkgs/data-view/view-presets/table/utils.js +16 -1
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +3 -1
- package/dist/_pkgs/global/gfx/curve.js +4 -3
- package/dist/_pkgs/std/clipboard/clipboard.js +13 -3
- package/dist/_pkgs/std/clipboard/utils.d.ts +5 -0
- package/dist/_pkgs/std/clipboard/utils.js +10 -0
- package/dist/_pkgs/std/event/dispatcher.js +27 -1
- package/dist/_pkgs/std/event/keymap.js +16 -6
- package/dist/_pkgs/std/extension/command-registry.d.ts +475 -0
- package/dist/_pkgs/std/extension/command-registry.js +431 -0
- package/dist/_pkgs/std/extension/dnd/index.d.ts +1 -1
- package/dist/_pkgs/std/extension/index.d.ts +2 -0
- package/dist/_pkgs/std/extension/index.js +2 -0
- package/dist/_pkgs/std/extension/shortcut.js +2 -1
- package/dist/_pkgs/std/extension/translation-manifest.d.ts +49 -0
- package/dist/_pkgs/std/extension/translation-manifest.js +71 -0
- package/dist/_pkgs/std/gfx/grid.js +1 -1
- package/dist/_pkgs/std/gfx/index.d.ts +7 -3
- package/dist/_pkgs/std/gfx/index.js +6 -2
- package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +6 -1
- package/dist/_pkgs/std/gfx/interactivity/manager.d.ts +8 -0
- package/dist/_pkgs/std/gfx/interactivity/manager.js +18 -0
- package/dist/_pkgs/std/gfx/layer.d.ts +1 -1
- package/dist/_pkgs/std/gfx/layer.js +1 -2
- package/dist/_pkgs/std/gfx/model/surface/decorators/field.js +9 -0
- package/dist/_pkgs/std/gfx/model/surface/decorators/index.d.ts +2 -2
- package/dist/_pkgs/std/gfx/model/surface/decorators/index.js +2 -2
- package/dist/_pkgs/std/gfx/model/surface/decorators/local.d.ts +14 -0
- package/dist/_pkgs/std/gfx/model/surface/decorators/local.js +22 -0
- package/dist/_pkgs/std/gfx/model/surface/decorators/observer.d.ts +2 -0
- package/dist/_pkgs/std/gfx/model/surface/decorators/observer.js +40 -1
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +442 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +510 -25
- package/dist/_pkgs/std/gfx/model/surface/pivot.d.ts +48 -0
- package/dist/_pkgs/std/gfx/model/surface/pivot.js +34 -0
- package/dist/_pkgs/std/gfx/model/surface/role.d.ts +153 -0
- package/dist/_pkgs/std/gfx/model/surface/role.js +117 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +70 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +305 -17
- package/dist/_pkgs/std/gfx/model/surface/tags.d.ts +77 -0
- package/dist/_pkgs/std/gfx/model/surface/tags.js +246 -0
- package/dist/_pkgs/std/gfx/perf.d.ts +10 -0
- package/dist/_pkgs/std/gfx/perf.js +30 -0
- package/dist/_pkgs/std/gfx/selection.js +1 -1
- package/dist/_pkgs/std/gfx/tool/tool-controller.d.ts +13 -0
- package/dist/_pkgs/std/gfx/tool/tool-controller.js +26 -0
- package/dist/_pkgs/std/gfx/viewport.d.ts +12 -0
- package/dist/_pkgs/std/gfx/viewport.js +20 -2
- package/dist/_pkgs/std/inline/extensions/inline-manager.js +1 -1
- package/dist/_pkgs/std/inline/extensions/markdown-matcher.js +1 -1
- package/dist/_pkgs/std/inline/services/event.d.ts +2 -0
- package/dist/_pkgs/std/inline/services/event.js +96 -21
- package/dist/_pkgs/std/utils/layer.js +2 -6
- package/dist/_pkgs/std/utils/tree.d.ts +14 -0
- package/dist/_pkgs/std/utils/tree.js +59 -8
- package/dist/_pkgs/std/view/element/gfx-block-component.js +23 -13
- package/dist/_pkgs/store/extension/workspace/workspace-meta.d.ts +10 -0
- package/dist/_pkgs/store/model/block/flat-sync-controller.js +2 -12
- package/dist/_pkgs/store/model/store/crud.js +10 -4
- package/dist/_pkgs/store/reactive/flat-native-y/index.d.ts +1 -1
- package/dist/_pkgs/store/reactive/flat-native-y/index.js +24 -2
- package/dist/commands.d.ts +58 -0
- package/dist/commands.js +66 -0
- package/dist/extensions/command-telemetry.d.ts +21 -0
- package/dist/extensions/command-telemetry.js +89 -0
- package/dist/extensions/command-usage.d.ts +23 -0
- package/dist/extensions/command-usage.js +37 -0
- package/dist/extensions/store.d.ts +9 -4
- package/dist/extensions/store.js +27 -24
- package/dist/extensions/view.d.ts +9 -4
- package/dist/extensions/view.js +35 -8
- package/dist/flags.d.ts +98 -21
- package/dist/flags.js +103 -22
- package/dist/frameworks.d.ts +45 -0
- package/dist/frameworks.js +186 -0
- package/dist/schemas.d.ts +8 -5
- package/dist/schemas.js +28 -32
- package/dist/shortcuts.d.ts +16 -16
- package/dist/shortcuts.js +8 -36
- package/dist/translations.d.ts +56 -0
- package/dist/translations.js +200 -0
- package/package.json +16 -4
- package/dist/_pkgs/affine-block-root/keyboard/shortcuts.d.ts +0 -8
- package/dist/_pkgs/affine-block-root/keyboard/shortcuts.js +0 -48
- package/dist/_pkgs/affine-gfx-shape/shortcuts.d.ts +0 -6
- package/dist/_pkgs/affine-gfx-shape/shortcuts.js +0 -28
- package/dist/_pkgs/data-view/core/utils/cache.d.ts +0 -5
- package/dist/_pkgs/data-view/core/utils/cache.js +0 -28
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { ServiceProvider } from '../../global/di/index.js';
|
|
2
|
+
import type { BlockStdScope } from '../../std/index.js';
|
|
3
|
+
import { type InterchangeFormat, type InterchangeImportCapability, type InterchangeReport, type SerializedElementProps } from './interchange.js';
|
|
4
|
+
/**
|
|
5
|
+
* **The public import API** — what an editor, a host application or a plugin
|
|
6
|
+
* calls to turn a foreign file into a board (`docs/adr/0012`).
|
|
7
|
+
*
|
|
8
|
+
* The registry next door declares WHAT Labre can read; a reader is a pure
|
|
9
|
+
* function of text (P3), and it deliberately stops short of the four things
|
|
10
|
+
* only a caller with an editor in its hands can do: pick the file, mint surface
|
|
11
|
+
* ids and repair the references that named the file's, bring the drawing into
|
|
12
|
+
* view, and say what the import cost. Those four were written once, for BPMN,
|
|
13
|
+
* inside `gfx/bpmn/src/actions.ts`. They are here now because not one line of
|
|
14
|
+
* them was about BPMN: an OWM sketch, a mermaid diagram and an SVG all need the
|
|
15
|
+
* same four, and a second copy of them would be a second set of bugs and a
|
|
16
|
+
* second wording of the same report.
|
|
17
|
+
*
|
|
18
|
+
* Three audiences, and they take different doors:
|
|
19
|
+
*
|
|
20
|
+
* - a **framework command** calls {@link runInterchangeImportFile} with its own
|
|
21
|
+
* capability, and that is the whole of its import glue;
|
|
22
|
+
* - a **host** (labreapp) builds its own import surface — a drop zone, a
|
|
23
|
+
* sidepanel, a menu of everything readable — on
|
|
24
|
+
* {@link interchangeImportersByExtension} to decide WHAT can read the file it
|
|
25
|
+
* was handed, and {@link importInterchangeFile} to run it: a drop zone
|
|
26
|
+
* already holds the `File` and must not be answered with a dialog;
|
|
27
|
+
* - **labre-mcp** calls no function here at all. It has no editor, so it calls
|
|
28
|
+
* `capability.run` directly and writes the props itself, which is exactly the
|
|
29
|
+
* purity P3 buys.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Write an imported board onto the surface, and give back the ids it minted.
|
|
33
|
+
*
|
|
34
|
+
* ## The one thing the caller of an importer owes (`docs/adr/0012`, D3)
|
|
35
|
+
*
|
|
36
|
+
* `surface.addElement` mints its own nanoid and ignores any id it is handed —
|
|
37
|
+
* surface identity is Labre's and never the file's — so a connector arrives
|
|
38
|
+
* with `source` / `target` naming the SOURCE FILE's ids. Every element carries
|
|
39
|
+
* its own source id under `interchange[formatId].id`, so the map from file id to
|
|
40
|
+
* surface id is a fold over the very array the reader returned; the second pass
|
|
41
|
+
* rewrites the two endpoints from it. Nothing else is needed, and nothing else
|
|
42
|
+
* is done: an end the map cannot resolve is left exactly as the file wrote it.
|
|
43
|
+
* That keeps the DOCUMENT honest, not the drawing — a connector naming an id no
|
|
44
|
+
* element has routes to an empty path and is invisible on the canvas (it does
|
|
45
|
+
* not crash; `connector-manager.ts` handles the missing connectable) — and an
|
|
46
|
+
* unresolvable name a reader can go and look up in the source file beats one
|
|
47
|
+
* this function quietly invented.
|
|
48
|
+
*
|
|
49
|
+
* The `interchange` payload needs no second pass: it rides in the props as one
|
|
50
|
+
* whole blob and `addElement` writes it with everything else, which is the
|
|
51
|
+
* whole-record LWW the field's own contract asks for (D2).
|
|
52
|
+
*
|
|
53
|
+
* @param formatId the format whose payload key carries the source ids — the
|
|
54
|
+
* `id` of the capability's {@link InterchangeFormat}, and the ONLY thing this
|
|
55
|
+
* function ever knew about BPMN.
|
|
56
|
+
*/
|
|
57
|
+
export declare function materializeInterchangeImport(std: BlockStdScope, formatId: string, elements: readonly SerializedElementProps[]): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Say what the import did — the summary, and the remarks.
|
|
60
|
+
*
|
|
61
|
+
* ## v1 of ADR 0012's open question 4 ("where does the report live?")
|
|
62
|
+
*
|
|
63
|
+
* The architect's v1: a NOTIFICATION for the summary, and the full notes on a
|
|
64
|
+
* surface that is reachable and honest. Reachable rules out a toast that names
|
|
65
|
+
* a count and drops the list; honest rules out the two things that look easier
|
|
66
|
+
* — writing the notes into the document as a text annotation (which pollutes a
|
|
67
|
+
* board the user did not ask us to draw on, and which the next export would
|
|
68
|
+
* have to explain) and dropping them (the notes are not derivable by re-running
|
|
69
|
+
* anything: the file is gone the moment the picker closes).
|
|
70
|
+
*
|
|
71
|
+
* So: one notification with the counts and the format version, a second with
|
|
72
|
+
* the remarks when there are few enough to read, and `console.table` with all
|
|
73
|
+
* of them, always, whenever there is one. The console is a poor product
|
|
74
|
+
* surface and it is named as one — the deliberate TARGET is the conformity
|
|
75
|
+
* panel, which is where a reader already goes to ask what is wrong with this
|
|
76
|
+
* board, and where an import remark belongs beside a validation finding. This
|
|
77
|
+
* is a stopgap that tells the truth, not the destination.
|
|
78
|
+
*
|
|
79
|
+
* ## The format is a word in the sentence, not a sentence per format
|
|
80
|
+
*
|
|
81
|
+
* The wordings are one set of keys for every format, and the format's own name
|
|
82
|
+
* is composed into them ({@link formatLabel}). The translation seam has no
|
|
83
|
+
* interpolation and no pluralisation — both are the host's — so a countable
|
|
84
|
+
* noun and a proper noun are the largest units this library can hand over
|
|
85
|
+
* without inventing grammar, which is the same argument the three count labels
|
|
86
|
+
* already ran on. The alternative, a key per format, would ask a host to
|
|
87
|
+
* translate "BPMN file imported" and "SVG file imported" as unrelated
|
|
88
|
+
* sentences and would leave every new format silently untranslated.
|
|
89
|
+
*/
|
|
90
|
+
export declare function reportInterchangeImport(std: BlockStdScope, format: InterchangeFormat, report: InterchangeReport): void;
|
|
91
|
+
/**
|
|
92
|
+
* Read a file the user picks with one declared capability, draw it, and say
|
|
93
|
+
* what it cost.
|
|
94
|
+
*
|
|
95
|
+
* Two steps, and neither is re-implemented anywhere: ask for a file, then hand
|
|
96
|
+
* it to {@link importInterchangeFile}, which is the rest of the gesture.
|
|
97
|
+
*
|
|
98
|
+
* ## The picker filter is the FORMAT's, not a table's
|
|
99
|
+
*
|
|
100
|
+
* `{ [mime]: extensions }` straight off the declaration, so a framework that
|
|
101
|
+
* adds a format adds its dialog filter with it and no second file has to agree.
|
|
102
|
+
* A format that declares no mime is offered as `text/plain`, which is what a
|
|
103
|
+
* DSL is — the extensions are the half that matters anyway, and the fallback
|
|
104
|
+
* branch of the picker (`showOpenFilePicker` is absent in Firefox and Safari)
|
|
105
|
+
* puts both halves into `input.accept` precisely because extensions like
|
|
106
|
+
* `.bpmn` are registered with no operating system on earth.
|
|
107
|
+
*
|
|
108
|
+
* The read-only guard is here as well as inside `importInterchangeFile`, and
|
|
109
|
+
* deliberately so: a dialog a document cannot honour should never open in the
|
|
110
|
+
* first place.
|
|
111
|
+
*/
|
|
112
|
+
export declare function runInterchangeImportFile(std: BlockStdScope, capability: InterchangeImportCapability): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* The import itself, over a file the caller ALREADY HAS: run the declared
|
|
115
|
+
* capability (`docs/adr/0012`), write what it returned, bring it into view, and
|
|
116
|
+
* say what it cost.
|
|
117
|
+
*
|
|
118
|
+
* ## Why this is separate from the picker
|
|
119
|
+
*
|
|
120
|
+
* Because a picker is one way to be handed a file and not the only one. A host
|
|
121
|
+
* drop zone has the `File` the moment somebody lets go of it; so does a paste,
|
|
122
|
+
* an "open with", and a fetch from a document store. Every one of those wants
|
|
123
|
+
* the four steps below and none of them wants a dialog — and a seam that only
|
|
124
|
+
* exists behind `showOpenFilePicker` forces each of them to re-implement the id
|
|
125
|
+
* remapping and the viewport fit, which is the duplication this whole file was
|
|
126
|
+
* written to end.
|
|
127
|
+
*
|
|
128
|
+
* It is also the honest testing seam. A test that has to intercept a MODULE to
|
|
129
|
+
* reach this code is a test coupled to the bundler; passing the file in is one
|
|
130
|
+
* argument, and it means the pipeline is proven the same way in every
|
|
131
|
+
* environment the library runs in. `capability.run` is the same function
|
|
132
|
+
* labre-mcp calls, so a command, a drop zone and the registry cannot read the
|
|
133
|
+
* same file differently — one door, and the registry is the label on it.
|
|
134
|
+
*
|
|
135
|
+
* ## What arrives is a NEW board, never a merge
|
|
136
|
+
*
|
|
137
|
+
* The elements are added beside whatever is already on the surface. That is the
|
|
138
|
+
* bottom row of a reader's own loss table — surface identity across a
|
|
139
|
+
* re-import is lost — and it is the honest behaviour: two boards the user can
|
|
140
|
+
* see and delete beats a merge that silently rewrote artefacts they had edited.
|
|
141
|
+
*
|
|
142
|
+
* ## Failure is an exception, and it says which one
|
|
143
|
+
*
|
|
144
|
+
* A reader THROWS on a file it cannot read, because the five note kinds cannot
|
|
145
|
+
* say "this is not a file I can read" and a report of three zeroes would claim
|
|
146
|
+
* an empty document where there was none. The sentence it throws names which of
|
|
147
|
+
* its refusals it was, so it is shown as it is rather than replaced with a
|
|
148
|
+
* wording of our own that knows less.
|
|
149
|
+
*/
|
|
150
|
+
export declare function importInterchangeFile(std: BlockStdScope, capability: InterchangeImportCapability, file: File): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Every registered importer, indexed by the extensions it declares.
|
|
153
|
+
*
|
|
154
|
+
* A LIST per extension, and that is the whole design: `.svg` will be claimed by
|
|
155
|
+
* several frameworks at once, because an SVG is a picture and which framework's
|
|
156
|
+
* vocabulary it is a picture OF is not a fact about the filename. ADR 0012 is
|
|
157
|
+
* explicit that a visual import is heuristic recognition and that the surface
|
|
158
|
+
* must name what it is about to do before the file is read — so this answers
|
|
159
|
+
* "what could read this file", and a UI (or a user) chooses. Anything that
|
|
160
|
+
* silently picked one would be guessing on the user's behalf about the one
|
|
161
|
+
* question they are the only one able to answer.
|
|
162
|
+
*
|
|
163
|
+
* Keys keep their leading dot and are lower-cased, because a file called
|
|
164
|
+
* `Order.BPMN` is the same kind of file as `order.bpmn` and nobody should have
|
|
165
|
+
* to know which. Capabilities keep the registry's own order — sorted by
|
|
166
|
+
* capability id — so a menu built from this map reads the same on every boot.
|
|
167
|
+
*
|
|
168
|
+
* Registration is flag-gated tooling (`docs/adr/0009`), so a framework whose
|
|
169
|
+
* flag is off contributes no row here, and a document a past import wrote keeps
|
|
170
|
+
* every byte it was given.
|
|
171
|
+
*/
|
|
172
|
+
export declare function interchangeImportersByExtension(provider: ServiceProvider): Map<string, InterchangeImportCapability[]>;
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { ConnectorElementModel } from '../../affine-model/index.js';
|
|
2
|
+
import { NotificationProvider, translateKey, } from '../../affine-shared/services/index.js';
|
|
3
|
+
import { openSingleFileWithSpec } from '../../affine-shared/utils/index.js';
|
|
4
|
+
import { getCommonBound } from '../../global/gfx/index.js';
|
|
5
|
+
import { GfxControllerIdentifier } from '../../std/gfx/index.js';
|
|
6
|
+
import { DefaultTool } from '../tool/default-tool.js';
|
|
7
|
+
import { interchangeCapabilities, } from './interchange.js';
|
|
8
|
+
/**
|
|
9
|
+
* **The public import API** — what an editor, a host application or a plugin
|
|
10
|
+
* calls to turn a foreign file into a board (`docs/adr/0012`).
|
|
11
|
+
*
|
|
12
|
+
* The registry next door declares WHAT Labre can read; a reader is a pure
|
|
13
|
+
* function of text (P3), and it deliberately stops short of the four things
|
|
14
|
+
* only a caller with an editor in its hands can do: pick the file, mint surface
|
|
15
|
+
* ids and repair the references that named the file's, bring the drawing into
|
|
16
|
+
* view, and say what the import cost. Those four were written once, for BPMN,
|
|
17
|
+
* inside `gfx/bpmn/src/actions.ts`. They are here now because not one line of
|
|
18
|
+
* them was about BPMN: an OWM sketch, a mermaid diagram and an SVG all need the
|
|
19
|
+
* same four, and a second copy of them would be a second set of bugs and a
|
|
20
|
+
* second wording of the same report.
|
|
21
|
+
*
|
|
22
|
+
* Three audiences, and they take different doors:
|
|
23
|
+
*
|
|
24
|
+
* - a **framework command** calls {@link runInterchangeImportFile} with its own
|
|
25
|
+
* capability, and that is the whole of its import glue;
|
|
26
|
+
* - a **host** (labreapp) builds its own import surface — a drop zone, a
|
|
27
|
+
* sidepanel, a menu of everything readable — on
|
|
28
|
+
* {@link interchangeImportersByExtension} to decide WHAT can read the file it
|
|
29
|
+
* was handed, and {@link importInterchangeFile} to run it: a drop zone
|
|
30
|
+
* already holds the `File` and must not be answered with a dialog;
|
|
31
|
+
* - **labre-mcp** calls no function here at all. It has no editor, so it calls
|
|
32
|
+
* `capability.run` directly and writes the props itself, which is exactly the
|
|
33
|
+
* purity P3 buys.
|
|
34
|
+
*/
|
|
35
|
+
/* ── Writing what a reader returned ───────────────────────────────────── */
|
|
36
|
+
/**
|
|
37
|
+
* Write an imported board onto the surface, and give back the ids it minted.
|
|
38
|
+
*
|
|
39
|
+
* ## The one thing the caller of an importer owes (`docs/adr/0012`, D3)
|
|
40
|
+
*
|
|
41
|
+
* `surface.addElement` mints its own nanoid and ignores any id it is handed —
|
|
42
|
+
* surface identity is Labre's and never the file's — so a connector arrives
|
|
43
|
+
* with `source` / `target` naming the SOURCE FILE's ids. Every element carries
|
|
44
|
+
* its own source id under `interchange[formatId].id`, so the map from file id to
|
|
45
|
+
* surface id is a fold over the very array the reader returned; the second pass
|
|
46
|
+
* rewrites the two endpoints from it. Nothing else is needed, and nothing else
|
|
47
|
+
* is done: an end the map cannot resolve is left exactly as the file wrote it.
|
|
48
|
+
* That keeps the DOCUMENT honest, not the drawing — a connector naming an id no
|
|
49
|
+
* element has routes to an empty path and is invisible on the canvas (it does
|
|
50
|
+
* not crash; `connector-manager.ts` handles the missing connectable) — and an
|
|
51
|
+
* unresolvable name a reader can go and look up in the source file beats one
|
|
52
|
+
* this function quietly invented.
|
|
53
|
+
*
|
|
54
|
+
* The `interchange` payload needs no second pass: it rides in the props as one
|
|
55
|
+
* whole blob and `addElement` writes it with everything else, which is the
|
|
56
|
+
* whole-record LWW the field's own contract asks for (D2).
|
|
57
|
+
*
|
|
58
|
+
* @param formatId the format whose payload key carries the source ids — the
|
|
59
|
+
* `id` of the capability's {@link InterchangeFormat}, and the ONLY thing this
|
|
60
|
+
* function ever knew about BPMN.
|
|
61
|
+
*/
|
|
62
|
+
export function materializeInterchangeImport(std, formatId, elements) {
|
|
63
|
+
const surface = std.get(GfxControllerIdentifier).surface;
|
|
64
|
+
if (!surface)
|
|
65
|
+
return [];
|
|
66
|
+
const bySource = new Map();
|
|
67
|
+
const created = elements.map(props => {
|
|
68
|
+
const id = surface.addElement({ ...props });
|
|
69
|
+
const carried = props.interchange;
|
|
70
|
+
const source = carried?.[formatId]?.id;
|
|
71
|
+
// FIRST wins, matching a reader's own answer to a file that used one id
|
|
72
|
+
// twice: it imports both and says so in a `substituted-id` note, and a flow
|
|
73
|
+
// naming that id means the first of them.
|
|
74
|
+
if (source !== undefined && !bySource.has(source))
|
|
75
|
+
bySource.set(source, id);
|
|
76
|
+
return id;
|
|
77
|
+
});
|
|
78
|
+
for (const id of created) {
|
|
79
|
+
const model = surface.getElementById(id);
|
|
80
|
+
if (!(model instanceof ConnectorElementModel))
|
|
81
|
+
continue;
|
|
82
|
+
for (const side of ['source', 'target']) {
|
|
83
|
+
const end = model[side];
|
|
84
|
+
if (end?.id === undefined)
|
|
85
|
+
continue;
|
|
86
|
+
model[side] = { ...end, id: bySource.get(end.id) ?? end.id };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return created;
|
|
90
|
+
}
|
|
91
|
+
/* ── Saying what it cost ──────────────────────────────────────────────── */
|
|
92
|
+
const IMPORT_DONE_KEY = 'com.labre.interchange.import.done';
|
|
93
|
+
const IMPORT_DONE_FALLBACK = 'file imported';
|
|
94
|
+
const IMPORT_FAILED_KEY = 'com.labre.interchange.import.failed';
|
|
95
|
+
const IMPORT_FAILED_FALLBACK = 'This file could not be imported';
|
|
96
|
+
const IMPORT_REMARKS_KEY = 'com.labre.interchange.import.remarks';
|
|
97
|
+
const IMPORT_REMARKS_FALLBACK = 'What the import could not keep as it was';
|
|
98
|
+
const IMPORT_CONSOLE_KEY = 'com.labre.interchange.import.console';
|
|
99
|
+
const IMPORT_CONSOLE_FALLBACK = 'remarks — the full report is in the browser console.';
|
|
100
|
+
const IMPORT_DRAWN_KEY = 'com.labre.interchange.import.drawn';
|
|
101
|
+
const IMPORT_DRAWN_FALLBACK = 'drawn';
|
|
102
|
+
const IMPORT_CARRIED_KEY = 'com.labre.interchange.import.carried';
|
|
103
|
+
const IMPORT_CARRIED_FALLBACK = 'carried';
|
|
104
|
+
const IMPORT_QUARANTINED_KEY = 'com.labre.interchange.import.quarantined';
|
|
105
|
+
const IMPORT_QUARANTINED_FALLBACK = 'quarantined';
|
|
106
|
+
/**
|
|
107
|
+
* How many remarks the second notification spells out before it hands the
|
|
108
|
+
* reader to the console.
|
|
109
|
+
*
|
|
110
|
+
* A toast is a headline surface: past five lines it stops being read and starts
|
|
111
|
+
* being dismissed, and a report nobody reads is a report that was not written.
|
|
112
|
+
* See {@link reportInterchangeImport} for what the number is a compromise
|
|
113
|
+
* about.
|
|
114
|
+
*/
|
|
115
|
+
const REMARKS_IN_A_NOTIFICATION = 5;
|
|
116
|
+
/**
|
|
117
|
+
* How the format names itself in a sentence: `bpmn` → `BPMN`.
|
|
118
|
+
*
|
|
119
|
+
* A format id is a lower-case key in the document (D2) and a proper noun in the
|
|
120
|
+
* chrome, and the chrome is where a user reads it — "BPMN 2.0", "SVG", "OWM".
|
|
121
|
+
* Upper-casing the declared id rather than adding a `label` field keeps the
|
|
122
|
+
* registry a table of facts about files: there is no second name to keep in
|
|
123
|
+
* step, and no format can be called one thing in its payload and another in the
|
|
124
|
+
* toast. The names this library actually ships are acronyms, which is why the
|
|
125
|
+
* rule is this simple one and not a title-casing.
|
|
126
|
+
*/
|
|
127
|
+
const formatLabel = (format) => format.id.toUpperCase();
|
|
128
|
+
/** One remark, as the line a reader sees. */
|
|
129
|
+
function remarkLine(note) {
|
|
130
|
+
const subject = note.sourceId ?? note.element;
|
|
131
|
+
return subject ? `${subject}: ${note.message}` : note.message;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The notification seam, or silence.
|
|
135
|
+
*
|
|
136
|
+
* `getOptional`, like every other call site in the library: the host injects a
|
|
137
|
+
* `NotificationService` (labreapp does, the standalone playground does not), and
|
|
138
|
+
* an import that assumed one would be an import the playground cannot run.
|
|
139
|
+
* Nothing here decides that an import failed to happen because nobody was
|
|
140
|
+
* listening — the elements are on the surface either way.
|
|
141
|
+
*/
|
|
142
|
+
function notifyImport(std, options) {
|
|
143
|
+
std.getOptional(NotificationProvider)?.notify({
|
|
144
|
+
title: options.title,
|
|
145
|
+
message: options.message,
|
|
146
|
+
accent: options.accent,
|
|
147
|
+
// Long enough to read a paragraph of remarks, and still self-dismissing:
|
|
148
|
+
// an import report is not a modal, and a toast the user has to close is a
|
|
149
|
+
// toast that interrupts the next thing they were doing.
|
|
150
|
+
duration: 8000,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Say what the import did — the summary, and the remarks.
|
|
155
|
+
*
|
|
156
|
+
* ## v1 of ADR 0012's open question 4 ("where does the report live?")
|
|
157
|
+
*
|
|
158
|
+
* The architect's v1: a NOTIFICATION for the summary, and the full notes on a
|
|
159
|
+
* surface that is reachable and honest. Reachable rules out a toast that names
|
|
160
|
+
* a count and drops the list; honest rules out the two things that look easier
|
|
161
|
+
* — writing the notes into the document as a text annotation (which pollutes a
|
|
162
|
+
* board the user did not ask us to draw on, and which the next export would
|
|
163
|
+
* have to explain) and dropping them (the notes are not derivable by re-running
|
|
164
|
+
* anything: the file is gone the moment the picker closes).
|
|
165
|
+
*
|
|
166
|
+
* So: one notification with the counts and the format version, a second with
|
|
167
|
+
* the remarks when there are few enough to read, and `console.table` with all
|
|
168
|
+
* of them, always, whenever there is one. The console is a poor product
|
|
169
|
+
* surface and it is named as one — the deliberate TARGET is the conformity
|
|
170
|
+
* panel, which is where a reader already goes to ask what is wrong with this
|
|
171
|
+
* board, and where an import remark belongs beside a validation finding. This
|
|
172
|
+
* is a stopgap that tells the truth, not the destination.
|
|
173
|
+
*
|
|
174
|
+
* ## The format is a word in the sentence, not a sentence per format
|
|
175
|
+
*
|
|
176
|
+
* The wordings are one set of keys for every format, and the format's own name
|
|
177
|
+
* is composed into them ({@link formatLabel}). The translation seam has no
|
|
178
|
+
* interpolation and no pluralisation — both are the host's — so a countable
|
|
179
|
+
* noun and a proper noun are the largest units this library can hand over
|
|
180
|
+
* without inventing grammar, which is the same argument the three count labels
|
|
181
|
+
* already ran on. The alternative, a key per format, would ask a host to
|
|
182
|
+
* translate "BPMN file imported" and "SVG file imported" as unrelated
|
|
183
|
+
* sentences and would leave every new format silently untranslated.
|
|
184
|
+
*/
|
|
185
|
+
export function reportInterchangeImport(std, format, report) {
|
|
186
|
+
const label = formatLabel(format);
|
|
187
|
+
const counts = [
|
|
188
|
+
`${report.mapped} ${translateKey(std, IMPORT_DRAWN_KEY, IMPORT_DRAWN_FALLBACK)}`,
|
|
189
|
+
`${report.carried} ${translateKey(std, IMPORT_CARRIED_KEY, IMPORT_CARRIED_FALLBACK)}`,
|
|
190
|
+
`${report.quarantined} ${translateKey(std, IMPORT_QUARANTINED_KEY, IMPORT_QUARANTINED_FALLBACK)}`,
|
|
191
|
+
].join(' · ');
|
|
192
|
+
// The version the reader actually READ, which is a fact about the file and
|
|
193
|
+
// not about this library — an `exporter` attribute is how a support thread
|
|
194
|
+
// about "bpmn.io drew it differently" gets answered in one line.
|
|
195
|
+
const version = report.sourceVersion;
|
|
196
|
+
notifyImport(std, {
|
|
197
|
+
title: `${label} ${translateKey(std, IMPORT_DONE_KEY, IMPORT_DONE_FALLBACK)}`,
|
|
198
|
+
message: version ? `${counts} — ${label} ${version}` : counts,
|
|
199
|
+
accent: 'info',
|
|
200
|
+
});
|
|
201
|
+
const notes = report.notes;
|
|
202
|
+
if (notes.length === 0)
|
|
203
|
+
return;
|
|
204
|
+
// Always, and before the second toast: the console line is the one that is
|
|
205
|
+
// still there in ten minutes, and the only place the WHOLE list lands when
|
|
206
|
+
// there are forty of them.
|
|
207
|
+
console.info(`[${format.id}] import report — ${counts}${version ? ` — ${label} ${version}` : ''}`);
|
|
208
|
+
console.table(notes.map(note => ({
|
|
209
|
+
kind: note.kind,
|
|
210
|
+
source: note.sourceId ?? '',
|
|
211
|
+
element: note.element ?? '',
|
|
212
|
+
message: note.message,
|
|
213
|
+
})));
|
|
214
|
+
notifyImport(std, {
|
|
215
|
+
title: translateKey(std, IMPORT_REMARKS_KEY, IMPORT_REMARKS_FALLBACK),
|
|
216
|
+
message: notes.length <= REMARKS_IN_A_NOTIFICATION
|
|
217
|
+
? notes.map(remarkLine).join('\n')
|
|
218
|
+
: `${notes.length} ${translateKey(std, IMPORT_CONSOLE_KEY, IMPORT_CONSOLE_FALLBACK)}`,
|
|
219
|
+
// Not `error`, and not `info`: nothing failed — every one of these is
|
|
220
|
+
// something the document KEPT — but each one is a difference between the
|
|
221
|
+
// file the user handed over and the board they are looking at.
|
|
222
|
+
accent: 'warning',
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/* ── The whole gesture ────────────────────────────────────────────────── */
|
|
226
|
+
/**
|
|
227
|
+
* Read a file the user picks with one declared capability, draw it, and say
|
|
228
|
+
* what it cost.
|
|
229
|
+
*
|
|
230
|
+
* Two steps, and neither is re-implemented anywhere: ask for a file, then hand
|
|
231
|
+
* it to {@link importInterchangeFile}, which is the rest of the gesture.
|
|
232
|
+
*
|
|
233
|
+
* ## The picker filter is the FORMAT's, not a table's
|
|
234
|
+
*
|
|
235
|
+
* `{ [mime]: extensions }` straight off the declaration, so a framework that
|
|
236
|
+
* adds a format adds its dialog filter with it and no second file has to agree.
|
|
237
|
+
* A format that declares no mime is offered as `text/plain`, which is what a
|
|
238
|
+
* DSL is — the extensions are the half that matters anyway, and the fallback
|
|
239
|
+
* branch of the picker (`showOpenFilePicker` is absent in Firefox and Safari)
|
|
240
|
+
* puts both halves into `input.accept` precisely because extensions like
|
|
241
|
+
* `.bpmn` are registered with no operating system on earth.
|
|
242
|
+
*
|
|
243
|
+
* The read-only guard is here as well as inside `importInterchangeFile`, and
|
|
244
|
+
* deliberately so: a dialog a document cannot honour should never open in the
|
|
245
|
+
* first place.
|
|
246
|
+
*/
|
|
247
|
+
export async function runInterchangeImportFile(std, capability) {
|
|
248
|
+
const gfx = std.get(GfxControllerIdentifier);
|
|
249
|
+
if (!gfx.surface || std.store.readonly)
|
|
250
|
+
return;
|
|
251
|
+
const { format } = capability;
|
|
252
|
+
const file = await openSingleFileWithSpec({
|
|
253
|
+
description: formatLabel(format),
|
|
254
|
+
accept: { [format.mime ?? 'text/plain']: [...format.extensions] },
|
|
255
|
+
});
|
|
256
|
+
// The user closed the picker. Not a failure, and not a notification: they
|
|
257
|
+
// know what they just did.
|
|
258
|
+
if (!file)
|
|
259
|
+
return;
|
|
260
|
+
await importInterchangeFile(std, capability, file);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The import itself, over a file the caller ALREADY HAS: run the declared
|
|
264
|
+
* capability (`docs/adr/0012`), write what it returned, bring it into view, and
|
|
265
|
+
* say what it cost.
|
|
266
|
+
*
|
|
267
|
+
* ## Why this is separate from the picker
|
|
268
|
+
*
|
|
269
|
+
* Because a picker is one way to be handed a file and not the only one. A host
|
|
270
|
+
* drop zone has the `File` the moment somebody lets go of it; so does a paste,
|
|
271
|
+
* an "open with", and a fetch from a document store. Every one of those wants
|
|
272
|
+
* the four steps below and none of them wants a dialog — and a seam that only
|
|
273
|
+
* exists behind `showOpenFilePicker` forces each of them to re-implement the id
|
|
274
|
+
* remapping and the viewport fit, which is the duplication this whole file was
|
|
275
|
+
* written to end.
|
|
276
|
+
*
|
|
277
|
+
* It is also the honest testing seam. A test that has to intercept a MODULE to
|
|
278
|
+
* reach this code is a test coupled to the bundler; passing the file in is one
|
|
279
|
+
* argument, and it means the pipeline is proven the same way in every
|
|
280
|
+
* environment the library runs in. `capability.run` is the same function
|
|
281
|
+
* labre-mcp calls, so a command, a drop zone and the registry cannot read the
|
|
282
|
+
* same file differently — one door, and the registry is the label on it.
|
|
283
|
+
*
|
|
284
|
+
* ## What arrives is a NEW board, never a merge
|
|
285
|
+
*
|
|
286
|
+
* The elements are added beside whatever is already on the surface. That is the
|
|
287
|
+
* bottom row of a reader's own loss table — surface identity across a
|
|
288
|
+
* re-import is lost — and it is the honest behaviour: two boards the user can
|
|
289
|
+
* see and delete beats a merge that silently rewrote artefacts they had edited.
|
|
290
|
+
*
|
|
291
|
+
* ## Failure is an exception, and it says which one
|
|
292
|
+
*
|
|
293
|
+
* A reader THROWS on a file it cannot read, because the five note kinds cannot
|
|
294
|
+
* say "this is not a file I can read" and a report of three zeroes would claim
|
|
295
|
+
* an empty document where there was none. The sentence it throws names which of
|
|
296
|
+
* its refusals it was, so it is shown as it is rather than replaced with a
|
|
297
|
+
* wording of our own that knows less.
|
|
298
|
+
*/
|
|
299
|
+
export async function importInterchangeFile(std, capability, file) {
|
|
300
|
+
const gfx = std.get(GfxControllerIdentifier);
|
|
301
|
+
if (!gfx.surface || std.store.readonly)
|
|
302
|
+
return;
|
|
303
|
+
const { format } = capability;
|
|
304
|
+
let result;
|
|
305
|
+
try {
|
|
306
|
+
result = capability.run(await file.text(), { name: file.name });
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
notifyImport(std, {
|
|
310
|
+
title: translateKey(std, IMPORT_FAILED_KEY, IMPORT_FAILED_FALLBACK),
|
|
311
|
+
message: error instanceof Error ? error.message : String(error),
|
|
312
|
+
accent: 'error',
|
|
313
|
+
});
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
// One undo step for the whole file, the way one lane gesture is one step:
|
|
317
|
+
// `captureSync` before opens a boundary, the writes land inside it, and the
|
|
318
|
+
// second one closes it. An import a user has to undo forty times is an import
|
|
319
|
+
// they cannot undo.
|
|
320
|
+
std.store.captureSync();
|
|
321
|
+
const created = materializeInterchangeImport(std, format.id, result.elements);
|
|
322
|
+
std.store.captureSync();
|
|
323
|
+
// …and then bring it into view, which is what template insertion does for
|
|
324
|
+
// the same reason: a board that landed off-screen looks like a command that
|
|
325
|
+
// did nothing. The padding is in MODEL units, so it is divided by the zoom to
|
|
326
|
+
// stay a constant margin on screen — the template panel's own arithmetic.
|
|
327
|
+
//
|
|
328
|
+
// ## Why the empty boxes are dropped, and it is not defensive
|
|
329
|
+
//
|
|
330
|
+
// A connector has no geometry of its own: its bound is derived from the path
|
|
331
|
+
// the connector manager routes between its two ends, and that path is
|
|
332
|
+
// computed on a LATER tick than the `addElement` that created it. Read
|
|
333
|
+
// synchronously here — which is the only moment this function has — every
|
|
334
|
+
// freshly imported connector answers `[0, 0, 0, 0]`, and a common bound that
|
|
335
|
+
// includes the origin stretches from (0, 0) to the far corner of the drawing.
|
|
336
|
+
// A file drawn at x ≈ 100000 (bpmn.io hands those out the moment somebody
|
|
337
|
+
// drags a process across the canvas) then fits a 100000-wide box, and the
|
|
338
|
+
// process the user just imported is a speck in the corner.
|
|
339
|
+
//
|
|
340
|
+
// Dropping zero-area boxes costs nothing and loses nothing: a connector runs
|
|
341
|
+
// BETWEEN two nodes, so once its path settles its bound is already inside
|
|
342
|
+
// theirs, and every artefact a framework pack draws has a positive size by
|
|
343
|
+
// construction. What is left is exactly the shaped elements, which is what
|
|
344
|
+
// "fit the imported board" means.
|
|
345
|
+
const boxes = created
|
|
346
|
+
.map(id => gfx.surface?.getElementById(id)?.elementBound)
|
|
347
|
+
.filter((bound) => bound !== undefined && bound.w > 0 && bound.h > 0);
|
|
348
|
+
const bound = getCommonBound(boxes);
|
|
349
|
+
if (bound) {
|
|
350
|
+
const padding = 20 / gfx.viewport.zoom;
|
|
351
|
+
gfx.viewport.setViewportByBound(bound, [padding, padding, padding, padding], true);
|
|
352
|
+
}
|
|
353
|
+
gfx.tool.setTool(DefaultTool);
|
|
354
|
+
reportInterchangeImport(std, format, result.report);
|
|
355
|
+
}
|
|
356
|
+
/* ── What can read a file called this ─────────────────────────────────── */
|
|
357
|
+
/**
|
|
358
|
+
* Every registered importer, indexed by the extensions it declares.
|
|
359
|
+
*
|
|
360
|
+
* A LIST per extension, and that is the whole design: `.svg` will be claimed by
|
|
361
|
+
* several frameworks at once, because an SVG is a picture and which framework's
|
|
362
|
+
* vocabulary it is a picture OF is not a fact about the filename. ADR 0012 is
|
|
363
|
+
* explicit that a visual import is heuristic recognition and that the surface
|
|
364
|
+
* must name what it is about to do before the file is read — so this answers
|
|
365
|
+
* "what could read this file", and a UI (or a user) chooses. Anything that
|
|
366
|
+
* silently picked one would be guessing on the user's behalf about the one
|
|
367
|
+
* question they are the only one able to answer.
|
|
368
|
+
*
|
|
369
|
+
* Keys keep their leading dot and are lower-cased, because a file called
|
|
370
|
+
* `Order.BPMN` is the same kind of file as `order.bpmn` and nobody should have
|
|
371
|
+
* to know which. Capabilities keep the registry's own order — sorted by
|
|
372
|
+
* capability id — so a menu built from this map reads the same on every boot.
|
|
373
|
+
*
|
|
374
|
+
* Registration is flag-gated tooling (`docs/adr/0009`), so a framework whose
|
|
375
|
+
* flag is off contributes no row here, and a document a past import wrote keeps
|
|
376
|
+
* every byte it was given.
|
|
377
|
+
*/
|
|
378
|
+
export function interchangeImportersByExtension(provider) {
|
|
379
|
+
const byExtension = new Map();
|
|
380
|
+
for (const capability of interchangeCapabilities(provider, {
|
|
381
|
+
direction: 'import',
|
|
382
|
+
})) {
|
|
383
|
+
for (const extension of capability.format.extensions) {
|
|
384
|
+
const key = extension.toLowerCase();
|
|
385
|
+
const capabilities = byExtension.get(key);
|
|
386
|
+
if (capabilities)
|
|
387
|
+
capabilities.push(capability);
|
|
388
|
+
else
|
|
389
|
+
byExtension.set(key, [capability]);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return byExtension;
|
|
393
|
+
}
|