markgraphy 0.1.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.txt +21 -0
- package/README.md +154 -0
- package/dist/animated/GraphAgni.svelte +430 -0
- package/dist/animated/GraphAgni.svelte.d.ts +22 -0
- package/dist/animated/GraphAum.svelte +294 -0
- package/dist/animated/GraphAum.svelte.d.ts +20 -0
- package/dist/animated/GraphBoot.svelte +325 -0
- package/dist/animated/GraphBoot.svelte.d.ts +28 -0
- package/dist/animated/GraphCron.svelte +476 -0
- package/dist/animated/GraphCron.svelte.d.ts +42 -0
- package/dist/animated/GraphDamru.svelte +341 -0
- package/dist/animated/GraphDamru.svelte.d.ts +18 -0
- package/dist/animated/GraphDeps.svelte +245 -0
- package/dist/animated/GraphDeps.svelte.d.ts +29 -0
- package/dist/animated/GraphDiya.svelte +330 -0
- package/dist/animated/GraphDiya.svelte.d.ts +22 -0
- package/dist/animated/GraphFire.svelte +246 -0
- package/dist/animated/GraphFire.svelte.d.ts +22 -0
- package/dist/animated/GraphFlame.svelte +258 -0
- package/dist/animated/GraphFlame.svelte.d.ts +14 -0
- package/dist/animated/GraphFlowPlayer.svelte +346 -0
- package/dist/animated/GraphFlowPlayer.svelte.d.ts +27 -0
- package/dist/animated/GraphGanga.svelte +305 -0
- package/dist/animated/GraphGanga.svelte.d.ts +20 -0
- package/dist/animated/GraphHash.svelte +251 -0
- package/dist/animated/GraphHash.svelte.d.ts +20 -0
- package/dist/animated/GraphJapa.svelte +253 -0
- package/dist/animated/GraphJapa.svelte.d.ts +20 -0
- package/dist/animated/GraphLife.svelte +312 -0
- package/dist/animated/GraphLife.svelte.d.ts +27 -0
- package/dist/animated/GraphMandala.svelte +262 -0
- package/dist/animated/GraphMandala.svelte.d.ts +24 -0
- package/dist/animated/GraphMandel.svelte +290 -0
- package/dist/animated/GraphMandel.svelte.d.ts +27 -0
- package/dist/animated/GraphPulse.svelte +248 -0
- package/dist/animated/GraphPulse.svelte.d.ts +24 -0
- package/dist/animated/GraphRain.svelte +280 -0
- package/dist/animated/GraphRain.svelte.d.ts +22 -0
- package/dist/animated/GraphScatter.svelte +395 -0
- package/dist/animated/GraphScatter.svelte.d.ts +31 -0
- package/dist/animated/GraphScope.svelte +197 -0
- package/dist/animated/GraphScope.svelte.d.ts +22 -0
- package/dist/animated/GraphSequence.svelte +247 -0
- package/dist/animated/GraphSequence.svelte.d.ts +18 -0
- package/dist/animated/GraphSpinners.svelte +109 -0
- package/dist/animated/GraphSpinners.svelte.d.ts +22 -0
- package/dist/animated/GraphState.svelte +270 -0
- package/dist/animated/GraphState.svelte.d.ts +14 -0
- package/dist/animated/GraphStream.svelte +223 -0
- package/dist/animated/GraphStream.svelte.d.ts +24 -0
- package/dist/animated/GraphSurya.svelte +268 -0
- package/dist/animated/GraphSurya.svelte.d.ts +22 -0
- package/dist/animated/GraphTerminal.svelte +238 -0
- package/dist/animated/GraphTerminal.svelte.d.ts +28 -0
- package/dist/animated/GraphTicker.svelte +163 -0
- package/dist/animated/GraphTicker.svelte.d.ts +21 -0
- package/dist/animated/GraphTypewriter.svelte +130 -0
- package/dist/animated/GraphTypewriter.svelte.d.ts +22 -0
- package/dist/animated/GraphWorkflow.svelte +570 -0
- package/dist/animated/GraphWorkflow.svelte.d.ts +29 -0
- package/dist/assets/favicon.svg +21 -0
- package/dist/diagram/AmplifierDiagram.svelte +206 -0
- package/dist/diagram/AmplifierDiagram.svelte.d.ts +12 -0
- package/dist/diagram/AsciiDiagram.svelte +212 -0
- package/dist/diagram/AsciiDiagram.svelte.d.ts +24 -0
- package/dist/diagram/DiagramEditor.svelte +414 -0
- package/dist/diagram/DiagramEditor.svelte.d.ts +3 -0
- package/dist/diagram/MetricsTableDiagram.svelte +125 -0
- package/dist/diagram/MetricsTableDiagram.svelte.d.ts +18 -0
- package/dist/diagram/NestedRadiiDiagram.svelte +218 -0
- package/dist/diagram/NestedRadiiDiagram.svelte.d.ts +12 -0
- package/dist/diagram/PromptLoopDiagram.svelte +331 -0
- package/dist/diagram/PromptLoopDiagram.svelte.d.ts +12 -0
- package/dist/diagram/ascii.d.ts +35 -0
- package/dist/diagram/ascii.js +83 -0
- package/dist/diagram/parser.d.ts +16 -0
- package/dist/diagram/parser.js +71 -0
- package/dist/frame/Graph.svelte +141 -0
- package/dist/frame/Graph.svelte.d.ts +14 -0
- package/dist/frame/GraphArrow.svelte +49 -0
- package/dist/frame/GraphArrow.svelte.d.ts +9 -0
- package/dist/frame/GraphBody.svelte +39 -0
- package/dist/frame/GraphBody.svelte.d.ts +10 -0
- package/dist/frame/GraphRule.svelte +21 -0
- package/dist/frame/GraphRule.svelte.d.ts +6 -0
- package/dist/frame/GraphTick.svelte +23 -0
- package/dist/frame/GraphTick.svelte.d.ts +9 -0
- package/dist/frame/GraphTrack.svelte +29 -0
- package/dist/frame/GraphTrack.svelte.d.ts +14 -0
- package/dist/frame/clock.d.ts +10 -0
- package/dist/frame/clock.js +62 -0
- package/dist/frame/glyphs.d.ts +22 -0
- package/dist/frame/glyphs.js +53 -0
- package/dist/frame/motion.css +27 -0
- package/dist/frame/motion.d.ts +24 -0
- package/dist/frame/motion.js +47 -0
- package/dist/frame/tone.d.ts +11 -0
- package/dist/frame/tone.js +64 -0
- package/dist/graphs/GraphActivity.svelte +387 -0
- package/dist/graphs/GraphActivity.svelte.d.ts +22 -0
- package/dist/graphs/GraphBars.svelte +194 -0
- package/dist/graphs/GraphBars.svelte.d.ts +20 -0
- package/dist/graphs/GraphBullet.svelte +208 -0
- package/dist/graphs/GraphBullet.svelte.d.ts +22 -0
- package/dist/graphs/GraphCalendar.svelte +203 -0
- package/dist/graphs/GraphCalendar.svelte.d.ts +20 -0
- package/dist/graphs/GraphCells.svelte +181 -0
- package/dist/graphs/GraphCells.svelte.d.ts +18 -0
- package/dist/graphs/GraphCompare.svelte +192 -0
- package/dist/graphs/GraphCompare.svelte.d.ts +18 -0
- package/dist/graphs/GraphCountdown.svelte +96 -0
- package/dist/graphs/GraphCountdown.svelte.d.ts +14 -0
- package/dist/graphs/GraphDiff.svelte +181 -0
- package/dist/graphs/GraphDiff.svelte.d.ts +18 -0
- package/dist/graphs/GraphFlow.svelte +137 -0
- package/dist/graphs/GraphFlow.svelte.d.ts +21 -0
- package/dist/graphs/GraphFunnel.svelte +190 -0
- package/dist/graphs/GraphFunnel.svelte.d.ts +21 -0
- package/dist/graphs/GraphGantt.svelte +258 -0
- package/dist/graphs/GraphGantt.svelte.d.ts +25 -0
- package/dist/graphs/GraphHeatmap.svelte +287 -0
- package/dist/graphs/GraphHeatmap.svelte.d.ts +22 -0
- package/dist/graphs/GraphInvoice.svelte +294 -0
- package/dist/graphs/GraphInvoice.svelte.d.ts +34 -0
- package/dist/graphs/GraphKpi.svelte +166 -0
- package/dist/graphs/GraphKpi.svelte.d.ts +17 -0
- package/dist/graphs/GraphLatency.svelte +340 -0
- package/dist/graphs/GraphLatency.svelte.d.ts +28 -0
- package/dist/graphs/GraphMeter.svelte +121 -0
- package/dist/graphs/GraphMeter.svelte.d.ts +16 -0
- package/dist/graphs/GraphPlot.svelte +226 -0
- package/dist/graphs/GraphPlot.svelte.d.ts +18 -0
- package/dist/graphs/GraphQuota.svelte +303 -0
- package/dist/graphs/GraphQuota.svelte.d.ts +27 -0
- package/dist/graphs/GraphRank.svelte +141 -0
- package/dist/graphs/GraphRank.svelte.d.ts +21 -0
- package/dist/graphs/GraphSlo.svelte +325 -0
- package/dist/graphs/GraphSlo.svelte.d.ts +31 -0
- package/dist/graphs/GraphSlope.svelte +197 -0
- package/dist/graphs/GraphSlope.svelte.d.ts +19 -0
- package/dist/graphs/GraphSpark.svelte +125 -0
- package/dist/graphs/GraphSpark.svelte.d.ts +15 -0
- package/dist/graphs/GraphSpec.svelte +69 -0
- package/dist/graphs/GraphSpec.svelte.d.ts +14 -0
- package/dist/graphs/GraphStack.svelte +266 -0
- package/dist/graphs/GraphStack.svelte.d.ts +25 -0
- package/dist/graphs/GraphStat.svelte +103 -0
- package/dist/graphs/GraphStat.svelte.d.ts +16 -0
- package/dist/graphs/GraphTable.svelte +133 -0
- package/dist/graphs/GraphTable.svelte.d.ts +15 -0
- package/dist/graphs/GraphTimeline.svelte +164 -0
- package/dist/graphs/GraphTimeline.svelte.d.ts +18 -0
- package/dist/graphs/GraphTimer.svelte +117 -0
- package/dist/graphs/GraphTimer.svelte.d.ts +15 -0
- package/dist/graphs/GraphTree.svelte +147 -0
- package/dist/graphs/GraphTree.svelte.d.ts +16 -0
- package/dist/graphs/GraphUptime.svelte +210 -0
- package/dist/graphs/GraphUptime.svelte.d.ts +18 -0
- package/dist/graphs/GraphWaffle.svelte +131 -0
- package/dist/graphs/GraphWaffle.svelte.d.ts +17 -0
- package/dist/graphs/GraphWaterfall.svelte +258 -0
- package/dist/graphs/GraphWaterfall.svelte.d.ts +22 -0
- package/dist/index.d.ts +147 -0
- package/dist/index.js +87 -0
- package/dist/themes.css +54 -0
- package/package.json +67 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Glyphs } from '../frame/glyphs';
|
|
3
|
+
import type { GraphPalette } from '../frame/tone';
|
|
4
|
+
|
|
5
|
+
/** Labeled 2d intensity matrix with an optional less/more legend. */
|
|
6
|
+
export interface HeatRow {
|
|
7
|
+
label: string;
|
|
8
|
+
values: number[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface GraphHeatmapProps {
|
|
12
|
+
title: string;
|
|
13
|
+
columns: string[];
|
|
14
|
+
rows: HeatRow[];
|
|
15
|
+
max?: number;
|
|
16
|
+
legend?: boolean;
|
|
17
|
+
caption?: string;
|
|
18
|
+
glyphs?: Glyphs;
|
|
19
|
+
palette?: GraphPalette;
|
|
20
|
+
corner?: string;
|
|
21
|
+
class?: string;
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import Graph from '../frame/Graph.svelte';
|
|
27
|
+
import GraphBody from '../frame/GraphBody.svelte';
|
|
28
|
+
import { intensityGlyph, intensityLevel, resolveGlyphs } from '../frame/glyphs';
|
|
29
|
+
import { intensityRole } from '../frame/tone';
|
|
30
|
+
import type { ToneRole } from '../frame/tone';
|
|
31
|
+
import { reveal, stagger } from '../frame/motion';
|
|
32
|
+
|
|
33
|
+
let {
|
|
34
|
+
title,
|
|
35
|
+
columns,
|
|
36
|
+
rows,
|
|
37
|
+
max,
|
|
38
|
+
legend = true,
|
|
39
|
+
caption,
|
|
40
|
+
glyphs,
|
|
41
|
+
palette,
|
|
42
|
+
corner,
|
|
43
|
+
class: className = ''
|
|
44
|
+
}: GraphHeatmapProps = $props();
|
|
45
|
+
|
|
46
|
+
const set = $derived(resolveGlyphs(glyphs));
|
|
47
|
+
const peak = $derived(max ?? Math.max(0, ...rows.flatMap((row) => row.values), 0));
|
|
48
|
+
|
|
49
|
+
const scale = $derived(
|
|
50
|
+
set.map((glyph, index) => ({
|
|
51
|
+
glyph,
|
|
52
|
+
key: `${glyph}-${index}`,
|
|
53
|
+
role: intensityRole(Math.round((index / Math.max(set.length - 1, 1)) * 4), palette)
|
|
54
|
+
}))
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const view = $derived(
|
|
58
|
+
rows.map((row) => ({
|
|
59
|
+
label: row.label,
|
|
60
|
+
spoken: `${row.label}: ${columns
|
|
61
|
+
.map((column, index) => `${column} ${row.values[index] ?? 0}`)
|
|
62
|
+
.join(', ')}`,
|
|
63
|
+
cells: columns.map((_, index) => {
|
|
64
|
+
const level = intensityLevel(row.values[index] ?? 0, peak);
|
|
65
|
+
return {
|
|
66
|
+
glyph: intensityGlyph(level, set),
|
|
67
|
+
role: intensityRole(level, palette) as ToneRole
|
|
68
|
+
};
|
|
69
|
+
})
|
|
70
|
+
}))
|
|
71
|
+
);
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<Graph {title} {corner} class={className}>
|
|
75
|
+
<GraphBody>
|
|
76
|
+
<div class="hm">
|
|
77
|
+
<div class="wrap">
|
|
78
|
+
<div class="cols">
|
|
79
|
+
<span class="spacer"></span>
|
|
80
|
+
{#each columns as column, c (c)}
|
|
81
|
+
<span class="colhead">{column}</span>
|
|
82
|
+
{/each}
|
|
83
|
+
</div>
|
|
84
|
+
<ul class="rows" role="list">
|
|
85
|
+
{#each view as row, r (row.label)}
|
|
86
|
+
<li
|
|
87
|
+
class="row"
|
|
88
|
+
aria-label={row.spoken}
|
|
89
|
+
use:reveal={{ delay: stagger(r, 40), amount: 0.4 }}
|
|
90
|
+
>
|
|
91
|
+
<span class="label">{row.label}</span>
|
|
92
|
+
<span class="cells" aria-hidden="true">
|
|
93
|
+
{#each row.cells as cell, c (c)}
|
|
94
|
+
<span
|
|
95
|
+
class="cell"
|
|
96
|
+
class:c-frame={cell.role === 'empty'}
|
|
97
|
+
class:c-muted={cell.role === 'muted'}
|
|
98
|
+
class:c-fg={cell.role === 'foreground'}
|
|
99
|
+
class:c-accent={cell.role === 'accent'}
|
|
100
|
+
class:c-accent2={cell.role === 'accent2'}
|
|
101
|
+
class:c-accent3={cell.role === 'accent3'}
|
|
102
|
+
>
|
|
103
|
+
{cell.glyph}
|
|
104
|
+
</span>
|
|
105
|
+
{/each}
|
|
106
|
+
</span>
|
|
107
|
+
</li>
|
|
108
|
+
{/each}
|
|
109
|
+
</ul>
|
|
110
|
+
</div>
|
|
111
|
+
{#if legend || caption}
|
|
112
|
+
<div class="foot">
|
|
113
|
+
{#if caption}
|
|
114
|
+
<p class="muted">{caption}</p>
|
|
115
|
+
{:else}
|
|
116
|
+
<span></span>
|
|
117
|
+
{/if}
|
|
118
|
+
{#if legend}
|
|
119
|
+
<p class="legend">
|
|
120
|
+
<span>Less</span>
|
|
121
|
+
<span class="scale" aria-hidden="true">
|
|
122
|
+
{#each scale as entry (entry.key)}
|
|
123
|
+
<span
|
|
124
|
+
class="sglyph"
|
|
125
|
+
class:c-frame={entry.role === 'empty'}
|
|
126
|
+
class:c-muted={entry.role === 'muted'}
|
|
127
|
+
class:c-fg={entry.role === 'foreground'}
|
|
128
|
+
class:c-accent={entry.role === 'accent'}
|
|
129
|
+
class:c-accent2={entry.role === 'accent2'}
|
|
130
|
+
class:c-accent3={entry.role === 'accent3'}
|
|
131
|
+
>
|
|
132
|
+
{entry.glyph}
|
|
133
|
+
</span>
|
|
134
|
+
{/each}
|
|
135
|
+
</span>
|
|
136
|
+
<span>More</span>
|
|
137
|
+
</p>
|
|
138
|
+
{/if}
|
|
139
|
+
</div>
|
|
140
|
+
{/if}
|
|
141
|
+
<span class="sr-only">{rows.length} rows across {columns.length} columns</span>
|
|
142
|
+
</div>
|
|
143
|
+
</GraphBody>
|
|
144
|
+
</Graph>
|
|
145
|
+
|
|
146
|
+
<style>
|
|
147
|
+
.hm {
|
|
148
|
+
display: flex;
|
|
149
|
+
flex-direction: column;
|
|
150
|
+
gap: 1rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.wrap {
|
|
154
|
+
display: flex;
|
|
155
|
+
width: 100%;
|
|
156
|
+
flex-direction: column;
|
|
157
|
+
gap: 0.5rem;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.cols {
|
|
161
|
+
display: flex;
|
|
162
|
+
width: 100%;
|
|
163
|
+
align-items: flex-end;
|
|
164
|
+
gap: 0.25rem;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.spacer {
|
|
168
|
+
width: 7rem;
|
|
169
|
+
flex: 0 0 auto;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.colhead {
|
|
173
|
+
overflow: hidden;
|
|
174
|
+
min-width: 1.25ch;
|
|
175
|
+
flex: 1 1 0%;
|
|
176
|
+
text-align: center;
|
|
177
|
+
text-overflow: ellipsis;
|
|
178
|
+
white-space: nowrap;
|
|
179
|
+
color: var(--graph-muted, oklch(0.62 0 0));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.rows {
|
|
183
|
+
margin: 0;
|
|
184
|
+
padding: 0;
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
gap: 0.25rem;
|
|
188
|
+
list-style: none;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.row {
|
|
192
|
+
display: flex;
|
|
193
|
+
align-items: center;
|
|
194
|
+
gap: 0.25rem;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.label {
|
|
198
|
+
overflow: hidden;
|
|
199
|
+
width: 7rem;
|
|
200
|
+
flex: 0 0 auto;
|
|
201
|
+
text-overflow: ellipsis;
|
|
202
|
+
white-space: nowrap;
|
|
203
|
+
color: var(--graph-foreground, oklch(0.93 0 0));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.cells {
|
|
207
|
+
display: flex;
|
|
208
|
+
min-width: 0;
|
|
209
|
+
flex: 1 1 0%;
|
|
210
|
+
gap: 0.25rem;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.cell {
|
|
214
|
+
min-width: 1.25ch;
|
|
215
|
+
flex: 1 1 0%;
|
|
216
|
+
line-height: 1;
|
|
217
|
+
text-align: center;
|
|
218
|
+
user-select: none;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.foot {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-wrap: wrap;
|
|
224
|
+
align-items: center;
|
|
225
|
+
justify-content: space-between;
|
|
226
|
+
gap: 0.75rem;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.legend {
|
|
230
|
+
margin: 0;
|
|
231
|
+
display: flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
gap: 0.5rem;
|
|
234
|
+
color: var(--graph-muted, oklch(0.62 0 0));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.scale {
|
|
238
|
+
display: flex;
|
|
239
|
+
user-select: none;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.sglyph {
|
|
243
|
+
width: 1ch;
|
|
244
|
+
text-align: center;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.muted {
|
|
248
|
+
margin: 0;
|
|
249
|
+
color: var(--graph-muted, oklch(0.62 0 0));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.c-accent {
|
|
253
|
+
color: var(--graph-accent, oklch(0.78 0.17 155));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.c-accent2 {
|
|
257
|
+
color: var(--graph-accent-2, oklch(0.78 0.12 70));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.c-accent3 {
|
|
261
|
+
color: var(--graph-accent-3, oklch(0.75 0.1 200));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.c-frame {
|
|
265
|
+
color: var(--graph-frame, oklch(0.6 0 0 / 0.5));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.c-fg {
|
|
269
|
+
color: var(--graph-foreground, oklch(0.93 0 0));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.c-muted {
|
|
273
|
+
color: var(--graph-muted, oklch(0.62 0 0));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.sr-only {
|
|
277
|
+
position: absolute;
|
|
278
|
+
width: 1px;
|
|
279
|
+
height: 1px;
|
|
280
|
+
padding: 0;
|
|
281
|
+
margin: -1px;
|
|
282
|
+
overflow: hidden;
|
|
283
|
+
clip-path: inset(50%);
|
|
284
|
+
white-space: nowrap;
|
|
285
|
+
border-width: 0;
|
|
286
|
+
}
|
|
287
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Glyphs } from '../frame/glyphs';
|
|
2
|
+
import type { GraphPalette } from '../frame/tone';
|
|
3
|
+
/** Labeled 2d intensity matrix with an optional less/more legend. */
|
|
4
|
+
export interface HeatRow {
|
|
5
|
+
label: string;
|
|
6
|
+
values: number[];
|
|
7
|
+
}
|
|
8
|
+
export interface GraphHeatmapProps {
|
|
9
|
+
title: string;
|
|
10
|
+
columns: string[];
|
|
11
|
+
rows: HeatRow[];
|
|
12
|
+
max?: number;
|
|
13
|
+
legend?: boolean;
|
|
14
|
+
caption?: string;
|
|
15
|
+
glyphs?: Glyphs;
|
|
16
|
+
palette?: GraphPalette;
|
|
17
|
+
corner?: string;
|
|
18
|
+
class?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const GraphHeatmap: import("svelte").Component<GraphHeatmapProps, {}, "">;
|
|
21
|
+
type GraphHeatmap = ReturnType<typeof GraphHeatmap>;
|
|
22
|
+
export default GraphHeatmap;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
/** Invoice document: from / bill-to blocks, meta, line items, totals. */
|
|
3
|
+
export interface InvoiceParty {
|
|
4
|
+
name: string;
|
|
5
|
+
lines?: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface InvoiceMeta {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface InvoiceItem {
|
|
14
|
+
description: string;
|
|
15
|
+
qty?: string;
|
|
16
|
+
rate?: string;
|
|
17
|
+
amount: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface InvoiceTotal {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
accent?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GraphInvoiceProps {
|
|
27
|
+
title: string;
|
|
28
|
+
from?: InvoiceParty;
|
|
29
|
+
to?: InvoiceParty;
|
|
30
|
+
meta?: InvoiceMeta[];
|
|
31
|
+
items: InvoiceItem[];
|
|
32
|
+
totals?: InvoiceTotal[];
|
|
33
|
+
note?: string;
|
|
34
|
+
corner?: string;
|
|
35
|
+
class?: string;
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<script lang="ts">
|
|
40
|
+
import Graph from '../frame/Graph.svelte';
|
|
41
|
+
import GraphBody from '../frame/GraphBody.svelte';
|
|
42
|
+
import GraphRule from '../frame/GraphRule.svelte';
|
|
43
|
+
import { reveal, stagger } from '../frame/motion';
|
|
44
|
+
|
|
45
|
+
let {
|
|
46
|
+
title,
|
|
47
|
+
from,
|
|
48
|
+
to,
|
|
49
|
+
meta,
|
|
50
|
+
items,
|
|
51
|
+
totals,
|
|
52
|
+
note,
|
|
53
|
+
corner,
|
|
54
|
+
class: className = ''
|
|
55
|
+
}: GraphInvoiceProps = $props();
|
|
56
|
+
|
|
57
|
+
const showQty = $derived(items.some((row) => row.qty != null));
|
|
58
|
+
const showRate = $derived(items.some((row) => row.rate != null));
|
|
59
|
+
const columns = $derived(1 + Number(showQty) + Number(showRate) + 1);
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<Graph {title} {corner} class={className}>
|
|
63
|
+
<GraphBody tight>
|
|
64
|
+
<div class="inv">
|
|
65
|
+
{#if from || to}
|
|
66
|
+
<div class="parties">
|
|
67
|
+
{#if from}
|
|
68
|
+
<div class="party">
|
|
69
|
+
<p class="kicker">From</p>
|
|
70
|
+
<p class="name">{from.name}</p>
|
|
71
|
+
{#each from.lines ?? [] as line}
|
|
72
|
+
<p class="muted">{line}</p>
|
|
73
|
+
{/each}
|
|
74
|
+
</div>
|
|
75
|
+
{/if}
|
|
76
|
+
{#if to}
|
|
77
|
+
<div class="party">
|
|
78
|
+
<p class="kicker">Bill to</p>
|
|
79
|
+
<p class="name">{to.name}</p>
|
|
80
|
+
{#each to.lines ?? [] as line}
|
|
81
|
+
<p class="muted">{line}</p>
|
|
82
|
+
{/each}
|
|
83
|
+
</div>
|
|
84
|
+
{/if}
|
|
85
|
+
</div>
|
|
86
|
+
{/if}
|
|
87
|
+
|
|
88
|
+
{#if meta && meta.length > 0}
|
|
89
|
+
<dl class="meta">
|
|
90
|
+
{#each meta as entry (entry.label)}
|
|
91
|
+
<div class="party">
|
|
92
|
+
<dt class="kicker">{entry.label}</dt>
|
|
93
|
+
<dd class="name">{entry.value}</dd>
|
|
94
|
+
</div>
|
|
95
|
+
{/each}
|
|
96
|
+
</dl>
|
|
97
|
+
{/if}
|
|
98
|
+
|
|
99
|
+
<div class="scroll">
|
|
100
|
+
<table class="table">
|
|
101
|
+
<thead>
|
|
102
|
+
<tr>
|
|
103
|
+
<th scope="col" class="cell head">Description</th>
|
|
104
|
+
{#if showQty}
|
|
105
|
+
<th scope="col" class="cell head pad">Qty</th>
|
|
106
|
+
{/if}
|
|
107
|
+
{#if showRate}
|
|
108
|
+
<th scope="col" class="cell head pad">Rate</th>
|
|
109
|
+
{/if}
|
|
110
|
+
<th scope="col" class="cell head right">Amount</th>
|
|
111
|
+
</tr>
|
|
112
|
+
<tr>
|
|
113
|
+
<th class="rulecell" colspan={columns}>
|
|
114
|
+
<GraphRule />
|
|
115
|
+
</th>
|
|
116
|
+
</tr>
|
|
117
|
+
</thead>
|
|
118
|
+
<tbody>
|
|
119
|
+
{#each items as row, i (row.description)}
|
|
120
|
+
<tr use:reveal={{ delay: stagger(i, 40), amount: 0.4 }}>
|
|
121
|
+
<td class="cell">{row.description}</td>
|
|
122
|
+
{#if showQty}
|
|
123
|
+
<td class="cell pad right">{row.qty ?? ''}</td>
|
|
124
|
+
{/if}
|
|
125
|
+
{#if showRate}
|
|
126
|
+
<td class="cell pad right">{row.rate ?? ''}</td>
|
|
127
|
+
{/if}
|
|
128
|
+
<td class="cell right">{row.amount}</td>
|
|
129
|
+
</tr>
|
|
130
|
+
{/each}
|
|
131
|
+
</tbody>
|
|
132
|
+
</table>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
{#if totals && totals.length > 0}
|
|
136
|
+
<div class="totals">
|
|
137
|
+
<GraphRule />
|
|
138
|
+
<dl class="total-list">
|
|
139
|
+
{#each totals as entry, i (entry.label)}
|
|
140
|
+
<div class="total-row" use:reveal={{ delay: stagger(i, 40) }}>
|
|
141
|
+
<dt class="total-label" class:c-fg={entry.accent} class:c-muted={!entry.accent}>
|
|
142
|
+
{entry.label}
|
|
143
|
+
</dt>
|
|
144
|
+
<dd class="total-value" class:c-accent={entry.accent} class:c-fg={!entry.accent}>
|
|
145
|
+
{entry.value}
|
|
146
|
+
</dd>
|
|
147
|
+
</div>
|
|
148
|
+
{/each}
|
|
149
|
+
</dl>
|
|
150
|
+
</div>
|
|
151
|
+
{/if}
|
|
152
|
+
|
|
153
|
+
{#if note}
|
|
154
|
+
<p class="note">{note}</p>
|
|
155
|
+
{/if}
|
|
156
|
+
</div>
|
|
157
|
+
</GraphBody>
|
|
158
|
+
</Graph>
|
|
159
|
+
|
|
160
|
+
<style>
|
|
161
|
+
.inv {
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
gap: 2rem;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.parties {
|
|
168
|
+
display: grid;
|
|
169
|
+
gap: 1.5rem;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media (min-width: 640px) {
|
|
173
|
+
.parties {
|
|
174
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.party {
|
|
179
|
+
display: flex;
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
gap: 0.25rem;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.kicker {
|
|
185
|
+
margin: 0;
|
|
186
|
+
letter-spacing: 0.025em;
|
|
187
|
+
text-transform: uppercase;
|
|
188
|
+
color: var(--graph-muted, oklch(0.62 0 0));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.name {
|
|
192
|
+
margin: 0;
|
|
193
|
+
color: var(--graph-foreground, oklch(0.93 0 0));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.muted {
|
|
197
|
+
margin: 0;
|
|
198
|
+
color: var(--graph-muted, oklch(0.62 0 0));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.meta {
|
|
202
|
+
margin: 0;
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-wrap: wrap;
|
|
205
|
+
column-gap: 2rem;
|
|
206
|
+
row-gap: 0.75rem;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.scroll {
|
|
210
|
+
overflow-x: auto;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.table {
|
|
214
|
+
width: 100%;
|
|
215
|
+
min-width: 32rem;
|
|
216
|
+
border-collapse: separate;
|
|
217
|
+
border-spacing: 0;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.cell {
|
|
221
|
+
padding: 0.625rem 0;
|
|
222
|
+
text-align: left;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.cell.pad {
|
|
226
|
+
padding-left: 0.75rem;
|
|
227
|
+
padding-right: 0.75rem;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.cell.right {
|
|
231
|
+
text-align: right;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.cell.head {
|
|
235
|
+
padding-top: 0;
|
|
236
|
+
padding-bottom: 0.75rem;
|
|
237
|
+
font-weight: 400;
|
|
238
|
+
color: var(--graph-muted, oklch(0.62 0 0));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.rulecell {
|
|
242
|
+
padding: 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.totals {
|
|
246
|
+
display: flex;
|
|
247
|
+
flex-direction: column;
|
|
248
|
+
gap: 0.75rem;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.total-list {
|
|
252
|
+
margin: 0 0 0 auto;
|
|
253
|
+
display: flex;
|
|
254
|
+
width: 100%;
|
|
255
|
+
max-width: 22rem;
|
|
256
|
+
flex-direction: column;
|
|
257
|
+
gap: 0.5rem;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.total-row {
|
|
261
|
+
display: grid;
|
|
262
|
+
grid-template-columns: minmax(0, 1fr) 8rem;
|
|
263
|
+
align-items: baseline;
|
|
264
|
+
column-gap: 1rem;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.total-label {
|
|
268
|
+
margin: 0;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.total-value {
|
|
272
|
+
margin: 0;
|
|
273
|
+
text-align: right;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.note {
|
|
277
|
+
margin: 0;
|
|
278
|
+
max-width: 48ch;
|
|
279
|
+
text-wrap: pretty;
|
|
280
|
+
color: var(--graph-muted, oklch(0.62 0 0));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.c-accent {
|
|
284
|
+
color: var(--graph-accent, oklch(0.78 0.17 155));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.c-fg {
|
|
288
|
+
color: var(--graph-foreground, oklch(0.93 0 0));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.c-muted {
|
|
292
|
+
color: var(--graph-muted, oklch(0.62 0 0));
|
|
293
|
+
}
|
|
294
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Invoice document: from / bill-to blocks, meta, line items, totals. */
|
|
2
|
+
export interface InvoiceParty {
|
|
3
|
+
name: string;
|
|
4
|
+
lines?: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface InvoiceMeta {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
export interface InvoiceItem {
|
|
11
|
+
description: string;
|
|
12
|
+
qty?: string;
|
|
13
|
+
rate?: string;
|
|
14
|
+
amount: string;
|
|
15
|
+
}
|
|
16
|
+
export interface InvoiceTotal {
|
|
17
|
+
label: string;
|
|
18
|
+
value: string;
|
|
19
|
+
accent?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface GraphInvoiceProps {
|
|
22
|
+
title: string;
|
|
23
|
+
from?: InvoiceParty;
|
|
24
|
+
to?: InvoiceParty;
|
|
25
|
+
meta?: InvoiceMeta[];
|
|
26
|
+
items: InvoiceItem[];
|
|
27
|
+
totals?: InvoiceTotal[];
|
|
28
|
+
note?: string;
|
|
29
|
+
corner?: string;
|
|
30
|
+
class?: string;
|
|
31
|
+
}
|
|
32
|
+
declare const GraphInvoice: import("svelte").Component<GraphInvoiceProps, {}, "">;
|
|
33
|
+
type GraphInvoice = ReturnType<typeof GraphInvoice>;
|
|
34
|
+
export default GraphInvoice;
|