@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
|
@@ -2,6 +2,7 @@ import { panelBaseStyle } from '../../affine-shared/styles/index.js';
|
|
|
2
2
|
import { stopPropagation } from '../../affine-shared/utils/index.js';
|
|
3
3
|
import { WithDisposable } from '../../global/lit/index.js';
|
|
4
4
|
import { css, html, LitElement } from 'lit';
|
|
5
|
+
import { EDITOR_MENU_TOGGLE } from './menu-button.js';
|
|
5
6
|
export class EditorToolbar extends WithDisposable(LitElement) {
|
|
6
7
|
static { this.styles = css `
|
|
7
8
|
${panelBaseStyle(':host')}
|
|
@@ -13,6 +14,27 @@ export class EditorToolbar extends WithDisposable(LitElement) {
|
|
|
13
14
|
height: 36px;
|
|
14
15
|
box-sizing: content-box;
|
|
15
16
|
flex-wrap: nowrap;
|
|
17
|
+
/* And never outside its own background. The row's width is a max-width
|
|
18
|
+
the positioner writes; entries keep their natural width (below), so a
|
|
19
|
+
row that has nothing left to give up would otherwise paint its last
|
|
20
|
+
icons over the document, past the border and the shadow — which is
|
|
21
|
+
what a 420px window used to show.
|
|
22
|
+
|
|
23
|
+
Clipped on the X axis alone: overflow-x hidden would make the row a
|
|
24
|
+
scroll container on BOTH axes (a visible paired with a hidden computes
|
|
25
|
+
to auto) and swallow the dropdown panels, which are positioned inside
|
|
26
|
+
the row and hang above and below it. */
|
|
27
|
+
overflow-x: clip;
|
|
28
|
+
overflow-y: visible;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* ...except while one of those panels is open. A clipping box is also what
|
|
32
|
+
floating-ui fits a panel into, so left in place the rule above would
|
|
33
|
+
squeeze a 176px menu into the width of the row that opened it — or, for
|
|
34
|
+
a dropdown at one end of the row, cut half of it off. See
|
|
35
|
+
syncOpenMenus below, which is what raises this attribute. */
|
|
36
|
+
:host([data-menu-open]) {
|
|
37
|
+
overflow: visible;
|
|
16
38
|
}
|
|
17
39
|
|
|
18
40
|
:host([data-without-bg]) {
|
|
@@ -35,6 +57,38 @@ export class EditorToolbar extends WithDisposable(LitElement) {
|
|
|
35
57
|
fill: currentColor;
|
|
36
58
|
}
|
|
37
59
|
`; }
|
|
60
|
+
/** The panels open in this row right now, whatever opened them. */
|
|
61
|
+
#openMenus = new Set();
|
|
62
|
+
/**
|
|
63
|
+
* Says, on the row itself, whether one of its panels is open.
|
|
64
|
+
*
|
|
65
|
+
* Why an attribute at all: the row cannot ask the question in CSS. `:host()`
|
|
66
|
+
* takes a COMPOUND selector and `:has()` is not one, so
|
|
67
|
+
* `:host(:has([data-open]))` is not a rule browsers honour (Chromium
|
|
68
|
+
* 2026-09: it matches from the document, never from inside the shadow root).
|
|
69
|
+
*
|
|
70
|
+
* Why not a `querySelector` for `data-open`, which the buttons do raise:
|
|
71
|
+
* because it answers only for the buttons the row holds DIRECTLY. A colour
|
|
72
|
+
* picker keeps its menu button inside its own shadow root, where neither a
|
|
73
|
+
* `querySelector` nor a `MutationObserver` of this row can see it — and that
|
|
74
|
+
* is the row whose panel the clip was cutting in half
|
|
75
|
+
* (`framework-palette-carousel.spec.ts`). {@link EDITOR_MENU_TOGGLE} is
|
|
76
|
+
* composed, so it crosses every boundary, and it is raised before the panel
|
|
77
|
+
* is ever positioned.
|
|
78
|
+
*
|
|
79
|
+
* A panel whose button is taken off the row by a re-render never says it
|
|
80
|
+
* closed, so the set is swept of anything no longer in a document.
|
|
81
|
+
*/
|
|
82
|
+
#syncOpenMenus() {
|
|
83
|
+
for (const menu of this.#openMenus) {
|
|
84
|
+
if (!menu.isConnected)
|
|
85
|
+
this.#openMenus.delete(menu);
|
|
86
|
+
}
|
|
87
|
+
if (this.#openMenus.size > 0)
|
|
88
|
+
this.dataset.menuOpen = 'true';
|
|
89
|
+
else
|
|
90
|
+
delete this.dataset.menuOpen;
|
|
91
|
+
}
|
|
38
92
|
connectedCallback() {
|
|
39
93
|
super.connectedCallback();
|
|
40
94
|
this._disposables.addFromEvent(this, 'pointerdown', (e) => {
|
|
@@ -44,6 +98,19 @@ export class EditorToolbar extends WithDisposable(LitElement) {
|
|
|
44
98
|
this._disposables.addFromEvent(this, 'wheel', stopPropagation, {
|
|
45
99
|
passive: false,
|
|
46
100
|
});
|
|
101
|
+
this._disposables.addFromEvent(this, EDITOR_MENU_TOGGLE, (e) => {
|
|
102
|
+
// The deepest element of the path, not `target`: a composed event that
|
|
103
|
+
// crosses a shadow boundary is retargeted to the host it came out of,
|
|
104
|
+
// and one host may hold more than one panel.
|
|
105
|
+
const menu = e.composedPath()[0];
|
|
106
|
+
if (!(menu instanceof Element))
|
|
107
|
+
return;
|
|
108
|
+
if (e.detail)
|
|
109
|
+
this.#openMenus.add(menu);
|
|
110
|
+
else
|
|
111
|
+
this.#openMenus.delete(menu);
|
|
112
|
+
this.#syncOpenMenus();
|
|
113
|
+
});
|
|
47
114
|
}
|
|
48
115
|
render() {
|
|
49
116
|
return html `<slot></slot>`;
|
|
@@ -23,6 +23,14 @@ export declare const COLOR_PICKER_TAB_CUSTOM: ChromeWording;
|
|
|
23
23
|
export declare const COLOR_PICKER_MODE_NORMAL: ChromeWording;
|
|
24
24
|
export declare const COLOR_PICKER_MODE_LIGHT: ChromeWording;
|
|
25
25
|
export declare const COLOR_PICKER_MODE_DARK: ChromeWording;
|
|
26
|
+
/**
|
|
27
|
+
* The carousel's own two words (`docs/adr/0027`). The PAGE names are not
|
|
28
|
+
* here: the base page is the one below, and a framework's page is named by the
|
|
29
|
+
* framework itself, through the `labelWording` it registers — the same key its
|
|
30
|
+
* senior button already uses.
|
|
31
|
+
*/
|
|
32
|
+
export declare const PALETTE_GROUP_DEFAULT: ChromeWording;
|
|
33
|
+
export declare const PALETTE_GROUP_CHOOSE: ChromeWording;
|
|
26
34
|
export { COLOR_LABEL, FILL_COLOR_LABEL };
|
|
27
35
|
export declare const BORDER_COLOR_LABEL: ChromeWording;
|
|
28
36
|
export declare const CONTEXT_MENU_NO_RESULTS: ChromeWording;
|
|
@@ -51,6 +51,21 @@ export const COLOR_PICKER_MODE_DARK = [
|
|
|
51
51
|
'com.labre.color-picker.mode.dark',
|
|
52
52
|
'Dark',
|
|
53
53
|
];
|
|
54
|
+
/* ── Palette carousel (the framework pages of a colour picker) ───────── */
|
|
55
|
+
/**
|
|
56
|
+
* The carousel's own two words (`docs/adr/0027`). The PAGE names are not
|
|
57
|
+
* here: the base page is the one below, and a framework's page is named by the
|
|
58
|
+
* framework itself, through the `labelWording` it registers — the same key its
|
|
59
|
+
* senior button already uses.
|
|
60
|
+
*/
|
|
61
|
+
export const PALETTE_GROUP_DEFAULT = [
|
|
62
|
+
'com.labre.color-picker.palette.default',
|
|
63
|
+
'Default',
|
|
64
|
+
];
|
|
65
|
+
export const PALETTE_GROUP_CHOOSE = [
|
|
66
|
+
'com.labre.color-picker.palette.choose',
|
|
67
|
+
'Choose a palette',
|
|
68
|
+
];
|
|
54
69
|
/* ── Shape colour picker ─────────────────────────────────────────────── */
|
|
55
70
|
export { COLOR_LABEL, FILL_COLOR_LABEL };
|
|
56
71
|
export const BORDER_COLOR_LABEL = [
|
|
@@ -408,6 +423,8 @@ export const COMPONENTS_WORDINGS = [
|
|
|
408
423
|
COLOR_PICKER_MODE_NORMAL,
|
|
409
424
|
COLOR_PICKER_MODE_LIGHT,
|
|
410
425
|
COLOR_PICKER_MODE_DARK,
|
|
426
|
+
PALETTE_GROUP_DEFAULT,
|
|
427
|
+
PALETTE_GROUP_CHOOSE,
|
|
411
428
|
BORDER_COLOR_LABEL,
|
|
412
429
|
CONTEXT_MENU_NO_RESULTS,
|
|
413
430
|
CONTEXT_MENU_DONE,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileDropExtension } from '../affine-components/drop-indicator/index.js';
|
|
2
2
|
import { PeekViewExtension, } from '../affine-components/peek/index.js';
|
|
3
3
|
import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
|
|
4
|
-
import { AutoClearSelectionService, BlockCommentManager, BlockLifecycleTelemetryWatcher, CitationService, DefaultOpenDocExtension, DNDAPIExtension, DocDisplayMetaService, DocModeService, EditPropsStore, EmbedOptionService, FileSizeLimitService, FontConfigExtension, fontConfigSchema, FontLoaderService, LinkPreviewCache, LinkPreviewCacheConfigSchema, LinkPreviewCacheExtension, LinkPreviewService, PageViewportServiceExtension, PivotMaterialityPublisher, TelemetryExtension, ThemeService, ToolbarRegistryExtension, } from '../affine-shared/services/index.js';
|
|
4
|
+
import { AutoClearSelectionService, BlockCommentManager, BlockLifecycleTelemetryWatcher, CitationService, DefaultOpenDocExtension, DNDAPIExtension, DocDisplayMetaService, DocModeService, DocumentDamageTelemetryWatcher, EditPropsStore, EmbedOptionService, FileSizeLimitService, FontConfigExtension, fontConfigSchema, FontLoaderService, LinkPreviewCache, LinkPreviewCacheConfigSchema, LinkPreviewCacheExtension, LinkPreviewService, PageViewportServiceExtension, PivotMaterialityPublisher, TelemetryExtension, ThemeService, ToolbarRegistryExtension, } from '../affine-shared/services/index.js';
|
|
5
5
|
import { InteractivityManager, ToolController } from '../std/gfx/index.js';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { clipboardConfigs } from './clipboard.js';
|
|
@@ -44,6 +44,7 @@ export class FoundationViewExtension extends ViewExtensionProvider {
|
|
|
44
44
|
BlockCommentManager,
|
|
45
45
|
// Inert without an injected TelemetryService; see telemetry README.
|
|
46
46
|
BlockLifecycleTelemetryWatcher,
|
|
47
|
+
DocumentDamageTelemetryWatcher,
|
|
47
48
|
]);
|
|
48
49
|
context.register(clipboardConfigs);
|
|
49
50
|
if (this.isEdgeless(context.scope)) {
|
|
@@ -138,7 +138,7 @@ let FrameCardTitleEditor = (() => {
|
|
|
138
138
|
background: 'var(--affine-background-primary-color)',
|
|
139
139
|
border: '1px solid var(--affine-primary-color)',
|
|
140
140
|
color: 'var(--affine-text-primary-color)',
|
|
141
|
-
boxShadow: '0px 0px 0px 2px
|
|
141
|
+
boxShadow: '0px 0px 0px 2px color-mix(in srgb, var(--affine-primary-color) 30%, transparent)',
|
|
142
142
|
zIndex: '1',
|
|
143
143
|
display: 'block',
|
|
144
144
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementRendererExtension, } from '../affine-block-surface/index.js';
|
|
1
|
+
import { ElementRendererExtension, taggedPath2D, } from '../affine-block-surface/index.js';
|
|
2
2
|
import { DefaultTheme } from '../affine-model/index.js';
|
|
3
3
|
export const brush = (model, ctx, matrix, renderer) => {
|
|
4
4
|
const { rotate } = model;
|
|
@@ -8,6 +8,6 @@ export const brush = (model, ctx, matrix, renderer) => {
|
|
|
8
8
|
ctx.setTransform(matrix.translateSelf(cx, cy).rotateSelf(rotate).translateSelf(-cx, -cy));
|
|
9
9
|
const color = renderer.getColorValue(model.color, DefaultTheme.black, true);
|
|
10
10
|
ctx.fillStyle = color;
|
|
11
|
-
ctx.fill(
|
|
11
|
+
ctx.fill(taggedPath2D(model.commands));
|
|
12
12
|
};
|
|
13
13
|
export const BrushElementRendererExtension = ElementRendererExtension('brush', brush);
|
|
@@ -45,7 +45,7 @@ export const EdgelessEraserLightIcon = html `<svg
|
|
|
45
45
|
/>
|
|
46
46
|
<path
|
|
47
47
|
d="M27.5 16.5H33H34.6295C35.2048 16.5 35.706 16.8921 35.8443 17.4505L35.8583 17.5067C36.0615 18.3269 36.7242 18.9534 37.5545 19.1105C38.1029 19.2142 38.5 19.6934 38.5 20.2516V21.75V27.5V39V61.5H27.5V16.5Z"
|
|
48
|
-
fill="
|
|
48
|
+
fill="var(--affine-primary-color)"
|
|
49
49
|
/>
|
|
50
50
|
<path
|
|
51
51
|
d="M27.5 16.5H33H34.6295C35.2048 16.5 35.706 16.8921 35.8443 17.4505L35.8583 17.5067C36.0615 18.3269 36.7242 18.9534 37.5545 19.1105C38.1029 19.2142 38.5 19.6934 38.5 20.2516V21.75V27.5V39V61.5H27.5V16.5Z"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EdgelessCRUDIdentifier } from '../../../affine-block-surface/index.js';
|
|
2
|
-
import { packColor, } from '../../../affine-components/color-picker/index.js';
|
|
2
|
+
import { frameworkPaletteGroups, packColor, } from '../../../affine-components/color-picker/index.js';
|
|
3
3
|
import { BrushElementModel, DefaultTheme, LineWidth, resolveColor, } from '../../../affine-model/index.js';
|
|
4
4
|
import { ToolbarModuleExtension, translateKey, } from '../../../affine-shared/services/index.js';
|
|
5
5
|
import { getMostCommonResolvedValue, getMostCommonValue, } from '../../../affine-shared/utils/index.js';
|
|
@@ -72,6 +72,9 @@ export const brushToolbarConfig = {
|
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
+
// A stroke drawn on a framework board opens on that framework's hues
|
|
76
|
+
// (`docs/adr/0027`); the editor palette stays page one.
|
|
77
|
+
const carousel = frameworkPaletteGroups(ctx.std, models, DefaultTheme.Palettes);
|
|
75
78
|
return html `
|
|
76
79
|
<edgeless-color-picker-button
|
|
77
80
|
class="color"
|
|
@@ -81,6 +84,8 @@ export const brushToolbarConfig = {
|
|
|
81
84
|
.theme=${theme}
|
|
82
85
|
.originalColor=${originalColor}
|
|
83
86
|
.enableCustomColor=${enableCustomColor}
|
|
87
|
+
.paletteGroups=${carousel.groups}
|
|
88
|
+
.activeGroupKey=${carousel.activeKey}
|
|
84
89
|
.std=${ctx.std}
|
|
85
90
|
>
|
|
86
91
|
</edgeless-color-picker-button>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EdgelessCRUDIdentifier } from '../../../affine-block-surface/index.js';
|
|
2
|
-
import { adjustColorAlpha, keepColor, packColor, } from '../../../affine-components/color-picker/index.js';
|
|
2
|
+
import { adjustColorAlpha, frameworkPaletteGroups, keepColor, packColor, } from '../../../affine-components/color-picker/index.js';
|
|
3
3
|
import { DEFAULT_HIGHLIGHTER_LINE_WIDTH, DefaultTheme, HIGHLIGHTER_LINE_WIDTHS, HighlighterElementModel, resolveColor, } from '../../../affine-model/index.js';
|
|
4
4
|
import { ToolbarModuleExtension, translateKey, } from '../../../affine-shared/services/index.js';
|
|
5
5
|
import { getMostCommonResolvedValue, getMostCommonValue, } from '../../../affine-shared/utils/index.js';
|
|
@@ -82,6 +82,9 @@ export const highlighterToolbarConfig = {
|
|
|
82
82
|
control: 'color picker',
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
+
// A highlight drawn over a framework board opens on that framework's
|
|
86
|
+
// hues (`docs/adr/0027`); the short stroke palette stays page one.
|
|
87
|
+
const carousel = frameworkPaletteGroups(ctx.std, models, DefaultTheme.StrokeColorShortPalettes);
|
|
85
88
|
return html `
|
|
86
89
|
<edgeless-color-picker-button
|
|
87
90
|
.colorPanelClass="${'one-way small'}"
|
|
@@ -91,6 +94,8 @@ export const highlighterToolbarConfig = {
|
|
|
91
94
|
.theme=${theme}
|
|
92
95
|
.originalColor=${originalColor}
|
|
93
96
|
.palettes=${DefaultTheme.StrokeColorShortPalettes}
|
|
97
|
+
.paletteGroups=${carousel.groups}
|
|
98
|
+
.activeGroupKey=${carousel.activeKey}
|
|
94
99
|
.shouldKeepColor=${true}
|
|
95
100
|
.enableCustomColor=${false}
|
|
96
101
|
.std=${ctx.std}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AStarRunner, Overlay } from '../affine-block-surface/index.js';
|
|
2
|
-
import { type BrushElementModel, type Connection, ConnectorElementModel, GroupElementModel, type LocalConnectorElementModel } from '../affine-model/index.js';
|
|
2
|
+
import { type BrushElementModel, type Connection, ConnectorElementModel, type ConnectorLabelEnd, GroupElementModel, type LocalConnectorElementModel } from '../affine-model/index.js';
|
|
3
3
|
import type { IBound, IVec } from '../global/gfx/index.js';
|
|
4
4
|
import { Bound, PointLocation } from '../global/gfx/index.js';
|
|
5
5
|
import type { BlockStdScope } from '../std/index.js';
|
|
@@ -26,6 +26,14 @@ export declare function isCenterAnchorEligible(ele: GfxModel): boolean;
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function isCenterAnchorEnabled(std: BlockStdScope): boolean;
|
|
28
28
|
export declare function isConnectorWithLabel(model: GfxModel | GfxLocalElementModel): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The end-label twin of `isConnectorWithLabel`: a connector carrying a painted
|
|
31
|
+
* label beside its `source` / `target` endpoint.
|
|
32
|
+
*
|
|
33
|
+
* A `LocalConnectorElementModel` has no labels at all — it is the preview a
|
|
34
|
+
* drag paints — so the `instanceof` is the guard, exactly as above.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isConnectorWithEndLabel(model: GfxModel | GfxLocalElementModel, end: ConnectorLabelEnd): boolean;
|
|
29
37
|
export declare function calculateNearestLocation(point: IVec, bounds: IBound, locations?: IVec[], shortestDistance?: number): IVec;
|
|
30
38
|
export declare function isConnectorAndBindingsAllSelected(connector: ConnectorElementModel | LocalConnectorElementModel, selected: GfxModel[]): boolean;
|
|
31
39
|
export declare function getAnchors(ele: GfxModel, includeCenterAnchor?: boolean): {
|
|
@@ -160,6 +160,46 @@ function computePerimeterPointForCenterAnchor(connectable, centerPoint, otherPoi
|
|
|
160
160
|
export function isConnectorWithLabel(model) {
|
|
161
161
|
return model instanceof ConnectorElementModel && model.hasLabel();
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* The end-label twin of `isConnectorWithLabel`: a connector carrying a painted
|
|
165
|
+
* label beside its `source` / `target` endpoint.
|
|
166
|
+
*
|
|
167
|
+
* A `LocalConnectorElementModel` has no labels at all — it is the preview a
|
|
168
|
+
* drag paints — so the `instanceof` is the guard, exactly as above.
|
|
169
|
+
*/
|
|
170
|
+
export function isConnectorWithEndLabel(model, end) {
|
|
171
|
+
return model instanceof ConnectorElementModel && model.hasEndLabel(end);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Translates one end label's box by how far its endpoint moved, so the label
|
|
175
|
+
* keeps the position the author gave it RELATIVE to that end.
|
|
176
|
+
*
|
|
177
|
+
* `ConnectorPathGenerator.updatePath` is the only caller: the label follows the
|
|
178
|
+
* end on every re-route, and on nothing else.
|
|
179
|
+
*/
|
|
180
|
+
function followEndpoint(model, end, previousPath) {
|
|
181
|
+
const box = model.endLabelXYWH(end);
|
|
182
|
+
if (!box || !model.hasEndLabel(end))
|
|
183
|
+
return;
|
|
184
|
+
const nextPath = model.absolutePath;
|
|
185
|
+
if (nextPath.length === 0 || previousPath.length === 0)
|
|
186
|
+
return;
|
|
187
|
+
const endpointOf = (path) => end === 'source' ? path[0] : path[path.length - 1];
|
|
188
|
+
const from = endpointOf(previousPath);
|
|
189
|
+
const to = endpointOf(nextPath);
|
|
190
|
+
const dx = to[0] - from[0];
|
|
191
|
+
const dy = to[1] - from[1];
|
|
192
|
+
if (dx === 0 && dy === 0)
|
|
193
|
+
return;
|
|
194
|
+
const [x, y, w, h] = box;
|
|
195
|
+
const moved = [x + dx, y + dy, w, h];
|
|
196
|
+
if (end === 'source') {
|
|
197
|
+
model.sourceLabelXYWH = moved;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
model.targetLabelXYWH = moved;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
163
203
|
export function calculateNearestLocation(point, bounds, locations = ConnectorEndpointLocations, shortestDistance = Number.POSITIVE_INFINITY) {
|
|
164
204
|
const { x, y, w, h } = bounds;
|
|
165
205
|
return locations
|
|
@@ -1000,6 +1040,10 @@ export class ConnectorPathGenerator extends PathGenerator {
|
|
|
1000
1040
|
const relativePoints = points.map((p) => {
|
|
1001
1041
|
return p.setVec(Vec.sub(p, [bound.x, bound.y]));
|
|
1002
1042
|
});
|
|
1043
|
+
// Captured before the assignment below rebuilds it: the end labels are
|
|
1044
|
+
// re-anchored by how far THEIR endpoint travelled, which is only knowable
|
|
1045
|
+
// against the path this call replaces.
|
|
1046
|
+
const previousPath = connector.absolutePath;
|
|
1003
1047
|
connector.updatingPath = true;
|
|
1004
1048
|
// the property assignment order matters
|
|
1005
1049
|
connector.xywh = bound.serialize();
|
|
@@ -1015,6 +1059,23 @@ export class ConnectorPathGenerator extends PathGenerator {
|
|
|
1015
1059
|
model.labelXYWH = [cx - w / 2, cy - h / 2, w, h];
|
|
1016
1060
|
}
|
|
1017
1061
|
}
|
|
1062
|
+
// The end labels follow THEIR OWN endpoint, not the connector's centre.
|
|
1063
|
+
// Dragging one of the two nodes moves one end and leaves the other where
|
|
1064
|
+
// it was: re-deriving both boxes from the offset distance (what the centre
|
|
1065
|
+
// label does) would recentre them, and translating both by the element's
|
|
1066
|
+
// delta would slide the far one off its line. Translating each by its
|
|
1067
|
+
// endpoint's delta is the only rule under which a `0..*` typed beside an
|
|
1068
|
+
// end stays beside that end — and the only one that preserves a box the
|
|
1069
|
+
// author dragged somewhere else. Same persistence gate as above: these are
|
|
1070
|
+
// `@field()`s too, so a watching peer must not write them.
|
|
1071
|
+
if (connector instanceof ConnectorElementModel) {
|
|
1072
|
+
const mayPersist = (options?.persistLabelXYWH ?? true) &&
|
|
1073
|
+
!connector.surface?.store?.readonly;
|
|
1074
|
+
if (mayPersist) {
|
|
1075
|
+
followEndpoint(connector, 'source', previousPath);
|
|
1076
|
+
followEndpoint(connector, 'target', previousPath);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1018
1079
|
connector.updatingPath = false;
|
|
1019
1080
|
}
|
|
1020
1081
|
_computeStartEndPoint(connector) {
|
|
@@ -41,11 +41,20 @@ import { type TypedEdge } from './typed-edge.js';
|
|
|
41
41
|
* a `@local()` field. The reveal is session state and leaves with the pointer.
|
|
42
42
|
*/
|
|
43
43
|
/**
|
|
44
|
-
* The one colour the reveal is drawn in — the
|
|
44
|
+
* The one colour the reveal is drawn in — the chrome accent, i.e. the colour of
|
|
45
45
|
* an affordance rather than of ink. Deliberately NOT the framework's palette:
|
|
46
46
|
* the label is the tool talking about the drawing, not part of the drawing.
|
|
47
|
+
*
|
|
48
|
+
* A TOKEN, not a hex: the chip is rendered in the DOM (`direction-widget.ts`),
|
|
49
|
+
* so it follows whatever the host sets `--affine-primary-color` to. The accent
|
|
50
|
+
* is AFFiNE's and due to be replaced — DESIGN.md, The Borrowed Blue Rule.
|
|
51
|
+
*
|
|
52
|
+
* It is the colour of EVERY typed edge of every framework: no role declares a
|
|
53
|
+
* `chipColor` any more (PO recette of 23/09/2026, after one that did produced
|
|
54
|
+
* two blues on one map). `affine/all/src/__tests__/direction-chip-accent.unit.spec.ts`
|
|
55
|
+
* reads the mounted vocabularies and keeps it that way.
|
|
47
56
|
*/
|
|
48
|
-
export declare const EDGE_DIRECTION_COLOR = "
|
|
57
|
+
export declare const EDGE_DIRECTION_COLOR = "var(--affine-primary-color)";
|
|
49
58
|
/**
|
|
50
59
|
* Where the label sits on a typed edge, and how it is turned.
|
|
51
60
|
*
|
|
@@ -40,11 +40,20 @@ import { asTypedEdge, edgeIsBound, roleVocabularies, } from './typed-edge.js';
|
|
|
40
40
|
* a `@local()` field. The reveal is session state and leaves with the pointer.
|
|
41
41
|
*/
|
|
42
42
|
/**
|
|
43
|
-
* The one colour the reveal is drawn in — the
|
|
43
|
+
* The one colour the reveal is drawn in — the chrome accent, i.e. the colour of
|
|
44
44
|
* an affordance rather than of ink. Deliberately NOT the framework's palette:
|
|
45
45
|
* the label is the tool talking about the drawing, not part of the drawing.
|
|
46
|
+
*
|
|
47
|
+
* A TOKEN, not a hex: the chip is rendered in the DOM (`direction-widget.ts`),
|
|
48
|
+
* so it follows whatever the host sets `--affine-primary-color` to. The accent
|
|
49
|
+
* is AFFiNE's and due to be replaced — DESIGN.md, The Borrowed Blue Rule.
|
|
50
|
+
*
|
|
51
|
+
* It is the colour of EVERY typed edge of every framework: no role declares a
|
|
52
|
+
* `chipColor` any more (PO recette of 23/09/2026, after one that did produced
|
|
53
|
+
* two blues on one map). `affine/all/src/__tests__/direction-chip-accent.unit.spec.ts`
|
|
54
|
+
* reads the mounted vocabularies and keeps it that way.
|
|
46
55
|
*/
|
|
47
|
-
export const EDGE_DIRECTION_COLOR = '
|
|
56
|
+
export const EDGE_DIRECTION_COLOR = 'var(--affine-primary-color)';
|
|
48
57
|
const pathOf = (model) => {
|
|
49
58
|
const path = model.absolutePath;
|
|
50
59
|
return Array.isArray(path) && path.length >= 2 ? path : null;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { DomRenderer } from '../../../affine-block-surface/index.js';
|
|
2
|
-
import { type ConnectorElementModel } from '../../../affine-model/index.js';
|
|
2
|
+
import { type ConnectorElementModel, type PointStyle } from '../../../affine-model/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Exported for `src/__tests__/endpoint-style.unit.spec.ts`: the hollow heads are
|
|
5
|
+
* defined by the fact that `fill` and `stroke` differ, which is only observable
|
|
6
|
+
* on the marker node this builds.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createArrowMarker(id: string, style: PointStyle, color: string, strokeWidth: number, isStart?: boolean): SVGMarkerElement;
|
|
3
9
|
/**
|
|
4
10
|
* Renders a ConnectorElementModel to a given HTMLElement using DOM/SVG.
|
|
5
11
|
* This function is intended to be registered via the DomElementRendererExtension.
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import { ConnectorMode, DefaultTheme, } from '../../../affine-model/index.js';
|
|
2
2
|
import { PointLocation, SVGPathBuilder } from '../../../global/gfx/index.js';
|
|
3
3
|
import { isConnectorWithLabel } from '../../connector-manager.js';
|
|
4
|
-
import { DEFAULT_ARROW_SIZE } from '../utils.js';
|
|
4
|
+
import { DEFAULT_ARROW_SIZE, HOLLOW_HEAD_FILL } from '../utils.js';
|
|
5
5
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
6
|
+
/**
|
|
7
|
+
* The outline width of a hollow head, in the marker's own `viewBox` units.
|
|
8
|
+
*
|
|
9
|
+
* Pinned rather than inherited. A marker declares `markerUnits="strokeWidth"`
|
|
10
|
+
* and a `0 0 20 20` viewBox mapped onto `markerWidth`, so one viewBox unit is
|
|
11
|
+
* already a fixed fraction of the connector's `strokeWidth` — the outline
|
|
12
|
+
* scales with the line without this attribute existing, and `1` is exactly the
|
|
13
|
+
* SVG default the solid heads get implicitly today. Nothing changes visually.
|
|
14
|
+
*
|
|
15
|
+
* It is set only on the hollow heads because they are the only ones where the
|
|
16
|
+
* value is observable: a solid head paints `fill` and `stroke` in the same
|
|
17
|
+
* colour, so its outline is invisible either way. On a hollow head the outline
|
|
18
|
+
* IS the head. Leaving it to a default that a future `stroke-width` on the
|
|
19
|
+
* `<svg>`, the `<defs>`, or the marker itself would override means the UML
|
|
20
|
+
* heads could silently thicken or vanish; the solid twins would not notice.
|
|
21
|
+
*/
|
|
22
|
+
const HOLLOW_HEAD_STROKE_WIDTH = 1;
|
|
23
|
+
const LABEL_SLOTS = ['center', 'source', 'target'];
|
|
6
24
|
/**
|
|
7
25
|
* The nodes a connector host already owns, kept across renders. Rebuilding the
|
|
8
26
|
* whole `<svg>` subtree on every frame allocated one element per connector per
|
|
@@ -46,7 +64,12 @@ function createConnectorPath(points, mode) {
|
|
|
46
64
|
}
|
|
47
65
|
return pathBuilder.build();
|
|
48
66
|
}
|
|
49
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Exported for `src/__tests__/endpoint-style.unit.spec.ts`: the hollow heads are
|
|
69
|
+
* defined by the fact that `fill` and `stroke` differ, which is only observable
|
|
70
|
+
* on the marker node this builds.
|
|
71
|
+
*/
|
|
72
|
+
export function createArrowMarker(id, style, color, strokeWidth, isStart = false) {
|
|
50
73
|
const marker = document.createElementNS(SVG_NS, 'marker');
|
|
51
74
|
const size = DEFAULT_ARROW_SIZE * (strokeWidth / 2);
|
|
52
75
|
marker.id = id;
|
|
@@ -57,6 +80,8 @@ function createArrowMarker(id, style, color, strokeWidth, isStart = false) {
|
|
|
57
80
|
marker.setAttribute('markerHeight', String(size));
|
|
58
81
|
marker.setAttribute('orient', 'auto');
|
|
59
82
|
marker.setAttribute('markerUnits', 'strokeWidth');
|
|
83
|
+
// No `default`, as on the canvas side: an unknown persisted `PointStyle`
|
|
84
|
+
// yields an empty marker rather than a wrong head.
|
|
60
85
|
switch (style) {
|
|
61
86
|
case 'Arrow': {
|
|
62
87
|
const path = document.createElementNS(SVG_NS, 'path');
|
|
@@ -74,6 +99,15 @@ function createArrowMarker(id, style, color, strokeWidth, isStart = false) {
|
|
|
74
99
|
marker.append(path);
|
|
75
100
|
break;
|
|
76
101
|
}
|
|
102
|
+
case 'TriangleHollow': {
|
|
103
|
+
const path = document.createElementNS(SVG_NS, 'path');
|
|
104
|
+
path.setAttribute('d', isStart ? 'M 20 7 L 12 10 L 20 13 Z' : 'M 0 7 L 8 10 L 0 13 Z');
|
|
105
|
+
path.setAttribute('fill', HOLLOW_HEAD_FILL);
|
|
106
|
+
path.setAttribute('stroke', color);
|
|
107
|
+
path.setAttribute('stroke-width', String(HOLLOW_HEAD_STROKE_WIDTH));
|
|
108
|
+
marker.append(path);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
77
111
|
case 'Circle': {
|
|
78
112
|
const circle = document.createElementNS(SVG_NS, 'circle');
|
|
79
113
|
circle.setAttribute('cx', '10');
|
|
@@ -92,6 +126,15 @@ function createArrowMarker(id, style, color, strokeWidth, isStart = false) {
|
|
|
92
126
|
marker.append(path);
|
|
93
127
|
break;
|
|
94
128
|
}
|
|
129
|
+
case 'DiamondHollow': {
|
|
130
|
+
const path = document.createElementNS(SVG_NS, 'path');
|
|
131
|
+
path.setAttribute('d', 'M 10 6 L 14 10 L 10 14 L 6 10 Z');
|
|
132
|
+
path.setAttribute('fill', HOLLOW_HEAD_FILL);
|
|
133
|
+
path.setAttribute('stroke', color);
|
|
134
|
+
path.setAttribute('stroke-width', String(HOLLOW_HEAD_STROKE_WIDTH));
|
|
135
|
+
marker.append(path);
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
95
138
|
}
|
|
96
139
|
return marker;
|
|
97
140
|
}
|
|
@@ -119,29 +162,53 @@ function getRetainedConnectorDom(element) {
|
|
|
119
162
|
svg,
|
|
120
163
|
defs,
|
|
121
164
|
path,
|
|
122
|
-
|
|
165
|
+
labels: {},
|
|
123
166
|
};
|
|
124
167
|
retainedConnectorDom.set(element, retained);
|
|
125
168
|
return retained;
|
|
126
169
|
}
|
|
127
|
-
function getOrCreateLabelElement(retained) {
|
|
128
|
-
|
|
129
|
-
|
|
170
|
+
function getOrCreateLabelElement(retained, slot) {
|
|
171
|
+
const existing = retained.labels[slot];
|
|
172
|
+
if (existing) {
|
|
173
|
+
return existing;
|
|
130
174
|
}
|
|
131
175
|
const label = document.createElement('div');
|
|
132
|
-
|
|
133
|
-
|
|
176
|
+
// Appended after the `<svg>` rather than inserted directly behind it, so the
|
|
177
|
+
// three captions land in slot order instead of in reverse creation order.
|
|
178
|
+
// Every one of them is absolutely positioned, so document order is a
|
|
179
|
+
// debugging convenience, not a layout decision.
|
|
180
|
+
(retained.svg.parentElement ?? retained.svg).append(label);
|
|
181
|
+
retained.labels[slot] = label;
|
|
134
182
|
return label;
|
|
135
183
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
184
|
+
/**
|
|
185
|
+
* The text and box one slot paints, or `null` when that caption is absent.
|
|
186
|
+
*
|
|
187
|
+
* The DOM twin of `paintedLabels` on the canvas side: same three slots, same
|
|
188
|
+
* `labelStyle` shared by all three, so the two renderers cannot disagree about
|
|
189
|
+
* what a connector is showing.
|
|
190
|
+
*/
|
|
191
|
+
function labelContent(model, slot) {
|
|
192
|
+
if (slot === 'center') {
|
|
193
|
+
return isConnectorWithLabel(model) && model.labelXYWH
|
|
194
|
+
? { text: model.text?.toString() ?? '', xywh: model.labelXYWH }
|
|
195
|
+
: null;
|
|
196
|
+
}
|
|
197
|
+
const xywh = model.endLabelXYWH(slot);
|
|
198
|
+
return model.hasEndLabel(slot) && xywh
|
|
199
|
+
? { text: model.endLabelText(slot)?.toString() ?? '', xywh }
|
|
200
|
+
: null;
|
|
201
|
+
}
|
|
202
|
+
function renderConnectorLabel(model, retained, renderer, zoom, slot) {
|
|
203
|
+
const content = labelContent(model, slot);
|
|
204
|
+
if (!content) {
|
|
205
|
+
retained.labels[slot]?.remove();
|
|
206
|
+
delete retained.labels[slot];
|
|
140
207
|
return;
|
|
141
208
|
}
|
|
142
|
-
const [lx, ly, lw, lh] =
|
|
209
|
+
const [lx, ly, lw, lh] = content.xywh;
|
|
143
210
|
const { labelStyle: { color, fontSize, fontWeight, fontStyle, fontFamily, textAlign, }, } = model;
|
|
144
|
-
const labelElement = getOrCreateLabelElement(retained);
|
|
211
|
+
const labelElement = getOrCreateLabelElement(retained, slot);
|
|
145
212
|
labelElement.style.position = 'absolute';
|
|
146
213
|
labelElement.style.left = `${lx * zoom}px`;
|
|
147
214
|
labelElement.style.top = `${ly * zoom}px`;
|
|
@@ -168,7 +235,7 @@ function renderConnectorLabel(model, retained, renderer, zoom) {
|
|
|
168
235
|
labelElement.style.whiteSpace = 'pre-wrap';
|
|
169
236
|
labelElement.style.wordWrap = 'break-word';
|
|
170
237
|
// Add text content
|
|
171
|
-
labelElement.textContent =
|
|
238
|
+
labelElement.textContent = content.text;
|
|
172
239
|
}
|
|
173
240
|
/**
|
|
174
241
|
* Renders a ConnectorElementModel to a given HTMLElement using DOM/SVG.
|
|
@@ -264,6 +331,9 @@ export const connectorDomRenderer = (model, element, renderer) => {
|
|
|
264
331
|
element.style.height = `${model.h * zoom}px`;
|
|
265
332
|
element.style.overflow = 'visible';
|
|
266
333
|
element.style.pointerEvents = 'none';
|
|
267
|
-
// Render
|
|
268
|
-
|
|
334
|
+
// Render each caption that is present — the centre name and the two end
|
|
335
|
+
// labels — and drop the node of any that is not.
|
|
336
|
+
for (const slot of LABEL_SLOTS) {
|
|
337
|
+
renderConnectorLabel(model, retained, renderer, zoom, slot);
|
|
338
|
+
}
|
|
269
339
|
};
|