@astra-spec/ui 0.0.1
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/LICENSE +29 -0
- package/README.md +261 -0
- package/TOKENS.md +93 -0
- package/blocks.css +7 -0
- package/components.css +13 -0
- package/dist/blocks/analysis-tree.d.ts +13 -0
- package/dist/blocks/analysis-tree.d.ts.map +1 -0
- package/dist/blocks/analysis-tree.js +19 -0
- package/dist/blocks/analysis-tree.js.map +1 -0
- package/dist/blocks/decisions-list.d.ts +17 -0
- package/dist/blocks/decisions-list.d.ts.map +1 -0
- package/dist/blocks/decisions-list.js +56 -0
- package/dist/blocks/decisions-list.js.map +1 -0
- package/dist/blocks/findings-list.d.ts +9 -0
- package/dist/blocks/findings-list.d.ts.map +1 -0
- package/dist/blocks/findings-list.js +35 -0
- package/dist/blocks/findings-list.js.map +1 -0
- package/dist/blocks/index.d.ts +18 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +10 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/blocks/inputs-list.d.ts +9 -0
- package/dist/blocks/inputs-list.d.ts.map +1 -0
- package/dist/blocks/inputs-list.js +32 -0
- package/dist/blocks/inputs-list.js.map +1 -0
- package/dist/blocks/outputs-list.d.ts +18 -0
- package/dist/blocks/outputs-list.d.ts.map +1 -0
- package/dist/blocks/outputs-list.js +47 -0
- package/dist/blocks/outputs-list.js.map +1 -0
- package/dist/blocks/papers-list.d.ts +16 -0
- package/dist/blocks/papers-list.d.ts.map +1 -0
- package/dist/blocks/papers-list.js +20 -0
- package/dist/blocks/papers-list.js.map +1 -0
- package/dist/blocks/prior-insights-list.d.ts +9 -0
- package/dist/blocks/prior-insights-list.d.ts.map +1 -0
- package/dist/blocks/prior-insights-list.js +29 -0
- package/dist/blocks/prior-insights-list.js.map +1 -0
- package/dist/blocks/section.d.ts +36 -0
- package/dist/blocks/section.d.ts.map +1 -0
- package/dist/blocks/section.js +30 -0
- package/dist/blocks/section.js.map +1 -0
- package/dist/components/artifact-preview.d.ts +71 -0
- package/dist/components/artifact-preview.d.ts.map +1 -0
- package/dist/components/artifact-preview.js +170 -0
- package/dist/components/artifact-preview.js.map +1 -0
- package/dist/components/decision-detail.d.ts +17 -0
- package/dist/components/decision-detail.d.ts.map +1 -0
- package/dist/components/decision-detail.js +21 -0
- package/dist/components/decision-detail.js.map +1 -0
- package/dist/components/detail-entry.d.ts +15 -0
- package/dist/components/detail-entry.d.ts.map +1 -0
- package/dist/components/detail-entry.js +14 -0
- package/dist/components/detail-entry.js.map +1 -0
- package/dist/components/finding-detail.d.ts +19 -0
- package/dist/components/finding-detail.d.ts.map +1 -0
- package/dist/components/finding-detail.js +39 -0
- package/dist/components/finding-detail.js.map +1 -0
- package/dist/components/index.d.ts +28 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +15 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/input-detail.d.ts +15 -0
- package/dist/components/input-detail.d.ts.map +1 -0
- package/dist/components/input-detail.js +21 -0
- package/dist/components/input-detail.js.map +1 -0
- package/dist/components/insight-detail.d.ts +25 -0
- package/dist/components/insight-detail.d.ts.map +1 -0
- package/dist/components/insight-detail.js +30 -0
- package/dist/components/insight-detail.js.map +1 -0
- package/dist/components/insight-trigger.d.ts +20 -0
- package/dist/components/insight-trigger.d.ts.map +1 -0
- package/dist/components/insight-trigger.js +32 -0
- package/dist/components/insight-trigger.js.map +1 -0
- package/dist/components/output-detail.d.ts +39 -0
- package/dist/components/output-detail.d.ts.map +1 -0
- package/dist/components/output-detail.js +124 -0
- package/dist/components/output-detail.js.map +1 -0
- package/dist/components/output-dialog.d.ts +18 -0
- package/dist/components/output-dialog.d.ts.map +1 -0
- package/dist/components/output-dialog.js +11 -0
- package/dist/components/output-dialog.js.map +1 -0
- package/dist/components/paper-detail.d.ts +34 -0
- package/dist/components/paper-detail.d.ts.map +1 -0
- package/dist/components/paper-detail.js +60 -0
- package/dist/components/paper-detail.js.map +1 -0
- package/dist/components/record-dialog.d.ts +33 -0
- package/dist/components/record-dialog.d.ts.map +1 -0
- package/dist/components/record-dialog.js +114 -0
- package/dist/components/record-dialog.js.map +1 -0
- package/dist/components/relation-items.d.ts +9 -0
- package/dist/components/relation-items.d.ts.map +1 -0
- package/dist/components/relation-items.js +20 -0
- package/dist/components/relation-items.js.map +1 -0
- package/dist/components/use-detail-stack.d.ts +31 -0
- package/dist/components/use-detail-stack.d.ts.map +1 -0
- package/dist/components/use-detail-stack.js +49 -0
- package/dist/components/use-detail-stack.js.map +1 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +6 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/labels.d.ts +61 -0
- package/dist/lib/labels.d.ts.map +1 -0
- package/dist/lib/labels.js +79 -0
- package/dist/lib/labels.js.map +1 -0
- package/dist/lib/slot.d.ts +11 -0
- package/dist/lib/slot.d.ts.map +1 -0
- package/dist/lib/slot.js +83 -0
- package/dist/lib/slot.js.map +1 -0
- package/dist/model/doi.d.ts +2 -0
- package/dist/model/doi.d.ts.map +1 -0
- package/dist/model/doi.js +5 -0
- package/dist/model/doi.js.map +1 -0
- package/dist/model/index.d.ts +10 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +7 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/locate-record.d.ts +8 -0
- package/dist/model/locate-record.d.ts.map +1 -0
- package/dist/model/locate-record.js +7 -0
- package/dist/model/locate-record.js.map +1 -0
- package/dist/model/papers.d.ts +38 -0
- package/dist/model/papers.d.ts.map +1 -0
- package/dist/model/papers.js +91 -0
- package/dist/model/papers.js.map +1 -0
- package/dist/model/records.d.ts +10 -0
- package/dist/model/records.d.ts.map +1 -0
- package/dist/model/records.js +32 -0
- package/dist/model/records.js.map +1 -0
- package/dist/model/relations.d.ts +45 -0
- package/dist/model/relations.d.ts.map +1 -0
- package/dist/model/relations.js +98 -0
- package/dist/model/relations.js.map +1 -0
- package/dist/primitives/badge.d.ts +11 -0
- package/dist/primitives/badge.d.ts.map +1 -0
- package/dist/primitives/badge.js +7 -0
- package/dist/primitives/badge.js.map +1 -0
- package/dist/primitives/button.d.ts +18 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +12 -0
- package/dist/primitives/button.js.map +1 -0
- package/dist/primitives/detail-layout.d.ts +26 -0
- package/dist/primitives/detail-layout.d.ts.map +1 -0
- package/dist/primitives/detail-layout.js +21 -0
- package/dist/primitives/detail-layout.js.map +1 -0
- package/dist/primitives/dialog.d.ts +133 -0
- package/dist/primitives/dialog.d.ts.map +1 -0
- package/dist/primitives/dialog.js +266 -0
- package/dist/primitives/dialog.js.map +1 -0
- package/dist/primitives/index.d.ts +25 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +14 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/kind.d.ts +6 -0
- package/dist/primitives/kind.d.ts.map +1 -0
- package/dist/primitives/kind.js +14 -0
- package/dist/primitives/kind.js.map +1 -0
- package/dist/primitives/prose.d.ts +36 -0
- package/dist/primitives/prose.d.ts.map +1 -0
- package/dist/primitives/prose.js +57 -0
- package/dist/primitives/prose.js.map +1 -0
- package/dist/primitives/record-list.d.ts +31 -0
- package/dist/primitives/record-list.d.ts.map +1 -0
- package/dist/primitives/record-list.js +17 -0
- package/dist/primitives/record-list.js.map +1 -0
- package/dist/primitives/relation-list.d.ts +22 -0
- package/dist/primitives/relation-list.d.ts.map +1 -0
- package/dist/primitives/relation-list.js +13 -0
- package/dist/primitives/relation-list.js.map +1 -0
- package/dist/primitives/surface-header.d.ts +31 -0
- package/dist/primitives/surface-header.d.ts.map +1 -0
- package/dist/primitives/surface-header.js +13 -0
- package/dist/primitives/surface-header.js.map +1 -0
- package/dist/views/index.d.ts +4 -0
- package/dist/views/index.d.ts.map +1 -0
- package/dist/views/index.js +3 -0
- package/dist/views/index.js.map +1 -0
- package/dist/views/inventory.d.ts +46 -0
- package/dist/views/inventory.d.ts.map +1 -0
- package/dist/views/inventory.js +101 -0
- package/dist/views/inventory.js.map +1 -0
- package/package.json +127 -0
- package/primitives.css +15 -0
- package/src/blocks/analysis-tree.tsx +109 -0
- package/src/blocks/decisions-list.tsx +113 -0
- package/src/blocks/findings-list.tsx +61 -0
- package/src/blocks/index.ts +23 -0
- package/src/blocks/inputs-list.tsx +51 -0
- package/src/blocks/outputs-list.tsx +143 -0
- package/src/blocks/papers-list.tsx +65 -0
- package/src/blocks/prior-insights-list.tsx +52 -0
- package/src/blocks/section.tsx +113 -0
- package/src/components/artifact-preview.tsx +314 -0
- package/src/components/decision-detail.tsx +93 -0
- package/src/components/detail-entry.ts +19 -0
- package/src/components/finding-detail.tsx +99 -0
- package/src/components/index.ts +44 -0
- package/src/components/input-detail.tsx +67 -0
- package/src/components/insight-detail.tsx +120 -0
- package/src/components/insight-trigger.tsx +102 -0
- package/src/components/output-detail.tsx +258 -0
- package/src/components/output-dialog.tsx +63 -0
- package/src/components/paper-detail.tsx +216 -0
- package/src/components/record-dialog.tsx +232 -0
- package/src/components/relation-items.ts +31 -0
- package/src/components/use-detail-stack.ts +78 -0
- package/src/lib/cn.ts +5 -0
- package/src/lib/labels.tsx +145 -0
- package/src/lib/slot.tsx +87 -0
- package/src/model/doi.ts +5 -0
- package/src/model/index.ts +32 -0
- package/src/model/locate-record.ts +13 -0
- package/src/model/papers.ts +146 -0
- package/src/model/records.ts +43 -0
- package/src/model/relations.ts +134 -0
- package/src/primitives/badge.tsx +32 -0
- package/src/primitives/button.tsx +58 -0
- package/src/primitives/detail-layout.tsx +84 -0
- package/src/primitives/dialog.tsx +555 -0
- package/src/primitives/index.ts +48 -0
- package/src/primitives/kind.ts +19 -0
- package/src/primitives/prose.tsx +74 -0
- package/src/primitives/record-list.tsx +103 -0
- package/src/primitives/relation-list.tsx +95 -0
- package/src/primitives/surface-header.tsx +87 -0
- package/src/views/index.ts +3 -0
- package/src/views/inventory.tsx +224 -0
- package/styles/base.css +49 -0
- package/styles/blocks/analysis-tree.css +64 -0
- package/styles/blocks/decisions-list.css +73 -0
- package/styles/blocks/outputs-list.css +349 -0
- package/styles/blocks/papers-list.css +98 -0
- package/styles/blocks/records.css +72 -0
- package/styles/components/artifact-preview.css +242 -0
- package/styles/components/decision-detail.css +159 -0
- package/styles/components/evidence.css +79 -0
- package/styles/components/finding-detail.css +63 -0
- package/styles/components/input-detail.css +95 -0
- package/styles/components/insight-detail.css +138 -0
- package/styles/components/insight-list.css +46 -0
- package/styles/components/insight-trigger.css +54 -0
- package/styles/components/output-detail.css +732 -0
- package/styles/components/paper-detail.css +249 -0
- package/styles/components/paper-doi.css +36 -0
- package/styles/primitives/badge.css +107 -0
- package/styles/primitives/button.css +116 -0
- package/styles/primitives/count-heading.css +27 -0
- package/styles/primitives/detail-layout.css +225 -0
- package/styles/primitives/dialog.css +634 -0
- package/styles/primitives/empty-state.css +10 -0
- package/styles/primitives/kind.css +41 -0
- package/styles/primitives/prose.css +15 -0
- package/styles/primitives/record-list.css +425 -0
- package/styles/primitives/relation-list.css +184 -0
- package/styles/primitives/surface-header.css +183 -0
- package/styles/tokens.css +119 -0
- package/styles/views/inventory.css +186 -0
- package/styles.css +2 -0
- package/views.css +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Centre National de la Recherche Scientifique (CNRS) and
|
|
4
|
+
The Regents of the University of California
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# `@astra-spec/ui`
|
|
2
|
+
|
|
3
|
+
Composable, themable React components for resolved
|
|
4
|
+
[ASTRA](https://astra-spec.org/) analyses.
|
|
5
|
+
|
|
6
|
+
`@astra-spec/ui` renders `ResolvedAnalysisDocument` and the `Resolved*` records
|
|
7
|
+
from [`@astra-spec/sdk`](https://github.com/LightconeResearch/astra-typescript).
|
|
8
|
+
It owns presentation: applications keep control of project loading, artifact
|
|
9
|
+
bytes and URLs, paper fetching, routing, and state.
|
|
10
|
+
|
|
11
|
+
| Layer | Responsibility |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| `@astra-spec/sdk` | Validate and resolve ASTRA projects; build canonical paths, provenance, artifact bindings, and indexes |
|
|
14
|
+
| `@astra-spec/ui` | Render primitives, record details, dialogs, inventory blocks, full views, and the theming contract |
|
|
15
|
+
| Your application | Provide a `ProjectReader`, load and refresh data, decode artifacts, fetch papers, and own navigation |
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @astra-spec/ui @astra-spec/sdk react react-dom
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The package is ESM-only and requires Node.js 20 or newer. Its peer dependency
|
|
24
|
+
ranges are `@astra-spec/sdk@^0.1.1` and React/React DOM 18 or 19.
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
Pass a document that has already been resolved by the SDK to `Inventory`, then
|
|
29
|
+
load the stylesheet for the view layer. The `astra-ui` class is required: it
|
|
30
|
+
scopes the package's styles and design tokens.
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import type { ResolvedAnalysisDocument } from '@astra-spec/sdk';
|
|
34
|
+
import { Inventory } from '@astra-spec/ui/views';
|
|
35
|
+
import '@astra-spec/ui/styles.css';
|
|
36
|
+
|
|
37
|
+
export function AnalysisView({ document }: { document: ResolvedAnalysisDocument }) {
|
|
38
|
+
return (
|
|
39
|
+
<div className="astra-ui">
|
|
40
|
+
<Inventory document={document} />
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Resolving a project is deliberately outside the UI package. For example, a
|
|
47
|
+
Node.js host can resolve one with the SDK before rendering it:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { resolveAnalysis } from '@astra-spec/sdk';
|
|
51
|
+
import { createNodeProjectReader } from '@astra-spec/sdk/node';
|
|
52
|
+
|
|
53
|
+
const reader = createNodeProjectReader('/path/to/astra-project');
|
|
54
|
+
const { document } = await resolveAnalysis(reader, { universeId: 'baseline' });
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Entry points
|
|
58
|
+
|
|
59
|
+
There is intentionally no root JavaScript entry point. Import the smallest
|
|
60
|
+
layer you need:
|
|
61
|
+
|
|
62
|
+
| Import | Use it for | Main exports |
|
|
63
|
+
| --- | --- | --- |
|
|
64
|
+
| `@astra-spec/ui/views` | Complete, ready-made surfaces | `Inventory` |
|
|
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`, `useDetailStack` |
|
|
67
|
+
| `@astra-spec/ui/primitives` | Generic presentation with no resolved ASTRA model dependency beyond record kinds | Buttons, badges, dialog and detail-layout compounds, lists, prose, labels |
|
|
68
|
+
| `@astra-spec/ui/model` | Pure, React-free derivations over SDK data | Record lookup, relationships, paper collection, display labels, DOI helpers |
|
|
69
|
+
|
|
70
|
+
Every public file also has a direct subpath, such as
|
|
71
|
+
`@astra-spec/ui/components/output-dialog` or
|
|
72
|
+
`@astra-spec/ui/primitives/button`. TypeScript declarations are included.
|
|
73
|
+
|
|
74
|
+
## Component guide
|
|
75
|
+
|
|
76
|
+
### Full view
|
|
77
|
+
|
|
78
|
+
`Inventory` is the highest-level component. It renders the selected analysis as
|
|
79
|
+
outputs, decisions, inputs, findings, prior insights, and cited papers, with an
|
|
80
|
+
optional outline and a drill-down detail stack.
|
|
81
|
+
|
|
82
|
+
Its most useful options are:
|
|
83
|
+
|
|
84
|
+
- `analysisPath` selects a nested analysis (`$` is the project root).
|
|
85
|
+
- `sections` changes which inventory sections appear and their order.
|
|
86
|
+
- `showOutline` and `idPrefix` control outline navigation.
|
|
87
|
+
- `renderArtifact`, `renderText`, and `renderPaper` replace host-owned content.
|
|
88
|
+
- `paperMetadata` and `onFetchPaper` connect paper loading to host state.
|
|
89
|
+
- `detail`, `defaultDetail`, and `onDetailChange` control the detail stack.
|
|
90
|
+
- `detailMode="embedded"` renders details as an inline panel instead of a modal.
|
|
91
|
+
- `labels` overrides user-facing strings.
|
|
92
|
+
- `index` accepts an `AnalysisIndex` the host has already built.
|
|
93
|
+
|
|
94
|
+
### Inventory blocks
|
|
95
|
+
|
|
96
|
+
Use blocks when your application owns the page layout or routing:
|
|
97
|
+
|
|
98
|
+
| Component | Purpose |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| `AnalysisTree` | Recursive picker for the root analysis and its sub-analyses |
|
|
101
|
+
| `OutputsList`, `OutputCard` | Figure and table galleries plus a list of other outputs, with optional compact artifact previews |
|
|
102
|
+
| `DecisionsList` | Decision rows, selected options, and a controlled or uncontrolled tag filter |
|
|
103
|
+
| `InputsList` | Inputs with their source and declared type |
|
|
104
|
+
| `FindingsList` | Findings with claims and evidence counts |
|
|
105
|
+
| `PriorInsightsList` | Prior insights with claims and source counts |
|
|
106
|
+
| `PapersList`, `PaperRows` | Cited papers derived with `collectInventoryPapers` |
|
|
107
|
+
| `InventorySection`, `InventoryRecords`, `InventoryOutline` | Section chrome, kind-aware record layout, and anchor navigation for custom inventories |
|
|
108
|
+
|
|
109
|
+
List components emit records through callbacks such as `onOpenRecord`; they do
|
|
110
|
+
not own application navigation.
|
|
111
|
+
|
|
112
|
+
### Record and paper details
|
|
113
|
+
|
|
114
|
+
Each ASTRA record kind has both a dialog and a dialog-free detail body:
|
|
115
|
+
|
|
116
|
+
| Family | What it renders |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| `OutputDialog`, `OutputDetail`, `OutputPreview`, `OutputDialogActions` | Output metadata, artifact content, provenance, related inputs and decisions, and open/expand actions |
|
|
119
|
+
| `DecisionDialog`, `DecisionDetail` | Decision status, selected option, rationale, alternatives, tags, and supporting insights |
|
|
120
|
+
| `InputDialog`, `InputDetail` | Input type, source, and authored description |
|
|
121
|
+
| `FindingDialog`, `FindingDetail` | Finding claim, artifact-backed evidence, and literature evidence |
|
|
122
|
+
| `InsightDialog`, `InsightDetail`, `InsightTrigger`, `InsightEvidenceTitle` | Prior-insight claims, quoted sources, evidence labels, and decisions informed by the insight |
|
|
123
|
+
| `PaperDialog`, `PaperDetail`, `PaperDialogActions` | Paper metadata, cited passages, related insights and decisions, and DOI actions |
|
|
124
|
+
|
|
125
|
+
Use a `*Dialog` when you already have the record and any derived relationship
|
|
126
|
+
data. Use the corresponding `*Detail` inside a sidebar, route, or your own
|
|
127
|
+
dialog shell.
|
|
128
|
+
|
|
129
|
+
`RecordDialog` is the generic alternative. Given a `DetailEntry`, resolved
|
|
130
|
+
document, and SDK index, it selects the correct detail UI and derives the
|
|
131
|
+
record's relationships, evidence, insights, and papers. Pair it with
|
|
132
|
+
`useDetailStack` for drill-down and back navigation. The same stack can be
|
|
133
|
+
controlled by a router or left uncontrolled.
|
|
134
|
+
|
|
135
|
+
Dialogs support two modes:
|
|
136
|
+
|
|
137
|
+
- `mode="modal"` uses the native `<dialog>` element, including focus restoration
|
|
138
|
+
and Escape/backdrop dismissal.
|
|
139
|
+
- `mode="embedded"` renders the same chrome as an inline panel.
|
|
140
|
+
|
|
141
|
+
### Artifact previews
|
|
142
|
+
|
|
143
|
+
The UI package does not read artifact files. `ArtifactPreview` renders safe,
|
|
144
|
+
host-provided preview data in six states: table, image, metric, text, loading,
|
|
145
|
+
or unavailable.
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import {
|
|
149
|
+
ArtifactPreview,
|
|
150
|
+
type ArtifactPreviewData,
|
|
151
|
+
type ArtifactRenderer,
|
|
152
|
+
} from '@astra-spec/ui/components';
|
|
153
|
+
|
|
154
|
+
export function createArtifactRenderer(
|
|
155
|
+
previews: ReadonlyMap<string, ArtifactPreviewData>,
|
|
156
|
+
): ArtifactRenderer {
|
|
157
|
+
return (output, { compact }) => (
|
|
158
|
+
<ArtifactPreview
|
|
159
|
+
output={output}
|
|
160
|
+
preview={previews.get(output.canonicalPath)}
|
|
161
|
+
compact={compact}
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
`tablePreviewFromDelimited`, `tablePreviewFromRows`, and
|
|
168
|
+
`metricPreviewFromJson` turn already-loaded host data into preview values. They
|
|
169
|
+
perform no I/O.
|
|
170
|
+
|
|
171
|
+
### Primitives
|
|
172
|
+
|
|
173
|
+
The primitive layer is useful for building surfaces that match the library:
|
|
174
|
+
|
|
175
|
+
| Components | Purpose |
|
|
176
|
+
| --- | --- |
|
|
177
|
+
| `Button`, `IconButton`, `Badge` | Controls and status/kind labels |
|
|
178
|
+
| `SurfaceHeader` | Reusable title, eyebrow, identifier, leading, and action layout |
|
|
179
|
+
| `Dialog`, `DialogProvider`, `DialogContent`, `DialogHeader`, `DialogBody`, `DialogClose`, `DialogBack`, `DialogAction` | Compound dialog context, state, and presentation building blocks |
|
|
180
|
+
| `DetailDialog` | Preset dialog shell used by record and paper dialogs |
|
|
181
|
+
| `DetailLayout`, `DetailMain`, `DetailRail`, `DetailSection`, `CountHeading` | Responsive detail-page structure |
|
|
182
|
+
| `RecordList`, `RecordIdentity`, `EmptyState` | Accessible, column-aligned record lists |
|
|
183
|
+
| `RelationList` | Counted related-record lists with optional navigation triggers |
|
|
184
|
+
| `Prose` | Authored text with built-in inline code and KaTeX math rendering |
|
|
185
|
+
| `LabelsProvider` | Scoped user-facing label overrides |
|
|
186
|
+
|
|
187
|
+
The layer also exports `Slot`, `cn`, prose parsers, label helpers, dialog hooks,
|
|
188
|
+
and their public types.
|
|
189
|
+
|
|
190
|
+
## Host extension points
|
|
191
|
+
|
|
192
|
+
- `renderArtifact(output, { compact })` renders host-decoded artifact content.
|
|
193
|
+
Without it, outputs use `ArtifactPreview`'s unavailable state.
|
|
194
|
+
- `renderText(text, { field })` replaces the built-in prose renderer. The
|
|
195
|
+
default understands inline code, `$inline$` math, and `$$display$$` math.
|
|
196
|
+
- `renderPaper(paper, { focusEvidence })` renders host-owned paper content.
|
|
197
|
+
- `onFetchPaper(doi)` asks the host to load paper data. Feed the result and
|
|
198
|
+
`status: 'fetching' | 'error'` back through `paperMetadata`.
|
|
199
|
+
- `labels` on `Inventory`, or `LabelsProvider` around lower-level components,
|
|
200
|
+
overrides the default UI copy.
|
|
201
|
+
|
|
202
|
+
These are render callbacks and events: the package never fetches a URL, reads a
|
|
203
|
+
file, resolves an ASTRA project, or stores application state on the host's
|
|
204
|
+
behalf.
|
|
205
|
+
|
|
206
|
+
## Styling and theming
|
|
207
|
+
|
|
208
|
+
Import exactly one bundle for the highest layer you render:
|
|
209
|
+
|
|
210
|
+
| Highest layer used | Stylesheet |
|
|
211
|
+
| --- | --- |
|
|
212
|
+
| Primitives | `@astra-spec/ui/primitives.css` |
|
|
213
|
+
| Components | `@astra-spec/ui/components.css` |
|
|
214
|
+
| Blocks | `@astra-spec/ui/blocks.css` |
|
|
215
|
+
| Views | `@astra-spec/ui/styles.css` or its alias `@astra-spec/ui/views.css` |
|
|
216
|
+
|
|
217
|
+
The bundles are nested: `components.css` includes primitives, `blocks.css`
|
|
218
|
+
includes components, and `styles.css` includes everything. Their import order
|
|
219
|
+
is part of the supported cascade.
|
|
220
|
+
|
|
221
|
+
Individual sheets are exported under `@astra-spec/ui/styles/*` for advanced
|
|
222
|
+
integrations, but they are not standalone bundles and are not one-to-one with
|
|
223
|
+
source components. Hosts normally should use one of the bundles above.
|
|
224
|
+
|
|
225
|
+
Components consume role-named `--astra-*` custom properties. Override them on
|
|
226
|
+
the same `.astra-ui` scope:
|
|
227
|
+
|
|
228
|
+
```css
|
|
229
|
+
.astra-ui {
|
|
230
|
+
--astra-color-accent: #7a3e9d;
|
|
231
|
+
--astra-font-heading: "Fraunces", serif;
|
|
232
|
+
--astra-radius-control: 0.375rem;
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
The complete token list and default values are in [TOKENS.md](./TOKENS.md).
|
|
237
|
+
Set `data-astra-color-scheme="dark"` on `.astra-ui` to select the built-in dark
|
|
238
|
+
defaults.
|
|
239
|
+
|
|
240
|
+
Styled roots and internal parts expose `data-slot` attributes. Kinds and
|
|
241
|
+
variants use attributes including `data-kind`, `data-mode`, `data-layout`,
|
|
242
|
+
`data-density`, `data-variant`, `data-selected`, and `data-expanded`. Package
|
|
243
|
+
rules live in CSS cascade layers and use zero-specificity `.astra-ui` scoping,
|
|
244
|
+
so unlayered host CSS can override them predictably.
|
|
245
|
+
|
|
246
|
+
## Platform support
|
|
247
|
+
|
|
248
|
+
- React and React DOM 18 or 19
|
|
249
|
+
- Chrome and Edge 111+
|
|
250
|
+
- Firefox 113+
|
|
251
|
+
- Safari and iOS Safari 16.2+
|
|
252
|
+
|
|
253
|
+
## Development and examples
|
|
254
|
+
|
|
255
|
+
The [repository README](https://github.com/LightconeResearch/astra-ui#readme)
|
|
256
|
+
documents the Ladle playground, integration examples, screenshots, and project
|
|
257
|
+
development commands.
|
|
258
|
+
|
|
259
|
+
## License
|
|
260
|
+
|
|
261
|
+
BSD-3-Clause. See [LICENSE](./LICENSE).
|
package/TOKENS.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# astra-ui token contract
|
|
2
|
+
|
|
3
|
+
Generated from `styles/tokens.css` by `scripts/tokens-doc.mjs`; do not edit by hand.
|
|
4
|
+
|
|
5
|
+
Every token is declared on `:where(.astra-ui)` at zero specificity, so a theme redefines it on `.astra-ui` (or any ancestor) and always wins. Dark values apply under `.astra-ui[data-astra-color-scheme="dark"]`, or automatically when JupyterLab or VS Code report a dark theme.
|
|
6
|
+
|
|
7
|
+
## Surfaces
|
|
8
|
+
|
|
9
|
+
| Token | Light default | Dark default |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| `--astra-color-canvas` | `#f8f7f3` | `#171614` |
|
|
12
|
+
| `--astra-color-surface` | `#ffffff` | `#1e1d1a` |
|
|
13
|
+
| `--astra-color-surface-raised` | `#ffffff` | `#272520` |
|
|
14
|
+
| `--astra-color-surface-muted` | `#f1efe9` | `#302d27` |
|
|
15
|
+
| `--astra-color-header` | `#f8f7f3` | `#302d27` |
|
|
16
|
+
| `--astra-color-artifact-paper` | `#ffffff` | `#f8f7f3` |
|
|
17
|
+
| `--astra-color-artifact-ink` | `#221f20` | `#221f20` |
|
|
18
|
+
|
|
19
|
+
## Text
|
|
20
|
+
|
|
21
|
+
| Token | Light default | Dark default |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| `--astra-color-text` | `#221f20` | `#f2eee7` |
|
|
24
|
+
| `--astra-color-text-muted` | `#4e5a70` | `#c4bdb2` |
|
|
25
|
+
| `--astra-color-text-subtle` | `#8b7d70` | `#a39b90` |
|
|
26
|
+
| `--astra-color-text-faint` | `#b8b0a8` | `#777168` |
|
|
27
|
+
| `--astra-color-eyebrow` | `#3f7280` | `#86adb7` |
|
|
28
|
+
|
|
29
|
+
## Borders
|
|
30
|
+
|
|
31
|
+
| Token | Light default | Dark default |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| `--astra-color-border-subtle` | `color-mix(in srgb, #8b7d70 10%, #f8f7f3)` | `#302d28` |
|
|
34
|
+
| `--astra-color-border` | `color-mix(in srgb, #8b7d70 18%, #f8f7f3)` | `#3b3731` |
|
|
35
|
+
| `--astra-color-border-strong` | `color-mix(in srgb, #8b7d70 38%, #f8f7f3)` | `#514b42` |
|
|
36
|
+
|
|
37
|
+
## Interaction
|
|
38
|
+
|
|
39
|
+
| Token | Light default | Dark default |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `--astra-color-accent` | `#4e5a70` | `#aeb8ca` |
|
|
42
|
+
| `--astra-color-accent-contrast` | `#ffffff` | `#171614` |
|
|
43
|
+
| `--astra-color-link` | `var(--astra-color-accent)` | — |
|
|
44
|
+
| `--astra-color-focus` | `#3f7280` | `#86adb7` |
|
|
45
|
+
| `--astra-color-danger` | `#a45a43` | `#d6927d` |
|
|
46
|
+
| `--astra-color-danger-soft` | `rgb(164 90 67 / 0.09)` | `rgb(214 146 125 / 0.13)` |
|
|
47
|
+
|
|
48
|
+
## Record kinds
|
|
49
|
+
|
|
50
|
+
| Token | Light default | Dark default |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `--astra-color-kind-input` | `#4e5a70` | `#aeb8ca` |
|
|
53
|
+
| `--astra-color-kind-analysis` | `#3f7280` | `#86adb7` |
|
|
54
|
+
| `--astra-color-kind-output` | `#3b7a73` | `#79b6ae` |
|
|
55
|
+
| `--astra-color-kind-decision` | `#a67c3c` | `#d8b477` |
|
|
56
|
+
| `--astra-color-kind-decision-ink` | `#765a2f` | `#d8b477` |
|
|
57
|
+
| `--astra-color-kind-finding` | `#a45a43` | `#d6927d` |
|
|
58
|
+
| `--astra-color-kind-insight` | `#8b7d70` | `#c2b5a9` |
|
|
59
|
+
| `--astra-color-kind-insight-ink` | `#4e5a70` | `#c2b5a9` |
|
|
60
|
+
| `--astra-color-kind-input-soft` | `rgb(78 90 112 / 0.1)` | `rgb(174 184 202 / 0.15)` |
|
|
61
|
+
| `--astra-color-kind-analysis-soft` | `rgb(63 114 128 / 0.1)` | `rgb(134 173 183 / 0.15)` |
|
|
62
|
+
| `--astra-color-kind-output-soft` | `rgb(59 122 115 / 0.1)` | `rgb(121 182 174 / 0.14)` |
|
|
63
|
+
| `--astra-color-kind-decision-soft` | `rgb(166 124 60 / 0.11)` | `rgb(216 180 119 / 0.14)` |
|
|
64
|
+
| `--astra-color-kind-finding-soft` | `rgb(164 90 67 / 0.1)` | `rgb(214 146 125 / 0.15)` |
|
|
65
|
+
| `--astra-color-kind-insight-soft` | `rgb(139 125 112 / 0.11)` | `rgb(194 181 169 / 0.15)` |
|
|
66
|
+
|
|
67
|
+
## Kind indirection
|
|
68
|
+
|
|
69
|
+
| Token | Light default | Dark default |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `--astra-kind` | `var(--astra-color-accent)` | — |
|
|
72
|
+
|
|
73
|
+
## Typography
|
|
74
|
+
|
|
75
|
+
| Token | Light default | Dark default |
|
|
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` | — |
|
|
80
|
+
| `--astra-font-mono` | `ui-monospace, "SF Mono", Menlo, Consolas, monospace` | — |
|
|
81
|
+
| `--astra-font-size` | `0.875rem` | — |
|
|
82
|
+
|
|
83
|
+
## Geometry
|
|
84
|
+
|
|
85
|
+
| Token | Light default | Dark default |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| `--astra-radius-control` | `0` | — |
|
|
88
|
+
| `--astra-shadow-raised` | `none` | `0 5px 18px rgb(0 0 0 / 0.38)` |
|
|
89
|
+
| `--astra-space-2` | `0.5rem` | — |
|
|
90
|
+
| `--astra-space-3` | `0.75rem` | — |
|
|
91
|
+
| `--astra-z-dialog` | `1000` | — |
|
|
92
|
+
| `--astra-z-fullscreen` | `10000` | — |
|
|
93
|
+
|
package/blocks.css
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* Components plus the inventory blocks (lists, sections, outline, tree). */
|
|
2
|
+
@import "./components.css";
|
|
3
|
+
@import "./styles/blocks/outputs-list.css";
|
|
4
|
+
@import "./styles/blocks/records.css";
|
|
5
|
+
@import "./styles/blocks/papers-list.css";
|
|
6
|
+
@import "./styles/blocks/analysis-tree.css";
|
|
7
|
+
@import "./styles/blocks/decisions-list.css";
|
package/components.css
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* Primitives plus the ASTRA-aware components (details and dialogs). */
|
|
2
|
+
@import "./primitives.css";
|
|
3
|
+
@import "./styles/components/artifact-preview.css";
|
|
4
|
+
@import "./styles/components/paper-detail.css";
|
|
5
|
+
@import "./styles/components/evidence.css";
|
|
6
|
+
@import "./styles/components/insight-trigger.css";
|
|
7
|
+
@import "./styles/components/decision-detail.css";
|
|
8
|
+
@import "./styles/components/insight-detail.css";
|
|
9
|
+
@import "./styles/components/input-detail.css";
|
|
10
|
+
@import "./styles/components/insight-list.css";
|
|
11
|
+
@import "./styles/components/paper-doi.css";
|
|
12
|
+
@import "./styles/components/finding-detail.css";
|
|
13
|
+
@import "./styles/components/output-detail.css";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ResolvedAnalysisDocument } from '@astra-spec/sdk';
|
|
2
|
+
import { type HTMLAttributes } from 'react';
|
|
3
|
+
export interface AnalysisTreeProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
4
|
+
document: ResolvedAnalysisDocument;
|
|
5
|
+
/** Canonical path of the selected analysis; `$` is the project root. */
|
|
6
|
+
analysisPath?: string | undefined;
|
|
7
|
+
onSelectAnalysis: (canonicalPath: string) => void;
|
|
8
|
+
/** Hide the heading (e.g. inside a popover). */
|
|
9
|
+
showHeading?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
/** The recursive analysis picker: the project root and its sub-analyses. */
|
|
12
|
+
export declare const AnalysisTree: import("react").ForwardRefExoticComponent<AnalysisTreeProps & import("react").RefAttributes<HTMLElement>>;
|
|
13
|
+
//# sourceMappingURL=analysis-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis-tree.d.ts","sourceRoot":"","sources":["../../src/blocks/analysis-tree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAwB,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAK/D,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IACtF,QAAQ,EAAE,wBAAwB,CAAC;IACnC,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,gBAAgB,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACnC;AA+DD,4EAA4E;AAC5E,eAAO,MAAM,YAAY,2GA+BvB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId } from 'react';
|
|
3
|
+
import { analysisTitle } from '../model/records.js';
|
|
4
|
+
import { cn } from '../lib/cn.js';
|
|
5
|
+
import { useLabels } from '../lib/labels.js';
|
|
6
|
+
function ProjectDocumentIcon() {
|
|
7
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", "aria-hidden": "true", width: "1.25rem", height: "1.25rem", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25M9 16.5v.75m3-3v3M15 12v5.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" }) }));
|
|
8
|
+
}
|
|
9
|
+
function AnalysisNode({ analysis, selectedPath, depth, onSelectAnalysis, }) {
|
|
10
|
+
const active = analysis.canonicalPath === selectedPath;
|
|
11
|
+
return (_jsxs("li", { children: [_jsxs("button", { type: "button", style: { paddingInlineStart: `${Math.min(depth, 4) * 1.25}rem` }, "aria-current": active ? 'page' : undefined, onClick: () => { onSelectAnalysis(analysis.canonicalPath); }, children: [_jsx(ProjectDocumentIcon, {}), _jsx("span", { children: analysisTitle(analysis) })] }), analysis.analyses.length ? (_jsx("ul", { children: analysis.analyses.map((child) => (_jsx(AnalysisNode, { analysis: child, selectedPath: selectedPath, depth: depth + 1, onSelectAnalysis: onSelectAnalysis }, child.canonicalPath))) })) : null] }));
|
|
12
|
+
}
|
|
13
|
+
/** The recursive analysis picker: the project root and its sub-analyses. */
|
|
14
|
+
export const AnalysisTree = forwardRef(function AnalysisTree({ document, analysisPath = '$', onSelectAnalysis, showHeading = true, className, 'aria-label': hostLabel, ...props }, ref) {
|
|
15
|
+
const labels = useLabels();
|
|
16
|
+
const headingId = useId();
|
|
17
|
+
return (_jsxs("nav", { "data-slot": "analysis-tree", ...props, ref: ref, className: cn('astra-analysis-tree', className), "aria-labelledby": showHeading && !hostLabel ? headingId : undefined, "aria-label": hostLabel ?? (showHeading ? undefined : labels.analysisTree), children: [showHeading ? _jsx("h2", { id: headingId, children: labels.analysisTree }) : null, _jsx("ul", { children: _jsx(AnalysisNode, { analysis: document.analysis, selectedPath: analysisPath, depth: 0, onSelectAnalysis: onSelectAnalysis }) })] }));
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=analysis-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysis-tree.js","sourceRoot":"","sources":["../../src/blocks/analysis-tree.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAW7C,SAAS,mBAAmB;IAC1B,OAAO,CACL,cACE,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,EACnB,WAAW,EAAE,GAAG,EAChB,MAAM,EAAC,cAAc,iBACT,MAAM,EAClB,KAAK,EAAC,SAAS,EACf,MAAM,EAAC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B,GAAG,KAAK,EACT,EAAE,GAAG;IACJ,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,SAAS,GAAG,KAAK,EAAE,CAAC;IAC1B,OAAO,CACL,4BACY,eAAe,KACrB,KAAK,EACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,qBAC9B,WAAW,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,gBACtD,SAAS,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,aAEvE,WAAW,CAAC,CAAC,CAAC,aAAI,EAAE,EAAE,SAAS,YAAG,MAAM,CAAC,YAAY,GAAM,CAAC,CAAC,CAAC,IAAI,EACnE,uBACE,KAAC,YAAY,IACX,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAC3B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,CAAC,EACR,gBAAgB,EAAE,gBAAgB,GAClC,GACC,IACD,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ResolvedAnalysisNode, ResolvedDecision } from '@astra-spec/sdk';
|
|
2
|
+
import { type HTMLAttributes } from 'react';
|
|
3
|
+
export declare const ALL_TAGS = "all";
|
|
4
|
+
export interface DecisionsListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
5
|
+
analysis: ResolvedAnalysisNode;
|
|
6
|
+
/** Display names for decision tags. */
|
|
7
|
+
tagLabels?: Readonly<Record<string, string>> | undefined;
|
|
8
|
+
/** Active tag filter (controlled); `'all'` shows every decision. */
|
|
9
|
+
tagFilter?: string | undefined;
|
|
10
|
+
defaultTagFilter?: string | undefined;
|
|
11
|
+
onTagFilterChange?: ((tag: string) => void) | undefined;
|
|
12
|
+
onOpenRecord: (decision: ResolvedDecision, analysis: ResolvedAnalysisNode) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function decisionTagLabel(tag: string, labels: Readonly<Record<string, string>>): string;
|
|
15
|
+
/** Decisions with a tag filter and the selected option of each. */
|
|
16
|
+
export declare const DecisionsList: import("react").ForwardRefExoticComponent<DecisionsListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
//# sourceMappingURL=decisions-list.d.ts.map
|
|
@@ -0,0 +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,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAG9F;AAED,mEAAmE;AACnE,eAAO,MAAM,aAAa,+GAsFxB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState } from 'react';
|
|
3
|
+
import { countLabel, recordTitle, selectedOptionLabel } from '../model/records.js';
|
|
4
|
+
import { useLabels } from '../lib/labels.js';
|
|
5
|
+
import { EmptyState, RecordIdentity, RecordList } from '../primitives/record-list.js';
|
|
6
|
+
import { InventoryRecords } from './section.js';
|
|
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
|
+
/** Decisions with a tag filter and the selected option of each. */
|
|
13
|
+
export const DecisionsList = forwardRef(function DecisionsList({ analysis, tagLabels = {}, tagFilter: controlledFilter, defaultTagFilter = ALL_TAGS, onTagFilterChange, onOpenRecord, className, ...props }, ref) {
|
|
14
|
+
const labels = useLabels();
|
|
15
|
+
const [internalFilter, setInternalFilter] = useState(defaultTagFilter);
|
|
16
|
+
const [lastAnalysis, setLastAnalysis] = useState(analysis.canonicalPath);
|
|
17
|
+
if (lastAnalysis !== analysis.canonicalPath) {
|
|
18
|
+
setLastAnalysis(analysis.canonicalPath);
|
|
19
|
+
setInternalFilter(defaultTagFilter);
|
|
20
|
+
}
|
|
21
|
+
const tagFilter = controlledFilter ?? internalFilter;
|
|
22
|
+
const setTagFilter = (tag) => {
|
|
23
|
+
if (controlledFilter === undefined)
|
|
24
|
+
setInternalFilter(tag);
|
|
25
|
+
onTagFilterChange?.(tag);
|
|
26
|
+
};
|
|
27
|
+
const records = analysis.decisions;
|
|
28
|
+
const tags = [...new Set(records.flatMap((record) => record.tags ?? []))];
|
|
29
|
+
const counts = new Map();
|
|
30
|
+
for (const record of records)
|
|
31
|
+
for (const tag of record.tags ?? [])
|
|
32
|
+
counts.set(tag, (counts.get(tag) ?? 0) + 1);
|
|
33
|
+
const visibleRecords = tagFilter === ALL_TAGS
|
|
34
|
+
? records
|
|
35
|
+
: records.filter((record) => record.tags?.includes(tagFilter));
|
|
36
|
+
if (!records.length) {
|
|
37
|
+
return _jsx(EmptyState, { "data-slot": "decisions-list", ...props, ref: ref, className: className, children: labels.empty.decisions });
|
|
38
|
+
}
|
|
39
|
+
return (_jsxs(InventoryRecords, { ...props, ref: ref, kind: "decision", className: className, children: [tags.length ? (_jsxs("div", { className: "astra-inventory-filter", role: "group", "aria-label": "Filter decisions by tag", children: [_jsxs("div", { className: "astra-inventory-filter__chips", children: [_jsxs("button", { type: "button", "aria-pressed": tagFilter === ALL_TAGS, onClick: () => { setTagFilter(ALL_TAGS); }, children: ["All \u00B7 ", records.length] }), tags.map((tag) => (_jsxs("button", { type: "button", "aria-pressed": tagFilter === tag, onClick: () => { setTagFilter(tag); }, children: [decisionTagLabel(tag, tagLabels), " \u00B7 ", counts.get(tag) ?? 0] }, tag)))] }), _jsx("span", { children: countLabel(visibleRecords.length, 'decision') })] })) : null, _jsx(RecordList, { label: labels.sections.decisions, columnTemplate: "minmax(14rem, 1.1fr) minmax(12rem, 1fr) 6.875rem 1.5rem", columns: [
|
|
40
|
+
{ label: 'Decision', className: 'astra-record-list__primary' },
|
|
41
|
+
{ label: 'Selected option', className: 'astra-record-list__selection' },
|
|
42
|
+
{ label: 'Tag', className: 'astra-record-list__secondary' },
|
|
43
|
+
{ className: 'astra-record-list__arrow' },
|
|
44
|
+
], rows: visibleRecords.map((record) => ({
|
|
45
|
+
key: record.canonicalPath,
|
|
46
|
+
accessibleLabel: `${recordTitle(record)}, selected option ${selectedOptionLabel(record)}`,
|
|
47
|
+
onOpen: () => { onOpenRecord(record, analysis); },
|
|
48
|
+
cells: [
|
|
49
|
+
_jsx(RecordIdentity, { kind: "decision", title: recordTitle(record) }),
|
|
50
|
+
_jsx("span", { className: "astra-record-list__selected", children: selectedOptionLabel(record) }),
|
|
51
|
+
_jsx("span", { className: "astra-record-list__tag", children: record.tags?.[0] ? decisionTagLabel(record.tags[0], tagLabels) : '—' }),
|
|
52
|
+
_jsx("span", { "aria-hidden": "true", children: "\u2192" }),
|
|
53
|
+
],
|
|
54
|
+
})) })] }));
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=decisions-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decisions-list.js","sourceRoot":"","sources":["../../src/blocks/decisions-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC;AAa9B,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,MAAwC;IACpF,OAAO,MAAM,CAAC,GAAG,CAAC;WACb,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;AAC5F,CAAC;AAED,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAqC,SAAS,aAAa,CAAC,EACjG,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,GAAG,QAAQ,EAC3B,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,GAAG;IACJ,MAAM,MAAM,GAAG,SAAS,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,EAAE,UAAU,EAAE,SAAS,EAAE,4BAA4B,EAAE;oBAC9D,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,8BAA8B,EAAE;oBACvE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,8BAA8B,EAAE;oBAC3D,EAAE,SAAS,EAAE,0BAA0B,EAAE;iBAC1C,EACD,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBACpC,GAAG,EAAE,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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ResolvedAnalysisNode, ResolvedInsight } from '@astra-spec/sdk';
|
|
2
|
+
import { type HTMLAttributes } from 'react';
|
|
3
|
+
export interface FindingsListProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
4
|
+
analysis: ResolvedAnalysisNode;
|
|
5
|
+
onOpenRecord: (finding: ResolvedInsight, analysis: ResolvedAnalysisNode) => void;
|
|
6
|
+
}
|
|
7
|
+
/** Findings with their claim and evidence count. */
|
|
8
|
+
export declare const FindingsList: import("react").ForwardRefExoticComponent<FindingsListProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
//# sourceMappingURL=findings-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings-list.d.ts","sourceRoot":"","sources":["../../src/blocks/findings-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAMxD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACzF,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,YAAY,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAClF;AAMD,oDAAoD;AACpD,eAAO,MAAM,YAAY,8GA2CvB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { recordTitle } from '../model/records.js';
|
|
4
|
+
import { useLabels } from '../lib/labels.js';
|
|
5
|
+
import { EmptyState, RecordList } from '../primitives/record-list.js';
|
|
6
|
+
import { InventoryRecords } from './section.js';
|
|
7
|
+
function evidenceLabel(count) {
|
|
8
|
+
return `${count} evidence ${count === 1 ? 'item' : 'items'}`;
|
|
9
|
+
}
|
|
10
|
+
/** Findings with their claim and evidence count. */
|
|
11
|
+
export const FindingsList = forwardRef(function FindingsList({ analysis, onOpenRecord, className, ...props }, ref) {
|
|
12
|
+
const labels = useLabels();
|
|
13
|
+
const records = analysis.findings;
|
|
14
|
+
if (!records.length) {
|
|
15
|
+
return _jsx(EmptyState, { "data-slot": "findings-list", ...props, ref: ref, className: className, children: labels.empty.findings });
|
|
16
|
+
}
|
|
17
|
+
return (_jsx(InventoryRecords, { ...props, ref: ref, kind: "finding", className: className, children: _jsx(RecordList, { label: labels.sections.findings, columnTemplate: "minmax(18rem, 1fr) 7rem 1.5rem", columns: [
|
|
18
|
+
{ label: 'Finding', className: 'astra-record-list__primary' },
|
|
19
|
+
{ label: 'Evidence', className: 'astra-record-list__count astra-record-list__secondary' },
|
|
20
|
+
{ className: 'astra-record-list__arrow' },
|
|
21
|
+
], rows: records.map((record) => {
|
|
22
|
+
const count = record.evidence.length;
|
|
23
|
+
return {
|
|
24
|
+
key: record.canonicalPath,
|
|
25
|
+
accessibleLabel: `${recordTitle(record)}: ${record.claim} ${evidenceLabel(count)}`,
|
|
26
|
+
onOpen: () => { onOpenRecord(record, analysis); },
|
|
27
|
+
cells: [
|
|
28
|
+
_jsxs("span", { className: "astra-record-list__name", "data-variant": "claim", children: [_jsx("span", { className: "astra-record-list__glyph", "aria-hidden": "true", children: "\u25CF" }), _jsxs("span", { children: [record.label ? _jsx("small", { children: record.label }) : null, _jsx("strong", { children: record.claim })] })] }),
|
|
29
|
+
_jsx("span", { children: evidenceLabel(count) }),
|
|
30
|
+
_jsx("span", { "aria-hidden": "true", children: "\u2192" }),
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
}) }) }));
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=findings-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings-list.js","sourceRoot":"","sources":["../../src/blocks/findings-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,UAAU,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C,OAAO;oBACL,GAAG,EAAE,MAAM,CAAC,aAAa;oBACzB,eAAe,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;oBAClF,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;oBACjD,KAAK,EAAE;wBACL,gBAAM,SAAS,EAAC,yBAAyB,kBAAc,OAAO,aAC5D,eAAM,SAAS,EAAC,0BAA0B,iBAAa,MAAM,uBAAS,EACtE,2BACG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,0BAAQ,MAAM,CAAC,KAAK,GAAS,CAAC,CAAC,CAAC,IAAI,EACpD,2BAAS,MAAM,CAAC,KAAK,GAAU,IAC1B,IACF;wBACP,yBAAO,aAAa,CAAC,KAAK,CAAC,GAAQ;wBACnC,8BAAkB,MAAM,uBAAS;qBAClC;iBACF,CAAC;YACJ,CAAC,CAAC,GACF,GACe,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Blocks: sections of the inventory page, composable into any layout. */
|
|
2
|
+
export { AnalysisTree } from './analysis-tree.js';
|
|
3
|
+
export type { AnalysisTreeProps } from './analysis-tree.js';
|
|
4
|
+
export { InventoryOutline, sectionKind, InventoryRecords, InventorySection } from './section.js';
|
|
5
|
+
export type { InventoryOutlineEntry, InventoryOutlineProps, InventoryRecordsProps, InventorySectionId, InventorySectionProps, } from './section.js';
|
|
6
|
+
export { OutputCard, OutputsList } from './outputs-list.js';
|
|
7
|
+
export type { OutputCardProps, OutputsListProps } from './outputs-list.js';
|
|
8
|
+
export { ALL_TAGS, DecisionsList, decisionTagLabel } from './decisions-list.js';
|
|
9
|
+
export type { DecisionsListProps } from './decisions-list.js';
|
|
10
|
+
export { InputsList } from './inputs-list.js';
|
|
11
|
+
export type { InputsListProps } from './inputs-list.js';
|
|
12
|
+
export { FindingsList } from './findings-list.js';
|
|
13
|
+
export type { FindingsListProps } from './findings-list.js';
|
|
14
|
+
export { PriorInsightsList } from './prior-insights-list.js';
|
|
15
|
+
export type { PriorInsightsListProps } from './prior-insights-list.js';
|
|
16
|
+
export { PaperRows, PapersList } from './papers-list.js';
|
|
17
|
+
export type { PaperRowsProps, PapersListProps } from './papers-list.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjG,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,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,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAChF,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Blocks: sections of the inventory page, composable into any layout. */
|
|
2
|
+
export { AnalysisTree } from './analysis-tree.js';
|
|
3
|
+
export { InventoryOutline, sectionKind, InventoryRecords, InventorySection } from './section.js';
|
|
4
|
+
export { OutputCard, OutputsList } from './outputs-list.js';
|
|
5
|
+
export { ALL_TAGS, DecisionsList, decisionTagLabel } from './decisions-list.js';
|
|
6
|
+
export { InputsList } from './inputs-list.js';
|
|
7
|
+
export { FindingsList } from './findings-list.js';
|
|
8
|
+
export { PriorInsightsList } from './prior-insights-list.js';
|
|
9
|
+
export { PaperRows, PapersList } from './papers-list.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|