@formicoidea/labre-core 0.42.0 → 0.45.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-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/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 +3 -0
- 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-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.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/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/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +2 -0
- 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/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.d.ts +0 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +2 -5
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +1 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +14 -6
- 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-loom-block/embed-loom-block.js +2 -0
- package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +2 -0
- 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-edgeless-linked-doc-block.js +3 -1
- 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/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-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +2 -2
- package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +5 -0
- package/dist/_pkgs/affine-block-frame/frame-manager.js +53 -19
- package/dist/_pkgs/affine-block-frame/frame-tool.js +3 -1
- 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-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/translations.d.ts +0 -1
- package/dist/_pkgs/affine-block-note/translations.js +0 -5
- 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/configs/toolbar.js +17 -1
- 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/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/index.js +1 -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/view.js +2 -0
- 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/interchange-import.js +13 -1
- package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +8 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.js +59 -3
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +4 -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 +80 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.js +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.d.ts +82 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.js +342 -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-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 +112 -4
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +98 -19
- 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/background-view.js +1 -1
- 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/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 +1 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.js +1 -0
- 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/element-highlight-overlay.js +2 -7
- 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/configs/tooltips.js +2 -2
- package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
- package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +5 -0
- package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
- package/dist/_pkgs/affine-components/context-menu/button.js +17 -1
- package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
- package/dist/_pkgs/affine-components/icons/ai.js +3 -3
- 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/list.js +7 -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/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-fragment-adapter-panel/adapter-panel.d.ts +2 -2
- 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 +3 -3
- 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 +1 -0
- package/dist/_pkgs/affine-fragment-frame-panel/index.js +1 -0
- package/dist/_pkgs/affine-gfx-brush/toolbar/components/eraser/icons.js +1 -1
- 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.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 +6 -4
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +24 -8
- 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-group/command/group-api.js +52 -1
- package/dist/_pkgs/affine-gfx-mindmap/indicator-overlay/index.js +6 -2
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/config.js +4 -2
- package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +6 -0
- package/dist/_pkgs/affine-gfx-mindmap/translations.js +10 -0
- 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 +5 -3
- 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 +13 -7
- 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-template/toolbar/template-loading.js +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/edgeless-text-editor.js +5 -3
- 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 +56 -3
- 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-gfx-text/translations.d.ts +8 -0
- package/dist/_pkgs/affine-gfx-text/translations.js +12 -0
- package/dist/_pkgs/affine-inline-latex/latex-node/latex-editor-menu.js +2 -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 +41 -2
- package/dist/_pkgs/affine-model/consts/text.js +50 -1
- 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-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 +27 -0
- 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 +13 -2
- package/dist/_pkgs/affine-shared/services/font-loader/config.js +43 -54
- package/dist/_pkgs/affine-shared/services/index.d.ts +3 -0
- package/dist/_pkgs/affine-shared/services/index.js +3 -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/theme-service.d.ts +19 -0
- package/dist/_pkgs/affine-shared/services/theme-service.js +24 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +25 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +90 -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 +2 -0
- package/dist/_pkgs/affine-shared/utils/index.js +2 -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-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +2 -2
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +15 -4
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
- 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/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/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/selection-pane/drop.d.ts +61 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.js +91 -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 +170 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.js +1381 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +58 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +171 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
- package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +2 -1
- package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
- 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/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/role.d.ts +10 -5
- 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/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 -2
- package/dist/translations.js +15 -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-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,6 +1,6 @@
|
|
|
1
|
-
import { indexOverBackgrounds, Overlay, stackedElementsOf, } from '../affine-block-surface/index.js';
|
|
1
|
+
import { applyCreationLayer, indexOverBackgrounds, Overlay, stackedElementsOf, } from '../affine-block-surface/index.js';
|
|
2
2
|
import { FrameworkBackgroundElementModel } from '../affine-model/index.js';
|
|
3
|
-
import { EditPropsStore, translateKey } from '../affine-shared/services/index.js';
|
|
3
|
+
import { EditPropsStore, getChromeAccentColor, translateKey, } from '../affine-shared/services/index.js';
|
|
4
4
|
import { DisposableGroup } from '../global/disposable/index.js';
|
|
5
5
|
import { BlockSuiteError, ErrorCode } from '../global/exceptions/index.js';
|
|
6
6
|
import { Bound, deserializeXYWH, } from '../global/gfx/index.js';
|
|
@@ -65,7 +65,10 @@ export class FrameOverlay extends Overlay {
|
|
|
65
65
|
}
|
|
66
66
|
render(ctx) {
|
|
67
67
|
ctx.beginPath();
|
|
68
|
-
|
|
68
|
+
// The accent read from the theme, not a literal: a canvas context cannot
|
|
69
|
+
// take a `var(…)`, so the token is resolved here (DESIGN.md, The Borrowed
|
|
70
|
+
// Blue Rule).
|
|
71
|
+
ctx.strokeStyle = getChromeAccentColor(this.gfx.std);
|
|
69
72
|
ctx.lineWidth = 2 / this.gfx.viewport.zoom;
|
|
70
73
|
const radius = 2 / this.gfx.viewport.zoom;
|
|
71
74
|
if (this._frame) {
|
|
@@ -100,6 +103,9 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
100
103
|
constructor(gfx) {
|
|
101
104
|
super(gfx);
|
|
102
105
|
this._disposable = new DisposableGroup();
|
|
106
|
+
/** Canvas elements added locally, waiting for the adoption microtask. */
|
|
107
|
+
this._pendingAdoptions = [];
|
|
108
|
+
this._pendingAdoptionTicks = 0;
|
|
103
109
|
this._watchElementAdded();
|
|
104
110
|
this._watchFrameMoved();
|
|
105
111
|
}
|
|
@@ -155,6 +161,10 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
155
161
|
index: this.frameIndexAt(bound),
|
|
156
162
|
presentationIndex: this.generatePresentationIndex(),
|
|
157
163
|
});
|
|
164
|
+
// The viewer's active layer, like every new model (ADR 0031 §6). Not
|
|
165
|
+
// through the stamped CRUD `addBlock`: it would replace the index
|
|
166
|
+
// `frameIndexAt` just chose.
|
|
167
|
+
applyCreationLayer(this.gfx.std, props);
|
|
158
168
|
const id = this.gfx.doc.addBlock('affine:frame', props, surfaceModel);
|
|
159
169
|
const frameModel = this.gfx.getElementById(id);
|
|
160
170
|
if (!frameModel || !isFrameBlock(frameModel)) {
|
|
@@ -228,7 +238,7 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
228
238
|
const { surface: surfaceModel, doc } = this.gfx;
|
|
229
239
|
this._disposable.add(surfaceModel.elementAdded.subscribe(({ id, local }) => {
|
|
230
240
|
const element = surfaceModel.getElementById(id);
|
|
231
|
-
if (element && local) {
|
|
241
|
+
if (element && local && !surfaceModel.store.readonly) {
|
|
232
242
|
// The entire frame detection logic must be in microtask for timing reasons:
|
|
233
243
|
//
|
|
234
244
|
// 1. For connectors: When elementAdded fires, connectors have invalid bounds [0,0,0,0]
|
|
@@ -245,22 +255,23 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
245
255
|
// - Connectors have proper bounds calculated (not [0,0,0,0])
|
|
246
256
|
// - getFrameFromPoint() works correctly with valid element centers
|
|
247
257
|
// - All element initialization is complete before frame detection
|
|
258
|
+
//
|
|
259
|
+
// One transaction (one update for the peers) adopts everything a
|
|
260
|
+
// single transaction added — a paste of N elements no longer sends N
|
|
261
|
+
// adoptions. Only the LAST microtask queued does the work, so each
|
|
262
|
+
// element is decided no earlier than its own microtask would have
|
|
263
|
+
// been, connector paths included.
|
|
264
|
+
this._pendingAdoptions.push(element);
|
|
265
|
+
this._pendingAdoptionTicks++;
|
|
248
266
|
queueMicrotask(() => {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
element.hasChild(frame)) {
|
|
267
|
+
if (--this._pendingAdoptionTicks > 0)
|
|
268
|
+
return;
|
|
269
|
+
const elements = this._pendingAdoptions.splice(0);
|
|
270
|
+
if (surfaceModel.store.readonly)
|
|
254
271
|
return;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
// it (e.g. a Wardley map background the frame was drawn on top of).
|
|
259
|
-
if (!element.group &&
|
|
260
|
-
frame &&
|
|
261
|
-
!this._enclosesFrame(element, frame)) {
|
|
262
|
-
this._adoptNewlyCreatedElement(frame, element);
|
|
263
|
-
}
|
|
272
|
+
doc.transact(() => {
|
|
273
|
+
elements.forEach(element => this._adoptIfInFrame(element));
|
|
274
|
+
});
|
|
264
275
|
});
|
|
265
276
|
}
|
|
266
277
|
}));
|
|
@@ -272,11 +283,18 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
272
283
|
// cannot write at all, which is how this surfaced (#251). See #242 for
|
|
273
284
|
// the rule: a cascade reacts to local transactions, the receiving peer
|
|
274
285
|
// trusts the sync.
|
|
275
|
-
if (!payload.isLocal)
|
|
286
|
+
if (!payload.isLocal || doc.readonly)
|
|
276
287
|
return;
|
|
277
288
|
if (payload.type === 'add' &&
|
|
278
289
|
payload.model instanceof GfxBlockElementModel &&
|
|
279
290
|
renderableInEdgeless(doc, surfaceModel, payload.model)) {
|
|
291
|
+
// Same guard as the canvas half: a block that already has a parent
|
|
292
|
+
// (restored by undo with its group, or created by a transaction that
|
|
293
|
+
// also wrote its container) is not the frame's to take. Adopting it
|
|
294
|
+
// makes two containers claim one child, and the next duplicate
|
|
295
|
+
// copies that child twice.
|
|
296
|
+
if (payload.model.group)
|
|
297
|
+
return;
|
|
280
298
|
const frame = this.getFrameFromPoint(payload.model.elementBound.center, isFrameBlock(payload.model) ? [payload.model] : []);
|
|
281
299
|
if (!frame)
|
|
282
300
|
return;
|
|
@@ -294,6 +312,22 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
294
312
|
}
|
|
295
313
|
}));
|
|
296
314
|
}
|
|
315
|
+
/** A canvas element just added locally: the frame under it adopts it. */
|
|
316
|
+
_adoptIfInFrame(element) {
|
|
317
|
+
const frame = this.getFrameFromPoint(element.elementBound.center);
|
|
318
|
+
if (!frame)
|
|
319
|
+
return;
|
|
320
|
+
// if the container created with a frame, skip it.
|
|
321
|
+
if (isGfxGroupCompatibleModel(element) && element.hasChild(frame)) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
// Only add elements that aren't already grouped, and never let the frame
|
|
325
|
+
// swallow a backdrop that encloses it (e.g. a Wardley map background the
|
|
326
|
+
// frame was drawn on top of).
|
|
327
|
+
if (!element.group && !this._enclosesFrame(element, frame)) {
|
|
328
|
+
this._adoptNewlyCreatedElement(frame, element);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
297
331
|
/**
|
|
298
332
|
* Whether `element` fully encloses `frame`.
|
|
299
333
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultTool, OverlayIdentifier } from '../affine-block-surface/index.js';
|
|
1
|
+
import { applyCreationLayer, DefaultTool, OverlayIdentifier, } from '../affine-block-surface/index.js';
|
|
2
2
|
import { EditPropsStore, TelemetryProvider, translateKey, } from '../affine-shared/services/index.js';
|
|
3
3
|
import { Bound, Vec } from '../global/gfx/index.js';
|
|
4
4
|
import { BaseTool, getTopElements } from '../std/gfx/index.js';
|
|
@@ -61,6 +61,8 @@ export class FrameTool extends BaseTool {
|
|
|
61
61
|
index: this.frameManager.frameIndexAt(bound),
|
|
62
62
|
presentationIndex: this.frameManager.generatePresentationIndex(),
|
|
63
63
|
});
|
|
64
|
+
// The active layer, as `EdgelessFrameManager._addFrameBlock` does.
|
|
65
|
+
applyCreationLayer(this.std, props);
|
|
64
66
|
const id = this.doc.addBlock('affine:frame', props, this.gfx.surface);
|
|
65
67
|
this.std.getOptional(TelemetryProvider)?.track('CanvasElementAdded', {
|
|
66
68
|
control: 'canvas:draw',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { autoResizeElementsCommand } from '../affine-block-surface/index.js';
|
|
1
|
+
import { applyCreationLayer, autoResizeElementsCommand, } from '../affine-block-surface/index.js';
|
|
2
2
|
import { toast } from '../affine-components/toast/index.js';
|
|
3
3
|
import { ImageBlockSchema, } from '../affine-model/index.js';
|
|
4
4
|
import { FileSizeLimitProvider, NativeClipboardProvider, TOAST_DOWNLOAD_IN_PROGRESS, TOAST_UPLOAD_SIZE_LIMIT, translateKey, } from '../affine-shared/services/index.js';
|
|
@@ -234,6 +234,9 @@ export async function addImages(std, files, options) {
|
|
|
234
234
|
},
|
|
235
235
|
};
|
|
236
236
|
});
|
|
237
|
+
// The viewer's active layer, as the CRUD `addBlock` path stamps it
|
|
238
|
+
// (ADR 0031 §6): several blocks at once go straight to `store.addBlocks`.
|
|
239
|
+
blocks.forEach(({ blockProps }) => applyCreationLayer(std, blockProps));
|
|
237
240
|
const blockIds = std.store.addBlocks(blocks, gfx.surface);
|
|
238
241
|
gfx.selection.set({
|
|
239
242
|
elements: blockIds,
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { type MarkdownAdapterPreprocessor } from '../../../affine-shared/adapters/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Preprocess the content to protect code blocks and LaTeX expressions
|
|
4
|
+
* reference issue: https://github.com/remarkjs/react-markdown/issues/785
|
|
5
|
+
* reference comment: https://github.com/remarkjs/react-markdown/issues/785#issuecomment-2307567823
|
|
6
|
+
* @param content - The content to preprocess
|
|
7
|
+
* @returns The preprocessed content
|
|
8
|
+
*/
|
|
9
|
+
export declare function preprocessLatex(content: string): string;
|
|
2
10
|
export declare const LatexMarkdownPreprocessorExtension: import("../../../store/index.js").ExtensionType & {
|
|
3
11
|
identifier: import("../../../global/di/types.js").ServiceIdentifier<MarkdownAdapterPreprocessor>;
|
|
4
12
|
};
|
|
@@ -24,7 +24,7 @@ function escapeMhchem(text) {
|
|
|
24
24
|
* @param content - The content to preprocess
|
|
25
25
|
* @returns The preprocessed content
|
|
26
26
|
*/
|
|
27
|
-
function preprocessLatex(content) {
|
|
27
|
+
export function preprocessLatex(content) {
|
|
28
28
|
// Protect code blocks
|
|
29
29
|
const codeBlocks = [];
|
|
30
30
|
let preprocessedContent = content;
|
|
@@ -32,14 +32,18 @@ function preprocessLatex(content) {
|
|
|
32
32
|
codeBlocks.push(code);
|
|
33
33
|
return `<<CODE_BLOCK_${codeBlocks.length - 1}>>`;
|
|
34
34
|
});
|
|
35
|
-
// Protect existing LaTeX expressions
|
|
35
|
+
// Protect existing LaTeX expressions. Inline delimiters use Pandoc's
|
|
36
|
+
// whitespace and digit rules, with backslash parity preserved: a `$` opens
|
|
37
|
+
// math when not followed by a space, closes it when not preceded by one nor
|
|
38
|
+
// followed by a digit, and an odd backslash run escapes it.
|
|
36
39
|
const latexExpressions = [];
|
|
37
|
-
preprocessedContent = preprocessedContent.replace(/(\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\]|\\\(.*?\\\))/g, match => {
|
|
40
|
+
preprocessedContent = preprocessedContent.replace(/(\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\]|\\\(.*?\\\)|(?<!\\)(?:\\\\)*\$(?!\s)(?:[^\n$\\]|\\.)*?(?<!\s)\$(?!\d))/g, match => {
|
|
38
41
|
latexExpressions.push(match);
|
|
39
42
|
return `<<LATEX_${latexExpressions.length - 1}>>`;
|
|
40
43
|
});
|
|
41
|
-
// Escape dollar signs that are likely currency indicators
|
|
42
|
-
|
|
44
|
+
// Escape dollar signs that are likely currency indicators. An odd backslash
|
|
45
|
+
// run already escapes the dollar sign, so only an even run (or none) gets one.
|
|
46
|
+
preprocessedContent = preprocessedContent.replace(/(?<!\\)((?:\\\\)*)\$(?=\d)/g, '$1\\$');
|
|
43
47
|
// Restore LaTeX expressions
|
|
44
48
|
preprocessedContent = preprocessedContent.replace(/<<LATEX_(\d+)>>/g, (_, index) => latexExpressions[parseInt(index)]);
|
|
45
49
|
// Restore code blocks
|
|
@@ -42,7 +42,9 @@ export function getListIcon(model, showChildren, onClick) {
|
|
|
42
42
|
@click=${onClick}
|
|
43
43
|
>
|
|
44
44
|
${model.props.checked
|
|
45
|
-
? CheckBoxCheckSolidIcon({
|
|
45
|
+
? CheckBoxCheckSolidIcon({
|
|
46
|
+
style: 'color: var(--affine-primary-color)',
|
|
47
|
+
})
|
|
46
48
|
: CheckBoxUnIcon()}
|
|
47
49
|
</div>`;
|
|
48
50
|
case 'toggle':
|
|
@@ -262,7 +262,7 @@ export const TodoTooltip = html `<svg width="170" height="68" viewBox="0 0 170 6
|
|
|
262
262
|
<g mask="url(#mask0_5604_203551)">
|
|
263
263
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.6667 19C12.7462 19 12 19.7462 12 20.6667V27.3333C12 28.2538 12.7462 29 13.6667 29H20.3333C21.2538 29 22 28.2538 22 27.3333V20.6667C22 19.7462 21.2538 19 20.3333 19H13.6667ZM12.9091 20.6667C12.9091 20.2483 13.2483 19.9091 13.6667 19.9091H20.3333C20.7517 19.9091 21.0909 20.2483 21.0909 20.6667V27.3333C21.0909 27.7517 20.7517 28.0909 20.3333 28.0909H13.6667C13.2483 28.0909 12.9091 27.7517 12.9091 27.3333V20.6667Z" fill="#77757D"/>
|
|
264
264
|
<rect x="28" y="20.1364" width="142" height="8" rx="4" fill="#121212" fill-opacity="0.3"/>
|
|
265
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="
|
|
265
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="var(--affine-primary-color)"/>
|
|
266
266
|
<rect x="28" y="40.1364" width="142" height="8" rx="4" fill="#8E8D91" fill-opacity="0.55"/>
|
|
267
267
|
</g>
|
|
268
268
|
</svg>
|
|
@@ -57,7 +57,6 @@ export declare const NOTE_BORDER_STYLE_LABEL: ChromeWording;
|
|
|
57
57
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_SHOW_IN}, one key. */
|
|
58
58
|
export declare const NOTE_DISPLAY_MODE_SHOW_IN: ChromeWording;
|
|
59
59
|
export declare const NOTE_DISPLAY_MODE_LABEL: ChromeWording;
|
|
60
|
-
export declare const NOTE_DISPLAY_MODE_TOOLTIP: ChromeWording;
|
|
61
60
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_BOTH}, one key. */
|
|
62
61
|
export declare const NOTE_DISPLAY_MODE_BOTH: ChromeWording;
|
|
63
62
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_EDGELESS}, one key. */
|
|
@@ -143,10 +143,6 @@ export const NOTE_DISPLAY_MODE_LABEL = [
|
|
|
143
143
|
'com.labre.note.display-mode.mode-label',
|
|
144
144
|
'Mode',
|
|
145
145
|
];
|
|
146
|
-
export const NOTE_DISPLAY_MODE_TOOLTIP = [
|
|
147
|
-
'com.labre.note.display-mode.tooltip',
|
|
148
|
-
'Display mode',
|
|
149
|
-
];
|
|
150
146
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_BOTH}, one key. */
|
|
151
147
|
export const NOTE_DISPLAY_MODE_BOTH = DISPLAY_MODE_BOTH;
|
|
152
148
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_EDGELESS}, one key. */
|
|
@@ -237,7 +233,6 @@ export const NOTE_WORDINGS = [
|
|
|
237
233
|
NOTE_STYLE_CUSTOM_COLOR,
|
|
238
234
|
NOTE_STYLE_PANEL_LABEL,
|
|
239
235
|
NOTE_DISPLAY_MODE_LABEL,
|
|
240
|
-
NOTE_DISPLAY_MODE_TOOLTIP,
|
|
241
236
|
NOTE_TOAST_DISPLAYED_IN_PAGE_MODE,
|
|
242
237
|
NOTE_TOAST_REMOVED_FROM_PAGE_BODY,
|
|
243
238
|
NOTE_TOAST_ADDED_TO_PAGE_BODY,
|
|
@@ -49,7 +49,7 @@ export const rootBlockHtmlAdapterMatcher = {
|
|
|
49
49
|
display: none;
|
|
50
50
|
}
|
|
51
51
|
label:before {
|
|
52
|
-
background: rgb(30, 150, 235);
|
|
52
|
+
background: var(--affine-primary-color, rgb(30, 150, 235));
|
|
53
53
|
border-radius: 3px;
|
|
54
54
|
height: 16px;
|
|
55
55
|
width: 16px;
|
|
@@ -58,7 +58,7 @@ export const rootBlockHtmlAdapterMatcher = {
|
|
|
58
58
|
}
|
|
59
59
|
input[type='checkbox'] + label:before {
|
|
60
60
|
content: '';
|
|
61
|
-
background: rgb(30, 150, 235);
|
|
61
|
+
background: var(--affine-primary-color, rgb(30, 150, 235));
|
|
62
62
|
color: #fff;
|
|
63
63
|
font-size: 16px;
|
|
64
64
|
line-height: 16px;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `doc.copyLink` — put the current document's URL on the clipboard, anchored on
|
|
3
|
+
* whatever is selected.
|
|
4
|
+
*
|
|
5
|
+
* The library does not know what a document's address looks like: routing is
|
|
6
|
+
* the host's, and the seam for it — `GenerateDocUrlProvider` — has shipped
|
|
7
|
+
* since AFFiNE with **no consumer at all** on either side. This command is the
|
|
8
|
+
* consumer, and the counterpart of the paste path that already turns a host URL
|
|
9
|
+
* back into an inline reference (`ParseDocUrlProvider`, read by
|
|
10
|
+
* `adapters/middlewares/paste.ts`). Copy here, paste there, and the round trip
|
|
11
|
+
* closes without the library ever spelling a URL.
|
|
12
|
+
*
|
|
13
|
+
* It lives in the registry rather than in the host chrome because ADR 0008
|
|
14
|
+
* makes a command the single source for its keystroke, its palette entry and
|
|
15
|
+
* its Settings › Shortcuts row. A host-side button would be reachable from none
|
|
16
|
+
* of the three, and would not fire while the focus is inside the editor.
|
|
17
|
+
*
|
|
18
|
+
* Default chord `Mod-Alt-l` (product decision, PR #401 — the gesture users
|
|
19
|
+
* already know from Notion). NOT `Mod-l`: `Ctrl+L` / `Cmd+L` is the browser's
|
|
20
|
+
* address bar and never reaches the page, so a default on it would silently do
|
|
21
|
+
* nothing on the web. `scope: 'global'` so it fires in page mode and on the
|
|
22
|
+
* canvas alike.
|
|
23
|
+
*
|
|
24
|
+
* **`navigator.clipboard` can be absent, not merely refusing.** The Clipboard
|
|
25
|
+
* API is a secure-context feature: over plain `http://` on anything but
|
|
26
|
+
* `localhost`, and in a cross-origin iframe with no `clipboard-write`
|
|
27
|
+
* permission, the `clipboard` property is `undefined` altogether — so reaching
|
|
28
|
+
* for `writeText` throws a synchronous `TypeError` out of `run` rather than
|
|
29
|
+
* returning a promise to reject. That is checked before anything is announced:
|
|
30
|
+
* no copy, no toast, no telemetry, one `console.error` saying why. Announcing a
|
|
31
|
+
* copy that never happened is the one failure mode worse than doing nothing.
|
|
32
|
+
*
|
|
33
|
+
* A clipboard that EXISTS and then rejects (permission denied at the moment of
|
|
34
|
+
* writing) is a different case and is left as it is: the promise is caught, and
|
|
35
|
+
* the toast has already been shown — the same optimistic behaviour the inline
|
|
36
|
+
* link toolbar has always had, kept deliberately so the two copy-a-link
|
|
37
|
+
* gestures do not answer differently.
|
|
38
|
+
*/
|
|
39
|
+
import { DocModeProvider, GenerateDocUrlProvider, NotificationProvider, TOAST_LINK_COPIED, TelemetryProvider, translateKey, } from '../../affine-shared/services/index.js';
|
|
40
|
+
import { BlockSelection, SurfaceSelection, } from '../../std/index.js';
|
|
41
|
+
/**
|
|
42
|
+
* Where the link points INSIDE the document, read off the live selection.
|
|
43
|
+
*
|
|
44
|
+
* `mode` is not decoration: the reader of these params
|
|
45
|
+
* (`extractSearchParams`, `adapters/middlewares/paste.ts`) only looks at
|
|
46
|
+
* `blockIds` / `elementIds` once it has found a valid `mode` in the query
|
|
47
|
+
* string, so an anchor emitted without one is dropped on the way back in. When
|
|
48
|
+
* no `DocModeProvider` is registered the anchor is therefore left out entirely
|
|
49
|
+
* rather than written in a form nothing can read — the link still opens the
|
|
50
|
+
* document, which is the honest degradation.
|
|
51
|
+
*
|
|
52
|
+
* Canvas before prose: a surface selection and a block selection can coexist in
|
|
53
|
+
* the store (selecting a note on the canvas leaves the page's own selection
|
|
54
|
+
* behind), and on the canvas the element IS what the user pointed at.
|
|
55
|
+
*
|
|
56
|
+
* A caret is deliberately NOT an anchor. `TextSelection` exists the whole time
|
|
57
|
+
* somebody is typing, so reading it would mean every copy silently points at a
|
|
58
|
+
* paragraph instead of the document — the opposite of what an unsolicited
|
|
59
|
+
* keystroke should do.
|
|
60
|
+
*/
|
|
61
|
+
function anchorOf(std) {
|
|
62
|
+
const mode = std.getOptional(DocModeProvider)?.getEditorMode();
|
|
63
|
+
if (!mode)
|
|
64
|
+
return undefined;
|
|
65
|
+
const elementIds = std.selection
|
|
66
|
+
.filter(SurfaceSelection)
|
|
67
|
+
.flatMap(selection => selection.elements);
|
|
68
|
+
if (elementIds.length)
|
|
69
|
+
return { mode, elementIds };
|
|
70
|
+
const blockIds = std.selection
|
|
71
|
+
.filter(BlockSelection)
|
|
72
|
+
.map(selection => selection.blockId);
|
|
73
|
+
if (blockIds.length)
|
|
74
|
+
return { mode, blockIds };
|
|
75
|
+
return { mode };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The seam, or nothing. Read through `getOptional` like every other host seam,
|
|
79
|
+
* and reported as UNAVAILABLE rather than as a silent no-op: a palette entry
|
|
80
|
+
* that copies nothing and a shortcut that does nothing are both worse than an
|
|
81
|
+
* entry that is not there (`docs/integrate/04-host-seams.md`, step 2 of "How to
|
|
82
|
+
* add a seam").
|
|
83
|
+
*/
|
|
84
|
+
const canCopyDocLink = (std) => !!std.getOptional(GenerateDocUrlProvider);
|
|
85
|
+
const copyDocLink = {
|
|
86
|
+
id: 'doc.copyLink',
|
|
87
|
+
owner: 'core',
|
|
88
|
+
kind: 'action',
|
|
89
|
+
// `com.labre.command.*` like the other keyless-by-intent core commands, not
|
|
90
|
+
// `com.labre.keyboardShortcuts.*`: this one is a capability that happens to
|
|
91
|
+
// carry a default chord, and the shortcut namespace would file it as a
|
|
92
|
+
// keymap row for a translator.
|
|
93
|
+
labelKey: 'com.labre.command.doc.copy-link',
|
|
94
|
+
labelFallback: 'Copy document link',
|
|
95
|
+
descriptionKey: 'com.labre.command.doc.copy-link.description',
|
|
96
|
+
descriptionFallback: 'Copy a link to this document, anchored on the selection, so it can be ' +
|
|
97
|
+
'pasted into a text as a reference.',
|
|
98
|
+
keywords: ['link', 'url', 'share', 'reference'],
|
|
99
|
+
surfaces: ['palette', 'agent'],
|
|
100
|
+
scope: 'global',
|
|
101
|
+
defaultKeys: { mac: ['Mod-Alt-l'], other: ['Mod-Alt-l'] },
|
|
102
|
+
// Copying an address is legitimate in a read-only document, so nothing here
|
|
103
|
+
// is gated on `editable`; the only precondition is the seam, which is not
|
|
104
|
+
// expressible in the serializable union and therefore rides on `when`.
|
|
105
|
+
availability: 'always',
|
|
106
|
+
when: canCopyDocLink,
|
|
107
|
+
run: (std, invocation) => {
|
|
108
|
+
// The load-bearing half of the gate: `runCommand` consults neither
|
|
109
|
+
// `availability` nor `when`, so the palette and the agent reach `run`
|
|
110
|
+
// directly — the same arbitration `tag.set` records.
|
|
111
|
+
const generator = std.getOptional(GenerateDocUrlProvider);
|
|
112
|
+
if (!generator)
|
|
113
|
+
return;
|
|
114
|
+
const params = anchorOf(std);
|
|
115
|
+
const url = generator.generateDocUrl(std.store.id, params);
|
|
116
|
+
// A host may decline — an unsaved document, one it does not route. Nothing
|
|
117
|
+
// is copied and nothing is announced.
|
|
118
|
+
if (!url)
|
|
119
|
+
return;
|
|
120
|
+
// Not a promise rejection: outside a secure context the property itself is
|
|
121
|
+
// `undefined`, so this would be a synchronous `TypeError` thrown out of
|
|
122
|
+
// `run` — and `runCommand` only catches what a returned promise rejects
|
|
123
|
+
// with, so it would surface as an unhandled error taking the keystroke
|
|
124
|
+
// down with it. Nothing announced, one line saying why.
|
|
125
|
+
if (!navigator.clipboard) {
|
|
126
|
+
console.error('doc.copyLink: no clipboard API — a secure context (https, or ' +
|
|
127
|
+
'localhost) is required, and an iframe needs `clipboard-write`.');
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
navigator.clipboard.writeText(url).catch(console.error);
|
|
131
|
+
std
|
|
132
|
+
.getOptional(NotificationProvider)
|
|
133
|
+
?.toast(translateKey(std, ...TOAST_LINK_COPIED));
|
|
134
|
+
// Self-emitted rather than declared through `CommandDescriptor.telemetry`:
|
|
135
|
+
// that field routes the bottleneck's reporter onto the three framework
|
|
136
|
+
// CREATION events and requires a `FrameworkId`, and this command creates
|
|
137
|
+
// nothing and belongs to no framework. `CopiedLink` is the event the two
|
|
138
|
+
// other copy-a-link sites already emit (the inline link toolbar, the
|
|
139
|
+
// iframe embed toolbar); reusing it keeps "links copied" one series.
|
|
140
|
+
// Ids never cross: the document id and the anchored ids stay here.
|
|
141
|
+
std.getOptional(TelemetryProvider)?.track('CopiedLink', {
|
|
142
|
+
page: params?.mode === 'edgeless' ? 'whiteboard editor' : 'doc editor',
|
|
143
|
+
segment: 'editor',
|
|
144
|
+
module: invocation.surface,
|
|
145
|
+
control: invocation.source,
|
|
146
|
+
type: params?.elementIds?.length
|
|
147
|
+
? 'element'
|
|
148
|
+
: params?.blockIds?.length
|
|
149
|
+
? 'block'
|
|
150
|
+
: 'document',
|
|
151
|
+
result: 'success',
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
export const copyLinkCommands = [copyDocLink];
|
|
@@ -5,7 +5,7 @@ import { toast } from '../../affine-components/toast/index.js';
|
|
|
5
5
|
import { EditorChevronDown } from '../../affine-components/toolbar/index.js';
|
|
6
6
|
import { deleteTextCommand, formatBlockCommand, formatNativeCommand, formatTextCommand, isFormatSupported, textFormatConfigs, } from '../../affine-inline-preset/index.js';
|
|
7
7
|
import { EmbedLinkedDocBlockSchema, EmbedSyncedDocBlockSchema, } from '../../affine-model/index.js';
|
|
8
|
-
import { textConversionConfigs } from '../../affine-rich-text/index.js';
|
|
8
|
+
import { textConversionConfigs, TextConversionEntryIdentifier, } from '../../affine-rich-text/index.js';
|
|
9
9
|
import { copySelectedModelsCommand, deleteSelectedModelsCommand, draftSelectedModelsCommand, duplicateSelectedModelsCommand, getBlockSelectionsCommand, getImageSelectionsCommand, getSelectedBlocksCommand, getSelectedModelsCommand, getTextSelectionCommand, } from '../../affine-shared/commands/index.js';
|
|
10
10
|
import { ActionPlacement, blockCommentToolbarButton, TOAST_COPIED_TO_CLIPBOARD, TOOLBAR_COPY, TOOLBAR_DELETE, TOOLBAR_DUPLICATE, translateKey, } from '../../affine-shared/services/index.js';
|
|
11
11
|
import { tableViewMeta } from '../../data-view/view-presets/index.js';
|
|
@@ -42,6 +42,11 @@ const conversionsActionGroup = {
|
|
|
42
42
|
})
|
|
43
43
|
.run();
|
|
44
44
|
};
|
|
45
|
+
// Conversions a gated block package registers from its own view extension
|
|
46
|
+
// (#418): absent when its flag is off, so never listed statically here.
|
|
47
|
+
const contributed = [
|
|
48
|
+
...std.provider.getAll(TextConversionEntryIdentifier).values(),
|
|
49
|
+
].filter(entry => entry.when(std, selectedModels));
|
|
45
50
|
return {
|
|
46
51
|
content: html `
|
|
47
52
|
<editor-menu-button
|
|
@@ -65,6 +70,17 @@ const conversionsActionGroup = {
|
|
|
65
70
|
${icon}<span class="label">${name}</span>
|
|
66
71
|
</editor-menu-action>
|
|
67
72
|
`)}
|
|
73
|
+
${repeat(contributed, entry => entry.flavour, entry => {
|
|
74
|
+
const label = translateKey(std, ...entry.nameWording);
|
|
75
|
+
return html `
|
|
76
|
+
<editor-menu-action
|
|
77
|
+
aria-label=${label}
|
|
78
|
+
@click=${() => entry.run(std, selectedModels)}
|
|
79
|
+
>
|
|
80
|
+
${entry.icon}<span class="label">${label}</span>
|
|
81
|
+
</editor-menu-action>
|
|
82
|
+
`;
|
|
83
|
+
})}
|
|
68
84
|
</div>
|
|
69
85
|
</editor-menu-button>
|
|
70
86
|
`,
|
|
@@ -7,7 +7,7 @@ import { BookmarkStyles, DEFAULT_NOTE_HEIGHT, DEFAULT_NOTE_WIDTH, FrameBlockMode
|
|
|
7
7
|
import { ClipboardAdapter, decodeClipboardBlobs, ImageProxyService, } from '../../../affine-shared/adapters/index.js';
|
|
8
8
|
import { CANVAS_EXPORT_IGNORE_TAGS, EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../../affine-shared/consts/index.js';
|
|
9
9
|
import { EmbedOptionProvider, ParseDocUrlProvider, TelemetryProvider, } from '../../../affine-shared/services/index.js';
|
|
10
|
-
import { convertToPng, isInsidePageEditor, isTopLevelBlock, isUrlInClipboard, matchModels, referenceToNode, } from '../../../affine-shared/utils/index.js';
|
|
10
|
+
import { convertToPng, isInsidePageEditor, isTopLevelBlock, isUrlInClipboard, matchModels, normalizeCanvasExportColors, referenceToNode, } from '../../../affine-shared/utils/index.js';
|
|
11
11
|
import { DisposableGroup } from '../../../global/disposable/index.js';
|
|
12
12
|
import { BlockSuiteError, ErrorCode } from '../../../global/exceptions/index.js';
|
|
13
13
|
import { Bound, getCommonBound, Vec, } from '../../../global/gfx/index.js';
|
|
@@ -336,6 +336,7 @@ export class EdgelessClipboardController extends PageClipboard {
|
|
|
336
336
|
}
|
|
337
337
|
},
|
|
338
338
|
onclone: async function (documentClone, element) {
|
|
339
|
+
normalizeCanvasExportColors(documentClone, element);
|
|
339
340
|
// html2canvas can't support transform feature
|
|
340
341
|
element.style.setProperty('transform', 'none');
|
|
341
342
|
const layer = documentClone.querySelector('.affine-edgeless-layer');
|