@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,355 @@
|
|
|
1
|
+
import { CanvasLocalVisibility, SelectionPaneProvider, TelemetryProvider, } from '../../../affine-shared/services/index.js';
|
|
2
|
+
import { GfxControllerIdentifier } from '../../../std/gfx/index.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { renamePaneFrame, renamePaneGroup, reorderPaneElements, setPaneElementsHiddenForEveryone, setPaneElementsLocked, } from './actions.js';
|
|
5
|
+
import { setUserLayersHiddenForEveryone } from '../user-layers/actions.js';
|
|
6
|
+
import { SelectionPaneModel } from './tree.js';
|
|
7
|
+
/**
|
|
8
|
+
* The selection pane's commands (ADR 0031, stage 2), `owner: 'core'`: the pane
|
|
9
|
+
* belongs to no framework, and `'core'` owners are exempt from the id-prefix
|
|
10
|
+
* rule (ADR 0008).
|
|
11
|
+
*
|
|
12
|
+
* The pane's own rows invoke the parameterised ones through `runCommand`, and
|
|
13
|
+
* so does a host's pane: the read-only refusal lives in the action, once.
|
|
14
|
+
*/
|
|
15
|
+
/** How the user reached the pane, as `SelectionPaneOpened` reports it. */
|
|
16
|
+
function openedFrom(invocation) {
|
|
17
|
+
if (invocation.surface === 'shortcut')
|
|
18
|
+
return 'shortcut';
|
|
19
|
+
if (invocation.source === 'toolbar:general')
|
|
20
|
+
return 'toolbar';
|
|
21
|
+
// The palette and the agent both invoke the command by name.
|
|
22
|
+
return 'palette';
|
|
23
|
+
}
|
|
24
|
+
const paneService = (std) => std.getOptional(SelectionPaneProvider);
|
|
25
|
+
/**
|
|
26
|
+
* Open the pane, or put the library's own panel away when it is the one on
|
|
27
|
+
* screen.
|
|
28
|
+
*
|
|
29
|
+
* Toggling needs a state the two-verb seam does not carry, so it reads the
|
|
30
|
+
* library panel's own (`SelectionPaneModel.open$`). A host that replaced the
|
|
31
|
+
* panel keeps its open state to itself: for it, the toggle always opens, and
|
|
32
|
+
* closing is the host's own control.
|
|
33
|
+
*
|
|
34
|
+
* Emits `SelectionPaneOpened` from its body, and only when it opens — see the
|
|
35
|
+
* telemetry README for why this command self-emits like `doc.copyLink`.
|
|
36
|
+
*
|
|
37
|
+
* Opening writes nothing, so no read-only guard: the pane is how a reader finds
|
|
38
|
+
* what is on a canvas they cannot edit.
|
|
39
|
+
*/
|
|
40
|
+
const toggleSelectionPane = {
|
|
41
|
+
id: 'canvas.selectionPane.toggle',
|
|
42
|
+
owner: 'core',
|
|
43
|
+
kind: 'action',
|
|
44
|
+
labelKey: 'com.labre.command.canvas.selection-pane.toggle',
|
|
45
|
+
labelFallback: 'Selection pane',
|
|
46
|
+
descriptionKey: 'com.labre.command.canvas.selection-pane.toggle.description',
|
|
47
|
+
descriptionFallback: 'List the elements of the canvas by stacking order, to select, lock, rename or reorder them.',
|
|
48
|
+
keywords: ['layers', 'objects', 'z-order', 'stack'],
|
|
49
|
+
surfaces: ['palette', 'agent'],
|
|
50
|
+
scope: 'edgeless',
|
|
51
|
+
defaultKeys: { mac: [], other: [] },
|
|
52
|
+
// `null` from `SelectionPaneExtension(null)` switches the pane off; the
|
|
53
|
+
// command then disappears rather than opening nothing.
|
|
54
|
+
when: std => !!paneService(std),
|
|
55
|
+
run: (std, invocation) => {
|
|
56
|
+
const service = paneService(std);
|
|
57
|
+
if (!service)
|
|
58
|
+
return;
|
|
59
|
+
const model = std.getOptional(SelectionPaneModel);
|
|
60
|
+
if (model?.open$.peek()) {
|
|
61
|
+
service.close();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
service.open();
|
|
65
|
+
std.getOptional(TelemetryProvider)?.track('SelectionPaneOpened', {
|
|
66
|
+
page: 'whiteboard editor',
|
|
67
|
+
source: openedFrom(invocation),
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
/*
|
|
72
|
+
* "An `id` or a non-empty `ids`" is checked in `run`, not with a zod `refine`:
|
|
73
|
+
* a refined schema is a `ZodEffects`, which `describeCommandParams` cannot
|
|
74
|
+
* project, so the agent manifest would lose the whole parameter contract.
|
|
75
|
+
*/
|
|
76
|
+
export const reorderElementParams = z.object({
|
|
77
|
+
// The element or gfx block to move.
|
|
78
|
+
id: z.string().min(1).optional(),
|
|
79
|
+
// Several models of ONE stack, moved as a block in their current relative
|
|
80
|
+
// order (the selection pane's multi-row drag, ADR 0034). Added beside `id`,
|
|
81
|
+
// which stays: a caller passing `id` alone is unchanged.
|
|
82
|
+
ids: z.array(z.string().min(1)).optional(),
|
|
83
|
+
// The model they land directly ABOVE, stacked with them; `null` puts them
|
|
84
|
+
// at the bottom of their stack.
|
|
85
|
+
above: z.string().min(1).nullable(),
|
|
86
|
+
});
|
|
87
|
+
const reorderElement = {
|
|
88
|
+
id: 'canvas.element.reorder',
|
|
89
|
+
owner: 'core',
|
|
90
|
+
kind: 'action',
|
|
91
|
+
labelKey: 'com.labre.command.canvas.element.reorder',
|
|
92
|
+
labelFallback: 'Move in the stack',
|
|
93
|
+
descriptionKey: 'com.labre.command.canvas.element.reorder.description',
|
|
94
|
+
descriptionFallback: 'Place an element directly above another one in the stacking order.',
|
|
95
|
+
// Agent only: without an explicit target there is nothing to say where.
|
|
96
|
+
surfaces: ['agent'],
|
|
97
|
+
scope: 'edgeless',
|
|
98
|
+
defaultKeys: { mac: [], other: [] },
|
|
99
|
+
availability: 'editable',
|
|
100
|
+
params: reorderElementParams,
|
|
101
|
+
run: (std, _invocation, params) => {
|
|
102
|
+
const parsed = reorderElementParams.safeParse(params);
|
|
103
|
+
if (!parsed.success) {
|
|
104
|
+
console.error('canvas.element.reorder: invalid params', parsed.error);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const { id, ids = [], above } = parsed.data;
|
|
108
|
+
const moving = id === undefined ? ids : [id, ...ids];
|
|
109
|
+
if (!moving.length) {
|
|
110
|
+
console.error('canvas.element.reorder: needs an id or ids');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
reorderPaneElements(std, moving, above);
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
export const lockElementsParams = z.object({
|
|
117
|
+
/**
|
|
118
|
+
* The models to act on. Omitted: the current canvas selection. Each one is
|
|
119
|
+
* locked ON ITS OWN — never wrapped into a group.
|
|
120
|
+
*/
|
|
121
|
+
ids: z.array(z.string()).optional(),
|
|
122
|
+
});
|
|
123
|
+
function lockTargets(std, params) {
|
|
124
|
+
const parsed = lockElementsParams.safeParse(params ?? {});
|
|
125
|
+
if (!parsed.success)
|
|
126
|
+
return [];
|
|
127
|
+
return (parsed.data.ids ?? std.get(GfxControllerIdentifier).selection.selectedIds);
|
|
128
|
+
}
|
|
129
|
+
function lockCommand(locked) {
|
|
130
|
+
const verb = locked ? 'lock' : 'unlock';
|
|
131
|
+
return {
|
|
132
|
+
id: `canvas.element.${verb}`,
|
|
133
|
+
owner: 'core',
|
|
134
|
+
kind: 'action',
|
|
135
|
+
labelKey: `com.labre.command.canvas.element.${verb}`,
|
|
136
|
+
labelFallback: locked ? 'Lock each element' : 'Unlock each element',
|
|
137
|
+
descriptionKey: `com.labre.command.canvas.element.${verb}.description`,
|
|
138
|
+
descriptionFallback: locked
|
|
139
|
+
? 'Lock every selected element on its own, without grouping them.'
|
|
140
|
+
: 'Unlock every selected element on its own.',
|
|
141
|
+
surfaces: ['palette', 'agent'],
|
|
142
|
+
scope: 'edgeless',
|
|
143
|
+
defaultKeys: { mac: [], other: [] },
|
|
144
|
+
availability: 'editable',
|
|
145
|
+
when: std => std.get(GfxControllerIdentifier).selection.selectedIds.length > 0,
|
|
146
|
+
params: lockElementsParams,
|
|
147
|
+
run: (std, _invocation, params) => {
|
|
148
|
+
setPaneElementsLocked(std, lockTargets(std, params), locked);
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export const renameGroupParams = z.object({
|
|
153
|
+
id: z.string().min(1),
|
|
154
|
+
title: z.string(),
|
|
155
|
+
});
|
|
156
|
+
const renameGroup = {
|
|
157
|
+
id: 'canvas.group.rename',
|
|
158
|
+
owner: 'core',
|
|
159
|
+
kind: 'action',
|
|
160
|
+
labelKey: 'com.labre.command.canvas.group.rename',
|
|
161
|
+
labelFallback: 'Rename group',
|
|
162
|
+
descriptionKey: 'com.labre.command.canvas.group.rename.description',
|
|
163
|
+
descriptionFallback: 'Give a group a new title.',
|
|
164
|
+
surfaces: ['agent'],
|
|
165
|
+
scope: 'edgeless',
|
|
166
|
+
defaultKeys: { mac: [], other: [] },
|
|
167
|
+
availability: 'editable',
|
|
168
|
+
params: renameGroupParams,
|
|
169
|
+
run: (std, _invocation, params) => {
|
|
170
|
+
const parsed = renameGroupParams.safeParse(params);
|
|
171
|
+
if (!parsed.success) {
|
|
172
|
+
console.error('canvas.group.rename: invalid params', parsed.error);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
renamePaneGroup(std, parsed.data.id, parsed.data.title);
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* A frame's row is renamed in place like a group's (ADR 0031, amendments:
|
|
180
|
+
* frames are rows). Its own command rather than `canvas.group.rename` widened:
|
|
181
|
+
* the agent reads a command's wording, and a frame is not a group.
|
|
182
|
+
*/
|
|
183
|
+
const renameFrame = {
|
|
184
|
+
id: 'canvas.frame.rename',
|
|
185
|
+
owner: 'core',
|
|
186
|
+
kind: 'action',
|
|
187
|
+
labelKey: 'com.labre.command.canvas.frame.rename',
|
|
188
|
+
labelFallback: 'Rename frame',
|
|
189
|
+
descriptionKey: 'com.labre.command.canvas.frame.rename.description',
|
|
190
|
+
descriptionFallback: 'Give a frame a new title.',
|
|
191
|
+
surfaces: ['agent'],
|
|
192
|
+
scope: 'edgeless',
|
|
193
|
+
defaultKeys: { mac: [], other: [] },
|
|
194
|
+
availability: 'editable',
|
|
195
|
+
params: renameGroupParams,
|
|
196
|
+
run: (std, _invocation, params) => {
|
|
197
|
+
const parsed = renameGroupParams.safeParse(params);
|
|
198
|
+
if (!parsed.success) {
|
|
199
|
+
console.error('canvas.frame.rename: invalid params', parsed.error);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
renamePaneFrame(std, parsed.data.id, parsed.data.title);
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
export const hideLocalParams = z.object({
|
|
206
|
+
/** The models to act on. Omitted: the current canvas selection. */
|
|
207
|
+
ids: z.array(z.string()).optional(),
|
|
208
|
+
/**
|
|
209
|
+
* Whole user layers to act on instead (ADR 0031 stage 7). When given,
|
|
210
|
+
* `ids` and the selection are ignored.
|
|
211
|
+
*/
|
|
212
|
+
layerIds: z.array(z.string()).optional(),
|
|
213
|
+
/** `false` shows them again. Omitted: hide. */
|
|
214
|
+
hidden: z.boolean().optional(),
|
|
215
|
+
});
|
|
216
|
+
function reportVisibility(std, hidden, count, scope = 'local', target = 'element') {
|
|
217
|
+
if (!count)
|
|
218
|
+
return;
|
|
219
|
+
std.getOptional(TelemetryProvider)?.track('CanvasVisibilityChanged', {
|
|
220
|
+
page: 'whiteboard editor',
|
|
221
|
+
target,
|
|
222
|
+
scope,
|
|
223
|
+
hidden,
|
|
224
|
+
count,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Hide elements for THIS viewer only (ADR 0031 §8) — or, with
|
|
229
|
+
* `hidden: false`, show them again; the pane's eye is both.
|
|
230
|
+
*
|
|
231
|
+
* Nothing is written to the document, so there is no read-only guard: a
|
|
232
|
+
* reader may hide what is in their way. Self-emits `CanvasVisibilityChanged`
|
|
233
|
+
* with the number of elements the gesture actually changed.
|
|
234
|
+
*/
|
|
235
|
+
const hideLocal = {
|
|
236
|
+
id: 'canvas.visibility.hideLocal',
|
|
237
|
+
owner: 'core',
|
|
238
|
+
kind: 'action',
|
|
239
|
+
labelKey: 'com.labre.command.canvas.visibility.hide-local',
|
|
240
|
+
labelFallback: 'Hide for me',
|
|
241
|
+
descriptionKey: 'com.labre.command.canvas.visibility.hide-local.description',
|
|
242
|
+
descriptionFallback: 'Hide the selected elements on your screen only. Nothing changes for anyone else.',
|
|
243
|
+
surfaces: ['palette', 'agent'],
|
|
244
|
+
scope: 'edgeless',
|
|
245
|
+
defaultKeys: { mac: [], other: [] },
|
|
246
|
+
availability: 'selection',
|
|
247
|
+
when: std => !!std.getOptional(CanvasLocalVisibility),
|
|
248
|
+
params: hideLocalParams,
|
|
249
|
+
run: (std, _invocation, params) => {
|
|
250
|
+
const visibility = std.getOptional(CanvasLocalVisibility);
|
|
251
|
+
const parsed = hideLocalParams.safeParse(params ?? {});
|
|
252
|
+
if (!visibility || !parsed.success)
|
|
253
|
+
return;
|
|
254
|
+
if (parsed.data.layerIds) {
|
|
255
|
+
const hidden = parsed.data.hidden ?? true;
|
|
256
|
+
const layers = parsed.data.layerIds;
|
|
257
|
+
const count = hidden
|
|
258
|
+
? visibility.hideLayers(layers)
|
|
259
|
+
: visibility.showLayers(layers);
|
|
260
|
+
reportVisibility(std, hidden, count, 'local', 'layer');
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const ids = parsed.data.ids ?? std.get(GfxControllerIdentifier).selection.selectedIds;
|
|
264
|
+
const hidden = parsed.data.hidden ?? true;
|
|
265
|
+
const count = hidden ? visibility.hide(ids) : visibility.show(ids);
|
|
266
|
+
reportVisibility(std, hidden, count);
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
export const hideForEveryoneParams = z.object({
|
|
270
|
+
/** The models to act on. Omitted: the current canvas selection. */
|
|
271
|
+
ids: z.array(z.string()).optional(),
|
|
272
|
+
/**
|
|
273
|
+
* Whole user layers to act on instead: `hidden: true` on each record, one
|
|
274
|
+
* write per layer, never one per member (ADR 0031 §7).
|
|
275
|
+
*/
|
|
276
|
+
layerIds: z.array(z.string()).optional(),
|
|
277
|
+
/** `false` shows them again, for everyone. Omitted: hide. */
|
|
278
|
+
hidden: z.boolean().optional(),
|
|
279
|
+
});
|
|
280
|
+
/**
|
|
281
|
+
* Hide elements for EVERYONE (ADR 0031 §7) — or, with `hidden: false`, show
|
|
282
|
+
* them again for everyone. Written to the document and synced: every viewer,
|
|
283
|
+
* every peer, stops painting and picking them, while rules, legends and
|
|
284
|
+
* semantic exports keep counting them (§9). Refused on a read-only document
|
|
285
|
+
* (`availability`, and again in the action). Self-emits
|
|
286
|
+
* `CanvasVisibilityChanged` with `scope: 'everyone'` and the count actually
|
|
287
|
+
* written.
|
|
288
|
+
*/
|
|
289
|
+
const hideForEveryone = {
|
|
290
|
+
id: 'canvas.visibility.hideForEveryone',
|
|
291
|
+
owner: 'core',
|
|
292
|
+
kind: 'action',
|
|
293
|
+
labelKey: 'com.labre.command.canvas.visibility.hide-for-everyone',
|
|
294
|
+
labelFallback: 'Hide for everyone',
|
|
295
|
+
descriptionKey: 'com.labre.command.canvas.visibility.hide-for-everyone.description',
|
|
296
|
+
descriptionFallback: 'Hide the selected elements for everyone who opens this document. They stay in the document and in the selection pane.',
|
|
297
|
+
surfaces: ['palette', 'agent'],
|
|
298
|
+
scope: 'edgeless',
|
|
299
|
+
defaultKeys: { mac: [], other: [] },
|
|
300
|
+
availability: 'editable',
|
|
301
|
+
when: std => std.get(GfxControllerIdentifier).selection.selectedIds.length > 0,
|
|
302
|
+
params: hideForEveryoneParams,
|
|
303
|
+
run: (std, _invocation, params) => {
|
|
304
|
+
const parsed = hideForEveryoneParams.safeParse(params ?? {});
|
|
305
|
+
if (!parsed.success)
|
|
306
|
+
return;
|
|
307
|
+
if (parsed.data.layerIds) {
|
|
308
|
+
const hidden = parsed.data.hidden ?? true;
|
|
309
|
+
const count = setUserLayersHiddenForEveryone(std, parsed.data.layerIds, hidden);
|
|
310
|
+
reportVisibility(std, hidden, count, 'everyone', 'layer');
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const ids = parsed.data.ids ?? std.get(GfxControllerIdentifier).selection.selectedIds;
|
|
314
|
+
const hidden = parsed.data.hidden ?? true;
|
|
315
|
+
const count = setPaneElementsHiddenForEveryone(std, ids, hidden);
|
|
316
|
+
reportVisibility(std, hidden, count, 'everyone');
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Show everything this viewer hid. Stays in the palette whatever the pane
|
|
321
|
+
* seam says: with `SelectionPaneExtension(null)` it is the one way back.
|
|
322
|
+
*/
|
|
323
|
+
const showAll = {
|
|
324
|
+
id: 'canvas.visibility.showAll',
|
|
325
|
+
owner: 'core',
|
|
326
|
+
kind: 'action',
|
|
327
|
+
labelKey: 'com.labre.command.canvas.visibility.show-all',
|
|
328
|
+
labelFallback: 'Show hidden elements',
|
|
329
|
+
descriptionKey: 'com.labre.command.canvas.visibility.show-all.description',
|
|
330
|
+
descriptionFallback: 'Show again every element and layer you hid on your screen.',
|
|
331
|
+
surfaces: ['palette', 'agent'],
|
|
332
|
+
scope: 'edgeless',
|
|
333
|
+
defaultKeys: { mac: [], other: [] },
|
|
334
|
+
when: std => {
|
|
335
|
+
const visibility = std.getOptional(CanvasLocalVisibility);
|
|
336
|
+
return ((visibility?.hiddenIds$.peek().size ?? 0) > 0 ||
|
|
337
|
+
(visibility?.hiddenLayerIds$.peek().size ?? 0) > 0);
|
|
338
|
+
},
|
|
339
|
+
run: std => {
|
|
340
|
+
const visibility = std.getOptional(CanvasLocalVisibility);
|
|
341
|
+
reportVisibility(std, false, visibility?.showAll() ?? 0);
|
|
342
|
+
reportVisibility(std, false, visibility?.showAllLayers() ?? 0, 'local', 'layer');
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
export const selectionPaneCommands = [
|
|
346
|
+
toggleSelectionPane,
|
|
347
|
+
reorderElement,
|
|
348
|
+
lockCommand(true),
|
|
349
|
+
lockCommand(false),
|
|
350
|
+
renameGroup,
|
|
351
|
+
renameFrame,
|
|
352
|
+
hideLocal,
|
|
353
|
+
hideForEveryone,
|
|
354
|
+
showAll,
|
|
355
|
+
];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { filterSelectionPaneTree, renamePaneFrame, renamePaneGroup, reorderPaneElement, reorderPaneElements, type SelectionPaneFilterTarget, selectionPaneFilterMembers, selectionPaneFilterTargets, setPaneElementsHiddenForEveryone, setPaneElementsLocked, } from './actions.js';
|
|
2
|
+
export { type HideForEveryoneParams, hideForEveryoneParams, type HideLocalParams, hideLocalParams, type LockElementsParams, lockElementsParams, type RenameGroupParams, renameGroupParams, type ReorderElementParams, reorderElementParams, selectionPaneCommands, } from './commands.js';
|
|
3
|
+
export { buildSelectionPaneTree, DEFAULT_LAYER_ID, paneContainerOf, paneLayersOf, type SelectionPaneLayers, type SelectionPaneNode, SelectionPaneModel, selectionPaneTree, } from './tree.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { filterSelectionPaneTree, renamePaneFrame, renamePaneGroup, reorderPaneElement, reorderPaneElements, selectionPaneFilterMembers, selectionPaneFilterTargets, setPaneElementsHiddenForEveryone, setPaneElementsLocked, } from './actions.js';
|
|
2
|
+
export { hideForEveryoneParams, hideLocalParams, lockElementsParams, renameGroupParams, reorderElementParams, selectionPaneCommands, } from './commands.js';
|
|
3
|
+
export { buildSelectionPaneTree, DEFAULT_LAYER_ID, paneContainerOf, paneLayersOf, SelectionPaneModel, selectionPaneTree, } from './tree.js';
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type BlockStdScope, LifeCycleWatcher } from '../../../std/index.js';
|
|
2
|
+
import { GfxGroupLikeElementModel, type GfxModel, DEFAULT_LAYER_ID, type SurfaceBlockModel } from '../../../std/gfx/index.js';
|
|
3
|
+
import { type ReadonlySignal } from '@preact/signals-core';
|
|
4
|
+
/** The default layer's reserved id (ADR 0031 §2), re-exported from std. */
|
|
5
|
+
export { DEFAULT_LAYER_ID };
|
|
6
|
+
/**
|
|
7
|
+
* One row of the selection pane, as the HEADLESS API hands it out (ADR 0031
|
|
8
|
+
* §12): ids and states only, never a wording. Whoever draws the row reads the
|
|
9
|
+
* label off the element at render time — its own text, its label sibling, its
|
|
10
|
+
* role's wording — so a rename on the canvas never has to invalidate this
|
|
11
|
+
* tree, and no element text ever crosses the seam in a payload a host might
|
|
12
|
+
* log.
|
|
13
|
+
*/
|
|
14
|
+
export interface SelectionPaneNode {
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* `'layer'` is a user layer's row (ADR 0031 §2). The top-level rows are
|
|
18
|
+
* always the layers, top first, and every element row sits under its
|
|
19
|
+
* effective layer. A surface with no `layers` has one, the default layer
|
|
20
|
+
* ({@link DEFAULT_LAYER_ID}), shown although it has no record yet (ADR 0031
|
|
21
|
+
* amendments); its name is `userLayerName`'s, the first-layer seed.
|
|
22
|
+
*/
|
|
23
|
+
kind: 'element' | 'block' | 'layer';
|
|
24
|
+
/** The element `type` (`shape`, `group`…) or the block flavour. */
|
|
25
|
+
type: string;
|
|
26
|
+
/** The element's role, when it carries one. Blocks carry none. */
|
|
27
|
+
role?: string;
|
|
28
|
+
/** The group-like ELEMENT (group, mindmap) this row is listed under. */
|
|
29
|
+
groupId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The effective layer (ADR 0031 §4): the outermost group's, a dangling id
|
|
32
|
+
* read as {@link DEFAULT_LAYER_ID}. A layer row carries its own id.
|
|
33
|
+
*/
|
|
34
|
+
layerId: string;
|
|
35
|
+
/** Locked by itself — what the row's lock toggle shows and flips. */
|
|
36
|
+
locked: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Hidden for this viewer only (`CanvasLocalVisibility`): still listed, still
|
|
39
|
+
* selectable from the pane, just not painted or picked on the canvas.
|
|
40
|
+
*/
|
|
41
|
+
hiddenLocal: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Hidden for everyone (the stored `hiddenForEveryone`, ADR 0031 §7): listed
|
|
44
|
+
* and selectable like a local hide, but no viewer paints or picks it.
|
|
45
|
+
*/
|
|
46
|
+
hiddenForEveryone: boolean;
|
|
47
|
+
/** Present on a group, a mindmap or a layer: its members, top first. */
|
|
48
|
+
children?: SelectionPaneNode[];
|
|
49
|
+
}
|
|
50
|
+
/** The user layers a tree is built against (ADR 0031 §4). */
|
|
51
|
+
export interface SelectionPaneLayers {
|
|
52
|
+
/** Every layer id, TOP first. */
|
|
53
|
+
readonly order: readonly string[];
|
|
54
|
+
/** Each id's rank key, as `compare` reads it. */
|
|
55
|
+
readonly ranks: ReadonlyMap<string, string>;
|
|
56
|
+
effectiveLayerOf(model: GfxModel): string;
|
|
57
|
+
/** The layers this viewer hid (stage 7). */
|
|
58
|
+
readonly hiddenLocally?: ReadonlySet<string>;
|
|
59
|
+
/** The layers whose record says `hidden: true` (stage 7). */
|
|
60
|
+
readonly hiddenForEveryone?: ReadonlySet<string>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The group-like ELEMENT a model is listed under, or `null` for a top-level
|
|
64
|
+
* row.
|
|
65
|
+
*
|
|
66
|
+
* Frames are deliberately not containers here, although they are
|
|
67
|
+
* group-compatible for z-order: a frame is a slide, and the pane filters BY
|
|
68
|
+
* frame rather than nesting under one — exactly the line ADR 0031 §4 draws for
|
|
69
|
+
* layers. `group` walks the model's surface, which throws on a model that is
|
|
70
|
+
* not attached to one; such a model is simply a top-level row.
|
|
71
|
+
*/
|
|
72
|
+
export declare function paneContainerOf(model: GfxModel): GfxGroupLikeElementModel | null;
|
|
73
|
+
/**
|
|
74
|
+
* The pane's rows, built from the canvas' models: one pass to bucket every
|
|
75
|
+
* model under its container, one sort per sibling list, top first.
|
|
76
|
+
*
|
|
77
|
+
* Pure, so the budget test can time exactly what a live pane pays. The order
|
|
78
|
+
* is the canvas' own comparator (`compareLayer`) reversed — the paint order,
|
|
79
|
+
* never a second opinion of it — with one shortcut that is exact: two models
|
|
80
|
+
* under the same group-like ancestor are ordered by `compareLayer` on their
|
|
81
|
+
* `index` alone (its ancestor walk finds no difference and falls through to
|
|
82
|
+
* `compareIndex`). So that case reads two cached strings instead of walking
|
|
83
|
+
* two ancestor chains per comparison, and only models stacked under different
|
|
84
|
+
* ancestors (a frame's members beside loose elements) walk their chains, read
|
|
85
|
+
* once per model rather than once per comparison.
|
|
86
|
+
*
|
|
87
|
+
* The top-level rows are the layers; with no `layers` given, the default
|
|
88
|
+
* layer alone, unrecorded — what a canvas without layers shows.
|
|
89
|
+
*/
|
|
90
|
+
export declare function buildSelectionPaneTree(models: readonly GfxModel[], hiddenLocally?: ReadonlySet<string>, layers?: SelectionPaneLayers): SelectionPaneNode[];
|
|
91
|
+
/**
|
|
92
|
+
* The surface's user layers as the tree builder takes them; while there is no
|
|
93
|
+
* record, the default layer alone, unrecorded (nothing is written to show it).
|
|
94
|
+
* Reads `layers$`, so a `computed` calling it re-derives on a create, a
|
|
95
|
+
* rename, a reorder — local or a peer's.
|
|
96
|
+
*/
|
|
97
|
+
export declare function paneLayersOf(surface: SurfaceBlockModel, hiddenLocally?: ReadonlySet<string>): SelectionPaneLayers;
|
|
98
|
+
/**
|
|
99
|
+
* The live tree behind {@link selectionPaneTree}, one per editor.
|
|
100
|
+
*
|
|
101
|
+
* The tree is a `computed` over a revision counter, bumped by the few events
|
|
102
|
+
* that can change a row (an element or block added or removed, a reorder, a
|
|
103
|
+
* regroup, a lock) — never by geometry. A `computed` is lazy, so an editor
|
|
104
|
+
* whose pane is closed and whose host never reads the tree pays the counter
|
|
105
|
+
* bump and nothing else; an open pane pays one rebuild per relevant change,
|
|
106
|
+
* not one per frame.
|
|
107
|
+
*
|
|
108
|
+
* It also holds whether the LIBRARY's own panel is open (`open$`), which is
|
|
109
|
+
* what the toggle command reads. A host that replaced the panel through
|
|
110
|
+
* `SelectionPaneExtension` owns its own open state; `open$` then stays false
|
|
111
|
+
* and the toggle always opens.
|
|
112
|
+
*/
|
|
113
|
+
export declare class SelectionPaneModel extends LifeCycleWatcher {
|
|
114
|
+
static key: string;
|
|
115
|
+
private readonly _revision$;
|
|
116
|
+
private _disposeSurfaceEffect;
|
|
117
|
+
private _subscriptions;
|
|
118
|
+
/** Whether the library's own panel is on screen. Written by that panel. */
|
|
119
|
+
readonly open$: import("@preact/signals-core").Signal<boolean>;
|
|
120
|
+
readonly tree$: ReadonlySignal<SelectionPaneNode[]>;
|
|
121
|
+
/** Force a rebuild; for a change no subscribed event reports. */
|
|
122
|
+
invalidate(): void;
|
|
123
|
+
mounted(): void;
|
|
124
|
+
private _surfaceSubscriptions;
|
|
125
|
+
private _watchSurface;
|
|
126
|
+
unmounted(): void;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The headless data API of the selection pane (ADR 0031 §12): a signal of
|
|
130
|
+
* rows, z-order, top first, ids only.
|
|
131
|
+
*
|
|
132
|
+
* What a host's own pane renders from, and what the library's panel renders
|
|
133
|
+
* from — one tree, so the two cannot disagree about the order of a canvas.
|
|
134
|
+
* Edgeless editors only: the model is registered by the surface's edgeless
|
|
135
|
+
* view extension.
|
|
136
|
+
*/
|
|
137
|
+
export declare function selectionPaneTree(std: BlockStdScope): ReadonlySignal<SelectionPaneNode[]>;
|