@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
|
@@ -32,20 +32,35 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { EdgelessFrameManager } from '../../affine-block-frame/index.js';
|
|
35
|
+
import { EdgelessFrameManager, frameCommands } from '../../affine-block-frame/index.js';
|
|
36
36
|
import { DocModeProvider, EditPropsStore, translateKey, } from '../../affine-shared/services/index.js';
|
|
37
|
+
import { createPanelReorderDrag, } from '../../affine-shared/utils/index.js';
|
|
37
38
|
import { DisposableGroup } from '../../global/disposable/index.js';
|
|
38
39
|
import { Bound } from '../../global/gfx/index.js';
|
|
39
40
|
import { SignalWatcher, WithDisposable } from '../../global/lit/index.js';
|
|
40
|
-
import { ShadowlessElement } from '../../std/index.js';
|
|
41
|
-
import {
|
|
41
|
+
import { runCommand, ShadowlessElement, } from '../../std/index.js';
|
|
42
|
+
import { GfxControllerIdentifier } from '../../std/gfx/index.js';
|
|
42
43
|
import { css, html, nothing } from 'lit';
|
|
43
44
|
import { property, query, state } from 'lit/decorators.js';
|
|
44
45
|
import { keyed } from 'lit/directives/keyed.js';
|
|
45
46
|
import { repeat } from 'lit/directives/repeat.js';
|
|
47
|
+
import { FrameCard, } from '../card/frame-card.js';
|
|
46
48
|
import { FRAME_PANEL_EMPTY_PLACEHOLDER } from '../translations.js';
|
|
47
|
-
import { startDragging } from '../utils/drag.js';
|
|
48
49
|
const compare = EdgelessFrameManager.framePresentationComparator;
|
|
50
|
+
/**
|
|
51
|
+
* How the panel invokes the registry: from the editor's chrome, on the cards
|
|
52
|
+
* it names, like the selection pane's rows.
|
|
53
|
+
*/
|
|
54
|
+
const PANEL_INVOCATION = {
|
|
55
|
+
surface: 'contextual-toolbar',
|
|
56
|
+
source: 'toolbar:general',
|
|
57
|
+
};
|
|
58
|
+
function reorderCommand() {
|
|
59
|
+
const command = frameCommands.find(c => c.id === 'canvas.frame.reorder');
|
|
60
|
+
if (!command)
|
|
61
|
+
throw new Error('frame panel: no canvas.frame.reorder');
|
|
62
|
+
return command;
|
|
63
|
+
}
|
|
49
64
|
const styles = css `
|
|
50
65
|
.frame-list-container {
|
|
51
66
|
display: flex;
|
|
@@ -89,6 +104,19 @@ const styles = css `
|
|
|
89
104
|
width: 284px;
|
|
90
105
|
left: 0;
|
|
91
106
|
}
|
|
107
|
+
|
|
108
|
+
/*
|
|
109
|
+
The drag mask, created by the drag controller (createPanelReorderDrag):
|
|
110
|
+
over the whole viewport for the length of the drag, so its cursor — set
|
|
111
|
+
inline by the controller, "grabbing" or "not-allowed" — speaks wherever
|
|
112
|
+
the pointer is. The dragged cards are appended after it, so they paint
|
|
113
|
+
over it.
|
|
114
|
+
*/
|
|
115
|
+
.frame-panel-drag-mask {
|
|
116
|
+
position: fixed;
|
|
117
|
+
inset: 0;
|
|
118
|
+
z-index: calc(var(--affine-z-index-popover, 0) + 3);
|
|
119
|
+
}
|
|
92
120
|
`;
|
|
93
121
|
export const AFFINE_FRAME_PANEL_BODY = 'affine-frame-panel-body';
|
|
94
122
|
let FramePanelBody = (() => {
|
|
@@ -99,9 +127,6 @@ let FramePanelBody = (() => {
|
|
|
99
127
|
let __selected_decorators;
|
|
100
128
|
let __selected_initializers = [];
|
|
101
129
|
let __selected_extraInitializers = [];
|
|
102
|
-
let _domHost_decorators;
|
|
103
|
-
let _domHost_initializers = [];
|
|
104
|
-
let _domHost_extraInitializers = [];
|
|
105
130
|
let _editorHost_decorators;
|
|
106
131
|
let _editorHost_initializers = [];
|
|
107
132
|
let _editorHost_extraInitializers = [];
|
|
@@ -119,14 +144,12 @@ let FramePanelBody = (() => {
|
|
|
119
144
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
120
145
|
__dragging_decorators = [state()];
|
|
121
146
|
__selected_decorators = [state()];
|
|
122
|
-
_domHost_decorators = [property({ attribute: false })];
|
|
123
147
|
_editorHost_decorators = [property({ attribute: false })];
|
|
124
148
|
_fitPadding_decorators = [property({ attribute: false })];
|
|
125
149
|
_frameListContainer_decorators = [query('.frame-list-container')];
|
|
126
150
|
_insertIndex_decorators = [property({ attribute: false })];
|
|
127
151
|
__esDecorate(this, null, __dragging_decorators, { kind: "accessor", name: "_dragging", static: false, private: false, access: { has: obj => "_dragging" in obj, get: obj => obj._dragging, set: (obj, value) => { obj._dragging = value; } }, metadata: _metadata }, __dragging_initializers, __dragging_extraInitializers);
|
|
128
152
|
__esDecorate(this, null, __selected_decorators, { kind: "accessor", name: "_selected", static: false, private: false, access: { has: obj => "_selected" in obj, get: obj => obj._selected, set: (obj, value) => { obj._selected = value; } }, metadata: _metadata }, __selected_initializers, __selected_extraInitializers);
|
|
129
|
-
__esDecorate(this, null, _domHost_decorators, { kind: "accessor", name: "domHost", static: false, private: false, access: { has: obj => "domHost" in obj, get: obj => obj.domHost, set: (obj, value) => { obj.domHost = value; } }, metadata: _metadata }, _domHost_initializers, _domHost_extraInitializers);
|
|
130
153
|
__esDecorate(this, null, _editorHost_decorators, { kind: "accessor", name: "editorHost", static: false, private: false, access: { has: obj => "editorHost" in obj, get: obj => obj.editorHost, set: (obj, value) => { obj.editorHost = value; } }, metadata: _metadata }, _editorHost_initializers, _editorHost_extraInitializers);
|
|
131
154
|
__esDecorate(this, null, _fitPadding_decorators, { kind: "accessor", name: "fitPadding", static: false, private: false, access: { has: obj => "fitPadding" in obj, get: obj => obj.fitPadding, set: (obj, value) => { obj.fitPadding = value; } }, metadata: _metadata }, _fitPadding_initializers, _fitPadding_extraInitializers);
|
|
132
155
|
__esDecorate(this, null, _frameListContainer_decorators, { kind: "accessor", name: "frameListContainer", static: false, private: false, access: { has: obj => "frameListContainer" in obj, get: obj => obj.frameListContainer, set: (obj, value) => { obj.frameListContainer = value; } }, metadata: _metadata }, _frameListContainer_initializers, _frameListContainer_extraInitializers);
|
|
@@ -148,53 +171,129 @@ let FramePanelBody = (() => {
|
|
|
148
171
|
? [0, 0, 0, 0].map((val, idx) => Number.isFinite(this.fitPadding[idx]) ? this.fitPadding[idx] : val)
|
|
149
172
|
: [0, 0, 0, 0];
|
|
150
173
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
container: this,
|
|
176
|
-
document: this.ownerDocument,
|
|
177
|
-
domHost: this.domHost ?? this.ownerDocument,
|
|
178
|
-
start: {
|
|
179
|
-
x: e.detail.clientX,
|
|
180
|
-
y: e.detail.clientY,
|
|
174
|
+
/* ── Drag to reorder ────────────────────────────────────────────────── */
|
|
175
|
+
/*
|
|
176
|
+
* The gesture is the side panels' one controller (`createPanelReorderDrag`,
|
|
177
|
+
* `@labre/affine-shared/utils`, ADR 0034), shared with the selection pane:
|
|
178
|
+
* pointer events, the 5px threshold, the read-only refusal, the mask and
|
|
179
|
+
* its cursor, Escape and `pointercancel` as cancels, the swallowed click.
|
|
180
|
+
* What is the panel's own is below: the selected cards move together, their
|
|
181
|
+
* copies follow the pointer, a line marks the gap, and the write is
|
|
182
|
+
* `canvas.frame.reorder`.
|
|
183
|
+
*/
|
|
184
|
+
_createReorderDrag() {
|
|
185
|
+
return createPanelReorderDrag({
|
|
186
|
+
readonly: () => this.editorHost.store.readonly,
|
|
187
|
+
rows: () => this._cards(),
|
|
188
|
+
bounds: () => this,
|
|
189
|
+
onPickUp: press => this._pickUp(press),
|
|
190
|
+
dropAt: gap => this._dropAt(gap),
|
|
191
|
+
onMove: (drop, point) => {
|
|
192
|
+
for (const ghost of this._ghosts) {
|
|
193
|
+
ghost.pos = { x: point.clientX, y: point.clientY };
|
|
194
|
+
}
|
|
195
|
+
this._indicatorTranslateY = drop?.lineY ?? 0;
|
|
196
|
+
this.insertIndex = drop?.gap;
|
|
197
|
+
this.requestUpdate();
|
|
181
198
|
},
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
199
|
+
onDrop: drop => this._reorderFrames(this._selected.slice(), drop.before),
|
|
200
|
+
onEnd: () => {
|
|
201
|
+
this._ghosts.forEach(ghost => ghost.remove());
|
|
202
|
+
this._ghosts = [];
|
|
203
|
+
this._pressed = null;
|
|
186
204
|
this._dragging = false;
|
|
187
205
|
this.insertIndex = undefined;
|
|
188
|
-
|
|
189
|
-
return;
|
|
190
|
-
this._reorderFrames(selected, framesMap, insertIdx);
|
|
206
|
+
this._updateFrames();
|
|
191
207
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
208
|
+
mask: {
|
|
209
|
+
host: () => this,
|
|
210
|
+
className: 'frame-panel-drag-mask',
|
|
211
|
+
testId: 'frame-panel-drag-mask',
|
|
195
212
|
},
|
|
196
213
|
});
|
|
197
214
|
}
|
|
215
|
+
/** The cards on screen, in presentation order. */
|
|
216
|
+
_cards() {
|
|
217
|
+
const list = this.frameListContainer;
|
|
218
|
+
if (!list)
|
|
219
|
+
return [];
|
|
220
|
+
return Array.from(list.querySelectorAll(':scope > affine-frame-card'));
|
|
221
|
+
}
|
|
222
|
+
/** A press on a card: the controller decides whether it becomes a drag. */
|
|
223
|
+
_drag(e) {
|
|
224
|
+
const { event } = e.detail;
|
|
225
|
+
this._pressed = {
|
|
226
|
+
card: e.currentTarget,
|
|
227
|
+
shiftKey: event.shiftKey,
|
|
228
|
+
};
|
|
229
|
+
this._reorder?.press(event);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The press became a drag. The pressed card is selected if it was not
|
|
233
|
+
* (shift adds it to the selection), and every selected card moves: their
|
|
234
|
+
* copies — the last two, the top one counting them — follow the pointer,
|
|
235
|
+
* and the cards themselves stay in place as placeholders.
|
|
236
|
+
*/
|
|
237
|
+
_pickUp(press) {
|
|
238
|
+
const card = this._pressed?.card;
|
|
239
|
+
if (!card?.frame)
|
|
240
|
+
return;
|
|
241
|
+
const id = card.frame.id;
|
|
242
|
+
if (!this._selected.includes(id)) {
|
|
243
|
+
this._selected = this._pressed?.shiftKey ? [...this._selected, id] : [id];
|
|
244
|
+
this._gfx.selection.set({ elements: this._selected, editing: false });
|
|
245
|
+
}
|
|
246
|
+
const list = this.frameListContainer;
|
|
247
|
+
this._listGap = list ? parseFloat(getComputedStyle(list).gap) || 0 : 0;
|
|
248
|
+
const items = new Map(this._frameItems.map(item => [item.frame.id, item]));
|
|
249
|
+
const dragged = this._selected.flatMap(selected => {
|
|
250
|
+
const item = items.get(selected);
|
|
251
|
+
return item ? [item] : [];
|
|
252
|
+
});
|
|
253
|
+
const width = this.renderRoot.querySelector(`[data-frame-id="${dragged[0]?.frame.id}"]`)?.clientWidth ?? card.clientWidth;
|
|
254
|
+
this._ghosts = dragged.slice(-2).map((item, idx, arr) => {
|
|
255
|
+
const ghost = new FrameCard();
|
|
256
|
+
ghost.frame = item.frame;
|
|
257
|
+
ghost.cardIndex = item.cardIndex;
|
|
258
|
+
ghost.frameIndex = item.frameIndex;
|
|
259
|
+
ghost.status = 'dragging';
|
|
260
|
+
ghost.stackOrder = arr.length - 1 - idx;
|
|
261
|
+
ghost.pos = { x: press.clientX, y: press.clientY };
|
|
262
|
+
ghost.width = width;
|
|
263
|
+
ghost.std = this.editorHost.std;
|
|
264
|
+
if (ghost.stackOrder === 0) {
|
|
265
|
+
ghost.dataset.testid = 'frame-panel-drag-ghost';
|
|
266
|
+
if (dragged.length > 1)
|
|
267
|
+
ghost.draggingCardNumber = dragged.length;
|
|
268
|
+
}
|
|
269
|
+
return ghost;
|
|
270
|
+
});
|
|
271
|
+
this.renderRoot.append(...this._ghosts);
|
|
272
|
+
this._dragging = true;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* A release at the gap `gap` puts the selected cards right before the first
|
|
276
|
+
* card at or after it that does not move, or at the end. The line sits in
|
|
277
|
+
* the middle of the list's gap: above the card under the gap, or under the
|
|
278
|
+
* last card — the frame panel's own drag used to draw that last one at 0.
|
|
279
|
+
*/
|
|
280
|
+
_dropAt(gap) {
|
|
281
|
+
const cards = this._cards();
|
|
282
|
+
const last = cards[cards.length - 1];
|
|
283
|
+
if (!last)
|
|
284
|
+
return null;
|
|
285
|
+
const moving = new Set(this._selected);
|
|
286
|
+
const before = cards
|
|
287
|
+
.slice(gap)
|
|
288
|
+
.map(card => card.frame?.id)
|
|
289
|
+
.find(id => id !== undefined && !moving.has(id)) ?? null;
|
|
290
|
+
const half = this._listGap / 2;
|
|
291
|
+
const under = cards[gap];
|
|
292
|
+
const lineY = under
|
|
293
|
+
? under.offsetTop - half
|
|
294
|
+
: last.offsetTop + last.offsetHeight + half;
|
|
295
|
+
return { gap, before, lineY };
|
|
296
|
+
}
|
|
198
297
|
_fitToElement(e) {
|
|
199
298
|
const { block } = e.detail;
|
|
200
299
|
const bound = Bound.deserialize(block.xywh);
|
|
@@ -246,6 +345,7 @@ let FramePanelBody = (() => {
|
|
|
246
345
|
${this.insertIndex !== undefined
|
|
247
346
|
? html `<div
|
|
248
347
|
class="insert-indicator"
|
|
348
|
+
data-testid="frame-panel-drop-indicator"
|
|
249
349
|
style=${`transform: translateY(${this._indicatorTranslateY}px)`}
|
|
250
350
|
></div>`
|
|
251
351
|
: nothing}
|
|
@@ -253,37 +353,41 @@ let FramePanelBody = (() => {
|
|
|
253
353
|
</div>`;
|
|
254
354
|
return frameList;
|
|
255
355
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
before = newIndex;
|
|
273
|
-
});
|
|
274
|
-
this.editorHost.store.captureSync();
|
|
275
|
-
this._updateFrames();
|
|
276
|
-
}
|
|
356
|
+
/**
|
|
357
|
+
* Move the selected cards, as one block, right before the frame `before`
|
|
358
|
+
* (`null` = at the end; `_dropAt` picks it). The write is
|
|
359
|
+
* `canvas.frame.reorder` (ADR 0034): the read-only refusal, the no-op check
|
|
360
|
+
* and the one undo step live in its action, run through the imported
|
|
361
|
+
* descriptor so the panel reorders in page mode too, where the command is
|
|
362
|
+
* not registered.
|
|
363
|
+
*/
|
|
364
|
+
_reorderFrames(selected, before) {
|
|
365
|
+
if (!selected.length)
|
|
366
|
+
return;
|
|
367
|
+
runCommand(this.editorHost.std, reorderCommand(), PANEL_INVOCATION, {
|
|
368
|
+
ids: selected,
|
|
369
|
+
before,
|
|
370
|
+
});
|
|
371
|
+
this._updateFrames();
|
|
277
372
|
}
|
|
278
373
|
_setDocDisposables(doc) {
|
|
279
374
|
this._clearDocDisposables();
|
|
280
375
|
this._docDisposables = new DisposableGroup();
|
|
281
|
-
this._docDisposables.add(doc.slots.blockUpdated.subscribe(
|
|
282
|
-
if (flavour
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
376
|
+
this._docDisposables.add(doc.slots.blockUpdated.subscribe(payload => {
|
|
377
|
+
if (payload.flavour !== 'affine:frame')
|
|
378
|
+
return;
|
|
379
|
+
// A frame added or deleted changes the cards; of the updates, only a
|
|
380
|
+
// new presentation order does. The panel is not the order's only
|
|
381
|
+
// writer — an undo, a host's slide panel running
|
|
382
|
+
// `canvas.frame.reorder`, a remote peer — and it went stale on all
|
|
383
|
+
// three until reopened.
|
|
384
|
+
if (payload.type === 'update' &&
|
|
385
|
+
payload.props.key !== 'presentationIndex') {
|
|
386
|
+
return;
|
|
286
387
|
}
|
|
388
|
+
requestAnimationFrame(() => {
|
|
389
|
+
this._updateFrames();
|
|
390
|
+
});
|
|
287
391
|
}));
|
|
288
392
|
}
|
|
289
393
|
_updateFrames() {
|
|
@@ -316,10 +420,13 @@ let FramePanelBody = (() => {
|
|
|
316
420
|
connectedCallback() {
|
|
317
421
|
super.connectedCallback();
|
|
318
422
|
this._updateFrameItems();
|
|
423
|
+
this._reorder = this._createReorderDrag();
|
|
319
424
|
}
|
|
320
425
|
disconnectedCallback() {
|
|
321
426
|
super.disconnectedCallback();
|
|
322
427
|
this._clearDocDisposables();
|
|
428
|
+
this._reorder?.dispose();
|
|
429
|
+
this._reorder = null;
|
|
323
430
|
}
|
|
324
431
|
firstUpdated() {
|
|
325
432
|
const disposables = this.disposables;
|
|
@@ -354,9 +461,6 @@ let FramePanelBody = (() => {
|
|
|
354
461
|
// Store the ids of the selected frames
|
|
355
462
|
get _selected() { return this.#_selected_accessor_storage; }
|
|
356
463
|
set _selected(value) { this.#_selected_accessor_storage = value; }
|
|
357
|
-
#domHost_accessor_storage;
|
|
358
|
-
get domHost() { return this.#domHost_accessor_storage; }
|
|
359
|
-
set domHost(value) { this.#domHost_accessor_storage = value; }
|
|
360
464
|
#editorHost_accessor_storage;
|
|
361
465
|
get editorHost() { return this.#editorHost_accessor_storage; }
|
|
362
466
|
set editorHost(value) { this.#editorHost_accessor_storage = value; }
|
|
@@ -392,11 +496,21 @@ let FramePanelBody = (() => {
|
|
|
392
496
|
});
|
|
393
497
|
};
|
|
394
498
|
this._docDisposables = null;
|
|
395
|
-
this._frameElementHeight = 0;
|
|
396
499
|
this._frameItems = [];
|
|
500
|
+
/** The side panels' one reorder gesture (ADR 0034), made on connect. */
|
|
501
|
+
this._reorder = null;
|
|
502
|
+
/** The card a press landed on: what a pick-up picks up. */
|
|
503
|
+
this._pressed = null;
|
|
504
|
+
/** The dragged cards' copies following the pointer, top one last. */
|
|
505
|
+
this._ghosts = [];
|
|
506
|
+
/** The list's `gap`, read once at the pick-up: the drop line sits in it. */
|
|
507
|
+
this._listGap = 0;
|
|
397
508
|
this._indicatorTranslateY = 0;
|
|
398
509
|
this._lastEdgelessRootId = '';
|
|
399
510
|
this._selectFrame = (e) => {
|
|
511
|
+
// A drag ends with a click on the card it started on; that click is not one.
|
|
512
|
+
if (this._reorder?.consumeSwallowedClick())
|
|
513
|
+
return;
|
|
400
514
|
const { selected, id, multiselect } = e.detail;
|
|
401
515
|
if (!selected) {
|
|
402
516
|
// de-select frame
|
|
@@ -422,8 +536,7 @@ let FramePanelBody = (() => {
|
|
|
422
536
|
};
|
|
423
537
|
this.#_dragging_accessor_storage = __runInitializers(this, __dragging_initializers, false);
|
|
424
538
|
this.#_selected_accessor_storage = (__runInitializers(this, __dragging_extraInitializers), __runInitializers(this, __selected_initializers, []));
|
|
425
|
-
this.#
|
|
426
|
-
this.#editorHost_accessor_storage = (__runInitializers(this, _domHost_extraInitializers), __runInitializers(this, _editorHost_initializers, void 0));
|
|
539
|
+
this.#editorHost_accessor_storage = (__runInitializers(this, __selected_extraInitializers), __runInitializers(this, _editorHost_initializers, void 0));
|
|
427
540
|
this.#fitPadding_accessor_storage = (__runInitializers(this, _editorHost_extraInitializers), __runInitializers(this, _fitPadding_initializers, void 0));
|
|
428
541
|
this.#frameListContainer_accessor_storage = (__runInitializers(this, _fitPadding_extraInitializers), __runInitializers(this, _frameListContainer_initializers, void 0));
|
|
429
542
|
this.#insertIndex_accessor_storage = (__runInitializers(this, _frameListContainer_extraInitializers), __runInitializers(this, _insertIndex_initializers, undefined));
|
|
@@ -11,11 +11,9 @@ export type SelectEvent = CustomEvent<{
|
|
|
11
11
|
index: number;
|
|
12
12
|
multiselect: boolean;
|
|
13
13
|
}>;
|
|
14
|
+
/** A press on a card's body, handed to the panel's drag controller. */
|
|
14
15
|
export type DragEvent = CustomEvent<{
|
|
15
|
-
|
|
16
|
-
clientY: number;
|
|
17
|
-
pageX: number;
|
|
18
|
-
pageY: number;
|
|
16
|
+
event: PointerEvent;
|
|
19
17
|
}>;
|
|
20
18
|
export type FitViewEvent = CustomEvent<{
|
|
21
19
|
block: FrameBlockModel;
|
|
@@ -24,6 +22,11 @@ export declare const AFFINE_FRAME_CARD = "affine-frame-card";
|
|
|
24
22
|
declare const FrameCard_base: typeof ShadowlessElement & import("../../global/utils/types.js").Constructor<import("../../global/lit/with-disposable.js").DisposableClass>;
|
|
25
23
|
export declare class FrameCard extends FrameCard_base {
|
|
26
24
|
static styles: import("lit").CSSResult;
|
|
25
|
+
/**
|
|
26
|
+
* Hand the press to the panel body: the threshold, the selection and the
|
|
27
|
+
* drag itself belong to the side panels' one controller, which the body
|
|
28
|
+
* holds (`createPanelReorderDrag`, ADR 0034).
|
|
29
|
+
*/
|
|
27
30
|
private _dispatchDragEvent;
|
|
28
31
|
private _dispatchFitViewEvent;
|
|
29
32
|
private _dispatchSelectEvent;
|
|
@@ -32,7 +32,6 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
32
32
|
}
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
|
-
import { on, once } from '../../affine-shared/utils/index.js';
|
|
36
35
|
import { WithDisposable } from '../../global/lit/index.js';
|
|
37
36
|
import { ShadowlessElement } from '../../std/index.js';
|
|
38
37
|
import { css, html, nothing } from 'lit';
|
|
@@ -168,33 +167,19 @@ let FrameCard = (() => {
|
|
|
168
167
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
169
168
|
}
|
|
170
169
|
static { this.styles = styles; }
|
|
170
|
+
/**
|
|
171
|
+
* Hand the press to the panel body: the threshold, the selection and the
|
|
172
|
+
* drag itself belong to the side panels' one controller, which the body
|
|
173
|
+
* holds (`createPanelReorderDrag`, ADR 0034).
|
|
174
|
+
*/
|
|
171
175
|
_dispatchDragEvent(e) {
|
|
172
176
|
e.preventDefault();
|
|
173
177
|
if (e.button !== 0)
|
|
174
178
|
return;
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
if (Math.abs(startX - e.clientX) < 5 &&
|
|
178
|
-
Math.abs(startY - e.clientY) < 5) {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
if (this.status !== 'selected') {
|
|
182
|
-
this._dispatchSelectEvent(e);
|
|
183
|
-
}
|
|
184
|
-
const event = new CustomEvent('drag', {
|
|
185
|
-
detail: {
|
|
186
|
-
clientX: e.clientX,
|
|
187
|
-
clientY: e.clientY,
|
|
188
|
-
pageX: e.pageX,
|
|
189
|
-
pageY: e.pageY,
|
|
190
|
-
},
|
|
191
|
-
});
|
|
192
|
-
this.dispatchEvent(event);
|
|
193
|
-
disposeDragStart();
|
|
194
|
-
});
|
|
195
|
-
once(this.ownerDocument, 'mouseup', () => {
|
|
196
|
-
disposeDragStart();
|
|
179
|
+
const event = new CustomEvent('drag', {
|
|
180
|
+
detail: { event: e },
|
|
197
181
|
});
|
|
182
|
+
this.dispatchEvent(event);
|
|
198
183
|
}
|
|
199
184
|
_dispatchFitViewEvent(e) {
|
|
200
185
|
e.stopPropagation();
|
|
@@ -248,7 +233,7 @@ let FrameCard = (() => {
|
|
|
248
233
|
class="frame-card-body"
|
|
249
234
|
@click=${this._dispatchSelectEvent}
|
|
250
235
|
@dblclick=${this._dispatchFitViewEvent}
|
|
251
|
-
@
|
|
236
|
+
@pointerdown=${this._dispatchDragEvent}
|
|
252
237
|
>
|
|
253
238
|
${this.status === 'dragging' && stackOrder !== 0
|
|
254
239
|
? nothing
|
|
@@ -3,7 +3,7 @@ import { LitElement, type PropertyValues } from 'lit';
|
|
|
3
3
|
export declare const AFFINE_FRAME_PANEL_HEADER = "affine-frame-panel-header";
|
|
4
4
|
declare const FramePanelHeader_base: typeof LitElement & import("../../global/utils/types.js").Constructor<import("../../global/lit/with-disposable.js").DisposableClass>;
|
|
5
5
|
export declare class FramePanelHeader extends FramePanelHeader_base {
|
|
6
|
-
static styles: import("lit").CSSResult;
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
7
|
private readonly _clearEdgelessDisposables;
|
|
8
8
|
private _edgelessDisposables;
|
|
9
9
|
private get _gfx();
|
|
@@ -35,6 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
35
35
|
import { PresentTool } from '../../affine-block-frame/index.js';
|
|
36
36
|
import { EdgelessLegacySlotIdentifier } from '../../affine-block-surface/index.js';
|
|
37
37
|
import { DocModeProvider, EditPropsStore, translateKey, } from '../../affine-shared/services/index.js';
|
|
38
|
+
import { panelHeaderStyles } from '../../affine-shared/styles/index.js';
|
|
38
39
|
import { createButtonPopper } from '../../affine-shared/utils/index.js';
|
|
39
40
|
import { DisposableGroup } from '../../global/disposable/index.js';
|
|
40
41
|
import { WithDisposable } from '../../global/lit/index.js';
|
|
@@ -50,16 +51,6 @@ const styles = css `
|
|
|
50
51
|
justify-content: start;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
.frame-panel-header {
|
|
54
|
-
display: flex;
|
|
55
|
-
width: 100%;
|
|
56
|
-
height: 36px;
|
|
57
|
-
align-items: center;
|
|
58
|
-
justify-content: space-between;
|
|
59
|
-
box-sizing: border-box;
|
|
60
|
-
padding: 0 8px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
54
|
.all-frames-setting {
|
|
64
55
|
display: flex;
|
|
65
56
|
align-items: center;
|
|
@@ -69,22 +60,9 @@ const styles = css `
|
|
|
69
60
|
margin: 8px 4px;
|
|
70
61
|
}
|
|
71
62
|
|
|
72
|
-
.all-frames-setting-button svg {
|
|
73
|
-
color: var(--affine-icon-secondary);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.all-frames-setting-button:hover svg,
|
|
77
|
-
.all-frames-setting-button.active svg {
|
|
78
|
-
color: var(--affine-icon-color);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
63
|
.all-frames-setting-label {
|
|
82
64
|
width: 68px;
|
|
83
65
|
height: 22px;
|
|
84
|
-
font-size: var(--affine-font-sm);
|
|
85
|
-
font-weight: 500;
|
|
86
|
-
line-height: 22px;
|
|
87
|
-
color: var(--light-text-color-text-secondary-color, #8e8d91);
|
|
88
66
|
}
|
|
89
67
|
|
|
90
68
|
.frames-setting-container {
|
|
@@ -158,7 +136,9 @@ let FramePanelHeader = (() => {
|
|
|
158
136
|
__esDecorate(this, null, _editorHost_decorators, { kind: "accessor", name: "editorHost", static: false, private: false, access: { has: obj => "editorHost" in obj, get: obj => obj.editorHost, set: (obj, value) => { obj.editorHost = value; } }, metadata: _metadata }, _editorHost_initializers, _editorHost_extraInitializers);
|
|
159
137
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
160
138
|
}
|
|
161
|
-
|
|
139
|
+
// The header row, title and icon button are every side panel's: they live in
|
|
140
|
+
// panelHeaderStyles so the selection pane and the catalogue draw the same.
|
|
141
|
+
static { this.styles = [panelHeaderStyles, styles]; }
|
|
162
142
|
get _gfx() {
|
|
163
143
|
return this.editorHost.std.get(GfxControllerIdentifier);
|
|
164
144
|
}
|
|
@@ -194,13 +174,14 @@ let FramePanelHeader = (() => {
|
|
|
194
174
|
}
|
|
195
175
|
render() {
|
|
196
176
|
const { std } = this.editorHost;
|
|
197
|
-
return html `<div class="frame-panel-header">
|
|
177
|
+
return html `<div class="frame-panel-header affine-panel-header">
|
|
198
178
|
<div class="all-frames-setting">
|
|
199
|
-
<span class="all-frames-setting-label"
|
|
179
|
+
<span class="all-frames-setting-label affine-panel-header-title"
|
|
200
180
|
>${translateKey(std, ...FRAME_PANEL_ALL_FRAMES_LABEL)}</span
|
|
201
181
|
>
|
|
202
182
|
<edgeless-tool-icon-button
|
|
203
|
-
class="all-frames-setting-button ${this
|
|
183
|
+
class="all-frames-setting-button affine-panel-header-button ${this
|
|
184
|
+
._settingPopperShow
|
|
204
185
|
? 'active'
|
|
205
186
|
: ''}"
|
|
206
187
|
.tooltip=${this._settingPopperShow
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { textDecorationLine } from '../../../affine-gfx-text/index.js';
|
|
1
2
|
import { ConnectorMode, DefaultTheme, } from '../../../affine-model/index.js';
|
|
2
3
|
import { PointLocation, SVGPathBuilder } from '../../../global/gfx/index.js';
|
|
3
4
|
import { isConnectorWithLabel } from '../../connector-manager.js';
|
|
@@ -207,7 +208,7 @@ function renderConnectorLabel(model, retained, renderer, zoom, slot) {
|
|
|
207
208
|
return;
|
|
208
209
|
}
|
|
209
210
|
const [lx, ly, lw, lh] = content.xywh;
|
|
210
|
-
const { labelStyle: { color, fontSize, fontWeight, fontStyle, fontFamily, textAlign, }, } = model;
|
|
211
|
+
const { labelStyle: { color, fontSize, fontWeight, fontStyle, fontFamily, textAlign, textDecoration, }, } = model;
|
|
211
212
|
const labelElement = getOrCreateLabelElement(retained, slot);
|
|
212
213
|
labelElement.style.position = 'absolute';
|
|
213
214
|
labelElement.style.left = `${lx * zoom}px`;
|
|
@@ -231,6 +232,7 @@ function renderConnectorLabel(model, retained, renderer, zoom, slot) {
|
|
|
231
232
|
labelElement.style.fontStyle = fontStyle;
|
|
232
233
|
labelElement.style.fontFamily = fontFamily;
|
|
233
234
|
labelElement.style.textAlign = textAlign;
|
|
235
|
+
labelElement.style.textDecorationLine = textDecorationLine(textDecoration);
|
|
234
236
|
labelElement.style.lineHeight = '1.2';
|
|
235
237
|
labelElement.style.whiteSpace = 'pre-wrap';
|
|
236
238
|
labelElement.style.wordWrap = 'break-word';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementRendererExtension, } from '../../affine-block-surface/index.js';
|
|
2
|
-
import { getFontString, getLineHeight, getTextWidth, isRTL, wrapTextDeltas, } from '../../affine-gfx-text/index.js';
|
|
2
|
+
import { alphabeticBaselineOffset, getFontString, getLineHeight, getTextWidth, isRTL, paintTextDecoration, wrapTextDeltas, } from '../../affine-gfx-text/index.js';
|
|
3
3
|
import { ConnectorMode, DefaultTheme, } from '../../affine-model/index.js';
|
|
4
4
|
import { getBezierParameters, } from '../../global/gfx/index.js';
|
|
5
5
|
import { deltaInsertsToChunks } from '../../std/inline/index.js';
|
|
@@ -170,7 +170,7 @@ function renderEndpoint(model, location, ctx, rc, end, style, stroke) {
|
|
|
170
170
|
* which pair of fields the function reached into.
|
|
171
171
|
*/
|
|
172
172
|
function renderLabel(label, ctx, matrix, renderer) {
|
|
173
|
-
const { text, xywh, style: { color, fontSize, fontWeight, fontStyle, fontFamily, textAlign }, constraints: { hasMaxWidth, maxWidth }, } = label;
|
|
173
|
+
const { text, xywh, style: { color, fontSize, fontWeight, fontStyle, fontFamily, textAlign, textDecoration, }, constraints: { hasMaxWidth, maxWidth }, } = label;
|
|
174
174
|
const font = getFontString({
|
|
175
175
|
fontStyle,
|
|
176
176
|
fontWeight,
|
|
@@ -193,7 +193,8 @@ function renderLabel(label, ctx, matrix, renderer) {
|
|
|
193
193
|
ctx.font = font;
|
|
194
194
|
ctx.textAlign = textAlign;
|
|
195
195
|
ctx.textBaseline = 'middle';
|
|
196
|
-
|
|
196
|
+
const fill = renderer.getColorValue(color, DefaultTheme.black, true);
|
|
197
|
+
ctx.fillStyle = fill;
|
|
197
198
|
let textMaxWidth = textAlign === 'center' ? 0 : getMaxTextWidth(lines, font);
|
|
198
199
|
if (hasMaxWidth && maxWidth > 0) {
|
|
199
200
|
textMaxWidth = Math.min(textMaxWidth, textMaxWidth);
|
|
@@ -219,7 +220,23 @@ function renderLabel(label, ctx, matrix, renderer) {
|
|
|
219
220
|
: rtl
|
|
220
221
|
? 0.5
|
|
221
222
|
: -0.5);
|
|
222
|
-
|
|
223
|
+
const lineY = index * lineHeight - textHeight + cy;
|
|
224
|
+
ctx.fillText(str, x + cx, lineY);
|
|
225
|
+
if (textDecoration) {
|
|
226
|
+
// Painted on the `middle` baseline; the line hangs off the alphabetic
|
|
227
|
+
// one, measured below it.
|
|
228
|
+
paintTextDecoration(ctx, {
|
|
229
|
+
decoration: textDecoration,
|
|
230
|
+
lineText: str,
|
|
231
|
+
font,
|
|
232
|
+
x: x + cx,
|
|
233
|
+
baselineY: lineY + alphabeticBaselineOffset(font, 'middle'),
|
|
234
|
+
fontFamily,
|
|
235
|
+
fontSize,
|
|
236
|
+
fontWeight,
|
|
237
|
+
color: fill,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
223
240
|
if (shouldTemporarilyAttach) {
|
|
224
241
|
ctx.canvas.remove();
|
|
225
242
|
}
|