@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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Store } from '../../../../store/index.js';
|
|
2
|
+
import type { GfxModel } from '../model.js';
|
|
3
|
+
import type { SurfaceBlockModel } from './surface-model.js';
|
|
4
|
+
/**
|
|
5
|
+
* The layer every element belongs to while it names none (ADR 0031 §2, §3).
|
|
6
|
+
* A `@` cannot appear in a nanoid, so it never collides with a real layer id;
|
|
7
|
+
* it has no record while the surface has no `layers`, and is written as
|
|
8
|
+
* `undefined` on an element, never as this string.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_LAYER_ID = "@default";
|
|
11
|
+
/** One user layer, stored on the surface under its id (ADR 0031 §2). */
|
|
12
|
+
export type SurfaceLayerRecord = {
|
|
13
|
+
/** Seeded through the translation seam at creation; content from then on. */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Fractional key, bottom → top; the same alphabet as an element's `index`. */
|
|
16
|
+
index: string;
|
|
17
|
+
/** "Hide for everyone" on the whole layer. Absent = visible. */
|
|
18
|
+
hidden?: true;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* What a model names as its own layer: an element's `layer` field, a gfx
|
|
22
|
+
* block's `layer` prop. `undefined` = the default layer.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ownLayerOf(model: unknown): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The model whose `layer` decides `model`'s (ADR 0031 §5): its outermost
|
|
27
|
+
* group-like ELEMENT ancestor (a group, a mindmap), else `model` itself. A
|
|
28
|
+
* group lives in one layer, stored once on its outermost group, so this is
|
|
29
|
+
* what {@link SurfaceUserLayers.effectiveLayerOf} reads and what a "move to
|
|
30
|
+
* layer" writes on. Frames are blocks and do not count. `groups` walks the
|
|
31
|
+
* model's surface, which throws on a detached model: that one carries itself.
|
|
32
|
+
*/
|
|
33
|
+
export declare function layerCarrierOf(model: GfxModel): GfxModel;
|
|
34
|
+
/**
|
|
35
|
+
* The user layers of one surface, resolved for the comparator (ADR 0031 §4).
|
|
36
|
+
*
|
|
37
|
+
* Two caches, both thrown away by a revision bump rather than kept in step:
|
|
38
|
+
*
|
|
39
|
+
* - the rank of every layer id (its record's `index`), rebuilt when the
|
|
40
|
+
* `layers` prop changes — `null` while the surface has no layer, which is
|
|
41
|
+
* the fast path: `compare` then never asks for an effective layer at all;
|
|
42
|
+
* - each model's EFFECTIVE layer, rebuilt when anything that decides it
|
|
43
|
+
* changes: a `layer` write, a regroup, an element added or removed.
|
|
44
|
+
*
|
|
45
|
+
* The effective layer is the `layer` of the model's outermost group-like
|
|
46
|
+
* ELEMENT ancestor (a group, a mindmap), else its own; a dangling id or none
|
|
47
|
+
* is {@link DEFAULT_LAYER_ID}. Frames are not counted: a frame is a slide,
|
|
48
|
+
* and a background layer under a content layer inside one frame is the point
|
|
49
|
+
* of layers. Nothing here writes: a dangling id is read as the default and
|
|
50
|
+
* left as it is.
|
|
51
|
+
*/
|
|
52
|
+
export declare class SurfaceUserLayers {
|
|
53
|
+
private readonly _surface;
|
|
54
|
+
private _ranks;
|
|
55
|
+
private _revision;
|
|
56
|
+
private readonly _effective;
|
|
57
|
+
constructor(_surface: SurfaceBlockModel);
|
|
58
|
+
/** Every layer id with its rank key, or `null` when there is no layer. */
|
|
59
|
+
get ranks(): ReadonlyMap<string, string> | null;
|
|
60
|
+
/** The `layers` record changed: ranks and effective layers are stale. */
|
|
61
|
+
invalidateRanks(): void;
|
|
62
|
+
/** Something that decides an effective layer changed. */
|
|
63
|
+
invalidateMembership(): void;
|
|
64
|
+
/** The layer `model` stacks and shows with. */
|
|
65
|
+
effectiveLayerOf(model: GfxModel): string;
|
|
66
|
+
}
|
|
67
|
+
export declare function registerSurfaceOfStore(store: Store, surface: SurfaceBlockModel): void;
|
|
68
|
+
export declare function userLayersOf(model: unknown): SurfaceUserLayers | null;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { GfxPrimitiveElementModel } from './element-model.js';
|
|
2
|
+
/**
|
|
3
|
+
* The layer every element belongs to while it names none (ADR 0031 §2, §3).
|
|
4
|
+
* A `@` cannot appear in a nanoid, so it never collides with a real layer id;
|
|
5
|
+
* it has no record while the surface has no `layers`, and is written as
|
|
6
|
+
* `undefined` on an element, never as this string.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_LAYER_ID = '@default';
|
|
9
|
+
/**
|
|
10
|
+
* What a model names as its own layer: an element's `layer` field, a gfx
|
|
11
|
+
* block's `layer` prop. `undefined` = the default layer.
|
|
12
|
+
*/
|
|
13
|
+
export function ownLayerOf(model) {
|
|
14
|
+
if (model instanceof GfxPrimitiveElementModel)
|
|
15
|
+
return model.layer;
|
|
16
|
+
try {
|
|
17
|
+
const props = model.props;
|
|
18
|
+
return typeof props?.layer === 'string' ? props.layer : undefined;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The model whose `layer` decides `model`'s (ADR 0031 §5): its outermost
|
|
26
|
+
* group-like ELEMENT ancestor (a group, a mindmap), else `model` itself. A
|
|
27
|
+
* group lives in one layer, stored once on its outermost group, so this is
|
|
28
|
+
* what {@link SurfaceUserLayers.effectiveLayerOf} reads and what a "move to
|
|
29
|
+
* layer" writes on. Frames are blocks and do not count. `groups` walks the
|
|
30
|
+
* model's surface, which throws on a detached model: that one carries itself.
|
|
31
|
+
*/
|
|
32
|
+
export function layerCarrierOf(model) {
|
|
33
|
+
let groups = [];
|
|
34
|
+
try {
|
|
35
|
+
groups = model.groups ?? [];
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
groups = [];
|
|
39
|
+
}
|
|
40
|
+
for (let i = groups.length - 1; i >= 0; i--) {
|
|
41
|
+
if (groups[i] instanceof GfxPrimitiveElementModel) {
|
|
42
|
+
return groups[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return model;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The user layers of one surface, resolved for the comparator (ADR 0031 §4).
|
|
49
|
+
*
|
|
50
|
+
* Two caches, both thrown away by a revision bump rather than kept in step:
|
|
51
|
+
*
|
|
52
|
+
* - the rank of every layer id (its record's `index`), rebuilt when the
|
|
53
|
+
* `layers` prop changes — `null` while the surface has no layer, which is
|
|
54
|
+
* the fast path: `compare` then never asks for an effective layer at all;
|
|
55
|
+
* - each model's EFFECTIVE layer, rebuilt when anything that decides it
|
|
56
|
+
* changes: a `layer` write, a regroup, an element added or removed.
|
|
57
|
+
*
|
|
58
|
+
* The effective layer is the `layer` of the model's outermost group-like
|
|
59
|
+
* ELEMENT ancestor (a group, a mindmap), else its own; a dangling id or none
|
|
60
|
+
* is {@link DEFAULT_LAYER_ID}. Frames are not counted: a frame is a slide,
|
|
61
|
+
* and a background layer under a content layer inside one frame is the point
|
|
62
|
+
* of layers. Nothing here writes: a dangling id is read as the default and
|
|
63
|
+
* left as it is.
|
|
64
|
+
*/
|
|
65
|
+
export class SurfaceUserLayers {
|
|
66
|
+
constructor(_surface) {
|
|
67
|
+
this._surface = _surface;
|
|
68
|
+
this._ranks = undefined;
|
|
69
|
+
this._revision = 0;
|
|
70
|
+
this._effective = new WeakMap();
|
|
71
|
+
}
|
|
72
|
+
/** Every layer id with its rank key, or `null` when there is no layer. */
|
|
73
|
+
get ranks() {
|
|
74
|
+
if (this._ranks === undefined) {
|
|
75
|
+
const layers = this._surface.props.layers;
|
|
76
|
+
if (!layers || Object.keys(layers).length === 0) {
|
|
77
|
+
this._ranks = null;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const ranks = new Map();
|
|
81
|
+
for (const [id, record] of Object.entries(layers)) {
|
|
82
|
+
if (record && typeof record.index === 'string') {
|
|
83
|
+
ranks.set(id, record.index);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
this._ranks = ranks.size ? ranks : null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return this._ranks;
|
|
90
|
+
}
|
|
91
|
+
/** The `layers` record changed: ranks and effective layers are stale. */
|
|
92
|
+
invalidateRanks() {
|
|
93
|
+
this._ranks = undefined;
|
|
94
|
+
this._revision++;
|
|
95
|
+
}
|
|
96
|
+
/** Something that decides an effective layer changed. */
|
|
97
|
+
invalidateMembership() {
|
|
98
|
+
this._revision++;
|
|
99
|
+
}
|
|
100
|
+
/** The layer `model` stacks and shows with. */
|
|
101
|
+
effectiveLayerOf(model) {
|
|
102
|
+
const cached = this._effective.get(model);
|
|
103
|
+
if (cached && cached.revision === this._revision)
|
|
104
|
+
return cached.layer;
|
|
105
|
+
const named = ownLayerOf(layerCarrierOf(model));
|
|
106
|
+
const ranks = this.ranks;
|
|
107
|
+
const layer = named !== undefined && ranks?.has(named) ? named : DEFAULT_LAYER_ID;
|
|
108
|
+
this._effective.set(model, { revision: this._revision, layer });
|
|
109
|
+
return layer;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Which surface a model's layers are read from. An element knows its
|
|
114
|
+
* surface; a gfx block knows its store, and the surface registers itself for
|
|
115
|
+
* its store when it initialises, so the comparator never queries the store.
|
|
116
|
+
*/
|
|
117
|
+
const SURFACE_OF_STORE = new WeakMap();
|
|
118
|
+
export function registerSurfaceOfStore(store, surface) {
|
|
119
|
+
SURFACE_OF_STORE.set(store, surface);
|
|
120
|
+
}
|
|
121
|
+
export function userLayersOf(model) {
|
|
122
|
+
if (model instanceof GfxPrimitiveElementModel) {
|
|
123
|
+
return model.surface?.userLayers ?? null;
|
|
124
|
+
}
|
|
125
|
+
const store = model.store;
|
|
126
|
+
return store ? (SURFACE_OF_STORE.get(store)?.userLayers ?? null) : null;
|
|
127
|
+
}
|
|
@@ -18,7 +18,7 @@ export interface BlockStdOptions {
|
|
|
18
18
|
extensions: ExtensionType[];
|
|
19
19
|
}
|
|
20
20
|
export declare class BlockStdScope {
|
|
21
|
-
static internalExtensions: (typeof ViewStore | typeof UIEventDispatcher | typeof RangeManager | typeof CommandManager | typeof
|
|
21
|
+
static internalExtensions: (typeof ViewStore | typeof UIEventDispatcher | typeof RangeManager | typeof CommandManager | typeof ElementHighlightManager | typeof GridManager | typeof GfxSelectionManager | typeof SurfaceMiddlewareExtension | typeof ViewManager | typeof LayerManager | typeof ServiceManager)[];
|
|
22
22
|
readonly container: Container;
|
|
23
23
|
readonly store: Store;
|
|
24
24
|
readonly provider: ServiceProvider;
|
|
@@ -8,6 +8,16 @@ export declare function getLayerEndZIndex(layers: Layer[], layerIndex: number):
|
|
|
8
8
|
export declare function updateLayersZIndex(layers: Layer[], startIdx: number): void;
|
|
9
9
|
export declare function getElementIndex(indexable: GfxModel): string;
|
|
10
10
|
export declare function ungroupIndex(index: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Insert `element` after every element that sorts before it or ties with it.
|
|
13
|
+
*
|
|
14
|
+
* The array is kept sorted by `compare`, so that predicate holds on a prefix
|
|
15
|
+
* and the position is found by bisection. The linear scan it replaces asked
|
|
16
|
+
* `compare` (which walks both elements' group chains) of every element on
|
|
17
|
+
* every insert: a paste of N elements was N² comparisons. Where an index is
|
|
18
|
+
* shared by two unrelated subtrees `compare` is not transitive and both pick
|
|
19
|
+
* a tied position, not always the same one (layer-ordered-insert.unit.spec).
|
|
20
|
+
*/
|
|
11
21
|
export declare function insertToOrderedArray(array: GfxModel[], element: GfxModel): void;
|
|
12
22
|
export declare function removeFromOrderedArray(array: GfxModel[], element: GfxModel): void;
|
|
13
23
|
export declare enum SortOrder {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isGfxGroupCompatibleModel, } from '../gfx/model/base.js';
|
|
2
2
|
import {} from '../gfx/model/gfx-block-model.js';
|
|
3
3
|
import { GfxLocalElementModel } from '../gfx/model/surface/local-element-model.js';
|
|
4
|
+
import { userLayersOf } from '../gfx/model/surface/user-layers.js';
|
|
4
5
|
export function getLayerEndZIndex(layers, layerIndex) {
|
|
5
6
|
const layer = layers[layerIndex];
|
|
6
7
|
return layer ? layer.zIndex + layer.elements.length - 1 : 0;
|
|
@@ -28,13 +29,29 @@ export function getElementIndex(indexable) {
|
|
|
28
29
|
export function ungroupIndex(index) {
|
|
29
30
|
return index.split('-')[0];
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Insert `element` after every element that sorts before it or ties with it.
|
|
34
|
+
*
|
|
35
|
+
* The array is kept sorted by `compare`, so that predicate holds on a prefix
|
|
36
|
+
* and the position is found by bisection. The linear scan it replaces asked
|
|
37
|
+
* `compare` (which walks both elements' group chains) of every element on
|
|
38
|
+
* every insert: a paste of N elements was N² comparisons. Where an index is
|
|
39
|
+
* shared by two unrelated subtrees `compare` is not transitive and both pick
|
|
40
|
+
* a tied position, not always the same one (layer-ordered-insert.unit.spec).
|
|
41
|
+
*/
|
|
31
42
|
export function insertToOrderedArray(array, element) {
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
let low = 0;
|
|
44
|
+
let high = array.length;
|
|
45
|
+
while (low < high) {
|
|
46
|
+
const mid = (low + high) >>> 1;
|
|
47
|
+
if (compare(array[mid], element) === SortOrder.AFTER) {
|
|
48
|
+
high = mid;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
low = mid + 1;
|
|
52
|
+
}
|
|
36
53
|
}
|
|
37
|
-
array.splice(
|
|
54
|
+
array.splice(low, 0, element);
|
|
38
55
|
}
|
|
39
56
|
export function removeFromOrderedArray(array, element) {
|
|
40
57
|
const idx = array.indexOf(element);
|
|
@@ -74,10 +91,40 @@ function compareLocal(a, b) {
|
|
|
74
91
|
if (isALocal && isBLocal && a.creator && a.creator === b.creator) {
|
|
75
92
|
return compareIndex(a.index, b.index);
|
|
76
93
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
94
|
+
const left = isALocal && a.creator ? a.creator : a;
|
|
95
|
+
const right = isBLocal && b.creator ? b.creator : b;
|
|
96
|
+
// ADR 0031 §4: user layer rank first, then everything below unchanged.
|
|
97
|
+
const byLayer = compareUserLayer(left, right);
|
|
98
|
+
if (byLayer !== SortOrder.SAME)
|
|
99
|
+
return byLayer;
|
|
100
|
+
return { a: left, b: right };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The first step of {@link compare} (ADR 0031 §4): two models in different
|
|
104
|
+
* user layers stack by their layers' `index`; anything else is `SAME`, and
|
|
105
|
+
* today's comparator decides.
|
|
106
|
+
*
|
|
107
|
+
* The fast path is the first `return`: a surface with no `layers` answers
|
|
108
|
+
* `null` ranks after one cached read, so a document without user layers
|
|
109
|
+
* sorts with exactly the code that sorted it before layers existed. A local
|
|
110
|
+
* element without a creator has no layer and keeps today's order — above the
|
|
111
|
+
* content, as overlays always were.
|
|
112
|
+
*/
|
|
113
|
+
function compareUserLayer(a, b) {
|
|
114
|
+
if (a instanceof GfxLocalElementModel || b instanceof GfxLocalElementModel) {
|
|
115
|
+
return SortOrder.SAME;
|
|
116
|
+
}
|
|
117
|
+
const layers = userLayersOf(a);
|
|
118
|
+
const ranks = layers?.ranks;
|
|
119
|
+
if (!layers || !ranks)
|
|
120
|
+
return SortOrder.SAME;
|
|
121
|
+
const aLayer = layers.effectiveLayerOf(a);
|
|
122
|
+
const bLayer = layers.effectiveLayerOf(b);
|
|
123
|
+
if (aLayer === bLayer)
|
|
124
|
+
return SortOrder.SAME;
|
|
125
|
+
// A default layer with no record (the loser of a first-layer race, ADR
|
|
126
|
+
// 0031 open point 6) stacks at the bottom: `''` precedes every key.
|
|
127
|
+
return compareIndex(ranks.get(aLayer) ?? '', ranks.get(bLayer) ?? '');
|
|
81
128
|
}
|
|
82
129
|
/**
|
|
83
130
|
* A comparator function for sorting elements in the surface.
|
|
@@ -91,15 +138,19 @@ export function compare(a, b) {
|
|
|
91
138
|
}
|
|
92
139
|
a = result.a;
|
|
93
140
|
b = result.b;
|
|
94
|
-
|
|
141
|
+
// Each `groups` read walks the group chain through `getGroup`, a scan of
|
|
142
|
+
// every container on the surface: read each side once.
|
|
143
|
+
const aGroups = a.groups;
|
|
144
|
+
const bGroups = b.groups;
|
|
145
|
+
if (isGfxGroupCompatibleModel(a) &&
|
|
146
|
+
bGroups.includes(a)) {
|
|
95
147
|
return SortOrder.BEFORE;
|
|
96
148
|
}
|
|
97
|
-
else if (isGfxGroupCompatibleModel(b) &&
|
|
149
|
+
else if (isGfxGroupCompatibleModel(b) &&
|
|
150
|
+
aGroups.includes(b)) {
|
|
98
151
|
return SortOrder.AFTER;
|
|
99
152
|
}
|
|
100
153
|
else {
|
|
101
|
-
const aGroups = a.groups;
|
|
102
|
-
const bGroups = b.groups;
|
|
103
154
|
let i = 1;
|
|
104
155
|
let aGroup = aGroups.at(-i);
|
|
105
156
|
let bGroup = bGroups.at(-i);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { BlockSuiteError, ErrorCode } from '../../../global/exceptions/index.js';
|
|
3
3
|
import { Bound } from '../../../global/gfx/index.js';
|
|
4
|
-
import { computed, effect, signal } from '@preact/signals-core';
|
|
4
|
+
import { computed, effect, signal, untracked } from '@preact/signals-core';
|
|
5
5
|
import { nothing } from 'lit';
|
|
6
6
|
import { GfxControllerIdentifier } from '../../gfx/identifiers.js';
|
|
7
7
|
import { SurfaceSelection } from '../../selection/index.js';
|
|
@@ -25,7 +25,10 @@ function updateZIndex(element) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
function updateBlockVisibility(view) {
|
|
28
|
-
|
|
28
|
+
// Read inside the effect below, so a local hide or show repaints the block
|
|
29
|
+
// without a transform change (ADR 0031 §8).
|
|
30
|
+
const hiddenLocally = view.gfx.localVisibility.isHidden(view.model);
|
|
31
|
+
if (view.transformState$.value === 'active' && !hiddenLocally) {
|
|
29
32
|
view.style.visibility = 'visible';
|
|
30
33
|
view.style.pointerEvents = 'auto';
|
|
31
34
|
view.classList.remove('block-idle');
|
|
@@ -47,12 +50,17 @@ function handleGfxConnection(instance) {
|
|
|
47
50
|
if (id === instance.model.id && type === 'update') {
|
|
48
51
|
updateTransform(instance);
|
|
49
52
|
updateZIndex(instance);
|
|
53
|
+
// A move to another user layer may hide or show it (ADR 0031 §7).
|
|
54
|
+
untracked(() => updateBlockVisibility(instance));
|
|
50
55
|
}
|
|
51
56
|
}));
|
|
52
57
|
// A reorder changes no property of this block, only the layer it sits in,
|
|
53
58
|
// so the stacking has to be read back from the layer manager.
|
|
54
59
|
instance.disposables.add(instance.gfx.layer.slots.layerUpdated.subscribe(() => {
|
|
55
60
|
updateZIndex(instance);
|
|
61
|
+
// So may a regroup, or a change of the layer list (a layer hidden for
|
|
62
|
+
// everyone is one record write, not a write on this block).
|
|
63
|
+
untracked(() => updateBlockVisibility(instance));
|
|
56
64
|
}));
|
|
57
65
|
instance.disposables.add(effect(() => {
|
|
58
66
|
updateBlockVisibility(instance);
|
package/dist/commands.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { frameCommands } from './_pkgs/affine-block-frame/index.js';
|
|
1
2
|
import { copyLinkCommands, coreCommands, pivotCommands, readingCommands, tagCommands, } from './_pkgs/affine-block-root/index.js';
|
|
2
|
-
import { auditCommands, exportSvgCommands, mapQualityCommands, } from './_pkgs/affine-block-surface/index.js';
|
|
3
|
+
import { auditCommands, canvasGridCommands, exportSvgCommands, mapQualityCommands, selectionPaneCommands, userLayerCommands, } from './_pkgs/affine-block-surface/index.js';
|
|
3
4
|
import { edgeDirectionCommands } from './_pkgs/affine-gfx-connector/index.js';
|
|
4
5
|
import { shapeCommands } from './_pkgs/affine-gfx-shape/index.js';
|
|
5
6
|
import { toCommandManifestEntry, } from './_pkgs/std/index.js';
|
|
@@ -54,6 +55,10 @@ export function getCommands(flags) {
|
|
|
54
55
|
...shapeCommands,
|
|
55
56
|
...mapQualityCommands,
|
|
56
57
|
...exportSvgCommands,
|
|
58
|
+
...selectionPaneCommands,
|
|
59
|
+
...frameCommands,
|
|
60
|
+
...canvasGridCommands,
|
|
61
|
+
...userLayerCommands,
|
|
57
62
|
...edgeDirectionCommands,
|
|
58
63
|
...(isCapabilityEnabled(flags, 'ai-audit') ? auditCommands : []),
|
|
59
64
|
], FRAMEWORK_COMMAND_GROUPS, flags);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type FramePreview } from './_pkgs/affine-fragment-frame-panel/index.js';
|
|
2
|
+
import type { FrameBlockModel } from './_pkgs/affine-model/index.js';
|
|
3
|
+
import type { BlockStdScope } from './_pkgs/std/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* `@labre/affine/host-panels` — the verbs a host's own panel calls (ADR 0034
|
|
6
|
+
* §4, docs/integrate/08-host-panels.md).
|
|
7
|
+
*
|
|
8
|
+
* A host that draws its own artefact catalogue, selection pane or slide list
|
|
9
|
+
* needs a handful of editor verbs: list a framework's artefacts, arm one, run
|
|
10
|
+
* a command, read the canvas stack, list the frames in presentation order,
|
|
11
|
+
* select a model, frame it in the viewport. They existed before this module,
|
|
12
|
+
* spread over four packages and three levels of abstraction (`armArtefact` in
|
|
13
|
+
* the edgeless toolbar widget, `selectionPaneTree` in the surface block, the
|
|
14
|
+
* command registry in `std`, the frame order in the frame block), and no page
|
|
15
|
+
* named them together. This module gathers them, so a host imports one entry
|
|
16
|
+
* and never a widget package.
|
|
17
|
+
*
|
|
18
|
+
* **Why a façade and not a seam.** A seam is the editor asking the host for
|
|
19
|
+
* something (show a panel, open a document); its absence needs a degraded
|
|
20
|
+
* behaviour and a row in the seams table. Here the direction is the other way:
|
|
21
|
+
* the host calls the editor, and nothing degrades — a host that draws no panel
|
|
22
|
+
* simply calls nothing. So: plain named functions over an `std`, no class, no
|
|
23
|
+
* object holding state, no registration. The library's own panels and a
|
|
24
|
+
* host's call the same functions and the same commands, which is what keeps
|
|
25
|
+
* their behaviour the same; every WRITE goes through a core command run by
|
|
26
|
+
* `runCommand` (`canvas.frame.reorder`, `canvas.element.reorder`, …), so the
|
|
27
|
+
* read-only refusal, the no-op check, the single undo step and the telemetry
|
|
28
|
+
* happen once whoever draws the pixels.
|
|
29
|
+
*
|
|
30
|
+
* **No Lit type is named here.** `lit` is only a dev dependency of
|
|
31
|
+
* `@labre/affine`, and a host that draws its panel in React must be able to
|
|
32
|
+
* type its calls without it (`host-panels-signature.unit.spec.ts` reads this
|
|
33
|
+
* file). `getCommandIcon` still returns what the icon tables hold; a host
|
|
34
|
+
* renders it with Lit's `render` or uses its own icons.
|
|
35
|
+
*
|
|
36
|
+
* **This module only widens.** A function, a parameter or a return type a
|
|
37
|
+
* host calls keeps its 0.46 shape in every minor: a new parameter is optional,
|
|
38
|
+
* a return never gains `null` (`host-panels-signature.unit.spec.ts`, which
|
|
39
|
+
* `yarn build` typechecks; docs/lessons.md 33). A verb a host panel needs and
|
|
40
|
+
* cannot find here is a gap in this module, not a reason to import a widget
|
|
41
|
+
* package.
|
|
42
|
+
*
|
|
43
|
+
* ponytail: `frameList` is a plain read, not a signal of the frame list; a
|
|
44
|
+
* host follows reorders through `std.store.slots.blockUpdated` (08 says how).
|
|
45
|
+
* A signal of the frame list is the upgrade path if two hosts ask.
|
|
46
|
+
*/
|
|
47
|
+
export { type AnyCommandDescriptor, type CommandInvocation, type CommandOwner, type CommandSurface, getCommandIcon, getCommandsForSurface, getRegisteredCommands, runCommand, } from './_pkgs/std/index.js';
|
|
48
|
+
export { armArtefact } from './_pkgs/affine-widget-edgeless-toolbar/index.js';
|
|
49
|
+
export { type SelectionPaneNode, selectionPaneTree, } from './_pkgs/affine-block-surface/index.js';
|
|
50
|
+
export { frameCommands, type ReorderFramesParams, reorderFramesParams, } from './_pkgs/affine-block-frame/index.js';
|
|
51
|
+
/**
|
|
52
|
+
* The document's frames in presentation order, first slide first — the order
|
|
53
|
+
* `canvas.frame.reorder` writes and the presentation walks. Works in page mode
|
|
54
|
+
* too: the frame manager is registered with the frame block in both.
|
|
55
|
+
*/
|
|
56
|
+
export declare function frameList(std: BlockStdScope): FrameBlockModel[];
|
|
57
|
+
/**
|
|
58
|
+
* Select `ids` on the canvas, the way a click on a panel row does: the
|
|
59
|
+
* selection replaces the current one and nothing enters text editing. Edgeless
|
|
60
|
+
* only — page mode shows no canvas selection.
|
|
61
|
+
*/
|
|
62
|
+
export declare function selectModels(std: BlockStdScope, ids: readonly string[]): void;
|
|
63
|
+
/**
|
|
64
|
+
* Move the viewport, smoothly, so model `id` fills it within `padding`
|
|
65
|
+
* (top, right, bottom, left, in screen pixels) — the frame panel's "fit to
|
|
66
|
+
* frame". `false` when no canvas model has that id; nothing moves then.
|
|
67
|
+
*
|
|
68
|
+
* It never switches the editor's mode: the host knows which mode it shows, and
|
|
69
|
+
* a host in page mode switches first (`DocModeProvider`).
|
|
70
|
+
*/
|
|
71
|
+
export declare function fitToModel(std: BlockStdScope, id: string, padding?: [number, number, number, number]): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The live preview of a frame the library's own frame panel draws on each
|
|
74
|
+
* card: a read-only mini editor clipped to the frame's bounds, repainted as
|
|
75
|
+
* the frame's content changes. Not a picture — a host that wants a static
|
|
76
|
+
* thumbnail renders one through `ExportManager` instead.
|
|
77
|
+
*
|
|
78
|
+
* Returns the element ready to be appended; `width` and `height` are the
|
|
79
|
+
* preview box in CSS pixels (the panel's card is 280 × 166), `fillScreen`
|
|
80
|
+
* covers the box instead of containing the frame. One mini editor per
|
|
81
|
+
* preview: mount only the cards on screen. The element is defined by the
|
|
82
|
+
* frame panel's view extension, so it renders nothing in an assembly where the
|
|
83
|
+
* `frame` flag is off (ADR 0009) — the same assembly where there is no frame
|
|
84
|
+
* to preview.
|
|
85
|
+
*/
|
|
86
|
+
export declare function createFramePreview(std: BlockStdScope, frame: FrameBlockModel, options?: {
|
|
87
|
+
width?: number;
|
|
88
|
+
height?: number;
|
|
89
|
+
fillScreen?: boolean;
|
|
90
|
+
}): FramePreview;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { EdgelessFrameManagerIdentifier } from './_pkgs/affine-block-frame/index.js';
|
|
2
|
+
import { AFFINE_FRAME_PREVIEW, } from './_pkgs/affine-fragment-frame-panel/index.js';
|
|
3
|
+
import { GfxControllerIdentifier } from './_pkgs/std/gfx/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* `@labre/affine/host-panels` — the verbs a host's own panel calls (ADR 0034
|
|
6
|
+
* §4, docs/integrate/08-host-panels.md).
|
|
7
|
+
*
|
|
8
|
+
* A host that draws its own artefact catalogue, selection pane or slide list
|
|
9
|
+
* needs a handful of editor verbs: list a framework's artefacts, arm one, run
|
|
10
|
+
* a command, read the canvas stack, list the frames in presentation order,
|
|
11
|
+
* select a model, frame it in the viewport. They existed before this module,
|
|
12
|
+
* spread over four packages and three levels of abstraction (`armArtefact` in
|
|
13
|
+
* the edgeless toolbar widget, `selectionPaneTree` in the surface block, the
|
|
14
|
+
* command registry in `std`, the frame order in the frame block), and no page
|
|
15
|
+
* named them together. This module gathers them, so a host imports one entry
|
|
16
|
+
* and never a widget package.
|
|
17
|
+
*
|
|
18
|
+
* **Why a façade and not a seam.** A seam is the editor asking the host for
|
|
19
|
+
* something (show a panel, open a document); its absence needs a degraded
|
|
20
|
+
* behaviour and a row in the seams table. Here the direction is the other way:
|
|
21
|
+
* the host calls the editor, and nothing degrades — a host that draws no panel
|
|
22
|
+
* simply calls nothing. So: plain named functions over an `std`, no class, no
|
|
23
|
+
* object holding state, no registration. The library's own panels and a
|
|
24
|
+
* host's call the same functions and the same commands, which is what keeps
|
|
25
|
+
* their behaviour the same; every WRITE goes through a core command run by
|
|
26
|
+
* `runCommand` (`canvas.frame.reorder`, `canvas.element.reorder`, …), so the
|
|
27
|
+
* read-only refusal, the no-op check, the single undo step and the telemetry
|
|
28
|
+
* happen once whoever draws the pixels.
|
|
29
|
+
*
|
|
30
|
+
* **No Lit type is named here.** `lit` is only a dev dependency of
|
|
31
|
+
* `@labre/affine`, and a host that draws its panel in React must be able to
|
|
32
|
+
* type its calls without it (`host-panels-signature.unit.spec.ts` reads this
|
|
33
|
+
* file). `getCommandIcon` still returns what the icon tables hold; a host
|
|
34
|
+
* renders it with Lit's `render` or uses its own icons.
|
|
35
|
+
*
|
|
36
|
+
* **This module only widens.** A function, a parameter or a return type a
|
|
37
|
+
* host calls keeps its 0.46 shape in every minor: a new parameter is optional,
|
|
38
|
+
* a return never gains `null` (`host-panels-signature.unit.spec.ts`, which
|
|
39
|
+
* `yarn build` typechecks; docs/lessons.md 33). A verb a host panel needs and
|
|
40
|
+
* cannot find here is a gap in this module, not a reason to import a widget
|
|
41
|
+
* package.
|
|
42
|
+
*
|
|
43
|
+
* ponytail: `frameList` is a plain read, not a signal of the frame list; a
|
|
44
|
+
* host follows reorders through `std.store.slots.blockUpdated` (08 says how).
|
|
45
|
+
* A signal of the frame list is the upgrade path if two hosts ask.
|
|
46
|
+
*/
|
|
47
|
+
export { getCommandIcon, getCommandsForSurface, getRegisteredCommands, runCommand, } from './_pkgs/std/index.js';
|
|
48
|
+
export { armArtefact } from './_pkgs/affine-widget-edgeless-toolbar/index.js';
|
|
49
|
+
export { selectionPaneTree, } from './_pkgs/affine-block-surface/index.js';
|
|
50
|
+
export { frameCommands, reorderFramesParams, } from './_pkgs/affine-block-frame/index.js';
|
|
51
|
+
/**
|
|
52
|
+
* The document's frames in presentation order, first slide first — the order
|
|
53
|
+
* `canvas.frame.reorder` writes and the presentation walks. Works in page mode
|
|
54
|
+
* too: the frame manager is registered with the frame block in both.
|
|
55
|
+
*/
|
|
56
|
+
export function frameList(std) {
|
|
57
|
+
return std.get(EdgelessFrameManagerIdentifier).frames;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Select `ids` on the canvas, the way a click on a panel row does: the
|
|
61
|
+
* selection replaces the current one and nothing enters text editing. Edgeless
|
|
62
|
+
* only — page mode shows no canvas selection.
|
|
63
|
+
*/
|
|
64
|
+
export function selectModels(std, ids) {
|
|
65
|
+
std.get(GfxControllerIdentifier).selection.set({
|
|
66
|
+
elements: [...ids],
|
|
67
|
+
editing: false,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Move the viewport, smoothly, so model `id` fills it within `padding`
|
|
72
|
+
* (top, right, bottom, left, in screen pixels) — the frame panel's "fit to
|
|
73
|
+
* frame". `false` when no canvas model has that id; nothing moves then.
|
|
74
|
+
*
|
|
75
|
+
* It never switches the editor's mode: the host knows which mode it shows, and
|
|
76
|
+
* a host in page mode switches first (`DocModeProvider`).
|
|
77
|
+
*/
|
|
78
|
+
export function fitToModel(std, id, padding = [0, 0, 0, 0]) {
|
|
79
|
+
const gfx = std.get(GfxControllerIdentifier);
|
|
80
|
+
const model = gfx.getElementById(id);
|
|
81
|
+
if (!model?.elementBound)
|
|
82
|
+
return false;
|
|
83
|
+
gfx.viewport.setViewportByBound(model.elementBound, padding, true);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The live preview of a frame the library's own frame panel draws on each
|
|
88
|
+
* card: a read-only mini editor clipped to the frame's bounds, repainted as
|
|
89
|
+
* the frame's content changes. Not a picture — a host that wants a static
|
|
90
|
+
* thumbnail renders one through `ExportManager` instead.
|
|
91
|
+
*
|
|
92
|
+
* Returns the element ready to be appended; `width` and `height` are the
|
|
93
|
+
* preview box in CSS pixels (the panel's card is 280 × 166), `fillScreen`
|
|
94
|
+
* covers the box instead of containing the frame. One mini editor per
|
|
95
|
+
* preview: mount only the cards on screen. The element is defined by the
|
|
96
|
+
* frame panel's view extension, so it renders nothing in an assembly where the
|
|
97
|
+
* `frame` flag is off (ADR 0009) — the same assembly where there is no frame
|
|
98
|
+
* to preview.
|
|
99
|
+
*/
|
|
100
|
+
export function createFramePreview(std, frame, options = {}) {
|
|
101
|
+
const preview = document.createElement(AFFINE_FRAME_PREVIEW);
|
|
102
|
+
preview.std = std;
|
|
103
|
+
preview.frame = frame;
|
|
104
|
+
if (options.width !== undefined)
|
|
105
|
+
preview.surfaceWidth = options.width;
|
|
106
|
+
if (options.height !== undefined)
|
|
107
|
+
preview.surfaceHeight = options.height;
|
|
108
|
+
if (options.fillScreen !== undefined)
|
|
109
|
+
preview.fillScreen = options.fillScreen;
|
|
110
|
+
return preview;
|
|
111
|
+
}
|
package/dist/translations.js
CHANGED
|
@@ -4,7 +4,7 @@ import { EMBED_WORDINGS } from './_pkgs/affine-block-embed/translations.js';
|
|
|
4
4
|
import { EMBED_DOC_WORDINGS } from './_pkgs/affine-block-embed-doc/translations.js';
|
|
5
5
|
import { FRAME_CHROME_WORDINGS, FRAME_WORDINGS, } from './_pkgs/affine-block-frame/translations.js';
|
|
6
6
|
import { IMAGE_WORDINGS } from './_pkgs/affine-block-image/translations.js';
|
|
7
|
-
import { EXEMPTION_FALLBACK, PROVENANCE_FALLBACK, SEVERITY_FALLBACK, SVG_SKETCH_WORDINGS, } from './_pkgs/affine-block-surface/index.js';
|
|
7
|
+
import { EXEMPTION_FALLBACK, EXPORT_SVG_WORDINGS, PROVENANCE_FALLBACK, READING_FRAME_WORDINGS, SEVERITY_FALLBACK, SVG_SKETCH_WORDINGS, USER_LAYER_SEED_WORDINGS, } from './_pkgs/affine-block-surface/index.js';
|
|
8
8
|
import { SURFACE_REF_CHROME_WORDINGS, SURFACE_REF_WORDINGS, } from './_pkgs/affine-block-surface-ref/translations.js';
|
|
9
9
|
import { ADAPTER_PANEL_WORDINGS } from './_pkgs/affine-fragment-adapter-panel/translations.js';
|
|
10
10
|
import { DOC_TITLE_WORDINGS } from './_pkgs/affine-fragment-doc-title/translations.js';
|
|
@@ -158,7 +158,11 @@ const CHROME_KEYS = [
|
|
|
158
158
|
['com.labre.reading.field.nature', 'Nature'],
|
|
159
159
|
['com.labre.reading.field.relations', 'Parent-child relations'],
|
|
160
160
|
['com.labre.reading.field.value-flow', 'Value flow'],
|
|
161
|
-
|
|
161
|
+
// `com.labre.reading.field.phase` and `com.labre.reading.phase.none` are the
|
|
162
|
+
// reading engine's DEFAULT frame wording, declared beside it in the surface
|
|
163
|
+
// package (`READING_FRAME_WORDINGS`) and walked from `PACKAGE_WORDINGS`: a
|
|
164
|
+
// profile that names no frame wording — Wardley's, a 0.43 host's — reads
|
|
165
|
+
// with them, whether or not a framework bundle is installed.
|
|
162
166
|
['com.labre.reading.field.naming', 'Naming convention'],
|
|
163
167
|
['com.labre.reading.field.record', 'Record'],
|
|
164
168
|
['com.labre.reading.field.drift', 'Drift'],
|
|
@@ -182,10 +186,7 @@ const CHROME_KEYS = [
|
|
|
182
186
|
['com.labre.reading.value-flow', 'Value flows up from'],
|
|
183
187
|
['com.labre.reading.value-flow.to', 'to'],
|
|
184
188
|
['com.labre.reading.phase.band', 'In the zone of punctuated equilibrium'],
|
|
185
|
-
[
|
|
186
|
-
'com.labre.reading.phase.none',
|
|
187
|
-
'Not on a framework background — no phase to read.',
|
|
188
|
-
],
|
|
189
|
+
['com.labre.reading.zone.unnamed', 'Unnamed'],
|
|
189
190
|
[
|
|
190
191
|
'com.labre.reading.naming.conforms',
|
|
191
192
|
'The name follows the convention of its nature.',
|
|
@@ -303,6 +304,8 @@ const PACKAGE_WORDINGS = [
|
|
|
303
304
|
POINTER_WORDINGS,
|
|
304
305
|
ROOT_CHROME_WORDINGS,
|
|
305
306
|
SVG_SKETCH_WORDINGS,
|
|
307
|
+
EXPORT_SVG_WORDINGS,
|
|
308
|
+
READING_FRAME_WORDINGS,
|
|
306
309
|
STD_WORDINGS,
|
|
307
310
|
ATTACHMENT_WORDINGS,
|
|
308
311
|
BOOKMARK_WORDINGS,
|
|
@@ -331,6 +334,7 @@ const PACKAGE_SEED_WORDINGS = [
|
|
|
331
334
|
SURFACE_REF_WORDINGS,
|
|
332
335
|
TEMPLATE_SEED_WORDINGS,
|
|
333
336
|
ROOT_SEED_WORDINGS,
|
|
337
|
+
USER_LAYER_SEED_WORDINGS,
|
|
334
338
|
];
|
|
335
339
|
/**
|
|
336
340
|
* Every i18n key THIS package can ask the host for, with its English fallback
|