@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Overlay } from '../../affine-block-surface/index.js';
|
|
2
2
|
import { PathGenerator } from '../../affine-gfx-connector/index.js';
|
|
3
3
|
import { ConnectorMode, LayoutType, } from '../../affine-model/index.js';
|
|
4
|
-
import { ThemeProvider } from '../../affine-shared/services/index.js';
|
|
4
|
+
import { CHROME_ACCENT_CSS_VARIABLE, ThemeProvider, } from '../../affine-shared/services/index.js';
|
|
5
5
|
import { isVecZero, PointLocation, toRadian, Vec, } from '../../global/gfx/index.js';
|
|
6
6
|
import last from 'lodash-es/last.js';
|
|
7
7
|
import { NODE_HORIZONTAL_SPACING, NODE_VERTICAL_SPACING } from '../view/layout.js';
|
|
@@ -101,7 +101,11 @@ export class MindMapIndicatorOverlay extends Overlay {
|
|
|
101
101
|
}
|
|
102
102
|
const targetPos = this.targetBound;
|
|
103
103
|
const points = this._generatePath();
|
|
104
|
-
|
|
104
|
+
// The accent read from the theme, not a literal: a canvas context cannot
|
|
105
|
+
// take a `var(…)`, so the token is resolved here (DESIGN.md, The Borrowed
|
|
106
|
+
// Blue Rule). The hex used to sit here as a `getColorValue` fallback that
|
|
107
|
+
// could never fire — the variable name always resolves.
|
|
108
|
+
const color = this.themeService.getCssVariableColor(CHROME_ACCENT_CSS_VARIABLE);
|
|
105
109
|
ctx.strokeStyle = color;
|
|
106
110
|
ctx.fillStyle = color;
|
|
107
111
|
ctx.lineWidth = 3;
|
|
@@ -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: [],
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { hasGrouped } from '../../affine-gfx-shape/index.js';
|
|
2
2
|
import { LayoutType, MindmapElementModel, MindmapStyle, ShapeElementModel, } from '../../affine-model/index.js';
|
|
3
|
-
import { STYLE_MENU_LABEL, ToolbarModuleExtension, } from '../../affine-shared/services/index.js';
|
|
3
|
+
import { MENU_ARIA_STYLE, STYLE_MENU_LABEL, ToolbarModuleExtension, } from '../../affine-shared/services/index.js';
|
|
4
4
|
import { getMostCommonValue } from '../../affine-shared/utils/index.js';
|
|
5
5
|
import { renderMenu, } from '../../affine-widget-edgeless-toolbar/index.js';
|
|
6
|
-
import { MINDMAP_LAYOUT_LABEL, MINDMAP_LAYOUT_LEFT, MINDMAP_LAYOUT_RADIAL, MINDMAP_LAYOUT_RIGHT, } from '../translations.js';
|
|
6
|
+
import { MINDMAP_LAYOUT_LABEL, MINDMAP_LAYOUT_MENU_ARIA, MINDMAP_LAYOUT_LEFT, MINDMAP_LAYOUT_RADIAL, MINDMAP_LAYOUT_RIGHT, } from '../translations.js';
|
|
7
7
|
import { RadiantIcon, RightLayoutIcon, StyleIcon } from '@blocksuite/icons/lit';
|
|
8
8
|
import { BlockFlavourIdentifier } from '../../std/index.js';
|
|
9
9
|
import { MindmapStyleFour, MindmapStyleOne, MindmapStyleThree, MindmapStyleTwo, } from '../view/index.js';
|
|
@@ -58,6 +58,7 @@ export const createMindmapStyleActionMenu = (ctx, models) => {
|
|
|
58
58
|
return renderMenu({
|
|
59
59
|
label: 'Style',
|
|
60
60
|
labelWording: STYLE_MENU_LABEL,
|
|
61
|
+
menuAriaWording: MENU_ARIA_STYLE,
|
|
61
62
|
icon: StyleIcon(),
|
|
62
63
|
items: MINDMAP_STYLE_LIST,
|
|
63
64
|
currentValue: style,
|
|
@@ -77,6 +78,7 @@ export const createMindmapLayoutActionMenu = (ctx, models) => {
|
|
|
77
78
|
return renderMenu({
|
|
78
79
|
label: 'Layout',
|
|
79
80
|
labelWording: MINDMAP_LAYOUT_LABEL,
|
|
81
|
+
menuAriaWording: MINDMAP_LAYOUT_MENU_ARIA,
|
|
80
82
|
items: MINDMAP_LAYOUT_LIST,
|
|
81
83
|
currentValue: layoutType,
|
|
82
84
|
onPick,
|
|
@@ -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
|
*
|
|
@@ -57,6 +57,12 @@ export declare const MINDMAP_TEMPLATE_NAME_STYLE_2: ChromeWording;
|
|
|
57
57
|
export declare const MINDMAP_TEMPLATE_NAME_STYLE_3: ChromeWording;
|
|
58
58
|
export declare const MINDMAP_TEMPLATE_NAME_STYLE_4: ChromeWording;
|
|
59
59
|
export declare const MINDMAP_LAYOUT_LABEL: ChromeWording;
|
|
60
|
+
/**
|
|
61
|
+
* The accessible name of the layout menu SHELL (#390) — its own wording, not
|
|
62
|
+
* `` `${MINDMAP_LAYOUT_LABEL}-menu` ``, which read "disposition-menu" in
|
|
63
|
+
* French. The fallback is the exact identifier that composition produced.
|
|
64
|
+
*/
|
|
65
|
+
export declare const MINDMAP_LAYOUT_MENU_ARIA: ChromeWording;
|
|
60
66
|
/**
|
|
61
67
|
* The three layout directions — a different concept from `gfx/text`'s own
|
|
62
68
|
* "Left" / "Right" text alignment (`TEXT_ALIGN_LEFT`/`RIGHT`), so kept as
|
|
@@ -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
|
*
|
|
@@ -102,6 +102,15 @@ export const MINDMAP_LAYOUT_LABEL = [
|
|
|
102
102
|
'com.labre.mindmap.toolbar.layout',
|
|
103
103
|
'Layout',
|
|
104
104
|
];
|
|
105
|
+
/**
|
|
106
|
+
* The accessible name of the layout menu SHELL (#390) — its own wording, not
|
|
107
|
+
* `` `${MINDMAP_LAYOUT_LABEL}-menu` ``, which read "disposition-menu" in
|
|
108
|
+
* French. The fallback is the exact identifier that composition produced.
|
|
109
|
+
*/
|
|
110
|
+
export const MINDMAP_LAYOUT_MENU_ARIA = [
|
|
111
|
+
'com.labre.mindmap.toolbar.layout-menu',
|
|
112
|
+
'layout-menu',
|
|
113
|
+
];
|
|
105
114
|
/**
|
|
106
115
|
* The three layout directions — a different concept from `gfx/text`'s own
|
|
107
116
|
* "Left" / "Right" text alignment (`TEXT_ALIGN_LEFT`/`RIGHT`), so kept as
|
|
@@ -159,6 +168,7 @@ export const MINDMAP_CHROME_WORDINGS = [
|
|
|
159
168
|
MINDMAP_TEMPLATE_NAME_STYLE_3,
|
|
160
169
|
MINDMAP_TEMPLATE_NAME_STYLE_4,
|
|
161
170
|
MINDMAP_LAYOUT_LABEL,
|
|
171
|
+
MINDMAP_LAYOUT_MENU_ARIA,
|
|
162
172
|
MINDMAP_LAYOUT_LEFT,
|
|
163
173
|
MINDMAP_LAYOUT_RADIAL,
|
|
164
174
|
MINDMAP_LAYOUT_RIGHT,
|
|
@@ -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
|
}
|
|
@@ -59,10 +59,39 @@ export class PolygonDrawingOverlay extends ToolOverlay {
|
|
|
59
59
|
_effectiveStrokeColor() {
|
|
60
60
|
return this._strokeStyle === 'none' ? 'transparent' : this._strokeColor;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* The marker shown at the pointer while the tool is armed and empty: the same
|
|
64
|
+
* dot the first placed vertex gets, plus a light ring, so the promise the
|
|
65
|
+
* cursor makes is the shape the click keeps.
|
|
66
|
+
*/
|
|
67
|
+
_renderFirstVertexHint(ctx, [cx, cy]) {
|
|
68
|
+
const zoom = this.gfx.viewport.zoom;
|
|
69
|
+
ctx.beginPath();
|
|
70
|
+
ctx.arc(cx, cy, VERTEX_INDICATOR_RADIUS, 0, Math.PI * 2);
|
|
71
|
+
ctx.fillStyle = this._strokeColor;
|
|
72
|
+
ctx.fill();
|
|
73
|
+
ctx.beginPath();
|
|
74
|
+
ctx.arc(cx, cy, CLOSE_SNAP_INDICATOR_RADIUS / zoom, 0, Math.PI * 2);
|
|
75
|
+
ctx.strokeStyle = this._strokeColor;
|
|
76
|
+
ctx.lineWidth = 1.5 / zoom;
|
|
77
|
+
ctx.setLineDash([]);
|
|
78
|
+
ctx.globalAlpha = this.globalAlpha * 0.4;
|
|
79
|
+
ctx.stroke();
|
|
80
|
+
ctx.globalAlpha = this.globalAlpha;
|
|
81
|
+
}
|
|
62
82
|
render(ctx, _rc) {
|
|
63
83
|
const { vertices, cursorPos, isDrawing } = this;
|
|
64
84
|
ctx.globalAlpha = this.globalAlpha;
|
|
65
|
-
if (
|
|
85
|
+
if (vertices.length === 0) {
|
|
86
|
+
// Nothing is placed yet, so there is no outline to preview — but the tool
|
|
87
|
+
// IS armed, and until now the canvas said nothing about it. Marking where
|
|
88
|
+
// the next click would land a corner is what tells the author the board
|
|
89
|
+
// is waiting for a first vertex rather than ignoring the pointer.
|
|
90
|
+
if (cursorPos)
|
|
91
|
+
this._renderFirstVertexHint(ctx, cursorPos);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!isDrawing)
|
|
66
95
|
return;
|
|
67
96
|
const effectiveStroke = this._effectiveStrokeColor();
|
|
68
97
|
const strokeWidth = Math.max(this._strokeWidth, 1);
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import type { PointerEventState } from '../std/index.js';
|
|
2
2
|
import { BaseTool, type GfxController } from '../std/gfx/index.js';
|
|
3
|
-
export type PolygonToolOption =
|
|
3
|
+
export type PolygonToolOption = {
|
|
4
|
+
/**
|
|
5
|
+
* Props the activation stamps on the shape the closed outline produces — the
|
|
6
|
+
* same seam `ConnectorTool`'s `role` / `style` options are: a framework arms
|
|
7
|
+
* this tool to draw ITS artefact (a Wardley zone) rather than a plain
|
|
8
|
+
* polygon, so the element is born typed instead of being converted after the
|
|
9
|
+
* fact. Absent for the plain polygon tool, which keeps drawing a shape.
|
|
10
|
+
*
|
|
11
|
+
* Merged BEFORE the geometry: a framework's description of an artefact
|
|
12
|
+
* carries the box and the outline it would have been born with, and the
|
|
13
|
+
* outline the author just drew must win over both.
|
|
14
|
+
*/
|
|
15
|
+
props?: Record<string, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Called once the element exists, for the placement an element description
|
|
18
|
+
* cannot express — a Wardley zone has to be lowered to just above the map it
|
|
19
|
+
* covers, which depends on what is already on the board.
|
|
20
|
+
*/
|
|
21
|
+
onCreated?: (gfx: GfxController, id: string) => void;
|
|
22
|
+
};
|
|
4
23
|
/**
|
|
5
24
|
* PolygonTool allows users to draw arbitrary polygons by clicking to place
|
|
6
25
|
* vertices on the edgeless canvas. The polygon is finalised by either:
|
|
@@ -228,8 +228,15 @@ export class PolygonTool extends BaseTool {
|
|
|
228
228
|
const id = this.gfx.surface.addElement({
|
|
229
229
|
type: CanvasElementType.SHAPE,
|
|
230
230
|
shapeType: ShapeType.Polygon,
|
|
231
|
-
xywh: bound.serialize(),
|
|
232
231
|
radius: 0,
|
|
232
|
+
// What the activation asked for, if anything — it may change the element
|
|
233
|
+
// type itself, which is how a framework gets its own artefact out of this
|
|
234
|
+
// gesture. Spread here so the geometry below always wins: the props of a
|
|
235
|
+
// framework artefact describe the shape it would have been born with,
|
|
236
|
+
// outline included, and that outline is exactly what the author just
|
|
237
|
+
// replaced by drawing.
|
|
238
|
+
...this.activatedOption.props,
|
|
239
|
+
xywh: bound.serialize(),
|
|
233
240
|
vertices: normalizedVertices,
|
|
234
241
|
isClosed: true,
|
|
235
242
|
smoothFlags: smoothFlagsForModel,
|
|
@@ -237,6 +244,7 @@ export class PolygonTool extends BaseTool {
|
|
|
237
244
|
? { controlPoints: controlPointsForModel }
|
|
238
245
|
: {}),
|
|
239
246
|
});
|
|
247
|
+
this.activatedOption.onCreated?.(this.gfx, id);
|
|
240
248
|
this.std.getOptional(TelemetryProvider)?.track('CanvasElementAdded', {
|
|
241
249
|
control: 'canvas:draw',
|
|
242
250
|
page: 'whiteboard editor',
|
|
@@ -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 } from '../../affine-gfx-text/index.js';
|
|
4
4
|
import { DefaultTheme, FontFamily, getShapeName, getShapeRadius, getShapeType, isTransparent, LineWidth, MindmapElementModel, resolveColor, ShapeElementModel, ShapeStyle, ShapeType, StrokeStyle, TextFitMode, } from '../../affine-model/index.js';
|
|
5
|
-
import { STYLE_MENU_LABEL, ToolbarModuleExtension, translateKey, } from '../../affine-shared/services/index.js';
|
|
5
|
+
import { MENU_ARIA_STYLE, STYLE_MENU_LABEL, ToolbarModuleExtension, translateKey, } from '../../affine-shared/services/index.js';
|
|
6
6
|
import { 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';
|
|
@@ -15,7 +15,7 @@ import { ShapeElementView } from '../element-view.js';
|
|
|
15
15
|
import { applyTextFitMode, nextTextFitMode } from '../text-fit.js';
|
|
16
16
|
import { mountShapeTextEditor } from '../text/edgeless-shape-text-editor.js';
|
|
17
17
|
import { ShapeComponentConfig } from './shape-menu-config.js';
|
|
18
|
-
import { SHAPE_ADD_TEXT_TOOLTIP, SHAPE_EDIT_VERTICES_TOOLTIP, SHAPE_SWITCH_TYPE_LABEL, SHAPE_TEXT_FIT_ARIA, SHAPE_TEXT_FIT_CONTAINED, SHAPE_TEXT_FIT_GROW, SHAPE_TEXT_FIT_OVERFLOW, SHAPE_TEXT_FIT_TOOLTIP, } from '../translations.js';
|
|
18
|
+
import { SHAPE_ADD_TEXT_TOOLTIP, SHAPE_EDIT_VERTICES_TOOLTIP, SHAPE_SWITCH_TYPE_LABEL, SHAPE_SWITCH_TYPE_MENU_ARIA, SHAPE_TEXT_FIT_ARIA, SHAPE_TEXT_FIT_CONTAINED, SHAPE_TEXT_FIT_GROW, SHAPE_TEXT_FIT_OVERFLOW, SHAPE_TEXT_FIT_TOOLTIP, } from '../translations.js';
|
|
19
19
|
/** Icon + wording per text fit mode for the cycling toolbar button. */
|
|
20
20
|
const TEXT_FIT_UI = {
|
|
21
21
|
[TextFitMode.Grow]: { icon: AutoHeightIcon(), wording: SHAPE_TEXT_FIT_GROW },
|
|
@@ -60,6 +60,7 @@ export const shapeToolbarConfig = {
|
|
|
60
60
|
icon: ShapeIcon(),
|
|
61
61
|
label: 'Switch shape type',
|
|
62
62
|
labelWording: SHAPE_SWITCH_TYPE_LABEL,
|
|
63
|
+
menuAriaWording: SHAPE_SWITCH_TYPE_MENU_ARIA,
|
|
63
64
|
items: ShapeComponentConfig.map(item => ({
|
|
64
65
|
key: item.tooltip,
|
|
65
66
|
keyWording: item.tooltipWording,
|
|
@@ -96,6 +97,7 @@ export const shapeToolbarConfig = {
|
|
|
96
97
|
return renderMenu({
|
|
97
98
|
label: 'Style',
|
|
98
99
|
labelWording: STYLE_MENU_LABEL,
|
|
100
|
+
menuAriaWording: MENU_ARIA_STYLE,
|
|
99
101
|
items: LINE_STYLE_LIST,
|
|
100
102
|
currentValue: shapeStyle === ShapeStyle.Scribbled,
|
|
101
103
|
onPick,
|
|
@@ -192,11 +194,16 @@ export const shapeToolbarConfig = {
|
|
|
192
194
|
.updateElement(model.id, { strokeStyle });
|
|
193
195
|
}
|
|
194
196
|
};
|
|
197
|
+
// The base palette, plus a page per framework whose tooling is on —
|
|
198
|
+
// opening on the one the selection belongs to (`docs/adr/0027`).
|
|
199
|
+
const carousel = frameworkPaletteGroups(ctx.std, models, DefaultTheme.Palettes);
|
|
195
200
|
return html `
|
|
196
201
|
<edgeless-shape-color-picker
|
|
197
202
|
@pickFillColor=${onPickFillColor}
|
|
198
203
|
@pickStrokeColor=${onPickStrokeColor}
|
|
199
204
|
@pickStrokeStyle=${onPickStrokeStyle}
|
|
205
|
+
.paletteGroups=${carousel.groups}
|
|
206
|
+
.activeGroupKey=${carousel.activeKey}
|
|
200
207
|
.payload=${{
|
|
201
208
|
fillColor,
|
|
202
209
|
strokeColor,
|
|
@@ -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 { DefaultTheme, isTransparent, LineWidth, resolveColor, ShapeElementModel, StrokeStyle, } from '../../affine-model/index.js';
|
|
4
4
|
import { getMostCommonValue } from '../../affine-shared/utils/index.js';
|
|
5
5
|
import { html } from 'lit';
|
|
@@ -99,12 +99,22 @@ export function paletteColorAction(id, palettes, fillColorFor = (_model, value)
|
|
|
99
99
|
crud.updateElement(model.id, props);
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
|
+
// The carousel: the editor palette, then a page per framework whose
|
|
103
|
+
// tooling is on. A Wardley node resolves to `wardley` and therefore
|
|
104
|
+
// OPENS on the very swatches `palettes` holds, since the framework
|
|
105
|
+
// registers that same list (`docs/adr/0027`). With its flag off the
|
|
106
|
+
// framework contributes no page and the picker opens on the editor
|
|
107
|
+
// palette — a palette is tooling (`docs/adr/0009`), the colour already
|
|
108
|
+
// stored is not and does not move.
|
|
109
|
+
const carousel = frameworkPaletteGroups(ctx.std, models, DefaultTheme.Palettes);
|
|
102
110
|
return html `
|
|
103
111
|
<edgeless-shape-color-picker
|
|
104
112
|
@pickFillColor=${onPickFillColor}
|
|
105
113
|
@pickStrokeColor=${onPickStrokeColor}
|
|
106
114
|
@pickStrokeStyle=${onPickStrokeStyle}
|
|
107
115
|
.palettes=${palettes}
|
|
116
|
+
.paletteGroups=${carousel.groups}
|
|
117
|
+
.activeGroupKey=${carousel.activeKey}
|
|
108
118
|
.payload=${{
|
|
109
119
|
fillColor,
|
|
110
120
|
strokeColor,
|
|
@@ -21,6 +21,13 @@ export declare const SHAPE_TEXT_FIT_OVERFLOW: ChromeWording;
|
|
|
21
21
|
export declare const SHAPE_TEXT_FIT_ARIA: ChromeWording;
|
|
22
22
|
export declare const SHAPE_TEXT_FIT_TOOLTIP: ChromeWording;
|
|
23
23
|
export declare const SHAPE_SWITCH_TYPE_LABEL: ChromeWording;
|
|
24
|
+
/**
|
|
25
|
+
* The accessible name of the shape-type menu SHELL (#390) — its own wording,
|
|
26
|
+
* not `` `${SHAPE_SWITCH_TYPE_LABEL}-menu` ``, which is what produced
|
|
27
|
+
* "changer le type de forme-menu" on a French host. The fallback is the exact
|
|
28
|
+
* identifier that composition produced in English.
|
|
29
|
+
*/
|
|
30
|
+
export declare const SHAPE_SWITCH_TYPE_MENU_ARIA: ChromeWording;
|
|
24
31
|
export declare const SHAPE_ADD_TEXT_TOOLTIP: ChromeWording;
|
|
25
32
|
export declare const SHAPE_EDIT_VERTICES_TOOLTIP: ChromeWording;
|
|
26
33
|
export declare const SHAPE_NAME_SQUARE: ChromeWording;
|
|
@@ -41,6 +41,16 @@ export const SHAPE_SWITCH_TYPE_LABEL = [
|
|
|
41
41
|
'com.labre.shape.toolbar.switch-type',
|
|
42
42
|
'Switch shape type',
|
|
43
43
|
];
|
|
44
|
+
/**
|
|
45
|
+
* The accessible name of the shape-type menu SHELL (#390) — its own wording,
|
|
46
|
+
* not `` `${SHAPE_SWITCH_TYPE_LABEL}-menu` ``, which is what produced
|
|
47
|
+
* "changer le type de forme-menu" on a French host. The fallback is the exact
|
|
48
|
+
* identifier that composition produced in English.
|
|
49
|
+
*/
|
|
50
|
+
export const SHAPE_SWITCH_TYPE_MENU_ARIA = [
|
|
51
|
+
'com.labre.shape.toolbar.switch-type-menu',
|
|
52
|
+
'switch shape type-menu',
|
|
53
|
+
];
|
|
44
54
|
export const SHAPE_ADD_TEXT_TOOLTIP = ADD_TEXT_TOOLTIP;
|
|
45
55
|
export const SHAPE_EDIT_VERTICES_TOOLTIP = [
|
|
46
56
|
'com.labre.shape.toolbar.edit-vertices',
|
|
@@ -83,6 +93,7 @@ export const SHAPE_WORDINGS = [
|
|
|
83
93
|
SHAPE_TEXT_FIT_ARIA,
|
|
84
94
|
SHAPE_TEXT_FIT_TOOLTIP,
|
|
85
95
|
SHAPE_SWITCH_TYPE_LABEL,
|
|
96
|
+
SHAPE_SWITCH_TYPE_MENU_ARIA,
|
|
86
97
|
SHAPE_EDIT_VERTICES_TOOLTIP,
|
|
87
98
|
SHAPE_NAME_SQUARE,
|
|
88
99
|
SHAPE_NAME_ELLIPSE,
|
|
@@ -2,7 +2,7 @@ import { ConnectorMode, FontFamily, FontWeight, PointStyle, ShapeStyle, StrokeSt
|
|
|
2
2
|
import { NOTATION_NEUTRALS } from '../../affine-shared/consts/index.js';
|
|
3
3
|
import { fillPlaceholders, translateKey, } from '../../affine-shared/services/index.js';
|
|
4
4
|
import { makeTemplateSnapshot, surfaceText, } from '../make-snapshot.js';
|
|
5
|
-
import { BMC_SEED_CHANNELS, BMC_SEED_COST_STRUCTURE, BMC_SEED_CUSTOMER_RELATIONSHIPS, BMC_SEED_CUSTOMER_SEGMENTS, BMC_SEED_DATE, BMC_SEED_DESIGNED_BY, BMC_SEED_DESIGNED_FOR, BMC_SEED_KEY_ACTIVITIES, BMC_SEED_KEY_PARTNERSHIPS, BMC_SEED_KEY_RESOURCES, BMC_SEED_REVENUE_STREAMS, BMC_SEED_TITLE, BMC_SEED_VALUE_PROPOSITIONS, BMC_SEED_VERSION, FISHBONE_SEED_CATEGORY, FISHBONE_SEED_EFFECT, FISHBONE_SEED_ITEM_1, FISHBONE_SEED_ITEM_2, GANTT_SEED_BUILD, GANTT_SEED_DESIGN, GANTT_SEED_DISCOVERY, GANTT_SEED_LAUNCH, GANTT_SEED_WEEK, KANBAN_SEED_CARD, KANBAN_SEED_DOING, KANBAN_SEED_DONE, KANBAN_SEED_TODO, SWOT_SEED_OPPORTUNITIES, SWOT_SEED_STRENGTHS, SWOT_SEED_THREATS, SWOT_SEED_WEAKNESSES, TEMPLATE_PANEL_CATEGORY_OTHER, } from '../translations.js';
|
|
5
|
+
import { BMC_SEED_CHANNELS, BMC_SEED_COST_STRUCTURE, BMC_SEED_CUSTOMER_RELATIONSHIPS, BMC_SEED_CUSTOMER_SEGMENTS, BMC_SEED_DATE, BMC_SEED_DESIGNED_BY, BMC_SEED_DESIGNED_FOR, BMC_SEED_KEY_ACTIVITIES, BMC_SEED_KEY_PARTNERSHIPS, BMC_SEED_KEY_RESOURCES, BMC_SEED_REVENUE_STREAMS, BMC_SEED_TITLE, BMC_SEED_VALUE_PROPOSITIONS, BMC_SEED_VERSION, FISHBONE_SEED_CATEGORY, FISHBONE_SEED_EFFECT, FISHBONE_SEED_ITEM_1, FISHBONE_SEED_ITEM_2, GANTT_SEED_BUILD, GANTT_SEED_DESIGN, GANTT_SEED_DISCOVERY, GANTT_SEED_LAUNCH, GANTT_SEED_WEEK, KANBAN_SEED_CARD, KANBAN_SEED_DOING, KANBAN_SEED_DONE, KANBAN_SEED_TODO, SWOT_SEED_OPPORTUNITIES, SWOT_SEED_STRENGTHS, SWOT_SEED_THREATS, SWOT_SEED_WEAKNESSES, TEMPLATE_NAME_BUSINESS_MODEL_CANVAS, TEMPLATE_NAME_FISHBONE, TEMPLATE_NAME_GANTT_CHART, TEMPLATE_NAME_KANBAN_BOARD, TEMPLATE_NAME_SWOT, TEMPLATE_PANEL_CATEGORY_OTHER, } from '../translations.js';
|
|
6
6
|
/**
|
|
7
7
|
* The generic ("Other") diagrams: built ONLY from general BlockSuite shapes
|
|
8
8
|
* (`shape` rect/polygon, `text`, `connector`) per the composition principle —
|
|
@@ -258,12 +258,18 @@ const previews = {
|
|
|
258
258
|
/**
|
|
259
259
|
* A hand-composed template — what is left once the artefacts are derived. The
|
|
260
260
|
* seeds a template writes into the document go through the translation seam
|
|
261
|
-
* at placement (ADR
|
|
261
|
+
* at placement (ADR 0023); `content` stays the English build, and `localize`
|
|
262
262
|
* rebuilds the same snapshot with translated seeds.
|
|
263
263
|
*/
|
|
264
|
-
function t(
|
|
264
|
+
function t(nameWording, preview, build) {
|
|
265
|
+
const [nameKey, name] = nameWording;
|
|
265
266
|
return {
|
|
266
267
|
name,
|
|
268
|
+
// `resolveTemplateName` reads this FIRST: nothing here derives from a
|
|
269
|
+
// command, so the tile's own key is the only way a host translates it
|
|
270
|
+
// (#390). `name` stays the stable English identity (drag payload, cache
|
|
271
|
+
// key) and doubles as the fallback.
|
|
272
|
+
nameKey,
|
|
267
273
|
type: 'template',
|
|
268
274
|
preview,
|
|
269
275
|
content: makeTemplateSnapshot(build(), name),
|
|
@@ -274,10 +280,10 @@ export const otherTemplateCategory = {
|
|
|
274
280
|
name: 'Other',
|
|
275
281
|
nameKey: TEMPLATE_PANEL_CATEGORY_OTHER[0],
|
|
276
282
|
templates: [
|
|
277
|
-
t(
|
|
278
|
-
t(
|
|
279
|
-
t(
|
|
280
|
-
t(
|
|
281
|
-
t(
|
|
283
|
+
t(TEMPLATE_NAME_SWOT, previews.swot, swot),
|
|
284
|
+
t(TEMPLATE_NAME_KANBAN_BOARD, previews.kanban, kanban),
|
|
285
|
+
t(TEMPLATE_NAME_BUSINESS_MODEL_CANVAS, previews.bmc, bmc),
|
|
286
|
+
t(TEMPLATE_NAME_FISHBONE, previews.fishbone, fishbone),
|
|
287
|
+
t(TEMPLATE_NAME_GANTT_CHART, previews.gantt, gantt),
|
|
282
288
|
],
|
|
283
289
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TranslationProvider } from '../affine-shared/services/index.js';
|
|
1
|
+
import { recordAction } from '../affine-block-surface/index.js';
|
|
3
2
|
import { Bound } from '../global/gfx/index.js';
|
|
4
|
-
import { generateKeyBetween, GfxControllerIdentifier } from '../std/gfx/index.js';
|
|
5
3
|
import * as Y from 'yjs';
|
|
6
4
|
import { makeTemplateSnapshot, surfaceText, surfaceYMap, } from './make-snapshot.js';
|
|
7
5
|
/**
|
|
@@ -35,124 +33,39 @@ function materialize(text) {
|
|
|
35
33
|
* the action writes its English fallbacks.
|
|
36
34
|
*/
|
|
37
35
|
export function snapshotFromAction(run, name, host) {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
let lastIndex = null;
|
|
41
|
-
const nextIndex = () => (lastIndex = generateKeyBetween(lastIndex, null));
|
|
42
|
-
const addElement = (props) => {
|
|
43
|
-
const id = `el-${n++}`;
|
|
44
|
-
const record = {};
|
|
45
|
-
for (const [key, value] of Object.entries(props)) {
|
|
46
|
-
if (value !== undefined)
|
|
47
|
-
record[key] = value;
|
|
48
|
-
}
|
|
49
|
-
record['id'] = id;
|
|
50
|
-
// ponytail: the Y conversions are hard-coded (`text`, and a group's
|
|
51
|
-
// `children` / `title`) instead of asking each element class for its own
|
|
52
|
-
// `propsToY`. Ceiling: it covers every prop the framework actions pass
|
|
53
|
-
// today. Upgrade path: run the real `propsToY` once the element-ctor map is
|
|
54
|
-
// reachable without a live surface.
|
|
55
|
-
const text = record['text'];
|
|
56
|
-
if (typeof text === 'string')
|
|
57
|
-
record['text'] = surfaceText(text);
|
|
58
|
-
else if (text instanceof Y.Text)
|
|
59
|
-
record['text'] = surfaceText(materialize(text));
|
|
60
|
-
if (record['type'] === 'group') {
|
|
61
|
-
const children = record['children'];
|
|
62
|
-
if (children && typeof children === 'object') {
|
|
63
|
-
record['children'] = surfaceYMap(Object.fromEntries(Object.keys(children).map(key => [key, true])));
|
|
64
|
-
}
|
|
65
|
-
const title = record['title'];
|
|
66
|
-
if (typeof title === 'string')
|
|
67
|
-
record['title'] = surfaceText(title);
|
|
68
|
-
else if (title instanceof Y.Text)
|
|
69
|
-
record['title'] = surfaceText(materialize(title));
|
|
70
|
-
}
|
|
71
|
-
if (record['index'] === undefined)
|
|
72
|
-
record['index'] = nextIndex();
|
|
73
|
-
// The model members an action reads back off `getElementById`, kept
|
|
74
|
-
// non-enumerable so they never leak into the snapshot.
|
|
75
|
-
Object.defineProperties(record, {
|
|
76
|
-
group: { value: null },
|
|
77
|
-
deserializedXYWH: {
|
|
78
|
-
get: () => typeof record['xywh'] === 'string'
|
|
79
|
-
? Bound.deserialize(record['xywh'])
|
|
80
|
-
: null,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
elements.set(id, record);
|
|
84
|
-
return id;
|
|
85
|
-
};
|
|
86
|
-
const records = () => [...elements.values()];
|
|
87
|
-
const surface = {
|
|
88
|
-
addElement,
|
|
89
|
-
getElementById: (id) => elements.get(id) ?? null,
|
|
90
|
-
getElementsByType: (type) => records().filter(el => el['type'] === type),
|
|
91
|
-
get elementModels() {
|
|
92
|
-
return records();
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
const gfx = {
|
|
96
|
-
surface,
|
|
97
|
-
viewport: { centerX: 0, centerY: 0, zoom: 1, center: { x: 0, y: 0 } },
|
|
98
|
-
doc: { captureSync: () => { } },
|
|
99
|
-
selection: { set: () => { }, selectedElements: [] },
|
|
100
|
-
tool: { setTool: () => { } },
|
|
101
|
-
layer: {
|
|
102
|
-
generateIndex: () => nextIndex(),
|
|
103
|
-
getReorderedIndex: (_model, direction) => {
|
|
104
|
-
const sorted = records()
|
|
105
|
-
.map(el => String(el['index']))
|
|
106
|
-
.sort();
|
|
107
|
-
return direction === 'back'
|
|
108
|
-
? generateKeyBetween(null, sorted[0] ?? null)
|
|
109
|
-
: generateKeyBetween(sorted[sorted.length - 1] ?? null, null);
|
|
110
|
-
},
|
|
111
|
-
get canvasElements() {
|
|
112
|
-
return records();
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
std: null,
|
|
116
|
-
};
|
|
117
|
-
const crud = {
|
|
118
|
-
addElement: (type, props) => addElement({ ...props, type }),
|
|
119
|
-
};
|
|
120
|
-
const std = {
|
|
121
|
-
get: (identifier) => {
|
|
122
|
-
if (identifier === GfxControllerIdentifier)
|
|
123
|
-
return gfx;
|
|
124
|
-
if (identifier === EdgelessCRUDIdentifier)
|
|
125
|
-
return crud;
|
|
126
|
-
throw new Error(`snapshotFromAction: unsupported service "${identifier?.identifierName ?? String(identifier)}"`);
|
|
127
|
-
},
|
|
128
|
-
getOptional: (identifier) => identifier === TranslationProvider
|
|
129
|
-
? host?.getOptional(TranslationProvider)
|
|
130
|
-
: undefined,
|
|
131
|
-
command: {
|
|
132
|
-
// Really run the command, so a group built by `createGroupCommand` is
|
|
133
|
-
// whatever that command says a group is — no second definition here.
|
|
134
|
-
exec: (cmd, payload) => {
|
|
135
|
-
let out;
|
|
136
|
-
cmd({ std: gfx.std, ...payload }, r => {
|
|
137
|
-
out = r;
|
|
138
|
-
});
|
|
139
|
-
return [{}, out ?? {}];
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
store: {
|
|
143
|
-
readonly: false,
|
|
144
|
-
captureSync: () => { },
|
|
145
|
-
id: 'doc:template',
|
|
146
|
-
workspace: { meta: { getDocMeta: () => undefined } },
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
gfx.std = std;
|
|
150
|
-
run(gfx.std);
|
|
151
|
-
if (elements.size === 0) {
|
|
36
|
+
const { records } = recordAction(run, { host, encode: toSnapshotProps });
|
|
37
|
+
if (records.length === 0) {
|
|
152
38
|
throw new Error('snapshotFromAction: the action added no element (a tool-arming command?)');
|
|
153
39
|
}
|
|
154
|
-
normalizeToOrigin(records
|
|
155
|
-
return makeTemplateSnapshot(Object.fromEntries(
|
|
40
|
+
normalizeToOrigin(records);
|
|
41
|
+
return makeTemplateSnapshot(Object.fromEntries(records.map(record => [String(record['id']), record])), name);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The Y-carrying props, in the serialized form a snapshot holds them in.
|
|
45
|
+
*
|
|
46
|
+
* ponytail: the conversions are hard-coded (`text`, and a group's `children` /
|
|
47
|
+
* `title`) instead of asking each element class for its own `propsToY`.
|
|
48
|
+
* Ceiling: it covers every prop the framework actions pass today. Upgrade path:
|
|
49
|
+
* run the real `propsToY` once the element-ctor map is reachable without a live
|
|
50
|
+
* surface.
|
|
51
|
+
*/
|
|
52
|
+
function toSnapshotProps(record) {
|
|
53
|
+
const text = record['text'];
|
|
54
|
+
if (typeof text === 'string')
|
|
55
|
+
record['text'] = surfaceText(text);
|
|
56
|
+
else if (text instanceof Y.Text)
|
|
57
|
+
record['text'] = surfaceText(materialize(text));
|
|
58
|
+
if (record['type'] === 'group') {
|
|
59
|
+
const children = record['children'];
|
|
60
|
+
if (children && typeof children === 'object') {
|
|
61
|
+
record['children'] = surfaceYMap(Object.fromEntries(Object.keys(children).map(key => [key, true])));
|
|
62
|
+
}
|
|
63
|
+
const title = record['title'];
|
|
64
|
+
if (typeof title === 'string')
|
|
65
|
+
record['title'] = surfaceText(title);
|
|
66
|
+
else if (title instanceof Y.Text)
|
|
67
|
+
record['title'] = surfaceText(materialize(title));
|
|
68
|
+
}
|
|
156
69
|
}
|
|
157
70
|
/** The connector endpoints that carry a free position rather than an anchor. */
|
|
158
71
|
function freeEndpoints(el) {
|
|
@@ -22,7 +22,7 @@ export class AffineTemplateLoading extends LitElement {
|
|
|
22
22
|
height: 20px;
|
|
23
23
|
position: relative;
|
|
24
24
|
background: conic-gradient(
|
|
25
|
-
|
|
25
|
+
var(--affine-primary-color) 90deg,
|
|
26
26
|
rgba(0, 0, 0, 0.1) 90deg 360deg
|
|
27
27
|
);
|
|
28
28
|
border-radius: 50%;
|
|
@@ -46,7 +46,7 @@ export type Template = {
|
|
|
46
46
|
* Rebuild {@link content} in the inserting editor's language — the seeds a
|
|
47
47
|
* template writes into the document (a component's name, a lane's title) go
|
|
48
48
|
* through the translation seam at placement, like a creation action's
|
|
49
|
-
* (ADR
|
|
49
|
+
* (ADR 0023). Called once per insertion; without it `content` is inserted
|
|
50
50
|
* as is.
|
|
51
51
|
*
|
|
52
52
|
* With no `TranslationProvider` registered it must return exactly
|
|
@@ -20,6 +20,11 @@ export declare const TEMPLATE_PANEL_SEARCH_PLACEHOLDER: ChromeWording;
|
|
|
20
20
|
export declare const TEMPLATE_PANEL_CATEGORY_OTHER: ChromeWording;
|
|
21
21
|
/** The "Template" senior tool's own button name (`SeniorTool.labelKey`). */
|
|
22
22
|
export declare const TEMPLATE_SENIOR_TOOL_NAME: ChromeWording;
|
|
23
|
+
export declare const TEMPLATE_NAME_SWOT: ChromeWording;
|
|
24
|
+
export declare const TEMPLATE_NAME_KANBAN_BOARD: ChromeWording;
|
|
25
|
+
export declare const TEMPLATE_NAME_BUSINESS_MODEL_CANVAS: ChromeWording;
|
|
26
|
+
export declare const TEMPLATE_NAME_FISHBONE: ChromeWording;
|
|
27
|
+
export declare const TEMPLATE_NAME_GANTT_CHART: ChromeWording;
|
|
23
28
|
export declare const TEMPLATE_PACKAGE_WORDINGS: readonly ChromeWording[];
|
|
24
29
|
/**
|
|
25
30
|
* The generic ("Other") diagrams' own seeds: the captions painted onto the
|