@typecaast/schema 0.2.1 → 0.4.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 +142 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +358 -47
- package/dist/index.d.ts +358 -47
- package/dist/index.js +127 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/typecaast.schema.json +820 -392
package/dist/index.d.cts
CHANGED
|
@@ -151,9 +151,11 @@ type PacingInput = z.input<typeof pacingSchema>;
|
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* Inline marks inside a text node. `text` runs carry plain content; the others
|
|
154
|
-
* are the recognized marks (`code`, `link`, `mention`, `emoji
|
|
155
|
-
*
|
|
156
|
-
* 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.
|
|
157
159
|
*/
|
|
158
160
|
declare const inlineTextSchema: z.ZodObject<{
|
|
159
161
|
type: z.ZodLiteral<"text">;
|
|
@@ -163,6 +165,18 @@ declare const inlineCodeSchema: z.ZodObject<{
|
|
|
163
165
|
type: z.ZodLiteral<"code">;
|
|
164
166
|
value: z.ZodString;
|
|
165
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>;
|
|
166
180
|
declare const inlineLinkSchema: z.ZodObject<{
|
|
167
181
|
type: z.ZodLiteral<"link">;
|
|
168
182
|
href: z.ZodString;
|
|
@@ -184,6 +198,15 @@ declare const inlineNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
184
198
|
}, z.core.$strip>, z.ZodObject<{
|
|
185
199
|
type: z.ZodLiteral<"code">;
|
|
186
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;
|
|
187
210
|
}, z.core.$strip>, z.ZodObject<{
|
|
188
211
|
type: z.ZodLiteral<"link">;
|
|
189
212
|
href: z.ZodString;
|
|
@@ -207,6 +230,15 @@ declare const textNodeSchema: z.ZodObject<{
|
|
|
207
230
|
}, z.core.$strip>, z.ZodObject<{
|
|
208
231
|
type: z.ZodLiteral<"code">;
|
|
209
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;
|
|
210
242
|
}, z.core.$strip>, z.ZodObject<{
|
|
211
243
|
type: z.ZodLiteral<"link">;
|
|
212
244
|
href: z.ZodString;
|
|
@@ -231,10 +263,305 @@ declare const imageNodeSchema: z.ZodObject<{
|
|
|
231
263
|
height: z.ZodOptional<z.ZodNumber>;
|
|
232
264
|
}, z.core.$strip>;
|
|
233
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 multi-line preformatted code block (Slack's fenced ``` block) — a monospaced
|
|
540
|
+
* box that preserves whitespace and newlines verbatim (used for tables, logs,
|
|
541
|
+
* snippets). Distinct from the inline `code` mark; `text` is **literal** and is
|
|
542
|
+
* never parsed for inline marks. `lang` is an optional language hint (unused by
|
|
543
|
+
* the current skins, reserved for future syntax highlighting).
|
|
544
|
+
*/
|
|
545
|
+
declare const codeBlockNodeSchema: z.ZodObject<{
|
|
546
|
+
type: z.ZodLiteral<"codeblock">;
|
|
547
|
+
text: z.ZodString;
|
|
548
|
+
lang: z.ZodOptional<z.ZodString>;
|
|
549
|
+
}, z.core.$strip>;
|
|
550
|
+
type CodeBlockNode = z.infer<typeof codeBlockNodeSchema>;
|
|
551
|
+
/**
|
|
552
|
+
* A legacy-style attachment: nested blocks rendered behind a colored left bar.
|
|
553
|
+
* `color` is any CSS color (defaults to a neutral bar). Recursive — its Zod
|
|
554
|
+
* schema lives in `content-registry.ts` (where the node union is built).
|
|
555
|
+
*/
|
|
556
|
+
interface AttachmentNode {
|
|
557
|
+
type: "attachment";
|
|
558
|
+
color?: string;
|
|
559
|
+
content: ContentNode[];
|
|
560
|
+
}
|
|
234
561
|
/**
|
|
235
562
|
* A content node whose `type` the runtime doesn't recognize. It validates
|
|
236
563
|
* leniently (only `type` is required) and is skipped by skins that don't handle
|
|
237
|
-
* it — so future node types (`
|
|
564
|
+
* it — so future node types (`linkPreview`, `videoEmbed`, …) slot in without
|
|
238
565
|
* breaking older runtimes or bumping the schema version.
|
|
239
566
|
*/
|
|
240
567
|
interface UnknownContentNode {
|
|
@@ -242,8 +569,14 @@ interface UnknownContentNode {
|
|
|
242
569
|
[key: string]: unknown;
|
|
243
570
|
}
|
|
244
571
|
/** The body of a message: an ordered list of content nodes. */
|
|
245
|
-
type ContentNode = TextNode | ImageNode | UnknownContentNode;
|
|
572
|
+
type ContentNode = TextNode | ImageNode | HeaderNode | SectionNode | ContextNode | DividerNode | ActionsNode | CodeBlockNode | AttachmentNode | UnknownContentNode;
|
|
246
573
|
|
|
574
|
+
/**
|
|
575
|
+
* A legacy-style attachment node — nested blocks behind a colored left bar.
|
|
576
|
+
* Recursive (its `content` is the full node array), so it's defined here where
|
|
577
|
+
* `contentSchema` is in scope and wrapped in `z.lazy` to defer the reference.
|
|
578
|
+
*/
|
|
579
|
+
declare const attachmentNodeSchema: z.ZodType<AttachmentNode>;
|
|
247
580
|
/** Register (or override) the strict schema for a content node type. */
|
|
248
581
|
declare function registerContentNodeType(type: string, schema: z.ZodTypeAny): void;
|
|
249
582
|
/** The content node types the runtime validates strictly. */
|
|
@@ -262,8 +595,10 @@ declare const contentSchema: z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$
|
|
|
262
595
|
|
|
263
596
|
/**
|
|
264
597
|
* Parse a plain authoring string into inline nodes, extracting inline `code`,
|
|
265
|
-
* links, and
|
|
266
|
-
* fine
|
|
598
|
+
* `bold`/`italic`/`strike`, links, and mentions. Emoji are left inside text
|
|
599
|
+
* runs (they render fine; a dedicated emoji mark can be authored explicitly).
|
|
600
|
+
* A `<@id>` mention carries its `id` and a placeholder label; the engine
|
|
601
|
+
* resolves the label to the participant's display name at compile time.
|
|
267
602
|
*/
|
|
268
603
|
declare function parseInline(text: string): InlineNode[];
|
|
269
604
|
/** Convenience shape for authoring an in-message image. */
|
|
@@ -286,10 +621,16 @@ interface MessageBodySugar {
|
|
|
286
621
|
/** Explicit content nodes; when present, wins over `text`/`images`. */
|
|
287
622
|
content?: ContentNode[];
|
|
288
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* Resolve a block's `text` sugar to `spans` (and recurse into attachments), so
|
|
626
|
+
* skins only ever read resolved inline content. Non-text blocks pass through.
|
|
627
|
+
*/
|
|
628
|
+
declare function normalizeContentNode(node: ContentNode): ContentNode;
|
|
289
629
|
/**
|
|
290
630
|
* Resolve a message's body sugar to content nodes. Explicit `content` is
|
|
291
|
-
* authoritative
|
|
292
|
-
* matching the "here's the toast:
|
|
631
|
+
* authoritative (block `text` sugar is normalized to spans); otherwise the text
|
|
632
|
+
* node (if any) comes first, then images — matching the "here's the toast:
|
|
633
|
+
* [image]" ordering in the spec example.
|
|
293
634
|
*/
|
|
294
635
|
declare function toContentNodes(body: MessageBodySugar): ContentNode[];
|
|
295
636
|
|
|
@@ -383,7 +724,13 @@ declare const readReceiptStepSchema: z.ZodObject<{
|
|
|
383
724
|
by: z.ZodOptional<z.ZodString>;
|
|
384
725
|
target: z.ZodOptional<z.ZodString>;
|
|
385
726
|
}, z.core.$strip>;
|
|
386
|
-
/**
|
|
727
|
+
/**
|
|
728
|
+
* A system / notice line — not a chat message. Skins render it distinctly: a
|
|
729
|
+
* centered muted notice (iMessage/WhatsApp/Slack "X joined #channel"), an agent
|
|
730
|
+
* tool-output line (Cursor/Claude Code `⎿ …`), a CI notice (Discord), etc. App
|
|
731
|
+
* "cards" are NOT system steps — model those as a `message` from an `app`
|
|
732
|
+
* participant carrying Block Kit content (header/section/context/actions/…).
|
|
733
|
+
*/
|
|
387
734
|
declare const systemStepSchema: z.ZodObject<{
|
|
388
735
|
id: z.ZodOptional<z.ZodString>;
|
|
389
736
|
instant: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -397,15 +744,6 @@ declare const systemStepSchema: z.ZodObject<{
|
|
|
397
744
|
content: z.ZodOptional<z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$ZodTypeInternals<ContentNode, unknown>>>>;
|
|
398
745
|
type: z.ZodLiteral<"system">;
|
|
399
746
|
from: z.ZodOptional<z.ZodString>;
|
|
400
|
-
card: z.ZodOptional<z.ZodString>;
|
|
401
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
402
|
-
label: z.ZodString;
|
|
403
|
-
href: z.ZodOptional<z.ZodString>;
|
|
404
|
-
variant: z.ZodOptional<z.ZodEnum<{
|
|
405
|
-
primary: "primary";
|
|
406
|
-
secondary: "secondary";
|
|
407
|
-
}>>;
|
|
408
|
-
}, z.core.$strip>>>;
|
|
409
747
|
}, z.core.$strip>;
|
|
410
748
|
/** An explicit pause in the timeline (formerly `beat`). */
|
|
411
749
|
declare const delayStepSchema: z.ZodObject<{
|
|
@@ -494,15 +832,6 @@ declare const timelineStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
494
832
|
content: z.ZodOptional<z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$ZodTypeInternals<ContentNode, unknown>>>>;
|
|
495
833
|
type: z.ZodLiteral<"system">;
|
|
496
834
|
from: z.ZodOptional<z.ZodString>;
|
|
497
|
-
card: z.ZodOptional<z.ZodString>;
|
|
498
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
499
|
-
label: z.ZodString;
|
|
500
|
-
href: z.ZodOptional<z.ZodString>;
|
|
501
|
-
variant: z.ZodOptional<z.ZodEnum<{
|
|
502
|
-
primary: "primary";
|
|
503
|
-
secondary: "secondary";
|
|
504
|
-
}>>;
|
|
505
|
-
}, z.core.$strip>>>;
|
|
506
835
|
}, z.core.$strip>, z.ZodObject<{
|
|
507
836
|
id: z.ZodOptional<z.ZodString>;
|
|
508
837
|
instant: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -591,15 +920,6 @@ declare const timelineSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
591
920
|
content: z.ZodOptional<z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$ZodTypeInternals<ContentNode, unknown>>>>;
|
|
592
921
|
type: z.ZodLiteral<"system">;
|
|
593
922
|
from: z.ZodOptional<z.ZodString>;
|
|
594
|
-
card: z.ZodOptional<z.ZodString>;
|
|
595
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
596
|
-
label: z.ZodString;
|
|
597
|
-
href: z.ZodOptional<z.ZodString>;
|
|
598
|
-
variant: z.ZodOptional<z.ZodEnum<{
|
|
599
|
-
primary: "primary";
|
|
600
|
-
secondary: "secondary";
|
|
601
|
-
}>>;
|
|
602
|
-
}, z.core.$strip>>>;
|
|
603
923
|
}, z.core.$strip>, z.ZodObject<{
|
|
604
924
|
id: z.ZodOptional<z.ZodString>;
|
|
605
925
|
instant: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -749,15 +1069,6 @@ declare const configSchema: z.ZodObject<{
|
|
|
749
1069
|
content: z.ZodOptional<z.ZodArray<z.ZodType<ContentNode, unknown, z.core.$ZodTypeInternals<ContentNode, unknown>>>>;
|
|
750
1070
|
type: z.ZodLiteral<"system">;
|
|
751
1071
|
from: z.ZodOptional<z.ZodString>;
|
|
752
|
-
card: z.ZodOptional<z.ZodString>;
|
|
753
|
-
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
754
|
-
label: z.ZodString;
|
|
755
|
-
href: z.ZodOptional<z.ZodString>;
|
|
756
|
-
variant: z.ZodOptional<z.ZodEnum<{
|
|
757
|
-
primary: "primary";
|
|
758
|
-
secondary: "secondary";
|
|
759
|
-
}>>;
|
|
760
|
-
}, z.core.$strip>>>;
|
|
761
1072
|
}, z.core.$strip>, z.ZodObject<{
|
|
762
1073
|
id: z.ZodOptional<z.ZodString>;
|
|
763
1074
|
instant: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -800,4 +1111,4 @@ interface Diagnostic {
|
|
|
800
1111
|
*/
|
|
801
1112
|
declare function validateConfig(raw: unknown): Diagnostic[];
|
|
802
1113
|
|
|
803
|
-
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 };
|
|
1114
|
+
export { type ActionsNode, type AssetMode, type AttachmentNode, type ButtonElement, CONFIG_VERSION, type CodeBlockNode, 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, codeBlockNodeSchema, 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 };
|