@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,91 @@
|
|
|
1
|
+
import type { BlockStdScope } from '../../../std/index.js';
|
|
2
|
+
import type { SelectionPaneNode } from './tree.js';
|
|
3
|
+
/**
|
|
4
|
+
* Move `id` so it sits directly ABOVE `above` in the stack — `null` puts it at
|
|
5
|
+
* the bottom of its stack. Answers whether anything was written.
|
|
6
|
+
*
|
|
7
|
+
* The one-row case of {@link reorderPaneElements}, kept for its callers.
|
|
8
|
+
*/
|
|
9
|
+
export declare function reorderPaneElement(std: BlockStdScope, id: string, above: string | null): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Move the models `ids`, as one block, so they sit directly ABOVE `above` in
|
|
12
|
+
* their stack — `null` puts them at the bottom of it. They keep their current
|
|
13
|
+
* relative z-order, whatever order `ids` lists them in. Answers whether
|
|
14
|
+
* anything was written.
|
|
15
|
+
*
|
|
16
|
+
* The drop target of a drag in a top-first list: dropping rows just over row
|
|
17
|
+
* X means "directly above X". Each moved model gets a new `index` between its
|
|
18
|
+
* new neighbours (the same `fractional-indexing` keys `LayerManager`
|
|
19
|
+
* generates), so only the moved models are written and nothing else shifts.
|
|
20
|
+
*
|
|
21
|
+
* Refused, with nothing written: a read-only document; an unknown id; a
|
|
22
|
+
* mindmap node (it has no index of its own — the whole mindmap moves as one,
|
|
23
|
+
* as the toolbar's reorder already says); models that are not all stacked
|
|
24
|
+
* together (a selection spanning two stacks has no one place to land, ADR
|
|
25
|
+
* 0034); an `above` that is one of them or not stacked with them; and a
|
|
26
|
+
* target that is where the models already are.
|
|
27
|
+
*/
|
|
28
|
+
export declare function reorderPaneElements(std: BlockStdScope, ids: readonly string[], above: string | null): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Lock or unlock each model ON ITS OWN. Answers whether anything was written.
|
|
31
|
+
*
|
|
32
|
+
* Deliberately not the contextual toolbar's lock: that one, given several
|
|
33
|
+
* elements, wraps them into a new group and locks the group — a structural
|
|
34
|
+
* edit a row's padlock must never make. Here each row keeps its place in the
|
|
35
|
+
* tree; only `lockedBySelf` changes, and only where it differs.
|
|
36
|
+
*/
|
|
37
|
+
export declare function setPaneElementsLocked(std: BlockStdScope, ids: readonly string[], locked: boolean): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Hide models for EVERYONE, or show them again (ADR 0031 §7). Answers how
|
|
40
|
+
* many models were written.
|
|
41
|
+
*
|
|
42
|
+
* Writes the stored `hiddenForEveryone` — never `hidden`, which mindmap
|
|
43
|
+
* collapse owns. Hiding writes `true`; showing REMOVES the key (`clearField`
|
|
44
|
+
* on an element, the props proxy's delete on a block), never stores `false`,
|
|
45
|
+
* so an unhidden document is byte-identical to one never hidden. Models
|
|
46
|
+
* already in the asked state are skipped, so a gesture that changes nothing
|
|
47
|
+
* writes nothing and pushes no undo step; the rest go in one transaction
|
|
48
|
+
* after one `captureSync()`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function setPaneElementsHiddenForEveryone(std: BlockStdScope, ids: readonly string[], hidden: boolean): number;
|
|
51
|
+
/**
|
|
52
|
+
* Rename a group through its existing stored `title`. Answers whether
|
|
53
|
+
* anything was written. An empty or unchanged title writes nothing.
|
|
54
|
+
*/
|
|
55
|
+
export declare function renamePaneGroup(std: BlockStdScope, id: string, title: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Rename a frame through its existing stored `title`, edited in place — the
|
|
58
|
+
* `Text` the frame's own title editor binds to, never a replaced one, so an
|
|
59
|
+
* open title editor keeps its binding. Answers whether anything was written.
|
|
60
|
+
* An empty or unchanged title writes nothing.
|
|
61
|
+
*/
|
|
62
|
+
export declare function renamePaneFrame(std: BlockStdScope, id: string, title: string): boolean;
|
|
63
|
+
/** Something the pane can be filtered by: a frame, and only a frame. */
|
|
64
|
+
export interface SelectionPaneFilterTarget {
|
|
65
|
+
id: string;
|
|
66
|
+
/**
|
|
67
|
+
* Always `'frame'`. A framework board was offered too until the product
|
|
68
|
+
* owner's review narrowed the filter to frames (ADR 0031, amendments); the
|
|
69
|
+
* field stays so a host reading it has nothing to change.
|
|
70
|
+
*/
|
|
71
|
+
kind: 'frame';
|
|
72
|
+
}
|
|
73
|
+
/** The frames on the canvas, top first — what the pane's filter offers. */
|
|
74
|
+
export declare function selectionPaneFilterTargets(std: BlockStdScope): SelectionPaneFilterTarget[];
|
|
75
|
+
/**
|
|
76
|
+
* The ids a frame filter keeps: the frame itself — a row like any other, so
|
|
77
|
+
* the list keeps showing what it is filtered by (ADR 0031, amendments) — its
|
|
78
|
+
* `childElementIds` and their descendants. `null` for an id that is not a
|
|
79
|
+
* frame.
|
|
80
|
+
*/
|
|
81
|
+
export declare function selectionPaneFilterMembers(std: BlockStdScope, targetId: string): Set<string> | null;
|
|
82
|
+
/**
|
|
83
|
+
* The tree narrowed to `members`: a row is kept when it is a member or holds
|
|
84
|
+
* one, so a group reaching into a frame stays as the path to its member.
|
|
85
|
+
*
|
|
86
|
+
* A LAYER row is always kept, its children narrowed (ADR 0031, amendments): a
|
|
87
|
+
* layer is where new elements land and where a drop goes, not something a
|
|
88
|
+
* frame holds, and a layer created under a filter that hid it read as a
|
|
89
|
+
* "New layer" button doing nothing.
|
|
90
|
+
*/
|
|
91
|
+
export declare function filterSelectionPaneTree(nodes: readonly SelectionPaneNode[], members: ReadonlySet<string>): SelectionPaneNode[];
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { FrameBlockModel, GroupElementModel, MindmapElementModel, } from '../../../affine-model/index.js';
|
|
2
|
+
import { compareLayer, GfxBlockElementModel, GfxControllerIdentifier, GfxPrimitiveElementModel, isStoredHiddenForEveryone, } from '../../../std/gfx/index.js';
|
|
3
|
+
import { generateKeyBetween } from 'fractional-indexing';
|
|
4
|
+
import * as Y from 'yjs';
|
|
5
|
+
/**
|
|
6
|
+
* The selection pane's writes (ADR 0031, stage 2). Every one of them:
|
|
7
|
+
*
|
|
8
|
+
* - refuses on a read-only document before reading anything else;
|
|
9
|
+
* - writes nothing when nothing would change — an unchanged write is an empty
|
|
10
|
+
* undo step, and an undo that "does nothing" reads as a broken undo;
|
|
11
|
+
* - takes ONE `captureSync()` first, so one gesture in the pane is one undo
|
|
12
|
+
* step, whatever it touched;
|
|
13
|
+
* - writes through `gfx.updateElement`, which is `surface.updateElement` for an
|
|
14
|
+
* element and `store.updateBlock` for a block — never a `Y.Map` directly.
|
|
15
|
+
*
|
|
16
|
+
* They are reached through the `canvas.element.*` / `canvas.group.rename`
|
|
17
|
+
* commands, so a host's own pane gets the same guards by calling `runCommand`.
|
|
18
|
+
*/
|
|
19
|
+
function gfxModel(std, id) {
|
|
20
|
+
const model = std.get(GfxControllerIdentifier).getElementById(id);
|
|
21
|
+
return model instanceof GfxPrimitiveElementModel ||
|
|
22
|
+
model instanceof GfxBlockElementModel
|
|
23
|
+
? model
|
|
24
|
+
: null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The models a reorder compares against: those sharing the moved model's RAW
|
|
28
|
+
* `group` — a group, a mindmap, a frame, or none.
|
|
29
|
+
*
|
|
30
|
+
* Raw and not the pane's container on purpose: an `index` only orders a model
|
|
31
|
+
* among the models its group-like ancestor stacks together (`compare` puts a
|
|
32
|
+
* frame's members right above the frame), so a key computed against a wider
|
|
33
|
+
* list could be written and still not move the row.
|
|
34
|
+
*/
|
|
35
|
+
function stackSiblings(std, model) {
|
|
36
|
+
const group = model.group;
|
|
37
|
+
const gfx = std.get(GfxControllerIdentifier);
|
|
38
|
+
// With user layers a model is restacked within its layer (ADR 0031 §4):
|
|
39
|
+
// a key computed against another layer's neighbours would not move it.
|
|
40
|
+
const userLayers = gfx.surface?.userLayers;
|
|
41
|
+
const layer = userLayers?.ranks ? userLayers.effectiveLayerOf(model) : null;
|
|
42
|
+
return gfx.gfxElements
|
|
43
|
+
.filter(other => other.group === group &&
|
|
44
|
+
(layer === null || userLayers.effectiveLayerOf(other) === layer))
|
|
45
|
+
.sort(compareLayer);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Move `id` so it sits directly ABOVE `above` in the stack — `null` puts it at
|
|
49
|
+
* the bottom of its stack. Answers whether anything was written.
|
|
50
|
+
*
|
|
51
|
+
* The one-row case of {@link reorderPaneElements}, kept for its callers.
|
|
52
|
+
*/
|
|
53
|
+
export function reorderPaneElement(std, id, above) {
|
|
54
|
+
return reorderPaneElements(std, [id], above);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Move the models `ids`, as one block, so they sit directly ABOVE `above` in
|
|
58
|
+
* their stack — `null` puts them at the bottom of it. They keep their current
|
|
59
|
+
* relative z-order, whatever order `ids` lists them in. Answers whether
|
|
60
|
+
* anything was written.
|
|
61
|
+
*
|
|
62
|
+
* The drop target of a drag in a top-first list: dropping rows just over row
|
|
63
|
+
* X means "directly above X". Each moved model gets a new `index` between its
|
|
64
|
+
* new neighbours (the same `fractional-indexing` keys `LayerManager`
|
|
65
|
+
* generates), so only the moved models are written and nothing else shifts.
|
|
66
|
+
*
|
|
67
|
+
* Refused, with nothing written: a read-only document; an unknown id; a
|
|
68
|
+
* mindmap node (it has no index of its own — the whole mindmap moves as one,
|
|
69
|
+
* as the toolbar's reorder already says); models that are not all stacked
|
|
70
|
+
* together (a selection spanning two stacks has no one place to land, ADR
|
|
71
|
+
* 0034); an `above` that is one of them or not stacked with them; and a
|
|
72
|
+
* target that is where the models already are.
|
|
73
|
+
*/
|
|
74
|
+
export function reorderPaneElements(std, ids, above) {
|
|
75
|
+
if (std.store.readonly)
|
|
76
|
+
return false;
|
|
77
|
+
const moving = new Set(ids);
|
|
78
|
+
if (moving.size === 0)
|
|
79
|
+
return false;
|
|
80
|
+
if (above !== null && moving.has(above))
|
|
81
|
+
return false;
|
|
82
|
+
const models = [];
|
|
83
|
+
for (const id of moving) {
|
|
84
|
+
const model = gfxModel(std, id);
|
|
85
|
+
if (!model)
|
|
86
|
+
return false;
|
|
87
|
+
if (model.group instanceof MindmapElementModel)
|
|
88
|
+
return false;
|
|
89
|
+
models.push(model);
|
|
90
|
+
}
|
|
91
|
+
const siblings = stackSiblings(std, models[0]);
|
|
92
|
+
if (models.some(model => !siblings.includes(model)))
|
|
93
|
+
return false;
|
|
94
|
+
// `siblings` is in stacking order, bottom first, so filtering keeps the
|
|
95
|
+
// moved models' relative order.
|
|
96
|
+
const moved = siblings.filter(model => moving.has(model.id));
|
|
97
|
+
const others = siblings.filter(model => !moving.has(model.id));
|
|
98
|
+
let position = 0;
|
|
99
|
+
if (above !== null) {
|
|
100
|
+
const target = others.findIndex(other => other.id === above);
|
|
101
|
+
if (target === -1)
|
|
102
|
+
return false;
|
|
103
|
+
position = target + 1;
|
|
104
|
+
}
|
|
105
|
+
// Already there: the stack would read the same after the move.
|
|
106
|
+
const after = [
|
|
107
|
+
...others.slice(0, position),
|
|
108
|
+
...moved,
|
|
109
|
+
...others.slice(position),
|
|
110
|
+
];
|
|
111
|
+
if (after.every((model, i) => model === siblings[i]))
|
|
112
|
+
return false;
|
|
113
|
+
const lower = others[position - 1]?.index ?? null;
|
|
114
|
+
const upper = others[position]?.index ?? null;
|
|
115
|
+
// Two equal keys cannot be split. `generateIndex` never produces them, so
|
|
116
|
+
// this only guards a hand-made document; refusing beats throwing in a drop.
|
|
117
|
+
if (lower !== null && upper !== null && lower >= upper)
|
|
118
|
+
return false;
|
|
119
|
+
const gfx = std.get(GfxControllerIdentifier);
|
|
120
|
+
std.store.captureSync();
|
|
121
|
+
std.store.transact(() => {
|
|
122
|
+
let previous = lower;
|
|
123
|
+
for (const model of moved) {
|
|
124
|
+
const index = generateKeyBetween(previous, upper);
|
|
125
|
+
gfx.updateElement(model, { index });
|
|
126
|
+
previous = index;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Lock or unlock each model ON ITS OWN. Answers whether anything was written.
|
|
133
|
+
*
|
|
134
|
+
* Deliberately not the contextual toolbar's lock: that one, given several
|
|
135
|
+
* elements, wraps them into a new group and locks the group — a structural
|
|
136
|
+
* edit a row's padlock must never make. Here each row keeps its place in the
|
|
137
|
+
* tree; only `lockedBySelf` changes, and only where it differs.
|
|
138
|
+
*/
|
|
139
|
+
export function setPaneElementsLocked(std, ids, locked) {
|
|
140
|
+
if (std.store.readonly)
|
|
141
|
+
return false;
|
|
142
|
+
const targets = ids
|
|
143
|
+
.map(id => gfxModel(std, id))
|
|
144
|
+
.filter((model) => model !== null && (model.lockedBySelf === true) !== locked);
|
|
145
|
+
if (!targets.length)
|
|
146
|
+
return false;
|
|
147
|
+
const gfx = std.get(GfxControllerIdentifier);
|
|
148
|
+
std.store.captureSync();
|
|
149
|
+
std.store.transact(() => {
|
|
150
|
+
for (const model of targets) {
|
|
151
|
+
gfx.updateElement(model, { lockedBySelf: locked });
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Hide models for EVERYONE, or show them again (ADR 0031 §7). Answers how
|
|
158
|
+
* many models were written.
|
|
159
|
+
*
|
|
160
|
+
* Writes the stored `hiddenForEveryone` — never `hidden`, which mindmap
|
|
161
|
+
* collapse owns. Hiding writes `true`; showing REMOVES the key (`clearField`
|
|
162
|
+
* on an element, the props proxy's delete on a block), never stores `false`,
|
|
163
|
+
* so an unhidden document is byte-identical to one never hidden. Models
|
|
164
|
+
* already in the asked state are skipped, so a gesture that changes nothing
|
|
165
|
+
* writes nothing and pushes no undo step; the rest go in one transaction
|
|
166
|
+
* after one `captureSync()`.
|
|
167
|
+
*/
|
|
168
|
+
export function setPaneElementsHiddenForEveryone(std, ids, hidden) {
|
|
169
|
+
if (std.store.readonly)
|
|
170
|
+
return 0;
|
|
171
|
+
const targets = ids
|
|
172
|
+
.map(id => gfxModel(std, id))
|
|
173
|
+
.filter((model) => model !== null && isStoredHiddenForEveryone(model) !== hidden);
|
|
174
|
+
if (!targets.length)
|
|
175
|
+
return 0;
|
|
176
|
+
const gfx = std.get(GfxControllerIdentifier);
|
|
177
|
+
std.store.captureSync();
|
|
178
|
+
std.store.transact(() => {
|
|
179
|
+
for (const model of targets) {
|
|
180
|
+
if (hidden) {
|
|
181
|
+
gfx.updateElement(model, { hiddenForEveryone: true });
|
|
182
|
+
}
|
|
183
|
+
else if (model instanceof GfxPrimitiveElementModel) {
|
|
184
|
+
model.clearField('hiddenForEveryone');
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
// The props proxy deletes the `prop:` key (ADR 0031 §7).
|
|
188
|
+
delete model.props.hiddenForEveryone;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return targets.length;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Rename a group through its existing stored `title`. Answers whether
|
|
196
|
+
* anything was written. An empty or unchanged title writes nothing.
|
|
197
|
+
*/
|
|
198
|
+
export function renamePaneGroup(std, id, title) {
|
|
199
|
+
if (std.store.readonly)
|
|
200
|
+
return false;
|
|
201
|
+
const model = gfxModel(std, id);
|
|
202
|
+
if (!(model instanceof GroupElementModel))
|
|
203
|
+
return false;
|
|
204
|
+
const next = title.trim();
|
|
205
|
+
if (!next || next === model.title.toString())
|
|
206
|
+
return false;
|
|
207
|
+
std.store.captureSync();
|
|
208
|
+
std
|
|
209
|
+
.get(GfxControllerIdentifier)
|
|
210
|
+
.updateElement(model, { title: new Y.Text(next) });
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Rename a frame through its existing stored `title`, edited in place — the
|
|
215
|
+
* `Text` the frame's own title editor binds to, never a replaced one, so an
|
|
216
|
+
* open title editor keeps its binding. Answers whether anything was written.
|
|
217
|
+
* An empty or unchanged title writes nothing.
|
|
218
|
+
*/
|
|
219
|
+
export function renamePaneFrame(std, id, title) {
|
|
220
|
+
if (std.store.readonly)
|
|
221
|
+
return false;
|
|
222
|
+
const model = gfxModel(std, id);
|
|
223
|
+
if (!(model instanceof FrameBlockModel))
|
|
224
|
+
return false;
|
|
225
|
+
const next = title.trim();
|
|
226
|
+
const text = model.props.title;
|
|
227
|
+
if (!next || next === text.toString())
|
|
228
|
+
return false;
|
|
229
|
+
std.store.captureSync();
|
|
230
|
+
text.replace(0, text.length, next);
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
/** The frames on the canvas, top first — what the pane's filter offers. */
|
|
234
|
+
export function selectionPaneFilterTargets(std) {
|
|
235
|
+
return std
|
|
236
|
+
.get(GfxControllerIdentifier)
|
|
237
|
+
.gfxElements.filter(model => model instanceof FrameBlockModel)
|
|
238
|
+
.sort((a, b) => compareLayer(b, a))
|
|
239
|
+
.map(model => ({ id: model.id, kind: 'frame' }));
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The ids a frame filter keeps: the frame itself — a row like any other, so
|
|
243
|
+
* the list keeps showing what it is filtered by (ADR 0031, amendments) — its
|
|
244
|
+
* `childElementIds` and their descendants. `null` for an id that is not a
|
|
245
|
+
* frame.
|
|
246
|
+
*/
|
|
247
|
+
export function selectionPaneFilterMembers(std, targetId) {
|
|
248
|
+
const target = std.get(GfxControllerIdentifier).getElementById(targetId);
|
|
249
|
+
if (!(target instanceof FrameBlockModel))
|
|
250
|
+
return null;
|
|
251
|
+
const ids = new Set([target.id]);
|
|
252
|
+
for (const child of target.childElements) {
|
|
253
|
+
ids.add(child.id);
|
|
254
|
+
if ('descendantElements' in child) {
|
|
255
|
+
for (const descendant of child
|
|
256
|
+
.descendantElements) {
|
|
257
|
+
ids.add(descendant.id);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return ids;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The tree narrowed to `members`: a row is kept when it is a member or holds
|
|
265
|
+
* one, so a group reaching into a frame stays as the path to its member.
|
|
266
|
+
*
|
|
267
|
+
* A LAYER row is always kept, its children narrowed (ADR 0031, amendments): a
|
|
268
|
+
* layer is where new elements land and where a drop goes, not something a
|
|
269
|
+
* frame holds, and a layer created under a filter that hid it read as a
|
|
270
|
+
* "New layer" button doing nothing.
|
|
271
|
+
*/
|
|
272
|
+
export function filterSelectionPaneTree(nodes, members) {
|
|
273
|
+
const kept = [];
|
|
274
|
+
for (const node of nodes) {
|
|
275
|
+
const children = node.children
|
|
276
|
+
? filterSelectionPaneTree(node.children, members)
|
|
277
|
+
: undefined;
|
|
278
|
+
if (node.kind === 'layer' ||
|
|
279
|
+
members.has(node.id) ||
|
|
280
|
+
(children && children.length)) {
|
|
281
|
+
kept.push(children ? { ...node, children } : node);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return kept;
|
|
285
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { AnyCommandDescriptor } from '../../../std/index.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const reorderElementParams: z.ZodObject<{
|
|
4
|
+
id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
6
|
+
above: z.ZodNullable<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
above: string | null;
|
|
9
|
+
id?: string | undefined;
|
|
10
|
+
ids?: string[] | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
above: string | null;
|
|
13
|
+
id?: string | undefined;
|
|
14
|
+
ids?: string[] | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export type ReorderElementParams = z.infer<typeof reorderElementParams>;
|
|
17
|
+
export declare const lockElementsParams: z.ZodObject<{
|
|
18
|
+
/**
|
|
19
|
+
* The models to act on. Omitted: the current canvas selection. Each one is
|
|
20
|
+
* locked ON ITS OWN — never wrapped into a group.
|
|
21
|
+
*/
|
|
22
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
ids?: string[] | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
ids?: string[] | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
export type LockElementsParams = z.infer<typeof lockElementsParams>;
|
|
29
|
+
export declare const renameGroupParams: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
title: z.ZodString;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
id: string;
|
|
34
|
+
title: string;
|
|
35
|
+
}, {
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
}>;
|
|
39
|
+
export type RenameGroupParams = z.infer<typeof renameGroupParams>;
|
|
40
|
+
export declare const hideLocalParams: z.ZodObject<{
|
|
41
|
+
/** The models to act on. Omitted: the current canvas selection. */
|
|
42
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
+
/**
|
|
44
|
+
* Whole user layers to act on instead (ADR 0031 stage 7). When given,
|
|
45
|
+
* `ids` and the selection are ignored.
|
|
46
|
+
*/
|
|
47
|
+
layerIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
48
|
+
/** `false` shows them again. Omitted: hide. */
|
|
49
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
hidden?: boolean | undefined;
|
|
52
|
+
ids?: string[] | undefined;
|
|
53
|
+
layerIds?: string[] | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
hidden?: boolean | undefined;
|
|
56
|
+
ids?: string[] | undefined;
|
|
57
|
+
layerIds?: string[] | undefined;
|
|
58
|
+
}>;
|
|
59
|
+
export type HideLocalParams = z.infer<typeof hideLocalParams>;
|
|
60
|
+
export declare const hideForEveryoneParams: z.ZodObject<{
|
|
61
|
+
/** The models to act on. Omitted: the current canvas selection. */
|
|
62
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
63
|
+
/**
|
|
64
|
+
* Whole user layers to act on instead: `hidden: true` on each record, one
|
|
65
|
+
* write per layer, never one per member (ADR 0031 §7).
|
|
66
|
+
*/
|
|
67
|
+
layerIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
68
|
+
/** `false` shows them again, for everyone. Omitted: hide. */
|
|
69
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
hidden?: boolean | undefined;
|
|
72
|
+
ids?: string[] | undefined;
|
|
73
|
+
layerIds?: string[] | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
hidden?: boolean | undefined;
|
|
76
|
+
ids?: string[] | undefined;
|
|
77
|
+
layerIds?: string[] | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
export type HideForEveryoneParams = z.infer<typeof hideForEveryoneParams>;
|
|
80
|
+
export declare const selectionPaneCommands: AnyCommandDescriptor[];
|