@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BulletedListIcon, CheckBoxIcon, CodeBlockIcon, DividerIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, Heading5Icon, Heading6Icon, NumberedListIcon, QuoteIcon, TextIcon, } from '../affine-components/icons/index.js';
|
|
2
2
|
import { BLOCK_TYPE_BULLETED_LIST, BLOCK_TYPE_BULLETED_LIST_DESCRIPTION, BLOCK_TYPE_CODE_BLOCK, BLOCK_TYPE_CODE_BLOCK_DESCRIPTION, BLOCK_TYPE_DIVIDER, BLOCK_TYPE_DIVIDER_DESCRIPTION, BLOCK_TYPE_HEADING_1, BLOCK_TYPE_HEADING_1_DESCRIPTION, BLOCK_TYPE_HEADING_2, BLOCK_TYPE_HEADING_2_DESCRIPTION, BLOCK_TYPE_HEADING_3, BLOCK_TYPE_HEADING_3_DESCRIPTION, BLOCK_TYPE_HEADING_4, BLOCK_TYPE_HEADING_4_DESCRIPTION, BLOCK_TYPE_HEADING_5, BLOCK_TYPE_HEADING_5_DESCRIPTION, BLOCK_TYPE_HEADING_6, BLOCK_TYPE_HEADING_6_DESCRIPTION, BLOCK_TYPE_NUMBERED_LIST, BLOCK_TYPE_NUMBERED_LIST_DESCRIPTION, BLOCK_TYPE_QUOTE, BLOCK_TYPE_QUOTE_DESCRIPTION, BLOCK_TYPE_TEXT, BLOCK_TYPE_TEXT_DESCRIPTION, BLOCK_TYPE_TODO_LIST, BLOCK_TYPE_TODO_LIST_DESCRIPTION, } from '../affine-shared/services/index.js';
|
|
3
|
+
import { createIdentifier } from '../global/di/index.js';
|
|
3
4
|
export const textConversionConfigs = [
|
|
4
5
|
{
|
|
5
6
|
flavour: 'affine:paragraph',
|
|
@@ -132,3 +133,11 @@ export const textConversionConfigs = [
|
|
|
132
133
|
descriptionWording: BLOCK_TYPE_DIVIDER_DESCRIPTION,
|
|
133
134
|
},
|
|
134
135
|
];
|
|
136
|
+
export const TextConversionEntryIdentifier = createIdentifier('AffineTextConversionEntry');
|
|
137
|
+
export function TextConversionEntryExtension(entry) {
|
|
138
|
+
return {
|
|
139
|
+
setup: di => {
|
|
140
|
+
di.addImpl(TextConversionEntryIdentifier(entry.flavour), entry);
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type TextConversionConfig, textConversionConfigs } from './conversion.js';
|
|
1
|
+
export { type TextConversionConfig, textConversionConfigs, type TextConversionEntry, TextConversionEntryExtension, TextConversionEntryIdentifier, } from './conversion.js';
|
|
2
2
|
export { asyncGetRichText, asyncSetInlineRange, cleanSpecifiedTail, focusTextModel, getInlineEditorByModel, getRichTextByModel, getTextContentFromInlineRange, onModelTextUpdated, selectTextModel, } from './dom.js';
|
|
3
3
|
export { RichText } from './rich-text.js';
|
|
4
4
|
export * from './utils.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { textConversionConfigs } from './conversion.js';
|
|
1
|
+
export { textConversionConfigs, TextConversionEntryExtension, TextConversionEntryIdentifier, } from './conversion.js';
|
|
2
2
|
export { asyncGetRichText, asyncSetInlineRange, cleanSpecifiedTail, focusTextModel, getInlineEditorByModel, getRichTextByModel, getTextContentFromInlineRange, onModelTextUpdated, selectTextModel, } from './dom.js';
|
|
3
3
|
export { RichText } from './rich-text.js';
|
|
4
4
|
export * from './utils.js';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { LifeCycleWatcher } from '../../std/index.js';
|
|
2
|
+
import { type SurfaceBlockModel } from '../../std/gfx/index.js';
|
|
3
|
+
import { type ReadonlySignal } from '@preact/signals-core';
|
|
4
|
+
/** Who decided the grid this viewer sees (ADR 0031 §11). */
|
|
5
|
+
export type CanvasGridSource = 'local' | 'document' | 'host' | 'library';
|
|
6
|
+
/**
|
|
7
|
+
* The four levels of ADR 0031 §11, nearest decision first: the viewer's own
|
|
8
|
+
* override, the document's "saved for everyone" setting, the host's default
|
|
9
|
+
* (`edgelessShowGrid`), and the library default — on. `undefined` at a level
|
|
10
|
+
* means "nobody decided here".
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveCanvasGrid(levels: {
|
|
13
|
+
local?: boolean;
|
|
14
|
+
document?: boolean;
|
|
15
|
+
host?: boolean;
|
|
16
|
+
}): {
|
|
17
|
+
visible: boolean;
|
|
18
|
+
source: CanvasGridSource;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* What a surface stored for everyone, read reactively. Previews (the
|
|
22
|
+
* read-only edgeless preview, a surface-ref) follow THIS and the library
|
|
23
|
+
* default only: they are a picture of the document, not a viewer's session,
|
|
24
|
+
* so neither a viewer override nor a host default reaches them.
|
|
25
|
+
*/
|
|
26
|
+
export declare function documentShowsGrid(surface: SurfaceBlockModel | null | undefined): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The canvas grid as THIS viewer sees it (ADR 0031 §11).
|
|
29
|
+
*
|
|
30
|
+
* - **The toggle is local**: it writes the viewer's override, an
|
|
31
|
+
* `EditPropsStore` `localStorage` prop keyed by document id like the
|
|
32
|
+
* viewport, so it survives a reload and produces no Yjs update — a reader
|
|
33
|
+
* may toggle it too.
|
|
34
|
+
* - **"Save for everyone"** writes the current state into the surface's
|
|
35
|
+
* `showGrid` and clears the saver's override, so they see what everyone
|
|
36
|
+
* sees. Refused on a read-only store; writes nothing when the document
|
|
37
|
+
* already says the same.
|
|
38
|
+
*
|
|
39
|
+
* Both containers that paint the grid (the edgeless root's background and
|
|
40
|
+
* the surface container) and the PNG export read `visible$`.
|
|
41
|
+
*/
|
|
42
|
+
export declare class CanvasGrid extends LifeCycleWatcher {
|
|
43
|
+
static key: string;
|
|
44
|
+
private readonly _local$;
|
|
45
|
+
private readonly _resolved$;
|
|
46
|
+
/** Whether this viewer sees the grid. */
|
|
47
|
+
readonly visible$: ReadonlySignal<boolean>;
|
|
48
|
+
/** Which level decided `visible$`. */
|
|
49
|
+
readonly source$: ReadonlySignal<CanvasGridSource>;
|
|
50
|
+
private _surface;
|
|
51
|
+
/**
|
|
52
|
+
* Flip the grid for this viewer only. Answers the new visibility.
|
|
53
|
+
*/
|
|
54
|
+
toggle(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Store what this viewer sees as the document's setting, and drop their
|
|
57
|
+
* override. Answers the saved value, or `null` when nothing was written
|
|
58
|
+
* (read-only store, no surface, or the document already said so).
|
|
59
|
+
*/
|
|
60
|
+
saveForEveryone(): boolean | null;
|
|
61
|
+
private _clearLocal;
|
|
62
|
+
mounted(): void;
|
|
63
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { LifeCycleWatcher } from '../../std/index.js';
|
|
2
|
+
import { GfxControllerIdentifier, } from '../../std/gfx/index.js';
|
|
3
|
+
import { computed, signal } from '@preact/signals-core';
|
|
4
|
+
import { EditPropsStore } from './edit-props-store.js';
|
|
5
|
+
import { EditorSettingProvider } from './editor-setting-service.js';
|
|
6
|
+
/**
|
|
7
|
+
* The four levels of ADR 0031 §11, nearest decision first: the viewer's own
|
|
8
|
+
* override, the document's "saved for everyone" setting, the host's default
|
|
9
|
+
* (`edgelessShowGrid`), and the library default — on. `undefined` at a level
|
|
10
|
+
* means "nobody decided here".
|
|
11
|
+
*/
|
|
12
|
+
export function resolveCanvasGrid(levels) {
|
|
13
|
+
if (levels.local !== undefined) {
|
|
14
|
+
return { visible: levels.local, source: 'local' };
|
|
15
|
+
}
|
|
16
|
+
if (levels.document !== undefined) {
|
|
17
|
+
return { visible: levels.document, source: 'document' };
|
|
18
|
+
}
|
|
19
|
+
if (levels.host !== undefined) {
|
|
20
|
+
return { visible: levels.host, source: 'host' };
|
|
21
|
+
}
|
|
22
|
+
return { visible: true, source: 'library' };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* What a surface stored for everyone, read reactively. Previews (the
|
|
26
|
+
* read-only edgeless preview, a surface-ref) follow THIS and the library
|
|
27
|
+
* default only: they are a picture of the document, not a viewer's session,
|
|
28
|
+
* so neither a viewer override nor a host default reaches them.
|
|
29
|
+
*/
|
|
30
|
+
export function documentShowsGrid(surface) {
|
|
31
|
+
return surface?.props.showGrid$.value !== false;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The canvas grid as THIS viewer sees it (ADR 0031 §11).
|
|
35
|
+
*
|
|
36
|
+
* - **The toggle is local**: it writes the viewer's override, an
|
|
37
|
+
* `EditPropsStore` `localStorage` prop keyed by document id like the
|
|
38
|
+
* viewport, so it survives a reload and produces no Yjs update — a reader
|
|
39
|
+
* may toggle it too.
|
|
40
|
+
* - **"Save for everyone"** writes the current state into the surface's
|
|
41
|
+
* `showGrid` and clears the saver's override, so they see what everyone
|
|
42
|
+
* sees. Refused on a read-only store; writes nothing when the document
|
|
43
|
+
* already says the same.
|
|
44
|
+
*
|
|
45
|
+
* Both containers that paint the grid (the edgeless root's background and
|
|
46
|
+
* the surface container) and the PNG export read `visible$`.
|
|
47
|
+
*/
|
|
48
|
+
export class CanvasGrid extends LifeCycleWatcher {
|
|
49
|
+
constructor() {
|
|
50
|
+
super(...arguments);
|
|
51
|
+
this._local$ = signal(undefined);
|
|
52
|
+
this._resolved$ = computed(() => resolveCanvasGrid({
|
|
53
|
+
local: this._local$.value,
|
|
54
|
+
document: this._surface()?.props.showGrid$.value,
|
|
55
|
+
host: this.std.getOptional(EditorSettingProvider)?.setting$.value
|
|
56
|
+
.edgelessShowGrid,
|
|
57
|
+
}));
|
|
58
|
+
/** Whether this viewer sees the grid. */
|
|
59
|
+
this.visible$ = computed(() => this._resolved$.value.visible);
|
|
60
|
+
/** Which level decided `visible$`. */
|
|
61
|
+
this.source$ = computed(() => this._resolved$.value.source);
|
|
62
|
+
}
|
|
63
|
+
static { this.key = 'canvas-grid'; }
|
|
64
|
+
_surface() {
|
|
65
|
+
return this.std.get(GfxControllerIdentifier).surface$.value;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Flip the grid for this viewer only. Answers the new visibility.
|
|
69
|
+
*/
|
|
70
|
+
toggle() {
|
|
71
|
+
const visible = !this.visible$.peek();
|
|
72
|
+
this._local$.value = visible;
|
|
73
|
+
this.std.getOptional(EditPropsStore)?.setStorage('localShowGrid', visible);
|
|
74
|
+
return visible;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Store what this viewer sees as the document's setting, and drop their
|
|
78
|
+
* override. Answers the saved value, or `null` when nothing was written
|
|
79
|
+
* (read-only store, no surface, or the document already said so).
|
|
80
|
+
*/
|
|
81
|
+
saveForEveryone() {
|
|
82
|
+
const surface = this._surface();
|
|
83
|
+
if (!surface || this.std.store.readonly)
|
|
84
|
+
return null;
|
|
85
|
+
const visible = this.visible$.peek();
|
|
86
|
+
this._clearLocal();
|
|
87
|
+
if (surface.props.showGrid === visible)
|
|
88
|
+
return null;
|
|
89
|
+
this.std.store.captureSync();
|
|
90
|
+
this.std.store.transact(() => {
|
|
91
|
+
surface.props.showGrid = visible;
|
|
92
|
+
});
|
|
93
|
+
this.std.store.captureSync();
|
|
94
|
+
return visible;
|
|
95
|
+
}
|
|
96
|
+
_clearLocal() {
|
|
97
|
+
if (this._local$.peek() === undefined)
|
|
98
|
+
return;
|
|
99
|
+
this._local$.value = undefined;
|
|
100
|
+
this.std.getOptional(EditPropsStore)?.removeStorage('localShowGrid');
|
|
101
|
+
}
|
|
102
|
+
mounted() {
|
|
103
|
+
super.mounted();
|
|
104
|
+
const stored = this.std
|
|
105
|
+
.getOptional(EditPropsStore)
|
|
106
|
+
?.getStorage('localShowGrid');
|
|
107
|
+
this._local$.value = stored ?? undefined;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { LifeCycleWatcher } from '../../std/index.js';
|
|
2
|
+
import { type ReadonlySignal } from '@preact/signals-core';
|
|
3
|
+
/**
|
|
4
|
+
* Hide is LOCAL by default (ADR 0031 §1, §8): what this viewer hid on this
|
|
5
|
+
* document's canvas, and nothing anybody else can see.
|
|
6
|
+
*
|
|
7
|
+
* - **Never written to the document.** The ids live in a signal and persist
|
|
8
|
+
* through `EditPropsStore`'s `localHiddenElements`, a `localStorage` prop
|
|
9
|
+
* keyed by document id exactly like the viewport — so a reload keeps them
|
|
10
|
+
* (open point 7, resolved at acceptance) and no Yjs update is ever produced.
|
|
11
|
+
* - **Pruned on load**: ids the document no longer has are dropped the first
|
|
12
|
+
* time the surface is there to ask, so the list does not grow forever.
|
|
13
|
+
* - **Not `display`**: the canvas text editor owns that flag and closing it on
|
|
14
|
+
* a locally hidden text would unhide it.
|
|
15
|
+
*
|
|
16
|
+
* The signal is registered into `gfx.localVisibility`, the per-editor hook the
|
|
17
|
+
* renderers, the DOM block views, pointer picking and the marquee read. It is
|
|
18
|
+
* never read by `grid.search`: rules, legends and semantic exports count a
|
|
19
|
+
* hidden element, because hiding is not deleting.
|
|
20
|
+
*
|
|
21
|
+
* Not gated by `store.readonly`: hiding is a way of LOOKING at a document, so
|
|
22
|
+
* a reader may do it — nothing they do here reaches the document.
|
|
23
|
+
*
|
|
24
|
+
* Whole user layers hide the same way (stage 7): a second set of ids, kept
|
|
25
|
+
* and persisted beside the first (`localHiddenLayers`), registered with
|
|
26
|
+
* `gfx.localVisibility.registerLayers` — every model whose effective layer
|
|
27
|
+
* is in it is hidden for this viewer.
|
|
28
|
+
*/
|
|
29
|
+
export declare class CanvasLocalVisibility extends LifeCycleWatcher {
|
|
30
|
+
static key: string;
|
|
31
|
+
private readonly _hiddenIds$;
|
|
32
|
+
private readonly _hiddenLayerIds$;
|
|
33
|
+
private _disposers;
|
|
34
|
+
/** The ids this viewer hid. */
|
|
35
|
+
get hiddenIds$(): ReadonlySignal<ReadonlySet<string>>;
|
|
36
|
+
/** The user layers this viewer hid. */
|
|
37
|
+
get hiddenLayerIds$(): ReadonlySignal<ReadonlySet<string>>;
|
|
38
|
+
isHidden(id: string): boolean;
|
|
39
|
+
/** Hide whole user layers for this viewer. Answers how many changed. */
|
|
40
|
+
hideLayers(ids: Iterable<string>): number;
|
|
41
|
+
/** Show user layers again. Answers how many were hidden. */
|
|
42
|
+
showLayers(ids: Iterable<string>): number;
|
|
43
|
+
/** Hide `ids`. Answers how many were not hidden yet. */
|
|
44
|
+
hide(ids: Iterable<string>): number;
|
|
45
|
+
/** Show `ids` again. Answers how many were hidden. */
|
|
46
|
+
show(ids: Iterable<string>): number;
|
|
47
|
+
/**
|
|
48
|
+
* Show every element this viewer hid. Answers how many were hidden.
|
|
49
|
+
* Hidden layers are {@link showAllLayers}'s, so each count reports one
|
|
50
|
+
* target.
|
|
51
|
+
*/
|
|
52
|
+
showAll(): number;
|
|
53
|
+
/** Show every layer this viewer hid. Answers how many were hidden. */
|
|
54
|
+
showAllLayers(): number;
|
|
55
|
+
private _commitLayers;
|
|
56
|
+
private _commit;
|
|
57
|
+
mounted(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Restore the hidden layers, pruned of layers the surface no longer has —
|
|
60
|
+
* the first time the surface is there to ask.
|
|
61
|
+
*/
|
|
62
|
+
private _restoreLayers;
|
|
63
|
+
unmounted(): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { LifeCycleWatcher } from '../../std/index.js';
|
|
2
|
+
import { DEFAULT_LAYER_ID, GfxControllerIdentifier } from '../../std/gfx/index.js';
|
|
3
|
+
import { effect, signal } from '@preact/signals-core';
|
|
4
|
+
import { EditPropsStore } from './edit-props-store.js';
|
|
5
|
+
/**
|
|
6
|
+
* Hide is LOCAL by default (ADR 0031 §1, §8): what this viewer hid on this
|
|
7
|
+
* document's canvas, and nothing anybody else can see.
|
|
8
|
+
*
|
|
9
|
+
* - **Never written to the document.** The ids live in a signal and persist
|
|
10
|
+
* through `EditPropsStore`'s `localHiddenElements`, a `localStorage` prop
|
|
11
|
+
* keyed by document id exactly like the viewport — so a reload keeps them
|
|
12
|
+
* (open point 7, resolved at acceptance) and no Yjs update is ever produced.
|
|
13
|
+
* - **Pruned on load**: ids the document no longer has are dropped the first
|
|
14
|
+
* time the surface is there to ask, so the list does not grow forever.
|
|
15
|
+
* - **Not `display`**: the canvas text editor owns that flag and closing it on
|
|
16
|
+
* a locally hidden text would unhide it.
|
|
17
|
+
*
|
|
18
|
+
* The signal is registered into `gfx.localVisibility`, the per-editor hook the
|
|
19
|
+
* renderers, the DOM block views, pointer picking and the marquee read. It is
|
|
20
|
+
* never read by `grid.search`: rules, legends and semantic exports count a
|
|
21
|
+
* hidden element, because hiding is not deleting.
|
|
22
|
+
*
|
|
23
|
+
* Not gated by `store.readonly`: hiding is a way of LOOKING at a document, so
|
|
24
|
+
* a reader may do it — nothing they do here reaches the document.
|
|
25
|
+
*
|
|
26
|
+
* Whole user layers hide the same way (stage 7): a second set of ids, kept
|
|
27
|
+
* and persisted beside the first (`localHiddenLayers`), registered with
|
|
28
|
+
* `gfx.localVisibility.registerLayers` — every model whose effective layer
|
|
29
|
+
* is in it is hidden for this viewer.
|
|
30
|
+
*/
|
|
31
|
+
export class CanvasLocalVisibility extends LifeCycleWatcher {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this._hiddenIds$ = signal(new Set());
|
|
35
|
+
this._hiddenLayerIds$ = signal(new Set());
|
|
36
|
+
this._disposers = [];
|
|
37
|
+
}
|
|
38
|
+
static { this.key = 'canvas-local-visibility'; }
|
|
39
|
+
/** The ids this viewer hid. */
|
|
40
|
+
get hiddenIds$() {
|
|
41
|
+
return this._hiddenIds$;
|
|
42
|
+
}
|
|
43
|
+
/** The user layers this viewer hid. */
|
|
44
|
+
get hiddenLayerIds$() {
|
|
45
|
+
return this._hiddenLayerIds$;
|
|
46
|
+
}
|
|
47
|
+
isHidden(id) {
|
|
48
|
+
return this._hiddenIds$.value.has(id);
|
|
49
|
+
}
|
|
50
|
+
/** Hide whole user layers for this viewer. Answers how many changed. */
|
|
51
|
+
hideLayers(ids) {
|
|
52
|
+
const next = new Set(this._hiddenLayerIds$.peek());
|
|
53
|
+
let changed = 0;
|
|
54
|
+
for (const id of ids) {
|
|
55
|
+
if (next.has(id))
|
|
56
|
+
continue;
|
|
57
|
+
next.add(id);
|
|
58
|
+
changed++;
|
|
59
|
+
}
|
|
60
|
+
if (changed)
|
|
61
|
+
this._commitLayers(next);
|
|
62
|
+
return changed;
|
|
63
|
+
}
|
|
64
|
+
/** Show user layers again. Answers how many were hidden. */
|
|
65
|
+
showLayers(ids) {
|
|
66
|
+
const next = new Set(this._hiddenLayerIds$.peek());
|
|
67
|
+
let changed = 0;
|
|
68
|
+
for (const id of ids) {
|
|
69
|
+
if (next.delete(id))
|
|
70
|
+
changed++;
|
|
71
|
+
}
|
|
72
|
+
if (changed)
|
|
73
|
+
this._commitLayers(next);
|
|
74
|
+
return changed;
|
|
75
|
+
}
|
|
76
|
+
/** Hide `ids`. Answers how many were not hidden yet. */
|
|
77
|
+
hide(ids) {
|
|
78
|
+
const next = new Set(this._hiddenIds$.peek());
|
|
79
|
+
let changed = 0;
|
|
80
|
+
for (const id of ids) {
|
|
81
|
+
if (next.has(id))
|
|
82
|
+
continue;
|
|
83
|
+
next.add(id);
|
|
84
|
+
changed++;
|
|
85
|
+
}
|
|
86
|
+
if (changed)
|
|
87
|
+
this._commit(next);
|
|
88
|
+
return changed;
|
|
89
|
+
}
|
|
90
|
+
/** Show `ids` again. Answers how many were hidden. */
|
|
91
|
+
show(ids) {
|
|
92
|
+
const next = new Set(this._hiddenIds$.peek());
|
|
93
|
+
let changed = 0;
|
|
94
|
+
for (const id of ids) {
|
|
95
|
+
if (next.delete(id))
|
|
96
|
+
changed++;
|
|
97
|
+
}
|
|
98
|
+
if (changed)
|
|
99
|
+
this._commit(next);
|
|
100
|
+
return changed;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Show every element this viewer hid. Answers how many were hidden.
|
|
104
|
+
* Hidden layers are {@link showAllLayers}'s, so each count reports one
|
|
105
|
+
* target.
|
|
106
|
+
*/
|
|
107
|
+
showAll() {
|
|
108
|
+
const count = this._hiddenIds$.peek().size;
|
|
109
|
+
if (count)
|
|
110
|
+
this._commit(new Set());
|
|
111
|
+
return count;
|
|
112
|
+
}
|
|
113
|
+
/** Show every layer this viewer hid. Answers how many were hidden. */
|
|
114
|
+
showAllLayers() {
|
|
115
|
+
const count = this._hiddenLayerIds$.peek().size;
|
|
116
|
+
if (count)
|
|
117
|
+
this._commitLayers(new Set());
|
|
118
|
+
return count;
|
|
119
|
+
}
|
|
120
|
+
_commitLayers(next) {
|
|
121
|
+
this._hiddenLayerIds$.value = next;
|
|
122
|
+
this.std
|
|
123
|
+
.getOptional(EditPropsStore)
|
|
124
|
+
?.setStorage('localHiddenLayers', [...next]);
|
|
125
|
+
}
|
|
126
|
+
_commit(next) {
|
|
127
|
+
this._hiddenIds$.value = next;
|
|
128
|
+
this.std
|
|
129
|
+
.getOptional(EditPropsStore)
|
|
130
|
+
?.setStorage('localHiddenElements', [...next]);
|
|
131
|
+
}
|
|
132
|
+
mounted() {
|
|
133
|
+
super.mounted();
|
|
134
|
+
const gfx = this.std.get(GfxControllerIdentifier);
|
|
135
|
+
this._disposers.push(gfx.localVisibility.register(this._hiddenIds$));
|
|
136
|
+
this._disposers.push(gfx.localVisibility.registerLayers(this._hiddenLayerIds$));
|
|
137
|
+
this._restoreLayers();
|
|
138
|
+
const stored = this.std.getOptional(EditPropsStore)?.getStorage('localHiddenElements') ??
|
|
139
|
+
[];
|
|
140
|
+
if (!stored.length)
|
|
141
|
+
return;
|
|
142
|
+
// The surface may arrive after mount; prune the first time it is there.
|
|
143
|
+
let pruned = false;
|
|
144
|
+
const stop = effect(() => {
|
|
145
|
+
if (pruned || !gfx.surface$.value)
|
|
146
|
+
return;
|
|
147
|
+
pruned = true;
|
|
148
|
+
const kept = stored.filter(id => gfx.getElementById(id) !== null);
|
|
149
|
+
if (kept.length === stored.length) {
|
|
150
|
+
this._hiddenIds$.value = new Set(kept);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
this._commit(new Set(kept));
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
this._disposers.push(stop);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Restore the hidden layers, pruned of layers the surface no longer has —
|
|
160
|
+
* the first time the surface is there to ask.
|
|
161
|
+
*/
|
|
162
|
+
_restoreLayers() {
|
|
163
|
+
const gfx = this.std.get(GfxControllerIdentifier);
|
|
164
|
+
const stored = this.std.getOptional(EditPropsStore)?.getStorage('localHiddenLayers') ??
|
|
165
|
+
[];
|
|
166
|
+
if (!stored.length)
|
|
167
|
+
return;
|
|
168
|
+
let pruned = false;
|
|
169
|
+
const stop = effect(() => {
|
|
170
|
+
const surface = gfx.surface$.value;
|
|
171
|
+
if (pruned || !surface)
|
|
172
|
+
return;
|
|
173
|
+
pruned = true;
|
|
174
|
+
const layers = surface.props.layers ?? {};
|
|
175
|
+
// The default layer exists with or without its record (ADR 0031
|
|
176
|
+
// amendments): a hide of it is never a layer the document lost.
|
|
177
|
+
const kept = stored.filter(id => id === DEFAULT_LAYER_ID || id in layers);
|
|
178
|
+
if (kept.length === stored.length) {
|
|
179
|
+
this._hiddenLayerIds$.value = new Set(kept);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
this._commitLayers(new Set(kept));
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
this._disposers.push(stop);
|
|
186
|
+
}
|
|
187
|
+
unmounted() {
|
|
188
|
+
this._disposers.forEach(dispose => dispose());
|
|
189
|
+
this._disposers = [];
|
|
190
|
+
super.unmounted();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -24,12 +24,12 @@ declare const LocalPropsSchema: z.ZodObject<{
|
|
|
24
24
|
centerY: z.ZodNumber;
|
|
25
25
|
zoom: z.ZodNumber;
|
|
26
26
|
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
centerX: number;
|
|
28
27
|
zoom: number;
|
|
28
|
+
centerX: number;
|
|
29
29
|
centerY: number;
|
|
30
30
|
}, {
|
|
31
|
-
centerX: number;
|
|
32
31
|
zoom: number;
|
|
32
|
+
centerX: number;
|
|
33
33
|
centerY: number;
|
|
34
34
|
}>, z.ZodObject<{
|
|
35
35
|
xywh: z.ZodString;
|
|
@@ -47,10 +47,29 @@ declare const LocalPropsSchema: z.ZodObject<{
|
|
|
47
47
|
presentNoFrameToastShown: z.ZodBoolean;
|
|
48
48
|
autoHideEmbedHTMLFullScreenToolbar: z.ZodBoolean;
|
|
49
49
|
connectorCenterAnchor: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
/**
|
|
51
|
+
* The ids this viewer hid on this document's canvas (ADR 0031 §8). Per
|
|
52
|
+
* viewer and per document, like the viewport; never written to the
|
|
53
|
+
* document. Owned by `CanvasLocalVisibility`.
|
|
54
|
+
*/
|
|
55
|
+
localHiddenElements: z.ZodArray<z.ZodString, "many">;
|
|
56
|
+
/**
|
|
57
|
+
* The user layers this viewer hid on this document's canvas (ADR 0031 §8,
|
|
58
|
+
* stage 7). Same owner, same key scheme, same lifetime as
|
|
59
|
+
* `localHiddenElements`; a separate key so the element list keeps the shape
|
|
60
|
+
* it already has in viewers' storage.
|
|
61
|
+
*/
|
|
62
|
+
localHiddenLayers: z.ZodArray<z.ZodString, "many">;
|
|
63
|
+
/**
|
|
64
|
+
* This viewer's grid override on this document's canvas (ADR 0031 §11),
|
|
65
|
+
* keyed like the viewport. Absent = the document, the host or the library
|
|
66
|
+
* decides. Owned by `CanvasGrid`.
|
|
67
|
+
*/
|
|
68
|
+
localShowGrid: z.ZodBoolean;
|
|
50
69
|
}, "strip", z.ZodTypeAny, {
|
|
51
70
|
viewport: {
|
|
52
|
-
centerX: number;
|
|
53
71
|
zoom: number;
|
|
72
|
+
centerX: number;
|
|
54
73
|
centerY: number;
|
|
55
74
|
} | {
|
|
56
75
|
xywh: string;
|
|
@@ -62,10 +81,13 @@ declare const LocalPropsSchema: z.ZodObject<{
|
|
|
62
81
|
presentNoFrameToastShown: boolean;
|
|
63
82
|
autoHideEmbedHTMLFullScreenToolbar: boolean;
|
|
64
83
|
connectorCenterAnchor: boolean;
|
|
84
|
+
localHiddenElements: string[];
|
|
85
|
+
localHiddenLayers: string[];
|
|
86
|
+
localShowGrid: boolean;
|
|
65
87
|
}, {
|
|
66
88
|
viewport: {
|
|
67
|
-
centerX: number;
|
|
68
89
|
zoom: number;
|
|
90
|
+
centerX: number;
|
|
69
91
|
centerY: number;
|
|
70
92
|
} | {
|
|
71
93
|
xywh: string;
|
|
@@ -76,6 +98,9 @@ declare const LocalPropsSchema: z.ZodObject<{
|
|
|
76
98
|
presentHideToolbar: boolean;
|
|
77
99
|
presentNoFrameToastShown: boolean;
|
|
78
100
|
autoHideEmbedHTMLFullScreenToolbar: boolean;
|
|
101
|
+
localHiddenElements: string[];
|
|
102
|
+
localHiddenLayers: string[];
|
|
103
|
+
localShowGrid: boolean;
|
|
79
104
|
connectorCenterAnchor?: boolean | undefined;
|
|
80
105
|
}>;
|
|
81
106
|
type SessionProps = z.infer<typeof SessionPropsSchema>;
|
|
@@ -416,6 +441,8 @@ export declare class EditPropsStore extends LifeCycleWatcher {
|
|
|
416
441
|
* session that turns read-only before unmounting stops writing too.
|
|
417
442
|
*/
|
|
418
443
|
saveViewport(viewport: StorageProps['viewport']): void;
|
|
444
|
+
/** Forget a stored prop, so the next `getStorage` answers `null`. */
|
|
445
|
+
removeStorage(key: StoragePropsKey): void;
|
|
419
446
|
setStorage<T extends StoragePropsKey>(key: T, value: StorageProps[T]): void;
|
|
420
447
|
unmounted(): void;
|
|
421
448
|
}
|
|
@@ -37,6 +37,25 @@ const LocalPropsSchema = z.object({
|
|
|
37
37
|
presentNoFrameToastShown: z.boolean(),
|
|
38
38
|
autoHideEmbedHTMLFullScreenToolbar: z.boolean(),
|
|
39
39
|
connectorCenterAnchor: z.boolean().default(false),
|
|
40
|
+
/**
|
|
41
|
+
* The ids this viewer hid on this document's canvas (ADR 0031 §8). Per
|
|
42
|
+
* viewer and per document, like the viewport; never written to the
|
|
43
|
+
* document. Owned by `CanvasLocalVisibility`.
|
|
44
|
+
*/
|
|
45
|
+
localHiddenElements: z.array(z.string()),
|
|
46
|
+
/**
|
|
47
|
+
* The user layers this viewer hid on this document's canvas (ADR 0031 §8,
|
|
48
|
+
* stage 7). Same owner, same key scheme, same lifetime as
|
|
49
|
+
* `localHiddenElements`; a separate key so the element list keeps the shape
|
|
50
|
+
* it already has in viewers' storage.
|
|
51
|
+
*/
|
|
52
|
+
localHiddenLayers: z.array(z.string()),
|
|
53
|
+
/**
|
|
54
|
+
* This viewer's grid override on this document's canvas (ADR 0031 §11),
|
|
55
|
+
* keyed like the viewport. Absent = the document, the host or the library
|
|
56
|
+
* decides. Owned by `CanvasGrid`.
|
|
57
|
+
*/
|
|
58
|
+
localShowGrid: z.boolean(),
|
|
40
59
|
});
|
|
41
60
|
function isLocalProp(key) {
|
|
42
61
|
return key in LocalPropsSchema.shape;
|
|
@@ -45,6 +64,11 @@ function isSessionProp(key) {
|
|
|
45
64
|
return key in SessionPropsSchema.shape;
|
|
46
65
|
}
|
|
47
66
|
function customizer(_target, source) {
|
|
67
|
+
// `mergeWith` assigns a primitive source as-is whatever the customizer says,
|
|
68
|
+
// so only an object can need one; skipping the schema parse for the rest is
|
|
69
|
+
// what keeps a paste of N elements from parsing every prop of every one.
|
|
70
|
+
if (source === null || typeof source !== 'object')
|
|
71
|
+
return;
|
|
48
72
|
if (ColorSchema.safeParse(source).success ||
|
|
49
73
|
source instanceof Y.Text ||
|
|
50
74
|
source instanceof Y.Array ||
|
|
@@ -107,6 +131,12 @@ export class EditPropsStore extends LifeCycleWatcher {
|
|
|
107
131
|
return 'blocksuite:embedHTML:autoHideFullScreenToolbar';
|
|
108
132
|
case 'connectorCenterAnchor':
|
|
109
133
|
return 'blocksuite:connector:centerAnchor';
|
|
134
|
+
case 'localHiddenElements':
|
|
135
|
+
return 'blocksuite:' + id + ':localHiddenElements';
|
|
136
|
+
case 'localHiddenLayers':
|
|
137
|
+
return 'blocksuite:' + id + ':localHiddenLayers';
|
|
138
|
+
case 'localShowGrid':
|
|
139
|
+
return 'blocksuite:' + id + ':localShowGrid';
|
|
110
140
|
default:
|
|
111
141
|
return key;
|
|
112
142
|
}
|
|
@@ -171,6 +201,10 @@ export class EditPropsStore extends LifeCycleWatcher {
|
|
|
171
201
|
return;
|
|
172
202
|
this.setStorage('viewport', viewport);
|
|
173
203
|
}
|
|
204
|
+
/** Forget a stored prop, so the next `getStorage` answers `null`. */
|
|
205
|
+
removeStorage(key) {
|
|
206
|
+
this._getStorage(key).removeItem(this._getStorageKey(key));
|
|
207
|
+
}
|
|
174
208
|
setStorage(key, value) {
|
|
175
209
|
const oldValue = this.getStorage(key);
|
|
176
210
|
this._getStorage(key).setItem(this._getStorageKey(key), JSON.stringify(value));
|
|
@@ -5,6 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
export declare const GeneralSettingSchema: z.ZodObject<{
|
|
6
6
|
edgelessScrollZoom: z.ZodDefault<z.ZodBoolean>;
|
|
7
7
|
edgelessDisableScheduleUpdate: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
edgelessShowGrid: z.ZodOptional<z.ZodBoolean>;
|
|
8
9
|
docCanvasPreferView: z.ZodDefault<z.ZodEnum<["affine:embed-linked-doc", "affine:embed-synced-doc"]>>;
|
|
9
10
|
} & {
|
|
10
11
|
connector: z.ZodDefault<z.ZodObject<{
|
|
@@ -1479,6 +1480,7 @@ export declare const GeneralSettingSchema: z.ZodObject<{
|
|
|
1479
1480
|
textHorizontalAlign?: import("../../affine-model/index.js").TextAlign | undefined;
|
|
1480
1481
|
textVerticalAlign?: import("../../affine-model/index.js").TextVerticalAlign | undefined;
|
|
1481
1482
|
};
|
|
1483
|
+
edgelessShowGrid?: boolean | undefined;
|
|
1482
1484
|
}, {
|
|
1483
1485
|
text?: {
|
|
1484
1486
|
color: string | {
|
|
@@ -1512,6 +1514,7 @@ export declare const GeneralSettingSchema: z.ZodObject<{
|
|
|
1512
1514
|
} | undefined;
|
|
1513
1515
|
edgelessScrollZoom?: boolean | undefined;
|
|
1514
1516
|
edgelessDisableScheduleUpdate?: boolean | undefined;
|
|
1517
|
+
edgelessShowGrid?: boolean | undefined;
|
|
1515
1518
|
docCanvasPreferView?: "affine:embed-linked-doc" | "affine:embed-synced-doc" | undefined;
|
|
1516
1519
|
connector?: {
|
|
1517
1520
|
mode: import("../../affine-model/index.js").ConnectorMode;
|
|
@@ -5,6 +5,13 @@ export const GeneralSettingSchema = z
|
|
|
5
5
|
.object({
|
|
6
6
|
edgelessScrollZoom: z.boolean().default(false),
|
|
7
7
|
edgelessDisableScheduleUpdate: z.boolean().default(false),
|
|
8
|
+
// The host's (or the user's) default for the canvas grid (ADR 0031 §11,
|
|
9
|
+
// level 3). No default on purpose: absent means the host did not decide,
|
|
10
|
+
// and the library default — on — applies. A viewer's own toggle and a
|
|
11
|
+
// document saved "for everyone" both win over it.
|
|
12
|
+
// A line comment, not JSDoc: see the guard in
|
|
13
|
+
// `affine/all/src/__tests__/zod-schema-jsdoc.unit.spec.ts`.
|
|
14
|
+
edgelessShowGrid: z.boolean().optional(),
|
|
8
15
|
docCanvasPreferView: z
|
|
9
16
|
.enum(['affine:embed-linked-doc', 'affine:embed-synced-doc'])
|
|
10
17
|
.default('affine:embed-synced-doc'),
|
|
@@ -14,6 +14,10 @@ export interface BlockSuiteFlags {
|
|
|
14
14
|
enable_mobile_keyboard_toolbar: boolean;
|
|
15
15
|
enable_mobile_linked_doc_menu: boolean;
|
|
16
16
|
enable_block_meta: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated No longer read: the Callout entries follow the `callout` key
|
|
19
|
+
* of `OPTIONAL_BLOCKS` alone, so `{ callout: false }` is the switch.
|
|
20
|
+
*/
|
|
17
21
|
enable_callout: boolean;
|
|
18
22
|
enable_edgeless_scribbled_style: boolean;
|
|
19
23
|
enable_table_virtual_scroll: boolean;
|