@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { AnyCommandDescriptor, BlockStdScope } from '../../../std/index.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* The user layers' commands (ADR 0031 §12), `owner: 'core'`, on the palette
|
|
5
|
+
* and the agent. The library's pane runs them through `runCommand`, and so
|
|
6
|
+
* does a host's: the read-only refusal and the undo step live in the
|
|
7
|
+
* actions, once.
|
|
8
|
+
*
|
|
9
|
+
* Each self-emits `CanvasLayerChanged` (see the telemetry README) when it
|
|
10
|
+
* wrote something — ids and counts only, never a layer name.
|
|
11
|
+
*/
|
|
12
|
+
export type CanvasLayerAction = 'create' | 'rename' | 'reorder' | 'delete' | 'move-elements';
|
|
13
|
+
export declare function reportLayerChange(std: BlockStdScope, action: CanvasLayerAction, memberCount?: number): void;
|
|
14
|
+
export declare const createLayerParams: z.ZodObject<{
|
|
15
|
+
/** Omitted: the seeded name, "Layer n". */
|
|
16
|
+
name: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
name?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
name?: string | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export type CreateLayerParams = z.infer<typeof createLayerParams>;
|
|
23
|
+
export declare const renameLayerParams: z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
name: string;
|
|
28
|
+
id: string;
|
|
29
|
+
}, {
|
|
30
|
+
name: string;
|
|
31
|
+
id: string;
|
|
32
|
+
}>;
|
|
33
|
+
export type RenameLayerParams = z.infer<typeof renameLayerParams>;
|
|
34
|
+
export declare const reorderLayerParams: z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
/** The layer it lands directly ABOVE; `null` puts it at the bottom. */
|
|
37
|
+
above: z.ZodNullable<z.ZodString>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
id: string;
|
|
40
|
+
above: string | null;
|
|
41
|
+
}, {
|
|
42
|
+
id: string;
|
|
43
|
+
above: string | null;
|
|
44
|
+
}>;
|
|
45
|
+
export type ReorderLayerParams = z.infer<typeof reorderLayerParams>;
|
|
46
|
+
export declare const moveElementsToLayerParams: z.ZodObject<{
|
|
47
|
+
/** Omitted: the current canvas selection. */
|
|
48
|
+
ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
49
|
+
layerId: z.ZodString;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
layerId: string;
|
|
52
|
+
ids?: string[] | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
layerId: string;
|
|
55
|
+
ids?: string[] | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
export type MoveElementsToLayerParams = z.infer<typeof moveElementsToLayerParams>;
|
|
58
|
+
export declare const deleteLayerParams: z.ZodObject<{
|
|
59
|
+
/** The layer to delete; `'@default'` is refused. */
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
id: string;
|
|
63
|
+
}, {
|
|
64
|
+
id: string;
|
|
65
|
+
}>;
|
|
66
|
+
export type DeleteLayerParams = z.infer<typeof deleteLayerParams>;
|
|
67
|
+
export declare const userLayerCommands: AnyCommandDescriptor[];
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { TelemetryProvider } from '../../../affine-shared/services/index.js';
|
|
2
|
+
import { DEFAULT_LAYER_ID, GfxControllerIdentifier } from '../../../std/gfx/index.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { createUserLayer, deleteUserLayer, moveModelsToUserLayer, renameUserLayer, reorderUserLayer, userLayersBottomUp, } from './actions.js';
|
|
5
|
+
export function reportLayerChange(std, action, memberCount) {
|
|
6
|
+
const layerCount = userLayersBottomUp(std.get(GfxControllerIdentifier).surface).length;
|
|
7
|
+
std.getOptional(TelemetryProvider)?.track('CanvasLayerChanged', {
|
|
8
|
+
page: 'whiteboard editor',
|
|
9
|
+
action,
|
|
10
|
+
layerCount,
|
|
11
|
+
...(memberCount === undefined ? {} : { memberCount }),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export const createLayerParams = z.object({
|
|
15
|
+
/** Omitted: the seeded name, "Layer n". */
|
|
16
|
+
name: z.string().optional(),
|
|
17
|
+
});
|
|
18
|
+
const createLayer = {
|
|
19
|
+
id: 'canvas.layer.create',
|
|
20
|
+
owner: 'core',
|
|
21
|
+
kind: 'action',
|
|
22
|
+
labelKey: 'com.labre.command.canvas.layer.create',
|
|
23
|
+
labelFallback: 'New layer',
|
|
24
|
+
descriptionKey: 'com.labre.command.canvas.layer.create.description',
|
|
25
|
+
descriptionFallback: 'Add a layer on top of the others. New elements go into it until you choose another.',
|
|
26
|
+
keywords: ['layer', 'calque'],
|
|
27
|
+
surfaces: ['palette', 'agent'],
|
|
28
|
+
scope: 'edgeless',
|
|
29
|
+
defaultKeys: { mac: [], other: [] },
|
|
30
|
+
availability: 'editable',
|
|
31
|
+
params: createLayerParams,
|
|
32
|
+
run: (std, _invocation, params) => {
|
|
33
|
+
const parsed = createLayerParams.safeParse(params ?? {});
|
|
34
|
+
if (!parsed.success)
|
|
35
|
+
return;
|
|
36
|
+
if (createUserLayer(std, parsed.data.name) === null)
|
|
37
|
+
return;
|
|
38
|
+
reportLayerChange(std, 'create');
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export const renameLayerParams = z.object({
|
|
42
|
+
id: z.string().min(1),
|
|
43
|
+
name: z.string(),
|
|
44
|
+
});
|
|
45
|
+
const renameLayer = {
|
|
46
|
+
id: 'canvas.layer.rename',
|
|
47
|
+
owner: 'core',
|
|
48
|
+
kind: 'action',
|
|
49
|
+
labelKey: 'com.labre.command.canvas.layer.rename',
|
|
50
|
+
labelFallback: 'Rename layer',
|
|
51
|
+
descriptionKey: 'com.labre.command.canvas.layer.rename.description',
|
|
52
|
+
descriptionFallback: 'Give a layer a new name.',
|
|
53
|
+
surfaces: ['agent'],
|
|
54
|
+
scope: 'edgeless',
|
|
55
|
+
defaultKeys: { mac: [], other: [] },
|
|
56
|
+
availability: 'editable',
|
|
57
|
+
params: renameLayerParams,
|
|
58
|
+
run: (std, _invocation, params) => {
|
|
59
|
+
const parsed = renameLayerParams.safeParse(params);
|
|
60
|
+
if (!parsed.success) {
|
|
61
|
+
console.error('canvas.layer.rename: invalid params', parsed.error);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (!renameUserLayer(std, parsed.data.id, parsed.data.name))
|
|
65
|
+
return;
|
|
66
|
+
reportLayerChange(std, 'rename');
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export const reorderLayerParams = z.object({
|
|
70
|
+
id: z.string().min(1),
|
|
71
|
+
/** The layer it lands directly ABOVE; `null` puts it at the bottom. */
|
|
72
|
+
above: z.string().min(1).nullable(),
|
|
73
|
+
});
|
|
74
|
+
const reorderLayer = {
|
|
75
|
+
id: 'canvas.layer.reorder',
|
|
76
|
+
owner: 'core',
|
|
77
|
+
kind: 'action',
|
|
78
|
+
labelKey: 'com.labre.command.canvas.layer.reorder',
|
|
79
|
+
labelFallback: 'Move layer',
|
|
80
|
+
descriptionKey: 'com.labre.command.canvas.layer.reorder.description',
|
|
81
|
+
descriptionFallback: 'Place a layer directly above another one: everything in it stacks there.',
|
|
82
|
+
surfaces: ['agent'],
|
|
83
|
+
scope: 'edgeless',
|
|
84
|
+
defaultKeys: { mac: [], other: [] },
|
|
85
|
+
availability: 'editable',
|
|
86
|
+
params: reorderLayerParams,
|
|
87
|
+
run: (std, _invocation, params) => {
|
|
88
|
+
const parsed = reorderLayerParams.safeParse(params);
|
|
89
|
+
if (!parsed.success) {
|
|
90
|
+
console.error('canvas.layer.reorder: invalid params', parsed.error);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (!reorderUserLayer(std, parsed.data.id, parsed.data.above))
|
|
94
|
+
return;
|
|
95
|
+
reportLayerChange(std, 'reorder');
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
export const moveElementsToLayerParams = z.object({
|
|
99
|
+
/** Omitted: the current canvas selection. */
|
|
100
|
+
ids: z.array(z.string()).optional(),
|
|
101
|
+
layerId: z.string().min(1),
|
|
102
|
+
});
|
|
103
|
+
const moveElementsToLayer = {
|
|
104
|
+
id: 'canvas.layer.moveElements',
|
|
105
|
+
owner: 'core',
|
|
106
|
+
kind: 'action',
|
|
107
|
+
labelKey: 'com.labre.command.canvas.layer.move-elements',
|
|
108
|
+
labelFallback: 'Move to layer',
|
|
109
|
+
descriptionKey: 'com.labre.command.canvas.layer.move-elements.description',
|
|
110
|
+
descriptionFallback: 'Move the selected elements to another layer. A grouped element moves with its group.',
|
|
111
|
+
surfaces: ['agent'],
|
|
112
|
+
scope: 'edgeless',
|
|
113
|
+
defaultKeys: { mac: [], other: [] },
|
|
114
|
+
availability: 'editable',
|
|
115
|
+
params: moveElementsToLayerParams,
|
|
116
|
+
run: (std, _invocation, params) => {
|
|
117
|
+
const parsed = moveElementsToLayerParams.safeParse(params);
|
|
118
|
+
if (!parsed.success) {
|
|
119
|
+
console.error('canvas.layer.moveElements: invalid params', parsed.error);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const ids = parsed.data.ids ?? std.get(GfxControllerIdentifier).selection.selectedIds;
|
|
123
|
+
const count = moveModelsToUserLayer(std, ids, parsed.data.layerId);
|
|
124
|
+
if (!count)
|
|
125
|
+
return;
|
|
126
|
+
reportLayerChange(std, 'move-elements', count);
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
export const deleteLayerParams = z.object({
|
|
130
|
+
/** The layer to delete; `'@default'` is refused. */
|
|
131
|
+
id: z.string().min(1),
|
|
132
|
+
});
|
|
133
|
+
/**
|
|
134
|
+
* Delete a layer and everything in it, in one undo step (ADR 0031 §10). The
|
|
135
|
+
* default layer cannot be deleted, which is what keeps a canvas at one layer
|
|
136
|
+
* at least (ADR 0031 amendments): with the default layer alone — recorded or
|
|
137
|
+
* not — there is nothing to delete, so `when` withdraws the command rather
|
|
138
|
+
* than letting it fail.
|
|
139
|
+
*/
|
|
140
|
+
const deleteLayer = {
|
|
141
|
+
id: 'canvas.layer.delete',
|
|
142
|
+
owner: 'core',
|
|
143
|
+
kind: 'action',
|
|
144
|
+
labelKey: 'com.labre.command.canvas.layer.delete',
|
|
145
|
+
labelFallback: 'Delete layer',
|
|
146
|
+
descriptionKey: 'com.labre.command.canvas.layer.delete.description',
|
|
147
|
+
descriptionFallback: 'Delete a layer and every element in it. One undo brings them all back.',
|
|
148
|
+
surfaces: ['agent'],
|
|
149
|
+
scope: 'edgeless',
|
|
150
|
+
defaultKeys: { mac: [], other: [] },
|
|
151
|
+
availability: 'editable',
|
|
152
|
+
when: std => userLayersBottomUp(std.get(GfxControllerIdentifier).surface).some(layer => layer.id !== DEFAULT_LAYER_ID),
|
|
153
|
+
params: deleteLayerParams,
|
|
154
|
+
run: (std, _invocation, params) => {
|
|
155
|
+
const parsed = deleteLayerParams.safeParse(params);
|
|
156
|
+
if (!parsed.success) {
|
|
157
|
+
console.error('canvas.layer.delete: invalid params', parsed.error);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const removed = deleteUserLayer(std, parsed.data.id);
|
|
161
|
+
if (removed === null)
|
|
162
|
+
return;
|
|
163
|
+
reportLayerChange(std, 'delete', removed);
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
export const userLayerCommands = [
|
|
167
|
+
createLayer,
|
|
168
|
+
renameLayer,
|
|
169
|
+
reorderLayer,
|
|
170
|
+
moveElementsToLayer,
|
|
171
|
+
deleteLayer,
|
|
172
|
+
];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { BlockStdScope } from '../../../std/index.js';
|
|
2
|
+
import { type SurfaceMiddleware, SurfaceMiddlewareBuilder } from '../../../std/gfx/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The layer to REQUEST for a model derived from `source` — the note an
|
|
5
|
+
* auto-complete arrow clones, the note the slicer splits off, the block that
|
|
6
|
+
* replaces another when its view changes — so it lands beside its source
|
|
7
|
+
* once {@link resolveCreationLayer} has read it. A source in the default
|
|
8
|
+
* layer asks for {@link DEFAULT_LAYER_ID} explicitly: "absent" would hand the
|
|
9
|
+
* derived model to the viewer's active layer instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare function sourceLayerOf(source: unknown): string;
|
|
12
|
+
/**
|
|
13
|
+
* The layer a model being CREATED is stored in (ADR 0031 §6), as the value
|
|
14
|
+
* to write: a layer id, or `undefined` for the default layer.
|
|
15
|
+
*
|
|
16
|
+
* - `requested` names a layer of THIS surface → kept (a duplicate, an
|
|
17
|
+
* alt-drag clone, a paste within the document stays beside its source);
|
|
18
|
+
* - `requested` is {@link DEFAULT_LAYER_ID} → the default layer, explicitly:
|
|
19
|
+
* a caller that computed "default" (a new group whose highest member is in
|
|
20
|
+
* it) is not overridden by the active layer;
|
|
21
|
+
* - anything else — absent, or an id with no record here (a paste from
|
|
22
|
+
* another document, a template, an import) → the viewer's active layer.
|
|
23
|
+
*
|
|
24
|
+
* A surface with no layer at all writes nothing, whatever was asked.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveCreationLayer(std: BlockStdScope, requested: unknown): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Stamp the creation layer on `props` in place: set it, or remove the key so
|
|
29
|
+
* a default-layer model writes no `layer` at all.
|
|
30
|
+
*/
|
|
31
|
+
export declare function applyCreationLayer(std: BlockStdScope, props: Record<string, unknown>): void;
|
|
32
|
+
/**
|
|
33
|
+
* Every `surface.addElement` goes through this `beforeAdd` middleware, beside
|
|
34
|
+
* `EditPropsMiddlewareBuilder` (ADR 0031 §6): a framework command adding an
|
|
35
|
+
* element directly gets the same rule as the canvas tools.
|
|
36
|
+
*/
|
|
37
|
+
export declare class UserLayerMiddlewareBuilder extends SurfaceMiddlewareBuilder {
|
|
38
|
+
static key: string;
|
|
39
|
+
middleware: SurfaceMiddleware;
|
|
40
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DEFAULT_LAYER_ID, GfxControllerIdentifier, ownLayerOf, SurfaceMiddlewareBuilder, } from '../../../std/gfx/index.js';
|
|
2
|
+
import { CanvasActiveLayer } from './active-layer.js';
|
|
3
|
+
/**
|
|
4
|
+
* The layer to REQUEST for a model derived from `source` — the note an
|
|
5
|
+
* auto-complete arrow clones, the note the slicer splits off, the block that
|
|
6
|
+
* replaces another when its view changes — so it lands beside its source
|
|
7
|
+
* once {@link resolveCreationLayer} has read it. A source in the default
|
|
8
|
+
* layer asks for {@link DEFAULT_LAYER_ID} explicitly: "absent" would hand the
|
|
9
|
+
* derived model to the viewer's active layer instead.
|
|
10
|
+
*/
|
|
11
|
+
export function sourceLayerOf(source) {
|
|
12
|
+
return ownLayerOf(source) ?? DEFAULT_LAYER_ID;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The layer a model being CREATED is stored in (ADR 0031 §6), as the value
|
|
16
|
+
* to write: a layer id, or `undefined` for the default layer.
|
|
17
|
+
*
|
|
18
|
+
* - `requested` names a layer of THIS surface → kept (a duplicate, an
|
|
19
|
+
* alt-drag clone, a paste within the document stays beside its source);
|
|
20
|
+
* - `requested` is {@link DEFAULT_LAYER_ID} → the default layer, explicitly:
|
|
21
|
+
* a caller that computed "default" (a new group whose highest member is in
|
|
22
|
+
* it) is not overridden by the active layer;
|
|
23
|
+
* - anything else — absent, or an id with no record here (a paste from
|
|
24
|
+
* another document, a template, an import) → the viewer's active layer.
|
|
25
|
+
*
|
|
26
|
+
* A surface with no layer at all writes nothing, whatever was asked.
|
|
27
|
+
*/
|
|
28
|
+
export function resolveCreationLayer(std, requested) {
|
|
29
|
+
const layers = std.get(GfxControllerIdentifier).surface?.props.layers;
|
|
30
|
+
if (!layers)
|
|
31
|
+
return undefined;
|
|
32
|
+
if (requested === DEFAULT_LAYER_ID)
|
|
33
|
+
return undefined;
|
|
34
|
+
if (typeof requested === 'string' && layers[requested])
|
|
35
|
+
return requested;
|
|
36
|
+
const active = std.getOptional(CanvasActiveLayer)?.resolve() ?? DEFAULT_LAYER_ID;
|
|
37
|
+
return active === DEFAULT_LAYER_ID ? undefined : active;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Stamp the creation layer on `props` in place: set it, or remove the key so
|
|
41
|
+
* a default-layer model writes no `layer` at all.
|
|
42
|
+
*/
|
|
43
|
+
export function applyCreationLayer(std, props) {
|
|
44
|
+
const layer = resolveCreationLayer(std, props.layer);
|
|
45
|
+
if (layer === undefined) {
|
|
46
|
+
delete props.layer;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
props.layer = layer;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Every `surface.addElement` goes through this `beforeAdd` middleware, beside
|
|
54
|
+
* `EditPropsMiddlewareBuilder` (ADR 0031 §6): a framework command adding an
|
|
55
|
+
* element directly gets the same rule as the canvas tools.
|
|
56
|
+
*/
|
|
57
|
+
export class UserLayerMiddlewareBuilder extends SurfaceMiddlewareBuilder {
|
|
58
|
+
constructor() {
|
|
59
|
+
super(...arguments);
|
|
60
|
+
this.middleware = ctx => {
|
|
61
|
+
if (ctx.type !== 'beforeAdd')
|
|
62
|
+
return;
|
|
63
|
+
const props = { ...ctx.payload.props };
|
|
64
|
+
applyCreationLayer(this.std, props);
|
|
65
|
+
ctx.payload.props = props;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
static { this.key = 'userLayer'; }
|
|
69
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CanvasActiveLayer } from './active-layer.js';
|
|
2
|
+
export { createUserLayer, deleteUserLayer, moveModelsToUserLayer, renameUserLayer, reorderUserLayer, setUserLayersHiddenForEveryone, userLayerName, userLayersBottomUp, writeModelLayer, } from './actions.js';
|
|
3
|
+
export { type CanvasLayerAction, type CreateLayerParams, createLayerParams, type DeleteLayerParams, deleteLayerParams, type MoveElementsToLayerParams, moveElementsToLayerParams, type RenameLayerParams, renameLayerParams, type ReorderLayerParams, reorderLayerParams, reportLayerChange, userLayerCommands, } from './commands.js';
|
|
4
|
+
export { applyCreationLayer, resolveCreationLayer, sourceLayerOf, UserLayerMiddlewareBuilder, } from './creation.js';
|
|
5
|
+
export { LAYER_SEED_NAME, USER_LAYER_SEED_WORDINGS } from './translations.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { CanvasActiveLayer } from './active-layer.js';
|
|
2
|
+
export { createUserLayer, deleteUserLayer, moveModelsToUserLayer, renameUserLayer, reorderUserLayer, setUserLayersHiddenForEveryone, userLayerName, userLayersBottomUp, writeModelLayer, } from './actions.js';
|
|
3
|
+
export { createLayerParams, deleteLayerParams, moveElementsToLayerParams, renameLayerParams, reorderLayerParams, reportLayerChange, userLayerCommands, } from './commands.js';
|
|
4
|
+
export { applyCreationLayer, resolveCreationLayer, sourceLayerOf, UserLayerMiddlewareBuilder, } from './creation.js';
|
|
5
|
+
export { LAYER_SEED_NAME, USER_LAYER_SEED_WORDINGS } from './translations.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChromeWording } from '../../../affine-shared/services/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The name a new user layer is created with (ADR 0031 §2). A SEED: the
|
|
4
|
+
* creation site resolves it through the translation seam once and writes
|
|
5
|
+
* the result into the document, where it is content from then on — a layer
|
|
6
|
+
* renamed, or opened under another locale, keeps its name.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LAYER_SEED_NAME: ChromeWording;
|
|
9
|
+
/** The seeds this package writes into a document for user layers. */
|
|
10
|
+
export declare const USER_LAYER_SEED_WORDINGS: readonly ChromeWording[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The name a new user layer is created with (ADR 0031 §2). A SEED: the
|
|
3
|
+
* creation site resolves it through the translation seam once and writes
|
|
4
|
+
* the result into the document, where it is content from then on — a layer
|
|
5
|
+
* renamed, or opened under another locale, keeps its name.
|
|
6
|
+
*/
|
|
7
|
+
export const LAYER_SEED_NAME = [
|
|
8
|
+
'com.labre.layer.seed.name',
|
|
9
|
+
'Layer {{n}}',
|
|
10
|
+
];
|
|
11
|
+
/** The seeds this package writes into a document for user layers. */
|
|
12
|
+
export const USER_LAYER_SEED_WORDINGS = [
|
|
13
|
+
LAYER_SEED_NAME,
|
|
14
|
+
];
|
|
@@ -105,7 +105,7 @@ export class FrameworkBackgroundView extends GfxElementModelView {
|
|
|
105
105
|
font: '14px Inter, sans-serif',
|
|
106
106
|
color: 'var(--affine-text-primary-color, #1f2328)',
|
|
107
107
|
background: 'var(--affine-background-overlay-panel-color, #ffffff)',
|
|
108
|
-
border: '1px solid var(--affine-primary-color
|
|
108
|
+
border: '1px solid var(--affine-primary-color)',
|
|
109
109
|
borderRadius: '6px',
|
|
110
110
|
boxShadow: 'var(--affine-shadow-2, 0 2px 8px rgba(0,0,0,0.18))',
|
|
111
111
|
outline: 'none',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Bound } from '../../global/gfx/index.js';
|
|
2
|
-
import { type FrameworkBackgroundDef, type Ratio } from './def.js';
|
|
3
|
-
import type
|
|
2
|
+
import { type BackgroundTextDef, type FrameworkBackgroundDef, type Ratio } from './def.js';
|
|
3
|
+
import { type BackgroundModelLike } from './labels.js';
|
|
4
4
|
/**
|
|
5
5
|
* The framework-background declaration read as EVALUATION FACTS (PF5.15/PF5.16).
|
|
6
6
|
*
|
|
@@ -85,6 +85,59 @@ export interface BackgroundAxisFact {
|
|
|
85
85
|
export declare function containingFrame<T extends {
|
|
86
86
|
id: string;
|
|
87
87
|
}>(bound: Bound, candidates: Iterable<T>, boundOf: (candidate: T) => Bound): T | null;
|
|
88
|
+
/**
|
|
89
|
+
* One zone of ONE instance, as a reader sees it: a framework zone the instance
|
|
90
|
+
* shows, or a zone the instance declares for itself.
|
|
91
|
+
*/
|
|
92
|
+
export interface BackgroundZoneFact {
|
|
93
|
+
/** The declared id, or `${idPrefix}:${item.id}` for an instance zone. */
|
|
94
|
+
id: string;
|
|
95
|
+
rect: {
|
|
96
|
+
x: Ratio;
|
|
97
|
+
y: Ratio;
|
|
98
|
+
w: Ratio;
|
|
99
|
+
h: Ratio;
|
|
100
|
+
};
|
|
101
|
+
/** A framework zone's name, as declared — key, fallback and stored prop. */
|
|
102
|
+
label?: BackgroundTextDef;
|
|
103
|
+
/** An instance zone's name, as the user wrote it. */
|
|
104
|
+
name?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Every zone ONE instance actually has: the framework's zones in the variant
|
|
108
|
+
* the instance is turned to, then the zones it declares for itself — a BPMN
|
|
109
|
+
* pool's lanes.
|
|
110
|
+
*
|
|
111
|
+
* THE answer to "which zones are on this frame", shared by the reading and the
|
|
112
|
+
* audit so they cannot disagree. Before it existed the audit concatenated every
|
|
113
|
+
* declared zone whatever the instance's variant, and could place a sub-domain
|
|
114
|
+
* on a migration chart in a classic quadrant nobody can see — the same gate
|
|
115
|
+
* the renderer and the validation engine already passed through
|
|
116
|
+
* (`backgroundInVariant`), forgotten in one reader out of three.
|
|
117
|
+
*
|
|
118
|
+
* Framework zones first, so a framework zone still wins a genuine overlap: the
|
|
119
|
+
* order the audit has always reported them in.
|
|
120
|
+
*/
|
|
121
|
+
export declare function backgroundZones(def: FrameworkBackgroundDef, model: BackgroundModelLike): BackgroundZoneFact[];
|
|
122
|
+
/**
|
|
123
|
+
* Where the centre of `bound` sits inside the PLOT of the instance occupying
|
|
124
|
+
* `frame`, as ratios.
|
|
125
|
+
*
|
|
126
|
+
* Ratios of the plot and not of the element box: a Wardley transition drawn at
|
|
127
|
+
* `0.4` is 40 % of the PLOT, and the margin between the two is exactly where the
|
|
128
|
+
* axis titles live. Not clamped — an element just off the left edge reads as
|
|
129
|
+
* `-0.03`, which is a true and useful thing to say. `null` for a degenerate
|
|
130
|
+
* plot.
|
|
131
|
+
*/
|
|
132
|
+
export declare function backgroundPlotRatios(def: FrameworkBackgroundDef, frame: Bound, bound: Bound): readonly [number, number] | null;
|
|
133
|
+
/**
|
|
134
|
+
* The first zone whose rectangle holds a plot-ratio point, in the order given.
|
|
135
|
+
*
|
|
136
|
+
* Inclusive on all four edges and first match wins, so a point exactly on a
|
|
137
|
+
* divider belongs to the zone declared first — the tie the audit and
|
|
138
|
+
* `bpmnLaneOf` have always broken that way.
|
|
139
|
+
*/
|
|
140
|
+
export declare function backgroundZoneAt<T extends Pick<BackgroundZoneFact, 'rect'>>(zones: readonly T[], at: readonly [number, number]): T | undefined;
|
|
88
141
|
/** The declared axes, as facts. Empty for a background that declares none. */
|
|
89
142
|
export declare function backgroundAxisFacts(def: FrameworkBackgroundDef): readonly BackgroundAxisFact[];
|
|
90
143
|
/** The declared axis with this id, as a fact. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { backgroundPlot, } from './def.js';
|
|
1
|
+
import { backgroundInstanceZones, backgroundPlot, } from './def.js';
|
|
2
|
+
import { backgroundInVariant } from './labels.js';
|
|
2
3
|
const FORWARD = {
|
|
3
4
|
horizontal: [1, 0],
|
|
4
5
|
vertical: [0, -1],
|
|
@@ -60,6 +61,67 @@ export function containingFrame(bound, candidates, boundOf) {
|
|
|
60
61
|
}
|
|
61
62
|
return found;
|
|
62
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Every zone ONE instance actually has: the framework's zones in the variant
|
|
66
|
+
* the instance is turned to, then the zones it declares for itself — a BPMN
|
|
67
|
+
* pool's lanes.
|
|
68
|
+
*
|
|
69
|
+
* THE answer to "which zones are on this frame", shared by the reading and the
|
|
70
|
+
* audit so they cannot disagree. Before it existed the audit concatenated every
|
|
71
|
+
* declared zone whatever the instance's variant, and could place a sub-domain
|
|
72
|
+
* on a migration chart in a classic quadrant nobody can see — the same gate
|
|
73
|
+
* the renderer and the validation engine already passed through
|
|
74
|
+
* (`backgroundInVariant`), forgotten in one reader out of three.
|
|
75
|
+
*
|
|
76
|
+
* Framework zones first, so a framework zone still wins a genuine overlap: the
|
|
77
|
+
* order the audit has always reported them in.
|
|
78
|
+
*/
|
|
79
|
+
export function backgroundZones(def, model) {
|
|
80
|
+
const zones = [];
|
|
81
|
+
for (const zone of def.zones ?? []) {
|
|
82
|
+
if (!backgroundInVariant(def, zone.variants, model))
|
|
83
|
+
continue;
|
|
84
|
+
zones.push({
|
|
85
|
+
id: zone.id,
|
|
86
|
+
rect: zone.rect,
|
|
87
|
+
...(zone.label !== undefined ? { label: zone.label } : {}),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
zones.push(...backgroundInstanceZones(def, model));
|
|
91
|
+
return zones;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Where the centre of `bound` sits inside the PLOT of the instance occupying
|
|
95
|
+
* `frame`, as ratios.
|
|
96
|
+
*
|
|
97
|
+
* Ratios of the plot and not of the element box: a Wardley transition drawn at
|
|
98
|
+
* `0.4` is 40 % of the PLOT, and the margin between the two is exactly where the
|
|
99
|
+
* axis titles live. Not clamped — an element just off the left edge reads as
|
|
100
|
+
* `-0.03`, which is a true and useful thing to say. `null` for a degenerate
|
|
101
|
+
* plot.
|
|
102
|
+
*/
|
|
103
|
+
export function backgroundPlotRatios(def, frame, bound) {
|
|
104
|
+
const plot = backgroundPlot(def, frame.w, frame.h);
|
|
105
|
+
if (!(plot.width > 0) || !(plot.height > 0))
|
|
106
|
+
return null;
|
|
107
|
+
return [
|
|
108
|
+
(bound.x + bound.w / 2 - frame.x - plot.x0) / plot.width,
|
|
109
|
+
(bound.y + bound.h / 2 - frame.y - plot.y0) / plot.height,
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The first zone whose rectangle holds a plot-ratio point, in the order given.
|
|
114
|
+
*
|
|
115
|
+
* Inclusive on all four edges and first match wins, so a point exactly on a
|
|
116
|
+
* divider belongs to the zone declared first — the tie the audit and
|
|
117
|
+
* `bpmnLaneOf` have always broken that way.
|
|
118
|
+
*/
|
|
119
|
+
export function backgroundZoneAt(zones, at) {
|
|
120
|
+
return zones.find(({ rect }) => at[0] >= rect.x &&
|
|
121
|
+
at[0] <= rect.x + rect.w &&
|
|
122
|
+
at[1] >= rect.y &&
|
|
123
|
+
at[1] <= rect.y + rect.h);
|
|
124
|
+
}
|
|
63
125
|
/** The declared axes, as facts. Empty for a background that declares none. */
|
|
64
126
|
export function backgroundAxisFacts(def) {
|
|
65
127
|
return (def.axes ?? []).map(axis => ({
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a framework that draws a FIXED reference artwork puts it in its element.
|
|
3
|
+
*
|
|
4
|
+
* A declared background (`FrameworkBackgroundDef`) never needs this: it is made
|
|
5
|
+
* of ratios of a plot and stretches with the element by construction. The
|
|
6
|
+
* frameworks that reproduce an authored drawing — Cynefin, Estuarine, EDGY, the
|
|
7
|
+
* DDD stencils — cannot stretch: circles would turn into ellipses and a
|
|
8
|
+
* hand-drawn boundary into a smear. They fit the artwork uniformly instead and
|
|
9
|
+
* centre what is left over.
|
|
10
|
+
*
|
|
11
|
+
* This was written three times over — `gfx/cynefin-estuarine/src/utils.ts`,
|
|
12
|
+
* `gfx/ddd-shared/src/shared/utils.ts` and `gfx/edgy/src/consts.ts` — with the
|
|
13
|
+
* same body each time. One source of truth (R37): the three call it, and a
|
|
14
|
+
* board that crops itself onto its drawing
|
|
15
|
+
* (`gfx/cynefin-estuarine/src/cynefin/crop.ts`) reads the very function the
|
|
16
|
+
* renderer painted through, so the two can never disagree about where the
|
|
17
|
+
* drawing is.
|
|
18
|
+
*/
|
|
19
|
+
/** A uniform fit: the scale, and the offsets that centre the letterbox. */
|
|
20
|
+
export interface RefFit {
|
|
21
|
+
/** Scale from reference units to element units. */
|
|
22
|
+
s: number;
|
|
23
|
+
/** Left offset of the fitted artwork inside the element, in element units. */
|
|
24
|
+
ox: number;
|
|
25
|
+
/** Top offset of the fitted artwork inside the element, in element units. */
|
|
26
|
+
oy: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Uniform fit of a `refW × refH` reference design into a `w × h` box: the
|
|
30
|
+
* scale factor plus the centring offsets (letterboxed), undistorted.
|
|
31
|
+
*
|
|
32
|
+
* The fitted artwork is `refW * s` by `refH * s` and shares the box's CENTRE —
|
|
33
|
+
* `ox + refW * s / 2 === w / 2` — which is what lets a board crop itself onto
|
|
34
|
+
* its drawing without the drawing moving, rotation included.
|
|
35
|
+
*/
|
|
36
|
+
export declare function refScale(w: number, h: number, refW: number, refH: number): RefFit;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a framework that draws a FIXED reference artwork puts it in its element.
|
|
3
|
+
*
|
|
4
|
+
* A declared background (`FrameworkBackgroundDef`) never needs this: it is made
|
|
5
|
+
* of ratios of a plot and stretches with the element by construction. The
|
|
6
|
+
* frameworks that reproduce an authored drawing — Cynefin, Estuarine, EDGY, the
|
|
7
|
+
* DDD stencils — cannot stretch: circles would turn into ellipses and a
|
|
8
|
+
* hand-drawn boundary into a smear. They fit the artwork uniformly instead and
|
|
9
|
+
* centre what is left over.
|
|
10
|
+
*
|
|
11
|
+
* This was written three times over — `gfx/cynefin-estuarine/src/utils.ts`,
|
|
12
|
+
* `gfx/ddd-shared/src/shared/utils.ts` and `gfx/edgy/src/consts.ts` — with the
|
|
13
|
+
* same body each time. One source of truth (R37): the three call it, and a
|
|
14
|
+
* board that crops itself onto its drawing
|
|
15
|
+
* (`gfx/cynefin-estuarine/src/cynefin/crop.ts`) reads the very function the
|
|
16
|
+
* renderer painted through, so the two can never disagree about where the
|
|
17
|
+
* drawing is.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Uniform fit of a `refW × refH` reference design into a `w × h` box: the
|
|
21
|
+
* scale factor plus the centring offsets (letterboxed), undistorted.
|
|
22
|
+
*
|
|
23
|
+
* The fitted artwork is `refW * s` by `refH * s` and shares the box's CENTRE —
|
|
24
|
+
* `ox + refW * s / 2 === w / 2` — which is what lets a board crop itself onto
|
|
25
|
+
* its drawing without the drawing moving, rotation included.
|
|
26
|
+
*/
|
|
27
|
+
export function refScale(w, h, refW, refH) {
|
|
28
|
+
const s = Math.min(w / refW, h / refH);
|
|
29
|
+
return { s, ox: (w - refW * s) / 2, oy: (h - refH * s) / 2 };
|
|
30
|
+
}
|