@astra-spec/ui 0.0.2 → 0.0.4
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.
- package/README.md +231 -20
- package/TOKENS.md +10 -3
- package/components.css +2 -0
- package/dist/blocks/decisions-list.d.ts +0 -1
- package/dist/blocks/decisions-list.d.ts.map +1 -1
- package/dist/blocks/decisions-list.js +1 -5
- package/dist/blocks/decisions-list.js.map +1 -1
- package/dist/blocks/index.d.ts +3 -3
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/blocks/index.js +2 -2
- package/dist/blocks/index.js.map +1 -1
- package/dist/blocks/inputs-list.js +1 -1
- package/dist/blocks/inputs-list.js.map +1 -1
- package/dist/blocks/outputs-list.d.ts +2 -2
- package/dist/blocks/outputs-list.d.ts.map +1 -1
- package/dist/blocks/outputs-list.js +15 -19
- package/dist/blocks/outputs-list.js.map +1 -1
- package/dist/blocks/section.d.ts +1 -4
- package/dist/blocks/section.d.ts.map +1 -1
- package/dist/blocks/section.js +1 -12
- package/dist/blocks/section.js.map +1 -1
- package/dist/components/artifact-preview.d.ts +2 -54
- package/dist/components/artifact-preview.d.ts.map +1 -1
- package/dist/components/artifact-preview.js +2 -107
- package/dist/components/artifact-preview.js.map +1 -1
- package/dist/components/decision-detail.d.ts +1 -1
- package/dist/components/decision-detail.d.ts.map +1 -1
- package/dist/components/decision-detail.js.map +1 -1
- package/dist/components/finding-detail.d.ts +2 -2
- package/dist/components/finding-detail.d.ts.map +1 -1
- package/dist/components/finding-detail.js.map +1 -1
- package/dist/components/index.d.ts +11 -13
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +7 -8
- package/dist/components/index.js.map +1 -1
- package/dist/components/input-detail.d.ts +1 -2
- package/dist/components/input-detail.d.ts.map +1 -1
- package/dist/components/input-detail.js +0 -3
- package/dist/components/input-detail.js.map +1 -1
- package/dist/components/insight-detail.d.ts +2 -8
- package/dist/components/insight-detail.d.ts.map +1 -1
- package/dist/components/insight-detail.js +5 -11
- package/dist/components/insight-detail.js.map +1 -1
- package/dist/components/insight-trigger.d.ts +1 -1
- package/dist/components/insight-trigger.d.ts.map +1 -1
- package/dist/components/insight-trigger.js.map +1 -1
- package/dist/components/output-detail.d.ts +2 -7
- package/dist/components/output-detail.d.ts.map +1 -1
- package/dist/components/output-detail.js +3 -30
- package/dist/components/output-detail.js.map +1 -1
- package/dist/components/output-dialog.d.ts +2 -2
- package/dist/components/output-dialog.d.ts.map +1 -1
- package/dist/components/output-dialog.js +2 -1
- package/dist/components/output-dialog.js.map +1 -1
- package/dist/components/paper-detail.d.ts +14 -14
- package/dist/components/paper-detail.d.ts.map +1 -1
- package/dist/components/paper-detail.js +49 -29
- package/dist/components/paper-detail.js.map +1 -1
- package/dist/components/paper-pdf-viewer.d.ts +19 -0
- package/dist/components/paper-pdf-viewer.d.ts.map +1 -0
- package/dist/components/paper-pdf-viewer.js +250 -0
- package/dist/components/paper-pdf-viewer.js.map +1 -0
- package/dist/components/record-dialog.d.ts +7 -5
- package/dist/components/record-dialog.d.ts.map +1 -1
- package/dist/components/record-dialog.js +7 -5
- package/dist/components/record-dialog.js.map +1 -1
- package/dist/components/record-preview.d.ts +61 -0
- package/dist/components/record-preview.d.ts.map +1 -0
- package/dist/components/record-preview.js +177 -0
- package/dist/components/record-preview.js.map +1 -0
- package/dist/components/relation-items.d.ts +1 -1
- package/dist/components/relation-items.d.ts.map +1 -1
- package/dist/components/relation-items.js +10 -3
- package/dist/components/relation-items.js.map +1 -1
- package/dist/{components/use-detail-stack.d.ts → lib/detail-stack.d.ts} +17 -2
- package/dist/lib/detail-stack.d.ts.map +1 -0
- package/dist/{components/use-detail-stack.js → lib/detail-stack.js} +15 -2
- package/dist/lib/detail-stack.js.map +1 -0
- package/dist/lib/index.d.ts +14 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +9 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/labels.d.ts +32 -0
- package/dist/lib/labels.d.ts.map +1 -1
- package/dist/lib/labels.js +32 -0
- package/dist/lib/labels.js.map +1 -1
- package/dist/lib/pdf-quote.d.ts +47 -0
- package/dist/lib/pdf-quote.d.ts.map +1 -0
- package/dist/lib/pdf-quote.js +154 -0
- package/dist/lib/pdf-quote.js.map +1 -0
- package/dist/lib/pdf-runtime.d.ts +102 -0
- package/dist/lib/pdf-runtime.d.ts.map +1 -0
- package/dist/lib/pdf-runtime.js +48 -0
- package/dist/lib/pdf-runtime.js.map +1 -0
- package/dist/lib/preview-data.d.ts +55 -0
- package/dist/lib/preview-data.d.ts.map +1 -0
- package/dist/lib/preview-data.js +108 -0
- package/dist/lib/preview-data.js.map +1 -0
- package/dist/lib/prose.d.ts +37 -0
- package/dist/lib/prose.d.ts.map +1 -0
- package/dist/lib/prose.js +60 -0
- package/dist/lib/prose.js.map +1 -0
- package/dist/lib/use-isomorphic-layout-effect.d.ts +4 -0
- package/dist/lib/use-isomorphic-layout-effect.d.ts.map +1 -0
- package/dist/lib/use-isomorphic-layout-effect.js +4 -0
- package/dist/lib/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/lib/use-output-expanded.d.ts +7 -0
- package/dist/lib/use-output-expanded.d.ts.map +1 -0
- package/dist/lib/use-output-expanded.js +29 -0
- package/dist/lib/use-output-expanded.js.map +1 -0
- package/dist/model/index.d.ts +5 -3
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +3 -2
- package/dist/model/index.js.map +1 -1
- package/dist/{primitives → model}/kind.d.ts +3 -0
- package/dist/model/kind.d.ts.map +1 -0
- package/dist/model/kind.js +25 -0
- package/dist/model/kind.js.map +1 -0
- package/dist/model/papers.d.ts +6 -6
- package/dist/model/papers.d.ts.map +1 -1
- package/dist/model/papers.js +8 -0
- package/dist/model/papers.js.map +1 -1
- package/dist/model/records.d.ts +5 -1
- package/dist/model/records.d.ts.map +1 -1
- package/dist/model/records.js +9 -0
- package/dist/model/records.js.map +1 -1
- package/dist/primitives/badge.d.ts +1 -1
- package/dist/primitives/badge.d.ts.map +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/button.js.map +1 -1
- package/dist/primitives/dialog.d.ts +1 -1
- package/dist/primitives/dialog.d.ts.map +1 -1
- package/dist/primitives/dialog.js +3 -3
- package/dist/primitives/dialog.js.map +1 -1
- package/dist/primitives/index.d.ts +6 -9
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +3 -5
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/preview-popover.d.ts +30 -0
- package/dist/primitives/preview-popover.d.ts.map +1 -0
- package/dist/primitives/preview-popover.js +132 -0
- package/dist/primitives/preview-popover.js.map +1 -0
- package/dist/primitives/prose.d.ts +1 -29
- package/dist/primitives/prose.d.ts.map +1 -1
- package/dist/primitives/prose.js +2 -50
- package/dist/primitives/prose.js.map +1 -1
- package/dist/primitives/record-list.d.ts +1 -1
- package/dist/primitives/record-list.d.ts.map +1 -1
- package/dist/primitives/record-list.js +1 -1
- package/dist/primitives/record-list.js.map +1 -1
- package/dist/primitives/relation-list.d.ts +1 -1
- package/dist/primitives/relation-list.d.ts.map +1 -1
- package/dist/primitives/relation-list.js +1 -1
- package/dist/primitives/relation-list.js.map +1 -1
- package/dist/primitives/slot.d.ts.map +1 -0
- package/dist/{lib → primitives}/slot.js +1 -1
- package/dist/primitives/slot.js.map +1 -0
- package/dist/primitives/surface-header.d.ts +1 -1
- package/dist/primitives/surface-header.d.ts.map +1 -1
- package/dist/views/inventory.d.ts +7 -5
- package/dist/views/inventory.d.ts.map +1 -1
- package/dist/views/inventory.js +5 -4
- package/dist/views/inventory.js.map +1 -1
- package/package.json +12 -1
- package/primitives.css +1 -0
- package/src/blocks/decisions-list.tsx +1 -6
- package/src/blocks/index.ts +2 -3
- package/src/blocks/inputs-list.tsx +1 -1
- package/src/blocks/outputs-list.tsx +53 -30
- package/src/blocks/section.tsx +1 -14
- package/src/components/artifact-preview.tsx +6 -161
- package/src/components/decision-detail.tsx +2 -1
- package/src/components/finding-detail.tsx +3 -2
- package/src/components/index.ts +19 -29
- package/src/components/input-detail.tsx +2 -5
- package/src/components/insight-detail.tsx +20 -35
- package/src/components/insight-trigger.tsx +2 -1
- package/src/components/output-detail.tsx +17 -38
- package/src/components/output-dialog.tsx +4 -3
- package/src/components/paper-detail.tsx +121 -66
- package/src/components/paper-pdf-viewer.tsx +319 -0
- package/src/components/record-dialog.tsx +15 -10
- package/src/components/record-preview.tsx +762 -0
- package/src/components/relation-items.ts +15 -5
- package/src/{components/use-detail-stack.ts → lib/detail-stack.ts} +24 -1
- package/src/lib/index.ts +22 -0
- package/src/lib/labels.tsx +67 -0
- package/src/lib/pdf-quote.ts +189 -0
- package/src/lib/pdf-runtime.ts +131 -0
- package/src/lib/preview-data.ts +155 -0
- package/src/lib/prose.tsx +87 -0
- package/src/lib/use-isomorphic-layout-effect.ts +4 -0
- package/src/lib/use-output-expanded.ts +27 -0
- package/src/model/index.ts +4 -2
- package/src/{primitives → model}/kind.ts +14 -0
- package/src/model/papers.ts +9 -7
- package/src/model/records.ts +12 -0
- package/src/primitives/badge.tsx +1 -1
- package/src/primitives/button.tsx +1 -1
- package/src/primitives/dialog.tsx +3 -5
- package/src/primitives/index.ts +9 -9
- package/src/primitives/preview-popover.tsx +278 -0
- package/src/primitives/prose.tsx +1 -63
- package/src/primitives/record-list.tsx +1 -1
- package/src/primitives/relation-list.tsx +1 -1
- package/src/{lib → primitives}/slot.tsx +1 -1
- package/src/primitives/surface-header.tsx +1 -1
- package/src/views/inventory.tsx +12 -8
- package/styles/blocks/analysis-tree.css +2 -2
- package/styles/blocks/decisions-list.css +4 -4
- package/styles/blocks/outputs-list.css +246 -19
- package/styles/blocks/papers-list.css +2 -2
- package/styles/components/artifact-preview.css +6 -6
- package/styles/components/decision-detail.css +2 -2
- package/styles/components/evidence.css +2 -2
- package/styles/components/input-detail.css +4 -4
- package/styles/components/insight-detail.css +56 -94
- package/styles/components/insight-list.css +3 -3
- package/styles/components/insight-trigger.css +1 -4
- package/styles/components/output-detail.css +25 -140
- package/styles/components/paper-detail.css +76 -95
- package/styles/components/paper-doi.css +3 -12
- package/styles/components/paper-pdf-viewer.css +120 -0
- package/styles/components/record-preview.css +316 -0
- package/styles/primitives/badge.css +1 -1
- package/styles/primitives/count-heading.css +2 -2
- package/styles/primitives/detail-layout.css +5 -5
- package/styles/primitives/dialog.css +9 -9
- package/styles/primitives/preview-popover.css +76 -0
- package/styles/primitives/record-list.css +17 -17
- package/styles/primitives/relation-list.css +6 -6
- package/styles/primitives/surface-header.css +5 -5
- package/styles/tokens.css +16 -3
- package/styles/views/inventory.css +3 -3
- package/dist/components/detail-entry.d.ts +0 -15
- package/dist/components/detail-entry.d.ts.map +0 -1
- package/dist/components/detail-entry.js +0 -14
- package/dist/components/detail-entry.js.map +0 -1
- package/dist/components/use-detail-stack.d.ts.map +0 -1
- package/dist/components/use-detail-stack.js.map +0 -1
- package/dist/lib/slot.d.ts.map +0 -1
- package/dist/lib/slot.js.map +0 -1
- package/dist/primitives/kind.d.ts.map +0 -1
- package/dist/primitives/kind.js +0 -14
- package/dist/primitives/kind.js.map +0 -1
- package/src/components/detail-entry.ts +0 -19
- /package/dist/{lib → primitives}/slot.d.ts +0 -0
package/README.md
CHANGED
|
@@ -63,9 +63,10 @@ layer you need:
|
|
|
63
63
|
| --- | --- | --- |
|
|
64
64
|
| `@astra-spec/ui/views` | Complete, ready-made surfaces | `Inventory` |
|
|
65
65
|
| `@astra-spec/ui/blocks` | Sections that can be assembled into a custom page | `AnalysisTree`, inventory lists, `InventorySection`, `InventoryOutline` |
|
|
66
|
-
| `@astra-spec/ui/components` | One ASTRA record or paper at a time | `*Detail`, `*Dialog`, `RecordDialog`, `ArtifactPreview`, `
|
|
67
|
-
| `@astra-spec/ui/primitives` | Generic presentation with no resolved ASTRA model dependency beyond record kinds | Buttons, badges,
|
|
68
|
-
| `@astra-spec/ui/model` | Pure, React-free derivations over SDK data | Record lookup, relationships, paper collection, display labels, DOI helpers |
|
|
66
|
+
| `@astra-spec/ui/components` | One ASTRA record or paper at a time | `*Detail`, `*Dialog`, `RecordDialog`, `RecordPreview`, `ArtifactPreview`, `PaperPdfViewer` |
|
|
67
|
+
| `@astra-spec/ui/primitives` | Generic presentation with no resolved ASTRA model dependency beyond record kinds | Buttons, badges, dialogs, `PreviewPopover`, detail-layout compounds, lists, `Prose` |
|
|
68
|
+
| `@astra-spec/ui/model` | Pure, React-free derivations over SDK data | Record lookup, relationships, paper collection, display labels, record kinds, DOI helpers |
|
|
69
|
+
| `@astra-spec/ui/lib` | The machinery behind the elements | `useDetailStack`, `LabelsProvider`, `renderProse`, preview-data builders, `pdfJsWithWorker` |
|
|
69
70
|
|
|
70
71
|
Every public file also has a direct subpath, such as
|
|
71
72
|
`@astra-spec/ui/components/output-dialog` or
|
|
@@ -84,7 +85,8 @@ Its most useful options are:
|
|
|
84
85
|
- `analysisPath` selects a nested analysis (`$` is the project root).
|
|
85
86
|
- `sections` changes which inventory sections appear and their order.
|
|
86
87
|
- `showOutline` and `idPrefix` control outline navigation.
|
|
87
|
-
- `renderArtifact
|
|
88
|
+
- `renderArtifact` and `renderText` replace host-owned content.
|
|
89
|
+
- `loadPdfJs` enables the built-in PDF viewer; `onOpenPaperFile` overrides external PDF opening.
|
|
88
90
|
- `paperMetadata` and `onFetchPaper` connect paper loading to host state.
|
|
89
91
|
- `detail`, `defaultDetail`, and `onDetailChange` control the detail stack.
|
|
90
92
|
- `detailMode="embedded"` renders details as an inline panel instead of a modal.
|
|
@@ -120,7 +122,7 @@ Each ASTRA record kind has both a dialog and a dialog-free detail body:
|
|
|
120
122
|
| `InputDialog`, `InputDetail` | Input type, source, and authored description |
|
|
121
123
|
| `FindingDialog`, `FindingDetail` | Finding claim, artifact-backed evidence, and literature evidence |
|
|
122
124
|
| `InsightDialog`, `InsightDetail`, `InsightTrigger`, `InsightEvidenceTitle` | Prior-insight claims, quoted sources, evidence labels, and decisions informed by the insight |
|
|
123
|
-
| `PaperDialog`, `PaperDetail`, `PaperDialogActions` | Paper metadata,
|
|
125
|
+
| `PaperDialog`, `PaperDetail`, `PaperDialogActions`, `PaperPdfViewer` | Paper metadata, in-place PDF reading with located passages, related insights and decisions, and DOI actions |
|
|
124
126
|
|
|
125
127
|
Use a `*Dialog` when you already have the record and any derived relationship
|
|
126
128
|
data. Use the corresponding `*Detail` inside a sidebar, route, or your own
|
|
@@ -138,6 +140,61 @@ Dialogs support two modes:
|
|
|
138
140
|
and Escape/backdrop dismissal.
|
|
139
141
|
- `mode="embedded"` renders the same chrome as an inline panel.
|
|
140
142
|
|
|
143
|
+
### Record previews
|
|
144
|
+
|
|
145
|
+
`RecordPreview` is compact, positioning-agnostic content for three entry
|
|
146
|
+
shapes: a resolved record, an analysis node, or the contextual value emitted by
|
|
147
|
+
an inline ASTRA value. It preserves kind-specific evidence and provenance while
|
|
148
|
+
leaving artifact decoding, authored-text rendering, citation formatting, and
|
|
149
|
+
navigation with the host.
|
|
150
|
+
|
|
151
|
+
`PreviewPopover` is the matching generic primitive. It opens after a short
|
|
152
|
+
pointer-hover delay or immediately on keyboard focus, remains open while the
|
|
153
|
+
pointer or focus is inside it, flips and shifts at viewport edges, and dismisses
|
|
154
|
+
with Escape. Preview content may contain links, buttons, and nested previews,
|
|
155
|
+
so it is exposed as a non-modal dialog rather than a tooltip.
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
import { indexAnalysis, type ResolvedDecision } from '@astra-spec/sdk';
|
|
159
|
+
import { RecordPreview } from '@astra-spec/ui/components';
|
|
160
|
+
import { PreviewPopover } from '@astra-spec/ui/primitives';
|
|
161
|
+
import '@astra-spec/ui/components.css';
|
|
162
|
+
|
|
163
|
+
const index = indexAnalysis(document);
|
|
164
|
+
const decision = index.recordByPath.get('decisions.method') as ResolvedDecision;
|
|
165
|
+
const analysis = index.analysisByRecordPath.get(decision.canonicalPath)!;
|
|
166
|
+
|
|
167
|
+
<PreviewPopover
|
|
168
|
+
label={`Decision preview: ${decision.label}`}
|
|
169
|
+
kind="decision"
|
|
170
|
+
trigger={<button type="button">{decision.label}</button>}
|
|
171
|
+
portalProps={{
|
|
172
|
+
// Portaled content cannot inherit classes or attributes from the trigger.
|
|
173
|
+
className: 'your-brand-scope',
|
|
174
|
+
'data-astra-color-scheme': 'light',
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
<RecordPreview
|
|
178
|
+
entry={{ kind: 'record', record: decision, analysis }}
|
|
179
|
+
document={document}
|
|
180
|
+
index={index}
|
|
181
|
+
renderArtifact={renderArtifact}
|
|
182
|
+
renderText={renderText}
|
|
183
|
+
renderCitation={(doi) => <Cite doi={doi} />}
|
|
184
|
+
onOpenRecord={openFullRecord}
|
|
185
|
+
/>
|
|
186
|
+
</PreviewPopover>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The portal wrapper establishes an `astra-ui` scope when its mount does not
|
|
190
|
+
already inherit one. Use `portalProps` to add a brand scope and synchronize
|
|
191
|
+
`data-astra-color-scheme` plus any brand-specific scheme attribute. Alternatively,
|
|
192
|
+
mount it under an already-scoped element with `portalRoot`; with no `portalProps`,
|
|
193
|
+
the wrapper preserves that scope instead of creating a nested token root.
|
|
194
|
+
`renderRecordReference` receives each related record and its default trigger so
|
|
195
|
+
a host can wrap decision insights and finding outputs in a nested
|
|
196
|
+
`PreviewPopover` without copying preview markup.
|
|
197
|
+
|
|
141
198
|
### Artifact previews
|
|
142
199
|
|
|
143
200
|
The UI package does not read artifact files. `ArtifactPreview` renders safe,
|
|
@@ -145,11 +202,8 @@ host-provided preview data in six states: table, image, metric, text, loading,
|
|
|
145
202
|
or unavailable.
|
|
146
203
|
|
|
147
204
|
```tsx
|
|
148
|
-
import {
|
|
149
|
-
|
|
150
|
-
type ArtifactPreviewData,
|
|
151
|
-
type ArtifactRenderer,
|
|
152
|
-
} from '@astra-spec/ui/components';
|
|
205
|
+
import { ArtifactPreview, type ArtifactRenderer } from '@astra-spec/ui/components';
|
|
206
|
+
import type { ArtifactPreviewData } from '@astra-spec/ui/lib';
|
|
153
207
|
|
|
154
208
|
export function createArtifactRenderer(
|
|
155
209
|
previews: ReadonlyMap<string, ArtifactPreviewData>,
|
|
@@ -165,8 +219,8 @@ export function createArtifactRenderer(
|
|
|
165
219
|
```
|
|
166
220
|
|
|
167
221
|
`tablePreviewFromDelimited`, `tablePreviewFromRows`, and
|
|
168
|
-
`metricPreviewFromJson` turn already-loaded host data
|
|
169
|
-
perform no I/O.
|
|
222
|
+
`metricPreviewFromJson` from `@astra-spec/ui/lib` turn already-loaded host data
|
|
223
|
+
into preview values. They perform no I/O.
|
|
170
224
|
|
|
171
225
|
### Primitives
|
|
172
226
|
|
|
@@ -175,6 +229,7 @@ The primitive layer is useful for building surfaces that match the library:
|
|
|
175
229
|
| Components | Purpose |
|
|
176
230
|
| --- | --- |
|
|
177
231
|
| `Button`, `IconButton`, `Badge` | Controls and status/kind labels |
|
|
232
|
+
| `PreviewPopover` | Accessible hover/focus positioning, viewport bounds, portal scoping, and nested preview coordination |
|
|
178
233
|
| `SurfaceHeader` | Reusable title, eyebrow, identifier, leading, and action layout |
|
|
179
234
|
| `Dialog`, `DialogProvider`, `DialogContent`, `DialogHeader`, `DialogBody`, `DialogClose`, `DialogBack`, `DialogAction` | Compound dialog context, state, and presentation building blocks |
|
|
180
235
|
| `DetailDialog` | Preset dialog shell used by record and paper dialogs |
|
|
@@ -182,10 +237,9 @@ The primitive layer is useful for building surfaces that match the library:
|
|
|
182
237
|
| `RecordList`, `RecordIdentity`, `EmptyState` | Accessible, column-aligned record lists |
|
|
183
238
|
| `RelationList` | Counted related-record lists with optional navigation triggers |
|
|
184
239
|
| `Prose` | Authored text with built-in inline code and KaTeX math rendering |
|
|
185
|
-
| `LabelsProvider` | Scoped user-facing label overrides |
|
|
186
240
|
|
|
187
|
-
The layer also exports `Slot`,
|
|
188
|
-
and
|
|
241
|
+
The layer also exports `Slot`, the dialog hooks, and their public types. Class
|
|
242
|
+
name merging (`cn`), prose parsing and the label helpers are in `@astra-spec/ui/lib`.
|
|
189
243
|
|
|
190
244
|
## Host extension points
|
|
191
245
|
|
|
@@ -193,15 +247,169 @@ and their public types.
|
|
|
193
247
|
Without it, outputs use `ArtifactPreview`'s unavailable state.
|
|
194
248
|
- `renderText(text, { field })` replaces the built-in prose renderer. The
|
|
195
249
|
default understands inline code, `$inline$` math, and `$$display$$` math.
|
|
196
|
-
|
|
250
|
+
Hosts that only need custom math commands can reuse that renderer with
|
|
251
|
+
`renderProse(text, { macros })`; macro values are KaTeX expansion strings.
|
|
252
|
+
- `loadPdfJs()` supplies pdf.js for reading papers in place and locating their quoted passages.
|
|
253
|
+
- `onOpenPaperFile(paper)` opens a PDF through the host; otherwise the dialog uses a normal link.
|
|
197
254
|
- `onFetchPaper(doi)` asks the host to load paper data. Feed the result and
|
|
198
255
|
`status: 'fetching' | 'error'` back through `paperMetadata`.
|
|
199
256
|
- `labels` on `Inventory`, or `LabelsProvider` around lower-level components,
|
|
200
257
|
overrides the default UI copy.
|
|
201
258
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
259
|
+
The host owns paper discovery, downloading, authentication and resource URLs;
|
|
260
|
+
the viewer only loads the URL it is given.
|
|
261
|
+
|
|
262
|
+
## PDF reading and passage navigation
|
|
263
|
+
|
|
264
|
+
`Inventory`, `RecordDialog`, `PaperDialog` and `PaperDetail` read a paper in
|
|
265
|
+
place when its metadata carries a `pdfUrl` and the host supplies `loadPdfJs`:
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
<Inventory
|
|
269
|
+
document={document}
|
|
270
|
+
paperMetadata={paperMetadata}
|
|
271
|
+
loadPdfJs={loadPdfJs}
|
|
272
|
+
onFetchPaper={fetchPaper}
|
|
273
|
+
/>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
`loadPdfJs` returns pdf.js itself. Import the module inside the callback, so
|
|
277
|
+
server rendering never touches browser APIs, and point
|
|
278
|
+
`GlobalWorkerOptions.workerSrc` at the matching worker script:
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
import type { PdfJsLoader } from '@astra-spec/ui/lib';
|
|
282
|
+
import workerUrl from 'pdfjs-dist/legacy/build/pdf.worker.min.mjs?url';
|
|
283
|
+
|
|
284
|
+
export const loadPdfJs: PdfJsLoader = async () => {
|
|
285
|
+
const pdfjs = await import('pdfjs-dist/legacy/build/pdf.mjs');
|
|
286
|
+
pdfjs.GlobalWorkerOptions.workerSrc = workerUrl;
|
|
287
|
+
return pdfjs;
|
|
288
|
+
};
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
pdf.js then starts one worker per open document, renders on the main thread
|
|
292
|
+
if that worker cannot start, and terminates the worker when the viewer
|
|
293
|
+
releases the document. The package has no pdf.js dependency: `PdfJs` is the
|
|
294
|
+
structural subset of the module the viewer uses (`getDocument` and
|
|
295
|
+
`TextLayer`), so any release whose module satisfies it can be supplied. The
|
|
296
|
+
legacy build of pdf.js 4.8.69 is the one validated in the package's browser
|
|
297
|
+
tests; it and its worker polyfill the supported browser floor, so use the
|
|
298
|
+
legacy runtime and worker together.
|
|
299
|
+
|
|
300
|
+
`workerSrc` is whatever URL your build serves the worker file from:
|
|
301
|
+
|
|
302
|
+
- Vite: the `?url` import above.
|
|
303
|
+
- webpack or rspack:
|
|
304
|
+
`new URL('pdfjs-dist/legacy/build/pdf.worker.min.mjs', import.meta.url).href`,
|
|
305
|
+
provided the build emits `.mjs` files referenced this way as assets. A build
|
|
306
|
+
whose rules process every `.mjs` file as JavaScript bundles the worker into
|
|
307
|
+
the main script instead. There, create the worker yourself with the
|
|
308
|
+
bundler-native form and let `pdfJsWithWorker` do the rest:
|
|
309
|
+
|
|
310
|
+
```ts
|
|
311
|
+
import { pdfJsWithWorker, type PdfJsLoader } from '@astra-spec/ui/lib';
|
|
312
|
+
|
|
313
|
+
export const loadPdfJs: PdfJsLoader = async () => pdfJsWithWorker(
|
|
314
|
+
await import('pdfjs-dist/legacy/build/pdf.mjs'),
|
|
315
|
+
() => new Worker(new URL('pdfjs-dist/legacy/build/pdf.worker.min.mjs', import.meta.url), { type: 'module' }),
|
|
316
|
+
);
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
It starts one worker per document, fails loading instead of hanging when
|
|
320
|
+
the script cannot start, and terminates the worker with the document.
|
|
321
|
+
- A page served from a restricted origin, such as an editor's embedded web
|
|
322
|
+
view: copy `pdf.mjs` and the worker next to the page and import the runtime
|
|
323
|
+
by URL at load time. Start the worker from the document, where its origin
|
|
324
|
+
is known: fetch the worker script, wrap it in a blob URL, and hand that to
|
|
325
|
+
`pdfJsWithWorker` (`() => new Worker(blobUrl, { type: 'module' })`). This
|
|
326
|
+
needs only `worker-src blob:` in the page's content security policy. Using
|
|
327
|
+
the worker's resource URL as `workerSrc` also works where the host serves
|
|
328
|
+
fetches made from inside a worker, but pdf.js then starts it through a blob
|
|
329
|
+
wrapper that imports that URL, so `script-src` must cover the worker's
|
|
330
|
+
origin as well; under a strict policy there is no main-thread fallback
|
|
331
|
+
either way. Never set `GlobalWorkerOptions.workerPort`: it overrides
|
|
332
|
+
`workerSrc` and makes every document share one worker that is never
|
|
333
|
+
terminated.
|
|
334
|
+
|
|
335
|
+
Decide the worker route once, before the first document opens: after a worker
|
|
336
|
+
fails to start, pdf.js keeps every later document on the main thread for the
|
|
337
|
+
lifetime of the page.
|
|
338
|
+
|
|
339
|
+
Document options such as `cMapUrl`, `standardFontDataUrl`, `httpHeaders` or
|
|
340
|
+
`withCredentials` are added by wrapping `getDocument`:
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
return {
|
|
344
|
+
TextLayer: pdfjs.TextLayer,
|
|
345
|
+
getDocument: (options) => pdfjs.getDocument({ ...options, cMapUrl, cMapPacked: true }),
|
|
346
|
+
};
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Locating passages
|
|
350
|
+
|
|
351
|
+
Each quoted passage in the paper's insight rail has a Locate control, and a
|
|
352
|
+
dialog opened with `focusInsightPath` locates that insight's first passage on
|
|
353
|
+
its own. The viewer searches the cited physical page first, prefers a
|
|
354
|
+
complete match anywhere in the document to a shortened prefix, and labels
|
|
355
|
+
partial results. When nothing matches it shows the cited page if the document
|
|
356
|
+
has one, or reports that the quote was not found. Pages are one-based
|
|
357
|
+
physical page indices, not printed labels. Matching tolerates split text runs,
|
|
358
|
+
ligatures, whitespace, hyphenation, curly quotes and accents the PDF kept,
|
|
359
|
+
decomposed or lost; it marks the original text without interpreting it. Text
|
|
360
|
+
is extracted once per page for the open document and shared between the
|
|
361
|
+
selectable text layer and search. There is no OCR and no use of a quote's
|
|
362
|
+
prefix or suffix to disambiguate repeated text, so scanned PDFs and quotes
|
|
363
|
+
spanning pages fall back to the cited page. Matching is navigation
|
|
364
|
+
assistance, not evidence verification.
|
|
365
|
+
|
|
366
|
+
### The viewer on its own
|
|
367
|
+
|
|
368
|
+
`PaperPdfViewer` from `@astra-spec/ui/components` takes `pdfUrl`, `title`,
|
|
369
|
+
`loadPdfJs`, an optional `passage` (`{ key, quote?, page? }`; repeat a passage
|
|
370
|
+
under a new `key` to scroll to it again) and `onLoadStateChange(state, error?)`,
|
|
371
|
+
which reports `'loading'`, `'ready'` or `'error'` with the failure reason.
|
|
372
|
+
Neither callback needs a stable identity: `onLoadStateChange` always calls the
|
|
373
|
+
latest function, and `loadPdfJs` is read once when a document mounts, so a
|
|
374
|
+
replacement is ignored until `pdfUrl` changes or the viewer remounts. Give the
|
|
375
|
+
viewer a container with a defined height and import `components.css` or a
|
|
376
|
+
higher bundle; it handles zoom, selectable text, nearby-page rendering, and
|
|
377
|
+
releases distant canvases while keeping page geometry. `PaperDetail` composes
|
|
378
|
+
it with the insight rail and makes the Locate controls inert after a load
|
|
379
|
+
failure. A host that mounts `PaperDetail` outside a dialog adds
|
|
380
|
+
`PaperDialogActions`, or its own link, to open the file elsewhere.
|
|
381
|
+
|
|
382
|
+
`onOpenPaperFile(paper)` overrides the dialog header's open action, for a host
|
|
383
|
+
that cannot open the PDF URL in a browser tab. It receives the `InventoryPaper`
|
|
384
|
+
with its `pdfUrl`. It is distinct from `onOpenPaper`, which navigates to paper
|
|
385
|
+
details. `onFetchPaper` remains an explicit acquisition request, with status
|
|
386
|
+
and errors returned through `paperMetadata`; opening a dialog never downloads
|
|
387
|
+
a missing paper through that callback.
|
|
388
|
+
|
|
389
|
+
All viewer messages and accessible names are overridable through `labels.pdf`
|
|
390
|
+
on `Inventory`, or through `LabelsProvider` for standalone paper components.
|
|
391
|
+
Dynamic entries receive page numbers, counts, paper titles, or zoom
|
|
392
|
+
percentages:
|
|
393
|
+
|
|
394
|
+
```tsx
|
|
395
|
+
<LabelsProvider labels={{ pdf: {
|
|
396
|
+
loading: 'Chargement…',
|
|
397
|
+
zoomIn: 'Agrandir',
|
|
398
|
+
quoteHighlighted: (page, total) => `Citation sur la page ${page}/${total}`,
|
|
399
|
+
} }}>
|
|
400
|
+
<PaperDialog record={paper} loadPdfJs={loadPdfJs} onClose={close} />
|
|
401
|
+
</LabelsProvider>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Migrating from `renderPaper`
|
|
405
|
+
|
|
406
|
+
- Replace `renderPaper` with `loadPdfJs`, and delete the host's page
|
|
407
|
+
rendering, quote matching and viewer stylesheet.
|
|
408
|
+
- Replace any interception of the paper link with `onOpenPaperFile`.
|
|
409
|
+
- Remove any `GlobalWorkerOptions.workerPort` assignment and any module-level
|
|
410
|
+
worker; pdf.js, or `pdfJsWithWorker`, owns one worker per document.
|
|
411
|
+
- `PaperRenderOptions.focusEvidence` has no successor: `PaperDetail` builds the
|
|
412
|
+
viewer's `passage` from the evidence itself.
|
|
205
413
|
|
|
206
414
|
## Styling and theming
|
|
207
415
|
|
|
@@ -249,7 +457,10 @@ Styled roots and internal parts expose `data-slot` attributes. Kinds and
|
|
|
249
457
|
variants use attributes including `data-kind`, `data-mode`, `data-layout`,
|
|
250
458
|
`data-density`, `data-variant`, `data-selected`, and `data-expanded`. Package
|
|
251
459
|
rules live in CSS cascade layers and use zero-specificity `.astra-ui` scoping,
|
|
252
|
-
so unlayered host CSS can override them predictably.
|
|
460
|
+
so unlayered host CSS can override them predictably. The one exception is in
|
|
461
|
+
`components.css` and the bundles above it: pdf.js appends its glyph-measuring
|
|
462
|
+
canvas to `<body>`, outside any scope, so one layered rule hides that
|
|
463
|
+
`hiddenCanvasElement` class wherever it appears.
|
|
253
464
|
|
|
254
465
|
## Platform support
|
|
255
466
|
|
package/TOKENS.md
CHANGED
|
@@ -74,10 +74,13 @@ Every token is declared on `:where(.astra-ui)` at zero specificity in the `astra
|
|
|
74
74
|
|
|
75
75
|
| Token | Light default | Dark default |
|
|
76
76
|
| --- | --- | --- |
|
|
77
|
-
| `--astra-font-ui` | `Georgia, "Times New Roman", serif` | — |
|
|
78
|
-
| `--astra-font-body` | `Georgia, "Times New Roman", serif` | — |
|
|
79
|
-
| `--astra-font-heading` | `Georgia, "Times New Roman", serif` | — |
|
|
77
|
+
| `--astra-font-ui` | `"Source Serif 4", Georgia, "Times New Roman", serif` | — |
|
|
78
|
+
| `--astra-font-body` | `"Source Serif 4", Georgia, "Times New Roman", serif` | — |
|
|
79
|
+
| `--astra-font-heading` | `"Source Serif 4", Georgia, "Times New Roman", serif` | — |
|
|
80
80
|
| `--astra-font-mono` | `ui-monospace, "SF Mono", Menlo, Consolas, monospace` | — |
|
|
81
|
+
| `--astra-font-size-2xs` | `0.6875rem` | — |
|
|
82
|
+
| `--astra-font-size-xs` | `0.75rem` | — |
|
|
83
|
+
| `--astra-font-size-sm` | `0.8125rem` | — |
|
|
81
84
|
| `--astra-font-size` | `0.875rem` | — |
|
|
82
85
|
|
|
83
86
|
## Geometry
|
|
@@ -85,9 +88,13 @@ Every token is declared on `:where(.astra-ui)` at zero specificity in the `astra
|
|
|
85
88
|
| Token | Light default | Dark default |
|
|
86
89
|
| --- | --- | --- |
|
|
87
90
|
| `--astra-radius-control` | `0` | — |
|
|
91
|
+
| `--astra-radius-preview` | `0.1875rem` | — |
|
|
88
92
|
| `--astra-shadow-raised` | `none` | `0 5px 18px rgb(0 0 0 / 0.38)` |
|
|
93
|
+
| `--astra-shadow-preview` | `0 6px 18px rgb(34 31 32 / 0.1)` | `0 6px 18px rgb(0 0 0 / 0.45)` |
|
|
94
|
+
| `--astra-width-preview` | `27.5rem` | — |
|
|
89
95
|
| `--astra-space-2` | `0.5rem` | — |
|
|
90
96
|
| `--astra-space-3` | `0.75rem` | — |
|
|
91
97
|
| `--astra-z-dialog` | `1000` | — |
|
|
98
|
+
| `--astra-z-preview` | `1100` | — |
|
|
92
99
|
| `--astra-z-fullscreen` | `10000` | — |
|
|
93
100
|
|
package/components.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@import "./primitives.css";
|
|
3
3
|
@import "./styles/components/artifact-preview.css";
|
|
4
4
|
@import "./styles/components/paper-detail.css";
|
|
5
|
+
@import "./styles/components/paper-pdf-viewer.css";
|
|
5
6
|
@import "./styles/components/evidence.css";
|
|
6
7
|
@import "./styles/components/insight-trigger.css";
|
|
7
8
|
@import "./styles/components/decision-detail.css";
|
|
@@ -11,3 +12,4 @@
|
|
|
11
12
|
@import "./styles/components/paper-doi.css";
|
|
12
13
|
@import "./styles/components/finding-detail.css";
|
|
13
14
|
@import "./styles/components/output-detail.css";
|
|
15
|
+
@import "./styles/components/record-preview.css";
|
|
@@ -11,7 +11,6 @@ export interface DecisionsListProps extends Omit<HTMLAttributes<HTMLDivElement>,
|
|
|
11
11
|
onTagFilterChange?: ((tag: string) => void) | undefined;
|
|
12
12
|
onOpenRecord: (decision: ResolvedDecision, analysis: ResolvedAnalysisNode) => void;
|
|
13
13
|
}
|
|
14
|
-
export declare function decisionTagLabel(tag: string, labels: Readonly<Record<string, string>>): string;
|
|
15
14
|
/** Decisions with a tag filter and the selected option of each. */
|
|
16
15
|
export declare const DecisionsList: import("react").ForwardRefExoticComponent<DecisionsListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
16
|
//# sourceMappingURL=decisions-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decisions-list.d.ts","sourceRoot":"","sources":["../../src/blocks/decisions-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAMlE,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAE9B,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC1F,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,uCAAuC;IACvC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACzD,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,iBAAiB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACxD,YAAY,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACpF;AAED,
|
|
1
|
+
{"version":3,"file":"decisions-list.d.ts","sourceRoot":"","sources":["../../src/blocks/decisions-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAMlE,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAE9B,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC1F,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,uCAAuC;IACvC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACzD,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,iBAAiB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACxD,YAAY,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACpF;AAED,mEAAmE;AACnE,eAAO,MAAM,aAAa,+GAsFxB,CAAC"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useState } 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';
|
|
7
7
|
export const ALL_TAGS = 'all';
|
|
8
|
-
export function decisionTagLabel(tag, labels) {
|
|
9
|
-
return labels[tag]
|
|
10
|
-
?? tag.replace(/_/g, ' ').replace(/^./, (character) => character.toUpperCase());
|
|
11
|
-
}
|
|
12
8
|
/** Decisions with a tag filter and the selected option of each. */
|
|
13
9
|
export const DecisionsList = forwardRef(function DecisionsList({ analysis, tagLabels = {}, tagFilter: controlledFilter, defaultTagFilter = ALL_TAGS, onTagFilterChange, onOpenRecord, className, ...props }, ref) {
|
|
14
10
|
const labels = useLabels();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decisions-list.js","sourceRoot":"","sources":["../../src/bl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E,MAAM,CAAC,aAAa;oBACzB,eAAe,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,qBAAqB,mBAAmB,CAAC,MAAM,CAAC,EAAE;oBACzF,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;oBACjD,KAAK,EAAE;wBACL,KAAC,cAAc,IAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAI;wBAC9D,eAAM,SAAS,EAAC,6BAA6B,YAAE,mBAAmB,CAAC,MAAM,CAAC,GAAQ;wBAClF,eAAM,SAAS,EAAC,wBAAwB,YACrC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,GAChE;wBACP,8BAAkB,MAAM,uBAAS;qBAClC;iBACF,CAAC,CAAC,GACH,IACe,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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,
|
|
5
|
-
export type { InventoryOutlineEntry, InventoryOutlineProps, InventoryRecordsProps,
|
|
4
|
+
export { InventoryOutline, InventoryRecords, InventorySection } from './section.js';
|
|
5
|
+
export type { InventoryOutlineEntry, InventoryOutlineProps, InventoryRecordsProps, InventorySectionProps, } from './section.js';
|
|
6
6
|
export { OutputCard, OutputsList } from './outputs-list.js';
|
|
7
7
|
export type { OutputCardProps, OutputsListProps } from './outputs-list.js';
|
|
8
|
-
export { ALL_TAGS, DecisionsList
|
|
8
|
+
export { ALL_TAGS, DecisionsList } from './decisions-list.js';
|
|
9
9
|
export type { DecisionsListProps } from './decisions-list.js';
|
|
10
10
|
export { InputsList } from './inputs-list.js';
|
|
11
11
|
export type { InputsListProps } from './inputs-list.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpF,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9D,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/blocks/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Blocks: sections of the inventory page, composable into any layout. */
|
|
2
2
|
export { AnalysisTree } from './analysis-tree.js';
|
|
3
|
-
export { InventoryOutline,
|
|
3
|
+
export { InventoryOutline, InventoryRecords, InventorySection } from './section.js';
|
|
4
4
|
export { OutputCard, OutputsList } from './outputs-list.js';
|
|
5
|
-
export { ALL_TAGS, DecisionsList
|
|
5
|
+
export { ALL_TAGS, DecisionsList } from './decisions-list.js';
|
|
6
6
|
export { InputsList } from './inputs-list.js';
|
|
7
7
|
export { FindingsList } from './findings-list.js';
|
|
8
8
|
export { PriorInsightsList } from './prior-insights-list.js';
|
package/dist/blocks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOpF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { recordTitle } from '../model/records.js';
|
|
4
4
|
import { useLabels } from '../lib/labels.js';
|
|
5
|
-
import { inputSourceLabel } from '../
|
|
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
|
/** Inputs with their declared source and type. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs-list.js","sourceRoot":"","sources":["../../src/blocks/inputs-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"inputs-list.js","sourceRoot":"","sources":["../../src/blocks/inputs-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,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,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAI;oBAC3D,eAAM,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC,YAAG,gBAAgB,CAAC,MAAM,CAAC,GAAQ;oBACxE,eAAM,SAAS,EAAC,wBAAwB,YAAE,MAAM,CAAC,IAAI,GAAQ;oBAC7D,8BAAkB,MAAM,uBAAS;iBAClC;aACF,CAAC,CAAC,GACH,GACe,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -11,8 +11,8 @@ export interface OutputCardProps extends Omit<HTMLAttributes<HTMLButtonElement>,
|
|
|
11
11
|
renderArtifact?: ArtifactRenderer | undefined;
|
|
12
12
|
onOpen: () => void;
|
|
13
13
|
}
|
|
14
|
-
/** A gallery card: compact preview, type
|
|
14
|
+
/** A gallery card: compact preview and title, with a type label for non-figures. */
|
|
15
15
|
export declare const OutputCard: import("react").ForwardRefExoticComponent<OutputCardProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
16
|
-
/** Figures and tables as galleries,
|
|
16
|
+
/** Figures and tables as galleries, metrics as compact tiles, files as a compact grid. */
|
|
17
17
|
export declare const OutputsList: import("react").ForwardRefExoticComponent<OutputsListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
18
|
//# sourceMappingURL=outputs-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputs-list.d.ts","sourceRoot":"","sources":["../../src/blocks/outputs-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAI/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAI1E,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxF,Q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,MAAM,WAAW,6GAwBtB,CAAC"}
|
|
@@ -3,11 +3,11 @@ import { forwardRef, useId } from 'react';
|
|
|
3
3
|
import { recordTitle } from '../model/records.js';
|
|
4
4
|
import { cn } from '../lib/cn.js';
|
|
5
5
|
import { useLabels } from '../lib/labels.js';
|
|
6
|
-
import { EmptyState
|
|
6
|
+
import { EmptyState } from '../primitives/record-list.js';
|
|
7
7
|
import { OutputPreview } from '../components/output-detail.js';
|
|
8
|
-
/** A gallery card: compact preview, type
|
|
8
|
+
/** A gallery card: compact preview and title, with a type label for non-figures. */
|
|
9
9
|
export const OutputCard = forwardRef(function OutputCard({ output, renderArtifact, onOpen, className, onClick, 'aria-label': hostLabel, ...props }, ref) {
|
|
10
|
-
return (_jsxs("button", { "data-slot": "output-card", ...props, ref: ref, type: "button", "aria-label": hostLabel ?? `Open ${output.type}: ${recordTitle(output)}`, className: cn('astra-output-card', className), onClick: (event) => { onClick?.(event); onOpen(); }, children: [_jsxs("span", { className: "astra-output-card__preview", children: [_jsx(OutputPreview, { output: output, compact: true, renderArtifact: renderArtifact }), _jsx("span", { className: "astra-output-card__open", "aria-hidden": "true", children: "Open \u2197" })] }), _jsxs("span", { className: "astra-output-card__body", children: [_jsx("span", { className: "astra-output-card__kind", children: output.type }), _jsx("strong", { children: recordTitle(output) }), output.label ? _jsx("code", { children: output.id }) : null] })] }));
|
|
10
|
+
return (_jsxs("button", { "data-slot": "output-card", ...props, ref: ref, type: "button", "aria-label": hostLabel ?? `Open ${output.type}: ${recordTitle(output)}`, className: cn('astra-output-card', className), onClick: (event) => { onClick?.(event); onOpen(); }, children: [_jsxs("span", { className: "astra-output-card__preview", children: [_jsx(OutputPreview, { output: output, compact: true, renderArtifact: renderArtifact }), _jsx("span", { className: "astra-output-card__open", "aria-hidden": "true", children: "Open \u2197" })] }), _jsxs("span", { className: "astra-output-card__body", children: [output.type !== 'figure' ? _jsx("span", { className: "astra-output-card__kind", children: output.type }) : null, _jsx("strong", { children: recordTitle(output) }), output.label ? _jsx("code", { children: output.id }) : null] })] }));
|
|
11
11
|
});
|
|
12
12
|
function OutputGallery({ title, outputs, renderArtifact, onOpen, }) {
|
|
13
13
|
const id = useId();
|
|
@@ -15,33 +15,29 @@ function OutputGallery({ title, outputs, renderArtifact, onOpen, }) {
|
|
|
15
15
|
return null;
|
|
16
16
|
return (_jsxs("section", { className: "astra-inventory-outputs__group", "aria-labelledby": id, children: [_jsx("h3", { id: id, className: "astra-inventory-outputs__group-heading", children: _jsx("span", { children: title }) }), _jsx("div", { className: "astra-inventory-outputs__gallery", children: outputs.map((output) => (_jsx(OutputCard, { output: output, renderArtifact: renderArtifact, onOpen: () => { onOpen(output); } }, output.canonicalPath))) })] }));
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function CompactOutputs({ title, outputs, renderArtifact, onOpen, }) {
|
|
19
19
|
const id = useId();
|
|
20
20
|
if (!outputs.length)
|
|
21
21
|
return null;
|
|
22
|
-
return (_jsxs("section", { className: "astra-inventory-outputs__group
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onOpen: () => { onOpen(output); },
|
|
29
|
-
cells: [
|
|
30
|
-
_jsx(RecordIdentity, { kind: "output", title: recordTitle(output), subtitle: output.label ? output.id : output.format?.toUpperCase() }),
|
|
31
|
-
_jsx("span", { "aria-hidden": "true", children: "\u2192" }),
|
|
32
|
-
],
|
|
33
|
-
})) })] }));
|
|
22
|
+
return (_jsxs("section", { className: "astra-inventory-outputs__group", "aria-labelledby": id, children: [_jsx("h3", { id: id, className: "astra-inventory-outputs__group-heading", children: _jsx("span", { children: title }) }), _jsx("ul", { className: "astra-inventory-outputs__compact-grid", "data-layout": outputs[0]?.type === 'metric' ? 'tiles' : 'grid', children: outputs.map((output) => {
|
|
23
|
+
const metric = output.type === 'metric';
|
|
24
|
+
const status = !output.active ? 'Inactive' : !output.artifact ? 'Not yet generated' : undefined;
|
|
25
|
+
return (_jsx("li", { children: _jsxs("button", { type: "button", className: "astra-output-entry", "data-kind": metric ? 'metric' : 'file', "aria-label": `Open ${output.type}: ${recordTitle(output)}`, onClick: () => { onOpen(output); }, children: [_jsxs("span", { className: "astra-output-entry__name", children: [recordTitle(output), !metric && status ? _jsx("span", { className: "astra-output-entry__status", children: status }) : null] }), metric ? (_jsx("span", { className: "astra-output-entry__value", children: renderArtifact?.(output, { compact: true })
|
|
26
|
+
?? _jsx("span", { className: "astra-output-entry__status", children: status ?? 'Preview unavailable' }) })) : (_jsx("span", { className: "astra-output-entry__format", children: output.format ? output.format.replace(/^\./, '').toUpperCase() : 'FILE' }))] }) }, output.canonicalPath));
|
|
27
|
+
}) })] }));
|
|
34
28
|
}
|
|
35
|
-
|
|
29
|
+
const GROUPED_TYPES = new Set(['figure', 'table', 'metric']);
|
|
30
|
+
/** Figures and tables as galleries, metrics as compact tiles, files as a compact grid. */
|
|
36
31
|
export const OutputsList = forwardRef(function OutputsList({ analysis, renderArtifact, onOpenRecord, className, ...props }, ref) {
|
|
37
32
|
const labels = useLabels();
|
|
38
33
|
const figures = analysis.outputs.filter(({ type }) => type === 'figure');
|
|
39
34
|
const tables = analysis.outputs.filter(({ type }) => type === 'table');
|
|
40
|
-
const
|
|
35
|
+
const metrics = analysis.outputs.filter(({ type }) => type === 'metric');
|
|
36
|
+
const files = analysis.outputs.filter(({ type }) => !GROUPED_TYPES.has(type));
|
|
41
37
|
if (!analysis.outputs.length) {
|
|
42
38
|
return _jsx(EmptyState, { "data-slot": "outputs-list", ...props, ref: ref, className: className, children: labels.empty.outputs });
|
|
43
39
|
}
|
|
44
40
|
const open = (output) => { onOpenRecord(output, analysis); };
|
|
45
|
-
return (_jsxs("div", { "data-slot": "outputs-list", ...props, ref: ref, className: cn('astra-inventory-outputs', className), children: [_jsx(OutputGallery, { title: "Figures", outputs: figures, renderArtifact: renderArtifact, onOpen: open }), _jsx(OutputGallery, { title: "Tables", outputs: tables, renderArtifact: renderArtifact, onOpen: open }), _jsx(
|
|
41
|
+
return (_jsxs("div", { "data-slot": "outputs-list", ...props, ref: ref, className: cn('astra-inventory-outputs', className), children: [_jsx(OutputGallery, { title: "Figures", outputs: figures, renderArtifact: renderArtifact, onOpen: open }), _jsx(OutputGallery, { title: "Tables", outputs: tables, renderArtifact: renderArtifact, onOpen: open }), _jsx(CompactOutputs, { title: "Metrics", outputs: metrics, renderArtifact: renderArtifact, onOpen: open }), _jsx(CompactOutputs, { title: "Output files", outputs: files, onOpen: open })] }));
|
|
46
42
|
});
|
|
47
43
|
//# sourceMappingURL=outputs-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputs-list.js","sourceRoot":"","sources":["../../src/blocks/outputs-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"outputs-list.js","sourceRoot":"","sources":["../../src/blocks/outputs-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAc/D,oFAAoF;AACpF,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAqC,SAAS,UAAU,CAAC,EAC3F,MAAM,EACN,cAAc,EACd,MAAM,EACN,SAAS,E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EAAC,SAAS,EAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,GAAI,EAClG,KAAC,cAAc,IAAC,KAAK,EAAC,cAAc,EAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAI,IACjE,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/blocks/section.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
import { type SurfaceKind } from '../
|
|
3
|
-
export type InventorySectionId = 'outputs' | 'decisions' | 'inputs' | 'findings' | 'prior_insights' | 'papers';
|
|
2
|
+
import { type InventorySectionId, type SurfaceKind } from '../model/kind.js';
|
|
4
3
|
export interface InventorySectionProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
5
4
|
/** Anchor id for the heading; also the outline link target. */
|
|
6
5
|
id: string;
|
|
@@ -13,8 +12,6 @@ export interface InventorySectionProps extends Omit<HTMLAttributes<HTMLElement>,
|
|
|
13
12
|
}
|
|
14
13
|
/** A titled, counted block of the inventory page. */
|
|
15
14
|
export declare const InventorySection: import("react").ForwardRefExoticComponent<InventorySectionProps & import("react").RefAttributes<HTMLElement>>;
|
|
16
|
-
/** The record kind each inventory section lists; drives the outline glyph and colour. */
|
|
17
|
-
export declare function sectionKind(section: InventorySectionId): SurfaceKind;
|
|
18
15
|
export interface InventoryOutlineEntry {
|
|
19
16
|
id: string;
|
|
20
17
|
label: ReactNode;
|