@lapismd/mira 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/extensions/index.d.ts +13 -1
  3. package/dist/extensions/index.d.ts.map +1 -1
  4. package/dist/extensions/index.js +13 -3
  5. package/dist/extensions/inline-links.d.ts +8 -0
  6. package/dist/extensions/inline-links.d.ts.map +1 -0
  7. package/dist/extensions/inline-links.js +120 -0
  8. package/dist/extensions/markdown-editing.d.ts +32 -0
  9. package/dist/extensions/markdown-editing.d.ts.map +1 -0
  10. package/dist/extensions/markdown-editing.js +1 -0
  11. package/dist/internal/codemirror/base/index.d.ts.map +1 -1
  12. package/dist/internal/codemirror/base/index.js +3 -0
  13. package/dist/internal/codemirror/markdown/index.d.ts.map +1 -1
  14. package/dist/internal/codemirror/markdown/index.js +2 -1
  15. package/dist/internal/codemirror/rich/block-controls.d.ts.map +1 -1
  16. package/dist/internal/codemirror/rich/block-controls.js +2 -0
  17. package/dist/internal/codemirror/rich/block-gutter-accessibility.d.ts +15 -0
  18. package/dist/internal/codemirror/rich/block-gutter-accessibility.d.ts.map +1 -0
  19. package/dist/internal/codemirror/rich/block-gutter-accessibility.js +67 -0
  20. package/dist/internal/codemirror/rich/index.d.ts.map +1 -1
  21. package/dist/internal/codemirror/rich/index.js +43 -9
  22. package/dist/internal/codemirror/rich/utils/images.d.ts +6 -3
  23. package/dist/internal/codemirror/rich/utils/images.d.ts.map +1 -1
  24. package/dist/internal/codemirror/rich/utils/images.js +16 -29
  25. package/dist/internal/codemirror/rich/utils/references.d.ts +15 -0
  26. package/dist/internal/codemirror/rich/utils/references.d.ts.map +1 -0
  27. package/dist/internal/codemirror/rich/utils/references.js +86 -0
  28. package/dist/internal/codemirror/rich/widgets/preview-widgets.d.ts +3 -0
  29. package/dist/internal/codemirror/rich/widgets/preview-widgets.d.ts.map +1 -1
  30. package/dist/internal/codemirror/rich/widgets/preview-widgets.js +31 -3
  31. package/dist/internal/inline-links/icons.d.ts +115 -0
  32. package/dist/internal/inline-links/icons.d.ts.map +1 -0
  33. package/dist/internal/inline-links/icons.js +148 -0
  34. package/dist/internal/inline-links/live-preview.d.ts +5 -0
  35. package/dist/internal/inline-links/live-preview.d.ts.map +1 -0
  36. package/dist/internal/inline-links/live-preview.js +135 -0
  37. package/dist/internal/inline-links/registry.d.ts +44 -0
  38. package/dist/internal/inline-links/registry.d.ts.map +1 -0
  39. package/dist/internal/inline-links/registry.js +153 -0
  40. package/dist/mira.svelte.d.ts +1 -1
  41. package/dist/preview/asset-url-lease.d.ts +6 -0
  42. package/dist/preview/asset-url-lease.d.ts.map +1 -0
  43. package/dist/preview/asset-url-lease.js +28 -0
  44. package/dist/preview/components/embed.svelte +10 -5
  45. package/dist/preview/components/embed.svelte.d.ts.map +1 -1
  46. package/dist/preview/components/image.svelte +7 -2
  47. package/dist/preview/components/image.svelte.d.ts.map +1 -1
  48. package/dist/preview/components/inline-link.svelte +94 -0
  49. package/dist/preview/components/inline-link.svelte.d.ts +16 -0
  50. package/dist/preview/components/inline-link.svelte.d.ts.map +1 -0
  51. package/dist/preview/components/link-destination-tooltip.svelte +63 -0
  52. package/dist/preview/components/link-destination-tooltip.svelte.d.ts +7 -0
  53. package/dist/preview/components/link-destination-tooltip.svelte.d.ts.map +1 -0
  54. package/dist/preview/components/link-site-icon.svelte +39 -0
  55. package/dist/preview/components/link-site-icon.svelte.d.ts +10 -0
  56. package/dist/preview/components/link-site-icon.svelte.d.ts.map +1 -0
  57. package/dist/preview/components/link.svelte +19 -9
  58. package/dist/preview/components/link.svelte.d.ts.map +1 -1
  59. package/dist/preview/editable-markdown-preview/editable-markdown-surface.svelte +26 -10
  60. package/dist/preview/editable-markdown-preview/editable-markdown-surface.svelte.d.ts.map +1 -1
  61. package/dist/preview/editable-markdown-preview/editing-session.d.ts +15 -0
  62. package/dist/preview/editable-markdown-preview/editing-session.d.ts.map +1 -0
  63. package/dist/preview/editable-markdown-preview/editing-session.js +103 -0
  64. package/dist/preview/editable-markdown-preview/editor-surface.svelte +13 -4
  65. package/dist/preview/editable-markdown-preview/editor-surface.svelte.d.ts +1 -0
  66. package/dist/preview/editable-markdown-preview/editor-surface.svelte.d.ts.map +1 -1
  67. package/dist/preview/editable-markdown-preview/serialized-writer.d.ts +10 -8
  68. package/dist/preview/editable-markdown-preview/serialized-writer.d.ts.map +1 -1
  69. package/dist/preview/editable-markdown-preview/serialized-writer.js +105 -6
  70. package/dist/preview/editable-markdown-preview.svelte +8 -6
  71. package/dist/preview/editable-markdown-preview.svelte.d.ts.map +1 -1
  72. package/dist/preview/index.d.ts +2 -0
  73. package/dist/preview/index.d.ts.map +1 -1
  74. package/dist/preview/index.js +2 -0
  75. package/dist/preview/markdown-preview.svelte +11 -0
  76. package/dist/preview/markdown-preview.svelte.d.ts.map +1 -1
  77. package/dist/preview/renderer/utils.js +0 -2
  78. package/dist/preview/styles/inline-links.css +38 -0
  79. package/dist/preview/styles/links-embeds-tags.css +2 -2
  80. package/dist/preview/styles/mermaid-highlight.css +4 -3
  81. package/dist/preview/styles/references.css +72 -0
  82. package/dist/preview/styles.css +2 -0
  83. package/dist/tables/editor-column.svelte +20 -7
  84. package/dist/tables/editor-column.svelte.d.ts +2 -0
  85. package/dist/tables/editor-column.svelte.d.ts.map +1 -1
  86. package/dist/tables/editor-table.svelte +4 -0
  87. package/dist/tables/editor-table.svelte.d.ts +2 -0
  88. package/dist/tables/editor-table.svelte.d.ts.map +1 -1
  89. package/dist/tables/grid-editor-column.svelte +6 -2
  90. package/dist/tables/grid-editor-column.svelte.d.ts +2 -0
  91. package/dist/tables/grid-editor-column.svelte.d.ts.map +1 -1
  92. package/dist/tables/grid-editor-table.svelte +4 -0
  93. package/dist/tables/grid-editor-table.svelte.d.ts +2 -0
  94. package/dist/tables/grid-editor-table.svelte.d.ts.map +1 -1
  95. package/dist/tables/index.d.ts +1 -0
  96. package/dist/tables/index.d.ts.map +1 -1
  97. package/dist/tables/index.js +1 -0
  98. package/dist/tables/markdown-table-data-cell.svelte +4 -0
  99. package/dist/tables/markdown-table-data-cell.svelte.d.ts +2 -0
  100. package/dist/tables/markdown-table-data-cell.svelte.d.ts.map +1 -1
  101. package/dist/tables/table-reader.svelte +101 -0
  102. package/dist/tables/table-reader.svelte.d.ts +21 -0
  103. package/dist/tables/table-reader.svelte.d.ts.map +1 -0
  104. package/dist/tables/types.d.ts +2 -0
  105. package/dist/tables/types.d.ts.map +1 -1
  106. package/dist/tables/widgets/grid-table-widget.d.ts +1 -1
  107. package/dist/tables/widgets/grid-table-widget.d.ts.map +1 -1
  108. package/dist/tables/widgets/grid-table-widget.js +5 -2
  109. package/dist/tables/widgets/lifecycle.d.ts +4 -0
  110. package/dist/tables/widgets/lifecycle.d.ts.map +1 -0
  111. package/dist/tables/widgets/lifecycle.js +13 -0
  112. package/dist/tables/widgets/pipe-table-widget.d.ts +1 -1
  113. package/dist/tables/widgets/pipe-table-widget.d.ts.map +1 -1
  114. package/dist/tables/widgets/pipe-table-widget.js +5 -2
  115. package/dist/ui/context-menu/context-menu-radio-group.svelte.d.ts +1 -1
  116. package/dist/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +1 -1
  117. package/dist/ui/toolbar/toolbar-group.svelte.d.ts +1 -1
  118. package/inline-links-NOTICE.md +31 -0
  119. package/package.json +6 -2
  120. package/dist/core/code-mirror.test.d.ts +0 -2
  121. package/dist/core/code-mirror.test.d.ts.map +0 -1
  122. package/dist/core/code-mirror.test.js +0 -68
  123. package/dist/core/images.test.d.ts +0 -2
  124. package/dist/core/images.test.d.ts.map +0 -1
  125. package/dist/core/images.test.js +0 -109
  126. package/dist/core/index.test.d.ts +0 -2
  127. package/dist/core/index.test.d.ts.map +0 -1
  128. package/dist/core/index.test.js +0 -11
  129. package/dist/core/markdown-actions.test.d.ts +0 -2
  130. package/dist/core/markdown-actions.test.d.ts.map +0 -1
  131. package/dist/core/markdown-actions.test.js +0 -182
  132. package/dist/extensions/doodle-dividers.test.d.ts +0 -2
  133. package/dist/extensions/doodle-dividers.test.d.ts.map +0 -1
  134. package/dist/extensions/doodle-dividers.test.js +0 -296
  135. package/dist/extensions/index.test.d.ts +0 -2
  136. package/dist/extensions/index.test.d.ts.map +0 -1
  137. package/dist/extensions/index.test.js +0 -283
  138. package/dist/index.test.d.ts +0 -2
  139. package/dist/index.test.d.ts.map +0 -1
  140. package/dist/index.test.js +0 -64
  141. package/dist/internal/appearance-context.test.d.ts +0 -2
  142. package/dist/internal/appearance-context.test.d.ts.map +0 -1
  143. package/dist/internal/appearance-context.test.js +0 -31
  144. package/dist/internal/codemirror/base/index.test.d.ts +0 -2
  145. package/dist/internal/codemirror/base/index.test.d.ts.map +0 -1
  146. package/dist/internal/codemirror/base/index.test.js +0 -303
  147. package/dist/internal/codemirror/base/search.test.d.ts +0 -2
  148. package/dist/internal/codemirror/base/search.test.d.ts.map +0 -1
  149. package/dist/internal/codemirror/base/search.test.js +0 -155
  150. package/dist/internal/codemirror/base/selection-toolbar.test.d.ts +0 -2
  151. package/dist/internal/codemirror/base/selection-toolbar.test.d.ts.map +0 -1
  152. package/dist/internal/codemirror/base/selection-toolbar.test.js +0 -149
  153. package/dist/internal/codemirror/markdown/authoring.test.d.ts +0 -2
  154. package/dist/internal/codemirror/markdown/authoring.test.d.ts.map +0 -1
  155. package/dist/internal/codemirror/markdown/authoring.test.js +0 -222
  156. package/dist/internal/codemirror/markdown/index.test.d.ts +0 -2
  157. package/dist/internal/codemirror/markdown/index.test.d.ts.map +0 -1
  158. package/dist/internal/codemirror/markdown/index.test.js +0 -158
  159. package/dist/internal/codemirror/markdown/showcase-fixture.test.d.ts +0 -2
  160. package/dist/internal/codemirror/markdown/showcase-fixture.test.d.ts.map +0 -1
  161. package/dist/internal/codemirror/markdown/showcase-fixture.test.js +0 -50
  162. package/dist/internal/codemirror/rich/block-controls.test.d.ts +0 -2
  163. package/dist/internal/codemirror/rich/block-controls.test.d.ts.map +0 -1
  164. package/dist/internal/codemirror/rich/block-controls.test.js +0 -401
  165. package/dist/internal/codemirror/rich/block-ranges.test.d.ts +0 -2
  166. package/dist/internal/codemirror/rich/block-ranges.test.d.ts.map +0 -1
  167. package/dist/internal/codemirror/rich/block-ranges.test.js +0 -310
  168. package/dist/internal/codemirror/rich/block-toolbar.test.d.ts +0 -2
  169. package/dist/internal/codemirror/rich/block-toolbar.test.d.ts.map +0 -1
  170. package/dist/internal/codemirror/rich/block-toolbar.test.js +0 -178
  171. package/dist/internal/codemirror/rich/decorations/fold-indicators.test.d.ts +0 -2
  172. package/dist/internal/codemirror/rich/decorations/fold-indicators.test.d.ts.map +0 -1
  173. package/dist/internal/codemirror/rich/decorations/fold-indicators.test.js +0 -8
  174. package/dist/internal/codemirror/rich/index.test.d.ts +0 -2
  175. package/dist/internal/codemirror/rich/index.test.d.ts.map +0 -1
  176. package/dist/internal/codemirror/rich/index.test.js +0 -607
  177. package/dist/internal/codemirror/rich/utils/code-block-lines.test.d.ts +0 -2
  178. package/dist/internal/codemirror/rich/utils/code-block-lines.test.d.ts.map +0 -1
  179. package/dist/internal/codemirror/rich/utils/code-block-lines.test.js +0 -82
  180. package/dist/internal/codemirror/rich/utils/fenced-code.test.d.ts +0 -2
  181. package/dist/internal/codemirror/rich/utils/fenced-code.test.d.ts.map +0 -1
  182. package/dist/internal/codemirror/rich/utils/fenced-code.test.js +0 -12
  183. package/dist/internal/codemirror/rich/utils/headings.test.d.ts +0 -2
  184. package/dist/internal/codemirror/rich/utils/headings.test.d.ts.map +0 -1
  185. package/dist/internal/codemirror/rich/utils/headings.test.js +0 -27
  186. package/dist/internal/codemirror/rich/utils/height-estimates.test.d.ts +0 -2
  187. package/dist/internal/codemirror/rich/utils/height-estimates.test.d.ts.map +0 -1
  188. package/dist/internal/codemirror/rich/utils/height-estimates.test.js +0 -10
  189. package/dist/internal/codemirror/rich/utils/images.test.d.ts +0 -2
  190. package/dist/internal/codemirror/rich/utils/images.test.d.ts.map +0 -1
  191. package/dist/internal/codemirror/rich/utils/images.test.js +0 -37
  192. package/dist/internal/codemirror/rich/utils/indent.test.d.ts +0 -2
  193. package/dist/internal/codemirror/rich/utils/indent.test.d.ts.map +0 -1
  194. package/dist/internal/codemirror/rich/utils/indent.test.js +0 -169
  195. package/dist/internal/codemirror/rich/utils/inline-math.test.d.ts +0 -2
  196. package/dist/internal/codemirror/rich/utils/inline-math.test.d.ts.map +0 -1
  197. package/dist/internal/codemirror/rich/utils/inline-math.test.js +0 -15
  198. package/dist/internal/codemirror/rich/utils/links.test.d.ts +0 -2
  199. package/dist/internal/codemirror/rich/utils/links.test.d.ts.map +0 -1
  200. package/dist/internal/codemirror/rich/utils/links.test.js +0 -28
  201. package/dist/internal/codemirror/rich/utils/list-callouts.test.d.ts +0 -2
  202. package/dist/internal/codemirror/rich/utils/list-callouts.test.d.ts.map +0 -1
  203. package/dist/internal/codemirror/rich/utils/list-callouts.test.js +0 -47
  204. package/dist/internal/codemirror/rich/utils/measured-indent.test.d.ts +0 -2
  205. package/dist/internal/codemirror/rich/utils/measured-indent.test.d.ts.map +0 -1
  206. package/dist/internal/codemirror/rich/utils/measured-indent.test.js +0 -102
  207. package/dist/internal/codemirror/rich/utils/ranges.test.d.ts +0 -2
  208. package/dist/internal/codemirror/rich/utils/ranges.test.d.ts.map +0 -1
  209. package/dist/internal/codemirror/rich/utils/ranges.test.js +0 -22
  210. package/dist/internal/codemirror/rich/utils/tasks.test.d.ts +0 -2
  211. package/dist/internal/codemirror/rich/utils/tasks.test.d.ts.map +0 -1
  212. package/dist/internal/codemirror/rich/utils/tasks.test.js +0 -57
  213. package/dist/internal/task-states.test.d.ts +0 -2
  214. package/dist/internal/task-states.test.d.ts.map +0 -1
  215. package/dist/internal/task-states.test.js +0 -36
  216. package/dist/mira-code-editor.test.d.ts +0 -2
  217. package/dist/mira-code-editor.test.d.ts.map +0 -1
  218. package/dist/mira-code-editor.test.js +0 -93
  219. package/dist/mode-position.test.d.ts +0 -2
  220. package/dist/mode-position.test.d.ts.map +0 -1
  221. package/dist/mode-position.test.js +0 -60
  222. package/dist/preview/code-language.test.d.ts +0 -2
  223. package/dist/preview/code-language.test.d.ts.map +0 -1
  224. package/dist/preview/code-language.test.js +0 -12
  225. package/dist/preview/components/icon.test.d.ts +0 -2
  226. package/dist/preview/components/icon.test.d.ts.map +0 -1
  227. package/dist/preview/components/icon.test.js +0 -20
  228. package/dist/preview/editable-markdown-preview/behavior.test.d.ts +0 -2
  229. package/dist/preview/editable-markdown-preview/behavior.test.d.ts.map +0 -1
  230. package/dist/preview/editable-markdown-preview/behavior.test.js +0 -36
  231. package/dist/preview/editable-markdown-preview/serialized-writer.test.d.ts +0 -2
  232. package/dist/preview/editable-markdown-preview/serialized-writer.test.d.ts.map +0 -1
  233. package/dist/preview/editable-markdown-preview/serialized-writer.test.js +0 -59
  234. package/dist/preview/embed-target.test.d.ts +0 -2
  235. package/dist/preview/embed-target.test.d.ts.map +0 -1
  236. package/dist/preview/embed-target.test.js +0 -78
  237. package/dist/preview/frontmatter/frontmatter.test.d.ts +0 -2
  238. package/dist/preview/frontmatter/frontmatter.test.d.ts.map +0 -1
  239. package/dist/preview/frontmatter/frontmatter.test.js +0 -190
  240. package/dist/preview/frontmatter/suggestions.test.d.ts +0 -2
  241. package/dist/preview/frontmatter/suggestions.test.d.ts.map +0 -1
  242. package/dist/preview/frontmatter/suggestions.test.js +0 -45
  243. package/dist/preview/outline.test.d.ts +0 -2
  244. package/dist/preview/outline.test.d.ts.map +0 -1
  245. package/dist/preview/outline.test.js +0 -98
  246. package/dist/preview/portable-surfaces.test.d.ts +0 -2
  247. package/dist/preview/portable-surfaces.test.d.ts.map +0 -1
  248. package/dist/preview/portable-surfaces.test.js +0 -513
  249. package/dist/preview/preview.test.d.ts +0 -2
  250. package/dist/preview/preview.test.d.ts.map +0 -1
  251. package/dist/preview/preview.test.js +0 -154
  252. package/dist/preview/remark/callouts.test.d.ts +0 -2
  253. package/dist/preview/remark/callouts.test.d.ts.map +0 -1
  254. package/dist/preview/remark/callouts.test.js +0 -23
  255. package/dist/preview/remark/custom-checklists.test.d.ts +0 -2
  256. package/dist/preview/remark/custom-checklists.test.d.ts.map +0 -1
  257. package/dist/preview/remark/custom-checklists.test.js +0 -51
  258. package/dist/preview/remark/links.test.d.ts +0 -2
  259. package/dist/preview/remark/links.test.d.ts.map +0 -1
  260. package/dist/preview/remark/links.test.js +0 -62
  261. package/dist/preview/remark/parity.test.d.ts +0 -2
  262. package/dist/preview/remark/parity.test.d.ts.map +0 -1
  263. package/dist/preview/remark/parity.test.js +0 -105
  264. package/dist/preview/styles/frontmatter-properties.test.d.ts +0 -2
  265. package/dist/preview/styles/frontmatter-properties.test.d.ts.map +0 -1
  266. package/dist/preview/styles/frontmatter-properties.test.js +0 -57
  267. package/dist/preview/styles/source-mode.test.d.ts +0 -2
  268. package/dist/preview/styles/source-mode.test.d.ts.map +0 -1
  269. package/dist/preview/styles/source-mode.test.js +0 -28
  270. package/dist/tables/extension.test.d.ts +0 -2
  271. package/dist/tables/extension.test.d.ts.map +0 -1
  272. package/dist/tables/extension.test.js +0 -100
  273. package/dist/tables/grid-editor-column.test.d.ts +0 -2
  274. package/dist/tables/grid-editor-column.test.d.ts.map +0 -1
  275. package/dist/tables/grid-editor-column.test.js +0 -27
  276. package/dist/tables/grid-table.test.d.ts +0 -2
  277. package/dist/tables/grid-table.test.d.ts.map +0 -1
  278. package/dist/tables/grid-table.test.js +0 -140
  279. package/dist/tables/index.test.d.ts +0 -2
  280. package/dist/tables/index.test.d.ts.map +0 -1
  281. package/dist/tables/index.test.js +0 -7
  282. package/dist/tables/inline-editor-extensions.test.d.ts +0 -2
  283. package/dist/tables/inline-editor-extensions.test.d.ts.map +0 -1
  284. package/dist/tables/inline-editor-extensions.test.js +0 -23
  285. package/dist/tables/pipe-table.test.d.ts +0 -2
  286. package/dist/tables/pipe-table.test.d.ts.map +0 -1
  287. package/dist/tables/pipe-table.test.js +0 -13
  288. package/dist/tables/table-node.test.d.ts +0 -2
  289. package/dist/tables/table-node.test.d.ts.map +0 -1
  290. package/dist/tables/table-node.test.js +0 -167
  291. package/dist/tables/widgets/source-button.test.d.ts +0 -2
  292. package/dist/tables/widgets/source-button.test.d.ts.map +0 -1
  293. package/dist/tables/widgets/source-button.test.js +0 -11
  294. package/dist/themes/theme-contract.test.d.ts +0 -2
  295. package/dist/themes/theme-contract.test.d.ts.map +0 -1
  296. package/dist/themes/theme-contract.test.js +0 -88
  297. package/dist/ui/index.test.d.ts +0 -2
  298. package/dist/ui/index.test.d.ts.map +0 -1
  299. package/dist/ui/index.test.js +0 -7
  300. package/dist/ui/styles.test.d.ts +0 -2
  301. package/dist/ui/styles.test.d.ts.map +0 -1
  302. package/dist/ui/styles.test.js +0 -26
  303. package/dist/ui/table-dnd/table-dnd-utils.test.d.ts +0 -2
  304. package/dist/ui/table-dnd/table-dnd-utils.test.d.ts.map +0 -1
  305. package/dist/ui/table-dnd/table-dnd-utils.test.js +0 -46
@@ -1,140 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { GridTableNode } from "./grid-table";
3
- function parseGridTable(markdown) {
4
- const node = GridTableNode.fromMarkdown(markdown);
5
- expect(node).not.toBeNull();
6
- return node;
7
- }
8
- function reparseGridTable(node) {
9
- return parseGridTable(node.toMarkdown());
10
- }
11
- function gridCellContent(node, rowIndex, colIndex) {
12
- return node.grid[rowIndex]?.[colIndex]?.cell.content ?? "";
13
- }
14
- const sampleGridTable = [
15
- "+----------------------+-------------------------+",
16
- "| Feature | Behavior |",
17
- "+======================+=========================+",
18
- "| Row and column menus | Kebab dropdown actions |",
19
- "+----------------------+-------------------------+",
20
- "| Drag handles | Reorder rows/columns |",
21
- "+----------------------+-------------------------+",
22
- "| Source toggle | Edit raw Markdown |",
23
- "+----------------------+-------------------------+",
24
- ].join("\n");
25
- const adobeOverviewGridTable = [
26
- "+-------------------+------+",
27
- "| Table Headings | Here |",
28
- "+--------+----------+------+",
29
- "| Sub | Headings | Too |",
30
- "+========+=================+",
31
- "| cell | column spanning |",
32
- "| spans +---------:+------+",
33
- "| rows | normal | cell |",
34
- "+---v----+:---------------:+",
35
- "| | cells can be |",
36
- "| | *formatted* |",
37
- "| | **paragraphs** |",
38
- "| | ``` |",
39
- "| multi | and contain |",
40
- "| line | blocks |",
41
- "| cells | ``` |",
42
- "+========+=========:+======+",
43
- "| footer | cells | |",
44
- "+--------+----------+------+",
45
- ].join("\n");
46
- const horizontalAlignmentExamples = [
47
- { align: "justify", markdown: ["+>-----<+", "| A b C |", "+-------+"] },
48
- { align: "center", markdown: ["+:-----:+", "| ABC |", "+-------+"] },
49
- { align: "left", markdown: ["+:------+", "| ABC |", "+------+"] },
50
- { align: "right", markdown: ["+------:+", "| ABC |", "+------+"] },
51
- ];
52
- const verticalAlignmentExamples = [
53
- {
54
- markdown: [
55
- "+---^---+",
56
- "| Larum |",
57
- "| Ipsum |",
58
- "| |",
59
- "| |",
60
- "+-------+",
61
- ],
62
- valign: "top",
63
- },
64
- {
65
- markdown: [
66
- "+---x---+",
67
- "| |",
68
- "| Larum |",
69
- "| Ipsum |",
70
- "| |",
71
- "+-------+",
72
- ],
73
- valign: "middle",
74
- },
75
- {
76
- markdown: [
77
- "+---v---+",
78
- "| |",
79
- "| |",
80
- "| Larum |",
81
- "| Ipsum |",
82
- "+-------+",
83
- ],
84
- valign: "bottom",
85
- },
86
- ];
87
- describe("GridTableNode", () => {
88
- it("uses the Lapis grid table model", () => {
89
- const node = GridTableNode.fromMarkdown([
90
- "+---------+----------+",
91
- "| Feature | Behavior |",
92
- "+=========+==========+",
93
- "| Handles | Actions |",
94
- "+---------+----------+",
95
- ].join("\n"));
96
- expect(node).not.toBeNull();
97
- expect(node?.getRowCount()).toBe(2);
98
- expect(node?.getColCount()).toBe(2);
99
- expect(node?.toMarkdown()).toContain("Feature");
100
- });
101
- it("preserves table shape after inserting rows and columns", () => {
102
- const node = parseGridTable(sampleGridTable);
103
- node.insertRowAt(node.getRowCount());
104
- node.insertColumnAt(node.getColCount());
105
- const reparsed = reparseGridTable(node);
106
- expect(reparsed.getRowCount()).toBe(5);
107
- expect(reparsed.getColCount()).toBe(3);
108
- expect(gridCellContent(reparsed, 0, 0)).toBe("Feature");
109
- expect(gridCellContent(reparsed, 1, 1)).toBe("Kebab dropdown actions");
110
- });
111
- it("preserves table shape after moving rows and columns", () => {
112
- const node = parseGridTable(sampleGridTable);
113
- node.moveRow(2, 1);
114
- node.moveColumn(1, 0);
115
- const reparsed = reparseGridTable(node);
116
- expect(reparsed.getRowCount()).toBe(4);
117
- expect(reparsed.getColCount()).toBe(2);
118
- expect(gridCellContent(reparsed, 0, 0)).toBe("Behavior");
119
- expect(gridCellContent(reparsed, 1, 1)).toBe("Drag handles");
120
- });
121
- it("parses the Adobe grid-table overview example with merged rows and columns", () => {
122
- const node = parseGridTable(adobeOverviewGridTable);
123
- const cells = node
124
- .getMdastNode()
125
- .children.flatMap((section) => section.children.flatMap((row) => row.children));
126
- expect(node.getColCount()).toBe(3);
127
- expect(cells.some((cell) => cell.colSpan > 1)).toBe(true);
128
- expect(cells.some((cell) => cell.rowSpan > 1)).toBe(true);
129
- expect(cells.some((cell) => cell.content.includes("*formatted*"))).toBe(true);
130
- expect(node.toMarkdown()).toContain("column spanning");
131
- });
132
- it.each(horizontalAlignmentExamples)("parses Adobe horizontal $align grid-table alignment", ({ align, markdown }) => {
133
- const node = parseGridTable(markdown.join("\n"));
134
- expect(node.grid[0]?.[0]?.cell.align).toBe(align);
135
- });
136
- it.each(verticalAlignmentExamples)("parses Adobe vertical $valign grid-table alignment", ({ valign, markdown }) => {
137
- const node = parseGridTable(markdown.join("\n"));
138
- expect(node.grid[0]?.[0]?.cell.valign).toBe(valign);
139
- });
140
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/tables/index.test.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { createTableExtensions } from ".";
3
- describe("codemirror tables public API", () => {
4
- it("creates the default table extensions", () => {
5
- expect(createTableExtensions()).toHaveLength(3);
6
- });
7
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=inline-editor-extensions.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inline-editor-extensions.test.d.ts","sourceRoot":"","sources":["../../src/tables/inline-editor-extensions.test.ts"],"names":[],"mappings":""}
@@ -1,23 +0,0 @@
1
- import { syntaxTree } from "@codemirror/language";
2
- import { EditorState } from "@codemirror/state";
3
- import { describe, expect, it } from "vitest";
4
- import { createInlineTableMarkdownExtensions } from "./inline-editor-extensions";
5
- describe("createInlineTableMarkdownExtensions", () => {
6
- it("uses the shared Mira Markdown parser for rich table cell editing", () => {
7
- const state = EditorState.create({
8
- doc: [
9
- "**bold** _italic_ `code` [[Project Plan|Plan]] ![[Diagram]] #mira/table",
10
- "\\(x + 1\\)",
11
- ].join("\n"),
12
- extensions: createInlineTableMarkdownExtensions(),
13
- });
14
- const tree = syntaxTree(state).toString();
15
- expect(tree).toContain("StrongEmphasis");
16
- expect(tree).toContain("Emphasis");
17
- expect(tree).toContain("InlineCode");
18
- expect(tree).toContain("WikiLink");
19
- expect(tree).toContain("EmbedLink");
20
- expect(tree).toContain("Tag");
21
- expect(tree).toContain("InlineMathBracket");
22
- });
23
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=pipe-table.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipe-table.test.d.ts","sourceRoot":"","sources":["../../src/tables/pipe-table.test.ts"],"names":[],"mappings":""}
@@ -1,13 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { formatMarkdownTable, parseMarkdownTable } from "./pipe-table";
3
- describe("pipe table parser", () => {
4
- it("parses and formats GFM tables", () => {
5
- const table = parseMarkdownTable("| Package | Status |\n| :--- | ---: |\n| Mira | ready |");
6
- expect(table).toEqual({
7
- header: ["Package", "Status"],
8
- align: ["left", "right"],
9
- rows: [["Mira", "ready"]],
10
- });
11
- expect(formatMarkdownTable(table)).toContain("| Package | Status |");
12
- });
13
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=table-node.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table-node.test.d.ts","sourceRoot":"","sources":["../../src/tables/table-node.test.ts"],"names":[],"mappings":""}
@@ -1,167 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { TableNode } from "./table-node";
3
- function parseTable(markdown) {
4
- const node = TableNode.fromMarkdown(markdown);
5
- expect(node).not.toBeNull();
6
- return node;
7
- }
8
- function reparseTable(node) {
9
- return parseTable(node.toMarkdown());
10
- }
11
- function cellText(node, rowIndex, colIndex) {
12
- const cell = node.getMdastNode().children[rowIndex]?.children[colIndex];
13
- return (cell?.children
14
- .map((child) => ("value" in child ? child.value : ""))
15
- .join("") ?? "");
16
- }
17
- const sampleTable = [
18
- "| Package | Role | Status |",
19
- "| --- | --- | --- |",
20
- "| @lapismd/mira/core | editor controller | ready |",
21
- "| @lapismd/mira/preview | rendered markdown | ready |",
22
- ].join("\n");
23
- describe("TableNode", () => {
24
- it("uses the Lapis table model", () => {
25
- const node = TableNode.fromMarkdown("| A |\n| --- |\n| B |");
26
- expect(node?.getRowCount()).toBe(2);
27
- expect(node?.getColCount()).toBe(1);
28
- });
29
- it("preserves table shape after inserting rows and columns", () => {
30
- const node = parseTable(sampleTable);
31
- node.insertRowAt(node.getRowCount());
32
- node.insertColumnAt(node.getColCount());
33
- expect(node.toMarkdown()).not.toContain("| :- |");
34
- expect(node.toMarkdown()).not.toContain("| - |");
35
- expect(node.toMarkdown()).toContain("| --- |");
36
- const reparsed = reparseTable(node);
37
- expect(reparsed.getRowCount()).toBe(4);
38
- expect(reparsed.getColCount()).toBe(4);
39
- for (const row of reparsed.getMdastNode().children) {
40
- expect(row.children).toHaveLength(4);
41
- }
42
- expect(cellText(reparsed, 0, 0)).toBe("Package");
43
- expect(cellText(reparsed, 1, 1)).toBe("editor controller");
44
- });
45
- it("preserves table shape after moving rows and columns", () => {
46
- const node = parseTable(sampleTable);
47
- node.moveRow(2, 1);
48
- node.moveColumn(2, 0);
49
- const reparsed = reparseTable(node);
50
- expect(reparsed.getRowCount()).toBe(3);
51
- expect(reparsed.getColCount()).toBe(3);
52
- for (const row of reparsed.getMdastNode().children) {
53
- expect(row.children).toHaveLength(3);
54
- }
55
- expect(cellText(reparsed, 0, 0)).toBe("Status");
56
- expect(cellText(reparsed, 1, 1)).toBe("@lapismd/mira/preview");
57
- });
58
- it("exposes MultiMarkdown spans for live-preview display without changing source", () => {
59
- const markdown = [
60
- "| MultiMarkdown | Span | Status |",
61
- "| :--- | :--- | ---: |",
62
- "| Combined cell | | ready |",
63
- "| Persistent row | rendered markdown | ready |",
64
- "| ^ | source-compatible spans | ready |",
65
- ].join("\n");
66
- const node = parseTable(markdown);
67
- const displayRows = node.getDisplayMdastNode().children;
68
- expect(node.hasSpans()).toBe(true);
69
- expect(displayRows[1]?.children).toHaveLength(2);
70
- expect(displayRows[1]?.children[0]?.data?.hProperties?.colSpan).toBe(2);
71
- expect(displayRows[1]?.children[0]?.data?.hProperties).toMatchObject({
72
- sourceRowIndex: 1,
73
- sourceColIndex: 0,
74
- displayColIndex: 0,
75
- });
76
- expect(displayRows[2]?.children).toHaveLength(3);
77
- expect(displayRows[2]?.children[0]?.data?.hProperties?.rowSpan).toBe(2);
78
- expect(displayRows[2]?.children[0]?.data?.hProperties).toMatchObject({
79
- sourceRowIndex: 2,
80
- sourceColIndex: 0,
81
- displayColIndex: 0,
82
- });
83
- expect(displayRows[3]?.children).toHaveLength(2);
84
- expect(displayRows[3]?.children[0]?.data?.hProperties).toMatchObject({
85
- sourceRowIndex: 3,
86
- sourceColIndex: 1,
87
- displayColIndex: 1,
88
- });
89
- expect(displayRows[3]?.children[1]?.data?.hProperties).toMatchObject({
90
- sourceRowIndex: 3,
91
- sourceColIndex: 2,
92
- displayColIndex: 2,
93
- });
94
- expect(cellText(node, 3, 0)).toBe("^");
95
- expect(node.toMarkdown()).toContain("| ^");
96
- const displayCell = displayRows[3].children[0];
97
- const coords = displayCell.data.hProperties;
98
- node.updateCellContents(coords.sourceColIndex, coords.sourceRowIndex, [
99
- { type: "text", value: "edited span cell" },
100
- ]);
101
- expect(cellText(node, 3, 0)).toBe("^");
102
- expect(cellText(node, 3, 1)).toBe("edited span cell");
103
- });
104
- it("keeps trailing empty columns separate from MultiMarkdown colspans", () => {
105
- const node = parseTable(sampleTable);
106
- node.insertColumnAt(node.getColCount());
107
- node.rerender();
108
- const headerRow = node.getDisplayMdastNode().children[0];
109
- const bodyRow = node.getDisplayMdastNode().children[1];
110
- expect(node.hasSpans()).toBe(false);
111
- expect(node.getColCount()).toBe(4);
112
- expect(headerRow?.children).toHaveLength(4);
113
- expect(bodyRow?.children).toHaveLength(4);
114
- expect(headerRow?.children[2]?.data?.hProperties?.colSpan).toBeUndefined();
115
- });
116
- it("keeps MultiMarkdown display spans after clone and rerender", () => {
117
- const node = parseTable([
118
- "| MultiMarkdown | Span | Status |",
119
- "| :--- | :--- | ---: |",
120
- "| Combined cell | | ready |",
121
- "| Persistent row | rendered markdown | ready |",
122
- "| ^ | source-compatible spans | ready |",
123
- ].join("\n"));
124
- const clone = TableNode.clone(node);
125
- clone.rerender();
126
- expect(clone.hasSpans()).toBe(true);
127
- expect(clone.getDisplayMdastNode().children[1]?.children[0]?.data?.hProperties
128
- ?.colSpan).toBe(2);
129
- expect(clone.getDisplayMdastNode().children[2]?.children[0]?.data?.hProperties
130
- ?.rowSpan).toBe(2);
131
- expect(clone.toMarkdown()).toContain("| ^");
132
- });
133
- it("selects display rows and columns across MultiMarkdown spans", () => {
134
- const node = parseTable([
135
- "| MultiMarkdown | Span | Status |",
136
- "| :--- | :--- | ---: |",
137
- "| Combined cell | | ready |",
138
- "| Persistent row | rendered markdown | ready |",
139
- "| ^ | source-compatible spans | ready |",
140
- ].join("\n"));
141
- expect(node.getCellsInDisplayColumn(0)).toEqual([
142
- [0, 0],
143
- [1, 0],
144
- [2, 0],
145
- ]);
146
- expect(node.getCellsInDisplayColumn(1)).toEqual([
147
- [0, 1],
148
- [1, 0],
149
- [2, 1],
150
- [3, 1],
151
- ]);
152
- expect(node.getCellsInDisplayRow(1)).toEqual([
153
- [1, 0],
154
- [1, 2],
155
- ]);
156
- expect(node.getCellsInDisplayRow(3)).toEqual([
157
- [2, 0],
158
- [3, 1],
159
- [3, 2],
160
- ]);
161
- expect(node.getCellsInDisplayRange([1, 1], [3, 1])).toEqual([
162
- [1, 0],
163
- [2, 1],
164
- [3, 1],
165
- ]);
166
- });
167
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=source-button.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-button.test.d.ts","sourceRoot":"","sources":["../../../src/tables/widgets/source-button.test.ts"],"names":[],"mappings":""}
@@ -1,11 +0,0 @@
1
- import { describe, expect, it, vi } from "vitest";
2
- import { createSourceButton } from "./source-button";
3
- describe("table source button", () => {
4
- it("calls the source callback from the widget affordance", () => {
5
- const onSource = vi.fn();
6
- const button = createSourceButton(onSource);
7
- button.click();
8
- expect(button.className).toContain("mira-table-widget__source-toggle");
9
- expect(onSource).toHaveBeenCalledTimes(1);
10
- });
11
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=theme-contract.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme-contract.test.d.ts","sourceRoot":"","sources":["../../src/themes/theme-contract.test.ts"],"names":[],"mappings":""}
@@ -1,88 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { describe, expect, it } from "vitest";
3
- const read = (relativePath) => readFileSync(new URL(relativePath, import.meta.url), "utf8");
4
- describe("Mira theme CSS contract", () => {
5
- it("keeps the Mira palette sentinels and defines both color modes", () => {
6
- const source = read("./_mira-palette.css");
7
- expect(source).toContain("light-dark(#fbfbfc, #17181c)");
8
- expect(source).toContain("light-dark(#0f766e, #2dd4bf)");
9
- expect(source).toContain("--mira-focus-ring: var(--mira-accent)");
10
- expect(source).toContain("--mira-callout-default: var(--_mira-callout-default-light)");
11
- expect(source).toContain('[data-mira-color-mode="dark"]');
12
- expect(source).not.toMatch(/--mira-callout-(?!background\b)[\w-]+:\s*light-dark\(/u);
13
- expect(source).not.toMatch(/--mira-widget-shadow:\s*light-dark\(/u);
14
- });
15
- it("maps the distinct Lapis Obsidian palette", () => {
16
- const source = read("./_obsidian-palette.css");
17
- expect(source).toContain('data-mira-theme~="obsidian"');
18
- expect(source).toContain("light-dark(#ffffff, #1e1e1e)");
19
- expect(source).toContain("light-dark(#222222, #dadada)");
20
- expect(source).toContain("light-dark(hsl(257 88.88% 70.95%), #7852ee)");
21
- expect(source).toContain("--mira-syntax-string: light-dark(#007a58, #53dfdd)");
22
- expect(source).not.toContain("#008f67");
23
- expect(source).not.toContain("light-dark(#fbfbfc, #17181c)");
24
- expect(source).toContain("--mira-callout-default: var(--_mira-callout-default-light)");
25
- expect(source).toContain('[data-mira-theme~="obsidian"][data-mira-color-mode="dark"]');
26
- expect(source).not.toMatch(/--mira-callout-(?!background\b)[\w-]+:\s*light-dark\(/u);
27
- expect(source).not.toMatch(/--mira-widget-shadow:\s*light-dark\(/u);
28
- });
29
- it("loads the contract, Mira fallback, and Obsidian override in order", () => {
30
- const source = read("../themes.css");
31
- const contract = source.indexOf("./themes/_contract.css");
32
- const mira = source.indexOf("./themes/_mira-palette.css");
33
- const obsidian = source.indexOf("./themes/_obsidian-palette.css");
34
- expect(contract).toBeGreaterThanOrEqual(0);
35
- expect(mira).toBeGreaterThan(contract);
36
- expect(obsidian).toBeGreaterThan(mira);
37
- });
38
- it("lets inherited light and dark classes override the root system mode", () => {
39
- const source = read("./_contract.css");
40
- expect(source).toContain(":is(.dark, .theme-dark)");
41
- expect(source).toContain(":is(.light, .theme-light)");
42
- expect(source).not.toContain(":where(.dark, .theme-dark)");
43
- expect(source).not.toContain(":where(.light, .theme-light)");
44
- });
45
- it("exports aggregate and individual theme entrypoints", () => {
46
- const manifest = JSON.parse(read("../../package.json"));
47
- expect(manifest.exports).toHaveProperty("./themes/mira.css");
48
- expect(manifest.exports).toHaveProperty("./themes/obsidian.css");
49
- expect(manifest.exports).toHaveProperty("./themes.css");
50
- });
51
- it("uses the theme-primary embed accent for blockquote guides", () => {
52
- const tokens = read("../preview/styles/tokens.css");
53
- const embeds = read("../preview/styles/links-embeds-tags.css");
54
- expect(tokens).toContain("--blockquote-border-color: var(--interactive-accent)");
55
- expect(embeds).toContain("border-inline-start: 2px solid var(--interactive-accent)");
56
- });
57
- it("exposes the complete Lapis-compatible per-level heading contract", () => {
58
- const contract = read("./_contract.css");
59
- const tokens = read("../preview/styles/tokens.css");
60
- const headings = read("../preview/styles/headings.css");
61
- const sizes = [
62
- "1.802em",
63
- "1.602em",
64
- "1.424em",
65
- "1.266em",
66
- "1.125em",
67
- "1em",
68
- ];
69
- const lineHeights = ["1.2", "1.2", "1.3", "1.4", "1.5", "1.5"];
70
- const weights = ["700", "600", "600", "600", "600", "600"];
71
- expect(contract).toContain("--mira-heading-color: var(--mira-foreground)");
72
- for (let index = 0; index < 6; index += 1) {
73
- const level = index + 1;
74
- expect(contract).toContain(`--mira-h${level}-color: var(--mira-heading-color)`);
75
- expect(contract).toContain(`--mira-h${level}-font: var(--mira-font-sans)`);
76
- expect(contract).toContain(`--mira-h${level}-size: ${sizes[index]}`);
77
- expect(contract).toContain(`--mira-h${level}-line-height: ${lineHeights[index]}`);
78
- expect(contract).toContain(`--mira-h${level}-style: normal`);
79
- expect(contract).toContain(`--mira-h${level}-variant: normal`);
80
- expect(contract).toContain(`--mira-h${level}-weight: ${weights[index]}`);
81
- expect(tokens).toContain(`--h${level}-color: var(--mira-h${level}-color)`);
82
- expect(tokens).toContain(`--h${level}-weight: var(--mira-h${level}-weight)`);
83
- }
84
- expect(headings).toContain(".cm-heading:not(.cm-meta)");
85
- expect(headings).toContain("color: inherit");
86
- expect(headings).toContain("font-weight: inherit");
87
- });
88
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/ui/index.test.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { cn } from ".";
3
- describe("cn", () => {
4
- it("merges class values", () => {
5
- expect(cn("a", false, "b")).toBe("a b");
6
- });
7
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=styles.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.test.d.ts","sourceRoot":"","sources":["../../src/ui/styles.test.ts"],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { describe, expect, it } from "vitest";
3
- const readSource = (relativePath) => readFileSync(new URL(relativePath, import.meta.url), "utf8");
4
- describe("Mira UI style boundaries", () => {
5
- it("scopes dialog overlay paint to Mira-owned overlays", () => {
6
- const styles = readSource("./styles.css");
7
- const overlay = readSource("./dialog/dialog-overlay.svelte");
8
- expect(styles).toContain('[data-mira-overlay][data-slot="dialog-overlay"]');
9
- expect(styles).not.toMatch(/(?:^|\n)\[data-slot="dialog-(?:overlay|content|title|description|header|footer)"\]/u);
10
- expect(overlay).toContain("data-mira-overlay");
11
- });
12
- it("scopes popover paint to Mira-owned overlays", () => {
13
- const styles = readSource("./styles.css");
14
- const popover = readSource("./popover/popover-content.svelte");
15
- expect(styles).toContain('[data-mira-overlay][data-slot="popover-content"]');
16
- expect(styles).not.toMatch(/(?:^|\n)\[data-slot="popover-content"\]\s*\{/u);
17
- expect(popover).toContain("data-mira-overlay");
18
- });
19
- it("scopes tooltip paint to Mira-owned overlays", () => {
20
- const styles = readSource("./styles.css");
21
- const tooltip = readSource("./tooltip/tooltip-content.svelte");
22
- expect(styles).toContain('[data-mira-overlay][data-slot="tooltip-content"]');
23
- expect(styles).not.toMatch(/(?:^|\n)\[data-slot="tooltip-content"\]/u);
24
- expect(tooltip).toContain("data-mira-overlay");
25
- });
26
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=table-dnd-utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table-dnd-utils.test.d.ts","sourceRoot":"","sources":["../../../src/ui/table-dnd/table-dnd-utils.test.ts"],"names":[],"mappings":""}
@@ -1,46 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { dropIndicatorClasses, isColumnDragSource, isRowDragSource, parseTableDragData, resolveTableDragTargetIndex, tableColDragType, tableRowDragType, } from "./table-dnd-utils";
3
- const rowType = tableRowDragType("csv");
4
- const colType = tableColDragType("csv");
5
- describe("dropIndicatorClasses", () => {
6
- it("marks column drop to the right", () => {
7
- expect(dropIndicatorClasses({ type: colType, index: 1 }, 3, 0, 3, rowType, colType)).toBe("is-dragging-right");
8
- });
9
- it("marks row drop above", () => {
10
- expect(dropIndicatorClasses({ type: rowType, index: 3 }, 1, 1, 0, rowType, colType)).toBe("is-dragging-top");
11
- });
12
- it("detects active row and column drag sources", () => {
13
- expect(isRowDragSource({ type: rowType, index: 2 }, 2, rowType)).toBe(true);
14
- expect(isRowDragSource({ type: rowType, index: 2 }, 1, rowType)).toBe(false);
15
- expect(isColumnDragSource({ type: colType, index: 1 }, 1, colType)).toBe(true);
16
- expect(isColumnDragSource({ type: colType, index: 1 }, 0, colType)).toBe(false);
17
- });
18
- });
19
- describe("parseTableDragData", () => {
20
- it("reads drag data from operation payload", () => {
21
- expect(parseTableDragData({
22
- data: { type: rowType, index: 2 },
23
- }, rowType, colType)).toEqual({ type: rowType, index: 2 });
24
- });
25
- it("parses csv-style drop ids", () => {
26
- expect(parseTableDragData({ id: "csv-row-drop:1:grip" }, rowType, colType)).toEqual({ type: rowType, index: 1 });
27
- });
28
- });
29
- describe("resolveTableDragTargetIndex", () => {
30
- it("prefers explicit drop target over dragOverIndex", () => {
31
- expect(resolveTableDragTargetIndex({
32
- operation: {
33
- source: { data: { type: rowType, index: 1 } },
34
- target: { data: { type: rowType, index: 3 } },
35
- },
36
- }, 2, rowType, colType)).toBe(3);
37
- });
38
- it("falls back to dragOverIndex", () => {
39
- expect(resolveTableDragTargetIndex({
40
- operation: {
41
- source: { data: { type: rowType, index: 1 } },
42
- target: null,
43
- },
44
- }, 3, rowType, colType)).toBe(3);
45
- });
46
- });