@formicoidea/labre-core 0.32.0 → 0.34.1
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 +3 -3
- package/dist/_pkgs/affine-block-attachment/configs/toolbar.d.ts +2 -2
- package/dist/_pkgs/affine-block-attachment/configs/toolbar.js +9 -7
- package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +12 -12
- package/dist/_pkgs/affine-block-callout/callout-block.js +1 -1
- package/dist/_pkgs/affine-block-code/code-block-inline.js +1 -1
- package/dist/_pkgs/affine-block-code/code-block.js +2 -2
- package/dist/_pkgs/affine-block-code/code-toolbar/config.js +9 -1
- package/dist/_pkgs/affine-block-code/code-toolbar/index.js +1 -1
- package/dist/_pkgs/affine-block-database/data-source.js +1 -2
- package/dist/_pkgs/affine-block-database/database-block.js +2 -2
- package/dist/_pkgs/affine-block-database/external-data-source.js +1 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +1 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +1 -1
- package/dist/_pkgs/affine-block-embed/common/render-linked-doc.js +3 -3
- package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -11
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-service.js +1 -1
- package/dist/_pkgs/affine-block-embed/embed-html-block/configs/toolbar.js +5 -5
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.d.ts +7 -7
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +14 -14
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +2 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +10 -10
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -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/components/embed-synced-doc-card.js +5 -4
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +10 -10
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +1 -1
- package/dist/_pkgs/affine-block-frame/frame-manager.js +3 -1
- package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
- package/dist/_pkgs/affine-block-frame/frame-toolbar.js +2 -2
- package/dist/_pkgs/affine-block-image/components/page-image-block.js +1 -1
- package/dist/_pkgs/affine-block-image/configs/toolbar.js +4 -4
- package/dist/_pkgs/affine-block-image/image-edgeless-block.js +1 -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/configs/toolbar.js +2 -2
- package/dist/_pkgs/affine-block-note/move-block.js +1 -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/configs/toolbar.d.ts +6 -4
- package/dist/_pkgs/affine-block-root/configs/toolbar.js +6 -6
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.d.ts +10 -10
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.js +4 -4
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.d.ts +7 -7
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +9 -9
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +3 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clipboard-utils.js +1 -1
- 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/element-model/index.d.ts +18 -3
- package/dist/_pkgs/affine-block-surface/element-model/index.js +12 -2
- package/dist/_pkgs/affine-block-surface/extensions/audit.js +23 -6
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +10 -5
- package/dist/_pkgs/affine-block-surface/extensions/editor-anchored-panel.js +2 -1
- 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 +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +172 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +404 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +323 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.js +64 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality-widget.js +61 -61
- 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-widget.js +78 -80
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.d.ts +21 -0
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.js +17 -3
- 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/validation.d.ts +809 -20
- package/dist/_pkgs/affine-block-surface/extensions/validation.js +1661 -50
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.d.ts +50 -6
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.js +129 -32
- package/dist/_pkgs/affine-block-surface/framework-background/def.d.ts +289 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.js +126 -1
- package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +42 -2
- package/dist/_pkgs/affine-block-surface/framework-background/labels.js +80 -4
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +172 -11
- 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/element-highlight-overlay.d.ts +17 -0
- package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +66 -0
- package/dist/_pkgs/affine-block-surface/renderer/overlay.js +1 -1
- package/dist/_pkgs/affine-block-surface/view.js +5 -0
- package/dist/_pkgs/affine-block-surface-ref/configs/toolbar.js +4 -4
- 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-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/icons/text.js +426 -426
- package/dist/_pkgs/affine-components/open-doc-dropdown-menu/dropdown-menu.d.ts +2 -0
- package/dist/_pkgs/affine-components/peek/peekable.js +1 -1
- package/dist/_pkgs/affine-components/resource/resource.js +2 -0
- 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 +1 -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/view-dropdown-menu/dropdown-menu.js +27 -14
- 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/toolbar/components/pen/pen-tool-button.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/connector-manager.js +7 -10
- package/dist/_pkgs/affine-gfx-connector/connector-tool.d.ts +19 -1
- package/dist/_pkgs/affine-gfx-connector/connector-tool.js +10 -2
- package/dist/_pkgs/affine-gfx-connector/connector-watcher.js +1 -4
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +2 -1
- package/dist/_pkgs/affine-gfx-connector/direction/invert-direction.js +1 -3
- 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/toolbar/config.js +1 -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-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-view.js +19 -12
- 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.js +1 -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-text/toolbar/actions.js +1 -1
- package/dist/_pkgs/affine-inline-link/command.js +1 -1
- package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.d.ts +4 -4
- package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.js +6 -6
- 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/configs/toolbar.d.ts +4 -4
- package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.js +6 -6
- package/dist/_pkgs/affine-inline-reference/reference-node/reference-node.js +1 -1
- 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 +135 -17
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +148 -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 +1 -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/cynefin/cynefin.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +9 -4
- package/dist/_pkgs/affine-model/elements/edgy/board.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/edgy/board.js +9 -4
- package/dist/_pkgs/affine-model/elements/edgy/facets.d.ts +20 -3
- package/dist/_pkgs/affine-model/elements/edgy/facets.js +13 -4
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +9 -4
- 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 +7 -2
- package/dist/_pkgs/affine-model/elements/framework-background/background.js +9 -4
- package/dist/_pkgs/affine-model/elements/framework-background/hit-test.d.ts +48 -0
- package/dist/_pkgs/affine-model/elements/framework-background/hit-test.js +55 -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 +11 -0
- package/dist/_pkgs/affine-model/elements/index.js +3 -0
- package/dist/_pkgs/affine-model/elements/shape/api/polygon.js +2 -8
- 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.js +1 -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/utils/color.js +5 -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 +11 -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 +11 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.js +15 -0
- package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.js +1 -1
- package/dist/_pkgs/affine-shared/services/index.d.ts +2 -0
- package/dist/_pkgs/affine-shared/services/index.js +2 -0
- package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +2 -1
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +73 -1
- package/dist/_pkgs/affine-shared/services/toolbar-service/action.d.ts +32 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/action.js +16 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/flags.d.ts +10 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/flags.js +32 -1
- 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/chrome.d.ts +106 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +201 -0
- package/dist/_pkgs/affine-shared/services/translation-service/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/translation-service/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/universe-tag-defs-service.js +5 -3
- package/dist/_pkgs/affine-shared/test-utils/affine-template.js +1 -1
- 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/zod-schema.js +1 -3
- package/dist/_pkgs/affine-widget-drag-handle/utils.js +1 -1
- 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-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 +41 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +49 -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 +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +19 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +51 -10
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +9 -0
- package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +2 -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 +1 -1
- 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-slash-menu/config.js +2 -1
- package/dist/_pkgs/affine-widget-toolbar/toolbar.js +11 -2
- package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +19 -2
- package/dist/_pkgs/affine-widget-toolbar/utils.js +28 -9
- package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +11 -11
- package/dist/_pkgs/data-view/core/utils/menu-title.js +17 -17
- package/dist/_pkgs/data-view/view-presets/calendar/pc/actions.js +8 -12
- package/dist/_pkgs/data-view/view-presets/calendar/pc/view.js +52 -40
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +18 -18
- package/dist/_pkgs/std/clipboard/utils.js +4 -1
- package/dist/_pkgs/std/extension/command-registry.d.ts +195 -5
- package/dist/_pkgs/std/extension/command-registry.js +218 -4
- package/dist/_pkgs/std/extension/shortcut.js +2 -1
- package/dist/_pkgs/std/extension/translation-manifest.d.ts +46 -1
- package/dist/_pkgs/std/extension/translation-manifest.js +58 -0
- package/dist/_pkgs/std/gfx/grid.js +1 -1
- package/dist/_pkgs/std/gfx/highlight.d.ts +84 -0
- package/dist/_pkgs/std/gfx/highlight.js +112 -0
- package/dist/_pkgs/std/gfx/index.d.ts +2 -1
- package/dist/_pkgs/std/gfx/index.js +1 -0
- package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +17 -3
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +160 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +75 -1
- package/dist/_pkgs/std/gfx/model/surface/role.js +5 -3
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +2 -1
- package/dist/_pkgs/std/gfx/selection.js +1 -1
- package/dist/_pkgs/std/gfx/viewport.js +1 -1
- 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/scope/std-scope.d.ts +2 -1
- package/dist/_pkgs/std/scope/std-scope.js +2 -0
- package/dist/_pkgs/std/utils/gfx.js +2 -0
- package/dist/_pkgs/store/model/store/crud.js +4 -1
- package/dist/commands.js +1 -1
- package/dist/extensions/command-usage.d.ts +23 -0
- package/dist/extensions/command-usage.js +37 -0
- package/dist/extensions/view.js +12 -0
- package/dist/frameworks.js +32 -0
- package/dist/shortcuts.d.ts +20 -6
- package/dist/shortcuts.js +7 -9
- package/dist/translations.js +98 -3
- package/package.json +13 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { type ServiceProvider } from '../../global/di/index.js';
|
|
2
|
+
import type { GfxPrimitiveElementModel } from '../../std/gfx/index.js';
|
|
3
|
+
import type { ExtensionType } from '../../store/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* The interchange registry (`docs/adr/0012`, P1).
|
|
6
|
+
*
|
|
7
|
+
* Reading a foreign file and writing one are DECLARED PLATFORM CAPABILITIES,
|
|
8
|
+
* registered the way rules and profiles already are — `createIdentifier` plus
|
|
9
|
+
* an `…Extension` helper — and not a function some toolbar happens to call.
|
|
10
|
+
* What that buys is a question the platform can answer about itself: "what can
|
|
11
|
+
* Labre read, what can it write, and for which framework" is a lookup, so the
|
|
12
|
+
* roadmap is a table of real rows rather than a wish.
|
|
13
|
+
*
|
|
14
|
+
* Three properties are load-bearing, and each one is a decision, not a detail.
|
|
15
|
+
*
|
|
16
|
+
* **The unit is the TRIPLE — framework × format × direction.** A direction is
|
|
17
|
+
* never implied by its opposite: BPMN writes `.bpmn` (#149) and cannot read one
|
|
18
|
+
* yet, and a registry that keyed on the format alone would have no way to say
|
|
19
|
+
* so. {@link interchangeCapabilityId} builds the key and
|
|
20
|
+
* {@link InterchangeExtension} refuses a capability whose `id` disagrees with
|
|
21
|
+
* its own three fields, because an id that lies is worse than no id.
|
|
22
|
+
*
|
|
23
|
+
* **The two `run` signatures are mirror images, and neither touches an
|
|
24
|
+
* editor.** An exporter takes element models and returns text; an importer
|
|
25
|
+
* takes text and returns SERIALIZED ELEMENT PROPS — never live models, because
|
|
26
|
+
* it has no surface to add them to and giving it one would cost the purity that
|
|
27
|
+
* lets both halves be unit-tested with plain objects and no DI. The caller does
|
|
28
|
+
* the writing: `surface.addElement` from an editor command, a document mutation
|
|
29
|
+
* from labre-mcp. See P3.
|
|
30
|
+
*
|
|
31
|
+
* **Registration is flag-gated tooling; what it wrote is content.** Call
|
|
32
|
+
* {@link InterchangeExtension} from the framework's FLAG-GATED view extension,
|
|
33
|
+
* beside `ValidationRuleExtension`, because offering to read a file is tooling.
|
|
34
|
+
* Turning a framework's flag off removes its import and export commands; it
|
|
35
|
+
* does not touch one element a past import created. See `docs/adr/0009`.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* A format Labre can read or write, and what it PROMISES (ADR 0012, P2).
|
|
39
|
+
*
|
|
40
|
+
* The tier is the single most load-bearing field here, because it is what a
|
|
41
|
+
* user is entitled to expect:
|
|
42
|
+
*
|
|
43
|
+
* - **`semantic`** — the file carries a MODEL (`.bpmn` XML, mermaid, the OWM
|
|
44
|
+
* DSL). Import is a translation, the preservation contract is full (mapped /
|
|
45
|
+
* carried / quarantined), and a round-trip is promised.
|
|
46
|
+
* - **`visual`** — the file carries a RENDERING (SVG). Import is best-effort
|
|
47
|
+
* RECOGNITION, it writes no foreign-matter payload, and it promises exactly
|
|
48
|
+
* one thing: the picture arrives as editable elements. No round-trip is
|
|
49
|
+
* implied, and the import surface must say so before the file is read.
|
|
50
|
+
*/
|
|
51
|
+
export interface InterchangeFormat {
|
|
52
|
+
/**
|
|
53
|
+
* Stable id, and THE KEY under which foreign matter is carried on an
|
|
54
|
+
* element — `'bpmn'`, `'owm'`, `'mermaid'`, `'svg'`.
|
|
55
|
+
*/
|
|
56
|
+
id: string;
|
|
57
|
+
tier: 'semantic' | 'visual';
|
|
58
|
+
/**
|
|
59
|
+
* For the file picker and the download name — `['.bpmn']`. The FIRST is the
|
|
60
|
+
* one a download is given, and the type says there is one: a format nothing
|
|
61
|
+
* on a disk is ever called is not a format anybody can hand us.
|
|
62
|
+
*/
|
|
63
|
+
extensions: readonly [string, ...string[]];
|
|
64
|
+
mime?: string;
|
|
65
|
+
}
|
|
66
|
+
/** Which way round a capability goes. Never both: see the triple, above. */
|
|
67
|
+
export type InterchangeDirection = 'import' | 'export';
|
|
68
|
+
/**
|
|
69
|
+
* One element as it is handed to `surface.addElement` — the exact shape the
|
|
70
|
+
* store already takes, so an importer's output is written with no translation
|
|
71
|
+
* step in between and no live model in sight.
|
|
72
|
+
*/
|
|
73
|
+
export type SerializedElementProps = Record<string, unknown> & {
|
|
74
|
+
type: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* One thing an import did that the drawing does not show, named (ADR 0012).
|
|
78
|
+
*
|
|
79
|
+
* The counts below say how much; a note says WHICH, and the ADR asks for that
|
|
80
|
+
* in five places — D1's quarantined column is "listed in the report", D3
|
|
81
|
+
* "records the substitution" of an id it could not keep and the lane
|
|
82
|
+
* disagreement it resolved, D4 "names" a shape that arrived with no diagram and
|
|
83
|
+
* says so when it laid one out, D5 surfaces `mustUnderstand` "by name". The
|
|
84
|
+
* ADR's own rejection of a document-level side table is the argument for this
|
|
85
|
+
* type: a tool that says "I lost some things" and cannot say which, where, or
|
|
86
|
+
* how to get them back has told the user nothing they can act on.
|
|
87
|
+
*/
|
|
88
|
+
export interface InterchangeNote {
|
|
89
|
+
kind: InterchangeNoteKind;
|
|
90
|
+
/** The Labre element it landed on or rides on, when there is one. */
|
|
91
|
+
elementId?: string;
|
|
92
|
+
/** The source element's id, VERBATIM, when it had one (D3). */
|
|
93
|
+
sourceId?: string;
|
|
94
|
+
/** Its source element name — `boundaryEvent`, `bioc:fill` (D1, D5). */
|
|
95
|
+
element?: string;
|
|
96
|
+
/** One line, in the user's words: what happened and what it costs them. */
|
|
97
|
+
message: string;
|
|
98
|
+
/**
|
|
99
|
+
* The i18n key {@link message} is the English default of — set only when the
|
|
100
|
+
* remark is a FIXED sentence.
|
|
101
|
+
*
|
|
102
|
+
* A reader is a pure function of text (`docs/adr/0012`, P3): it has no `std`,
|
|
103
|
+
* so it cannot reach the host's catalogue and hands the key over instead, and
|
|
104
|
+
* `reportInterchangeImport` resolves it when it draws the report. That is the
|
|
105
|
+
* whole of the seam here, and it deliberately covers only the remarks that
|
|
106
|
+
* say the same thing every time.
|
|
107
|
+
*
|
|
108
|
+
* A remark that NAMES something out of the file — an element, an id, a count
|
|
109
|
+
* of lanes — carries no key and stays English. The seam has no interpolation
|
|
110
|
+
* and no pluralisation (both are the host's), so the alternative would be to
|
|
111
|
+
* invent a grammar for sentences with holes in them, which is exactly what
|
|
112
|
+
* the three interchange count labels already refuse to do.
|
|
113
|
+
*/
|
|
114
|
+
messageKey?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The five things worth saying about one item, and no sixth.
|
|
118
|
+
*
|
|
119
|
+
* - `carried` — no artefact for it; kept verbatim on the nearest mapped
|
|
120
|
+
* element, invisible on the canvas, re-emitted in place (D1).
|
|
121
|
+
* - `quarantined` — kept in the document and deliberately NOT re-emitted,
|
|
122
|
+
* because re-emitting it would write a file that contradicts the drawing.
|
|
123
|
+
* The four cases are closed and named in D5.
|
|
124
|
+
* - `substituted-id` — the file's id could not be given back, so one was
|
|
125
|
+
* minted. D3's whole point: record what we were given, never reconstruct
|
|
126
|
+
* what we think we sent.
|
|
127
|
+
* - `invented-layout` — a position the source did not carry. D4 forbids
|
|
128
|
+
* claiming an invented position came from the file, so it is declared here.
|
|
129
|
+
* - `warning` — the reader proceeded but its reading may be wrong;
|
|
130
|
+
* `extension/@mustUnderstand="true"` is the named case (D5), a lane the DI
|
|
131
|
+
* and the `flowNodeRef` disagreed about is the other (D3).
|
|
132
|
+
*/
|
|
133
|
+
export type InterchangeNoteKind = 'carried' | 'quarantined' | 'substituted-id' | 'invented-layout' | 'warning';
|
|
134
|
+
/**
|
|
135
|
+
* What a semantic import did with every node of the file (ADR 0012, D1).
|
|
136
|
+
*
|
|
137
|
+
* Three states and not two, and the middle one is the whole point: **mapped**
|
|
138
|
+
* became a drawn artefact, **carried** had no artefact and was kept verbatim on
|
|
139
|
+
* the nearest mapped element, **quarantined** was kept in the document but will
|
|
140
|
+
* not be re-emitted, because re-emitting it would produce a file that
|
|
141
|
+
* contradicts itself. A semantic import classifies; it never silently discards.
|
|
142
|
+
*
|
|
143
|
+
* The counts are here because a UI wants a headline it can render without
|
|
144
|
+
* walking a list; {@link notes} is here because a headline is not a product
|
|
145
|
+
* surface. Neither derives from the other — an import may carry a hundred
|
|
146
|
+
* fragments and have three worth naming — so both are stated.
|
|
147
|
+
*/
|
|
148
|
+
export interface InterchangeReport {
|
|
149
|
+
/** Nodes that became a drawn, editable artefact. */
|
|
150
|
+
mapped: number;
|
|
151
|
+
/** Nodes kept verbatim on the nearest mapped element, invisible on canvas. */
|
|
152
|
+
carried: number;
|
|
153
|
+
/** Nodes kept but deliberately not re-emitted. */
|
|
154
|
+
quarantined: number;
|
|
155
|
+
/** Which ones, and why. Empty is a claim: nothing was worth naming. */
|
|
156
|
+
notes: readonly InterchangeNote[];
|
|
157
|
+
/**
|
|
158
|
+
* The format version actually read — `'2.0'`, a mermaid release (P2, as
|
|
159
|
+
* amended). Absent when the source declared none, which is itself a fact
|
|
160
|
+
* about the file rather than a gap in the reader.
|
|
161
|
+
*/
|
|
162
|
+
sourceVersion?: string;
|
|
163
|
+
}
|
|
164
|
+
/** What the caller tells an exporter about the document it is producing. */
|
|
165
|
+
export interface InterchangeExportContext {
|
|
166
|
+
/**
|
|
167
|
+
* Names the produced document and the file it is offered as — the board's own
|
|
168
|
+
* title. A capability writes a name, it does not go looking for one: the
|
|
169
|
+
* caller reads the title, this says what to do with it.
|
|
170
|
+
*
|
|
171
|
+
* Making it safe to write to disk is the CAPABILITY's job, not the caller's,
|
|
172
|
+
* because the answer is the format's — which characters, which cap, which
|
|
173
|
+
* extension. Pass the raw title. Note the consequence, which is inherited and
|
|
174
|
+
* not introduced here: the sanitized name is also what lands as the
|
|
175
|
+
* document's own name INSIDE the file, so a board titled `Order/to cash` is
|
|
176
|
+
* named `Order-to cash` in the XML as well as on the download.
|
|
177
|
+
*/
|
|
178
|
+
name?: string;
|
|
179
|
+
}
|
|
180
|
+
/** What the caller tells an importer about the source it is handing over. */
|
|
181
|
+
export interface InterchangeImportContext {
|
|
182
|
+
/**
|
|
183
|
+
* A name for what is read, used only when the source document names nothing
|
|
184
|
+
* itself. A file that carries its own name always wins: an import states what
|
|
185
|
+
* the file says, and never what the caller wished it said.
|
|
186
|
+
*/
|
|
187
|
+
name?: string;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* A whole document, as text, plus what a caller needs to hand it to a browser
|
|
191
|
+
* or an HTTP response without knowing which format it asked for.
|
|
192
|
+
*/
|
|
193
|
+
export interface InterchangeExportResult {
|
|
194
|
+
/** The document. */
|
|
195
|
+
text: string;
|
|
196
|
+
/** Suggested download name, extension included. */
|
|
197
|
+
filename: string;
|
|
198
|
+
/** `application/xml`, `text/plain`, … — the format's, not the caller's. */
|
|
199
|
+
mime: string;
|
|
200
|
+
/**
|
|
201
|
+
* What the WRITER could not say, one line each, in the user's words. Absent
|
|
202
|
+
* when the board came out whole, which is the usual case.
|
|
203
|
+
*
|
|
204
|
+
* Not a three-way classification — an exporter has nothing foreign to sort,
|
|
205
|
+
* which is why {@link InterchangeReport} is the importer's alone. But an
|
|
206
|
+
* export loses things too: a board can hold sentences the format has no way
|
|
207
|
+
* to write down, and the user who clicked Export is the one person entitled
|
|
208
|
+
* to be told. Warnings are never errors — the file is valid and the export
|
|
209
|
+
* succeeded.
|
|
210
|
+
*/
|
|
211
|
+
warnings?: readonly string[];
|
|
212
|
+
}
|
|
213
|
+
/** Element props for the caller to write, and what became of the source. */
|
|
214
|
+
export interface InterchangeImportResult {
|
|
215
|
+
elements: readonly SerializedElementProps[];
|
|
216
|
+
report: InterchangeReport;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* The whole board, in document order — never a selection.
|
|
220
|
+
*
|
|
221
|
+
* A framework document is one statement and half a statement is not a smaller
|
|
222
|
+
* one, so the capability is handed the surface's elements and picks out what it
|
|
223
|
+
* speaks about itself. Document order is the caller's, and it matters: it is
|
|
224
|
+
* the tie-break the audit and the validation rules already break on, so an
|
|
225
|
+
* export cannot disagree with a badge the user can see.
|
|
226
|
+
*/
|
|
227
|
+
export type InterchangeExporter = (elements: readonly GfxPrimitiveElementModel[], context: InterchangeExportContext) => InterchangeExportResult;
|
|
228
|
+
/**
|
|
229
|
+
* Text in, element props out. No surface, no `std`, no DI — see P3: this is
|
|
230
|
+
* what makes the same function callable from an editor command and from
|
|
231
|
+
* labre-mcp, and testable from neither.
|
|
232
|
+
*/
|
|
233
|
+
export type InterchangeImporter = (source: string, context: InterchangeImportContext) => InterchangeImportResult;
|
|
234
|
+
/** Everything a capability declares that does not depend on its direction. */
|
|
235
|
+
export interface InterchangeCapabilityBase {
|
|
236
|
+
/**
|
|
237
|
+
* `${framework}:${format.id}:${direction}` — unique, and the DI key. Build it
|
|
238
|
+
* with {@link interchangeCapabilityId} rather than by hand.
|
|
239
|
+
*/
|
|
240
|
+
id: string;
|
|
241
|
+
/** `'bpmn'`, `'wardley'`, `'c4'` — the framework that owns the vocabulary. */
|
|
242
|
+
framework: string;
|
|
243
|
+
format: InterchangeFormat;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* One direction of one format for one framework.
|
|
247
|
+
*
|
|
248
|
+
* A UNION discriminated on `direction`, so `run` is the function that direction
|
|
249
|
+
* means and nothing else. This is what makes the triple structural rather than
|
|
250
|
+
* a naming convention: `InterchangeExtension` can refuse an id that lies about
|
|
251
|
+
* its three fields, but only the type system can refuse an importer handed over
|
|
252
|
+
* as an export — no runtime check can tell two functions apart by looking. It
|
|
253
|
+
* also means a caller that has narrowed on `direction` calls `run` directly,
|
|
254
|
+
* with no cast, which is the difference between a registry and a bag.
|
|
255
|
+
*/
|
|
256
|
+
export type InterchangeCapability = (InterchangeCapabilityBase & {
|
|
257
|
+
direction: 'export';
|
|
258
|
+
/** The pure function. See P3 — this is the whole contract. */
|
|
259
|
+
run: InterchangeExporter;
|
|
260
|
+
}) | (InterchangeCapabilityBase & {
|
|
261
|
+
direction: 'import';
|
|
262
|
+
/** The pure function. See P3 — this is the whole contract. */
|
|
263
|
+
run: InterchangeImporter;
|
|
264
|
+
});
|
|
265
|
+
/** Narrowed by direction, for a caller that asked the registry for one. */
|
|
266
|
+
export type InterchangeExportCapability = Extract<InterchangeCapability, {
|
|
267
|
+
direction: 'export';
|
|
268
|
+
}>;
|
|
269
|
+
export type InterchangeImportCapability = Extract<InterchangeCapability, {
|
|
270
|
+
direction: 'import';
|
|
271
|
+
}>;
|
|
272
|
+
/** The one way to spell a capability's id. */
|
|
273
|
+
export declare function interchangeCapabilityId(framework: string, formatId: string, direction: InterchangeDirection): string;
|
|
274
|
+
/** A framework registers its interchange here; nothing else registers any. */
|
|
275
|
+
export declare const InterchangeIdentifier: import("../../global/di/types.js").ServiceIdentifier<InterchangeCapability> & (<U extends InterchangeCapability = InterchangeCapability>(variant: import("../../global/di/types.js").ServiceVariant) => import("../../global/di/types.js").ServiceIdentifier<U>);
|
|
276
|
+
/**
|
|
277
|
+
* Register a framework's interchange capabilities. Call it from the FLAG-GATED
|
|
278
|
+
* view extension — offering to read or write a file is tooling, so a disabled
|
|
279
|
+
* framework offers neither, and a board a past import wrote keeps every byte it
|
|
280
|
+
* was given (`docs/adr/0009`).
|
|
281
|
+
*
|
|
282
|
+
* ```ts
|
|
283
|
+
* context.register(InterchangeExtension([BPMN_XML_EXPORT]));
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* The id is checked against the triple it claims to be, its parts are checked
|
|
287
|
+
* for the separator that would let two different triples mint one key, and the
|
|
288
|
+
* DI container refuses a second capability under the same id. All three
|
|
289
|
+
* refusals are loud and all three are deliberate: a registry whose keys can lie
|
|
290
|
+
* or collide answers the question "what can Labre read" with something other
|
|
291
|
+
* than the truth, and that question is the only reason this registry exists.
|
|
292
|
+
*
|
|
293
|
+
* They fire at container setup — at boot, or in any test that mounts — never
|
|
294
|
+
* mid-session, and never on a capability built with
|
|
295
|
+
* {@link interchangeCapabilityId}.
|
|
296
|
+
*/
|
|
297
|
+
export declare function InterchangeExtension(capabilities: readonly InterchangeCapability[]): ExtensionType;
|
|
298
|
+
/** Narrows {@link interchangeCapabilities}. Every field is optional and ANDed. */
|
|
299
|
+
export interface InterchangeQuery {
|
|
300
|
+
framework?: string;
|
|
301
|
+
/** The format's id, not its extension. */
|
|
302
|
+
format?: string;
|
|
303
|
+
direction?: InterchangeDirection;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* The capabilities registered in this assembly, optionally narrowed.
|
|
307
|
+
*
|
|
308
|
+
* Read straight off the DI identifier, exactly as the audit reads the rules:
|
|
309
|
+
* registration is the gate, so a framework whose flag is off contributes
|
|
310
|
+
* nothing here for the same reason it contributes no rule. Sorted by id, so a
|
|
311
|
+
* menu built from this list is in the same order on every boot.
|
|
312
|
+
*
|
|
313
|
+
* Asking for a direction returns that direction's capabilities, typed: a caller
|
|
314
|
+
* that queried for exporters gets `run`s it can call, not a union it must
|
|
315
|
+
* narrow a second time by hand.
|
|
316
|
+
*/
|
|
317
|
+
export declare function interchangeCapabilities(provider: ServiceProvider, query: InterchangeQuery & {
|
|
318
|
+
direction: 'export';
|
|
319
|
+
}): InterchangeExportCapability[];
|
|
320
|
+
export declare function interchangeCapabilities(provider: ServiceProvider, query: InterchangeQuery & {
|
|
321
|
+
direction: 'import';
|
|
322
|
+
}): InterchangeImportCapability[];
|
|
323
|
+
export declare function interchangeCapabilities(provider: ServiceProvider, query?: InterchangeQuery): InterchangeCapability[];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createIdentifier } from '../../global/di/index.js';
|
|
2
|
+
/** The separator the triple is built from, and therefore reserved in its parts. */
|
|
3
|
+
const ID_SEPARATOR = ':';
|
|
4
|
+
/** The one way to spell a capability's id. */
|
|
5
|
+
export function interchangeCapabilityId(framework, formatId, direction) {
|
|
6
|
+
return `${framework}${ID_SEPARATOR}${formatId}${ID_SEPARATOR}${direction}`;
|
|
7
|
+
}
|
|
8
|
+
/** A framework registers its interchange here; nothing else registers any. */
|
|
9
|
+
export const InterchangeIdentifier = createIdentifier('Interchange');
|
|
10
|
+
/**
|
|
11
|
+
* Register a framework's interchange capabilities. Call it from the FLAG-GATED
|
|
12
|
+
* view extension — offering to read or write a file is tooling, so a disabled
|
|
13
|
+
* framework offers neither, and a board a past import wrote keeps every byte it
|
|
14
|
+
* was given (`docs/adr/0009`).
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* context.register(InterchangeExtension([BPMN_XML_EXPORT]));
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* The id is checked against the triple it claims to be, its parts are checked
|
|
21
|
+
* for the separator that would let two different triples mint one key, and the
|
|
22
|
+
* DI container refuses a second capability under the same id. All three
|
|
23
|
+
* refusals are loud and all three are deliberate: a registry whose keys can lie
|
|
24
|
+
* or collide answers the question "what can Labre read" with something other
|
|
25
|
+
* than the truth, and that question is the only reason this registry exists.
|
|
26
|
+
*
|
|
27
|
+
* They fire at container setup — at boot, or in any test that mounts — never
|
|
28
|
+
* mid-session, and never on a capability built with
|
|
29
|
+
* {@link interchangeCapabilityId}.
|
|
30
|
+
*/
|
|
31
|
+
export function InterchangeExtension(capabilities) {
|
|
32
|
+
return {
|
|
33
|
+
setup: di => {
|
|
34
|
+
for (const capability of capabilities) {
|
|
35
|
+
// Checked BEFORE the triple is minted from them: `('a', 'b:c')` and
|
|
36
|
+
// `('a:b', 'c')` mint the same key, and the id would agree with itself.
|
|
37
|
+
// Without this, that surfaces as an opaque DI collision instead of the
|
|
38
|
+
// sentence this function already knows how to write.
|
|
39
|
+
for (const [field, value] of [
|
|
40
|
+
['framework', capability.framework],
|
|
41
|
+
['format.id', capability.format.id],
|
|
42
|
+
]) {
|
|
43
|
+
if (value.includes(ID_SEPARATOR)) {
|
|
44
|
+
throw new Error(`Interchange ${field} "${value}" contains "${ID_SEPARATOR}", which separates the parts of a capability id.`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const expected = interchangeCapabilityId(capability.framework, capability.format.id, capability.direction);
|
|
48
|
+
if (capability.id !== expected) {
|
|
49
|
+
throw new Error(`Interchange capability id "${capability.id}" is not its triple: expected "${expected}".`);
|
|
50
|
+
}
|
|
51
|
+
di.addImpl(InterchangeIdentifier(capability.id), () => capability);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function interchangeCapabilities(provider, query = {}) {
|
|
57
|
+
return [...provider.getAll(InterchangeIdentifier).values()]
|
|
58
|
+
.filter(capability => (query.framework === undefined ||
|
|
59
|
+
capability.framework === query.framework) &&
|
|
60
|
+
(query.format === undefined || capability.format.id === query.format) &&
|
|
61
|
+
(query.direction === undefined ||
|
|
62
|
+
capability.direction === query.direction))
|
|
63
|
+
.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
64
|
+
}
|
|
@@ -149,77 +149,77 @@ let MapQualityWidget = (() => {
|
|
|
149
149
|
static { this.styles = [
|
|
150
150
|
editorAnchoredPanelStyles,
|
|
151
151
|
css `
|
|
152
|
-
|
|
152
|
+
/* The box, the layer and the anchoring come from the shared pattern; this
|
|
153
153
|
is the panel's own stacking of sections inside it. */
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
.map-quality-panel {
|
|
155
|
+
display: flex;
|
|
156
|
+
flex-direction: column;
|
|
157
|
+
gap: 12px;
|
|
158
|
+
}
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
.map-quality-head {
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
justify-content: space-between;
|
|
164
|
+
gap: 8px;
|
|
165
|
+
font-weight: 600;
|
|
166
|
+
}
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
168
|
+
.map-quality-close {
|
|
169
|
+
border: none;
|
|
170
|
+
background: transparent;
|
|
171
|
+
color: var(--affine-text-secondary-color);
|
|
172
|
+
font-family: inherit;
|
|
173
|
+
font-size: 16px;
|
|
174
|
+
line-height: 1;
|
|
175
|
+
padding: 2px 6px;
|
|
176
|
+
border-radius: 4px;
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
}
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
.map-quality-close:hover {
|
|
181
|
+
background: var(--affine-hover-color);
|
|
182
|
+
color: var(--affine-text-primary-color);
|
|
183
|
+
}
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
.map-quality-group-label {
|
|
186
|
+
color: var(--affine-text-secondary-color);
|
|
187
|
+
font-size: 12px;
|
|
188
|
+
text-transform: uppercase;
|
|
189
|
+
letter-spacing: 0.04em;
|
|
190
|
+
}
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
192
|
+
/* One column for the control, one for the words. */
|
|
193
|
+
.map-quality-nudge {
|
|
194
|
+
display: grid;
|
|
195
|
+
grid-template-columns: ${unsafeCSS(CHECKBOX_GUTTER)}px 1fr;
|
|
196
|
+
align-items: start;
|
|
197
|
+
padding: 4px 0;
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
}
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
.map-quality-nudge input[disabled] {
|
|
202
|
+
cursor: not-allowed;
|
|
203
|
+
}
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
.map-quality-nudge input {
|
|
206
|
+
margin: 2px 0 0;
|
|
207
|
+
justify-self: start;
|
|
208
|
+
}
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
.map-quality-nudge[data-checked='true'] .map-quality-nudge-label {
|
|
211
|
+
color: var(--affine-text-secondary-color);
|
|
212
|
+
}
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
.map-quality-nudge-label {
|
|
215
|
+
overflow-wrap: anywhere;
|
|
216
|
+
}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
218
|
+
.map-quality-close:focus-visible,
|
|
219
|
+
.map-quality-nudge input:focus-visible {
|
|
220
|
+
outline: 2px solid var(--affine-primary-color);
|
|
221
|
+
outline-offset: 1px;
|
|
222
|
+
}
|
|
223
223
|
`,
|
|
224
224
|
]; }
|
|
225
225
|
#_openFor_accessor_storage;
|
|
@@ -265,7 +265,7 @@ let MapQualityWidget = (() => {
|
|
|
265
265
|
*/
|
|
266
266
|
_watchElements() {
|
|
267
267
|
const wanted = this._openFor !== null;
|
|
268
|
-
if (wanted ===
|
|
268
|
+
if (wanted === this._elementSubscriptions.length > 0)
|
|
269
269
|
return;
|
|
270
270
|
for (const subscription of this._elementSubscriptions) {
|
|
271
271
|
subscription.unsubscribe();
|