@formicoidea/labre-core 0.50.0 → 0.51.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.
Files changed (191) hide show
  1. package/dist/_pkgs/affine-block-attachment/asset-picker.d.ts +24 -0
  2. package/dist/_pkgs/affine-block-attachment/asset-picker.js +87 -0
  3. package/dist/_pkgs/affine-block-attachment/configs/slash-menu.js +3 -20
  4. package/dist/_pkgs/affine-block-attachment/index.d.ts +1 -0
  5. package/dist/_pkgs/affine-block-attachment/index.js +1 -0
  6. package/dist/_pkgs/affine-block-attachment/utils.d.ts +9 -1
  7. package/dist/_pkgs/affine-block-attachment/utils.js +9 -0
  8. package/dist/_pkgs/affine-block-bookmark/adapters/markdown/markdown.js +14 -1
  9. package/dist/_pkgs/affine-block-bookmark/adapters/notion-html.js +5 -1
  10. package/dist/_pkgs/affine-block-database/adapters/markdown.js +5 -3
  11. package/dist/_pkgs/affine-block-embed/common/adapters/html.js +5 -3
  12. package/dist/_pkgs/affine-block-embed/common/adapters/markdown.js +11 -0
  13. package/dist/_pkgs/affine-block-frame/frame-template.d.ts +58 -0
  14. package/dist/_pkgs/affine-block-frame/frame-template.js +207 -0
  15. package/dist/_pkgs/affine-block-frame/frame-toolbar.js +19 -3
  16. package/dist/_pkgs/affine-block-frame/index.d.ts +1 -0
  17. package/dist/_pkgs/affine-block-frame/index.js +1 -0
  18. package/dist/_pkgs/affine-block-frame/translations.d.ts +7 -0
  19. package/dist/_pkgs/affine-block-frame/translations.js +16 -1
  20. package/dist/_pkgs/affine-block-frame/view.js +6 -0
  21. package/dist/_pkgs/affine-block-image/asset-picker.d.ts +63 -0
  22. package/dist/_pkgs/affine-block-image/asset-picker.js +183 -0
  23. package/dist/_pkgs/affine-block-image/commands/insert-images.d.ts +5 -0
  24. package/dist/_pkgs/affine-block-image/commands/insert-images.js +8 -8
  25. package/dist/_pkgs/affine-block-image/components/page-image-block.d.ts +11 -0
  26. package/dist/_pkgs/affine-block-image/components/page-image-block.js +81 -12
  27. package/dist/_pkgs/affine-block-image/configs/replace-action.d.ts +9 -0
  28. package/dist/_pkgs/affine-block-image/configs/replace-action.js +27 -0
  29. package/dist/_pkgs/affine-block-image/configs/toolbar.js +6 -0
  30. package/dist/_pkgs/affine-block-image/crop/crop-controller.d.ts +46 -0
  31. package/dist/_pkgs/affine-block-image/crop/crop-controller.js +104 -0
  32. package/dist/_pkgs/affine-block-image/crop/crop-math.d.ts +70 -0
  33. package/dist/_pkgs/affine-block-image/crop/crop-math.js +141 -0
  34. package/dist/_pkgs/affine-block-image/crop/crop-overlay.d.ts +57 -0
  35. package/dist/_pkgs/affine-block-image/crop/crop-overlay.js +343 -0
  36. package/dist/_pkgs/affine-block-image/crop/crop-toolbar.d.ts +12 -0
  37. package/dist/_pkgs/affine-block-image/crop/crop-toolbar.js +78 -0
  38. package/dist/_pkgs/affine-block-image/crop/write-crop.d.ts +16 -0
  39. package/dist/_pkgs/affine-block-image/crop/write-crop.js +57 -0
  40. package/dist/_pkgs/affine-block-image/edgeless-clipboard-config.js +4 -1
  41. package/dist/_pkgs/affine-block-image/effects.js +2 -0
  42. package/dist/_pkgs/affine-block-image/image-block.d.ts +2 -0
  43. package/dist/_pkgs/affine-block-image/image-block.js +2 -0
  44. package/dist/_pkgs/affine-block-image/image-edgeless-block.d.ts +2 -0
  45. package/dist/_pkgs/affine-block-image/image-edgeless-block.js +36 -8
  46. package/dist/_pkgs/affine-block-image/image-resize-manager.js +15 -0
  47. package/dist/_pkgs/affine-block-image/index.d.ts +1 -0
  48. package/dist/_pkgs/affine-block-image/index.js +1 -0
  49. package/dist/_pkgs/affine-block-image/translations.d.ts +15 -0
  50. package/dist/_pkgs/affine-block-image/translations.js +43 -0
  51. package/dist/_pkgs/affine-block-image/utils.d.ts +13 -0
  52. package/dist/_pkgs/affine-block-image/utils.js +10 -1
  53. package/dist/_pkgs/affine-block-root/clipboard/page-clipboard.js +5 -0
  54. package/dist/_pkgs/affine-block-root/commands/page-export-commands.d.ts +2 -0
  55. package/dist/_pkgs/affine-block-root/commands/page-export-commands.js +71 -0
  56. package/dist/_pkgs/affine-block-root/index.d.ts +1 -0
  57. package/dist/_pkgs/affine-block-root/index.js +1 -0
  58. package/dist/_pkgs/affine-block-root/view.js +8 -0
  59. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.d.ts +30 -0
  60. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/capability.js +44 -0
  61. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.d.ts +26 -0
  62. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/colors.js +82 -0
  63. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.d.ts +18 -0
  64. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/command.js +91 -0
  65. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.d.ts +3 -0
  66. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/index.js +3 -0
  67. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.d.ts +50 -0
  68. package/dist/_pkgs/affine-block-surface/extensions/drawio-export/writer.js +732 -0
  69. package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.d.ts +12 -0
  70. package/dist/_pkgs/affine-block-surface/extensions/export-manager/draw-image-block.js +15 -0
  71. package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +7 -1
  72. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +7 -1
  73. package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +60 -1
  74. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +2 -2
  75. package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +2 -2
  76. package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.d.ts +6 -0
  77. package/dist/_pkgs/affine-block-surface/extensions/export-svg/marker-version.js +8 -0
  78. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +28 -1
  79. package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +66 -6
  80. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +2 -7
  81. package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +2 -6
  82. package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +2 -0
  83. package/dist/_pkgs/affine-block-surface/extensions/index.js +2 -0
  84. package/dist/_pkgs/affine-block-surface/extensions/interchange-export.d.ts +84 -0
  85. package/dist/_pkgs/affine-block-surface/extensions/interchange-export.js +150 -0
  86. package/dist/_pkgs/affine-block-surface/extensions/interchange-import.js +24 -2
  87. package/dist/_pkgs/affine-block-surface/extensions/interchange.d.ts +23 -2
  88. package/dist/_pkgs/affine-block-surface/extensions/interchange.js +4 -1
  89. package/dist/_pkgs/affine-block-surface/extensions/legend-role.d.ts +18 -0
  90. package/dist/_pkgs/affine-block-surface/extensions/legend-role.js +20 -0
  91. package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +2 -19
  92. package/dist/_pkgs/affine-block-surface/extensions/legend.js +2 -18
  93. package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.d.ts +67 -0
  94. package/dist/_pkgs/affine-block-surface/extensions/svg-sanitize.js +235 -0
  95. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.d.ts +1 -0
  96. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +9 -0
  97. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +17 -13
  98. package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +52 -80
  99. package/dist/_pkgs/affine-block-surface/extensions/xml-element.d.ts +98 -0
  100. package/dist/_pkgs/affine-block-surface/extensions/xml-element.js +261 -0
  101. package/dist/_pkgs/affine-block-surface/extensions/xml-reader.d.ts +238 -0
  102. package/dist/_pkgs/affine-block-surface/extensions/xml-reader.js +570 -0
  103. package/dist/_pkgs/affine-block-surface/framework-background/def.js +1 -1
  104. package/dist/_pkgs/affine-block-surface/interchange-headless.d.ts +29 -0
  105. package/dist/_pkgs/affine-block-surface/interchange-headless.js +32 -0
  106. package/dist/_pkgs/affine-block-surface/view.js +22 -2
  107. package/dist/_pkgs/affine-block-table/adapters/utils.js +24 -1
  108. package/dist/_pkgs/affine-gfx-note/toolbar/note-menu.js +5 -8
  109. package/dist/_pkgs/affine-gfx-template/contribute.d.ts +14 -4
  110. package/dist/_pkgs/affine-gfx-template/contribute.js +47 -6
  111. package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.d.ts +7 -2
  112. package/dist/_pkgs/affine-gfx-template/toolbar/builtin-templates.js +14 -40
  113. package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.d.ts +1 -1
  114. package/dist/_pkgs/affine-gfx-template/toolbar/resolve-name.js +1 -1
  115. package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.d.ts +4 -4
  116. package/dist/_pkgs/affine-gfx-template/toolbar/template-panel.js +9 -9
  117. package/dist/_pkgs/affine-gfx-template/toolbar/template-type.d.ts +2 -4
  118. package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
  119. package/dist/_pkgs/affine-gfx-template/translations.js +9 -0
  120. package/dist/_pkgs/affine-inline-footnote/adapters/markdown/inline-delta.js +6 -0
  121. package/dist/_pkgs/affine-inline-footnote/adapters/markdown/markdown-inline.js +7 -0
  122. package/dist/_pkgs/affine-inline-link/adapters/html/html-inline.js +4 -1
  123. package/dist/_pkgs/affine-inline-link/adapters/html/inline-delta.js +3 -1
  124. package/dist/_pkgs/affine-inline-link/adapters/markdown/inline-delta.js +4 -1
  125. package/dist/_pkgs/affine-inline-link/adapters/notion-html/html-inline.js +2 -1
  126. package/dist/_pkgs/affine-inline-link/link-node/affine-link.d.ts +7 -0
  127. package/dist/_pkgs/affine-inline-link/link-node/affine-link.js +37 -0
  128. package/dist/_pkgs/affine-inline-link/link-node/index.d.ts +1 -0
  129. package/dist/_pkgs/affine-inline-link/link-node/index.js +1 -0
  130. package/dist/_pkgs/affine-inline-link/link-node/propose-views.d.ts +22 -0
  131. package/dist/_pkgs/affine-inline-link/link-node/propose-views.js +59 -0
  132. package/dist/_pkgs/affine-model/blocks/image/image-crop.d.ts +48 -0
  133. package/dist/_pkgs/affine-model/blocks/image/image-crop.js +78 -0
  134. package/dist/_pkgs/affine-model/blocks/image/image-model.d.ts +6 -0
  135. package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
  136. package/dist/_pkgs/affine-model/blocks/image/index.d.ts +1 -0
  137. package/dist/_pkgs/affine-model/blocks/image/index.js +1 -0
  138. package/dist/_pkgs/affine-model/consts/shape.d.ts +2 -0
  139. package/dist/_pkgs/affine-model/consts/shape.js +5 -0
  140. package/dist/_pkgs/affine-model/elements/bpmn/consts.d.ts +31 -0
  141. package/dist/_pkgs/affine-model/elements/bpmn/consts.js +31 -0
  142. package/dist/_pkgs/affine-model/elements/bpmn/index.d.ts +1 -0
  143. package/dist/_pkgs/affine-model/elements/bpmn/index.js +1 -0
  144. package/dist/_pkgs/affine-model/elements/bpmn/pool.d.ts +0 -25
  145. package/dist/_pkgs/affine-model/elements/bpmn/pool.js +1 -25
  146. package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +0 -2
  147. package/dist/_pkgs/affine-model/elements/shape/shape.js +1 -2
  148. package/dist/_pkgs/affine-model/elements/uml/consts.d.ts +133 -0
  149. package/dist/_pkgs/affine-model/elements/uml/consts.js +107 -0
  150. package/dist/_pkgs/affine-model/elements/uml/diagram.d.ts +1 -79
  151. package/dist/_pkgs/affine-model/elements/uml/diagram.js +1 -53
  152. package/dist/_pkgs/affine-model/elements/uml/fragment.d.ts +0 -15
  153. package/dist/_pkgs/affine-model/elements/uml/fragment.js +1 -15
  154. package/dist/_pkgs/affine-model/elements/uml/index.d.ts +1 -0
  155. package/dist/_pkgs/affine-model/elements/uml/index.js +1 -0
  156. package/dist/_pkgs/affine-model/elements/uml/partition.d.ts +0 -20
  157. package/dist/_pkgs/affine-model/elements/uml/partition.js +1 -20
  158. package/dist/_pkgs/affine-model/elements/uml/region.d.ts +0 -11
  159. package/dist/_pkgs/affine-model/elements/uml/region.js +1 -11
  160. package/dist/_pkgs/affine-model/headless.d.ts +19 -0
  161. package/dist/_pkgs/affine-model/headless.js +19 -0
  162. package/dist/_pkgs/affine-shared/headless.d.ts +10 -0
  163. package/dist/_pkgs/affine-shared/headless.js +10 -0
  164. package/dist/_pkgs/affine-shared/services/asset-picker-service.d.ts +63 -0
  165. package/dist/_pkgs/affine-shared/services/asset-picker-service.js +20 -0
  166. package/dist/_pkgs/affine-shared/services/frame-template-service.d.ts +83 -0
  167. package/dist/_pkgs/affine-shared/services/frame-template-service.js +17 -0
  168. package/dist/_pkgs/affine-shared/services/index.d.ts +2 -0
  169. package/dist/_pkgs/affine-shared/services/index.js +2 -0
  170. package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +6 -0
  171. package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +10 -0
  172. package/dist/_pkgs/affine-widget-drag-handle/watchers/drag-event-watcher.js +8 -3
  173. package/dist/_pkgs/affine-widget-keyboard-toolbar/config.js +4 -16
  174. package/dist/_pkgs/affine-widget-linked-doc/transformers/html.d.ts +7 -0
  175. package/dist/_pkgs/affine-widget-linked-doc/transformers/html.js +25 -24
  176. package/dist/_pkgs/affine-widget-linked-doc/transformers/index.d.ts +1 -1
  177. package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.d.ts +7 -0
  178. package/dist/_pkgs/affine-widget-linked-doc/transformers/markdown.js +26 -25
  179. package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.d.ts +23 -0
  180. package/dist/_pkgs/affine-widget-linked-doc/transformers/utils.js +14 -0
  181. package/dist/commands.js +5 -2
  182. package/dist/host-panels.d.ts +21 -1
  183. package/dist/host-panels.js +50 -10
  184. package/dist/interchange.d.ts +1 -0
  185. package/dist/interchange.js +1 -0
  186. package/dist/model/headless.d.ts +1 -0
  187. package/dist/model/headless.js +1 -0
  188. package/dist/shared/headless.d.ts +1 -0
  189. package/dist/shared/headless.js +1 -0
  190. package/dist/translations.js +8 -1
  191. package/package.json +13 -1
@@ -0,0 +1,107 @@
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 const UML_FRAME_BAND_HEIGHT = 44;
30
+ /**
31
+ * The word written in the heading tag, per kind.
32
+ *
33
+ * A table rather than the raw value so that a kind whose stored discriminant
34
+ * and whose printed tag ever diverge has one place to say so. Today they are
35
+ * the same four strings, and that is worth stating rather than assuming.
36
+ *
37
+ * `Partial` on purpose: a frame read off a document carries whatever string was
38
+ * written there, including a kind from a later phase this build has never heard
39
+ * of. Typing the lookup as total would make {@link
40
+ * UmlDiagramElementModel.heading}'s `?? this.kind` fallback look like dead
41
+ * defensive code, when it is the whole of the append-only promise.
42
+ */
43
+ export const UML_DIAGRAM_KIND_TAG = {
44
+ class: 'class',
45
+ pkg: 'pkg',
46
+ obj: 'obj',
47
+ uc: 'uc',
48
+ // Both are Annex A's own abbreviations, written exactly as the Annex writes
49
+ // them — `cmp` for the component diagram, `dep` for the deployment diagram.
50
+ cmp: 'cmp',
51
+ dep: 'dep',
52
+ // Annex A's own abbreviations again — `act` for the activity diagram, `stm`
53
+ // for the state machine diagram. `stm` is the one tag in the table that is
54
+ // NOT the kind spelled out: Annex A's frame kind is the two words `state
55
+ // machine`, and `stm` is the abbreviation it gives in their place.
56
+ act: 'act',
57
+ stm: 'stm',
58
+ // Annex A's abbreviation for the interaction frame, and the third tag in the
59
+ // table that is not the kind spelled out: the frame kind is `interaction`.
60
+ sd: 'sd',
61
+ };
62
+ /**
63
+ * Height of a combined fragment's OPERATOR BAND — the strip across its top the
64
+ * pentagon tag is drawn in, in model units.
65
+ *
66
+ * Owned by the model for the reason {@link UML_FRAME_BAND_HEIGHT} is: the
67
+ * fragment's own hit test reads it (a fragment is clickable by its tag strip as
68
+ * well as by its border), and `affine-model` cannot reach into
69
+ * `affine-block-surface` where the declaration is resolved.
70
+ *
71
+ * The diagram frame's own 44, and deliberately: §17.6.4 draws the operator in
72
+ * the very same cut-corner pentagon Annex A draws a frame heading in — it IS a
73
+ * frame, nested in another one — and two numbers for one piece of furniture
74
+ * would drift.
75
+ */
76
+ export const UML_FRAGMENT_BAND = 44;
77
+ /**
78
+ * Height of a partition's NAME BAND — the strip its name is written in, in
79
+ * model units.
80
+ *
81
+ * Declared HERE, in the model, and re-exported by `@labre/affine-gfx-uml`, for
82
+ * the reason {@link UML_FRAME_BAND_HEIGHT} is: the partition's own hit test
83
+ * reads it (a swimlane is clickable by its header as well as by its border),
84
+ * and `affine-model` cannot reach into `affine-block-surface` where the
85
+ * declaration is resolved. One number, owned by the layer that both the
86
+ * declaration and the hit test can read.
87
+ *
88
+ * It is the band's THICKNESS whichever edge the band is on — the top for a
89
+ * vertical lane, the left for a horizontal one — because §15.6.4 draws one
90
+ * header strip and turns it with the lane rather than resizing it.
91
+ *
92
+ * 36 against the diagram frame's 44: a partition header is a name and not a
93
+ * `<kind> <name>` heading, and it is written inside a lane that already sits on
94
+ * a sheet, so it reads as a subdivision rather than as a second sheet.
95
+ */
96
+ export const UML_PARTITION_BAND = 36;
97
+ /**
98
+ * Height of a region's NAME BAND — the strip its name is written in, in model
99
+ * units.
100
+ *
101
+ * Owned by the model for the reason {@link UML_PARTITION_BAND} is: the region's
102
+ * own hit test reads it, and `affine-model` cannot reach into the package where
103
+ * the declaration is resolved. The same 36 the partition uses, and deliberately
104
+ * so — the two are the same piece of furniture, a name written in a strip along
105
+ * the top of a transparent frame, and two numbers would drift.
106
+ */
107
+ export const UML_REGION_BAND = 36;
@@ -2,85 +2,7 @@ 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
- * Height of the diagram frame's heading band — the strip across the top of the
7
- * frame the `<kind> <name>` tag is written in, in model units.
8
- *
9
- * Declared HERE, in the model, and re-exported by `@labre/affine-gfx-uml`
10
- * rather than the other way round, for the reason `C4_BOARD_TITLE_BAND_HEIGHT`
11
- * is: the frame's own hit test needs it (a diagram is clickable by its heading
12
- * band as well as by its border), and `affine-model` cannot reach into
13
- * `affine-block-surface` where the declaration is resolved. One number, owned
14
- * by the layer that both the declaration and the hit test can read.
15
- *
16
- * It is the frame's TOP MARGIN — the inset the drawing gives up so the heading
17
- * has somewhere to be written — so the strip that is painted, the strip that is
18
- * picked and the strip that opens the rename are one number rather than three.
19
- *
20
- * 44 is the height of the cut-corner tag UML 2.5.1 Annex A draws the heading
21
- * in: a 20-unit label with the rest as breathing room above and below.
22
- * Changing it moves the heading, so it is a visual decision and not a hit-test
23
- * one.
24
- */
25
- export declare const UML_FRAME_BAND_HEIGHT = 44;
26
- /**
27
- * Which kind of UML diagram this frame draws — the DECLARED fact, as opposed to
28
- * the name, which is free text and says whatever its author wants it to.
29
- *
30
- * ## Where the values come from
31
- *
32
- * UML 2.5.1 Annex A gives the normative frame kind names, each with the
33
- * abbreviation that may be written in its place:
34
- *
35
- * - `activity` / `act`;
36
- * - `class` — the one kind Annex A gives NO abbreviation for, so the word
37
- * itself is the tag;
38
- * - `component` / `cmp`;
39
- * - `deployment` / `dep`;
40
- * - `interaction` / `sd`;
41
- * - `package` / `pkg`;
42
- * - `state machine` / `stm`;
43
- * - `use case` / `uc`.
44
- *
45
- * `obj` is NOT in that list. Annex A has no frame kind for the object diagram —
46
- * the standard treats it as a class diagram showing instances — but every tool
47
- * that draws one tags it `obj`, and an architect reading the sheet expects to
48
- * see it. So `obj` is kept as a TOOL CONVENTION, recorded as such here so that
49
- * nobody later "fixes" it against the spec without knowing it was a choice.
50
- *
51
- * ## Widening this union is additive
52
- *
53
- * Phase 1 shipped the first four kinds below; phase 2 APPENDED `cmp` and `dep`,
54
- * the two structural frames of §11.6.4 and §19.2.4, then `act` and `stm`, the
55
- * two behaviour frames of §15.2.4 and §14.2.4; phase 3 appends `sd`. Each
56
- * arrives as a new VALUE of the existing `kind`
57
- * string field — no new field, no schema change, no migration and no backfill.
58
- * The same promise `C4NodeKind` and `BpmnNodeKind` already make.
59
- *
60
- * Appended, never reordered: the union is read as a set of strings by every
61
- * consumer, and a document only ever stores one of them, so the ORDER below is a
62
- * reading aid. Keeping it chronological is what lets a reviewer see at a glance
63
- * which build a value arrived in.
64
- *
65
- * A value a client has never seen reads back as the string it is, and
66
- * {@link UmlDiagramElementModel.heading} writes it verbatim, so a document
67
- * created by a newer build still shows its own heading on an older one.
68
- */
69
- export type UmlDiagramKind = 'class' | 'pkg' | 'obj' | 'uc' | 'cmp' | 'dep' | 'act' | 'stm' | 'sd';
70
- /**
71
- * The word written in the heading tag, per kind.
72
- *
73
- * A table rather than the raw value so that a kind whose stored discriminant
74
- * and whose printed tag ever diverge has one place to say so. Today they are
75
- * the same four strings, and that is worth stating rather than assuming.
76
- *
77
- * `Partial` on purpose: a frame read off a document carries whatever string was
78
- * written there, including a kind from a later phase this build has never heard
79
- * of. Typing the lookup as total would make {@link
80
- * UmlDiagramElementModel.heading}'s `?? this.kind` fallback look like dead
81
- * defensive code, when it is the whole of the append-only promise.
82
- */
83
- export declare const UML_DIAGRAM_KIND_TAG: Partial<Record<UmlDiagramKind, string>>;
5
+ import { type UmlDiagramKind } from './consts.js';
84
6
  export type UmlDiagramProps = FrameworkBackgroundProps & {
85
7
  /** The diagram name, written in the heading tag — edited inline on dblclick. */
86
8
  name?: string;
@@ -35,59 +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
- * Height of the diagram frame's heading band — the strip across the top of the
40
- * frame the `<kind> <name>` tag is written in, in model units.
41
- *
42
- * Declared HERE, in the model, and re-exported by `@labre/affine-gfx-uml`
43
- * rather than the other way round, for the reason `C4_BOARD_TITLE_BAND_HEIGHT`
44
- * is: the frame's own hit test needs it (a diagram is clickable by its heading
45
- * band as well as by its border), and `affine-model` cannot reach into
46
- * `affine-block-surface` where the declaration is resolved. One number, owned
47
- * by the layer that both the declaration and the hit test can read.
48
- *
49
- * It is the frame's TOP MARGIN — the inset the drawing gives up so the heading
50
- * has somewhere to be written — so the strip that is painted, the strip that is
51
- * picked and the strip that opens the rename are one number rather than three.
52
- *
53
- * 44 is the height of the cut-corner tag UML 2.5.1 Annex A draws the heading
54
- * in: a 20-unit label with the rest as breathing room above and below.
55
- * Changing it moves the heading, so it is a visual decision and not a hit-test
56
- * one.
57
- */
58
- export const UML_FRAME_BAND_HEIGHT = 44;
59
- /**
60
- * The word written in the heading tag, per kind.
61
- *
62
- * A table rather than the raw value so that a kind whose stored discriminant
63
- * and whose printed tag ever diverge has one place to say so. Today they are
64
- * the same four strings, and that is worth stating rather than assuming.
65
- *
66
- * `Partial` on purpose: a frame read off a document carries whatever string was
67
- * written there, including a kind from a later phase this build has never heard
68
- * of. Typing the lookup as total would make {@link
69
- * UmlDiagramElementModel.heading}'s `?? this.kind` fallback look like dead
70
- * defensive code, when it is the whole of the append-only promise.
71
- */
72
- export const UML_DIAGRAM_KIND_TAG = {
73
- class: 'class',
74
- pkg: 'pkg',
75
- obj: 'obj',
76
- uc: 'uc',
77
- // Both are Annex A's own abbreviations, written exactly as the Annex writes
78
- // them — `cmp` for the component diagram, `dep` for the deployment diagram.
79
- cmp: 'cmp',
80
- dep: 'dep',
81
- // Annex A's own abbreviations again — `act` for the activity diagram, `stm`
82
- // for the state machine diagram. `stm` is the one tag in the table that is
83
- // NOT the kind spelled out: Annex A's frame kind is the two words `state
84
- // machine`, and `stm` is the abbreviation it gives in their place.
85
- act: 'act',
86
- stm: 'stm',
87
- // Annex A's abbreviation for the interaction frame, and the third tag in the
88
- // table that is not the kind spelled out: the frame kind is `interaction`.
89
- sd: 'sd',
90
- };
38
+ import { UML_DIAGRAM_KIND_TAG, UML_FRAME_BAND_HEIGHT, } from './consts.js';
91
39
  /**
92
40
  * The UML diagram frame: the sheet one diagram is drawn on — a class diagram, a
93
41
  * package diagram, an object diagram, a use case diagram, a component diagram, a
@@ -2,21 +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
- * Height of a combined fragment's OPERATOR BAND — the strip across its top the
7
- * pentagon tag is drawn in, in model units.
8
- *
9
- * Owned by the model for the reason {@link UML_FRAME_BAND_HEIGHT} is: the
10
- * fragment's own hit test reads it (a fragment is clickable by its tag strip as
11
- * well as by its border), and `affine-model` cannot reach into
12
- * `affine-block-surface` where the declaration is resolved.
13
- *
14
- * The diagram frame's own 44, and deliberately: §17.6.4 draws the operator in
15
- * the very same cut-corner pentagon Annex A draws a frame heading in — it IS a
16
- * frame, nested in another one — and two numbers for one piece of furniture
17
- * would drift.
18
- */
19
- export declare const UML_FRAGMENT_BAND = 44;
20
5
  /**
21
6
  * The INTERACTION OPERATOR of a combined fragment — the word written in its
22
7
  * pentagon, and the whole of what the fragment says (UML 2.5.1 §17.6.4).
@@ -35,21 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { field } from '../../../std/gfx/index.js';
36
36
  import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
37
37
  import { umlInNameBand } from './band.js';
38
- /**
39
- * Height of a combined fragment's OPERATOR BAND — the strip across its top the
40
- * pentagon tag is drawn in, in model units.
41
- *
42
- * Owned by the model for the reason {@link UML_FRAME_BAND_HEIGHT} is: the
43
- * fragment's own hit test reads it (a fragment is clickable by its tag strip as
44
- * well as by its border), and `affine-model` cannot reach into
45
- * `affine-block-surface` where the declaration is resolved.
46
- *
47
- * The diagram frame's own 44, and deliberately: §17.6.4 draws the operator in
48
- * the very same cut-corner pentagon Annex A draws a frame heading in — it IS a
49
- * frame, nested in another one — and two numbers for one piece of furniture
50
- * would drift.
51
- */
52
- export const UML_FRAGMENT_BAND = 44;
38
+ import { UML_FRAGMENT_BAND } from './consts.js';
53
39
  /**
54
40
  * A COMBINED FRAGMENT — the rectangle drawn round part of a sequence diagram
55
41
  * with an operator in its corner (UML 2.5.1 §17.6.4), and, under the `ref`
@@ -1,4 +1,5 @@
1
1
  export * from './band.js';
2
+ export * from './consts.js';
2
3
  export * from './diagram.js';
3
4
  export * from './fragment.js';
4
5
  export * from './lifeline.js';
@@ -1,4 +1,5 @@
1
1
  export * from './band.js';
2
+ export * from './consts.js';
2
3
  export * from './diagram.js';
3
4
  export * from './fragment.js';
4
5
  export * from './lifeline.js';
@@ -2,26 +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
- * Height of a partition's NAME BAND — the strip its name is written in, in
7
- * model units.
8
- *
9
- * Declared HERE, in the model, and re-exported by `@labre/affine-gfx-uml`, for
10
- * the reason {@link UML_FRAME_BAND_HEIGHT} is: the partition's own hit test
11
- * reads it (a swimlane is clickable by its header as well as by its border),
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
- * It is the band's THICKNESS whichever edge the band is on — the top for a
17
- * vertical lane, the left for a horizontal one — because §15.6.4 draws one
18
- * header strip and turns it with the lane rather than resizing it.
19
- *
20
- * 36 against the diagram frame's 44: a partition header is a name and not a
21
- * `<kind> <name>` heading, and it is written inside a lane that already sits on
22
- * a sheet, so it reads as a subdivision rather than as a second sheet.
23
- */
24
- export declare const UML_PARTITION_BAND = 36;
25
5
  /**
26
6
  * Which way a partition is sliced — the one thing §15.6.4 lets an author choose
27
7
  * about a swimlane, and the thing that decides which edge the header is on.
@@ -35,26 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { field } from '../../../std/gfx/index.js';
36
36
  import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
37
37
  import { umlInNameBand } from './band.js';
38
- /**
39
- * Height of a partition's NAME BAND — the strip its name is written in, in
40
- * model units.
41
- *
42
- * Declared HERE, in the model, and re-exported by `@labre/affine-gfx-uml`, for
43
- * the reason {@link UML_FRAME_BAND_HEIGHT} is: the partition's own hit test
44
- * reads it (a swimlane is clickable by its header as well as by its border),
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
- * It is the band's THICKNESS whichever edge the band is on — the top for a
50
- * vertical lane, the left for a horizontal one — because §15.6.4 draws one
51
- * header strip and turns it with the lane rather than resizing it.
52
- *
53
- * 36 against the diagram frame's 44: a partition header is a name and not a
54
- * `<kind> <name>` heading, and it is written inside a lane that already sits on
55
- * a sheet, so it reads as a subdivision rather than as a second sheet.
56
- */
57
- export const UML_PARTITION_BAND = 36;
38
+ import { UML_PARTITION_BAND } from './consts.js';
58
39
  /**
59
40
  * An activity PARTITION — the swimlane of UML 2.5.1 §15.6.4: the strip drawn
60
41
  * across an activity diagram saying who (or what) is responsible for the
@@ -2,17 +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
- * Height of a region's NAME BAND — the strip its name is written in, in model
7
- * units.
8
- *
9
- * Owned by the model for the reason {@link UML_PARTITION_BAND} is: the region's
10
- * own hit test reads it, and `affine-model` cannot reach into the package where
11
- * the declaration is resolved. The same 36 the partition uses, and deliberately
12
- * so — the two are the same piece of furniture, a name written in a strip along
13
- * the top of a transparent frame, and two numbers would drift.
14
- */
15
- export declare const UML_REGION_BAND = 36;
16
5
  export type UmlRegionProps = FrameworkBackgroundProps & {
17
6
  /** The state name, written in the band — edited inline on dblclick. */
18
7
  name?: string;
@@ -35,17 +35,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
35
35
  import { field } from '../../../std/gfx/index.js';
36
36
  import { FrameworkBackgroundElementModel } from '../framework-background/index.js';
37
37
  import { umlInNameBand } from './band.js';
38
- /**
39
- * Height of a region's NAME BAND — the strip its name is written in, in model
40
- * units.
41
- *
42
- * Owned by the model for the reason {@link UML_PARTITION_BAND} is: the region's
43
- * own hit test reads it, and `affine-model` cannot reach into the package where
44
- * the declaration is resolved. The same 36 the partition uses, and deliberately
45
- * so — the two are the same piece of furniture, a name written in a strip along
46
- * the top of a transparent frame, and two numbers would drift.
47
- */
48
- export const UML_REGION_BAND = 36;
38
+ import { UML_REGION_BAND } from './consts.js';
49
39
  /**
50
40
  * A COMPOSITE STATE — the region of UML 2.5.1 §14.2.4: the rounded rectangle
51
41
  * drawn round the sub-states of a state that has its own state machine inside
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@labre/affine-model/headless` — the model's data with no element class
3
+ * behind it: the enums and constants every surface element is written with,
4
+ * and the pure geometry an interchange reader computes with (ADR 0012, P3 as
5
+ * amended 2026-10-14).
6
+ *
7
+ * The package index re-exports every one of these unchanged; this entry
8
+ * exists for a caller that must not load `@labre/std/gfx` (and with it Lit and
9
+ * the drag-and-drop adapter): the headless `./interchange` entries of the
10
+ * framework bundles. Held by `interchange-headless.unit.spec.ts` in
11
+ * `packages/affine/all`. Add only from files that import nothing but
12
+ * `@labre/global` and types.
13
+ */
14
+ export * from './consts/index.js';
15
+ export * from './elements/bpmn/consts.js';
16
+ export * from './elements/connector/end-label.js';
17
+ export { DEFAULT_POLYGON_VERTICES } from './elements/shape/api/polygon.js';
18
+ export * from './elements/uml/consts.js';
19
+ export * from './elements/uml/lifeline.js';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@labre/affine-model/headless` — the model's data with no element class
3
+ * behind it: the enums and constants every surface element is written with,
4
+ * and the pure geometry an interchange reader computes with (ADR 0012, P3 as
5
+ * amended 2026-10-14).
6
+ *
7
+ * The package index re-exports every one of these unchanged; this entry
8
+ * exists for a caller that must not load `@labre/std/gfx` (and with it Lit and
9
+ * the drag-and-drop adapter): the headless `./interchange` entries of the
10
+ * framework bundles. Held by `interchange-headless.unit.spec.ts` in
11
+ * `packages/affine/all`. Add only from files that import nothing but
12
+ * `@labre/global` and types.
13
+ */
14
+ export * from './consts/index.js';
15
+ export * from './elements/bpmn/consts.js';
16
+ export * from './elements/connector/end-label.js';
17
+ export { DEFAULT_POLYGON_VERTICES } from './elements/shape/api/polygon.js';
18
+ export * from './elements/uml/consts.js';
19
+ export * from './elements/uml/lifeline.js';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * `@labre/affine-shared/headless` — the few shared helpers an interchange
3
+ * reader or writer calls, with no editor behind them (ADR 0012, P3 as amended
4
+ * 2026-10-14). The barrels (`./consts`, `./services`, `./utils`) re-export the
5
+ * same bindings; this entry exists for the headless `./interchange` graphs,
6
+ * held by `interchange-headless.unit.spec.ts` in `packages/affine/all`.
7
+ */
8
+ export { NOTATION_NEUTRALS } from './consts/notation.js';
9
+ export { fillPlaceholders, type TranslationParams, } from './services/translation-service/index.js';
10
+ export { safeFilename } from './utils/file/filesys.js';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * `@labre/affine-shared/headless` — the few shared helpers an interchange
3
+ * reader or writer calls, with no editor behind them (ADR 0012, P3 as amended
4
+ * 2026-10-14). The barrels (`./consts`, `./services`, `./utils`) re-export the
5
+ * same bindings; this entry exists for the headless `./interchange` graphs,
6
+ * held by `interchange-headless.unit.spec.ts` in `packages/affine/all`.
7
+ */
8
+ export { NOTATION_NEUTRALS } from './consts/notation.js';
9
+ export { fillPlaceholders, } from './services/translation-service/index.js';
10
+ export { safeFilename } from './utils/file/filesys.js';
@@ -0,0 +1,63 @@
1
+ import type { ExtensionType } from '../../store/index.js';
2
+ /**
3
+ * A blob the host ALREADY stores, as the editor references it: the block it
4
+ * lands in stores `sourceId` and nothing else of the bytes. The library never
5
+ * sends the bytes again (`BlobSource.set` is not called); it may read them
6
+ * once through the store's blob sources to measure an image when `width` or
7
+ * `height` is missing.
8
+ */
9
+ export interface AssetRef {
10
+ /** The blob's key in the store's blob sources (the Labre app: its sha256). */
11
+ sourceId: string;
12
+ /** The file name, kept by an attachment card. */
13
+ name: string;
14
+ /** The MIME type. An image request ignores a ref that is not `image/*`. */
15
+ type: string;
16
+ /** In bytes. */
17
+ size: number;
18
+ /** An image's natural size; measured from the blob when either is absent. */
19
+ width?: number;
20
+ height?: number;
21
+ }
22
+ /**
23
+ * What the editor asks for.
24
+ *
25
+ * - `kind`: `image` for an image block, `file` for an attachment card.
26
+ * - `mode`: `insert` adds new blocks; `replace` swaps the picture of one
27
+ * existing image (one ref is used, the first).
28
+ * - `multiple`: whether more than one ref is welcome (the image insertions).
29
+ * - `docId`: the document the result lands in, so the host can attach the
30
+ * asset to that page (a guest of the page must be able to read it).
31
+ */
32
+ export interface AssetPickerRequest {
33
+ kind: 'image' | 'file';
34
+ mode: 'insert' | 'replace';
35
+ multiple?: boolean;
36
+ docId: string;
37
+ }
38
+ /**
39
+ * Pick an asset from the host's own library (labre P4: the asset dialog of
40
+ * the shell), instead of the system file chooser.
41
+ *
42
+ * `pick` resolves with the refs to use, or `null` when the viewer cancelled:
43
+ * then nothing is written. An empty array is a cancellation too. A rejection
44
+ * is logged and nothing is written: show your own error before rejecting.
45
+ * Upload a new file into your library inside the dialog, then resolve with
46
+ * its ref: the editor never receives a `File` through this seam.
47
+ */
48
+ export interface AssetPickerService {
49
+ pick(request: AssetPickerRequest): Promise<AssetRef[] | null>;
50
+ }
51
+ export declare const AssetPickerProvider: import("../../global/di/types.js").ServiceIdentifier<AssetPickerService> & (<U extends AssetPickerService = AssetPickerService>(variant: import("../../global/di/types.js").ServiceVariant) => import("../../global/di/types.js").ServiceIdentifier<U>);
52
+ /**
53
+ * Host seam: the asset dialog. Present, the slash menu's Image, Attachment
54
+ * and PDF, the mobile keyboard toolbar's Image and Attachment, and the
55
+ * canvas's image and file buttons open it, and the image toolbar gains
56
+ * "Replace". Absent, every one of those opens the system file chooser as
57
+ * before, and there is no "Replace". Pasting and dropping files never go
58
+ * through it.
59
+ *
60
+ * `di.override`, like `FrameTemplateExtension`, so a later registration
61
+ * always wins and registering twice never throws at boot.
62
+ */
63
+ export declare function AssetPickerExtension(service: AssetPickerService): ExtensionType;
@@ -0,0 +1,20 @@
1
+ import { createIdentifier } from '../../global/di/index.js';
2
+ export const AssetPickerProvider = createIdentifier('AffineAssetPicker');
3
+ /**
4
+ * Host seam: the asset dialog. Present, the slash menu's Image, Attachment
5
+ * and PDF, the mobile keyboard toolbar's Image and Attachment, and the
6
+ * canvas's image and file buttons open it, and the image toolbar gains
7
+ * "Replace". Absent, every one of those opens the system file chooser as
8
+ * before, and there is no "Replace". Pasting and dropping files never go
9
+ * through it.
10
+ *
11
+ * `di.override`, like `FrameTemplateExtension`, so a later registration
12
+ * always wins and registering twice never throws at boot.
13
+ */
14
+ export function AssetPickerExtension(service) {
15
+ return {
16
+ setup: di => {
17
+ di.override(AssetPickerProvider, () => service);
18
+ },
19
+ };
20
+ }
@@ -0,0 +1,83 @@
1
+ import type { DocSnapshot, ExtensionType } from '../../store/index.js';
2
+ /**
3
+ * What "Save as template" on a frame's toolbar hands the host: the frame and
4
+ * everything it holds, serialized once, at the moment of the gesture.
5
+ *
6
+ * `snapshot` is a `DocSnapshot` the canvas's own template job inserts as is
7
+ * (`createTemplateJob(std, 'template').insertTemplate(snapshot)`, which mints
8
+ * fresh ids and lands every model in the viewer's active layer): keep it
9
+ * verbatim and give it back through {@link FrameTemplateService.list}. It is
10
+ * plain JSON. It names images and attachments by their blob id (`sourceId`)
11
+ * and never carries the bytes: the copy references them.
12
+ */
13
+ export interface FrameTemplateDraft {
14
+ /** The document the frame was saved from. */
15
+ docId: string;
16
+ /** The frame's block id in that document. */
17
+ frameId: string;
18
+ /** The frame's title when it was saved (may be empty). */
19
+ title: string;
20
+ snapshot: DocSnapshot;
21
+ }
22
+ /** One saved frame, as the canvas's Templates panel lists it. */
23
+ export interface SavedFrameTemplate {
24
+ /** Your own id for it; the panel uses it as the tile's identity. */
25
+ id: string;
26
+ title: string;
27
+ /** The `snapshot` of the {@link FrameTemplateDraft} you were given. */
28
+ snapshot: unknown;
29
+ /** An inline `<svg…` or an image URL; the panel's generic tile otherwise. */
30
+ preview?: string;
31
+ }
32
+ /** A saved frame inserted into a document, by your id for the template. */
33
+ export interface FrameTemplateInsertion {
34
+ docId: string;
35
+ templateId: string;
36
+ }
37
+ /** Ids of a frame whose life the host may follow. */
38
+ export interface FrameTemplateFrameRef {
39
+ docId: string;
40
+ frameId: string;
41
+ }
42
+ /**
43
+ * Frames saved as templates (labre P4): the host keeps them, the library
44
+ * serializes, lists and inserts them.
45
+ *
46
+ * - `save` is called by the frame toolbar's "Save as template"
47
+ * (`blocks/frame/src/frame-toolbar.ts`). The library tells the viewer how it
48
+ * went (a success or an error notification): do not notify yourself.
49
+ * - `list` feeds one category of the canvas's Templates panel
50
+ * (`gfx/template`, `templateManagerFor`). It is called each time the panel
51
+ * shows that category or searches across categories, never before.
52
+ * - `frameDeleted` is called when THIS viewer deletes a frame on a writable
53
+ * document, never for a deletion that arrives from another peer (that peer
54
+ * reported its own), so a deletion is reported once per author. It is called
55
+ * for every frame, saved or not: ignore the ids you do not know.
56
+ * - `frameRestored` is called when this viewer brings back a frame it had
57
+ * deleted in this session (undo). Whatever `frameDeleted` did must be
58
+ * undoable by it: move a template to the trash, never destroy it.
59
+ * - `frameInserted` is called once a saved frame from that category is on the
60
+ * canvas (the template job succeeded), with the document it landed in and
61
+ * your id for the template: link what the copy references (its images) to
62
+ * that document. Not called when the insertion failed.
63
+ *
64
+ * Both notifications may come twice for one gesture (two editors mounted on
65
+ * one document): make them idempotent.
66
+ */
67
+ export interface FrameTemplateService {
68
+ save(draft: FrameTemplateDraft): Promise<void>;
69
+ list(): Promise<SavedFrameTemplate[]>;
70
+ frameDeleted?(frame: FrameTemplateFrameRef): void;
71
+ frameRestored?(frame: FrameTemplateFrameRef): void;
72
+ frameInserted?(insertion: FrameTemplateInsertion): void;
73
+ }
74
+ export declare const FrameTemplateProvider: import("../../global/di/types.js").ServiceIdentifier<FrameTemplateService> & (<U extends FrameTemplateService = FrameTemplateService>(variant: import("../../global/di/types.js").ServiceVariant) => import("../../global/di/types.js").ServiceIdentifier<U>);
75
+ /**
76
+ * Host seam: keep frames saved as templates. Absent, the toolbar has no
77
+ * "Save as template", the Templates panel has no "Saved frames" category and
78
+ * nothing is reported when a frame is deleted.
79
+ *
80
+ * `di.override`, like `OutlinePanelExtension`, so a later registration always
81
+ * wins and registering twice never throws at boot.
82
+ */
83
+ export declare function FrameTemplateExtension(service: FrameTemplateService): ExtensionType;