@formicoidea/labre-core 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_pkgs/affine-block-attachment/attachment-block.js +1 -1
- package/dist/_pkgs/affine-block-callout/callout-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-callout/callout-block.js +26 -4
- package/dist/_pkgs/affine-block-callout/callout-keymap.js +59 -19
- package/dist/_pkgs/affine-block-callout/commands/callout-to-paragraph.d.ts +20 -0
- package/dist/_pkgs/affine-block-callout/commands/callout-to-paragraph.js +60 -0
- package/dist/_pkgs/affine-block-callout/commands/split-callout.d.ts +17 -0
- package/dist/_pkgs/affine-block-callout/commands/split-callout.js +42 -0
- package/dist/_pkgs/affine-block-callout/configs/slash-menu.js +9 -6
- package/dist/_pkgs/affine-block-callout/emoji-margin.d.ts +9 -0
- package/dist/_pkgs/affine-block-callout/emoji-margin.js +36 -0
- package/dist/_pkgs/affine-block-callout/emoji-menu.d.ts +5 -1
- package/dist/_pkgs/affine-block-callout/emoji-menu.js +5 -0
- package/dist/_pkgs/affine-block-code/code-block-inline.js +1 -1
- package/dist/_pkgs/affine-block-code/code-block.d.ts +14 -0
- package/dist/_pkgs/affine-block-code/code-block.js +44 -6
- package/dist/_pkgs/affine-block-code/code-toolbar/components/code-toolbar.d.ts +2 -0
- package/dist/_pkgs/affine-block-code/code-toolbar/components/code-toolbar.js +23 -14
- package/dist/_pkgs/affine-block-code/code-toolbar/components/more-menu.d.ts +16 -0
- package/dist/_pkgs/affine-block-code/code-toolbar/components/more-menu.js +93 -0
- package/dist/_pkgs/affine-block-code/code-toolbar/config.js +54 -5
- package/dist/_pkgs/affine-block-code/code-toolbar/index.js +1 -1
- package/dist/_pkgs/affine-block-code/effects.d.ts +2 -0
- package/dist/_pkgs/affine-block-code/effects.js +2 -0
- package/dist/_pkgs/affine-block-code/highlight/affine-code-unit.js +6 -1
- package/dist/_pkgs/affine-block-code/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-code/index.js +1 -0
- package/dist/_pkgs/affine-block-code/line-numbers.d.ts +25 -0
- package/dist/_pkgs/affine-block-code/line-numbers.js +27 -0
- package/dist/_pkgs/affine-block-code/styles.js +31 -0
- package/dist/_pkgs/affine-block-data-view/data-view-block.js +1 -0
- package/dist/_pkgs/affine-block-database/components/title/index.js +4 -1
- package/dist/_pkgs/affine-block-database/configs/slash-menu.js +28 -1
- package/dist/_pkgs/affine-block-database/data-source.js +1 -2
- package/dist/_pkgs/affine-block-database/database-block.js +13 -0
- package/dist/_pkgs/affine-block-database/external-data-source.js +1 -1
- package/dist/_pkgs/affine-block-database/properties/paste-url.d.ts +24 -0
- package/dist/_pkgs/affine-block-database/properties/paste-url.js +98 -0
- package/dist/_pkgs/affine-block-database/properties/rich-text/cell-renderer.js +9 -19
- package/dist/_pkgs/affine-block-database/properties/title/text.js +20 -25
- package/dist/_pkgs/affine-block-database/views/index.js +1 -0
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +11 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.d.ts +3 -0
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +48 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/font-size.d.ts +17 -0
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/font-size.js +24 -0
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-service.js +1 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +2 -2
- package/dist/_pkgs/affine-block-embed-doc/common/doc-trashed.d.ts +9 -0
- package/dist/_pkgs/affine-block-embed-doc/common/doc-trashed.js +10 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +8 -4
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/utils.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +1 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.d.ts +4 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +23 -4
- package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +13 -0
- package/dist/_pkgs/affine-block-frame/frame-manager.js +34 -2
- package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
- package/dist/_pkgs/affine-block-image/components/page-image-block.js +1 -1
- package/dist/_pkgs/affine-block-image/image-edgeless-block.js +1 -1
- package/dist/_pkgs/affine-block-latex/styles.js +6 -1
- package/dist/_pkgs/affine-block-list/utils/forward-delete.js +1 -1
- package/dist/_pkgs/affine-block-note/commands/select-block.js +1 -1
- package/dist/_pkgs/affine-block-note/commands/select-blocks-between.js +1 -1
- package/dist/_pkgs/affine-block-note/move-block.js +1 -1
- package/dist/_pkgs/affine-block-note/note-edgeless-block.d.ts +9 -0
- package/dist/_pkgs/affine-block-note/note-edgeless-block.js +29 -1
- package/dist/_pkgs/affine-block-paragraph/utils/forward-delete.js +2 -2
- package/dist/_pkgs/affine-block-paragraph/utils/merge-with-prev.js +1 -1
- package/dist/_pkgs/affine-block-root/commands/pivot-commands.d.ts +37 -0
- package/dist/_pkgs/affine-block-root/commands/pivot-commands.js +168 -0
- package/dist/_pkgs/affine-block-root/commands/reading-commands.d.ts +23 -0
- package/dist/_pkgs/affine-block-root/commands/reading-commands.js +107 -0
- package/dist/_pkgs/affine-block-root/commands/tag-commands.d.ts +47 -0
- package/dist/_pkgs/affine-block-root/commands/tag-commands.js +159 -0
- package/dist/_pkgs/affine-block-root/configs/toolbar.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +10 -3
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/render-linked-doc.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +27 -2
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +11 -2
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-service.js +14 -0
- package/dist/_pkgs/affine-block-root/edgeless/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/edgeless/index.js +1 -0
- package/dist/_pkgs/affine-block-root/edgeless/reserved-keys.d.ts +21 -0
- package/dist/_pkgs/affine-block-root/edgeless/reserved-keys.js +34 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/clipboard-utils.js +1 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +7 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +11 -2
- package/dist/_pkgs/affine-block-root/index.d.ts +4 -1
- package/dist/_pkgs/affine-block-root/index.js +4 -1
- package/dist/_pkgs/affine-block-root/keyboard/commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-root/keyboard/commands.js +147 -0
- package/dist/_pkgs/affine-block-root/view.js +13 -4
- package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.js +1 -1
- package/dist/_pkgs/affine-block-surface/adapters/plain-text/element-adapter/type.js +1 -1
- package/dist/_pkgs/affine-block-surface/commands/reassociate-connectors.js +0 -1
- package/dist/_pkgs/affine-block-surface/effects.js +6 -0
- package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +21 -3
- package/dist/_pkgs/affine-block-surface/element-model/index.js +14 -2
- package/dist/_pkgs/affine-block-surface/extensions/audit.d.ts +107 -0
- package/dist/_pkgs/affine-block-surface/extensions/audit.js +489 -0
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.d.ts +14 -0
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +37 -5
- package/dist/_pkgs/affine-block-surface/extensions/editor-anchored-panel.d.ts +133 -0
- package/dist/_pkgs/affine-block-surface/extensions/editor-anchored-panel.js +327 -0
- package/dist/_pkgs/affine-block-surface/extensions/element-renderer.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +17 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +17 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.d.ts +172 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +393 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +306 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange.js +64 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality-widget.d.ts +146 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality-widget.js +528 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality.d.ts +109 -0
- package/dist/_pkgs/affine-block-surface/extensions/map-quality.js +84 -0
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.d.ts +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-toolbar.d.ts +15 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-toolbar.js +158 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +145 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +588 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +494 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +767 -0
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.d.ts +45 -0
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.js +177 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +107 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +958 -0
- package/dist/_pkgs/affine-block-surface/extensions/tags-toolbar.d.ts +10 -0
- package/dist/_pkgs/affine-block-surface/extensions/tags-toolbar.js +295 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation-toolbar.d.ts +27 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation-toolbar.js +361 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +2129 -0
- package/dist/_pkgs/affine-block-surface/extensions/validation.js +4620 -0
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.d.ts +330 -0
- package/dist/_pkgs/affine-block-surface/extensions/violation-detail-widget.js +1004 -0
- package/dist/_pkgs/affine-block-surface/extensions/violation-timeline.d.ts +80 -0
- package/dist/_pkgs/affine-block-surface/extensions/violation-timeline.js +123 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.d.ts +610 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.js +206 -0
- package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +188 -0
- package/dist/_pkgs/affine-block-surface/framework-background/facts.js +284 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +5 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.js +5 -0
- package/dist/_pkgs/affine-block-surface/framework-background/interaction.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/framework-background/interaction.js +24 -0
- package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +99 -0
- package/dist/_pkgs/affine-block-surface/framework-background/labels.js +193 -0
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.d.ts +8 -0
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +399 -0
- package/dist/_pkgs/affine-block-surface/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +69 -3
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +333 -44
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +18 -2
- package/dist/_pkgs/affine-block-surface/renderer/overlay.js +1 -1
- package/dist/_pkgs/affine-block-surface/tool/default-tool.js +8 -0
- package/dist/_pkgs/affine-block-surface/utils/font.js +9 -3
- package/dist/_pkgs/affine-block-surface/view.d.ts +17 -0
- package/dist/_pkgs/affine-block-surface/view.js +57 -2
- package/dist/_pkgs/affine-block-surface-ref/portal/note.js +2 -2
- package/dist/_pkgs/affine-block-table/commands.js +1 -1
- package/dist/_pkgs/affine-block-table/selection-controller.d.ts +6 -0
- package/dist/_pkgs/affine-block-table/selection-controller.js +24 -1
- package/dist/_pkgs/affine-block-table/table-block.js +8 -2
- package/dist/_pkgs/affine-block-table/table-cell.js +5 -6
- package/dist/_pkgs/affine-block-table/table-keymap.d.ts +18 -0
- package/dist/_pkgs/affine-block-table/table-keymap.js +41 -0
- package/dist/_pkgs/affine-block-table/utils.d.ts +7 -0
- package/dist/_pkgs/affine-block-table/utils.js +12 -0
- package/dist/_pkgs/affine-block-table/view.js +2 -0
- package/dist/_pkgs/affine-components/caption/captioned-block-component.js +2 -1
- package/dist/_pkgs/affine-components/context-menu/button.d.ts +7 -0
- package/dist/_pkgs/affine-components/context-menu/button.js +7 -2
- package/dist/_pkgs/affine-components/context-menu/input.d.ts +4 -0
- package/dist/_pkgs/affine-components/context-menu/input.js +12 -0
- package/dist/_pkgs/affine-components/context-menu/menu-all.d.ts +2 -0
- package/dist/_pkgs/affine-components/context-menu/menu-renderer.js +8 -1
- package/dist/_pkgs/affine-components/context-menu/sub-menu.js +3 -0
- package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +1 -1
- package/dist/_pkgs/affine-components/embed-card-modal/embed-card-edit-modal.js +1 -1
- package/dist/_pkgs/affine-components/filterable-list/styles.js +1 -1
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/highlight-duotone-icon.js +8 -8
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/text-duotone-icon.js +11 -11
- package/dist/_pkgs/affine-components/icon-picker/affine-icon-picker-panel.d.ts +28 -0
- package/dist/_pkgs/affine-components/icon-picker/affine-icon-picker-panel.js +231 -0
- package/dist/_pkgs/affine-components/icon-picker/emoji-data.d.ts +40 -0
- package/dist/_pkgs/affine-components/icon-picker/emoji-data.js +99 -0
- package/dist/_pkgs/affine-components/icon-picker/emoji-picker-panel.d.ts +32 -0
- package/dist/_pkgs/affine-components/icon-picker/emoji-picker-panel.js +276 -0
- package/dist/_pkgs/affine-components/icon-picker/icon-data.d.ts +34 -0
- package/dist/_pkgs/affine-components/icon-picker/icon-data.js +83 -0
- package/dist/_pkgs/affine-components/icon-picker/icon-picker.d.ts +39 -0
- package/dist/_pkgs/affine-components/icon-picker/icon-picker.js +233 -0
- package/dist/_pkgs/affine-components/icon-picker/index.d.ts +8 -0
- package/dist/_pkgs/affine-components/icon-picker/index.js +15 -0
- package/dist/_pkgs/affine-components/icon-picker/recent-store.d.ts +8 -0
- package/dist/_pkgs/affine-components/icon-picker/recent-store.js +41 -0
- package/dist/_pkgs/affine-components/icon-picker/styles.d.ts +5 -0
- package/dist/_pkgs/affine-components/icon-picker/styles.js +166 -0
- package/dist/_pkgs/affine-components/icon-picker/types.d.ts +22 -0
- package/dist/_pkgs/affine-components/icon-picker/types.js +10 -0
- package/dist/_pkgs/affine-components/icons/text.js +426 -426
- package/dist/_pkgs/affine-components/open-doc-dropdown-menu/dropdown-menu.d.ts +1 -0
- package/dist/_pkgs/affine-components/peek/peekable.js +1 -1
- package/dist/_pkgs/affine-components/portal/portal.d.ts +1 -1
- package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -0
- package/dist/_pkgs/affine-components/toolbar/index.js +1 -0
- package/dist/_pkgs/affine-components/toolbar/menu-button.js +2 -1
- package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +55 -0
- package/dist/_pkgs/affine-components/toolbar/picker-menu.js +47 -0
- package/dist/_pkgs/affine-components/toolbar/toolbar.js +11 -10
- package/dist/_pkgs/affine-foundation/view.js +11 -2
- package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.js +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/header/frames-setting-menu.js +1 -1
- package/dist/_pkgs/affine-fragment-outline/mobile-outline-panel.js +1 -1
- package/dist/_pkgs/affine-gfx-brush/index.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-brush/index.js +1 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/brush.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/brush.js +11 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/highlighter.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/highlighter.js +11 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/index.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/index.js +2 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/shared.d.ts +14 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/dom/shared.js +54 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/index.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-brush/renderer/index.js +4 -0
- package/dist/_pkgs/affine-gfx-brush/toolbar/components/pen/pen-tool-button.js +1 -1
- package/dist/_pkgs/affine-gfx-brush/view.d.ts +14 -0
- package/dist/_pkgs/affine-gfx-brush/view.js +29 -3
- package/dist/_pkgs/affine-gfx-connector/connector-manager.js +39 -16
- package/dist/_pkgs/affine-gfx-connector/connector-tool.d.ts +26 -1
- package/dist/_pkgs/affine-gfx-connector/connector-tool.js +12 -3
- package/dist/_pkgs/affine-gfx-connector/connector-watcher.js +1 -4
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.d.ts +123 -0
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +282 -0
- package/dist/_pkgs/affine-gfx-connector/direction/direction-widget.d.ts +65 -0
- package/dist/_pkgs/affine-gfx-connector/direction/direction-widget.js +395 -0
- package/dist/_pkgs/affine-gfx-connector/direction/index.d.ts +4 -0
- package/dist/_pkgs/affine-gfx-connector/direction/index.js +4 -0
- package/dist/_pkgs/affine-gfx-connector/direction/invert-direction.d.ts +72 -0
- package/dist/_pkgs/affine-gfx-connector/direction/invert-direction.js +185 -0
- package/dist/_pkgs/affine-gfx-connector/direction/typed-edge.d.ts +69 -0
- package/dist/_pkgs/affine-gfx-connector/direction/typed-edge.js +66 -0
- package/dist/_pkgs/affine-gfx-connector/effects.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-connector/effects.js +2 -0
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +78 -41
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/index.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-connector/index.js +1 -0
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.d.ts +50 -0
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +68 -2
- package/dist/_pkgs/affine-gfx-connector/view.js +16 -0
- package/dist/_pkgs/affine-gfx-group/command/group-api.js +150 -62
- package/dist/_pkgs/affine-gfx-group/text/edgeless-group-title-editor.js +4 -1
- package/dist/_pkgs/affine-gfx-mindmap/adapter/markdown/index.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/adapter/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +583 -4
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-menu.js +23 -23
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/mindmap-tool-button.js +5 -1
- package/dist/_pkgs/affine-gfx-mindmap/view/utils.js +1 -1
- package/dist/_pkgs/affine-gfx-note/overlay/overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-note/toolbar/note-senior-button.js +1 -1
- package/dist/_pkgs/affine-gfx-pointer/tools/pan-tool.d.ts +16 -0
- package/dist/_pkgs/affine-gfx-pointer/tools/pan-tool.js +102 -32
- package/dist/_pkgs/affine-gfx-shape/commands.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-shape/commands.js +33 -0
- package/dist/_pkgs/affine-gfx-shape/consts.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/draggable/shape-draggable.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/polygon.js +17 -9
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/utils.js +8 -3
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape-dom/index.js +48 -19
- package/dist/_pkgs/affine-gfx-shape/element-view.js +19 -12
- package/dist/_pkgs/affine-gfx-shape/index.d.ts +1 -1
- package/dist/_pkgs/affine-gfx-shape/index.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-vertex-editing-overlay.js +12 -7
- package/dist/_pkgs/affine-gfx-shape/overlay/shape-overlay.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +4 -2
- package/dist/_pkgs/affine-gfx-shape/shape-tool.js +1 -1
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.d.ts +26 -0
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +124 -15
- package/dist/_pkgs/affine-gfx-shape/view.js +3 -3
- package/dist/_pkgs/affine-gfx-template/builtin/other.js +66 -17
- package/dist/_pkgs/affine-gfx-template/toolbar/overlay-scrollbar.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-tool-button.d.ts +2 -0
- package/dist/_pkgs/affine-gfx-template/toolbar/template-tool-button.js +18 -1
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +9 -5
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +1 -1
- package/dist/_pkgs/affine-inline-latex/command.js +46 -26
- package/dist/_pkgs/affine-inline-latex/latex-node/latex-node.d.ts +10 -0
- package/dist/_pkgs/affine-inline-latex/latex-node/latex-node.js +23 -0
- package/dist/_pkgs/affine-inline-link/command.js +1 -1
- package/dist/_pkgs/affine-inline-link/link-node/affine-link.js +4 -1
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +29 -1
- package/dist/_pkgs/affine-inline-preset/command/format-block.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/format-native.js +2 -2
- package/dist/_pkgs/affine-inline-preset/command/format-text.js +1 -1
- package/dist/_pkgs/affine-inline-preset/inline-spec.js +1 -1
- package/dist/_pkgs/affine-inline-reference/reference-node/reference-node.js +1 -1
- package/dist/_pkgs/affine-model/blocks/code/code-model.d.ts +1 -0
- package/dist/_pkgs/affine-model/blocks/code/code-model.js +1 -0
- package/dist/_pkgs/affine-model/elements/bpmn/node.d.ts +40 -7
- package/dist/_pkgs/affine-model/elements/bpmn/node.js +4 -2
- package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +74 -17
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +55 -26
- package/dist/_pkgs/affine-model/elements/c4/board.d.ts +88 -0
- package/dist/_pkgs/affine-model/elements/c4/board.js +128 -0
- package/dist/_pkgs/affine-model/elements/c4/boundary.d.ts +63 -0
- package/dist/_pkgs/affine-model/elements/c4/boundary.js +134 -0
- package/dist/_pkgs/affine-model/elements/c4/index.d.ts +3 -0
- package/dist/_pkgs/affine-model/elements/c4/index.js +3 -0
- package/dist/_pkgs/affine-model/elements/c4/node.d.ts +97 -0
- package/dist/_pkgs/affine-model/elements/c4/node.js +130 -0
- package/dist/_pkgs/affine-model/elements/connector/connector.js +25 -1
- package/dist/_pkgs/affine-model/elements/context-map/context-map.d.ts +27 -0
- package/dist/_pkgs/affine-model/elements/context-map/context-map.js +94 -0
- package/dist/_pkgs/affine-model/elements/context-map/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/context-map/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +34 -17
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +28 -26
- package/dist/_pkgs/affine-model/elements/edgy/board.d.ts +32 -0
- package/dist/_pkgs/affine-model/elements/edgy/board.js +112 -0
- package/dist/_pkgs/affine-model/elements/edgy/facets.d.ts +12 -0
- package/dist/_pkgs/affine-model/elements/edgy/facets.js +25 -1
- package/dist/_pkgs/affine-model/elements/edgy/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/edgy/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +36 -0
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +103 -0
- package/dist/_pkgs/affine-model/elements/event-storming/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/event-storming/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +42 -0
- package/dist/_pkgs/affine-model/elements/framework-background/background.js +42 -0
- package/dist/_pkgs/affine-model/elements/framework-background/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/framework-background/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/index.d.ts +14 -1
- package/dist/_pkgs/affine-model/elements/index.js +4 -0
- package/dist/_pkgs/affine-model/elements/mindmap/mindmap.js +8 -3
- package/dist/_pkgs/affine-model/elements/mindmap/style.d.ts +10 -0
- package/dist/_pkgs/affine-model/elements/mindmap/style.js +8 -0
- package/dist/_pkgs/affine-model/elements/shape/api/polygon.js +2 -8
- package/dist/_pkgs/affine-model/elements/wardley/wardley.d.ts +21 -29
- package/dist/_pkgs/affine-model/elements/wardley/wardley.js +41 -48
- package/dist/_pkgs/affine-shared/adapters/html/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/delta-converter.d.ts +6 -1
- package/dist/_pkgs/affine-shared/adapters/markdown/delta-converter.js +161 -3
- package/dist/_pkgs/affine-shared/adapters/markdown/markdown.js +5 -1
- package/dist/_pkgs/affine-shared/adapters/notion-html/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/notion-html/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/plain-text/block-adapter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/plain-text/delta-converter.js +1 -1
- package/dist/_pkgs/affine-shared/adapters/types/delta-converter.d.ts +1 -0
- package/dist/_pkgs/affine-shared/adapters/utils/color.d.ts +24 -0
- package/dist/_pkgs/affine-shared/adapters/utils/color.js +283 -0
- package/dist/_pkgs/affine-shared/adapters/utils/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/adapters/utils/index.js +1 -0
- package/dist/_pkgs/affine-shared/commands/block-crud/get-selected-blocks.js +10 -2
- package/dist/_pkgs/affine-shared/commands/model-crud/draft-selected-models.js +1 -1
- package/dist/_pkgs/affine-shared/commands/selection/focus-block-end.js +1 -1
- package/dist/_pkgs/affine-shared/commands/selection/focus-block-start.js +1 -1
- package/dist/_pkgs/affine-shared/consts/index.d.ts +10 -0
- package/dist/_pkgs/affine-shared/consts/index.js +10 -0
- package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.d.ts +55 -0
- package/dist/_pkgs/affine-shared/services/artefact-catalogue-service.js +35 -0
- package/dist/_pkgs/affine-shared/services/audit-service.d.ts +311 -0
- package/dist/_pkgs/affine-shared/services/audit-service.js +228 -0
- package/dist/_pkgs/affine-shared/services/command-usage-service.d.ts +31 -0
- package/dist/_pkgs/affine-shared/services/command-usage-service.js +109 -0
- package/dist/_pkgs/affine-shared/services/comment-service/block-comment-manager.js +1 -1
- package/dist/_pkgs/affine-shared/services/doc-display-meta-service.js +1 -1
- package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +7 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.js +11 -0
- package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.js +1 -1
- package/dist/_pkgs/affine-shared/services/font-loader/font-loader-service.d.ts +26 -1
- package/dist/_pkgs/affine-shared/services/font-loader/font-loader-service.js +124 -7
- package/dist/_pkgs/affine-shared/services/index.d.ts +7 -0
- package/dist/_pkgs/affine-shared/services/index.js +7 -0
- package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.d.ts +129 -0
- package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +312 -0
- package/dist/_pkgs/affine-shared/services/pivot-properties-service.d.ts +217 -0
- package/dist/_pkgs/affine-shared/services/pivot-properties-service.js +114 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/code-block.d.ts +1 -1
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +255 -1
- package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/telemetry-service/types.d.ts +6 -1
- package/dist/_pkgs/affine-shared/services/toolbar-service/action.d.ts +10 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/layout.d.ts +134 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/layout.js +146 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/registry.d.ts +44 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/registry.js +161 -3
- package/dist/_pkgs/affine-shared/services/translation-service/index.d.ts +68 -0
- package/dist/_pkgs/affine-shared/services/translation-service/index.js +39 -0
- package/dist/_pkgs/affine-shared/services/universe-tag-defs-service.d.ts +155 -0
- package/dist/_pkgs/affine-shared/services/universe-tag-defs-service.js +256 -0
- package/dist/_pkgs/affine-shared/test-utils/affine-template.js +1 -1
- package/dist/_pkgs/affine-shared/utils/dom/point-to-range.d.ts +4 -0
- package/dist/_pkgs/affine-shared/utils/dom/point-to-range.js +58 -2
- package/dist/_pkgs/affine-shared/utils/dom/viewport.d.ts +60 -0
- package/dist/_pkgs/affine-shared/utils/dom/viewport.js +58 -0
- package/dist/_pkgs/affine-shared/utils/edgeless.js +1 -1
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +34 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +48 -7
- package/dist/_pkgs/affine-shared/utils/print-to-pdf.d.ts +21 -0
- package/dist/_pkgs/affine-shared/utils/print-to-pdf.js +166 -32
- package/dist/_pkgs/affine-shared/utils/zod-schema.d.ts +7 -0
- package/dist/_pkgs/affine-shared/utils/zod-schema.js +25 -1
- package/dist/_pkgs/affine-widget-drag-handle/utils.js +1 -1
- package/dist/_pkgs/affine-widget-drag-handle/watchers/edgeless-watcher.d.ts +19 -10
- package/dist/_pkgs/affine-widget-drag-handle/watchers/edgeless-watcher.js +122 -23
- package/dist/_pkgs/affine-widget-drag-handle/watchers/pointer-event-watcher.d.ts +2 -0
- package/dist/_pkgs/affine-widget-drag-handle/watchers/pointer-event-watcher.js +25 -4
- package/dist/_pkgs/affine-widget-edgeless-auto-connect/index.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +1 -1
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/auto-complete-panel.js +10 -5
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-auto-complete.d.ts +15 -1
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-auto-complete.js +37 -32
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-element-link.js +5 -4
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/edgeless-selected-rect.js +19 -9
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.d.ts +16 -2
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +19 -2
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.d.ts +14 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-default.js +40 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +158 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +572 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.d.ts +46 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +66 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.d.ts +13 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/chord-format.js +50 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.d.ts +6 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/edgeless-toolbar.js +15 -5
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/extension/index.d.ts +7 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +5 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +5 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +57 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +140 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +9 -0
- package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +4 -1
- package/dist/_pkgs/affine-widget-keyboard-toolbar/icons.js +98 -98
- package/dist/_pkgs/affine-widget-keyboard-toolbar/keyboard-tool-panel.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/import-doc/import-doc.js +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/linked-doc-popover.js +2 -15
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.d.ts +10 -1
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.js +133 -6
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.d.ts +10 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.js +120 -3
- package/dist/_pkgs/affine-widget-linked-doc/utils.d.ts +12 -0
- package/dist/_pkgs/affine-widget-linked-doc/utils.js +33 -0
- package/dist/_pkgs/affine-widget-page-dragging-area/index.js +1 -1
- package/dist/_pkgs/affine-widget-remote-selection/doc/doc-remote-selection.js +1 -1
- package/dist/_pkgs/affine-widget-remote-selection/edgeless/index.js +6 -4
- package/dist/_pkgs/affine-widget-slash-menu/slash-menu-popover.js +8 -4
- package/dist/_pkgs/affine-widget-slash-menu/utils.d.ts +9 -0
- package/dist/_pkgs/affine-widget-slash-menu/utils.js +24 -0
- package/dist/_pkgs/affine-widget-toolbar/toolbar.d.ts +6 -0
- package/dist/_pkgs/affine-widget-toolbar/toolbar.js +40 -8
- package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +146 -3
- package/dist/_pkgs/affine-widget-toolbar/utils.js +744 -58
- package/dist/_pkgs/data-view/core/common/property-menu.js +3 -16
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.d.ts +4 -0
- package/dist/_pkgs/data-view/core/component/tags/multi-tag-select.js +28 -1
- package/dist/_pkgs/data-view/core/data-view.d.ts +3 -1
- package/dist/_pkgs/data-view/core/data-view.js +25 -3
- package/dist/_pkgs/data-view/core/detail/field.js +2 -2
- package/dist/_pkgs/data-view/core/detail/selection.d.ts +4 -2
- package/dist/_pkgs/data-view/core/detail/selection.js +23 -7
- package/dist/_pkgs/data-view/core/effect.js +2 -0
- package/dist/_pkgs/data-view/core/filter/eval.js +36 -23
- package/dist/_pkgs/data-view/core/filter/filter-fn/matcher.d.ts +7 -0
- package/dist/_pkgs/data-view/core/filter/filter-fn/matcher.js +12 -0
- package/dist/_pkgs/data-view/core/group-by/compare-date-keys.d.ts +11 -0
- package/dist/_pkgs/data-view/core/group-by/compare-date-keys.js +55 -0
- package/dist/_pkgs/data-view/core/group-by/define.d.ts +6 -0
- package/dist/_pkgs/data-view/core/group-by/define.js +114 -0
- package/dist/_pkgs/data-view/core/group-by/matcher.d.ts +7 -0
- package/dist/_pkgs/data-view/core/group-by/matcher.js +13 -0
- package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +11 -11
- package/dist/_pkgs/data-view/core/group-by/renderer/date-group.d.ts +9 -0
- package/dist/_pkgs/data-view/core/group-by/renderer/date-group.js +97 -0
- package/dist/_pkgs/data-view/core/group-by/setting.js +86 -7
- package/dist/_pkgs/data-view/core/group-by/trait.d.ts +34 -0
- package/dist/_pkgs/data-view/core/group-by/trait.js +106 -10
- package/dist/_pkgs/data-view/core/utils/menu-title.js +17 -17
- package/dist/_pkgs/data-view/property-presets/multi-select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/property-presets/number/define.js +2 -1
- package/dist/_pkgs/data-view/property-presets/select/cell-renderer.js +3 -1
- package/dist/_pkgs/data-view/view-presets/calendar/calendar-view-manager.d.ts +70 -0
- package/dist/_pkgs/data-view/view-presets/calendar/calendar-view-manager.js +449 -0
- package/dist/_pkgs/data-view/view-presets/calendar/define.d.ts +10 -0
- package/dist/_pkgs/data-view/view-presets/calendar/define.js +27 -0
- package/dist/_pkgs/data-view/view-presets/calendar/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/calendar/effect.js +4 -0
- package/dist/_pkgs/data-view/view-presets/calendar/index.d.ts +6 -0
- package/dist/_pkgs/data-view/view-presets/calendar/index.js +6 -0
- package/dist/_pkgs/data-view/view-presets/calendar/layout.d.ts +37 -0
- package/dist/_pkgs/data-view/view-presets/calendar/layout.js +138 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/actions.d.ts +7 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/actions.js +64 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/dnd.d.ts +32 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/dnd.js +159 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/effect.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/effect.js +7 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/hit-test.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/hit-test.js +28 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/styles.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/styles.js +707 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/view.d.ts +89 -0
- package/dist/_pkgs/data-view/view-presets/calendar/pc/view.js +849 -0
- package/dist/_pkgs/data-view/view-presets/calendar/renderer.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/calendar/renderer.js +8 -0
- package/dist/_pkgs/data-view/view-presets/calendar/source.d.ts +8 -0
- package/dist/_pkgs/data-view/view-presets/calendar/source.js +3 -0
- package/dist/_pkgs/data-view/view-presets/calendar/types.d.ts +79 -0
- package/dist/_pkgs/data-view/view-presets/calendar/types.js +1 -0
- package/dist/_pkgs/data-view/view-presets/convert.js +28 -0
- package/dist/_pkgs/data-view/view-presets/effect.js +2 -0
- package/dist/_pkgs/data-view/view-presets/index.d.ts +2 -0
- package/dist/_pkgs/data-view/view-presets/index.js +3 -0
- package/dist/_pkgs/data-view/view-presets/kanban/kanban-view-manager.js +3 -1
- package/dist/_pkgs/data-view/view-presets/kanban/mobile/cell.js +2 -2
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.d.ts +18 -0
- package/dist/_pkgs/data-view/view-presets/table/collapsed-state.js +36 -0
- package/dist/_pkgs/data-view/view-presets/table/mobile/cell.js +2 -2
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.d.ts +11 -0
- package/dist/_pkgs/data-view/view-presets/table/mobile/group.js +89 -4
- package/dist/_pkgs/data-view/view-presets/table/pc/cell.d.ts +3 -0
- package/dist/_pkgs/data-view/view-presets/table/pc/cell.js +11 -2
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/hotkeys.js +39 -33
- package/dist/_pkgs/data-view/view-presets/table/pc/group.d.ts +10 -0
- package/dist/_pkgs/data-view/view-presets/table/pc/group.js +86 -5
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.d.ts +1 -0
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/hotkeys.js +39 -33
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +18 -18
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.d.ts +3 -0
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/cell.js +8 -0
- package/dist/_pkgs/data-view/view-presets/table/table-view-manager.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/utils.d.ts +3 -0
- package/dist/_pkgs/data-view/view-presets/table/utils.js +16 -1
- package/dist/_pkgs/data-view/widget-presets/tools/presets/view-options/view-options.js +3 -1
- package/dist/_pkgs/global/gfx/curve.js +4 -3
- package/dist/_pkgs/std/clipboard/clipboard.js +13 -3
- package/dist/_pkgs/std/clipboard/utils.d.ts +5 -0
- package/dist/_pkgs/std/clipboard/utils.js +10 -0
- package/dist/_pkgs/std/event/dispatcher.js +27 -1
- package/dist/_pkgs/std/event/keymap.js +16 -6
- package/dist/_pkgs/std/extension/command-registry.d.ts +475 -0
- package/dist/_pkgs/std/extension/command-registry.js +431 -0
- package/dist/_pkgs/std/extension/dnd/index.d.ts +1 -1
- package/dist/_pkgs/std/extension/index.d.ts +2 -0
- package/dist/_pkgs/std/extension/index.js +2 -0
- package/dist/_pkgs/std/extension/shortcut.js +2 -1
- package/dist/_pkgs/std/extension/translation-manifest.d.ts +49 -0
- package/dist/_pkgs/std/extension/translation-manifest.js +71 -0
- package/dist/_pkgs/std/gfx/grid.js +1 -1
- package/dist/_pkgs/std/gfx/index.d.ts +7 -3
- package/dist/_pkgs/std/gfx/index.js +6 -2
- package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +6 -1
- package/dist/_pkgs/std/gfx/interactivity/manager.d.ts +8 -0
- package/dist/_pkgs/std/gfx/interactivity/manager.js +18 -0
- package/dist/_pkgs/std/gfx/layer.d.ts +1 -1
- package/dist/_pkgs/std/gfx/layer.js +1 -2
- package/dist/_pkgs/std/gfx/model/surface/decorators/field.js +9 -0
- package/dist/_pkgs/std/gfx/model/surface/decorators/index.d.ts +2 -2
- package/dist/_pkgs/std/gfx/model/surface/decorators/index.js +2 -2
- package/dist/_pkgs/std/gfx/model/surface/decorators/local.d.ts +14 -0
- package/dist/_pkgs/std/gfx/model/surface/decorators/local.js +22 -0
- package/dist/_pkgs/std/gfx/model/surface/decorators/observer.d.ts +2 -0
- package/dist/_pkgs/std/gfx/model/surface/decorators/observer.js +40 -1
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +442 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +510 -25
- package/dist/_pkgs/std/gfx/model/surface/pivot.d.ts +48 -0
- package/dist/_pkgs/std/gfx/model/surface/pivot.js +34 -0
- package/dist/_pkgs/std/gfx/model/surface/role.d.ts +153 -0
- package/dist/_pkgs/std/gfx/model/surface/role.js +117 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +70 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +305 -17
- package/dist/_pkgs/std/gfx/model/surface/tags.d.ts +77 -0
- package/dist/_pkgs/std/gfx/model/surface/tags.js +246 -0
- package/dist/_pkgs/std/gfx/perf.d.ts +10 -0
- package/dist/_pkgs/std/gfx/perf.js +30 -0
- package/dist/_pkgs/std/gfx/selection.js +1 -1
- package/dist/_pkgs/std/gfx/tool/tool-controller.d.ts +13 -0
- package/dist/_pkgs/std/gfx/tool/tool-controller.js +26 -0
- package/dist/_pkgs/std/gfx/viewport.d.ts +12 -0
- package/dist/_pkgs/std/gfx/viewport.js +20 -2
- package/dist/_pkgs/std/inline/extensions/inline-manager.js +1 -1
- package/dist/_pkgs/std/inline/extensions/markdown-matcher.js +1 -1
- package/dist/_pkgs/std/inline/services/event.d.ts +2 -0
- package/dist/_pkgs/std/inline/services/event.js +96 -21
- package/dist/_pkgs/std/utils/layer.js +2 -6
- package/dist/_pkgs/std/utils/tree.d.ts +14 -0
- package/dist/_pkgs/std/utils/tree.js +59 -8
- package/dist/_pkgs/std/view/element/gfx-block-component.js +23 -13
- package/dist/_pkgs/store/extension/workspace/workspace-meta.d.ts +10 -0
- package/dist/_pkgs/store/model/block/flat-sync-controller.js +2 -12
- package/dist/_pkgs/store/model/store/crud.js +10 -4
- package/dist/_pkgs/store/reactive/flat-native-y/index.d.ts +1 -1
- package/dist/_pkgs/store/reactive/flat-native-y/index.js +24 -2
- package/dist/commands.d.ts +58 -0
- package/dist/commands.js +66 -0
- package/dist/extensions/command-telemetry.d.ts +21 -0
- package/dist/extensions/command-telemetry.js +89 -0
- package/dist/extensions/command-usage.d.ts +23 -0
- package/dist/extensions/command-usage.js +37 -0
- package/dist/extensions/store.d.ts +9 -4
- package/dist/extensions/store.js +27 -24
- package/dist/extensions/view.d.ts +9 -4
- package/dist/extensions/view.js +35 -8
- package/dist/flags.d.ts +98 -21
- package/dist/flags.js +103 -22
- package/dist/frameworks.d.ts +45 -0
- package/dist/frameworks.js +186 -0
- package/dist/schemas.d.ts +8 -5
- package/dist/schemas.js +28 -32
- package/dist/shortcuts.d.ts +16 -16
- package/dist/shortcuts.js +8 -36
- package/dist/translations.d.ts +56 -0
- package/dist/translations.js +200 -0
- package/package.json +16 -4
- package/dist/_pkgs/affine-block-root/keyboard/shortcuts.d.ts +0 -8
- package/dist/_pkgs/affine-block-root/keyboard/shortcuts.js +0 -48
- package/dist/_pkgs/affine-gfx-shape/shortcuts.d.ts +0 -6
- package/dist/_pkgs/affine-gfx-shape/shortcuts.js +0 -28
- package/dist/_pkgs/data-view/core/utils/cache.d.ts +0 -5
- package/dist/_pkgs/data-view/core/utils/cache.js +0 -28
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { renderToolbarSeparator, } from '../affine-components/toolbar/index.js';
|
|
2
|
-
import { ActionPlacement, } from '../affine-shared/services/index.js';
|
|
2
|
+
import { ActionPlacement, planToolbarLayout, TOOLBAR_SETTLE_DELAY, toolbarDegradationSteps, toolbarRoomChanged, } from '../affine-shared/services/index.js';
|
|
3
3
|
import { nextTick } from '../global/utils/index.js';
|
|
4
|
+
import { GfxControllerIdentifier } from '../std/gfx/index.js';
|
|
4
5
|
import { MoreVerticalIcon } from '@blocksuite/icons/lit';
|
|
5
6
|
import { autoUpdate, computePosition, flip, hide, inline, limitShift, offset, shift, size, } from '@floating-ui/dom';
|
|
6
7
|
import { html, render } from 'lit';
|
|
@@ -21,7 +22,13 @@ export const sideMap = new Map([
|
|
|
21
22
|
// has only one shape element
|
|
22
23
|
['affine:surface:shape', { top: 26, bottom: -26 }],
|
|
23
24
|
]);
|
|
24
|
-
export function autoUpdatePosition(signal, toolbar, referenceElement, flavour, placement, sideOptions, options = { elementResize: false
|
|
25
|
+
export function autoUpdatePosition(signal, toolbar, referenceElement, flavour, placement, sideOptions, options = { elementResize: false },
|
|
26
|
+
/**
|
|
27
|
+
* Called whenever the room the row has just changed. This is the only place
|
|
28
|
+
* that knows it: `size` is what writes the cap, and it re-runs on every
|
|
29
|
+
* scroll, resize and flip.
|
|
30
|
+
*/
|
|
31
|
+
onAvailableWidth) {
|
|
25
32
|
const isInline = flavour === 'affine:note';
|
|
26
33
|
const hasSurfaceScope = flavour.includes('surface');
|
|
27
34
|
const isInner = placement === 'inner';
|
|
@@ -49,9 +56,14 @@ export function autoUpdatePosition(signal, toolbar, referenceElement, flavour, p
|
|
|
49
56
|
padding: 10,
|
|
50
57
|
apply: ({ elements, availableWidth }) => {
|
|
51
58
|
elements.floating.style.width = 'fit-content';
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
|
|
59
|
+
// The room the row has. The toolbar never wraps and never
|
|
60
|
+
// scrolls: past this width its entries give way, in the order
|
|
61
|
+
// they declared, into the "⋮" menu — see `ToolbarFitter`.
|
|
62
|
+
const capped = `${availableWidth}px`;
|
|
63
|
+
if (elements.floating.style.maxWidth !== capped) {
|
|
64
|
+
elements.floating.style.maxWidth = capped;
|
|
65
|
+
onAvailableWidth?.();
|
|
66
|
+
}
|
|
55
67
|
},
|
|
56
68
|
}),
|
|
57
69
|
isInline ? inline() : undefined,
|
|
@@ -65,7 +77,16 @@ export function autoUpdatePosition(signal, toolbar, referenceElement, flavour, p
|
|
|
65
77
|
crossAxis: state.placement.includes('bottom'),
|
|
66
78
|
limiter: limitShift(),
|
|
67
79
|
})),
|
|
68
|
-
flip
|
|
80
|
+
// `flip` answers ONE question here — above or below — so both of its
|
|
81
|
+
// sideways ideas are off. Left on (their default), they teleport the
|
|
82
|
+
// row: on a reference far wider than the screen, every alignment
|
|
83
|
+
// overflows somewhere, `bestFit` picks between `-start` and `-end`
|
|
84
|
+
// by a margin of a few pixels, and under a zoom that verdict changes
|
|
85
|
+
// from one frame to the next — the row jumps between the LEFT clamp
|
|
86
|
+
// and the RIGHT clamp of the very same geometry (PO recette of
|
|
87
|
+
// 25/08/2026, third video: the map background's row). Horizontal
|
|
88
|
+
// placement belongs to `shift`, which slides — it never teleports.
|
|
89
|
+
flip({ padding: 10, crossAxis: false, flipAlignment: false }),
|
|
69
90
|
hide(),
|
|
70
91
|
],
|
|
71
92
|
};
|
|
@@ -84,6 +105,10 @@ export function autoUpdatePosition(signal, toolbar, referenceElement, flavour, p
|
|
|
84
105
|
if (signal.aborted)
|
|
85
106
|
return;
|
|
86
107
|
const result = await computePosition(referenceElement, toolbar, config);
|
|
108
|
+
// The gesture may have aborted this loop while the position was being
|
|
109
|
+
// computed. A dying loop that still writes is a second anchor on screen.
|
|
110
|
+
if (signal.aborted)
|
|
111
|
+
return;
|
|
87
112
|
const { x, middlewareData, placement: currentPlacement } = result;
|
|
88
113
|
const y = result.y -
|
|
89
114
|
(currentPlacement.includes('top') ? 0 : offsetTop + offsetBottom);
|
|
@@ -105,7 +130,10 @@ export function autoUpdatePosition(signal, toolbar, referenceElement, flavour, p
|
|
|
105
130
|
};
|
|
106
131
|
return autoUpdate(referenceElement, toolbar, () => {
|
|
107
132
|
update().catch(console.error);
|
|
108
|
-
},
|
|
133
|
+
},
|
|
134
|
+
// Only a canvas anchor moves without a scroll or a resize to announce it,
|
|
135
|
+
// so only a canvas anchor pays for a per-frame re-measure.
|
|
136
|
+
{ animationFrame: hasSurfaceScope, ...options });
|
|
109
137
|
}
|
|
110
138
|
export function combine(actions, context) {
|
|
111
139
|
const grouped = group(actions);
|
|
@@ -143,6 +171,179 @@ function group(actions) {
|
|
|
143
171
|
return paired;
|
|
144
172
|
}
|
|
145
173
|
const merge = (a, b) => mergeWith(a, b, (obj, src) => Array.isArray(obj) ? group(obj.concat(src)) : src);
|
|
174
|
+
export function emptyToolbarLayout() {
|
|
175
|
+
return { shrunk: new Set(), collapsed: new Set() };
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Whether the widget can render this action as an entry of the "⋮" menu.
|
|
179
|
+
*
|
|
180
|
+
* Mirrors {@link renderActions}' own precedence exactly: an action that brings
|
|
181
|
+
* its own template (`content`) or its own sub-actions is opaque — the widget
|
|
182
|
+
* has no honest way to turn it into a menu line, and a dropdown nested inside a
|
|
183
|
+
* dropdown is worse than a dropdown that stayed. Those keep their place on the
|
|
184
|
+
* row, which is also what the PO asked for the two qualification dropdowns.
|
|
185
|
+
*/
|
|
186
|
+
function isPlainAction(action) {
|
|
187
|
+
if ('content' in action)
|
|
188
|
+
return false;
|
|
189
|
+
if ('actions' in action)
|
|
190
|
+
return false;
|
|
191
|
+
return typeof action.run === 'function';
|
|
192
|
+
}
|
|
193
|
+
function resolveContent(action, context) {
|
|
194
|
+
if (!('content' in action))
|
|
195
|
+
return undefined;
|
|
196
|
+
if (typeof action.content === 'function')
|
|
197
|
+
return action.content(context);
|
|
198
|
+
return action.content ?? null;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Resolves every entry of the row, in order, dropping the ones that render
|
|
202
|
+
* nothing — the same precedence {@link renderResolvedActions} then applies.
|
|
203
|
+
*/
|
|
204
|
+
function resolveActions(actions, context) {
|
|
205
|
+
const resolved = [];
|
|
206
|
+
for (const action of actions) {
|
|
207
|
+
if ('content' in action) {
|
|
208
|
+
const template = resolveContent(action, context);
|
|
209
|
+
if (template === null || template === undefined)
|
|
210
|
+
continue;
|
|
211
|
+
resolved.push({ kind: 'template', action, template });
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if ('actions' in action && action.actions.length) {
|
|
215
|
+
const combined = combine(action.actions, context);
|
|
216
|
+
if (!combined.length)
|
|
217
|
+
continue;
|
|
218
|
+
const ordered = orderBy(combined, ['id', 'score'], ['asc', 'asc']);
|
|
219
|
+
resolved.push({
|
|
220
|
+
kind: 'group',
|
|
221
|
+
action,
|
|
222
|
+
children: ordered.map(child => ({
|
|
223
|
+
action: child,
|
|
224
|
+
template: resolveContent(child, context),
|
|
225
|
+
})),
|
|
226
|
+
});
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if ('run' in action && action.run) {
|
|
230
|
+
resolved.push({ kind: 'action', action });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return resolved;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* A stable name for one template, by the only thing about it that is stable.
|
|
237
|
+
*
|
|
238
|
+
* A tagged template literal hands the SAME frozen strings array to every
|
|
239
|
+
* evaluation of its call site — that array IS which template this is, and it is
|
|
240
|
+
* what Lit itself diffs on. The `TemplateResult` wrapped around it, on the other
|
|
241
|
+
* hand, is a fresh object every single render, which is precisely why an entry's
|
|
242
|
+
* template can never be compared by identity.
|
|
243
|
+
*/
|
|
244
|
+
const templateNames = new WeakMap();
|
|
245
|
+
let templateCount = 0;
|
|
246
|
+
function templateName(strings) {
|
|
247
|
+
let name = templateNames.get(strings);
|
|
248
|
+
if (name === undefined) {
|
|
249
|
+
name = `t${++templateCount}`;
|
|
250
|
+
templateNames.set(strings, name);
|
|
251
|
+
}
|
|
252
|
+
return name;
|
|
253
|
+
}
|
|
254
|
+
/** How deep a template may nest before the digest stops caring. */
|
|
255
|
+
const MAX_DIGEST_DEPTH = 8;
|
|
256
|
+
/**
|
|
257
|
+
* What a template SAYS, as values.
|
|
258
|
+
*
|
|
259
|
+
* Only the things that end up as characters on the row are collected — the
|
|
260
|
+
* words and the numbers, plus a name for each template so that a different
|
|
261
|
+
* shape reads differently. Everything else is deliberately dropped:
|
|
262
|
+
*
|
|
263
|
+
* - **Functions** are event handlers. A fresh closure per render is the normal
|
|
264
|
+
* way to write one, and it changes nothing the eye can see.
|
|
265
|
+
* - **Booleans** are attributes (`?active`, `?disabled`). They change how an
|
|
266
|
+
* entry LOOKS, never how wide it is, and a row does not need re-planning
|
|
267
|
+
* because a toggle went blue.
|
|
268
|
+
* - **Anything else** — a model, a context, a DOM node — is an object whose
|
|
269
|
+
* identity says nothing about the row.
|
|
270
|
+
*
|
|
271
|
+
* That asymmetry is the whole point: same words, same digest, whatever objects
|
|
272
|
+
* were built to carry them.
|
|
273
|
+
*/
|
|
274
|
+
function digestValue(value, out, depth = 0) {
|
|
275
|
+
if (depth > MAX_DIGEST_DEPTH || value === null || value === undefined)
|
|
276
|
+
return;
|
|
277
|
+
switch (typeof value) {
|
|
278
|
+
case 'string':
|
|
279
|
+
case 'number':
|
|
280
|
+
case 'bigint':
|
|
281
|
+
out.push(String(value));
|
|
282
|
+
return;
|
|
283
|
+
case 'boolean':
|
|
284
|
+
case 'function':
|
|
285
|
+
case 'symbol':
|
|
286
|
+
return;
|
|
287
|
+
default:
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
if (Array.isArray(value)) {
|
|
291
|
+
for (const item of value)
|
|
292
|
+
digestValue(item, out, depth + 1);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
// A `TemplateResult` (`strings` + `values`) or a directive result (`values`
|
|
296
|
+
// alone: `repeat`, `join`, `keyed`, `ifDefined`…). Both are walked the same
|
|
297
|
+
// way, and anything shaped like neither contributes nothing.
|
|
298
|
+
const parts = value;
|
|
299
|
+
if (Array.isArray(parts.strings))
|
|
300
|
+
out.push(templateName(parts.strings));
|
|
301
|
+
if (Array.isArray(parts.values)) {
|
|
302
|
+
for (const item of parts.values)
|
|
303
|
+
digestValue(item, out, depth + 1);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* What the row SAYS, entry by entry — the half of its signature that the
|
|
308
|
+
* entries' own state decides.
|
|
309
|
+
*
|
|
310
|
+
* The other half ({@link renderToolbar}'s list of ids, priorities, words and
|
|
311
|
+
* icons) describes the entries the widget itself draws, and for a row made of
|
|
312
|
+
* nothing else it is a complete description: same list, same widths. A row that
|
|
313
|
+
* carries OPAQUE entries — a dropdown that names the profile in force, a group
|
|
314
|
+
* whose members come and go with the element they are about — is not described
|
|
315
|
+
* by that list at all, and two rows it calls identical can be twenty pixels
|
|
316
|
+
* apart. This is what closes that gap.
|
|
317
|
+
*
|
|
318
|
+
* Plain entries add nothing here: their word and their icon are already in the
|
|
319
|
+
* other half, and repeating them would only make the string longer.
|
|
320
|
+
*/
|
|
321
|
+
function digestEntries(entries) {
|
|
322
|
+
const out = [];
|
|
323
|
+
for (const entry of entries) {
|
|
324
|
+
if (entry.kind === 'action')
|
|
325
|
+
continue;
|
|
326
|
+
out.push(entry.action.id);
|
|
327
|
+
if (entry.kind === 'template') {
|
|
328
|
+
digestValue(entry.template, out, 0);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
for (const child of entry.children) {
|
|
332
|
+
out.push(child.action.id);
|
|
333
|
+
if (child.template !== undefined) {
|
|
334
|
+
digestValue(child.template, out, 0);
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
// A plain member of a group: the widget draws it, so what it will say is
|
|
338
|
+
// known without resolving anything.
|
|
339
|
+
out.push(child.action.showLabel && child.action.label
|
|
340
|
+
? String(child.action.label)
|
|
341
|
+
: '');
|
|
342
|
+
out.push(child.action.icon ? 'i' : '');
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return out.join('');
|
|
346
|
+
}
|
|
146
347
|
/**
|
|
147
348
|
* Renders toolbar
|
|
148
349
|
*
|
|
@@ -152,7 +353,7 @@ const merge = (a, b) => mergeWith(a, b, (obj, src) => Array.isArray(obj) ? group
|
|
|
152
353
|
* 3. `affine:*`
|
|
153
354
|
* 4. `custom:affine:*`
|
|
154
355
|
*/
|
|
155
|
-
export function renderToolbar(toolbar, context, flavour) {
|
|
356
|
+
export function renderToolbar(toolbar, context, flavour, source = () => emptyToolbarLayout()) {
|
|
156
357
|
const hasSurfaceScope = flavour.includes('surface');
|
|
157
358
|
const toolbarRegistry = context.toolbarRegistry;
|
|
158
359
|
const actions = [
|
|
@@ -163,8 +364,12 @@ export function renderToolbar(toolbar, context, flavour) {
|
|
|
163
364
|
'custom:affine:*',
|
|
164
365
|
]
|
|
165
366
|
.flat()
|
|
166
|
-
|
|
167
|
-
|
|
367
|
+
// Every module of each key, not just one: a flavour may be shared by
|
|
368
|
+
// several contributors (`custom:affine:surface:group` carries Wardley's
|
|
369
|
+
// qualification dropdown AND C4's morph), and they are told apart by the
|
|
370
|
+
// owner suffix on their DI variant — see `toolbarModuleKey`.
|
|
371
|
+
.map(key => toolbarRegistry.modulesFor(key))
|
|
372
|
+
.flat()
|
|
168
373
|
.filter(module => typeof module.config.when === 'function'
|
|
169
374
|
? module.config.when(context)
|
|
170
375
|
: (module.config.when ?? true))
|
|
@@ -176,16 +381,65 @@ export function renderToolbar(toolbar, context, flavour) {
|
|
|
176
381
|
// Resets
|
|
177
382
|
if (primaryActionGroup.length === 0) {
|
|
178
383
|
context.reset();
|
|
179
|
-
return;
|
|
384
|
+
return null;
|
|
180
385
|
}
|
|
386
|
+
// What this row could give up if it ran out of width, decided entirely by
|
|
387
|
+
// what the entries declare — the widget never names a block or a framework.
|
|
388
|
+
const items = primaryActionGroup.map(action => {
|
|
389
|
+
const plain = isPlainAction(action);
|
|
390
|
+
return {
|
|
391
|
+
id: action.id,
|
|
392
|
+
priority: action.priority ?? 0,
|
|
393
|
+
shrinkable: plain && Boolean(action.icon && action.showLabel && action.label),
|
|
394
|
+
collapsible: plain,
|
|
395
|
+
};
|
|
396
|
+
});
|
|
397
|
+
const steps = toolbarDegradationSteps(items);
|
|
398
|
+
// Resolved BEFORE the plan is asked for, and drawn from this same answer: an
|
|
399
|
+
// entry that brings its own template only says what it says once it has been
|
|
400
|
+
// called, and the signature below has to know.
|
|
401
|
+
const resolved = resolveActions(primaryActionGroup, context);
|
|
402
|
+
// What this row IS, before anything about how it is currently degraded — in
|
|
403
|
+
// the two halves {@link ToolbarRow} describes. Both are VALUES: nothing that
|
|
404
|
+
// varies with the objects a render happens to allocate — a fresh template, a
|
|
405
|
+
// fresh event handler — reaches either string, which is what keeps them
|
|
406
|
+
// identical across two identical rebuilds.
|
|
407
|
+
//
|
|
408
|
+
// The words are in the first half, not just the ids: an entry that changes
|
|
409
|
+
// its label ("Add exception" becoming "Revoke exception") changes what the
|
|
410
|
+
// row costs, and a plan measured on the old words no longer describes it.
|
|
411
|
+
const row = {
|
|
412
|
+
entries: [
|
|
413
|
+
flavour,
|
|
414
|
+
...primaryActionGroup.map(action => [
|
|
415
|
+
action.id,
|
|
416
|
+
action.priority ?? 0,
|
|
417
|
+
action.showLabel && action.label ? action.label : '',
|
|
418
|
+
action.icon ? 'i' : '',
|
|
419
|
+
isPlainAction(action) ? 'p' : 'o',
|
|
420
|
+
].join('~')),
|
|
421
|
+
].join('|'),
|
|
422
|
+
state: digestEntries(resolved),
|
|
423
|
+
};
|
|
424
|
+
const layout = source(row);
|
|
425
|
+
// Entries the last measurement sent into the menu lead it: they came off the
|
|
426
|
+
// row, so they are the first thing the user looks for after opening it.
|
|
427
|
+
const collapsed = primaryActionGroup.filter(a => layout.collapsed.has(a.id));
|
|
428
|
+
const primary = resolved.filter(entry => !layout.collapsed.has(entry.action.id));
|
|
429
|
+
const more = [...collapsed, ...moreActionGroup];
|
|
181
430
|
const innerToolbar = context.placement$.value === 'inner';
|
|
182
|
-
|
|
183
|
-
|
|
431
|
+
let hasMenu = false;
|
|
432
|
+
if (more.length) {
|
|
433
|
+
const moreMenuItems = renderActions(more, context, renderMenuActionItem);
|
|
184
434
|
if (moreMenuItems.length) {
|
|
185
435
|
const key = `${context.getCurrentModel()?.id}`;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
436
|
+
hasMenu = true;
|
|
437
|
+
primary.push({
|
|
438
|
+
kind: 'template',
|
|
439
|
+
// Not an entry of the row's signature: the "⋮" is DERIVED from the
|
|
440
|
+
// plan, and a row is never re-planned because its own plan opened one.
|
|
441
|
+
action: { id: 'more' },
|
|
442
|
+
template: html `${keyed(`${flavour}:${key}`, html `
|
|
189
443
|
<editor-menu-button
|
|
190
444
|
aria-label="More menu"
|
|
191
445
|
.contentPadding="${'8px'}"
|
|
@@ -211,7 +465,7 @@ export function renderToolbar(toolbar, context, flavour) {
|
|
|
211
465
|
});
|
|
212
466
|
}
|
|
213
467
|
}
|
|
214
|
-
render(join(
|
|
468
|
+
render(join(renderResolvedActions(primary, context, renderActionItem, layout.shrunk), innerToolbar ? null : renderToolbarSeparator()), toolbar);
|
|
215
469
|
// Avoids shaking
|
|
216
470
|
if (flavour === 'affine:note' && context.std.range.value) {
|
|
217
471
|
if (!('inline' in toolbar.dataset)) {
|
|
@@ -224,47 +478,34 @@ export function renderToolbar(toolbar, context, flavour) {
|
|
|
224
478
|
else {
|
|
225
479
|
delete toolbar.dataset.inline;
|
|
226
480
|
}
|
|
227
|
-
if (toolbar.dataset.open)
|
|
228
|
-
|
|
229
|
-
|
|
481
|
+
if (!toolbar.dataset.open) {
|
|
482
|
+
toolbar.dataset.open = 'true';
|
|
483
|
+
}
|
|
484
|
+
return { steps, hasMenu, ...row };
|
|
230
485
|
}
|
|
231
|
-
function
|
|
232
|
-
return
|
|
233
|
-
.
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return action.content ?? null;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if ('actions' in action && action.actions.length) {
|
|
243
|
-
const combined = combine(action.actions, context);
|
|
244
|
-
if (!combined.length)
|
|
245
|
-
return null;
|
|
246
|
-
const ordered = orderBy(combined, ['id', 'score'], ['asc', 'asc']);
|
|
247
|
-
return repeat(ordered, a => a.id, a => {
|
|
248
|
-
if ('content' in a) {
|
|
249
|
-
if (typeof a.content === 'function') {
|
|
250
|
-
return a.content(context);
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
return a.content ?? null;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return render(a, context);
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
if ('run' in action && action.run) {
|
|
260
|
-
return render(action, context);
|
|
486
|
+
function renderResolvedActions(entries, context, render = renderActionItem, shrunk) {
|
|
487
|
+
return entries.map(entry => {
|
|
488
|
+
if (entry.kind === 'template')
|
|
489
|
+
return entry.template;
|
|
490
|
+
if (entry.kind === 'group') {
|
|
491
|
+
return repeat(entry.children, child => child.action.id, child => child.template !== undefined
|
|
492
|
+
? child.template
|
|
493
|
+
: render(child.action, context, shrunk?.has(child.action.id) ?? false));
|
|
261
494
|
}
|
|
262
|
-
return
|
|
263
|
-
})
|
|
264
|
-
|
|
495
|
+
return render(entry.action, context, shrunk?.has(entry.action.id) ?? false);
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
function renderActions(actions, context, render = renderActionItem, shrunk) {
|
|
499
|
+
return renderResolvedActions(resolveActions(actions, context), context, render, shrunk);
|
|
265
500
|
}
|
|
266
501
|
// TODO(@fundon): supports templates
|
|
267
|
-
function renderActionItem(action, context
|
|
502
|
+
function renderActionItem(action, context,
|
|
503
|
+
/**
|
|
504
|
+
* The row is tight and this entry has already given up its label. It keeps
|
|
505
|
+
* its icon and its behaviour; the word moves to the tooltip, which is the
|
|
506
|
+
* cheapest thing an entry can lose (see `layout.ts`).
|
|
507
|
+
*/
|
|
508
|
+
iconOnly = false) {
|
|
268
509
|
const innerToolbar = context.placement$.value === 'inner';
|
|
269
510
|
const ids = action.id.split('.');
|
|
270
511
|
const id = ids[ids.length - 1];
|
|
@@ -275,21 +516,22 @@ function renderActionItem(action, context) {
|
|
|
275
516
|
const disabled = typeof action.disabled === 'function'
|
|
276
517
|
? action.disabled(context)
|
|
277
518
|
: action.disabled;
|
|
519
|
+
const showLabel = Boolean(action.showLabel && action.label) && !iconOnly;
|
|
278
520
|
return html `
|
|
279
521
|
<editor-icon-button
|
|
280
522
|
data-testid=${ifDefined(id)}
|
|
523
|
+
data-toolbar-action-id=${action.id}
|
|
524
|
+
data-icon-only=${ifDefined(iconOnly ? 'true' : undefined)}
|
|
281
525
|
aria-label=${ifDefined(label)}
|
|
282
526
|
?active=${actived}
|
|
283
527
|
?disabled=${disabled}
|
|
284
|
-
.tooltip=${action.tooltip}
|
|
528
|
+
.tooltip=${action.tooltip ?? (iconOnly ? action.label : undefined)}
|
|
285
529
|
.iconContainerPadding=${innerToolbar ? 4 : 2}
|
|
286
530
|
.iconSize=${innerToolbar ? '16px' : undefined}
|
|
287
531
|
@click=${() => action.run?.(context)}
|
|
288
532
|
>
|
|
289
533
|
${action.icon}
|
|
290
|
-
${
|
|
291
|
-
? html `<span class="label">${action.label}</span>`
|
|
292
|
-
: null}
|
|
534
|
+
${showLabel ? html `<span class="label">${action.label}</span>` : null}
|
|
293
535
|
</editor-icon-button>
|
|
294
536
|
`;
|
|
295
537
|
}
|
|
@@ -308,6 +550,7 @@ function renderMenuActionItem(action, context) {
|
|
|
308
550
|
return html `
|
|
309
551
|
<editor-menu-action
|
|
310
552
|
data-testid=${ifDefined(id)}
|
|
553
|
+
data-toolbar-action-id=${action.id}
|
|
311
554
|
aria-label=${ifDefined(label)}
|
|
312
555
|
class="${ifDefined(destructive)}"
|
|
313
556
|
?active=${actived}
|
|
@@ -322,3 +565,446 @@ function renderMenuActionItem(action, context) {
|
|
|
322
565
|
</editor-menu-action>
|
|
323
566
|
`;
|
|
324
567
|
}
|
|
568
|
+
/**
|
|
569
|
+
* What a "⋮" button costs a row that has none yet: one icon, no label.
|
|
570
|
+
*
|
|
571
|
+
* Estimated rather than measured, because the button does not exist at the
|
|
572
|
+
* moment the planner has to decide whether opening one pays for itself. The
|
|
573
|
+
* estimate is only ever used for that one comparison, and a round of
|
|
574
|
+
* verification measures the real row right afterwards.
|
|
575
|
+
*/
|
|
576
|
+
const MENU_BUTTON_WIDTH = 24;
|
|
577
|
+
/** How many times the fitter is willing to re-measure before settling. */
|
|
578
|
+
const MAX_FIT_ROUNDS = 3;
|
|
579
|
+
/**
|
|
580
|
+
* The width the row may occupy, as `size()` wrote it.
|
|
581
|
+
*
|
|
582
|
+
* Two shapes, because the middleware has two: a floating toolbar gets a cap and
|
|
583
|
+
* keeps its natural width under it, while an `inner` toolbar is pinned to the
|
|
584
|
+
* exact width of the block it sits on. Anything else — a row nothing has
|
|
585
|
+
* positioned yet — has all the room in the world and collapses nothing.
|
|
586
|
+
*/
|
|
587
|
+
function availableWidthOf(toolbar) {
|
|
588
|
+
const max = Number.parseFloat(toolbar.style.maxWidth);
|
|
589
|
+
if (Number.isFinite(max))
|
|
590
|
+
return max;
|
|
591
|
+
const width = Number.parseFloat(toolbar.style.width);
|
|
592
|
+
return Number.isFinite(width) ? width : Number.POSITIVE_INFINITY;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Waits until the row is on screen as it was just described.
|
|
596
|
+
*
|
|
597
|
+
* One animation frame: every pending Lit update is a microtask, and microtasks
|
|
598
|
+
* are drained — exhaustively, including the ones those updates queue for their
|
|
599
|
+
* own children — before a frame callback runs. Measuring any earlier reads
|
|
600
|
+
* elements whose shadow root has not rendered yet, which is to say elements
|
|
601
|
+
* that are still zero pixels wide.
|
|
602
|
+
*/
|
|
603
|
+
function settled() {
|
|
604
|
+
return new Promise(resolve => requestAnimationFrame(() => resolve()));
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Reads what the row costs, entry by entry.
|
|
608
|
+
*
|
|
609
|
+
* Only the entries the widget itself rendered ({@link renderActionItem}) carry
|
|
610
|
+
* an id, and they are exactly the entries that can give way — anything opaque
|
|
611
|
+
* stays on the row, so its width is counted into the total and never offered as
|
|
612
|
+
* a saving.
|
|
613
|
+
*/
|
|
614
|
+
function measureToolbar(toolbar, hasMenu) {
|
|
615
|
+
const style = getComputedStyle(toolbar);
|
|
616
|
+
const gap = Number.parseFloat(style.columnGap) || 0;
|
|
617
|
+
const children = Array.from(toolbar.children);
|
|
618
|
+
// Separators are uniform, and an entry that leaves the row takes one with it.
|
|
619
|
+
const separator = children.find(child => child.localName === 'editor-toolbar-separator');
|
|
620
|
+
const separatorCost = separator ? separator.offsetWidth + gap : 0;
|
|
621
|
+
const label = {};
|
|
622
|
+
const entry = {};
|
|
623
|
+
let content = 0;
|
|
624
|
+
for (const child of children) {
|
|
625
|
+
content += child.offsetWidth + gap;
|
|
626
|
+
const id = child.dataset.toolbarActionId;
|
|
627
|
+
if (!id)
|
|
628
|
+
continue;
|
|
629
|
+
entry[id] = child.offsetWidth + gap + separatorCost;
|
|
630
|
+
label[id] = child.querySelector('.label')?.offsetWidth ?? 0;
|
|
631
|
+
}
|
|
632
|
+
if (children.length)
|
|
633
|
+
content -= gap;
|
|
634
|
+
return {
|
|
635
|
+
content,
|
|
636
|
+
available: availableWidthOf(toolbar),
|
|
637
|
+
label,
|
|
638
|
+
entry,
|
|
639
|
+
menuCost: MENU_BUTTON_WIDTH + gap + separatorCost,
|
|
640
|
+
hasMenu,
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* The WHOLE row's measurements, read from the row as it is currently DRAWN.
|
|
645
|
+
*
|
|
646
|
+
* A state change — a dropdown naming a different profile, a group that gained
|
|
647
|
+
* a member — invalidates the widths the plan was made from. It does not
|
|
648
|
+
* invalidate the plan itself: the entries are the same entries and they give
|
|
649
|
+
* way in the same order. So the row must be re-measured, and the one thing it
|
|
650
|
+
* must not do to be re-measured is appear undegraded for a frame, which is the
|
|
651
|
+
* flash the PO reported and the second pass removed.
|
|
652
|
+
*
|
|
653
|
+
* It does not have to. The row is measured wearing its plan, and what the plan
|
|
654
|
+
* took off is added back from the numbers that made it — an entry that is not
|
|
655
|
+
* on the row is not on screen, so nothing about it can have moved under it.
|
|
656
|
+
* What comes out is the row whole, measured without ever having been shown
|
|
657
|
+
* whole.
|
|
658
|
+
*/
|
|
659
|
+
function wholeRowMetrics(drawn, previous, layout) {
|
|
660
|
+
const label = { ...previous.label, ...drawn.label };
|
|
661
|
+
const entry = { ...previous.entry, ...drawn.entry };
|
|
662
|
+
let content = drawn.content;
|
|
663
|
+
// An entry drawn as its icon alone: it is on the row, so its icon was just
|
|
664
|
+
// measured; the word it is not wearing is worth what it was worth.
|
|
665
|
+
for (const id of layout.shrunk) {
|
|
666
|
+
const word = previous.label[id] ?? 0;
|
|
667
|
+
label[id] = word;
|
|
668
|
+
entry[id] = (drawn.entry[id] ?? previous.entry[id] ?? 0) + word;
|
|
669
|
+
content += word;
|
|
670
|
+
}
|
|
671
|
+
// An entry in the "⋮": nothing of it is on the row, so it costs the row what
|
|
672
|
+
// it cost the last time the row carried it.
|
|
673
|
+
for (const id of layout.collapsed) {
|
|
674
|
+
const cost = previous.entry[id] ?? 0;
|
|
675
|
+
entry[id] = cost;
|
|
676
|
+
label[id] = previous.label[id] ?? 0;
|
|
677
|
+
content += cost;
|
|
678
|
+
}
|
|
679
|
+
// And the "⋮" the plan opened is not part of the row it opened it for.
|
|
680
|
+
if (layout.collapsed.size > 0 && !previous.hasMenu) {
|
|
681
|
+
content -= drawn.menuCost;
|
|
682
|
+
}
|
|
683
|
+
return {
|
|
684
|
+
content,
|
|
685
|
+
available: drawn.available,
|
|
686
|
+
label,
|
|
687
|
+
entry,
|
|
688
|
+
menuCost: drawn.menuCost,
|
|
689
|
+
// What the row carries on its OWN account, which the plan never changed.
|
|
690
|
+
hasMenu: previous.hasMenu,
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
function stepKey(step) {
|
|
694
|
+
return `${step.kind}:${step.id}`;
|
|
695
|
+
}
|
|
696
|
+
function sameLayout(a, b) {
|
|
697
|
+
if (a.shrunk.size !== b.shrunk.size)
|
|
698
|
+
return false;
|
|
699
|
+
if (a.collapsed.size !== b.collapsed.size)
|
|
700
|
+
return false;
|
|
701
|
+
for (const id of a.shrunk)
|
|
702
|
+
if (!b.shrunk.has(id))
|
|
703
|
+
return false;
|
|
704
|
+
for (const id of a.collapsed)
|
|
705
|
+
if (!b.collapsed.has(id))
|
|
706
|
+
return false;
|
|
707
|
+
return true;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Keeps the contextual toolbar on ONE line.
|
|
711
|
+
*
|
|
712
|
+
* Owns the two halves the pure planner cannot: MEASURING the row, and
|
|
713
|
+
* RE-RENDERING it once the planner has said which entries give way. The order
|
|
714
|
+
* they give way in is not decided here — it comes from what the entries
|
|
715
|
+
* declared (`priority`, `icon`, `label`), so this class never learns that a
|
|
716
|
+
* block or a framework exists.
|
|
717
|
+
*
|
|
718
|
+
* The row is measured ONCE per ROW, while it is still whole. Every later
|
|
719
|
+
* resize replans from those numbers instead of flashing the row back to its
|
|
720
|
+
* full width just to measure it again — which is also what makes the collapse
|
|
721
|
+
* reversible: widen the editor and the plan simply spends fewer steps.
|
|
722
|
+
*
|
|
723
|
+
* "Per row", not per render: the widget re-renders for reasons that have
|
|
724
|
+
* nothing to do with width, and a re-render is not a new row. Which row it is
|
|
725
|
+
* is answered by {@link ToolbarRow}, and a row that has not changed keeps the
|
|
726
|
+
* plan it is wearing — see {@link ToolbarFitter.render}.
|
|
727
|
+
*
|
|
728
|
+
* A row that changed only what it SAYS keeps it too, and is simply re-measured
|
|
729
|
+
* where it stands ({@link ToolbarFitter.#remeasure}). That is the generalisation
|
|
730
|
+
* the PO's recette of 25/08/2026 asked for: the components' row is made
|
|
731
|
+
* entirely of entries the widget draws itself, so the list of entries is a
|
|
732
|
+
* complete description of it and the first half of {@link ToolbarRow} was
|
|
733
|
+
* enough; a framework background's row is mostly OPAQUE — toggles grouped by
|
|
734
|
+
* the framework, a dropdown naming the level of requirement in force — and for
|
|
735
|
+
* that row the list says nothing about what it costs.
|
|
736
|
+
*
|
|
737
|
+
* And it replans only at the ACCALMIE. While the room is still moving — a zoom,
|
|
738
|
+
* a pan, a window being dragged — the plan on screen is frozen: see
|
|
739
|
+
* {@link ToolbarFitter.resize}.
|
|
740
|
+
*/
|
|
741
|
+
export class ToolbarFitter {
|
|
742
|
+
#context = null;
|
|
743
|
+
#flavour = '';
|
|
744
|
+
#hasMenu = false;
|
|
745
|
+
#layout = emptyToolbarLayout();
|
|
746
|
+
/** The whole row, measured once. `null` until the first frame lands. */
|
|
747
|
+
#metrics = null;
|
|
748
|
+
/** The room the row is waiting to be replanned for, once it holds still. */
|
|
749
|
+
#pending = null;
|
|
750
|
+
/** Armed while the room is still moving; fires at the accalmie. */
|
|
751
|
+
#settleTimer = null;
|
|
752
|
+
/** Which entries the row on screen has. `''` when there is no row. */
|
|
753
|
+
#entries = '';
|
|
754
|
+
/** What those entries currently say. See {@link ToolbarRow}. */
|
|
755
|
+
#state = '';
|
|
756
|
+
#steps = [];
|
|
757
|
+
/** Bumped by anything that invalidates a measurement still in flight. */
|
|
758
|
+
#token = 0;
|
|
759
|
+
constructor(toolbar) {
|
|
760
|
+
this.toolbar = toolbar;
|
|
761
|
+
}
|
|
762
|
+
/** Nothing is waiting on the room any more. */
|
|
763
|
+
#cancelSettle() {
|
|
764
|
+
if (this.#settleTimer !== null) {
|
|
765
|
+
clearTimeout(this.#settleTimer);
|
|
766
|
+
this.#settleTimer = null;
|
|
767
|
+
}
|
|
768
|
+
this.#pending = null;
|
|
769
|
+
}
|
|
770
|
+
#apply(plan) {
|
|
771
|
+
const next = emptyToolbarLayout();
|
|
772
|
+
for (const step of plan) {
|
|
773
|
+
if (step.kind === 'shrink')
|
|
774
|
+
next.shrunk.add(step.id);
|
|
775
|
+
else
|
|
776
|
+
next.collapsed.add(step.id);
|
|
777
|
+
}
|
|
778
|
+
if (sameLayout(next, this.#layout))
|
|
779
|
+
return false;
|
|
780
|
+
this.#layout = next;
|
|
781
|
+
renderToolbar(this.toolbar, this.#context, this.#flavour, () => next);
|
|
782
|
+
return true;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Applies a plan, then checks the row against the estimates that produced it.
|
|
786
|
+
*
|
|
787
|
+
* A plan is arithmetic on measured widths, but a rendered row is not: a
|
|
788
|
+
* dropped label frees a little more or a little less than its own span, and
|
|
789
|
+
* the "⋮" that appears is the width it turns out to be. So the row is read
|
|
790
|
+
* back and, while it still overflows, the next unspent steps are added — at
|
|
791
|
+
* most {@link MAX_FIT_ROUNDS} times, after which the row keeps what it has
|
|
792
|
+
* and stays, above all, one line.
|
|
793
|
+
*/
|
|
794
|
+
async #converge(plan, token) {
|
|
795
|
+
for (let round = 0; round < MAX_FIT_ROUNDS; round++) {
|
|
796
|
+
if (token !== this.#token || !this.#context)
|
|
797
|
+
return;
|
|
798
|
+
// An empty plan is the answer when the room came back: it restores the
|
|
799
|
+
// whole row, and there is then nothing left to verify.
|
|
800
|
+
if (!this.#apply(plan) || plan.length === 0)
|
|
801
|
+
return;
|
|
802
|
+
await settled();
|
|
803
|
+
if (token !== this.#token || !this.#context)
|
|
804
|
+
return;
|
|
805
|
+
const now = measureToolbar(this.toolbar, this.#hasMenu || this.#layout.collapsed.size > 0);
|
|
806
|
+
if (now.content <= now.available)
|
|
807
|
+
return;
|
|
808
|
+
const spent = new Set(plan.map(stepKey));
|
|
809
|
+
const extra = planToolbarLayout(this.#steps.filter(step => !spent.has(stepKey(step))), now);
|
|
810
|
+
if (extra.length === 0)
|
|
811
|
+
return;
|
|
812
|
+
plan = [...plan, ...extra];
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Spends the room the last measurement was waiting on.
|
|
817
|
+
*
|
|
818
|
+
* The hysteresis is checked a second time here, against the plan that is
|
|
819
|
+
* actually on screen: a gesture that wandered away and came back has changed
|
|
820
|
+
* nothing, and a row is not rebuilt to arrive where it already is.
|
|
821
|
+
*/
|
|
822
|
+
#replan() {
|
|
823
|
+
const metrics = this.#metrics;
|
|
824
|
+
const available = this.#pending;
|
|
825
|
+
this.#pending = null;
|
|
826
|
+
if (!metrics || available === null || !this.#context)
|
|
827
|
+
return;
|
|
828
|
+
if (!toolbarRoomChanged(metrics.available, available))
|
|
829
|
+
return;
|
|
830
|
+
this.#metrics = { ...metrics, available };
|
|
831
|
+
void this.#converge(planToolbarLayout(this.#steps, this.#metrics), ++this.#token);
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Waits for the room to hold still, then replans once.
|
|
835
|
+
*
|
|
836
|
+
* Re-armed by every further change, so a gesture of any length spends exactly
|
|
837
|
+
* one plan — the one for the width it ended on.
|
|
838
|
+
*/
|
|
839
|
+
#settle() {
|
|
840
|
+
if (this.#settleTimer !== null)
|
|
841
|
+
clearTimeout(this.#settleTimer);
|
|
842
|
+
this.#settleTimer = setTimeout(() => {
|
|
843
|
+
this.#settleTimer = null;
|
|
844
|
+
// A wheel zoom breathes: between two notches the room can hold still for
|
|
845
|
+
// longer than the delay and the gesture still be under way. The viewport
|
|
846
|
+
// knows it is, and says so for as long as it lasts.
|
|
847
|
+
if (this.#zooming()) {
|
|
848
|
+
this.#settle();
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
this.#replan();
|
|
852
|
+
}, TOOLBAR_SETTLE_DELAY);
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Whether a zoom gesture is under way, as the viewport itself reports it.
|
|
856
|
+
*
|
|
857
|
+
* Only the zoom. A pan changes the room on every frame of the drag, so the
|
|
858
|
+
* delay above already spans it whole; and `panning$` is raised by every
|
|
859
|
+
* programmatic recentring too, which would freeze the row for gestures no one
|
|
860
|
+
* is making. In page mode there is no viewport at all, and the delay is then
|
|
861
|
+
* the only signal there is — which is all it needs to be.
|
|
862
|
+
*/
|
|
863
|
+
#zooming() {
|
|
864
|
+
const gfx = this.#context?.std.getOptional(GfxControllerIdentifier);
|
|
865
|
+
return gfx?.viewport.zooming$.value === true;
|
|
866
|
+
}
|
|
867
|
+
async #measure(token) {
|
|
868
|
+
await settled();
|
|
869
|
+
if (token !== this.#token || !this.#context)
|
|
870
|
+
return;
|
|
871
|
+
const metrics = measureToolbar(this.toolbar, this.#hasMenu);
|
|
872
|
+
this.#metrics = metrics;
|
|
873
|
+
if (metrics.content <= metrics.available)
|
|
874
|
+
return;
|
|
875
|
+
await this.#converge(planToolbarLayout(this.#steps, metrics), token);
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* The row said something new. Measure it again, wearing what it is wearing.
|
|
879
|
+
*
|
|
880
|
+
* The plan is untouched — the entries are the same entries — so this never
|
|
881
|
+
* draws the whole row, and the eye sees the row change at most once: when the
|
|
882
|
+
* new widths genuinely no longer fit the same plan.
|
|
883
|
+
*/
|
|
884
|
+
async #remeasure(token) {
|
|
885
|
+
await settled();
|
|
886
|
+
if (token !== this.#token || !this.#context)
|
|
887
|
+
return;
|
|
888
|
+
const previous = this.#metrics;
|
|
889
|
+
const drawn = measureToolbar(this.toolbar, this.#hasMenu || this.#layout.collapsed.size > 0);
|
|
890
|
+
const metrics = previous
|
|
891
|
+
? wholeRowMetrics(drawn, previous, this.#layout)
|
|
892
|
+
: drawn;
|
|
893
|
+
this.#metrics = metrics;
|
|
894
|
+
await this.#converge(planToolbarLayout(this.#steps, metrics), token);
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Renders the row, in the mode the plan on screen says.
|
|
898
|
+
*
|
|
899
|
+
* The widget re-renders for a great many reasons that have nothing to do
|
|
900
|
+
* with the row's width — an element updated anywhere on the canvas, a block
|
|
901
|
+
* updated, a selection re-emitted, something hovered — and any of them can
|
|
902
|
+
* land on any frame of a gesture. So this asks a question first: is the row
|
|
903
|
+
* about to be drawn the row already on screen?
|
|
904
|
+
*
|
|
905
|
+
* - **Yes** (same {@link ToolbarRow}, both halves): it is drawn wearing the
|
|
906
|
+
* plan it is already wearing, entry by entry, and nothing is measured.
|
|
907
|
+
* The DOM does not change, so there is nothing to see — which is the
|
|
908
|
+
* PO's recette of 25/08/2026. Before, every one of these re-renders threw
|
|
909
|
+
* the plan away, painted the whole row, and only then measured and
|
|
910
|
+
* degraded it again: one flash of "Read this component" per re-render,
|
|
911
|
+
* plus a full replan at whatever width the gesture happened to be at,
|
|
912
|
+
* straight through the freeze the accalmie was supposed to give.
|
|
913
|
+
* - **The same entries, saying something new** — a dropdown naming another
|
|
914
|
+
* profile, a group that gained a member: the PLAN still describes the row
|
|
915
|
+
* and stays on it, so again there is nothing to see. Only the widths it was
|
|
916
|
+
* made from are out of date, and {@link ToolbarFitter.#remeasure} reads
|
|
917
|
+
* them back off the row as it is drawn.
|
|
918
|
+
* - **No**: a different row. Then, and only then, it is rendered whole,
|
|
919
|
+
* measured, and spends what it must.
|
|
920
|
+
*/
|
|
921
|
+
render(context, flavour) {
|
|
922
|
+
this.#context = context;
|
|
923
|
+
this.#flavour = flavour;
|
|
924
|
+
// Answered while the entries are resolved and before they are drawn: the
|
|
925
|
+
// mode an entry reads in is an argument of its own render, never a fixup.
|
|
926
|
+
let change = 'none';
|
|
927
|
+
const fit = renderToolbar(this.toolbar, context, flavour, row => {
|
|
928
|
+
if (row.entries !== this.#entries) {
|
|
929
|
+
change = 'row';
|
|
930
|
+
this.#entries = row.entries;
|
|
931
|
+
this.#state = row.state;
|
|
932
|
+
this.#layout = emptyToolbarLayout();
|
|
933
|
+
return this.#layout;
|
|
934
|
+
}
|
|
935
|
+
if (row.state !== this.#state) {
|
|
936
|
+
change = 'state';
|
|
937
|
+
this.#state = row.state;
|
|
938
|
+
}
|
|
939
|
+
// Either way the row keeps what it is wearing: a plan is a list of
|
|
940
|
+
// entries, and this is the same list.
|
|
941
|
+
return this.#layout;
|
|
942
|
+
});
|
|
943
|
+
if (!fit) {
|
|
944
|
+
this.reset();
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
// The same row saying the same things: it is already right, and a
|
|
948
|
+
// measurement now would be a measurement of a room that is still moving.
|
|
949
|
+
if (change === 'none')
|
|
950
|
+
return;
|
|
951
|
+
const token = ++this.#token;
|
|
952
|
+
this.#cancelSettle();
|
|
953
|
+
if (change === 'state') {
|
|
954
|
+
// The entries did not move, so neither did what they can give up nor
|
|
955
|
+
// whether the row carries a "⋮" of its own. Only the numbers changed.
|
|
956
|
+
if (this.#steps.length === 0)
|
|
957
|
+
return;
|
|
958
|
+
void this.#remeasure(token);
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
// A new row. Whatever the old one was waiting for describes nothing.
|
|
962
|
+
this.#metrics = null;
|
|
963
|
+
this.#steps = fit.steps;
|
|
964
|
+
this.#hasMenu = fit.hasMenu;
|
|
965
|
+
if (fit.steps.length === 0)
|
|
966
|
+
return;
|
|
967
|
+
void this.#measure(token);
|
|
968
|
+
}
|
|
969
|
+
/** The toolbar is going away: stop measuring it. */
|
|
970
|
+
reset() {
|
|
971
|
+
this.#token++;
|
|
972
|
+
this.#cancelSettle();
|
|
973
|
+
this.#context = null;
|
|
974
|
+
this.#metrics = null;
|
|
975
|
+
this.#layout = emptyToolbarLayout();
|
|
976
|
+
this.#steps = [];
|
|
977
|
+
this.#hasMenu = false;
|
|
978
|
+
// The row that comes back is measured from scratch: `#metrics` went with
|
|
979
|
+
// it, and a plan with nothing behind it could never be revised.
|
|
980
|
+
this.#entries = '';
|
|
981
|
+
this.#state = '';
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* The room the row has may have changed.
|
|
985
|
+
*
|
|
986
|
+
* Two answers are refused before anything is replanned, and the PO's second
|
|
987
|
+
* pass of 02/08/2026 is about both:
|
|
988
|
+
*
|
|
989
|
+
* 1. **A change too small to mean anything.** Two measurements a pixel apart
|
|
990
|
+
* are the same measurement, and a row that believes them alternates
|
|
991
|
+
* between two compositions for as long as they alternate.
|
|
992
|
+
* 2. **A change that is still happening.** A zoom moves the room on every
|
|
993
|
+
* frame; replanning on each of them re-composes the row under the cursor,
|
|
994
|
+
* and every new width moves the anchoring with it — which is the toolbar
|
|
995
|
+
* "hesitating between anchor points" the PO reported. The plan on screen
|
|
996
|
+
* is FROZEN for the whole gesture and spent once, when the viewport lands.
|
|
997
|
+
*
|
|
998
|
+
* The room is remembered as it goes by, so the plan that is finally made is
|
|
999
|
+
* the one for the width the gesture ended on, not the width it started from.
|
|
1000
|
+
*/
|
|
1001
|
+
resize() {
|
|
1002
|
+
if (!this.#metrics || !this.#context)
|
|
1003
|
+
return;
|
|
1004
|
+
const available = availableWidthOf(this.toolbar);
|
|
1005
|
+
if (!toolbarRoomChanged(this.#metrics.available, available))
|
|
1006
|
+
return;
|
|
1007
|
+
this.#pending = available;
|
|
1008
|
+
this.#settle();
|
|
1009
|
+
}
|
|
1010
|
+
}
|