@formicoidea/labre-core 0.33.0 → 0.34.2
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/attachment-block.js +2 -2
- package/dist/_pkgs/affine-block-attachment/configs/toolbar.d.ts +2 -2
- package/dist/_pkgs/affine-block-attachment/configs/toolbar.js +9 -7
- package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +12 -12
- package/dist/_pkgs/affine-block-code/code-block.js +2 -2
- package/dist/_pkgs/affine-block-code/code-toolbar/config.js +6 -0
- package/dist/_pkgs/affine-block-database/database-block.js +2 -2
- package/dist/_pkgs/affine-block-embed/common/render-linked-doc.js +3 -3
- package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -11
- package/dist/_pkgs/affine-block-embed/embed-html-block/configs/toolbar.js +5 -5
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.d.ts +7 -7
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +12 -12
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +2 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/configs/toolbar.js +9 -9
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-linked-doc-block.js +4 -4
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/components/embed-synced-doc-card.js +5 -4
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +9 -9
- package/dist/_pkgs/affine-block-frame/frame-toolbar.js +2 -2
- package/dist/_pkgs/affine-block-image/configs/toolbar.js +4 -4
- package/dist/_pkgs/affine-block-note/configs/toolbar.js +2 -2
- package/dist/_pkgs/affine-block-root/configs/toolbar.d.ts +6 -4
- package/dist/_pkgs/affine-block-root/configs/toolbar.js +6 -6
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.d.ts +10 -10
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/misc.js +4 -4
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.d.ts +7 -7
- package/dist/_pkgs/affine-block-root/edgeless/configs/toolbar/more.js +8 -8
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +3 -1
- package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +15 -4
- package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +17 -0
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.d.ts +21 -0
- package/dist/_pkgs/affine-block-surface/extensions/spotlight.js +17 -3
- 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/renderer/element-highlight-overlay.d.ts +17 -0
- package/dist/_pkgs/affine-block-surface/renderer/element-highlight-overlay.js +66 -0
- package/dist/_pkgs/affine-block-surface/view.js +5 -0
- package/dist/_pkgs/affine-block-surface-ref/configs/toolbar.js +4 -4
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/highlight-duotone-icon.js +8 -8
- package/dist/_pkgs/affine-components/highlight-dropdown-menu/text-duotone-icon.js +11 -11
- package/dist/_pkgs/affine-components/icons/text.js +426 -426
- package/dist/_pkgs/affine-components/open-doc-dropdown-menu/dropdown-menu.d.ts +2 -0
- package/dist/_pkgs/affine-components/resource/resource.js +2 -0
- package/dist/_pkgs/affine-components/view-dropdown-menu/dropdown-menu.js +27 -14
- package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.d.ts +4 -4
- package/dist/_pkgs/affine-inline-link/link-node/configs/toolbar.js +6 -6
- package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.d.ts +4 -4
- package/dist/_pkgs/affine-inline-reference/reference-node/configs/toolbar.js +6 -6
- package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +61 -0
- package/dist/_pkgs/affine-model/elements/bpmn/pool.js +93 -0
- package/dist/_pkgs/affine-model/elements/cynefin/cynefin.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/cynefin/cynefin.js +9 -4
- package/dist/_pkgs/affine-model/elements/edgy/board.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/edgy/board.js +9 -4
- package/dist/_pkgs/affine-model/elements/edgy/facets.d.ts +20 -3
- package/dist/_pkgs/affine-model/elements/edgy/facets.js +13 -4
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/estuarine/estuarine.js +9 -4
- package/dist/_pkgs/affine-model/elements/framework-background/background.d.ts +7 -2
- package/dist/_pkgs/affine-model/elements/framework-background/background.js +9 -4
- package/dist/_pkgs/affine-model/elements/framework-background/hit-test.d.ts +48 -0
- package/dist/_pkgs/affine-model/elements/framework-background/hit-test.js +55 -0
- package/dist/_pkgs/affine-model/elements/framework-background/index.d.ts +1 -0
- package/dist/_pkgs/affine-model/elements/framework-background/index.js +1 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +11 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.js +15 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/action.d.ts +32 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/action.js +16 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/flags.d.ts +10 -0
- package/dist/_pkgs/affine-shared/services/toolbar-service/flags.js +32 -1
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +106 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +201 -0
- package/dist/_pkgs/affine-shared/services/translation-service/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/services/translation-service/index.js +1 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.d.ts +11 -16
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/catalogue-groups.js +11 -28
- package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +2 -1
- package/dist/_pkgs/affine-widget-keyboard-toolbar/icons.js +98 -98
- package/dist/_pkgs/affine-widget-slash-menu/config.js +2 -1
- package/dist/_pkgs/affine-widget-toolbar/toolbar.js +5 -0
- package/dist/_pkgs/affine-widget-toolbar/utils.d.ts +19 -2
- package/dist/_pkgs/affine-widget-toolbar/utils.js +22 -7
- package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +11 -11
- package/dist/_pkgs/data-view/core/utils/menu-title.js +17 -17
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/group-title.js +18 -18
- package/dist/_pkgs/std/extension/command-registry.d.ts +36 -0
- package/dist/_pkgs/std/extension/command-registry.js +16 -0
- package/dist/_pkgs/std/extension/translation-manifest.d.ts +46 -1
- package/dist/_pkgs/std/extension/translation-manifest.js +58 -0
- package/dist/_pkgs/std/gfx/highlight.d.ts +84 -0
- package/dist/_pkgs/std/gfx/highlight.js +112 -0
- package/dist/_pkgs/std/gfx/index.d.ts +1 -0
- package/dist/_pkgs/std/gfx/index.js +1 -0
- package/dist/_pkgs/std/gfx/interactivity/gfx-view-event-handler.js +17 -3
- package/dist/_pkgs/std/scope/std-scope.d.ts +2 -1
- package/dist/_pkgs/std/scope/std-scope.js +2 -0
- package/dist/_pkgs/std/utils/gfx.js +2 -0
- package/dist/shortcuts.d.ts +20 -6
- package/dist/shortcuts.js +7 -9
- package/dist/translations.js +25 -18
- package/package.json +13 -1
|
@@ -125,10 +125,21 @@ const REMARKS_IN_A_NOTIFICATION = 5;
|
|
|
125
125
|
* rule is this simple one and not a title-casing.
|
|
126
126
|
*/
|
|
127
127
|
const formatLabel = (format) => format.id.toUpperCase();
|
|
128
|
-
/**
|
|
129
|
-
|
|
128
|
+
/**
|
|
129
|
+
* One remark, as the line a reader sees.
|
|
130
|
+
*
|
|
131
|
+
* The reader that produced it had no `std` and could not translate it (P3), so
|
|
132
|
+
* this is where a remark that declared a key gets its wording — with its own
|
|
133
|
+
* `message` as the English default, exactly like every other `translateKey`
|
|
134
|
+
* call site. A remark with no key is one that names something out of the file
|
|
135
|
+
* and is shown as the reader wrote it (see `InterchangeNote.messageKey`).
|
|
136
|
+
*/
|
|
137
|
+
function remarkLine(std, note) {
|
|
138
|
+
const message = note.messageKey
|
|
139
|
+
? translateKey(std, note.messageKey, note.message)
|
|
140
|
+
: note.message;
|
|
130
141
|
const subject = note.sourceId ?? note.element;
|
|
131
|
-
return subject ? `${subject}: ${
|
|
142
|
+
return subject ? `${subject}: ${message}` : message;
|
|
132
143
|
}
|
|
133
144
|
/**
|
|
134
145
|
* The notification seam, or silence.
|
|
@@ -214,7 +225,7 @@ export function reportInterchangeImport(std, format, report) {
|
|
|
214
225
|
notifyImport(std, {
|
|
215
226
|
title: translateKey(std, IMPORT_REMARKS_KEY, IMPORT_REMARKS_FALLBACK),
|
|
216
227
|
message: notes.length <= REMARKS_IN_A_NOTIFICATION
|
|
217
|
-
? notes.map(remarkLine).join('\n')
|
|
228
|
+
? notes.map(note => remarkLine(std, note)).join('\n')
|
|
218
229
|
: `${notes.length} ${translateKey(std, IMPORT_CONSOLE_KEY, IMPORT_CONSOLE_FALLBACK)}`,
|
|
219
230
|
// Not `error`, and not `info`: nothing failed — every one of these is
|
|
220
231
|
// something the document KEPT — but each one is a difference between the
|
|
@@ -95,6 +95,23 @@ export interface InterchangeNote {
|
|
|
95
95
|
element?: string;
|
|
96
96
|
/** One line, in the user's words: what happened and what it costs them. */
|
|
97
97
|
message: string;
|
|
98
|
+
/**
|
|
99
|
+
* The i18n key {@link message} is the English default of — set only when the
|
|
100
|
+
* remark is a FIXED sentence.
|
|
101
|
+
*
|
|
102
|
+
* A reader is a pure function of text (`docs/adr/0012`, P3): it has no `std`,
|
|
103
|
+
* so it cannot reach the host's catalogue and hands the key over instead, and
|
|
104
|
+
* `reportInterchangeImport` resolves it when it draws the report. That is the
|
|
105
|
+
* whole of the seam here, and it deliberately covers only the remarks that
|
|
106
|
+
* say the same thing every time.
|
|
107
|
+
*
|
|
108
|
+
* A remark that NAMES something out of the file — an element, an id, a count
|
|
109
|
+
* of lanes — carries no key and stays English. The seam has no interpolation
|
|
110
|
+
* and no pluralisation (both are the host's), so the alternative would be to
|
|
111
|
+
* invent a grammar for sentences with holes in them, which is exactly what
|
|
112
|
+
* the three interchange count labels already refuse to do.
|
|
113
|
+
*/
|
|
114
|
+
messageKey?: string;
|
|
98
115
|
}
|
|
99
116
|
/**
|
|
100
117
|
* The five things worth saying about one item, and no sixth.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ConnectorElementModel } from '../../affine-model/index.js';
|
|
2
|
+
import type { Bound } from '../../global/gfx/index.js';
|
|
2
3
|
import type { GfxModel } from '../../std/gfx/index.js';
|
|
3
4
|
import { InteractivityExtension } from '../../std/gfx/index.js';
|
|
4
5
|
import type { ExtensionType } from '../../store/index.js';
|
|
@@ -25,6 +26,26 @@ export declare function SpotlightHostExtension(elementType: string): ExtensionTy
|
|
|
25
26
|
* two endpoints). Pure — exported for unit tests.
|
|
26
27
|
*/
|
|
27
28
|
export declare function spotlightSet(target: GfxModel, getConnectors: (id: string) => ConnectorElementModel[]): Set<string>;
|
|
29
|
+
/** The shape {@link findSpotlightHost} needs of a candidate host. */
|
|
30
|
+
export type SpotlightHostCandidate = {
|
|
31
|
+
type: string;
|
|
32
|
+
elementBound: Bound;
|
|
33
|
+
spotlightEnabled?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The host that grants `target` the spotlight, or `null` when none does.
|
|
37
|
+
*
|
|
38
|
+
* A host qualifies when its type was REGISTERED as a spotlight host
|
|
39
|
+
* (`SpotlightHostExtension`), when it did not opt out (`spotlightEnabled:
|
|
40
|
+
* false`, its toolbar toggle) and when its bounds contain the target. A
|
|
41
|
+
* background whose type is not registered grants nothing, whatever fields it
|
|
42
|
+
* carries — that is how the EDGY facets Venn stopped spotlighting (#195).
|
|
43
|
+
*
|
|
44
|
+
* Pure — exported for unit tests.
|
|
45
|
+
*/
|
|
46
|
+
export declare function findSpotlightHost<T extends SpotlightHostCandidate>(target: {
|
|
47
|
+
elementBound: Bound;
|
|
48
|
+
}, elements: readonly T[], hostTypes: readonly string[]): T | null;
|
|
28
49
|
export declare class SpotlightManager extends InteractivityExtension {
|
|
29
50
|
static key: string;
|
|
30
51
|
/** Elements currently faded, restored on leave. */
|
|
@@ -47,6 +47,22 @@ export function spotlightSet(target, getConnectors) {
|
|
|
47
47
|
}
|
|
48
48
|
return keep;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* The host that grants `target` the spotlight, or `null` when none does.
|
|
52
|
+
*
|
|
53
|
+
* A host qualifies when its type was REGISTERED as a spotlight host
|
|
54
|
+
* (`SpotlightHostExtension`), when it did not opt out (`spotlightEnabled:
|
|
55
|
+
* false`, its toolbar toggle) and when its bounds contain the target. A
|
|
56
|
+
* background whose type is not registered grants nothing, whatever fields it
|
|
57
|
+
* carries — that is how the EDGY facets Venn stopped spotlighting (#195).
|
|
58
|
+
*
|
|
59
|
+
* Pure — exported for unit tests.
|
|
60
|
+
*/
|
|
61
|
+
export function findSpotlightHost(target, elements, hostTypes) {
|
|
62
|
+
return (elements.find(el => hostTypes.includes(el.type) &&
|
|
63
|
+
el.spotlightEnabled !== false &&
|
|
64
|
+
el.elementBound.contains(target.elementBound)) ?? null);
|
|
65
|
+
}
|
|
50
66
|
/** Delay before a new spotlight is applied / cleared, so brushing across
|
|
51
67
|
* elements doesn't flash the fade on and off. */
|
|
52
68
|
const SPOTLIGHT_DELAY_MS = 140;
|
|
@@ -120,9 +136,7 @@ export class SpotlightManager extends InteractivityExtension {
|
|
|
120
136
|
// The behavior is granted by a host whose bounds contain the target —
|
|
121
137
|
// unless that host opted out (`spotlightEnabled: false`, toolbar toggle).
|
|
122
138
|
const host = target
|
|
123
|
-
? surface.elementModels
|
|
124
|
-
el.spotlightEnabled !== false &&
|
|
125
|
-
el.elementBound.contains(target.elementBound))
|
|
139
|
+
? findSpotlightHost(target, surface.elementModels, hostTypes)
|
|
126
140
|
: null;
|
|
127
141
|
if (!target || !host) {
|
|
128
142
|
// Debounced restore: brushing across the gaps between elements must not
|
|
@@ -4,6 +4,7 @@ export { SurfaceElementModel, SurfaceGroupLikeModel, } from './element-model/bas
|
|
|
4
4
|
export { CanvasElementType } from './element-model/index.js';
|
|
5
5
|
export { CanvasRenderer } from './renderer/canvas-renderer.js';
|
|
6
6
|
export { DomRenderer } from './renderer/dom-renderer.js';
|
|
7
|
+
export { ElementHighlightOverlay } from './renderer/element-highlight-overlay.js';
|
|
7
8
|
export type { ElementRenderer } from './renderer/elements/index.js';
|
|
8
9
|
export * from './renderer/elements/type.js';
|
|
9
10
|
export { Overlay, OverlayIdentifier } from './renderer/overlay.js';
|
|
@@ -6,6 +6,7 @@ export { SurfaceElementModel, SurfaceGroupLikeModel, } from './element-model/bas
|
|
|
6
6
|
export { CanvasElementType } from './element-model/index.js';
|
|
7
7
|
export { CanvasRenderer } from './renderer/canvas-renderer.js';
|
|
8
8
|
export { DomRenderer } from './renderer/dom-renderer.js';
|
|
9
|
+
export { ElementHighlightOverlay } from './renderer/element-highlight-overlay.js';
|
|
9
10
|
export * from './renderer/elements/type.js';
|
|
10
11
|
export { Overlay, OverlayIdentifier } from './renderer/overlay.js';
|
|
11
12
|
export { ToolOverlay } from './renderer/tool-overlay.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GfxController } from '../../std/gfx/index.js';
|
|
2
|
+
import { Overlay } from './overlay.js';
|
|
3
|
+
/**
|
|
4
|
+
* Draws the transient emphasis ring around the elements held by
|
|
5
|
+
* `gfx.highlight` (`ElementHighlightManager`).
|
|
6
|
+
*
|
|
7
|
+
* The overlay is a pure renderer: it owns no state, reads nothing from the
|
|
8
|
+
* store and mutates nothing, which makes it safe on a read-only editor.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ElementHighlightOverlay extends Overlay {
|
|
11
|
+
static overlayName: string;
|
|
12
|
+
private readonly _disposables;
|
|
13
|
+
private get _strokeColor();
|
|
14
|
+
constructor(gfx: GfxController);
|
|
15
|
+
dispose(): void;
|
|
16
|
+
render(ctx: CanvasRenderingContext2D): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ThemeProvider } from '../../affine-shared/services/index.js';
|
|
2
|
+
import { DisposableGroup } from '../../global/disposable/index.js';
|
|
3
|
+
import { effect } from '@preact/signals-core';
|
|
4
|
+
import { Overlay } from './overlay.js';
|
|
5
|
+
/** Ring thickness, in screen pixels. */
|
|
6
|
+
const HIGHLIGHT_STROKE_WIDTH = 2;
|
|
7
|
+
/** Gap between the element bounds and the ring, in screen pixels. */
|
|
8
|
+
const HIGHLIGHT_GAP = 4;
|
|
9
|
+
/** Ring corner radius, in screen pixels. */
|
|
10
|
+
const HIGHLIGHT_RADIUS = 4;
|
|
11
|
+
/** Used when no theme is provided, matches the legacy frame highlight. */
|
|
12
|
+
const FALLBACK_HIGHLIGHT_COLOR = '#1E96EB';
|
|
13
|
+
/**
|
|
14
|
+
* Draws the transient emphasis ring around the elements held by
|
|
15
|
+
* `gfx.highlight` (`ElementHighlightManager`).
|
|
16
|
+
*
|
|
17
|
+
* The overlay is a pure renderer: it owns no state, reads nothing from the
|
|
18
|
+
* store and mutates nothing, which makes it safe on a read-only editor.
|
|
19
|
+
*/
|
|
20
|
+
export class ElementHighlightOverlay extends Overlay {
|
|
21
|
+
static { this.overlayName = 'element-highlight'; }
|
|
22
|
+
get _strokeColor() {
|
|
23
|
+
return (this.gfx.std
|
|
24
|
+
.getOptional(ThemeProvider)
|
|
25
|
+
?.getCssVariableColor('--affine-primary-color') ??
|
|
26
|
+
FALLBACK_HIGHLIGHT_COLOR);
|
|
27
|
+
}
|
|
28
|
+
constructor(gfx) {
|
|
29
|
+
super(gfx);
|
|
30
|
+
this._disposables = new DisposableGroup();
|
|
31
|
+
this._disposables.add(effect(() => {
|
|
32
|
+
// Repaint the canvas whenever the highlighted set changes.
|
|
33
|
+
this.gfx.highlight.highlighted$.value;
|
|
34
|
+
this.refresh();
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
dispose() {
|
|
38
|
+
this._disposables.dispose();
|
|
39
|
+
}
|
|
40
|
+
render(ctx) {
|
|
41
|
+
const elements = this.gfx.highlight.highlightedElements;
|
|
42
|
+
if (elements.length === 0)
|
|
43
|
+
return;
|
|
44
|
+
const { zoom } = this.gfx.viewport;
|
|
45
|
+
const gap = HIGHLIGHT_GAP / zoom;
|
|
46
|
+
const radius = HIGHLIGHT_RADIUS / zoom;
|
|
47
|
+
ctx.save();
|
|
48
|
+
ctx.strokeStyle = this._strokeColor;
|
|
49
|
+
ctx.lineWidth = HIGHLIGHT_STROKE_WIDTH / zoom;
|
|
50
|
+
for (const element of elements) {
|
|
51
|
+
const [x, y, w, h] = element.deserializedXYWH;
|
|
52
|
+
ctx.save();
|
|
53
|
+
// Rotate around the element center so rotated elements keep a tight
|
|
54
|
+
// ring; connectors and other non-rotatable elements use their bound box.
|
|
55
|
+
ctx.translate(x + w / 2, y + h / 2);
|
|
56
|
+
if (element.rotate) {
|
|
57
|
+
ctx.rotate((element.rotate * Math.PI) / 180);
|
|
58
|
+
}
|
|
59
|
+
ctx.beginPath();
|
|
60
|
+
ctx.roundRect(-w / 2 - gap, -h / 2 - gap, w + gap * 2, h + gap * 2, radius);
|
|
61
|
+
ctx.stroke();
|
|
62
|
+
ctx.restore();
|
|
63
|
+
}
|
|
64
|
+
ctx.restore();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -4,6 +4,7 @@ import { literal } from 'lit/static-html.js';
|
|
|
4
4
|
import { effects } from './effects.js';
|
|
5
5
|
import { auditCommands, EdgelessCRUDExtension, EdgelessLegacySlotExtension, EditPropsMiddlewareBuilder, mapQualityCommands, mapQualityWidget, ReadingManager, readingProposalWidget, readingToolbarExtension, SpotlightManager, ValidationManager, validationExceptionToolbarExtension, ValidationOverlay, violationDetailWidget, } from './extensions/index.js';
|
|
6
6
|
import { ExportManagerExtension } from './extensions/export-manager/export-manager.js';
|
|
7
|
+
import { ElementHighlightOverlay } from './renderer/element-highlight-overlay.js';
|
|
7
8
|
import { DefaultTool } from './tool/default-tool.js';
|
|
8
9
|
export class SurfaceViewExtension extends ViewExtensionProvider {
|
|
9
10
|
constructor() {
|
|
@@ -26,6 +27,10 @@ export class SurfaceViewExtension extends ViewExtensionProvider {
|
|
|
26
27
|
context.register(DefaultTool);
|
|
27
28
|
context.register(BlockViewExtension('affine:surface', literal `affine-surface`));
|
|
28
29
|
context.register(EditPropsMiddlewareBuilder);
|
|
30
|
+
// Draws `gfx.highlightElements(...)`. Registered for `preview-edgeless`
|
|
31
|
+
// too — embedded read-only windows are the API's primary consumer — and
|
|
32
|
+
// paints nothing until a host asks for a highlight.
|
|
33
|
+
context.register(ElementHighlightOverlay);
|
|
29
34
|
// No-op until a framework registers a SpotlightHostExtension.
|
|
30
35
|
context.register(SpotlightManager);
|
|
31
36
|
// No-op until a framework registers a ValidationRuleExtension — which
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toast } from '../../affine-components/toast/index.js';
|
|
2
2
|
import { copySelectedModelsCommand, draftSelectedModelsCommand, } from '../../affine-shared/commands/index.js';
|
|
3
|
-
import { ActionPlacement, blockCommentToolbarButton, } from '../../affine-shared/services/index.js';
|
|
3
|
+
import { ActionPlacement, blockCommentToolbarButton, TOAST_COPIED_TO_CLIPBOARD, TOOLBAR_COPY, TOOLBAR_DELETE, translateKey, } from '../../affine-shared/services/index.js';
|
|
4
4
|
import { CaptionIcon, CopyIcon, DeleteIcon } from '@blocksuite/icons/lit';
|
|
5
5
|
import { html } from 'lit';
|
|
6
6
|
import { SurfaceRefBlockComponent } from '../surface-ref-block.js';
|
|
@@ -20,7 +20,7 @@ export const surfaceRefToolbarModuleConfig = {
|
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
id: 'c.copy-surface-ref',
|
|
23
|
-
|
|
23
|
+
labelWording: TOOLBAR_COPY,
|
|
24
24
|
icon: CopyIcon(),
|
|
25
25
|
run: ctx => {
|
|
26
26
|
const surfaceRefBlock = ctx.getCurrentBlockByType(SurfaceRefBlockComponent);
|
|
@@ -32,7 +32,7 @@ export const surfaceRefToolbarModuleConfig = {
|
|
|
32
32
|
})
|
|
33
33
|
.pipe(copySelectedModelsCommand)
|
|
34
34
|
.run();
|
|
35
|
-
toast(surfaceRefBlock.std.host,
|
|
35
|
+
toast(surfaceRefBlock.std.host, translateKey(surfaceRefBlock.std, ...TOAST_COPIED_TO_CLIPBOARD));
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
{
|
|
@@ -64,7 +64,7 @@ export const surfaceRefToolbarModuleConfig = {
|
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
id: 'g.surface-ref-deletion',
|
|
67
|
-
|
|
67
|
+
labelWording: TOOLBAR_DELETE,
|
|
68
68
|
icon: DeleteIcon(),
|
|
69
69
|
placement: ActionPlacement.More,
|
|
70
70
|
variant: 'destructive',
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { HighLightDuotoneIcon } from '@blocksuite/icons/lit';
|
|
2
2
|
import { css, LitElement } from 'lit';
|
|
3
3
|
export class HighlightDuotoneIcon extends LitElement {
|
|
4
|
-
static { this.styles = css `
|
|
5
|
-
svg {
|
|
6
|
-
display: flex;
|
|
7
|
-
font-size: 20px;
|
|
8
|
-
}
|
|
9
|
-
svg > path:nth-child(1) {
|
|
10
|
-
fill: var(--color, unset);
|
|
11
|
-
}
|
|
4
|
+
static { this.styles = css `
|
|
5
|
+
svg {
|
|
6
|
+
display: flex;
|
|
7
|
+
font-size: 20px;
|
|
8
|
+
}
|
|
9
|
+
svg > path:nth-child(1) {
|
|
10
|
+
fill: var(--color, unset);
|
|
11
|
+
}
|
|
12
12
|
`; }
|
|
13
13
|
render() {
|
|
14
14
|
return HighLightDuotoneIcon();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { TextBackgroundDuotoneIcon } from '@blocksuite/icons/lit';
|
|
2
2
|
import { css, LitElement } from 'lit';
|
|
3
3
|
export class TextDuotoneIcon extends LitElement {
|
|
4
|
-
static { this.styles = css `
|
|
5
|
-
svg {
|
|
6
|
-
display: flex;
|
|
7
|
-
font-size: 20px;
|
|
8
|
-
}
|
|
9
|
-
svg > path:nth-child(1) {
|
|
10
|
-
fill: var(--background, unset);
|
|
11
|
-
}
|
|
12
|
-
svg > path:nth-child(3) {
|
|
13
|
-
fill: var(--color, unset);
|
|
14
|
-
}
|
|
4
|
+
static { this.styles = css `
|
|
5
|
+
svg {
|
|
6
|
+
display: flex;
|
|
7
|
+
font-size: 20px;
|
|
8
|
+
}
|
|
9
|
+
svg > path:nth-child(1) {
|
|
10
|
+
fill: var(--background, unset);
|
|
11
|
+
}
|
|
12
|
+
svg > path:nth-child(3) {
|
|
13
|
+
fill: var(--color, unset);
|
|
14
|
+
}
|
|
15
15
|
`; }
|
|
16
16
|
render() {
|
|
17
17
|
return TextBackgroundDuotoneIcon();
|