@formicoidea/labre-core 0.42.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_pkgs/affine-block-attachment/utils.js +4 -0
- package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +17 -4
- package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.d.ts +29 -0
- package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.js +81 -0
- package/dist/_pkgs/affine-block-callout/configs/slash-menu.js +6 -4
- package/dist/_pkgs/affine-block-callout/configs/turn-into.d.ts +8 -0
- package/dist/_pkgs/affine-block-callout/configs/turn-into.js +19 -0
- package/dist/_pkgs/affine-block-callout/translations.d.ts +4 -2
- package/dist/_pkgs/affine-block-callout/translations.js +4 -2
- package/dist/_pkgs/affine-block-callout/view.js +3 -0
- package/dist/_pkgs/affine-block-code/code-block-service.d.ts +13 -0
- package/dist/_pkgs/affine-block-code/code-block-service.js +26 -0
- package/dist/_pkgs/affine-block-code/code-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-code/code-block.js +11 -2
- package/dist/_pkgs/affine-block-code/code-toolbar/components/lang-button.js +31 -8
- package/dist/_pkgs/affine-block-data-view/configs/tooltips.js +1 -1
- package/dist/_pkgs/affine-block-database/configs/tooltips.js +1 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +4 -2
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.d.ts +11 -0
- package/dist/_pkgs/affine-block-edgeless-text/svg-painter.d.ts +20 -0
- package/dist/_pkgs/affine-block-edgeless-text/svg-painter.js +76 -0
- package/dist/_pkgs/affine-block-edgeless-text/view.js +2 -0
- package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.d.ts +39 -0
- package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.js +39 -0
- package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +2 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.d.ts +14 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.js +21 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.d.ts +0 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +2 -5
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +1 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +14 -6
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.d.ts +16 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.js +17 -1
- package/dist/_pkgs/affine-block-embed/embed-loom-block/embed-loom-block.js +2 -0
- package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +2 -0
- package/dist/_pkgs/affine-block-embed/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-embed/index.js +1 -0
- package/dist/_pkgs/affine-block-embed/translations.d.ts +8 -0
- package/dist/_pkgs/affine-block-embed/translations.js +28 -0
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-edgeless-linked-doc-block.js +3 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +7 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-edgeless-synced-doc-block.js +3 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +2 -2
- package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +5 -0
- package/dist/_pkgs/affine-block-frame/frame-manager.js +53 -19
- package/dist/_pkgs/affine-block-frame/frame-tool.js +3 -1
- package/dist/_pkgs/affine-block-image/utils.js +4 -1
- package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.d.ts +8 -0
- package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.js +9 -5
- package/dist/_pkgs/affine-block-list/utils/get-list-icon.js +3 -1
- package/dist/_pkgs/affine-block-note/configs/tooltips.js +1 -1
- package/dist/_pkgs/affine-block-note/translations.d.ts +0 -1
- package/dist/_pkgs/affine-block-note/translations.js +0 -5
- package/dist/_pkgs/affine-block-root/adapters/html.js +2 -2
- package/dist/_pkgs/affine-block-root/commands/copy-link-commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-root/commands/copy-link-commands.js +155 -0
- package/dist/_pkgs/affine-block-root/configs/toolbar.js +17 -1
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/clipboard.js +2 -1
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/command.js +161 -83
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.d.ts +21 -0
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.js +85 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +18 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +9 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +28 -0
- package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/index.js +1 -0
- package/dist/_pkgs/affine-block-root/keyboard/commands.js +9 -6
- package/dist/_pkgs/affine-block-root/preview/edgeless-root-preview-block.js +15 -2
- package/dist/_pkgs/affine-block-root/view.js +2 -0
- package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.d.ts +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/audit.js +13 -61
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.js +71 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/clipboard-config.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +27 -7
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +2 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +22 -3
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +6 -3
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +4 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.d.ts +63 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.js +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +62 -5
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +98 -18
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +14 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +82 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +112 -10
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.d.ts +13 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.js +33 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +13 -1
- package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +8 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.js +59 -3
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +13 -6
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +26 -10
- package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +82 -6
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +99 -21
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.d.ts +80 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.js +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.d.ts +82 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.js +342 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.d.ts +137 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.js +323 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +23 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +112 -4
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +98 -19
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.d.ts +76 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.js +299 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.d.ts +20 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.js +34 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.d.ts +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.js +172 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.d.ts +40 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.js +69 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.d.ts +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.js +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.d.ts +10 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.js +14 -0
- package/dist/_pkgs/affine-block-surface/framework-background/background-view.js +1 -1
- package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +55 -2
- package/dist/_pkgs/affine-block-surface/framework-background/facts.js +63 -1
- package/dist/_pkgs/affine-block-surface/framework-background/fit.d.ts +36 -0
- package/dist/_pkgs/affine-block-surface/framework-background/fit.js +30 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +16 -8
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +26 -14
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +17 -3
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.d.ts +3 -1
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +22 -2
- package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +2 -7
- package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.d.ts +30 -0
- package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.js +29 -0
- package/dist/_pkgs/affine-block-surface/surface-block.js +6 -0
- package/dist/_pkgs/affine-block-surface/surface-model.js +5 -0
- package/dist/_pkgs/affine-block-surface/surface-transformer.js +5 -0
- package/dist/_pkgs/affine-block-surface/tool/default-tool.js +28 -5
- package/dist/_pkgs/affine-block-surface/view.js +23 -1
- package/dist/_pkgs/affine-block-surface-ref/configs/tooltips.js +2 -2
- package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
- package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +5 -0
- package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
- package/dist/_pkgs/affine-components/context-menu/button.js +17 -1
- package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
- package/dist/_pkgs/affine-components/icons/ai.js +3 -3
- package/dist/_pkgs/affine-components/icons/index.d.ts +0 -1
- package/dist/_pkgs/affine-components/icons/index.js +0 -1
- package/dist/_pkgs/affine-components/icons/list.js +7 -1
- package/dist/_pkgs/affine-components/icons/text.d.ts +1 -0
- package/dist/_pkgs/affine-components/icons/text.js +11 -0
- package/dist/_pkgs/affine-components/size-dropdown-menu/dropdown-menu.js +6 -1
- package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -1
- package/dist/_pkgs/affine-components/toolbar/index.js +1 -1
- package/dist/_pkgs/affine-components/toolbar/menu-button.d.ts +7 -0
- package/dist/_pkgs/affine-components/toolbar/menu-button.js +30 -0
- package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +16 -1
- package/dist/_pkgs/affine-components/toolbar/picker-menu.js +2 -2
- package/dist/_pkgs/affine-components/toolbar/toolbar.d.ts +1 -0
- package/dist/_pkgs/affine-components/toolbar/toolbar.js +67 -0
- package/dist/_pkgs/affine-fragment-adapter-panel/adapter-panel.d.ts +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card-title-editor.js +1 -1
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +3 -3
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.d.ts +1 -1
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +8 -27
- package/dist/_pkgs/affine-fragment-frame-panel/index.d.ts +1 -0
- package/dist/_pkgs/affine-fragment-frame-panel/index.js +1 -0
- package/dist/_pkgs/affine-gfx-brush/toolbar/components/eraser/icons.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.d.ts +11 -2
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +11 -2
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +3 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +21 -4
- package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +6 -4
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +24 -8
- package/dist/_pkgs/affine-gfx-connector/translations.d.ts +3 -0
- package/dist/_pkgs/affine-gfx-connector/translations.js +23 -0
- package/dist/_pkgs/affine-gfx-group/command/group-api.js +52 -1
- package/dist/_pkgs/affine-gfx-mindmap/indicator-overlay/index.js +6 -2
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/config.js +4 -2
- package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +6 -0
- package/dist/_pkgs/affine-gfx-mindmap/translations.js +10 -0
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +21 -3
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +2 -0
- package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +5 -3
- package/dist/_pkgs/affine-gfx-shape/translations.d.ts +7 -0
- package/dist/_pkgs/affine-gfx-shape/translations.js +11 -0
- package/dist/_pkgs/affine-gfx-template/builtin/other.js +13 -7
- package/dist/_pkgs/affine-gfx-template/services/template-middlewares.d.ts +9 -0
- package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +23 -1
- package/dist/_pkgs/affine-gfx-template/services/template.js +2 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-loading.js +1 -1
- package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
- package/dist/_pkgs/affine-gfx-template/translations.js +38 -0
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +5 -3
- package/dist/_pkgs/affine-gfx-text/element-renderer/index.js +20 -3
- package/dist/_pkgs/affine-gfx-text/element-renderer/utils.d.ts +67 -1
- package/dist/_pkgs/affine-gfx-text/element-renderer/utils.js +101 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +56 -3
- package/dist/_pkgs/affine-gfx-text/toolbar/config.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-gfx-text/translations.d.ts +8 -0
- package/dist/_pkgs/affine-gfx-text/translations.js +12 -0
- package/dist/_pkgs/affine-inline-latex/latex-node/latex-editor-menu.js +2 -1
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +31 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.d.ts +4 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.js +14 -0
- package/dist/_pkgs/affine-inline-preset/command/config.js +21 -3
- package/dist/_pkgs/affine-inline-preset/command/index.d.ts +1 -1
- package/dist/_pkgs/affine-inline-preset/command/index.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/text-style.d.ts +2 -1
- package/dist/_pkgs/affine-inline-preset/command/text-style.js +1 -0
- package/dist/_pkgs/affine-inline-preset/default-inline-manager.js +2 -1
- package/dist/_pkgs/affine-inline-preset/inline-spec.d.ts +4 -0
- package/dist/_pkgs/affine-inline-preset/inline-spec.js +14 -0
- package/dist/_pkgs/affine-inline-preset/translations.d.ts +2 -2
- package/dist/_pkgs/affine-inline-preset/translations.js +2 -2
- package/dist/_pkgs/affine-model/blocks/attachment/attachment-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/bookmark/bookmark-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.d.ts +1 -1
- package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/embed/iframe/iframe-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/frame/frame-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/latex/latex-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/note/note-model.js +2 -0
- package/dist/_pkgs/affine-model/consts/text.d.ts +41 -2
- package/dist/_pkgs/affine-model/consts/text.js +50 -1
- package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +6 -1
- package/dist/_pkgs/affine-model/elements/shape/shape.js +14 -1
- package/dist/_pkgs/affine-model/elements/text/text.d.ts +6 -1
- package/dist/_pkgs/affine-model/elements/text/text.js +13 -1
- package/dist/_pkgs/affine-model/utils/helper.js +2 -0
- package/dist/_pkgs/affine-rich-text/conversion.d.ts +25 -0
- package/dist/_pkgs/affine-rich-text/conversion.js +9 -0
- package/dist/_pkgs/affine-rich-text/index.d.ts +1 -1
- package/dist/_pkgs/affine-rich-text/index.js +1 -1
- package/dist/_pkgs/affine-shared/commands/model-crud/replace-selected-text-with-blocks.d.ts +1 -1
- package/dist/_pkgs/affine-shared/services/canvas-grid.d.ts +63 -0
- package/dist/_pkgs/affine-shared/services/canvas-grid.js +109 -0
- package/dist/_pkgs/affine-shared/services/canvas-local-visibility.d.ts +64 -0
- package/dist/_pkgs/affine-shared/services/canvas-local-visibility.js +192 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +27 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.js +34 -0
- package/dist/_pkgs/affine-shared/services/editor-setting-service.d.ts +3 -0
- package/dist/_pkgs/affine-shared/services/editor-setting-service.js +7 -0
- package/dist/_pkgs/affine-shared/services/feature-flag-service.d.ts +4 -0
- package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +13 -2
- package/dist/_pkgs/affine-shared/services/font-loader/config.js +43 -54
- package/dist/_pkgs/affine-shared/services/index.d.ts +3 -0
- package/dist/_pkgs/affine-shared/services/index.js +3 -0
- package/dist/_pkgs/affine-shared/services/selection-pane-service.d.ts +44 -0
- package/dist/_pkgs/affine-shared/services/selection-pane-service.js +28 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +69 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/theme-service.d.ts +19 -0
- package/dist/_pkgs/affine-shared/services/theme-service.js +24 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +25 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +90 -0
- package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/styles/index.js +1 -0
- package/dist/_pkgs/affine-shared/styles/panel-header.d.ts +31 -0
- package/dist/_pkgs/affine-shared/styles/panel-header.js +61 -0
- package/dist/_pkgs/affine-shared/styles/text.js +7 -7
- package/dist/_pkgs/affine-shared/types/index.d.ts +6 -0
- package/dist/_pkgs/affine-shared/utils/canvas-export-colors.d.ts +26 -0
- package/dist/_pkgs/affine-shared/utils/canvas-export-colors.js +127 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +8 -11
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +8 -11
- package/dist/_pkgs/affine-shared/utils/index.d.ts +2 -0
- package/dist/_pkgs/affine-shared/utils/index.js +2 -0
- package/dist/_pkgs/affine-shared/utils/label-mode.d.ts +47 -0
- package/dist/_pkgs/affine-shared/utils/label-mode.js +55 -0
- package/dist/_pkgs/affine-shared/utils/model/merge-to-code-model.js +7 -1
- package/dist/_pkgs/affine-shared/utils/model/transform-model.js +5 -0
- package/dist/_pkgs/affine-widget-edgeless-dragging-area/edgeless-dragging-area-rect.js +2 -2
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +15 -4
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
- package/dist/_pkgs/affine-widget-edgeless-toolbar/config/types.d.ts +15 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.d.ts +1 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.js +7 -2
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.d.ts +18 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.js +52 -6
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.d.ts +61 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.js +91 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.d.ts +17 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.js +95 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.d.ts +10 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.js +31 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.d.ts +26 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.js +82 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.d.ts +170 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.js +1381 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +58 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +171 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
- package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +2 -1
- package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
- package/dist/_pkgs/affine-widget-slash-menu/translations.d.ts +16 -0
- package/dist/_pkgs/affine-widget-slash-menu/translations.js +23 -1
- package/dist/_pkgs/affine-widget-toolbar/utils.js +57 -14
- package/dist/_pkgs/data-view/core/detail/field.js +2 -1
- package/dist/_pkgs/data-view/core/filter/literal/define.js +3 -1
- package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +1 -1
- package/dist/_pkgs/data-view/property-presets/checkbox/cell-renderer.js +8 -2
- package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +1 -1
- package/dist/_pkgs/data-view/view-presets/kanban/pc/controller/drag.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/drag.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/selection.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/header/vertical-indicator.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/row/row-select-checkbox.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/drag.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/selection.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/header/vertical-indicator.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/row-header.js +3 -1
- package/dist/_pkgs/std/gfx/controller.d.ts +13 -0
- package/dist/_pkgs/std/gfx/controller.js +22 -2
- package/dist/_pkgs/std/gfx/grid.d.ts +31 -2
- package/dist/_pkgs/std/gfx/index.d.ts +3 -1
- package/dist/_pkgs/std/gfx/index.js +3 -1
- package/dist/_pkgs/std/gfx/interactivity/manager.js +7 -0
- package/dist/_pkgs/std/gfx/layer.js +73 -5
- package/dist/_pkgs/std/gfx/local-visibility.d.ts +88 -0
- package/dist/_pkgs/std/gfx/local-visibility.js +217 -0
- package/dist/_pkgs/std/gfx/model/gfx-block-model.d.ts +13 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +34 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +65 -1
- package/dist/_pkgs/std/gfx/model/surface/role.d.ts +10 -5
- package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +27 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +43 -0
- package/dist/_pkgs/std/gfx/model/surface/user-layers.d.ts +68 -0
- package/dist/_pkgs/std/gfx/model/surface/user-layers.js +127 -0
- package/dist/_pkgs/std/utils/layer.d.ts +10 -0
- package/dist/_pkgs/std/utils/layer.js +64 -13
- package/dist/_pkgs/std/view/element/gfx-block-component.js +10 -2
- package/dist/commands.js +6 -2
- package/dist/translations.js +15 -6
- package/package.json +13 -2
- package/dist/_pkgs/affine-components/icons/file-icons-rc.d.ts +0 -1
- package/dist/_pkgs/affine-components/icons/file-icons-rc.js +0 -130
- package/dist/_pkgs/affine-shared/test-utils/affine-template.d.ts +0 -6
- package/dist/_pkgs/affine-shared/test-utils/affine-template.js +0 -258
- package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.d.ts +0 -8
- package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.js +0 -81
- package/dist/_pkgs/affine-shared/test-utils/create-test-host.d.ts +0 -23
- package/dist/_pkgs/affine-shared/test-utils/create-test-host.js +0 -187
- package/dist/_pkgs/affine-shared/test-utils/index.d.ts +0 -3
- package/dist/_pkgs/affine-shared/test-utils/index.js +0 -3
|
@@ -859,7 +859,7 @@ let SelectionElement = (() => {
|
|
|
859
859
|
height: `${focus.height}px`,
|
|
860
860
|
display: 'block',
|
|
861
861
|
boxShadow: focus.editing
|
|
862
|
-
? '0px 0px 0px 2px
|
|
862
|
+
? '0px 0px 0px 2px color-mix(in srgb, var(--affine-primary-color) 30%, transparent)'
|
|
863
863
|
: 'unset',
|
|
864
864
|
})
|
|
865
865
|
: undefined;
|
package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/header/vertical-indicator.js
CHANGED
|
@@ -101,7 +101,8 @@ let TableVerticalIndicator = (() => {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
.with-shadow.vertical-indicator::after {
|
|
104
|
-
box-shadow: 0px 0px 8px 0px
|
|
104
|
+
box-shadow: 0px 0px 8px 0px
|
|
105
|
+
color-mix(in srgb, var(--affine-primary-color) 35%, transparent);
|
|
105
106
|
}
|
|
106
107
|
`; }
|
|
107
108
|
render() {
|
|
@@ -138,7 +138,9 @@ let TableRowHeader = (() => {
|
|
|
138
138
|
<div @click=${this.selectRow} class="${styles.checkboxWrapper}">
|
|
139
139
|
<div class="${classString}">
|
|
140
140
|
${this.rowSelected$.value
|
|
141
|
-
? CheckBoxCheckSolidIcon({
|
|
141
|
+
? CheckBoxCheckSolidIcon({
|
|
142
|
+
style: `color:var(--affine-primary-color)`,
|
|
143
|
+
})
|
|
142
144
|
: CheckBoxUnIcon()}
|
|
143
145
|
</div>
|
|
144
146
|
</div>
|
|
@@ -8,6 +8,7 @@ import type { CursorType } from './cursor.js';
|
|
|
8
8
|
import { GridManager } from './grid.js';
|
|
9
9
|
import { KeyboardController } from './keyboard.js';
|
|
10
10
|
import { LayerManager } from './layer.js';
|
|
11
|
+
import { GfxHiddenForEveryone, GfxLocalVisibility } from './local-visibility.js';
|
|
11
12
|
import type { PointTestOptions } from './model/base.js';
|
|
12
13
|
import { GfxBlockElementModel } from './model/gfx-block-model.js';
|
|
13
14
|
import type { GfxModel } from './model/model.js';
|
|
@@ -20,6 +21,18 @@ export declare class GfxController extends LifeCycleWatcher {
|
|
|
20
21
|
private readonly _surface$;
|
|
21
22
|
readonly cursor$: Signal<CursorType>;
|
|
22
23
|
readonly keyboard: KeyboardController;
|
|
24
|
+
/**
|
|
25
|
+
* What this viewer has hidden on the canvas (ADR 0031 §8). Read by the
|
|
26
|
+
* renderers, the DOM block views, pointer picking and the marquee — never by
|
|
27
|
+
* `grid.search`, whose answer rules and legends share.
|
|
28
|
+
*/
|
|
29
|
+
readonly localVisibility: GfxLocalVisibility;
|
|
30
|
+
/**
|
|
31
|
+
* The ids hidden for everyone (ADR 0031 §7), followed on the surface and
|
|
32
|
+
* the store and registered into {@link localVisibility}: what nobody sees
|
|
33
|
+
* is, a fortiori, not seen by this viewer.
|
|
34
|
+
*/
|
|
35
|
+
readonly hiddenForEveryone: GfxHiddenForEveryone;
|
|
23
36
|
readonly viewport: Viewport;
|
|
24
37
|
get grid(): GridManager;
|
|
25
38
|
get layer(): LayerManager;
|
|
@@ -10,6 +10,7 @@ import { GridManager } from './grid.js';
|
|
|
10
10
|
import { gfxControllerKey } from './identifiers.js';
|
|
11
11
|
import { KeyboardController } from './keyboard.js';
|
|
12
12
|
import { LayerManager } from './layer.js';
|
|
13
|
+
import { GfxHiddenForEveryone, GfxLocalVisibility, } from './local-visibility.js';
|
|
13
14
|
import { GfxBlockElementModel } from './model/gfx-block-model.js';
|
|
14
15
|
import { GfxPrimitiveElementModel } from './model/surface/element-model.js';
|
|
15
16
|
import { FIT_TO_SCREEN_PADDING, Viewport, ZOOM_INITIAL } from './viewport.js';
|
|
@@ -46,11 +47,27 @@ export class GfxController extends LifeCycleWatcher {
|
|
|
46
47
|
this._disposables = new DisposableGroup();
|
|
47
48
|
this._surface$ = new Signal(null);
|
|
48
49
|
this.cursor$ = new Signal();
|
|
50
|
+
/**
|
|
51
|
+
* What this viewer has hidden on the canvas (ADR 0031 §8). Read by the
|
|
52
|
+
* renderers, the DOM block views, pointer picking and the marquee — never by
|
|
53
|
+
* `grid.search`, whose answer rules and legends share.
|
|
54
|
+
*/
|
|
55
|
+
this.localVisibility = new GfxLocalVisibility();
|
|
56
|
+
/**
|
|
57
|
+
* The ids hidden for everyone (ADR 0031 §7), followed on the surface and
|
|
58
|
+
* the store and registered into {@link localVisibility}: what nobody sees
|
|
59
|
+
* is, a fortiori, not seen by this viewer.
|
|
60
|
+
*/
|
|
61
|
+
this.hiddenForEveryone = new GfxHiddenForEveryone();
|
|
49
62
|
this.viewport = new Viewport();
|
|
50
63
|
this.keyboard = new KeyboardController(std);
|
|
51
64
|
this._disposables.add(onSurfaceAdded(this.doc, surface => {
|
|
52
65
|
this._surface$.value = surface;
|
|
66
|
+
this.hiddenForEveryone.watch(this.doc, surface);
|
|
53
67
|
}));
|
|
68
|
+
this._disposables.add(this.localVisibility.register(this.hiddenForEveryone.ids$));
|
|
69
|
+
this._disposables.add(this.localVisibility.registerLayers(this.hiddenForEveryone.layerIds$));
|
|
70
|
+
this._disposables.add(() => this.hiddenForEveryone.dispose());
|
|
54
71
|
this._disposables.add(this.viewport);
|
|
55
72
|
this._disposables.add(this.keyboard);
|
|
56
73
|
this.std.provider.getAll(GfxClassExtenderIdentifier).forEach(ext => {
|
|
@@ -94,8 +111,11 @@ export class GfxController extends LifeCycleWatcher {
|
|
|
94
111
|
h: responsePadding[1] * 2,
|
|
95
112
|
};
|
|
96
113
|
const candidates = this.grid.search(hitTestBound);
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
// A model this viewer hid is not under the pointer: it is not painted,
|
|
115
|
+
// so it cannot be what the user aims at (ADR 0031 §8).
|
|
116
|
+
const picked = candidates.filter(elm => !this.localVisibility.isHidden(elm) &&
|
|
117
|
+
(elm.includesPoint(x, y, options, this.std.host) ||
|
|
118
|
+
elm.externalBound?.isPointInBound([x, y])));
|
|
99
119
|
picked.sort(this.layer.compare);
|
|
100
120
|
if (all) {
|
|
101
121
|
return picked;
|
|
@@ -45,8 +45,37 @@ export declare class GridManager extends GfxExtension {
|
|
|
45
45
|
remove(element: GfxModel | GfxLocalElementModel): void;
|
|
46
46
|
/**
|
|
47
47
|
* Search for elements in a bound.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
48
|
+
*
|
|
49
|
+
* Skips the stored `hidden` (mindmap collapse) and NOTHING ELSE, on purpose:
|
|
50
|
+
* this answer is shared by painting, picking AND logic — rules, legends,
|
|
51
|
+
* semantic exports — and a viewer's local hide must never change what
|
|
52
|
+
* another viewer's rules or legend say about the same document (ADR 0031
|
|
53
|
+
* §8). A new visibility is applied by the consumer, never added here.
|
|
54
|
+
*
|
|
55
|
+
* Caller audit (ADR 0031 §9; the row of its table each caller belongs to):
|
|
56
|
+
*
|
|
57
|
+
* - paint — the canvas renderer's bound pass (`_renderByBound`, which also
|
|
58
|
+
* paints the SVG export and the PNG export's canvas layer) and the DOM
|
|
59
|
+
* renderer's two passes: filter through the shared paint predicate
|
|
60
|
+
* (`isPainted`, `affine-block-surface/renderer/paint-predicate.ts`).
|
|
61
|
+
* - paint, blocks — `gfx-viewport`'s `getModelsInViewport` in the edgeless
|
|
62
|
+
* root and its preview: which DOM blocks to mount; a block's own
|
|
63
|
+
* visibility is its view's business.
|
|
64
|
+
* - picking — `GfxController.getElementByPoint` and every caller of it
|
|
65
|
+
* (selection, hover highlights, frame highlight, peek, connector reveal,
|
|
66
|
+
* mindmap drag, pan, text tools, element link, spotlight).
|
|
67
|
+
* - marquee — `GfxController.getElementsByBound` from
|
|
68
|
+
* `InteractivityManager.handleBoxSelection`.
|
|
69
|
+
* - export — `getElementsByBound` from the PNG export (`ExportManager`),
|
|
70
|
+
* the SVG board export (`renderBoardSvg`) and copy-as-PNG
|
|
71
|
+
* (`EdgelessClipboardController`'s canvas path).
|
|
72
|
+
* - logic, keeps every visibility — `getElementsByBound` from the legend
|
|
73
|
+
* (`rolesInBound`, the legend redraw), and the surface-ref slash menu's
|
|
74
|
+
* free-space search (a hidden element still takes its room).
|
|
75
|
+
* - pointer-adjacent, no row in the table yet, keeps every visibility today
|
|
76
|
+
* — the connector tool's connectable targets in view and the snap
|
|
77
|
+
* overlay's alignment candidates: a connector may still attach to, and a
|
|
78
|
+
* drag still snap to, an element the viewer hid.
|
|
50
79
|
*/
|
|
51
80
|
search<T extends BuiltInFilterType = 'canvas' | 'block'>(bound: IBound, options?: {
|
|
52
81
|
/**
|
|
@@ -10,12 +10,14 @@ export { GfxControllerIdentifier } from './identifiers.js';
|
|
|
10
10
|
export type { BoxSelectionContext, DragEndContext, DragExtensionInitializeContext, DragInitializationOption, DragMoveContext, DragStartContext, ExtensionDragEndContext, ExtensionDragMoveContext, ExtensionDragStartContext, GfxInteractivityContext, GfxViewInteractionConfig, ResizeConstraint, ResizeEndContext, ResizeHandle, ResizeMoveContext, ResizeStartContext, RotateConstraint, RotateEndContext, RotateMoveContext, RotateStartContext, SelectContext, } from './interactivity/index.js';
|
|
11
11
|
export { GfxViewEventManager, GfxViewInteractionExtension, InteractivityExtension, InteractivityIdentifier, InteractivityManager, } from './interactivity/index.js';
|
|
12
12
|
export { LayerManager, type ReorderingDirection } from './layer.js';
|
|
13
|
+
export { GfxHiddenForEveryone, GfxLocalVisibility, } from './local-visibility.js';
|
|
13
14
|
export type { GfxCompatibleInterface, GfxElementGeometry, GfxGroupCompatibleInterface, PointTestOptions, } from './model/base.js';
|
|
14
15
|
export { gfxGroupCompatibleSymbol, isGfxGroupCompatibleModel, } from './model/base.js';
|
|
15
16
|
export { GfxBlockElementModel, type GfxCommonBlockProps, GfxCompatibleBlockModel as GfxCompatible, type GfxCompatibleProps, } from './model/gfx-block-model.js';
|
|
16
17
|
export { type GfxModel, isPrimitiveModel } from './model/model.js';
|
|
17
18
|
export { convert, convertProps, derive, field, getDerivedProps, getFieldPropsSet, getLocalPropsSet, initializeObservers, initializeWatchers, local, observe, updateDerivedProps, watch, } from './model/surface/decorators/index.js';
|
|
18
|
-
export { type BaseElementProps, type ForeignInterchange, type InterchangeScope, GfxGroupLikeElementModel, GfxPrimitiveElementModel, type SerializedElement, type ValidationException, } from './model/surface/element-model.js';
|
|
19
|
+
export { type BaseElementProps, type ForeignInterchange, type InterchangeScope, GfxGroupLikeElementModel, GfxPrimitiveElementModel, isStoredHiddenForEveryone, type SerializedElement, type ValidationException, } from './model/surface/element-model.js';
|
|
20
|
+
export { DEFAULT_LAYER_ID, layerCarrierOf, ownLayerOf, type SurfaceLayerRecord, SurfaceUserLayers, } from './model/surface/user-layers.js';
|
|
19
21
|
export { GfxLocalElementModel, prop, } from './model/surface/local-element-model.js';
|
|
20
22
|
export { collectPivotOccurrences, isPivotBound, type PivotBoundElement, type PivotOccurrence, resolvePivotBinding, } from './model/surface/pivot.js';
|
|
21
23
|
export { type EdgeDirectionDef, findRoleDef, isTypedEdgeRole, type RoleDef, type RoleDefs, type RoleId, roleIsA, type RoleKind, RoleVocabularyExtension, RoleVocabularyIdentifier, } from './model/surface/role.js';
|
|
@@ -8,11 +8,13 @@ export { DEFAULT_HIGHLIGHT_DURATION, DEFAULT_HIGHLIGHT_PADDING, ElementHighlight
|
|
|
8
8
|
export { GfxControllerIdentifier } from './identifiers.js';
|
|
9
9
|
export { GfxViewEventManager, GfxViewInteractionExtension, InteractivityExtension, InteractivityIdentifier, InteractivityManager, } from './interactivity/index.js';
|
|
10
10
|
export { LayerManager } from './layer.js';
|
|
11
|
+
export { GfxHiddenForEveryone, GfxLocalVisibility, } from './local-visibility.js';
|
|
11
12
|
export { gfxGroupCompatibleSymbol, isGfxGroupCompatibleModel, } from './model/base.js';
|
|
12
13
|
export { GfxBlockElementModel, GfxCompatibleBlockModel as GfxCompatible, } from './model/gfx-block-model.js';
|
|
13
14
|
export { isPrimitiveModel } from './model/model.js';
|
|
14
15
|
export { convert, convertProps, derive, field, getDerivedProps, getFieldPropsSet, getLocalPropsSet, initializeObservers, initializeWatchers, local, observe, updateDerivedProps, watch, } from './model/surface/decorators/index.js';
|
|
15
|
-
export { GfxGroupLikeElementModel, GfxPrimitiveElementModel, } from './model/surface/element-model.js';
|
|
16
|
+
export { GfxGroupLikeElementModel, GfxPrimitiveElementModel, isStoredHiddenForEveryone, } from './model/surface/element-model.js';
|
|
17
|
+
export { DEFAULT_LAYER_ID, layerCarrierOf, ownLayerOf, SurfaceUserLayers, } from './model/surface/user-layers.js';
|
|
16
18
|
export { GfxLocalElementModel, prop, } from './model/surface/local-element-model.js';
|
|
17
19
|
export { collectPivotOccurrences, isPivotBound, resolvePivotBinding, } from './model/surface/pivot.js';
|
|
18
20
|
export { findRoleDef, isTypedEdgeRole, roleIsA, RoleVocabularyExtension, RoleVocabularyIdentifier, } from './model/surface/role.js';
|
|
@@ -225,6 +225,10 @@ export class InteractivityManager extends GfxExtension {
|
|
|
225
225
|
}
|
|
226
226
|
handleBoxSelection(context) {
|
|
227
227
|
const elements = this.gfx.getElementsByBound(context.box).filter(model => {
|
|
228
|
+
// The marquee takes what the viewer sees: a locally hidden model is
|
|
229
|
+
// left out (ADR 0031 §8). The selection pane still selects it.
|
|
230
|
+
if (this.gfx.localVisibility.isHidden(model))
|
|
231
|
+
return false;
|
|
228
232
|
const view = this.gfx.view.get(model);
|
|
229
233
|
if (!view ||
|
|
230
234
|
view.onBoxSelected({
|
|
@@ -283,6 +287,9 @@ export class InteractivityManager extends GfxExtension {
|
|
|
283
287
|
onDragMove(lastEvent);
|
|
284
288
|
});
|
|
285
289
|
const onDragMove = (event) => {
|
|
290
|
+
// The viewport watcher replays the latest pointer position; without
|
|
291
|
+
// this it replayed the drag start and snapped the elements back.
|
|
292
|
+
lastEvent = event;
|
|
286
293
|
dragLastPos = Point.from(this.gfx.viewport.toModelCoordFromClientCoord([event.x, event.y]));
|
|
287
294
|
const moveContext = {
|
|
288
295
|
...internal,
|
|
@@ -220,11 +220,22 @@ export class LayerManager extends GfxExtension {
|
|
|
220
220
|
layerElements[0],
|
|
221
221
|
last(layerElements),
|
|
222
222
|
], target)) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
// The first element `target` sorts before. The layer is sorted and
|
|
224
|
+
// `target` is in its range, so that position is found by bisection
|
|
225
|
+
// rather than by comparing `target` with every element: a frame
|
|
226
|
+
// adopting N children re-inserted each of them, N² comparisons.
|
|
227
|
+
let low = 0;
|
|
228
|
+
let high = layerElements.length;
|
|
229
|
+
while (low < high) {
|
|
230
|
+
const mid = (low + high) >>> 1;
|
|
231
|
+
if (compare(target, layerElements[mid]) < 0) {
|
|
232
|
+
high = mid;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
low = mid + 1;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const insertIdx = low;
|
|
228
239
|
if (layer.type === type) {
|
|
229
240
|
addToLayer(layer, target, insertIdx);
|
|
230
241
|
updateLayersZIndex(layers, cur);
|
|
@@ -468,6 +479,31 @@ export class LayerManager extends GfxExtension {
|
|
|
468
479
|
* @returns
|
|
469
480
|
*/
|
|
470
481
|
generateIndex(reverse = false) {
|
|
482
|
+
// With user layers the paint order is layer rank first (ADR 0031 §4), so
|
|
483
|
+
// the first and last runs no longer hold the lowest and highest `index`.
|
|
484
|
+
// "Above everything" must still mean above every key, which, rank first,
|
|
485
|
+
// is the top of whichever layer the new element lands in.
|
|
486
|
+
// Every model is scanned, not the runs' edges: a run can span two user
|
|
487
|
+
// layers, and the lower layer's highest key then sits mid-run.
|
|
488
|
+
if (this._surface?.userLayers.ranks) {
|
|
489
|
+
let lowest = null;
|
|
490
|
+
let highest = null;
|
|
491
|
+
for (const model of [...this.canvasElements, ...this.blocks]) {
|
|
492
|
+
const index = model.index;
|
|
493
|
+
if (typeof index !== 'string')
|
|
494
|
+
continue;
|
|
495
|
+
if (lowest === null || index < lowest)
|
|
496
|
+
lowest = index;
|
|
497
|
+
if (highest === null || index > highest)
|
|
498
|
+
highest = index;
|
|
499
|
+
}
|
|
500
|
+
if (lowest === null || highest === null) {
|
|
501
|
+
return LayerManager.INITIAL_INDEX;
|
|
502
|
+
}
|
|
503
|
+
return reverse
|
|
504
|
+
? generateKeyBetween(null, lowest)
|
|
505
|
+
: generateKeyBetween(highest, null);
|
|
506
|
+
}
|
|
471
507
|
if (reverse) {
|
|
472
508
|
const firstIndex = this.layers[0]?.indexes[0];
|
|
473
509
|
return firstIndex
|
|
@@ -493,6 +529,13 @@ export class LayerManager extends GfxExtension {
|
|
|
493
529
|
}
|
|
494
530
|
else {
|
|
495
531
|
elements = this.layers.reduce((pre, current) => pre.concat(current.elements.filter(element => element.group == null)), []);
|
|
532
|
+
// Forward / backward / front / back move an element WITHIN its user
|
|
533
|
+
// layer (ADR 0031 §4): its neighbours are that layer's members only.
|
|
534
|
+
const userLayers = this._surface?.userLayers;
|
|
535
|
+
if (userLayers?.ranks) {
|
|
536
|
+
const own = userLayers.effectiveLayerOf(element);
|
|
537
|
+
elements = elements.filter(other => userLayers.effectiveLayerOf(other) === own);
|
|
538
|
+
}
|
|
496
539
|
}
|
|
497
540
|
const currentIdx = elements.indexOf(element);
|
|
498
541
|
switch (direction) {
|
|
@@ -553,6 +596,13 @@ export class LayerManager extends GfxExtension {
|
|
|
553
596
|
}
|
|
554
597
|
if (payload.type === 'update') {
|
|
555
598
|
const block = store.getModelById(payload.id);
|
|
599
|
+
// A block moved to another user layer (ADR 0031 §3) stacks
|
|
600
|
+
// elsewhere: re-sort it as if its `index` changed.
|
|
601
|
+
if (payload.props.key === 'layer' &&
|
|
602
|
+
block instanceof GfxBlockElementModel &&
|
|
603
|
+
this.blocks.includes(block)) {
|
|
604
|
+
this.update(block);
|
|
605
|
+
}
|
|
556
606
|
if ((payload.props.key === 'index' ||
|
|
557
607
|
payload.props.key === 'childElementIds') &&
|
|
558
608
|
block instanceof GfxBlockElementModel &&
|
|
@@ -599,6 +649,24 @@ export class LayerManager extends GfxExtension {
|
|
|
599
649
|
if (payload.props['index'] || payload.props['childIds']) {
|
|
600
650
|
this.update(surface.getElementById(payload.id), payload.props);
|
|
601
651
|
}
|
|
652
|
+
else if ('layer' in payload.props || 'layer' in payload.oldValues) {
|
|
653
|
+
// Moved to another user layer (ADR 0031 §3), set or cleared:
|
|
654
|
+
// re-sort as an `index` change would (a group re-sorts whole).
|
|
655
|
+
const element = surface.getElementById(payload.id);
|
|
656
|
+
if (element)
|
|
657
|
+
this.update(element);
|
|
658
|
+
}
|
|
659
|
+
}));
|
|
660
|
+
// The layer list changed — created, reordered, removed (ADR 0031 §2):
|
|
661
|
+
// every rank may have moved, so the whole order is rebuilt.
|
|
662
|
+
this._disposable.add(surface.propsUpdated.subscribe(({ key }) => {
|
|
663
|
+
if (key !== 'layers')
|
|
664
|
+
return;
|
|
665
|
+
this._reset();
|
|
666
|
+
this.slots.layerUpdated.next({
|
|
667
|
+
type: 'update',
|
|
668
|
+
initiatingElement: surface,
|
|
669
|
+
});
|
|
602
670
|
}));
|
|
603
671
|
this._disposable.add(surface.elementRemoved.subscribe(payload => this.delete(payload.model)));
|
|
604
672
|
this._disposable.add(surface.localElementAdded.subscribe(elm => {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Store } from '../../store/index.js';
|
|
2
|
+
import { type ReadonlySignal } from '@preact/signals-core';
|
|
3
|
+
import type { GfxLocalElementModel } from './model/surface/local-element-model.js';
|
|
4
|
+
import type { GfxModel } from './model/model.js';
|
|
5
|
+
import type { SurfaceBlockModel } from './model/surface/surface-model.js';
|
|
6
|
+
/**
|
|
7
|
+
* The ids of the elements and gfx blocks hidden for everyone (ADR 0031 §7) —
|
|
8
|
+
* the SHARED half of the paint and pick predicate, kept as a set so the
|
|
9
|
+
* renderers ask one `has` per element and pay nothing when nobody hid
|
|
10
|
+
* anything.
|
|
11
|
+
*
|
|
12
|
+
* Built from the document once per surface, then kept current by the
|
|
13
|
+
* surface's element events and the store's block events, local or remote
|
|
14
|
+
* alike: a peer's "hide for everyone" reaches this viewer the moment its
|
|
15
|
+
* update does. Registered by `GfxController` into its
|
|
16
|
+
* {@link GfxLocalVisibility}, beside the viewer's own local hide, so every
|
|
17
|
+
* site that already skips what this viewer hid skips this too — and
|
|
18
|
+
* `grid.search`, which reads neither, keeps counting both.
|
|
19
|
+
*/
|
|
20
|
+
export declare class GfxHiddenForEveryone {
|
|
21
|
+
private readonly _ids$;
|
|
22
|
+
private readonly _layerIds$;
|
|
23
|
+
private _unwatch;
|
|
24
|
+
/** Every id carrying the stored `hiddenForEveryone`. */
|
|
25
|
+
get ids$(): ReadonlySignal<ReadonlySet<string>>;
|
|
26
|
+
/**
|
|
27
|
+
* Every user layer hidden for everyone — `hidden: true` on its record (ADR
|
|
28
|
+
* 0031 §7): one write for a whole layer, never one per member.
|
|
29
|
+
*/
|
|
30
|
+
get layerIds$(): ReadonlySignal<ReadonlySet<string>>;
|
|
31
|
+
/** Follow `surface` and `store`; `null` stops following. */
|
|
32
|
+
watch(store: Store, surface: SurfaceBlockModel | null): void;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* What THIS viewer does not see on the canvas — the per-editor predicate hook
|
|
37
|
+
* of ADR 0031 §8.
|
|
38
|
+
*
|
|
39
|
+
* `std` knows nothing about why an element is hidden for one viewer; the
|
|
40
|
+
* affine layer (`CanvasLocalVisibility`) registers a signal of ids and owns
|
|
41
|
+
* their persistence. `GfxController` registers one more source, the ids
|
|
42
|
+
* hidden for everyone ({@link GfxHiddenForEveryone}): the shared half of the
|
|
43
|
+
* same predicate, so the sites below skip both with one question. Layers
|
|
44
|
+
* have their own sources (`registerLayers`), local and shared alike: a model
|
|
45
|
+
* whose EFFECTIVE layer is hidden is hidden. This class answers the one
|
|
46
|
+
* question the gfx plumbing asks — "does this viewer see that model?" — at the places a viewer's eye
|
|
47
|
+
* and hand reach the canvas: the renderers, the DOM block views, pointer
|
|
48
|
+
* picking and the marquee.
|
|
49
|
+
*
|
|
50
|
+
* It is deliberately NOT consulted by `GridManager.search`: that answer is
|
|
51
|
+
* shared with rules, legends and semantic exports, and one viewer's local
|
|
52
|
+
* hide must never change what another viewer's rules say about the same
|
|
53
|
+
* document.
|
|
54
|
+
*
|
|
55
|
+
* Reactive: `isHidden` reads a signal, so an effect or a `computed` that asks
|
|
56
|
+
* re-runs when the set changes (the DOM block views rely on it). With nothing
|
|
57
|
+
* registered, or nothing hidden, every answer is `false` after one size check.
|
|
58
|
+
*/
|
|
59
|
+
export declare class GfxLocalVisibility {
|
|
60
|
+
private readonly _sources$;
|
|
61
|
+
/** Every id hidden for this viewer, across every registered source. */
|
|
62
|
+
readonly hiddenIds$: ReadonlySignal<ReadonlySet<string>>;
|
|
63
|
+
private readonly _layerSources$;
|
|
64
|
+
/** Every user layer hidden for this viewer, across every layer source. */
|
|
65
|
+
readonly hiddenLayerIds$: ReadonlySignal<ReadonlySet<string>>;
|
|
66
|
+
/** Add a source of hidden ids. Returns its disposer. */
|
|
67
|
+
register(source: ReadonlySignal<ReadonlySet<string>>): () => void;
|
|
68
|
+
/** Add a source of hidden LAYER ids (ADR 0031, stage 7). Returns its disposer. */
|
|
69
|
+
registerLayers(source: ReadonlySignal<ReadonlySet<string>>): () => void;
|
|
70
|
+
/**
|
|
71
|
+
* Is `model` hidden for this viewer — itself, or through a group-like
|
|
72
|
+
* ELEMENT ancestor (a group, a mindmap)?
|
|
73
|
+
*
|
|
74
|
+
* Frames are not walked, although they are group-compatible: a frame is a
|
|
75
|
+
* slide, and hiding the frame hides the frame, not what it holds (ADR 0031
|
|
76
|
+
* §5). A model no surface holds has no ancestors to ask about.
|
|
77
|
+
*/
|
|
78
|
+
isHidden(model: GfxModel | GfxLocalElementModel): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether `model`'s EFFECTIVE layer is one of `layers` — the outermost
|
|
81
|
+
* group's layer, so a whole group hides with its layer. A hidden frame's
|
|
82
|
+
* layer hides the frame, not what it holds (ADR 0031 §5). Local elements
|
|
83
|
+
* belong to no layer. A surface with no `layers` record still has the
|
|
84
|
+
* default layer, shown and hideable before it is recorded (ADR 0031
|
|
85
|
+
* amendments): every model is then in it.
|
|
86
|
+
*/
|
|
87
|
+
private _inHiddenLayer;
|
|
88
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { computed, signal } from '@preact/signals-core';
|
|
2
|
+
import { GfxBlockElementModel } from './model/gfx-block-model.js';
|
|
3
|
+
import { GfxPrimitiveElementModel, isStoredHiddenForEveryone, } from './model/surface/element-model.js';
|
|
4
|
+
import { userLayersOf } from './model/surface/user-layers.js';
|
|
5
|
+
const NOTHING_HIDDEN = new Set();
|
|
6
|
+
/**
|
|
7
|
+
* The ids of the elements and gfx blocks hidden for everyone (ADR 0031 §7) —
|
|
8
|
+
* the SHARED half of the paint and pick predicate, kept as a set so the
|
|
9
|
+
* renderers ask one `has` per element and pay nothing when nobody hid
|
|
10
|
+
* anything.
|
|
11
|
+
*
|
|
12
|
+
* Built from the document once per surface, then kept current by the
|
|
13
|
+
* surface's element events and the store's block events, local or remote
|
|
14
|
+
* alike: a peer's "hide for everyone" reaches this viewer the moment its
|
|
15
|
+
* update does. Registered by `GfxController` into its
|
|
16
|
+
* {@link GfxLocalVisibility}, beside the viewer's own local hide, so every
|
|
17
|
+
* site that already skips what this viewer hid skips this too — and
|
|
18
|
+
* `grid.search`, which reads neither, keeps counting both.
|
|
19
|
+
*/
|
|
20
|
+
export class GfxHiddenForEveryone {
|
|
21
|
+
constructor() {
|
|
22
|
+
this._ids$ = signal(NOTHING_HIDDEN);
|
|
23
|
+
this._layerIds$ = signal(NOTHING_HIDDEN);
|
|
24
|
+
this._unwatch = null;
|
|
25
|
+
}
|
|
26
|
+
/** Every id carrying the stored `hiddenForEveryone`. */
|
|
27
|
+
get ids$() {
|
|
28
|
+
return this._ids$;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Every user layer hidden for everyone — `hidden: true` on its record (ADR
|
|
32
|
+
* 0031 §7): one write for a whole layer, never one per member.
|
|
33
|
+
*/
|
|
34
|
+
get layerIds$() {
|
|
35
|
+
return this._layerIds$;
|
|
36
|
+
}
|
|
37
|
+
/** Follow `surface` and `store`; `null` stops following. */
|
|
38
|
+
watch(store, surface) {
|
|
39
|
+
this.dispose();
|
|
40
|
+
if (!surface)
|
|
41
|
+
return;
|
|
42
|
+
const initial = new Set();
|
|
43
|
+
for (const element of surface.elementModels) {
|
|
44
|
+
if (isStoredHiddenForEveryone(element))
|
|
45
|
+
initial.add(element.id);
|
|
46
|
+
}
|
|
47
|
+
for (const model of store.getAllModels()) {
|
|
48
|
+
if (model instanceof GfxBlockElementModel &&
|
|
49
|
+
isStoredHiddenForEveryone(model)) {
|
|
50
|
+
initial.add(model.id);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
this._ids$.value = initial.size ? initial : NOTHING_HIDDEN;
|
|
54
|
+
const readLayers = () => {
|
|
55
|
+
const hidden = new Set();
|
|
56
|
+
for (const [id, record] of Object.entries(surface.props.layers ?? {})) {
|
|
57
|
+
if (record?.hidden === true)
|
|
58
|
+
hidden.add(id);
|
|
59
|
+
}
|
|
60
|
+
const current = this._layerIds$.peek();
|
|
61
|
+
if (hidden.size === current.size &&
|
|
62
|
+
[...hidden].every(id => current.has(id))) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this._layerIds$.value = hidden.size ? hidden : NOTHING_HIDDEN;
|
|
66
|
+
};
|
|
67
|
+
readLayers();
|
|
68
|
+
const recheck = (id, model) => {
|
|
69
|
+
const hidden = model !== null && isStoredHiddenForEveryone(model);
|
|
70
|
+
const current = this._ids$.peek();
|
|
71
|
+
if (current.has(id) === hidden)
|
|
72
|
+
return;
|
|
73
|
+
const next = new Set(current);
|
|
74
|
+
if (hidden)
|
|
75
|
+
next.add(id);
|
|
76
|
+
else
|
|
77
|
+
next.delete(id);
|
|
78
|
+
this._ids$.value = next.size ? next : NOTHING_HIDDEN;
|
|
79
|
+
};
|
|
80
|
+
const subscriptions = [
|
|
81
|
+
surface.propsUpdated.subscribe(({ key }) => {
|
|
82
|
+
if (key === 'layers')
|
|
83
|
+
readLayers();
|
|
84
|
+
}),
|
|
85
|
+
surface.elementAdded.subscribe(({ id }) => recheck(id, surface.getElementById(id))),
|
|
86
|
+
surface.elementUpdated.subscribe(({ id }) => recheck(id, surface.getElementById(id))),
|
|
87
|
+
surface.elementRemoved.subscribe(({ id }) => recheck(id, null)),
|
|
88
|
+
store.slots.blockUpdated.subscribe(payload => {
|
|
89
|
+
if (payload.type === 'delete') {
|
|
90
|
+
recheck(payload.id, null);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (payload.type === 'update' &&
|
|
94
|
+
payload.props.key !== 'hiddenForEveryone') {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
recheck(payload.id, store.getBlock(payload.id)?.model ?? null);
|
|
98
|
+
}),
|
|
99
|
+
];
|
|
100
|
+
this._unwatch = () => subscriptions.forEach(sub => sub.unsubscribe());
|
|
101
|
+
}
|
|
102
|
+
dispose() {
|
|
103
|
+
this._unwatch?.();
|
|
104
|
+
this._unwatch = null;
|
|
105
|
+
this._ids$.value = NOTHING_HIDDEN;
|
|
106
|
+
this._layerIds$.value = NOTHING_HIDDEN;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* What THIS viewer does not see on the canvas — the per-editor predicate hook
|
|
111
|
+
* of ADR 0031 §8.
|
|
112
|
+
*
|
|
113
|
+
* `std` knows nothing about why an element is hidden for one viewer; the
|
|
114
|
+
* affine layer (`CanvasLocalVisibility`) registers a signal of ids and owns
|
|
115
|
+
* their persistence. `GfxController` registers one more source, the ids
|
|
116
|
+
* hidden for everyone ({@link GfxHiddenForEveryone}): the shared half of the
|
|
117
|
+
* same predicate, so the sites below skip both with one question. Layers
|
|
118
|
+
* have their own sources (`registerLayers`), local and shared alike: a model
|
|
119
|
+
* whose EFFECTIVE layer is hidden is hidden. This class answers the one
|
|
120
|
+
* question the gfx plumbing asks — "does this viewer see that model?" — at the places a viewer's eye
|
|
121
|
+
* and hand reach the canvas: the renderers, the DOM block views, pointer
|
|
122
|
+
* picking and the marquee.
|
|
123
|
+
*
|
|
124
|
+
* It is deliberately NOT consulted by `GridManager.search`: that answer is
|
|
125
|
+
* shared with rules, legends and semantic exports, and one viewer's local
|
|
126
|
+
* hide must never change what another viewer's rules say about the same
|
|
127
|
+
* document.
|
|
128
|
+
*
|
|
129
|
+
* Reactive: `isHidden` reads a signal, so an effect or a `computed` that asks
|
|
130
|
+
* re-runs when the set changes (the DOM block views rely on it). With nothing
|
|
131
|
+
* registered, or nothing hidden, every answer is `false` after one size check.
|
|
132
|
+
*/
|
|
133
|
+
export class GfxLocalVisibility {
|
|
134
|
+
constructor() {
|
|
135
|
+
this._sources$ = signal([]);
|
|
136
|
+
/** Every id hidden for this viewer, across every registered source. */
|
|
137
|
+
this.hiddenIds$ = computed(() => unionOf(this._sources$.value));
|
|
138
|
+
this._layerSources$ = signal([]);
|
|
139
|
+
/** Every user layer hidden for this viewer, across every layer source. */
|
|
140
|
+
this.hiddenLayerIds$ = computed(() => unionOf(this._layerSources$.value));
|
|
141
|
+
}
|
|
142
|
+
/** Add a source of hidden ids. Returns its disposer. */
|
|
143
|
+
register(source) {
|
|
144
|
+
this._sources$.value = [...this._sources$.peek(), source];
|
|
145
|
+
return () => {
|
|
146
|
+
this._sources$.value = this._sources$
|
|
147
|
+
.peek()
|
|
148
|
+
.filter(existing => existing !== source);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/** Add a source of hidden LAYER ids (ADR 0031, stage 7). Returns its disposer. */
|
|
152
|
+
registerLayers(source) {
|
|
153
|
+
this._layerSources$.value = [...this._layerSources$.peek(), source];
|
|
154
|
+
return () => {
|
|
155
|
+
this._layerSources$.value = this._layerSources$
|
|
156
|
+
.peek()
|
|
157
|
+
.filter(existing => existing !== source);
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Is `model` hidden for this viewer — itself, or through a group-like
|
|
162
|
+
* ELEMENT ancestor (a group, a mindmap)?
|
|
163
|
+
*
|
|
164
|
+
* Frames are not walked, although they are group-compatible: a frame is a
|
|
165
|
+
* slide, and hiding the frame hides the frame, not what it holds (ADR 0031
|
|
166
|
+
* §5). A model no surface holds has no ancestors to ask about.
|
|
167
|
+
*/
|
|
168
|
+
isHidden(model) {
|
|
169
|
+
const hiddenLayers = this.hiddenLayerIds$.value;
|
|
170
|
+
if (hiddenLayers.size > 0 && this._inHiddenLayer(model, hiddenLayers)) {
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
const hidden = this.hiddenIds$.value;
|
|
174
|
+
if (hidden.size === 0)
|
|
175
|
+
return false;
|
|
176
|
+
if (hidden.has(model.id))
|
|
177
|
+
return true;
|
|
178
|
+
let ancestors;
|
|
179
|
+
try {
|
|
180
|
+
ancestors = model.groups ?? [];
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
return ancestors.some(ancestor => ancestor instanceof GfxPrimitiveElementModel && hidden.has(ancestor.id));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Whether `model`'s EFFECTIVE layer is one of `layers` — the outermost
|
|
189
|
+
* group's layer, so a whole group hides with its layer. A hidden frame's
|
|
190
|
+
* layer hides the frame, not what it holds (ADR 0031 §5). Local elements
|
|
191
|
+
* belong to no layer. A surface with no `layers` record still has the
|
|
192
|
+
* default layer, shown and hideable before it is recorded (ADR 0031
|
|
193
|
+
* amendments): every model is then in it.
|
|
194
|
+
*/
|
|
195
|
+
_inHiddenLayer(model, layers) {
|
|
196
|
+
const userLayers = userLayersOf(model);
|
|
197
|
+
if (!userLayers)
|
|
198
|
+
return false;
|
|
199
|
+
if (!(model instanceof GfxPrimitiveElementModel) &&
|
|
200
|
+
!(model instanceof GfxBlockElementModel)) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
return layers.has(userLayers.effectiveLayerOf(model));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function unionOf(sources) {
|
|
207
|
+
if (sources.length === 0)
|
|
208
|
+
return NOTHING_HIDDEN;
|
|
209
|
+
if (sources.length === 1)
|
|
210
|
+
return sources[0].value;
|
|
211
|
+
const union = new Set();
|
|
212
|
+
for (const source of sources) {
|
|
213
|
+
for (const id of source.value)
|
|
214
|
+
union.add(id);
|
|
215
|
+
}
|
|
216
|
+
return union;
|
|
217
|
+
}
|
|
@@ -13,6 +13,19 @@ export type GfxCompatibleProps = {
|
|
|
13
13
|
xywh: SerializedXYWH;
|
|
14
14
|
index: string;
|
|
15
15
|
lockedBySelf?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* "Hide for everyone" (ADR 0031 §7). `true` or absent, never `false`:
|
|
18
|
+
* unhiding deletes the `prop:` key through the props proxy, so the block
|
|
19
|
+
* goes back to byte-identical. Every gfx block schema declares it with an
|
|
20
|
+
* `undefined` default, the way it declares `lockedBySelf`.
|
|
21
|
+
*/
|
|
22
|
+
hiddenForEveryone?: true;
|
|
23
|
+
/**
|
|
24
|
+
* The user layer this block belongs to (ADR 0031 §3); `undefined` = the
|
|
25
|
+
* default layer. Declared by every gfx block schema with an `undefined`
|
|
26
|
+
* default, like `hiddenForEveryone`.
|
|
27
|
+
*/
|
|
28
|
+
layer?: string;
|
|
16
29
|
};
|
|
17
30
|
/**
|
|
18
31
|
* This type include the common props for the graphic block model.
|