@joewinke/jatui 0.36.3 → 0.38.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 (271) hide show
  1. package/dist/artifact-blocks/AttachmentChip.svelte +66 -0
  2. package/dist/artifact-blocks/AttachmentChip.svelte.d.ts +7 -0
  3. package/dist/artifact-blocks/BlockComments.svelte +309 -0
  4. package/dist/artifact-blocks/BlockComments.svelte.d.ts +33 -0
  5. package/dist/artifact-blocks/BlockRenderer.svelte +674 -0
  6. package/dist/artifact-blocks/BlockRenderer.svelte.d.ts +55 -0
  7. package/dist/artifact-blocks/BlockVerdict.svelte +151 -0
  8. package/dist/artifact-blocks/BlockVerdict.svelte.d.ts +13 -0
  9. package/dist/artifact-blocks/BlocksArtifactView.svelte +1616 -0
  10. package/dist/artifact-blocks/BlocksArtifactView.svelte.d.ts +113 -0
  11. package/dist/artifact-blocks/CONTRACT.md +225 -0
  12. package/dist/artifact-blocks/CommentPill.svelte +49 -0
  13. package/dist/artifact-blocks/CommentPill.svelte.d.ts +16 -0
  14. package/dist/artifact-blocks/FoldedRounds.svelte +95 -0
  15. package/dist/artifact-blocks/FoldedRounds.svelte.d.ts +9 -0
  16. package/dist/artifact-blocks/Glyph.svelte +54 -0
  17. package/dist/artifact-blocks/Glyph.svelte.d.ts +10 -0
  18. package/dist/artifact-blocks/HistoryScrubber.svelte +500 -0
  19. package/dist/artifact-blocks/HistoryScrubber.svelte.d.ts +15 -0
  20. package/dist/artifact-blocks/Markdown.svelte +186 -0
  21. package/dist/artifact-blocks/Markdown.svelte.d.ts +30 -0
  22. package/dist/artifact-blocks/NoteComposer.svelte +31 -0
  23. package/dist/artifact-blocks/NoteComposer.svelte.d.ts +8 -0
  24. package/dist/artifact-blocks/PlainComposer.svelte +200 -0
  25. package/dist/artifact-blocks/PlainComposer.svelte.d.ts +15 -0
  26. package/dist/artifact-blocks/SectionTools.svelte +102 -0
  27. package/dist/artifact-blocks/SectionTools.svelte.d.ts +19 -0
  28. package/dist/artifact-blocks/adapter.d.ts +13 -0
  29. package/dist/artifact-blocks/adapter.js +31 -0
  30. package/dist/artifact-blocks/autoSend.d.ts +49 -0
  31. package/dist/artifact-blocks/autoSend.js +103 -0
  32. package/dist/artifact-blocks/blocks/actions/ActionsBlock.svelte +557 -0
  33. package/dist/artifact-blocks/blocks/actions/ActionsBlock.svelte.d.ts +48 -0
  34. package/dist/artifact-blocks/blocks/actions/block.d.ts +8 -0
  35. package/dist/artifact-blocks/blocks/actions/block.js +74 -0
  36. package/dist/artifact-blocks/blocks/actions/requests.d.ts +62 -0
  37. package/dist/artifact-blocks/blocks/actions/requests.js +26 -0
  38. package/dist/artifact-blocks/blocks/actions/schema.d.ts +168 -0
  39. package/dist/artifact-blocks/blocks/actions/schema.js +253 -0
  40. package/dist/artifact-blocks/blocks/callout/CalloutBlock.svelte +779 -0
  41. package/dist/artifact-blocks/blocks/callout/CalloutBlock.svelte.d.ts +40 -0
  42. package/dist/artifact-blocks/blocks/callout/block.d.ts +7 -0
  43. package/dist/artifact-blocks/blocks/callout/block.js +39 -0
  44. package/dist/artifact-blocks/blocks/callout/schema.d.ts +72 -0
  45. package/dist/artifact-blocks/blocks/callout/schema.js +115 -0
  46. package/dist/artifact-blocks/blocks/chart/ChartBlock.svelte +875 -0
  47. package/dist/artifact-blocks/blocks/chart/ChartBlock.svelte.d.ts +59 -0
  48. package/dist/artifact-blocks/blocks/chart/block.d.ts +9 -0
  49. package/dist/artifact-blocks/blocks/chart/block.js +70 -0
  50. package/dist/artifact-blocks/blocks/chart/schema.d.ts +171 -0
  51. package/dist/artifact-blocks/blocks/chart/schema.js +498 -0
  52. package/dist/artifact-blocks/blocks/chart/thumb.d.ts +2 -0
  53. package/dist/artifact-blocks/blocks/chart/thumb.js +201 -0
  54. package/dist/artifact-blocks/blocks/checklist/ChecklistBlock.svelte +1048 -0
  55. package/dist/artifact-blocks/blocks/checklist/ChecklistBlock.svelte.d.ts +16 -0
  56. package/dist/artifact-blocks/blocks/checklist/Icon.svelte +105 -0
  57. package/dist/artifact-blocks/blocks/checklist/Icon.svelte.d.ts +17 -0
  58. package/dist/artifact-blocks/blocks/checklist/block.d.ts +10 -0
  59. package/dist/artifact-blocks/blocks/checklist/block.js +63 -0
  60. package/dist/artifact-blocks/blocks/checklist/itemReview.d.ts +16 -0
  61. package/dist/artifact-blocks/blocks/checklist/itemReview.js +63 -0
  62. package/dist/artifact-blocks/blocks/checklist/labels.d.ts +62 -0
  63. package/dist/artifact-blocks/blocks/checklist/labels.js +96 -0
  64. package/dist/artifact-blocks/blocks/checklist/retest.d.ts +43 -0
  65. package/dist/artifact-blocks/blocks/checklist/retest.js +68 -0
  66. package/dist/artifact-blocks/blocks/checklist/schema.d.ts +84 -0
  67. package/dist/artifact-blocks/blocks/checklist/schema.js +91 -0
  68. package/dist/artifact-blocks/blocks/code/CodeBlock.svelte +128 -0
  69. package/dist/artifact-blocks/blocks/code/CodeBlock.svelte.d.ts +12 -0
  70. package/dist/artifact-blocks/blocks/code/block.d.ts +8 -0
  71. package/dist/artifact-blocks/blocks/code/block.js +31 -0
  72. package/dist/artifact-blocks/blocks/code/highlight.d.ts +34 -0
  73. package/dist/artifact-blocks/blocks/code/highlight.js +280 -0
  74. package/dist/artifact-blocks/blocks/code/schema.d.ts +32 -0
  75. package/dist/artifact-blocks/blocks/code/schema.js +39 -0
  76. package/dist/artifact-blocks/blocks/collage/CollageBlock.svelte +290 -0
  77. package/dist/artifact-blocks/blocks/collage/CollageBlock.svelte.d.ts +29 -0
  78. package/dist/artifact-blocks/blocks/collage/block.d.ts +9 -0
  79. package/dist/artifact-blocks/blocks/collage/block.js +29 -0
  80. package/dist/artifact-blocks/blocks/collage/schema.d.ts +52 -0
  81. package/dist/artifact-blocks/blocks/collage/schema.js +86 -0
  82. package/dist/artifact-blocks/blocks/compare/CompareBlock.svelte +484 -0
  83. package/dist/artifact-blocks/blocks/compare/CompareBlock.svelte.d.ts +25 -0
  84. package/dist/artifact-blocks/blocks/compare/block.d.ts +9 -0
  85. package/dist/artifact-blocks/blocks/compare/block.js +32 -0
  86. package/dist/artifact-blocks/blocks/compare/schema.d.ts +74 -0
  87. package/dist/artifact-blocks/blocks/compare/schema.js +148 -0
  88. package/dist/artifact-blocks/blocks/diagram/DiagramBlock.svelte +392 -0
  89. package/dist/artifact-blocks/blocks/diagram/DiagramBlock.svelte.d.ts +30 -0
  90. package/dist/artifact-blocks/blocks/diagram/block.d.ts +9 -0
  91. package/dist/artifact-blocks/blocks/diagram/block.js +50 -0
  92. package/dist/artifact-blocks/blocks/diagram/constants.d.ts +48 -0
  93. package/dist/artifact-blocks/blocks/diagram/constants.js +53 -0
  94. package/dist/artifact-blocks/blocks/diagram/schema.d.ts +161 -0
  95. package/dist/artifact-blocks/blocks/diagram/schema.js +621 -0
  96. package/dist/artifact-blocks/blocks/diagram/thumb.d.ts +2 -0
  97. package/dist/artifact-blocks/blocks/diagram/thumb.js +157 -0
  98. package/dist/artifact-blocks/blocks/diagram/types.d.ts +74 -0
  99. package/dist/artifact-blocks/blocks/diagram/types.js +1 -0
  100. package/dist/artifact-blocks/blocks/diff/DiffBlock.svelte +81 -0
  101. package/dist/artifact-blocks/blocks/diff/DiffBlock.svelte.d.ts +10 -0
  102. package/dist/artifact-blocks/blocks/diff/block.d.ts +7 -0
  103. package/dist/artifact-blocks/blocks/diff/block.js +36 -0
  104. package/dist/artifact-blocks/blocks/diff/schema.d.ts +18 -0
  105. package/dist/artifact-blocks/blocks/diff/schema.js +35 -0
  106. package/dist/artifact-blocks/blocks/diff-review/DiffReviewBlock.svelte +1055 -0
  107. package/dist/artifact-blocks/blocks/diff-review/DiffReviewBlock.svelte.d.ts +5 -0
  108. package/dist/artifact-blocks/blocks/diff-review/block.d.ts +15 -0
  109. package/dist/artifact-blocks/blocks/diff-review/block.js +64 -0
  110. package/dist/artifact-blocks/blocks/diff-review/decisions.d.ts +57 -0
  111. package/dist/artifact-blocks/blocks/diff-review/decisions.js +80 -0
  112. package/dist/artifact-blocks/blocks/diff-review/schema.d.ts +13 -0
  113. package/dist/artifact-blocks/blocks/diff-review/schema.js +84 -0
  114. package/dist/artifact-blocks/blocks/diff-review/types.d.ts +35 -0
  115. package/dist/artifact-blocks/blocks/diff-review/types.js +1 -0
  116. package/dist/artifact-blocks/blocks/explainer/ExplainerBlock.svelte +145 -0
  117. package/dist/artifact-blocks/blocks/explainer/ExplainerBlock.svelte.d.ts +5 -0
  118. package/dist/artifact-blocks/blocks/explainer/block.d.ts +8 -0
  119. package/dist/artifact-blocks/blocks/explainer/block.js +21 -0
  120. package/dist/artifact-blocks/blocks/explainer/schema.d.ts +26 -0
  121. package/dist/artifact-blocks/blocks/explainer/schema.js +69 -0
  122. package/dist/artifact-blocks/blocks/group-content.d.ts +10 -0
  123. package/dist/artifact-blocks/blocks/group-content.js +16 -0
  124. package/dist/artifact-blocks/blocks/group-data.d.ts +10 -0
  125. package/dist/artifact-blocks/blocks/group-data.js +7 -0
  126. package/dist/artifact-blocks/blocks/group-review.d.ts +10 -0
  127. package/dist/artifact-blocks/blocks/group-review.js +12 -0
  128. package/dist/artifact-blocks/blocks/group-visual.d.ts +17 -0
  129. package/dist/artifact-blocks/blocks/group-visual.js +14 -0
  130. package/dist/artifact-blocks/blocks/map/MapBlock.svelte +413 -0
  131. package/dist/artifact-blocks/blocks/map/MapBlock.svelte.d.ts +53 -0
  132. package/dist/artifact-blocks/blocks/map/block.d.ts +9 -0
  133. package/dist/artifact-blocks/blocks/map/block.js +62 -0
  134. package/dist/artifact-blocks/blocks/map/schema.d.ts +123 -0
  135. package/dist/artifact-blocks/blocks/map/schema.js +113 -0
  136. package/dist/artifact-blocks/blocks/map/thumb.d.ts +2 -0
  137. package/dist/artifact-blocks/blocks/map/thumb.js +69 -0
  138. package/dist/artifact-blocks/blocks/markdown/MarkdownBlock.svelte +33 -0
  139. package/dist/artifact-blocks/blocks/markdown/MarkdownBlock.svelte.d.ts +15 -0
  140. package/dist/artifact-blocks/blocks/markdown/block.d.ts +7 -0
  141. package/dist/artifact-blocks/blocks/markdown/block.js +28 -0
  142. package/dist/artifact-blocks/blocks/markdown/render.d.ts +17 -0
  143. package/dist/artifact-blocks/blocks/markdown/render.js +115 -0
  144. package/dist/artifact-blocks/blocks/markdown/schema.d.ts +10 -0
  145. package/dist/artifact-blocks/blocks/markdown/schema.js +23 -0
  146. package/dist/artifact-blocks/blocks/media-picker/MediaPickerBlock.svelte +2112 -0
  147. package/dist/artifact-blocks/blocks/media-picker/MediaPickerBlock.svelte.d.ts +5 -0
  148. package/dist/artifact-blocks/blocks/media-picker/block.d.ts +24 -0
  149. package/dist/artifact-blocks/blocks/media-picker/block.js +137 -0
  150. package/dist/artifact-blocks/blocks/media-picker/choices.d.ts +28 -0
  151. package/dist/artifact-blocks/blocks/media-picker/choices.js +35 -0
  152. package/dist/artifact-blocks/blocks/media-picker/decisions.d.ts +51 -0
  153. package/dist/artifact-blocks/blocks/media-picker/decisions.js +75 -0
  154. package/dist/artifact-blocks/blocks/media-picker/schema.d.ts +7 -0
  155. package/dist/artifact-blocks/blocks/media-picker/schema.js +199 -0
  156. package/dist/artifact-blocks/blocks/media-picker/types.d.ts +92 -0
  157. package/dist/artifact-blocks/blocks/media-picker/types.js +1 -0
  158. package/dist/artifact-blocks/blocks/media-picker/versions.d.ts +51 -0
  159. package/dist/artifact-blocks/blocks/media-picker/versions.js +118 -0
  160. package/dist/artifact-blocks/blocks/mockup/MockupBlock.svelte +213 -0
  161. package/dist/artifact-blocks/blocks/mockup/MockupBlock.svelte.d.ts +5 -0
  162. package/dist/artifact-blocks/blocks/mockup/block.d.ts +26 -0
  163. package/dist/artifact-blocks/blocks/mockup/block.js +52 -0
  164. package/dist/artifact-blocks/blocks/mockup/doc.d.ts +24 -0
  165. package/dist/artifact-blocks/blocks/mockup/doc.js +44 -0
  166. package/dist/artifact-blocks/blocks/mockup/sandbox.d.ts +21 -0
  167. package/dist/artifact-blocks/blocks/mockup/sandbox.js +27 -0
  168. package/dist/artifact-blocks/blocks/mockup/schema.d.ts +7 -0
  169. package/dist/artifact-blocks/blocks/mockup/schema.js +90 -0
  170. package/dist/artifact-blocks/blocks/mockup/types.d.ts +36 -0
  171. package/dist/artifact-blocks/blocks/mockup/types.js +17 -0
  172. package/dist/artifact-blocks/blocks/program/ProgramBlock.svelte +359 -0
  173. package/dist/artifact-blocks/blocks/program/ProgramBlock.svelte.d.ts +32 -0
  174. package/dist/artifact-blocks/blocks/program/block.d.ts +35 -0
  175. package/dist/artifact-blocks/blocks/program/block.js +68 -0
  176. package/dist/artifact-blocks/blocks/program/schema.d.ts +132 -0
  177. package/dist/artifact-blocks/blocks/program/schema.js +268 -0
  178. package/dist/artifact-blocks/blocks/stats/StatsBlock.svelte +315 -0
  179. package/dist/artifact-blocks/blocks/stats/StatsBlock.svelte.d.ts +24 -0
  180. package/dist/artifact-blocks/blocks/stats/block.d.ts +7 -0
  181. package/dist/artifact-blocks/blocks/stats/block.js +49 -0
  182. package/dist/artifact-blocks/blocks/stats/schema.d.ts +82 -0
  183. package/dist/artifact-blocks/blocks/stats/schema.js +43 -0
  184. package/dist/artifact-blocks/blocks/stats/thumb.d.ts +2 -0
  185. package/dist/artifact-blocks/blocks/stats/thumb.js +102 -0
  186. package/dist/artifact-blocks/blocks/table/TableBlock.svelte +490 -0
  187. package/dist/artifact-blocks/blocks/table/TableBlock.svelte.d.ts +28 -0
  188. package/dist/artifact-blocks/blocks/table/block.d.ts +9 -0
  189. package/dist/artifact-blocks/blocks/table/block.js +100 -0
  190. package/dist/artifact-blocks/blocks/table/schema.d.ts +143 -0
  191. package/dist/artifact-blocks/blocks/table/schema.js +278 -0
  192. package/dist/artifact-blocks/blocks/timeline/TimelineBlock.svelte +347 -0
  193. package/dist/artifact-blocks/blocks/timeline/TimelineBlock.svelte.d.ts +42 -0
  194. package/dist/artifact-blocks/blocks/timeline/block.d.ts +9 -0
  195. package/dist/artifact-blocks/blocks/timeline/block.js +96 -0
  196. package/dist/artifact-blocks/blocks/timeline/constants.d.ts +26 -0
  197. package/dist/artifact-blocks/blocks/timeline/constants.js +27 -0
  198. package/dist/artifact-blocks/blocks/timeline/schema.d.ts +102 -0
  199. package/dist/artifact-blocks/blocks/timeline/schema.js +405 -0
  200. package/dist/artifact-blocks/blocks/timeline/thumb.d.ts +2 -0
  201. package/dist/artifact-blocks/blocks/timeline/thumb.js +117 -0
  202. package/dist/artifact-blocks/blocks/timeline/types.d.ts +66 -0
  203. package/dist/artifact-blocks/blocks/timeline/types.js +1 -0
  204. package/dist/artifact-blocks/blocks/transcript/TranscriptBlock.svelte +169 -0
  205. package/dist/artifact-blocks/blocks/transcript/TranscriptBlock.svelte.d.ts +26 -0
  206. package/dist/artifact-blocks/blocks/transcript/block.d.ts +9 -0
  207. package/dist/artifact-blocks/blocks/transcript/block.js +86 -0
  208. package/dist/artifact-blocks/blocks/transcript/schema.d.ts +114 -0
  209. package/dist/artifact-blocks/blocks/transcript/schema.js +126 -0
  210. package/dist/artifact-blocks/builtins.d.ts +40 -0
  211. package/dist/artifact-blocks/builtins.js +22 -0
  212. package/dist/artifact-blocks/contractBlocks.d.ts +92 -0
  213. package/dist/artifact-blocks/contractBlocks.js +279 -0
  214. package/dist/artifact-blocks/history.d.ts +140 -0
  215. package/dist/artifact-blocks/history.js +363 -0
  216. package/dist/artifact-blocks/index.d.ts +40 -0
  217. package/dist/artifact-blocks/index.js +46 -0
  218. package/dist/artifact-blocks/listen/context.d.ts +30 -0
  219. package/dist/artifact-blocks/listen/context.js +30 -0
  220. package/dist/artifact-blocks/liveData.d.ts +78 -0
  221. package/dist/artifact-blocks/liveData.js +137 -0
  222. package/dist/artifact-blocks/liveDataPoller.d.ts +41 -0
  223. package/dist/artifact-blocks/liveDataPoller.js +140 -0
  224. package/dist/artifact-blocks/openNav.d.ts +46 -0
  225. package/dist/artifact-blocks/openNav.js +106 -0
  226. package/dist/artifact-blocks/pageReviewKeys.d.ts +17 -0
  227. package/dist/artifact-blocks/pageReviewKeys.js +115 -0
  228. package/dist/artifact-blocks/params.d.ts +98 -0
  229. package/dist/artifact-blocks/params.js +159 -0
  230. package/dist/artifact-blocks/registry.d.ts +27 -0
  231. package/dist/artifact-blocks/registry.js +83 -0
  232. package/dist/artifact-blocks/review/BlockIcon.svelte +99 -0
  233. package/dist/artifact-blocks/review/BlockIcon.svelte.d.ts +17 -0
  234. package/dist/artifact-blocks/review/BulkRejectForm.svelte +94 -0
  235. package/dist/artifact-blocks/review/BulkRejectForm.svelte.d.ts +11 -0
  236. package/dist/artifact-blocks/review/BulkUndoBar.svelte +40 -0
  237. package/dist/artifact-blocks/review/BulkUndoBar.svelte.d.ts +9 -0
  238. package/dist/artifact-blocks/review/ItemNote.svelte +193 -0
  239. package/dist/artifact-blocks/review/ItemNote.svelte.d.ts +33 -0
  240. package/dist/artifact-blocks/review/NoteToggle.svelte +52 -0
  241. package/dist/artifact-blocks/review/NoteToggle.svelte.d.ts +12 -0
  242. package/dist/artifact-blocks/review/TeamChip.svelte +71 -0
  243. package/dist/artifact-blocks/review/TeamChip.svelte.d.ts +8 -0
  244. package/dist/artifact-blocks/review/attachments.d.ts +10 -0
  245. package/dist/artifact-blocks/review/attachments.js +37 -0
  246. package/dist/artifact-blocks/review/bulk.d.ts +52 -0
  247. package/dist/artifact-blocks/review/bulk.js +61 -0
  248. package/dist/artifact-blocks/review/itemReview.d.ts +33 -0
  249. package/dist/artifact-blocks/review/itemReview.js +112 -0
  250. package/dist/artifact-blocks/review/roundLines.d.ts +14 -0
  251. package/dist/artifact-blocks/review/roundLines.js +20 -0
  252. package/dist/artifact-blocks/review/rounds.d.ts +86 -0
  253. package/dist/artifact-blocks/review/rounds.js +302 -0
  254. package/dist/artifact-blocks/review/saver.d.ts +23 -0
  255. package/dist/artifact-blocks/review/saver.js +48 -0
  256. package/dist/artifact-blocks/review/team.d.ts +31 -0
  257. package/dist/artifact-blocks/review/team.js +42 -0
  258. package/dist/artifact-blocks/review/visualOrder.d.ts +29 -0
  259. package/dist/artifact-blocks/review/visualOrder.js +66 -0
  260. package/dist/artifact-blocks/review.d.ts +180 -0
  261. package/dist/artifact-blocks/review.js +716 -0
  262. package/dist/artifact-blocks/thumb-kit.d.ts +80 -0
  263. package/dist/artifact-blocks/thumb-kit.js +149 -0
  264. package/dist/artifact-blocks/types.d.ts +513 -0
  265. package/dist/artifact-blocks/types.js +1 -0
  266. package/dist/components/Button.svelte +8 -0
  267. package/dist/components/TextInput.svelte +39 -6
  268. package/dist/components/TextInput.svelte.d.ts +15 -7
  269. package/dist/components/basic/Checkbox.svelte +52 -14
  270. package/dist/components/basic/Checkbox.svelte.d.ts +11 -1
  271. package/package.json +11 -2
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Diagram block thumbnail composer (mos-qkpva).
3
+ *
4
+ * The same layout the component draws — layoutFlow/layoutSequence from
5
+ * ./schema.ts (dagre when the engine resolves, the layered fallback
6
+ * otherwise) — as a simplified silhouette: node shapes with the component's
7
+ * tone opacities, edges with arrowheads, and node labels at a size meant to
8
+ * survive downscaling better than nothing. No structure table, no title:
9
+ * the thumbnail says "this row is a diagram", the shapes say what kind.
10
+ */
11
+ import * as dagreNs from "@dagrejs/dagre";
12
+ import { diagramParamsSchema, resolveDagre, layoutFlow, layoutSequence, kindShape, kindDashed, nodeTextLines, } from "./schema.js";
13
+ import { SEQ_ACTOR_H, VIEW_PAD } from "./constants";
14
+ import { r1, thumbText, thumbTruncate, toneColor, } from "../../thumb-kit.js";
15
+ /** The components' static tone maps, resolved to concrete color+opacity. */
16
+ function nodeFill(palette, tone) {
17
+ if (tone === "neutral" || tone === undefined)
18
+ return {
19
+ fill: tone === "neutral" ? palette.ink : palette.primary,
20
+ opacity: tone === "neutral" ? 0.08 : 0.12,
21
+ };
22
+ return { fill: toneColor(palette, tone), opacity: 0.12 };
23
+ }
24
+ function nodeStroke(palette, tone) {
25
+ if (tone === "neutral" || tone === undefined)
26
+ return { stroke: palette.ink, opacity: tone === "neutral" ? 0.3 : 0.6 };
27
+ return { stroke: toneColor(palette, tone), opacity: 0.6 };
28
+ }
29
+ function edgeStroke(palette, tone) {
30
+ if (tone === "neutral" || tone === undefined)
31
+ return { stroke: palette.ink, opacity: tone === "neutral" ? 0.4 : 0.7 };
32
+ return { stroke: toneColor(palette, tone), opacity: 0.7 };
33
+ }
34
+ export function drawDiagramThumb(raw, palette) {
35
+ const parsed = diagramParamsSchema.safeParse(raw);
36
+ if (!parsed.success)
37
+ return null;
38
+ const params = parsed.data;
39
+ if (params.nodes.length === 0)
40
+ return null;
41
+ const isSeq = params.mode === "sequence";
42
+ const dagre = resolveDagre(dagreNs);
43
+ const seq = isSeq ? layoutSequence(params) : null;
44
+ const flow = isSeq ? null : layoutFlow(params, dagre);
45
+ if (!seq && !flow)
46
+ return null;
47
+ const W = Math.max(80, (seq ?? flow)?.width ?? 80);
48
+ const H = Math.max(60, (seq ?? flow)?.height ?? 60);
49
+ const out = [];
50
+ const nodeShape = (b) => b.shape ?? kindShape(b.kind);
51
+ /** One node's silhouette at its laid-out box. */
52
+ function drawNode(b) {
53
+ const f = nodeFill(palette, b.tone);
54
+ const s = nodeStroke(palette, b.tone);
55
+ const shape = nodeShape(b);
56
+ const strokeAttrs = `fill="${f.fill}" fill-opacity="${f.opacity}" stroke="${s.stroke}" stroke-opacity="${s.opacity}" stroke-width="1.5"`;
57
+ if (shape === "diamond") {
58
+ const cx = b.x + b.w / 2;
59
+ const cy = b.y + b.h / 2;
60
+ out.push(`<polygon points="${r1(cx)},${r1(b.y)} ${r1(b.x + b.w)},${r1(cy)} ${r1(cx)},${r1(b.y + b.h)} ${r1(b.x)},${r1(cy)}" ${strokeAttrs}/>`);
61
+ }
62
+ else if (shape === "circle") {
63
+ out.push(`<ellipse cx="${r1(b.x + b.w / 2)}" cy="${r1(b.y + b.h / 2)}" rx="${r1(b.w / 2)}" ry="${r1(b.h / 2)}" ${strokeAttrs}/>`);
64
+ }
65
+ else {
66
+ const rx = shape === "pill" || shape === "stadium" ? Math.min(b.h / 2, 18) : 6;
67
+ const dashed = kindDashed(b.kind)
68
+ ? ` stroke-dasharray="5 4"`
69
+ : "";
70
+ out.push(`<rect x="${r1(b.x)}" y="${r1(b.y)}" width="${r1(b.w)}" height="${r1(b.h)}" rx="${r1(rx)}" ${strokeAttrs}${dashed}/>`);
71
+ }
72
+ // labels (two wrapped lines at most, like the component's nodeTextLines)
73
+ const text = nodeTextLines(b, { w: b.w, h: b.h });
74
+ const lines = text.label.slice(0, 2);
75
+ const lineH = 11;
76
+ const textTop = b.y + b.h / 2 - (lines.length * lineH) / 2;
77
+ lines.forEach((line, li) => {
78
+ out.push(thumbText(b.x + b.w / 2, textTop + lineH * li + lineH / 2 + 4, thumbTruncate(line, 16), { size: 10, fill: palette.ink, weight: 600, anchor: "middle" }));
79
+ });
80
+ }
81
+ /** Polyline path + arrowhead, mirroring the component's path helpers. */
82
+ function drawEdge(e) {
83
+ if (!e.points.length)
84
+ return;
85
+ const s = edgeStroke(palette, e.tone);
86
+ const d = e.points
87
+ .map((p, i) => `${i ? "L" : "M"} ${r1(p.x)} ${r1(p.y)}`)
88
+ .join(" ");
89
+ out.push(`<path d="${d}" fill="none" stroke="${s.stroke}" stroke-opacity="${s.opacity}" stroke-width="1.5"${e.dashed ? ` stroke-dasharray="5 4"` : ""}/>`);
90
+ const n = e.points.length;
91
+ if (n >= 2) {
92
+ const a = e.points[n - 2];
93
+ const b = e.points[n - 1];
94
+ const ang = Math.atan2(b.y - a.y, b.x - a.x);
95
+ const size = 8;
96
+ const p1 = {
97
+ x: b.x - size * Math.cos(ang - 0.45),
98
+ y: b.y - size * Math.sin(ang - 0.45),
99
+ };
100
+ const p2 = {
101
+ x: b.x - size * Math.cos(ang + 0.45),
102
+ y: b.y - size * Math.sin(ang + 0.45),
103
+ };
104
+ out.push(`<polygon points="${r1(b.x)},${r1(b.y)} ${r1(p1.x)},${r1(p1.y)} ${r1(p2.x)},${r1(p2.y)}" fill="${s.stroke}" fill-opacity="${s.opacity}"/>`);
105
+ }
106
+ if (e.label && e.labelPoint)
107
+ out.push(thumbText(e.labelPoint.x, e.labelPoint.y + 4, thumbTruncate(e.label, 14), {
108
+ size: 9,
109
+ fill: palette.ink,
110
+ opacity: 0.6,
111
+ anchor: "middle",
112
+ }));
113
+ }
114
+ if (seq) {
115
+ // sequence: actor pills + lifelines + messages
116
+ for (const a of seq.actors) {
117
+ const f = nodeFill(palette, a.tone);
118
+ const s = nodeStroke(palette, a.tone);
119
+ out.push(`<rect x="${r1(a.x - a.w / 2)}" y="${VIEW_PAD}" width="${r1(a.w)}" height="${SEQ_ACTOR_H}" rx="${r1(SEQ_ACTOR_H / 2)}" fill="${f.fill}" fill-opacity="${f.opacity}" stroke="${s.stroke}" stroke-opacity="${s.opacity}" stroke-width="1.5"/>`);
120
+ out.push(thumbText(a.x, VIEW_PAD + SEQ_ACTOR_H / 2 + 4, thumbTruncate(a.label, 14), {
121
+ size: 10,
122
+ fill: palette.ink,
123
+ weight: 600,
124
+ anchor: "middle",
125
+ }));
126
+ out.push(`<line x1="${r1(a.x)}" x2="${r1(a.x)}" y1="${VIEW_PAD + SEQ_ACTOR_H}" y2="${r1(H - VIEW_PAD)}" stroke="${palette.ink}" stroke-opacity="0.25" stroke-width="1" stroke-dasharray="4 4"/>`);
127
+ }
128
+ for (const m of seq.messages) {
129
+ const s = edgeStroke(palette, m.tone);
130
+ const toRight = m.x2 >= m.x1;
131
+ const xStart = toRight ? m.x1 : m.x2;
132
+ const xEnd = toRight ? m.x2 : m.x1;
133
+ out.push(`<line x1="${r1(xStart)}" x2="${r1(toRight ? xEnd - 6 : xEnd + 6)}" y1="${r1(m.y)}" y2="${r1(m.y)}" stroke="${s.stroke}" stroke-opacity="${s.opacity}" stroke-width="1.5"${m.dashed ? ` stroke-dasharray="5 4"` : ""}/>`);
134
+ out.push(`<polygon points="${r1(xEnd)},${r1(m.y)} ${r1(toRight ? xEnd - 8 : xEnd + 8)},${r1(m.y - 3.5)} ${r1(toRight ? xEnd - 8 : xEnd + 8)},${r1(m.y + 3.5)}" fill="${s.stroke}" fill-opacity="${s.opacity}"/>`);
135
+ if (m.label)
136
+ out.push(thumbText((xStart + xEnd) / 2, m.y - 6, thumbTruncate(m.label, 14), {
137
+ size: 9,
138
+ fill: palette.ink,
139
+ opacity: 0.6,
140
+ anchor: "middle",
141
+ }));
142
+ }
143
+ }
144
+ else if (flow) {
145
+ for (const e of flow.edges)
146
+ drawEdge({
147
+ points: e.points,
148
+ label: e.label,
149
+ labelPoint: e.labelPoint,
150
+ dashed: e.dashed,
151
+ tone: e.tone,
152
+ });
153
+ for (const b of flow.boxes)
154
+ drawNode(b);
155
+ }
156
+ return `<svg viewBox="0 0 ${r1(W)} ${r1(H)}">${out.join("")}</svg>`;
157
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Diagram block — shared types. schema.ts owns the zod schema and infers
3
+ * DiagramParams from it; this file only carries the layout vocabulary so
4
+ * schema.ts and DiagramBlock.svelte agree without a cycle.
5
+ */
6
+ import type { z } from "zod";
7
+ import type { ToneToken } from "../../params";
8
+ import type { diagramParamsSchema } from "./schema";
9
+ export type DiagramMode = "flow" | "sequence";
10
+ export type NodeShape = "rect" | "pill" | "diamond" | "circle" | "stadium";
11
+ export type NodeKind = "default" | "input" | "output" | "decision" | "terminal" | "process" | "data" | "subroutine" | "external" | "note";
12
+ export type DiagramParams = z.infer<typeof diagramParamsSchema>;
13
+ export interface Point {
14
+ x: number;
15
+ y: number;
16
+ }
17
+ /** A laid-out node: top-left box plus the params the renderer paints. */
18
+ export interface NodeBox {
19
+ id: string;
20
+ x: number;
21
+ y: number;
22
+ w: number;
23
+ h: number;
24
+ label: string;
25
+ sublabel?: string;
26
+ kind?: NodeKind;
27
+ tone?: ToneToken;
28
+ shape?: NodeShape;
29
+ }
30
+ export interface EdgeGeom {
31
+ from: string;
32
+ to: string;
33
+ label?: string;
34
+ dashed?: boolean;
35
+ tone?: ToneToken;
36
+ /** Polyline from source border to target border (dagre or layered). */
37
+ points: Point[];
38
+ /** Label anchor (dagre's label position, or the polyline midpoint). */
39
+ labelPoint: Point | null;
40
+ labelW: number;
41
+ labelH: number;
42
+ }
43
+ export interface FlowLayout {
44
+ boxes: NodeBox[];
45
+ edges: EdgeGeom[];
46
+ width: number;
47
+ height: number;
48
+ /** Which engine produced the layout ("layered" = the no-dagre fallback). */
49
+ engine: "dagre" | "layered";
50
+ }
51
+ export interface SeqActor {
52
+ id: string;
53
+ label: string;
54
+ tone?: ToneToken;
55
+ /** Center x of the lifeline; w = actor box width. */
56
+ x: number;
57
+ w: number;
58
+ }
59
+ export interface SeqMessage {
60
+ from: string;
61
+ to: string;
62
+ label?: string;
63
+ dashed?: boolean;
64
+ tone?: ToneToken;
65
+ y: number;
66
+ x1: number;
67
+ x2: number;
68
+ }
69
+ export interface SeqLayout {
70
+ actors: SeqActor[];
71
+ messages: SeqMessage[];
72
+ width: number;
73
+ height: number;
74
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,81 @@
1
+ <script lang="ts">
2
+ /**
3
+ * diff block — old/new text through jatui's HunkDiffView (side-by-side or
4
+ * unified, line numbers, word-level inline highlights). The block's own job
5
+ * is the header (file label + +/- counts) and handing the text through; the
6
+ * diff math and rendering live in jatui.
7
+ *
8
+ * Read-only safe: HunkDiffView is pure presentation, nothing here saves
9
+ * state, so the block renders identically on the public share route.
10
+ */
11
+ import { diffLines } from "diff"
12
+ import HunkDiffView from "../../../components/HunkDiffView.svelte"
13
+ import type { BlockProps } from "../../types.js"
14
+ import { type DiffParams } from "./schema.js"
15
+
16
+ let { params }: BlockProps<DiffParams> = $props()
17
+
18
+ const oldText = $derived(params?.oldText ?? null)
19
+ const newText = $derived(params?.newText ?? null)
20
+ const unified = $derived(params?.unified ?? false)
21
+
22
+ /** +/- line counts for the header chips — the REAL line diff (the same
23
+ * diffLines pass HunkDiffView renders), not a length guess: a modified
24
+ * line is one removal + one addition, exactly as the rows below show. */
25
+ const stats = $derived.by(() => {
26
+ let removed = 0
27
+ let added = 0
28
+ for (const c of diffLines(oldText ?? "", newText ?? "")) {
29
+ if (c.removed) removed += c.count ?? c.value.split("\n").length
30
+ else if (c.added) added += c.count ?? c.value.split("\n").length
31
+ }
32
+ return { removed, added }
33
+ })
34
+
35
+ /** Header chips show the honest delta only when the texts differ. */
36
+ const identical = $derived(oldText !== null && oldText === newText)
37
+ </script>
38
+
39
+ <figure class="artifact-diff w-full">
40
+ {#if params?.file || params?.caption}
41
+ <figcaption class="mb-1.5 flex min-w-0 flex-wrap items-baseline gap-x-3">
42
+ {#if params?.file}
43
+ <span
44
+ class="truncate rounded-field bg-base-content/5 px-2 py-0.5 font-mono text-xs font-medium text-base-content/80"
45
+ >
46
+ {params.file}
47
+ </span>
48
+ {/if}
49
+ {#if params?.caption}
50
+ <span class="min-w-0 text-xs text-base-content/60">
51
+ {params.caption}
52
+ </span>
53
+ {/if}
54
+ </figcaption>
55
+ {/if}
56
+
57
+ {#if identical}
58
+ <p class="text-sm text-base-content/50">
59
+ No difference: both sides are identical.
60
+ </p>
61
+ {:else}
62
+ <div
63
+ class="overflow-x-auto rounded-box border border-base-content/10 bg-base-100"
64
+ >
65
+ <div
66
+ class="flex items-center gap-2 border-b border-base-content/10 px-3 py-1.5"
67
+ >
68
+ <span class="badge badge-error badge-sm font-mono"
69
+ >-{stats.removed}</span
70
+ >
71
+ <span class="badge badge-success badge-sm font-mono"
72
+ >+{stats.added}</span
73
+ >
74
+ <span class="ml-auto text-2xs text-base-content/45">
75
+ {unified ? "unified" : "side by side"}
76
+ </span>
77
+ </div>
78
+ <HunkDiffView {oldText} {newText} {unified} />
79
+ </div>
80
+ {/if}
81
+ </figure>
@@ -0,0 +1,10 @@
1
+ import type { BlockProps } from "../../types.js";
2
+ declare const DiffBlock: import("svelte").Component<BlockProps<{
3
+ oldText: string | null;
4
+ newText: string | null;
5
+ unified: boolean;
6
+ file?: string | undefined;
7
+ caption?: string | undefined;
8
+ }>, {}, "">;
9
+ type DiffBlock = ReturnType<typeof DiffBlock>;
10
+ export default DiffBlock;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * diff block — old/new text through jatui HunkDiffView (split or unified).
3
+ */
4
+ import type { ArtifactBlockDef } from "../../types.js";
5
+ import { type DiffParams } from "./schema.js";
6
+ declare const def: ArtifactBlockDef<DiffParams>;
7
+ export default def;
@@ -0,0 +1,36 @@
1
+ import DiffBlock from "./DiffBlock.svelte";
2
+ import { diffSchema } from "./schema.js";
3
+ const OLD_YAML = `modules:
4
+ scheduling:
5
+ enabled: true
6
+ billing:
7
+ enabled: false
8
+ messages:
9
+ enabled: true
10
+ `;
11
+ const NEW_YAML = `modules:
12
+ scheduling:
13
+ enabled: true
14
+ billing:
15
+ enabled: true
16
+ messages:
17
+ enabled: true
18
+ vault:
19
+ enabled: false
20
+ `;
21
+ const EXAMPLE = {
22
+ file: "tenants/cmf/app.yaml",
23
+ caption: "Billing + vault toggles flipped",
24
+ oldText: OLD_YAML,
25
+ newText: NEW_YAML,
26
+ unified: false,
27
+ };
28
+ const def = {
29
+ type: "diff",
30
+ title: "Diff",
31
+ description: "Before/after text through jatui's HunkDiffView: line numbers, side-by-side (default) or unified columns, red/green rows with strikethrough on removed lines and inline word-level highlights. Params: oldText and/or newText (each up to 50,000 chars — at least one; null means the side doesn't exist, i.e. a created or deleted file), unified (true = one column — also the friendlier read on a phone), file (a short label, e.g. 'tenants/cmf/app.yaml') and caption (one line of what changed). Use it to review config changes, contract edits and any text an agent proposes changing. Tip: quote the two versions verbatim — the viewer trusts the diff exactly as much as its inputs; end both sides with a trailing newline so the last line diffs cleanly, and keep each side a whole file or a self-contained hunk, not a fragment that reads out of context.",
32
+ schema: diffSchema,
33
+ component: DiffBlock,
34
+ example: EXAMPLE,
35
+ };
36
+ export default def;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Params schema for the diff block (old/new text through jatui HunkDiffView).
3
+ * Imported by block.ts (def), DiffBlock.svelte (props typing) and the tests —
4
+ * keeps them cycle-free.
5
+ *
6
+ * Untrusted input rules (CONTRACT.md): both texts are length-capped and
7
+ * rendered BY jatui's diff lib as text (it never evaluates content) — the
8
+ * component renders the diff through HunkDiffView's own DOM, never {@html}.
9
+ */
10
+ import { z } from "zod";
11
+ export declare const diffSchema: z.ZodObject<{
12
+ oldText: z.ZodDefault<z.ZodNullable<z.ZodString>>;
13
+ newText: z.ZodDefault<z.ZodNullable<z.ZodString>>;
14
+ unified: z.ZodDefault<z.ZodBoolean>;
15
+ file: z.ZodOptional<z.ZodString>;
16
+ caption: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ export type DiffParams = z.infer<typeof diffSchema>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Params schema for the diff block (old/new text through jatui HunkDiffView).
3
+ * Imported by block.ts (def), DiffBlock.svelte (props typing) and the tests —
4
+ * keeps them cycle-free.
5
+ *
6
+ * Untrusted input rules (CONTRACT.md): both texts are length-capped and
7
+ * rendered BY jatui's diff lib as text (it never evaluates content) — the
8
+ * component renders the diff through HunkDiffView's own DOM, never {@html}.
9
+ */
10
+ import { z } from "zod";
11
+ /** One side of the diff. 50k chars ≈ ~2k lines — a whole config file or a
12
+ * big hunk; inside the contract's ~256KB per-block params budget even with
13
+ * both sides maxed (the publisher owns the sum). */
14
+ const SIDE_MAX_CHARS = 50_000;
15
+ export const diffSchema = z
16
+ .object({
17
+ /** The text BEFORE the change (null when the file is brand new). */
18
+ oldText: z.string().max(SIDE_MAX_CHARS).nullable().default(null),
19
+ /** The text AFTER the change (null when the file was deleted). */
20
+ newText: z.string().max(SIDE_MAX_CHARS).nullable().default(null),
21
+ /** Unified single column (default) vs the two-column split view. */
22
+ unified: z.boolean().default(false),
23
+ /** Optional label — the file (or thing) this diff is about. */
24
+ file: z.string().max(200).optional(),
25
+ /** Optional caption under the header (what changed, in one line). */
26
+ caption: z.string().max(200).optional(),
27
+ })
28
+ .superRefine((v, ctx) => {
29
+ if (v.oldText === null && v.newText === null)
30
+ ctx.addIssue({
31
+ code: "custom",
32
+ path: ["oldText"],
33
+ message: "at least one of oldText / newText is required",
34
+ });
35
+ });