@formicoidea/labre-core 0.43.1 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_pkgs/affine-block-attachment/utils.js +4 -0
- package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +17 -4
- package/dist/_pkgs/affine-block-callout/commands/turn-callout-into.d.ts +43 -0
- package/dist/_pkgs/affine-block-callout/commands/turn-callout-into.js +109 -0
- package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.d.ts +29 -0
- package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.js +81 -0
- package/dist/_pkgs/affine-block-callout/configs/slash-menu.js +6 -4
- package/dist/_pkgs/affine-block-callout/configs/toolbar.d.ts +65 -0
- package/dist/_pkgs/affine-block-callout/configs/toolbar.js +178 -0
- package/dist/_pkgs/affine-block-callout/configs/turn-into.d.ts +8 -0
- package/dist/_pkgs/affine-block-callout/configs/turn-into.js +19 -0
- package/dist/_pkgs/affine-block-callout/translations.d.ts +4 -2
- package/dist/_pkgs/affine-block-callout/translations.js +4 -2
- package/dist/_pkgs/affine-block-callout/view.js +10 -1
- package/dist/_pkgs/affine-block-code/code-block-service.d.ts +13 -0
- package/dist/_pkgs/affine-block-code/code-block-service.js +26 -0
- package/dist/_pkgs/affine-block-code/code-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-code/code-block.js +11 -2
- package/dist/_pkgs/affine-block-code/code-toolbar/components/lang-button.js +31 -8
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.d.ts +11 -0
- package/dist/_pkgs/affine-block-edgeless-text/svg-painter.d.ts +20 -0
- package/dist/_pkgs/affine-block-edgeless-text/svg-painter.js +76 -0
- package/dist/_pkgs/affine-block-edgeless-text/view.js +2 -0
- package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-edgeless-linked-doc-block.js +3 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +7 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-edgeless-synced-doc-block.js +3 -1
- package/dist/_pkgs/affine-block-frame/commands.d.ts +27 -0
- package/dist/_pkgs/affine-block-frame/commands.js +49 -0
- package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +16 -6
- package/dist/_pkgs/affine-block-frame/frame-manager.js +58 -22
- package/dist/_pkgs/affine-block-frame/frame-order.d.ts +43 -0
- package/dist/_pkgs/affine-block-frame/frame-order.js +93 -0
- package/dist/_pkgs/affine-block-frame/frame-tool.js +3 -1
- package/dist/_pkgs/affine-block-frame/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-frame/index.js +2 -0
- package/dist/_pkgs/affine-block-frame/present/frame-order-menu.d.ts +10 -2
- package/dist/_pkgs/affine-block-frame/present/frame-order-menu.js +32 -18
- package/dist/_pkgs/affine-block-frame/view.js +6 -0
- package/dist/_pkgs/affine-block-image/utils.js +4 -1
- package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.d.ts +8 -0
- package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.js +9 -5
- package/dist/_pkgs/affine-block-note/configs/toolbar.d.ts +19 -0
- package/dist/_pkgs/affine-block-note/configs/toolbar.js +38 -23
- package/dist/_pkgs/affine-block-note/translations.d.ts +2 -1
- package/dist/_pkgs/affine-block-note/translations.js +14 -6
- package/dist/_pkgs/affine-block-root/configs/toolbar.js +48 -3
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/clipboard.js +2 -1
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/command.js +161 -83
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.d.ts +21 -0
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.js +85 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +18 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +9 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +28 -0
- package/dist/_pkgs/affine-block-root/keyboard/commands.js +9 -6
- package/dist/_pkgs/affine-block-root/preview/edgeless-root-preview-block.js +15 -2
- package/dist/_pkgs/affine-block-root/translations.d.ts +7 -2
- package/dist/_pkgs/affine-block-root/translations.js +10 -13
- package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.d.ts +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/audit.js +13 -61
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.js +71 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/clipboard-config.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +27 -7
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +2 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +22 -3
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +6 -3
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +4 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.d.ts +63 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.js +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +62 -5
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +98 -18
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +14 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +82 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +112 -10
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.d.ts +13 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.js +33 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +13 -6
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +26 -10
- package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +82 -6
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +99 -21
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.d.ts +91 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.js +285 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.d.ts +80 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.js +355 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.d.ts +137 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.js +323 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +112 -4
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +86 -15
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.d.ts +76 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.js +299 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.d.ts +20 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.js +34 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.d.ts +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.js +172 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.d.ts +40 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.js +69 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.d.ts +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.js +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.d.ts +10 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.js +14 -0
- package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +55 -2
- package/dist/_pkgs/affine-block-surface/framework-background/facts.js +63 -1
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +16 -8
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +26 -14
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +17 -3
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.d.ts +3 -1
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +22 -2
- package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.d.ts +30 -0
- package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.js +29 -0
- package/dist/_pkgs/affine-block-surface/surface-block.js +6 -0
- package/dist/_pkgs/affine-block-surface/surface-model.js +5 -0
- package/dist/_pkgs/affine-block-surface/surface-transformer.js +5 -0
- package/dist/_pkgs/affine-block-surface/tool/default-tool.js +28 -5
- package/dist/_pkgs/affine-block-surface/view.js +23 -1
- package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
- package/dist/_pkgs/affine-components/context-menu/button.js +14 -0
- package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
- package/dist/_pkgs/affine-components/icons/index.d.ts +0 -1
- package/dist/_pkgs/affine-components/icons/index.js +0 -1
- package/dist/_pkgs/affine-components/icons/text.d.ts +1 -0
- package/dist/_pkgs/affine-components/icons/text.js +11 -0
- package/dist/_pkgs/affine-components/portal/portal.d.ts +1 -1
- package/dist/_pkgs/affine-foundation/view.d.ts +8 -8
- package/dist/_pkgs/affine-fragment-adapter-panel/adapter-panel.d.ts +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.d.ts +34 -2
- package/dist/_pkgs/affine-fragment-frame-panel/body/frame-panel-body.js +194 -81
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.d.ts +7 -4
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +9 -24
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.d.ts +1 -1
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +8 -27
- package/dist/_pkgs/affine-fragment-frame-panel/index.d.ts +2 -0
- package/dist/_pkgs/affine-fragment-frame-panel/index.js +2 -0
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +3 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +21 -4
- package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +3 -2
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-gfx-group/command/group-api.js +52 -1
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +21 -3
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +2 -0
- package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-gfx-template/services/template-middlewares.d.ts +9 -0
- package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +23 -1
- package/dist/_pkgs/affine-gfx-template/services/template.js +2 -1
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +2 -1
- package/dist/_pkgs/affine-gfx-text/element-renderer/index.js +20 -3
- package/dist/_pkgs/affine-gfx-text/element-renderer/utils.d.ts +67 -1
- package/dist/_pkgs/affine-gfx-text/element-renderer/utils.js +101 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +53 -2
- package/dist/_pkgs/affine-gfx-text/toolbar/config.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +31 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.d.ts +4 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.js +14 -0
- package/dist/_pkgs/affine-inline-preset/command/config.js +21 -3
- package/dist/_pkgs/affine-inline-preset/command/index.d.ts +1 -1
- package/dist/_pkgs/affine-inline-preset/command/index.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/text-style.d.ts +2 -1
- package/dist/_pkgs/affine-inline-preset/command/text-style.js +1 -0
- package/dist/_pkgs/affine-inline-preset/default-inline-manager.js +2 -1
- package/dist/_pkgs/affine-inline-preset/inline-spec.d.ts +4 -0
- package/dist/_pkgs/affine-inline-preset/inline-spec.js +14 -0
- package/dist/_pkgs/affine-inline-preset/translations.d.ts +2 -2
- package/dist/_pkgs/affine-inline-preset/translations.js +2 -2
- package/dist/_pkgs/affine-model/blocks/attachment/attachment-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/bookmark/bookmark-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.d.ts +1 -1
- package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/embed/iframe/iframe-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/frame/frame-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/latex/latex-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/note/note-model.js +2 -0
- package/dist/_pkgs/affine-model/consts/text.d.ts +26 -0
- package/dist/_pkgs/affine-model/consts/text.js +25 -0
- package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +6 -1
- package/dist/_pkgs/affine-model/elements/shape/shape.js +14 -1
- package/dist/_pkgs/affine-model/elements/text/text.d.ts +6 -1
- package/dist/_pkgs/affine-model/elements/text/text.js +13 -1
- package/dist/_pkgs/affine-model/utils/helper.js +2 -0
- package/dist/_pkgs/affine-model/utils/types.d.ts +2 -2
- package/dist/_pkgs/affine-rich-text/conversion.d.ts +25 -0
- package/dist/_pkgs/affine-rich-text/conversion.js +9 -0
- package/dist/_pkgs/affine-rich-text/index.d.ts +1 -1
- package/dist/_pkgs/affine-rich-text/index.js +1 -1
- package/dist/_pkgs/affine-shared/commands/model-crud/replace-selected-text-with-blocks.d.ts +1 -1
- package/dist/_pkgs/affine-shared/services/canvas-grid.d.ts +63 -0
- package/dist/_pkgs/affine-shared/services/canvas-grid.js +109 -0
- package/dist/_pkgs/affine-shared/services/canvas-local-visibility.d.ts +64 -0
- package/dist/_pkgs/affine-shared/services/canvas-local-visibility.js +192 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +31 -4
- package/dist/_pkgs/affine-shared/services/edit-props-store.js +34 -0
- package/dist/_pkgs/affine-shared/services/editor-setting-service.d.ts +3 -0
- package/dist/_pkgs/affine-shared/services/editor-setting-service.js +7 -0
- package/dist/_pkgs/affine-shared/services/feature-flag-service.d.ts +4 -0
- package/dist/_pkgs/affine-shared/services/font-loader/config.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/font-loader/font-loader-service.d.ts +3 -3
- package/dist/_pkgs/affine-shared/services/index.d.ts +4 -1
- package/dist/_pkgs/affine-shared/services/index.js +4 -1
- package/dist/_pkgs/affine-shared/services/link-preview-service/link-preview-storage.d.ts +4 -4
- package/dist/_pkgs/affine-shared/services/outline-panel-service.d.ts +31 -0
- package/dist/_pkgs/affine-shared/services/outline-panel-service.js +17 -0
- package/dist/_pkgs/affine-shared/services/selection-pane-service.d.ts +44 -0
- package/dist/_pkgs/affine-shared/services/selection-pane-service.js +28 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +69 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +16 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +28 -0
- package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/styles/index.js +1 -0
- package/dist/_pkgs/affine-shared/styles/panel-header.d.ts +31 -0
- package/dist/_pkgs/affine-shared/styles/panel-header.js +61 -0
- package/dist/_pkgs/affine-shared/styles/text.js +7 -7
- package/dist/_pkgs/affine-shared/types/index.d.ts +6 -0
- package/dist/_pkgs/affine-shared/utils/canvas-export-colors.d.ts +26 -0
- package/dist/_pkgs/affine-shared/utils/canvas-export-colors.js +127 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +8 -11
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +8 -11
- package/dist/_pkgs/affine-shared/utils/index.d.ts +3 -0
- package/dist/_pkgs/affine-shared/utils/index.js +3 -0
- package/dist/_pkgs/affine-shared/utils/label-mode.d.ts +47 -0
- package/dist/_pkgs/affine-shared/utils/label-mode.js +55 -0
- package/dist/_pkgs/affine-shared/utils/model/merge-to-code-model.js +7 -1
- package/dist/_pkgs/affine-shared/utils/model/transform-model.js +5 -0
- package/dist/_pkgs/affine-shared/utils/panel-reorder-drag.d.ts +85 -0
- package/dist/_pkgs/affine-shared/utils/panel-reorder-drag.js +162 -0
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +10 -3
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.d.ts +62 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.js +94 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.d.ts +17 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.js +95 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.d.ts +10 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.js +31 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.d.ts +26 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.js +82 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.d.ts +186 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.js +1417 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +52 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +161 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
- package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
- package/dist/_pkgs/std/gfx/controller.d.ts +13 -0
- package/dist/_pkgs/std/gfx/controller.js +22 -2
- package/dist/_pkgs/std/gfx/grid.d.ts +31 -2
- package/dist/_pkgs/std/gfx/index.d.ts +3 -1
- package/dist/_pkgs/std/gfx/index.js +3 -1
- package/dist/_pkgs/std/gfx/interactivity/manager.js +7 -0
- package/dist/_pkgs/std/gfx/layer.js +73 -5
- package/dist/_pkgs/std/gfx/local-visibility.d.ts +88 -0
- package/dist/_pkgs/std/gfx/local-visibility.js +217 -0
- package/dist/_pkgs/std/gfx/model/gfx-block-model.d.ts +13 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +34 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +65 -1
- package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +27 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +43 -0
- package/dist/_pkgs/std/gfx/model/surface/user-layers.d.ts +68 -0
- package/dist/_pkgs/std/gfx/model/surface/user-layers.js +127 -0
- package/dist/_pkgs/std/scope/std-scope.d.ts +1 -1
- package/dist/_pkgs/std/utils/layer.d.ts +10 -0
- package/dist/_pkgs/std/utils/layer.js +64 -13
- package/dist/_pkgs/std/view/element/gfx-block-component.js +10 -2
- package/dist/commands.js +6 -1
- package/dist/host-panels.d.ts +90 -0
- package/dist/host-panels.js +111 -0
- package/dist/translations.js +10 -6
- package/package.json +13 -2
- package/dist/_pkgs/affine-components/icons/file-icons-rc.d.ts +0 -1
- package/dist/_pkgs/affine-components/icons/file-icons-rc.js +0 -130
- package/dist/_pkgs/affine-fragment-frame-panel/utils/drag.d.ts +0 -27
- package/dist/_pkgs/affine-fragment-frame-panel/utils/drag.js +0 -96
- package/dist/_pkgs/affine-shared/services/sidebar-service.d.ts +0 -8
- package/dist/_pkgs/affine-shared/services/sidebar-service.js +0 -7
- package/dist/_pkgs/affine-shared/test-utils/affine-template.d.ts +0 -6
- package/dist/_pkgs/affine-shared/test-utils/affine-template.js +0 -258
- package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.d.ts +0 -8
- package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.js +0 -81
- package/dist/_pkgs/affine-shared/test-utils/create-test-host.d.ts +0 -23
- package/dist/_pkgs/affine-shared/test-utils/create-test-host.js +0 -187
- package/dist/_pkgs/affine-shared/test-utils/index.d.ts +0 -3
- package/dist/_pkgs/affine-shared/test-utils/index.js +0 -3
|
@@ -90,6 +90,22 @@ const isUnderlineElement = (ast) => {
|
|
|
90
90
|
const isUnderlineStyle = /text-decoration:\s*underline/.test(style);
|
|
91
91
|
return isUnderlineTag || isUnderlineStyle;
|
|
92
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* Check if the element is an overline element through its style — HTML has
|
|
95
|
+
* no overline tag, so `text-decoration: overline;` is the only spelling, and
|
|
96
|
+
* the one the HTML export writes (ADR 0030 §5).
|
|
97
|
+
* @example
|
|
98
|
+
* ```html
|
|
99
|
+
* <span style="text-decoration: overline;">Hello</span>
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
const isOverlineElement = (ast) => {
|
|
103
|
+
if (!isElement(ast)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
const style = typeof ast.properties.style === 'string' ? ast.properties.style : '';
|
|
107
|
+
return /text-decoration:\s*overline/.test(style);
|
|
108
|
+
};
|
|
93
109
|
/**
|
|
94
110
|
* Check if the element is a line-through element through style or tag
|
|
95
111
|
* If the element tag is <del> or the style is `text-decoration: line-through;`,
|
|
@@ -124,6 +140,7 @@ const isTextLikeElement = (ast) => {
|
|
|
124
140
|
!isStrongElement(ast) &&
|
|
125
141
|
!isItalicElement(ast) &&
|
|
126
142
|
!isUnderlineElement(ast) &&
|
|
143
|
+
!isOverlineElement(ast) &&
|
|
127
144
|
!isLineThroughElement(ast));
|
|
128
145
|
};
|
|
129
146
|
export const htmlTextToDeltaMatcher = HtmlASTToDeltaExtension({
|
|
@@ -256,6 +273,19 @@ export const htmlUnderlineElementToDeltaMatcher = HtmlASTToDeltaExtension({
|
|
|
256
273
|
}));
|
|
257
274
|
},
|
|
258
275
|
});
|
|
276
|
+
export const htmlOverlineElementToDeltaMatcher = HtmlASTToDeltaExtension({
|
|
277
|
+
name: 'overline-element',
|
|
278
|
+
match: ast => isOverlineElement(ast),
|
|
279
|
+
toDelta: (ast, context) => {
|
|
280
|
+
if (!isElement(ast)) {
|
|
281
|
+
return [];
|
|
282
|
+
}
|
|
283
|
+
return ast.children.flatMap(child => context.toDelta(child, { trim: false }).map(delta => {
|
|
284
|
+
delta.attributes = { ...delta.attributes, overline: true };
|
|
285
|
+
return delta;
|
|
286
|
+
}));
|
|
287
|
+
},
|
|
288
|
+
});
|
|
259
289
|
export const htmlMarkElementToDeltaMatcher = HtmlASTToDeltaExtension({
|
|
260
290
|
name: 'mark-element',
|
|
261
291
|
match: ast => isElement(ast) && ast.tagName === 'mark',
|
|
@@ -285,6 +315,7 @@ export const HtmlInlineToDeltaAdapterExtensions = [
|
|
|
285
315
|
htmlCodeElementToDeltaMatcher,
|
|
286
316
|
htmlDelElementToDeltaMatcher,
|
|
287
317
|
htmlUnderlineElementToDeltaMatcher,
|
|
318
|
+
htmlOverlineElementToDeltaMatcher,
|
|
288
319
|
htmlMarkElementToDeltaMatcher,
|
|
289
320
|
htmlBrElementToDeltaMatcher,
|
|
290
321
|
];
|
|
@@ -13,6 +13,10 @@ export declare const inlineCodeDeltaToHtmlAdapterMatcher: import("../../../store
|
|
|
13
13
|
export declare const underlineDeltaToHtmlAdapterMatcher: import("../../../store/index.js").ExtensionType & {
|
|
14
14
|
identifier: import("../../../global/di/types.js").ServiceIdentifier<import("../../../affine-shared/adapters/index.js").InlineDeltaToHtmlAdapterMatcher>;
|
|
15
15
|
};
|
|
16
|
+
/** HTML has no overline tag: a span carries it as CSS (ADR 0030 §5). */
|
|
17
|
+
export declare const overlineDeltaToHtmlAdapterMatcher: import("../../../store/index.js").ExtensionType & {
|
|
18
|
+
identifier: import("../../../global/di/types.js").ServiceIdentifier<import("../../../affine-shared/adapters/index.js").InlineDeltaToHtmlAdapterMatcher>;
|
|
19
|
+
};
|
|
16
20
|
export declare const highlightBackgroundDeltaToHtmlAdapterMatcher: import("../../../store/index.js").ExtensionType & {
|
|
17
21
|
identifier: import("../../../global/di/types.js").ServiceIdentifier<import("../../../affine-shared/adapters/index.js").InlineDeltaToHtmlAdapterMatcher>;
|
|
18
22
|
};
|
|
@@ -60,6 +60,19 @@ export const underlineDeltaToHtmlAdapterMatcher = InlineDeltaToHtmlAdapterExtens
|
|
|
60
60
|
};
|
|
61
61
|
},
|
|
62
62
|
});
|
|
63
|
+
/** HTML has no overline tag: a span carries it as CSS (ADR 0030 §5). */
|
|
64
|
+
export const overlineDeltaToHtmlAdapterMatcher = InlineDeltaToHtmlAdapterExtension({
|
|
65
|
+
name: 'overline',
|
|
66
|
+
match: delta => !!delta.attributes?.overline,
|
|
67
|
+
toAST: (_, context) => {
|
|
68
|
+
return {
|
|
69
|
+
type: 'element',
|
|
70
|
+
tagName: 'span',
|
|
71
|
+
properties: { style: 'text-decoration: overline;' },
|
|
72
|
+
children: [context.current],
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
});
|
|
63
76
|
export const highlightBackgroundDeltaToHtmlAdapterMatcher = InlineDeltaToHtmlAdapterExtension({
|
|
64
77
|
name: 'highlight-background',
|
|
65
78
|
match: delta => !!delta.attributes?.background,
|
|
@@ -123,6 +136,7 @@ export const InlineDeltaToHtmlAdapterExtensions = [
|
|
|
123
136
|
italicDeltaToHtmlAdapterMatcher,
|
|
124
137
|
strikeDeltaToHtmlAdapterMatcher,
|
|
125
138
|
underlineDeltaToHtmlAdapterMatcher,
|
|
139
|
+
overlineDeltaToHtmlAdapterMatcher,
|
|
126
140
|
highlightBackgroundDeltaToHtmlAdapterMatcher,
|
|
127
141
|
highlightColorDeltaToHtmlAdapterMatcher,
|
|
128
142
|
inlineCodeDeltaToHtmlAdapterMatcher,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BoldIcon, CodeIcon, ItalicIcon, LinkIcon, StrikethroughIcon, UnderlineIcon, } from '../../affine-components/icons/index.js';
|
|
1
|
+
import { BoldIcon, CodeIcon, ItalicIcon, LinkIcon, OverlineIcon, StrikethroughIcon, UnderlineIcon, } from '../../affine-components/icons/index.js';
|
|
2
2
|
import { toggleLink } from '../../affine-inline-link/index.js';
|
|
3
3
|
import {} from '../../affine-shared/services/index.js';
|
|
4
4
|
import { TextSelection } from '../../std/index.js';
|
|
5
|
-
import { isTextAttributeActive, toggleBold, toggleCode, toggleItalic, toggleStrike, toggleUnderline, } from './text-style.js';
|
|
6
|
-
import { TEXT_FORMAT_BOLD, TEXT_FORMAT_CODE, TEXT_FORMAT_ITALIC, TEXT_FORMAT_LINK, TEXT_FORMAT_STRIKETHROUGH, TEXT_FORMAT_UNDERLINE, } from '../translations.js';
|
|
5
|
+
import { isTextAttributeActive, toggleBold, toggleCode, toggleItalic, toggleOverline, toggleStrike, toggleUnderline, } from './text-style.js';
|
|
6
|
+
import { TEXT_FORMAT_BOLD, TEXT_FORMAT_CODE, TEXT_FORMAT_ITALIC, TEXT_FORMAT_LINK, TEXT_FORMAT_OVERLINE, TEXT_FORMAT_STRIKETHROUGH, TEXT_FORMAT_UNDERLINE, } from '../translations.js';
|
|
7
7
|
export const textFormatConfigs = [
|
|
8
8
|
{
|
|
9
9
|
id: 'bold',
|
|
@@ -56,6 +56,24 @@ export const textFormatConfigs = [
|
|
|
56
56
|
host.std.command.chain().pipe(toggleUnderline).run();
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
|
+
{
|
|
60
|
+
// No default chord: `Mod-u` is underline's and none is free everywhere;
|
|
61
|
+
// a host binds one through the shortcuts pane (ADR 0030 §5).
|
|
62
|
+
id: 'overline',
|
|
63
|
+
name: 'Overline',
|
|
64
|
+
nameWording: TEXT_FORMAT_OVERLINE,
|
|
65
|
+
icon: OverlineIcon,
|
|
66
|
+
activeWhen: host => {
|
|
67
|
+
const [result] = host.std.command
|
|
68
|
+
.chain()
|
|
69
|
+
.pipe(isTextAttributeActive, { key: 'overline' })
|
|
70
|
+
.run();
|
|
71
|
+
return result;
|
|
72
|
+
},
|
|
73
|
+
action: host => {
|
|
74
|
+
host.std.command.chain().pipe(toggleOverline).run();
|
|
75
|
+
},
|
|
76
|
+
},
|
|
59
77
|
{
|
|
60
78
|
id: 'strike',
|
|
61
79
|
name: 'Strikethrough',
|
|
@@ -5,5 +5,5 @@ export { deleteTextCommand } from './delete-text.js';
|
|
|
5
5
|
export { formatBlockCommand } from './format-block.js';
|
|
6
6
|
export { formatNativeCommand } from './format-native.js';
|
|
7
7
|
export { formatTextCommand } from './format-text.js';
|
|
8
|
-
export { getTextAttributes, isTextAttributeActive, toggleBold, toggleCode, toggleItalic, toggleStrike, toggleTextStyleCommand, toggleUnderline, } from './text-style.js';
|
|
8
|
+
export { getTextAttributes, isTextAttributeActive, toggleBold, toggleCode, toggleItalic, toggleOverline, toggleStrike, toggleTextStyleCommand, toggleUnderline, } from './text-style.js';
|
|
9
9
|
export { isFormatSupported } from './utils.js';
|
|
@@ -4,5 +4,5 @@ export { deleteTextCommand } from './delete-text.js';
|
|
|
4
4
|
export { formatBlockCommand } from './format-block.js';
|
|
5
5
|
export { formatNativeCommand } from './format-native.js';
|
|
6
6
|
export { formatTextCommand } from './format-text.js';
|
|
7
|
-
export { getTextAttributes, isTextAttributeActive, toggleBold, toggleCode, toggleItalic, toggleStrike, toggleTextStyleCommand, toggleUnderline, } from './text-style.js';
|
|
7
|
+
export { getTextAttributes, isTextAttributeActive, toggleBold, toggleCode, toggleItalic, toggleOverline, toggleStrike, toggleTextStyleCommand, toggleUnderline, } from './text-style.js';
|
|
8
8
|
export { isFormatSupported } from './utils.js';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { AffineTextAttributes, AffineTextStyleAttributes } from '../../affine-shared/types/index.js';
|
|
2
2
|
import type { Command } from '../../std/index.js';
|
|
3
3
|
export declare const toggleTextStyleCommand: Command<{
|
|
4
|
-
key: Extract<keyof AffineTextStyleAttributes, 'bold' | 'italic' | 'underline' | 'strike' | 'code'>;
|
|
4
|
+
key: Extract<keyof AffineTextStyleAttributes, 'bold' | 'italic' | 'underline' | 'overline' | 'strike' | 'code'>;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const toggleBold: Command;
|
|
7
7
|
export declare const toggleItalic: Command;
|
|
8
8
|
export declare const toggleUnderline: Command;
|
|
9
|
+
export declare const toggleOverline: Command;
|
|
9
10
|
export declare const toggleStrike: Command;
|
|
10
11
|
export declare const toggleCode: Command;
|
|
11
12
|
export declare const getTextAttributes: Command<{}, {
|
|
@@ -41,6 +41,7 @@ const toggleTextStyleCommandWrapper = (key) => {
|
|
|
41
41
|
export const toggleBold = toggleTextStyleCommandWrapper('bold');
|
|
42
42
|
export const toggleItalic = toggleTextStyleCommandWrapper('italic');
|
|
43
43
|
export const toggleUnderline = toggleTextStyleCommandWrapper('underline');
|
|
44
|
+
export const toggleOverline = toggleTextStyleCommandWrapper('overline');
|
|
44
45
|
export const toggleStrike = toggleTextStyleCommandWrapper('strike');
|
|
45
46
|
export const toggleCode = toggleTextStyleCommandWrapper('code');
|
|
46
47
|
export const getTextAttributes = (ctx, next) => {
|
|
@@ -5,13 +5,14 @@ import { LinkInlineSpecExtension } from '../affine-inline-link/index.js';
|
|
|
5
5
|
import { MentionInlineSpecExtension } from '../affine-inline-mention/index.js';
|
|
6
6
|
import { ReferenceInlineSpecExtension } from '../affine-inline-reference/index.js';
|
|
7
7
|
import { InlineManagerExtension } from '../std/inline/index.js';
|
|
8
|
-
import { BackgroundInlineSpecExtension, BoldInlineSpecExtension, CodeInlineSpecExtension, ColorInlineSpecExtension, ItalicInlineSpecExtension, StrikeInlineSpecExtension, UnderlineInlineSpecExtension, } from './inline-spec.js';
|
|
8
|
+
import { BackgroundInlineSpecExtension, BoldInlineSpecExtension, CodeInlineSpecExtension, ColorInlineSpecExtension, ItalicInlineSpecExtension, OverlineInlineSpecExtension, StrikeInlineSpecExtension, UnderlineInlineSpecExtension, } from './inline-spec.js';
|
|
9
9
|
export const DefaultInlineManagerExtension = InlineManagerExtension({
|
|
10
10
|
id: 'DefaultInlineManager',
|
|
11
11
|
specs: [
|
|
12
12
|
BoldInlineSpecExtension.identifier,
|
|
13
13
|
ItalicInlineSpecExtension.identifier,
|
|
14
14
|
UnderlineInlineSpecExtension.identifier,
|
|
15
|
+
OverlineInlineSpecExtension.identifier,
|
|
15
16
|
StrikeInlineSpecExtension.identifier,
|
|
16
17
|
CodeInlineSpecExtension.identifier,
|
|
17
18
|
BackgroundInlineSpecExtension.identifier,
|
|
@@ -11,6 +11,10 @@ export declare const ItalicInlineSpecExtension: ExtensionType & {
|
|
|
11
11
|
export declare const UnderlineInlineSpecExtension: ExtensionType & {
|
|
12
12
|
identifier: import("../global/di/types.js").ServiceIdentifier<import("../std/inline/index.js").InlineSpecs<AffineTextAttributes>>;
|
|
13
13
|
};
|
|
14
|
+
/** Underline's twin, declared at the affine level only (ADR 0030 §5). */
|
|
15
|
+
export declare const OverlineInlineSpecExtension: ExtensionType & {
|
|
16
|
+
identifier: import("../global/di/types.js").ServiceIdentifier<import("../std/inline/index.js").InlineSpecs<AffineTextAttributes>>;
|
|
17
|
+
};
|
|
14
18
|
export declare const StrikeInlineSpecExtension: ExtensionType & {
|
|
15
19
|
identifier: import("../global/di/types.js").ServiceIdentifier<import("../std/inline/index.js").InlineSpecs<AffineTextAttributes>>;
|
|
16
20
|
};
|
|
@@ -37,6 +37,19 @@ export const UnderlineInlineSpecExtension = InlineSpecExtension({
|
|
|
37
37
|
return html `<affine-text .delta=${delta}></affine-text>`;
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
|
+
/** Underline's twin, declared at the affine level only (ADR 0030 §5). */
|
|
41
|
+
export const OverlineInlineSpecExtension = InlineSpecExtension({
|
|
42
|
+
name: 'overline',
|
|
43
|
+
schema: z.object({
|
|
44
|
+
overline: z.literal(true).optional().nullable().catch(undefined),
|
|
45
|
+
}),
|
|
46
|
+
match: delta => {
|
|
47
|
+
return !!delta.attributes?.overline;
|
|
48
|
+
},
|
|
49
|
+
renderer: ({ delta }) => {
|
|
50
|
+
return html `<affine-text .delta=${delta}></affine-text>`;
|
|
51
|
+
},
|
|
52
|
+
});
|
|
40
53
|
export const StrikeInlineSpecExtension = InlineSpecExtension({
|
|
41
54
|
name: 'strike',
|
|
42
55
|
schema: z.object({
|
|
@@ -89,6 +102,7 @@ export const InlineSpecExtensions = [
|
|
|
89
102
|
BoldInlineSpecExtension,
|
|
90
103
|
ItalicInlineSpecExtension,
|
|
91
104
|
UnderlineInlineSpecExtension,
|
|
105
|
+
OverlineInlineSpecExtension,
|
|
92
106
|
StrikeInlineSpecExtension,
|
|
93
107
|
CodeInlineSpecExtension,
|
|
94
108
|
BackgroundInlineSpecExtension,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChromeWording, TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_STRIKETHROUGH, TEXT_FORMAT_UNDERLINE } from '../affine-shared/services/index.js';
|
|
1
|
+
import { type ChromeWording, TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_OVERLINE, TEXT_FORMAT_STRIKETHROUGH, TEXT_FORMAT_UNDERLINE } from '../affine-shared/services/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* `@labre/affine-inline-preset`'s own wordings — `command/config.ts`'s
|
|
4
4
|
* `textFormatConfigs`. This is DATA (no `std` of its own): `name` is
|
|
@@ -14,7 +14,7 @@ import { type ChromeWording, TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_S
|
|
|
14
14
|
* re-exported here under this package's own name; only "Code" stays this
|
|
15
15
|
* format's own.
|
|
16
16
|
*/
|
|
17
|
-
export { TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_UNDERLINE, TEXT_FORMAT_STRIKETHROUGH, };
|
|
17
|
+
export { TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_UNDERLINE, TEXT_FORMAT_OVERLINE, TEXT_FORMAT_STRIKETHROUGH, };
|
|
18
18
|
export declare const TEXT_FORMAT_CODE: ChromeWording;
|
|
19
19
|
export declare const TEXT_FORMAT_LINK: ChromeWording;
|
|
20
20
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_STRIKETHROUGH, TEXT_FORMAT_UNDERLINE, TOOLBAR_LINK, } from '../affine-shared/services/index.js';
|
|
1
|
+
import { TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_OVERLINE, TEXT_FORMAT_STRIKETHROUGH, TEXT_FORMAT_UNDERLINE, TOOLBAR_LINK, } from '../affine-shared/services/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* `@labre/affine-inline-preset`'s own wordings — `command/config.ts`'s
|
|
4
4
|
* `textFormatConfigs`. This is DATA (no `std` of its own): `name` is
|
|
@@ -14,7 +14,7 @@ import { TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_STRIKETHROUGH, TEXT_F
|
|
|
14
14
|
* re-exported here under this package's own name; only "Code" stays this
|
|
15
15
|
* format's own.
|
|
16
16
|
*/
|
|
17
|
-
export { TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_UNDERLINE, TEXT_FORMAT_STRIKETHROUGH, };
|
|
17
|
+
export { TEXT_FORMAT_BOLD, TEXT_FORMAT_ITALIC, TEXT_FORMAT_UNDERLINE, TEXT_FORMAT_OVERLINE, TEXT_FORMAT_STRIKETHROUGH, };
|
|
18
18
|
export const TEXT_FORMAT_CODE = [
|
|
19
19
|
'com.labre.text-format.code',
|
|
20
20
|
'Code',
|
|
@@ -4,7 +4,7 @@ import { FontFamily, FontStyle, FontWeight, TextAlign, type TextStyleProps } fro
|
|
|
4
4
|
type EdgelessTextProps = {
|
|
5
5
|
hasMaxWidth: boolean;
|
|
6
6
|
comments?: Record<string, boolean>;
|
|
7
|
-
} & Omit<TextStyleProps, 'fontSize'> & GfxCommonBlockProps;
|
|
7
|
+
} & Omit<TextStyleProps, 'fontSize' | 'textDecoration'> & GfxCommonBlockProps;
|
|
8
8
|
export declare const EdgelessTextZodSchema: z.ZodDefault<z.ZodObject<{
|
|
9
9
|
color: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
10
10
|
normal: z.ZodString;
|
|
@@ -21,6 +21,8 @@ export const FrameBlockSchema = defineBlockSchema({
|
|
|
21
21
|
childElementIds: Object.create(null),
|
|
22
22
|
presentationIndex: generateKeyBetweenV2(null, null),
|
|
23
23
|
lockedBySelf: false,
|
|
24
|
+
hiddenForEveryone: undefined,
|
|
25
|
+
layer: undefined,
|
|
24
26
|
comments: undefined,
|
|
25
27
|
}),
|
|
26
28
|
metadata: {
|
|
@@ -36,6 +36,8 @@ export const NoteBlockSchema = defineBlockSchema({
|
|
|
36
36
|
background: DefaultTheme.noteBackgrounColor,
|
|
37
37
|
index: 'a0',
|
|
38
38
|
lockedBySelf: false,
|
|
39
|
+
hiddenForEveryone: undefined,
|
|
40
|
+
layer: undefined,
|
|
39
41
|
hidden: false,
|
|
40
42
|
displayMode: NoteDisplayMode.DocAndEdgeless,
|
|
41
43
|
edgeless: {
|
|
@@ -11,6 +11,30 @@ export declare enum TextVerticalAlign {
|
|
|
11
11
|
Center = "center",
|
|
12
12
|
Top = "top"
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* The line a canvas text is decorated with, as a CSS `text-decoration-line`
|
|
16
|
+
* token list (ADR 0030).
|
|
17
|
+
*
|
|
18
|
+
* **These string values are PERSISTED** — on a `text`, on a `shape` and inside
|
|
19
|
+
* a connector's `labelStyle` — so the enum is **append-only**: a member may be
|
|
20
|
+
* added, never renamed, never removed, never given a different string value.
|
|
21
|
+
*
|
|
22
|
+
* Readers split the value on whitespace and act on the tokens they know, never
|
|
23
|
+
* `switch` on the whole string: a token a newer client adds (`line-through`,
|
|
24
|
+
* say) is skipped by this build one token at a time, so
|
|
25
|
+
* `'underline line-through'` still paints its underline here.
|
|
26
|
+
*
|
|
27
|
+
* `undefined` (the key absent) and `None` paint the same on every element. They
|
|
28
|
+
* differ for one reader only — the UML object glyph's legacy rule, drawn for a
|
|
29
|
+
* name that never carried the field — which is why turning the decoration off
|
|
30
|
+
* writes `None` rather than clearing the key.
|
|
31
|
+
*/
|
|
32
|
+
export declare enum TextDecoration {
|
|
33
|
+
None = "none",
|
|
34
|
+
Underline = "underline",
|
|
35
|
+
Overline = "overline",
|
|
36
|
+
UnderlineOverline = "underline overline"
|
|
37
|
+
}
|
|
14
38
|
export type TextStyleProps = {
|
|
15
39
|
color: Color;
|
|
16
40
|
fontFamily: FontFamily;
|
|
@@ -18,6 +42,8 @@ export type TextStyleProps = {
|
|
|
18
42
|
fontStyle: FontStyle;
|
|
19
43
|
fontWeight: FontWeight;
|
|
20
44
|
textAlign: TextAlign;
|
|
45
|
+
/** Optional and never written by default: see {@link TextDecoration}. */
|
|
46
|
+
textDecoration?: TextDecoration;
|
|
21
47
|
};
|
|
22
48
|
export declare enum FontWeight {
|
|
23
49
|
Bold = "700",
|
|
@@ -13,6 +13,31 @@ export var TextVerticalAlign;
|
|
|
13
13
|
TextVerticalAlign["Center"] = "center";
|
|
14
14
|
TextVerticalAlign["Top"] = "top";
|
|
15
15
|
})(TextVerticalAlign || (TextVerticalAlign = {}));
|
|
16
|
+
/**
|
|
17
|
+
* The line a canvas text is decorated with, as a CSS `text-decoration-line`
|
|
18
|
+
* token list (ADR 0030).
|
|
19
|
+
*
|
|
20
|
+
* **These string values are PERSISTED** — on a `text`, on a `shape` and inside
|
|
21
|
+
* a connector's `labelStyle` — so the enum is **append-only**: a member may be
|
|
22
|
+
* added, never renamed, never removed, never given a different string value.
|
|
23
|
+
*
|
|
24
|
+
* Readers split the value on whitespace and act on the tokens they know, never
|
|
25
|
+
* `switch` on the whole string: a token a newer client adds (`line-through`,
|
|
26
|
+
* say) is skipped by this build one token at a time, so
|
|
27
|
+
* `'underline line-through'` still paints its underline here.
|
|
28
|
+
*
|
|
29
|
+
* `undefined` (the key absent) and `None` paint the same on every element. They
|
|
30
|
+
* differ for one reader only — the UML object glyph's legacy rule, drawn for a
|
|
31
|
+
* name that never carried the field — which is why turning the decoration off
|
|
32
|
+
* writes `None` rather than clearing the key.
|
|
33
|
+
*/
|
|
34
|
+
export var TextDecoration;
|
|
35
|
+
(function (TextDecoration) {
|
|
36
|
+
TextDecoration["None"] = "none";
|
|
37
|
+
TextDecoration["Underline"] = "underline";
|
|
38
|
+
TextDecoration["Overline"] = "overline";
|
|
39
|
+
TextDecoration["UnderlineOverline"] = "underline overline";
|
|
40
|
+
})(TextDecoration || (TextDecoration = {}));
|
|
16
41
|
export var FontWeight;
|
|
17
42
|
(function (FontWeight) {
|
|
18
43
|
FontWeight["Bold"] = "700";
|
|
@@ -3,7 +3,7 @@ import { Bound } from '../../../global/gfx/index.js';
|
|
|
3
3
|
import type { BaseElementProps, PointTestOptions } from '../../../std/gfx/index.js';
|
|
4
4
|
import { GfxLocalElementModel, GfxPrimitiveElementModel } from '../../../std/gfx/index.js';
|
|
5
5
|
import * as Y from 'yjs';
|
|
6
|
-
import { FontStyle, FontWeight, ShapeStyle, ShapeType, StrokeStyle, TextAlign, TextFitMode, TextResizing, type TextStyleProps, TextVerticalAlign } from '../../consts/index.js';
|
|
6
|
+
import { FontStyle, FontWeight, ShapeStyle, ShapeType, StrokeStyle, TextAlign, type TextDecoration, TextFitMode, TextResizing, type TextStyleProps, TextVerticalAlign } from '../../consts/index.js';
|
|
7
7
|
import { type Color } from '../../themes/index.js';
|
|
8
8
|
export type ShapeProps = BaseElementProps & {
|
|
9
9
|
shapeType: ShapeType;
|
|
@@ -98,6 +98,11 @@ export declare class ShapeElementModel extends GfxPrimitiveElementModel<ShapePro
|
|
|
98
98
|
accessor strokeWidth: number;
|
|
99
99
|
accessor text: Y.Text | undefined;
|
|
100
100
|
accessor textAlign: TextAlign;
|
|
101
|
+
/**
|
|
102
|
+
* Absent until the author sets it, so a shape whose text is never decorated
|
|
103
|
+
* stores exactly the keys it stored before the field existed (ADR 0030).
|
|
104
|
+
*/
|
|
105
|
+
accessor textDecoration: TextDecoration | undefined;
|
|
101
106
|
accessor textDisplay: boolean;
|
|
102
107
|
accessor textHorizontalAlign: TextAlign;
|
|
103
108
|
accessor textResizing: TextResizing;
|
|
@@ -102,6 +102,9 @@ let ShapeElementModel = (() => {
|
|
|
102
102
|
let _textAlign_decorators;
|
|
103
103
|
let _textAlign_initializers = [];
|
|
104
104
|
let _textAlign_extraInitializers = [];
|
|
105
|
+
let _textDecoration_decorators;
|
|
106
|
+
let _textDecoration_initializers = [];
|
|
107
|
+
let _textDecoration_extraInitializers = [];
|
|
105
108
|
let _textDisplay_decorators;
|
|
106
109
|
let _textDisplay_initializers = [];
|
|
107
110
|
let _textDisplay_extraInitializers = [];
|
|
@@ -155,6 +158,7 @@ let ShapeElementModel = (() => {
|
|
|
155
158
|
_strokeWidth_decorators = [field()];
|
|
156
159
|
_text_decorators = [field()];
|
|
157
160
|
_textAlign_decorators = [field(TextAlign.Center)];
|
|
161
|
+
_textDecoration_decorators = [field()];
|
|
158
162
|
_textDisplay_decorators = [local()];
|
|
159
163
|
_textHorizontalAlign_decorators = [field(TextAlign.Center)];
|
|
160
164
|
_textResizing_decorators = [field(TextResizing.AUTO_HEIGHT)];
|
|
@@ -185,6 +189,7 @@ let ShapeElementModel = (() => {
|
|
|
185
189
|
__esDecorate(this, null, _strokeWidth_decorators, { kind: "accessor", name: "strokeWidth", static: false, private: false, access: { has: obj => "strokeWidth" in obj, get: obj => obj.strokeWidth, set: (obj, value) => { obj.strokeWidth = value; } }, metadata: _metadata }, _strokeWidth_initializers, _strokeWidth_extraInitializers);
|
|
186
190
|
__esDecorate(this, null, _text_decorators, { kind: "accessor", name: "text", static: false, private: false, access: { has: obj => "text" in obj, get: obj => obj.text, set: (obj, value) => { obj.text = value; } }, metadata: _metadata }, _text_initializers, _text_extraInitializers);
|
|
187
191
|
__esDecorate(this, null, _textAlign_decorators, { kind: "accessor", name: "textAlign", static: false, private: false, access: { has: obj => "textAlign" in obj, get: obj => obj.textAlign, set: (obj, value) => { obj.textAlign = value; } }, metadata: _metadata }, _textAlign_initializers, _textAlign_extraInitializers);
|
|
192
|
+
__esDecorate(this, null, _textDecoration_decorators, { kind: "accessor", name: "textDecoration", static: false, private: false, access: { has: obj => "textDecoration" in obj, get: obj => obj.textDecoration, set: (obj, value) => { obj.textDecoration = value; } }, metadata: _metadata }, _textDecoration_initializers, _textDecoration_extraInitializers);
|
|
188
193
|
__esDecorate(this, null, _textDisplay_decorators, { kind: "accessor", name: "textDisplay", static: false, private: false, access: { has: obj => "textDisplay" in obj, get: obj => obj.textDisplay, set: (obj, value) => { obj.textDisplay = value; } }, metadata: _metadata }, _textDisplay_initializers, _textDisplay_extraInitializers);
|
|
189
194
|
__esDecorate(this, null, _textHorizontalAlign_decorators, { kind: "accessor", name: "textHorizontalAlign", static: false, private: false, access: { has: obj => "textHorizontalAlign" in obj, get: obj => obj.textHorizontalAlign, set: (obj, value) => { obj.textHorizontalAlign = value; } }, metadata: _metadata }, _textHorizontalAlign_initializers, _textHorizontalAlign_extraInitializers);
|
|
190
195
|
__esDecorate(this, null, _textResizing_decorators, { kind: "accessor", name: "textResizing", static: false, private: false, access: { has: obj => "textResizing" in obj, get: obj => obj.textResizing, set: (obj, value) => { obj.textResizing = value; } }, metadata: _metadata }, _textResizing_initializers, _textResizing_extraInitializers);
|
|
@@ -306,6 +311,13 @@ let ShapeElementModel = (() => {
|
|
|
306
311
|
#textAlign_accessor_storage;
|
|
307
312
|
get textAlign() { return this.#textAlign_accessor_storage; }
|
|
308
313
|
set textAlign(value) { this.#textAlign_accessor_storage = value; }
|
|
314
|
+
#textDecoration_accessor_storage;
|
|
315
|
+
/**
|
|
316
|
+
* Absent until the author sets it, so a shape whose text is never decorated
|
|
317
|
+
* stores exactly the keys it stored before the field existed (ADR 0030).
|
|
318
|
+
*/
|
|
319
|
+
get textDecoration() { return this.#textDecoration_accessor_storage; }
|
|
320
|
+
set textDecoration(value) { this.#textDecoration_accessor_storage = value; }
|
|
309
321
|
#textDisplay_accessor_storage;
|
|
310
322
|
get textDisplay() { return this.#textDisplay_accessor_storage; }
|
|
311
323
|
set textDisplay(value) { this.#textDisplay_accessor_storage = value; }
|
|
@@ -397,7 +409,8 @@ let ShapeElementModel = (() => {
|
|
|
397
409
|
this.#strokeWidth_accessor_storage = (__runInitializers(this, _strokeStyle_extraInitializers), __runInitializers(this, _strokeWidth_initializers, 4));
|
|
398
410
|
this.#text_accessor_storage = (__runInitializers(this, _strokeWidth_extraInitializers), __runInitializers(this, _text_initializers, undefined));
|
|
399
411
|
this.#textAlign_accessor_storage = (__runInitializers(this, _text_extraInitializers), __runInitializers(this, _textAlign_initializers, void 0));
|
|
400
|
-
this.#
|
|
412
|
+
this.#textDecoration_accessor_storage = (__runInitializers(this, _textAlign_extraInitializers), __runInitializers(this, _textDecoration_initializers, undefined));
|
|
413
|
+
this.#textDisplay_accessor_storage = (__runInitializers(this, _textDecoration_extraInitializers), __runInitializers(this, _textDisplay_initializers, true));
|
|
401
414
|
this.#textHorizontalAlign_accessor_storage = (__runInitializers(this, _textDisplay_extraInitializers), __runInitializers(this, _textHorizontalAlign_initializers, void 0));
|
|
402
415
|
this.#textResizing_accessor_storage = (__runInitializers(this, _textHorizontalAlign_extraInitializers), __runInitializers(this, _textResizing_initializers, TextResizing.AUTO_HEIGHT));
|
|
403
416
|
this.#textFitMode_accessor_storage = (__runInitializers(this, _textResizing_extraInitializers), __runInitializers(this, _textFitMode_initializers, TextFitMode.Grow));
|
|
@@ -3,7 +3,7 @@ import { Bound } from '../../../global/gfx/index.js';
|
|
|
3
3
|
import type { BaseElementProps } from '../../../std/gfx/index.js';
|
|
4
4
|
import { GfxPrimitiveElementModel } from '../../../std/gfx/index.js';
|
|
5
5
|
import * as Y from 'yjs';
|
|
6
|
-
import { FontFamily, FontStyle, FontWeight, TextAlign, type TextStyleProps } from '../../consts/index.js';
|
|
6
|
+
import { FontFamily, FontStyle, FontWeight, TextAlign, type TextDecoration, type TextStyleProps } from '../../consts/index.js';
|
|
7
7
|
import { type Color } from '../../themes/index.js';
|
|
8
8
|
export type TextElementProps = BaseElementProps & {
|
|
9
9
|
text: Y.Text;
|
|
@@ -25,5 +25,10 @@ export declare class TextElementModel extends GfxPrimitiveElementModel<TextEleme
|
|
|
25
25
|
accessor rotate: number;
|
|
26
26
|
accessor text: Y.Text;
|
|
27
27
|
accessor textAlign: TextAlign;
|
|
28
|
+
/**
|
|
29
|
+
* Absent until the author sets it, so a text that is never decorated stores
|
|
30
|
+
* exactly the keys it stored before the field existed (ADR 0030).
|
|
31
|
+
*/
|
|
32
|
+
accessor textDecoration: TextDecoration | undefined;
|
|
28
33
|
accessor xywh: SerializedXYWH;
|
|
29
34
|
}
|
|
@@ -66,6 +66,9 @@ let TextElementModel = (() => {
|
|
|
66
66
|
let _textAlign_decorators;
|
|
67
67
|
let _textAlign_initializers = [];
|
|
68
68
|
let _textAlign_extraInitializers = [];
|
|
69
|
+
let _textDecoration_decorators;
|
|
70
|
+
let _textDecoration_initializers = [];
|
|
71
|
+
let _textDecoration_extraInitializers = [];
|
|
69
72
|
let _xywh_decorators;
|
|
70
73
|
let _xywh_initializers = [];
|
|
71
74
|
let _xywh_extraInitializers = [];
|
|
@@ -81,6 +84,7 @@ let TextElementModel = (() => {
|
|
|
81
84
|
_rotate_decorators = [field(0)];
|
|
82
85
|
_text_decorators = [field()];
|
|
83
86
|
_textAlign_decorators = [field()];
|
|
87
|
+
_textDecoration_decorators = [field()];
|
|
84
88
|
_xywh_decorators = [field('[0,0,0,0]')];
|
|
85
89
|
__esDecorate(this, null, _color_decorators, { kind: "accessor", name: "color", static: false, private: false, access: { has: obj => "color" in obj, get: obj => obj.color, set: (obj, value) => { obj.color = value; } }, metadata: _metadata }, _color_initializers, _color_extraInitializers);
|
|
86
90
|
__esDecorate(this, null, _fontFamily_decorators, { kind: "accessor", name: "fontFamily", static: false, private: false, access: { has: obj => "fontFamily" in obj, get: obj => obj.fontFamily, set: (obj, value) => { obj.fontFamily = value; } }, metadata: _metadata }, _fontFamily_initializers, _fontFamily_extraInitializers);
|
|
@@ -91,6 +95,7 @@ let TextElementModel = (() => {
|
|
|
91
95
|
__esDecorate(this, null, _rotate_decorators, { kind: "accessor", name: "rotate", static: false, private: false, access: { has: obj => "rotate" in obj, get: obj => obj.rotate, set: (obj, value) => { obj.rotate = value; } }, metadata: _metadata }, _rotate_initializers, _rotate_extraInitializers);
|
|
92
96
|
__esDecorate(this, null, _text_decorators, { kind: "accessor", name: "text", static: false, private: false, access: { has: obj => "text" in obj, get: obj => obj.text, set: (obj, value) => { obj.text = value; } }, metadata: _metadata }, _text_initializers, _text_extraInitializers);
|
|
93
97
|
__esDecorate(this, null, _textAlign_decorators, { kind: "accessor", name: "textAlign", static: false, private: false, access: { has: obj => "textAlign" in obj, get: obj => obj.textAlign, set: (obj, value) => { obj.textAlign = value; } }, metadata: _metadata }, _textAlign_initializers, _textAlign_extraInitializers);
|
|
98
|
+
__esDecorate(this, null, _textDecoration_decorators, { kind: "accessor", name: "textDecoration", static: false, private: false, access: { has: obj => "textDecoration" in obj, get: obj => obj.textDecoration, set: (obj, value) => { obj.textDecoration = value; } }, metadata: _metadata }, _textDecoration_initializers, _textDecoration_extraInitializers);
|
|
94
99
|
__esDecorate(this, null, _xywh_decorators, { kind: "accessor", name: "xywh", static: false, private: false, access: { has: obj => "xywh" in obj, get: obj => obj.xywh, set: (obj, value) => { obj.xywh = value; } }, metadata: _metadata }, _xywh_initializers, _xywh_extraInitializers);
|
|
95
100
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
96
101
|
}
|
|
@@ -145,7 +150,14 @@ let TextElementModel = (() => {
|
|
|
145
150
|
#textAlign_accessor_storage = (__runInitializers(this, _text_extraInitializers), __runInitializers(this, _textAlign_initializers, TextAlign.Center));
|
|
146
151
|
get textAlign() { return this.#textAlign_accessor_storage; }
|
|
147
152
|
set textAlign(value) { this.#textAlign_accessor_storage = value; }
|
|
148
|
-
#
|
|
153
|
+
#textDecoration_accessor_storage = (__runInitializers(this, _textAlign_extraInitializers), __runInitializers(this, _textDecoration_initializers, undefined));
|
|
154
|
+
/**
|
|
155
|
+
* Absent until the author sets it, so a text that is never decorated stores
|
|
156
|
+
* exactly the keys it stored before the field existed (ADR 0030).
|
|
157
|
+
*/
|
|
158
|
+
get textDecoration() { return this.#textDecoration_accessor_storage; }
|
|
159
|
+
set textDecoration(value) { this.#textDecoration_accessor_storage = value; }
|
|
160
|
+
#xywh_accessor_storage = (__runInitializers(this, _textDecoration_extraInitializers), __runInitializers(this, _xywh_initializers, '[0,0,16,16]'));
|
|
149
161
|
get xywh() { return this.#xywh_accessor_storage; }
|
|
150
162
|
set xywh(value) { this.#xywh_accessor_storage = value; }
|
|
151
163
|
constructor() {
|
|
@@ -12,6 +12,8 @@ export function createEmbedBlockSchema({ name, version, toModel, props, transfor
|
|
|
12
12
|
index: 'a0',
|
|
13
13
|
xywh: '[0,0,0,0]',
|
|
14
14
|
lockedBySelf: false,
|
|
15
|
+
hiddenForEveryone: undefined,
|
|
16
|
+
layer: undefined,
|
|
15
17
|
rotate: 0,
|
|
16
18
|
comments: undefined,
|
|
17
19
|
'meta:createdAt': undefined,
|
|
@@ -10,13 +10,13 @@ export declare const LinkPreviewDataSchema: z.ZodObject<{
|
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
description: string | null;
|
|
12
12
|
title: string | null;
|
|
13
|
-
image: string | null;
|
|
14
13
|
icon: string | null;
|
|
14
|
+
image: string | null;
|
|
15
15
|
}, {
|
|
16
16
|
description: string | null;
|
|
17
17
|
title: string | null;
|
|
18
|
-
image: string | null;
|
|
19
18
|
icon: string | null;
|
|
19
|
+
image: string | null;
|
|
20
20
|
}>;
|
|
21
21
|
export type LinkPreviewData = z.infer<typeof LinkPreviewDataSchema>;
|
|
22
22
|
export type Connectable = Exclude<GfxModel, ConnectorElementModel | BrushElementModel | GroupElementModel>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type ChromeWording } from '../affine-shared/services/index.js';
|
|
2
|
+
import type { BlockStdScope } from '../std/index.js';
|
|
3
|
+
import type { BlockModel, ExtensionType } from '../store/index.js';
|
|
2
4
|
import type { TemplateResult } from 'lit';
|
|
3
5
|
/**
|
|
4
6
|
* Text primitive entries used in slash menu and format bar,
|
|
@@ -25,3 +27,26 @@ export interface TextConversionConfig {
|
|
|
25
27
|
descriptionWording?: ChromeWording;
|
|
26
28
|
}
|
|
27
29
|
export declare const textConversionConfigs: TextConversionConfig[];
|
|
30
|
+
/**
|
|
31
|
+
* A "Turn into" entry contributed by a block package from its OWN view
|
|
32
|
+
* extension, for a conversion `updateBlockType` cannot carry (#418).
|
|
33
|
+
*
|
|
34
|
+
* `textConversionConfigs` above is static and unconditional: every entry in it
|
|
35
|
+
* is offered whatever the host's flags say. A block whose tooling is
|
|
36
|
+
* flag-gated (ADR 0009) therefore cannot be listed there; it registers this
|
|
37
|
+
* entry from its gated view extension instead, so `{ callout: false }` removes
|
|
38
|
+
* the entry with the rest of the callout's tooling. Mirrors
|
|
39
|
+
* `SlashMenuConfigExtension`: one DI variant per flavour, read with `getAll`
|
|
40
|
+
* by the menu that draws the entries.
|
|
41
|
+
*/
|
|
42
|
+
export interface TextConversionEntry {
|
|
43
|
+
flavour: string;
|
|
44
|
+
name: string;
|
|
45
|
+
nameWording: ChromeWording;
|
|
46
|
+
icon: TemplateResult;
|
|
47
|
+
/** Whether the entry is offered for the models currently selected. */
|
|
48
|
+
when: (std: BlockStdScope, models: BlockModel[]) => boolean;
|
|
49
|
+
run: (std: BlockStdScope, models: BlockModel[]) => void;
|
|
50
|
+
}
|
|
51
|
+
export declare const TextConversionEntryIdentifier: import("../global/di/types.js").ServiceIdentifier<TextConversionEntry> & (<U extends TextConversionEntry = TextConversionEntry>(variant: import("../global/di/types.js").ServiceVariant) => import("../global/di/types.js").ServiceIdentifier<U>);
|
|
52
|
+
export declare function TextConversionEntryExtension(entry: TextConversionEntry): ExtensionType;
|