phormat 0.0.5

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 (489) hide show
  1. package/README.md +102 -0
  2. package/dist/assets/example-test.svelte +228 -0
  3. package/dist/debug/JsonDebug.svelte +19 -0
  4. package/dist/debug/JsonDebug.svelte.d.ts +6 -0
  5. package/dist/debug/JsonDebugNode.svelte +138 -0
  6. package/dist/debug/JsonDebugNode.svelte.d.ts +11 -0
  7. package/dist/demo/documentLifecycle.d.ts +57 -0
  8. package/dist/demo/documentLifecycle.js +196 -0
  9. package/dist/demo/index.d.ts +2 -0
  10. package/dist/demo/index.js +2 -0
  11. package/dist/editor/BlockEditor.svelte +112 -0
  12. package/dist/editor/BlockEditor.svelte.d.ts +7 -0
  13. package/dist/editor/BlockRow.svelte +76 -0
  14. package/dist/editor/BlockRow.svelte.d.ts +20 -0
  15. package/dist/editor/Editor.svelte +103 -0
  16. package/dist/editor/Editor.svelte.d.ts +7 -0
  17. package/dist/editor/MarkdownEditor.svelte.d.ts +160 -0
  18. package/dist/editor/MarkdownEditor.svelte.js +1119 -0
  19. package/dist/editor/NestedRowChrome.svelte +160 -0
  20. package/dist/editor/NestedRowChrome.svelte.d.ts +20 -0
  21. package/dist/editor/PhormatEditor.svelte +206 -0
  22. package/dist/editor/PhormatEditor.svelte.d.ts +26 -0
  23. package/dist/editor/RawMarkdownPanel.svelte +39 -0
  24. package/dist/editor/RawMarkdownPanel.svelte.d.ts +6 -0
  25. package/dist/editor/block-specs/BlockSpecMissing.svelte +12 -0
  26. package/dist/editor/block-specs/BlockSpecMissing.svelte.d.ts +7 -0
  27. package/dist/editor/block-specs/blockquote/BlockquoteRenderer.svelte +32 -0
  28. package/dist/editor/block-specs/blockquote/BlockquoteRenderer.svelte.d.ts +21 -0
  29. package/dist/editor/block-specs/blockquote/commands.d.ts +2 -0
  30. package/dist/editor/block-specs/blockquote/commands.js +65 -0
  31. package/dist/editor/block-specs/blockquote/index.d.ts +6 -0
  32. package/dist/editor/block-specs/blockquote/index.js +5 -0
  33. package/dist/editor/block-specs/blockquote/inlineSecondPass.d.ts +6 -0
  34. package/dist/editor/block-specs/blockquote/inlineSecondPass.js +35 -0
  35. package/dist/editor/block-specs/blockquote/parse.d.ts +16 -0
  36. package/dist/editor/block-specs/blockquote/parse.js +188 -0
  37. package/dist/editor/block-specs/blockquote/reconcile.d.ts +2 -0
  38. package/dist/editor/block-specs/blockquote/reconcile.js +9 -0
  39. package/dist/editor/block-specs/blockquote/serialize.d.ts +6 -0
  40. package/dist/editor/block-specs/blockquote/serialize.js +55 -0
  41. package/dist/editor/block-specs/blockquote/types.d.ts +20 -0
  42. package/dist/editor/block-specs/blockquote/types.js +1 -0
  43. package/dist/editor/block-specs/blockquoteSpec.d.ts +4 -0
  44. package/dist/editor/block-specs/blockquoteSpec.js +37 -0
  45. package/dist/editor/block-specs/callout/CalloutRenderer.svelte +38 -0
  46. package/dist/editor/block-specs/callout/CalloutRenderer.svelte.d.ts +21 -0
  47. package/dist/editor/block-specs/callout/CalloutTypeIcon.svelte +14 -0
  48. package/dist/editor/block-specs/callout/CalloutTypeIcon.svelte.d.ts +7 -0
  49. package/dist/editor/block-specs/callout/commands.d.ts +2 -0
  50. package/dist/editor/block-specs/callout/commands.js +65 -0
  51. package/dist/editor/block-specs/callout/icons.d.ts +10 -0
  52. package/dist/editor/block-specs/callout/icons.js +52 -0
  53. package/dist/editor/block-specs/callout/index.d.ts +9 -0
  54. package/dist/editor/block-specs/callout/index.js +7 -0
  55. package/dist/editor/block-specs/callout/inlineSecondPass.d.ts +6 -0
  56. package/dist/editor/block-specs/callout/inlineSecondPass.js +9 -0
  57. package/dist/editor/block-specs/callout/parse.d.ts +9 -0
  58. package/dist/editor/block-specs/callout/parse.js +83 -0
  59. package/dist/editor/block-specs/callout/parseBody.d.ts +6 -0
  60. package/dist/editor/block-specs/callout/parseBody.js +290 -0
  61. package/dist/editor/block-specs/callout/reconcile.d.ts +2 -0
  62. package/dist/editor/block-specs/callout/reconcile.js +8 -0
  63. package/dist/editor/block-specs/callout/serialize.d.ts +5 -0
  64. package/dist/editor/block-specs/callout/serialize.js +65 -0
  65. package/dist/editor/block-specs/callout/types.d.ts +7 -0
  66. package/dist/editor/block-specs/callout/types.js +1 -0
  67. package/dist/editor/block-specs/calloutSpec.d.ts +2 -0
  68. package/dist/editor/block-specs/calloutSpec.js +23 -0
  69. package/dist/editor/block-specs/codeFence/CodeFenceRenderer.svelte +18 -0
  70. package/dist/editor/block-specs/codeFence/CodeFenceRenderer.svelte.d.ts +21 -0
  71. package/dist/editor/block-specs/codeFence/commands.d.ts +2 -0
  72. package/dist/editor/block-specs/codeFence/commands.js +1 -0
  73. package/dist/editor/block-specs/codeFence/index.d.ts +5 -0
  74. package/dist/editor/block-specs/codeFence/index.js +4 -0
  75. package/dist/editor/block-specs/codeFence/inlineSecondPass.d.ts +3 -0
  76. package/dist/editor/block-specs/codeFence/inlineSecondPass.js +5 -0
  77. package/dist/editor/block-specs/codeFence/reconcile.d.ts +2 -0
  78. package/dist/editor/block-specs/codeFence/reconcile.js +5 -0
  79. package/dist/editor/block-specs/codeFence/serialize.d.ts +2 -0
  80. package/dist/editor/block-specs/codeFence/serialize.js +8 -0
  81. package/dist/editor/block-specs/codeFence/types.d.ts +6 -0
  82. package/dist/editor/block-specs/codeFence/types.js +1 -0
  83. package/dist/editor/block-specs/codeFenceSpec.d.ts +2 -0
  84. package/dist/editor/block-specs/codeFenceSpec.js +23 -0
  85. package/dist/editor/block-specs/columns/ColumnsRenderer.svelte +18 -0
  86. package/dist/editor/block-specs/columns/ColumnsRenderer.svelte.d.ts +21 -0
  87. package/dist/editor/block-specs/columns/EditableColumns.svelte +16 -0
  88. package/dist/editor/block-specs/columns/EditableColumns.svelte.d.ts +4 -0
  89. package/dist/editor/block-specs/columns/commands.d.ts +2 -0
  90. package/dist/editor/block-specs/columns/commands.js +1 -0
  91. package/dist/editor/block-specs/columns/index.d.ts +6 -0
  92. package/dist/editor/block-specs/columns/index.js +5 -0
  93. package/dist/editor/block-specs/columns/inlineSecondPass.d.ts +3 -0
  94. package/dist/editor/block-specs/columns/inlineSecondPass.js +5 -0
  95. package/dist/editor/block-specs/columns/parse.d.ts +20 -0
  96. package/dist/editor/block-specs/columns/parse.js +111 -0
  97. package/dist/editor/block-specs/columns/reconcile.d.ts +2 -0
  98. package/dist/editor/block-specs/columns/reconcile.js +6 -0
  99. package/dist/editor/block-specs/columns/serialize.d.ts +2 -0
  100. package/dist/editor/block-specs/columns/serialize.js +16 -0
  101. package/dist/editor/block-specs/columns/types.d.ts +4 -0
  102. package/dist/editor/block-specs/columns/types.js +1 -0
  103. package/dist/editor/block-specs/columnsSpec.d.ts +2 -0
  104. package/dist/editor/block-specs/columnsSpec.js +24 -0
  105. package/dist/editor/block-specs/heading/HeaderRenderer.svelte +30 -0
  106. package/dist/editor/block-specs/heading/HeaderRenderer.svelte.d.ts +21 -0
  107. package/dist/editor/block-specs/heading/commands.d.ts +2 -0
  108. package/dist/editor/block-specs/heading/commands.js +41 -0
  109. package/dist/editor/block-specs/heading/edit.d.ts +10 -0
  110. package/dist/editor/block-specs/heading/edit.js +33 -0
  111. package/dist/editor/block-specs/heading/index.d.ts +7 -0
  112. package/dist/editor/block-specs/heading/index.js +6 -0
  113. package/dist/editor/block-specs/heading/inlineSecondPass.d.ts +4 -0
  114. package/dist/editor/block-specs/heading/inlineSecondPass.js +20 -0
  115. package/dist/editor/block-specs/heading/parse.d.ts +5 -0
  116. package/dist/editor/block-specs/heading/parse.js +18 -0
  117. package/dist/editor/block-specs/heading/reconcile.d.ts +2 -0
  118. package/dist/editor/block-specs/heading/reconcile.js +8 -0
  119. package/dist/editor/block-specs/heading/serialize.d.ts +2 -0
  120. package/dist/editor/block-specs/heading/serialize.js +9 -0
  121. package/dist/editor/block-specs/heading/types.d.ts +5 -0
  122. package/dist/editor/block-specs/heading/types.js +1 -0
  123. package/dist/editor/block-specs/headingSpec.d.ts +2 -0
  124. package/dist/editor/block-specs/headingSpec.js +28 -0
  125. package/dist/editor/block-specs/horizontalRule/HorizontalRuleRenderer.svelte +15 -0
  126. package/dist/editor/block-specs/horizontalRule/HorizontalRuleRenderer.svelte.d.ts +21 -0
  127. package/dist/editor/block-specs/horizontalRule/commands.d.ts +2 -0
  128. package/dist/editor/block-specs/horizontalRule/commands.js +1 -0
  129. package/dist/editor/block-specs/horizontalRule/index.d.ts +6 -0
  130. package/dist/editor/block-specs/horizontalRule/index.js +5 -0
  131. package/dist/editor/block-specs/horizontalRule/inlineSecondPass.d.ts +3 -0
  132. package/dist/editor/block-specs/horizontalRule/inlineSecondPass.js +5 -0
  133. package/dist/editor/block-specs/horizontalRule/parse.d.ts +2 -0
  134. package/dist/editor/block-specs/horizontalRule/parse.js +15 -0
  135. package/dist/editor/block-specs/horizontalRule/reconcile.d.ts +2 -0
  136. package/dist/editor/block-specs/horizontalRule/reconcile.js +5 -0
  137. package/dist/editor/block-specs/horizontalRule/serialize.d.ts +2 -0
  138. package/dist/editor/block-specs/horizontalRule/serialize.js +3 -0
  139. package/dist/editor/block-specs/horizontalRule/types.d.ts +3 -0
  140. package/dist/editor/block-specs/horizontalRule/types.js +1 -0
  141. package/dist/editor/block-specs/horizontalRuleSpec.d.ts +2 -0
  142. package/dist/editor/block-specs/horizontalRuleSpec.js +24 -0
  143. package/dist/editor/block-specs/list/ListRenderer.svelte +70 -0
  144. package/dist/editor/block-specs/list/ListRenderer.svelte.d.ts +21 -0
  145. package/dist/editor/block-specs/list/commands.d.ts +2 -0
  146. package/dist/editor/block-specs/list/commands.js +65 -0
  147. package/dist/editor/block-specs/list/index.d.ts +6 -0
  148. package/dist/editor/block-specs/list/index.js +5 -0
  149. package/dist/editor/block-specs/list/inlineSecondPass.d.ts +6 -0
  150. package/dist/editor/block-specs/list/inlineSecondPass.js +78 -0
  151. package/dist/editor/block-specs/list/parse.d.ts +11 -0
  152. package/dist/editor/block-specs/list/parse.js +312 -0
  153. package/dist/editor/block-specs/list/reconcile.d.ts +2 -0
  154. package/dist/editor/block-specs/list/reconcile.js +6 -0
  155. package/dist/editor/block-specs/list/serialize.d.ts +4 -0
  156. package/dist/editor/block-specs/list/serialize.js +83 -0
  157. package/dist/editor/block-specs/list/types.d.ts +27 -0
  158. package/dist/editor/block-specs/list/types.js +1 -0
  159. package/dist/editor/block-specs/listSpec.d.ts +4 -0
  160. package/dist/editor/block-specs/listSpec.js +24 -0
  161. package/dist/editor/block-specs/paragraph/ParagraphRenderer.svelte +22 -0
  162. package/dist/editor/block-specs/paragraph/ParagraphRenderer.svelte.d.ts +21 -0
  163. package/dist/editor/block-specs/paragraph/commands.d.ts +2 -0
  164. package/dist/editor/block-specs/paragraph/commands.js +41 -0
  165. package/dist/editor/block-specs/paragraph/edit.d.ts +10 -0
  166. package/dist/editor/block-specs/paragraph/edit.js +69 -0
  167. package/dist/editor/block-specs/paragraph/index.d.ts +7 -0
  168. package/dist/editor/block-specs/paragraph/index.js +6 -0
  169. package/dist/editor/block-specs/paragraph/inlineSecondPass.d.ts +3 -0
  170. package/dist/editor/block-specs/paragraph/inlineSecondPass.js +25 -0
  171. package/dist/editor/block-specs/paragraph/parse.d.ts +9 -0
  172. package/dist/editor/block-specs/paragraph/parse.js +76 -0
  173. package/dist/editor/block-specs/paragraph/reconcile.d.ts +2 -0
  174. package/dist/editor/block-specs/paragraph/reconcile.js +9 -0
  175. package/dist/editor/block-specs/paragraph/serialize.d.ts +4 -0
  176. package/dist/editor/block-specs/paragraph/serialize.js +39 -0
  177. package/dist/editor/block-specs/paragraph/types.d.ts +10 -0
  178. package/dist/editor/block-specs/paragraph/types.js +1 -0
  179. package/dist/editor/block-specs/paragraphSpec.d.ts +2 -0
  180. package/dist/editor/block-specs/paragraphSpec.js +24 -0
  181. package/dist/editor/block-specs/registry.d.ts +10 -0
  182. package/dist/editor/block-specs/registry.js +34 -0
  183. package/dist/editor/block-specs/table/TableRenderer.svelte +53 -0
  184. package/dist/editor/block-specs/table/TableRenderer.svelte.d.ts +21 -0
  185. package/dist/editor/block-specs/table/commands.d.ts +2 -0
  186. package/dist/editor/block-specs/table/commands.js +1 -0
  187. package/dist/editor/block-specs/table/edit.d.ts +10 -0
  188. package/dist/editor/block-specs/table/edit.js +127 -0
  189. package/dist/editor/block-specs/table/editCommands.d.ts +18 -0
  190. package/dist/editor/block-specs/table/editCommands.js +87 -0
  191. package/dist/editor/block-specs/table/index.d.ts +8 -0
  192. package/dist/editor/block-specs/table/index.js +6 -0
  193. package/dist/editor/block-specs/table/inlineSecondPass.d.ts +3 -0
  194. package/dist/editor/block-specs/table/inlineSecondPass.js +22 -0
  195. package/dist/editor/block-specs/table/parse.d.ts +17 -0
  196. package/dist/editor/block-specs/table/parse.js +181 -0
  197. package/dist/editor/block-specs/table/reconcile.d.ts +2 -0
  198. package/dist/editor/block-specs/table/reconcile.js +6 -0
  199. package/dist/editor/block-specs/table/serialize.d.ts +3 -0
  200. package/dist/editor/block-specs/table/serialize.js +32 -0
  201. package/dist/editor/block-specs/table/types.d.ts +11 -0
  202. package/dist/editor/block-specs/table/types.js +1 -0
  203. package/dist/editor/block-specs/tableSpec.d.ts +2 -0
  204. package/dist/editor/block-specs/tableSpec.js +25 -0
  205. package/dist/editor/block-specs/toc/EditableToc.svelte +16 -0
  206. package/dist/editor/block-specs/toc/EditableToc.svelte.d.ts +4 -0
  207. package/dist/editor/block-specs/toc/TocRenderer.svelte +22 -0
  208. package/dist/editor/block-specs/toc/TocRenderer.svelte.d.ts +21 -0
  209. package/dist/editor/block-specs/toc/commands.d.ts +2 -0
  210. package/dist/editor/block-specs/toc/commands.js +1 -0
  211. package/dist/editor/block-specs/toc/index.d.ts +6 -0
  212. package/dist/editor/block-specs/toc/index.js +5 -0
  213. package/dist/editor/block-specs/toc/inlineSecondPass.d.ts +3 -0
  214. package/dist/editor/block-specs/toc/inlineSecondPass.js +5 -0
  215. package/dist/editor/block-specs/toc/parse.d.ts +10 -0
  216. package/dist/editor/block-specs/toc/parse.js +43 -0
  217. package/dist/editor/block-specs/toc/reconcile.d.ts +2 -0
  218. package/dist/editor/block-specs/toc/reconcile.js +5 -0
  219. package/dist/editor/block-specs/toc/serialize.d.ts +2 -0
  220. package/dist/editor/block-specs/toc/serialize.js +6 -0
  221. package/dist/editor/block-specs/toc/types.d.ts +8 -0
  222. package/dist/editor/block-specs/toc/types.js +1 -0
  223. package/dist/editor/block-specs/tocSpec.d.ts +2 -0
  224. package/dist/editor/block-specs/tocSpec.js +24 -0
  225. package/dist/editor/block-specs/toggle/ToggleRenderer.svelte +19 -0
  226. package/dist/editor/block-specs/toggle/ToggleRenderer.svelte.d.ts +21 -0
  227. package/dist/editor/block-specs/toggle/commands.d.ts +2 -0
  228. package/dist/editor/block-specs/toggle/commands.js +1 -0
  229. package/dist/editor/block-specs/toggle/index.d.ts +7 -0
  230. package/dist/editor/block-specs/toggle/index.js +5 -0
  231. package/dist/editor/block-specs/toggle/inlineSecondPass.d.ts +3 -0
  232. package/dist/editor/block-specs/toggle/inlineSecondPass.js +5 -0
  233. package/dist/editor/block-specs/toggle/parse.d.ts +9 -0
  234. package/dist/editor/block-specs/toggle/parse.js +78 -0
  235. package/dist/editor/block-specs/toggle/reconcile.d.ts +2 -0
  236. package/dist/editor/block-specs/toggle/reconcile.js +6 -0
  237. package/dist/editor/block-specs/toggle/serialize.d.ts +4 -0
  238. package/dist/editor/block-specs/toggle/serialize.js +13 -0
  239. package/dist/editor/block-specs/toggle/types.d.ts +5 -0
  240. package/dist/editor/block-specs/toggle/types.js +1 -0
  241. package/dist/editor/block-specs/toggleSpec.d.ts +2 -0
  242. package/dist/editor/block-specs/toggleSpec.js +24 -0
  243. package/dist/editor/block-specs/types.d.ts +26 -0
  244. package/dist/editor/block-specs/types.js +1 -0
  245. package/dist/editor/blocks/EditableBlockquote.svelte +52 -0
  246. package/dist/editor/blocks/EditableBlockquote.svelte.d.ts +10 -0
  247. package/dist/editor/blocks/EditableBlockquoteNodes.svelte +134 -0
  248. package/dist/editor/blocks/EditableBlockquoteNodes.svelte.d.ts +14 -0
  249. package/dist/editor/blocks/EditableBlockquoteParagraph.svelte +44 -0
  250. package/dist/editor/blocks/EditableBlockquoteParagraph.svelte.d.ts +12 -0
  251. package/dist/editor/blocks/EditableCallout.svelte +182 -0
  252. package/dist/editor/blocks/EditableCallout.svelte.d.ts +11 -0
  253. package/dist/editor/blocks/EditableCalloutListItemRow.svelte +169 -0
  254. package/dist/editor/blocks/EditableCalloutListItemRow.svelte.d.ts +15 -0
  255. package/dist/editor/blocks/EditableCalloutNodes.svelte +91 -0
  256. package/dist/editor/blocks/EditableCalloutNodes.svelte.d.ts +13 -0
  257. package/dist/editor/blocks/EditableCalloutParagraph.svelte +39 -0
  258. package/dist/editor/blocks/EditableCalloutParagraph.svelte.d.ts +12 -0
  259. package/dist/editor/blocks/EditableCodeBlock.svelte +43 -0
  260. package/dist/editor/blocks/EditableCodeBlock.svelte.d.ts +10 -0
  261. package/dist/editor/blocks/EditableHeading.svelte +161 -0
  262. package/dist/editor/blocks/EditableHeading.svelte.d.ts +10 -0
  263. package/dist/editor/blocks/EditableHorizontalRule.svelte +20 -0
  264. package/dist/editor/blocks/EditableHorizontalRule.svelte.d.ts +10 -0
  265. package/dist/editor/blocks/EditableInlineSurface.svelte +423 -0
  266. package/dist/editor/blocks/EditableInlineSurface.svelte.d.ts +26 -0
  267. package/dist/editor/blocks/EditableList.svelte +77 -0
  268. package/dist/editor/blocks/EditableList.svelte.d.ts +17 -0
  269. package/dist/editor/blocks/EditableListItemRow.svelte +231 -0
  270. package/dist/editor/blocks/EditableListItemRow.svelte.d.ts +19 -0
  271. package/dist/editor/blocks/EditableParagraph.svelte +208 -0
  272. package/dist/editor/blocks/EditableParagraph.svelte.d.ts +10 -0
  273. package/dist/editor/blocks/EditableParagraphNodes.svelte +89 -0
  274. package/dist/editor/blocks/EditableParagraphNodes.svelte.d.ts +15 -0
  275. package/dist/editor/blocks/EditableTable.svelte +83 -0
  276. package/dist/editor/blocks/EditableTable.svelte.d.ts +10 -0
  277. package/dist/editor/blocks/EditableTableCell.svelte +89 -0
  278. package/dist/editor/blocks/EditableTableCell.svelte.d.ts +15 -0
  279. package/dist/editor/blocks/EditableToggle.svelte +94 -0
  280. package/dist/editor/blocks/EditableToggle.svelte.d.ts +10 -0
  281. package/dist/editor/commandMenu.d.ts +18 -0
  282. package/dist/editor/commandMenu.js +83 -0
  283. package/dist/editor/commandRegistry.d.ts +48 -0
  284. package/dist/editor/commandRegistry.js +133 -0
  285. package/dist/editor/context/assetBaseUrl.d.ts +6 -0
  286. package/dist/editor/context/assetBaseUrl.js +20 -0
  287. package/dist/editor/dom/editorHistoryKeydown.d.ts +6 -0
  288. package/dist/editor/dom/editorHistoryKeydown.js +31 -0
  289. package/dist/editor/dom/plainEnterKeydown.d.ts +12 -0
  290. package/dist/editor/dom/plainEnterKeydown.js +53 -0
  291. package/dist/editor/dom/plaintextCaret.d.ts +12 -0
  292. package/dist/editor/dom/plaintextCaret.js +61 -0
  293. package/dist/editor/dom/syncDocumentSelectionFocus.d.ts +17 -0
  294. package/dist/editor/dom/syncDocumentSelectionFocus.js +56 -0
  295. package/dist/editor/draftPersistence.d.ts +27 -0
  296. package/dist/editor/draftPersistence.js +83 -0
  297. package/dist/editor/editorHistoryHandle.d.ts +16 -0
  298. package/dist/editor/editorHistoryHandle.js +22 -0
  299. package/dist/editor/inlineChrome/InlineChromeCoordinator.svelte +174 -0
  300. package/dist/editor/inlineChrome/InlineChromeCoordinator.svelte.d.ts +8 -0
  301. package/dist/editor/inlineChrome/InlineFormattingToolbar.svelte +181 -0
  302. package/dist/editor/inlineChrome/InlineFormattingToolbar.svelte.d.ts +3 -0
  303. package/dist/editor/inlineChrome/inlineChromeActions.d.ts +17 -0
  304. package/dist/editor/inlineChrome/inlineChromeActions.js +148 -0
  305. package/dist/editor/inlineChrome/inlineChromeState.svelte.d.ts +23 -0
  306. package/dist/editor/inlineChrome/inlineChromeState.svelte.js +21 -0
  307. package/dist/editor/inlineChrome/inlineToolbarIcons.d.ts +14 -0
  308. package/dist/editor/inlineChrome/inlineToolbarIcons.js +14 -0
  309. package/dist/editor/inlineChrome/inlineWrapActive.d.ts +3 -0
  310. package/dist/editor/inlineChrome/inlineWrapActive.js +19 -0
  311. package/dist/editor/inlineChrome/selectionRect.d.ts +2 -0
  312. package/dist/editor/inlineChrome/selectionRect.js +23 -0
  313. package/dist/editor/model/blockEditCommands.d.ts +73 -0
  314. package/dist/editor/model/blockEditCommands.js +719 -0
  315. package/dist/editor/model/blockTree.d.ts +39 -0
  316. package/dist/editor/model/blockTree.js +185 -0
  317. package/dist/editor/model/blockTreeDrop.d.ts +9 -0
  318. package/dist/editor/model/blockTreeDrop.js +295 -0
  319. package/dist/editor/model/blockTreeMutations.d.ts +10 -0
  320. package/dist/editor/model/blockTreeMutations.js +68 -0
  321. package/dist/editor/model/calloutEditCommands.d.ts +39 -0
  322. package/dist/editor/model/calloutEditCommands.js +305 -0
  323. package/dist/editor/model/documentSelection.d.ts +8 -0
  324. package/dist/editor/model/documentSelection.js +56 -0
  325. package/dist/editor/model/documentSelectionFromSource.d.ts +3 -0
  326. package/dist/editor/model/documentSelectionFromSource.js +45 -0
  327. package/dist/editor/model/documentToRenderBlocks.d.ts +3 -0
  328. package/dist/editor/model/documentToRenderBlocks.js +13 -0
  329. package/dist/editor/model/editorPipeline.bench.d.ts +1 -0
  330. package/dist/editor/model/editorPipeline.bench.js +27 -0
  331. package/dist/editor/model/editorTransactions.d.ts +20 -0
  332. package/dist/editor/model/editorTransactions.js +68 -0
  333. package/dist/editor/model/emptyParagraph.d.ts +11 -0
  334. package/dist/editor/model/emptyParagraph.js +25 -0
  335. package/dist/editor/model/enterCommands.d.ts +16 -0
  336. package/dist/editor/model/enterCommands.js +288 -0
  337. package/dist/editor/model/extensionSyntaxWarnings.d.ts +29 -0
  338. package/dist/editor/model/extensionSyntaxWarnings.js +122 -0
  339. package/dist/editor/model/findBlockAtSourceOffset.d.ts +3 -0
  340. package/dist/editor/model/findBlockAtSourceOffset.js +20 -0
  341. package/dist/editor/model/fixtures/serialization-fidelity/reorder-gaps.svelte +4 -0
  342. package/dist/editor/model/focusOutcome.d.ts +25 -0
  343. package/dist/editor/model/focusOutcome.js +1 -0
  344. package/dist/editor/model/incrementalReparse.d.ts +16 -0
  345. package/dist/editor/model/incrementalReparse.js +111 -0
  346. package/dist/editor/model/index.d.ts +22 -0
  347. package/dist/editor/model/index.js +19 -0
  348. package/dist/editor/model/inlineDraftCommit.d.ts +17 -0
  349. package/dist/editor/model/inlineDraftCommit.js +187 -0
  350. package/dist/editor/model/inlineDraftMerge.d.ts +8 -0
  351. package/dist/editor/model/inlineDraftMerge.js +81 -0
  352. package/dist/editor/model/inlineEditCommands.d.ts +28 -0
  353. package/dist/editor/model/inlineEditCommands.js +581 -0
  354. package/dist/editor/model/inlinePlain.d.ts +3 -0
  355. package/dist/editor/model/inlinePlain.js +28 -0
  356. package/dist/editor/model/inlineSecondPass.d.ts +4 -0
  357. package/dist/editor/model/inlineSecondPass.js +47 -0
  358. package/dist/editor/model/line-utils.d.ts +14 -0
  359. package/dist/editor/model/line-utils.js +38 -0
  360. package/dist/editor/model/listEditCommands.d.ts +56 -0
  361. package/dist/editor/model/listEditCommands.js +299 -0
  362. package/dist/editor/model/nestedContainerTransactions.d.ts +36 -0
  363. package/dist/editor/model/nestedContainerTransactions.js +336 -0
  364. package/dist/editor/model/parseMarkdownDocument.d.ts +2 -0
  365. package/dist/editor/model/parseMarkdownDocument.js +324 -0
  366. package/dist/editor/model/quoteEditCommands.d.ts +39 -0
  367. package/dist/editor/model/quoteEditCommands.js +323 -0
  368. package/dist/editor/model/reconcileBlockIds.d.ts +9 -0
  369. package/dist/editor/model/reconcileBlockIds.js +297 -0
  370. package/dist/editor/model/reparseOptions.d.ts +12 -0
  371. package/dist/editor/model/reparseOptions.js +1 -0
  372. package/dist/editor/model/resolveEnterPlainSnapshot.d.ts +6 -0
  373. package/dist/editor/model/resolveEnterPlainSnapshot.js +23 -0
  374. package/dist/editor/model/richInlines.d.ts +16 -0
  375. package/dist/editor/model/richInlines.js +494 -0
  376. package/dist/editor/model/serializeInlineNodes.d.ts +3 -0
  377. package/dist/editor/model/serializeInlineNodes.js +45 -0
  378. package/dist/editor/model/serializeMarkdownDocument.d.ts +30 -0
  379. package/dist/editor/model/serializeMarkdownDocument.js +150 -0
  380. package/dist/editor/model/structureParseWarnings.d.ts +10 -0
  381. package/dist/editor/model/structureParseWarnings.js +60 -0
  382. package/dist/editor/model/syntheticInlineRanges.d.ts +3 -0
  383. package/dist/editor/model/syntheticInlineRanges.js +36 -0
  384. package/dist/editor/model/types.d.ts +185 -0
  385. package/dist/editor/model/types.js +26 -0
  386. package/dist/editor/plugins/autolinks/AutolinkRenderer.svelte +20 -0
  387. package/dist/editor/plugins/autolinks/AutolinkRenderer.svelte.d.ts +21 -0
  388. package/dist/editor/plugins/autolinks/index.d.ts +2 -0
  389. package/dist/editor/plugins/autolinks/index.js +4 -0
  390. package/dist/editor/plugins/autolinks/parse-autolinks.d.ts +2 -0
  391. package/dist/editor/plugins/autolinks/parse-autolinks.js +68 -0
  392. package/dist/editor/plugins/autolinks/types.d.ts +6 -0
  393. package/dist/editor/plugins/autolinks/types.js +1 -0
  394. package/dist/editor/plugins/emphasis/EmphasisRenderer.svelte +15 -0
  395. package/dist/editor/plugins/emphasis/EmphasisRenderer.svelte.d.ts +21 -0
  396. package/dist/editor/plugins/emphasis/index.d.ts +2 -0
  397. package/dist/editor/plugins/emphasis/index.js +4 -0
  398. package/dist/editor/plugins/emphasis/parse-emphasis.d.ts +2 -0
  399. package/dist/editor/plugins/emphasis/parse-emphasis.js +188 -0
  400. package/dist/editor/plugins/emphasis/types.d.ts +24 -0
  401. package/dist/editor/plugins/emphasis/types.js +1 -0
  402. package/dist/editor/plugins/escaping/EscapingRenderer.svelte +18 -0
  403. package/dist/editor/plugins/escaping/EscapingRenderer.svelte.d.ts +21 -0
  404. package/dist/editor/plugins/escaping/index.d.ts +2 -0
  405. package/dist/editor/plugins/escaping/index.js +4 -0
  406. package/dist/editor/plugins/escaping/parse-escaping.d.ts +6 -0
  407. package/dist/editor/plugins/escaping/parse-escaping.js +26 -0
  408. package/dist/editor/plugins/escaping/types.d.ts +10 -0
  409. package/dist/editor/plugins/escaping/types.js +1 -0
  410. package/dist/editor/plugins/extended-task-list/ExtendedTaskListRenderer.svelte +25 -0
  411. package/dist/editor/plugins/extended-task-list/ExtendedTaskListRenderer.svelte.d.ts +21 -0
  412. package/dist/editor/plugins/extended-task-list/index.d.ts +2 -0
  413. package/dist/editor/plugins/extended-task-list/index.js +4 -0
  414. package/dist/editor/plugins/extended-task-list/parse-extended-task-list.d.ts +2 -0
  415. package/dist/editor/plugins/extended-task-list/parse-extended-task-list.js +35 -0
  416. package/dist/editor/plugins/extended-task-list/types.d.ts +6 -0
  417. package/dist/editor/plugins/extended-task-list/types.js +1 -0
  418. package/dist/editor/plugins/highlight/HighlightRenderer.svelte +16 -0
  419. package/dist/editor/plugins/highlight/HighlightRenderer.svelte.d.ts +21 -0
  420. package/dist/editor/plugins/highlight/index.d.ts +2 -0
  421. package/dist/editor/plugins/highlight/index.js +4 -0
  422. package/dist/editor/plugins/highlight/parse-highlights.d.ts +4 -0
  423. package/dist/editor/plugins/highlight/parse-highlights.js +49 -0
  424. package/dist/editor/plugins/highlight/types.d.ts +6 -0
  425. package/dist/editor/plugins/highlight/types.js +1 -0
  426. package/dist/editor/plugins/index.d.ts +1 -0
  427. package/dist/editor/plugins/index.js +1 -0
  428. package/dist/editor/plugins/links-images/LinksImagesRenderer.svelte +53 -0
  429. package/dist/editor/plugins/links-images/LinksImagesRenderer.svelte.d.ts +21 -0
  430. package/dist/editor/plugins/links-images/index.d.ts +2 -0
  431. package/dist/editor/plugins/links-images/index.js +4 -0
  432. package/dist/editor/plugins/links-images/parse-image-layout.d.ts +28 -0
  433. package/dist/editor/plugins/links-images/parse-image-layout.js +147 -0
  434. package/dist/editor/plugins/links-images/parse-links-images.d.ts +25 -0
  435. package/dist/editor/plugins/links-images/parse-links-images.js +236 -0
  436. package/dist/editor/plugins/links-images/resolve-asset-url.d.ts +5 -0
  437. package/dist/editor/plugins/links-images/resolve-asset-url.js +21 -0
  438. package/dist/editor/plugins/links-images/types.d.ts +11 -0
  439. package/dist/editor/plugins/links-images/types.js +1 -0
  440. package/dist/editor/plugins/mention/MentionRenderer.svelte +18 -0
  441. package/dist/editor/plugins/mention/MentionRenderer.svelte.d.ts +21 -0
  442. package/dist/editor/plugins/mention/index.d.ts +2 -0
  443. package/dist/editor/plugins/mention/index.js +4 -0
  444. package/dist/editor/plugins/mention/parse-mentions.d.ts +2 -0
  445. package/dist/editor/plugins/mention/parse-mentions.js +54 -0
  446. package/dist/editor/plugins/mention/types.d.ts +14 -0
  447. package/dist/editor/plugins/mention/types.js +1 -0
  448. package/dist/editor/plugins/raw-text/RawTextRenderer.svelte +19 -0
  449. package/dist/editor/plugins/raw-text/RawTextRenderer.svelte.d.ts +21 -0
  450. package/dist/editor/plugins/raw-text/index.d.ts +2 -0
  451. package/dist/editor/plugins/raw-text/index.js +4 -0
  452. package/dist/editor/plugins/raw-text/types.d.ts +4 -0
  453. package/dist/editor/plugins/raw-text/types.js +1 -0
  454. package/dist/editor/plugins/shared/InlineNodes.svelte +113 -0
  455. package/dist/editor/plugins/shared/InlineNodes.svelte.d.ts +21 -0
  456. package/dist/editor/plugins/shared/InlineNodesEdit.svelte +78 -0
  457. package/dist/editor/plugins/shared/InlineNodesEdit.svelte.d.ts +21 -0
  458. package/dist/editor/plugins/strikethrough/StrikethroughRenderer.svelte +9 -0
  459. package/dist/editor/plugins/strikethrough/StrikethroughRenderer.svelte.d.ts +21 -0
  460. package/dist/editor/plugins/strikethrough/index.d.ts +2 -0
  461. package/dist/editor/plugins/strikethrough/index.js +4 -0
  462. package/dist/editor/plugins/strikethrough/parse-strikethrough.d.ts +3 -0
  463. package/dist/editor/plugins/strikethrough/parse-strikethrough.js +38 -0
  464. package/dist/editor/plugins/strikethrough/types.d.ts +4 -0
  465. package/dist/editor/plugins/strikethrough/types.js +1 -0
  466. package/dist/editor/plugins/synced-block/SyncedBlockRenderer.svelte +16 -0
  467. package/dist/editor/plugins/synced-block/SyncedBlockRenderer.svelte.d.ts +21 -0
  468. package/dist/editor/plugins/synced-block/index.d.ts +2 -0
  469. package/dist/editor/plugins/synced-block/index.js +4 -0
  470. package/dist/editor/plugins/synced-block/parse-synced-blocks.d.ts +2 -0
  471. package/dist/editor/plugins/synced-block/parse-synced-blocks.js +15 -0
  472. package/dist/editor/plugins/synced-block/types.d.ts +4 -0
  473. package/dist/editor/plugins/synced-block/types.js +1 -0
  474. package/dist/editor/plugins/types.d.ts +19 -0
  475. package/dist/editor/plugins/types.js +1 -0
  476. package/dist/editor/plugins/wiki-link/WikiLinkRenderer.svelte +15 -0
  477. package/dist/editor/plugins/wiki-link/WikiLinkRenderer.svelte.d.ts +21 -0
  478. package/dist/editor/plugins/wiki-link/index.d.ts +2 -0
  479. package/dist/editor/plugins/wiki-link/index.js +4 -0
  480. package/dist/editor/plugins/wiki-link/parse-wiki-links.d.ts +2 -0
  481. package/dist/editor/plugins/wiki-link/parse-wiki-links.js +30 -0
  482. package/dist/editor/plugins/wiki-link/types.d.ts +8 -0
  483. package/dist/editor/plugins/wiki-link/types.js +1 -0
  484. package/dist/editor/taskCheckboxStates.d.ts +5 -0
  485. package/dist/editor/taskCheckboxStates.js +28 -0
  486. package/dist/index.d.ts +6 -0
  487. package/dist/index.js +9 -0
  488. package/dist/styles/index.css +6 -0
  489. package/package.json +84 -0
@@ -0,0 +1,134 @@
1
+ <script lang="ts">
2
+ import Self from './EditableBlockquoteNodes.svelte';
3
+ import BlockRow from '../BlockRow.svelte';
4
+ import EditableInlineSurface from './EditableInlineSurface.svelte';
5
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
6
+ import type { EditorBlock, InlineNode } from '../model/types';
7
+ import { isNestedQuoteChild } from '../block-specs/blockquote/parse';
8
+ import {
9
+ blockquoteDisplayPlain,
10
+ nodeAtQuotePath,
11
+ quoteBlockCanMoveSibling,
12
+ type QuotePath
13
+ } from '../model/quoteEditCommands';
14
+
15
+ let {
16
+ editor,
17
+ topBlockIndex,
18
+ draftRoot,
19
+ quotePath,
20
+ onRowFocus,
21
+ onRowBlur
22
+ }: {
23
+ editor: MarkdownEditor;
24
+ topBlockIndex: number;
25
+ draftRoot: EditorBlock;
26
+ quotePath: QuotePath;
27
+ onRowFocus: () => void;
28
+ onRowBlur: () => void;
29
+ } = $props();
30
+
31
+ const quoteNode = $derived(nodeAtQuotePath(draftRoot, quotePath)!);
32
+ const isNested = $derived(quotePath.length > 0);
33
+ const displayPlain = $derived(blockquoteDisplayPlain(quoteNode, editor.source));
34
+
35
+ function commitDraft(inlines: InlineNode[], plainCaret: number) {
36
+ editor.commitBlockquoteBodyInlineDraftAt(
37
+ topBlockIndex,
38
+ quoteNode.id,
39
+ inlines,
40
+ plainCaret
41
+ );
42
+ }
43
+
44
+ function commitChildDraft(child: EditorBlock, inlines: InlineNode[], plainCaret: number) {
45
+ editor.commitBlockquoteBodyInlineDraftAt(topBlockIndex, child.id, inlines, plainCaret);
46
+ }
47
+
48
+ function onBodyBlur() {
49
+ onRowBlur();
50
+ }
51
+
52
+ function childCanMove(path: QuotePath, direction: 'up' | 'down'): boolean {
53
+ return quoteBlockCanMoveSibling(draftRoot, path, direction);
54
+ }
55
+ </script>
56
+
57
+ <div class="{isNested ? '' : 'mb-1'} border-l border-border-emphasis pl-4 text-txt-secondary">
58
+ <EditableInlineSurface
59
+ {editor}
60
+ blockId={quoteNode.id}
61
+ surfaceBlockType="blockquote"
62
+ modelInlines={quoteNode.inlines}
63
+ {displayPlain}
64
+ ariaLabel="Blockquote"
65
+ class="min-h-[1.5lh] py-1 text-txt-primary"
66
+ onFocus={onRowFocus}
67
+ onBlur={onBodyBlur}
68
+ onCommit={commitDraft}
69
+ />
70
+
71
+ {#each quoteNode.children ?? [] as child, ci (child.id)}
72
+ {#if child.type === 'blockquote'}
73
+ {@const childPath = [...quotePath, ci] as QuotePath}
74
+ {@const nested = isNestedQuoteChild(quoteNode, child, editor.source)}
75
+ <BlockRow
76
+ {editor}
77
+ blockIndex={topBlockIndex}
78
+ blockId={child.id}
79
+ blockType="blockquote"
80
+ blockSynthetic={false}
81
+ nestedRowBlockId={child.id}
82
+ nestedRowBlockType="blockquote"
83
+ moveUpCommandId="moveQuoteParagraphUp"
84
+ moveDownCommandId="moveQuoteParagraphDown"
85
+ canMoveUp={childCanMove(childPath, 'up')}
86
+ canMoveDown={childCanMove(childPath, 'down')}
87
+ >
88
+ {#if nested}
89
+ <Self {editor} {topBlockIndex} {draftRoot} quotePath={childPath} {onRowFocus} {onRowBlur} />
90
+ {:else}
91
+ <EditableInlineSurface
92
+ {editor}
93
+ blockId={child.id}
94
+ surfaceBlockType="paragraph"
95
+ modelInlines={child.inlines}
96
+ displayPlain={blockquoteDisplayPlain(child, editor.source)}
97
+ ariaLabel="Blockquote"
98
+ class="min-h-[1.5lh] py-1 text-txt-primary"
99
+ onFocus={onRowFocus}
100
+ onBlur={onBodyBlur}
101
+ onCommit={(inlines, plainCaret) => commitChildDraft(child, inlines, plainCaret)}
102
+ />
103
+ {#each child.children ?? [] as grandchild, gi (grandchild.id)}
104
+ {#if grandchild.type === 'blockquote'}
105
+ {@const grandchildPath = [...childPath, gi] as QuotePath}
106
+ <BlockRow
107
+ {editor}
108
+ blockIndex={topBlockIndex}
109
+ blockId={grandchild.id}
110
+ blockType="blockquote"
111
+ blockSynthetic={false}
112
+ nestedRowBlockId={grandchild.id}
113
+ nestedRowBlockType="blockquote"
114
+ moveUpCommandId="moveQuoteParagraphUp"
115
+ moveDownCommandId="moveQuoteParagraphDown"
116
+ canMoveUp={childCanMove(grandchildPath, 'up')}
117
+ canMoveDown={childCanMove(grandchildPath, 'down')}
118
+ >
119
+ <Self
120
+ {editor}
121
+ {topBlockIndex}
122
+ {draftRoot}
123
+ quotePath={grandchildPath}
124
+ {onRowFocus}
125
+ {onRowBlur}
126
+ />
127
+ </BlockRow>
128
+ {/if}
129
+ {/each}
130
+ {/if}
131
+ </BlockRow>
132
+ {/if}
133
+ {/each}
134
+ </div>
@@ -0,0 +1,14 @@
1
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
2
+ import type { EditorBlock } from '../model/types';
3
+ import { type QuotePath } from '../model/quoteEditCommands';
4
+ type $$ComponentProps = {
5
+ editor: MarkdownEditor;
6
+ topBlockIndex: number;
7
+ draftRoot: EditorBlock;
8
+ quotePath: QuotePath;
9
+ onRowFocus: () => void;
10
+ onRowBlur: () => void;
11
+ };
12
+ declare const EditableBlockquoteNodes: import("svelte").Component<$$ComponentProps, {}, "">;
13
+ type EditableBlockquoteNodes = ReturnType<typeof EditableBlockquoteNodes>;
14
+ export default EditableBlockquoteNodes;
@@ -0,0 +1,44 @@
1
+ <script lang="ts">
2
+ import EditableInlineSurface from './EditableInlineSurface.svelte';
3
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
4
+ import type { EditorBlock, InlineNode } from '../model/types';
5
+ import { paragraphDisplayPlain } from '../model/blockEditCommands';
6
+
7
+ let {
8
+ block,
9
+ editor,
10
+ topBlockIndex,
11
+ onRowFocus,
12
+ onRowBlur
13
+ }: {
14
+ block: EditorBlock;
15
+ editor: MarkdownEditor;
16
+ topBlockIndex: number;
17
+ onRowFocus: () => void;
18
+ onRowBlur: () => void;
19
+ } = $props();
20
+
21
+ const displayPlain = $derived(paragraphDisplayPlain(block));
22
+
23
+ function commitDraft(inlines: InlineNode[], plainCaret: number) {
24
+ editor.commitBlockquoteParagraphInlineDraftAt(
25
+ topBlockIndex,
26
+ block.id,
27
+ inlines,
28
+ plainCaret
29
+ );
30
+ }
31
+ </script>
32
+
33
+ <EditableInlineSurface
34
+ {editor}
35
+ blockId={block.id}
36
+ surfaceBlockType="paragraph"
37
+ modelInlines={block.inlines}
38
+ {displayPlain}
39
+ ariaLabel="Blockquote paragraph"
40
+ class="min-h-[1.5lh] py-1 text-txt-primary"
41
+ onFocus={onRowFocus}
42
+ onBlur={onRowBlur}
43
+ onCommit={commitDraft}
44
+ />
@@ -0,0 +1,12 @@
1
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
2
+ import type { EditorBlock } from '../model/types';
3
+ type $$ComponentProps = {
4
+ block: EditorBlock;
5
+ editor: MarkdownEditor;
6
+ topBlockIndex: number;
7
+ onRowFocus: () => void;
8
+ onRowBlur: () => void;
9
+ };
10
+ declare const EditableBlockquoteParagraph: import("svelte").Component<$$ComponentProps, {}, "">;
11
+ type EditableBlockquoteParagraph = ReturnType<typeof EditableBlockquoteParagraph>;
12
+ export default EditableBlockquoteParagraph;
@@ -0,0 +1,182 @@
1
+ <script lang="ts">
2
+ import { Button, Popover } from 'phoundry-ui';
3
+ import EditableCalloutNodes from './EditableCalloutNodes.svelte';
4
+ import CalloutTypeIcon from '../block-specs/callout/CalloutTypeIcon.svelte';
5
+ import {
6
+ CURATED_CALLOUT_TYPES,
7
+ calloutAccentFor,
8
+ calloutIconFor,
9
+ calloutTypeLabel,
10
+ type CuratedCalloutType
11
+ } from '../block-specs/callout/icons';
12
+ import type { CalloutBlock } from '../block-specs/callout/types';
13
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
14
+ import type { EditorBlock } from '../model/types';
15
+ import {
16
+ makeCalloutBodySyntheticParagraph,
17
+ isCalloutBodySyntheticParagraphId
18
+ } from '../model/calloutEditCommands';
19
+ import { deepCloneBlock } from '../model/blockTree';
20
+
21
+ let {
22
+ editor,
23
+ blockIndex,
24
+ block,
25
+ nested = false
26
+ }: {
27
+ editor: MarkdownEditor;
28
+ blockIndex: number;
29
+ block: EditorBlock;
30
+ nested?: boolean;
31
+ } = $props();
32
+
33
+ let titleEl = $state.raw<HTMLDivElement | null>(null);
34
+ let popoverOpen = $state(false);
35
+ let titleDraft = $state('');
36
+ let rowFocusCount = $state(0);
37
+
38
+ const data = $derived(block.data as CalloutBlock);
39
+ const accent = $derived(calloutAccentFor(data.type));
40
+ const parsedChildren = $derived(block.children ?? []);
41
+
42
+ const bodyChildren = $derived.by((): EditorBlock[] => {
43
+ if (parsedChildren.length > 0) return parsedChildren;
44
+ return [makeCalloutBodySyntheticParagraph(block.id)];
45
+ });
46
+
47
+ const draftCallout = $derived.by(() => {
48
+ if (rowFocusCount > 0) return deepCloneBlock(block);
49
+ return block;
50
+ });
51
+
52
+ $effect(() => {
53
+ void block.id;
54
+ void editor.document.source;
55
+ const el = titleEl;
56
+ if (!el || el.contains(document.activeElement)) return;
57
+ titleDraft = data.title;
58
+ el.textContent = data.title;
59
+ });
60
+
61
+ function readOpener(): CalloutBlock {
62
+ return block.data as CalloutBlock;
63
+ }
64
+
65
+ function commitOpener(patch: Partial<Pick<CalloutBlock, 'type' | 'title'>>) {
66
+ const prev = readOpener();
67
+ const next: CalloutBlock = {
68
+ ...prev,
69
+ ...patch
70
+ };
71
+ editor.commitCalloutOpenerDraftAt(blockIndex, block.id, next);
72
+ }
73
+
74
+ function selectType(type: CuratedCalloutType) {
75
+ commitOpener({ type });
76
+ popoverOpen = false;
77
+ }
78
+
79
+ function onTitleFocus() {
80
+ titleDraft = data.title;
81
+ }
82
+
83
+ function onTitleBlur() {
84
+ const el = titleEl;
85
+ if (!el) return;
86
+ const text = (el.textContent ?? '').replace(/\n/g, ' ').trim();
87
+ titleDraft = text;
88
+ if (text !== data.title) {
89
+ commitOpener({ title: text });
90
+ }
91
+ }
92
+
93
+ function onTitleKeydown(e: KeyboardEvent) {
94
+ if (e.key === 'Enter') {
95
+ e.preventDefault();
96
+ (e.currentTarget as HTMLDivElement).blur();
97
+ }
98
+ }
99
+
100
+ function onRowFocus() {
101
+ rowFocusCount++;
102
+ if (parsedChildren.length === 0) {
103
+ editor.ensureCalloutEmptyBodyAt(blockIndex);
104
+ }
105
+ editor.beginPlainEditSession(blockIndex);
106
+ }
107
+
108
+ function onRowBlur() {
109
+ rowFocusCount--;
110
+ queueMicrotask(() => {
111
+ if (rowFocusCount <= 0) {
112
+ rowFocusCount = 0;
113
+ editor.commitPlainEditSession();
114
+ }
115
+ });
116
+ }
117
+ </script>
118
+
119
+ <aside
120
+ class="{nested
121
+ ? 'my-2 border-l-2 border-border-default pl-3'
122
+ : ''} border-l-4 py-1 pl-2 {accent.bar}"
123
+ >
124
+ <div class="mb-2 flex items-start gap-2">
125
+ <Popover bind:open={popoverOpen} placement="bottom-start">
126
+ {#snippet trigger(toggle)}
127
+ <Button
128
+ variant="ghost"
129
+ size="sm"
130
+ iconOnly
131
+ icon={calloutIconFor(data.type)}
132
+ class="mt-0.5 shrink-0 !px-1 {accent.title}"
133
+ aria-label="Change callout type"
134
+ onclick={toggle}
135
+ />
136
+ {/snippet}
137
+ <div
138
+ class="grid min-w-[10rem] gap-0.5 rounded-lg border border-border-default bg-surface-base p-1 shadow-lg"
139
+ role="menu"
140
+ >
141
+ {#each CURATED_CALLOUT_TYPES as t (t)}
142
+ <button
143
+ type="button"
144
+ role="menuitem"
145
+ class="flex items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-txt-primary hover:bg-surface-raised"
146
+ class:bg-surface-raised={data.type.toLowerCase() === t ||
147
+ (data.type.toLowerCase() === 'info' && t === 'note') ||
148
+ (data.type.toLowerCase() === 'danger' && t === 'error')}
149
+ onclick={() => selectType(t)}
150
+ >
151
+ <CalloutTypeIcon type={t} class="h-4 w-4 shrink-0" />
152
+ <span>{calloutTypeLabel(t)}</span>
153
+ </button>
154
+ {/each}
155
+ </div>
156
+ </Popover>
157
+
158
+ <!-- svelte-ignore a11y_no_noninteractive_tabindex -->
159
+ <div
160
+ bind:this={titleEl}
161
+ contenteditable="plaintext-only"
162
+ role="textbox"
163
+ tabindex="0"
164
+ aria-label="Callout title"
165
+ class="min-h-[1.5rem] min-w-[4rem] flex-1 text-base font-semibold outline-none empty:before:text-txt-tertiary empty:before:content-['Title…'] {accent.title}"
166
+ onfocus={onTitleFocus}
167
+ onblur={onTitleBlur}
168
+ onkeydown={onTitleKeydown}
169
+ ></div>
170
+ </div>
171
+
172
+ <div class="callout-body pl-1">
173
+ <EditableCalloutNodes
174
+ {editor}
175
+ topBlockIndex={blockIndex}
176
+ calloutBlock={draftCallout}
177
+ children={bodyChildren}
178
+ onRowFocus={onRowFocus}
179
+ onRowBlur={onRowBlur}
180
+ />
181
+ </div>
182
+ </aside>
@@ -0,0 +1,11 @@
1
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
2
+ import type { EditorBlock } from '../model/types';
3
+ type $$ComponentProps = {
4
+ editor: MarkdownEditor;
5
+ blockIndex: number;
6
+ block: EditorBlock;
7
+ nested?: boolean;
8
+ };
9
+ declare const EditableCallout: import("svelte").Component<$$ComponentProps, {}, "">;
10
+ type EditableCallout = ReturnType<typeof EditableCallout>;
11
+ export default EditableCallout;
@@ -0,0 +1,169 @@
1
+ <script lang="ts">
2
+ import EditableInlineSurface from './EditableInlineSurface.svelte';
3
+ import { plainOffsets } from '../dom/plaintextCaret';
4
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
5
+ import { findBlockLocation } from '../model/blockTree';
6
+ import type { EditorBlock, InlineNode, ListItemBlockData } from '../model/types';
7
+ import { StatusCheckbox } from 'phoundry-ui';
8
+ import {
9
+ listDemoteEmptyItemAt,
10
+ listIndentItem,
11
+ listItemDisplayPlain,
12
+ listMergeWithPrevious,
13
+ listOutdentItem,
14
+ listPromoteToTaskFromBodyShortcut,
15
+ isListItemTaskBodyShortcutPlain,
16
+ isListItemTaskBodyShortcutTrigger,
17
+ listSetTaskState
18
+ } from '../model/listEditCommands';
19
+ import { inlineNodesToPlainText } from '../model/inlinePlain';
20
+ import type { TaskCheckboxState } from '../model/types';
21
+ import { taskCheckboxStates } from '../taskCheckboxStates.js';
22
+
23
+ let {
24
+ item,
25
+ editor,
26
+ topBlockIndex,
27
+ markerOrdered,
28
+ markerStart,
29
+ siblingIndex,
30
+ onRowFocus,
31
+ onRowBlur
32
+ }: {
33
+ item: EditorBlock;
34
+ editor: MarkdownEditor;
35
+ topBlockIndex: number;
36
+ markerOrdered: boolean;
37
+ markerStart?: number;
38
+ siblingIndex: number;
39
+ onRowFocus: () => void;
40
+ onRowBlur: () => void;
41
+ } = $props();
42
+
43
+ const data = $derived(item.data as ListItemBlockData);
44
+ const listMarkerNumber = $derived((markerStart ?? 1) + siblingIndex);
45
+ const displayPlain = $derived(listItemDisplayPlain(item, editor.source));
46
+
47
+ function applyStruct(
48
+ fn: (blocks: EditorBlock[]) => EditorBlock[] | null,
49
+ opts?: { focusBlockId?: string; focusPlain?: { start: number; end: number } }
50
+ ) {
51
+ editor.applyCalloutStructMutation(topBlockIndex, item.id, fn, opts);
52
+ }
53
+
54
+ function commitDraft(inlines: InlineNode[], plainCaret: number) {
55
+ void plainCaret;
56
+ const current = findBlockLocation(editor.document.blocks, item.id)?.block;
57
+ if (!current || current.type !== 'listItem') return;
58
+ const plain = inlineNodesToPlainText(inlines);
59
+ const d = current.data as ListItemBlockData;
60
+ if (d.task !== undefined && isListItemTaskBodyShortcutPlain(plain)) return;
61
+ editor.commitCalloutListItemInlineDraftAt(topBlockIndex, item.id, inlines, plainCaret);
62
+ }
63
+
64
+ function onKeydownExtra(e: KeyboardEvent) {
65
+ const node = e.currentTarget as HTMLDivElement;
66
+ const plain = node.textContent ?? '';
67
+ const { start, end } = plainOffsets(node);
68
+
69
+ if (
70
+ data.task === undefined &&
71
+ (e.key === ' ' || e.key === 'Enter') &&
72
+ !e.shiftKey &&
73
+ !e.ctrlKey &&
74
+ !e.metaKey &&
75
+ !e.altKey &&
76
+ isListItemTaskBodyShortcutTrigger(plain, e.key === 'Enter' ? 'enter' : 'space')
77
+ ) {
78
+ e.preventDefault();
79
+ applyStruct((blocks) => listPromoteToTaskFromBodyShortcut(blocks, item.id, plain), {
80
+ focusBlockId: item.id,
81
+ focusPlain: { start: 0, end: 0 }
82
+ });
83
+ return;
84
+ }
85
+ if (e.key === 'Backspace' && start === 0 && end === 0) {
86
+ e.preventDefault();
87
+ const draftPlain = node.textContent ?? '';
88
+ if (draftPlain.trim().length === 0) {
89
+ applyStruct((blocks) => listDemoteEmptyItemAt(blocks, item.id), {
90
+ focusBlockId: item.id,
91
+ focusPlain: { start: 0, end: 0 }
92
+ });
93
+ return;
94
+ }
95
+ const loc = findBlockLocation(editor.document.blocks, item.id);
96
+ if (!loc || loc.index === 0) return;
97
+ const prev = loc.siblings[loc.index - 1];
98
+ if (!prev || prev.type !== 'listItem') return;
99
+ const joinPlain = listItemDisplayPlain(prev, editor.source).replace(/[ \t]+$/, '').length;
100
+ applyStruct(
101
+ (blocks) => listMergeWithPrevious(blocks, item.id, editor.source)?.blocks ?? null,
102
+ { focusBlockId: prev.id, focusPlain: { start: joinPlain, end: joinPlain } }
103
+ );
104
+ return;
105
+ }
106
+ if (e.key === 'Tab') {
107
+ e.preventDefault();
108
+ const len = node.textContent?.length ?? 0;
109
+ const caret = Math.max(0, Math.min(start, len));
110
+ const focusPlain = { start: caret, end: caret };
111
+ if (e.shiftKey) {
112
+ applyStruct((blocks) => listOutdentItem(blocks, item.id), {
113
+ focusBlockId: item.id,
114
+ focusPlain
115
+ });
116
+ } else {
117
+ applyStruct((blocks) => listIndentItem(blocks, item.id), {
118
+ focusBlockId: item.id,
119
+ focusPlain
120
+ });
121
+ }
122
+ }
123
+ }
124
+
125
+ function onTaskChange(key: string) {
126
+ applyStruct((blocks) => listSetTaskState(blocks, item.id, key as TaskCheckboxState));
127
+ }
128
+ </script>
129
+
130
+ <div class="flex items-start gap-2">
131
+ {#if data.task !== undefined}
132
+ <div class="flex h-lh shrink-0 items-center">
133
+ <StatusCheckbox
134
+ activeKey={data.task}
135
+ states={taskCheckboxStates}
136
+ fallbackChar={data.task === 'other' ? data.taskMarkerChar : undefined}
137
+ ariaLabelPrefix="Task"
138
+ onchange={(key: string) => onTaskChange(key)}
139
+ onmousedown={(e: MouseEvent) => e.preventDefault()}
140
+ />
141
+ </div>
142
+ {:else if markerOrdered}
143
+ <span
144
+ class="mt-0.5 w-5 shrink-0 text-right text-txt-tertiary tabular-nums select-none"
145
+ aria-hidden="true"
146
+ >
147
+ {listMarkerNumber}.
148
+ </span>
149
+ {:else}
150
+ <span class="mt-0.5 w-4 shrink-0 text-center text-txt-tertiary select-none" aria-hidden="true">
151
+
152
+ </span>
153
+ {/if}
154
+ <div class="min-w-0 flex-1 pt-0.5">
155
+ <EditableInlineSurface
156
+ {editor}
157
+ blockId={item.id}
158
+ surfaceBlockType="listItem"
159
+ modelInlines={item.inlines}
160
+ {displayPlain}
161
+ ariaLabel="Callout list item"
162
+ class="min-h-lh py-0 text-txt-primary"
163
+ onFocus={onRowFocus}
164
+ onBlur={onRowBlur}
165
+ onCommit={commitDraft}
166
+ onKeydownExtra={onKeydownExtra}
167
+ />
168
+ </div>
169
+ </div>
@@ -0,0 +1,15 @@
1
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
2
+ import type { EditorBlock } from '../model/types';
3
+ type $$ComponentProps = {
4
+ item: EditorBlock;
5
+ editor: MarkdownEditor;
6
+ topBlockIndex: number;
7
+ markerOrdered: boolean;
8
+ markerStart?: number;
9
+ siblingIndex: number;
10
+ onRowFocus: () => void;
11
+ onRowBlur: () => void;
12
+ };
13
+ declare const EditableCalloutListItemRow: import("svelte").Component<$$ComponentProps, {}, "">;
14
+ type EditableCalloutListItemRow = ReturnType<typeof EditableCalloutListItemRow>;
15
+ export default EditableCalloutListItemRow;
@@ -0,0 +1,91 @@
1
+ <script lang="ts">
2
+ import EditableCallout from './EditableCallout.svelte';
3
+ import EditableCalloutListItemRow from './EditableCalloutListItemRow.svelte';
4
+ import EditableCalloutParagraph from './EditableCalloutParagraph.svelte';
5
+ import BlockRow from '../BlockRow.svelte';
6
+ import { getBlockSpec } from '../block-specs/registry';
7
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
8
+ import type { EditorBlock, ListItemBlockData } from '../model/types';
9
+ import { calloutChildCanMoveSibling } from '../model/calloutEditCommands';
10
+
11
+ let {
12
+ editor,
13
+ topBlockIndex,
14
+ calloutBlock,
15
+ children,
16
+ onRowFocus,
17
+ onRowBlur
18
+ }: {
19
+ editor: MarkdownEditor;
20
+ topBlockIndex: number;
21
+ calloutBlock: EditorBlock;
22
+ children: EditorBlock[];
23
+ onRowFocus: () => void;
24
+ onRowBlur: () => void;
25
+ } = $props();
26
+
27
+ function listMarkerStart(index: number): number | undefined {
28
+ const item = children[index];
29
+ if (!item || item.type !== 'listItem') return undefined;
30
+ return (item.data as ListItemBlockData).ordinalValue;
31
+ }
32
+
33
+ function childCanMove(childId: string, direction: 'up' | 'down'): boolean {
34
+ return calloutChildCanMoveSibling(calloutBlock, childId, direction);
35
+ }
36
+
37
+ </script>
38
+
39
+ <div>
40
+ {#each children as child, ci (child.id)}
41
+ <BlockRow
42
+ {editor}
43
+ blockIndex={topBlockIndex}
44
+ blockId={child.id}
45
+ blockType="callout"
46
+ blockSynthetic={false}
47
+ nestedRowBlockId={child.id}
48
+ nestedRowBlockType={child.type}
49
+ moveUpCommandId="moveCalloutChildUp"
50
+ moveDownCommandId="moveCalloutChildDown"
51
+ canMoveUp={childCanMove(child.id, 'up')}
52
+ canMoveDown={childCanMove(child.id, 'down')}
53
+ >
54
+ {#if child.type === 'paragraph'}
55
+ <EditableCalloutParagraph
56
+ block={child}
57
+ {editor}
58
+ {topBlockIndex}
59
+ {onRowFocus}
60
+ {onRowBlur}
61
+ />
62
+ {:else if child.type === 'listItem'}
63
+ {@const itemData = child.data as ListItemBlockData}
64
+ <EditableCalloutListItemRow
65
+ item={child}
66
+ {editor}
67
+ {topBlockIndex}
68
+ siblingIndex={ci}
69
+ markerOrdered={itemData.ordered}
70
+ markerStart={listMarkerStart(ci)}
71
+ {onRowFocus}
72
+ {onRowBlur}
73
+ />
74
+ {:else if child.type === 'callout'}
75
+ <EditableCallout
76
+ {editor}
77
+ blockIndex={topBlockIndex}
78
+ block={child}
79
+ nested={true}
80
+ />
81
+ {:else}
82
+ {@const spec = getBlockSpec(child.type)}
83
+ {#if spec}
84
+ <div class="rounded border border-border-muted/60 bg-surface-sunken/30 p-2">
85
+ {@render spec.render(child)}
86
+ </div>
87
+ {/if}
88
+ {/if}
89
+ </BlockRow>
90
+ {/each}
91
+ </div>
@@ -0,0 +1,13 @@
1
+ import type { MarkdownEditor } from '../MarkdownEditor.svelte';
2
+ import type { EditorBlock } from '../model/types';
3
+ type $$ComponentProps = {
4
+ editor: MarkdownEditor;
5
+ topBlockIndex: number;
6
+ calloutBlock: EditorBlock;
7
+ children: EditorBlock[];
8
+ onRowFocus: () => void;
9
+ onRowBlur: () => void;
10
+ };
11
+ declare const EditableCalloutNodes: import("svelte").Component<$$ComponentProps, {}, "">;
12
+ type EditableCalloutNodes = ReturnType<typeof EditableCalloutNodes>;
13
+ export default EditableCalloutNodes;