@typecaast/schema 0.2.0 → 0.3.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.
- package/dist/index.cjs +135 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +356 -51
- package/dist/index.d.ts +356 -51
- package/dist/index.js +121 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/typecaast.schema.json +801 -393
package/dist/index.d.cts
CHANGED
|
@@ -7,10 +7,17 @@ declare const sizeSchema: z.ZodObject<{
|
|
|
7
7
|
}, z.core.$strip>;
|
|
8
8
|
type Size = z.infer<typeof sizeSchema>;
|
|
9
9
|
/**
|
|
10
|
-
* How the rendered conversation fills its container.
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* How the rendered conversation fills its container. The widget is
|
|
11
|
+
* **container-driven** in the first two modes — its size never grows
|
|
12
|
+
* with content; messages clip when they overflow the bottom-anchored
|
|
13
|
+
* thread.
|
|
14
|
+
* - `reflow`: fills the container in both axes; bubbles re-wrap to the
|
|
15
|
+
* container width.
|
|
16
|
+
* - `scale`: renders at the exact authored canvas size and CSS-scales
|
|
17
|
+
* to fit (preserves the canonical layout — letterboxes if the
|
|
18
|
+
* container's aspect doesn't match the canvas).
|
|
19
|
+
* - `fixed`: pins the widget to the authored canvas px; clips. The only
|
|
20
|
+
* non-container-driven mode.
|
|
14
21
|
*/
|
|
15
22
|
declare const fitModeSchema: z.ZodEnum<{
|
|
16
23
|
reflow: "reflow";
|
|
@@ -144,9 +151,11 @@ type PacingInput = z.input<typeof pacingSchema>;
|
|
|
144
151
|
|
|
145
152
|
/**
|
|
146
153
|
* Inline marks inside a text node. `text` runs carry plain content; the others
|
|
147
|
-
* are the recognized marks (`code`, `link`, `mention`, `emoji
|
|
148
|
-
*
|
|
149
|
-
* bump (unknown content node types are handled leniently; see
|
|
154
|
+
* are the recognized marks (`code`, `link`, `mention`, `emoji`, and the
|
|
155
|
+
* emphasis marks `bold`/`italic`/`strike`). New marks can be added without a
|
|
156
|
+
* schema-version bump (unknown content node types are handled leniently; see
|
|
157
|
+
* the registry). Emphasis marks are flat (no nesting, e.g. bold *and* italic on
|
|
158
|
+
* the same run) — a deliberate v1 simplification matching Slack's common usage.
|
|
150
159
|
*/
|
|
151
160
|
declare const inlineTextSchema: z.ZodObject<{
|
|
152
161
|
type: z.ZodLiteral<"text">;
|
|
@@ -156,6 +165,18 @@ declare const inlineCodeSchema: z.ZodObject<{
|
|
|
156
165
|
type: z.ZodLiteral<"code">;
|
|
157
166
|
value: z.ZodString;
|
|
158
167
|
}, z.core.$strip>;
|
|
168
|
+
declare const inlineBoldSchema: z.ZodObject<{
|
|
169
|
+
type: z.ZodLiteral<"bold">;
|
|
170
|
+
value: z.ZodString;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
declare const inlineItalicSchema: z.ZodObject<{
|
|
173
|
+
type: z.ZodLiteral<"italic">;
|
|
174
|
+
value: z.ZodString;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
declare const inlineStrikeSchema: z.ZodObject<{
|
|
177
|
+
type: z.ZodLiteral<"strike">;
|
|
178
|
+
value: z.ZodString;
|
|
179
|
+
}, z.core.$strip>;
|
|
159
180
|
declare const inlineLinkSchema: z.ZodObject<{
|
|
160
181
|
type: z.ZodLiteral<"link">;
|
|
161
182
|
href: z.ZodString;
|
|
@@ -177,6 +198,15 @@ declare const inlineNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
177
198
|
}, z.core.$strip>, z.ZodObject<{
|
|
178
199
|
type: z.ZodLiteral<"code">;
|
|
179
200
|
value: z.ZodString;
|
|
201
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
202
|
+
type: z.ZodLiteral<"bold">;
|
|
203
|
+
value: z.ZodString;
|
|
204
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
205
|
+
type: z.ZodLiteral<"italic">;
|
|
206
|
+
value: z.ZodString;
|
|
207
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
208
|
+
type: z.ZodLiteral<"strike">;
|
|
209
|
+
value: z.ZodString;
|
|
180
210
|
}, z.core.$strip>, z.ZodObject<{
|
|
181
211
|
type: z.ZodLiteral<"link">;
|
|
182
212
|
href: z.ZodString;
|
|
@@ -200,6 +230,15 @@ declare const textNodeSchema: z.ZodObject<{
|
|
|
200
230
|
}, z.core.$strip>, z.ZodObject<{
|
|
201
231
|
type: z.ZodLiteral<"code">;
|
|
202
232
|
value: z.ZodString;
|
|
233
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
234
|
+
type: z.ZodLiteral<"bold">;
|
|
235
|
+
value: z.ZodString;
|
|
236
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
237
|
+
type: z.ZodLiteral<"italic">;
|
|
238
|
+
value: z.ZodString;
|
|
239
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
240
|
+
type: z.ZodLiteral<"strike">;
|
|
241
|
+
value: z.ZodString;
|
|
203
242
|
}, z.core.$strip>, z.ZodObject<{
|
|
204
243
|
type: z.ZodLiteral<"link">;
|
|
205
244
|
href: z.ZodString;
|
|
@@ -224,10 +263,292 @@ declare const imageNodeSchema: z.ZodObject<{
|
|
|
224
263
|
height: z.ZodOptional<z.ZodNumber>;
|
|
225
264
|
}, z.core.$strip>;
|
|
226
265
|
type ImageNode = z.infer<typeof imageNodeSchema>;
|
|
266
|
+
/**
|
|
267
|
+
* An interactive button (in an `actions` block or as a `section` accessory).
|
|
268
|
+
* With `href` the skin renders a link opening in a new tab; without one it's
|
|
269
|
+
* visibly inert. `style` controls emphasis — omitted = default (outlined),
|
|
270
|
+
* matching Slack's `primary`/`danger`/default button styles.
|
|
271
|
+
*/
|
|
272
|
+
declare const buttonElementSchema: z.ZodObject<{
|
|
273
|
+
type: z.ZodLiteral<"button">;
|
|
274
|
+
label: z.ZodString;
|
|
275
|
+
href: z.ZodOptional<z.ZodString>;
|
|
276
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
277
|
+
primary: "primary";
|
|
278
|
+
danger: "danger";
|
|
279
|
+
}>>;
|
|
280
|
+
}, z.core.$strip>;
|
|
281
|
+
type ButtonElement = z.infer<typeof buttonElementSchema>;
|
|
282
|
+
/** A small image element (a `context` element or a `section` accessory). */
|
|
283
|
+
declare const imageElementSchema: z.ZodObject<{
|
|
284
|
+
type: z.ZodLiteral<"image">;
|
|
285
|
+
src: z.ZodString;
|
|
286
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, z.core.$strip>;
|
|
288
|
+
type ImageElement = z.infer<typeof imageElementSchema>;
|
|
289
|
+
/** A large bold heading (Block Kit `header` — plain text, no inline marks). */
|
|
290
|
+
declare const headerNodeSchema: z.ZodObject<{
|
|
291
|
+
type: z.ZodLiteral<"header">;
|
|
292
|
+
text: z.ZodString;
|
|
293
|
+
}, z.core.$strip>;
|
|
294
|
+
type HeaderNode = z.infer<typeof headerNodeSchema>;
|
|
295
|
+
/**
|
|
296
|
+
* A section block: a paragraph of inline content, with an optional `accessory`
|
|
297
|
+
* (a button or image to its right) and optional `fields` (a two-column grid).
|
|
298
|
+
* Text may be authored as `spans` (resolved) or `text` (sugar, parsed to spans
|
|
299
|
+
* by `toContentNodes`).
|
|
300
|
+
*/
|
|
301
|
+
declare const sectionFieldSchema: z.ZodObject<{
|
|
302
|
+
spans: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
303
|
+
type: z.ZodLiteral<"text">;
|
|
304
|
+
value: z.ZodString;
|
|
305
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
306
|
+
type: z.ZodLiteral<"code">;
|
|
307
|
+
value: z.ZodString;
|
|
308
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
309
|
+
type: z.ZodLiteral<"bold">;
|
|
310
|
+
value: z.ZodString;
|
|
311
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
312
|
+
type: z.ZodLiteral<"italic">;
|
|
313
|
+
value: z.ZodString;
|
|
314
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
315
|
+
type: z.ZodLiteral<"strike">;
|
|
316
|
+
value: z.ZodString;
|
|
317
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
318
|
+
type: z.ZodLiteral<"link">;
|
|
319
|
+
href: z.ZodString;
|
|
320
|
+
label: z.ZodOptional<z.ZodString>;
|
|
321
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
322
|
+
type: z.ZodLiteral<"mention">;
|
|
323
|
+
label: z.ZodString;
|
|
324
|
+
id: z.ZodOptional<z.ZodString>;
|
|
325
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
326
|
+
type: z.ZodLiteral<"emoji">;
|
|
327
|
+
value: z.ZodString;
|
|
328
|
+
shortcode: z.ZodOptional<z.ZodString>;
|
|
329
|
+
}, z.core.$strip>], "type">>>;
|
|
330
|
+
text: z.ZodOptional<z.ZodString>;
|
|
331
|
+
}, z.core.$strip>;
|
|
332
|
+
declare const sectionNodeSchema: z.ZodObject<{
|
|
333
|
+
type: z.ZodLiteral<"section">;
|
|
334
|
+
spans: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
335
|
+
type: z.ZodLiteral<"text">;
|
|
336
|
+
value: z.ZodString;
|
|
337
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
338
|
+
type: z.ZodLiteral<"code">;
|
|
339
|
+
value: z.ZodString;
|
|
340
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
341
|
+
type: z.ZodLiteral<"bold">;
|
|
342
|
+
value: z.ZodString;
|
|
343
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
344
|
+
type: z.ZodLiteral<"italic">;
|
|
345
|
+
value: z.ZodString;
|
|
346
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
347
|
+
type: z.ZodLiteral<"strike">;
|
|
348
|
+
value: z.ZodString;
|
|
349
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
350
|
+
type: z.ZodLiteral<"link">;
|
|
351
|
+
href: z.ZodString;
|
|
352
|
+
label: z.ZodOptional<z.ZodString>;
|
|
353
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
354
|
+
type: z.ZodLiteral<"mention">;
|
|
355
|
+
label: z.ZodString;
|
|
356
|
+
id: z.ZodOptional<z.ZodString>;
|
|
357
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
358
|
+
type: z.ZodLiteral<"emoji">;
|
|
359
|
+
value: z.ZodString;
|
|
360
|
+
shortcode: z.ZodOptional<z.ZodString>;
|
|
361
|
+
}, z.core.$strip>], "type">>>;
|
|
362
|
+
text: z.ZodOptional<z.ZodString>;
|
|
363
|
+
accessory: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
364
|
+
type: z.ZodLiteral<"button">;
|
|
365
|
+
label: z.ZodString;
|
|
366
|
+
href: z.ZodOptional<z.ZodString>;
|
|
367
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
368
|
+
primary: "primary";
|
|
369
|
+
danger: "danger";
|
|
370
|
+
}>>;
|
|
371
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
372
|
+
type: z.ZodLiteral<"image">;
|
|
373
|
+
src: z.ZodString;
|
|
374
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
375
|
+
}, z.core.$strip>], "type">>;
|
|
376
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
377
|
+
spans: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
378
|
+
type: z.ZodLiteral<"text">;
|
|
379
|
+
value: z.ZodString;
|
|
380
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
381
|
+
type: z.ZodLiteral<"code">;
|
|
382
|
+
value: z.ZodString;
|
|
383
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
384
|
+
type: z.ZodLiteral<"bold">;
|
|
385
|
+
value: z.ZodString;
|
|
386
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
387
|
+
type: z.ZodLiteral<"italic">;
|
|
388
|
+
value: z.ZodString;
|
|
389
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
390
|
+
type: z.ZodLiteral<"strike">;
|
|
391
|
+
value: z.ZodString;
|
|
392
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
393
|
+
type: z.ZodLiteral<"link">;
|
|
394
|
+
href: z.ZodString;
|
|
395
|
+
label: z.ZodOptional<z.ZodString>;
|
|
396
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
397
|
+
type: z.ZodLiteral<"mention">;
|
|
398
|
+
label: z.ZodString;
|
|
399
|
+
id: z.ZodOptional<z.ZodString>;
|
|
400
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
401
|
+
type: z.ZodLiteral<"emoji">;
|
|
402
|
+
value: z.ZodString;
|
|
403
|
+
shortcode: z.ZodOptional<z.ZodString>;
|
|
404
|
+
}, z.core.$strip>], "type">>>;
|
|
405
|
+
text: z.ZodOptional<z.ZodString>;
|
|
406
|
+
}, z.core.$strip>>>;
|
|
407
|
+
}, z.core.$strip>;
|
|
408
|
+
type SectionNode = z.infer<typeof sectionNodeSchema>;
|
|
409
|
+
/** A context block: a row of small, muted text/image elements. */
|
|
410
|
+
declare const contextTextElementSchema: z.ZodObject<{
|
|
411
|
+
type: z.ZodLiteral<"text">;
|
|
412
|
+
spans: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
413
|
+
type: z.ZodLiteral<"text">;
|
|
414
|
+
value: z.ZodString;
|
|
415
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
416
|
+
type: z.ZodLiteral<"code">;
|
|
417
|
+
value: z.ZodString;
|
|
418
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
419
|
+
type: z.ZodLiteral<"bold">;
|
|
420
|
+
value: z.ZodString;
|
|
421
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
422
|
+
type: z.ZodLiteral<"italic">;
|
|
423
|
+
value: z.ZodString;
|
|
424
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
425
|
+
type: z.ZodLiteral<"strike">;
|
|
426
|
+
value: z.ZodString;
|
|
427
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
428
|
+
type: z.ZodLiteral<"link">;
|
|
429
|
+
href: z.ZodString;
|
|
430
|
+
label: z.ZodOptional<z.ZodString>;
|
|
431
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
432
|
+
type: z.ZodLiteral<"mention">;
|
|
433
|
+
label: z.ZodString;
|
|
434
|
+
id: z.ZodOptional<z.ZodString>;
|
|
435
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
436
|
+
type: z.ZodLiteral<"emoji">;
|
|
437
|
+
value: z.ZodString;
|
|
438
|
+
shortcode: z.ZodOptional<z.ZodString>;
|
|
439
|
+
}, z.core.$strip>], "type">>>;
|
|
440
|
+
text: z.ZodOptional<z.ZodString>;
|
|
441
|
+
}, z.core.$strip>;
|
|
442
|
+
declare const contextElementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
443
|
+
type: z.ZodLiteral<"text">;
|
|
444
|
+
spans: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
445
|
+
type: z.ZodLiteral<"text">;
|
|
446
|
+
value: z.ZodString;
|
|
447
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
448
|
+
type: z.ZodLiteral<"code">;
|
|
449
|
+
value: z.ZodString;
|
|
450
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
451
|
+
type: z.ZodLiteral<"bold">;
|
|
452
|
+
value: z.ZodString;
|
|
453
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
454
|
+
type: z.ZodLiteral<"italic">;
|
|
455
|
+
value: z.ZodString;
|
|
456
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
457
|
+
type: z.ZodLiteral<"strike">;
|
|
458
|
+
value: z.ZodString;
|
|
459
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
460
|
+
type: z.ZodLiteral<"link">;
|
|
461
|
+
href: z.ZodString;
|
|
462
|
+
label: z.ZodOptional<z.ZodString>;
|
|
463
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
464
|
+
type: z.ZodLiteral<"mention">;
|
|
465
|
+
label: z.ZodString;
|
|
466
|
+
id: z.ZodOptional<z.ZodString>;
|
|
467
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
468
|
+
type: z.ZodLiteral<"emoji">;
|
|
469
|
+
value: z.ZodString;
|
|
470
|
+
shortcode: z.ZodOptional<z.ZodString>;
|
|
471
|
+
}, z.core.$strip>], "type">>>;
|
|
472
|
+
text: z.ZodOptional<z.ZodString>;
|
|
473
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
474
|
+
type: z.ZodLiteral<"image">;
|
|
475
|
+
src: z.ZodString;
|
|
476
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
477
|
+
}, z.core.$strip>], "type">;
|
|
478
|
+
type ContextElement = z.infer<typeof contextElementSchema>;
|
|
479
|
+
declare const contextNodeSchema: z.ZodObject<{
|
|
480
|
+
type: z.ZodLiteral<"context">;
|
|
481
|
+
elements: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
482
|
+
type: z.ZodLiteral<"text">;
|
|
483
|
+
spans: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
484
|
+
type: z.ZodLiteral<"text">;
|
|
485
|
+
value: z.ZodString;
|
|
486
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
487
|
+
type: z.ZodLiteral<"code">;
|
|
488
|
+
value: z.ZodString;
|
|
489
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
490
|
+
type: z.ZodLiteral<"bold">;
|
|
491
|
+
value: z.ZodString;
|
|
492
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
493
|
+
type: z.ZodLiteral<"italic">;
|
|
494
|
+
value: z.ZodString;
|
|
495
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
496
|
+
type: z.ZodLiteral<"strike">;
|
|
497
|
+
value: z.ZodString;
|
|
498
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
499
|
+
type: z.ZodLiteral<"link">;
|
|
500
|
+
href: z.ZodString;
|
|
501
|
+
label: z.ZodOptional<z.ZodString>;
|
|
502
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
503
|
+
type: z.ZodLiteral<"mention">;
|
|
504
|
+
label: z.ZodString;
|
|
505
|
+
id: z.ZodOptional<z.ZodString>;
|
|
506
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
507
|
+
type: z.ZodLiteral<"emoji">;
|
|
508
|
+
value: z.ZodString;
|
|
509
|
+
shortcode: z.ZodOptional<z.ZodString>;
|
|
510
|
+
}, z.core.$strip>], "type">>>;
|
|
511
|
+
text: z.ZodOptional<z.ZodString>;
|
|
512
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
513
|
+
type: z.ZodLiteral<"image">;
|
|
514
|
+
src: z.ZodString;
|
|
515
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
516
|
+
}, z.core.$strip>], "type">>;
|
|
517
|
+
}, z.core.$strip>;
|
|
518
|
+
type ContextNode = z.infer<typeof contextNodeSchema>;
|
|
519
|
+
/** A horizontal rule between blocks. */
|
|
520
|
+
declare const dividerNodeSchema: z.ZodObject<{
|
|
521
|
+
type: z.ZodLiteral<"divider">;
|
|
522
|
+
}, z.core.$strip>;
|
|
523
|
+
type DividerNode = z.infer<typeof dividerNodeSchema>;
|
|
524
|
+
/** A row of interactive buttons. */
|
|
525
|
+
declare const actionsNodeSchema: z.ZodObject<{
|
|
526
|
+
type: z.ZodLiteral<"actions">;
|
|
527
|
+
elements: z.ZodArray<z.ZodObject<{
|
|
528
|
+
type: z.ZodLiteral<"button">;
|
|
529
|
+
label: z.ZodString;
|
|
530
|
+
href: z.ZodOptional<z.ZodString>;
|
|
531
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
532
|
+
primary: "primary";
|
|
533
|
+
danger: "danger";
|
|
534
|
+
}>>;
|
|
535
|
+
}, z.core.$strip>>;
|
|
536
|
+
}, z.core.$strip>;
|
|
537
|
+
type ActionsNode = z.infer<typeof actionsNodeSchema>;
|
|
538
|
+
/**
|
|
539
|
+
* A legacy-style attachment: nested blocks rendered behind a colored left bar.
|
|
540
|
+
* `color` is any CSS color (defaults to a neutral bar). Recursive — its Zod
|
|
541
|
+
* schema lives in `content-registry.ts` (where the node union is built).
|
|
542
|
+
*/
|
|
543
|
+
interface AttachmentNode {
|
|
544
|
+
type: "attachment";
|
|
545
|
+
color?: string;
|
|
546
|
+
content: ContentNode[];
|
|
547
|
+
}
|
|
227
548
|
/**
|
|
228
549
|
* A content node whose `type` the runtime doesn't recognize. It validates
|
|
229
550
|
* leniently (only `type` is required) and is skipped by skins that don't handle
|
|
230
|
-
* it — so future node types (`
|
|
551
|
+
* it — so future node types (`linkPreview`, `videoEmbed`, …) slot in without
|
|
231
552
|
* breaking older runtimes or bumping the schema version.
|
|
232
553
|
*/
|
|
233
554
|
interface UnknownContentNode {
|
|
@@ -235,8 +556,14 @@ interface UnknownContentNode {
|
|
|
235
556
|
[key: string]: unknown;
|
|
236
557
|
}
|
|
237
558
|
/** The body of a message: an ordered list of content nodes. */
|
|
238
|
-
type ContentNode = TextNode | ImageNode | UnknownContentNode;
|
|
559
|
+
type ContentNode = TextNode | ImageNode | HeaderNode | SectionNode | ContextNode | DividerNode | ActionsNode | AttachmentNode | UnknownContentNode;
|
|
239
560
|
|
|
561
|
+
/**
|
|
562
|
+
* A legacy-style attachment node — nested blocks behind a colored left bar.
|
|
563
|
+
* Recursive (its `content` is the full node array), so it's defined here where
|
|
564
|
+
* `contentSchema` is in scope and wrapped in `z.lazy` to defer the reference.
|
|
565
|
+
*/
|
|
566
|
+
declare const attachmentNodeSchema: z.ZodType<AttachmentNode>;
|
|
240
567
|
/** Register (or override) the strict schema for a content node type. */
|
|
241
568
|
declare function registerContentNodeType(type: string, schema: z.ZodTypeAny): void;
|
|
242
569
|
/** The content node types the runtime validates strictly. */
|
|
@@ -255,8 +582,10 @@ declare const contentSchema: z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$
|
|
|
255
582
|
|
|
256
583
|
/**
|
|
257
584
|
* Parse a plain authoring string into inline nodes, extracting inline `code`,
|
|
258
|
-
* links, and
|
|
259
|
-
* fine
|
|
585
|
+
* `bold`/`italic`/`strike`, links, and mentions. Emoji are left inside text
|
|
586
|
+
* runs (they render fine; a dedicated emoji mark can be authored explicitly).
|
|
587
|
+
* A `<@id>` mention carries its `id` and a placeholder label; the engine
|
|
588
|
+
* resolves the label to the participant's display name at compile time.
|
|
260
589
|
*/
|
|
261
590
|
declare function parseInline(text: string): InlineNode[];
|
|
262
591
|
/** Convenience shape for authoring an in-message image. */
|
|
@@ -279,10 +608,16 @@ interface MessageBodySugar {
|
|
|
279
608
|
/** Explicit content nodes; when present, wins over `text`/`images`. */
|
|
280
609
|
content?: ContentNode[];
|
|
281
610
|
}
|
|
611
|
+
/**
|
|
612
|
+
* Resolve a block's `text` sugar to `spans` (and recurse into attachments), so
|
|
613
|
+
* skins only ever read resolved inline content. Non-text blocks pass through.
|
|
614
|
+
*/
|
|
615
|
+
declare function normalizeContentNode(node: ContentNode): ContentNode;
|
|
282
616
|
/**
|
|
283
617
|
* Resolve a message's body sugar to content nodes. Explicit `content` is
|
|
284
|
-
* authoritative
|
|
285
|
-
* matching the "here's the toast:
|
|
618
|
+
* authoritative (block `text` sugar is normalized to spans); otherwise the text
|
|
619
|
+
* node (if any) comes first, then images — matching the "here's the toast:
|
|
620
|
+
* [image]" ordering in the spec example.
|
|
286
621
|
*/
|
|
287
622
|
declare function toContentNodes(body: MessageBodySugar): ContentNode[];
|
|
288
623
|
|
|
@@ -376,7 +711,13 @@ declare const readReceiptStepSchema: z.ZodObject<{
|
|
|
376
711
|
by: z.ZodOptional<z.ZodString>;
|
|
377
712
|
target: z.ZodOptional<z.ZodString>;
|
|
378
713
|
}, z.core.$strip>;
|
|
379
|
-
/**
|
|
714
|
+
/**
|
|
715
|
+
* A system / notice line — not a chat message. Skins render it distinctly: a
|
|
716
|
+
* centered muted notice (iMessage/WhatsApp/Slack "X joined #channel"), an agent
|
|
717
|
+
* tool-output line (Cursor/Claude Code `⎿ …`), a CI notice (Discord), etc. App
|
|
718
|
+
* "cards" are NOT system steps — model those as a `message` from an `app`
|
|
719
|
+
* participant carrying Block Kit content (header/section/context/actions/…).
|
|
720
|
+
*/
|
|
380
721
|
declare const systemStepSchema: z.ZodObject<{
|
|
381
722
|
id: z.ZodOptional<z.ZodString>;
|
|
382
723
|
instant: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -390,15 +731,6 @@ declare const systemStepSchema: z.ZodObject<{
|
|
|
390
731
|
content: z.ZodOptional<z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$ZodTypeInternals<ContentNode, unknown>>>>;
|
|
391
732
|
type: z.ZodLiteral<"system">;
|
|
392
733
|
from: z.ZodOptional<z.ZodString>;
|
|
393
|
-
card: z.ZodOptional<z.ZodString>;
|
|
394
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
395
|
-
label: z.ZodString;
|
|
396
|
-
href: z.ZodOptional<z.ZodString>;
|
|
397
|
-
variant: z.ZodOptional<z.ZodEnum<{
|
|
398
|
-
primary: "primary";
|
|
399
|
-
secondary: "secondary";
|
|
400
|
-
}>>;
|
|
401
|
-
}, z.core.$strip>>>;
|
|
402
734
|
}, z.core.$strip>;
|
|
403
735
|
/** An explicit pause in the timeline (formerly `beat`). */
|
|
404
736
|
declare const delayStepSchema: z.ZodObject<{
|
|
@@ -487,15 +819,6 @@ declare const timelineStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
487
819
|
content: z.ZodOptional<z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$ZodTypeInternals<ContentNode, unknown>>>>;
|
|
488
820
|
type: z.ZodLiteral<"system">;
|
|
489
821
|
from: z.ZodOptional<z.ZodString>;
|
|
490
|
-
card: z.ZodOptional<z.ZodString>;
|
|
491
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
492
|
-
label: z.ZodString;
|
|
493
|
-
href: z.ZodOptional<z.ZodString>;
|
|
494
|
-
variant: z.ZodOptional<z.ZodEnum<{
|
|
495
|
-
primary: "primary";
|
|
496
|
-
secondary: "secondary";
|
|
497
|
-
}>>;
|
|
498
|
-
}, z.core.$strip>>>;
|
|
499
822
|
}, z.core.$strip>, z.ZodObject<{
|
|
500
823
|
id: z.ZodOptional<z.ZodString>;
|
|
501
824
|
instant: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -584,15 +907,6 @@ declare const timelineSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
584
907
|
content: z.ZodOptional<z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$ZodTypeInternals<ContentNode, unknown>>>>;
|
|
585
908
|
type: z.ZodLiteral<"system">;
|
|
586
909
|
from: z.ZodOptional<z.ZodString>;
|
|
587
|
-
card: z.ZodOptional<z.ZodString>;
|
|
588
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
589
|
-
label: z.ZodString;
|
|
590
|
-
href: z.ZodOptional<z.ZodString>;
|
|
591
|
-
variant: z.ZodOptional<z.ZodEnum<{
|
|
592
|
-
primary: "primary";
|
|
593
|
-
secondary: "secondary";
|
|
594
|
-
}>>;
|
|
595
|
-
}, z.core.$strip>>>;
|
|
596
910
|
}, z.core.$strip>, z.ZodObject<{
|
|
597
911
|
id: z.ZodOptional<z.ZodString>;
|
|
598
912
|
instant: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -742,15 +1056,6 @@ declare const configSchema: z.ZodObject<{
|
|
|
742
1056
|
content: z.ZodOptional<z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$ZodTypeInternals<ContentNode, unknown>>>>;
|
|
743
1057
|
type: z.ZodLiteral<"system">;
|
|
744
1058
|
from: z.ZodOptional<z.ZodString>;
|
|
745
|
-
card: z.ZodOptional<z.ZodString>;
|
|
746
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
747
|
-
label: z.ZodString;
|
|
748
|
-
href: z.ZodOptional<z.ZodString>;
|
|
749
|
-
variant: z.ZodOptional<z.ZodEnum<{
|
|
750
|
-
primary: "primary";
|
|
751
|
-
secondary: "secondary";
|
|
752
|
-
}>>;
|
|
753
|
-
}, z.core.$strip>>>;
|
|
754
1059
|
}, z.core.$strip>, z.ZodObject<{
|
|
755
1060
|
id: z.ZodOptional<z.ZodString>;
|
|
756
1061
|
instant: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -793,4 +1098,4 @@ interface Diagnostic {
|
|
|
793
1098
|
*/
|
|
794
1099
|
declare function validateConfig(raw: unknown): Diagnostic[];
|
|
795
1100
|
|
|
796
|
-
export { type AssetMode, CONFIG_VERSION, type ComposerMode, type Config, type ConfigInput, type ContentNode, type Diagnostic, type FitMode, type ImageNode, type ImageSugar, type InlineNode, type MessageBodySugar, type Meta, type MetaInput, type Pacing, type PacingInput, type Participant, type ParticipantInput, type ParticipantKind, STEP_TYPES, type Severity, type Size, type SkinRef, type StepType, type TextNode, type ThemeMode, type TimelineStep, type TimelineStepInput, type UnknownContentNode, assetModeSchema, buildContentNodeSchema, composerModeSchema, composerTypeStepSchema, configJsonSchema, configSchema, contentNodeSchema, contentSchema, delayStepSchema, deleteStepSchema, editStepSchema, fitModeSchema, imageNodeSchema, imageSugarSchema, imageToContentNode, inlineCodeSchema, inlineEmojiSchema, inlineLinkSchema, inlineMentionSchema, inlineNodeSchema, inlineTextSchema, isKnownContentNodeType, knownContentNodeTypes, messageStepSchema, metaSchema, pacingSchema, parseInline, participantKindSchema, participantSchema, participantsSchema, reactionStepSchema, readReceiptStepSchema, registerContentNodeType, sendStepSchema, sizeSchema, skinRefSchema, systemStepSchema, textNodeSchema, textToContentNode, themeModeSchema, timelineSchema, timelineStepSchema, toContentNodes, typingStepSchema, validateConfig };
|
|
1101
|
+
export { type ActionsNode, type AssetMode, type AttachmentNode, type ButtonElement, CONFIG_VERSION, type ComposerMode, type Config, type ConfigInput, type ContentNode, type ContextElement, type ContextNode, type Diagnostic, type DividerNode, type FitMode, type HeaderNode, type ImageElement, type ImageNode, type ImageSugar, type InlineNode, type MessageBodySugar, type Meta, type MetaInput, type Pacing, type PacingInput, type Participant, type ParticipantInput, type ParticipantKind, STEP_TYPES, type SectionNode, type Severity, type Size, type SkinRef, type StepType, type TextNode, type ThemeMode, type TimelineStep, type TimelineStepInput, type UnknownContentNode, actionsNodeSchema, assetModeSchema, attachmentNodeSchema, buildContentNodeSchema, buttonElementSchema, composerModeSchema, composerTypeStepSchema, configJsonSchema, configSchema, contentNodeSchema, contentSchema, contextElementSchema, contextNodeSchema, contextTextElementSchema, delayStepSchema, deleteStepSchema, dividerNodeSchema, editStepSchema, fitModeSchema, headerNodeSchema, imageElementSchema, imageNodeSchema, imageSugarSchema, imageToContentNode, inlineBoldSchema, inlineCodeSchema, inlineEmojiSchema, inlineItalicSchema, inlineLinkSchema, inlineMentionSchema, inlineNodeSchema, inlineStrikeSchema, inlineTextSchema, isKnownContentNodeType, knownContentNodeTypes, messageStepSchema, metaSchema, normalizeContentNode, pacingSchema, parseInline, participantKindSchema, participantSchema, participantsSchema, reactionStepSchema, readReceiptStepSchema, registerContentNodeType, sectionFieldSchema, sectionNodeSchema, sendStepSchema, sizeSchema, skinRefSchema, systemStepSchema, textNodeSchema, textToContentNode, themeModeSchema, timelineSchema, timelineStepSchema, toContentNodes, typingStepSchema, validateConfig };
|