@formicoidea/labre-core 0.41.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +384 -0
- package/dist/_pkgs/affine-block-bookmark/bookmark-block.js +2 -2
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.js +7 -1
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +2 -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/consts.d.ts +2 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +5 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +1 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +30 -8
- 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 +2 -1
- package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +2 -1
- package/dist/_pkgs/affine-block-frame/frame-manager.js +1 -1
- 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-note/note-keymap.js +7 -1
- package/dist/_pkgs/affine-block-paragraph/paragraph-keymap.js +7 -1
- 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/keyboard/keymap.js +1 -16
- 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 +241 -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 +136 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.js +439 -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/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/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.js +1 -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/view.js +8 -1
- package/dist/_pkgs/affine-block-surface-ref/configs/slash-menu.js +1 -1
- 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 +440 -0
- 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/resource/resource.js +29 -16
- 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-gfx-brush/element-renderer.js +2 -2
- 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/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 +216 -54
- 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 +72 -4
- 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/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/templates/index.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/basket-elements.js +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/utils/import-mindmap.js +2 -2
- package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +1 -1
- package/dist/_pkgs/affine-gfx-mindmap/translations.js +1 -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 +6 -1
- package/dist/_pkgs/affine-gfx-shape/toolbar/palette-color-action.js +11 -1
- package/dist/_pkgs/affine-gfx-template/builtin/other.js +1 -1
- package/dist/_pkgs/affine-gfx-template/snapshot-from-action.js +32 -119
- package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +1 -1
- 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 +57 -2
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +8 -1
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +12 -2
- package/dist/_pkgs/affine-gfx-text/translations.d.ts +1 -0
- package/dist/_pkgs/affine-gfx-text/translations.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/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 +7 -0
- package/dist/_pkgs/affine-shared/services/font-loader/config.js +43 -0
- 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/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 +77 -7
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +97 -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-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/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-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/view.js +5 -0
- 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/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 +8 -1
- package/dist/frameworks.d.ts +9 -0
- package/dist/frameworks.js +19 -0
- package/dist/translations.js +16 -0
- package/package.json +9 -4
- package/dist/_pkgs/affine-gfx-group/group-watcher.d.ts +0 -1
- package/dist/_pkgs/affine-gfx-group/group-watcher.js +0 -20
|
@@ -1,8 +1,8 @@
|
|
|
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 { createTextActions, normalizeTextBound } from '../../affine-gfx-text/index.js';
|
|
4
4
|
import { ConnectorElementModel, ConnectorMode, DEFAULT_FRONT_ENDPOINT_STYLE, DEFAULT_REAR_ENDPOINT_STYLE, DefaultTheme, LineWidth, PointStyle, resolveColor, StrokeStyle, } from '../../affine-model/index.js';
|
|
5
|
-
import { ToolbarModuleExtension, translateKey, } from '../../affine-shared/services/index.js';
|
|
5
|
+
import { CONNECTOR_SOURCE_LABEL, CONNECTOR_TARGET_LABEL, ToolbarModuleExtension, translateKey, } from '../../affine-shared/services/index.js';
|
|
6
6
|
import { getMostCommonResolvedValue, getMostCommonValue, } from '../../affine-shared/utils/index.js';
|
|
7
7
|
import { getRootBlock, LINE_STYLE_LIST, renderMenu, } from '../../affine-widget-edgeless-toolbar/index.js';
|
|
8
8
|
import { Bound } from '../../global/gfx/index.js';
|
|
@@ -14,8 +14,20 @@ import { isConnectorWithLabel } from '../connector-manager.js';
|
|
|
14
14
|
import { INVERT_EDGE_DIRECTION, invertEdgeDirection, } from '../direction/invert-direction.js';
|
|
15
15
|
import { asTypedEdge, edgeIsBound, roleVocabularies, } from '../direction/typed-edge.js';
|
|
16
16
|
import { mountConnectorLabelEditor } from '../text/index.js';
|
|
17
|
+
import { EndPointDiamondHollowIcon, EndPointTriangleHollowIcon, StartPointDiamondHollowIcon, StartPointTriangleHollowIcon, } from './hollow-endpoint-icons.js';
|
|
17
18
|
import { CONNECTOR_ADD_TEXT, CONNECTOR_LABEL_END_POINT_STYLE, CONNECTOR_LABEL_SHAPE, CONNECTOR_LABEL_START_POINT_STYLE, CONNECTOR_LABEL_STROKE_STYLE, CONNECTOR_LABEL_STYLE, CONNECTOR_MODE_WORDING, CONNECTOR_TOOLTIP_CONNECTOR_SHAPE, CONNECTOR_TOOLTIP_FLIP_DIRECTION, } from '../translations.js';
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Every `PointStyle` must appear in BOTH lists.
|
|
21
|
+
*
|
|
22
|
+
* `renderMenu` paints the menu's trigger with
|
|
23
|
+
* `renderCurrentMenuItemWith(items, currentValue, 'icon')`, which returns
|
|
24
|
+
* `undefined` for a value the list does not carry — an unlisted style gives a
|
|
25
|
+
* blank button, so a connector created by a framework (or imported) with that
|
|
26
|
+
* head shows an empty endpoint control. There is no test that can catch a
|
|
27
|
+
* forgotten entry at the type level; `endpoint-style.unit.spec.ts` asserts the
|
|
28
|
+
* coverage instead.
|
|
29
|
+
*/
|
|
30
|
+
export const FRONT_ENDPOINT_STYLE_LIST = [
|
|
19
31
|
{
|
|
20
32
|
value: PointStyle.None,
|
|
21
33
|
icon: StartPointIcon(),
|
|
@@ -28,6 +40,10 @@ const FRONT_ENDPOINT_STYLE_LIST = [
|
|
|
28
40
|
value: PointStyle.Triangle,
|
|
29
41
|
icon: StartPointTriangleIcon(),
|
|
30
42
|
},
|
|
43
|
+
{
|
|
44
|
+
value: PointStyle.TriangleHollow,
|
|
45
|
+
icon: StartPointTriangleHollowIcon(),
|
|
46
|
+
},
|
|
31
47
|
{
|
|
32
48
|
value: PointStyle.Circle,
|
|
33
49
|
icon: StartPointCircleIcon(),
|
|
@@ -36,12 +52,20 @@ const FRONT_ENDPOINT_STYLE_LIST = [
|
|
|
36
52
|
value: PointStyle.Diamond,
|
|
37
53
|
icon: StartPointDiamondIcon(),
|
|
38
54
|
},
|
|
55
|
+
{
|
|
56
|
+
value: PointStyle.DiamondHollow,
|
|
57
|
+
icon: StartPointDiamondHollowIcon(),
|
|
58
|
+
},
|
|
39
59
|
];
|
|
40
|
-
const REAR_ENDPOINT_STYLE_LIST = [
|
|
60
|
+
export const REAR_ENDPOINT_STYLE_LIST = [
|
|
41
61
|
{
|
|
42
62
|
value: PointStyle.Diamond,
|
|
43
63
|
icon: EndPointDiamondIcon(),
|
|
44
64
|
},
|
|
65
|
+
{
|
|
66
|
+
value: PointStyle.DiamondHollow,
|
|
67
|
+
icon: EndPointDiamondHollowIcon(),
|
|
68
|
+
},
|
|
45
69
|
{
|
|
46
70
|
value: PointStyle.Circle,
|
|
47
71
|
icon: EndPointCircleIcon(),
|
|
@@ -50,6 +74,10 @@ const REAR_ENDPOINT_STYLE_LIST = [
|
|
|
50
74
|
value: PointStyle.Triangle,
|
|
51
75
|
icon: EndPointTriangleIcon(),
|
|
52
76
|
},
|
|
77
|
+
{
|
|
78
|
+
value: PointStyle.TriangleHollow,
|
|
79
|
+
icon: EndPointTriangleHollowIcon(),
|
|
80
|
+
},
|
|
53
81
|
{
|
|
54
82
|
value: PointStyle.Arrow,
|
|
55
83
|
icon: EndPointArrowIcon(),
|
|
@@ -127,6 +155,9 @@ export const connectorToolbarConfig = {
|
|
|
127
155
|
}
|
|
128
156
|
updateModelsWith(ctx, models, 'strokeStyle', value);
|
|
129
157
|
};
|
|
158
|
+
// A link belongs to what it links: the carousel opens on the framework
|
|
159
|
+
// of its endpoints, else of the board it crosses (`docs/adr/0027`).
|
|
160
|
+
const carousel = frameworkPaletteGroups(ctx.std, models, DefaultTheme.Palettes);
|
|
130
161
|
return html `
|
|
131
162
|
<edgeless-color-picker-button
|
|
132
163
|
class="stroke-color"
|
|
@@ -137,6 +168,8 @@ export const connectorToolbarConfig = {
|
|
|
137
168
|
.hollowCircle=${true}
|
|
138
169
|
.originalColor=${firstModel.stroke}
|
|
139
170
|
.enableCustomColor=${enableCustomColor}
|
|
171
|
+
.paletteGroups=${carousel.groups}
|
|
172
|
+
.activeGroupKey=${carousel.activeKey}
|
|
140
173
|
.std=${ctx.std}
|
|
141
174
|
>
|
|
142
175
|
<edgeless-line-styles-panel
|
|
@@ -360,6 +393,41 @@ export const connectorToolbarConfig = {
|
|
|
360
393
|
mountConnectorLabelEditor(model, rootBlock);
|
|
361
394
|
},
|
|
362
395
|
},
|
|
396
|
+
/**
|
|
397
|
+
* The two END labels (`docs/adr/0018` phase 2).
|
|
398
|
+
*
|
|
399
|
+
* After the caption and its style controls, because that is the order the
|
|
400
|
+
* notation itself has: an association is named in the middle and adorned at
|
|
401
|
+
* its ends. Each entry appears only while its own end is bare — an end
|
|
402
|
+
* label that exists is edited by double-clicking it, exactly as the caption
|
|
403
|
+
* is, and `g.text` has always hidden itself on the same rule.
|
|
404
|
+
*
|
|
405
|
+
* Wordings, not literals: the row is a host's UI, and a hard-coded "Source
|
|
406
|
+
* label" is the one word a translated editor cannot translate (#183).
|
|
407
|
+
*/
|
|
408
|
+
...['source', 'target'].map(end => ({
|
|
409
|
+
id: end === 'source' ? 'h.source-label' : 'h.target-label',
|
|
410
|
+
tooltipWording: end === 'source' ? CONNECTOR_SOURCE_LABEL : CONNECTOR_TARGET_LABEL,
|
|
411
|
+
labelWording: end === 'source' ? CONNECTOR_SOURCE_LABEL : CONNECTOR_TARGET_LABEL,
|
|
412
|
+
icon: AddTextIcon(),
|
|
413
|
+
when(ctx) {
|
|
414
|
+
const models = ctx.getSurfaceModelsByType(ConnectorElementModel);
|
|
415
|
+
if (models.length !== 1)
|
|
416
|
+
return false;
|
|
417
|
+
return end === 'source'
|
|
418
|
+
? !models[0].sourceLabel
|
|
419
|
+
: !models[0].targetLabel;
|
|
420
|
+
},
|
|
421
|
+
run(ctx) {
|
|
422
|
+
const model = ctx.getCurrentModelByType(ConnectorElementModel);
|
|
423
|
+
if (!model)
|
|
424
|
+
return;
|
|
425
|
+
const rootBlock = getRootBlock(ctx);
|
|
426
|
+
if (!rootBlock)
|
|
427
|
+
return;
|
|
428
|
+
mountConnectorLabelEditor(model, rootBlock, undefined, { which: end });
|
|
429
|
+
},
|
|
430
|
+
})),
|
|
363
431
|
// id: `g.text`
|
|
364
432
|
...createTextActions(ConnectorElementModel, 'connector', (ctx, model, props) => {
|
|
365
433
|
if (!isConnectorWithLabel(model))
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Front (start) hollow diamond — the head sits at the left end of the stub. */
|
|
2
|
+
export declare const StartPointDiamondHollowIcon: () => import("lit-html").TemplateResult<1>;
|
|
3
|
+
/** Rear (end) hollow diamond — the head sits at the right end of the stub. */
|
|
4
|
+
export declare const EndPointDiamondHollowIcon: () => import("lit-html").TemplateResult<1>;
|
|
5
|
+
/** Front (start) hollow closed triangle. */
|
|
6
|
+
export declare const StartPointTriangleHollowIcon: () => import("lit-html").TemplateResult<1>;
|
|
7
|
+
/** Rear (end) hollow closed triangle. */
|
|
8
|
+
export declare const EndPointTriangleHollowIcon: () => import("lit-html").TemplateResult<1>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* The four toolbar icons for the hollow UML endpoint heads.
|
|
4
|
+
*
|
|
5
|
+
* Hand-authored because `@blocksuite/icons` has no hollow variant of its
|
|
6
|
+
* `StartPoint*` / `EndPoint*` set. They mirror that set deliberately: the same
|
|
7
|
+
* `0 0 24 24` viewBox and the same `1em` box, so a hollow entry lines up
|
|
8
|
+
* pixel-for-pixel with the filled neighbour it sits next to in the endpoint
|
|
9
|
+
* menus. The difference is only the paint — the shipped icons merge stub and
|
|
10
|
+
* head into one `fill='currentColor'` path, these draw the stub as a stroked
|
|
11
|
+
* line and leave the head `fill="none"` so the reader sees the hollow head the
|
|
12
|
+
* canvas will actually draw.
|
|
13
|
+
*
|
|
14
|
+
* Each is a function returning a `TemplateResult`, matching how the
|
|
15
|
+
* `@blocksuite/icons` lit icons are called at the use site
|
|
16
|
+
* (`StartPointDiamondIcon()`).
|
|
17
|
+
*/
|
|
18
|
+
const ICON_STYLE = 'user-select:none;flex-shrink:0;';
|
|
19
|
+
/** Front (start) hollow diamond — the head sits at the left end of the stub. */
|
|
20
|
+
export const StartPointDiamondHollowIcon = () => html `
|
|
21
|
+
<svg
|
|
22
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
23
|
+
viewBox="0 0 24 24"
|
|
24
|
+
width="1em"
|
|
25
|
+
height="1em"
|
|
26
|
+
fill="none"
|
|
27
|
+
style=${ICON_STYLE}
|
|
28
|
+
>
|
|
29
|
+
<path
|
|
30
|
+
d="M21 12H11"
|
|
31
|
+
stroke="currentColor"
|
|
32
|
+
stroke-width="1.5"
|
|
33
|
+
stroke-linecap="round"
|
|
34
|
+
/>
|
|
35
|
+
<path
|
|
36
|
+
d="M11 12L7 8L3 12L7 16Z"
|
|
37
|
+
fill="none"
|
|
38
|
+
stroke="currentColor"
|
|
39
|
+
stroke-width="1.5"
|
|
40
|
+
stroke-linejoin="round"
|
|
41
|
+
/>
|
|
42
|
+
</svg>
|
|
43
|
+
`;
|
|
44
|
+
/** Rear (end) hollow diamond — the head sits at the right end of the stub. */
|
|
45
|
+
export const EndPointDiamondHollowIcon = () => html `
|
|
46
|
+
<svg
|
|
47
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
48
|
+
viewBox="0 0 24 24"
|
|
49
|
+
width="1em"
|
|
50
|
+
height="1em"
|
|
51
|
+
fill="none"
|
|
52
|
+
style=${ICON_STYLE}
|
|
53
|
+
>
|
|
54
|
+
<path
|
|
55
|
+
d="M3 12H13"
|
|
56
|
+
stroke="currentColor"
|
|
57
|
+
stroke-width="1.5"
|
|
58
|
+
stroke-linecap="round"
|
|
59
|
+
/>
|
|
60
|
+
<path
|
|
61
|
+
d="M13 12L17 8L21 12L17 16Z"
|
|
62
|
+
fill="none"
|
|
63
|
+
stroke="currentColor"
|
|
64
|
+
stroke-width="1.5"
|
|
65
|
+
stroke-linejoin="round"
|
|
66
|
+
/>
|
|
67
|
+
</svg>
|
|
68
|
+
`;
|
|
69
|
+
/** Front (start) hollow closed triangle. */
|
|
70
|
+
export const StartPointTriangleHollowIcon = () => html `
|
|
71
|
+
<svg
|
|
72
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
73
|
+
viewBox="0 0 24 24"
|
|
74
|
+
width="1em"
|
|
75
|
+
height="1em"
|
|
76
|
+
fill="none"
|
|
77
|
+
style=${ICON_STYLE}
|
|
78
|
+
>
|
|
79
|
+
<path
|
|
80
|
+
d="M21 12H10.5"
|
|
81
|
+
stroke="currentColor"
|
|
82
|
+
stroke-width="1.5"
|
|
83
|
+
stroke-linecap="round"
|
|
84
|
+
/>
|
|
85
|
+
<path
|
|
86
|
+
d="M10.5 7.5L3 12L10.5 16.5Z"
|
|
87
|
+
fill="none"
|
|
88
|
+
stroke="currentColor"
|
|
89
|
+
stroke-width="1.5"
|
|
90
|
+
stroke-linejoin="round"
|
|
91
|
+
/>
|
|
92
|
+
</svg>
|
|
93
|
+
`;
|
|
94
|
+
/** Rear (end) hollow closed triangle. */
|
|
95
|
+
export const EndPointTriangleHollowIcon = () => html `
|
|
96
|
+
<svg
|
|
97
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
98
|
+
viewBox="0 0 24 24"
|
|
99
|
+
width="1em"
|
|
100
|
+
height="1em"
|
|
101
|
+
fill="none"
|
|
102
|
+
style=${ICON_STYLE}
|
|
103
|
+
>
|
|
104
|
+
<path
|
|
105
|
+
d="M3 12H13.5"
|
|
106
|
+
stroke="currentColor"
|
|
107
|
+
stroke-width="1.5"
|
|
108
|
+
stroke-linecap="round"
|
|
109
|
+
/>
|
|
110
|
+
<path
|
|
111
|
+
d="M13.5 7.5L21 12L13.5 16.5Z"
|
|
112
|
+
fill="none"
|
|
113
|
+
stroke="currentColor"
|
|
114
|
+
stroke-width="1.5"
|
|
115
|
+
stroke-linejoin="round"
|
|
116
|
+
/>
|
|
117
|
+
</svg>
|
|
118
|
+
`;
|
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
import { type ConnectorElementModel } from '../../affine-model/index.js';
|
|
1
|
+
import { CONNECTOR_END_LABEL_GRAB, type ConnectorElementModel } from '../../affine-model/index.js';
|
|
2
|
+
import { type IVec, type XYWH } from '../../global/gfx/index.js';
|
|
2
3
|
import { type DragEndContext, type DragMoveContext, type DragStartContext, GfxElementModelView } from '../../std/gfx/index.js';
|
|
4
|
+
import { type ConnectorLabelWhich } from '../text/edgeless-connector-label-editor.js';
|
|
5
|
+
/**
|
|
6
|
+
* How close to an endpoint a double-click has to land to mean "the label of
|
|
7
|
+
* THAT end" (`docs/adr/0018` phase 2).
|
|
8
|
+
*
|
|
9
|
+
* Re-exported rather than declared: the number is the model's now, because the
|
|
10
|
+
* connector's own HIT TEST has to claim the same discs — a gesture the
|
|
11
|
+
* dispatcher never delivers is a gesture no picker gets to interpret
|
|
12
|
+
* (`connectorEndNear`, and the PO's recette of 14/09/2026). Kept exported here
|
|
13
|
+
* because this is where every caller has always reached for it.
|
|
14
|
+
*/
|
|
15
|
+
export { CONNECTOR_END_LABEL_GRAB };
|
|
16
|
+
/** What {@link pickConnectorLabelWhich} needs, and nothing more. */
|
|
17
|
+
export type ConnectorLabelHitTarget = {
|
|
18
|
+
absolutePath: readonly IVec[];
|
|
19
|
+
sourceLabelXYWH?: XYWH;
|
|
20
|
+
targetLabelXYWH?: XYWH;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Which of a connector's three labels a point is asking for.
|
|
24
|
+
*
|
|
25
|
+
* The order is what makes the gesture predictable:
|
|
26
|
+
*
|
|
27
|
+
* 1. an END LABEL BOX under the pointer — an existing label is edited where it
|
|
28
|
+
* is drawn, never re-created somewhere else;
|
|
29
|
+
* 2. otherwise, within {@link CONNECTOR_END_LABEL_GRAB} of an ENDPOINT — the
|
|
30
|
+
* nearer end, which is where a label the connector does not have yet gets
|
|
31
|
+
* created;
|
|
32
|
+
* 3. otherwise the CENTRE, which is what a double-click on a connector has
|
|
33
|
+
* always meant and stays the answer everywhere else on the line.
|
|
34
|
+
*
|
|
35
|
+
* Pure, and exported, because the ordering is the whole behaviour and a spec
|
|
36
|
+
* that had to drive a real pointer to check it would test the dispatcher.
|
|
37
|
+
*/
|
|
38
|
+
export declare function pickConnectorLabelWhich(connector: ConnectorLabelHitTarget, point: IVec, grab?: number): ConnectorLabelWhich;
|
|
3
39
|
export declare class ConnectorElementView extends GfxElementModelView<ConnectorElementModel> {
|
|
4
40
|
static type: string;
|
|
5
41
|
onDragStart: (context: DragStartContext) => void;
|
|
@@ -1,7 +1,55 @@
|
|
|
1
|
-
import { LocalShapeElementModel, } from '../../affine-model/index.js';
|
|
2
|
-
import { Bound, serializeXYWH, Vec } from '../../global/gfx/index.js';
|
|
1
|
+
import { CONNECTOR_END_LABEL_GRAB, LocalShapeElementModel, } from '../../affine-model/index.js';
|
|
2
|
+
import { Bound, serializeXYWH, Vec, } from '../../global/gfx/index.js';
|
|
3
3
|
import { generateKeyBetween, GfxElementModelView, GfxViewInteractionExtension, } from '../../std/gfx/index.js';
|
|
4
|
-
import { mountConnectorLabelEditor } from '../text/edgeless-connector-label-editor.js';
|
|
4
|
+
import { mountConnectorLabelEditor, } from '../text/edgeless-connector-label-editor.js';
|
|
5
|
+
/**
|
|
6
|
+
* How close to an endpoint a double-click has to land to mean "the label of
|
|
7
|
+
* THAT end" (`docs/adr/0018` phase 2).
|
|
8
|
+
*
|
|
9
|
+
* Re-exported rather than declared: the number is the model's now, because the
|
|
10
|
+
* connector's own HIT TEST has to claim the same discs — a gesture the
|
|
11
|
+
* dispatcher never delivers is a gesture no picker gets to interpret
|
|
12
|
+
* (`connectorEndNear`, and the PO's recette of 14/09/2026). Kept exported here
|
|
13
|
+
* because this is where every caller has always reached for it.
|
|
14
|
+
*/
|
|
15
|
+
export { CONNECTOR_END_LABEL_GRAB };
|
|
16
|
+
/**
|
|
17
|
+
* Which of a connector's three labels a point is asking for.
|
|
18
|
+
*
|
|
19
|
+
* The order is what makes the gesture predictable:
|
|
20
|
+
*
|
|
21
|
+
* 1. an END LABEL BOX under the pointer — an existing label is edited where it
|
|
22
|
+
* is drawn, never re-created somewhere else;
|
|
23
|
+
* 2. otherwise, within {@link CONNECTOR_END_LABEL_GRAB} of an ENDPOINT — the
|
|
24
|
+
* nearer end, which is where a label the connector does not have yet gets
|
|
25
|
+
* created;
|
|
26
|
+
* 3. otherwise the CENTRE, which is what a double-click on a connector has
|
|
27
|
+
* always meant and stays the answer everywhere else on the line.
|
|
28
|
+
*
|
|
29
|
+
* Pure, and exported, because the ordering is the whole behaviour and a spec
|
|
30
|
+
* that had to drive a real pointer to check it would test the dispatcher.
|
|
31
|
+
*/
|
|
32
|
+
export function pickConnectorLabelWhich(connector, point, grab = CONNECTOR_END_LABEL_GRAB) {
|
|
33
|
+
const boxes = [
|
|
34
|
+
['source', connector.sourceLabelXYWH],
|
|
35
|
+
['target', connector.targetLabelXYWH],
|
|
36
|
+
];
|
|
37
|
+
for (const [end, box] of boxes) {
|
|
38
|
+
if (box && Bound.fromXYWH(box).isPointInBound(point))
|
|
39
|
+
return end;
|
|
40
|
+
}
|
|
41
|
+
const path = connector.absolutePath;
|
|
42
|
+
if (path.length) {
|
|
43
|
+
const first = path[0];
|
|
44
|
+
const last = path[path.length - 1];
|
|
45
|
+
const toSource = Vec.dist(point, [first[0], first[1]]);
|
|
46
|
+
const toTarget = Vec.dist(point, [last[0], last[1]]);
|
|
47
|
+
if (Math.min(toSource, toTarget) <= grab) {
|
|
48
|
+
return toSource <= toTarget ? 'source' : 'target';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return 'center';
|
|
52
|
+
}
|
|
5
53
|
export class ConnectorElementView extends GfxElementModelView {
|
|
6
54
|
constructor() {
|
|
7
55
|
super(...arguments);
|
|
@@ -21,6 +69,30 @@ export class ConnectorElementView extends GfxElementModelView {
|
|
|
21
69
|
static { this.type = 'connector'; }
|
|
22
70
|
onCreated() {
|
|
23
71
|
super.onCreated();
|
|
72
|
+
// What the GRID must offer before any hit test is asked. The grid indexes a
|
|
73
|
+
// connector by its `responseBound` — the box of its PATH — and the end-label
|
|
74
|
+
// grab discs stick out of it by up to `CONNECTOR_END_LABEL_GRAB`, so without
|
|
75
|
+
// this nothing is ever a candidate out there and
|
|
76
|
+
// `ConnectorElementModel.endGrabIncludesPoint` never gets asked. It widens
|
|
77
|
+
// the CANDIDATE set only: what is picked, hovered and selected is still
|
|
78
|
+
// decided by the model's own `includesPoint`.
|
|
79
|
+
//
|
|
80
|
+
// Set from the view rather than defaulted on the model because it is a
|
|
81
|
+
// LOCAL fact about this peer's pointer, which is exactly what
|
|
82
|
+
// `responseExtension` is for — nothing about it is written to the document.
|
|
83
|
+
//
|
|
84
|
+
// NOT gated on the model's `role`, although `endGrabIncludesPoint` is
|
|
85
|
+
// (a generalist connector keeps its hairline). Two reasons, and both are
|
|
86
|
+
// about `onCreated` running exactly once: a connector acquires its role
|
|
87
|
+
// AFTER creation often enough — an import writes the element then types it,
|
|
88
|
+
// a morph retypes it, a paste re-creates it — and a halo decided at that one
|
|
89
|
+
// moment would be missing for every one of those. And it costs nothing to
|
|
90
|
+
// keep: the extension widens the CANDIDATE set only, and the authority on
|
|
91
|
+
// what a point actually hits is the model, which now declines.
|
|
92
|
+
this.model.responseExtension = [
|
|
93
|
+
CONNECTOR_END_LABEL_GRAB,
|
|
94
|
+
CONNECTOR_END_LABEL_GRAB,
|
|
95
|
+
];
|
|
24
96
|
this._initLabelMoving();
|
|
25
97
|
}
|
|
26
98
|
_initLabelMoving() {
|
|
@@ -28,12 +100,14 @@ export class ConnectorElementView extends GfxElementModelView {
|
|
|
28
100
|
if (this.model.isLocked()) {
|
|
29
101
|
return;
|
|
30
102
|
}
|
|
31
|
-
const enterLabelEditor = (evt) => {
|
|
103
|
+
const enterLabelEditor = (evt, which = 'center') => {
|
|
32
104
|
const edgeless = this.std.view.getBlock(this.std.store.root.id);
|
|
33
105
|
if (edgeless && !this.model.isLocked()) {
|
|
34
|
-
mountConnectorLabelEditor(this.model, edgeless, this.gfx.viewport.toModelCoord(evt.x, evt.y));
|
|
106
|
+
mountConnectorLabelEditor(this.model, edgeless, this.gfx.viewport.toModelCoord(evt.x, evt.y), { which });
|
|
35
107
|
}
|
|
36
108
|
};
|
|
109
|
+
/** Which label the pointer is asking for, in model coordinates. */
|
|
110
|
+
const labelEndAt = (evt) => pickConnectorLabelWhich(this.model, this.gfx.viewport.toModelCoord(evt.x, evt.y));
|
|
37
111
|
const getCurrentPosition = (evt) => {
|
|
38
112
|
const [x, y] = this.gfx.viewport.toModelCoord(evt.x, evt.y);
|
|
39
113
|
return {
|
|
@@ -64,7 +138,10 @@ export class ConnectorElementView extends GfxElementModelView {
|
|
|
64
138
|
clientY: 0,
|
|
65
139
|
};
|
|
66
140
|
view.on('dblclick', evt => {
|
|
67
|
-
|
|
141
|
+
// This view IS the centre label's box, so the answer is not up for
|
|
142
|
+
// discussion — a short connector whose caption sits within grabbing
|
|
143
|
+
// distance of an arrowhead still edits its caption when you click it.
|
|
144
|
+
enterLabelEditor(evt, 'center');
|
|
68
145
|
});
|
|
69
146
|
view.on('dragstart', evt => {
|
|
70
147
|
startPoint = getCurrentPosition(evt);
|
|
@@ -130,9 +207,21 @@ export class ConnectorElementView extends GfxElementModelView {
|
|
|
130
207
|
}));
|
|
131
208
|
updateLabelElement();
|
|
132
209
|
this.on('dblclick', evt => {
|
|
133
|
-
|
|
134
|
-
|
|
210
|
+
// The centre label, when it exists, is a local element with its own view
|
|
211
|
+
// and its own `dblclick` above: anything that lands inside its box is
|
|
212
|
+
// already spoken for, and answering here too would mount two editors.
|
|
213
|
+
if (curLabelElement &&
|
|
214
|
+
Bound.deserialize(curLabelElement.xywh).isPointInBound(this.gfx.viewport.toModelCoord(evt.x, evt.y))) {
|
|
215
|
+
return;
|
|
135
216
|
}
|
|
217
|
+
const which = labelEndAt(evt);
|
|
218
|
+
// Outside that box, `center` means what it meant before this tranche:
|
|
219
|
+
// open the caption editor when there is no caption yet, and otherwise do
|
|
220
|
+
// nothing (the caption is edited by clicking the caption). The two ends
|
|
221
|
+
// are new, and they answer whether the connector has a caption or not.
|
|
222
|
+
if (which === 'center' && curLabelElement)
|
|
223
|
+
return;
|
|
224
|
+
enterLabelEditor(evt, which);
|
|
136
225
|
});
|
|
137
226
|
}
|
|
138
227
|
}
|
|
@@ -77,7 +77,7 @@ export const createGroupCommand = (ctx, next) => {
|
|
|
77
77
|
return pre;
|
|
78
78
|
}, {}),
|
|
79
79
|
// Translated HERE and once: the title is document content the moment it
|
|
80
|
-
// lands (ADR
|
|
80
|
+
// lands (ADR 0023), so the host's catalogue is asked at placement and
|
|
81
81
|
// never again — a renamed group keeps its name.
|
|
82
82
|
title: translateKey(std, ...GROUP_SEED_NAME, { n: groups.length + 1 }),
|
|
83
83
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { StoreExtensionProvider, } from '../affine-ext-loader/index.js';
|
|
2
2
|
import { groupToMarkdownAdapterMatcher, groupToPlainTextAdapterMatcher, } from './adapter/index.js';
|
|
3
|
-
import { groupRelationWatcherExtension } from './group-watcher.js';
|
|
4
3
|
export class GroupStoreExtension extends StoreExtensionProvider {
|
|
5
4
|
constructor() {
|
|
6
5
|
super(...arguments);
|
|
@@ -10,6 +9,5 @@ export class GroupStoreExtension extends StoreExtensionProvider {
|
|
|
10
9
|
super.setup(context);
|
|
11
10
|
context.register(groupToPlainTextAdapterMatcher);
|
|
12
11
|
context.register(groupToMarkdownAdapterMatcher);
|
|
13
|
-
context.register(groupRelationWatcherExtension);
|
|
14
12
|
}
|
|
15
13
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { type ChromeWording } from '../affine-shared/services/index.js';
|
|
1
|
+
import { type ChromeWording, GROUP_SEED_NAME } from '../affine-shared/services/index.js';
|
|
2
2
|
/**
|
|
3
|
-
* The group's own seed
|
|
4
|
-
* with (`Group 2`), written into the document
|
|
5
|
-
* (`createGroupCommand`). Resolved at PLACEMENT and never again — a group
|
|
6
|
-
* renamed by its author keeps its name, and a group created before this key
|
|
7
|
-
* existed keeps the plain text it was given.
|
|
3
|
+
* The group's own seed — the default title a newly created group is stamped
|
|
4
|
+
* with (`Group 2`), written into the document by `createGroupCommand`.
|
|
8
5
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* It now LIVES in `@labre/affine-shared`, because the surface block's legend
|
|
7
|
+
* groups the box it draws and cannot import this package (`gfx-group` depends
|
|
8
|
+
* on the surface block, not the other way round). Re-exported here unchanged,
|
|
9
|
+
* and still listed by {@link GROUP_WORDINGS} below, so the key manifest sees
|
|
10
|
+
* exactly the one `seed` entry it always has.
|
|
12
11
|
*/
|
|
13
|
-
export
|
|
12
|
+
export { GROUP_SEED_NAME };
|
|
14
13
|
/**
|
|
15
14
|
* This package's contribution to the translation-key manifest — a single seed,
|
|
16
15
|
* listed in `PACKAGE_SEED_WORDINGS` under source `seed`
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { TOOLBAR_INSERT_INTO_PAGE, TOOLBAR_RENAME, TOOLBAR_UNGROUP, } from '../affine-shared/services/index.js';
|
|
1
|
+
import { GROUP_SEED_NAME, TOOLBAR_INSERT_INTO_PAGE, TOOLBAR_RENAME, TOOLBAR_UNGROUP, } from '../affine-shared/services/index.js';
|
|
2
2
|
/**
|
|
3
|
-
* The group's own seed
|
|
4
|
-
* with (`Group 2`), written into the document
|
|
5
|
-
* (`createGroupCommand`). Resolved at PLACEMENT and never again — a group
|
|
6
|
-
* renamed by its author keeps its name, and a group created before this key
|
|
7
|
-
* existed keeps the plain text it was given.
|
|
3
|
+
* The group's own seed — the default title a newly created group is stamped
|
|
4
|
+
* with (`Group 2`), written into the document by `createGroupCommand`.
|
|
8
5
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* It now LIVES in `@labre/affine-shared`, because the surface block's legend
|
|
7
|
+
* groups the box it draws and cannot import this package (`gfx-group` depends
|
|
8
|
+
* on the surface block, not the other way round). Re-exported here unchanged,
|
|
9
|
+
* and still listed by {@link GROUP_WORDINGS} below, so the key manifest sees
|
|
10
|
+
* exactly the one `seed` entry it always has.
|
|
12
11
|
*/
|
|
13
|
-
export
|
|
14
|
-
'com.labre.group.seed.name',
|
|
15
|
-
'Group {{n}}',
|
|
16
|
-
];
|
|
12
|
+
export { GROUP_SEED_NAME };
|
|
17
13
|
/**
|
|
18
14
|
* This package's contribution to the translation-key manifest — a single seed,
|
|
19
15
|
* listed in `PACKAGE_SEED_WORDINGS` under source `seed`
|
|
@@ -29,7 +29,7 @@ function tpl(name, preview, build, nameKey) {
|
|
|
29
29
|
nameKey,
|
|
30
30
|
content: makeTemplateSnapshot(build(EN_SEEDS), name),
|
|
31
31
|
// The seeds a template writes into the document go through the
|
|
32
|
-
// translation seam at placement (ADR
|
|
32
|
+
// translation seam at placement (ADR 0023); `content` stays the English
|
|
33
33
|
// build.
|
|
34
34
|
localize: std => makeTemplateSnapshot(build(seedsFor(std)), name),
|
|
35
35
|
};
|
|
@@ -37,7 +37,7 @@ export const getMindmapRender = (mindmapStyle) => async (bound, edgeless) => {
|
|
|
37
37
|
const rootX = x;
|
|
38
38
|
const rootY = centerVertical - rootH / 2;
|
|
39
39
|
// Translated HERE and once: the captions are document content the moment
|
|
40
|
-
// they land (ADR
|
|
40
|
+
// they land (ADR 0023), so the host's catalogue is asked at placement and
|
|
41
41
|
// never again.
|
|
42
42
|
const root = {
|
|
43
43
|
children: [],
|
|
@@ -29,7 +29,7 @@ function readAsText(file) {
|
|
|
29
29
|
async function parseMmFile(file, std) {
|
|
30
30
|
const content = await readAsText(file);
|
|
31
31
|
// Translated HERE and once: a node with no text is document content the
|
|
32
|
-
// moment the import lands (ADR
|
|
32
|
+
// moment the import lands (ADR 0023).
|
|
33
33
|
const untitled = translateKey(std, ...MINDMAP_SEED_IMPORTED_NODE);
|
|
34
34
|
try {
|
|
35
35
|
const parsed = c.convertXML(content);
|
|
@@ -67,7 +67,7 @@ async function parseMmFile(file, std) {
|
|
|
67
67
|
async function parseOPMLFile(file, std) {
|
|
68
68
|
const content = await readAsText(file);
|
|
69
69
|
// Translated HERE and once: a node with no text is document content the
|
|
70
|
-
// moment the import lands (ADR
|
|
70
|
+
// moment the import lands (ADR 0023).
|
|
71
71
|
const untitled = translateKey(std, ...MINDMAP_SEED_IMPORTED_NODE);
|
|
72
72
|
try {
|
|
73
73
|
const parsed = c.convertXML(content);
|
|
@@ -3,7 +3,7 @@ import { type ChromeWording } from '../affine-shared/services/index.js';
|
|
|
3
3
|
* The mindmap's own seeds: the captions a freshly placed mindmap is written
|
|
4
4
|
* with, wherever the gesture draws one directly (the toolbar's built-in
|
|
5
5
|
* templates, the drag-from-basket tool, a `.mm`/`.opml` import that meets an
|
|
6
|
-
* empty node). Resolved at PLACEMENT and never again (ADR
|
|
6
|
+
* empty node). Resolved at PLACEMENT and never again (ADR 0023) — a node
|
|
7
7
|
* renamed by its author keeps its name, and a mindmap created before these
|
|
8
8
|
* keys existed keeps the plain text it was given.
|
|
9
9
|
*
|
|
@@ -3,7 +3,7 @@ import { MINDMAP_NAME, } from '../affine-shared/services/index.js';
|
|
|
3
3
|
* The mindmap's own seeds: the captions a freshly placed mindmap is written
|
|
4
4
|
* with, wherever the gesture draws one directly (the toolbar's built-in
|
|
5
5
|
* templates, the drag-from-basket tool, a `.mm`/`.opml` import that meets an
|
|
6
|
-
* empty node). Resolved at PLACEMENT and never again (ADR
|
|
6
|
+
* empty node). Resolved at PLACEMENT and never again (ADR 0023) — a node
|
|
7
7
|
* renamed by its author keeps its name, and a mindmap created before these
|
|
8
8
|
* keys existed keeps the plain text it was given.
|
|
9
9
|
*
|
|
@@ -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 highlighter = (model, ctx, matrix, renderer) => {
|
|
4
4
|
const { rotate, deserializedXYWH: [, , w, h], } = model;
|
|
@@ -7,6 +7,6 @@ export const highlighter = (model, ctx, matrix, renderer) => {
|
|
|
7
7
|
ctx.setTransform(matrix.translateSelf(cx, cy).rotateSelf(rotate).translateSelf(-cx, -cy));
|
|
8
8
|
const color = renderer.getColorValue(model.color, DefaultTheme.hightlighterColor, true);
|
|
9
9
|
ctx.fillStyle = color;
|
|
10
|
-
ctx.fill(
|
|
10
|
+
ctx.fill(taggedPath2D(model.commands));
|
|
11
11
|
};
|
|
12
12
|
export const HighlighterElementRendererExtension = ElementRendererExtension('highlighter', highlighter);
|
|
@@ -37,5 +37,11 @@ export declare class PolygonDrawingOverlay extends ToolOverlay {
|
|
|
37
37
|
* account (renders as transparent).
|
|
38
38
|
*/
|
|
39
39
|
private _effectiveStrokeColor;
|
|
40
|
+
/**
|
|
41
|
+
* The marker shown at the pointer while the tool is armed and empty: the same
|
|
42
|
+
* dot the first placed vertex gets, plus a light ring, so the promise the
|
|
43
|
+
* cursor makes is the shape the click keeps.
|
|
44
|
+
*/
|
|
45
|
+
private _renderFirstVertexHint;
|
|
40
46
|
render(ctx: CanvasRenderingContext2D, _rc: RoughCanvas): void;
|
|
41
47
|
}
|