@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,22 @@
|
|
|
1
|
+
import { type BlockStdScope } from '../../std/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The URL a paste carries when its plain text is ONE http(s) URL and nothing
|
|
4
|
+
* else, or `null`. A sentence holding a URL, two URLs, a `mailto:` or any
|
|
5
|
+
* scheme `isSafeLinkUrl` refuses is not a lone URL: it pastes as text, as it
|
|
6
|
+
* always did.
|
|
7
|
+
*/
|
|
8
|
+
export declare function lonePastedUrl(text: string | null | undefined): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* After a lone URL was pasted in a page (labre REQ-IM-1), open the link's own
|
|
11
|
+
* toolbar on the link the paste wrote, so its view switcher offers "Card view"
|
|
12
|
+
* and "Embed view" next to the current "Inline view". Nothing is written: the
|
|
13
|
+
* paste already stored a plain link, which stays the default when the viewer
|
|
14
|
+
* picks nothing. The conversions are the toolbar's, with their own gates (a
|
|
15
|
+
* registered bookmark or embed view, an embed provider for the URL).
|
|
16
|
+
*
|
|
17
|
+
* Returns whether a toolbar was opened. Nothing opens when the paste did not
|
|
18
|
+
* leave a link at the caret (a URL the host recognised as one of its own
|
|
19
|
+
* documents became a reference), on a read-only document, or inside a table
|
|
20
|
+
* or a database cell, where the toolbar offers no conversion.
|
|
21
|
+
*/
|
|
22
|
+
export declare function proposeLinkViews(std: BlockStdScope, url: string): Promise<boolean>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isSafeLinkUrl, normalizeUrl } from '../../affine-shared/utils/index.js';
|
|
2
|
+
import { TextSelection } from '../../std/index.js';
|
|
3
|
+
import { AffineLink } from './affine-link.js';
|
|
4
|
+
/**
|
|
5
|
+
* The URL a paste carries when its plain text is ONE http(s) URL and nothing
|
|
6
|
+
* else, or `null`. A sentence holding a URL, two URLs, a `mailto:` or any
|
|
7
|
+
* scheme `isSafeLinkUrl` refuses is not a lone URL: it pastes as text, as it
|
|
8
|
+
* always did.
|
|
9
|
+
*/
|
|
10
|
+
export function lonePastedUrl(text) {
|
|
11
|
+
const candidate = text?.trim();
|
|
12
|
+
if (!candidate || /\s/.test(candidate))
|
|
13
|
+
return null;
|
|
14
|
+
if (!isSafeLinkUrl(candidate))
|
|
15
|
+
return null;
|
|
16
|
+
if (!URL.canParse(candidate))
|
|
17
|
+
return null;
|
|
18
|
+
const { protocol } = new URL(candidate);
|
|
19
|
+
return protocol === 'http:' || protocol === 'https:' ? candidate : null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* After a lone URL was pasted in a page (labre REQ-IM-1), open the link's own
|
|
23
|
+
* toolbar on the link the paste wrote, so its view switcher offers "Card view"
|
|
24
|
+
* and "Embed view" next to the current "Inline view". Nothing is written: the
|
|
25
|
+
* paste already stored a plain link, which stays the default when the viewer
|
|
26
|
+
* picks nothing. The conversions are the toolbar's, with their own gates (a
|
|
27
|
+
* registered bookmark or embed view, an embed provider for the URL).
|
|
28
|
+
*
|
|
29
|
+
* Returns whether a toolbar was opened. Nothing opens when the paste did not
|
|
30
|
+
* leave a link at the caret (a URL the host recognised as one of its own
|
|
31
|
+
* documents became a reference), on a read-only document, or inside a table
|
|
32
|
+
* or a database cell, where the toolbar offers no conversion.
|
|
33
|
+
*/
|
|
34
|
+
export async function proposeLinkViews(std, url) {
|
|
35
|
+
if (std.store.readonly)
|
|
36
|
+
return false;
|
|
37
|
+
await std.host.updateComplete;
|
|
38
|
+
const caret = std.selection.find(TextSelection);
|
|
39
|
+
if (!caret)
|
|
40
|
+
return false;
|
|
41
|
+
const block = std.view.getBlock(caret.from.blockId);
|
|
42
|
+
if (!block)
|
|
43
|
+
return false;
|
|
44
|
+
await block.updateComplete;
|
|
45
|
+
if (block.closest('affine-database, affine-table'))
|
|
46
|
+
return false;
|
|
47
|
+
const href = normalizeUrl(url);
|
|
48
|
+
const links = Array.from(block.querySelectorAll('affine-link')).filter((node) => node instanceof AffineLink && node.link === href);
|
|
49
|
+
// The caret ends the pasted run; an equal link written earlier in the same
|
|
50
|
+
// paragraph must not be the one the toolbar points at.
|
|
51
|
+
const pasted = links.find(link => {
|
|
52
|
+
const range = link.selfInlineRange;
|
|
53
|
+
return !!range && range.index + range.length === caret.from.index;
|
|
54
|
+
}) ?? links.at(-1);
|
|
55
|
+
if (!pasted)
|
|
56
|
+
return false;
|
|
57
|
+
pasted.proposeViews();
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stored crop of an image block (ADR 0037): a view on the source, never
|
|
3
|
+
* new bytes. The rectangle is normalised to the source image (0..1 on each
|
|
4
|
+
* axis), so it needs no pixel size and survives any resize.
|
|
5
|
+
*
|
|
6
|
+
* Append-only: a mask token, once shipped, is never renamed or removed. A
|
|
7
|
+
* token this build does not know reads as `free`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const IMAGE_CROP_MASKS: readonly ["free", "16:9", "4:3", "1:1"];
|
|
10
|
+
export type ImageCropMask = (typeof IMAGE_CROP_MASKS)[number];
|
|
11
|
+
export interface ImageCrop {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
/** The preset that drew the rectangle; absent means free. */
|
|
17
|
+
mask?: ImageCropMask;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Below this a side is a sliver nobody can grab again; the crop tool never
|
|
21
|
+
* writes one, and a stored one is treated as damaged.
|
|
22
|
+
*/
|
|
23
|
+
export declare const IMAGE_CROP_MIN_SIDE = 0.02;
|
|
24
|
+
/**
|
|
25
|
+
* The crop to paint, or `undefined` for the whole image.
|
|
26
|
+
*
|
|
27
|
+
* Every reader goes through here: the value may come from a peer, an import
|
|
28
|
+
* or a damaged document, and a crop that cannot be honoured shows the whole
|
|
29
|
+
* picture rather than an empty box or an error. A rectangle covering the
|
|
30
|
+
* whole image is "no crop" too, so nothing downstream has to tell them apart.
|
|
31
|
+
*/
|
|
32
|
+
export declare function readImageCrop(value: unknown): ImageCrop | undefined;
|
|
33
|
+
export declare function isWholeImage(rect: Pick<ImageCrop, 'x' | 'y' | 'w' | 'h'>): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The part of the source, in source pixels, a crop keeps — what a raster
|
|
36
|
+
* export hands to `drawImage(image, sx, sy, sw, sh, …)`.
|
|
37
|
+
*
|
|
38
|
+
* `null` when there is nothing to cut: no crop, or a source with no pixel
|
|
39
|
+
* size (an SVG without intrinsic dimensions loads as 0×0). The caller then
|
|
40
|
+
* draws the whole image into the box, as before ADR 0037; a source
|
|
41
|
+
* rectangle of 0×0 would draw nothing at all.
|
|
42
|
+
*/
|
|
43
|
+
export declare function imageCropSourceRect(crop: ImageCrop | undefined, naturalWidth: number, naturalHeight: number): {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
w: number;
|
|
47
|
+
h: number;
|
|
48
|
+
} | null;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The stored crop of an image block (ADR 0037): a view on the source, never
|
|
3
|
+
* new bytes. The rectangle is normalised to the source image (0..1 on each
|
|
4
|
+
* axis), so it needs no pixel size and survives any resize.
|
|
5
|
+
*
|
|
6
|
+
* Append-only: a mask token, once shipped, is never renamed or removed. A
|
|
7
|
+
* token this build does not know reads as `free`.
|
|
8
|
+
*/
|
|
9
|
+
export const IMAGE_CROP_MASKS = ['free', '16:9', '4:3', '1:1'];
|
|
10
|
+
/**
|
|
11
|
+
* Below this a side is a sliver nobody can grab again; the crop tool never
|
|
12
|
+
* writes one, and a stored one is treated as damaged.
|
|
13
|
+
*/
|
|
14
|
+
export const IMAGE_CROP_MIN_SIDE = 0.02;
|
|
15
|
+
const EPSILON = 1e-6;
|
|
16
|
+
const isFraction = (value) => typeof value === 'number' && Number.isFinite(value);
|
|
17
|
+
/**
|
|
18
|
+
* The crop to paint, or `undefined` for the whole image.
|
|
19
|
+
*
|
|
20
|
+
* Every reader goes through here: the value may come from a peer, an import
|
|
21
|
+
* or a damaged document, and a crop that cannot be honoured shows the whole
|
|
22
|
+
* picture rather than an empty box or an error. A rectangle covering the
|
|
23
|
+
* whole image is "no crop" too, so nothing downstream has to tell them apart.
|
|
24
|
+
*/
|
|
25
|
+
export function readImageCrop(value) {
|
|
26
|
+
if (!value || typeof value !== 'object')
|
|
27
|
+
return undefined;
|
|
28
|
+
const { x, y, w, h, mask } = value;
|
|
29
|
+
if (!isFraction(x) || !isFraction(y) || !isFraction(w) || !isFraction(h)) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
if (x < -EPSILON || y < -EPSILON)
|
|
33
|
+
return undefined;
|
|
34
|
+
if (w < IMAGE_CROP_MIN_SIDE - EPSILON || h < IMAGE_CROP_MIN_SIDE - EPSILON) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
if (x + w > 1 + EPSILON || y + h > 1 + EPSILON)
|
|
38
|
+
return undefined;
|
|
39
|
+
if (isWholeImage({ x, y, w, h }))
|
|
40
|
+
return undefined;
|
|
41
|
+
const crop = {
|
|
42
|
+
x: Math.max(0, x),
|
|
43
|
+
y: Math.max(0, y),
|
|
44
|
+
w: Math.min(w, 1 - Math.max(0, x)),
|
|
45
|
+
h: Math.min(h, 1 - Math.max(0, y)),
|
|
46
|
+
};
|
|
47
|
+
if (typeof mask === 'string' &&
|
|
48
|
+
mask !== 'free' &&
|
|
49
|
+
IMAGE_CROP_MASKS.includes(mask)) {
|
|
50
|
+
crop.mask = mask;
|
|
51
|
+
}
|
|
52
|
+
return crop;
|
|
53
|
+
}
|
|
54
|
+
export function isWholeImage(rect) {
|
|
55
|
+
return (Math.abs(rect.x) < EPSILON &&
|
|
56
|
+
Math.abs(rect.y) < EPSILON &&
|
|
57
|
+
Math.abs(rect.w - 1) < EPSILON &&
|
|
58
|
+
Math.abs(rect.h - 1) < EPSILON);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The part of the source, in source pixels, a crop keeps — what a raster
|
|
62
|
+
* export hands to `drawImage(image, sx, sy, sw, sh, …)`.
|
|
63
|
+
*
|
|
64
|
+
* `null` when there is nothing to cut: no crop, or a source with no pixel
|
|
65
|
+
* size (an SVG without intrinsic dimensions loads as 0×0). The caller then
|
|
66
|
+
* draws the whole image into the box, as before ADR 0037; a source
|
|
67
|
+
* rectangle of 0×0 would draw nothing at all.
|
|
68
|
+
*/
|
|
69
|
+
export function imageCropSourceRect(crop, naturalWidth, naturalHeight) {
|
|
70
|
+
if (!crop || naturalWidth <= 0 || naturalHeight <= 0)
|
|
71
|
+
return null;
|
|
72
|
+
return {
|
|
73
|
+
x: crop.x * naturalWidth,
|
|
74
|
+
y: crop.y * naturalHeight,
|
|
75
|
+
w: crop.w * naturalWidth,
|
|
76
|
+
h: crop.h * naturalHeight,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GfxCommonBlockProps, GfxElementGeometry } from '../../../std/gfx/index.js';
|
|
2
2
|
import type { BlockMeta } from '../../utils/types.js';
|
|
3
|
+
import type { ImageCrop } from './image-crop.js';
|
|
3
4
|
import { ImageBlockTransformer } from './image-transformer.js';
|
|
4
5
|
export type ImageBlockProps = {
|
|
5
6
|
caption?: string;
|
|
@@ -9,6 +10,11 @@ export type ImageBlockProps = {
|
|
|
9
10
|
rotate: number;
|
|
10
11
|
size?: number;
|
|
11
12
|
comments?: Record<string, boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* The part of the source this block shows (ADR 0037). Absent means the
|
|
15
|
+
* whole image; read it through `readImageCrop`, never directly.
|
|
16
|
+
*/
|
|
17
|
+
crop?: ImageCrop;
|
|
12
18
|
} & Omit<GfxCommonBlockProps, 'scale'> & BlockMeta;
|
|
13
19
|
export declare const ImageBlockSchema: {
|
|
14
20
|
version: number;
|
|
@@ -39,3 +39,8 @@ export var ShapeStyle;
|
|
|
39
39
|
ShapeStyle["General"] = "General";
|
|
40
40
|
ShapeStyle["Scribbled"] = "Scribbled";
|
|
41
41
|
})(ShapeStyle || (ShapeStyle = {}));
|
|
42
|
+
// Moved here from `elements/shape/shape.ts`, unchanged, so the model's
|
|
43
|
+
// headless entry exports them without the element class (ADR 0012, P3 as
|
|
44
|
+
// amended 2026-10-14).
|
|
45
|
+
export const SHAPE_TEXT_PADDING = 20;
|
|
46
|
+
export const SHAPE_TEXT_VERTICAL_PADDING = 10;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants moved out of the element-class files of this folder, unchanged, so
|
|
3
|
+
* the model's headless entry (`@labre/affine-model/headless`) exports them
|
|
4
|
+
* without `@labre/std/gfx` behind them (ADR 0012, P3 as amended 2026-10-14).
|
|
5
|
+
* The folder index re-exports this file.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Width of the participant band — the left margin strip the pool name is
|
|
9
|
+
* written up, in model units.
|
|
10
|
+
*
|
|
11
|
+
* Declared HERE, in the model, and re-exported by `@labre/affine-gfx-bpmn`
|
|
12
|
+
* rather than the other way round. The pool's own hit test needs it (a pool is
|
|
13
|
+
* clickable by its title bands as well as its border, the bpmn.io convention),
|
|
14
|
+
* and `affine-model` cannot reach into `affine-block-surface` where the
|
|
15
|
+
* declaration is resolved. One number, owned by the layer that both the
|
|
16
|
+
* declaration and the hit test can read.
|
|
17
|
+
*/
|
|
18
|
+
export declare const POOL_BAND_WIDTH = 28;
|
|
19
|
+
/**
|
|
20
|
+
* Width of a lane's own title band — the strip immediately inside the
|
|
21
|
+
* participant band, with the lane name turned on its side.
|
|
22
|
+
*
|
|
23
|
+
* Four units narrower than {@link POOL_BAND_WIDTH}, and for the same reason the
|
|
24
|
+
* lane font is two points smaller: the two strips sit side by side, so the
|
|
25
|
+
* subordinate one has to say so. Identical widths read as a single 56-unit
|
|
26
|
+
* gutter rather than as a participant containing lanes, which is exactly the
|
|
27
|
+
* relationship the picture has to carry.
|
|
28
|
+
*
|
|
29
|
+
* NO fill, divider only — what bpmn.io, Camunda and Visio all draw.
|
|
30
|
+
*/
|
|
31
|
+
export declare const POOL_LANE_BAND_WIDTH = 24;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants moved out of the element-class files of this folder, unchanged, so
|
|
3
|
+
* the model's headless entry (`@labre/affine-model/headless`) exports them
|
|
4
|
+
* without `@labre/std/gfx` behind them (ADR 0012, P3 as amended 2026-10-14).
|
|
5
|
+
* The folder index re-exports this file.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Width of the participant band — the left margin strip the pool name is
|
|
9
|
+
* written up, in model units.
|
|
10
|
+
*
|
|
11
|
+
* Declared HERE, in the model, and re-exported by `@labre/affine-gfx-bpmn`
|
|
12
|
+
* rather than the other way round. The pool's own hit test needs it (a pool is
|
|
13
|
+
* clickable by its title bands as well as its border, the bpmn.io convention),
|
|
14
|
+
* and `affine-model` cannot reach into `affine-block-surface` where the
|
|
15
|
+
* declaration is resolved. One number, owned by the layer that both the
|
|
16
|
+
* declaration and the hit test can read.
|
|
17
|
+
*/
|
|
18
|
+
export const POOL_BAND_WIDTH = 28;
|
|
19
|
+
/**
|
|
20
|
+
* Width of a lane's own title band — the strip immediately inside the
|
|
21
|
+
* participant band, with the lane name turned on its side.
|
|
22
|
+
*
|
|
23
|
+
* Four units narrower than {@link POOL_BAND_WIDTH}, and for the same reason the
|
|
24
|
+
* lane font is two points smaller: the two strips sit side by side, so the
|
|
25
|
+
* subordinate one has to say so. Identical widths read as a single 56-unit
|
|
26
|
+
* gutter rather than as a participant containing lanes, which is exactly the
|
|
27
|
+
* relationship the picture has to carry.
|
|
28
|
+
*
|
|
29
|
+
* NO fill, divider only — what bpmn.io, Camunda and Visio all draw.
|
|
30
|
+
*/
|
|
31
|
+
export const POOL_LANE_BAND_WIDTH = 24;
|
|
@@ -2,31 +2,6 @@ import type { SerializedXYWH } from '../../../global/gfx/index.js';
|
|
|
2
2
|
import type { PointTestOptions } from '../../../std/gfx/index.js';
|
|
3
3
|
import type { FrameworkBackgroundProps } from '../framework-background/index.js';
|
|
4
4
|
import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
|
|
5
|
-
/**
|
|
6
|
-
* Width of the participant band — the left margin strip the pool name is
|
|
7
|
-
* written up, in model units.
|
|
8
|
-
*
|
|
9
|
-
* Declared HERE, in the model, and re-exported by `@labre/affine-gfx-bpmn`
|
|
10
|
-
* rather than the other way round. The pool's own hit test needs it (a pool is
|
|
11
|
-
* clickable by its title bands as well as its border, the bpmn.io convention),
|
|
12
|
-
* and `affine-model` cannot reach into `affine-block-surface` where the
|
|
13
|
-
* declaration is resolved. One number, owned by the layer that both the
|
|
14
|
-
* declaration and the hit test can read.
|
|
15
|
-
*/
|
|
16
|
-
export declare const POOL_BAND_WIDTH = 28;
|
|
17
|
-
/**
|
|
18
|
-
* Width of a lane's own title band — the strip immediately inside the
|
|
19
|
-
* participant band, with the lane name turned on its side.
|
|
20
|
-
*
|
|
21
|
-
* Four units narrower than {@link POOL_BAND_WIDTH}, and for the same reason the
|
|
22
|
-
* lane font is two points smaller: the two strips sit side by side, so the
|
|
23
|
-
* subordinate one has to say so. Identical widths read as a single 56-unit
|
|
24
|
-
* gutter rather than as a participant containing lanes, which is exactly the
|
|
25
|
-
* relationship the picture has to carry.
|
|
26
|
-
*
|
|
27
|
-
* NO fill, divider only — what bpmn.io, Camunda and Visio all draw.
|
|
28
|
-
*/
|
|
29
|
-
export declare const POOL_LANE_BAND_WIDTH = 24;
|
|
30
5
|
/**
|
|
31
6
|
* One LANE (couloir) of a pool: a horizontal band the participant's own work is
|
|
32
7
|
* divided into — "Sales", "Back office", "Automated".
|
|
@@ -35,31 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
35
35
|
import { rotatePoint } from '../../../global/gfx/index.js';
|
|
36
36
|
import { field } from '../../../std/gfx/index.js';
|
|
37
37
|
import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
|
|
38
|
-
|
|
39
|
-
* Width of the participant band — the left margin strip the pool name is
|
|
40
|
-
* written up, in model units.
|
|
41
|
-
*
|
|
42
|
-
* Declared HERE, in the model, and re-exported by `@labre/affine-gfx-bpmn`
|
|
43
|
-
* rather than the other way round. The pool's own hit test needs it (a pool is
|
|
44
|
-
* clickable by its title bands as well as its border, the bpmn.io convention),
|
|
45
|
-
* and `affine-model` cannot reach into `affine-block-surface` where the
|
|
46
|
-
* declaration is resolved. One number, owned by the layer that both the
|
|
47
|
-
* declaration and the hit test can read.
|
|
48
|
-
*/
|
|
49
|
-
export const POOL_BAND_WIDTH = 28;
|
|
50
|
-
/**
|
|
51
|
-
* Width of a lane's own title band — the strip immediately inside the
|
|
52
|
-
* participant band, with the lane name turned on its side.
|
|
53
|
-
*
|
|
54
|
-
* Four units narrower than {@link POOL_BAND_WIDTH}, and for the same reason the
|
|
55
|
-
* lane font is two points smaller: the two strips sit side by side, so the
|
|
56
|
-
* subordinate one has to say so. Identical widths read as a single 56-unit
|
|
57
|
-
* gutter rather than as a participant containing lanes, which is exactly the
|
|
58
|
-
* relationship the picture has to carry.
|
|
59
|
-
*
|
|
60
|
-
* NO fill, divider only — what bpmn.io, Camunda and Visio all draw.
|
|
61
|
-
*/
|
|
62
|
-
export const POOL_LANE_BAND_WIDTH = 24;
|
|
38
|
+
import { POOL_BAND_WIDTH, POOL_LANE_BAND_WIDTH } from './consts.js';
|
|
63
39
|
/**
|
|
64
40
|
* A BPMN "pool": a participant container drawn as a rounded-rect frame with a
|
|
65
41
|
* vertical name band on the left. It is a framework background like every other
|
|
@@ -47,8 +47,6 @@ export type ShapeProps = BaseElementProps & {
|
|
|
47
47
|
textFitMode?: TextFitMode;
|
|
48
48
|
maxWidth?: false | number;
|
|
49
49
|
} & Partial<TextStyleProps>;
|
|
50
|
-
export declare const SHAPE_TEXT_PADDING = 20;
|
|
51
|
-
export declare const SHAPE_TEXT_VERTICAL_PADDING = 10;
|
|
52
50
|
export declare class ShapeElementModel extends GfxPrimitiveElementModel<ShapeProps> {
|
|
53
51
|
/**
|
|
54
52
|
* The bound of the text content.
|
|
@@ -36,10 +36,9 @@ import { Bound, getBoundWithRotation } from '../../../global/gfx/index.js';
|
|
|
36
36
|
import { field, GfxLocalElementModel, GfxPrimitiveElementModel, local, prop, } from '../../../std/gfx/index.js';
|
|
37
37
|
import * as Y from 'yjs';
|
|
38
38
|
import { DEFAULT_ROUGHNESS, FontFamily, FontStyle, FontWeight, ShapeStyle, ShapeTextFontSize, ShapeType, StrokeStyle, TextAlign, TextFitMode, TextResizing, TextVerticalAlign, } from '../../consts/index.js';
|
|
39
|
+
import { SHAPE_TEXT_PADDING, SHAPE_TEXT_VERTICAL_PADDING, } from '../../consts/shape.js';
|
|
39
40
|
import { DefaultTheme } from '../../themes/index.js';
|
|
40
41
|
import { shapeMethods } from './api/index.js';
|
|
41
|
-
export const SHAPE_TEXT_PADDING = 20;
|
|
42
|
-
export const SHAPE_TEXT_VERTICAL_PADDING = 10;
|
|
43
42
|
let ShapeElementModel = (() => {
|
|
44
43
|
let _classSuper = GfxPrimitiveElementModel;
|
|
45
44
|
let _color_decorators;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The UML element constants an interchange reader needs WITHOUT the element
|
|
3
|
+
* classes: moved out of `diagram.ts`, `fragment.ts`, `partition.ts` and `region.ts`
|
|
4
|
+
* unchanged, so the
|
|
5
|
+
* model's headless entry (`@labre/affine-model/headless`) can export them with
|
|
6
|
+
* no `@labre/std/gfx` behind it (ADR 0012, P3 as amended 2026-10-14). The
|
|
7
|
+
* package index re-exports this file, so nothing an importer reads moved.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Height of the diagram frame's heading band — the strip across the top of the
|
|
11
|
+
* frame the `<kind> <name>` tag is written in, in model units.
|
|
12
|
+
*
|
|
13
|
+
* Declared HERE, in the model, and re-exported by `@labre/affine-gfx-uml`
|
|
14
|
+
* rather than the other way round, for the reason `C4_BOARD_TITLE_BAND_HEIGHT`
|
|
15
|
+
* is: the frame's own hit test needs it (a diagram is clickable by its heading
|
|
16
|
+
* band as well as by its border), and `affine-model` cannot reach into
|
|
17
|
+
* `affine-block-surface` where the declaration is resolved. One number, owned
|
|
18
|
+
* by the layer that both the declaration and the hit test can read.
|
|
19
|
+
*
|
|
20
|
+
* It is the frame's TOP MARGIN — the inset the drawing gives up so the heading
|
|
21
|
+
* has somewhere to be written — so the strip that is painted, the strip that is
|
|
22
|
+
* picked and the strip that opens the rename are one number rather than three.
|
|
23
|
+
*
|
|
24
|
+
* 44 is the height of the cut-corner tag UML 2.5.1 Annex A draws the heading
|
|
25
|
+
* in: a 20-unit label with the rest as breathing room above and below.
|
|
26
|
+
* Changing it moves the heading, so it is a visual decision and not a hit-test
|
|
27
|
+
* one.
|
|
28
|
+
*/
|
|
29
|
+
export declare const UML_FRAME_BAND_HEIGHT = 44;
|
|
30
|
+
/**
|
|
31
|
+
* Which kind of UML diagram this frame draws — the DECLARED fact, as opposed to
|
|
32
|
+
* the name, which is free text and says whatever its author wants it to.
|
|
33
|
+
*
|
|
34
|
+
* ## Where the values come from
|
|
35
|
+
*
|
|
36
|
+
* UML 2.5.1 Annex A gives the normative frame kind names, each with the
|
|
37
|
+
* abbreviation that may be written in its place:
|
|
38
|
+
*
|
|
39
|
+
* - `activity` / `act`;
|
|
40
|
+
* - `class` — the one kind Annex A gives NO abbreviation for, so the word
|
|
41
|
+
* itself is the tag;
|
|
42
|
+
* - `component` / `cmp`;
|
|
43
|
+
* - `deployment` / `dep`;
|
|
44
|
+
* - `interaction` / `sd`;
|
|
45
|
+
* - `package` / `pkg`;
|
|
46
|
+
* - `state machine` / `stm`;
|
|
47
|
+
* - `use case` / `uc`.
|
|
48
|
+
*
|
|
49
|
+
* `obj` is NOT in that list. Annex A has no frame kind for the object diagram —
|
|
50
|
+
* the standard treats it as a class diagram showing instances — but every tool
|
|
51
|
+
* that draws one tags it `obj`, and an architect reading the sheet expects to
|
|
52
|
+
* see it. So `obj` is kept as a TOOL CONVENTION, recorded as such here so that
|
|
53
|
+
* nobody later "fixes" it against the spec without knowing it was a choice.
|
|
54
|
+
*
|
|
55
|
+
* ## Widening this union is additive
|
|
56
|
+
*
|
|
57
|
+
* Phase 1 shipped the first four kinds below; phase 2 APPENDED `cmp` and `dep`,
|
|
58
|
+
* the two structural frames of §11.6.4 and §19.2.4, then `act` and `stm`, the
|
|
59
|
+
* two behaviour frames of §15.2.4 and §14.2.4; phase 3 appends `sd`. Each
|
|
60
|
+
* arrives as a new VALUE of the existing `kind`
|
|
61
|
+
* string field — no new field, no schema change, no migration and no backfill.
|
|
62
|
+
* The same promise `C4NodeKind` and `BpmnNodeKind` already make.
|
|
63
|
+
*
|
|
64
|
+
* Appended, never reordered: the union is read as a set of strings by every
|
|
65
|
+
* consumer, and a document only ever stores one of them, so the ORDER below is a
|
|
66
|
+
* reading aid. Keeping it chronological is what lets a reviewer see at a glance
|
|
67
|
+
* which build a value arrived in.
|
|
68
|
+
*
|
|
69
|
+
* A value a client has never seen reads back as the string it is, and
|
|
70
|
+
* {@link UmlDiagramElementModel.heading} writes it verbatim, so a document
|
|
71
|
+
* created by a newer build still shows its own heading on an older one.
|
|
72
|
+
*/
|
|
73
|
+
export type UmlDiagramKind = 'class' | 'pkg' | 'obj' | 'uc' | 'cmp' | 'dep' | 'act' | 'stm' | 'sd';
|
|
74
|
+
/**
|
|
75
|
+
* The word written in the heading tag, per kind.
|
|
76
|
+
*
|
|
77
|
+
* A table rather than the raw value so that a kind whose stored discriminant
|
|
78
|
+
* and whose printed tag ever diverge has one place to say so. Today they are
|
|
79
|
+
* the same four strings, and that is worth stating rather than assuming.
|
|
80
|
+
*
|
|
81
|
+
* `Partial` on purpose: a frame read off a document carries whatever string was
|
|
82
|
+
* written there, including a kind from a later phase this build has never heard
|
|
83
|
+
* of. Typing the lookup as total would make {@link
|
|
84
|
+
* UmlDiagramElementModel.heading}'s `?? this.kind` fallback look like dead
|
|
85
|
+
* defensive code, when it is the whole of the append-only promise.
|
|
86
|
+
*/
|
|
87
|
+
export declare const UML_DIAGRAM_KIND_TAG: Partial<Record<UmlDiagramKind, string>>;
|
|
88
|
+
/**
|
|
89
|
+
* Height of a combined fragment's OPERATOR BAND — the strip across its top the
|
|
90
|
+
* pentagon tag is drawn in, in model units.
|
|
91
|
+
*
|
|
92
|
+
* Owned by the model for the reason {@link UML_FRAME_BAND_HEIGHT} is: the
|
|
93
|
+
* fragment's own hit test reads it (a fragment is clickable by its tag strip as
|
|
94
|
+
* well as by its border), and `affine-model` cannot reach into
|
|
95
|
+
* `affine-block-surface` where the declaration is resolved.
|
|
96
|
+
*
|
|
97
|
+
* The diagram frame's own 44, and deliberately: §17.6.4 draws the operator in
|
|
98
|
+
* the very same cut-corner pentagon Annex A draws a frame heading in — it IS a
|
|
99
|
+
* frame, nested in another one — and two numbers for one piece of furniture
|
|
100
|
+
* would drift.
|
|
101
|
+
*/
|
|
102
|
+
export declare const UML_FRAGMENT_BAND = 44;
|
|
103
|
+
/**
|
|
104
|
+
* Height of a partition's NAME BAND — the strip its name is written in, in
|
|
105
|
+
* model units.
|
|
106
|
+
*
|
|
107
|
+
* Declared HERE, in the model, and re-exported by `@labre/affine-gfx-uml`, for
|
|
108
|
+
* the reason {@link UML_FRAME_BAND_HEIGHT} is: the partition's own hit test
|
|
109
|
+
* reads it (a swimlane is clickable by its header as well as by its border),
|
|
110
|
+
* and `affine-model` cannot reach into `affine-block-surface` where the
|
|
111
|
+
* declaration is resolved. One number, owned by the layer that both the
|
|
112
|
+
* declaration and the hit test can read.
|
|
113
|
+
*
|
|
114
|
+
* It is the band's THICKNESS whichever edge the band is on — the top for a
|
|
115
|
+
* vertical lane, the left for a horizontal one — because §15.6.4 draws one
|
|
116
|
+
* header strip and turns it with the lane rather than resizing it.
|
|
117
|
+
*
|
|
118
|
+
* 36 against the diagram frame's 44: a partition header is a name and not a
|
|
119
|
+
* `<kind> <name>` heading, and it is written inside a lane that already sits on
|
|
120
|
+
* a sheet, so it reads as a subdivision rather than as a second sheet.
|
|
121
|
+
*/
|
|
122
|
+
export declare const UML_PARTITION_BAND = 36;
|
|
123
|
+
/**
|
|
124
|
+
* Height of a region's NAME BAND — the strip its name is written in, in model
|
|
125
|
+
* units.
|
|
126
|
+
*
|
|
127
|
+
* Owned by the model for the reason {@link UML_PARTITION_BAND} is: the region's
|
|
128
|
+
* own hit test reads it, and `affine-model` cannot reach into the package where
|
|
129
|
+
* the declaration is resolved. The same 36 the partition uses, and deliberately
|
|
130
|
+
* so — the two are the same piece of furniture, a name written in a strip along
|
|
131
|
+
* the top of a transparent frame, and two numbers would drift.
|
|
132
|
+
*/
|
|
133
|
+
export declare const UML_REGION_BAND = 36;
|