vizmatic 0.3.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/PROMPT.md +75 -525
  2. package/README.md +87 -578
  3. package/ROADMAP.md +49 -67
  4. package/SCIENCE.md +250 -0
  5. package/assets/THIRD_PARTY_LICENSES.md +40 -1
  6. package/assets/fonts/InstrumentSerif-Italic.ttf +0 -0
  7. package/assets/fonts/InstrumentSerif-Regular.ttf +0 -0
  8. package/assets/licenses/raster-codecs-MIT.txt +74 -0
  9. package/dist/chunk-3F2VQ7NW.js +1 -0
  10. package/dist/chunk-4XE64I2U.js +755 -0
  11. package/dist/chunk-JHHPLALU.js +79 -0
  12. package/dist/chunk-LTX44BAE.js +112 -0
  13. package/dist/chunk-MLKGABMK.js +9 -0
  14. package/dist/chunk-PSBF4TEK.js +1 -0
  15. package/dist/chunk-RPAHMKAR.js +605 -0
  16. package/dist/chunk-RWF4VBUL.js +3617 -0
  17. package/dist/chunk-WHT6HRMX.js +4201 -0
  18. package/dist/cli.js +371 -10
  19. package/dist/index.cjs +11129 -2922
  20. package/dist/index.d.cts +1225 -369
  21. package/dist/index.d.ts +1225 -369
  22. package/dist/index.js +6220 -3015
  23. package/dist/math-LXB4FH4E.js +7 -0
  24. package/dist/math-QVCETQDQ.js +1 -0
  25. package/dist/scene-browser-assets.d.ts +38 -0
  26. package/dist/scene-browser-assets.js +53 -0
  27. package/dist/scene-browser-chunks/chunk-5MVLYGXM.js +70 -0
  28. package/dist/scene-browser-chunks/chunk-ASXKN3NU.js +1 -0
  29. package/dist/scene-browser-chunks/chunk-CM5Y5LZP.js +1 -0
  30. package/dist/scene-browser-chunks/chunk-DP7NB4EW.js +6 -0
  31. package/dist/scene-browser-chunks/emscripten-module.browser-M5AEKJGE.js +1 -0
  32. package/dist/scene-browser-chunks/ffi-FL6ORJU3.js +1 -0
  33. package/dist/scene-browser-chunks/module-ES6BEMUI-JD5S5VKR.js +1 -0
  34. package/dist/scene-browser-chunks/module-asyncify-2EFITU5U-HWPFJFJC.js +1 -0
  35. package/dist/scene-browser-chunks/scene-browser-layout-M3XSXMV4.js +27 -0
  36. package/dist/scene-browser.d.ts +117 -0
  37. package/dist/scene-browser.js +220 -0
  38. package/dist/scene-cli.d.ts +1 -0
  39. package/dist/scene-cli.js +4 -0
  40. package/dist/scene-runtime.cjs +995 -0
  41. package/dist/scene-runtime.d.cts +81 -0
  42. package/dist/scene-runtime.d.ts +81 -0
  43. package/dist/scene-runtime.js +22 -0
  44. package/dist/server-2FYHZ4UO.js +331 -0
  45. package/dist/stage-browser/browser.d.ts +2482 -0
  46. package/dist/stage-browser/chunk-SQE76S5B.js +1 -0
  47. package/dist/stage-browser/chunk-VZNL6JY2.js +59 -0
  48. package/dist/stage-browser/dagre.esm-N2NIVIAZ.js +6 -0
  49. package/dist/stage-browser/math-4WFNHVV2.js +18 -0
  50. package/dist/stage-browser/stage.js +19 -0
  51. package/dist/stage-export.cjs +4950 -0
  52. package/dist/stage-export.d.cts +112 -0
  53. package/dist/stage-export.d.ts +112 -0
  54. package/dist/stage-export.js +544 -0
  55. package/dist/stage.cjs +9745 -0
  56. package/dist/stage.d.cts +1678 -0
  57. package/dist/stage.d.ts +1678 -0
  58. package/dist/stage.js +5404 -0
  59. package/dist/svg-import-Djj2q7Pc.d.cts +742 -0
  60. package/dist/svg-import-Djj2q7Pc.d.ts +742 -0
  61. package/dist/video-CcHW1qhV.d.cts +532 -0
  62. package/dist/video-CcHW1qhV.d.ts +532 -0
  63. package/examples/README.md +18 -0
  64. package/examples/agent-pipeline.tsx +4 -4
  65. package/examples/animated-pipeline.tsx +1 -5
  66. package/examples/attention-head.tsx +12 -12
  67. package/examples/aurora-incident.tsx +4 -3
  68. package/examples/building-blocks.tsx +8 -9
  69. package/examples/catalog-charts.tsx +4 -4
  70. package/examples/catalog-content.tsx +7 -9
  71. package/examples/catalog-convolution-kernel.tsx +116 -0
  72. package/examples/catalog-data.tsx +2 -8
  73. package/examples/catalog-dataflow.tsx +5 -9
  74. package/examples/catalog-dense.tsx +80 -0
  75. package/examples/catalog-deployment.tsx +5 -11
  76. package/examples/catalog-diagrams.tsx +13 -16
  77. package/examples/catalog-drawing.tsx +7 -7
  78. package/examples/catalog-flows.tsx +4 -4
  79. package/examples/catalog-foundations.tsx +11 -11
  80. package/examples/catalog-gaussian-blur.tsx +146 -0
  81. package/examples/catalog-image-tensors.tsx +115 -0
  82. package/examples/catalog-ml.tsx +36 -31
  83. package/examples/catalog-numeric-matrices.tsx +93 -0
  84. package/examples/catalog-photo-blur.tsx +209 -0
  85. package/examples/catalog-science-ai.tsx +130 -0
  86. package/examples/catalog-science-chemistry.tsx +103 -0
  87. package/examples/catalog-science-math.tsx +93 -0
  88. package/examples/catalog-science-physics.tsx +84 -0
  89. package/examples/catalog-sequence.tsx +59 -38
  90. package/examples/data-pipeline-lineage-presentation.tsx +5 -0
  91. package/examples/data-pipeline-lineage.tsx +85 -0
  92. package/examples/daybreak-launch.tsx +1 -0
  93. package/examples/desired-quadrant.tsx +7 -8
  94. package/examples/engineering-dashboard-presentation.tsx +13 -0
  95. package/examples/engineering-dashboard.tsx +160 -0
  96. package/examples/engineering-flow.tsx +2 -4
  97. package/examples/eval-dashboard.tsx +6 -6
  98. package/examples/films/attention.ts +278 -0
  99. package/examples/films/cache-miss.ts +431 -0
  100. package/examples/films/catalog.json +132 -0
  101. package/examples/films/central-limit.ts +269 -0
  102. package/examples/films/complex-maps.ts +273 -0
  103. package/examples/films/deck-example.ts +224 -0
  104. package/examples/films/euler-circle.ts +179 -0
  105. package/examples/films/fourier-epicycles.ts +265 -0
  106. package/examples/films/gradient-descent.ts +345 -0
  107. package/examples/films/linear-maps.ts +175 -0
  108. package/examples/films/lorenz.ts +207 -0
  109. package/examples/films/pythagoras.ts +185 -0
  110. package/examples/films/taylor-series.ts +159 -0
  111. package/examples/films/vizmatic-title.ts +117 -0
  112. package/examples/llm-serving-stack-presentation.tsx +5 -0
  113. package/examples/llm-serving-stack.tsx +94 -0
  114. package/examples/model-garden.tsx +1 -0
  115. package/examples/model-router.tsx +6 -6
  116. package/examples/nccl-all-gather.tsx +3 -3
  117. package/examples/nccl-all-reduce.tsx +3 -3
  118. package/examples/nccl-all-to-all.tsx +1 -1
  119. package/examples/nccl-broadcast.tsx +1 -1
  120. package/examples/nccl-reduce-scatter.tsx +5 -5
  121. package/examples/orthogonal-routing.tsx +4 -4
  122. package/examples/pareto-frontier.tsx +9 -10
  123. package/examples/presentation-frame.tsx +6 -6
  124. package/examples/pressure-mechanism.scene.json +14 -0
  125. package/examples/production-system-map-presentation.tsx +5 -0
  126. package/examples/production-system-map.tsx +130 -0
  127. package/examples/rag-graph.tsx +7 -7
  128. package/examples/release-card.tsx +5 -5
  129. package/examples/spec-anatomy.tsx +5 -5
  130. package/examples/system-architecture.tsx +19 -32
  131. package/examples/theme-system.tsx +1 -1
  132. package/examples/token-matrix.tsx +4 -2
  133. package/examples/transparent-badge.tsx +1 -2
  134. package/examples/videos/README.md +62 -0
  135. package/examples/videos/calculus-tangent.tsx +101 -0
  136. package/examples/videos/catalyst-pathway.tsx +56 -0
  137. package/examples/videos/causal-attention.tsx +91 -0
  138. package/examples/videos/convolution-kernel.tsx +34 -0
  139. package/examples/videos/gaussian-blur.tsx +32 -0
  140. package/examples/videos/image-to-matrix.tsx +22 -0
  141. package/examples/videos/matrix-multiplication.tsx +128 -0
  142. package/examples/videos/photo-gaussian-blur.tsx +39 -0
  143. package/examples/videos/request-lifecycle.tsx +99 -0
  144. package/examples/videos/signal-to-story.tsx +126 -0
  145. package/examples/videos/wave-interference.tsx +80 -0
  146. package/examples/vizmatic-bare.d.ts +1 -0
  147. package/examples/vizmatic-hero.tsx +9 -18
  148. package/examples/website-workflow.tsx +7 -7
  149. package/examples/weekend-field-notes.tsx +3 -2
  150. package/package.json +77 -12
@@ -44,23 +44,20 @@ function buildFrame(theme: ThemeMode, active: number, opacity = 1) {
44
44
  subtitle={stage.subtitle}
45
45
  tone={stage.tone}
46
46
  width={stage.width}
47
- minHeight={104}
48
47
  align="center"
49
48
  justify="center"
50
49
  />,
51
50
  ...(index < visibleStages.length - 1
52
- ? [<FlowArrow key={`connector-${index}`} c={c} direction="right" length={20} tone="purple" />]
51
+ ? [<FlowArrow key={`connector-${index}`} c={c} direction="right" length={20} />]
53
52
  : []),
54
53
  ])}
55
54
  </Row>
56
55
  <Row width="100%" gap={16} align="stretch">
57
56
  <CalloutCard
58
57
  c={c}
59
- tone="purple"
60
58
  title={`Frame ${active + 1} of 4`}
61
59
  detail={`${stages[active].title} is active`}
62
60
  width={300}
63
- minHeight={118}
64
61
  />
65
62
  <CalloutCard
66
63
  c={c}
@@ -68,7 +65,6 @@ function buildFrame(theme: ThemeMode, active: number, opacity = 1) {
68
65
  title={active === stages.length - 1 ? 'Export complete' : `Rendering frame ${active + 1}`}
69
66
  detail="createAnimation(theme) defines typed state, timing, and reset."
70
67
  width={644}
71
- minHeight={118}
72
68
  />
73
69
  </Row>
74
70
  </Scene>
@@ -1,7 +1,7 @@
1
1
  width = 1040;
2
2
  height = 560;
3
3
 
4
- <Scene title="One attention head, one context vector" subtitle="QKᵀ scores keys, then softmax weights their value vectors" align="center">
4
+ <Scene title="One attention head, one context vector" subtitle="QKᵀ / √dₖ scores keys; softmax weights their value vectors" align="center">
5
5
  <GraphDiagram
6
6
  ariaLabel="Attention head computation from query scores through weighted value vectors to a context vector"
7
7
  width={900}
@@ -10,22 +10,22 @@ height = 560;
10
10
  nodeHeight={66}
11
11
  labelFontSize={16}
12
12
  nodes={[
13
- { id: 'query', label: 'q_model', detail: 'query vector', x: 0.07, y: 0.50, tone: 'blue' },
14
- { id: 'scores', label: 'QKᵀ', detail: 'score all keys', x: 0.30, y: 0.50, tone: 'purple' },
15
- { id: 'weights', label: 'softmax', detail: '[0.08, 0.74, 0.18]', x: 0.52, y: 0.50, tone: 'cyan' },
16
- { id: 'v-the', label: 'V_the', detail: 'α = 0.08', x: 0.72, y: 0.22, tone: 'blue', muted: true },
13
+ { id: 'query', label: 'q_model', detail: 'query vector', x: 0.07, y: 0.50 },
14
+ { id: 'scores', label: 'QKᵀ', detail: 'score all keys', x: 0.30, y: 0.50 },
15
+ { id: 'weights', label: 'softmax', detail: '[0.08, 0.74, 0.18]', x: 0.52, y: 0.50 },
16
+ { id: 'v-the', label: 'V_the', detail: 'α = 0.08', x: 0.72, y: 0.22, muted: true },
17
17
  { id: 'v-model', label: 'V_model', detail: 'α = 0.74', x: 0.72, y: 0.50, tone: 'green' },
18
- { id: 'v-routes', label: 'V_routes', detail: 'α = 0.18', x: 0.72, y: 0.78, tone: 'cyan', muted: true },
18
+ { id: 'v-routes', label: 'V_routes', detail: 'α = 0.18', x: 0.72, y: 0.78, muted: true },
19
19
  { id: 'context', label: 'context', detail: 'Σ αᵢVᵢ', x: 0.95, y: 0.50, tone: 'green', width: 138 },
20
20
  ]}
21
21
  edges={[
22
- { from: 'query', to: 'scores', tone: 'blue' },
23
- { from: 'scores', to: 'weights', tone: 'purple' },
24
- { from: 'weights', to: 'v-the', tone: 'blue', muted: true },
25
- { from: 'weights', to: 'v-model', tone: 'green' },
26
- { from: 'weights', to: 'v-routes', tone: 'cyan', muted: true },
22
+ { from: 'query', to: 'scores' },
23
+ { from: 'scores', to: 'weights' },
24
+ { from: 'weights', to: 'v-the', muted: true },
25
+ { from: 'weights', to: 'v-model' },
26
+ { from: 'weights', to: 'v-routes', muted: true },
27
27
  { from: 'v-the', to: 'context', muted: true },
28
- { from: 'v-model', to: 'context', tone: 'green' },
28
+ { from: 'v-model', to: 'context' },
29
29
  { from: 'v-routes', to: 'context', muted: true },
30
30
  ]}
31
31
  />
@@ -1,3 +1,4 @@
1
+ density = "compact";
1
2
  width = 1120;
2
3
  height = 800;
3
4
  background = "theme";
@@ -64,11 +65,11 @@ background = "theme";
64
65
  { id: 'orders', label: 'Orders store', detail: 'writes steady', x: 0.91, y: 0.50, tone: 'green', icon: 'database' },
65
66
  ]}
66
67
  edges={[
67
- { from: 'edge', to: 'queue', fromSide: 'right', toSide: 'left', tone: 'blue' },
68
+ { from: 'edge', to: 'queue', fromSide: 'right', toSide: 'left' },
68
69
  { from: 'queue', to: 'worker-a', fromSide: 'right', toSide: 'left', tone: 'critical', style: 'dashed' },
69
- { from: 'queue', to: 'worker-b', fromSide: 'right', toSide: 'left', tone: 'green' },
70
+ { from: 'queue', to: 'worker-b', fromSide: 'right', toSide: 'left' },
70
71
  { from: 'worker-a', to: 'orders', fromSide: 'right', toSide: 'left', tone: 'warm', style: 'dashed' },
71
- { from: 'worker-b', to: 'orders', fromSide: 'right', toSide: 'left', tone: 'green' },
72
+ { from: 'worker-b', to: 'orders', fromSide: 'right', toSide: 'left' },
72
73
  ]}
73
74
  />
74
75
  </Panel>
@@ -22,8 +22,8 @@ height = 650;
22
22
  title="Render workflow"
23
23
  width={330}
24
24
  events={[
25
- { time: 'draft', title: 'Choose primitives', detail: 'match components to content', tone: 'blue' },
26
- { time: 'render', title: 'Export both themes', detail: 'create dark and light files', tone: 'purple' },
25
+ { time: 'draft', title: 'Choose primitives', detail: 'match components to content' },
26
+ { time: 'render', title: 'Export both themes', detail: 'create dark and light files' },
27
27
  { time: 'review', title: 'Inspect output', detail: 'check layout and contrast', tone: 'green' },
28
28
  ]}
29
29
  />
@@ -35,11 +35,10 @@ height = 650;
35
35
  root={{
36
36
  label: 'Scene',
37
37
  detail: 'root',
38
- tone: 'purple',
39
38
  children: [
40
39
  { label: 'Metrics', detail: 'Donut', tone: 'green' },
41
- { label: 'Flow', detail: 'Timeline', tone: 'blue' },
42
- { label: 'Org', detail: 'Tree', tone: 'cyan' },
40
+ { label: 'Flow', detail: 'Timeline' },
41
+ { label: 'Org', detail: 'Tree' },
43
42
  ],
44
43
  }}
45
44
  />
@@ -54,18 +53,18 @@ height = 650;
54
53
  </Column>
55
54
  </Row>
56
55
  </CalloutCard>
57
- <CalloutCard tone="purple" filled={false} width={250} align="left">
56
+ <CalloutCard filled={false} width={250} align="left">
58
57
  <Row gap={10} justify="start" width="100%">
59
- <Icon name="layers" tone="purple" size={28} />
58
+ <Icon name="layers" size={28} />
60
59
  <Column gap={2} align="start">
61
60
  <TextLabel text="Show sequence" variant="small" color={c.textPrimary} />
62
61
  <TextLabel text="Timeline" variant="tiny" mono color={c.textMuted} />
63
62
  </Column>
64
63
  </Row>
65
64
  </CalloutCard>
66
- <CalloutCard tone="cyan" filled={false} width={250} align="left">
65
+ <CalloutCard filled={false} width={250} align="left">
67
66
  <Row gap={10} justify="start" width="100%">
68
- <Icon name="git" tone="cyan" size={28} />
67
+ <Icon name="git" size={28} />
69
68
  <Column gap={2} align="start">
70
69
  <TextLabel text="Explain structure" variant="small" color={c.textPrimary} />
71
70
  <TextLabel text="TreeDiagram" variant="tiny" mono color={c.textMuted} />
@@ -141,15 +141,15 @@ export function create(theme: ThemeMode = 'dark') {
141
141
  <LineChart
142
142
  c={c}
143
143
  title="LineChart"
144
- subtitle="multi-series trend"
144
+ subtitle="illustrative pass and failure rates by release"
145
145
  width={348}
146
146
  height={188}
147
147
  format="percent"
148
- yAxisLabel="score"
148
+ yAxisLabel="share of evaluations"
149
149
  labels={['r1', 'r2', 'r3', 'r4', 'r5']}
150
150
  series={[
151
- { name: 'quality', points: [0.62, 0.69, 0.76, 0.83, 0.91], color: 'positive', area: true },
152
- { name: 'latency', points: [0.84, 0.76, 0.70, 0.65, 0.61], color: 'primary' },
151
+ { name: 'pass rate', points: [0.62, 0.69, 0.76, 0.83, 0.91], color: 'positive', area: true },
152
+ { name: 'failure rate', points: [0.38, 0.31, 0.24, 0.17, 0.09], color: 'primary' },
153
153
  ]}
154
154
  />
155
155
 
@@ -46,7 +46,7 @@ export function create(theme: ThemeMode = 'dark') {
46
46
  gap={12}
47
47
  >
48
48
  <Row width="100%" gap={12} align="stretch">
49
- <Panel c={c} title="Inline language" subtitle="ToneStrip · Icon · TextLabel · MathText · SvgMathText" tone="purple" width={540} minHeight={148}>
49
+ <Panel c={c} title="Inline language" subtitle="ToneStrip · Icon · TextLabel · MathText · SvgMathText" tone="purple" width={540}>
50
50
  <Row gap={12} wrap align="center" justify="start">
51
51
  <Row gap={7}>
52
52
  <ToneStrip tone="purple" width={42} height={6} />
@@ -66,13 +66,13 @@ export function create(theme: ThemeMode = 'dark') {
66
66
  </div>
67
67
  </Row>
68
68
  </Panel>
69
- <Panel c={c} title="Tokens and values" subtitle="Badge · BadgePill · GradientChip · ValuePill" tone="cyan" width={524} minHeight={148}>
69
+ <Panel c={c} title="Tokens and values" subtitle="Badge · BadgePill · GradientChip · ValuePill" tone="cyan" width={524}>
70
70
  <Row gap={10} align="center" justify="start">
71
71
  <Column gap={8} align="start">
72
72
  <Badge c={c} label="Badge" color="secondary" />
73
73
  <BadgePill c={c} text="BadgePill" tone="cyan" fontSize={11} />
74
74
  </Column>
75
- <GradientChip c={c} title="GradientChip" subtitle="high-signal label" tone="cyan" width={174} minHeight={74} />
75
+ <GradientChip c={c} title="GradientChip" subtitle="high-signal label" tone="cyan" width={174} />
76
76
  <ValuePill c={c} label="ValuePill" value="42 ms" detail="p95 render" tone="green" width={132} />
77
77
  </Row>
78
78
  </Panel>
@@ -80,12 +80,12 @@ export function create(theme: ThemeMode = 'dark') {
80
80
 
81
81
  <Row width="100%" gap={12} align="stretch">
82
82
  <EquationCard c={c} title="EquationCard" formula="rate = work / time" result="8.4" detail="units / second" tone="purple" width={212} math />
83
- <StepCard c={c} eyebrow="01" title="StepCard" subtitle="named stage" tone="blue" width={194} minHeight={132} />
84
- <MetricCard c={c} label="MetricCard" value="98.7%" detail="healthy output" tone="green" width={178} minHeight={132} />
85
- <CalloutCard c={c} title="CalloutCard" detail="Emphasize one decision, caveat, or result without interrupting narrative flow." tone="ocean" width={462} minHeight={132} align="left" />
83
+ <StepCard c={c} eyebrow="01" title="StepCard" subtitle="named stage" tone="blue" width={194} />
84
+ <MetricCard c={c} label="MetricCard" value="98.7%" detail="healthy output" tone="green" width={178} />
85
+ <CalloutCard c={c} title="CalloutCard" detail="Emphasize one decision, caveat, or result without interrupting narrative flow." tone="ocean" width={462} align="left" />
86
86
  </Row>
87
87
 
88
- <Panel c={c} title="Structured content" subtitle="DetailList · CodeBlock · Comparison · KeyValueList · TileGrid · Tile" tone="warm" width="100%" minHeight={286}>
88
+ <Panel c={c} title="Structured content" subtitle="DetailList · CodeBlock · Comparison · KeyValueList · TileGrid · Tile" tone="warm" width="100%">
89
89
  <Row width="100%" gap={12} align="stretch" justify="center">
90
90
  <Column gap={8} align="stretch" width={170}>
91
91
  <TextLabel c={c} text="DetailList" fontSize={11} mono color={c.textMuted} />
@@ -109,7 +109,6 @@ export function create(theme: ThemeMode = 'dark') {
109
109
  divider
110
110
  gap={7}
111
111
  sideWidth={103}
112
- minHeight={138}
113
112
  sides={[
114
113
  { title: 'dense', tone: 'critical', lines: ['one signal', 'short label'] },
115
114
  { title: 'clear', tone: 'green', lines: ['grouped', 'scan-ready'] },
@@ -136,7 +135,6 @@ export function create(theme: ThemeMode = 'dark') {
136
135
  columns={2}
137
136
  gap={8}
138
137
  tileWidth={108}
139
- minHeight={68}
140
138
  tiles={[
141
139
  { title: 'Tile', subtitle: 'primitive', tone: 'blue' },
142
140
  { title: 'Grid', subtitle: 'layout', tone: 'purple' },
@@ -0,0 +1,116 @@
1
+ import {
2
+ crossCorrelate2d, getThemeColors, Matrix, PixelGrid,
3
+ type RgbPixel, type ThemeMode,
4
+ } from 'vizmatic'
5
+
6
+ export const width = 1280
7
+ export const height = 720
8
+
9
+ // A synthetic 6×6 grayscale image and a hand-set, illustrative edge detector.
10
+ // A trained CNN learns its weights. Here one channel, one filter and bias 0
11
+ // isolate the spatial operation: unflipped cross-correlation, as in Conv2d.
12
+ export const kernelInput = [
13
+ [0, 0, 0, 0, 0, 0],
14
+ [0, 0, 1, 1, 0, 0],
15
+ [0, 0, 1, 1, 0, 0],
16
+ [0, 0, 1, 1, 0, 0],
17
+ [0, 0, 1, 1, 0, 0],
18
+ [0, 0, 0, 0, 0, 0],
19
+ ]
20
+ export const edgeKernel = [[-1, 0, 1], [-1, 0, 1], [-1, 0, 1]]
21
+ export const kernelResponse = crossCorrelate2d(kernelInput, edgeKernel)
22
+ export const kernelActivation = kernelResponse.map(row => row.map(value => Math.max(0, value)))
23
+ const inputPixels: RgbPixel[][] = kernelInput.map(row => row.map(value => [value * 255, value * 255, value * 255]))
24
+ const labels = (values: number[][]) => values.map(row => row.map(String))
25
+
26
+ export interface KernelLessonState {
27
+ cell: number
28
+ term: number
29
+ filled: number
30
+ windowRow: number
31
+ windowCol: number
32
+ moving: number
33
+ reveal: number
34
+ }
35
+
36
+ export function convolutionFrame(theme: ThemeMode, state: Readonly<KernelLessonState>) {
37
+ const c = getThemeColors(theme)
38
+ const accent = theme === 'dark' ? c.warningLight : c.warningDark
39
+ const positive = theme === 'dark' ? c.positiveLight : c.positiveDark
40
+ const negative = theme === 'dark' ? c.criticalLight : c.criticalDark
41
+ const row = Math.floor(state.cell / 4), col = state.cell % 4
42
+ const tap = Math.min(8, Math.max(0, Math.round(state.term)))
43
+ const kr = Math.floor(tap / 3), kc = tap % 3
44
+ const response = kernelResponse[row][col]
45
+ const rowProducts = edgeKernel.map((weights, r) => weights.map((weight, k) => kernelInput[row + r][col + k] * weight))
46
+ const rowSums = rowProducts.map(values => values.reduce((sum, value) => sum + value, 0))
47
+ const knownLabels = (values: number[][]) => values.map((valuesRow, r) => valuesRow.map((value, k) => r * 4 + k < state.filled ? String(value) : '·'))
48
+ const isComputing = state.moving < .01
49
+ const gridX = 46, gridY = 232, pitch = 46
50
+ const reveal = state.reveal
51
+ return (
52
+ <div style={{ display: 'flex', position: 'relative', width, height, overflow: 'hidden', backgroundColor: c.bg, color: c.textPrimary, fontFamily: c.fontSans }}>
53
+ <div style={{ display: 'flex', position: 'absolute', left: 46, top: 32, flexDirection: 'column', gap: 7 }}>
54
+ <span style={{ color: c.textSecondary, fontFamily: c.fontMono, fontSize: 13, letterSpacing: 2 }}>DEEP LEARNING / A CONVOLUTION YOU CAN CALCULATE</span>
55
+ <span style={{ fontSize: 41, fontWeight: 750, letterSpacing: -1 }}>One small filter. An entire feature map.</span>
56
+ <span style={{ fontSize: 18, color: c.textSecondary }}>Slide the same weights across the image. Multiply, add, then apply ReLU.</span>
57
+ </div>
58
+ <div style={{ display: 'flex', position: 'absolute', left: gridX, top: 168, flexDirection: 'column', gap: 6 }}>
59
+ <span style={{ fontSize: 23, fontWeight: 700 }}>Input image <span style={{ color: c.textSecondary, fontSize: 16 }}>6 × 6</span></span>
60
+ <span style={{ fontSize: 15, color: c.textSecondary }}>Synthetic pixels · black 0 / white 1</span>
61
+ </div>
62
+ <div style={{ display: 'flex', position: 'absolute', left: gridX, top: gridY, opacity: 1 - reveal }}><PixelGrid c={c} pixels={inputPixels} width={274} height={274} /></div>
63
+ <div style={{ display: 'flex', position: 'absolute', left: gridX, top: gridY, opacity: reveal }}>
64
+ <Matrix c={c} data={kernelInput} labels={labels(kernelInput)} cellSize={44} fontSize={20} colorize={false} {...(isComputing ? { highlightCell: { row: row + kr, col: col + kc } } : {})} highlightColor={accent} />
65
+ </div>
66
+ <div style={{ display: 'flex', position: 'absolute', left: gridX + state.windowCol * pitch - 3, top: gridY + state.windowRow * pitch - 3, width: 142, height: 142, border: `3px solid ${accent}`, borderRadius: 9, boxSizing: 'border-box', opacity: reveal }} />
67
+ <div style={{ display: 'flex', position: 'absolute', left: 345, top: 316, color: c.textSecondary, fontSize: 34, opacity: reveal }}>×</div>
68
+ <div style={{ display: 'flex', position: 'absolute', left: 390, top: 168, width: 208, flexDirection: 'column', gap: 6, opacity: reveal }}>
69
+ <span style={{ fontSize: 23, fontWeight: 700 }}>Kernel <span style={{ color: c.textSecondary, fontSize: 16 }}>3 × 3</span></span>
70
+ <span style={{ fontSize: 15, color: c.textSecondary }}>Hand-set vertical-edge filter</span>
71
+ </div>
72
+ <div style={{ display: 'flex', position: 'absolute', left: 402, top: 270, opacity: reveal }}>
73
+ <Matrix c={c} data={edgeKernel} labels={labels(edgeKernel)} cellSize={52} fontSize={22} colorize={false} {...(isComputing ? { highlightCell: { row: kr, col: kc } } : {})} highlightColor={accent} />
74
+ </div>
75
+ <div style={{ display: 'flex', position: 'absolute', left: 390, top: 458, width: 220, flexDirection: 'column', gap: 8, opacity: reveal }}>
76
+ <span style={{ color: c.textSecondary, fontSize: 15 }}>Stride 1 · no padding · bias 0</span>
77
+ <span style={{ color: c.textSecondary, fontSize: 15 }}>6 − 3 + 1 = 4 per axis</span>
78
+ </div>
79
+ <span style={{ display: 'flex', position: 'absolute', left: 618, top: 316, color: c.textSecondary, fontSize: 31, opacity: reveal }}>=</span>
80
+ <div style={{ display: 'flex', position: 'absolute', left: 664, top: 168, flexDirection: 'column', gap: 6, opacity: reveal }}>
81
+ <span style={{ fontSize: 23, fontWeight: 700 }}>Response <span style={{ color: c.textSecondary, fontSize: 16 }}>4 × 4</span></span>
82
+ <span style={{ fontSize: 15, color: c.textSecondary }}>Keep the sign of every sum</span>
83
+ </div>
84
+ <div style={{ display: 'flex', position: 'absolute', left: 664, top: 250, opacity: reveal }}>
85
+ <Matrix c={c} data={kernelResponse} labels={knownLabels(kernelResponse)} cellSize={51} fontSize={22} colorize={false} highlightCell={{ row, col }} highlightColor={response < 0 ? negative : positive} />
86
+ </div>
87
+ <span style={{ display: 'flex', position: 'absolute', left: 664, top: 478, color: c.textSecondary, fontSize: 15, opacity: reveal }}>Left edge: + · right edge: −</span>
88
+ <div style={{ display: 'flex', position: 'absolute', left: 896, top: 302, flexDirection: 'column', alignItems: 'center', gap: 3, opacity: reveal }}>
89
+ <span style={{ color: c.textPrimary, fontSize: 16, fontWeight: 700 }}>ReLU</span>
90
+ <span style={{ color: c.textSecondary, fontSize: 30 }}>→</span>
91
+ </div>
92
+ <div style={{ display: 'flex', position: 'absolute', left: 986, top: 168, flexDirection: 'column', gap: 6, opacity: reveal }}>
93
+ <span style={{ fontSize: 23, fontWeight: 700 }}>Activation <span style={{ color: c.textSecondary, fontSize: 16 }}>4 × 4</span></span>
94
+ <span style={{ fontSize: 15, color: c.textSecondary }}>max(0, response)</span>
95
+ </div>
96
+ <div style={{ display: 'flex', position: 'absolute', left: 986, top: 250, opacity: reveal }}>
97
+ <Matrix c={c} data={kernelActivation} labels={knownLabels(kernelActivation)} cellSize={51} fontSize={22} colorize={false} highlightCell={{ row, col }} highlightColor={positive} />
98
+ </div>
99
+ <span style={{ display: 'flex', position: 'absolute', left: 986, top: 478, color: c.textSecondary, fontSize: 15, opacity: reveal }}>Negative responses become zero.</span>
100
+ <div style={{ display: 'flex', position: 'absolute', left: 46, top: 538, width: 1188, height: 132, borderRadius: 14, border: `1px solid ${c.borderSubtle}`, backgroundColor: c.bgCard, opacity: reveal }}>
101
+ <div style={{ display: 'flex', position: 'absolute', left: 22, top: 16, color: accent, fontFamily: c.fontMono, fontSize: 13, letterSpacing: 1.2 }}>{isComputing ? `OUTPUT [${row}, ${col}] · NINE PIXEL × WEIGHT PRODUCTS` : 'SLIDE THE SAME KERNEL TO THE NEXT PATCH'}</div>
102
+ <div style={{ display: 'flex', position: 'absolute', left: 22, top: 48, gap: 14, fontFamily: c.fontMono, fontSize: 19, alignItems: 'center' }}>
103
+ {rowProducts.map((_, r) => <span key={r} style={{ display: 'flex', padding: '7px 9px', borderRadius: 6, border: `1px solid ${r === kr && isComputing ? accent : c.borderSubtle}`, color: c.textPrimary }}>{kernelInput[row + r][col]}×(−1) + {kernelInput[row + r][col + 1]}×0 + {kernelInput[row + r][col + 2]}×1 = {rowSums[r]}</span>)}
104
+ <span style={{ color: response < 0 ? negative : positive, fontSize: 27, fontWeight: 700 }}>Σ = {response}</span>
105
+ </div>
106
+ <span style={{ display: 'flex', position: 'absolute', left: 22, top: 101, color: c.textSecondary, fontSize: 14 }}>Current tap: {kernelInput[row + kr][col + kc]} × ({edgeKernel[kr][kc]}) = {rowProducts[kr][kc]} · ReLU({response}) = {Math.max(0, response)}</span>
107
+ </div>
108
+ <span style={{ display: 'flex', position: 'absolute', left: 46, top: 690, color: c.textSecondary, fontSize: 12 }}>One input channel / one filter. Real CNNs learn weights, sum over input channels, and may add a bias. Conv2d uses cross-correlation: weights are not flipped.</span>
109
+ </div>
110
+ )
111
+ }
112
+
113
+ export function create(theme: ThemeMode = 'dark') {
114
+ return convolutionFrame(theme, { cell: 6, term: 0, filled: 16, windowRow: 1, windowCol: 2, moving: 0, reveal: 1 })
115
+ }
116
+ export default create('dark')
@@ -34,7 +34,6 @@ export function create(theme: ThemeMode = 'dark') {
34
34
  subtitle="numeric values with optional headers"
35
35
  tone="blue"
36
36
  width={338}
37
- minHeight={210}
38
37
  align="center"
39
38
  >
40
39
  <Matrix
@@ -59,7 +58,6 @@ export function create(theme: ThemeMode = 'dark') {
59
58
  subtitle="scaled intensity with named axes"
60
59
  tone="purple"
61
60
  width={338}
62
- minHeight={210}
63
61
  align="center"
64
62
  >
65
63
  <Heatmap
@@ -85,13 +83,12 @@ export function create(theme: ThemeMode = 'dark') {
85
83
  subtitle="symbolic regions and block structure"
86
84
  tone="cyan"
87
85
  width={340}
88
- minHeight={210}
89
86
  align="center"
90
87
  >
91
88
  <TiledMatrix
92
89
  c={c}
93
- title="TiledMatrix"
94
- subtitle="causal attention mask"
90
+ title="Block-sparse tile pattern"
91
+ subtitle="highlighted rectangular regions; no causal mask"
95
92
  rows={6}
96
93
  cols={7}
97
94
  cellSize={20}
@@ -112,7 +109,6 @@ export function create(theme: ThemeMode = 'dark') {
112
109
  subtitle="structured rows with header bands"
113
110
  tone="warm"
114
111
  width={340}
115
- minHeight={220}
116
112
  align="center"
117
113
  >
118
114
  <DataTable
@@ -135,7 +131,6 @@ export function create(theme: ThemeMode = 'dark') {
135
131
  subtitle="general labeled cells and tones"
136
132
  tone="green"
137
133
  width={280}
138
- minHeight={220}
139
134
  align="center"
140
135
  >
141
136
  <Grid
@@ -158,7 +153,6 @@ export function create(theme: ThemeMode = 'dark') {
158
153
  subtitle="dense distribution for cards and dashboards"
159
154
  tone="ocean"
160
155
  width={396}
161
- minHeight={220}
162
156
  align="center"
163
157
  >
164
158
  <MiniBarChart
@@ -25,9 +25,7 @@ export function create(theme: ThemeMode = 'dark') {
25
25
  c={c}
26
26
  title="Feature pipeline"
27
27
  subtitle="schema metadata stays attached to nodes and edges while stream and batch paths remain distinct"
28
- tone="purple"
29
28
  width="100%"
30
- minHeight={690}
31
29
  padding={14}
32
30
  align="center"
33
31
  footer="Dashed edges are stream delivery; solid edges are batch delivery. Invalid records stay observable in quarantine."
@@ -54,13 +52,13 @@ export function create(theme: ThemeMode = 'dark') {
54
52
  label: 'Event ingest',
55
53
  detail: 'SDK + webhook',
56
54
  kind: 'source',
57
- tone: 'blue',
58
55
  icon: 'stream',
59
56
  schema: {
60
57
  name: 'Event.v1',
61
58
  fields: [
62
59
  { name: 'id', type: 'uuid', required: true },
63
60
  { name: 'ts', type: 'int64', required: true },
61
+ { name: 'user', type: 'string', required: true },
64
62
  ],
65
63
  },
66
64
  },
@@ -69,7 +67,6 @@ export function create(theme: ThemeMode = 'dark') {
69
67
  label: 'Validate + dedupe',
70
68
  detail: 'contract gate',
71
69
  kind: 'transform',
72
- tone: 'purple',
73
70
  icon: 'check',
74
71
  schema: 'Valid.v1 { id, ts, user }',
75
72
  },
@@ -78,7 +75,6 @@ export function create(theme: ThemeMode = 'dark') {
78
75
  label: 'Build features',
79
76
  detail: 'window + join',
80
77
  kind: 'transform',
81
- tone: 'cyan',
82
78
  icon: 'tool',
83
79
  schema: 'FeatureRow { id, x₁…xₙ }',
84
80
  },
@@ -111,10 +107,10 @@ export function create(theme: ThemeMode = 'dark') {
111
107
  },
112
108
  ]}
113
109
  edges={[
114
- { from: 'ingest', to: 'validate', mode: 'stream', label: 'stream · Event.v1', tone: 'blue' },
115
- { from: 'validate', to: 'features', mode: 'stream', label: 'stream · Valid.v1', tone: 'purple' },
116
- { from: 'features', to: 'serving', mode: 'stream', label: 'stream · vector', tone: 'cyan' },
117
- { from: 'features', to: 'warehouse', mode: 'batch', label: 'batch · FeatureRow', tone: 'green' },
110
+ { from: 'ingest', to: 'validate', mode: 'stream', label: 'stream · Event.v1' },
111
+ { from: 'validate', to: 'features', mode: 'stream', label: 'stream · Valid.v1' },
112
+ { from: 'features', to: 'serving', mode: 'stream', label: 'stream · vector' },
113
+ { from: 'features', to: 'warehouse', mode: 'batch', label: 'batch · FeatureRow' },
118
114
  { from: 'validate', to: 'quarantine', mode: 'stream', label: 'stream · rejects', tone: 'warm' },
119
115
  ]}
120
116
  />
@@ -0,0 +1,80 @@
1
+ import {
2
+ Column,
3
+ DiagramLegend,
4
+ FactRows,
5
+ InlineBar,
6
+ MetricStrip,
7
+ Panel,
8
+ Row,
9
+ Scene,
10
+ SmallMultiples,
11
+ Sparkline,
12
+ StatusDot,
13
+ TagList,
14
+ getThemeColors,
15
+ type ThemeMode,
16
+ } from 'vizmatic'
17
+
18
+ export const width = 1120
19
+ export const height = 520
20
+
21
+ export function create(theme: ThemeMode = 'dark') {
22
+ const c = getThemeColors(theme)
23
+
24
+ return (
25
+ <Scene
26
+ c={c}
27
+ title="Dense information catalog"
28
+ subtitle="Word-sized charts, fact rows, and keys for packing real data into nodes and dashboards."
29
+ background={c.bg}
30
+ gap={10}
31
+ >
32
+ <Row gap={10} align="stretch" justify="start" width="100%">
33
+ <Panel c={c} title="MetricStrip" subtitle="Numbers with units, no card around each" width={420}>
34
+ <MetricStrip c={c} metrics={[
35
+ { label: 'p50', value: '42', unit: 'ms' },
36
+ { label: 'p99', value: '310', unit: 'ms', tone: 'warm', bar: 0.78 },
37
+ { label: 'error rate', value: '0.04', unit: '%', spark: [3, 2, 4, 2, 1, 1] },
38
+ ]} />
39
+ </Panel>
40
+ <Panel c={c} title="FactRows" subtitle="Key and value, with capacity bars" width={300}>
41
+ <FactRows c={c} rows={[
42
+ { key: 'region', value: 'us-east-1' },
43
+ { key: 'replicas', value: '12 / 12' },
44
+ { key: 'disk', value: '91%', bar: 0.91, tone: 'warm' },
45
+ ]} />
46
+ </Panel>
47
+ <Panel c={c} title="Marks" subtitle="Sparkline, InlineBar, StatusDot, TagList" width={344}>
48
+ <Column gap={6} align="start" width="100%">
49
+ <Row gap={8} justify="start">
50
+ <Sparkline c={c} values={[12, 14, 13, 17, 16, 21, 24, 22, 26]} width={150} height={22} area tone="blue" />
51
+ <StatusDot c={c} status="ok" />
52
+ <StatusDot c={c} status="warn" />
53
+ <StatusDot c={c} status="error" />
54
+ <StatusDot c={c} status="idle" />
55
+ </Row>
56
+ <InlineBar c={c} value={0.71} tone="blue" />
57
+ <TagList c={c} tags={['rust', 'us-east-1', 'tier 0']} />
58
+ </Column>
59
+ </Panel>
60
+ </Row>
61
+ <Panel c={c} title="SmallMultiples" subtitle="One chart repeated, on one shared scale, with an SLO reference">
62
+ <SmallMultiples c={c} columns={5} cellWidth={196} cellHeight={40} sharedScale items={[
63
+ { label: 'gateway', value: '41', unit: 'ms', status: 'ok', values: [38, 42, 40, 44, 41, 39, 41], reference: 120 },
64
+ { label: 'search', value: '184', unit: 'ms', status: 'warn', tone: 'warm', values: [120, 134, 150, 148, 162, 171, 184], reference: 120 },
65
+ { label: 'checkout', value: '212', unit: 'ms', status: 'warn', tone: 'warm', values: [160, 172, 180, 190, 188, 204, 212], reference: 120 },
66
+ { label: 'ledger', value: '12', unit: 'ms', status: 'ok', values: [14, 12, 13, 12, 11, 13, 12], reference: 120 },
67
+ { label: 'features', value: '4', unit: 'ms', status: 'ok', values: [5, 4, 4, 5, 4, 4, 4], reference: 120 },
68
+ ]} />
69
+ </Panel>
70
+ <DiagramLegend c={c} title="Key" items={[
71
+ { label: 'synchronous', style: 'solid' },
72
+ { label: 'asynchronous', style: 'dashed' },
73
+ { label: 'event', style: 'dotted' },
74
+ { label: 'over SLO', style: 'dot', tone: 'warm' },
75
+ ]} />
76
+ </Scene>
77
+ )
78
+ }
79
+
80
+ export default create('dark')
@@ -25,12 +25,10 @@ export function create(theme: ThemeMode = 'dark') {
25
25
  c={c}
26
26
  title="Regional inference plane"
27
27
  subtitle="network edges carry protocol and port intent; dotted links cross a declared trust or subnet boundary"
28
- tone="cyan"
29
28
  width="100%"
30
- minHeight={560}
31
29
  padding={14}
32
30
  align="center"
33
- footer="Ingress enters at HTTPS/443; service-to-service traffic uses mTLS or gRPC; workload identity remains inside its trust boundary."
31
+ footer="Ingress: HTTPS/443 · gateway → API: mTLS/8080 · API → model: gRPC/50051 · model → cache/warehouse: TCP/6379 and TCP/5432."
34
32
  >
35
33
  <DeploymentDiagram
36
34
  c={c}
@@ -49,10 +47,10 @@ export function create(theme: ThemeMode = 'dark') {
49
47
  iconSize={18}
50
48
  ariaLabel="Regional inference deployment with internet ingress, nested VPC and subnet boundaries, inference namespace, identity trust boundary, and protocol-specific service connections"
51
49
  boundaries={[
52
- { id: 'region', label: 'us-east-1', detail: 'REGION', kind: 'region', tone: 'blue' },
53
- { id: 'vpc', label: 'prod-vpc', detail: '10.20.0.0/16', kind: 'vpc', parent: 'region', tone: 'purple' },
54
- { id: 'public', label: 'public subnet', detail: '10.20.1.0/24', kind: 'subnet', parent: 'vpc', tone: 'cyan' },
55
- { id: 'private', label: 'private subnet', detail: '10.20.2.0/24', kind: 'subnet', parent: 'vpc', tone: 'purple' },
50
+ { id: 'region', label: 'us-east-1', detail: 'REGION', kind: 'region' },
51
+ { id: 'vpc', label: 'prod-vpc', detail: '10.20.0.0/16', kind: 'vpc', parent: 'region' },
52
+ { id: 'public', label: 'public subnet', detail: '10.20.1.0/24', kind: 'subnet', parent: 'vpc' },
53
+ { id: 'private', label: 'private subnet', detail: '10.20.2.0/24', kind: 'subnet', parent: 'vpc' },
56
54
  { id: 'inference', label: 'inference', detail: 'NAMESPACE', kind: 'namespace', parent: 'private', tone: 'green' },
57
55
  { id: 'identity', label: 'workload identity', detail: 'TRUST · mTLS', kind: 'trust', parent: 'vpc', tone: 'warm' },
58
56
  ]}
@@ -62,7 +60,6 @@ export function create(theme: ThemeMode = 'dark') {
62
60
  label: 'Internet',
63
61
  detail: 'external clients',
64
62
  kind: 'internet',
65
- tone: 'neutral',
66
63
  icon: 'globe',
67
64
  ports: [{ id: 'https', port: 443, protocol: 'HTTPS', direction: 'egress' }],
68
65
  },
@@ -72,7 +69,6 @@ export function create(theme: ThemeMode = 'dark') {
72
69
  detail: 'public ingress',
73
70
  kind: 'gateway',
74
71
  boundary: 'public',
75
- tone: 'cyan',
76
72
  ports: [
77
73
  { id: 'https', port: 443, protocol: 'HTTPS', direction: 'ingress' },
78
74
  { id: 'mesh', port: 15008, protocol: 'mTLS', direction: 'egress' },
@@ -84,7 +80,6 @@ export function create(theme: ThemeMode = 'dark') {
84
80
  detail: 'namespace service',
85
81
  kind: 'service',
86
82
  boundary: 'inference',
87
- tone: 'purple',
88
83
  ports: [
89
84
  { id: 'http', port: 8080, protocol: 'HTTP', direction: 'ingress' },
90
85
  { id: 'grpc', port: 50051, protocol: 'gRPC', direction: 'egress' },
@@ -108,7 +103,6 @@ export function create(theme: ThemeMode = 'dark') {
108
103
  detail: 'private state',
109
104
  kind: 'cache',
110
105
  boundary: 'private',
111
- tone: 'blue',
112
106
  ports: [{ id: 'redis', port: 6379, protocol: 'TCP', direction: 'bidirectional' }],
113
107
  },
114
108
  {