@formicoidea/labre-core 0.50.0 → 0.52.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/asset-picker.d.ts +24 -0
- package/dist/_pkgs/affine-block-attachment/asset-picker.js +87 -0
- package/dist/_pkgs/affine-block-attachment/configs/slash-menu.js +3 -20
- package/dist/_pkgs/affine-block-attachment/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-attachment/index.js +1 -0
- package/dist/_pkgs/affine-block-attachment/utils.d.ts +9 -1
- package/dist/_pkgs/affine-block-attachment/utils.js +9 -0
- package/dist/_pkgs/affine-block-bookmark/adapters/markdown/markdown.js +14 -1
- package/dist/_pkgs/affine-block-bookmark/adapters/notion-html.js +5 -1
- package/dist/_pkgs/affine-block-database/adapters/markdown.js +5 -3
- package/dist/_pkgs/affine-block-embed/common/adapters/html.js +5 -3
- package/dist/_pkgs/affine-block-embed/common/adapters/markdown.js +11 -0
- package/dist/_pkgs/affine-block-frame/frame-template.d.ts +58 -0
- package/dist/_pkgs/affine-block-frame/frame-template.js +207 -0
- package/dist/_pkgs/affine-block-frame/frame-toolbar.js +19 -3
- package/dist/_pkgs/affine-block-frame/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-frame/index.js +1 -0
- package/dist/_pkgs/affine-block-frame/translations.d.ts +7 -0
- package/dist/_pkgs/affine-block-frame/translations.js +16 -1
- package/dist/_pkgs/affine-block-frame/view.js +6 -0
- package/dist/_pkgs/affine-block-image/asset-picker.d.ts +63 -0
- package/dist/_pkgs/affine-block-image/asset-picker.js +183 -0
- package/dist/_pkgs/affine-block-image/commands/insert-images.d.ts +5 -0
- package/dist/_pkgs/affine-block-image/commands/insert-images.js +8 -8
- package/dist/_pkgs/affine-block-image/components/page-image-block.d.ts +11 -0
- package/dist/_pkgs/affine-block-image/components/page-image-block.js +81 -12
- package/dist/_pkgs/affine-block-image/configs/replace-action.d.ts +9 -0
- package/dist/_pkgs/affine-block-image/configs/replace-action.js +27 -0
- package/dist/_pkgs/affine-block-image/configs/toolbar.js +6 -0
- package/dist/_pkgs/affine-block-image/crop/crop-controller.d.ts +46 -0
- package/dist/_pkgs/affine-block-image/crop/crop-controller.js +104 -0
- package/dist/_pkgs/affine-block-image/crop/crop-math.d.ts +70 -0
- package/dist/_pkgs/affine-block-image/crop/crop-math.js +141 -0
- package/dist/_pkgs/affine-block-image/crop/crop-overlay.d.ts +57 -0
- package/dist/_pkgs/affine-block-image/crop/crop-overlay.js +343 -0
- package/dist/_pkgs/affine-block-image/crop/crop-toolbar.d.ts +12 -0
- package/dist/_pkgs/affine-block-image/crop/crop-toolbar.js +78 -0
- package/dist/_pkgs/affine-block-image/crop/write-crop.d.ts +16 -0
- package/dist/_pkgs/affine-block-image/crop/write-crop.js +57 -0
- package/dist/_pkgs/affine-block-image/edgeless-clipboard-config.js +4 -1
- package/dist/_pkgs/affine-block-image/effects.js +2 -0
- package/dist/_pkgs/affine-block-image/image-block.d.ts +2 -0
- package/dist/_pkgs/affine-block-image/image-block.js +2 -0
- package/dist/_pkgs/affine-block-image/image-edgeless-block.d.ts +2 -0
- package/dist/_pkgs/affine-block-image/image-edgeless-block.js +36 -8
- package/dist/_pkgs/affine-block-image/image-resize-manager.js +15 -0
- package/dist/_pkgs/affine-block-image/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-image/index.js +1 -0
- package/dist/_pkgs/affine-block-image/translations.d.ts +15 -0
- package/dist/_pkgs/affine-block-image/translations.js +43 -0
- package/dist/_pkgs/affine-block-image/utils.d.ts +13 -0
- package/dist/_pkgs/affine-block-image/utils.js +10 -1
- package/dist/_pkgs/affine-block-root/clipboard/page-clipboard.js +5 -0
- package/dist/_pkgs/affine-block-root/commands/page-export-commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-root/commands/page-export-commands.js +71 -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/view.js +8 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.d.ts +30 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.js +44 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.d.ts +26 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.js +82 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.d.ts +18 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.js +91 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.d.ts +50 -0
- package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.js +732 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.js +15 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +7 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +7 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +60 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.d.ts +6 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.js +8 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +28 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +66 -6
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +2 -7
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +2 -6
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-export.d.ts +84 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-export.js +150 -0
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +24 -2
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +23 -2
- package/dist/_pkgs/affine-block-surface/extensions/interchange.js +4 -1
- package/dist/_pkgs/affine-block-surface/extensions/legend-role.d.ts +18 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend-role.js +20 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +2 -19
- package/dist/_pkgs/affine-block-surface/extensions/legend.js +2 -18
- package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.d.ts +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.js +235 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +9 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +17 -13
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +52 -80
- package/dist/_pkgs/affine-block-surface/extensions/xml-element.d.ts +98 -0
- package/dist/_pkgs/affine-block-surface/extensions/xml-element.js +261 -0
- package/dist/_pkgs/affine-block-surface/extensions/xml-reader.d.ts +238 -0
- package/dist/_pkgs/affine-block-surface/extensions/xml-reader.js +570 -0
- package/dist/_pkgs/affine-block-surface/framework-background/def.js +1 -1
- package/dist/_pkgs/affine-block-surface/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/interchange-headless.d.ts +29 -0
- package/dist/_pkgs/affine-block-surface/interchange-headless.js +32 -0
- package/dist/_pkgs/affine-block-surface/view.js +22 -2
- package/dist/_pkgs/affine-block-table/adapters/utils.js +24 -1
- package/dist/_pkgs/affine-gfx-note/toolbar/note-menu.js +5 -8
- package/dist/_pkgs/affine-gfx-template/contribute.d.ts +14 -4
- package/dist/_pkgs/affine-gfx-template/contribute.js +47 -6
- package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.d.ts +7 -2
- package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.js +14 -40
- package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.d.ts +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.js +1 -1
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.d.ts +4 -4
- package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +9 -9
- package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +2 -4
- package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
- package/dist/_pkgs/affine-gfx-template/translations.js +9 -0
- package/dist/_pkgs/affine-inline-footnote/adapters/markdown/inline-delta.js +6 -0
- package/dist/_pkgs/affine-inline-footnote/adapters/markdown/markdown-inline.js +7 -0
- package/dist/_pkgs/affine-inline-link/adapters/html/html-inline.js +4 -1
- package/dist/_pkgs/affine-inline-link/adapters/html/inline-delta.js +3 -1
- package/dist/_pkgs/affine-inline-link/adapters/markdown/inline-delta.js +4 -1
- package/dist/_pkgs/affine-inline-link/adapters/notion-html/html-inline.js +2 -1
- package/dist/_pkgs/affine-inline-link/link-node/affine-link.d.ts +7 -0
- package/dist/_pkgs/affine-inline-link/link-node/affine-link.js +37 -0
- package/dist/_pkgs/affine-inline-link/link-node/index.d.ts +1 -0
- package/dist/_pkgs/affine-inline-link/link-node/index.js +1 -0
- package/dist/_pkgs/affine-inline-link/link-node/propose-views.d.ts +22 -0
- package/dist/_pkgs/affine-inline-link/link-node/propose-views.js +59 -0
- package/dist/_pkgs/affine-model/blocks/image/image-crop.d.ts +48 -0
- package/dist/_pkgs/affine-model/blocks/image/image-crop.js +78 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.d.ts +6 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/image/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/blocks/image/index.js +1 -0
- package/dist/_pkgs/affine-model/consts/shape.d.ts +2 -0
- package/dist/_pkgs/affine-model/consts/shape.js +5 -0
- package/dist/_pkgs/affine-model/elements/bpmn/consts.d.ts +31 -0
- package/dist/_pkgs/affine-model/elements/bpmn/consts.js +31 -0
- package/dist/_pkgs/affine-model/elements/bpmn/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/bpmn/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +0 -25
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -25
- package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +0 -2
- package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -2
- package/dist/_pkgs/affine-model/elements/uml/consts.d.ts +133 -0
- package/dist/_pkgs/affine-model/elements/uml/consts.js +107 -0
- package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +1 -79
- package/dist/_pkgs/affine-model/elements/uml/diagram.js +1 -53
- package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +0 -15
- package/dist/_pkgs/affine-model/elements/uml/fragment.js +1 -15
- package/dist/_pkgs/affine-model/elements/uml/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/uml/index.js +1 -0
- package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +0 -20
- package/dist/_pkgs/affine-model/elements/uml/partition.js +1 -20
- package/dist/_pkgs/affine-model/elements/uml/region.d.ts +0 -11
- package/dist/_pkgs/affine-model/elements/uml/region.js +1 -11
- package/dist/_pkgs/affine-model/headless.d.ts +19 -0
- package/dist/_pkgs/affine-model/headless.js +19 -0
- package/dist/_pkgs/affine-shared/headless.d.ts +10 -0
- package/dist/_pkgs/affine-shared/headless.js +10 -0
- package/dist/_pkgs/affine-shared/services/asset-picker-service.d.ts +63 -0
- package/dist/_pkgs/affine-shared/services/asset-picker-service.js +20 -0
- package/dist/_pkgs/affine-shared/services/frame-template-service.d.ts +83 -0
- package/dist/_pkgs/affine-shared/services/frame-template-service.js +17 -0
- 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/thread-marks-service.d.ts +69 -0
- package/dist/_pkgs/affine-shared/services/thread-marks-service.js +20 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +6 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +10 -0
- package/dist/_pkgs/affine-widget-drag-handle/watchers/drag-event-watcher.js +8 -3
- package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +4 -16
- package/dist/_pkgs/affine-widget-linked-doc/transformers/html.d.ts +7 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/html.js +25 -24
- package/dist/_pkgs/affine-widget-linked-doc/transformers/index.d.ts +1 -1
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.d.ts +7 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.js +26 -25
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.d.ts +23 -0
- package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.js +14 -0
- package/dist/_pkgs/affine-widget-thread-marks/effects.d.ts +1 -0
- package/dist/_pkgs/affine-widget-thread-marks/effects.js +4 -0
- package/dist/_pkgs/affine-widget-thread-marks/excerpt.d.ts +19 -0
- package/dist/_pkgs/affine-widget-thread-marks/excerpt.js +68 -0
- package/dist/_pkgs/affine-widget-thread-marks/index.d.ts +5 -0
- package/dist/_pkgs/affine-widget-thread-marks/index.js +8 -0
- package/dist/_pkgs/affine-widget-thread-marks/toolbar.d.ts +49 -0
- package/dist/_pkgs/affine-widget-thread-marks/toolbar.js +108 -0
- package/dist/_pkgs/affine-widget-thread-marks/translations.d.ts +9 -0
- package/dist/_pkgs/affine-widget-thread-marks/translations.js +11 -0
- package/dist/_pkgs/affine-widget-thread-marks/view.d.ts +12 -0
- package/dist/_pkgs/affine-widget-thread-marks/view.js +25 -0
- package/dist/_pkgs/affine-widget-thread-marks/widget.d.ts +51 -0
- package/dist/_pkgs/affine-widget-thread-marks/widget.js +214 -0
- package/dist/commands.js +5 -2
- package/dist/extensions/view.js +2 -0
- package/dist/host-panels.d.ts +24 -1
- package/dist/host-panels.js +61 -10
- package/dist/interchange.d.ts +1 -0
- package/dist/interchange.js +1 -0
- package/dist/model/headless.d.ts +1 -0
- package/dist/model/headless.js +1 -0
- package/dist/shared/headless.d.ts +1 -0
- package/dist/shared/headless.js +1 -0
- package/dist/translations.js +10 -1
- package/package.json +13 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WidgetViewExtension } from '../std/index.js';
|
|
2
|
+
import { literal, unsafeStatic } from 'lit/static-html.js';
|
|
3
|
+
import { AFFINE_THREAD_MARKS_WIDGET } from './widget.js';
|
|
4
|
+
export * from './excerpt.js';
|
|
5
|
+
export * from './toolbar.js';
|
|
6
|
+
export * from './translations.js';
|
|
7
|
+
export * from './widget.js';
|
|
8
|
+
export const threadMarksWidget = WidgetViewExtension('affine:page', AFFINE_THREAD_MARKS_WIDGET, literal `${unsafeStatic(AFFINE_THREAD_MARKS_WIDGET)}`);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ToolbarContext } from '../affine-shared/services/index.js';
|
|
2
|
+
import { type BlockStdScope } from '../std/index.js';
|
|
3
|
+
import type { ExtensionType } from '../store/index.js';
|
|
4
|
+
import { type ThreadTarget } from './excerpt.js';
|
|
5
|
+
/**
|
|
6
|
+
* The ONE target a toolbar row speaks for, or `null` when it speaks for
|
|
7
|
+
* several (a discussion anchors to one block or one element, labre ADR-0048).
|
|
8
|
+
*
|
|
9
|
+
* - On the canvas, exactly one selected model: a canvas element (shape,
|
|
10
|
+
* connector, group, framework board) is an `element`, a canvas block (note,
|
|
11
|
+
* frame, image, embed) a `block`.
|
|
12
|
+
* - A text selection within one block: that block (the grain is the block,
|
|
13
|
+
* never a range of text).
|
|
14
|
+
* - One selected block, or the block a hover toolbar is drawn for.
|
|
15
|
+
*/
|
|
16
|
+
export declare function threadTargetOf(ctx: ToolbarContext): ThreadTarget | null;
|
|
17
|
+
/**
|
|
18
|
+
* Ask the host to open the discussion of `target`, with the excerpt the
|
|
19
|
+
* library computes. Nothing is written: no prop, no id in the document.
|
|
20
|
+
* Without the seam, nothing happens.
|
|
21
|
+
*/
|
|
22
|
+
export declare function openThreadOn(std: BlockStdScope, target: ThreadTarget): void;
|
|
23
|
+
export declare const THREAD_DISCUSS_ACTION_ID = "g.thread-discuss";
|
|
24
|
+
/**
|
|
25
|
+
* "Discuss" in the toolbar of every block and every canvas element (ADR 0038).
|
|
26
|
+
* Shown only when the host registered the seam and the row speaks for one
|
|
27
|
+
* target. It is not AFFiNE's `blockCommentToolbarButton`: that one writes the
|
|
28
|
+
* comment id into the block.
|
|
29
|
+
*/
|
|
30
|
+
export declare const threadDiscussToolbarConfig: {
|
|
31
|
+
readonly when: (ctx: ToolbarContext) => boolean;
|
|
32
|
+
readonly actions: [{
|
|
33
|
+
readonly id: "g.thread-discuss";
|
|
34
|
+
readonly icon: import("lit-html").TemplateResult<1>;
|
|
35
|
+
readonly labelWording: import("../affine-shared/services/index.js").ChromeWording;
|
|
36
|
+
readonly tooltipWording: import("../affine-shared/services/index.js").ChromeWording;
|
|
37
|
+
readonly run: (ctx: ToolbarContext) => void;
|
|
38
|
+
}];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Registered on the two wildcard rows, each under an owner key: the bare
|
|
42
|
+
* `affine:surface:*` is the root's built-in canvas module, and an owner key
|
|
43
|
+
* never collides with a bare one. `affine:*` is merged into every row the
|
|
44
|
+
* toolbar draws; `affine:surface:*` names the canvas rows explicitly, so a
|
|
45
|
+
* row that stopped merging `affine:*` would still offer it. Where both apply,
|
|
46
|
+
* the toolbar merges entries by id, so the row shows "Discuss" once. A new
|
|
47
|
+
* block or framework inherits it by doing nothing.
|
|
48
|
+
*/
|
|
49
|
+
export declare const threadDiscussToolbarExtensions: ExtensionType[];
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { CommentIcon } from '@blocksuite/icons/lit';
|
|
2
|
+
import { ToolbarModuleExtension, toolbarModuleKey, ThreadMarksProvider, } from '../affine-shared/services/index.js';
|
|
3
|
+
import { BlockFlavourIdentifier, BlockSelection, TextSelection, } from '../std/index.js';
|
|
4
|
+
import { GfxPrimitiveElementModel } from '../std/gfx/index.js';
|
|
5
|
+
import { threadExcerpt } from './excerpt.js';
|
|
6
|
+
import { THREAD_DISCUSS } from './translations.js';
|
|
7
|
+
/** Containers a discussion never anchors to: the page and the canvas itself. */
|
|
8
|
+
const NOT_A_TARGET = new Set(['affine:page', 'affine:surface']);
|
|
9
|
+
function blockTarget(id, ctx) {
|
|
10
|
+
if (!id)
|
|
11
|
+
return null;
|
|
12
|
+
const model = ctx.store.getModelById(id);
|
|
13
|
+
if (!model || NOT_A_TARGET.has(model.flavour))
|
|
14
|
+
return null;
|
|
15
|
+
return { targetType: 'block', targetId: model.id };
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The ONE target a toolbar row speaks for, or `null` when it speaks for
|
|
19
|
+
* several (a discussion anchors to one block or one element, labre ADR-0048).
|
|
20
|
+
*
|
|
21
|
+
* - On the canvas, exactly one selected model: a canvas element (shape,
|
|
22
|
+
* connector, group, framework board) is an `element`, a canvas block (note,
|
|
23
|
+
* frame, image, embed) a `block`.
|
|
24
|
+
* - A text selection within one block: that block (the grain is the block,
|
|
25
|
+
* never a range of text).
|
|
26
|
+
* - One selected block, or the block a hover toolbar is drawn for.
|
|
27
|
+
*/
|
|
28
|
+
export function threadTargetOf(ctx) {
|
|
29
|
+
if (ctx.hasSelectedSurfaceModels) {
|
|
30
|
+
const models = ctx.getSurfaceModels();
|
|
31
|
+
if (models.length !== 1)
|
|
32
|
+
return null;
|
|
33
|
+
const model = models[0];
|
|
34
|
+
if (!model)
|
|
35
|
+
return null;
|
|
36
|
+
return model instanceof GfxPrimitiveElementModel
|
|
37
|
+
? { targetType: 'element', targetId: model.id }
|
|
38
|
+
: blockTarget(model.id, ctx);
|
|
39
|
+
}
|
|
40
|
+
const text = ctx.selection.find(TextSelection);
|
|
41
|
+
if (text) {
|
|
42
|
+
const from = text.from.blockId;
|
|
43
|
+
const to = text.to?.blockId ?? from;
|
|
44
|
+
return from === to ? blockTarget(from, ctx) : null;
|
|
45
|
+
}
|
|
46
|
+
if (ctx.selection.filter(BlockSelection).length > 1)
|
|
47
|
+
return null;
|
|
48
|
+
return blockTarget(ctx.getCurrentModelBy(BlockSelection)?.id, ctx);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Ask the host to open the discussion of `target`, with the excerpt the
|
|
52
|
+
* library computes. Nothing is written: no prop, no id in the document.
|
|
53
|
+
* Without the seam, nothing happens.
|
|
54
|
+
*/
|
|
55
|
+
export function openThreadOn(std, target) {
|
|
56
|
+
const service = std.getOptional(ThreadMarksProvider);
|
|
57
|
+
if (!service)
|
|
58
|
+
return;
|
|
59
|
+
service.openThread({
|
|
60
|
+
docId: std.store.id,
|
|
61
|
+
targetType: target.targetType,
|
|
62
|
+
targetId: target.targetId,
|
|
63
|
+
excerpt: threadExcerpt(std, target),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export const THREAD_DISCUSS_ACTION_ID = 'g.thread-discuss';
|
|
67
|
+
/**
|
|
68
|
+
* "Discuss" in the toolbar of every block and every canvas element (ADR 0038).
|
|
69
|
+
* Shown only when the host registered the seam and the row speaks for one
|
|
70
|
+
* target. It is not AFFiNE's `blockCommentToolbarButton`: that one writes the
|
|
71
|
+
* comment id into the block.
|
|
72
|
+
*/
|
|
73
|
+
export const threadDiscussToolbarConfig = {
|
|
74
|
+
when: ctx => Boolean(ctx.std.getOptional(ThreadMarksProvider)) &&
|
|
75
|
+
threadTargetOf(ctx) !== null,
|
|
76
|
+
actions: [
|
|
77
|
+
{
|
|
78
|
+
id: THREAD_DISCUSS_ACTION_ID,
|
|
79
|
+
icon: CommentIcon(),
|
|
80
|
+
labelWording: THREAD_DISCUSS,
|
|
81
|
+
tooltipWording: THREAD_DISCUSS,
|
|
82
|
+
run: ctx => {
|
|
83
|
+
const target = threadTargetOf(ctx);
|
|
84
|
+
if (target)
|
|
85
|
+
openThreadOn(ctx.std, target);
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Registered on the two wildcard rows, each under an owner key: the bare
|
|
92
|
+
* `affine:surface:*` is the root's built-in canvas module, and an owner key
|
|
93
|
+
* never collides with a bare one. `affine:*` is merged into every row the
|
|
94
|
+
* toolbar draws; `affine:surface:*` names the canvas rows explicitly, so a
|
|
95
|
+
* row that stopped merging `affine:*` would still offer it. Where both apply,
|
|
96
|
+
* the toolbar merges entries by id, so the row shows "Discuss" once. A new
|
|
97
|
+
* block or framework inherits it by doing nothing.
|
|
98
|
+
*/
|
|
99
|
+
export const threadDiscussToolbarExtensions = [
|
|
100
|
+
ToolbarModuleExtension({
|
|
101
|
+
id: BlockFlavourIdentifier(toolbarModuleKey('affine:*', 'thread')),
|
|
102
|
+
config: threadDiscussToolbarConfig,
|
|
103
|
+
}),
|
|
104
|
+
ToolbarModuleExtension({
|
|
105
|
+
id: BlockFlavourIdentifier(toolbarModuleKey('affine:surface:*', 'thread')),
|
|
106
|
+
config: threadDiscussToolbarConfig,
|
|
107
|
+
}),
|
|
108
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChromeWording } from '../affine-shared/services/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* "Discuss": the toolbar action that asks the host to open the discussion of
|
|
4
|
+
* a block or a canvas element, and the accessible name of the mark drawn on
|
|
5
|
+
* what already has one (ADR 0038).
|
|
6
|
+
*/
|
|
7
|
+
export declare const THREAD_DISCUSS: ChromeWording;
|
|
8
|
+
/** Every wording this package declares, in the order it renders them. */
|
|
9
|
+
export declare const THREAD_MARKS_WORDINGS: readonly ChromeWording[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Discuss": the toolbar action that asks the host to open the discussion of
|
|
3
|
+
* a block or a canvas element, and the accessible name of the mark drawn on
|
|
4
|
+
* what already has one (ADR 0038).
|
|
5
|
+
*/
|
|
6
|
+
export const THREAD_DISCUSS = [
|
|
7
|
+
'com.labre.thread.discuss',
|
|
8
|
+
'Discuss',
|
|
9
|
+
];
|
|
10
|
+
/** Every wording this package declares, in the order it renders them. */
|
|
11
|
+
export const THREAD_MARKS_WORDINGS = [THREAD_DISCUSS];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ViewExtensionContext, ViewExtensionProvider } from '../affine-ext-loader/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The "has a thread" seam's view side (ADR 0038): the marks widget and the
|
|
4
|
+
* "Discuss" toolbar module, in both views. Registered unconditionally: the
|
|
5
|
+
* seam, not a flag, decides whether anything shows (no flag gates a
|
|
6
|
+
* discussion, labre P5).
|
|
7
|
+
*/
|
|
8
|
+
export declare class ThreadMarksViewExtension extends ViewExtensionProvider {
|
|
9
|
+
name: string;
|
|
10
|
+
effect(): void;
|
|
11
|
+
setup(context: ViewExtensionContext): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ViewExtensionProvider, } from '../affine-ext-loader/index.js';
|
|
2
|
+
import { effects } from './effects.js';
|
|
3
|
+
import { threadMarksWidget } from './index.js';
|
|
4
|
+
import { threadDiscussToolbarExtensions } from './toolbar.js';
|
|
5
|
+
/**
|
|
6
|
+
* The "has a thread" seam's view side (ADR 0038): the marks widget and the
|
|
7
|
+
* "Discuss" toolbar module, in both views. Registered unconditionally: the
|
|
8
|
+
* seam, not a flag, decides whether anything shows (no flag gates a
|
|
9
|
+
* discussion, labre P5).
|
|
10
|
+
*/
|
|
11
|
+
export class ThreadMarksViewExtension extends ViewExtensionProvider {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.name = 'affine-thread-marks-widget';
|
|
15
|
+
}
|
|
16
|
+
effect() {
|
|
17
|
+
super.effect();
|
|
18
|
+
effects();
|
|
19
|
+
}
|
|
20
|
+
setup(context) {
|
|
21
|
+
super.setup(context);
|
|
22
|
+
context.register(threadMarksWidget);
|
|
23
|
+
context.register(threadDiscussToolbarExtensions);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ThreadMark } from '../affine-shared/services/index.js';
|
|
2
|
+
import { WidgetComponent } from '../std/index.js';
|
|
3
|
+
export declare const AFFINE_THREAD_MARKS_WIDGET = "affine-thread-marks-widget";
|
|
4
|
+
/**
|
|
5
|
+
* Where a mark sits, relative to the widget's own origin: beside a block of
|
|
6
|
+
* the page (`side`, in the right gutter, at the block's top), or on the
|
|
7
|
+
* top-right corner of a canvas model or of a block inside a canvas note
|
|
8
|
+
* (`corner`, centred on it).
|
|
9
|
+
*/
|
|
10
|
+
export interface ThreadMarkPlace {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
anchor: 'side' | 'corner';
|
|
14
|
+
}
|
|
15
|
+
export interface PlacedThreadMark extends ThreadMarkPlace {
|
|
16
|
+
mark: ThreadMark;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The marks to draw, from what the host says and where the editor finds each
|
|
20
|
+
* target. Pure, so the "ignore what is absent" rule is held by a test:
|
|
21
|
+
*
|
|
22
|
+
* - a target `locate` cannot find (deleted, of the other view, hidden for this
|
|
23
|
+
* viewer) is skipped, never an error: an orphan anchor has no mark;
|
|
24
|
+
* - a mark at `count <= 0` is not drawn;
|
|
25
|
+
* - two marks on one target are one mark: counts add up, unread wins.
|
|
26
|
+
*/
|
|
27
|
+
export declare function placeThreadMarks(marks: readonly ThreadMark[], locate: (mark: ThreadMark) => ThreadMarkPlace | null): PlacedThreadMark[];
|
|
28
|
+
/**
|
|
29
|
+
* The "has a thread" marks (ADR 0038), one widget for both views, mounted on
|
|
30
|
+
* the root like `remote-selection`: in the page view beside each marked block,
|
|
31
|
+
* on the canvas on the corner of each marked element or block. A click asks
|
|
32
|
+
* the host to open the discussion, exactly as "Discuss" does.
|
|
33
|
+
*
|
|
34
|
+
* It reads the seam and the layout, and writes nothing. Positions are
|
|
35
|
+
* client rects taken relative to the widget's own box and recomputed, once a
|
|
36
|
+
* frame at most, when the marks, the document, the canvas or the window
|
|
37
|
+
* change. Without the seam it renders nothing.
|
|
38
|
+
*/
|
|
39
|
+
export declare class ThreadMarksWidget extends WidgetComponent {
|
|
40
|
+
static styles: import("lit").CSSResult;
|
|
41
|
+
private readonly _refresh;
|
|
42
|
+
private get _edgeless();
|
|
43
|
+
connectedCallback(): void;
|
|
44
|
+
private _locate;
|
|
45
|
+
render(): unknown;
|
|
46
|
+
}
|
|
47
|
+
declare global {
|
|
48
|
+
interface HTMLElementTagNameMap {
|
|
49
|
+
[AFFINE_THREAD_MARKS_WIDGET]: ThreadMarksWidget;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { CommentIcon } from '@blocksuite/icons/lit';
|
|
2
|
+
import { isPainted } from '../affine-block-surface/index.js';
|
|
3
|
+
import { ThreadMarksProvider, translateKey, } from '../affine-shared/services/index.js';
|
|
4
|
+
import { isInsideEdgelessEditor, requestThrottledConnectedFrame, } from '../affine-shared/utils/index.js';
|
|
5
|
+
import { WidgetComponent } from '../std/index.js';
|
|
6
|
+
import { GfxBlockElementModel, GfxControllerIdentifier, GfxPrimitiveElementModel, } from '../std/gfx/index.js';
|
|
7
|
+
import { effect } from '@preact/signals-core';
|
|
8
|
+
import { cssVarV2 } from '@toeverything/theme/v2';
|
|
9
|
+
import { css, html, nothing, unsafeCSS } from 'lit';
|
|
10
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
11
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
12
|
+
import { openThreadOn } from './toolbar.js';
|
|
13
|
+
import { THREAD_DISCUSS } from './translations.js';
|
|
14
|
+
export const AFFINE_THREAD_MARKS_WIDGET = 'affine-thread-marks-widget';
|
|
15
|
+
/**
|
|
16
|
+
* The marks to draw, from what the host says and where the editor finds each
|
|
17
|
+
* target. Pure, so the "ignore what is absent" rule is held by a test:
|
|
18
|
+
*
|
|
19
|
+
* - a target `locate` cannot find (deleted, of the other view, hidden for this
|
|
20
|
+
* viewer) is skipped, never an error: an orphan anchor has no mark;
|
|
21
|
+
* - a mark at `count <= 0` is not drawn;
|
|
22
|
+
* - two marks on one target are one mark: counts add up, unread wins.
|
|
23
|
+
*/
|
|
24
|
+
export function placeThreadMarks(marks, locate) {
|
|
25
|
+
const merged = new Map();
|
|
26
|
+
for (const mark of marks) {
|
|
27
|
+
if (!(mark.count > 0))
|
|
28
|
+
continue;
|
|
29
|
+
const key = `${mark.targetType}:${mark.targetId}`;
|
|
30
|
+
const seen = merged.get(key);
|
|
31
|
+
merged.set(key, seen
|
|
32
|
+
? {
|
|
33
|
+
...seen,
|
|
34
|
+
count: seen.count + mark.count,
|
|
35
|
+
unread: seen.unread || mark.unread,
|
|
36
|
+
}
|
|
37
|
+
: mark);
|
|
38
|
+
}
|
|
39
|
+
const placed = [];
|
|
40
|
+
for (const mark of merged.values()) {
|
|
41
|
+
const place = locate(mark);
|
|
42
|
+
if (place)
|
|
43
|
+
placed.push({ ...place, mark });
|
|
44
|
+
}
|
|
45
|
+
return placed;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The "has a thread" marks (ADR 0038), one widget for both views, mounted on
|
|
49
|
+
* the root like `remote-selection`: in the page view beside each marked block,
|
|
50
|
+
* on the canvas on the corner of each marked element or block. A click asks
|
|
51
|
+
* the host to open the discussion, exactly as "Discuss" does.
|
|
52
|
+
*
|
|
53
|
+
* It reads the seam and the layout, and writes nothing. Positions are
|
|
54
|
+
* client rects taken relative to the widget's own box and recomputed, once a
|
|
55
|
+
* frame at most, when the marks, the document, the canvas or the window
|
|
56
|
+
* change. Without the seam it renders nothing.
|
|
57
|
+
*/
|
|
58
|
+
export class ThreadMarksWidget extends WidgetComponent {
|
|
59
|
+
constructor() {
|
|
60
|
+
super(...arguments);
|
|
61
|
+
this._refresh = requestThrottledConnectedFrame(() => {
|
|
62
|
+
this.requestUpdate();
|
|
63
|
+
}, this);
|
|
64
|
+
}
|
|
65
|
+
static { this.styles = css `
|
|
66
|
+
:host {
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
width: 0;
|
|
71
|
+
height: 0;
|
|
72
|
+
overflow: visible;
|
|
73
|
+
pointer-events: none;
|
|
74
|
+
z-index: 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.thread-mark {
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: 0;
|
|
80
|
+
left: 0;
|
|
81
|
+
gap: 2px;
|
|
82
|
+
padding: 0 6px 0 4px;
|
|
83
|
+
border-radius: 12px;
|
|
84
|
+
border: 1px solid ${unsafeCSS(cssVarV2('layer/insideBorder/border'))};
|
|
85
|
+
background: ${unsafeCSS(cssVarV2('layer/background/overlayPanel'))};
|
|
86
|
+
box-shadow: var(--affine-shadow-1);
|
|
87
|
+
color: ${unsafeCSS(cssVarV2('text/secondary'))};
|
|
88
|
+
pointer-events: auto;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.thread-mark[data-unread] {
|
|
92
|
+
color: ${unsafeCSS(cssVarV2('text/emphasis'))};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media (pointer: coarse) {
|
|
96
|
+
.thread-mark::after {
|
|
97
|
+
content: '';
|
|
98
|
+
position: absolute;
|
|
99
|
+
inset: -10px;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
`; }
|
|
103
|
+
get _edgeless() {
|
|
104
|
+
return isInsideEdgelessEditor(this.std.host);
|
|
105
|
+
}
|
|
106
|
+
connectedCallback() {
|
|
107
|
+
super.connectedCallback();
|
|
108
|
+
const { _disposables, std } = this;
|
|
109
|
+
// The seam is fixed for the editor's life: without it, follow nothing,
|
|
110
|
+
// so a host that has no threads pays nothing on a pan or a keystroke.
|
|
111
|
+
if (!std.getOptional(ThreadMarksProvider))
|
|
112
|
+
return;
|
|
113
|
+
_disposables.add(std.store.slots.blockUpdated.subscribe(this._refresh));
|
|
114
|
+
// A block mounts after the widget: a mark on it can only be placed then.
|
|
115
|
+
_disposables.add(std.view.viewUpdated.subscribe(this._refresh));
|
|
116
|
+
_disposables.addFromEvent(window, 'resize', this._refresh);
|
|
117
|
+
// Capture: the page view scrolls in a container, not the window.
|
|
118
|
+
_disposables.addFromEvent(window, 'scroll', this._refresh, true);
|
|
119
|
+
const gfx = std.getOptional(GfxControllerIdentifier);
|
|
120
|
+
if (gfx) {
|
|
121
|
+
_disposables.add(gfx.viewport.viewportUpdated.subscribe(this._refresh));
|
|
122
|
+
// The surface may load after the widget connects: follow it.
|
|
123
|
+
_disposables.add(effect(() => {
|
|
124
|
+
const surface = gfx.surface$.value;
|
|
125
|
+
if (!surface)
|
|
126
|
+
return;
|
|
127
|
+
this._refresh();
|
|
128
|
+
const subscriptions = [
|
|
129
|
+
surface.elementAdded.subscribe(this._refresh),
|
|
130
|
+
surface.elementRemoved.subscribe(this._refresh),
|
|
131
|
+
surface.elementUpdated.subscribe(this._refresh),
|
|
132
|
+
];
|
|
133
|
+
return () => subscriptions.forEach(s => s.unsubscribe());
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
_locate(mark, origin) {
|
|
138
|
+
const edgeless = this._edgeless;
|
|
139
|
+
if (edgeless) {
|
|
140
|
+
const gfx = this.std.get(GfxControllerIdentifier);
|
|
141
|
+
const model = gfx.getElementById(mark.targetId);
|
|
142
|
+
if (model instanceof GfxPrimitiveElementModel ||
|
|
143
|
+
model instanceof GfxBlockElementModel) {
|
|
144
|
+
// What this viewer does not see carries no mark (ADR 0031): the
|
|
145
|
+
// renderers' own predicate for an element, the local hide for a block.
|
|
146
|
+
const painted = model instanceof GfxPrimitiveElementModel
|
|
147
|
+
? isPainted(model, gfx.localVisibility)
|
|
148
|
+
: !gfx.localVisibility.isHidden(model);
|
|
149
|
+
if (!painted)
|
|
150
|
+
return null;
|
|
151
|
+
const bound = model.elementBound;
|
|
152
|
+
const [x, y] = gfx.viewport.toViewCoord(bound.maxX, bound.y);
|
|
153
|
+
return {
|
|
154
|
+
x: x + gfx.viewport.left - origin.left,
|
|
155
|
+
y: y + gfx.viewport.top - origin.top,
|
|
156
|
+
anchor: 'corner',
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (mark.targetType !== 'block')
|
|
161
|
+
return null;
|
|
162
|
+
const block = this.std.view.getBlock(mark.targetId);
|
|
163
|
+
if (!block)
|
|
164
|
+
return null;
|
|
165
|
+
const rect = block.getBoundingClientRect();
|
|
166
|
+
if (rect.width === 0 && rect.height === 0)
|
|
167
|
+
return null;
|
|
168
|
+
return {
|
|
169
|
+
x: rect.right - origin.left,
|
|
170
|
+
y: rect.top - origin.top,
|
|
171
|
+
anchor: edgeless ? 'corner' : 'side',
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
render() {
|
|
175
|
+
const service = this.std.getOptional(ThreadMarksProvider);
|
|
176
|
+
if (!service)
|
|
177
|
+
return nothing;
|
|
178
|
+
const marks = service.marks$.value;
|
|
179
|
+
if (marks.length === 0)
|
|
180
|
+
return nothing;
|
|
181
|
+
const origin = this.getBoundingClientRect();
|
|
182
|
+
const placed = placeThreadMarks(marks, mark => this._locate(mark, origin));
|
|
183
|
+
if (placed.length === 0)
|
|
184
|
+
return nothing;
|
|
185
|
+
const label = translateKey(this.std, ...THREAD_DISCUSS);
|
|
186
|
+
return repeat(placed, ({ mark }) => `${mark.targetType}:${mark.targetId}`, ({ mark, x, y, anchor }) => html `<icon-button
|
|
187
|
+
class="thread-mark"
|
|
188
|
+
data-testid="thread-mark"
|
|
189
|
+
data-target-type=${mark.targetType}
|
|
190
|
+
data-target-id=${mark.targetId}
|
|
191
|
+
?data-unread=${mark.unread}
|
|
192
|
+
width="auto"
|
|
193
|
+
height="24px"
|
|
194
|
+
.active=${mark.unread}
|
|
195
|
+
.text=${String(mark.count)}
|
|
196
|
+
aria-label=${label}
|
|
197
|
+
title=${label}
|
|
198
|
+
style=${styleMap({
|
|
199
|
+
transform: anchor === 'side'
|
|
200
|
+
? `translate(${x + 8}px, ${y}px)`
|
|
201
|
+
: `translate(${x}px, ${y}px) translate(-50%, -50%)`,
|
|
202
|
+
})}
|
|
203
|
+
@pointerdown=${(event) => event.stopPropagation()}
|
|
204
|
+
@click=${(event) => {
|
|
205
|
+
event.stopPropagation();
|
|
206
|
+
openThreadOn(this.std, {
|
|
207
|
+
targetType: mark.targetType,
|
|
208
|
+
targetId: mark.targetId,
|
|
209
|
+
});
|
|
210
|
+
}}
|
|
211
|
+
>${CommentIcon({ width: '16px', height: '16px' })}</icon-button
|
|
212
|
+
>`);
|
|
213
|
+
}
|
|
214
|
+
}
|
package/dist/commands.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { frameCommands } from './_pkgs/affine-block-frame/index.js';
|
|
2
|
-
import { copyLinkCommands, coreCommands, pivotCommands, readingCommands, tagCommands, } from './_pkgs/affine-block-root/index.js';
|
|
3
|
-
import { auditCommands, canvasExportCommands, canvasGridCommands, exportSvgCommands, mapQualityCommands, selectionPaneCommands, userLayerCommands, } from './_pkgs/affine-block-surface/index.js';
|
|
2
|
+
import { copyLinkCommands, coreCommands, pageExportCommands, pivotCommands, readingCommands, tagCommands, } from './_pkgs/affine-block-root/index.js';
|
|
3
|
+
import { auditCommands, canvasDrawioExportCommands, canvasExportCommands, canvasGridCommands, canvasSvgExportCommands, exportSvgCommands, mapQualityCommands, selectionPaneCommands, userLayerCommands, } from './_pkgs/affine-block-surface/index.js';
|
|
4
4
|
import { edgeDirectionCommands } from './_pkgs/affine-gfx-connector/index.js';
|
|
5
5
|
import { shapeCommands } from './_pkgs/affine-gfx-shape/index.js';
|
|
6
6
|
import { toCommandManifestEntry, } from './_pkgs/std/index.js';
|
|
@@ -49,6 +49,7 @@ export function getCommands(flags) {
|
|
|
49
49
|
return buildCommandRegistry([
|
|
50
50
|
...coreCommands,
|
|
51
51
|
...copyLinkCommands,
|
|
52
|
+
...pageExportCommands,
|
|
52
53
|
...pivotCommands,
|
|
53
54
|
...tagCommands,
|
|
54
55
|
...readingCommands,
|
|
@@ -59,6 +60,8 @@ export function getCommands(flags) {
|
|
|
59
60
|
...frameCommands,
|
|
60
61
|
...canvasGridCommands,
|
|
61
62
|
...canvasExportCommands,
|
|
63
|
+
...canvasDrawioExportCommands,
|
|
64
|
+
...canvasSvgExportCommands,
|
|
62
65
|
...userLayerCommands,
|
|
63
66
|
...edgeDirectionCommands,
|
|
64
67
|
...(isCapabilityEnabled(flags, 'ai-audit') ? auditCommands : []),
|
package/dist/extensions/view.js
CHANGED
|
@@ -54,6 +54,7 @@ import { PageDraggingAreaViewExtension } from '../_pkgs/affine-widget-page-dragg
|
|
|
54
54
|
import { RemoteSelectionViewExtension } from '../_pkgs/affine-widget-remote-selection/view.js';
|
|
55
55
|
import { ScrollAnchoringViewExtension } from '../_pkgs/affine-widget-scroll-anchoring/view.js';
|
|
56
56
|
import { SlashMenuViewExtension } from '../_pkgs/affine-widget-slash-menu/view.js';
|
|
57
|
+
import { ThreadMarksViewExtension } from '../_pkgs/affine-widget-thread-marks/view.js';
|
|
57
58
|
import { ToolbarViewExtension } from '../_pkgs/affine-widget-toolbar/view.js';
|
|
58
59
|
import { ViewportOverlayViewExtension } from '../_pkgs/affine-widget-viewport-overlay/view.js';
|
|
59
60
|
import { isBlockEnabled, isCapabilityEnabled, } from '../flags.js';
|
|
@@ -158,6 +159,7 @@ export function getInternalViewExtensions(flags) {
|
|
|
158
159
|
KeyboardToolbarViewExtension,
|
|
159
160
|
LinkedDocViewExtension,
|
|
160
161
|
RemoteSelectionViewExtension,
|
|
162
|
+
ThreadMarksViewExtension,
|
|
161
163
|
ScrollAnchoringViewExtension,
|
|
162
164
|
SlashMenuViewExtension,
|
|
163
165
|
ToolbarViewExtension,
|
package/dist/host-panels.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type FramePreview } from './_pkgs/affine-fragment-frame-panel/index.js';
|
|
2
2
|
import type { FrameBlockModel } from './_pkgs/affine-model/index.js';
|
|
3
|
+
import { type TranslationParams } from './_pkgs/affine-shared/services/index.js';
|
|
3
4
|
import { type BlockStdScope, type CommandFile } from './_pkgs/std/index.js';
|
|
4
5
|
/**
|
|
5
6
|
* `@labre/affine/host-panels` — the verbs a host's own panel calls (ADR 0034
|
|
@@ -57,6 +58,9 @@ export { type SelectionPaneNode, selectionPaneTree, } from './_pkgs/affine-block
|
|
|
57
58
|
export { frameCommands, type ReorderFramesParams, reorderFramesParams, } from './_pkgs/affine-block-frame/index.js';
|
|
58
59
|
export { formatPropertyValue, isPropertyValueEmpty, } from './_pkgs/affine-fragment-doc-title/index.js';
|
|
59
60
|
export type { PropertiesPanelRequest, PropertiesPanelService, TitleBandNotShownPage, TitleBandProperty, TitleBandService, TitleBandSheetState, } from './_pkgs/affine-shared/services/index.js';
|
|
61
|
+
export { ThreadMarksExtension } from './_pkgs/affine-shared/services/index.js';
|
|
62
|
+
export type { ThreadMark, ThreadMarksService, ThreadMarkTargetType, ThreadOpenRequest, } from './_pkgs/affine-shared/services/index.js';
|
|
63
|
+
export { type ThreadTarget, threadExcerpt, } from './_pkgs/affine-widget-thread-marks/index.js';
|
|
60
64
|
/**
|
|
61
65
|
* The document's frames in presentation order, first slide first — the order
|
|
62
66
|
* `canvas.frame.reorder` writes and the presentation walks. Works in page mode
|
|
@@ -121,6 +125,13 @@ export interface ViewAction {
|
|
|
121
125
|
label: string;
|
|
122
126
|
/** The `com.labre.*` key behind {@link label}, for a host that translates itself. */
|
|
123
127
|
labelKey: string;
|
|
128
|
+
/**
|
|
129
|
+
* The `{{name}}` values {@link labelKey} is filled with, for a host that
|
|
130
|
+
* translates itself — present only on a label that has placeholders (the
|
|
131
|
+
* framework exports: `{ framework, extension }`, the framework's name
|
|
132
|
+
* already resolved). {@link label} has them filled in.
|
|
133
|
+
*/
|
|
134
|
+
labelParams?: TranslationParams;
|
|
124
135
|
/** Stable asset key; `getCommandIcon(std, iconKey)` is the library's icon. */
|
|
125
136
|
iconKey?: string;
|
|
126
137
|
/** Present only on a toggle: the state a check mark shows. */
|
|
@@ -143,7 +154,8 @@ export interface ViewActionResult {
|
|
|
143
154
|
/**
|
|
144
155
|
* The actions proper to the view the editor shows now, in their declared
|
|
145
156
|
* order: the commands registered on the `'view-menu'` surface whose `scope`
|
|
146
|
-
* is this mode (or `'global'`) and whose `when` holds
|
|
157
|
+
* is this mode (or `'global'`) and whose `when` holds, and on the canvas
|
|
158
|
+
* one export per framework format the interchange registry can write.
|
|
147
159
|
*
|
|
148
160
|
* `mode` is the view the host shows; omitted, it is read from
|
|
149
161
|
* `DocModeProvider`, and a provider that does not know (the library default
|
|
@@ -157,6 +169,17 @@ export interface ViewActionResult {
|
|
|
157
169
|
* mode switch: the `std` is rebuilt.
|
|
158
170
|
*/
|
|
159
171
|
export declare function getViewActions(std: BlockStdScope, mode?: 'page' | 'edgeless'): ViewAction[];
|
|
172
|
+
/**
|
|
173
|
+
* The exports of the view the editor shows now — the `'export'` section of
|
|
174
|
+
* {@link getViewActions}, in the same order: what a host lists in ONE
|
|
175
|
+
* "Export…" menu. On the page: Markdown and HTML. On the canvas: PNG and PDF
|
|
176
|
+
* (with an `ExportManager`), draw.io, SVG (with a canvas renderer), one entry
|
|
177
|
+
* per framework format the registry writes (`canvas.export.<framework>.<format>`,
|
|
178
|
+
* listed while the board holds that framework's elements), then Markdown and
|
|
179
|
+
* HTML. Every one resolves {@link runViewAction} with `{ file }` and downloads
|
|
180
|
+
* nothing.
|
|
181
|
+
*/
|
|
182
|
+
export declare function getViewExports(std: BlockStdScope, mode?: 'page' | 'edgeless'): ViewAction[];
|
|
160
183
|
/**
|
|
161
184
|
* Run one entry of {@link getViewActions} by its id, through `runCommand`'s
|
|
162
185
|
* bottleneck (usage and telemetry recorded once), and wait for it.
|