@astra-spec/ui 0.0.3 → 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 (273) hide show
  1. package/README.md +173 -20
  2. package/TOKENS.md +17 -8
  3. package/components.css +1 -0
  4. package/dist/blocks/decisions-list.d.ts +0 -1
  5. package/dist/blocks/decisions-list.d.ts.map +1 -1
  6. package/dist/blocks/decisions-list.js +1 -5
  7. package/dist/blocks/decisions-list.js.map +1 -1
  8. package/dist/blocks/findings-list.d.ts.map +1 -1
  9. package/dist/blocks/findings-list.js +2 -1
  10. package/dist/blocks/findings-list.js.map +1 -1
  11. package/dist/blocks/index.d.ts +3 -3
  12. package/dist/blocks/index.d.ts.map +1 -1
  13. package/dist/blocks/index.js +2 -2
  14. package/dist/blocks/index.js.map +1 -1
  15. package/dist/blocks/inputs-list.js +1 -1
  16. package/dist/blocks/inputs-list.js.map +1 -1
  17. package/dist/blocks/outputs-list.d.ts +2 -2
  18. package/dist/blocks/outputs-list.d.ts.map +1 -1
  19. package/dist/blocks/outputs-list.js +15 -19
  20. package/dist/blocks/outputs-list.js.map +1 -1
  21. package/dist/blocks/section.d.ts +1 -4
  22. package/dist/blocks/section.d.ts.map +1 -1
  23. package/dist/blocks/section.js +3 -13
  24. package/dist/blocks/section.js.map +1 -1
  25. package/dist/components/artifact-preview.d.ts +2 -54
  26. package/dist/components/artifact-preview.d.ts.map +1 -1
  27. package/dist/components/artifact-preview.js +2 -107
  28. package/dist/components/artifact-preview.js.map +1 -1
  29. package/dist/components/decision-detail.d.ts +1 -1
  30. package/dist/components/decision-detail.d.ts.map +1 -1
  31. package/dist/components/decision-detail.js.map +1 -1
  32. package/dist/components/finding-detail.d.ts +2 -2
  33. package/dist/components/finding-detail.d.ts.map +1 -1
  34. package/dist/components/finding-detail.js.map +1 -1
  35. package/dist/components/index.d.ts +9 -13
  36. package/dist/components/index.d.ts.map +1 -1
  37. package/dist/components/index.js +6 -8
  38. package/dist/components/index.js.map +1 -1
  39. package/dist/components/input-detail.d.ts +1 -2
  40. package/dist/components/input-detail.d.ts.map +1 -1
  41. package/dist/components/input-detail.js +0 -3
  42. package/dist/components/input-detail.js.map +1 -1
  43. package/dist/components/insight-detail.d.ts +2 -8
  44. package/dist/components/insight-detail.d.ts.map +1 -1
  45. package/dist/components/insight-detail.js +5 -11
  46. package/dist/components/insight-detail.js.map +1 -1
  47. package/dist/components/insight-trigger.d.ts +1 -1
  48. package/dist/components/insight-trigger.d.ts.map +1 -1
  49. package/dist/components/insight-trigger.js +3 -2
  50. package/dist/components/insight-trigger.js.map +1 -1
  51. package/dist/components/output-detail.d.ts +2 -7
  52. package/dist/components/output-detail.d.ts.map +1 -1
  53. package/dist/components/output-detail.js +3 -30
  54. package/dist/components/output-detail.js.map +1 -1
  55. package/dist/components/output-dialog.d.ts +2 -2
  56. package/dist/components/output-dialog.d.ts.map +1 -1
  57. package/dist/components/output-dialog.js +2 -1
  58. package/dist/components/output-dialog.js.map +1 -1
  59. package/dist/components/paper-detail.d.ts +14 -14
  60. package/dist/components/paper-detail.d.ts.map +1 -1
  61. package/dist/components/paper-detail.js +49 -29
  62. package/dist/components/paper-detail.js.map +1 -1
  63. package/dist/components/paper-pdf-viewer.d.ts +19 -0
  64. package/dist/components/paper-pdf-viewer.d.ts.map +1 -0
  65. package/dist/components/paper-pdf-viewer.js +250 -0
  66. package/dist/components/paper-pdf-viewer.js.map +1 -0
  67. package/dist/components/record-dialog.d.ts +7 -5
  68. package/dist/components/record-dialog.d.ts.map +1 -1
  69. package/dist/components/record-dialog.js +7 -5
  70. package/dist/components/record-dialog.js.map +1 -1
  71. package/dist/components/record-preview.d.ts +2 -2
  72. package/dist/components/record-preview.d.ts.map +1 -1
  73. package/dist/components/record-preview.js +9 -8
  74. package/dist/components/record-preview.js.map +1 -1
  75. package/dist/components/relation-items.d.ts +1 -1
  76. package/dist/components/relation-items.d.ts.map +1 -1
  77. package/dist/components/relation-items.js +10 -3
  78. package/dist/components/relation-items.js.map +1 -1
  79. package/dist/{components/use-detail-stack.d.ts → lib/detail-stack.d.ts} +17 -2
  80. package/dist/lib/detail-stack.d.ts.map +1 -0
  81. package/dist/{components/use-detail-stack.js → lib/detail-stack.js} +15 -2
  82. package/dist/lib/detail-stack.js.map +1 -0
  83. package/dist/lib/index.d.ts +14 -0
  84. package/dist/lib/index.d.ts.map +1 -0
  85. package/dist/lib/index.js +9 -0
  86. package/dist/lib/index.js.map +1 -0
  87. package/dist/lib/labels.d.ts +20 -0
  88. package/dist/lib/labels.d.ts.map +1 -1
  89. package/dist/lib/labels.js +20 -0
  90. package/dist/lib/labels.js.map +1 -1
  91. package/dist/lib/pdf-quote.d.ts +47 -0
  92. package/dist/lib/pdf-quote.d.ts.map +1 -0
  93. package/dist/lib/pdf-quote.js +154 -0
  94. package/dist/lib/pdf-quote.js.map +1 -0
  95. package/dist/lib/pdf-runtime.d.ts +102 -0
  96. package/dist/lib/pdf-runtime.d.ts.map +1 -0
  97. package/dist/lib/pdf-runtime.js +48 -0
  98. package/dist/lib/pdf-runtime.js.map +1 -0
  99. package/dist/lib/preview-data.d.ts +55 -0
  100. package/dist/lib/preview-data.d.ts.map +1 -0
  101. package/dist/lib/preview-data.js +108 -0
  102. package/dist/lib/preview-data.js.map +1 -0
  103. package/dist/lib/prose.d.ts +37 -0
  104. package/dist/lib/prose.d.ts.map +1 -0
  105. package/dist/lib/prose.js +60 -0
  106. package/dist/lib/prose.js.map +1 -0
  107. package/dist/lib/use-isomorphic-layout-effect.d.ts +4 -0
  108. package/dist/lib/use-isomorphic-layout-effect.d.ts.map +1 -0
  109. package/dist/lib/use-isomorphic-layout-effect.js +4 -0
  110. package/dist/lib/use-isomorphic-layout-effect.js.map +1 -0
  111. package/dist/lib/use-output-expanded.d.ts +7 -0
  112. package/dist/lib/use-output-expanded.d.ts.map +1 -0
  113. package/dist/lib/use-output-expanded.js +29 -0
  114. package/dist/lib/use-output-expanded.js.map +1 -0
  115. package/dist/model/index.d.ts +5 -3
  116. package/dist/model/index.d.ts.map +1 -1
  117. package/dist/model/index.js +3 -2
  118. package/dist/model/index.js.map +1 -1
  119. package/dist/model/kind.d.ts +9 -0
  120. package/dist/model/kind.d.ts.map +1 -0
  121. package/dist/model/kind.js +25 -0
  122. package/dist/model/kind.js.map +1 -0
  123. package/dist/model/papers.d.ts +6 -6
  124. package/dist/model/papers.d.ts.map +1 -1
  125. package/dist/model/papers.js +8 -0
  126. package/dist/model/papers.js.map +1 -1
  127. package/dist/model/records.d.ts +5 -1
  128. package/dist/model/records.d.ts.map +1 -1
  129. package/dist/model/records.js +9 -0
  130. package/dist/model/records.js.map +1 -1
  131. package/dist/primitives/badge.d.ts +1 -1
  132. package/dist/primitives/badge.d.ts.map +1 -1
  133. package/dist/primitives/button.js +1 -1
  134. package/dist/primitives/button.js.map +1 -1
  135. package/dist/primitives/dialog.d.ts +1 -1
  136. package/dist/primitives/dialog.d.ts.map +1 -1
  137. package/dist/primitives/dialog.js +3 -3
  138. package/dist/primitives/dialog.js.map +1 -1
  139. package/dist/primitives/index.d.ts +8 -9
  140. package/dist/primitives/index.d.ts.map +1 -1
  141. package/dist/primitives/index.js +4 -5
  142. package/dist/primitives/index.js.map +1 -1
  143. package/dist/primitives/inline-reference.d.ts +9 -0
  144. package/dist/primitives/inline-reference.d.ts.map +1 -0
  145. package/dist/primitives/inline-reference.js +14 -0
  146. package/dist/primitives/inline-reference.js.map +1 -0
  147. package/dist/primitives/kind-glyph.d.ts +8 -0
  148. package/dist/primitives/kind-glyph.d.ts.map +1 -0
  149. package/dist/primitives/kind-glyph.js +9 -0
  150. package/dist/primitives/kind-glyph.js.map +1 -0
  151. package/dist/primitives/preview-popover.d.ts +2 -2
  152. package/dist/primitives/preview-popover.d.ts.map +1 -1
  153. package/dist/primitives/preview-popover.js +1 -1
  154. package/dist/primitives/preview-popover.js.map +1 -1
  155. package/dist/primitives/prose.d.ts +1 -35
  156. package/dist/primitives/prose.d.ts.map +1 -1
  157. package/dist/primitives/prose.js +2 -58
  158. package/dist/primitives/prose.js.map +1 -1
  159. package/dist/primitives/record-list.d.ts +1 -1
  160. package/dist/primitives/record-list.d.ts.map +1 -1
  161. package/dist/primitives/record-list.js +3 -2
  162. package/dist/primitives/record-list.js.map +1 -1
  163. package/dist/primitives/relation-list.d.ts +1 -1
  164. package/dist/primitives/relation-list.d.ts.map +1 -1
  165. package/dist/primitives/relation-list.js +3 -2
  166. package/dist/primitives/relation-list.js.map +1 -1
  167. package/dist/primitives/slot.d.ts.map +1 -0
  168. package/dist/{lib → primitives}/slot.js +1 -1
  169. package/dist/primitives/slot.js.map +1 -0
  170. package/dist/primitives/surface-header.d.ts +1 -1
  171. package/dist/primitives/surface-header.d.ts.map +1 -1
  172. package/dist/views/inventory.d.ts +7 -5
  173. package/dist/views/inventory.d.ts.map +1 -1
  174. package/dist/views/inventory.js +5 -4
  175. package/dist/views/inventory.js.map +1 -1
  176. package/isolate.css +7 -0
  177. package/package.json +15 -3
  178. package/primitives.css +2 -0
  179. package/src/blocks/decisions-list.tsx +1 -6
  180. package/src/blocks/findings-list.tsx +2 -1
  181. package/src/blocks/index.ts +2 -3
  182. package/src/blocks/inputs-list.tsx +1 -1
  183. package/src/blocks/outputs-list.tsx +53 -30
  184. package/src/blocks/section.tsx +3 -15
  185. package/src/components/artifact-preview.tsx +6 -161
  186. package/src/components/decision-detail.tsx +2 -1
  187. package/src/components/finding-detail.tsx +3 -2
  188. package/src/components/index.ts +10 -30
  189. package/src/components/input-detail.tsx +2 -5
  190. package/src/components/insight-detail.tsx +20 -35
  191. package/src/components/insight-trigger.tsx +5 -3
  192. package/src/components/output-detail.tsx +17 -38
  193. package/src/components/output-dialog.tsx +4 -3
  194. package/src/components/paper-detail.tsx +121 -66
  195. package/src/components/paper-pdf-viewer.tsx +319 -0
  196. package/src/components/record-dialog.tsx +15 -10
  197. package/src/components/record-preview.tsx +12 -17
  198. package/src/components/relation-items.ts +15 -5
  199. package/src/{components/use-detail-stack.ts → lib/detail-stack.ts} +24 -1
  200. package/src/lib/index.ts +22 -0
  201. package/src/lib/labels.tsx +40 -0
  202. package/src/lib/pdf-quote.ts +189 -0
  203. package/src/lib/pdf-runtime.ts +131 -0
  204. package/src/lib/preview-data.ts +155 -0
  205. package/src/lib/prose.tsx +87 -0
  206. package/src/lib/use-isomorphic-layout-effect.ts +4 -0
  207. package/src/lib/use-output-expanded.ts +27 -0
  208. package/src/model/index.ts +4 -2
  209. package/src/model/kind.ts +33 -0
  210. package/src/model/papers.ts +9 -7
  211. package/src/model/records.ts +12 -0
  212. package/src/primitives/badge.tsx +1 -1
  213. package/src/primitives/button.tsx +1 -1
  214. package/src/primitives/dialog.tsx +3 -5
  215. package/src/primitives/index.ts +8 -17
  216. package/src/primitives/inline-reference.tsx +25 -0
  217. package/src/primitives/kind-glyph.tsx +24 -0
  218. package/src/primitives/preview-popover.tsx +3 -3
  219. package/src/primitives/prose.tsx +1 -86
  220. package/src/primitives/record-list.tsx +3 -4
  221. package/src/primitives/relation-list.tsx +4 -7
  222. package/src/{lib → primitives}/slot.tsx +1 -1
  223. package/src/primitives/surface-header.tsx +1 -1
  224. package/src/views/inventory.tsx +12 -8
  225. package/styles/blocks/analysis-tree.css +6 -6
  226. package/styles/blocks/decisions-list.css +10 -10
  227. package/styles/blocks/outputs-list.css +272 -45
  228. package/styles/blocks/papers-list.css +14 -14
  229. package/styles/blocks/records.css +13 -13
  230. package/styles/components/artifact-preview.css +21 -21
  231. package/styles/components/decision-detail.css +23 -23
  232. package/styles/components/evidence.css +4 -9
  233. package/styles/components/finding-detail.css +11 -11
  234. package/styles/components/input-detail.css +11 -11
  235. package/styles/components/insight-detail.css +57 -95
  236. package/styles/components/insight-list.css +9 -9
  237. package/styles/components/insight-trigger.css +5 -8
  238. package/styles/components/output-detail.css +74 -189
  239. package/styles/components/paper-detail.css +90 -109
  240. package/styles/components/paper-doi.css +5 -14
  241. package/styles/components/paper-pdf-viewer.css +120 -0
  242. package/styles/components/record-preview.css +444 -268
  243. package/styles/primitives/badge.css +2 -2
  244. package/styles/primitives/button.css +25 -25
  245. package/styles/primitives/count-heading.css +5 -5
  246. package/styles/primitives/detail-layout.css +25 -25
  247. package/styles/primitives/dialog.css +86 -86
  248. package/styles/primitives/empty-state.css +1 -1
  249. package/styles/primitives/inline-reference.css +37 -0
  250. package/styles/primitives/kind-glyph.css +31 -0
  251. package/styles/primitives/kind.css +6 -0
  252. package/styles/primitives/preview-popover.css +6 -11
  253. package/styles/primitives/prose.css +1 -1
  254. package/styles/primitives/record-list.css +46 -62
  255. package/styles/primitives/relation-list.css +20 -42
  256. package/styles/primitives/surface-header.css +20 -16
  257. package/styles/tokens.css +26 -8
  258. package/styles/views/inventory.css +27 -29
  259. package/dist/components/detail-entry.d.ts +0 -15
  260. package/dist/components/detail-entry.d.ts.map +0 -1
  261. package/dist/components/detail-entry.js +0 -14
  262. package/dist/components/detail-entry.js.map +0 -1
  263. package/dist/components/use-detail-stack.d.ts.map +0 -1
  264. package/dist/components/use-detail-stack.js.map +0 -1
  265. package/dist/lib/slot.d.ts.map +0 -1
  266. package/dist/lib/slot.js.map +0 -1
  267. package/dist/primitives/kind.d.ts +0 -6
  268. package/dist/primitives/kind.d.ts.map +0 -1
  269. package/dist/primitives/kind.js +0 -14
  270. package/dist/primitives/kind.js.map +0 -1
  271. package/src/components/detail-entry.ts +0 -19
  272. package/src/primitives/kind.ts +0 -19
  273. /package/dist/{lib → primitives}/slot.d.ts +0 -0
@@ -6,7 +6,7 @@ import { locateRecord } from '../model/locate-record.js';
6
6
  import { cn } from '../lib/cn.js';
7
7
  import { LabelsProvider, useLabels } from '../lib/labels.js';
8
8
  import { RecordDialog } from '../components/record-dialog.js';
9
- import { useDetailStack } from '../components/use-detail-stack.js';
9
+ import { useDetailStack } from '../lib/detail-stack.js';
10
10
  import { DialogProvider } from '../primitives/dialog.js';
11
11
  import { DecisionsList } from '../blocks/decisions-list.js';
12
12
  import { FindingsList } from '../blocks/findings-list.js';
@@ -14,7 +14,8 @@ import { InputsList } from '../blocks/inputs-list.js';
14
14
  import { OutputsList } from '../blocks/outputs-list.js';
15
15
  import { PapersList } from '../blocks/papers-list.js';
16
16
  import { PriorInsightsList } from '../blocks/prior-insights-list.js';
17
- import { InventoryOutline, InventorySection, sectionKind } from '../blocks/section.js';
17
+ import { InventoryOutline, InventorySection } from '../blocks/section.js';
18
+ import { sectionKind } from '../model/kind.js';
18
19
  export const DEFAULT_SECTIONS = ['outputs', 'decisions', 'inputs', 'findings', 'prior_insights', 'papers'];
19
20
  const EMPTY_PAPER_METADATA = {};
20
21
  function entryLabel(entry, papers) {
@@ -30,7 +31,7 @@ function entryLabel(entry, papers) {
30
31
  export const Inventory = forwardRef(function Inventory({ labels, ...props }, ref) {
31
32
  return (_jsx(LabelsProvider, { labels: labels, children: _jsx(ExplorerBody, { ...props, ref: ref }) }));
32
33
  });
33
- const ExplorerBody = forwardRef(function ExplorerBody({ document, index: providedIndex, analysisPath = '$', sections = DEFAULT_SECTIONS, idPrefix = '', showOutline = true, renderArtifact, renderText, renderPaper, onOpenArtifact, paperMetadata = EMPTY_PAPER_METADATA, onFetchPaper, decisionTagLabels = {}, detailMode = 'modal', detail, defaultDetail, onDetailChange, className, children, ...rest }, ref) {
34
+ const ExplorerBody = forwardRef(function ExplorerBody({ document, index: providedIndex, analysisPath = '$', sections = DEFAULT_SECTIONS, idPrefix = '', showOutline = true, renderArtifact, renderText, loadPdfJs, onOpenPaperFile, onOpenArtifact, paperMetadata = EMPTY_PAPER_METADATA, onFetchPaper, decisionTagLabels = {}, detailMode = 'modal', detail, defaultDetail, onDetailChange, className, children, ...rest }, ref) {
34
35
  const labels = useLabels();
35
36
  const index = useMemo(() => providedIndex ?? indexAnalysis(document), [document, providedIndex]);
36
37
  const analysis = index.analysisByPath.get(analysisPath) ?? document.analysis;
@@ -96,6 +97,6 @@ const ExplorerBody = forwardRef(function ExplorerBody({ document, index: provide
96
97
  label: labels.sections[section],
97
98
  count: sectionContent[section].count,
98
99
  kind: sectionKind(section),
99
- })) })) : null] }), stack.active ? (_jsx(DialogProvider, { mode: detailMode, backText: stack.previous ? entryLabel(stack.previous, papers) : undefined, children: _jsx(RecordDialog, { entry: stack.active, fallback: _jsx("p", { children: labels.notFound }), document: document, index: index, papers: papers, paperMetadata: paperMetadata, renderArtifact: renderArtifact, renderText: renderText, renderPaper: renderPaper, onOpenArtifact: onOpenArtifact, onFetchPaper: onFetchPaper, onOpenRecord: stack.pushRecord, onOpenPaper: stack.pushPaper, onBack: stack.previous ? stack.back : undefined, onClose: stack.close }) })) : null] }));
100
+ })) })) : null] }), stack.active ? (_jsx(DialogProvider, { mode: detailMode, backText: stack.previous ? entryLabel(stack.previous, papers) : undefined, children: _jsx(RecordDialog, { entry: stack.active, fallback: _jsx("p", { children: labels.notFound }), document: document, index: index, papers: papers, paperMetadata: paperMetadata, renderArtifact: renderArtifact, renderText: renderText, loadPdfJs: loadPdfJs, onOpenPaperFile: onOpenPaperFile, onOpenArtifact: onOpenArtifact, onFetchPaper: onFetchPaper, onOpenRecord: stack.pushRecord, onOpenPaper: stack.pushPaper, onBack: stack.previous ? stack.back : undefined, onClose: stack.close }) })) : null] }));
100
101
  });
101
102
  //# sourceMappingURL=inventory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"inventory.js","sourceRoot":"","sources":["../../src/views/inventory.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,GAMd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAuC,MAAM,OAAO,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,WAAW,EAAuD,MAAM,oBAAoB,CAAC;AACzI,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,SAAS,EAA4B,MAAM,kBAAkB,CAAC;AAGvF,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pC,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC;yBAC3B,CAAC,CAAC,GACH,CACH,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CACd,KAAC,cAAc,IAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,YACzG,KAAC,YAAY,IACX,KAAK,EAAE,KAAK,CAAC,MAAM,EACnB,QAAQ,EAAE,sBAAI,MAAM,CAAC,QAAQ,GAAK,EAClC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,KAAK,CAAC,UAAU,EAC9B,WAAW,EAAE,KAAK,CAAC,SAAS,EAC5B,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAC/C,OAAO,EAAE,KAAK,CAAC,KAAK,GACpB,GACa,CAClB,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
package/isolate.css ADDED
@@ -0,0 +1,7 @@
1
+ /* Opt in on each owned UI root and portal with `astra-isolate`.
2
+ * Restore shared layers where an embedding application styles native elements.
3
+ * Host chrome should use its own layer; inline styles and user-important rules remain effective.
4
+ */
5
+ .astra-ui.astra-isolate :is(a, button, input, select, textarea, code, kbd, pre, samp, tt, p, li, blockquote, h1, h2, h3, h4, h5, h6) {
6
+ all: revert-layer;
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astra-spec/ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "React components for rendering resolved ASTRA analyses",
5
5
  "license": "BSD-3-Clause",
6
6
  "homepage": "https://github.com/LightconeResearch/astra-ui#readme",
@@ -25,6 +25,16 @@
25
25
  ],
26
26
  "style": "./styles.css",
27
27
  "exports": {
28
+ "./lib": {
29
+ "types": "./dist/lib/index.d.ts",
30
+ "import": "./dist/lib/index.js",
31
+ "default": "./dist/lib/index.js"
32
+ },
33
+ "./lib/*": {
34
+ "types": "./dist/lib/*.d.ts",
35
+ "import": "./dist/lib/*.js",
36
+ "default": "./dist/lib/*.js"
37
+ },
28
38
  "./primitives": {
29
39
  "types": "./dist/primitives/index.d.ts",
30
40
  "import": "./dist/primitives/index.js",
@@ -81,7 +91,8 @@
81
91
  "./components.css": "./components.css",
82
92
  "./primitives.css": "./primitives.css",
83
93
  "./styles/*": "./styles/*",
84
- "./package.json": "./package.json"
94
+ "./package.json": "./package.json",
95
+ "./isolate.css": "./isolate.css"
85
96
  },
86
97
  "files": [
87
98
  "dist",
@@ -94,7 +105,8 @@
94
105
  "primitives.css",
95
106
  "README.md",
96
107
  "TOKENS.md",
97
- "LICENSE"
108
+ "LICENSE",
109
+ "isolate.css"
98
110
  ],
99
111
  "scripts": {
100
112
  "clean": "node --input-type=module -e \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })\" && tsc -b tsconfig.json --clean",
package/primitives.css CHANGED
@@ -14,3 +14,5 @@
14
14
  @import "./styles/primitives/record-list.css";
15
15
  @import "./styles/primitives/empty-state.css";
16
16
  @import "./styles/primitives/prose.css";
17
+ @import "./styles/primitives/kind-glyph.css";
18
+ @import "./styles/primitives/inline-reference.css";
@@ -1,6 +1,6 @@
1
1
  import type { ResolvedAnalysisNode, ResolvedDecision } from '@astra-spec/sdk';
2
2
  import { forwardRef, useState, type HTMLAttributes } from 'react';
3
- import { countLabel, recordTitle, selectedOptionLabel } from '../model/records.js';
3
+ import { countLabel, decisionTagLabel, recordTitle, selectedOptionLabel } from '../model/records.js';
4
4
  import { useLabels } from '../lib/labels.js';
5
5
  import { EmptyState, RecordIdentity, RecordList } from '../primitives/record-list.js';
6
6
  import { InventoryRecords } from './section.js';
@@ -18,11 +18,6 @@ export interface DecisionsListProps extends Omit<HTMLAttributes<HTMLDivElement>,
18
18
  onOpenRecord: (decision: ResolvedDecision, analysis: ResolvedAnalysisNode) => void;
19
19
  }
20
20
 
21
- export function decisionTagLabel(tag: string, labels: Readonly<Record<string, string>>): string {
22
- return labels[tag]
23
- ?? tag.replace(/_/g, ' ').replace(/^./, (character: string) => character.toUpperCase());
24
- }
25
-
26
21
  /** Decisions with a tag filter and the selected option of each. */
27
22
  export const DecisionsList = forwardRef<HTMLDivElement, DecisionsListProps>(function DecisionsList({
28
23
  analysis,
@@ -1,3 +1,4 @@
1
+ import { KindGlyph } from '../primitives/kind-glyph.js';
1
2
  import type { ResolvedAnalysisNode, ResolvedInsight } from '@astra-spec/sdk';
2
3
  import { forwardRef, type HTMLAttributes } from 'react';
3
4
  import { recordTitle } from '../model/records.js';
@@ -44,7 +45,7 @@ export const FindingsList = forwardRef<HTMLDivElement, FindingsListProps>(functi
44
45
  onOpen: () => { onOpenRecord(record, analysis); },
45
46
  cells: [
46
47
  <span className="astra-record-list__name" data-variant="claim">
47
- <span className="astra-record-list__glyph" aria-hidden="true">●</span>
48
+ <KindGlyph className="astra-record-list__glyph" kind="finding" />
48
49
  <span>
49
50
  {record.label ? <small>{record.label}</small> : null}
50
51
  <strong>{record.claim}</strong>
@@ -1,17 +1,16 @@
1
1
  /** Blocks: sections of the inventory page, composable into any layout. */
2
2
  export { AnalysisTree } from './analysis-tree.js';
3
3
  export type { AnalysisTreeProps } from './analysis-tree.js';
4
- export { InventoryOutline, sectionKind, InventoryRecords, InventorySection } from './section.js';
4
+ export { InventoryOutline, InventoryRecords, InventorySection } from './section.js';
5
5
  export type {
6
6
  InventoryOutlineEntry,
7
7
  InventoryOutlineProps,
8
8
  InventoryRecordsProps,
9
- InventorySectionId,
10
9
  InventorySectionProps,
11
10
  } from './section.js';
12
11
  export { OutputCard, OutputsList } from './outputs-list.js';
13
12
  export type { OutputCardProps, OutputsListProps } from './outputs-list.js';
14
- export { ALL_TAGS, DecisionsList, decisionTagLabel } from './decisions-list.js';
13
+ export { ALL_TAGS, DecisionsList } from './decisions-list.js';
15
14
  export type { DecisionsListProps } from './decisions-list.js';
16
15
  export { InputsList } from './inputs-list.js';
17
16
  export type { InputsListProps } from './inputs-list.js';
@@ -2,7 +2,7 @@ import type { ResolvedAnalysisNode, ResolvedInput } from '@astra-spec/sdk';
2
2
  import { forwardRef, type HTMLAttributes } from 'react';
3
3
  import { recordTitle } from '../model/records.js';
4
4
  import { useLabels } from '../lib/labels.js';
5
- import { inputSourceLabel } from '../components/input-detail.js';
5
+ import { inputSourceLabel } from '../model/records.js';
6
6
  import { EmptyState, RecordIdentity, RecordList } from '../primitives/record-list.js';
7
7
  import { InventoryRecords } from './section.js';
8
8
 
@@ -4,7 +4,7 @@ import { recordTitle } from '../model/records.js';
4
4
  import { cn } from '../lib/cn.js';
5
5
  import { useLabels } from '../lib/labels.js';
6
6
  import type { ArtifactRenderer } from '../components/artifact-preview.js';
7
- import { EmptyState, RecordIdentity, RecordList } from '../primitives/record-list.js';
7
+ import { EmptyState } from '../primitives/record-list.js';
8
8
  import { OutputPreview } from '../components/output-detail.js';
9
9
 
10
10
  export interface OutputsListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
@@ -19,7 +19,7 @@ export interface OutputCardProps extends Omit<HTMLAttributes<HTMLButtonElement>,
19
19
  onOpen: () => void;
20
20
  }
21
21
 
22
- /** A gallery card: compact preview, type, and title. */
22
+ /** A gallery card: compact preview and title, with a type label for non-figures. */
23
23
  export const OutputCard = forwardRef<HTMLButtonElement, OutputCardProps>(function OutputCard({
24
24
  output,
25
25
  renderArtifact,
@@ -44,7 +44,7 @@ export const OutputCard = forwardRef<HTMLButtonElement, OutputCardProps>(functio
44
44
  <span className="astra-output-card__open" aria-hidden="true">Open ↗</span>
45
45
  </span>
46
46
  <span className="astra-output-card__body">
47
- <span className="astra-output-card__kind">{output.type}</span>
47
+ {output.type !== 'figure' ? <span className="astra-output-card__kind">{output.type}</span> : null}
48
48
  <strong>{recordTitle(output)}</strong>
49
49
  {output.label ? <code>{output.id}</code> : null}
50
50
  </span>
@@ -84,40 +84,61 @@ function OutputGallery({
84
84
  );
85
85
  }
86
86
 
87
- function OutputFiles({ outputs, onOpen }: { outputs: ResolvedOutput[]; onOpen: (output: ResolvedOutput) => void }) {
87
+ function CompactOutputs({
88
+ title,
89
+ outputs,
90
+ renderArtifact,
91
+ onOpen,
92
+ }: {
93
+ title: string;
94
+ outputs: ResolvedOutput[];
95
+ renderArtifact?: ArtifactRenderer | undefined;
96
+ onOpen: (output: ResolvedOutput) => void;
97
+ }) {
88
98
  const id = useId();
89
99
  if (!outputs.length) return null;
90
100
  return (
91
- <section className="astra-inventory-outputs__group astra-inventory-outputs__files" aria-labelledby={id}>
101
+ <section className="astra-inventory-outputs__group" aria-labelledby={id}>
92
102
  <h3 id={id} className="astra-inventory-outputs__group-heading">
93
- <span>Other outputs</span>
103
+ <span>{title}</span>
94
104
  </h3>
95
- <RecordList
96
- label="Other outputs"
97
- columnTemplate="minmax(14rem, 1fr) 1.5rem"
98
- columns={[
99
- { label: 'Output', className: 'astra-record-list__primary' },
100
- { className: 'astra-record-list__arrow' },
101
- ]}
102
- rows={outputs.map((output) => ({
103
- key: output.canonicalPath,
104
- accessibleLabel: recordTitle(output),
105
- onOpen: () => { onOpen(output); },
106
- cells: [
107
- <RecordIdentity
108
- kind="output"
109
- title={recordTitle(output)}
110
- subtitle={output.label ? output.id : output.format?.toUpperCase()}
111
- />,
112
- <span aria-hidden="true">→</span>,
113
- ],
114
- }))}
115
- />
105
+ <ul className="astra-inventory-outputs__compact-grid" data-layout={outputs[0]?.type === 'metric' ? 'tiles' : 'grid'}>
106
+ {outputs.map((output) => {
107
+ const metric = output.type === 'metric';
108
+ const status = !output.active ? 'Inactive' : !output.artifact ? 'Not yet generated' : undefined;
109
+ return (
110
+ <li key={output.canonicalPath}>
111
+ <button
112
+ type="button"
113
+ className="astra-output-entry"
114
+ data-kind={metric ? 'metric' : 'file'}
115
+ aria-label={`Open ${output.type}: ${recordTitle(output)}`}
116
+ onClick={() => { onOpen(output); }}
117
+ >
118
+ <span className="astra-output-entry__name">
119
+ {recordTitle(output)}
120
+ {!metric && status ? <span className="astra-output-entry__status">{status}</span> : null}
121
+ </span>
122
+ {metric ? (
123
+ <span className="astra-output-entry__value">
124
+ {renderArtifact?.(output, { compact: true })
125
+ ?? <span className="astra-output-entry__status">{status ?? 'Preview unavailable'}</span>}
126
+ </span>
127
+ ) : (
128
+ <span className="astra-output-entry__format">{output.format ? output.format.replace(/^\./, '').toUpperCase() : 'FILE'}</span>
129
+ )}
130
+ </button>
131
+ </li>
132
+ );
133
+ })}
134
+ </ul>
116
135
  </section>
117
136
  );
118
137
  }
119
138
 
120
- /** Figures and tables as galleries, everything else as a list. */
139
+ const GROUPED_TYPES = new Set<ResolvedOutput['type']>(['figure', 'table', 'metric']);
140
+
141
+ /** Figures and tables as galleries, metrics as compact tiles, files as a compact grid. */
121
142
  export const OutputsList = forwardRef<HTMLDivElement, OutputsListProps>(function OutputsList({
122
143
  analysis,
123
144
  renderArtifact,
@@ -128,7 +149,8 @@ export const OutputsList = forwardRef<HTMLDivElement, OutputsListProps>(function
128
149
  const labels = useLabels();
129
150
  const figures = analysis.outputs.filter(({ type }) => type === 'figure');
130
151
  const tables = analysis.outputs.filter(({ type }) => type === 'table');
131
- const files = analysis.outputs.filter(({ type }) => type !== 'figure' && type !== 'table');
152
+ const metrics = analysis.outputs.filter(({ type }) => type === 'metric');
153
+ const files = analysis.outputs.filter(({ type }) => !GROUPED_TYPES.has(type));
132
154
  if (!analysis.outputs.length) {
133
155
  return <EmptyState data-slot="outputs-list" {...props} ref={ref} className={className}>{labels.empty.outputs}</EmptyState>;
134
156
  }
@@ -137,7 +159,8 @@ export const OutputsList = forwardRef<HTMLDivElement, OutputsListProps>(function
137
159
  <div data-slot="outputs-list" {...props} ref={ref} className={cn('astra-inventory-outputs', className)}>
138
160
  <OutputGallery title="Figures" outputs={figures} renderArtifact={renderArtifact} onOpen={open} />
139
161
  <OutputGallery title="Tables" outputs={tables} renderArtifact={renderArtifact} onOpen={open} />
140
- <OutputFiles outputs={files} onOpen={open} />
162
+ <CompactOutputs title="Metrics" outputs={metrics} renderArtifact={renderArtifact} onOpen={open} />
163
+ <CompactOutputs title="Output files" outputs={files} onOpen={open} />
141
164
  </div>
142
165
  );
143
166
  });
@@ -1,10 +1,9 @@
1
+ import { KindGlyph } from '../primitives/kind-glyph.js';
1
2
  import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';
2
3
  import { cn } from '../lib/cn.js';
3
- import { surfaceGlyph, type SurfaceKind } from '../primitives/kind.js';
4
+ import { type InventorySectionId, type SurfaceKind } from '../model/kind.js';
4
5
  import { useLabels } from '../lib/labels.js';
5
6
 
6
- export type InventorySectionId = 'outputs' | 'decisions' | 'inputs' | 'findings' | 'prior_insights' | 'papers';
7
-
8
7
  export interface InventorySectionProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
9
8
  /** Anchor id for the heading; also the outline link target. */
10
9
  id: string;
@@ -46,17 +45,6 @@ export const InventorySection = forwardRef<HTMLElement, InventorySectionProps>(f
46
45
  );
47
46
  });
48
47
 
49
- /** The record kind each inventory section lists; drives the outline glyph and colour. */
50
- export function sectionKind(section: InventorySectionId): SurfaceKind {
51
- switch (section) {
52
- case 'outputs': return 'output';
53
- case 'decisions': return 'decision';
54
- case 'inputs': return 'input';
55
- case 'findings': return 'finding';
56
- case 'prior_insights': return 'prior_insight';
57
- case 'papers': return 'paper';
58
- }
59
- }
60
48
 
61
49
  export interface InventoryOutlineEntry {
62
50
  id: string;
@@ -92,7 +80,7 @@ export const InventoryOutline = forwardRef<HTMLElement, InventoryOutlineProps>(f
92
80
  {entries.map((entry) => (
93
81
  <a key={entry.id} href={`#${entry.id}`}>
94
82
  <span className="astra-inventory-outline__glyph" {...(entry.kind ? { 'data-kind': entry.kind } : {})} aria-hidden="true">
95
- {entry.kind ? surfaceGlyph(entry.kind) : null}
83
+ {entry.kind ? <KindGlyph kind={entry.kind} /> : null}
96
84
  </span>
97
85
  <span>{entry.label}</span>
98
86
  {entry.count !== undefined ? <span>{entry.count}</span> : null}
@@ -1,59 +1,7 @@
1
1
  import type { ResolvedOutput } from '@astra-spec/sdk';
2
2
  import { forwardRef, useEffect, useState, type HTMLAttributes, type ReactNode } from 'react';
3
3
  import { cn } from '../lib/cn.js';
4
-
5
- export interface TablePreviewData {
6
- kind: 'table';
7
- headers: string[];
8
- rows: (string | number | boolean | null)[][];
9
- /** Exact number of rows in the source. Leave unset when the source was sampled and the total is unknown. */
10
- totalRows?: number | undefined;
11
- totalColumns?: number | undefined;
12
- /** The preview does not show everything: rows or columns were cut, or the source itself was a sample. */
13
- truncated?: boolean | undefined;
14
- }
15
-
16
- export interface ImagePreviewData {
17
- kind: 'image';
18
- url: string;
19
- alt?: string | undefined;
20
- width?: number | undefined;
21
- height?: number | undefined;
22
- }
23
-
24
- export interface MetricPreviewData {
25
- kind: 'metric';
26
- value: number | string;
27
- uncertainty?: number | string | undefined;
28
- unit?: string | undefined;
29
- label?: string | undefined;
30
- }
31
-
32
- export interface TextPreviewData {
33
- kind: 'text';
34
- text: string;
35
- language?: string | undefined;
36
- truncated?: boolean | undefined;
37
- }
38
-
39
- export interface LoadingPreviewData {
40
- kind: 'loading';
41
- message?: string | undefined;
42
- }
43
-
44
- export interface UnavailablePreviewData {
45
- kind: 'unavailable';
46
- reason?: string | undefined;
47
- }
48
-
49
- /** Host-safe data that a portable component can render without reading a file. */
50
- export type ArtifactPreviewData =
51
- | TablePreviewData
52
- | ImagePreviewData
53
- | MetricPreviewData
54
- | TextPreviewData
55
- | LoadingPreviewData
56
- | UnavailablePreviewData;
4
+ import type { ArtifactPreviewData } from '../lib/preview-data.js';
57
5
 
58
6
  export interface ArtifactRenderOptions {
59
7
  compact: boolean;
@@ -70,10 +18,11 @@ export interface ArtifactPreviewProps extends Omit<HTMLAttributes<HTMLElement>,
70
18
  preview?: ArtifactPreviewData | undefined;
71
19
  compact?: boolean | undefined;
72
20
  caption?: ReactNode | undefined;
73
- /** Pure helpers exported below build the default preview data. */
21
+ /** Builders in `lib/preview-data` produce this from data the host already loaded. */
74
22
  locale?: string | undefined;
75
23
  }
76
24
 
25
+ /** Numbers are rounded for display; strings are the host's exact choice and pass through. */
77
26
  function compactValue(value: string | number | undefined, locale: string | undefined): string {
78
27
  if (value == null || value === '') return 'Value unavailable';
79
28
  return typeof value === 'number'
@@ -190,10 +139,10 @@ export const ArtifactPreview = forwardRef<HTMLElement, ArtifactPreviewProps>(fun
190
139
  if (preview.kind === 'metric') {
191
140
  return (
192
141
  <div {...shared} ref={ref as never} className={cn(rootClass, 'astra-artifact__metric')}>
193
- {preview.label ? <span>{preview.label}</span> : null}
142
+ {preview.label ? <span className="astra-artifact__metric-label">{preview.label}</span> : null}
194
143
  <strong className="astra-artifact__metric-value">{compactValue(preview.value, locale)}</strong>
195
- {preview.uncertainty !== undefined ? (
196
- <span className="astra-artifact__metric-uncertainty">± {preview.uncertainty}</span>
144
+ {preview.uncertainty != null && preview.uncertainty !== '' ? (
145
+ <span className="astra-artifact__metric-uncertainty">± {compactValue(preview.uncertainty, locale)}</span>
197
146
  ) : null}
198
147
  {preview.unit ? <span className="astra-artifact__metric-unit">{preview.unit}</span> : null}
199
148
  </div>
@@ -208,107 +157,3 @@ export const ArtifactPreview = forwardRef<HTMLElement, ArtifactPreviewProps>(fun
208
157
  );
209
158
  });
210
159
 
211
- /* ------------------------------------------------------------------ */
212
- /* Pure helpers hosts can use to build preview data (no I/O) */
213
- /* ------------------------------------------------------------------ */
214
-
215
- export interface DelimitedPreviewOptions {
216
- delimiter?: string | undefined;
217
- maxRows?: number | undefined;
218
- maxColumns?: number | undefined;
219
- /** Set when the source text was itself cut short by the host. */
220
- sourceTruncated?: boolean | undefined;
221
- }
222
-
223
- /** RFC 4180-style rows: quoted cells may hold delimiters, doubled quotes, and line breaks. Blank rows are dropped. */
224
- function parseDelimited(text: string, delimiter: string): { rows: string[][]; unterminated: boolean } {
225
- const rows: string[][] = [];
226
- let row: string[] = [];
227
- let cell = '';
228
- let quoted = false;
229
- const endCell = () => { row.push(cell.trim()); cell = ''; };
230
- const endRow = () => {
231
- endCell();
232
- if (row.some((value) => value.length > 0)) rows.push(row);
233
- row = [];
234
- };
235
- for (let index = 0; index < text.length; index += 1) {
236
- const character = text.charAt(index);
237
- if (quoted) {
238
- if (character !== '"') cell += character;
239
- else if (text.charAt(index + 1) === '"') { cell += '"'; index += 1; } else quoted = false;
240
- } else if (character === '"') quoted = true;
241
- else if (character === delimiter) endCell();
242
- else if (character === '\n' || character === '\r') {
243
- if (character === '\r' && text.charAt(index + 1) === '\n') index += 1;
244
- endRow();
245
- } else cell += character;
246
- }
247
- endRow();
248
- return { rows, unterminated: quoted };
249
- }
250
-
251
- /** Turns delimited text (CSV, TSV) into table preview data. */
252
- export function tablePreviewFromDelimited(text: string, options: DelimitedPreviewOptions = {}): TablePreviewData {
253
- const delimiter = options.delimiter ?? ',';
254
- const maxRows = options.maxRows ?? 30;
255
- const maxColumns = options.maxColumns ?? 30;
256
- const parsed = parseDelimited(text, delimiter);
257
- const [allHeaders = [], ...records] = parsed.rows;
258
- // A byte-limited sample may end inside a record (or inside a quoted cell);
259
- // that record is dropped, and the total row count is unknown.
260
- const sampled = Boolean(options.sourceTruncated);
261
- const lastComplete = /\r?\n$/.test(text) && !parsed.unterminated;
262
- const body = sampled && !lastComplete ? records.slice(0, -1) : records;
263
- const headers = allHeaders.slice(0, maxColumns);
264
- const rows = body.slice(0, maxRows).map((cells) => cells.slice(0, maxColumns));
265
- return {
266
- kind: 'table',
267
- headers,
268
- rows,
269
- ...(sampled ? {} : { totalRows: body.length }),
270
- totalColumns: allHeaders.length,
271
- truncated: sampled || body.length > maxRows || allHeaders.length > maxColumns,
272
- };
273
- }
274
-
275
- /** Turns an array of flat objects (e.g. parsed JSON records) into table preview data. */
276
- export function tablePreviewFromRows(
277
- records: readonly Record<string, unknown>[],
278
- options: Pick<DelimitedPreviewOptions, 'maxRows' | 'maxColumns' | 'sourceTruncated'> = {},
279
- ): TablePreviewData {
280
- const maxRows = options.maxRows ?? 30;
281
- const maxColumns = options.maxColumns ?? 30;
282
- const allHeaders = [...new Set(records.flatMap((record) => Object.keys(record)))];
283
- const headers = allHeaders.slice(0, maxColumns);
284
- const rows = records.slice(0, maxRows).map((record) => headers.map((header) => {
285
- const value = record[header];
286
- if (value == null) return null;
287
- if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string') return value;
288
- return JSON.stringify(value);
289
- }));
290
- return {
291
- kind: 'table',
292
- headers,
293
- rows,
294
- totalRows: records.length,
295
- totalColumns: allHeaders.length,
296
- truncated: Boolean(options.sourceTruncated) || records.length > maxRows || allHeaders.length > maxColumns,
297
- };
298
- }
299
-
300
- /** Reads a metric from a scalar or a `{ value, uncertainty?, unit?, label? }` object; `undefined` when the shape is not a metric. */
301
- export function metricPreviewFromJson(value: unknown): MetricPreviewData | undefined {
302
- if (typeof value === 'number' || typeof value === 'string') return { kind: 'metric', value };
303
- if (value && typeof value === 'object' && 'value' in value) {
304
- const record = value as Record<string, unknown>;
305
- const metric = record.value;
306
- if (typeof metric !== 'number' && typeof metric !== 'string') return undefined;
307
- const result: MetricPreviewData = { kind: 'metric', value: metric };
308
- if (typeof record.uncertainty === 'number' || typeof record.uncertainty === 'string') result.uncertainty = record.uncertainty;
309
- if (typeof record.unit === 'string') result.unit = record.unit;
310
- if (typeof record.label === 'string') result.label = record.label;
311
- return result;
312
- }
313
- return undefined;
314
- }
@@ -4,7 +4,8 @@ import { recordTitle } from '../model/records.js';
4
4
  import { useLabels } from '../lib/labels.js';
5
5
  import { CountHeading, DetailLayout, DetailMain, DetailSection } from '../primitives/detail-layout.js';
6
6
  import { DetailDialog, type DetailDialogProps } from '../primitives/dialog.js';
7
- import { Prose, type TextRenderer } from '../primitives/prose.js';
7
+ import { Prose } from '../primitives/prose.js';
8
+ import type { TextRenderer } from '../lib/prose.js';
8
9
  import { InsightTrigger } from './insight-trigger.js';
9
10
 
10
11
  export interface DecisionDetailProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
@@ -7,9 +7,10 @@ import { cn } from '../lib/cn.js';
7
7
  import { useLabels } from '../lib/labels.js';
8
8
  import { DetailLayout, DetailMain } from '../primitives/detail-layout.js';
9
9
  import { DetailDialog, type DetailDialogProps } from '../primitives/dialog.js';
10
- import { Prose, type TextRenderer } from '../primitives/prose.js';
10
+ import { Prose } from '../primitives/prose.js';
11
+ import type { TextRenderer } from '../lib/prose.js';
11
12
  import { RelationList } from '../primitives/relation-list.js';
12
- import type { OpenRecordHandler } from './relation-items.js';
13
+ import type { OpenRecordHandler } from '../lib/detail-stack.js';
13
14
 
14
15
  export interface FindingDetailProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
15
16
  record: ResolvedInsight;