@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { BlockSuiteError, ErrorCode } from '../../../global/exceptions/index.js';
|
|
3
3
|
import { Bound } from '../../../global/gfx/index.js';
|
|
4
|
-
import { computed, effect, signal } from '@preact/signals-core';
|
|
4
|
+
import { computed, effect, signal, untracked } from '@preact/signals-core';
|
|
5
5
|
import { nothing } from 'lit';
|
|
6
6
|
import { GfxControllerIdentifier } from '../../gfx/identifiers.js';
|
|
7
7
|
import { SurfaceSelection } from '../../selection/index.js';
|
|
@@ -25,7 +25,10 @@ function updateZIndex(element) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
function updateBlockVisibility(view) {
|
|
28
|
-
|
|
28
|
+
// Read inside the effect below, so a local hide or show repaints the block
|
|
29
|
+
// without a transform change (ADR 0031 §8).
|
|
30
|
+
const hiddenLocally = view.gfx.localVisibility.isHidden(view.model);
|
|
31
|
+
if (view.transformState$.value === 'active' && !hiddenLocally) {
|
|
29
32
|
view.style.visibility = 'visible';
|
|
30
33
|
view.style.pointerEvents = 'auto';
|
|
31
34
|
view.classList.remove('block-idle');
|
|
@@ -47,12 +50,17 @@ function handleGfxConnection(instance) {
|
|
|
47
50
|
if (id === instance.model.id && type === 'update') {
|
|
48
51
|
updateTransform(instance);
|
|
49
52
|
updateZIndex(instance);
|
|
53
|
+
// A move to another user layer may hide or show it (ADR 0031 §7).
|
|
54
|
+
untracked(() => updateBlockVisibility(instance));
|
|
50
55
|
}
|
|
51
56
|
}));
|
|
52
57
|
// A reorder changes no property of this block, only the layer it sits in,
|
|
53
58
|
// so the stacking has to be read back from the layer manager.
|
|
54
59
|
instance.disposables.add(instance.gfx.layer.slots.layerUpdated.subscribe(() => {
|
|
55
60
|
updateZIndex(instance);
|
|
61
|
+
// So may a regroup, or a change of the layer list (a layer hidden for
|
|
62
|
+
// everyone is one record write, not a write on this block).
|
|
63
|
+
untracked(() => updateBlockVisibility(instance));
|
|
56
64
|
}));
|
|
57
65
|
instance.disposables.add(effect(() => {
|
|
58
66
|
updateBlockVisibility(instance);
|
package/dist/commands.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { coreCommands, pivotCommands, readingCommands, tagCommands, } from './_pkgs/affine-block-root/index.js';
|
|
2
|
-
import { auditCommands, exportSvgCommands, mapQualityCommands, } from './_pkgs/affine-block-surface/index.js';
|
|
1
|
+
import { copyLinkCommands, coreCommands, pivotCommands, readingCommands, tagCommands, } from './_pkgs/affine-block-root/index.js';
|
|
2
|
+
import { auditCommands, canvasGridCommands, exportSvgCommands, mapQualityCommands, selectionPaneCommands, userLayerCommands, } from './_pkgs/affine-block-surface/index.js';
|
|
3
3
|
import { edgeDirectionCommands } from './_pkgs/affine-gfx-connector/index.js';
|
|
4
4
|
import { shapeCommands } from './_pkgs/affine-gfx-shape/index.js';
|
|
5
5
|
import { toCommandManifestEntry, } from './_pkgs/std/index.js';
|
|
@@ -47,12 +47,16 @@ export function buildCommandRegistry(core, groups, flags) {
|
|
|
47
47
|
export function getCommands(flags) {
|
|
48
48
|
return buildCommandRegistry([
|
|
49
49
|
...coreCommands,
|
|
50
|
+
...copyLinkCommands,
|
|
50
51
|
...pivotCommands,
|
|
51
52
|
...tagCommands,
|
|
52
53
|
...readingCommands,
|
|
53
54
|
...shapeCommands,
|
|
54
55
|
...mapQualityCommands,
|
|
55
56
|
...exportSvgCommands,
|
|
57
|
+
...selectionPaneCommands,
|
|
58
|
+
...canvasGridCommands,
|
|
59
|
+
...userLayerCommands,
|
|
56
60
|
...edgeDirectionCommands,
|
|
57
61
|
...(isCapabilityEnabled(flags, 'ai-audit') ? auditCommands : []),
|
|
58
62
|
], FRAMEWORK_COMMAND_GROUPS, flags);
|
package/dist/translations.js
CHANGED
|
@@ -4,7 +4,7 @@ import { EMBED_WORDINGS } from './_pkgs/affine-block-embed/translations.js';
|
|
|
4
4
|
import { EMBED_DOC_WORDINGS } from './_pkgs/affine-block-embed-doc/translations.js';
|
|
5
5
|
import { FRAME_CHROME_WORDINGS, FRAME_WORDINGS, } from './_pkgs/affine-block-frame/translations.js';
|
|
6
6
|
import { IMAGE_WORDINGS } from './_pkgs/affine-block-image/translations.js';
|
|
7
|
-
import { EXEMPTION_FALLBACK, PROVENANCE_FALLBACK, SEVERITY_FALLBACK, SVG_SKETCH_WORDINGS, } from './_pkgs/affine-block-surface/index.js';
|
|
7
|
+
import { EXEMPTION_FALLBACK, EXPORT_SVG_WORDINGS, PROVENANCE_FALLBACK, READING_FRAME_WORDINGS, SEVERITY_FALLBACK, SVG_SKETCH_WORDINGS, USER_LAYER_SEED_WORDINGS, } from './_pkgs/affine-block-surface/index.js';
|
|
8
8
|
import { SURFACE_REF_CHROME_WORDINGS, SURFACE_REF_WORDINGS, } from './_pkgs/affine-block-surface-ref/translations.js';
|
|
9
9
|
import { ADAPTER_PANEL_WORDINGS } from './_pkgs/affine-fragment-adapter-panel/translations.js';
|
|
10
10
|
import { DOC_TITLE_WORDINGS } from './_pkgs/affine-fragment-doc-title/translations.js';
|
|
@@ -158,7 +158,11 @@ const CHROME_KEYS = [
|
|
|
158
158
|
['com.labre.reading.field.nature', 'Nature'],
|
|
159
159
|
['com.labre.reading.field.relations', 'Parent-child relations'],
|
|
160
160
|
['com.labre.reading.field.value-flow', 'Value flow'],
|
|
161
|
-
|
|
161
|
+
// `com.labre.reading.field.phase` and `com.labre.reading.phase.none` are the
|
|
162
|
+
// reading engine's DEFAULT frame wording, declared beside it in the surface
|
|
163
|
+
// package (`READING_FRAME_WORDINGS`) and walked from `PACKAGE_WORDINGS`: a
|
|
164
|
+
// profile that names no frame wording — Wardley's, a 0.43 host's — reads
|
|
165
|
+
// with them, whether or not a framework bundle is installed.
|
|
162
166
|
['com.labre.reading.field.naming', 'Naming convention'],
|
|
163
167
|
['com.labre.reading.field.record', 'Record'],
|
|
164
168
|
['com.labre.reading.field.drift', 'Drift'],
|
|
@@ -182,10 +186,7 @@ const CHROME_KEYS = [
|
|
|
182
186
|
['com.labre.reading.value-flow', 'Value flows up from'],
|
|
183
187
|
['com.labre.reading.value-flow.to', 'to'],
|
|
184
188
|
['com.labre.reading.phase.band', 'In the zone of punctuated equilibrium'],
|
|
185
|
-
[
|
|
186
|
-
'com.labre.reading.phase.none',
|
|
187
|
-
'Not on a framework background — no phase to read.',
|
|
188
|
-
],
|
|
189
|
+
['com.labre.reading.zone.unnamed', 'Unnamed'],
|
|
189
190
|
[
|
|
190
191
|
'com.labre.reading.naming.conforms',
|
|
191
192
|
'The name follows the convention of its nature.',
|
|
@@ -219,6 +220,11 @@ const CHROME_KEYS = [
|
|
|
219
220
|
// and would leave every new format silently untranslated.
|
|
220
221
|
['com.labre.interchange.import.done', 'file imported'],
|
|
221
222
|
['com.labre.interchange.import.failed', 'This file could not be imported'],
|
|
223
|
+
// The name an imported sheet takes when neither the file nor the source
|
|
224
|
+
// document carries one. Resolved at the creation site (`interchange-import`,
|
|
225
|
+
// which has `std`); the pure readers keep the same English text as their own
|
|
226
|
+
// last-resort default, so the two can never drift (#390).
|
|
227
|
+
['com.labre.interchange.import.default-name', 'Imported diagram'],
|
|
222
228
|
// Rights lost WHILE the file was being read — the import's own sentence,
|
|
223
229
|
// because nothing is wrong with the file. It rides under the same "could not
|
|
224
230
|
// be imported" headline as a reader's refusal, which is what it is to the
|
|
@@ -298,6 +304,8 @@ const PACKAGE_WORDINGS = [
|
|
|
298
304
|
POINTER_WORDINGS,
|
|
299
305
|
ROOT_CHROME_WORDINGS,
|
|
300
306
|
SVG_SKETCH_WORDINGS,
|
|
307
|
+
EXPORT_SVG_WORDINGS,
|
|
308
|
+
READING_FRAME_WORDINGS,
|
|
301
309
|
STD_WORDINGS,
|
|
302
310
|
ATTACHMENT_WORDINGS,
|
|
303
311
|
BOOKMARK_WORDINGS,
|
|
@@ -326,6 +334,7 @@ const PACKAGE_SEED_WORDINGS = [
|
|
|
326
334
|
SURFACE_REF_WORDINGS,
|
|
327
335
|
TEMPLATE_SEED_WORDINGS,
|
|
328
336
|
ROOT_SEED_WORDINGS,
|
|
337
|
+
USER_LAYER_SEED_WORDINGS,
|
|
329
338
|
];
|
|
330
339
|
/**
|
|
331
340
|
* Every i18n key THIS package can ask the host for, with its English fallback
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formicoidea/labre-core",
|
|
3
3
|
"description": "Labre editor — the full BlockSuite-derived editor as one package.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.45.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"author": "lajola",
|
|
@@ -854,6 +854,10 @@
|
|
|
854
854
|
"types": "./dist/foundation/view.d.ts",
|
|
855
855
|
"import": "./dist/foundation/view.js"
|
|
856
856
|
},
|
|
857
|
+
"./_pkgs/affine-block-surface": {
|
|
858
|
+
"types": "./dist/_pkgs/affine-block-surface/index.d.ts",
|
|
859
|
+
"import": "./dist/_pkgs/affine-block-surface/index.js"
|
|
860
|
+
},
|
|
857
861
|
"./_pkgs/affine-widget-edgeless-toolbar": {
|
|
858
862
|
"types": "./dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts",
|
|
859
863
|
"import": "./dist/_pkgs/affine-widget-edgeless-toolbar/index.js"
|
|
@@ -869,6 +873,14 @@
|
|
|
869
873
|
"./_pkgs/global/utils": {
|
|
870
874
|
"types": "./dist/_pkgs/global/utils/index.d.ts",
|
|
871
875
|
"import": "./dist/_pkgs/global/utils/index.js"
|
|
876
|
+
},
|
|
877
|
+
"./_pkgs/store": {
|
|
878
|
+
"types": "./dist/_pkgs/store/index.d.ts",
|
|
879
|
+
"import": "./dist/_pkgs/store/index.js"
|
|
880
|
+
},
|
|
881
|
+
"./_pkgs/store/index.js": {
|
|
882
|
+
"types": "./dist/_pkgs/store/index.d.ts",
|
|
883
|
+
"import": "./dist/_pkgs/store/index.js"
|
|
872
884
|
}
|
|
873
885
|
},
|
|
874
886
|
"files": [
|
|
@@ -942,7 +954,6 @@
|
|
|
942
954
|
"ts-pattern": "^5.1.0",
|
|
943
955
|
"unified": "^11.0.5",
|
|
944
956
|
"unist-util-visit": "^5.0.0",
|
|
945
|
-
"vitest": "^3.2.3",
|
|
946
957
|
"w3c-keyname": "^2.2.8",
|
|
947
958
|
"y-protocols": "^1.0.6",
|
|
948
959
|
"yjs": "^13.6.21",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getAttachmentFileIconRC(filetype: string): (props: import("react").SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { FileIconAepIcon, FileIconAiIcon, FileIconAviIcon, FileIconCssIcon, FileIconCsvIcon, FileIconDmgIcon, FileIconDocIcon, FileIconDocxIcon, FileIconEpsIcon, FileIconExeIcon, FileIconFigIcon, FileIconGifIcon, FileIconHtmlIcon, FileIconInddIcon, FileIconJavaIcon, FileIconJpegIcon, FileIconJsIcon, FileIconJsonIcon, FileIconMkvIcon, FileIconMp3Icon, FileIconMp4Icon, FileIconMpegIcon, FileIconNoneIcon, FileIconPdfIcon, FileIconPngIcon, FileIconPptIcon, FileIconPptxIcon, FileIconPsdIcon, FileIconRarIcon, FileIconRssIcon, FileIconSqlIcon, FileIconSvgIcon, FileIconTiffIcon, FileIconTxtIcon, FileIconWavIcon, FileIconWebpIcon, FileIconXlsIcon, FileIconXlsxIcon, FileIconXmlIcon, FileIconZipIcon, ImageIcon, } from '@blocksuite/icons/rc';
|
|
2
|
-
export function getAttachmentFileIconRC(filetype) {
|
|
3
|
-
switch (filetype) {
|
|
4
|
-
case 'img':
|
|
5
|
-
return ImageIcon;
|
|
6
|
-
case 'image/jpeg':
|
|
7
|
-
case 'jpg':
|
|
8
|
-
case 'jpeg':
|
|
9
|
-
return FileIconJpegIcon;
|
|
10
|
-
case 'image/png':
|
|
11
|
-
case 'png':
|
|
12
|
-
return FileIconPngIcon;
|
|
13
|
-
case 'image/webp':
|
|
14
|
-
case 'webp':
|
|
15
|
-
return FileIconWebpIcon;
|
|
16
|
-
case 'image/tiff':
|
|
17
|
-
case 'tiff':
|
|
18
|
-
return FileIconTiffIcon;
|
|
19
|
-
case 'image/gif':
|
|
20
|
-
case 'gif':
|
|
21
|
-
return FileIconGifIcon;
|
|
22
|
-
case 'image/svg':
|
|
23
|
-
case 'svg':
|
|
24
|
-
return FileIconSvgIcon;
|
|
25
|
-
case 'image/eps':
|
|
26
|
-
case 'eps':
|
|
27
|
-
return FileIconEpsIcon;
|
|
28
|
-
case 'application/pdf':
|
|
29
|
-
case 'pdf':
|
|
30
|
-
return FileIconPdfIcon;
|
|
31
|
-
case 'application/msword':
|
|
32
|
-
case 'application/x-iwork-pages-sffpages':
|
|
33
|
-
case 'doc':
|
|
34
|
-
return FileIconDocIcon;
|
|
35
|
-
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
36
|
-
case 'docx':
|
|
37
|
-
return FileIconDocxIcon;
|
|
38
|
-
case 'text/plain':
|
|
39
|
-
case 'txt':
|
|
40
|
-
return FileIconTxtIcon;
|
|
41
|
-
case 'csv':
|
|
42
|
-
return FileIconCsvIcon;
|
|
43
|
-
case 'application/vnd.ms-excel':
|
|
44
|
-
case 'xls':
|
|
45
|
-
return FileIconXlsIcon;
|
|
46
|
-
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
47
|
-
case 'application/x-iwork-numbers-sffnumbers':
|
|
48
|
-
case 'xlsx':
|
|
49
|
-
return FileIconXlsxIcon;
|
|
50
|
-
case 'application/vnd.ms-powerpoint':
|
|
51
|
-
case 'application/x-iwork-keynote-sffkeynote':
|
|
52
|
-
case 'ppt':
|
|
53
|
-
return FileIconPptIcon;
|
|
54
|
-
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
|
55
|
-
case 'pptx':
|
|
56
|
-
return FileIconPptxIcon;
|
|
57
|
-
case 'application/illustrator':
|
|
58
|
-
case 'fig':
|
|
59
|
-
return FileIconFigIcon;
|
|
60
|
-
case 'application/postscript':
|
|
61
|
-
case 'ai':
|
|
62
|
-
return FileIconAiIcon;
|
|
63
|
-
case 'application/vnd.adobe.photoshop':
|
|
64
|
-
case 'psd':
|
|
65
|
-
return FileIconPsdIcon;
|
|
66
|
-
case 'application/vnd.adobe.indesign':
|
|
67
|
-
case 'indd':
|
|
68
|
-
return FileIconInddIcon;
|
|
69
|
-
case 'application/vnd.adobe.afterfx':
|
|
70
|
-
case 'aep':
|
|
71
|
-
return FileIconAepIcon;
|
|
72
|
-
case 'audio/mpeg':
|
|
73
|
-
case 'audio/mp3':
|
|
74
|
-
case 'mp3':
|
|
75
|
-
return FileIconMp3Icon;
|
|
76
|
-
case 'audio/wav':
|
|
77
|
-
case 'wav':
|
|
78
|
-
return FileIconWavIcon;
|
|
79
|
-
case 'video/mpeg':
|
|
80
|
-
case 'mpeg':
|
|
81
|
-
return FileIconMpegIcon;
|
|
82
|
-
case 'video/mp4':
|
|
83
|
-
case 'mp4':
|
|
84
|
-
return FileIconMp4Icon;
|
|
85
|
-
case 'video/avi':
|
|
86
|
-
case 'avi':
|
|
87
|
-
return FileIconAviIcon;
|
|
88
|
-
case 'video/mkv':
|
|
89
|
-
case 'mkv':
|
|
90
|
-
return FileIconMkvIcon;
|
|
91
|
-
case 'text/html':
|
|
92
|
-
case 'html':
|
|
93
|
-
return FileIconHtmlIcon;
|
|
94
|
-
case 'text/css':
|
|
95
|
-
case 'css':
|
|
96
|
-
return FileIconCssIcon;
|
|
97
|
-
case 'application/rss+xml':
|
|
98
|
-
case 'rss':
|
|
99
|
-
return FileIconRssIcon;
|
|
100
|
-
case 'application/sql':
|
|
101
|
-
case 'sql':
|
|
102
|
-
return FileIconSqlIcon;
|
|
103
|
-
case 'application/javascript':
|
|
104
|
-
case 'js':
|
|
105
|
-
return FileIconJsIcon;
|
|
106
|
-
case 'application/json':
|
|
107
|
-
case 'json':
|
|
108
|
-
return FileIconJsonIcon;
|
|
109
|
-
case 'application/java':
|
|
110
|
-
case 'java':
|
|
111
|
-
return FileIconJavaIcon;
|
|
112
|
-
case 'application/xml':
|
|
113
|
-
case 'xml':
|
|
114
|
-
return FileIconXmlIcon;
|
|
115
|
-
case 'application/x-msdos-program':
|
|
116
|
-
case 'exe':
|
|
117
|
-
return FileIconExeIcon;
|
|
118
|
-
case 'application/x-apple-diskimage':
|
|
119
|
-
case 'dmg':
|
|
120
|
-
return FileIconDmgIcon;
|
|
121
|
-
case 'application/zip':
|
|
122
|
-
case 'zip':
|
|
123
|
-
return FileIconZipIcon;
|
|
124
|
-
case 'application/x-rar-compressed':
|
|
125
|
-
case 'rar':
|
|
126
|
-
return FileIconRarIcon;
|
|
127
|
-
default:
|
|
128
|
-
return FileIconNoneIcon;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type Block, type ExtensionType } from '../../store/index.js';
|
|
2
|
-
export declare function createAffineTemplate(extensions?: ExtensionType[]): {
|
|
3
|
-
affine: (strings: TemplateStringsArray, ...values: any[]) => import("../../std/index.js").EditorHost;
|
|
4
|
-
block: (strings: TemplateStringsArray, ...values: any[]) => Block | null;
|
|
5
|
-
};
|
|
6
|
-
export declare const affine: (strings: TemplateStringsArray, ...values: any[]) => import("../../std/index.js").EditorHost, block: (strings: TemplateStringsArray, ...values: any[]) => Block | null;
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { CodeBlockSchemaExtension, DatabaseBlockSchemaExtension, ImageBlockSchemaExtension, ListBlockSchemaExtension, NoteBlockSchemaExtension, ParagraphBlockSchemaExtension, RootBlockSchemaExtension, } from '../../affine-model/index.js';
|
|
2
|
-
import { Container } from '../../global/di/index.js';
|
|
3
|
-
import { TextSelection } from '../../std/index.js';
|
|
4
|
-
import { Text } from '../../store/index.js';
|
|
5
|
-
import { TestWorkspace } from '../../store/test/index.js';
|
|
6
|
-
import { createTestHost } from './create-test-host.js';
|
|
7
|
-
const DEFAULT_EXTENSIONS = [
|
|
8
|
-
RootBlockSchemaExtension,
|
|
9
|
-
NoteBlockSchemaExtension,
|
|
10
|
-
ParagraphBlockSchemaExtension,
|
|
11
|
-
ListBlockSchemaExtension,
|
|
12
|
-
ImageBlockSchemaExtension,
|
|
13
|
-
DatabaseBlockSchemaExtension,
|
|
14
|
-
CodeBlockSchemaExtension,
|
|
15
|
-
];
|
|
16
|
-
// Mapping from tag names to flavours
|
|
17
|
-
const tagToFlavour = {
|
|
18
|
-
'affine-page': 'affine:page',
|
|
19
|
-
'affine-note': 'affine:note',
|
|
20
|
-
'affine-paragraph': 'affine:paragraph',
|
|
21
|
-
'affine-list': 'affine:list',
|
|
22
|
-
'affine-image': 'affine:image',
|
|
23
|
-
'affine-database': 'affine:database',
|
|
24
|
-
'affine-code': 'affine:code',
|
|
25
|
-
};
|
|
26
|
-
export function createAffineTemplate(extensions = DEFAULT_EXTENSIONS) {
|
|
27
|
-
/**
|
|
28
|
-
* Parse template strings and build BlockSuite document structure,
|
|
29
|
-
* then create a host object with the document
|
|
30
|
-
*
|
|
31
|
-
* Example:
|
|
32
|
-
* ```
|
|
33
|
-
* const host = affine`
|
|
34
|
-
* <affine-page id="page">
|
|
35
|
-
* <affine-note id="note">
|
|
36
|
-
* <affine-paragraph id="paragraph-1">Hello, world<anchor /></affine-paragraph>
|
|
37
|
-
* <affine-paragraph id="paragraph-2">Hello, world<focus /></affine-paragraph>
|
|
38
|
-
* </affine-note>
|
|
39
|
-
* </affine-page>
|
|
40
|
-
* `;
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
function affine(strings, ...values) {
|
|
44
|
-
// Merge template strings and values
|
|
45
|
-
let htmlString = '';
|
|
46
|
-
strings.forEach((str, i) => {
|
|
47
|
-
htmlString += str;
|
|
48
|
-
if (i < values.length) {
|
|
49
|
-
htmlString += values[i];
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
// Create a new doc
|
|
53
|
-
const workspace = new TestWorkspace({});
|
|
54
|
-
workspace.meta.initialize();
|
|
55
|
-
const doc = workspace.createDoc('test-doc');
|
|
56
|
-
const container = new Container();
|
|
57
|
-
extensions.forEach(extension => {
|
|
58
|
-
extension.setup(container);
|
|
59
|
-
});
|
|
60
|
-
const store = doc.getStore({ extensions, provider: container.provider() });
|
|
61
|
-
let selectionInfo = {};
|
|
62
|
-
// Use DOMParser to parse HTML string
|
|
63
|
-
doc.load(() => {
|
|
64
|
-
const parser = new DOMParser();
|
|
65
|
-
const dom = parser.parseFromString(htmlString.trim(), 'text/html');
|
|
66
|
-
const root = dom.body.firstElementChild;
|
|
67
|
-
if (!root) {
|
|
68
|
-
throw new Error('Template must contain a root element');
|
|
69
|
-
}
|
|
70
|
-
buildDocFromElement(store, root, null, selectionInfo);
|
|
71
|
-
});
|
|
72
|
-
// Create host object
|
|
73
|
-
const host = createTestHost(store);
|
|
74
|
-
// Set selection if needed
|
|
75
|
-
if (selectionInfo.anchorBlockId && selectionInfo.focusBlockId) {
|
|
76
|
-
const anchorBlock = store.getBlock(selectionInfo.anchorBlockId);
|
|
77
|
-
const anchorTextLength = anchorBlock?.model?.text?.length ?? 0;
|
|
78
|
-
const focusOffset = selectionInfo.focusOffset ?? 0;
|
|
79
|
-
const anchorOffset = selectionInfo.anchorOffset ?? 0;
|
|
80
|
-
if (selectionInfo.anchorBlockId === selectionInfo.focusBlockId) {
|
|
81
|
-
const selection = host.selection.create(TextSelection, {
|
|
82
|
-
from: {
|
|
83
|
-
blockId: selectionInfo.anchorBlockId,
|
|
84
|
-
index: anchorOffset,
|
|
85
|
-
length: focusOffset,
|
|
86
|
-
},
|
|
87
|
-
to: null,
|
|
88
|
-
});
|
|
89
|
-
host.selection.setGroup('note', [selection]);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
const selection = host.selection.create(TextSelection, {
|
|
93
|
-
from: {
|
|
94
|
-
blockId: selectionInfo.anchorBlockId,
|
|
95
|
-
index: anchorOffset,
|
|
96
|
-
length: anchorTextLength - anchorOffset,
|
|
97
|
-
},
|
|
98
|
-
to: {
|
|
99
|
-
blockId: selectionInfo.focusBlockId,
|
|
100
|
-
index: 0,
|
|
101
|
-
length: focusOffset,
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
host.selection.setGroup('note', [selection]);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
else if (selectionInfo.cursorBlockId) {
|
|
108
|
-
const selection = host.selection.create(TextSelection, {
|
|
109
|
-
from: {
|
|
110
|
-
blockId: selectionInfo.cursorBlockId,
|
|
111
|
-
index: selectionInfo.cursorOffset ?? 0,
|
|
112
|
-
length: 0,
|
|
113
|
-
},
|
|
114
|
-
to: null,
|
|
115
|
-
});
|
|
116
|
-
host.selection.setGroup('note', [selection]);
|
|
117
|
-
}
|
|
118
|
-
return host;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Create a single block from template string
|
|
122
|
-
*
|
|
123
|
-
* Example:
|
|
124
|
-
* ```
|
|
125
|
-
* const block = block`<affine-note />`
|
|
126
|
-
* ```
|
|
127
|
-
*/
|
|
128
|
-
function block(strings, ...values) {
|
|
129
|
-
// Merge template strings and values
|
|
130
|
-
let htmlString = '';
|
|
131
|
-
strings.forEach((str, i) => {
|
|
132
|
-
htmlString += str;
|
|
133
|
-
if (i < values.length) {
|
|
134
|
-
htmlString += values[i];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
// Create a temporary doc to hold the block
|
|
138
|
-
const workspace = new TestWorkspace({});
|
|
139
|
-
workspace.meta.initialize();
|
|
140
|
-
const doc = workspace.createDoc('temp-doc');
|
|
141
|
-
const store = doc.getStore({ extensions });
|
|
142
|
-
let blockId = null;
|
|
143
|
-
const selectionInfo = {};
|
|
144
|
-
// Use DOMParser to parse HTML string
|
|
145
|
-
doc.load(() => {
|
|
146
|
-
const parser = new DOMParser();
|
|
147
|
-
const dom = parser.parseFromString(htmlString.trim(), 'text/html');
|
|
148
|
-
const root = dom.body.firstElementChild;
|
|
149
|
-
if (!root) {
|
|
150
|
-
throw new Error('Template must contain a root element');
|
|
151
|
-
}
|
|
152
|
-
// Create a root block if needed
|
|
153
|
-
const flavour = tagToFlavour[root.tagName.toLowerCase()];
|
|
154
|
-
if (flavour === 'affine:paragraph' ||
|
|
155
|
-
flavour === 'affine:list' ||
|
|
156
|
-
flavour === 'affine:code') {
|
|
157
|
-
const pageId = store.addBlock('affine:page', {});
|
|
158
|
-
const noteId = store.addBlock('affine:note', {}, pageId);
|
|
159
|
-
blockId = buildDocFromElement(store, root, noteId, selectionInfo);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
blockId = buildDocFromElement(store, root, null, selectionInfo);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
// Return the created block
|
|
166
|
-
return blockId ? (store.getBlock(blockId) ?? null) : null;
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
affine,
|
|
170
|
-
block,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
export const { affine, block } = createAffineTemplate();
|
|
174
|
-
/**
|
|
175
|
-
* Recursively build document structure
|
|
176
|
-
* @param doc
|
|
177
|
-
* @param element
|
|
178
|
-
* @param parentId
|
|
179
|
-
* @param selectionInfo
|
|
180
|
-
* @returns
|
|
181
|
-
*/
|
|
182
|
-
function buildDocFromElement(doc, element, parentId, selectionInfo) {
|
|
183
|
-
const tagName = element.tagName.toLowerCase();
|
|
184
|
-
// Handle selection tags
|
|
185
|
-
if (tagName === 'anchor') {
|
|
186
|
-
if (!parentId)
|
|
187
|
-
return '';
|
|
188
|
-
const parentBlock = doc.getBlock(parentId);
|
|
189
|
-
if (parentBlock) {
|
|
190
|
-
const textBeforeCursor = element.previousSibling?.textContent ?? '';
|
|
191
|
-
selectionInfo.anchorBlockId = parentId;
|
|
192
|
-
selectionInfo.anchorOffset = textBeforeCursor.length;
|
|
193
|
-
}
|
|
194
|
-
return parentId;
|
|
195
|
-
}
|
|
196
|
-
else if (tagName === 'focus') {
|
|
197
|
-
if (!parentId)
|
|
198
|
-
return '';
|
|
199
|
-
const parentBlock = doc.getBlock(parentId);
|
|
200
|
-
if (parentBlock) {
|
|
201
|
-
const textBeforeCursor = element.previousSibling?.textContent ?? '';
|
|
202
|
-
selectionInfo.focusBlockId = parentId;
|
|
203
|
-
selectionInfo.focusOffset = textBeforeCursor.length;
|
|
204
|
-
}
|
|
205
|
-
return parentId;
|
|
206
|
-
}
|
|
207
|
-
else if (tagName === 'cursor') {
|
|
208
|
-
if (!parentId)
|
|
209
|
-
return '';
|
|
210
|
-
const parentBlock = doc.getBlock(parentId);
|
|
211
|
-
if (parentBlock) {
|
|
212
|
-
const textBeforeCursor = element.previousSibling?.textContent ?? '';
|
|
213
|
-
selectionInfo.cursorBlockId = parentId;
|
|
214
|
-
selectionInfo.cursorOffset = textBeforeCursor.length;
|
|
215
|
-
}
|
|
216
|
-
return parentId;
|
|
217
|
-
}
|
|
218
|
-
const flavour = tagToFlavour[tagName];
|
|
219
|
-
if (!flavour) {
|
|
220
|
-
throw new Error(`Unknown tag name: ${tagName}`);
|
|
221
|
-
}
|
|
222
|
-
const props = {};
|
|
223
|
-
const customId = element.getAttribute('id');
|
|
224
|
-
// If ID is specified, add it to props
|
|
225
|
-
if (customId) {
|
|
226
|
-
props.id = customId;
|
|
227
|
-
}
|
|
228
|
-
// Process element attributes
|
|
229
|
-
Array.from(element.attributes).forEach(attr => {
|
|
230
|
-
if (attr.name !== 'id') {
|
|
231
|
-
// Skip id attribute, we already handled it
|
|
232
|
-
props[attr.name] = attr.value;
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
// Special handling for different block types based on their flavours
|
|
236
|
-
switch (flavour) {
|
|
237
|
-
case 'affine:paragraph':
|
|
238
|
-
case 'affine:list':
|
|
239
|
-
if (element.textContent) {
|
|
240
|
-
props.text = new Text(element.textContent);
|
|
241
|
-
}
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
// Create block
|
|
245
|
-
const blockId = doc.addBlock(flavour, props, parentId);
|
|
246
|
-
// Process all child nodes, including text nodes
|
|
247
|
-
Array.from(element.children).forEach(child => {
|
|
248
|
-
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
249
|
-
// Handle element nodes
|
|
250
|
-
buildDocFromElement(doc, child, blockId, selectionInfo);
|
|
251
|
-
}
|
|
252
|
-
else if (child.nodeType === Node.TEXT_NODE) {
|
|
253
|
-
// Handle text nodes
|
|
254
|
-
console.log('buildDocFromElement text node:', child.textContent);
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
return blockId;
|
|
258
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { expect } from 'vitest';
|
|
2
|
-
const COMPARE_PROPERTIES = new Set(['id']);
|
|
3
|
-
function blockToTemplate(block, indent = '') {
|
|
4
|
-
const props = Object.entries(block.props)
|
|
5
|
-
.filter(([key]) => COMPARE_PROPERTIES.has(key))
|
|
6
|
-
.map(([key, value]) => `${key}="${value}"`)
|
|
7
|
-
.join(' ');
|
|
8
|
-
const text = block.text ? block.text.toString() : '';
|
|
9
|
-
const children = block.children
|
|
10
|
-
.map(child => blockToTemplate(child, indent + ' '))
|
|
11
|
-
.join('\n');
|
|
12
|
-
const tagName = `affine-${block.flavour}`;
|
|
13
|
-
const propsStr = props ? ` ${props}` : '';
|
|
14
|
-
const content = text
|
|
15
|
-
? `>${text}</${tagName}>`
|
|
16
|
-
: children
|
|
17
|
-
? `>\n${children}\n${indent}</${tagName}>`
|
|
18
|
-
: `></${tagName}>`;
|
|
19
|
-
return `${indent}<${tagName}${propsStr}${content}`;
|
|
20
|
-
}
|
|
21
|
-
function docToTemplate(doc) {
|
|
22
|
-
if (!doc.root)
|
|
23
|
-
return 'null';
|
|
24
|
-
const rootBlock = doc.getBlock(doc.root.id);
|
|
25
|
-
if (!rootBlock)
|
|
26
|
-
return 'null';
|
|
27
|
-
return blockToTemplate(rootBlock.model);
|
|
28
|
-
}
|
|
29
|
-
function compareBlocks(actual, expected, compareId = false) {
|
|
30
|
-
if (actual.flavour !== expected.flavour)
|
|
31
|
-
return false;
|
|
32
|
-
if (compareId && actual.id !== expected.id)
|
|
33
|
-
return false;
|
|
34
|
-
if (actual.children.length !== expected.children.length)
|
|
35
|
-
return false;
|
|
36
|
-
const actualText = actual.text;
|
|
37
|
-
const expectedText = expected.text;
|
|
38
|
-
if (actualText &&
|
|
39
|
-
expectedText &&
|
|
40
|
-
actualText.toString() !== expectedText.toString()) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
const actualProps = { ...actual.props };
|
|
44
|
-
const expectedProps = { ...expected.props };
|
|
45
|
-
if (JSON.stringify(actualProps) !== JSON.stringify(expectedProps))
|
|
46
|
-
return false;
|
|
47
|
-
for (const [i, child] of actual.children.entries()) {
|
|
48
|
-
if (!compareBlocks(child, expected.children[i], compareId))
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
function compareDocs(actual, expected, compareId = false) {
|
|
54
|
-
if (!actual.root || !expected.root)
|
|
55
|
-
return false;
|
|
56
|
-
const actualRoot = actual.getBlock(actual.root.id);
|
|
57
|
-
const expectedRoot = expected.getBlock(expected.root.id);
|
|
58
|
-
if (!actualRoot || !expectedRoot)
|
|
59
|
-
return false;
|
|
60
|
-
return compareBlocks(actualRoot.model, expectedRoot.model, compareId);
|
|
61
|
-
}
|
|
62
|
-
expect.extend({
|
|
63
|
-
toEqualDoc(received, expected, options = { compareId: false }) {
|
|
64
|
-
const compareId = options.compareId;
|
|
65
|
-
const pass = compareDocs(received, expected, compareId);
|
|
66
|
-
if (pass) {
|
|
67
|
-
return {
|
|
68
|
-
message: () => 'expected documents to be different',
|
|
69
|
-
pass: true,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
const actualTemplate = docToTemplate(received);
|
|
74
|
-
const expectedTemplate = docToTemplate(expected);
|
|
75
|
-
return {
|
|
76
|
-
message: () => `Documents are not equal.\n\nActual:\n${actualTemplate}\n\nExpected:\n${expectedTemplate}`,
|
|
77
|
-
pass: false,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
});
|