@dversum/mcp-server 2.9.0 → 2.11.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 (51) hide show
  1. package/dist/src/client.d.ts +11 -0
  2. package/dist/src/client.d.ts.map +1 -1
  3. package/dist/src/client.js +51 -0
  4. package/dist/src/client.js.map +1 -1
  5. package/dist/src/index.d.ts.map +1 -1
  6. package/dist/src/index.js +19 -7
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/tools/whiteboard-compose.d.ts +4 -0
  9. package/dist/src/tools/whiteboard-compose.d.ts.map +1 -0
  10. package/dist/src/tools/whiteboard-compose.js +359 -0
  11. package/dist/src/tools/whiteboard-compose.js.map +1 -0
  12. package/dist/src/tools/whiteboards.d.ts.map +1 -1
  13. package/dist/src/tools/whiteboards.js +150 -7
  14. package/dist/src/tools/whiteboards.js.map +1 -1
  15. package/dist/src/whiteboard/elements.d.ts +171 -0
  16. package/dist/src/whiteboard/elements.d.ts.map +1 -0
  17. package/dist/src/whiteboard/elements.js +121 -0
  18. package/dist/src/whiteboard/elements.js.map +1 -0
  19. package/dist/src/whiteboard/link.d.ts +22 -0
  20. package/dist/src/whiteboard/link.d.ts.map +1 -0
  21. package/dist/src/whiteboard/link.js +56 -0
  22. package/dist/src/whiteboard/link.js.map +1 -0
  23. package/dist/src/whiteboard/measure.d.ts +26 -0
  24. package/dist/src/whiteboard/measure.d.ts.map +1 -0
  25. package/dist/src/whiteboard/measure.js +64 -0
  26. package/dist/src/whiteboard/measure.js.map +1 -0
  27. package/dist/src/whiteboard/sections.d.ts +329 -0
  28. package/dist/src/whiteboard/sections.d.ts.map +1 -0
  29. package/dist/src/whiteboard/sections.js +757 -0
  30. package/dist/src/whiteboard/sections.js.map +1 -0
  31. package/dist/src/whiteboard/sections.spec.d.ts +2 -0
  32. package/dist/src/whiteboard/sections.spec.d.ts.map +1 -0
  33. package/dist/src/whiteboard/sections.spec.js +518 -0
  34. package/dist/src/whiteboard/sections.spec.js.map +1 -0
  35. package/dist/src/whiteboard/stock.d.ts +39 -0
  36. package/dist/src/whiteboard/stock.d.ts.map +1 -0
  37. package/dist/src/whiteboard/stock.js +91 -0
  38. package/dist/src/whiteboard/stock.js.map +1 -0
  39. package/dist/src/whiteboard/stock.spec.d.ts +2 -0
  40. package/dist/src/whiteboard/stock.spec.d.ts.map +1 -0
  41. package/dist/src/whiteboard/stock.spec.js +69 -0
  42. package/dist/src/whiteboard/stock.spec.js.map +1 -0
  43. package/dist/src/whiteboard/styles.d.ts +65 -0
  44. package/dist/src/whiteboard/styles.d.ts.map +1 -0
  45. package/dist/src/whiteboard/styles.js +63 -0
  46. package/dist/src/whiteboard/styles.js.map +1 -0
  47. package/dist/src/whiteboard/tokens.d.ts +114 -0
  48. package/dist/src/whiteboard/tokens.d.ts.map +1 -0
  49. package/dist/src/whiteboard/tokens.js +105 -0
  50. package/dist/src/whiteboard/tokens.js.map +1 -0
  51. package/package.json +5 -3
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Links on whiteboard elements.
3
+ *
4
+ * A public board can be edited by anonymous viewers, so an element's link
5
+ * is untrusted input that ends up in an href. That makes `javascript:` and
6
+ * `data:` URLs a real path to running someone else's script in a viewer's
7
+ * session, and it is why this allows a short list of schemes rather than
8
+ * blocking a longer list of bad ones: a blocklist is one obscure scheme
9
+ * away from being wrong.
10
+ */
11
+ const ALLOWED_PROTOCOLS = ['http:', 'https:', 'mailto:'];
12
+ /** Long enough for any real link, short enough to not be a payload. */
13
+ export const MAX_LINK_LENGTH = 2048;
14
+ /**
15
+ * The href to render, or null when the value cannot be trusted.
16
+ *
17
+ * Returns null rather than throwing, so a bad link on one element renders
18
+ * as plain content instead of breaking the board around it.
19
+ */
20
+ export function safeLinkHref(raw) {
21
+ if (typeof raw !== 'string')
22
+ return null;
23
+ const value = raw.trim();
24
+ if (!value || value.length > MAX_LINK_LENGTH)
25
+ return null;
26
+ const parsed = parseUrl(value);
27
+ if (!parsed)
28
+ return null;
29
+ if (!ALLOWED_PROTOCOLS.includes(parsed.protocol))
30
+ return null;
31
+ return parsed.href;
32
+ }
33
+ /** True when a link is present and usable. */
34
+ export function hasLink(raw) {
35
+ return safeLinkHref(raw) !== null;
36
+ }
37
+ function parseUrl(value) {
38
+ try {
39
+ return new URL(value);
40
+ }
41
+ catch {
42
+ // People type "dversum.com", not "https://dversum.com". Assume https
43
+ // rather than dropping the link, but only for something that actually
44
+ // looks like a host, so "javascript:alert(1)" cannot sneak back in
45
+ // by failing the first parse.
46
+ if (!/^[\w-]+(\.[\w-]+)+([/?#].*)?$/.test(value))
47
+ return null;
48
+ try {
49
+ return new URL(`https://${value}`);
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ }
55
+ }
56
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.js","sourceRoot":"","sources":["../../../src/whiteboard/link.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;AAExD,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAA;AAEnC;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IACxC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,CAAA;IACxB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,eAAe;QAAE,OAAO,IAAI,CAAA;IAEzD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC9B,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IACxB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAA;IAC7D,OAAO,MAAM,CAAC,IAAI,CAAA;AACpB,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,OAAO,CAAC,GAAY;IAClC,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;AACnC,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,qEAAqE;QACrE,sEAAsE;QACtE,mEAAmE;QACnE,8BAA8B;QAC9B,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QAC7D,IAAI,CAAC;YACH,OAAO,IAAI,GAAG,CAAC,WAAW,KAAK,EAAE,CAAC,CAAA;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Text measurement for layout.
3
+ *
4
+ * Sections must report an exact height or stacked sections overlap. There
5
+ * is no canvas or DOM here, so widths come from a per-character average.
6
+ * That is an estimate, but it is a consistent one, and it is applied the
7
+ * same way to every section, so the rhythm of the page stays regular even
8
+ * where a line is a few pixels off.
9
+ *
10
+ * Ratios are measured against the UI sans stack at weight 400 and 700.
11
+ * Serif and mono run wider; hand runs narrower.
12
+ */
13
+ import { type TypeRole } from './tokens.js';
14
+ import type { FontId } from './elements.js';
15
+ export declare function charWidth(fontSize: number, weight?: 'normal' | 'bold', family?: FontId): number;
16
+ /** Width of a single unwrapped run, for sizing a button or a pill. */
17
+ export declare function textWidth(content: string, fontSize: number, weight?: 'normal' | 'bold', family?: FontId): number;
18
+ /**
19
+ * Greedy word wrap. A word longer than the line is left to overflow rather
20
+ * than broken, because a hyphenless mid-word break looks worse than a
21
+ * slightly long line and only ever happens to URLs.
22
+ */
23
+ export declare function wrapLines(content: string, width: number, fontSize: number, weight?: 'normal' | 'bold', family?: FontId): string[];
24
+ /** Rendered height of wrapped text at a given role. */
25
+ export declare function textBlockHeight(content: string, width: number, role: TypeRole, family?: FontId, weightOverride?: 'normal' | 'bold'): number;
26
+ //# sourceMappingURL=measure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/whiteboard/measure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAS3C,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,QAAQ,GAAG,MAAiB,EAAE,MAAM,GAAE,MAAe,GAAG,MAAM,CAEjH;AAED,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,QAAQ,GAAG,MAAiB,EAAE,MAAM,GAAE,MAAe,GAAG,MAAM,CAElI;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,QAAQ,GAAG,MAAiB,EACpC,MAAM,GAAE,MAAe,GACtB,MAAM,EAAE,CAwBV;AAED,uDAAuD;AACvD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,QAAQ,EACd,MAAM,GAAE,MAAe,EACvB,cAAc,CAAC,EAAE,QAAQ,GAAG,MAAM,GACjC,MAAM,CAKR"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Text measurement for layout.
3
+ *
4
+ * Sections must report an exact height or stacked sections overlap. There
5
+ * is no canvas or DOM here, so widths come from a per-character average.
6
+ * That is an estimate, but it is a consistent one, and it is applied the
7
+ * same way to every section, so the rhythm of the page stays regular even
8
+ * where a line is a few pixels off.
9
+ *
10
+ * Ratios are measured against the UI sans stack at weight 400 and 700.
11
+ * Serif and mono run wider; hand runs narrower.
12
+ */
13
+ import { TYPE_SCALE } from './tokens.js';
14
+ const WIDTH_RATIO = {
15
+ sans: { normal: 0.52, bold: 0.56 },
16
+ serif: { normal: 0.5, bold: 0.54 },
17
+ mono: { normal: 0.6, bold: 0.6 },
18
+ hand: { normal: 0.44, bold: 0.46 },
19
+ };
20
+ export function charWidth(fontSize, weight = 'normal', family = 'sans') {
21
+ return fontSize * WIDTH_RATIO[family][weight];
22
+ }
23
+ /** Width of a single unwrapped run, for sizing a button or a pill. */
24
+ export function textWidth(content, fontSize, weight = 'normal', family = 'sans') {
25
+ return content.length * charWidth(fontSize, weight, family);
26
+ }
27
+ /**
28
+ * Greedy word wrap. A word longer than the line is left to overflow rather
29
+ * than broken, because a hyphenless mid-word break looks worse than a
30
+ * slightly long line and only ever happens to URLs.
31
+ */
32
+ export function wrapLines(content, width, fontSize, weight = 'normal', family = 'sans') {
33
+ const cw = charWidth(fontSize, weight, family);
34
+ const maxChars = Math.max(1, Math.floor(width / cw));
35
+ const lines = [];
36
+ for (const paragraph of content.split('\n')) {
37
+ if (paragraph.trim() === '') {
38
+ lines.push('');
39
+ continue;
40
+ }
41
+ let line = '';
42
+ for (const word of paragraph.split(/\s+/).filter(Boolean)) {
43
+ const candidate = line ? `${line} ${word}` : word;
44
+ if (candidate.length <= maxChars || line === '') {
45
+ line = candidate;
46
+ }
47
+ else {
48
+ lines.push(line);
49
+ line = word;
50
+ }
51
+ }
52
+ if (line)
53
+ lines.push(line);
54
+ }
55
+ return lines.length ? lines : [''];
56
+ }
57
+ /** Rendered height of wrapped text at a given role. */
58
+ export function textBlockHeight(content, width, role, family = 'sans', weightOverride) {
59
+ const token = TYPE_SCALE[role];
60
+ const weight = weightOverride ?? token.weight;
61
+ const lines = wrapLines(content, width, token.size, weight, family);
62
+ return Math.ceil(lines.length * token.size * token.lineHeight);
63
+ }
64
+ //# sourceMappingURL=measure.js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I,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAA;AAChE,CAAC"}
@@ -0,0 +1,329 @@
1
+ /**
2
+ * Composed whiteboard sections.
3
+ *
4
+ * A board built element by element reads as a scatter of boxes. A board
5
+ * built as a stack of sections reads as a page, because the sections share
6
+ * a content column, a spacing rhythm and a type hierarchy.
7
+ *
8
+ * Every function here is pure: it takes a position and some content, and
9
+ * returns positioned elements plus the exact height it consumed. The
10
+ * caller never computes a coordinate, and `composeBoard` never has to
11
+ * guess where the next section starts.
12
+ */
13
+ import { type WhiteboardElement, type ChartType } from './elements.js';
14
+ import { type BoardStyle, type BoardStyleId } from './styles.js';
15
+ /** Space from the canvas origin to the content column. */
16
+ export declare const CANVAS_MARGIN: 64;
17
+ /** Content column width. Callers may override for a narrower board. */
18
+ export declare const DEFAULT_COLUMN = 1200;
19
+ /**
20
+ * Hard cap on any run of body copy. At body size an average character is
21
+ * about 7 units wide, so 560 is roughly 80 characters. Body text running
22
+ * the full column is unreadable and is a large part of why wide boards
23
+ * look wrong, so every section clamps to this rather than filling.
24
+ */
25
+ export declare const MEASURE = 560;
26
+ /**
27
+ * How tall a hero stands in page layout.
28
+ *
29
+ * A landing page opens with one screen that holds a single idea. A hero
30
+ * that is only as tall as its own text reads as the first paragraph of a
31
+ * document instead, which is exactly what this board looked like. Roughly
32
+ * a laptop viewport at the default column width.
33
+ */
34
+ export declare const HERO_HEIGHT = 720;
35
+ export interface SectionEnv {
36
+ x: number;
37
+ y: number;
38
+ width: number;
39
+ /** Deterministic, collision-free ids scoped to this section. */
40
+ id: (suffix: string) => string;
41
+ /** The board's look. Chosen once, applied by every section. */
42
+ style: BoardStyle;
43
+ /** 1-based position, for styles that number their sections. */
44
+ index: number;
45
+ /**
46
+ * 'page' means one long scroll, so the hero can own a whole screen.
47
+ * 'slides' means every section shares a fixed screen and nothing may
48
+ * claim it.
49
+ */
50
+ layout: 'page' | 'slides';
51
+ /**
52
+ * The full canvas width, ignoring the content column. A band that runs
53
+ * edge to edge is one of the strongest signals that something is a page
54
+ * rather than a document, so bands are allowed to reach past the column
55
+ * they otherwise respect.
56
+ */
57
+ bleedX: number;
58
+ bleedWidth: number;
59
+ }
60
+ export interface SectionOutput {
61
+ elements: WhiteboardElement[];
62
+ height: number;
63
+ /** True when the section drew outside the content column, on purpose. */
64
+ bleeds?: boolean;
65
+ }
66
+ export type Visual = {
67
+ kind: 'image';
68
+ src: string;
69
+ alt?: string;
70
+ } | {
71
+ kind: 'chart';
72
+ chartType: ChartType;
73
+ title?: string;
74
+ subtitle?: string;
75
+ data: unknown;
76
+ style?: Record<string, unknown>;
77
+ }
78
+ /**
79
+ * A reserved space with the art direction written inside it. This is the
80
+ * default when a board wants a picture that does not exist yet: a board
81
+ * that says what belongs in the gap is more useful than one filled with
82
+ * an unrelated stock photo, and nothing external can break.
83
+ */
84
+ | {
85
+ kind: 'placeholder';
86
+ brief: string;
87
+ };
88
+ export interface HeroContent {
89
+ headline: string;
90
+ subline?: string;
91
+ visual?: Visual;
92
+ /** An optional button under the subline. href must be http, https or mailto. */
93
+ cta?: {
94
+ label: string;
95
+ href?: string;
96
+ };
97
+ }
98
+ /**
99
+ * The only section allowed display type, which is what makes the top of a
100
+ * board read as the top. An accent rule stands in for the all-caps eyebrow
101
+ * label that marks a page as generated.
102
+ */
103
+ export declare function hero(env: SectionEnv, c: HeroContent): SectionOutput;
104
+ export interface FeatureItem {
105
+ icon: string;
106
+ title: string;
107
+ body: string;
108
+ }
109
+ export interface FeatureGridContent {
110
+ items: FeatureItem[];
111
+ columns?: 2 | 3 | 4;
112
+ /** A line naming what this group is. */
113
+ title?: string;
114
+ /** One or two sentences under the title. */
115
+ intro?: string;
116
+ }
117
+ /**
118
+ * Card heights are equalised to the tallest, so the row bottoms align. A
119
+ * grid whose cards each stop at their own text is the single most common
120
+ * reason a composed board looks ragged.
121
+ */
122
+ export declare function featureGrid(env: SectionEnv, c: FeatureGridContent): SectionOutput;
123
+ export interface Stat {
124
+ value: string;
125
+ label: string;
126
+ delta?: {
127
+ text: string;
128
+ tone?: 'up' | 'down';
129
+ };
130
+ }
131
+ export interface StatBandContent {
132
+ stats: Stat[];
133
+ }
134
+ /**
135
+ * Plain text on an ink panel rather than KPI chart elements: a band needs
136
+ * one shared baseline across every figure, and the chart element brings
137
+ * its own card chrome that would fight the panel.
138
+ */
139
+ export declare function statBand(env: SectionEnv, c: StatBandContent): SectionOutput;
140
+ export interface SplitContent {
141
+ title: string;
142
+ body: string;
143
+ visual: Visual;
144
+ /** Which side the text sits on. Alternate it when repeating the section. */
145
+ side?: 'left' | 'right';
146
+ }
147
+ export declare function split(env: SectionEnv, c: SplitContent): SectionOutput;
148
+ export interface Step {
149
+ title: string;
150
+ body?: string;
151
+ }
152
+ export interface StepsContent {
153
+ steps: Step[];
154
+ title?: string;
155
+ intro?: string;
156
+ }
157
+ /**
158
+ * The one section where numbered markers are honest, because the content
159
+ * genuinely is a sequence. Connectors draw the actual progression rather
160
+ * than leaving the reader to infer it from left-to-right order.
161
+ */
162
+ export declare function steps(env: SectionEnv, c: StepsContent): SectionOutput;
163
+ export interface QuoteContent {
164
+ quote: string;
165
+ attribution?: string;
166
+ }
167
+ /** Structurally the quietest section and typographically the loudest. */
168
+ export declare function quote(env: SectionEnv, c: QuoteContent): SectionOutput;
169
+ export interface ChartPanelContent {
170
+ title: string;
171
+ caption?: string;
172
+ chart: Extract<Visual, {
173
+ kind: 'chart';
174
+ }>;
175
+ /** Plot height. Defaults to a 16:5-ish band that suits most chart types. */
176
+ chartHeight?: number;
177
+ }
178
+ export declare function chartPanel(env: SectionEnv, c: ChartPanelContent): SectionOutput;
179
+ export interface CtaBandContent {
180
+ headline: string;
181
+ buttonLabel: string;
182
+ note?: string;
183
+ /** Where the button goes. Only http, https and mailto are accepted. */
184
+ href?: string;
185
+ }
186
+ /**
187
+ * The button label carries no arrow glyph. An appended arrow is one of the
188
+ * clearest tells of a generated page, and on a static board it also
189
+ * promises an interaction that does not exist.
190
+ */
191
+ export declare function ctaBand(env: SectionEnv, c: CtaBandContent): SectionOutput;
192
+ export interface ComparisonTableContent {
193
+ columns: string[];
194
+ rows: string[][];
195
+ }
196
+ /**
197
+ * The first column is the row label and carries the longest strings, so it
198
+ * gets half again the width of the rest. Equal columns look tidy in the
199
+ * abstract and wrap badly in practice.
200
+ */
201
+ export declare function comparisonTable(env: SectionEnv, c: ComparisonTableContent): SectionOutput;
202
+ export interface TimelineEvent {
203
+ date: string;
204
+ title: string;
205
+ body?: string;
206
+ }
207
+ export interface TimelineContent {
208
+ events: TimelineEvent[];
209
+ }
210
+ export declare function timeline(env: SectionEnv, c: TimelineContent): SectionOutput;
211
+ export interface LogoRowContent {
212
+ label?: string;
213
+ items: ({
214
+ kind: 'icon';
215
+ iconName: string;
216
+ } | {
217
+ kind: 'image';
218
+ src: string;
219
+ alt?: string;
220
+ })[];
221
+ }
222
+ export declare function logoRow(env: SectionEnv, c: LogoRowContent): SectionOutput;
223
+ export interface FooterMetaContent {
224
+ items: string[];
225
+ }
226
+ /**
227
+ * Items are positioned separately rather than joined with middle dots. A
228
+ * dot-joined meta string is a generated-page tell, and separate elements
229
+ * also stay legible when the board is exported at a smaller scale.
230
+ */
231
+ export declare function footerMeta(env: SectionEnv, c: FooterMetaContent): SectionOutput;
232
+ export interface ImageBandContent {
233
+ visual: Visual;
234
+ caption?: string;
235
+ /** Band height in canvas units. Defaults to a wide 3:1 strip. */
236
+ height?: number;
237
+ }
238
+ /**
239
+ * A full-width picture with an optional caption. Wide and short on
240
+ * purpose: a full-column image at its natural aspect ratio would dwarf
241
+ * every section around it.
242
+ */
243
+ export declare function imageBand(env: SectionEnv, c: ImageBandContent): SectionOutput;
244
+ export type SectionSpec = {
245
+ type: 'hero';
246
+ content: HeroContent;
247
+ } | {
248
+ type: 'featureGrid';
249
+ content: FeatureGridContent;
250
+ } | {
251
+ type: 'statBand';
252
+ content: StatBandContent;
253
+ } | {
254
+ type: 'split';
255
+ content: SplitContent;
256
+ } | {
257
+ type: 'steps';
258
+ content: StepsContent;
259
+ } | {
260
+ type: 'quote';
261
+ content: QuoteContent;
262
+ } | {
263
+ type: 'chartPanel';
264
+ content: ChartPanelContent;
265
+ } | {
266
+ type: 'ctaBand';
267
+ content: CtaBandContent;
268
+ } | {
269
+ type: 'comparisonTable';
270
+ content: ComparisonTableContent;
271
+ } | {
272
+ type: 'timeline';
273
+ content: TimelineContent;
274
+ } | {
275
+ type: 'logoRow';
276
+ content: LogoRowContent;
277
+ } | {
278
+ type: 'footerMeta';
279
+ content: FooterMetaContent;
280
+ } | {
281
+ type: 'imageBand';
282
+ content: ImageBandContent;
283
+ };
284
+ export declare const SECTION_TYPES: readonly ["hero", "featureGrid", "statBand", "split", "steps", "quote", "chartPanel", "ctaBand", "comparisonTable", "timeline", "logoRow", "footerMeta", "imageBand"];
285
+ /**
286
+ * A screen-shaped page for slide layout. 16:9 against the default column,
287
+ * so a board reads like a deck rather than a scroll.
288
+ */
289
+ export declare const SLIDE_HEIGHT: number;
290
+ export interface ComposedPage {
291
+ elements: WhiteboardElement[];
292
+ layerOrder: string[];
293
+ /** Ids of elements that deliberately sit outside the content column. */
294
+ bleedIds: string[];
295
+ /** Total height of the stack, so a caller can size a viewport. */
296
+ height: number;
297
+ width: number;
298
+ }
299
+ /**
300
+ * Stack sections down one content column.
301
+ *
302
+ * Each section reports the height it consumed, so the next one starts a
303
+ * fixed gap below it. That is the whole reason sections never overlap and
304
+ * the rhythm of the page stays even regardless of how much text a caller
305
+ * supplies.
306
+ */
307
+ export declare function composeBoard(specs: SectionSpec[], opts?: {
308
+ columnWidth?: number;
309
+ margin?: number;
310
+ style?: BoardStyleId;
311
+ layout?: 'page' | 'slides';
312
+ }): ComposedPage;
313
+ /**
314
+ * Break the same section list into screen-sized pages.
315
+ *
316
+ * This is the other way to read a board: instead of one long column you
317
+ * scroll, a stack of pages you step through, each one filling a screen.
318
+ * Sections are packed greedily and never split, because half a feature
319
+ * grid at a page break is worse than an uneven page.
320
+ */
321
+ export declare function composeSlides(specs: SectionSpec[], opts?: {
322
+ columnWidth?: number;
323
+ margin?: number;
324
+ slideHeight?: number;
325
+ style?: BoardStyleId;
326
+ }): ComposedPage[];
327
+ export { BOARD_STYLES, BOARD_STYLE_IDS, DEFAULT_STYLE, resolveStyle } from './styles.js';
328
+ export type { BoardStyle, BoardStyleId } from './styles.js';
329
+ //# sourceMappingURL=sections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sections.d.ts","sourceRoot":"","sources":["../../../src/whiteboard/sections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAEL,KAAK,iBAAiB,EAAe,KAAK,SAAS,EACpD,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAuC,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAIrG,0DAA0D;AAC1D,eAAO,MAAM,aAAa,IAAY,CAAA;AAEtC,uEAAuE;AACvE,eAAO,MAAM,cAAc,OAAO,CAAA;AAElC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,MAAM,CAAA;AAK1B;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,MAAM,CAAA;AAO9B,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,gEAAgE;IAChE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAA;IAC9B,+DAA+D;IAC/D,KAAK,EAAE,UAAU,CAAA;IACjB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAA;IACzB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,iBAAi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