platejs 54.0.0-beta.2 → 54.0.0-beta.3

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 (237) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.md +56 -0
  3. package/dist/{AIChatRequestContext-BMVWhfPV.d.ts → AIChatRequestContext-DY104TqL.d.ts} +2 -2
  4. package/dist/{BaseSuggestionPlugin-DBl3fqnm.d.ts → BaseSuggestionPlugin-Deo6n6Fs.d.ts} +7 -3
  5. package/dist/{PlateStatic-DhNv2ejp.d.ts → PlateStatic-CJX5bKuv.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-DAOYWuvC.d.ts} +2 -2
  14. package/dist/{comparison-types-CYnJ35qU.d.ts → comparison-types-Dt-unJZY-DCddmbSD.d.ts} +10 -2
  15. package/dist/compiler/index.d.ts +2 -2
  16. package/dist/{core-BJG8l_mk.d.ts → core-ClHasORr.d.ts} +433 -95
  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 +4 -2
  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/dom.md +14 -4
  24. package/dist/docs/api/editor-transforms.md +2 -1
  25. package/dist/docs/api/react-hooks.md +25 -11
  26. package/dist/docs/authored-changes.md +5 -2
  27. package/dist/docs/basic-blocks.md +42 -29
  28. package/dist/docs/blockquote.md +5 -3
  29. package/dist/docs/board.md +63 -8
  30. package/dist/docs/code-block.md +47 -0
  31. package/dist/docs/discussion.md +1 -1
  32. package/dist/docs/docx.md +1 -1
  33. package/dist/docs/dom-coverage.md +5 -0
  34. package/dist/docs/examples/editable-voids.md +2 -3
  35. package/dist/docs/external-text.md +2 -0
  36. package/dist/docs/field.md +370 -0
  37. package/dist/docs/find.md +9 -6
  38. package/dist/docs/form.md +2 -0
  39. package/dist/docs/heading.md +6 -0
  40. package/dist/docs/installation/manual.md +0 -4
  41. package/dist/docs/link.md +3 -3
  42. package/dist/docs/llms.txt +4 -2
  43. package/dist/docs/markdown.md +176 -8
  44. package/dist/docs/plugin-components.md +13 -10
  45. package/dist/docs/plugin-input-rules.md +4 -12
  46. package/dist/docs/prompt-editor.md +205 -0
  47. package/dist/docs/roots.md +8 -6
  48. package/dist/docs/rtl.md +6 -4
  49. package/dist/docs/selection.md +7 -4
  50. package/dist/docs/suggestion.md +1 -1
  51. package/dist/docs/toolbar.md +26 -30
  52. package/dist/docs/upload.md +106 -17
  53. package/dist/docx/export/index.d.ts +3 -3
  54. package/dist/docx/export/lib/docxStaticComponents.js +12 -2
  55. package/dist/docx/export/lib/exportDocx.js +29 -5
  56. package/dist/docx/export/lib/reviewPart.js +1 -1
  57. package/dist/docx/export/lib/reviewProjection.js +10 -8
  58. package/dist/docx/import/index.d.ts +4 -4
  59. package/dist/docx/paste/index.d.ts +4 -4
  60. package/dist/dom/index.d.ts +1 -6
  61. package/dist/dom/plite-dom.internal.js +2 -2
  62. package/dist/excalidraw/index.d.ts +3 -2
  63. package/dist/excalidraw/react/index.d.ts +3 -2
  64. package/dist/facade.js +2 -2
  65. package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +13 -5
  66. package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +32 -10
  67. package/dist/features/board/index.d.ts +2 -2
  68. package/dist/features/board/lib/BaseBoardPlugin.js +14 -1
  69. package/dist/features/board/lib/boardStroke.internal.js +13 -1
  70. package/dist/features/board/lib/boardTypes.internal.js +16 -0
  71. package/dist/features/callout/index.d.ts +3 -2
  72. package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +14 -5
  73. package/dist/features/combobox/index.d.ts +2 -2
  74. package/dist/features/comments/index.d.ts +1 -1
  75. package/dist/features/date/index.d.ts +3 -2
  76. package/dist/features/details/index.d.ts +3 -2
  77. package/dist/features/details/lib/BaseDetailsPlugin.js +10 -10
  78. package/dist/features/field/index.d.ts +2 -0
  79. package/dist/features/field/index.js +2 -0
  80. package/dist/features/field/lib/BaseFieldPlugin.js +414 -0
  81. package/dist/features/field/lib/fieldRules.internal.js +42 -0
  82. package/dist/features/find/index.d.ts +3 -2
  83. package/dist/features/footnote/index.d.ts +1 -1
  84. package/dist/features/ink/index.d.ts +1 -1
  85. package/dist/features/ink/lib/BaseInkPlugin.js +126 -103
  86. package/dist/features/ink/lib/inkCodec.internal.js +130 -0
  87. package/dist/features/ink/lib/inkGone.internal.js +229 -48
  88. package/dist/features/ink/lib/inkPlaces.internal.js +533 -62
  89. package/dist/features/layout/index.d.ts +1 -1
  90. package/dist/features/link/lib/BaseLinkPlugin.js +6 -4
  91. package/dist/features/lint/index.d.ts +3 -2
  92. package/dist/features/media/index.d.ts +1 -1
  93. package/dist/features/media/lib/media/parseMediaUrl.js +11 -1
  94. package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +6 -2
  95. package/dist/features/mention/index.d.ts +5 -4
  96. package/dist/features/suggestion/index.d.ts +1 -1
  97. package/dist/features/table/index.d.ts +1 -1
  98. package/dist/features/table/lib/BaseTablePlugin.js +14 -8
  99. package/dist/features/table/lib/internal/selection.js +4 -2
  100. package/dist/features/toc/index.d.ts +1 -1
  101. package/dist/features/upload/index.d.ts +2 -2
  102. package/dist/features/upload/lib/BaseUploadPlugin.js +464 -250
  103. package/dist/history/index.d.ts +2 -2
  104. package/dist/html/index.d.ts +3 -3
  105. package/dist/html/server/index.d.ts +1 -1
  106. package/dist/{htmlTypes-DjeFG3P8.d.ts → htmlTypes-cg_cWsaN.d.ts} +2 -31
  107. package/dist/hyperscript/index.d.ts +1 -1
  108. package/dist/{index-D1CFXA-i.d.ts → index-8WO2vI0U.d.ts} +475 -143
  109. package/dist/{index-DaM37gF6.d.ts → index-B5mYEawV.d.ts} +37 -21
  110. package/dist/{index-Bq3sdm3S.d.ts → index-BZWFoUXt.d.ts} +5 -4
  111. package/dist/{index-DdIRduDG.d.ts → index-C0POz7rg.d.ts} +3 -2
  112. package/dist/{index-Bxfvicyy.d.ts → index-C1_JIhL4.d.ts} +4 -3
  113. package/dist/{index-DC_MNGyu.d.ts → index-C35V_hj0.d.ts} +3 -3
  114. package/dist/{index-kLKMc-pI.d.ts → index-C6ql9pKw.d.ts} +2 -2
  115. package/dist/{index-hsC_sOn2.d.ts → index-C9DiGDVj.d.ts} +35 -5
  116. package/dist/{index-DTgaSxKr.d.ts → index-CLsEe3LY.d.ts} +40 -4
  117. package/dist/{index-CT7miqQN.d.ts → index-CdOLsPaW.d.ts} +29 -9
  118. package/dist/{index-DLA2DUR2.d.ts → index-CktYvOgk.d.ts} +4 -3
  119. package/dist/{index-BBKGrsG3.d.ts → index-Cmuluh6f.d.ts} +1 -1
  120. package/dist/{index-BiQerPJS.d.ts → index-CzLwBZpY.d.ts} +2 -2
  121. package/dist/{index-DzD6BIFJ.d.ts → index-D3-2iM1b.d.ts} +7 -5
  122. package/dist/{index-Cl77E9yr.d.ts → index-DKOFvteF.d.ts} +2 -2
  123. package/dist/{index-iaZOhA76.d.ts → index-DPWyk3lG-DOYwohXO.d.ts} +1 -1
  124. package/dist/index-DQnjqtQa.d.ts +678 -0
  125. package/dist/{index-CcZbqPqk.d.ts → index-Do9pj1GK.d.ts} +73 -39
  126. package/dist/{index-BU6k1Aev.d.ts → index-DpltOCot-A2b3p3Eb.d.ts} +4735 -4586
  127. package/dist/{index-Bc2Yg_2j.d.ts → index-HPYawTae-BCUQLEWF.d.ts} +2 -2
  128. package/dist/{index-BkR7-GLI.d.ts → index-baQOK89E.d.ts} +2 -2
  129. package/dist/{index-D5W-p9bS.d.ts → index-oIJAZxc2.d.ts} +49 -4
  130. package/dist/{index-xdmCBvlT.d.ts → index-r7yb77Wy.d.ts} +3 -2
  131. package/dist/index.d.ts +4 -4
  132. package/dist/{react/internal → internal}/penStroke.internal.js +1 -1
  133. package/dist/internal/plugin/OverridePlugin.js +101 -119
  134. package/dist/internal/plugin/collectPlateNodeMappings.js +5 -1
  135. package/dist/internal/plugin/pastedUploadFiles.js +4 -0
  136. package/dist/internal/plugin/resolvePlugin.js +1 -1
  137. package/dist/internal/plugin/resolvePlugins.js +3 -0
  138. package/dist/internal/plugin/uploadDrafts.js +6 -0
  139. package/dist/internal/utils/mergePlugins.js +1 -0
  140. package/dist/lib/plugins/element-id/ElementIdPlugin.js +8 -2
  141. package/dist/lib/plugins/html/HtmlPlugin.js +9 -0
  142. package/dist/lib/plugins/html/htmlSafety.js +1 -1
  143. package/dist/lib/plugins/input-rules/InputRulesPlugin.js +5 -15
  144. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +16 -0
  145. package/dist/markdown/index.d.ts +2 -2
  146. package/dist/markdown/index.js +2 -1
  147. package/dist/markdown/lib/MarkdownPlugin.js +16 -9
  148. package/dist/markdown/lib/RawHtmlPlugin.js +24 -0
  149. package/dist/markdown/lib/deserializer/mdastToSlate.js +12 -2
  150. package/dist/markdown/lib/internal/markdownConversion.js +773 -74
  151. package/dist/markdown/lib/internal/markdownDiagnostics.js +18 -7
  152. package/dist/markdown/lib/internal/markdownFrontmatter.js +102 -0
  153. package/dist/markdown/lib/internal/markdownIntrinsics.js +125 -43
  154. package/dist/markdown/lib/internal/markdownLine.js +5 -3
  155. package/dist/markdown/lib/internal/markdownMappings.js +19 -7
  156. package/dist/markdown/lib/internal/markdownOpenTail.js +381 -0
  157. package/dist/markdown/lib/internal/markdownRawHtml.js +314 -0
  158. package/dist/markdown/lib/internal/markdownSegments.js +57 -48
  159. package/dist/markdown/lib/internal/markdownTags.js +22 -8
  160. package/dist/markdown/lib/serializer/convertNodesSerialize.js +10 -8
  161. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +226 -0
  162. package/dist/markdown/lib/serializer/listToMdastTree.js +2 -0
  163. package/dist/math/index.d.ts +3 -2
  164. package/dist/math/react/index.d.ts +4 -3
  165. package/dist/migrations/index.d.ts +3 -3
  166. package/dist/pagination/index.d.ts +1 -1
  167. package/dist/pagination/react/index.d.ts +4 -4
  168. package/dist/react/components/EditorContentView.internal.js +17 -8
  169. package/dist/react/components/EditorProvider.js +5 -5
  170. package/dist/react/components/Plate.js +103 -122
  171. package/dist/react/components/PlateContainer.js +40 -32
  172. package/dist/react/components/PlateController.js +28 -16
  173. package/dist/react/components/PlateRoot.internal.js +3 -2
  174. package/dist/react/core.js +4 -4
  175. package/dist/react/features/board/BoardSurface.js +116 -87
  176. package/dist/react/features/board/boardClipboard.internal.js +15 -5
  177. package/dist/react/features/board/boardGesture.internal.js +6 -3
  178. package/dist/react/features/board/boardIndex.internal.js +7 -18
  179. package/dist/react/features/board/boardPictures.internal.js +19 -13
  180. package/dist/react/features/board/boardView.internal.js +184 -49
  181. package/dist/react/features/board/boardVoice.internal.js +10 -11
  182. package/dist/react/features/board/index.d.ts +64 -18
  183. package/dist/react/features/callout/index.d.ts +3 -2
  184. package/dist/react/features/combobox/index.d.ts +8 -8
  185. package/dist/react/features/comments/index.d.ts +6 -5
  186. package/dist/react/features/date/index.d.ts +4 -3
  187. package/dist/react/features/details/index.d.ts +4 -3
  188. package/dist/react/features/field/FieldPlugin.js +34 -0
  189. package/dist/react/features/field/index.d.ts +312 -0
  190. package/dist/react/features/field/index.js +2 -0
  191. package/dist/react/features/footnote/index.d.ts +7 -6
  192. package/dist/react/features/format-painter/index.d.ts +4 -3
  193. package/dist/react/features/ink/InkContent.js +313 -0
  194. package/dist/react/features/ink/index.d.ts +57 -29
  195. package/dist/react/features/ink/index.js +2 -2
  196. package/dist/react/features/ink/inkCapture.internal.js +39 -17
  197. package/dist/react/features/ink/inkInput.internal.js +1 -1
  198. package/dist/react/features/ink/inkLayout.internal.js +6 -3
  199. package/dist/react/features/ink/inkPaint.internal.js +78 -2
  200. package/dist/react/features/ink/inkPlacement.internal.js +331 -104
  201. package/dist/react/features/ink/inkWatch.internal.js +7 -5
  202. package/dist/react/features/layout/index.d.ts +5 -4
  203. package/dist/react/features/media/index.d.ts +5 -4
  204. package/dist/react/features/mention/index.d.ts +6 -5
  205. package/dist/react/features/resizable/Resizable.js +4 -6
  206. package/dist/react/features/resizable/index.d.ts +5 -5
  207. package/dist/react/features/suggestion/index.d.ts +6 -5
  208. package/dist/react/features/table/TablePlugin.js +4 -11
  209. package/dist/react/features/table/index.d.ts +8 -7
  210. package/dist/react/features/toc/index.d.ts +2 -2
  211. package/dist/react/features/upload/index.d.ts +11 -6
  212. package/dist/react/index.d.ts +6 -6
  213. package/dist/react/index.js +4 -4
  214. package/dist/react/internal/plate-context.js +425 -188
  215. package/dist/react/plite-react.js +2 -2
  216. package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +12 -10
  217. package/dist/react/stores/plate/useEditor.js +32 -14
  218. package/dist/react/stores/plate/useEditorHistory.js +55 -0
  219. package/dist/react/stores/plate/useEditorSelector.js +66 -21
  220. package/dist/react/utils/pipeRenderElement.internal.js +1 -1
  221. package/dist/react/utils/pluginRenderElement.internal.js +1 -1
  222. package/dist/react/virtualized.d.ts +4 -4
  223. package/dist/{source-CNKy99Th.d.ts → source-aUwpNnAw.d.ts} +4 -4
  224. package/dist/static/index.d.ts +18 -18
  225. package/dist/static/internal/renderStaticHtmlWithOverrides.js +2 -2
  226. package/dist/static/internal/staticPresentation.js +4 -4
  227. package/dist/static/internal/writeStaticSelectionClipboardData.js +7 -2
  228. package/dist/tabbable/index.d.ts +1 -1
  229. package/dist/tabbable/react/index.d.ts +3 -3
  230. package/dist/testing/index.d.ts +3 -3
  231. package/dist/yjs/index.d.ts +1 -1
  232. package/dist/yjs/react/index.d.ts +6 -6
  233. package/package.json +20 -2
  234. package/dist/markdown/lib/serializer/convertTextsSerialize.js +0 -163
  235. package/dist/react/components/EditorSelectionView.js +0 -40
  236. package/dist/react/features/ink/InkLayer.js +0 -218
  237. package/dist/react/internal/createPlateTargetScope.js +0 -62
@@ -6,6 +6,10 @@ import { PLUGINS } from "../../../utils/plate-keys.js";
6
6
  import { property, schema, txLocate } from "../../../core.js";
7
7
  //#region src/features/basic-nodes/lib/BaseHeadingPlugins.ts
8
8
  const isHeadingLevel = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 6;
9
+ const levelProps = (level, type, detailsTitleType) => (node) => node.type === detailsTitleType ? { level } : {
10
+ level,
11
+ type
12
+ };
9
13
  const rules = {
10
14
  break: { splitReset: true },
11
15
  delete: {
@@ -60,21 +64,39 @@ const BaseHeadingPlugin = definePlugin(PLUGINS.heading, {
60
64
  }
61
65
  }),
62
66
  rules,
63
- read: ({ editor, schema: { type } }) => ({ level: (node) => {
64
- const summary = getCompiledPlatePlugin(editor, PLUGINS.detailsSummary);
65
- const summaryType = summary ? editor.plugin(summary).schema.type : void 0;
66
- return (node.type === type || summaryType !== void 0 && node.type === summaryType) && isHeadingLevel(node.level) ? node.level : void 0;
67
- } })
67
+ read: ({ editor, schema: { type }, state }) => {
68
+ const detailsTitleType = () => {
69
+ const summary = getCompiledPlatePlugin(editor, PLUGINS.detailsSummary);
70
+ return summary ? editor.plugin(summary).schema.type : void 0;
71
+ };
72
+ return {
73
+ level: (node) => (node.type === type || node.type === detailsTitleType()) && isHeadingLevel(node.level) ? node.level : void 0,
74
+ /**
75
+ * Whether `setLevel(level)` can apply: the schema lets every selected
76
+ * block take the level where it sits.
77
+ */
78
+ canSetLevel: (level) => {
79
+ const blocks = state.nodes.blocks();
80
+ const props = levelProps(level, type, detailsTitleType());
81
+ const root = state.view.root();
82
+ return blocks.length > 0 && blocks.every(([node, path]) => state.schema.canPlace([{
83
+ ...node,
84
+ ...props(node)
85
+ }], {
86
+ at: path,
87
+ replace: true,
88
+ root
89
+ }));
90
+ }
91
+ };
92
+ }
68
93
  }).extend(({ read }) => ({ update: ({ editor, tx, schema: { type } }) => {
69
94
  const summary = getCompiledPlatePlugin(editor, PLUGINS.detailsSummary);
70
- const summaryType = summary ? editor.plugin(summary).schema.type : void 0;
95
+ const detailsTitleType = summary ? editor.plugin(summary).schema.type : void 0;
71
96
  const setLevel = txLocate(false, (level) => {
72
97
  const blocks = tx.nodes.blocks();
73
98
  if (blocks.length === 0) return false;
74
- return blocks.every(([node]) => read.level(node) === level) || tx.blocks.set((node) => summaryType !== void 0 && node.type === summaryType ? { level } : {
75
- level,
76
- type
77
- });
99
+ return blocks.every(([node]) => read.level(node) === level) || tx.blocks.set(levelProps(level, type, detailsTitleType));
78
100
  });
79
101
  return {
80
102
  setLevel,
@@ -1,2 +1,2 @@
1
- import { A as BoardFramePlace, C as BoardArrowEnds, D as BoardFrameEntry, E as BoardArrowEntry, F as BoardRestackDirection, L as BoardSize, O as BoardMemberEntry, P as BoardPlace, R as defineBoardShape, S as BoardArrowEnd, _ as BoardFrameElement, a as BoardElement, b as BoardArrowEndInput, d as BaseBoardImagePlugin, f as BoardImageElement, g as BaseBoardFramePlugin, h as BoardGeoElement, i as BoardDefinition, j as BoardShapePlace, k as BoardShapeEntry, l as BaseBoardNotePlugin, m as BoardGeo, n as BoardStrokeElement, p as BaseBoardGeoPlugin, r as BaseBoardPlugin, t as BaseBoardStrokePlugin, u as BoardNoteElement, v as BaseBoardArrowPlugin, w as BoardArrowSide, x as BoardArrowAnchor, y as BoardArrowElement } from "../../index-D5W-p9bS.js";
2
- export { BaseBoardArrowPlugin, BaseBoardFramePlugin, BaseBoardGeoPlugin, BaseBoardImagePlugin, BaseBoardNotePlugin, BaseBoardPlugin, BaseBoardStrokePlugin, type BoardArrowAnchor, BoardArrowElement, type BoardArrowEnd, BoardArrowEndInput, type BoardArrowEnds, type BoardArrowEntry, type BoardArrowSide, BoardDefinition, BoardElement, BoardFrameElement, type BoardFrameEntry, type BoardFramePlace, BoardGeo, BoardGeoElement, BoardImageElement, type BoardMemberEntry, BoardNoteElement, type BoardPlace, type BoardRestackDirection, type BoardShapeEntry, type BoardShapePlace, type BoardSize, BoardStrokeElement, defineBoardShape };
1
+ import { A as BoardShapeEntry, C as BoardArrowEnd, D as BoardArrowEntry, F as BoardPlace, I as BoardRestackDirection, M as BoardShapePlace, O as BoardFrameEntry, R as BoardSize, S as BoardArrowAnchor, T as BoardArrowSide, _ as BaseBoardFramePlugin, a as BoardElement, b as BoardArrowElement, d as BoardNoteElement, f as BaseBoardImagePlugin, g as BoardGeoElement, h as BoardGeo, i as BoardDefinition, j as BoardFramePlace, k as BoardMemberEntry, m as BaseBoardGeoPlugin, n as BoardStrokeElement, p as BoardImageElement, r as BaseBoardPlugin, s as BoardStrokePath, t as BaseBoardStrokePlugin, u as BaseBoardNotePlugin, v as BoardFrameElement, w as BoardArrowEnds, x as BoardArrowEndInput, y as BaseBoardArrowPlugin, z as defineBoardShape } from "../../index-oIJAZxc2.js";
2
+ export { BaseBoardArrowPlugin, BaseBoardFramePlugin, BaseBoardGeoPlugin, BaseBoardImagePlugin, BaseBoardNotePlugin, BaseBoardPlugin, BaseBoardStrokePlugin, type BoardArrowAnchor, BoardArrowElement, type BoardArrowEnd, BoardArrowEndInput, type BoardArrowEnds, type BoardArrowEntry, type BoardArrowSide, BoardDefinition, BoardElement, BoardFrameElement, type BoardFrameEntry, type BoardFramePlace, BoardGeo, BoardGeoElement, BoardImageElement, type BoardMemberEntry, BoardNoteElement, type BoardPlace, type BoardRestackDirection, type BoardShapeEntry, type BoardShapePlace, type BoardSize, BoardStrokeElement, type BoardStrokePath, defineBoardShape };
@@ -13,10 +13,12 @@ import { BaseBoardFramePlugin } from "./BaseBoardFramePlugin.js";
13
13
  import { BaseBoardGeoPlugin } from "./BaseBoardGeoPlugin.js";
14
14
  import { BaseBoardImagePlugin } from "./BaseBoardImagePlugin.js";
15
15
  import { BaseBoardNotePlugin } from "./BaseBoardNotePlugin.js";
16
+ import { boardStrokePath, boardStrokePointsOf } from "./boardStroke.internal.js";
16
17
  import { BaseBoardStrokePlugin } from "./BaseBoardStrokePlugin.js";
17
18
  import { moveShapesTo, paintKeyOf, paintOrder, placeShapeCopies, shapeIdOf, withCarriedRootSlots, withCutSlotsLoose, withFreshRootShapeIds, withSourcePaintOrder } from "./boardCopy.internal.js";
18
19
  import { BOARD_ARROW_ATTRIBUTES, BOARD_FRAME_ATTRIBUTES, BOARD_SHAPE_ATTRIBUTES, BOARD_STROKE_ATTRIBUTES, decodeBoardArrowAttributes, decodeBoardFrameAttributes, decodeBoardShapeAttributes, decodeBoardStrokeAttributes, encodeBoardArrowAttributes, encodeBoardFrameAttributes, encodeBoardShapeAttributes, encodeBoardStrokeAttributes } from "./boardHtml.internal.js";
19
20
  import { flooredSizeKeepingRatio, keepsBoardRatio } from "./boardRatio.internal.js";
21
+ import { boardTypesOf } from "./boardTypes.internal.js";
20
22
  import { nanoid } from "nanoid";
21
23
  //#region src/features/board/lib/BaseBoardPlugin.ts
22
24
  /**
@@ -166,6 +168,7 @@ const BaseBoardPlugin = definePlugin("board", {
166
168
  }))],
167
169
  read: ({ state }) => {
168
170
  const members = boardMembersOf(state, properties);
171
+ const types = boardTypesOf(editor);
169
172
  return {
170
173
  /**
171
174
  * Where the arrow `id` draws its two ends, or null when `id` names
@@ -192,7 +195,17 @@ const BaseBoardPlugin = definePlugin("board", {
192
195
  }) });
193
196
  },
194
197
  /** The members of the board block `board`, in stored order. */
195
- shapes: (board) => boardShapesOf(state, members, board)
198
+ shapes: (board) => boardShapesOf(state, members, board),
199
+ /**
200
+ * Where the pen line `id` draws its outline within its box, the
201
+ * path the live board draws, or null when `id` names no pen line.
202
+ */
203
+ strokePath: (id) => {
204
+ const entry = members.member(id);
205
+ if (entry?.kind !== "shape") return null;
206
+ const points = boardStrokePointsOf(entry, types.stroke());
207
+ return points ? boardStrokePath(points, entry.size) : null;
208
+ }
196
209
  };
197
210
  }
198
211
  };
@@ -1,3 +1,4 @@
1
+ import { strokeOutline } from "../../../internal/penStroke.internal.js";
1
2
  //#region src/features/board/lib/boardStroke.internal.ts
2
3
  const BOARD_STROKE_TYPE = "boardStroke";
3
4
  /** How much thinner perfect-freehand draws a pen line as its pressure falls. */
@@ -29,5 +30,16 @@ const boardInkIn = (points, box) => {
29
30
  ]);
30
31
  return ink;
31
32
  };
33
+ const boardStrokePointsOf = (entry, strokeType) => entry.node.type === strokeType && Array.isArray(entry.node.points) ? entry.node.points : void 0;
34
+ const boardStrokePath = (points, { height, width }) => ({
35
+ height,
36
+ path: strokeOutline(boardInkIn(points, {
37
+ height,
38
+ width,
39
+ x: 0,
40
+ y: 0
41
+ }), BOARD_PEN, true),
42
+ width
43
+ });
32
44
  //#endregion
33
- export { BOARD_PEN, BOARD_STROKE_REACH, BOARD_STROKE_THINNING, BOARD_STROKE_TYPE, boardInkIn, boardStrokeRadius, isBoardStrokePoints };
45
+ export { BOARD_PEN, BOARD_STROKE_REACH, BOARD_STROKE_THINNING, BOARD_STROKE_TYPE, boardInkIn, boardStrokePath, boardStrokePointsOf, boardStrokeRadius, isBoardStrokePoints };
@@ -0,0 +1,16 @@
1
+ import { BaseBoardGeoPlugin } from "./BaseBoardGeoPlugin.js";
2
+ import { BaseBoardNotePlugin } from "./BaseBoardNotePlugin.js";
3
+ import { BaseBoardStrokePlugin } from "./BaseBoardStrokePlugin.js";
4
+ //#region src/features/board/lib/boardTypes.internal.ts
5
+ const boardTypesOf = (editor) => {
6
+ const geo = editor.plugin(BaseBoardGeoPlugin);
7
+ const note = editor.plugin(BaseBoardNotePlugin);
8
+ const stroke = editor.plugin(BaseBoardStrokePlugin);
9
+ return {
10
+ geo: () => geo.installed ? geo.schema.type : void 0,
11
+ note: () => note.installed ? note.schema.type : void 0,
12
+ stroke: () => stroke.installed ? stroke.schema.type : void 0
13
+ };
14
+ };
15
+ //#endregion
16
+ export { boardTypesOf };
@@ -1,5 +1,6 @@
1
- import { $u as EditorJsonValue, Cl as PropertyValueOptions, Mc as ElementOf, vl as PropertyStringDescriptor } from "../../index-BU6k1Aev.js";
2
- import { _ as BasePlugin } from "../../core-BJG8l_mk.js";
1
+ import { Vt as EditorJsonValue, is as PropertyStringDescriptor, ki as ElementOf, ls as PropertyValueOptions } from "../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../htmlTypes-cg_cWsaN.js";
3
+ import { _ as BasePlugin } from "../../core-ClHasORr.js";
3
4
  declare const BaseCalloutPlugin: BasePlugin<Readonly<{
4
5
  formats: true;
5
6
  rules: true;
@@ -96,7 +96,10 @@ const BaseCodeBlockPlugin = definePlugin(PLUGINS.codeBlock, {
96
96
  max: 1
97
97
  }),
98
98
  ownsExit: true,
99
- properties: { language: property.string() },
99
+ properties: {
100
+ language: property.string(),
101
+ meta: property.string()
102
+ },
100
103
  slice: { preserveContext: true }
101
104
  } },
102
105
  component: "pre",
@@ -114,20 +117,23 @@ const BaseCodeBlockPlugin = definePlugin(PLUGINS.codeBlock, {
114
117
  }
115
118
  const languageClass = element.querySelector(":scope > code")?.className.match(CODE_LANGUAGE_CLASS_RE)?.[1];
116
119
  const language = element.dataset.language || languageClass || void 0;
120
+ const { meta } = element.dataset;
117
121
  const text = restoreTrailingNewlines(readCodeDomText(element), element);
118
- preserve("data-code-trailing-newlines", "data-language");
122
+ preserve("data-code-trailing-newlines", "data-language", "data-meta");
119
123
  return {
120
124
  children: [{ text }],
121
- ...language ? { language } : {}
125
+ ...language ? { language } : {},
126
+ ...meta ? { meta } : {}
122
127
  };
123
128
  },
124
129
  encode: ({ content, node, preserve }) => {
125
130
  const trailingNewlines = countTrailingNewlines(NodeApi.string(node));
126
- preserve("language");
131
+ preserve("language", "meta");
127
132
  return {
128
133
  attributes: {
129
134
  ...trailingNewlines > 0 ? { "data-code-trailing-newlines": trailingNewlines } : {},
130
- "data-language": node.language
135
+ "data-language": node.language,
136
+ "data-meta": node.meta
131
137
  },
132
138
  children: [{
133
139
  children: content,
@@ -146,13 +152,16 @@ const BaseCodeBlockPlugin = definePlugin(PLUGINS.codeBlock, {
146
152
  node: "code",
147
153
  decode: ({ node }) => ({
148
154
  ...node.lang ? { language: node.lang } : {},
155
+ ...node.meta ? { meta: node.meta } : {},
149
156
  children: [{ text: node.value || "" }],
150
157
  type
151
158
  }),
152
159
  encode: ({ node, preserve }) => {
153
160
  preserve("language");
161
+ if (node.language) preserve("meta");
154
162
  return {
155
163
  lang: node.language,
164
+ meta: node.meta,
156
165
  type: "code",
157
166
  value: NodeApi.string(node)
158
167
  };
@@ -1,3 +1,3 @@
1
- import { n as ComboboxState, t as ComboboxEditor } from "../../combobox-DkBGgyd3.js";
2
- import { n as filterWords, t as FilterWordsOptions } from "../../index-BBKGrsG3.js";
1
+ import { n as ComboboxState, t as ComboboxEditor } from "../../combobox-DAOYWuvC.js";
2
+ import { n as filterWords, t as FilterWordsOptions } from "../../index-Cmuluh6f.js";
3
3
  export { ComboboxEditor, ComboboxState, FilterWordsOptions, filterWords };
@@ -1,2 +1,2 @@
1
- import { S as SavedComments, _ as CommentsLoadIssue, a as CommentDataValue, b as CreateCommentThreadInput, c as CommentMutationRequest, d as CommentRanges, f as CommentResolution, g as CommentsChange, h as CommentUser, i as CommentDataList, l as CommentMutationResult, m as CommentThread, n as CommentAttachment, o as CommentMessage, p as CommentTarget, r as CommentData, s as CommentMutationDecision, t as BaseCommentsPlugin, u as CommentOperation, v as CommentsPluginState, x as PendingComment, y as CommentsSnapshot } from "../../index-Bxfvicyy.js";
1
+ import { S as SavedComments, _ as CommentsLoadIssue, a as CommentDataValue, b as CreateCommentThreadInput, c as CommentMutationRequest, d as CommentRanges, f as CommentResolution, g as CommentsChange, h as CommentUser, i as CommentDataList, l as CommentMutationResult, m as CommentThread, n as CommentAttachment, o as CommentMessage, p as CommentTarget, r as CommentData, s as CommentMutationDecision, t as BaseCommentsPlugin, u as CommentOperation, v as CommentsPluginState, x as PendingComment, y as CommentsSnapshot } from "../../index-C1_JIhL4.js";
2
2
  export { BaseCommentsPlugin, CommentAttachment, CommentData, CommentDataList, CommentDataValue, CommentMessage, CommentMutationDecision, CommentMutationRequest, CommentMutationResult, CommentOperation, CommentRanges, CommentResolution, CommentTarget, CommentThread, CommentUser, CommentsChange, CommentsLoadIssue, CommentsPluginState, CommentsSnapshot, CreateCommentThreadInput, PendingComment, SavedComments };
@@ -1,5 +1,6 @@
1
- import { Mc as ElementOf, Qo as TxDeclaredMethod, vl as PropertyStringDescriptor } from "../../index-BU6k1Aev.js";
2
- import { _ as BasePlugin, _t as NodeInsertOptions } from "../../core-BJG8l_mk.js";
1
+ import { eu as TxDeclaredMethod, is as PropertyStringDescriptor, ki as ElementOf } from "../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../htmlTypes-cg_cWsaN.js";
3
+ import { _ as BasePlugin, _t as NodeInsertOptions } from "../../core-ClHasORr.js";
3
4
  declare const BaseDatePlugin: BasePlugin<Readonly<{
4
5
  readonly __pluginWritableProperties: Readonly<{
5
6
  descriptor: PropertyStringDescriptor<{
@@ -1,5 +1,6 @@
1
- import { $i as NodeKey, $u as EditorJsonValue, El as SchemaContentDefault, Il as SchemaContentRule, Mc as ElementOf, Mu as Location, Qo as TxDeclaredMethod, fl as PropertyJsonDescriptor, kl as SchemaContentPrefixSlot, ms as NodeSelection } from "../../index-BU6k1Aev.js";
2
- import { Qn as HeadingLevel, _ as BasePlugin, bo as PluginReference, ct as BlockInsertOptions, lt as BlockUpsertOptions, vo as PluginDependency } from "../../core-BJG8l_mk.js";
1
+ import { Ds as SchemaContentPrefixSlot, Ki as Location, Pa as NodeSelection, Ps as SchemaContentRule, Qo as PropertyJsonDescriptor, Vt as EditorJsonValue, eu as TxDeclaredMethod, ki as ElementOf, ws as SchemaContentDefault, xa as NodeKey } from "../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../htmlTypes-cg_cWsaN.js";
3
+ import { Qn as HeadingLevel, _ as BasePlugin, ct as BlockInsertOptions, lt as BlockUpsertOptions, xo as PluginReference, yo as PluginDependency } from "../../core-ClHasORr.js";
3
4
  declare const isSummaryHeadingLevel: (value: unknown) => value is HeadingLevel;
4
5
  type BaseDetailsViewState = {
5
6
  openKeys: Set<NodeKey>;
@@ -346,23 +346,23 @@ const BaseDetailsPlugin = definePlugin(PLUGINS.details, {
346
346
  if (!details) return next();
347
347
  const detailsKey = state.key(details[0]);
348
348
  const paragraphType = editor.plugin(BaseParagraphPlugin).schema.type;
349
- const exitAfterDetails = () => state.transaction((tx) => {
350
- const nextPath = PathApi.next(details[1]);
351
- const point = tx.nodes.get(nextPath) ? tx.points.start(nextPath) : void 0;
352
- if (point) {
353
- tx.selection.set(point);
354
- return;
355
- }
349
+ const afterDetails = PathApi.next(details[1]);
350
+ const insertParagraphAfterDetails = () => state.transaction((tx) => {
356
351
  tx.nodes.insert({
357
352
  children: [{ text: "" }],
358
353
  type: paragraphType
359
354
  }, {
360
- at: nextPath,
355
+ at: afterDetails,
361
356
  select: true
362
357
  });
363
358
  });
364
359
  if (summary) {
365
- if (!viewStoreOf(state).get("openKeys").has(detailsKey)) return exitAfterDetails();
360
+ if (!viewStoreOf(state).get("openKeys").has(detailsKey)) {
361
+ const point = state.nodes.get(afterDetails) ? state.points.start(afterDetails) : void 0;
362
+ return point ? state.transaction((tx) => {
363
+ tx.selection.set(point);
364
+ }) : insertParagraphAfterDetails();
365
+ }
366
366
  if (state.points.isEnd(selection.anchor, summary[1])) {
367
367
  const firstBodyPoint = state.points.start(details[1].concat(1));
368
368
  return state.transaction((tx) => {
@@ -380,7 +380,7 @@ const BaseDetailsPlugin = definePlugin(PLUGINS.details, {
380
380
  }
381
381
  const block = state.nodes.block({ at: selection });
382
382
  const childIndex = block?.[1].at(-1);
383
- if (block && childIndex === details[0].children.length - 1 && childIndex > 0 && NodeApi.string(block[0]) === "" && state.points.isEnd(selection.anchor, block[1])) return exitAfterDetails();
383
+ if (block && childIndex === details[0].children.length - 1 && childIndex > 0 && NodeApi.string(block[0]) === "" && state.points.isEnd(selection.anchor, block[1])) return insertParagraphAfterDetails();
384
384
  return next();
385
385
  }),
386
386
  handle(editorCommands.delete, ({ input, state }) => {
@@ -0,0 +1,2 @@
1
+ import { a as FieldKind, c as FieldProblem, d as FieldTest, f as FieldValue, i as FieldElement, l as FieldRead, n as FIELD_TESTS, o as FieldOption, p as fitsField, r as FieldCondition, s as FieldPatch, t as BaseFieldPlugin, u as FieldSettings } from "../../index-DQnjqtQa.js";
2
+ export { BaseFieldPlugin, FIELD_TESTS, FieldCondition, FieldElement, FieldKind, FieldOption, FieldPatch, FieldProblem, FieldRead, FieldSettings, FieldTest, FieldValue, fitsField };
@@ -0,0 +1,2 @@
1
+ import { BaseFieldPlugin, FIELD_TESTS, fitsField } from "./lib/BaseFieldPlugin.js";
2
+ export { BaseFieldPlugin, FIELD_TESTS, fitsField };