@formicoidea/labre-core 0.41.0 → 0.43.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/LICENSE +384 -0
- package/dist/_pkgs/affine-block-bookmark/bookmark-block.js +2 -2
- package/dist/_pkgs/affine-block-data-view/configs/tooltips.js +1 -1
- package/dist/_pkgs/affine-block-database/configs/tooltips.js +1 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +4 -2
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +7 -1
- package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.d.ts +39 -0
- package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.js +39 -0
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +4 -1
- package/dist/_pkgs/affine-block-embed/embed-github-block/embed-github-block.js +2 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.d.ts +14 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.js +21 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +2 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +2 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +41 -11
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.d.ts +16 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.js +17 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.d.ts +8 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/utils.js +19 -0
- package/dist/_pkgs/affine-block-embed/embed-loom-block/embed-loom-block.js +4 -1
- package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +4 -1
- package/dist/_pkgs/affine-block-embed/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-embed/index.js +1 -0
- package/dist/_pkgs/affine-block-embed/translations.d.ts +8 -0
- package/dist/_pkgs/affine-block-embed/translations.js +28 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +2 -2
- package/dist/_pkgs/affine-block-frame/frame-manager.js +6 -3
- package/dist/_pkgs/affine-block-frame/frame-tool.js +1 -1
- package/dist/_pkgs/affine-block-frame/frame-toolbar.js +6 -1
- package/dist/_pkgs/affine-block-list/list-keymap.js +7 -0
- package/dist/_pkgs/affine-block-list/utils/get-list-icon.js +3 -1
- package/dist/_pkgs/affine-block-note/configs/tooltips.js +1 -1
- package/dist/_pkgs/affine-block-note/note-keymap.js +7 -1
- package/dist/_pkgs/affine-block-paragraph/paragraph-keymap.js +7 -1
- package/dist/_pkgs/affine-block-root/adapters/html.js +2 -2
- package/dist/_pkgs/affine-block-root/commands/copy-link-commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-root/commands/copy-link-commands.js +155 -0
- package/dist/_pkgs/affine-block-root/commands/pivot-commands.js +1 -8
- package/dist/_pkgs/affine-block-root/commands/tag-commands.js +1 -8
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.d.ts +9 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-keyboard.js +51 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +22 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +46 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.d.ts +21 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/pinch-zoom.js +24 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/query.js +8 -0
- package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/index.js +1 -0
- package/dist/_pkgs/affine-block-root/keyboard/keymap.js +1 -16
- package/dist/_pkgs/affine-block-root/view.js +2 -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/export-svg/command.d.ts +23 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +89 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +7 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +41 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +70 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +49 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +257 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.d.ts +16 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/tagged-path.js +24 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +24 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +66 -0
- 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 +66 -4
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +253 -11
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +18 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.d.ts +81 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend-toolbar.js +81 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +144 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.js +495 -0
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +17 -3
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +35 -13
- package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +61 -1
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +85 -39
- package/dist/_pkgs/affine-block-surface/extensions/record-action.d.ts +66 -0
- package/dist/_pkgs/affine-block-surface/extensions/record-action.js +145 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +23 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +12 -4
- package/dist/_pkgs/affine-block-surface/extensions/validation.d.ts +253 -28
- package/dist/_pkgs/affine-block-surface/extensions/validation.js +489 -41
- package/dist/_pkgs/affine-block-surface/framework-background/background-view.d.ts +115 -0
- package/dist/_pkgs/affine-block-surface/framework-background/background-view.js +185 -0
- package/dist/_pkgs/affine-block-surface/framework-background/fit.d.ts +36 -0
- package/dist/_pkgs/affine-block-surface/framework-background/fit.js +30 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.js +2 -0
- package/dist/_pkgs/affine-block-surface/framework-background/labels.d.ts +16 -1
- package/dist/_pkgs/affine-block-surface/framework-background/labels.js +31 -21
- package/dist/_pkgs/affine-block-surface/framework-background/renderer.js +29 -5
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +6 -4
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +56 -8
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +15 -0
- package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +2 -7
- package/dist/_pkgs/affine-block-surface/view.js +8 -1
- package/dist/_pkgs/affine-block-surface-ref/configs/slash-menu.js +1 -1
- package/dist/_pkgs/affine-block-surface-ref/configs/tooltips.js +2 -2
- package/dist/_pkgs/affine-components/color-picker/button.d.ts +56 -1
- package/dist/_pkgs/affine-components/color-picker/button.js +168 -23
- package/dist/_pkgs/affine-components/color-picker/framework-palette.d.ts +106 -0
- package/dist/_pkgs/affine-components/color-picker/framework-palette.js +177 -0
- package/dist/_pkgs/affine-components/color-picker/index.d.ts +2 -0
- package/dist/_pkgs/affine-components/color-picker/index.js +2 -0
- package/dist/_pkgs/affine-components/color-picker/palette-carousel.d.ts +85 -0
- package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +445 -0
- package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
- package/dist/_pkgs/affine-components/context-menu/button.js +3 -1
- package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.d.ts +31 -1
- package/dist/_pkgs/affine-components/edgeless-shape-color-picker/color-picker.js +189 -63
- package/dist/_pkgs/affine-components/icons/ai.js +3 -3
- package/dist/_pkgs/affine-components/icons/list.js +7 -1
- package/dist/_pkgs/affine-components/resource/resource.js +29 -16
- package/dist/_pkgs/affine-components/size-dropdown-menu/dropdown-menu.js +6 -1
- package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -1
- package/dist/_pkgs/affine-components/toolbar/index.js +1 -1
- package/dist/_pkgs/affine-components/toolbar/menu-button.d.ts +7 -0
- package/dist/_pkgs/affine-components/toolbar/menu-button.js +30 -0
- package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +16 -1
- package/dist/_pkgs/affine-components/toolbar/picker-menu.js +2 -2
- package/dist/_pkgs/affine-components/toolbar/toolbar.d.ts +1 -0
- package/dist/_pkgs/affine-components/toolbar/toolbar.js +67 -0
- package/dist/_pkgs/affine-components/translations.d.ts +8 -0
- package/dist/_pkgs/affine-components/translations.js +17 -0
- package/dist/_pkgs/affine-foundation/view.js +2 -1
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card-title-editor.js +1 -1
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +1 -1
- package/dist/_pkgs/affine-gfx-brush/element-renderer.js +2 -2
- package/dist/_pkgs/affine-gfx-brush/toolbar/components/eraser/icons.js +1 -1
- package/dist/_pkgs/affine-gfx-brush/toolbar/configs/brush.js +6 -1
- package/dist/_pkgs/affine-gfx-brush/toolbar/configs/highlighter.js +6 -1
- package/dist/_pkgs/affine-gfx-connector/connector-manager.d.ts +9 -1
- package/dist/_pkgs/affine-gfx-connector/connector-manager.js +61 -0
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.d.ts +11 -2
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +11 -2
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.d.ts +7 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +87 -17
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +78 -17
- package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.d.ts +24 -2
- package/dist/_pkgs/affine-gfx-connector/element-renderer/utils.js +31 -8
- package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.d.ts +124 -3
- package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +219 -56
- package/dist/_pkgs/affine-gfx-connector/text/text.d.ts +13 -4
- package/dist/_pkgs/affine-gfx-connector/text/text.js +13 -44
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.d.ts +56 -0
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +94 -10
- package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.d.ts +8 -0
- package/dist/_pkgs/affine-gfx-connector/toolbar/hollow-endpoint-icons.js +118 -0
- package/dist/_pkgs/affine-gfx-connector/translations.d.ts +3 -0
- package/dist/_pkgs/affine-gfx-connector/translations.js +23 -0
- package/dist/_pkgs/affine-gfx-connector/view/view.d.ts +37 -1
- package/dist/_pkgs/affine-gfx-connector/view/view.js +97 -8
- package/dist/_pkgs/affine-gfx-group/command/group-api.js +1 -1
- package/dist/_pkgs/affine-gfx-group/store.js +0 -2
- package/dist/_pkgs/affine-gfx-group/translations.d.ts +9 -10
- package/dist/_pkgs/affine-gfx-group/translations.js +9 -13
- package/dist/_pkgs/affine-gfx-mindmap/indicator-overlay/index.js +6 -2
- package/dist/_pkgs/affine-gfx-mindmap/templates/index.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/basket-elements.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/config.js +4 -2
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/utils/import-mindmap.js +2 -2
- package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +7 -1
- package/dist/_pkgs/affine-gfx-mindmap/translations.js +11 -1
- package/dist/_pkgs/affine-gfx-shape/element-renderer/highlighter.js +2 -2
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.d.ts +6 -0
- package/dist/_pkgs/affine-gfx-shape/overlay/polygon-drawing-overlay.js +30 -1
- package/dist/_pkgs/affine-gfx-shape/polygon-tool.d.ts +20 -1
- package/dist/_pkgs/affine-gfx-shape/polygon-tool.js +9 -1
- package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +10 -3
- package/dist/_pkgs/affine-gfx-shape/toolbar/palette-color-action.js +11 -1
- package/dist/_pkgs/affine-gfx-shape/translations.d.ts +7 -0
- package/dist/_pkgs/affine-gfx-shape/translations.js +11 -0
- package/dist/_pkgs/affine-gfx-template/builtin/other.js +14 -8
- package/dist/_pkgs/affine-gfx-template/snapshot-from-action.js +32 -119
- package/dist/_pkgs/affine-gfx-template/toolbar/template-loading.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +1 -1
- package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
- package/dist/_pkgs/affine-gfx-template/translations.js +38 -0
- package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.d.ts +13 -1
- package/dist/_pkgs/affine-gfx-text/dblclick-add-edgeless-text.js +19 -4
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.d.ts +41 -0
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +60 -4
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +8 -1
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +14 -2
- package/dist/_pkgs/affine-gfx-text/translations.d.ts +9 -0
- package/dist/_pkgs/affine-gfx-text/translations.js +14 -1
- package/dist/_pkgs/affine-inline-latex/latex-node/latex-editor-menu.js +2 -1
- package/dist/_pkgs/affine-inline-preset/markdown.js +5 -1
- package/dist/_pkgs/affine-model/consts/connector.d.ts +28 -2
- package/dist/_pkgs/affine-model/consts/connector.js +26 -0
- package/dist/_pkgs/affine-model/consts/text.d.ts +15 -2
- package/dist/_pkgs/affine-model/consts/text.js +25 -1
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -1
- package/dist/_pkgs/affine-model/elements/brush/brush.js +1 -1
- package/dist/_pkgs/affine-model/elements/c4/board.js +1 -1
- package/dist/_pkgs/affine-model/elements/c4/boundary.js +1 -1
- package/dist/_pkgs/affine-model/elements/connector/connector.d.ts +135 -0
- package/dist/_pkgs/affine-model/elements/connector/connector.js +246 -5
- package/dist/_pkgs/affine-model/elements/connector/end-label.d.ts +83 -0
- package/dist/_pkgs/affine-model/elements/connector/end-label.js +119 -0
- package/dist/_pkgs/affine-model/elements/connector/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/connector/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/context-map/context-map.js +1 -1
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.d.ts +28 -0
- package/dist/_pkgs/affine-model/elements/core-domain/core-domain.js +129 -2
- package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +8 -0
- package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +45 -2
- package/dist/_pkgs/affine-model/elements/edgy/board.js +1 -1
- package/dist/_pkgs/affine-model/elements/edgy/facets.js +1 -1
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +6 -0
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +36 -2
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.d.ts +18 -7
- package/dist/_pkgs/affine-model/elements/event-storming/event-storming.js +23 -8
- package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +16 -0
- package/dist/_pkgs/affine-model/elements/framework-background/background.js +18 -0
- package/dist/_pkgs/affine-model/elements/highlighter/highlighter.js +1 -1
- package/dist/_pkgs/affine-model/elements/index.d.ts +8 -0
- package/dist/_pkgs/affine-model/elements/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -1
- package/dist/_pkgs/affine-model/elements/text/text.js +1 -1
- package/dist/_pkgs/affine-model/elements/uml/band.d.ts +39 -0
- package/dist/_pkgs/affine-model/elements/uml/band.js +31 -0
- package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +158 -0
- package/dist/_pkgs/affine-model/elements/uml/diagram.js +229 -0
- package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +161 -0
- package/dist/_pkgs/affine-model/elements/uml/fragment.js +205 -0
- package/dist/_pkgs/affine-model/elements/uml/index.d.ts +8 -0
- package/dist/_pkgs/affine-model/elements/uml/index.js +8 -0
- package/dist/_pkgs/affine-model/elements/uml/lifeline.d.ts +77 -0
- package/dist/_pkgs/affine-model/elements/uml/lifeline.js +89 -0
- package/dist/_pkgs/affine-model/elements/uml/node.d.ts +142 -0
- package/dist/_pkgs/affine-model/elements/uml/node.js +190 -0
- package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +106 -0
- package/dist/_pkgs/affine-model/elements/uml/partition.js +172 -0
- package/dist/_pkgs/affine-model/elements/uml/region.d.ts +75 -0
- package/dist/_pkgs/affine-model/elements/uml/region.js +150 -0
- package/dist/_pkgs/affine-model/elements/uml/subject.d.ts +37 -0
- package/dist/_pkgs/affine-model/elements/uml/subject.js +108 -0
- package/dist/_pkgs/affine-model/elements/wardley/wardley.js +1 -1
- package/dist/_pkgs/affine-shared/services/embed-iframe/embed-iframe-config.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +18 -0
- package/dist/_pkgs/affine-shared/services/font-loader/config.js +82 -50
- package/dist/_pkgs/affine-shared/services/pivot-materiality-publisher.js +1 -9
- package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.d.ts +53 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/document-damage-watcher.js +95 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +26 -1
- package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/theme-service.d.ts +19 -0
- package/dist/_pkgs/affine-shared/services/theme-service.js +24 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.d.ts +34 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/command-action.js +63 -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/translation-service/chrome.d.ts +97 -7
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +178 -7
- package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/styles/index.js +1 -0
- package/dist/_pkgs/affine-shared/styles/motion.d.ts +14 -0
- package/dist/_pkgs/affine-shared/styles/motion.js +38 -0
- package/dist/_pkgs/affine-shared/utils/event.d.ts +10 -0
- package/dist/_pkgs/affine-shared/utils/event.js +20 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +16 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +25 -0
- package/dist/_pkgs/affine-shared/utils/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/utils/index.js +1 -0
- package/dist/_pkgs/affine-shared/utils/link-preview-refresh.d.ts +12 -0
- package/dist/_pkgs/affine-shared/utils/link-preview-refresh.js +13 -0
- package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +2 -2
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +5 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.d.ts +12 -4
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +27 -4
- package/dist/_pkgs/affine-widget-edgeless-toolbar/config/types.d.ts +15 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.d.ts +1 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.js +7 -2
- package/dist/_pkgs/affine-widget-edgeless-toolbar/create-popper.js +13 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +2 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.d.ts +80 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/command-menu.js +270 -81
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.d.ts +15 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/menu/senior-menu-selection.js +15 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.d.ts +18 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.js +52 -6
- package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-weight-and-style-panel.js +8 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.d.ts +42 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-ghost-overlay.js +100 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.d.ts +100 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/artefact-placement-tool.js +274 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.d.ts +3 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/index.js +3 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.d.ts +25 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/placement/translate-created.js +67 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +6 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +10 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +5 -0
- package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +2 -1
- package/dist/_pkgs/affine-widget-slash-menu/translations.d.ts +16 -0
- package/dist/_pkgs/affine-widget-slash-menu/translations.js +23 -1
- package/dist/_pkgs/affine-widget-toolbar/utils.js +57 -14
- package/dist/_pkgs/data-view/core/detail/field.js +2 -1
- package/dist/_pkgs/data-view/core/filter/literal/define.js +3 -1
- package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +1 -1
- package/dist/_pkgs/data-view/property-presets/checkbox/cell-renderer.js +8 -2
- package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +1 -1
- package/dist/_pkgs/data-view/view-presets/kanban/pc/controller/drag.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/drag.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/selection.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/header/vertical-indicator.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/row/row-select-checkbox.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/drag.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/selection.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/header/vertical-indicator.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/row-header.js +3 -1
- package/dist/_pkgs/global/gfx/xywh.js +7 -0
- package/dist/_pkgs/std/extension/command-registry.d.ts +158 -1
- package/dist/_pkgs/std/extension/command-registry.js +22 -0
- package/dist/_pkgs/std/gfx/index.d.ts +1 -1
- package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.d.ts +12 -0
- package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +20 -1
- package/dist/_pkgs/std/gfx/interactivity/manager.d.ts +10 -0
- package/dist/_pkgs/std/gfx/interactivity/manager.js +12 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +12 -7
- package/dist/_pkgs/std/gfx/model/surface/role.d.ts +10 -5
- package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +56 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +84 -3
- package/dist/_pkgs/std/gfx/view/view.d.ts +11 -2
- package/dist/_pkgs/std/gfx/view/view.js +16 -2
- package/dist/commands.d.ts +6 -0
- package/dist/commands.js +10 -2
- package/dist/frameworks.d.ts +9 -0
- package/dist/frameworks.js +19 -0
- package/dist/translations.js +21 -0
- package/package.json +13 -4
- package/dist/_pkgs/affine-gfx-group/group-watcher.d.ts +0 -1
- package/dist/_pkgs/affine-gfx-group/group-watcher.js +0 -20
|
@@ -34,6 +34,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
34
34
|
};
|
|
35
35
|
import { DefaultTool, EdgelessCRUDIdentifier, } from '../../affine-block-surface/index.js';
|
|
36
36
|
import { getLineHeight } from '../../affine-gfx-text/index.js';
|
|
37
|
+
import { connectorEndLabelBox, } from '../../affine-model/index.js';
|
|
37
38
|
import { ThemeProvider, translateKey } from '../../affine-shared/services/index.js';
|
|
38
39
|
import { almostEqual } from '../../affine-shared/utils/index.js';
|
|
39
40
|
import { BlockSuiteError, ErrorCode } from '../../global/exceptions/index.js';
|
|
@@ -51,37 +52,155 @@ import { CONNECTOR_ADD_TEXT } from '../translations.js';
|
|
|
51
52
|
const HORIZONTAL_PADDING = 2;
|
|
52
53
|
const VERTICAL_PADDING = 2;
|
|
53
54
|
const BORDER_WIDTH = 1;
|
|
54
|
-
|
|
55
|
+
/** The box a label is seeded with, before the first character is typed. */
|
|
56
|
+
const DEFAULT_LABEL_SIZE = { w: 16, h: 16 };
|
|
57
|
+
/**
|
|
58
|
+
* The model fields each label lives in.
|
|
59
|
+
*
|
|
60
|
+
* Declared once, as data, because THREE places need the same answer — the
|
|
61
|
+
* editor's read, its resize write and its empty-commit delete — and three
|
|
62
|
+
* `which === 'center' ? … : …` chains is how one of them ends up writing the
|
|
63
|
+
* centre label's box under an end label's text.
|
|
64
|
+
*/
|
|
65
|
+
export const CONNECTOR_LABEL_FIELDS = {
|
|
66
|
+
center: { text: 'text', xywh: 'labelXYWH' },
|
|
67
|
+
source: { text: 'sourceLabel', xywh: 'sourceLabelXYWH' },
|
|
68
|
+
target: { text: 'targetLabel', xywh: 'targetLabelXYWH' },
|
|
69
|
+
};
|
|
70
|
+
/** {@link CONNECTOR_LABEL_FIELDS}, defaulting to the centre label. */
|
|
71
|
+
export function connectorLabelFields(which = 'center') {
|
|
72
|
+
return CONNECTOR_LABEL_FIELDS[which];
|
|
73
|
+
}
|
|
74
|
+
/** The `Y.Text` of `which`, or `undefined` when that label does not exist. */
|
|
75
|
+
export function connectorLabelText(connector, which = 'center') {
|
|
76
|
+
return which === 'center' ? connector.text : connector.endLabelText(which);
|
|
77
|
+
}
|
|
78
|
+
/** The box of `which`, or `undefined` when that label does not exist. */
|
|
79
|
+
export function connectorLabelXYWH(connector, which = 'center') {
|
|
80
|
+
return which === 'center'
|
|
81
|
+
? connector.labelXYWH
|
|
82
|
+
: connector.endLabelXYWH(which);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The box an end label of `size` takes on the current path — the one geometry
|
|
86
|
+
* helper the model owns, so the renderer, the editor and the hit test all place
|
|
87
|
+
* an end label in the same spot.
|
|
88
|
+
*/
|
|
89
|
+
export function connectorEndLabelBoxFor(connector, which, size = DEFAULT_LABEL_SIZE) {
|
|
90
|
+
return connectorEndLabelBox(connector.absolutePath, which, size);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* What to write so that `which` EXISTS, or `null` when it already does.
|
|
94
|
+
*
|
|
95
|
+
* The centre label is seeded where the pointer is, riding the path by an offset
|
|
96
|
+
* distance — it has always been a caption the author places. An end label is
|
|
97
|
+
* seeded at its ENDPOINT and ignores the pointer: the whole value of one is
|
|
98
|
+
* that it follows the end when the node moves (`docs/adr/0018`, "Alternatives
|
|
99
|
+
* rejected"), so where the double-click landed says nothing about where it
|
|
100
|
+
* belongs.
|
|
101
|
+
*/
|
|
102
|
+
export function connectorLabelSeedProps(connector, which = 'center', point) {
|
|
103
|
+
if (connectorLabelText(connector, which))
|
|
104
|
+
return null;
|
|
105
|
+
const fields = connectorLabelFields(which);
|
|
106
|
+
const text = new Y.Text();
|
|
107
|
+
if (which !== 'center') {
|
|
108
|
+
return {
|
|
109
|
+
[fields.text]: text,
|
|
110
|
+
[fields.xywh]: connectorEndLabelBoxFor(connector, which),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
let labelXYWH = connector.labelXYWH ?? [
|
|
114
|
+
0,
|
|
115
|
+
0,
|
|
116
|
+
DEFAULT_LABEL_SIZE.w,
|
|
117
|
+
DEFAULT_LABEL_SIZE.h,
|
|
118
|
+
];
|
|
119
|
+
const labelOffset = { ...connector.labelOffset };
|
|
120
|
+
if (point) {
|
|
121
|
+
const center = connector.getNearestPoint(point);
|
|
122
|
+
const distance = connector.getOffsetDistanceByPoint(center);
|
|
123
|
+
const bounds = Bound.fromXYWH(labelXYWH);
|
|
124
|
+
bounds.center = center;
|
|
125
|
+
labelOffset.distance = distance;
|
|
126
|
+
labelXYWH = bounds.toXYWH();
|
|
127
|
+
}
|
|
128
|
+
return { text, labelXYWH, labelOffset };
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* What to write when an editing session ENDS, or `null` when the text is
|
|
132
|
+
* already exactly what the model holds.
|
|
133
|
+
*
|
|
134
|
+
* A label committed empty clears both of its fields, so the connector reads
|
|
135
|
+
* as one that has none (`hasEndLabel` false, nothing painted, nothing
|
|
136
|
+
* exported). The KEYS stay in the Y.Map as `undefined` — the field setter
|
|
137
|
+
* writes what it is given — so only a connector that never carried an end
|
|
138
|
+
* label is byte-identical to a pre-0020 one; `docs/adr/0020`'s "no migration"
|
|
139
|
+
* promise is about that connector, not about this reset.
|
|
140
|
+
*
|
|
141
|
+
* Pure and exported: it is the one rule with three outcomes (delete, trim,
|
|
142
|
+
* nothing) times three labels, and a spec should be able to ask it directly.
|
|
143
|
+
*/
|
|
144
|
+
export function connectorLabelCommitProps(raw, which = 'center') {
|
|
145
|
+
const fields = connectorLabelFields(which);
|
|
146
|
+
const trimed = raw.trim();
|
|
147
|
+
if (trimed.length === 0) {
|
|
148
|
+
return {
|
|
149
|
+
[fields.text]: undefined,
|
|
150
|
+
[fields.xywh]: undefined,
|
|
151
|
+
// The centre label's placement along the path goes with it; an end label
|
|
152
|
+
// has no offset of its own — its place is its endpoint.
|
|
153
|
+
...(which === 'center' ? { labelOffset: undefined } : null),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
if (trimed.length < raw.length) {
|
|
157
|
+
// @TODO: trim in Y.Text?
|
|
158
|
+
return { [fields.text]: new Y.Text(trimed) };
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The box an END label takes after a measurement: a label that already has a
|
|
164
|
+
* box keeps its CENTRE and takes the new size — the author's or the importer's
|
|
165
|
+
* placement survives an edit — and a label that has none yet is seeded beside
|
|
166
|
+
* its endpoint by `connectorEndLabelBox`.
|
|
167
|
+
*/
|
|
168
|
+
function endLabelRect(connector, which, w, h) {
|
|
169
|
+
const current = connectorLabelXYWH(connector, which);
|
|
170
|
+
if (current) {
|
|
171
|
+
const [cx, cy] = Bound.fromXYWH(current).center;
|
|
172
|
+
return [cx - w / 2, cy - h / 2, w, h];
|
|
173
|
+
}
|
|
174
|
+
return connectorEndLabelBoxFor(connector, which, { w, h });
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Opens the label editor on ONE of a connector's three labels.
|
|
178
|
+
*
|
|
179
|
+
* This function used to exist twice — here and byte-alike in `text.ts`, which
|
|
180
|
+
* was the copy the package barrel re-exported — so the toolbar and the keyboard
|
|
181
|
+
* reached one body and the view's double-click the other. `docs/adr/0018`
|
|
182
|
+
* phase 2 makes the difference visible (a selector only one copy would have
|
|
183
|
+
* carried), so the duplicate is gone and `text.ts` re-exports this one.
|
|
184
|
+
*/
|
|
185
|
+
export function mountConnectorLabelEditor(connector, edgeless, point, options) {
|
|
55
186
|
const mountElm = edgeless.querySelector('.edgeless-mount-point');
|
|
56
187
|
if (!mountElm) {
|
|
57
188
|
throw new BlockSuiteError(ErrorCode.ValueNotExists, "edgeless block's mount point does not exist");
|
|
58
189
|
}
|
|
190
|
+
const which = options?.which ?? 'center';
|
|
59
191
|
const gfx = edgeless.std.get(GfxControllerIdentifier);
|
|
60
192
|
gfx.tool.setTool(DefaultTool);
|
|
61
193
|
gfx.selection.set({
|
|
62
194
|
elements: [connector.id],
|
|
63
195
|
editing: true,
|
|
64
196
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
let labelXYWH = connector.labelXYWH ?? [0, 0, 16, 16];
|
|
69
|
-
if (point) {
|
|
70
|
-
const center = connector.getNearestPoint(point);
|
|
71
|
-
const distance = connector.getOffsetDistanceByPoint(center);
|
|
72
|
-
const bounds = Bound.fromXYWH(labelXYWH);
|
|
73
|
-
bounds.center = center;
|
|
74
|
-
labelOffset.distance = distance;
|
|
75
|
-
labelXYWH = bounds.toXYWH();
|
|
76
|
-
}
|
|
77
|
-
edgeless.std.get(EdgelessCRUDIdentifier).updateElement(connector.id, {
|
|
78
|
-
text,
|
|
79
|
-
labelXYWH,
|
|
80
|
-
labelOffset: { ...labelOffset },
|
|
81
|
-
});
|
|
197
|
+
const seed = connectorLabelSeedProps(connector, which, point);
|
|
198
|
+
if (seed) {
|
|
199
|
+
edgeless.std.get(EdgelessCRUDIdentifier).updateElement(connector.id, seed);
|
|
82
200
|
}
|
|
83
201
|
const editor = new EdgelessConnectorLabelEditor();
|
|
84
202
|
editor.connector = connector;
|
|
203
|
+
editor.which = which;
|
|
85
204
|
mountElm.append(editor);
|
|
86
205
|
editor.updateComplete
|
|
87
206
|
.then(() => {
|
|
@@ -94,6 +213,9 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
94
213
|
let _connector_decorators;
|
|
95
214
|
let _connector_initializers = [];
|
|
96
215
|
let _connector_extraInitializers = [];
|
|
216
|
+
let _which_decorators;
|
|
217
|
+
let _which_initializers = [];
|
|
218
|
+
let _which_extraInitializers = [];
|
|
97
219
|
let _std_decorators;
|
|
98
220
|
let _std_initializers = [];
|
|
99
221
|
let _std_extraInitializers = [];
|
|
@@ -104,11 +226,13 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
104
226
|
static {
|
|
105
227
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
106
228
|
_connector_decorators = [property({ attribute: false })];
|
|
229
|
+
_which_decorators = [property({ attribute: false })];
|
|
107
230
|
_std_decorators = [consume({
|
|
108
231
|
context: stdContext,
|
|
109
232
|
})];
|
|
110
233
|
_richText_decorators = [query('rich-text')];
|
|
111
234
|
__esDecorate(this, null, _connector_decorators, { kind: "accessor", name: "connector", static: false, private: false, access: { has: obj => "connector" in obj, get: obj => obj.connector, set: (obj, value) => { obj.connector = value; } }, metadata: _metadata }, _connector_initializers, _connector_extraInitializers);
|
|
235
|
+
__esDecorate(this, null, _which_decorators, { kind: "accessor", name: "which", static: false, private: false, access: { has: obj => "which" in obj, get: obj => obj.which, set: (obj, value) => { obj.which = value; } }, metadata: _metadata }, _which_initializers, _which_extraInitializers);
|
|
112
236
|
__esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers);
|
|
113
237
|
__esDecorate(this, null, _richText_decorators, { kind: "accessor", name: "richText", static: false, private: false, access: { has: obj => "richText" in obj, get: obj => obj.richText, set: (obj, value) => { obj.richText = value; } }, metadata: _metadata }, _richText_initializers, _richText_extraInitializers);
|
|
114
238
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -121,10 +245,11 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
121
245
|
transform-origin: center;
|
|
122
246
|
z-index: 10;
|
|
123
247
|
padding: ${VERTICAL_PADDING}px ${HORIZONTAL_PADDING}px;
|
|
124
|
-
border: ${BORDER_WIDTH}px solid var(--affine-primary-color
|
|
248
|
+
border: ${BORDER_WIDTH}px solid var(--affine-primary-color);
|
|
125
249
|
background: var(--affine-background-primary-color, #fff);
|
|
126
250
|
border-radius: 2px;
|
|
127
|
-
box-shadow: 0px 0px 0px 2px
|
|
251
|
+
box-shadow: 0px 0px 0px 2px
|
|
252
|
+
color-mix(in srgb, var(--affine-primary-color) 30%, transparent);
|
|
128
253
|
box-sizing: border-box;
|
|
129
254
|
overflow: visible;
|
|
130
255
|
|
|
@@ -154,6 +279,30 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
154
279
|
get selection() {
|
|
155
280
|
return this.gfx.selection;
|
|
156
281
|
}
|
|
282
|
+
/** The two model fields this editor reads and writes. */
|
|
283
|
+
get fields() {
|
|
284
|
+
return connectorLabelFields(this.which);
|
|
285
|
+
}
|
|
286
|
+
/** The `Y.Text` this editor is bound to. */
|
|
287
|
+
get yText() {
|
|
288
|
+
return connectorLabelText(this.connector, this.which);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Where the editor sits, in MODEL coordinates.
|
|
292
|
+
*
|
|
293
|
+
* The centre label rides the path by its offset distance, so its anchor is
|
|
294
|
+
* recomputed from the connector; an end label's box is the anchor, and it is
|
|
295
|
+
* the box that follows the endpoint (see `connectorEndLabelBox`).
|
|
296
|
+
*/
|
|
297
|
+
get _labelCenter() {
|
|
298
|
+
const { connector, which } = this;
|
|
299
|
+
if (which === 'center') {
|
|
300
|
+
return connector.getPointByOffsetDistance(connector.labelOffset.distance);
|
|
301
|
+
}
|
|
302
|
+
const box = connectorLabelXYWH(connector, which) ??
|
|
303
|
+
connectorEndLabelBoxFor(connector, which);
|
|
304
|
+
return Bound.fromXYWH(box).center;
|
|
305
|
+
}
|
|
157
306
|
get inlineEditor() {
|
|
158
307
|
return this.richText.inlineEditor;
|
|
159
308
|
}
|
|
@@ -170,14 +319,15 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
170
319
|
this._resizeObserver = null;
|
|
171
320
|
}
|
|
172
321
|
firstUpdated() {
|
|
173
|
-
const { connector, selection, std } = this;
|
|
322
|
+
const { connector, selection, std, which } = this;
|
|
323
|
+
const fields = this.fields;
|
|
174
324
|
const dispatcher = std.event;
|
|
175
325
|
this._resizeObserver = new ResizeObserver(() => {
|
|
176
326
|
this._updateLabelRect();
|
|
177
327
|
this.requestUpdate();
|
|
178
328
|
});
|
|
179
329
|
this._resizeObserver.observe(this.richText);
|
|
180
|
-
this.connector.stash(
|
|
330
|
+
this.connector.stash(fields.xywh);
|
|
181
331
|
this.updateComplete
|
|
182
332
|
.then(() => {
|
|
183
333
|
if (!this.inlineEditor)
|
|
@@ -215,27 +365,19 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
215
365
|
this.disposables.add(dispatcher.add('click', () => true));
|
|
216
366
|
this.disposables.add(dispatcher.add('doubleClick', () => true));
|
|
217
367
|
this.disposables.add(() => {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
else if (len < text.length) {
|
|
231
|
-
this.crud.updateElement(connector.id, {
|
|
232
|
-
// @TODO: trim in Y.Text?
|
|
233
|
-
text: new Y.Text(trimed),
|
|
234
|
-
});
|
|
235
|
-
}
|
|
368
|
+
const yText = connectorLabelText(connector, which);
|
|
369
|
+
if (yText) {
|
|
370
|
+
const props = connectorLabelCommitProps(yText.toString(), which);
|
|
371
|
+
if (props)
|
|
372
|
+
this.crud.updateElement(connector.id, props);
|
|
373
|
+
}
|
|
374
|
+
if (which === 'center') {
|
|
375
|
+
connector.labelEditing = false;
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
connector.endLabelEditing = null;
|
|
236
379
|
}
|
|
237
|
-
connector.
|
|
238
|
-
connector.pop('labelXYWH');
|
|
380
|
+
connector.pop(fields.xywh);
|
|
239
381
|
selection.set({
|
|
240
382
|
elements: [],
|
|
241
383
|
editing: false,
|
|
@@ -244,8 +386,13 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
244
386
|
if (!this.inlineEditorContainer)
|
|
245
387
|
return;
|
|
246
388
|
this.disposables.addFromEvent(this.inlineEditorContainer, 'blur', () => {
|
|
247
|
-
|
|
389
|
+
// Re-entrant: Chrome fires the focused child's blur SYNCHRONOUSLY
|
|
390
|
+
// inside `remove()`, before the node is detached, and the commit
|
|
391
|
+
// in `disconnectedCallback` moves the focus again. Without the
|
|
392
|
+
// flag the handler removes a node whose removal is in progress.
|
|
393
|
+
if (this._keeping || this._removing)
|
|
248
394
|
return;
|
|
395
|
+
this._removing = true;
|
|
249
396
|
this.remove();
|
|
250
397
|
});
|
|
251
398
|
this.disposables.addFromEvent(this.inlineEditorContainer, 'compositionstart', () => {
|
|
@@ -256,7 +403,16 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
256
403
|
this._isComposition = false;
|
|
257
404
|
this.requestUpdate();
|
|
258
405
|
});
|
|
259
|
-
|
|
406
|
+
// The canvas must not paint the label the overlay is showing, and only
|
|
407
|
+
// THAT one: `hasEndLabel` is gated on `endLabelEditing`, `hasLabel()`
|
|
408
|
+
// on `labelEditing`, so editing one end leaves the caption and the
|
|
409
|
+
// other end drawn (`ConnectorElementModel.hasEndLabel`).
|
|
410
|
+
if (which === 'center') {
|
|
411
|
+
connector.labelEditing = true;
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
connector.endLabelEditing = which;
|
|
415
|
+
}
|
|
260
416
|
})
|
|
261
417
|
.catch(console.error);
|
|
262
418
|
}
|
|
@@ -267,17 +423,18 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
267
423
|
}
|
|
268
424
|
render() {
|
|
269
425
|
const { connector } = this;
|
|
270
|
-
const {
|
|
426
|
+
const { labelStyle: { fontFamily, fontSize, fontStyle, fontWeight, textAlign, color: labelColor, }, labelConstraints: { hasMaxWidth, maxWidth }, } = connector;
|
|
271
427
|
const lineHeight = getLineHeight(fontFamily, fontSize, fontWeight);
|
|
272
428
|
const { translateX, translateY, zoom } = this.gfx.viewport;
|
|
273
|
-
const [x, y] = Vec.mul(
|
|
429
|
+
const [x, y] = Vec.mul(this._labelCenter, zoom);
|
|
274
430
|
const transformOperation = [
|
|
275
431
|
'translate(-50%, -50%)',
|
|
276
432
|
`translate(${translateX}px, ${translateY}px)`,
|
|
277
433
|
`translate(${x}px, ${y}px)`,
|
|
278
434
|
`scale(${zoom})`,
|
|
279
435
|
];
|
|
280
|
-
const
|
|
436
|
+
const yText = this.yText;
|
|
437
|
+
const isEmpty = !yText?.length && !this._isComposition;
|
|
281
438
|
const color = this.std
|
|
282
439
|
.get(ThemeProvider)
|
|
283
440
|
.generateColorProperty(labelColor, '#000000');
|
|
@@ -299,7 +456,7 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
299
456
|
})}
|
|
300
457
|
>
|
|
301
458
|
<rich-text
|
|
302
|
-
.yText=${
|
|
459
|
+
.yText=${yText}
|
|
303
460
|
.enableFormat=${false}
|
|
304
461
|
style=${isEmpty
|
|
305
462
|
? styleMap({
|
|
@@ -326,6 +483,10 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
326
483
|
#connector_accessor_storage;
|
|
327
484
|
get connector() { return this.#connector_accessor_storage; }
|
|
328
485
|
set connector(value) { this.#connector_accessor_storage = value; }
|
|
486
|
+
#which_accessor_storage;
|
|
487
|
+
/** Which of the connector's three labels is being edited. */
|
|
488
|
+
get which() { return this.#which_accessor_storage; }
|
|
489
|
+
set which(value) { this.#which_accessor_storage = value; }
|
|
329
490
|
#std_accessor_storage;
|
|
330
491
|
get std() { return this.#std_accessor_storage; }
|
|
331
492
|
set std(value) { this.#std_accessor_storage = value; }
|
|
@@ -336,27 +497,29 @@ let EdgelessConnectorLabelEditor = (() => {
|
|
|
336
497
|
super(...arguments);
|
|
337
498
|
this._isComposition = false;
|
|
338
499
|
this._keeping = false;
|
|
500
|
+
this._removing = false;
|
|
339
501
|
this._resizeObserver = null;
|
|
340
502
|
this._updateLabelRect = () => {
|
|
341
|
-
const { connector, isConnected } = this;
|
|
503
|
+
const { connector, isConnected, which } = this;
|
|
342
504
|
if (!connector || !isConnected)
|
|
343
505
|
return;
|
|
344
506
|
if (!this.inlineEditorContainer)
|
|
345
507
|
return;
|
|
346
508
|
const newWidth = this.inlineEditorContainer.scrollWidth;
|
|
347
509
|
const newHeight = this.inlineEditorContainer.scrollHeight;
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
510
|
+
const labelXYWH = which === 'center'
|
|
511
|
+
? Bound.fromCenter(connector.getPointByOffsetDistance(connector.labelOffset.distance), newWidth, newHeight).toXYWH()
|
|
512
|
+
: endLabelRect(connector, which, newWidth, newHeight);
|
|
513
|
+
const current = connectorLabelXYWH(connector, which);
|
|
514
|
+
if (!current || labelXYWH.some((p, i) => !almostEqual(p, current[i]))) {
|
|
353
515
|
this.crud.updateElement(connector.id, {
|
|
354
|
-
labelXYWH,
|
|
516
|
+
[this.fields.xywh]: labelXYWH,
|
|
355
517
|
});
|
|
356
518
|
}
|
|
357
519
|
};
|
|
358
520
|
this.#connector_accessor_storage = __runInitializers(this, _connector_initializers, void 0);
|
|
359
|
-
this.#
|
|
521
|
+
this.#which_accessor_storage = (__runInitializers(this, _connector_extraInitializers), __runInitializers(this, _which_initializers, 'center'));
|
|
522
|
+
this.#std_accessor_storage = (__runInitializers(this, _which_extraInitializers), __runInitializers(this, _std_initializers, void 0));
|
|
360
523
|
this.#richText_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _richText_initializers, void 0));
|
|
361
524
|
__runInitializers(this, _richText_extraInitializers);
|
|
362
525
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The barrel's door onto the label editor.
|
|
3
|
+
*
|
|
4
|
+
* It used to carry a SECOND copy of `mountConnectorLabelEditor`, byte-alike
|
|
5
|
+
* with the one in `edgeless-connector-label-editor.ts` — and since this file is
|
|
6
|
+
* what `text/index.ts` re-exports, the toolbar and the keyboard reached this
|
|
7
|
+
* copy while the connector view's double-click imported the other one directly.
|
|
8
|
+
* Two bodies, one behaviour, and no way to add the per-end selector
|
|
9
|
+
* (`docs/adr/0018` phase 2) to both at once without adding it twice.
|
|
10
|
+
*
|
|
11
|
+
* One body now lives next door; this file only forwards it.
|
|
12
|
+
*/
|
|
13
|
+
export * from './edgeless-connector-label-editor.js';
|
|
@@ -1,44 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
gfx.selection.set({
|
|
15
|
-
elements: [connector.id],
|
|
16
|
-
editing: true,
|
|
17
|
-
});
|
|
18
|
-
if (!connector.text) {
|
|
19
|
-
const text = new Y.Text();
|
|
20
|
-
const labelOffset = connector.labelOffset;
|
|
21
|
-
let labelXYWH = connector.labelXYWH ?? [0, 0, 16, 16];
|
|
22
|
-
if (point) {
|
|
23
|
-
const center = connector.getNearestPoint(point);
|
|
24
|
-
const distance = connector.getOffsetDistanceByPoint(center);
|
|
25
|
-
const bounds = Bound.fromXYWH(labelXYWH);
|
|
26
|
-
bounds.center = center;
|
|
27
|
-
labelOffset.distance = distance;
|
|
28
|
-
labelXYWH = bounds.toXYWH();
|
|
29
|
-
}
|
|
30
|
-
edgeless.std.get(EdgelessCRUDIdentifier).updateElement(connector.id, {
|
|
31
|
-
text,
|
|
32
|
-
labelXYWH,
|
|
33
|
-
labelOffset: { ...labelOffset },
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
const editor = new EdgelessConnectorLabelEditor();
|
|
37
|
-
editor.connector = connector;
|
|
38
|
-
mountElm.append(editor);
|
|
39
|
-
editor.updateComplete
|
|
40
|
-
.then(() => {
|
|
41
|
-
editor.inlineEditor?.focusEnd();
|
|
42
|
-
})
|
|
43
|
-
.catch(console.error);
|
|
44
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* The barrel's door onto the label editor.
|
|
3
|
+
*
|
|
4
|
+
* It used to carry a SECOND copy of `mountConnectorLabelEditor`, byte-alike
|
|
5
|
+
* with the one in `edgeless-connector-label-editor.ts` — and since this file is
|
|
6
|
+
* what `text/index.ts` re-exports, the toolbar and the keyboard reached this
|
|
7
|
+
* copy while the connector view's double-click imported the other one directly.
|
|
8
|
+
* Two bodies, one behaviour, and no way to add the per-end selector
|
|
9
|
+
* (`docs/adr/0018` phase 2) to both at once without adding it twice.
|
|
10
|
+
*
|
|
11
|
+
* One body now lives next door; this file only forwards it.
|
|
12
|
+
*/
|
|
13
|
+
export * from './edgeless-connector-label-editor.js';
|
|
@@ -1,4 +1,60 @@
|
|
|
1
|
+
import { PointStyle } from '../../affine-model/index.js';
|
|
1
2
|
import { type ToolbarContext, type ToolbarGenericAction } from '../../affine-shared/services/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Every `PointStyle` must appear in BOTH lists.
|
|
5
|
+
*
|
|
6
|
+
* `renderMenu` paints the menu's trigger with
|
|
7
|
+
* `renderCurrentMenuItemWith(items, currentValue, 'icon')`, which returns
|
|
8
|
+
* `undefined` for a value the list does not carry — an unlisted style gives a
|
|
9
|
+
* blank button, so a connector created by a framework (or imported) with that
|
|
10
|
+
* head shows an empty endpoint control. There is no test that can catch a
|
|
11
|
+
* forgotten entry at the type level; `endpoint-style.unit.spec.ts` asserts the
|
|
12
|
+
* coverage instead.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FRONT_ENDPOINT_STYLE_LIST: [{
|
|
15
|
+
readonly value: PointStyle.None;
|
|
16
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
17
|
+
}, {
|
|
18
|
+
readonly value: PointStyle.Arrow;
|
|
19
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
20
|
+
}, {
|
|
21
|
+
readonly value: PointStyle.Triangle;
|
|
22
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
23
|
+
}, {
|
|
24
|
+
readonly value: PointStyle.TriangleHollow;
|
|
25
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
26
|
+
}, {
|
|
27
|
+
readonly value: PointStyle.Circle;
|
|
28
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
29
|
+
}, {
|
|
30
|
+
readonly value: PointStyle.Diamond;
|
|
31
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
32
|
+
}, {
|
|
33
|
+
readonly value: PointStyle.DiamondHollow;
|
|
34
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
35
|
+
}];
|
|
36
|
+
export declare const REAR_ENDPOINT_STYLE_LIST: [{
|
|
37
|
+
readonly value: PointStyle.Diamond;
|
|
38
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
39
|
+
}, {
|
|
40
|
+
readonly value: PointStyle.DiamondHollow;
|
|
41
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
42
|
+
}, {
|
|
43
|
+
readonly value: PointStyle.Circle;
|
|
44
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
45
|
+
}, {
|
|
46
|
+
readonly value: PointStyle.Triangle;
|
|
47
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
48
|
+
}, {
|
|
49
|
+
readonly value: PointStyle.TriangleHollow;
|
|
50
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
51
|
+
}, {
|
|
52
|
+
readonly value: PointStyle.Arrow;
|
|
53
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
54
|
+
}, {
|
|
55
|
+
readonly value: PointStyle.None;
|
|
56
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
57
|
+
}];
|
|
2
58
|
export declare const connectorToolbarConfig: {
|
|
3
59
|
readonly actions: [{
|
|
4
60
|
readonly id: "a.stroke-color";
|