@formicoidea/labre-core 0.43.1 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_pkgs/affine-block-attachment/utils.js +4 -0
- package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +17 -4
- package/dist/_pkgs/affine-block-callout/commands/turn-callout-into.d.ts +43 -0
- package/dist/_pkgs/affine-block-callout/commands/turn-callout-into.js +109 -0
- package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.d.ts +29 -0
- package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.js +81 -0
- package/dist/_pkgs/affine-block-callout/configs/slash-menu.js +6 -4
- package/dist/_pkgs/affine-block-callout/configs/toolbar.d.ts +65 -0
- package/dist/_pkgs/affine-block-callout/configs/toolbar.js +178 -0
- package/dist/_pkgs/affine-block-callout/configs/turn-into.d.ts +8 -0
- package/dist/_pkgs/affine-block-callout/configs/turn-into.js +19 -0
- package/dist/_pkgs/affine-block-callout/translations.d.ts +4 -2
- package/dist/_pkgs/affine-block-callout/translations.js +4 -2
- package/dist/_pkgs/affine-block-callout/view.js +10 -1
- package/dist/_pkgs/affine-block-code/code-block-service.d.ts +13 -0
- package/dist/_pkgs/affine-block-code/code-block-service.js +26 -0
- package/dist/_pkgs/affine-block-code/code-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-code/code-block.js +11 -2
- package/dist/_pkgs/affine-block-code/code-toolbar/components/lang-button.js +31 -8
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.d.ts +11 -0
- package/dist/_pkgs/affine-block-edgeless-text/svg-painter.d.ts +20 -0
- package/dist/_pkgs/affine-block-edgeless-text/svg-painter.js +76 -0
- package/dist/_pkgs/affine-block-edgeless-text/view.js +2 -0
- package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-edgeless-linked-doc-block.js +3 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +7 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-edgeless-synced-doc-block.js +3 -1
- package/dist/_pkgs/affine-block-frame/commands.d.ts +27 -0
- package/dist/_pkgs/affine-block-frame/commands.js +49 -0
- package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +16 -6
- package/dist/_pkgs/affine-block-frame/frame-manager.js +58 -22
- package/dist/_pkgs/affine-block-frame/frame-order.d.ts +43 -0
- package/dist/_pkgs/affine-block-frame/frame-order.js +93 -0
- package/dist/_pkgs/affine-block-frame/frame-tool.js +3 -1
- package/dist/_pkgs/affine-block-frame/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-frame/index.js +2 -0
- package/dist/_pkgs/affine-block-frame/present/frame-order-menu.d.ts +10 -2
- package/dist/_pkgs/affine-block-frame/present/frame-order-menu.js +32 -18
- package/dist/_pkgs/affine-block-frame/view.js +6 -0
- package/dist/_pkgs/affine-block-image/utils.js +4 -1
- package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.d.ts +8 -0
- package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.js +9 -5
- package/dist/_pkgs/affine-block-note/configs/toolbar.d.ts +19 -0
- package/dist/_pkgs/affine-block-note/configs/toolbar.js +38 -23
- package/dist/_pkgs/affine-block-note/translations.d.ts +2 -1
- package/dist/_pkgs/affine-block-note/translations.js +14 -6
- package/dist/_pkgs/affine-block-root/configs/toolbar.js +48 -3
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/clipboard.js +2 -1
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/command.js +161 -83
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.d.ts +21 -0
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.js +85 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +18 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +9 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +28 -0
- package/dist/_pkgs/affine-block-root/keyboard/commands.js +9 -6
- package/dist/_pkgs/affine-block-root/preview/edgeless-root-preview-block.js +15 -2
- package/dist/_pkgs/affine-block-root/translations.d.ts +7 -2
- package/dist/_pkgs/affine-block-root/translations.js +10 -13
- package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.d.ts +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/audit.js +13 -61
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.js +71 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/clipboard-config.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +27 -7
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +2 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +22 -3
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +6 -3
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +4 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.d.ts +63 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.js +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +62 -5
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +98 -18
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +14 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +82 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +112 -10
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.d.ts +13 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.js +33 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +13 -6
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +26 -10
- package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +82 -6
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +99 -21
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.d.ts +91 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.js +285 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.d.ts +80 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.js +355 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.d.ts +137 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.js +323 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +112 -4
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +86 -15
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.d.ts +76 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.js +299 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.d.ts +20 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.js +34 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.d.ts +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.js +172 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.d.ts +40 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.js +69 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.d.ts +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.js +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.d.ts +10 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.js +14 -0
- package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +55 -2
- package/dist/_pkgs/affine-block-surface/framework-background/facts.js +63 -1
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +16 -8
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +26 -14
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +17 -3
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.d.ts +3 -1
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +22 -2
- package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.d.ts +30 -0
- package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.js +29 -0
- package/dist/_pkgs/affine-block-surface/surface-block.js +6 -0
- package/dist/_pkgs/affine-block-surface/surface-model.js +5 -0
- package/dist/_pkgs/affine-block-surface/surface-transformer.js +5 -0
- package/dist/_pkgs/affine-block-surface/tool/default-tool.js +28 -5
- package/dist/_pkgs/affine-block-surface/view.js +23 -1
- package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
- package/dist/_pkgs/affine-components/context-menu/button.js +14 -0
- package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
- package/dist/_pkgs/affine-components/icons/index.d.ts +0 -1
- package/dist/_pkgs/affine-components/icons/index.js +0 -1
- package/dist/_pkgs/affine-components/icons/text.d.ts +1 -0
- package/dist/_pkgs/affine-components/icons/text.js +11 -0
- package/dist/_pkgs/affine-components/portal/portal.d.ts +1 -1
- package/dist/_pkgs/affine-foundation/view.d.ts +8 -8
- package/dist/_pkgs/affine-fragment-adapter-panel/adapter-panel.d.ts +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.d.ts +34 -2
- package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.js +194 -81
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.d.ts +7 -4
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +9 -24
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.d.ts +1 -1
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +8 -27
- package/dist/_pkgs/affine-fragment-frame-panel/index.d.ts +2 -0
- package/dist/_pkgs/affine-fragment-frame-panel/index.js +2 -0
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +3 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +21 -4
- package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +3 -2
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-gfx-group/command/group-api.js +52 -1
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +21 -3
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +2 -0
- package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-gfx-template/services/template-middlewares.d.ts +9 -0
- package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +23 -1
- package/dist/_pkgs/affine-gfx-template/services/template.js +2 -1
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +2 -1
- package/dist/_pkgs/affine-gfx-text/element-renderer/index.js +20 -3
- package/dist/_pkgs/affine-gfx-text/element-renderer/utils.d.ts +67 -1
- package/dist/_pkgs/affine-gfx-text/element-renderer/utils.js +101 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +53 -2
- package/dist/_pkgs/affine-gfx-text/toolbar/config.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +31 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.d.ts +4 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.js +14 -0
- package/dist/_pkgs/affine-inline-preset/command/config.js +21 -3
- package/dist/_pkgs/affine-inline-preset/command/index.d.ts +1 -1
- package/dist/_pkgs/affine-inline-preset/command/index.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/text-style.d.ts +2 -1
- package/dist/_pkgs/affine-inline-preset/command/text-style.js +1 -0
- package/dist/_pkgs/affine-inline-preset/default-inline-manager.js +2 -1
- package/dist/_pkgs/affine-inline-preset/inline-spec.d.ts +4 -0
- package/dist/_pkgs/affine-inline-preset/inline-spec.js +14 -0
- package/dist/_pkgs/affine-inline-preset/translations.d.ts +2 -2
- package/dist/_pkgs/affine-inline-preset/translations.js +2 -2
- package/dist/_pkgs/affine-model/blocks/attachment/attachment-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/bookmark/bookmark-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.d.ts +1 -1
- package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/embed/iframe/iframe-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/frame/frame-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/latex/latex-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/note/note-model.js +2 -0
- package/dist/_pkgs/affine-model/consts/text.d.ts +26 -0
- package/dist/_pkgs/affine-model/consts/text.js +25 -0
- package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +6 -1
- package/dist/_pkgs/affine-model/elements/shape/shape.js +14 -1
- package/dist/_pkgs/affine-model/elements/text/text.d.ts +6 -1
- package/dist/_pkgs/affine-model/elements/text/text.js +13 -1
- package/dist/_pkgs/affine-model/utils/helper.js +2 -0
- package/dist/_pkgs/affine-model/utils/types.d.ts +2 -2
- package/dist/_pkgs/affine-rich-text/conversion.d.ts +25 -0
- package/dist/_pkgs/affine-rich-text/conversion.js +9 -0
- package/dist/_pkgs/affine-rich-text/index.d.ts +1 -1
- package/dist/_pkgs/affine-rich-text/index.js +1 -1
- package/dist/_pkgs/affine-shared/commands/model-crud/replace-selected-text-with-blocks.d.ts +1 -1
- package/dist/_pkgs/affine-shared/services/canvas-grid.d.ts +63 -0
- package/dist/_pkgs/affine-shared/services/canvas-grid.js +109 -0
- package/dist/_pkgs/affine-shared/services/canvas-local-visibility.d.ts +64 -0
- package/dist/_pkgs/affine-shared/services/canvas-local-visibility.js +192 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +31 -4
- package/dist/_pkgs/affine-shared/services/edit-props-store.js +34 -0
- package/dist/_pkgs/affine-shared/services/editor-setting-service.d.ts +3 -0
- package/dist/_pkgs/affine-shared/services/editor-setting-service.js +7 -0
- package/dist/_pkgs/affine-shared/services/feature-flag-service.d.ts +4 -0
- package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/font-loader/font-loader-service.d.ts +3 -3
- package/dist/_pkgs/affine-shared/services/index.d.ts +4 -1
- package/dist/_pkgs/affine-shared/services/index.js +4 -1
- package/dist/_pkgs/affine-shared/services/link-preview-service/link-preview-storage.d.ts +4 -4
- package/dist/_pkgs/affine-shared/services/outline-panel-service.d.ts +31 -0
- package/dist/_pkgs/affine-shared/services/outline-panel-service.js +17 -0
- package/dist/_pkgs/affine-shared/services/selection-pane-service.d.ts +44 -0
- package/dist/_pkgs/affine-shared/services/selection-pane-service.js +28 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +69 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +16 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +28 -0
- 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/panel-header.d.ts +31 -0
- package/dist/_pkgs/affine-shared/styles/panel-header.js +61 -0
- package/dist/_pkgs/affine-shared/styles/text.js +7 -7
- package/dist/_pkgs/affine-shared/types/index.d.ts +6 -0
- package/dist/_pkgs/affine-shared/utils/canvas-export-colors.d.ts +26 -0
- package/dist/_pkgs/affine-shared/utils/canvas-export-colors.js +127 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +8 -11
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +8 -11
- package/dist/_pkgs/affine-shared/utils/index.d.ts +3 -0
- package/dist/_pkgs/affine-shared/utils/index.js +3 -0
- package/dist/_pkgs/affine-shared/utils/label-mode.d.ts +47 -0
- package/dist/_pkgs/affine-shared/utils/label-mode.js +55 -0
- package/dist/_pkgs/affine-shared/utils/model/merge-to-code-model.js +7 -1
- package/dist/_pkgs/affine-shared/utils/model/transform-model.js +5 -0
- package/dist/_pkgs/affine-shared/utils/panel-reorder-drag.d.ts +85 -0
- package/dist/_pkgs/affine-shared/utils/panel-reorder-drag.js +162 -0
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +10 -3
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.d.ts +62 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.js +94 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.d.ts +17 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.js +95 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.d.ts +10 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.js +31 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.d.ts +26 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.js +82 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.d.ts +186 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.js +1417 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +52 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +161 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
- package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
- package/dist/_pkgs/std/gfx/controller.d.ts +13 -0
- package/dist/_pkgs/std/gfx/controller.js +22 -2
- package/dist/_pkgs/std/gfx/grid.d.ts +31 -2
- package/dist/_pkgs/std/gfx/index.d.ts +3 -1
- package/dist/_pkgs/std/gfx/index.js +3 -1
- package/dist/_pkgs/std/gfx/interactivity/manager.js +7 -0
- package/dist/_pkgs/std/gfx/layer.js +73 -5
- package/dist/_pkgs/std/gfx/local-visibility.d.ts +88 -0
- package/dist/_pkgs/std/gfx/local-visibility.js +217 -0
- package/dist/_pkgs/std/gfx/model/gfx-block-model.d.ts +13 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +34 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +65 -1
- package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +27 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +43 -0
- package/dist/_pkgs/std/gfx/model/surface/user-layers.d.ts +68 -0
- package/dist/_pkgs/std/gfx/model/surface/user-layers.js +127 -0
- package/dist/_pkgs/std/scope/std-scope.d.ts +1 -1
- package/dist/_pkgs/std/utils/layer.d.ts +10 -0
- package/dist/_pkgs/std/utils/layer.js +64 -13
- package/dist/_pkgs/std/view/element/gfx-block-component.js +10 -2
- package/dist/commands.js +6 -1
- package/dist/host-panels.d.ts +90 -0
- package/dist/host-panels.js +111 -0
- package/dist/translations.js +10 -6
- package/package.json +13 -2
- package/dist/_pkgs/affine-components/icons/file-icons-rc.d.ts +0 -1
- package/dist/_pkgs/affine-components/icons/file-icons-rc.js +0 -130
- package/dist/_pkgs/affine-fragment-frame-panel/utils/drag.d.ts +0 -27
- package/dist/_pkgs/affine-fragment-frame-panel/utils/drag.js +0 -96
- package/dist/_pkgs/affine-shared/services/sidebar-service.d.ts +0 -8
- package/dist/_pkgs/affine-shared/services/sidebar-service.js +0 -7
- package/dist/_pkgs/affine-shared/test-utils/affine-template.d.ts +0 -6
- package/dist/_pkgs/affine-shared/test-utils/affine-template.js +0 -258
- package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.d.ts +0 -8
- package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.js +0 -81
- package/dist/_pkgs/affine-shared/test-utils/create-test-host.d.ts +0 -23
- package/dist/_pkgs/affine-shared/test-utils/create-test-host.js +0 -187
- package/dist/_pkgs/affine-shared/test-utils/index.d.ts +0 -3
- package/dist/_pkgs/affine-shared/test-utils/index.js +0 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConnectorElementModel, GroupElementModel, MindmapElementModel, } from '../../../affine-model/index.js';
|
|
2
|
+
import { sourceLayerOf } from '../../../affine-block-surface/index.js';
|
|
2
3
|
import { getTopElements, GfxBlockElementModel, isGfxGroupCompatibleModel, } from '../../../std/gfx/index.js';
|
|
3
4
|
/**
|
|
4
5
|
* return all elements in the tree of the elements
|
|
@@ -16,11 +17,29 @@ export function getSortedCloneElements(elements) {
|
|
|
16
17
|
});
|
|
17
18
|
return sortEdgelessElements([...set]);
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The data a clone gesture in the same document (duplicate, alt-drag)
|
|
22
|
+
* re-creates. Each model asks for its source's layer EXPLICITLY, the default
|
|
23
|
+
* layer included (ADR 0031, amendment "A duplicate stays in its source's
|
|
24
|
+
* layer, the default one included"): a default-layer model serializes no
|
|
25
|
+
* `layer`, and "absent" would hand its copy to the viewer's active layer. A
|
|
26
|
+
* paste goes through `prepareClipboardData` instead and keeps §6's rule — it
|
|
27
|
+
* cannot tell the default layer from another document.
|
|
28
|
+
*/
|
|
19
29
|
export function prepareCloneData(elements, std) {
|
|
20
30
|
elements = sortEdgelessElements(elements);
|
|
21
31
|
const job = std.store.getTransformer();
|
|
22
32
|
const res = elements.map(element => {
|
|
23
33
|
const data = serializeElement(element, elements, job);
|
|
34
|
+
if (!data)
|
|
35
|
+
return data;
|
|
36
|
+
const layer = sourceLayerOf(element);
|
|
37
|
+
if ('props' in data && data.type === 'block') {
|
|
38
|
+
data.props = { ...data.props, layer };
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
data.layer = layer;
|
|
42
|
+
}
|
|
24
43
|
return data;
|
|
25
44
|
});
|
|
26
45
|
return res.filter((d) => !!d);
|
|
@@ -77,7 +96,16 @@ export function sortEdgelessElements(elements) {
|
|
|
77
96
|
const rest = elements.filter(element => !(element instanceof ConnectorElementModel));
|
|
78
97
|
return [...rest, ...connectors];
|
|
79
98
|
};
|
|
99
|
+
// A child may be claimed by two containers in a stored document (a frame and
|
|
100
|
+
// a group: an older paste let the frame adopt a child before the pasted group
|
|
101
|
+
// claimed it). `getTopElements` then reports it as a top element — its
|
|
102
|
+
// `.group` reads the other container — and the walk meets it again under its
|
|
103
|
+
// group. Visit each element once, or the paste creates it twice.
|
|
104
|
+
const visited = new Set();
|
|
80
105
|
const traverse = (element) => {
|
|
106
|
+
if (visited.has(element))
|
|
107
|
+
return;
|
|
108
|
+
visited.add(element);
|
|
81
109
|
if (isGfxGroupCompatibleModel(element)) {
|
|
82
110
|
moveConnectorToEnd(element.childElements).forEach(child => traverse(child));
|
|
83
111
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EdgelessCRUDIdentifier, getLastPropsKey, } from '../../affine-block-surface/index.js';
|
|
2
2
|
import { EditPropsStore } from '../../affine-shared/services/index.js';
|
|
3
3
|
import { pickStylePropsForKey } from '../../affine-shared/utils/index.js';
|
|
4
|
-
import { IS_WINDOWS } from '../../global/env/index.js';
|
|
4
|
+
import { IS_LINUX, IS_WINDOWS } from '../../global/env/index.js';
|
|
5
5
|
import { GfxControllerIdentifier, GfxPrimitiveElementModel, } from '../../std/gfx/index.js';
|
|
6
6
|
import { duplicate } from '../edgeless/utils/clipboard-utils.js';
|
|
7
7
|
/**
|
|
@@ -21,12 +21,13 @@ import { duplicate } from '../edgeless/utils/clipboard-utils.js';
|
|
|
21
21
|
*
|
|
22
22
|
* Computed by the `when` predicate AND by `run`, on purpose: the projection to
|
|
23
23
|
* a shortcut only consumes the keystroke when `when` holds, and this gesture
|
|
24
|
-
* must fall through when it has nothing to apply — on Windows `Mod+Y`
|
|
25
|
-
* the `redo-windows` alias, which has to keep working.
|
|
24
|
+
* must fall through when it has nothing to apply — on Windows and Linux `Mod+Y`
|
|
25
|
+
* is also the `redo-windows` alias, which has to keep working.
|
|
26
26
|
*/
|
|
27
27
|
function lastStyleTargets(std) {
|
|
28
28
|
// Readonly: nothing to repaint, so `when` fails and the keystroke falls
|
|
29
|
-
// through (on Windows Mod+Y is also the redo alias, itself
|
|
29
|
+
// through (on Windows and Linux Mod+Y is also the redo alias, itself
|
|
30
|
+
// readonly-gated).
|
|
30
31
|
if (std.store.readonly)
|
|
31
32
|
return [];
|
|
32
33
|
const gfx = std.get(GfxControllerIdentifier);
|
|
@@ -72,7 +73,9 @@ export const coreCommands = [
|
|
|
72
73
|
},
|
|
73
74
|
},
|
|
74
75
|
{
|
|
75
|
-
//
|
|
76
|
+
// Redo alias (Ctrl+Y) on Windows and Linux; not bound on mac (empty
|
|
77
|
+
// combo). The id still says "windows": command ids are persisted in
|
|
78
|
+
// users' override tables, so it is kept rather than renamed.
|
|
76
79
|
id: 'redo-windows',
|
|
77
80
|
owner: 'core',
|
|
78
81
|
kind: 'action',
|
|
@@ -84,7 +87,7 @@ export const coreCommands = [
|
|
|
84
87
|
scope: 'global',
|
|
85
88
|
defaultKeys: { mac: [], other: ['Control-y'] },
|
|
86
89
|
availability: 'always',
|
|
87
|
-
when: () => IS_WINDOWS,
|
|
90
|
+
when: () => IS_WINDOWS || IS_LINUX,
|
|
88
91
|
run: std => {
|
|
89
92
|
if (std.store.canRedo)
|
|
90
93
|
std.store.redo();
|
|
@@ -33,7 +33,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
35
|
import { EdgelessCRUDIdentifier, getBgGridGap, } from '../../affine-block-surface/index.js';
|
|
36
|
-
import { EditorSettingProvider, FontLoaderService, ThemeProvider, ViewportElementProvider, } from '../../affine-shared/services/index.js';
|
|
36
|
+
import { documentShowsGrid, EditorSettingProvider, FontLoaderService, ThemeProvider, ViewportElementProvider, } from '../../affine-shared/services/index.js';
|
|
37
37
|
import { requestThrottledConnectedFrame } from '../../affine-shared/utils/index.js';
|
|
38
38
|
import { BlockComponent, SurfaceSelection, } from '../../std/index.js';
|
|
39
39
|
import { GfxControllerIdentifier, } from '../../std/gfx/index.js';
|
|
@@ -95,6 +95,11 @@ let EdgelessRootPreviewBlockComponent = (() => {
|
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/* ADR 0031 §11: a preview follows the document's showGrid alone. */
|
|
99
|
+
affine-edgeless-root-preview .edgeless-background.grid-hidden {
|
|
100
|
+
background-image: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
98
103
|
@media print {
|
|
99
104
|
.selected {
|
|
100
105
|
background-color: transparent !important;
|
|
@@ -208,8 +213,16 @@ let EdgelessRootPreviewBlockComponent = (() => {
|
|
|
208
213
|
...this.backgroundStyle,
|
|
209
214
|
background: this.overrideBackground,
|
|
210
215
|
});
|
|
216
|
+
// A preview is a picture of the document, not a viewer's session: no
|
|
217
|
+
// viewer override and no host default, only what the document saved.
|
|
218
|
+
const gridClass = documentShowsGrid(this.surfaceBlockModel)
|
|
219
|
+
? ''
|
|
220
|
+
: ' grid-hidden';
|
|
211
221
|
return html `
|
|
212
|
-
<div
|
|
222
|
+
<div
|
|
223
|
+
class="edgeless-background edgeless-container${gridClass}"
|
|
224
|
+
style=${background}
|
|
225
|
+
>
|
|
213
226
|
<gfx-viewport
|
|
214
227
|
.enableChildrenSchedule=${!this._disableScheduleUpdate}
|
|
215
228
|
.viewport=${this._gfx.viewport}
|
|
@@ -4,6 +4,10 @@ import { type ChromeWording } from '../affine-shared/services/index.js';
|
|
|
4
4
|
* `PACKAGE_SEED_WORDINGS` in `@labre/affine/translations` — see that file and
|
|
5
5
|
* `packages/affine/shared/src/services/translation-service/README.md`.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Aliases (L7 dedupe): the callout's own row says the same two words (#468),
|
|
9
|
+
* so they live in `chrome.ts` under the keys they always had.
|
|
10
|
+
*/
|
|
7
11
|
export declare const ROOT_TOOLBAR_CONVERSIONS_ARIA: ChromeWording;
|
|
8
12
|
export declare const ROOT_TOOLBAR_TURN_INTO: ChromeWording;
|
|
9
13
|
export declare const ROOT_TOOLBAR_CREATE_TABLE: ChromeWording;
|
|
@@ -51,8 +55,9 @@ export declare const ROOT_TOAST_ZOOM_TO_SELECTION: ChromeWording;
|
|
|
51
55
|
export declare const ROOT_MINDMAP_SEED_NEW_NODE: ChromeWording;
|
|
52
56
|
/**
|
|
53
57
|
* This package's own CHROME wordings — L7 dedupe aliased
|
|
54
|
-
* `
|
|
55
|
-
*
|
|
58
|
+
* `ROOT_TOOLBAR_CONVERSIONS_ARIA`, `ROOT_TOOLBAR_CREATE_LINKED_DOC`,
|
|
59
|
+
* `ROOT_TOOLBAR_FRAME`, `ROOT_TOOLBAR_RELOAD`, `ROOT_TOOLBAR_REMOVE_LINK` and
|
|
60
|
+
* `ROOT_TOOLBAR_TURN_INTO` to `chrome.ts` wordings — not listed again
|
|
56
61
|
* here, same rule the note/slash-menu packages' own chrome aliases already
|
|
57
62
|
* follow.
|
|
58
63
|
*/
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { TOOL_NAME_FRAME, TOOLBAR_CREATE_LINKED_DOC_TITLE, TOOLBAR_RELOAD, TOOLBAR_REMOVE_LINK, } from '../affine-shared/services/index.js';
|
|
1
|
+
import { TOOL_NAME_FRAME, TOOLBAR_CONVERSIONS_ARIA, TOOLBAR_CREATE_LINKED_DOC_TITLE, TOOLBAR_RELOAD, TOOLBAR_REMOVE_LINK, TOOLBAR_TURN_INTO, } from '../affine-shared/services/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* This package's own wordings, joined into `PACKAGE_WORDINGS` /
|
|
4
4
|
* `PACKAGE_SEED_WORDINGS` in `@labre/affine/translations` — see that file and
|
|
5
5
|
* `packages/affine/shared/src/services/translation-service/README.md`.
|
|
6
6
|
*/
|
|
7
7
|
/* ── The block contextual toolbar (`configs/toolbar.ts`) ──────────────── */
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export const
|
|
13
|
-
|
|
14
|
-
'Turn into',
|
|
15
|
-
];
|
|
8
|
+
/**
|
|
9
|
+
* Aliases (L7 dedupe): the callout's own row says the same two words (#468),
|
|
10
|
+
* so they live in `chrome.ts` under the keys they always had.
|
|
11
|
+
*/
|
|
12
|
+
export const ROOT_TOOLBAR_CONVERSIONS_ARIA = TOOLBAR_CONVERSIONS_ARIA;
|
|
13
|
+
export const ROOT_TOOLBAR_TURN_INTO = TOOLBAR_TURN_INTO;
|
|
16
14
|
export const ROOT_TOOLBAR_CREATE_TABLE = [
|
|
17
15
|
'com.labre.root.toolbar.create-table',
|
|
18
16
|
'Create Table',
|
|
@@ -134,14 +132,13 @@ export const ROOT_MINDMAP_SEED_NEW_NODE = [
|
|
|
134
132
|
];
|
|
135
133
|
/**
|
|
136
134
|
* This package's own CHROME wordings — L7 dedupe aliased
|
|
137
|
-
* `
|
|
138
|
-
*
|
|
135
|
+
* `ROOT_TOOLBAR_CONVERSIONS_ARIA`, `ROOT_TOOLBAR_CREATE_LINKED_DOC`,
|
|
136
|
+
* `ROOT_TOOLBAR_FRAME`, `ROOT_TOOLBAR_RELOAD`, `ROOT_TOOLBAR_REMOVE_LINK` and
|
|
137
|
+
* `ROOT_TOOLBAR_TURN_INTO` to `chrome.ts` wordings — not listed again
|
|
139
138
|
* here, same rule the note/slash-menu packages' own chrome aliases already
|
|
140
139
|
* follow.
|
|
141
140
|
*/
|
|
142
141
|
export const ROOT_CHROME_WORDINGS = [
|
|
143
|
-
ROOT_TOOLBAR_CONVERSIONS_ARIA,
|
|
144
|
-
ROOT_TOOLBAR_TURN_INTO,
|
|
145
142
|
ROOT_TOOLBAR_CREATE_TABLE,
|
|
146
143
|
ROOT_ALIGNMENT_MENU_ARIA,
|
|
147
144
|
ROOT_ALIGN_LEFT,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ExtensionType } from '../../../../../store/index.js';
|
|
2
1
|
import type { MarkdownAST } from '../../../../affine-shared/adapters/index.js';
|
|
3
2
|
import { type ServiceIdentifier } from '../../../../global/di/index.js';
|
|
3
|
+
import type { ExtensionType } from '../../../../store/index.js';
|
|
4
4
|
import type { ElementModelMatcher } from '../../type.js';
|
|
5
5
|
export type ElementToMarkdownAdapterMatcher = ElementModelMatcher<MarkdownAST>;
|
|
6
6
|
export declare const ElementToMarkdownAdapterMatcherIdentifier: ServiceIdentifier<ElementToMarkdownAdapterMatcher> & (<U extends ElementToMarkdownAdapterMatcher = ElementToMarkdownAdapterMatcher>(variant: import("../../../../global/di/types.js").ServiceVariant) => ServiceIdentifier<U>);
|
|
@@ -30,7 +30,7 @@ export declare const elementsCtorMap: {
|
|
|
30
30
|
umlRegion: typeof UmlRegionElementModel;
|
|
31
31
|
umlFragment: typeof UmlFragmentElementModel;
|
|
32
32
|
};
|
|
33
|
-
export {
|
|
33
|
+
export { BrushElementModel, ConnectorElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, SurfaceElementModel, TextElementModel, };
|
|
34
34
|
export declare enum CanvasElementType {
|
|
35
35
|
BRUSH = "brush",
|
|
36
36
|
CONNECTOR = "connector",
|
|
@@ -30,7 +30,7 @@ export const elementsCtorMap = {
|
|
|
30
30
|
umlRegion: UmlRegionElementModel,
|
|
31
31
|
umlFragment: UmlFragmentElementModel,
|
|
32
32
|
};
|
|
33
|
-
export {
|
|
33
|
+
export { BrushElementModel, ConnectorElementModel, GroupElementModel, HighlighterElementModel, MindmapElementModel, ShapeElementModel, SurfaceElementModel, TextElementModel, };
|
|
34
34
|
export var CanvasElementType;
|
|
35
35
|
(function (CanvasElementType) {
|
|
36
36
|
CanvasElementType["BRUSH"] = "brush";
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
import { getAuditCriteria, requestAudit, TelemetryProvider, } from '../../affine-shared/services/index.js';
|
|
31
31
|
import { GfxControllerIdentifier, GfxPrimitiveElementModel, roleIsA, } from '../../std/gfx/index.js';
|
|
32
32
|
import { z } from 'zod';
|
|
33
|
-
import {
|
|
34
|
-
import { backgroundAxisFacts, containingFrame, } from '../framework-background/facts.js';
|
|
33
|
+
import { backgroundAxisFacts, backgroundPlotRatios, backgroundZoneAt, backgroundZones, containingFrame, } from '../framework-background/facts.js';
|
|
35
34
|
import { ValidationManager, ValidationRuleIdentifier, } from './validation.js';
|
|
36
35
|
/**
|
|
37
36
|
* `map.audit` takes no required parameter: the assistant audits what is
|
|
@@ -113,69 +112,21 @@ function collectFrames(rules, elements) {
|
|
|
113
112
|
type: def.type,
|
|
114
113
|
...(typeof profileId === 'string' ? { profileId } : {}),
|
|
115
114
|
axes: backgroundAxisFacts(def),
|
|
116
|
-
// The framework's
|
|
117
|
-
// a BPMN pool's lanes
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
rect: { ...zone.rect },
|
|
126
|
-
})),
|
|
127
|
-
...backgroundInstanceZones(def, el).map(zone => ({
|
|
128
|
-
id: zone.id,
|
|
129
|
-
...(zone.name !== undefined ? { name: zone.name } : {}),
|
|
130
|
-
rect: { ...zone.rect },
|
|
131
|
-
})),
|
|
132
|
-
],
|
|
115
|
+
// The zones THIS frame has — the framework's, in the variant it is
|
|
116
|
+
// turned to, then its own (a BPMN pool's lanes) — read through the
|
|
117
|
+
// helper the reading panel uses, so the two cannot disagree. Copied
|
|
118
|
+
// field by field: the declared label is painting data, not a fact.
|
|
119
|
+
zones: backgroundZones(def, el).map(zone => ({
|
|
120
|
+
id: zone.id,
|
|
121
|
+
...(zone.name !== undefined ? { name: zone.name } : {}),
|
|
122
|
+
rect: { ...zone.rect },
|
|
123
|
+
})),
|
|
133
124
|
},
|
|
134
125
|
});
|
|
135
126
|
}
|
|
136
127
|
}
|
|
137
128
|
return frames;
|
|
138
129
|
}
|
|
139
|
-
/**
|
|
140
|
-
* Where an element's centre sits inside a frame's PLOT, as ratios.
|
|
141
|
-
*
|
|
142
|
-
* A POSITION, not a membership test: it is asked only about an element some
|
|
143
|
-
* frame already contains, and answers where in that frame's plot it lies.
|
|
144
|
-
*
|
|
145
|
-
* Ratios of the plot and not of the element box: a Wardley transition drawn at
|
|
146
|
-
* `0.4` is 40 % of the PLOT, not of the map element, and the margin between the
|
|
147
|
-
* two is exactly where the axis titles live. `backgroundPlot` is the one place
|
|
148
|
-
* that knows the difference, and this is the only reason this function exists
|
|
149
|
-
* rather than a subtraction at the call site.
|
|
150
|
-
*
|
|
151
|
-
* Not clamped: an element just off the left edge reads as `-0.03`, which is a
|
|
152
|
-
* true and useful thing to say. `null` for a degenerate plot.
|
|
153
|
-
*/
|
|
154
|
-
function plotRatios(frame, bound) {
|
|
155
|
-
const plot = backgroundPlot(frame.def, frame.bound.w, frame.bound.h);
|
|
156
|
-
if (!(plot.width > 0) || !(plot.height > 0))
|
|
157
|
-
return null;
|
|
158
|
-
const cx = bound.x + bound.w / 2;
|
|
159
|
-
const cy = bound.y + bound.h / 2;
|
|
160
|
-
return [
|
|
161
|
-
(cx - frame.bound.x - plot.x0) / plot.width,
|
|
162
|
-
(cy - frame.bound.y - plot.y0) / plot.height,
|
|
163
|
-
];
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* The zone a plot-ratio point falls in, if any — one the framework declares or
|
|
167
|
-
* one the frame itself does. It needs to know nothing about the difference: the
|
|
168
|
-
* fact carries both, in that order, as rectangles in the same ratios.
|
|
169
|
-
*/
|
|
170
|
-
function zoneAt(frame, at) {
|
|
171
|
-
for (const zone of frame.fact.zones) {
|
|
172
|
-
const { x, y, w, h } = zone.rect;
|
|
173
|
-
if (at[0] >= x && at[0] <= x + w && at[1] >= y && at[1] <= y + h) {
|
|
174
|
-
return zone.id;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return undefined;
|
|
178
|
-
}
|
|
179
130
|
/**
|
|
180
131
|
* Levels 1 and 2, copied out of the engine's verdict.
|
|
181
132
|
*
|
|
@@ -245,8 +196,9 @@ export function collectAuditFacts(std) {
|
|
|
245
196
|
elementFacts.push({ id: el.id, role });
|
|
246
197
|
continue;
|
|
247
198
|
}
|
|
248
|
-
|
|
249
|
-
const
|
|
199
|
+
// A POSITION, not a membership test: `frame` already contains the element.
|
|
200
|
+
const at = backgroundPlotRatios(frame.def, frame.bound, bound);
|
|
201
|
+
const zone = at === null ? undefined : backgroundZoneAt(frame.fact.zones, at)?.id;
|
|
250
202
|
elementFacts.push({
|
|
251
203
|
id: el.id,
|
|
252
204
|
role,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CanvasGrid, TelemetryProvider } from '../../../affine-shared/services/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The canvas grid's two commands (ADR 0031 §11, §12), `owner: 'core'`, on the
|
|
4
|
+
* palette and the agent. The library has no page "more" menu — that belongs
|
|
5
|
+
* to the host — so these are the grid's whole UI here; a host puts them in
|
|
6
|
+
* its own menu through `runCommand`.
|
|
7
|
+
*
|
|
8
|
+
* Both self-emit `CanvasGridToggled` (see the telemetry README): `scope` is
|
|
9
|
+
* which gesture ran, and a save that changes nothing reports nothing.
|
|
10
|
+
*/
|
|
11
|
+
function reportGrid(std, scope, visible) {
|
|
12
|
+
std.getOptional(TelemetryProvider)?.track('CanvasGridToggled', {
|
|
13
|
+
page: 'whiteboard editor',
|
|
14
|
+
scope,
|
|
15
|
+
visible,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Show or hide the grid for THIS viewer, on this document. Writes nothing to
|
|
20
|
+
* the document, so a reader may do it too.
|
|
21
|
+
*/
|
|
22
|
+
const toggleGrid = {
|
|
23
|
+
id: 'canvas.grid.toggle',
|
|
24
|
+
owner: 'core',
|
|
25
|
+
kind: 'action',
|
|
26
|
+
labelKey: 'com.labre.command.canvas.grid.toggle',
|
|
27
|
+
labelFallback: 'Show or hide the grid',
|
|
28
|
+
descriptionKey: 'com.labre.command.canvas.grid.toggle.description',
|
|
29
|
+
descriptionFallback: 'Show or hide the canvas grid on your screen only. Nothing changes for anyone else.',
|
|
30
|
+
keywords: ['grid', 'dots', 'background'],
|
|
31
|
+
surfaces: ['palette', 'agent'],
|
|
32
|
+
scope: 'edgeless',
|
|
33
|
+
defaultKeys: { mac: [], other: [] },
|
|
34
|
+
when: std => !!std.getOptional(CanvasGrid),
|
|
35
|
+
run: std => {
|
|
36
|
+
const grid = std.getOptional(CanvasGrid);
|
|
37
|
+
if (!grid)
|
|
38
|
+
return;
|
|
39
|
+
reportGrid(std, 'local', grid.toggle());
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Store the grid as this viewer sees it on the document, for everyone, and
|
|
44
|
+
* drop this viewer's own override. Read-only refuses (`availability`, and
|
|
45
|
+
* again in `CanvasGrid.saveForEveryone`).
|
|
46
|
+
*/
|
|
47
|
+
const saveGridForEveryone = {
|
|
48
|
+
id: 'canvas.grid.saveForEveryone',
|
|
49
|
+
owner: 'core',
|
|
50
|
+
kind: 'action',
|
|
51
|
+
labelKey: 'com.labre.command.canvas.grid.save-for-everyone',
|
|
52
|
+
labelFallback: 'Save the grid for everyone',
|
|
53
|
+
descriptionKey: 'com.labre.command.canvas.grid.save-for-everyone.description',
|
|
54
|
+
descriptionFallback: 'Make the grid as you see it now the setting of this document, for everyone who opens it.',
|
|
55
|
+
keywords: ['grid', 'dots', 'background', 'document'],
|
|
56
|
+
surfaces: ['palette', 'agent'],
|
|
57
|
+
scope: 'edgeless',
|
|
58
|
+
defaultKeys: { mac: [], other: [] },
|
|
59
|
+
availability: 'editable',
|
|
60
|
+
when: std => !!std.getOptional(CanvasGrid),
|
|
61
|
+
run: std => {
|
|
62
|
+
const saved = std.getOptional(CanvasGrid)?.saveForEveryone() ?? null;
|
|
63
|
+
if (saved === null)
|
|
64
|
+
return;
|
|
65
|
+
reportGrid(std, 'everyone', saved);
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
export const canvasGridCommands = [
|
|
69
|
+
toggleGrid,
|
|
70
|
+
saveGridForEveryone,
|
|
71
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { canvasGridCommands } from './commands.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { canvasGridCommands } from './commands.js';
|
|
@@ -4,12 +4,16 @@ import { StdIdentifier } from '../../std/index.js';
|
|
|
4
4
|
import { Extension } from '../../store/index.js';
|
|
5
5
|
import { getSurfaceComponent } from '../utils/get-surface-block.js';
|
|
6
6
|
import { EdgelessCRUDIdentifier } from './crud-extension.js';
|
|
7
|
+
import { applyCreationLayer } from './user-layers/creation.js';
|
|
7
8
|
export const EdgelessClipboardConfigIdentifier = createIdentifier('edgeless-clipboard-config');
|
|
8
9
|
export class EdgelessClipboardConfig extends Extension {
|
|
9
10
|
constructor(std) {
|
|
10
11
|
super();
|
|
11
12
|
this.std = std;
|
|
12
13
|
this.onBlockSnapshotPaste = async (snapshot, doc, parent, index) => {
|
|
14
|
+
// The clipboard's block path follows the elements' rule (ADR 0031 §6):
|
|
15
|
+
// a layer of this surface is kept, anything else lands in the active one.
|
|
16
|
+
applyCreationLayer(this.std, snapshot.props);
|
|
13
17
|
const block = await this.std.clipboard.pasteBlockSnapshot(snapshot, doc, parent, index);
|
|
14
18
|
return block?.id ?? null;
|
|
15
19
|
};
|
|
@@ -5,6 +5,7 @@ import { GfxBlockElementModel, GfxControllerIdentifier, isGfxGroupCompatibleMode
|
|
|
5
5
|
import { Extension } from '../../store/index.js';
|
|
6
6
|
import { getLastPropsKey } from '../utils/get-last-props-key.js';
|
|
7
7
|
import { isConnectable, isNoteBlock } from './query.js';
|
|
8
|
+
import { applyCreationLayer } from './user-layers/creation.js';
|
|
8
9
|
export const EdgelessCRUDIdentifier = createIdentifier('AffineEdgelessCrudService');
|
|
9
10
|
export class EdgelessCRUDExtension extends Extension {
|
|
10
11
|
constructor(std) {
|
|
@@ -48,6 +49,9 @@ export class EdgelessCRUDExtension extends Extension {
|
|
|
48
49
|
...props,
|
|
49
50
|
index: gfx.layer.generateIndex(),
|
|
50
51
|
};
|
|
52
|
+
// A gfx block gets the elements' rule (ADR 0031 §6): its own layer if it
|
|
53
|
+
// names one of this surface, else the viewer's active layer.
|
|
54
|
+
applyCreationLayer(this.std, nProps);
|
|
51
55
|
return this.std.store.addBlock(flavour, nProps, parentId, parentIndex);
|
|
52
56
|
};
|
|
53
57
|
this.addElement = (type, props) => {
|
|
@@ -3,6 +3,18 @@ import { type BlockStdScope, type EditorHost } from '../../../std/index.js';
|
|
|
3
3
|
import { GfxBlockElementModel, type GfxController, GfxPrimitiveElementModel } from '../../../std/gfx/index.js';
|
|
4
4
|
import type { ExtensionType, Store } from '../../../store/index.js';
|
|
5
5
|
import { CanvasRenderer } from '../../renderer/canvas-renderer.js';
|
|
6
|
+
export type EdgelessBackgroundOptions = {
|
|
7
|
+
size: number;
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
/** `null` when the grid is off (ADR 0031 §11): the background alone. */
|
|
10
|
+
gridColor: string | null;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The SVG the PNG export paints the canvas background from: the background
|
|
14
|
+
* colour, plus the dotted grid unless `gridColor` is `null` — what this
|
|
15
|
+
* viewer sees, as `CanvasGrid.visible$` says.
|
|
16
|
+
*/
|
|
17
|
+
export declare function edgelessBackgroundSvg(width: number, height: number, { size, backgroundColor, gridColor }: EdgelessBackgroundOptions): string;
|
|
6
18
|
export declare class ExportManager {
|
|
7
19
|
readonly std: BlockStdScope;
|
|
8
20
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ImageBlockModel } from '../../../affine-model/index.js';
|
|
2
2
|
import { FetchUtils, ImageProxyService } from '../../../affine-shared/adapters/index.js';
|
|
3
3
|
import { CANVAS_EXPORT_IGNORE_TAGS } from '../../../affine-shared/consts/index.js';
|
|
4
|
-
import { CHROME_UNTITLED, translateKey } from '../../../affine-shared/services/index.js';
|
|
5
|
-
import { isInsidePageEditor, matchModels } from '../../../affine-shared/utils/index.js';
|
|
4
|
+
import { CanvasGrid, CHROME_UNTITLED, translateKey, } from '../../../affine-shared/services/index.js';
|
|
5
|
+
import { isInsidePageEditor, matchModels, normalizeCanvasExportColors, toLegacyColors, } from '../../../affine-shared/utils/index.js';
|
|
6
6
|
import { BlockSuiteError, ErrorCode } from '../../../global/exceptions/index.js';
|
|
7
7
|
import { deserializeXYWH } from '../../../global/gfx/index.js';
|
|
8
8
|
import { StdIdentifier, } from '../../../std/index.js';
|
|
@@ -10,6 +10,17 @@ import { GfxBlockElementModel, GfxControllerIdentifier, GfxPrimitiveElementModel
|
|
|
10
10
|
import { CanvasRenderer } from '../../renderer/canvas-renderer.js';
|
|
11
11
|
import { getBgGridGap } from '../../utils/get-bg-grip-gap.js';
|
|
12
12
|
import { FileExporter } from './file-exporter.js';
|
|
13
|
+
/**
|
|
14
|
+
* The SVG the PNG export paints the canvas background from: the background
|
|
15
|
+
* colour, plus the dotted grid unless `gridColor` is `null` — what this
|
|
16
|
+
* viewer sees, as `CanvasGrid.visible$` says.
|
|
17
|
+
*/
|
|
18
|
+
export function edgelessBackgroundSvg(width, height, { size, backgroundColor, gridColor }) {
|
|
19
|
+
const grid = gridColor === null
|
|
20
|
+
? ''
|
|
21
|
+
: ` background-image: radial-gradient(${gridColor} 1px, ${backgroundColor} 1px)`;
|
|
22
|
+
return `<svg width='${width}px' height='${height}px' xmlns='http://www.w3.org/2000/svg' style='background-size:${size}px ${size}px;background-color:${backgroundColor};${grid}'></svg>`;
|
|
23
|
+
}
|
|
13
24
|
export class ExportManager {
|
|
14
25
|
/**
|
|
15
26
|
* The image proxy every remote-image fetch of the export goes through —
|
|
@@ -157,11 +168,12 @@ export class ExportManager {
|
|
|
157
168
|
return false;
|
|
158
169
|
}
|
|
159
170
|
},
|
|
160
|
-
onclone: async (
|
|
171
|
+
onclone: async (documentClone, element) => {
|
|
172
|
+
normalizeCanvasExportColors(documentClone, element);
|
|
161
173
|
element.style.height = `${viewportHeight}px`;
|
|
162
174
|
await this.replaceImgSrcWithSvg(element);
|
|
163
175
|
},
|
|
164
|
-
backgroundColor: window.getComputedStyle(viewportElement).backgroundColor,
|
|
176
|
+
backgroundColor: toLegacyColors(window.getComputedStyle(viewportElement).backgroundColor),
|
|
165
177
|
x: pageLeft - viewport.left,
|
|
166
178
|
width: pageWidth,
|
|
167
179
|
height: viewportHeight,
|
|
@@ -179,8 +191,8 @@ export class ExportManager {
|
|
|
179
191
|
this._checkCanContinueToCanvas(pathname, editorMode);
|
|
180
192
|
return data;
|
|
181
193
|
}
|
|
182
|
-
_drawEdgelessBackground(ctx,
|
|
183
|
-
const svgImg =
|
|
194
|
+
_drawEdgelessBackground(ctx, options) {
|
|
195
|
+
const svgImg = edgelessBackgroundSvg(ctx.canvas.width, ctx.canvas.height, options);
|
|
184
196
|
const img = new Image();
|
|
185
197
|
const cleanup = () => {
|
|
186
198
|
img.onload = null;
|
|
@@ -218,6 +230,7 @@ export class ExportManager {
|
|
|
218
230
|
}
|
|
219
231
|
},
|
|
220
232
|
onclone: async (documentClone, element) => {
|
|
233
|
+
normalizeCanvasExportColors(documentClone, element);
|
|
221
234
|
// html2canvas can't support transform feature
|
|
222
235
|
element.style.setProperty('transform', 'none');
|
|
223
236
|
const layer = element.classList.contains('.affine-edgeless-layer')
|
|
@@ -300,7 +313,10 @@ export class ExportManager {
|
|
|
300
313
|
await this._drawEdgelessBackground(ctx, {
|
|
301
314
|
backgroundColor: containerComputedStyle.getPropertyValue('--affine-background-primary-color'),
|
|
302
315
|
size: getBgGridGap(edgelessBackground.zoom),
|
|
303
|
-
|
|
316
|
+
// What this viewer sees: off leaves the background colour alone.
|
|
317
|
+
gridColor: (this.std.getOptional(CanvasGrid)?.visible$.peek() ?? true)
|
|
318
|
+
? containerComputedStyle.getPropertyValue('--affine-edgeless-grid-color')
|
|
319
|
+
: null,
|
|
304
320
|
});
|
|
305
321
|
}
|
|
306
322
|
if (!blocks && !elements) {
|
|
@@ -331,6 +347,10 @@ export class ExportManager {
|
|
|
331
347
|
elements = [...elementSet];
|
|
332
348
|
blocks = [...blockSet];
|
|
333
349
|
}
|
|
350
|
+
// What you see is what you export (ADR 0031, resolved at acceptance): a
|
|
351
|
+
// block this viewer hid is not drawn. Canvas elements are left out by the
|
|
352
|
+
// renderer's own paint predicate.
|
|
353
|
+
blocks = blocks.filter(block => !gfx.localVisibility.isHidden(block));
|
|
334
354
|
for (const block of blocks) {
|
|
335
355
|
if (matchModels(block, [ImageBlockModel])) {
|
|
336
356
|
if (!block.props.sourceId)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FrameworkBackgroundElementModel } from '../../../affine-model/index.js';
|
|
2
2
|
import type { AnyCommandDescriptor, BlockStdScope } from '../../../std/index.js';
|
|
3
|
+
import { type BoardSvgExportOptions } from './parts.js';
|
|
3
4
|
/**
|
|
4
5
|
* The framework boards in the current canvas selection.
|
|
5
6
|
*
|
|
@@ -19,5 +20,5 @@ export declare function selectedBoards(std: BlockStdScope): FrameworkBackgroundE
|
|
|
19
20
|
* on the browser — a result nobody can read off the gesture. One board, one
|
|
20
21
|
* file, every time.
|
|
21
22
|
*/
|
|
22
|
-
export declare function exportBoardSvg(std: BlockStdScope): void;
|
|
23
|
+
export declare function exportBoardSvg(std: BlockStdScope, options?: Readonly<BoardSvgExportOptions>): void;
|
|
23
24
|
export declare const exportSvgCommands: AnyCommandDescriptor[];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { FrameworkBackgroundElementModel } from '../../../affine-model/index.js';
|
|
2
|
+
import { NotificationProvider, translateKey, } from '../../../affine-shared/services/index.js';
|
|
2
3
|
import { downloadBlob, safeFilename } from '../../../affine-shared/utils/index.js';
|
|
3
4
|
import { GfxControllerIdentifier } from '../../../std/gfx/index.js';
|
|
5
|
+
import { boardSvgExportOptions, DEFAULT_BOARD_SVG_EXPORT_OPTIONS, } from './parts.js';
|
|
4
6
|
import { renderBoardSvg } from './render.js';
|
|
7
|
+
import { EXPORT_SVG_NOTHING_TO_EXPORT } from './translations.js';
|
|
5
8
|
/** What the file is, told to the browser. */
|
|
6
9
|
const SVG_MIME = 'image/svg+xml';
|
|
7
10
|
/** The name a board with no document title falls back to. */
|
|
@@ -29,11 +32,20 @@ export function selectedBoards(std) {
|
|
|
29
32
|
* on the browser — a result nobody can read off the gesture. One board, one
|
|
30
33
|
* file, every time.
|
|
31
34
|
*/
|
|
32
|
-
export function exportBoardSvg(std) {
|
|
35
|
+
export function exportBoardSvg(std, options = DEFAULT_BOARD_SVG_EXPORT_OPTIONS) {
|
|
33
36
|
const [board] = selectedBoards(std);
|
|
34
37
|
if (!board)
|
|
35
38
|
return;
|
|
36
|
-
const
|
|
39
|
+
const rendered = renderBoardSvg(std, board, options);
|
|
40
|
+
if (!rendered) {
|
|
41
|
+
// Every part left was switched off. Said once, through the host's
|
|
42
|
+
// notification seam; a host without one simply gets no file.
|
|
43
|
+
std
|
|
44
|
+
.getOptional(NotificationProvider)
|
|
45
|
+
?.toast(translateKey(std, ...EXPORT_SVG_NOTHING_TO_EXPORT));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const { svg } = rendered;
|
|
37
49
|
const title = std.store.workspace.meta.getDocMeta(std.store.id)?.title;
|
|
38
50
|
downloadBlob(
|
|
39
51
|
// The charset is the browser's business, not the format's: `image/svg+xml`
|
|
@@ -53,6 +65,13 @@ export function exportBoardSvg(std) {
|
|
|
53
65
|
* It READS, so there is no read-only guard: taking a picture of a board you
|
|
54
66
|
* cannot edit is precisely what a reader does.
|
|
55
67
|
*
|
|
68
|
+
* Its optional params are the export options (`parts.ts`), which the "⋮"
|
|
69
|
+
* entry asks for before it runs this. Every other surface — the palette, the
|
|
70
|
+
* catalogue, a shortcut, the agent — passes nothing and exports everything,
|
|
71
|
+
* without a dialog. They are deliberately not declared as `params`: the agent
|
|
72
|
+
* contract stays "export the selected board", and `run` re-validates whatever
|
|
73
|
+
* arrives.
|
|
74
|
+
*
|
|
56
75
|
* No `telemetry` field: `CommandTelemetry.framework` is typed on `FrameworkId`,
|
|
57
76
|
* and this command cannot name one — the surface package knows a board by its
|
|
58
77
|
* MODEL CLASS, and nothing in it maps `bpmnPool` back to `bpmn` without
|
|
@@ -84,6 +103,6 @@ const exportSvg = {
|
|
|
84
103
|
// union can express.
|
|
85
104
|
availability: 'selection:framework',
|
|
86
105
|
when: std => selectedBoards(std).length > 0,
|
|
87
|
-
run: std => exportBoardSvg(std),
|
|
106
|
+
run: (std, _invocation, params) => exportBoardSvg(std, boardSvgExportOptions(params)),
|
|
88
107
|
};
|
|
89
108
|
export const exportSvgCommands = [exportSvg];
|