platejs 54.0.0-beta.2 → 54.0.0-beta.4

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 (255) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.md +56 -0
  3. package/dist/{AIChatRequestContext-BMVWhfPV.d.ts → AIChatRequestContext-DrUahdTc.d.ts} +2 -2
  4. package/dist/{BaseSuggestionPlugin-DBl3fqnm.d.ts → BaseSuggestionPlugin-_7Ka6nY3.d.ts} +7 -3
  5. package/dist/{PlateStatic-DhNv2ejp.d.ts → PlateStatic-D3Cb-QwH.d.ts} +7 -7
  6. package/dist/ai/index.d.ts +1 -1
  7. package/dist/ai/react/AIChatPlugin.js +113 -78
  8. package/dist/ai/react/CopilotPlugin.js +1 -1
  9. package/dist/ai/react/index.d.ts +23 -16
  10. package/dist/authored/index.d.ts +4 -4
  11. package/dist/code-block/codemirror/createCodeMirrorAdapter.js +12 -9
  12. package/dist/code-block/codemirror/index.d.ts +1 -1
  13. package/dist/{combobox-DkBGgyd3.d.ts → combobox-Dr0OYZIE.d.ts} +2 -2
  14. package/dist/{comparison-types-CYnJ35qU.d.ts → comparison-types-DdwE6mYq-BogsHoUO.d.ts} +10 -2
  15. package/dist/compiler/index.d.ts +2 -2
  16. package/dist/{core-BJG8l_mk.d.ts → core-BqR-fEDp.d.ts} +493 -116
  17. package/dist/diff/index.d.ts +2 -2
  18. package/dist/docs/ai.md +4 -3
  19. package/dist/docs/api/core/plate-components.md +0 -19
  20. package/dist/docs/api/core/plate-controller.md +5 -3
  21. package/dist/docs/api/core/plate-plugin.md +3 -0
  22. package/dist/docs/api/core/plate-store.md +3 -3
  23. package/dist/docs/api/core.md +45 -5
  24. package/dist/docs/api/dom.md +11 -4
  25. package/dist/docs/api/editor-transforms.md +2 -1
  26. package/dist/docs/api/react-hooks.md +45 -13
  27. package/dist/docs/authored-changes.md +9 -4
  28. package/dist/docs/basic-blocks.md +42 -29
  29. package/dist/docs/block-placeholder.md +4 -2
  30. package/dist/docs/blockquote.md +5 -3
  31. package/dist/docs/board.md +118 -10
  32. package/dist/docs/code-block.md +47 -0
  33. package/dist/docs/comment.md +2 -2
  34. package/dist/docs/discussion.md +1 -1
  35. package/dist/docs/document-model.md +15 -3
  36. package/dist/docs/docx.md +1 -1
  37. package/dist/docs/dom-coverage.md +5 -0
  38. package/dist/docs/editor.md +50 -4
  39. package/dist/docs/examples/editable-voids.md +2 -3
  40. package/dist/docs/external-text.md +2 -0
  41. package/dist/docs/field.md +370 -0
  42. package/dist/docs/find.md +9 -6
  43. package/dist/docs/form.md +2 -0
  44. package/dist/docs/heading.md +6 -0
  45. package/dist/docs/installation/manual.md +0 -4
  46. package/dist/docs/link.md +3 -3
  47. package/dist/docs/llms.txt +4 -2
  48. package/dist/docs/markdown.md +270 -14
  49. package/dist/docs/plugin-components.md +13 -10
  50. package/dist/docs/plugin-input-rules.md +66 -15
  51. package/dist/docs/prompt-editor.md +205 -0
  52. package/dist/docs/roots.md +8 -6
  53. package/dist/docs/rtl.md +6 -4
  54. package/dist/docs/selection.md +7 -4
  55. package/dist/docs/suggestion.md +1 -1
  56. package/dist/docs/toolbar.md +26 -30
  57. package/dist/docs/upload.md +106 -17
  58. package/dist/docx/export/index.d.ts +3 -3
  59. package/dist/docx/export/lib/docxStaticComponents.js +12 -2
  60. package/dist/docx/export/lib/exportDocx.js +46 -17
  61. package/dist/docx/export/lib/internal/xml-builder.js +11 -16
  62. package/dist/docx/export/lib/reviewPart.js +1 -1
  63. package/dist/docx/export/lib/reviewProjection.js +52 -10
  64. package/dist/docx/import/index.d.ts +4 -4
  65. package/dist/docx/paste/index.d.ts +4 -4
  66. package/dist/dom/index.d.ts +1 -6
  67. package/dist/dom/plite-dom.internal.js +2 -2
  68. package/dist/excalidraw/index.d.ts +3 -2
  69. package/dist/excalidraw/react/index.d.ts +3 -2
  70. package/dist/facade.js +2 -2
  71. package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +13 -5
  72. package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +32 -10
  73. package/dist/features/board/index.d.ts +2 -2
  74. package/dist/features/board/lib/BaseBoardPlugin.js +14 -1
  75. package/dist/features/board/lib/boardStroke.internal.js +13 -1
  76. package/dist/features/board/lib/boardTypes.internal.js +16 -0
  77. package/dist/features/callout/index.d.ts +3 -2
  78. package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +14 -5
  79. package/dist/features/combobox/index.d.ts +2 -2
  80. package/dist/features/comments/BaseCommentsPlugin.js +33 -17
  81. package/dist/features/comments/index.d.ts +1 -1
  82. package/dist/features/date/index.d.ts +3 -2
  83. package/dist/features/details/index.d.ts +3 -2
  84. package/dist/features/details/lib/BaseDetailsPlugin.js +25 -12
  85. package/dist/features/field/index.d.ts +2 -0
  86. package/dist/features/field/index.js +4 -0
  87. package/dist/features/field/lib/BaseFieldPlugin.js +360 -0
  88. package/dist/features/field/lib/applyFieldValues.js +188 -0
  89. package/dist/features/field/lib/fieldRules.internal.js +204 -0
  90. package/dist/features/find/index.d.ts +3 -2
  91. package/dist/features/footnote/index.d.ts +1 -1
  92. package/dist/features/ink/index.d.ts +1 -1
  93. package/dist/features/ink/lib/BaseInkPlugin.js +126 -103
  94. package/dist/features/ink/lib/inkCodec.internal.js +130 -0
  95. package/dist/features/ink/lib/inkGone.internal.js +229 -48
  96. package/dist/features/ink/lib/inkPlaces.internal.js +534 -64
  97. package/dist/features/layout/index.d.ts +1 -1
  98. package/dist/features/link/lib/BaseLinkPlugin.js +6 -4
  99. package/dist/features/lint/index.d.ts +3 -2
  100. package/dist/features/media/index.d.ts +2 -2
  101. package/dist/features/media/index.js +2 -2
  102. package/dist/features/media/lib/media/parseMediaUrl.js +11 -1
  103. package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +206 -4
  104. package/dist/features/mention/index.d.ts +5 -4
  105. package/dist/features/suggestion/index.d.ts +1 -1
  106. package/dist/features/table/index.d.ts +1 -1
  107. package/dist/features/table/lib/BaseTablePlugin.js +64 -15
  108. package/dist/features/table/lib/internal/selection.js +4 -2
  109. package/dist/features/toc/index.d.ts +1 -1
  110. package/dist/features/upload/index.d.ts +2 -2
  111. package/dist/features/upload/lib/BaseUploadPlugin.js +464 -250
  112. package/dist/history/index.d.ts +2 -2
  113. package/dist/html/index.d.ts +3 -3
  114. package/dist/html/server/index.d.ts +1 -1
  115. package/dist/{htmlTypes-DjeFG3P8.d.ts → htmlTypes-eT2ZGDAj.d.ts} +2 -31
  116. package/dist/hyperscript/index.d.ts +1 -1
  117. package/dist/{index-DzD6BIFJ.d.ts → index-B33E1CRJ.d.ts} +295 -6
  118. package/dist/{index-Cl77E9yr.d.ts → index-B7moSod7.d.ts} +2 -2
  119. package/dist/{index-hsC_sOn2.d.ts → index-B8-5Sr7I.d.ts} +35 -5
  120. package/dist/{index-BiQerPJS.d.ts → index-B8QJDAmG.d.ts} +2 -2
  121. package/dist/{index-BBKGrsG3.d.ts → index-BTx5oK7k.d.ts} +1 -1
  122. package/dist/{index-iaZOhA76.d.ts → index-BWPcE4ac-Cto_IsNs.d.ts} +7 -1
  123. package/dist/{index-BU6k1Aev.d.ts → index-BXjLmx1n-CXk17buG.d.ts} +4781 -4584
  124. package/dist/{index-kLKMc-pI.d.ts → index-BXwU9QH6.d.ts} +2 -2
  125. package/dist/{index-DTgaSxKr.d.ts → index-BkwR-5hH.d.ts} +40 -4
  126. package/dist/{index-Bq3sdm3S.d.ts → index-BsV2McRr.d.ts} +5 -4
  127. package/dist/index-C9Fu-P4E.d.ts +773 -0
  128. package/dist/{index-D5W-p9bS.d.ts → index-Ca48r1ng.d.ts} +49 -4
  129. package/dist/{index-CcZbqPqk.d.ts → index-Cob_iBdu.d.ts} +116 -41
  130. package/dist/{index-Bxfvicyy.d.ts → index-CpY7Xnxw.d.ts} +4 -3
  131. package/dist/{index-BkR7-GLI.d.ts → index-DNQXzU-X.d.ts} +2 -2
  132. package/dist/{index-D1CFXA-i.d.ts → index-DPowErHa.d.ts} +471 -141
  133. package/dist/{index-DaM37gF6.d.ts → index-DShbzec2.d.ts} +38 -23
  134. package/dist/{index-DC_MNGyu.d.ts → index-DYdObeFQ.d.ts} +3 -3
  135. package/dist/{index-Bc2Yg_2j.d.ts → index-Dq3Jlj8O-BJ6NxZm0.d.ts} +2 -2
  136. package/dist/{index-CT7miqQN.d.ts → index-DwWQVwQt.d.ts} +29 -11
  137. package/dist/{index-xdmCBvlT.d.ts → index-JWgwL5l3.d.ts} +5 -2
  138. package/dist/{index-DLA2DUR2.d.ts → index-M781pyx9.d.ts} +4 -3
  139. package/dist/{index-DdIRduDG.d.ts → index-d7io3MzC.d.ts} +3 -2
  140. package/dist/index.d.ts +4 -4
  141. package/dist/{react/internal → internal}/penStroke.internal.js +1 -1
  142. package/dist/internal/plugin/OverridePlugin.js +101 -119
  143. package/dist/internal/plugin/collectPlateNodeMappings.js +5 -1
  144. package/dist/internal/plugin/pastedUploadFiles.js +4 -0
  145. package/dist/internal/plugin/resolvePlugin.js +1 -1
  146. package/dist/internal/plugin/resolvePlugins.js +3 -0
  147. package/dist/internal/plugin/uploadDrafts.js +6 -0
  148. package/dist/internal/utils/mergePlugins.js +1 -0
  149. package/dist/lib/plugins/element-id/ElementIdPlugin.js +14 -18
  150. package/dist/lib/plugins/html/HtmlPlugin.js +9 -0
  151. package/dist/lib/plugins/html/htmlSafety.js +1 -1
  152. package/dist/lib/plugins/input-rules/InputRulesPlugin.js +77 -28
  153. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +16 -0
  154. package/dist/markdown/index.d.ts +2 -2
  155. package/dist/markdown/index.js +3 -1
  156. package/dist/markdown/lib/MarkdownPlugin.js +14 -11
  157. package/dist/markdown/lib/RawHtmlPlugin.js +26 -0
  158. package/dist/markdown/lib/deserializer/mdastToSlate.js +12 -2
  159. package/dist/markdown/lib/internal/markdownConversion.js +776 -74
  160. package/dist/markdown/lib/internal/markdownDiagnostics.js +18 -7
  161. package/dist/markdown/lib/internal/markdownFootnoteWriter.js +35 -0
  162. package/dist/markdown/lib/internal/markdownFrontmatter.js +102 -0
  163. package/dist/markdown/lib/internal/markdownIntrinsics.js +125 -43
  164. package/dist/markdown/lib/internal/markdownLine.js +5 -3
  165. package/dist/markdown/lib/internal/markdownMappings.js +19 -7
  166. package/dist/markdown/lib/internal/markdownOpenTail.js +381 -0
  167. package/dist/markdown/lib/internal/markdownRawHtml.js +353 -0
  168. package/dist/markdown/lib/internal/markdownSegments.js +57 -48
  169. package/dist/markdown/lib/internal/markdownTags.js +29 -9
  170. package/dist/markdown/lib/serializer/convertNodesSerialize.js +10 -8
  171. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +226 -0
  172. package/dist/markdown/lib/serializer/listToMdastTree.js +2 -0
  173. package/dist/math/index.d.ts +3 -2
  174. package/dist/math/react/index.d.ts +4 -3
  175. package/dist/migrations/index.d.ts +3 -3
  176. package/dist/migrations/migratePlateV54.js +4 -6
  177. package/dist/migrations/migratePlateV54RetiredMarks.internal.js +23 -8
  178. package/dist/migrations/migratePlateV54Suggestions.internal.js +2 -2
  179. package/dist/migrations/v53-manifest.internal.js +4 -0
  180. package/dist/pagination/index.d.ts +1 -1
  181. package/dist/pagination/react/index.d.ts +4 -4
  182. package/dist/react/components/EditorContentView.internal.js +42 -23
  183. package/dist/react/components/EditorProvider.js +5 -5
  184. package/dist/react/components/Plate.js +102 -128
  185. package/dist/react/components/PlateContainer.js +40 -32
  186. package/dist/react/components/PlateController.js +28 -16
  187. package/dist/react/components/PlateRoot.internal.js +3 -2
  188. package/dist/react/core.js +4 -4
  189. package/dist/react/features/board/BoardSurface.js +116 -87
  190. package/dist/react/features/board/boardClipboard.internal.js +15 -5
  191. package/dist/react/features/board/boardExport.internal.js +470 -0
  192. package/dist/react/features/board/boardGesture.internal.js +6 -3
  193. package/dist/react/features/board/boardIndex.internal.js +7 -18
  194. package/dist/react/features/board/boardPictureStyles.internal.js +415 -0
  195. package/dist/react/features/board/boardPictures.internal.js +19 -13
  196. package/dist/react/features/board/boardView.internal.js +190 -50
  197. package/dist/react/features/board/boardVoice.internal.js +10 -11
  198. package/dist/react/features/board/index.d.ts +108 -18
  199. package/dist/react/features/callout/index.d.ts +3 -2
  200. package/dist/react/features/combobox/index.d.ts +8 -8
  201. package/dist/react/features/comments/index.d.ts +6 -5
  202. package/dist/react/features/date/index.d.ts +4 -3
  203. package/dist/react/features/details/index.d.ts +4 -3
  204. package/dist/react/features/field/FieldPlugin.js +35 -0
  205. package/dist/react/features/field/index.d.ts +315 -0
  206. package/dist/react/features/field/index.js +2 -0
  207. package/dist/react/features/footnote/index.d.ts +7 -6
  208. package/dist/react/features/format-painter/index.d.ts +4 -3
  209. package/dist/react/features/ink/InkContent.js +313 -0
  210. package/dist/react/features/ink/index.d.ts +57 -33
  211. package/dist/react/features/ink/index.js +2 -2
  212. package/dist/react/features/ink/inkCapture.internal.js +39 -17
  213. package/dist/react/features/ink/inkInput.internal.js +1 -1
  214. package/dist/react/features/ink/inkLayout.internal.js +6 -3
  215. package/dist/react/features/ink/inkPaint.internal.js +78 -2
  216. package/dist/react/features/ink/inkPlacement.internal.js +332 -104
  217. package/dist/react/features/ink/inkWatch.internal.js +7 -5
  218. package/dist/react/features/layout/index.d.ts +5 -4
  219. package/dist/react/features/media/index.d.ts +5 -4
  220. package/dist/react/features/mention/index.d.ts +6 -5
  221. package/dist/react/features/resizable/Resizable.js +4 -6
  222. package/dist/react/features/resizable/index.d.ts +5 -5
  223. package/dist/react/features/suggestion/index.d.ts +6 -5
  224. package/dist/react/features/table/TablePlugin.js +4 -11
  225. package/dist/react/features/table/index.d.ts +10 -8
  226. package/dist/react/features/table/useTableResize.js +10 -1
  227. package/dist/react/features/toc/index.d.ts +2 -2
  228. package/dist/react/features/upload/index.d.ts +11 -6
  229. package/dist/react/index.d.ts +6 -6
  230. package/dist/react/index.js +4 -4
  231. package/dist/react/internal/plate-context.js +434 -188
  232. package/dist/react/plite-react.js +2 -2
  233. package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +12 -10
  234. package/dist/react/stores/plate/useEditor.js +32 -14
  235. package/dist/react/stores/plate/useEditorHistory.js +55 -0
  236. package/dist/react/stores/plate/useEditorSelector.js +79 -21
  237. package/dist/react/utils/BlockPlaceholderPlugin.js +5 -2
  238. package/dist/react/utils/pipeRenderElement.internal.js +1 -1
  239. package/dist/react/utils/pluginRenderElement.internal.js +1 -1
  240. package/dist/react/virtualized.d.ts +4 -4
  241. package/dist/{source-CNKy99Th.d.ts → source-BGohy8vH.d.ts} +4 -4
  242. package/dist/static/index.d.ts +18 -18
  243. package/dist/static/internal/renderStaticHtmlWithOverrides.js +2 -2
  244. package/dist/static/internal/staticPresentation.js +4 -4
  245. package/dist/static/internal/writeStaticSelectionClipboardData.js +7 -2
  246. package/dist/tabbable/index.d.ts +1 -1
  247. package/dist/tabbable/react/index.d.ts +3 -3
  248. package/dist/testing/index.d.ts +3 -3
  249. package/dist/yjs/index.d.ts +1 -1
  250. package/dist/yjs/react/index.d.ts +6 -6
  251. package/package.json +20 -2
  252. package/dist/markdown/lib/serializer/convertTextsSerialize.js +0 -163
  253. package/dist/react/components/EditorSelectionView.js +0 -40
  254. package/dist/react/features/ink/InkLayer.js +0 -218
  255. package/dist/react/internal/createPlateTargetScope.js +0 -62
@@ -0,0 +1,470 @@
1
+ import { createAuthoredEditorView } from "../../../facade.js";
2
+ import { getPluginNodeClass } from "../../../lib/utils/pluginNodeClass.js";
3
+ import { ElementApi } from "../../../core.js";
4
+ import { bindStaticPresentation } from "../../../static/internal/staticPresentation.js";
5
+ import { getStaticRootView } from "../../../static/internal/staticDocumentView.js";
6
+ import { EditorStatic } from "../../../static/components/PlateStatic.js";
7
+ import { loadStaticRenderer } from "../../../static/internal/renderStaticHtmlWithOverrides.js";
8
+ import { shapeIdOf } from "../../../features/board/lib/boardCopy.internal.js";
9
+ import { PICTURE_ROOT, pictureFrameOf, pictureSheetOf, readPictureStyles } from "./boardPictureStyles.internal.js";
10
+ import * as React$1 from "react";
11
+ import { c } from "react/compiler-runtime";
12
+ //#region src/react/features/board/boardExport.internal.tsx
13
+ const SVG_NS = "http://www.w3.org/2000/svg";
14
+ const PADDING = 32;
15
+ const UNDRAWN_FILL = "#e4e4e7";
16
+ const PNG_SCALE = 2;
17
+ const PNG_SIDE = 16384;
18
+ const PNG_AREA = 16777216;
19
+ const FETCHES = 6;
20
+ const FETCH_LIMIT_MS = 5e3;
21
+ const FONT_WAIT_MS = 250;
22
+ const COLOR = /(?:oklab|oklch|lab|lch|color)\([^()]*\)/gu;
23
+ const QUOTED = /("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/u;
24
+ function PictureShapes(t0) {
25
+ const $ = c(9);
26
+ const { editor, root } = t0;
27
+ let shapes;
28
+ let t1;
29
+ if ($[0] !== editor || $[1] !== root) {
30
+ shapes = getStaticRootView(editor, root);
31
+ const ids = shapes.read.children().map(_temp);
32
+ t1 = JSON.stringify(ids);
33
+ $[0] = editor;
34
+ $[1] = root;
35
+ $[2] = shapes;
36
+ $[3] = t1;
37
+ } else {
38
+ shapes = $[2];
39
+ t1 = $[3];
40
+ }
41
+ let t2;
42
+ if ($[4] !== shapes) {
43
+ t2 = /* @__PURE__ */ React$1.createElement(EditorStatic, { editor: shapes });
44
+ $[4] = shapes;
45
+ $[5] = t2;
46
+ } else t2 = $[5];
47
+ let t3;
48
+ if ($[6] !== t1 || $[7] !== t2) {
49
+ t3 = /* @__PURE__ */ React$1.createElement("div", { "data-board-picture-shapes": t1 }, t2);
50
+ $[6] = t1;
51
+ $[7] = t2;
52
+ $[8] = t3;
53
+ } else t3 = $[8];
54
+ return t3;
55
+ }
56
+ function _temp(node) {
57
+ return ElementApi.isElement(node) ? shapeIdOf(node) : "";
58
+ }
59
+ const boxIn = (drawing) => {
60
+ const [x = 0, y = 0, width = 0, height = 0] = (drawing.getAttribute("data-board-box") ?? "").split(" ").map(Number);
61
+ return {
62
+ height,
63
+ width,
64
+ x,
65
+ y
66
+ };
67
+ };
68
+ const inOrUnder = (element, selector) => element.matches(selector) || element.querySelector(selector) !== null;
69
+ const stripEditor = (drawing) => {
70
+ for (const node of [drawing, ...drawing.querySelectorAll("*")]) for (const { name } of [...node.attributes]) if (name === "contenteditable" || name.startsWith("data-editor")) node.removeAttribute(name);
71
+ };
72
+ const srgbOf = (document) => {
73
+ const cache = /* @__PURE__ */ new Map();
74
+ let paint;
75
+ const converted = (color) => {
76
+ paint ??= document.createElement("canvas").getContext("2d", { willReadFrequently: true });
77
+ if (!paint) return color;
78
+ let srgb = cache.get(color);
79
+ if (srgb === void 0) {
80
+ paint.clearRect(0, 0, 1, 1);
81
+ paint.fillStyle = color;
82
+ paint.fillRect(0, 0, 1, 1);
83
+ const [r, g, b, a = 0] = paint.getImageData(0, 0, 1, 1).data;
84
+ srgb = `rgba(${r}, ${g}, ${b}, ${Math.round(a / 255 * 1e3) / 1e3})`;
85
+ cache.set(color, srgb);
86
+ }
87
+ return srgb;
88
+ };
89
+ return (value) => value.split(QUOTED).map((part, at) => at % 2 === 1 ? part : part.replace(COLOR, converted)).join("");
90
+ };
91
+ const backgroundOf = (host, srgb) => {
92
+ const layers = [];
93
+ for (let element = host; element; element = element.parentElement) {
94
+ const [r = 0, g = 0, b = 0, a = 1] = srgb(getComputedStyle(element).backgroundColor).match(/[\d.]+/gu)?.map(Number) ?? [
95
+ 0,
96
+ 0,
97
+ 0,
98
+ 0
99
+ ];
100
+ if (a > 0) layers.unshift([
101
+ r,
102
+ g,
103
+ b,
104
+ a
105
+ ]);
106
+ if (a >= 1) break;
107
+ }
108
+ let [red, green, blue] = [
109
+ 255,
110
+ 255,
111
+ 255
112
+ ];
113
+ for (const [r, g, b, a] of layers) {
114
+ red = r * a + red * (1 - a);
115
+ green = g * a + green * (1 - a);
116
+ blue = b * a + blue * (1 - a);
117
+ }
118
+ return `rgb(${Math.round(red)}, ${Math.round(green)}, ${Math.round(blue)})`;
119
+ };
120
+ const paintedIn = (drawing, origin) => [drawing, ...drawing.querySelectorAll("*")].flatMap((node) => {
121
+ const { height, left, top, width } = node.getBoundingClientRect();
122
+ return width > 0 || height > 0 ? [{
123
+ height,
124
+ width,
125
+ x: left - origin.left,
126
+ y: top - origin.top
127
+ }] : [];
128
+ });
129
+ const edgesOf = (boxes) => {
130
+ let left = Number.POSITIVE_INFINITY;
131
+ let top = Number.POSITIVE_INFINITY;
132
+ let right = Number.NEGATIVE_INFINITY;
133
+ let bottom = Number.NEGATIVE_INFINITY;
134
+ for (const { height, width, x, y } of boxes) {
135
+ left = Math.min(left, x);
136
+ top = Math.min(top, y);
137
+ right = Math.max(right, x + width);
138
+ bottom = Math.max(bottom, y + height);
139
+ }
140
+ return {
141
+ bottom,
142
+ left,
143
+ right,
144
+ top
145
+ };
146
+ };
147
+ const rectAt = (document, box, fill) => {
148
+ const rect = document.createElementNS(SVG_NS, "rect");
149
+ rect.setAttribute("fill", fill);
150
+ rect.setAttribute("height", String(box.height));
151
+ rect.setAttribute("width", String(box.width));
152
+ rect.setAttribute("x", String(box.x));
153
+ rect.setAttribute("y", String(box.y));
154
+ return rect;
155
+ };
156
+ const sourceOf = (image) => image.localName === "img" ? "src" : "href";
157
+ const inSixes = async (tasks) => {
158
+ const queue = [...tasks];
159
+ await Promise.all(Array.from({ length: FETCHES }, async () => {
160
+ for (let task = queue.shift(); task; task = queue.shift()) await task();
161
+ }));
162
+ };
163
+ const fetched = async (url) => {
164
+ const response = await fetch(url, { signal: AbortSignal.timeout(FETCH_LIMIT_MS) });
165
+ if (!response.ok) throw new Error(`${url} answered ${response.status}.`);
166
+ return response.blob();
167
+ };
168
+ const dataUrlOf = (blob) => new Promise((resolve, reject) => {
169
+ const reader = new FileReader();
170
+ reader.addEventListener("load", () => typeof reader.result === "string" ? resolve(reader.result) : reject(/* @__PURE__ */ new Error("The file did not read as a data URL.")));
171
+ reader.addEventListener("error", () => reject(reader.error ?? /* @__PURE__ */ new Error("The file did not read.")));
172
+ reader.readAsDataURL(blob);
173
+ });
174
+ const decodedDataUrl = async (document, blob, size, scale) => {
175
+ const url = URL.createObjectURL(blob);
176
+ try {
177
+ const image = document.createElement("img");
178
+ image.src = url;
179
+ await image.decode();
180
+ const { naturalHeight, naturalWidth } = image;
181
+ const fit = scale === null ? 1 : scale * Math.max(size.width / naturalWidth, size.height / naturalHeight);
182
+ const canvas = document.createElement("canvas");
183
+ const paint = fit > 0 && fit < 1 ? canvas.getContext("2d") : null;
184
+ if (!paint) return await dataUrlOf(blob);
185
+ canvas.height = Math.max(1, Math.round(naturalHeight * fit));
186
+ canvas.width = Math.max(1, Math.round(naturalWidth * fit));
187
+ paint.drawImage(image, 0, 0, canvas.width, canvas.height);
188
+ return canvas.toDataURL("image/png");
189
+ } finally {
190
+ URL.revokeObjectURL(url);
191
+ }
192
+ };
193
+ const grayOf = (document, image) => {
194
+ if (image.namespaceURI === SVG_NS) {
195
+ const rect = document.createElementNS(SVG_NS, "rect");
196
+ for (const name of [
197
+ "height",
198
+ "width",
199
+ "x",
200
+ "y"
201
+ ]) {
202
+ const value = image.getAttribute(name);
203
+ if (value !== null) rect.setAttribute(name, value);
204
+ }
205
+ rect.setAttribute("fill", UNDRAWN_FILL);
206
+ return rect;
207
+ }
208
+ const box = document.createElement("span");
209
+ box.style.cssText = image.style.cssText;
210
+ box.style.backgroundColor = UNDRAWN_FILL;
211
+ box.style.display ||= "inline-block";
212
+ return box;
213
+ };
214
+ const pngSizeOf = (width, height) => {
215
+ const scale = Math.min(PNG_SCALE, PNG_SIDE / width, PNG_SIDE / height, Math.sqrt(PNG_AREA / (width * height)));
216
+ return {
217
+ height: Math.max(1, Math.floor(height * scale)),
218
+ scale,
219
+ width: Math.max(1, Math.floor(width * scale))
220
+ };
221
+ };
222
+ const pngOf = async (document, svg, { height, width }) => {
223
+ const image = document.createElement("img");
224
+ let fallback;
225
+ try {
226
+ image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
227
+ await image.decode().catch(() => {
228
+ fallback = URL.createObjectURL(new Blob([svg], { type: "image/svg+xml" }));
229
+ image.src = fallback;
230
+ return image.decode();
231
+ });
232
+ await new Promise((resolve) => {
233
+ setTimeout(resolve, FONT_WAIT_MS);
234
+ });
235
+ const canvas = document.createElement("canvas");
236
+ canvas.height = height;
237
+ canvas.width = width;
238
+ const paint = canvas.getContext("2d");
239
+ if (!paint) throw new Error("The browser gave no 2D canvas for the PNG.");
240
+ paint.drawImage(image, 0, 0, width, height);
241
+ return await new Promise((resolve, reject) => {
242
+ canvas.toBlob((blob) => blob ? resolve(blob) : reject(/* @__PURE__ */ new Error("The PNG did not encode.")), "image/png");
243
+ });
244
+ } finally {
245
+ if (fallback) URL.revokeObjectURL(fallback);
246
+ }
247
+ };
248
+ const pin = (document, object) => {
249
+ const box = document.createElement("div");
250
+ const size = (name) => {
251
+ const value = Number(object.getAttribute(name));
252
+ return Number.isFinite(value) && value > 0 ? `${value}px` : "100%";
253
+ };
254
+ box.style.cssText = `position: fixed; left: 0px; top: 0px; width: ${size("width")}; height: ${size("height")};`;
255
+ box.append(...object.childNodes);
256
+ object.append(box);
257
+ };
258
+ const groupOf = (document, { box, drawing, id }, labels, offsets) => {
259
+ const group = document.createElementNS(SVG_NS, "g");
260
+ group.setAttribute("data-board-picture", id);
261
+ if (!drawing) {
262
+ group.append(rectAt(document, box, UNDRAWN_FILL));
263
+ return group;
264
+ }
265
+ for (const svg of drawing.querySelectorAll(":scope > svg")) {
266
+ svg.setAttribute("x", String(box.x + (offsets.get(svg)?.left ?? 0)));
267
+ svg.setAttribute("y", String(box.y + (offsets.get(svg)?.top ?? 0)));
268
+ group.append(svg);
269
+ }
270
+ const label = drawing.querySelector(":scope > [data-board-arrow-label]");
271
+ if (label) {
272
+ const object = document.createElementNS(SVG_NS, "foreignObject");
273
+ const size = labels.get(label);
274
+ const height = Math.max(1, Math.ceil(size?.height ?? 0));
275
+ const width = Math.max(1, Math.ceil(size?.width ?? 0));
276
+ object.setAttribute("height", String(height));
277
+ object.setAttribute("overflow", "visible");
278
+ object.setAttribute("width", String(width));
279
+ object.setAttribute("x", String(box.x + (offsets.get(label)?.left ?? 0) - width / 2));
280
+ object.setAttribute("y", String(box.y + (offsets.get(label)?.top ?? 0) - height / 2));
281
+ object.append(label);
282
+ group.append(object);
283
+ }
284
+ for (const object of group.querySelectorAll("foreignObject")) pin(document, object);
285
+ return group;
286
+ };
287
+ const OFF_PAGE = "The board is not on the page.";
288
+ const CSS_TOKEN = /"(?:[^"\\]|\\.)*"?|'(?:[^'\\]|\\.)*'?|\\.?|[(),;]|[^"'\\(),;]+/gsu;
289
+ const URL_SOURCE = /^url\(\s*(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|((?:[^"'()\s\\]|\\.)*))\s*\)/isu;
290
+ const splitTopLevel = (text, separator) => {
291
+ const parts = [""];
292
+ let depth = 0;
293
+ for (const [token] of text.matchAll(CSS_TOKEN)) {
294
+ if (token === "(") depth += 1;
295
+ if (token === ")") depth = Math.max(0, depth - 1);
296
+ if (token === separator && depth === 0) parts.push("");
297
+ else parts[parts.length - 1] += token;
298
+ }
299
+ return parts;
300
+ };
301
+ const inlinedFace = async (face, base) => {
302
+ const open = face.indexOf("{") + 1;
303
+ const close = face.lastIndexOf("}");
304
+ const declarations = splitTopLevel(face.slice(open, close), ";");
305
+ const at = declarations.findIndex((declaration) => /^\s*src\s*:/iu.test(declaration));
306
+ if (at === -1) return {
307
+ css: face,
308
+ missing: false
309
+ };
310
+ const colon = declarations[at].indexOf(":") + 1;
311
+ const kept = [];
312
+ let urls = 0;
313
+ let loaded = 0;
314
+ for (const source of splitTopLevel(declarations[at].slice(colon), ",")) {
315
+ const written = source.trim();
316
+ const url = URL_SOURCE.exec(written);
317
+ if (!url) {
318
+ if (written) kept.push(written);
319
+ continue;
320
+ }
321
+ urls += 1;
322
+ try {
323
+ const href = (url[1] ?? url[2] ?? url[3] ?? "").replaceAll(/\\(.)/gsu, "$1");
324
+ const inlined = /^data:/iu.test(href) ? href : await dataUrlOf(await fetched(new URL(href, base).href));
325
+ kept.push(`url("${inlined.replaceAll(/["\\]/gu, "\\$&")}")${written.slice(url[0].length)}`);
326
+ loaded += 1;
327
+ } catch {
328
+ continue;
329
+ }
330
+ }
331
+ if (urls === 0) return {
332
+ css: face,
333
+ missing: false
334
+ };
335
+ declarations[at] = `${declarations[at].slice(0, colon)} ${kept.join(", ")}`;
336
+ return {
337
+ css: kept.length === 0 ? "" : `${face.slice(0, open)}${declarations.join(";")}${face.slice(close)}`,
338
+ missing: loaded === 0
339
+ };
340
+ };
341
+ const pageUrlOf = (href, base) => URL.canParse(href, base) ? new URL(href, base) : null;
342
+ const drawBoardPicture = async (view, selected, format, kit) => {
343
+ const { renderToStaticMarkup } = await loadStaticRenderer();
344
+ const source = view.pictureSource(selected);
345
+ if (!source) throw new Error(OFF_PAGE);
346
+ const { editor, host, layouts, projection, root } = source;
347
+ const picture = createAuthoredEditorView(editor, {
348
+ readOnly: true,
349
+ ...projection && { authored: { preview: projection } }
350
+ });
351
+ const missing = bindStaticPresentation(picture, { plugins: kit });
352
+ const data = renderToStaticMarkup(/* @__PURE__ */ React$1.createElement(PictureShapes, {
353
+ editor: picture,
354
+ root
355
+ }));
356
+ const document = host.ownerDocument;
357
+ const { baseURI } = document;
358
+ const template = document.createElement("template");
359
+ template.innerHTML = data;
360
+ const kept = new Set(JSON.parse(template.content.querySelector("[data-board-picture-shapes]")?.getAttribute("data-board-picture-shapes") ?? "[]"));
361
+ const shown = new Map([...template.content.querySelectorAll(`[data-editor-root="${CSS.escape(root)}"][data-editor-node="element"]`)].flatMap((node) => {
362
+ const id = node.getAttribute("data-board-picture");
363
+ return id === null || node.getAttribute("data-editor-path")?.includes(",") ? [] : [[id, node]];
364
+ }));
365
+ const warnings = [];
366
+ const drawings = [];
367
+ for (const { box, id } of layouts) {
368
+ if (!kept.has(id)) continue;
369
+ const drawing = shown.get(id);
370
+ if (drawing) {
371
+ if (inOrUnder(drawing, "[data-board-image-unreadable]")) warnings.push({
372
+ code: "image-unreadable",
373
+ shapeId: id
374
+ });
375
+ drawings.push({
376
+ box: boxIn(drawing),
377
+ drawing,
378
+ id
379
+ });
380
+ } else {
381
+ warnings.push({
382
+ code: "shape-undrawn",
383
+ shapeId: id
384
+ });
385
+ drawings.push({
386
+ box,
387
+ drawing: null,
388
+ id
389
+ });
390
+ }
391
+ }
392
+ if (drawings.length === 0) return null;
393
+ if ([...missing].some(([name, features]) => drawings.some(({ drawing }) => drawing && (features.has("slots") || inOrUnder(drawing, `.${CSS.escape(getPluginNodeClass(name))}`))))) warnings.push({ code: "content-undrawn" });
394
+ const placed = drawings.flatMap(({ drawing }) => [...drawing?.querySelectorAll(":scope > svg, :scope > [data-board-arrow-label]") ?? []]);
395
+ const frame = pictureFrameOf(document);
396
+ host.append(...drawings.flatMap(({ drawing }) => drawing ?? []), frame);
397
+ const origin = host.getBoundingClientRect();
398
+ const edges = edgesOf(drawings.flatMap(({ box, drawing }) => [box, ...drawing ? paintedIn(drawing, origin) : []]));
399
+ const styles = readPictureStyles(frame, host, placed);
400
+ const labels = new Map(placed.filter((element) => element.hasAttribute("data-board-arrow-label")).map((label) => [label, label.getBoundingClientRect()]));
401
+ const images = placed.flatMap((drawn) => [...drawn.querySelectorAll("image, img")].filter((image) => image.getAttribute(sourceOf(image))).map((image) => ({
402
+ id: image.closest("[data-board-picture]")?.getAttribute("data-board-picture") ?? "",
403
+ image,
404
+ size: image.getBoundingClientRect()
405
+ })));
406
+ const srgb = srgbOf(document);
407
+ const background = backgroundOf(host, srgb);
408
+ host.replaceChildren();
409
+ await Promise.resolve();
410
+ for (const { drawing } of drawings) if (drawing) stripEditor(drawing);
411
+ for (const link of placed.flatMap((drawn) => [...drawn.querySelectorAll("a[href]")])) {
412
+ const url = pageUrlOf(link.getAttribute("href") ?? "", baseURI);
413
+ if (url) link.setAttribute("href", url.href);
414
+ }
415
+ const nonce = Math.random().toString(36).slice(2, 10);
416
+ const rules = styles.write(srgb, nonce);
417
+ const left = Math.floor(edges.left - PADDING);
418
+ const top = Math.floor(edges.top - PADDING);
419
+ const width = Math.max(1, Math.ceil(edges.right + PADDING) - left);
420
+ const height = Math.max(1, Math.ceil(edges.bottom + PADDING) - top);
421
+ const png = format === "png" ? pngSizeOf(width, height) : null;
422
+ const css = [];
423
+ let fontMissing = false;
424
+ await inSixes([...images.map(({ id, image, size }) => async () => {
425
+ const name = sourceOf(image);
426
+ const href = image.getAttribute(name) ?? "";
427
+ try {
428
+ const blob = await fetched(new URL(href, baseURI).href);
429
+ image.setAttribute(name, await decodedDataUrl(document, blob, size, png?.scale ?? null));
430
+ } catch {
431
+ const link = pageUrlOf(href, baseURI);
432
+ warnings.push({
433
+ code: "image-unreadable",
434
+ shapeId: id
435
+ });
436
+ if (!png && link && /^https?:$/u.test(link.protocol)) image.setAttribute(name, link.href);
437
+ else image.replaceWith(grayOf(document, image));
438
+ }
439
+ }), ...styles.faces.map(({ base, css: face }, at) => async () => {
440
+ const inlined = await inlinedFace(face, base);
441
+ if (inlined.missing) fontMissing = true;
442
+ css[at] = inlined.css;
443
+ })]);
444
+ if (fontMissing) warnings.push({ code: "font-missing" });
445
+ const svg = document.createElementNS(SVG_NS, "svg");
446
+ const sheet = document.createElementNS(SVG_NS, "style");
447
+ sheet.textContent = pictureSheetOf(nonce, css, rules);
448
+ svg.setAttribute(PICTURE_ROOT, nonce);
449
+ svg.setAttribute("height", String(height));
450
+ svg.setAttribute("viewBox", `${left} ${top} ${width} ${height}`);
451
+ svg.setAttribute("width", String(width));
452
+ svg.append(sheet, rectAt(document, {
453
+ height,
454
+ width,
455
+ x: left,
456
+ y: top
457
+ }, background), ...drawings.map((drawing) => groupOf(document, drawing, labels, styles.offsets)));
458
+ const text = new XMLSerializer().serializeToString(svg);
459
+ if (png && png.scale < PNG_SCALE) warnings.push({ code: "downscaled" });
460
+ const blob = png ? await pngOf(document, text, png) : new Blob([text], { type: "image/svg+xml" });
461
+ if (host.isConnected) return {
462
+ blob,
463
+ height: png?.height ?? height,
464
+ warnings,
465
+ width: png?.width ?? width
466
+ };
467
+ throw new Error(OFF_PAGE);
468
+ };
469
+ //#endregion
470
+ export { drawBoardPicture };
@@ -1,7 +1,8 @@
1
1
  import { BaseBoardArrowPlugin } from "../../../features/board/lib/BaseBoardArrowPlugin.js";
2
+ import { simulatedPressure, strokeOutline } from "../../../internal/penStroke.internal.js";
2
3
  import { BOARD_PEN } from "../../../features/board/lib/boardStroke.internal.js";
3
4
  import { BaseBoardStrokePlugin } from "../../../features/board/lib/BaseBoardStrokePlugin.js";
4
- import { simulatedPressure, strokeOutline } from "../../internal/penStroke.internal.js";
5
+ import { boardTypesOf } from "../../../features/board/lib/boardTypes.internal.js";
5
6
  import { CORNERS_CLOCKWISE, draggedBox, resized, sameBox, spanOf } from "./boardIndex.internal.js";
6
7
  import { BOARD_PLACE_SIZE, arrowEndOn } from "./boardPick.internal.js";
7
8
  import { drawGuides, elementOf, placeElement, previewArrowLine, previewCopy, previewGuides, previewPlaceOutline, previewSelectBox, previewStroke } from "./boardPreview.internal.js";
@@ -241,7 +242,7 @@ const attachBoardGestures = (host, core, spaceHeld) => {
241
242
  return;
242
243
  }
243
244
  if (done.kind === "pen") core.write((tx) => tx.plugin(BaseBoardStrokePlugin).insert({
244
- ...core.styleFor(BaseBoardStrokePlugin.name, done.style),
245
+ ...core.styleFor(boardTypesOf(core.editor).stroke(), done.style),
245
246
  points: done.points
246
247
  }, { board: core.board }));
247
248
  else if (done.kind === "arrow") {
@@ -331,6 +332,7 @@ const attachBoardGestures = (host, core, spaceHeld) => {
331
332
  gesture = pan(pointer, pointerId);
332
333
  } else if (selecting && shapeElement && shape && handle) {
333
334
  if (!core.writable()) return;
335
+ core.focusBoard();
334
336
  gesture = {
335
337
  corner: handle,
336
338
  element: shapeElement,
@@ -357,7 +359,8 @@ const attachBoardGestures = (host, core, spaceHeld) => {
357
359
  if (event.shiftKey) {
358
360
  moving = held ? [] : [...selected, shape];
359
361
  core.toggleSelected(shape.key);
360
- } else if (!held) core.select([shape.key]);
362
+ } else if (held) core.focusBoard();
363
+ else core.select([shape.key]);
361
364
  const ids = new Set(moving.map(({ id }) => id));
362
365
  const carried = new Set(ids);
363
366
  for (const id of ids) for (const member of index.membersOf(id) ?? []) carried.add(member);
@@ -1,10 +1,8 @@
1
1
  import { ElementApi } from "../../../core.js";
2
- import "../../../features/board/lib/boardShape.internal.js";
3
2
  import { ARROW_SIDES, boardArrowTargetOf, boardOutlineOf, isBoundArrowEnd, resolveBoardArrow } from "../../../features/board/lib/boardArrow.internal.js";
4
- import { BOARD_PEN, BOARD_STROKE_REACH, BOARD_STROKE_TYPE, boardInkIn } from "../../../features/board/lib/boardStroke.internal.js";
3
+ import { BOARD_STROKE_REACH, boardInkIn, boardStrokePath, boardStrokePointsOf } from "../../../features/board/lib/boardStroke.internal.js";
5
4
  import { paintKeyOf, paintOrder } from "../../../features/board/lib/boardCopy.internal.js";
6
5
  import { flooredSizeKeepingRatio } from "../../../features/board/lib/boardRatio.internal.js";
7
- import { strokeOutline } from "../../internal/penStroke.internal.js";
8
6
  import { lineSide, onInk, segmentGap } from "./boardInk.internal.js";
9
7
  import RBush from "rbush";
10
8
  //#region src/react/features/board/boardIndex.internal.ts
@@ -88,8 +86,6 @@ const resized = (start, corner, dx, dy, { center, keepRatio }) => {
88
86
  y: top ? start.y + (start.height - height) : start.y
89
87
  };
90
88
  };
91
- const isStroke = (entry) => entry.node.type === BOARD_STROKE_TYPE;
92
- const inkOf = (entry) => isStroke(entry) && Array.isArray(entry.node.points) ? entry.node.points : void 0;
93
89
  const sameInk = (a, b) => a === b || a.length === b.length && a.every((value, at) => value === b[at]);
94
90
  const drawnInk = /* @__PURE__ */ new WeakMap();
95
91
  const inkOnBoard = (layout, ink) => {
@@ -107,7 +103,7 @@ const inOutline = (outline, at) => {
107
103
  return !sides.has(1) || !sides.has(-1);
108
104
  };
109
105
  const outlineAlong = (outline, from, to, slop, solid) => outline.some((start, at) => segmentGap(from, to, start, outline[(at + 1) % outline.length]) <= slop) || (inOutline(outline, from) || inOutline(outline, to)) && solid();
110
- const hollow = (node, isEmpty) => node?.type === "boardGeo" && (node.fill ?? "none") === "none" && node.children.every((block) => ElementApi.isElement(block) && isEmpty(block));
106
+ const hollow = (node, geoType, isEmpty) => node !== void 0 && node.type === geoType && (node.fill ?? "none") === "none" && node.children.every((block) => ElementApi.isElement(block) && isEmpty(block));
111
107
  const reaches = (layout, at, zoom) => {
112
108
  switch (layout.kind) {
113
109
  case "arrow": return false;
@@ -121,7 +117,7 @@ const reaches = (layout, at, zoom) => {
121
117
  * and hit tests read, frame membership, and where each arrow draws, with the
122
118
  * preview a gesture shows in place of the stored drawing.
123
119
  */
124
- const createBoardIndex = ({ children: childrenOf, takesText: takesTextIn, isEmpty, keepsRatio: keepsRatioIn, members: membersRead, nodeOf, previewCleared }) => {
120
+ const createBoardIndex = ({ children: childrenOf, takesText: takesTextIn, isEmpty, keepsRatio: keepsRatioIn, members: membersRead, nodeOf, previewCleared, types }) => {
125
121
  const tree = new RBush();
126
122
  let children = null;
127
123
  let entries = [];
@@ -137,6 +133,8 @@ const createBoardIndex = ({ children: childrenOf, takesText: takesTextIn, isEmpt
137
133
  const arrowListeners = /* @__PURE__ */ new Map();
138
134
  const strokePaths = /* @__PURE__ */ new WeakMap();
139
135
  let version = 0;
136
+ const isStroke = (entry) => entry.node.type === types.stroke();
137
+ const inkOf = (entry) => boardStrokePointsOf(entry, types.stroke());
140
138
  const sameMember = (entry, previous) => {
141
139
  if (entry.key !== previous.key || entry.id !== previous.id || entry.zIndex !== previous.zIndex) return false;
142
140
  if (entry.kind === "arrow") return previous.kind === "arrow" && sameEnd(entry.start, previous.start) && sameEnd(entry.end, previous.end);
@@ -251,7 +249,7 @@ const createBoardIndex = ({ children: childrenOf, takesText: takesTextIn, isEmpt
251
249
  default: {
252
250
  if (layout.ink) return onInk(inkOnBoard(layout, layout.ink), from, to, zoom);
253
251
  const target = targets.get(layout.id);
254
- return !!target && outlineAlong(boardOutlineOf(target, zoom), from, to, slop, () => !hollow(nodeOf(layout.key), isEmpty));
252
+ return !!target && outlineAlong(boardOutlineOf(target, zoom), from, to, slop, () => !hollow(nodeOf(layout.key), types.geo(), isEmpty));
255
253
  }
256
254
  }
257
255
  };
@@ -407,16 +405,7 @@ const createBoardIndex = ({ children: childrenOf, takesText: takesTextIn, isEmpt
407
405
  const { height, width } = layout.box;
408
406
  const drawn = strokePaths.get(ink);
409
407
  if (drawn && drawn.height === height && drawn.width === width) return drawn;
410
- const next = {
411
- height,
412
- path: strokeOutline(boardInkIn(ink, {
413
- height,
414
- width,
415
- x: 0,
416
- y: 0
417
- }), BOARD_PEN, true),
418
- width
419
- };
408
+ const next = boardStrokePath(ink, layout.box);
420
409
  strokePaths.set(ink, next);
421
410
  return next;
422
411
  },