@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,109 @@
|
|
|
1
|
+
import { CommandUsageIdentifier, } from '../../std/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where `createLocalCommandUsageStore` persists. Namespaced like the rest of
|
|
4
|
+
* Labre's browser-local state, and versionless on purpose: the shape is two
|
|
5
|
+
* numbers per command, and a reader that does not recognise an entry drops it.
|
|
6
|
+
*/
|
|
7
|
+
export const COMMAND_USAGE_KEY = 'labre:command-usage';
|
|
8
|
+
/**
|
|
9
|
+
* Enough for every command of every framework several times over (the registry
|
|
10
|
+
* holds 76 today), small enough that the JSON stays a few kilobytes. Overflow
|
|
11
|
+
* evicts the least recently used entry, so the measure a ranking cares about —
|
|
12
|
+
* what this user reached for lately — is the last thing lost.
|
|
13
|
+
*/
|
|
14
|
+
const MAX_ENTRIES = 200;
|
|
15
|
+
/**
|
|
16
|
+
* `localStorage` throws outright in a few environments (private mode quotas,
|
|
17
|
+
* sandboxed frames, some test runners), and a usage measure is never important
|
|
18
|
+
* enough to take a command down with it — every access is therefore
|
|
19
|
+
* best-effort. Same rule and same shape as the icon picker's recent store.
|
|
20
|
+
*/
|
|
21
|
+
const storage = () => {
|
|
22
|
+
try {
|
|
23
|
+
return globalThis.localStorage ?? null;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const readUsage = () => {
|
|
30
|
+
try {
|
|
31
|
+
const raw = storage()?.getItem(COMMAND_USAGE_KEY);
|
|
32
|
+
if (!raw)
|
|
33
|
+
return {};
|
|
34
|
+
const parsed = JSON.parse(raw);
|
|
35
|
+
if (!parsed || typeof parsed !== 'object')
|
|
36
|
+
return {};
|
|
37
|
+
// Entry by entry: one corrupted record must not discard the whole table.
|
|
38
|
+
const usage = {};
|
|
39
|
+
for (const [id, value] of Object.entries(parsed)) {
|
|
40
|
+
const { c, t } = (value ?? {});
|
|
41
|
+
if (typeof c === 'number' && typeof t === 'number')
|
|
42
|
+
usage[id] = { c, t };
|
|
43
|
+
}
|
|
44
|
+
return usage;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const writeUsage = (usage) => {
|
|
51
|
+
try {
|
|
52
|
+
storage()?.setItem(COMMAND_USAGE_KEY, JSON.stringify(usage));
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// best-effort: this session keeps working, the measure just misses a run
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/** Keeps the {@link MAX_ENTRIES} most recently used entries, nothing else. */
|
|
59
|
+
const evictOverflow = (usage) => {
|
|
60
|
+
const ids = Object.keys(usage);
|
|
61
|
+
if (ids.length <= MAX_ENTRIES)
|
|
62
|
+
return usage;
|
|
63
|
+
const kept = ids
|
|
64
|
+
.sort((a, b) => usage[b].t - usage[a].t)
|
|
65
|
+
.slice(0, MAX_ENTRIES);
|
|
66
|
+
return Object.fromEntries(kept.map(id => [id, usage[id]]));
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The default {@link CommandUsageStore}: recency and frequency in this
|
|
70
|
+
* browser's `localStorage`, per command id.
|
|
71
|
+
*
|
|
72
|
+
* It measures only. Nothing ranks anything here — PF6's "seven most-recent +
|
|
73
|
+
* six most-used" sub-menu reads these numbers, and a host that
|
|
74
|
+
* wants the measure to follow the user across devices replaces the whole store
|
|
75
|
+
* through {@link CommandUsageExtension}.
|
|
76
|
+
*/
|
|
77
|
+
export function createLocalCommandUsageStore() {
|
|
78
|
+
return {
|
|
79
|
+
record: (command) => {
|
|
80
|
+
const usage = readUsage();
|
|
81
|
+
const previous = usage[command.id];
|
|
82
|
+
usage[command.id] = { c: (previous?.c ?? 0) + 1, t: Date.now() };
|
|
83
|
+
writeUsage(evictOverflow(usage));
|
|
84
|
+
},
|
|
85
|
+
statsOf: (commandId) => {
|
|
86
|
+
const entry = readUsage()[commandId];
|
|
87
|
+
return entry ? { count: entry.c, lastUsedAt: entry.t } : undefined;
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Host override seam: replace the browser-local measure with the host's own.
|
|
93
|
+
*
|
|
94
|
+
* This is where a host persists command usage in ITS database — so the ranking
|
|
95
|
+
* follows the user from laptop to browser to tablet instead of restarting at
|
|
96
|
+
* zero, which is exactly what a "most-used" sub-menu is judged on. The library
|
|
97
|
+
* ships the local store as the default (`CommandUsageViewExtension`) and never
|
|
98
|
+
* requires a host to care.
|
|
99
|
+
*
|
|
100
|
+
* Mirrors `EditorSettingExtension` / `KeymapOverrideExtension`: `di.override`,
|
|
101
|
+
* so a host registering after the library's own extensions always wins.
|
|
102
|
+
*/
|
|
103
|
+
export function CommandUsageExtension(store) {
|
|
104
|
+
return {
|
|
105
|
+
setup: di => {
|
|
106
|
+
di.override(CommandUsageIdentifier, () => store);
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DividerBlockModel } from '../../../affine-model/index.js';
|
|
2
2
|
import { DisposableGroup } from '../../../global/disposable/index.js';
|
|
3
|
-
import { BlockSelection, LifeCycleWatcher, TextSelection
|
|
3
|
+
import { BlockSelection, LifeCycleWatcher, TextSelection } from '../../../std/index.js';
|
|
4
4
|
import { signal } from '@preact/signals-core';
|
|
5
5
|
import { getSelectedBlocksCommand } from '../../commands/index.js';
|
|
6
6
|
import { ImageSelection } from '../../selection/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createIdentifier } from '../../global/di/index.js';
|
|
2
|
-
import { disposeMember
|
|
2
|
+
import { disposeMember } from '../../global/disposable/index.js';
|
|
3
3
|
import { AliasIcon, BlockLinkIcon, DeleteIcon, EdgelessIcon, LinkedEdgelessIcon, LinkedPageIcon, PageIcon, } from '@blocksuite/icons/lit';
|
|
4
4
|
import { LifeCycleWatcher, StdIdentifier } from '../../std/index.js';
|
|
5
5
|
import { computed, signal, } from '@preact/signals-core';
|
|
@@ -405,6 +405,17 @@ export declare class EditPropsStore extends LifeCycleWatcher {
|
|
|
405
405
|
dispose(): void;
|
|
406
406
|
getStorage<T extends StoragePropsKey>(key: T): StorageProps[T] | null;
|
|
407
407
|
recordLastProps(key: LastPropsKey, props: Partial<LastProps[LastPropsKey]>): void;
|
|
408
|
+
/**
|
|
409
|
+
* Remember the edgeless viewport of the current editing session, so the next
|
|
410
|
+
* mount of this doc reopens where the user left it.
|
|
411
|
+
*
|
|
412
|
+
* The storage key is shared by every mount of the same doc, so a read-only
|
|
413
|
+
* mount — an embedded preview, a mini map — must not overwrite what the full
|
|
414
|
+
* editor remembered: a preview is not an editing session. Readonly is read
|
|
415
|
+
* here, at save time (the edgeless root block saves on unmount), so a
|
|
416
|
+
* session that turns read-only before unmounting stops writing too.
|
|
417
|
+
*/
|
|
418
|
+
saveViewport(viewport: StorageProps['viewport']): void;
|
|
408
419
|
setStorage<T extends StoragePropsKey>(key: T, value: StorageProps[T]): void;
|
|
409
420
|
unmounted(): void;
|
|
410
421
|
}
|
|
@@ -156,6 +156,21 @@ export class EditPropsStore extends LifeCycleWatcher {
|
|
|
156
156
|
const nextProps = mergeWith(clonedeep(innerProps), { [key]: overrideProps }, customizer);
|
|
157
157
|
this.innerProps$.value = OptionalPropsSchema.parse(nextProps);
|
|
158
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Remember the edgeless viewport of the current editing session, so the next
|
|
161
|
+
* mount of this doc reopens where the user left it.
|
|
162
|
+
*
|
|
163
|
+
* The storage key is shared by every mount of the same doc, so a read-only
|
|
164
|
+
* mount — an embedded preview, a mini map — must not overwrite what the full
|
|
165
|
+
* editor remembered: a preview is not an editing session. Readonly is read
|
|
166
|
+
* here, at save time (the edgeless root block saves on unmount), so a
|
|
167
|
+
* session that turns read-only before unmounting stops writing too.
|
|
168
|
+
*/
|
|
169
|
+
saveViewport(viewport) {
|
|
170
|
+
if (this.std.store.readonly)
|
|
171
|
+
return;
|
|
172
|
+
this.setStorage('viewport', viewport);
|
|
173
|
+
}
|
|
159
174
|
setStorage(key, value) {
|
|
160
175
|
const oldValue = this.getStorage(key);
|
|
161
176
|
this._getStorage(key).setItem(this._getStorageKey(key), JSON.stringify(value));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIdentifier
|
|
1
|
+
import { createIdentifier } from '../../../global/di/index.js';
|
|
2
2
|
export const EmbedIframeConfigIdentifier = createIdentifier('EmbedIframeConfig');
|
|
3
3
|
export function EmbedIframeConfigExtension(config) {
|
|
4
4
|
const identifier = EmbedIframeConfigIdentifier(config.name);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export * from './artefact-catalogue-service.js';
|
|
1
2
|
export * from './audit-service.js';
|
|
2
3
|
export * from './auto-clear-selection-service.js';
|
|
3
4
|
export * from './block-meta-service.js';
|
|
4
5
|
export * from './citation-service/index.js';
|
|
6
|
+
export * from './command-usage-service.js';
|
|
5
7
|
export * from './comment-service/index.js';
|
|
6
8
|
export * from './doc-display-meta-service.js';
|
|
7
9
|
export * from './doc-mode-service.js';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export * from './artefact-catalogue-service.js';
|
|
1
2
|
export * from './audit-service.js';
|
|
2
3
|
export * from './auto-clear-selection-service.js';
|
|
3
4
|
export * from './block-meta-service.js';
|
|
4
5
|
export * from './citation-service/index.js';
|
|
6
|
+
export * from './command-usage-service.js';
|
|
5
7
|
export * from './comment-service/index.js';
|
|
6
8
|
export * from './doc-display-meta-service.js';
|
|
7
9
|
export * from './doc-mode-service.js';
|
|
@@ -110,7 +110,8 @@ export class PivotMaterialityPublisher extends LifeCycleWatcher {
|
|
|
110
110
|
// there is nobody to announce to, so nothing is subscribed and the whole
|
|
111
111
|
// watcher costs one lookup. Binding and qualification keep working: they
|
|
112
112
|
// are element-local writes and never needed the host.
|
|
113
|
-
if (!this.std.getOptional(PivotPropertiesProvider)
|
|
113
|
+
if (!this.std.getOptional(PivotPropertiesProvider)
|
|
114
|
+
?.publishOccurrenceMaterialities) {
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
116
117
|
// The surface is a SIGNAL, not a fact: it can legitimately be null at mount
|
|
@@ -34,7 +34,7 @@ export type BlockLifecycleEvents = {
|
|
|
34
34
|
* manipulated ('background:classic', 'node:market', 'connector:link'…).
|
|
35
35
|
*/
|
|
36
36
|
export interface FrameworkElementEvent extends TelemetryEvent {
|
|
37
|
-
framework: 'wardley' | 'edgy' | 'cynefin' | 'bpmn' | 'event-storming' | 'core-domain' | 'context-map';
|
|
37
|
+
framework: 'wardley' | 'edgy' | 'cynefin' | 'bpmn' | 'c4' | 'event-storming' | 'core-domain' | 'context-map';
|
|
38
38
|
element: string;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
@@ -101,11 +101,83 @@ export interface EdgeDirectionEvent extends TelemetryEvent {
|
|
|
101
101
|
/** How many edges the single gesture reversed. */
|
|
102
102
|
elementCount: number;
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* A framework element became a NEARBY kind of itself — a task said more
|
|
106
|
+
* precisely as a user task, a start event as a timer start — from its own
|
|
107
|
+
* contextual toolbar, in one atomic write.
|
|
108
|
+
*
|
|
109
|
+
* **A new event name, for the reason {@link FrameworkPromotionEvent} gives.**
|
|
110
|
+
* ADR 0003 § 2 defines the creation event as UI intent emitted at INSERTION
|
|
111
|
+
* sites, and a morph inserts nothing: no element is created, destroyed or
|
|
112
|
+
* swapped, no id changes, no geometry moves and no connector is re-pointed.
|
|
113
|
+
* Reusing `FrameworkElementAdded` would count a drawn-then-refined artefact
|
|
114
|
+
* twice and inflate "elements added per framework" permanently.
|
|
115
|
+
*
|
|
116
|
+
* Worth measuring on its own, too. The set of reachable kinds is DATA a
|
|
117
|
+
* framework declares by hand, and the only evidence that a declared family is
|
|
118
|
+
* the right family is how often it is actually crossed — a pair nobody ever
|
|
119
|
+
* morphs between did not need to be offered, and a morph users reach for
|
|
120
|
+
* constantly says the palette led them to the wrong artefact first.
|
|
121
|
+
*
|
|
122
|
+
* Ids only: the two roles, and their framework. Never a kind's board content,
|
|
123
|
+
* never the element ids, never the label anybody typed.
|
|
124
|
+
*/
|
|
125
|
+
export interface FrameworkElementMorphedEvent extends TelemetryEvent {
|
|
126
|
+
page?: 'whiteboard editor';
|
|
127
|
+
/**
|
|
128
|
+
* Owning framework — the declaration's own wire key, matching what
|
|
129
|
+
* `reportCommandTelemetry` sends for that framework's commands.
|
|
130
|
+
*
|
|
131
|
+
* OPTIONAL for the same reason it is on {@link FrameworkPromotionEvent}: the
|
|
132
|
+
* capability is generic, and an element type may one day declare a morph
|
|
133
|
+
* without belonging to a framework the union names. Absent rather than
|
|
134
|
+
* `'unknown'`, per the repo convention.
|
|
135
|
+
*/
|
|
136
|
+
framework?: FrameworkId;
|
|
137
|
+
/** Role id the selection carried, when they all carried the same one. */
|
|
138
|
+
fromRole?: string;
|
|
139
|
+
/** Role id it now carries. */
|
|
140
|
+
toRole?: string;
|
|
141
|
+
/** How many elements the single gesture actually rewrote. */
|
|
142
|
+
elementCount: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A framework VIEW was told which level it draws — a C4 board set to Context,
|
|
146
|
+
* Container or Component, or put back to a free sketch.
|
|
147
|
+
*
|
|
148
|
+
* **A new event name, for the reason {@link FrameworkPromotionEvent} gives.**
|
|
149
|
+
* Nothing is inserted, nothing is morphed and no level of requirement changes:
|
|
150
|
+
* the author is stating what the sheet IS, which is a fact none of the existing
|
|
151
|
+
* events describes. Reusing one of them would corrupt the funnel it belongs to.
|
|
152
|
+
*
|
|
153
|
+
* Worth measuring on its own, and for the same reason a profile change is: this
|
|
154
|
+
* is an OPTIONAL declaration nothing forces, so how often it is made is the only
|
|
155
|
+
* evidence that asking for it was worth the toolbar entry — and a level users
|
|
156
|
+
* set and then clear is a rule pack that argued with a drawing they meant.
|
|
157
|
+
*
|
|
158
|
+
* Ids only: the framework and the level's own closed vocabulary. Never the
|
|
159
|
+
* board's title, never what is drawn on it.
|
|
160
|
+
*/
|
|
161
|
+
export interface FrameworkViewLevelEvent extends TelemetryEvent {
|
|
162
|
+
page?: 'whiteboard editor';
|
|
163
|
+
/** Owning framework of the view, e.g. `c4`. */
|
|
164
|
+
framework: FrameworkId;
|
|
165
|
+
/**
|
|
166
|
+
* The level now in force, from the framework's own closed vocabulary —
|
|
167
|
+
* `'none'` when the view has been put back to declaring nothing, which is a
|
|
168
|
+
* value the dashboard needs as much as the others.
|
|
169
|
+
*/
|
|
170
|
+
level: string;
|
|
171
|
+
/** The one it replaces, when the view declared one. */
|
|
172
|
+
previousLevel?: string;
|
|
173
|
+
}
|
|
104
174
|
export type FrameworkDiagramEvents = {
|
|
105
175
|
FrameworkElementAdded: FrameworkElementEvent;
|
|
106
176
|
FrameworkToolPicked: FrameworkElementEvent;
|
|
107
177
|
FrameworkLegendCreated: FrameworkElementEvent;
|
|
108
178
|
FrameworkElementPromoted: FrameworkPromotionEvent;
|
|
179
|
+
FrameworkElementMorphed: FrameworkElementMorphedEvent;
|
|
180
|
+
FrameworkViewLevelSet: FrameworkViewLevelEvent;
|
|
109
181
|
EdgeDirectionInverted: EdgeDirectionEvent;
|
|
110
182
|
};
|
|
111
183
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { BlockStdScope } from '../../../std/index.js';
|
|
1
2
|
import type { TemplateResult } from 'lit';
|
|
3
|
+
import { type ChromeWording } from '../translation-service/index.js';
|
|
2
4
|
import type { ToolbarContext } from './context.js';
|
|
3
5
|
export declare enum ActionPlacement {
|
|
4
6
|
Start = 0,
|
|
@@ -25,9 +27,28 @@ type ActionBase = {
|
|
|
25
27
|
};
|
|
26
28
|
export type ToolbarAction = ActionBase & {
|
|
27
29
|
label?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The same word as {@link label}, said as an i18n key with its English
|
|
32
|
+
* default — resolved against the host's catalogue when the row is built, and
|
|
33
|
+
* written over `label` there (`combine`, in the toolbar widget).
|
|
34
|
+
*
|
|
35
|
+
* It exists because `label` is a VALUE and the translation seam needs `std`:
|
|
36
|
+
* a literal here is the one wording a host cannot override, which is what
|
|
37
|
+
* left a fully translated editor saying "Duplicate" and "Card view" in
|
|
38
|
+
* English (#183). Declaring the pair keeps a call site one line — the shape a
|
|
39
|
+
* static label already had — instead of pushing every entry that has words
|
|
40
|
+
* into a `generate`.
|
|
41
|
+
*
|
|
42
|
+
* Wordings are declared once in `@labre/affine-shared/services`
|
|
43
|
+
* (`CHROME_WORDINGS`), which is also what the key manifest walks — a pair
|
|
44
|
+
* spelt inline at a call site would be a key no host is ever offered.
|
|
45
|
+
*/
|
|
46
|
+
labelWording?: ChromeWording;
|
|
28
47
|
showLabel?: boolean;
|
|
29
48
|
icon?: TemplateResult;
|
|
30
49
|
tooltip?: string | TemplateResult;
|
|
50
|
+
/** {@link labelWording}, for the tooltip. Written over `tooltip`. */
|
|
51
|
+
tooltipWording?: ChromeWording;
|
|
31
52
|
variant?: 'destructive';
|
|
32
53
|
disabled?: ((cx: ToolbarContext) => boolean) | boolean;
|
|
33
54
|
content?: ((cx: ToolbarContext) => TemplateResult | null) | (TemplateResult | null);
|
|
@@ -45,4 +66,15 @@ export type ToolbarActionGroupGenerator = ActionBase & {
|
|
|
45
66
|
};
|
|
46
67
|
export type ToolbarGenericAction = ToolbarAction | ToolbarActionGenerator | ToolbarActionGroup | ToolbarActionGroupGenerator;
|
|
47
68
|
export type ToolbarActions<T extends ActionBase = ToolbarGenericAction> = T[];
|
|
69
|
+
/**
|
|
70
|
+
* What an entry SAYS, whether it declared a wording or a literal label.
|
|
71
|
+
*
|
|
72
|
+
* The row itself never needs this — `combine` resolves `labelWording` onto
|
|
73
|
+
* `label` before anything is drawn. It exists for the entries a widget renders
|
|
74
|
+
* ITSELF out of the raw declarations, which is exactly what the view switcher
|
|
75
|
+
* does: `content(ctx)` hands its own children to `affine-view-dropdown-menu`,
|
|
76
|
+
* so those never pass through `combine` and would otherwise be the one control
|
|
77
|
+
* in the editor left saying "Card view" in English (#183).
|
|
78
|
+
*/
|
|
79
|
+
export declare function toolbarActionLabel(std: BlockStdScope, action: ToolbarAction): string;
|
|
48
80
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { translateKey } from '../translation-service/index.js';
|
|
1
2
|
export var ActionPlacement;
|
|
2
3
|
(function (ActionPlacement) {
|
|
3
4
|
ActionPlacement[ActionPlacement["Start"] = 0] = "Start";
|
|
@@ -5,3 +6,18 @@ export var ActionPlacement;
|
|
|
5
6
|
ActionPlacement[ActionPlacement["End"] = 2] = "End";
|
|
6
7
|
ActionPlacement[ActionPlacement["More"] = 4] = "More";
|
|
7
8
|
})(ActionPlacement || (ActionPlacement = {}));
|
|
9
|
+
/**
|
|
10
|
+
* What an entry SAYS, whether it declared a wording or a literal label.
|
|
11
|
+
*
|
|
12
|
+
* The row itself never needs this — `combine` resolves `labelWording` onto
|
|
13
|
+
* `label` before anything is drawn. It exists for the entries a widget renders
|
|
14
|
+
* ITSELF out of the raw declarations, which is exactly what the view switcher
|
|
15
|
+
* does: `content(ctx)` hands its own children to `affine-view-dropdown-menu`,
|
|
16
|
+
* so those never pass through `combine` and would otherwise be the one control
|
|
17
|
+
* in the editor left saying "Card view" in English (#183).
|
|
18
|
+
*/
|
|
19
|
+
export function toolbarActionLabel(std, action) {
|
|
20
|
+
return action.labelWording
|
|
21
|
+
? translateKey(std, ...action.labelWording)
|
|
22
|
+
: (action.label ?? '');
|
|
23
|
+
}
|
|
@@ -9,11 +9,21 @@ export declare enum Flag {
|
|
|
9
9
|
Accepting = 64
|
|
10
10
|
}
|
|
11
11
|
export declare class Flags {
|
|
12
|
+
#private;
|
|
12
13
|
value$: import("@preact/signals-core").Signal<Flag>;
|
|
14
|
+
get revision(): number;
|
|
15
|
+
get revision$(): import("@preact/signals-core").Signal<number>;
|
|
13
16
|
get value(): Flag;
|
|
14
17
|
toggle(flag: Flag, activated: boolean): void;
|
|
15
18
|
check(flag: Flag, value?: Flag): boolean;
|
|
16
19
|
contains(flag: number, value?: Flag): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Forces subscribers to re-run while keeping `flag` activated.
|
|
22
|
+
*
|
|
23
|
+
* The revision bump is what actually notifies; the batch keeps both writes
|
|
24
|
+
* in a single notification so the toolbar never sees a transient
|
|
25
|
+
* {@link Flag.None} frame.
|
|
26
|
+
*/
|
|
17
27
|
refresh(flag: Flag): void;
|
|
18
28
|
reset(): void;
|
|
19
29
|
hide(): void;
|
|
@@ -16,6 +16,30 @@ export var Flag;
|
|
|
16
16
|
export class Flags {
|
|
17
17
|
constructor() {
|
|
18
18
|
this.value$ = signal(Flag.None);
|
|
19
|
+
/**
|
|
20
|
+
* Bumped on every {@link Flags.refresh} call.
|
|
21
|
+
*
|
|
22
|
+
* `refresh` intentionally leaves `value$` unchanged, so it cannot be used as
|
|
23
|
+
* a repaint channel on its own: since `@preact/signals-core` 1.14 a `batch`
|
|
24
|
+
* that ends on its initial value notifies nobody. Subscribers that must
|
|
25
|
+
* re-run on a forced refresh have to read this revision counter as well.
|
|
26
|
+
*/
|
|
27
|
+
this.#revision$ = signal(0);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Bumped on every {@link Flags.refresh} call.
|
|
31
|
+
*
|
|
32
|
+
* `refresh` intentionally leaves `value$` unchanged, so it cannot be used as
|
|
33
|
+
* a repaint channel on its own: since `@preact/signals-core` 1.14 a `batch`
|
|
34
|
+
* that ends on its initial value notifies nobody. Subscribers that must
|
|
35
|
+
* re-run on a forced refresh have to read this revision counter as well.
|
|
36
|
+
*/
|
|
37
|
+
#revision$;
|
|
38
|
+
get revision() {
|
|
39
|
+
return this.#revision$.peek();
|
|
40
|
+
}
|
|
41
|
+
get revision$() {
|
|
42
|
+
return this.#revision$;
|
|
19
43
|
}
|
|
20
44
|
get value() {
|
|
21
45
|
return this.value$.peek();
|
|
@@ -33,10 +57,17 @@ export class Flags {
|
|
|
33
57
|
contains(flag, value = this.value) {
|
|
34
58
|
return (flag & value) !== Flag.None;
|
|
35
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Forces subscribers to re-run while keeping `flag` activated.
|
|
62
|
+
*
|
|
63
|
+
* The revision bump is what actually notifies; the batch keeps both writes
|
|
64
|
+
* in a single notification so the toolbar never sees a transient
|
|
65
|
+
* {@link Flag.None} frame.
|
|
66
|
+
*/
|
|
36
67
|
refresh(flag) {
|
|
37
68
|
batch(() => {
|
|
38
|
-
this.toggle(flag, false);
|
|
39
69
|
this.toggle(flag, true);
|
|
70
|
+
this.#revision$.value++;
|
|
40
71
|
});
|
|
41
72
|
}
|
|
42
73
|
reset() {
|
|
@@ -8,7 +8,19 @@ import type { ToolbarModule } from './module.js';
|
|
|
8
8
|
export declare const ToolbarModuleIdentifier: import("../../../global/di/types.js").ServiceIdentifier<ToolbarModule> & (<U extends ToolbarModule = ToolbarModule>(variant: import("../../../global/di/types.js").ServiceVariant) => import("../../../global/di/types.js").ServiceIdentifier<U>);
|
|
9
9
|
export declare const ToolbarRegistryIdentifier: import("../../../global/di/types.js").ServiceIdentifier<ToolbarRegistryExtension> & (<U extends ToolbarRegistryExtension = ToolbarRegistryExtension>(variant: import("../../../global/di/types.js").ServiceVariant) => import("../../../global/di/types.js").ServiceIdentifier<U>);
|
|
10
10
|
export declare function ToolbarModuleExtension(module: ToolbarModule): ExtensionType;
|
|
11
|
+
/** The flavour a DI variant speaks for, owner suffix and all. */
|
|
12
|
+
export declare function toolbarModuleFlavour(variant: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* A second (or third) module on one flavour, named by who contributes it.
|
|
15
|
+
*
|
|
16
|
+
* The owner is never shown and never parsed back — it exists so two
|
|
17
|
+
* contributors cannot claim one DI variant. Use a stable, framework-scoped
|
|
18
|
+
* name (`c4-morph`), because it is the identity the container refuses
|
|
19
|
+
* duplicates on.
|
|
20
|
+
*/
|
|
21
|
+
export declare function toolbarModuleKey(flavour: string, owner: string): string;
|
|
11
22
|
export declare class ToolbarRegistryExtension extends Extension {
|
|
23
|
+
#private;
|
|
12
24
|
readonly std: BlockStdScope;
|
|
13
25
|
flavour$: import("@preact/signals-core").Signal<string>;
|
|
14
26
|
elementsMap$: import("@preact/signals-core").Signal<Map<string, GfxModel[]>>;
|
|
@@ -20,8 +32,40 @@ export declare class ToolbarRegistryExtension extends Extension {
|
|
|
20
32
|
placement$: import("@preact/signals-core").Signal<ToolbarPlacement>;
|
|
21
33
|
flags: Flags;
|
|
22
34
|
constructor(std: BlockStdScope);
|
|
35
|
+
/**
|
|
36
|
+
* Every module of every flavour, keyed by the DI variant it was registered
|
|
37
|
+
* under — which for a shared flavour carries an owner suffix. Read
|
|
38
|
+
* {@link modulesFor} instead unless the variant itself is the question.
|
|
39
|
+
*/
|
|
23
40
|
get modules(): Map<string, ToolbarModule>;
|
|
41
|
+
/**
|
|
42
|
+
* Every module contributing to one flavour's row — the bare-key module
|
|
43
|
+
* first, then the owner-suffixed ones in registration order.
|
|
44
|
+
*/
|
|
45
|
+
modulesFor(flavour: string): readonly ToolbarModule[];
|
|
46
|
+
/**
|
|
47
|
+
* The config registered under the flavour ITSELF, or `null`.
|
|
48
|
+
*
|
|
49
|
+
* Deliberately not "the first module of this flavour". The callers of this
|
|
50
|
+
* method ask a question about one identified registration — does this block
|
|
51
|
+
* flavour have a toolbar of its own, where does that toolbar sit — and an
|
|
52
|
+
* owner-suffixed contributor is an ADDITION to a row, not a stand-in for the
|
|
53
|
+
* module that defines it. Answering with a contributor would make the reply
|
|
54
|
+
* depend on which frameworks a host happened to switch on: with `wardley`
|
|
55
|
+
* off and `c4` on, `custom:affine:surface:group` has no bare module at all,
|
|
56
|
+
* and returning C4's morph there would let a placement (or a `has`-style
|
|
57
|
+
* probe) be decided by a menu that only some builds ship.
|
|
58
|
+
*/
|
|
24
59
|
getModuleBy(flavour: string): import("./config.js").ToolbarModuleConfig | null;
|
|
60
|
+
/**
|
|
61
|
+
* Where a flavour's row sits: the first module of it that actually SAYS.
|
|
62
|
+
*
|
|
63
|
+
* A row is one row however many modules contribute to it, so the placement
|
|
64
|
+
* is a property of the flavour and not of a registration — and a contributor
|
|
65
|
+
* that declares none must not be read as declaring the default. Scanning for
|
|
66
|
+
* the first module with a `placement` keeps the answer the same whether the
|
|
67
|
+
* framework that states it is registered first, last, or under an owner.
|
|
68
|
+
*/
|
|
25
69
|
getModulePlacement(flavour: string, fallback?: ToolbarPlacement): ToolbarPlacement;
|
|
26
70
|
static setup(di: Container): void;
|
|
27
71
|
}
|