@typecaast/schema 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +44 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -111
- package/dist/index.d.ts +82 -111
- package/dist/index.js +43 -22
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
- package/typecaast.schema.json +33 -91
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var sizeSchema = z.object({
|
|
|
6
6
|
height: z.number().int().positive()
|
|
7
7
|
});
|
|
8
8
|
var fitModeSchema = z.enum(["reflow", "scale", "fixed"]);
|
|
9
|
+
var composerModeSchema = z.enum(["auto", "always", "never"]);
|
|
9
10
|
var themeModeSchema = z.enum(["light", "dark", "auto"]);
|
|
10
11
|
var assetModeSchema = z.enum(["inline", "url"]);
|
|
11
12
|
var skinRefSchema = z.object({
|
|
@@ -23,7 +24,15 @@ var metaSchema = z.object({
|
|
|
23
24
|
seed: z.number().int().default(42),
|
|
24
25
|
/** Canvas background: `"transparent"` or any CSS color. */
|
|
25
26
|
background: z.string().default("transparent"),
|
|
26
|
-
assets: assetModeSchema.default("inline")
|
|
27
|
+
assets: assetModeSchema.default("inline"),
|
|
28
|
+
/** Reply-box visibility (see `composerModeSchema`). */
|
|
29
|
+
composer: composerModeSchema.default("auto"),
|
|
30
|
+
/**
|
|
31
|
+
* Auto-replay when the timeline reaches the end. Honored by the builder
|
|
32
|
+
* preview and by `<Typecaast>` when the consumer doesn't pass an explicit
|
|
33
|
+
* `loop` prop.
|
|
34
|
+
*/
|
|
35
|
+
loop: z.boolean().default(false)
|
|
27
36
|
});
|
|
28
37
|
var participantKindSchema = z.enum(["person", "app"]);
|
|
29
38
|
var participantSchema = z.object({
|
|
@@ -44,10 +53,6 @@ var pacingSchema = z.object({
|
|
|
44
53
|
readingWpm: z.number().positive().default(240),
|
|
45
54
|
/** Chars/sec for composer typing + sender typing duration. */
|
|
46
55
|
typingCps: z.number().positive().default(14),
|
|
47
|
-
/** Lag between a message and a reaction landing. */
|
|
48
|
-
reactionDelayMs: z.number().nonnegative().default(700),
|
|
49
|
-
/** Baseline beat between messages. */
|
|
50
|
-
interMessageGapMs: z.number().nonnegative().default(900),
|
|
51
56
|
/** ±fraction of seeded jitter so pacing doesn't feel robotic (0–1). */
|
|
52
57
|
humanize: z.number().min(0).max(1).default(0.15),
|
|
53
58
|
/** Delay before the first event. */
|
|
@@ -174,12 +179,8 @@ function toContentNodes(body) {
|
|
|
174
179
|
var stepBaseShape = {
|
|
175
180
|
/** Optional id so reactions/edits/deletes can target this step's message. */
|
|
176
181
|
id: z.string().optional(),
|
|
177
|
-
/** Override the computed gap before this step (ms, relative to the prior). */
|
|
178
|
-
delay: z.number().optional(),
|
|
179
182
|
/** Reveal with no animation and no computed delay. */
|
|
180
|
-
instant: z.boolean().optional()
|
|
181
|
-
/** Extra pause held after this step completes (ms). */
|
|
182
|
-
holdAfter: z.number().nonnegative().optional()
|
|
183
|
+
instant: z.boolean().optional()
|
|
183
184
|
};
|
|
184
185
|
var imageSugarSchema = z.object({
|
|
185
186
|
src: z.string(),
|
|
@@ -205,9 +206,14 @@ var messageStepSchema = z.object({
|
|
|
205
206
|
});
|
|
206
207
|
var reactionStepSchema = z.object({
|
|
207
208
|
type: z.literal("reaction"),
|
|
208
|
-
|
|
209
|
+
/** Message id to react to. Defaults to `$prev` (the most-recent message). */
|
|
210
|
+
target: z.string().optional(),
|
|
209
211
|
emoji: z.string(),
|
|
212
|
+
/** Emoji shortcode without colons, e.g. `"eyes"` — shown in skin tooltips. */
|
|
213
|
+
shortcode: z.string().optional(),
|
|
210
214
|
from: z.string().optional(),
|
|
215
|
+
/** Gap from when the target appears, before the reaction lands (ms). */
|
|
216
|
+
delay: z.number().nonnegative().optional(),
|
|
211
217
|
...stepBaseShape
|
|
212
218
|
});
|
|
213
219
|
var typingStepSchema = z.object({
|
|
@@ -231,13 +237,15 @@ var sendStepSchema = z.object({
|
|
|
231
237
|
});
|
|
232
238
|
var editStepSchema = z.object({
|
|
233
239
|
type: z.literal("edit"),
|
|
234
|
-
|
|
240
|
+
/** Message id to edit. Defaults to `$prev` (the most-recent message). */
|
|
241
|
+
target: z.string().optional(),
|
|
235
242
|
...bodyShape,
|
|
236
243
|
...stepBaseShape
|
|
237
244
|
});
|
|
238
245
|
var deleteStepSchema = z.object({
|
|
239
246
|
type: z.literal("delete"),
|
|
240
|
-
|
|
247
|
+
/** Message id to delete. Defaults to `$prev` (the most-recent message). */
|
|
248
|
+
target: z.string().optional(),
|
|
241
249
|
...stepBaseShape
|
|
242
250
|
});
|
|
243
251
|
var readReceiptStepSchema = z.object({
|
|
@@ -251,12 +259,25 @@ var systemStepSchema = z.object({
|
|
|
251
259
|
from: z.string().optional(),
|
|
252
260
|
/** Named card variant the skin renders, e.g. `"pr-opened"`. */
|
|
253
261
|
card: z.string().optional(),
|
|
254
|
-
|
|
262
|
+
/**
|
|
263
|
+
* Buttons rendered alongside the system message. When `href` is set the
|
|
264
|
+
* skin should render the button as a link that opens in a new tab; when
|
|
265
|
+
* absent it should be visibly inert (e.g. `cursor: not-allowed`). `variant`
|
|
266
|
+
* controls visual emphasis; if omitted the first action defaults to
|
|
267
|
+
* `"primary"` and the rest to `"secondary"`.
|
|
268
|
+
*/
|
|
269
|
+
actions: z.array(
|
|
270
|
+
z.object({
|
|
271
|
+
label: z.string(),
|
|
272
|
+
href: z.string().optional(),
|
|
273
|
+
variant: z.enum(["primary", "secondary"]).optional()
|
|
274
|
+
})
|
|
275
|
+
).optional(),
|
|
255
276
|
...bodyShape,
|
|
256
277
|
...stepBaseShape
|
|
257
278
|
});
|
|
258
|
-
var
|
|
259
|
-
type: z.literal("
|
|
279
|
+
var delayStepSchema = z.object({
|
|
280
|
+
type: z.literal("delay"),
|
|
260
281
|
duration: z.number().nonnegative(),
|
|
261
282
|
...stepBaseShape
|
|
262
283
|
});
|
|
@@ -270,7 +291,7 @@ var timelineStepSchema = z.discriminatedUnion("type", [
|
|
|
270
291
|
deleteStepSchema,
|
|
271
292
|
readReceiptStepSchema,
|
|
272
293
|
systemStepSchema,
|
|
273
|
-
|
|
294
|
+
delayStepSchema
|
|
274
295
|
]);
|
|
275
296
|
var timelineSchema = z.array(timelineStepSchema);
|
|
276
297
|
var STEP_TYPES = [
|
|
@@ -283,7 +304,7 @@ var STEP_TYPES = [
|
|
|
283
304
|
"delete",
|
|
284
305
|
"readReceipt",
|
|
285
306
|
"system",
|
|
286
|
-
"
|
|
307
|
+
"delay"
|
|
287
308
|
];
|
|
288
309
|
var CONFIG_VERSION = 1;
|
|
289
310
|
var configSchema = z.object({
|
|
@@ -398,14 +419,14 @@ function validateConfig(raw) {
|
|
|
398
419
|
}
|
|
399
420
|
if (step.type === "reaction" || step.type === "edit" || step.type === "delete") {
|
|
400
421
|
const target = step.target;
|
|
401
|
-
if (target === "$prev") {
|
|
422
|
+
if (!target || target === "$prev") {
|
|
402
423
|
if (priorMessages === 0) {
|
|
403
424
|
diagnostics.push({
|
|
404
425
|
code: "W_NO_PREV",
|
|
405
426
|
severity: "warning",
|
|
406
|
-
message:
|
|
427
|
+
message: "Default target has no preceding message.",
|
|
407
428
|
location: `${loc}.target`,
|
|
408
|
-
hint: "Place this after a message, or
|
|
429
|
+
hint: "Place this after a message, or set a target message id."
|
|
409
430
|
});
|
|
410
431
|
}
|
|
411
432
|
} else if (!messageIds.has(target)) {
|
|
@@ -423,6 +444,6 @@ function validateConfig(raw) {
|
|
|
423
444
|
return diagnostics;
|
|
424
445
|
}
|
|
425
446
|
|
|
426
|
-
export { CONFIG_VERSION, STEP_TYPES, assetModeSchema,
|
|
447
|
+
export { CONFIG_VERSION, STEP_TYPES, 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 };
|
|
427
448
|
//# sourceMappingURL=index.js.map
|
|
428
449
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/meta.ts","../src/participants.ts","../src/pacing.ts","../src/content-nodes.ts","../src/content-registry.ts","../src/content-sugar.ts","../src/timeline.ts","../src/config.ts","../src/validate.ts"],"names":["z"],"mappings":";;;AAGO,IAAM,UAAA,GAAa,EAAE,MAAA,CAAO;AAAA,EACjC,OAAO,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA,EACjC,QAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA;AAC3B,CAAC;AASM,IAAM,gBAAgB,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,OAAA,EAAS,OAAO,CAAC;AAQzD,IAAM,kBAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,OAAA,EAAS,MAAA,EAAQ,MAAM,CAAC;AAQxD,IAAM,kBAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,KAAK,CAAC;AAIhD,IAAM,aAAA,GAAgB,EAAE,MAAA,CAAO;AAAA,EACpC,EAAA,EAAI,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,OAAA,EAAS,CAAA,CAAE,MAAA,CAAO,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,OAAA,EAAS,CAAA,CAAE,QAAA;AAC7C,C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ACN,QAAA,EAAU,SAAA;AAAA,YACV,OAAA,EAAS,0CAAA;AAAA,YACT,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,YAChB,IAAA,EAAM;AAAA,WACP,CAAA;AAAA,QACH;AAAA,MACF,CAAA,MAAA,IAAW,CAAC,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA,EAAG;AAClC,QAAA,WAAA,CAAY,IAAA,CAAK;AAAA,UACf,IAAA,EAAM,UAAA;AAAA,UACN,QAAA,EAAU,SAAA;AAAA,UACV,OAAA,EAAS,WAAW,MAAM,CAAA,kCAAA,CAAA;AAAA,UAC1B,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,UAChB,IAAA,EAAM;AAAA,SACP,CAAA;AAAA,MACH;AAAA,IACF;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,SAAA,IAAa,IAAA,CAAK,SAAS,QAAA,EAAU,aAAA,EAAA;AAAA,EACzD,CAAC,CAAA;AAED,EAAA,OAAO,WAAA;AACT","file":"index.js","sourcesContent":["import { z } from \"zod\";\n\n/** A pixel dimension pair (authoring reference; the exact frame for video). */\nexport const sizeSchema = z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n});\nexport type Size = z.infer<typeof sizeSchema>;\n\n/**\n * How the rendered conversation fills its container.\n * - `reflow`: container queries + ResizeObserver; bubbles re-wrap on small screens.\n * - `scale`: CSS transform scale-to-fit, preserves exact layout.\n * - `fixed`: clip to canvas.\n */\nexport const fitModeSchema = z.enum([\"reflow\", \"scale\", \"fixed\"]);\nexport type FitMode = z.infer<typeof fitModeSchema>;\n\n/**\n * Color theme. `auto` inherits the host page's `prefers-color-scheme` (live\n * preview) and falls back to `light`; video export resolves `auto` to a\n * concrete mode and defaults to `light` when unspecified.\n */\nexport const themeModeSchema = z.enum([\"light\", \"dark\", \"auto\"]);\nexport type ThemeMode = z.infer<typeof themeModeSchema>;\n\n/**\n * Asset resolution strategy.\n * - `inline`: embed images as data URLs (self-contained config; default).\n * - `url`: reference hosted images (smaller config; user hosts their own).\n */\nexport const assetModeSchema = z.enum([\"inline\", \"url\"]);\nexport type AssetMode = z.infer<typeof assetModeSchema>;\n\n/** Reference to a skin plus its skin-specific options (validated by the skin). */\nexport const skinRefSchema = z.object({\n id: z.string().min(1),\n options: z.record(z.string(), z.unknown()).optional(),\n});\nexport type SkinRef = z.infer<typeof skinRefSchema>;\n\n/** Top-level rendering/authoring metadata. */\nexport const metaSchema = z.object({\n /** Authoring reference size; fixed frame for video. */\n canvas: sizeSchema,\n fps: z.number().int().positive().default(30),\n fit: fitModeSchema.default(\"reflow\"),\n theme: themeModeSchema.default(\"auto\"),\n skin: skinRefSchema,\n /** Seed for all deterministic jitter (no `Math.random`). */\n seed: z.number().int().default(42),\n /** Canvas background: `\"transparent\"` or any CSS color. */\n background: z.string().default(\"transparent\"),\n assets: assetModeSchema.default(\"inline\"),\n});\n\n/** `meta` as it appears after parsing (defaults applied). */\nexport type Meta = z.infer<typeof metaSchema>;\n/** `meta` as authored (fields with defaults are optional). */\nexport type MetaInput = z.input<typeof metaSchema>;\n","import { z } from \"zod\";\n\n/** Whether a participant is a human or an app/bot (changes how skins render it). */\nexport const participantKindSchema = z.enum([\"person\", \"app\"]);\nexport type ParticipantKind = z.infer<typeof participantKindSchema>;\n\n/** A speaker in the conversation. */\nexport const participantSchema = z.object({\n /** Stable id referenced by timeline steps (`from`, `target`, …). */\n id: z.string().min(1),\n name: z.string().min(1),\n /** Avatar asset (data URL or referenced URL per `meta.assets`). */\n avatar: z.string().optional(),\n /** Accent color (CSS color) some skins use for the author. */\n color: z.string().optional(),\n /** The viewer — rendered as the \"self\" side and the composer's author. */\n isSelf: z.boolean().optional(),\n kind: participantKindSchema.default(\"person\"),\n});\nexport type Participant = z.infer<typeof participantSchema>;\nexport type ParticipantInput = z.input<typeof participantSchema>;\n\nexport const participantsSchema = z.array(participantSchema);\n","import { z } from \"zod\";\n\n/**\n * Global auto-pacing defaults. Every value is overridable per step in the\n * timeline; the engine computes delays/durations from these and bakes in\n * seeded, deterministic jitter (`humanize`).\n */\nexport const pacingSchema = z.object({\n /** Gap before an incoming message ≈ reading time of the prior message. */\n readingWpm: z.number().positive().default(240),\n /** Chars/sec for composer typing + sender typing duration. */\n typingCps: z.number().positive().default(14),\n /** Lag between a message and a reaction landing. */\n reactionDelayMs: z.number().nonnegative().default(700),\n /** Baseline beat between messages. */\n interMessageGapMs: z.number().nonnegative().default(900),\n /** ±fraction of seeded jitter so pacing doesn't feel robotic (0–1). */\n humanize: z.number().min(0).max(1).default(0.15),\n /** Delay before the first event. */\n startDelayMs: z.number().nonnegative().default(400),\n});\nexport type Pacing = z.infer<typeof pacingSchema>;\nexport type PacingInput = z.input<typeof pacingSchema>;\n","import { z } from \"zod\";\n\n/**\n * Inline marks inside a text node. `text` runs carry plain content; the others\n * are the recognized marks (`code`, `link`, `mention`, `emoji`). The set is\n * intentionally small in v1 — new marks can be added without a schema-version\n * bump (unknown content node types are handled leniently; see the registry).\n */\nexport const inlineTextSchema = z.object({\n type: z.literal(\"text\"),\n value: z.string(),\n});\nexport const inlineCodeSchema = z.object({\n type: z.literal(\"code\"),\n value: z.string(),\n});\nexport const inlineLinkSchema = z.object({\n type: z.literal(\"link\"),\n href: z.string(),\n label: z.string().optional(),\n});\nexport const inlineMentionSchema = z.object({\n type: z.literal(\"mention\"),\n /** Display label as authored, e.g. `\"@PostHog\"`. */\n label: z.string(),\n /** Resolved participant id, filled when the mention binds to a participant. */\n id: z.string().optional(),\n});\nexport const inlineEmojiSchema = z.object({\n type: z.literal(\"emoji\"),\n /** The rendered glyph, e.g. `\"🦔\"`. */\n value: z.string(),\n /** Optional shortcode, e.g. `\"hedgehog\"`. */\n shortcode: z.string().optional(),\n});\n\nexport const inlineNodeSchema = z.discriminatedUnion(\"type\", [\n inlineTextSchema,\n inlineCodeSchema,\n inlineLinkSchema,\n inlineMentionSchema,\n inlineEmojiSchema,\n]);\nexport type InlineNode = z.infer<typeof inlineNodeSchema>;\n\n/** A block of inline content. */\nexport const textNodeSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema),\n});\nexport type TextNode = z.infer<typeof textNodeSchema>;\n\n/** An in-message image (same hosting model as avatars, per `meta.assets`). */\nexport const imageNodeSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\nexport type ImageNode = z.infer<typeof imageNodeSchema>;\n\n/**\n * A content node whose `type` the runtime doesn't recognize. It validates\n * leniently (only `type` is required) and is skipped by skins that don't handle\n * it — so future node types (`attachment`, `linkPreview`, …) slot in without\n * breaking older runtimes or bumping the schema version.\n */\nexport interface UnknownContentNode {\n type: string;\n [key: string]: unknown;\n}\n\n/** The body of a message: an ordered list of content nodes. */\nexport type ContentNode = TextNode | ImageNode | UnknownContentNode;\n","import { z } from \"zod\";\nimport {\n imageNodeSchema,\n textNodeSchema,\n type ContentNode,\n} from \"./content-nodes.js\";\n\n/**\n * The content-type registry. Each message body node has a `type` resolved\n * through here. v1 registers `text` and `image`; additional types can be\n * registered (with their own strict schema) without a schema-version bump.\n *\n * Nodes whose `type` is **not** registered validate leniently (only `type` is\n * required) and are skipped by skins that don't handle them. Nodes whose `type`\n * **is** registered must satisfy that type's schema — so a malformed `text`\n * node is an error rather than silently passing through the lenient path.\n */\nconst registry = new Map<string, z.ZodTypeAny>([\n [\"text\", textNodeSchema],\n [\"image\", imageNodeSchema],\n]);\n\n/** Register (or override) the strict schema for a content node type. */\nexport function registerContentNodeType(\n type: string,\n schema: z.ZodTypeAny,\n): void {\n registry.set(type, schema);\n}\n\n/** The content node types the runtime validates strictly. */\nexport function knownContentNodeTypes(): string[] {\n return [...registry.keys()];\n}\n\nexport function isKnownContentNodeType(type: string): boolean {\n return registry.has(type);\n}\n\n/** Accepts any object with a string `type` that isn't a registered type. */\nconst lenientUnknownNodeSchema = z\n .looseObject({ type: z.string() })\n .refine((node) => !registry.has(node.type), {\n message: \"malformed content node for a registered type\",\n });\n\n/**\n * Build a content-node schema from the current registry state. Call this after\n * registering a new type to pick it up; `contentNodeSchema` below is the\n * default built from the v1 registry (`text` + `image`).\n */\nexport function buildContentNodeSchema(): z.ZodType<ContentNode> {\n return z.union([\n ...registry.values(),\n lenientUnknownNodeSchema,\n ]) as unknown as z.ZodType<ContentNode>;\n}\n\n/** Default content-node schema (text + image + lenient unknown). */\nexport const contentNodeSchema = buildContentNodeSchema();\n\n/** A message body: an ordered array of content nodes. */\nexport const contentSchema = z.array(contentNodeSchema);\n","import type {\n ContentNode,\n ImageNode,\n InlineNode,\n TextNode,\n} from \"./content-nodes.js\";\n\n/**\n * Matches an inline mark: a backtick code span, an http(s) link, or an\n * `@mention`. Everything else becomes plain text runs.\n */\nconst INLINE_TOKEN = /`([^`]+)`|(https?:\\/\\/[^\\s]+)|(@[A-Za-z0-9_][\\w.-]*)/g;\n\n/**\n * Parse a plain authoring string into inline nodes, extracting inline `code`,\n * links, and `@mentions`. Emoji are left inside text runs in v1 (they render\n * fine and a dedicated emoji mark can be authored explicitly).\n */\nexport function parseInline(text: string): InlineNode[] {\n if (text.length === 0) return [];\n const spans: InlineNode[] = [];\n const re = new RegExp(INLINE_TOKEN.source, \"g\");\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = re.exec(text)) !== null) {\n const matchText = match[0] ?? \"\";\n if (match.index > lastIndex) {\n spans.push({ type: \"text\", value: text.slice(lastIndex, match.index) });\n }\n if (match[1] !== undefined) {\n spans.push({ type: \"code\", value: match[1] });\n } else if (match[2] !== undefined) {\n spans.push({ type: \"link\", href: match[2] });\n } else if (match[3] !== undefined) {\n spans.push({ type: \"mention\", label: match[3] });\n }\n lastIndex = match.index + matchText.length;\n }\n if (lastIndex < text.length) {\n spans.push({ type: \"text\", value: text.slice(lastIndex) });\n }\n return spans;\n}\n\n/** Convenience shape for authoring an in-message image. */\nexport interface ImageSugar {\n src: string;\n alt?: string;\n width?: number;\n height?: number;\n}\n\n/** `text` string → a single text content node. */\nexport function textToContentNode(text: string): TextNode {\n return { type: \"text\", spans: parseInline(text) };\n}\n\n/** `image` sugar → an image content node (drops undefined optionals). */\nexport function imageToContentNode(image: ImageSugar): ImageNode {\n const node: ImageNode = { type: \"image\", src: image.src };\n if (image.alt !== undefined) node.alt = image.alt;\n if (image.width !== undefined) node.width = image.width;\n if (image.height !== undefined) node.height = image.height;\n return node;\n}\n\n/** The sugar fields a message may carry instead of explicit `content`. */\nexport interface MessageBodySugar {\n /** Authored text (parsed into inline marks). */\n text?: string;\n /** In-message images, rendered after the text. */\n images?: ImageSugar[];\n /** Explicit content nodes; when present, wins over `text`/`images`. */\n content?: ContentNode[];\n}\n\n/**\n * Resolve a message's body sugar to content nodes. Explicit `content` is\n * authoritative; otherwise the text node (if any) comes first, then images —\n * matching the \"here's the toast: [image]\" ordering in the spec example.\n */\nexport function toContentNodes(body: MessageBodySugar): ContentNode[] {\n if (body.content) return body.content;\n const nodes: ContentNode[] = [];\n if (body.text !== undefined && body.text.length > 0) {\n nodes.push(textToContentNode(body.text));\n }\n if (body.images) {\n for (const image of body.images) nodes.push(imageToContentNode(image));\n }\n return nodes;\n}\n","import { z } from \"zod\";\nimport { contentSchema } from \"./content-registry.js\";\n\n/**\n * Per-step overrides shared by every step. The engine computes timing from the\n * pacing model; these win over the computed values.\n */\nconst stepBaseShape = {\n /** Optional id so reactions/edits/deletes can target this step's message. */\n id: z.string().optional(),\n /** Override the computed gap before this step (ms, relative to the prior). */\n delay: z.number().optional(),\n /** Reveal with no animation and no computed delay. */\n instant: z.boolean().optional(),\n /** Extra pause held after this step completes (ms). */\n holdAfter: z.number().nonnegative().optional(),\n};\n\n/** Authoring sugar for an in-message image (compiled to an image node). */\nexport const imageSugarSchema = z.object({\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\n\n/** Message-body sugar fields; `content` (explicit nodes) wins when present. */\nconst bodyShape = {\n text: z.string().optional(),\n images: z.array(imageSugarSchema).optional(),\n content: contentSchema.optional(),\n};\n\n/** Optional typing indicator preceding a message. */\nconst messageTypingSchema = z.union([\n z.boolean(),\n z.object({ showTypingFor: z.number().nonnegative().optional() }),\n]);\n\n/** An incoming message, optionally preceded by a typing indicator. */\nexport const messageStepSchema = z.object({\n type: z.literal(\"message\"),\n from: z.string(),\n typing: messageTypingSchema.optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** A reaction landing on a target message (`$prev` or a message id). */\nexport const reactionStepSchema = z.object({\n type: z.literal(\"reaction\"),\n target: z.string(),\n emoji: z.string(),\n from: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** A standalone typing indicator (no message necessarily follows). */\nexport const typingStepSchema = z.object({\n type: z.literal(\"typing\"),\n from: z.string(),\n showTypingFor: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** The self participant typing into the composer, char by char. */\nexport const composerTypeStepSchema = z.object({\n type: z.literal(\"composerType\"),\n from: z.string(),\n text: z.string(),\n /** Override the computed typing duration (ms). */\n typingDuration: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** Commit the composer's current text to the thread. */\nexport const sendStepSchema = z.object({\n type: z.literal(\"send\"),\n from: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** Edit a previously sent message's body. */\nexport const editStepSchema = z.object({\n type: z.literal(\"edit\"),\n target: z.string(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** Delete a previously sent message. */\nexport const deleteStepSchema = z.object({\n type: z.literal(\"delete\"),\n target: z.string(),\n ...stepBaseShape,\n});\n\n/** A read receipt (optionally by a participant, optionally up to a message). */\nexport const readReceiptStepSchema = z.object({\n type: z.literal(\"readReceipt\"),\n by: z.string().optional(),\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** An app/system card (e.g. \"Pull request opened\" with action buttons). */\nexport const systemStepSchema = z.object({\n type: z.literal(\"system\"),\n from: z.string().optional(),\n /** Named card variant the skin renders, e.g. `\"pr-opened\"`. */\n card: z.string().optional(),\n actions: z\n .array(z.object({ label: z.string(), href: z.string().optional() }))\n .optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** An explicit pause in the timeline. */\nexport const beatStepSchema = z.object({\n type: z.literal(\"beat\"),\n duration: z.number().nonnegative(),\n ...stepBaseShape,\n});\n\nexport const timelineStepSchema = z.discriminatedUnion(\"type\", [\n messageStepSchema,\n reactionStepSchema,\n typingStepSchema,\n composerTypeStepSchema,\n sendStepSchema,\n editStepSchema,\n deleteStepSchema,\n readReceiptStepSchema,\n systemStepSchema,\n beatStepSchema,\n]);\nexport type TimelineStep = z.infer<typeof timelineStepSchema>;\nexport type TimelineStepInput = z.input<typeof timelineStepSchema>;\n\nexport const timelineSchema = z.array(timelineStepSchema);\n\n/** The discriminant values of every timeline step. */\nexport const STEP_TYPES = [\n \"message\",\n \"reaction\",\n \"typing\",\n \"composerType\",\n \"send\",\n \"edit\",\n \"delete\",\n \"readReceipt\",\n \"system\",\n \"beat\",\n] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n","import { z } from \"zod\";\nimport { metaSchema } from \"./meta.js\";\nimport { participantsSchema } from \"./participants.js\";\nimport { pacingSchema } from \"./pacing.js\";\nimport { timelineSchema } from \"./timeline.js\";\n\n/**\n * The config schema version. Distinct from the `@typecaast/schema` package\n * version (related but versioned independently — see PLAN §22). A config newer\n * than the installed runtime fails parsing with a clear error.\n */\nexport const CONFIG_VERSION = 1;\n\n/** The complete Typecaast config: the single source of truth for a simulation. */\nexport const configSchema = z.object({\n version: z.literal(CONFIG_VERSION),\n meta: metaSchema,\n participants: participantsSchema,\n /** Optional; omitted pacing resolves to the full default model. */\n pacing: pacingSchema.default(() => pacingSchema.parse({})),\n timeline: timelineSchema,\n});\n\n/** A parsed config (defaults applied). */\nexport type Config = z.infer<typeof configSchema>;\n/** A config as authored (fields with defaults are optional). */\nexport type ConfigInput = z.input<typeof configSchema>;\n\n/**\n * Generate the JSON Schema for a Typecaast config (for editor autocomplete and\n * `$schema` references). Lazy so importing the package never eagerly runs the\n * conversion. Refinements (e.g. the lenient content-node guard) are not\n * representable in JSON Schema and are dropped.\n */\nexport function configJsonSchema(): Record<string, unknown> {\n return z.toJSONSchema(configSchema, {\n unrepresentable: \"any\",\n target: \"draft-7\",\n }) as Record<string, unknown>;\n}\n","import { CONFIG_VERSION, configSchema } from \"./config.js\";\n\n/** Diagnostic severity tiers (PLAN §23). */\nexport type Severity = \"error\" | \"warning\" | \"info\";\n\n/**\n * A single validation finding. Every diagnostic carries a stable `code`, the\n * offending `location` (step/message/path), and a `hint` for remediation.\n */\nexport interface Diagnostic {\n code: string;\n severity: Severity;\n message: string;\n /** Dotted/indexed path, e.g. `timeline[3].from` or `meta.canvas.width`. */\n location?: string;\n hint?: string;\n}\n\nfunction formatPath(path: ReadonlyArray<PropertyKey>): string {\n let out = \"\";\n for (const key of path) {\n if (typeof key === \"number\") out += `[${key}]`;\n else if (out === \"\") out += String(key);\n else out += `.${String(key)}`;\n }\n return out;\n}\n\n/** Read an optional `from`/`by`/`target` field off any step shape. */\nfunction field(step: unknown, key: string): string | undefined {\n const value = (step as Record<string, unknown>)[key];\n return typeof value === \"string\" ? value : undefined;\n}\n\n/**\n * Validate a parsed config value (already JSON-decoded). Returns all\n * diagnostics — schema errors, then semantic checks (reference integrity,\n * target resolution). Reusable by the CLI and the builder's lint panel.\n *\n * A version newer than the runtime short-circuits with a single hard error.\n */\nexport function validateConfig(raw: unknown): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n\n if (raw && typeof raw === \"object\" && \"version\" in raw) {\n const version = (raw as { version: unknown }).version;\n if (typeof version === \"number\" && version > CONFIG_VERSION) {\n return [\n {\n code: \"E_VERSION\",\n severity: \"error\",\n message: `Config version ${version} is newer than this runtime supports (max ${CONFIG_VERSION}).`,\n location: \"version\",\n hint: \"Upgrade Typecaast (e.g. `npm i @typecaast/cli@latest`).\",\n },\n ];\n }\n }\n\n const result = configSchema.safeParse(raw);\n if (!result.success) {\n for (const issue of result.error.issues) {\n diagnostics.push({\n code: \"E_SCHEMA\",\n severity: \"error\",\n message: issue.message,\n location: formatPath(issue.path) || undefined,\n });\n }\n return diagnostics;\n }\n\n const config = result.data;\n\n // Duplicate participant ids.\n const ids = config.participants.map((p) => p.id);\n const idSet = new Set(ids);\n for (const dup of new Set(ids.filter((id, i) => ids.indexOf(id) !== i))) {\n diagnostics.push({\n code: \"E_DUP_PARTICIPANT\",\n severity: \"error\",\n message: `Duplicate participant id \"${dup}\".`,\n location: \"participants\",\n hint: \"Participant ids must be unique.\",\n });\n }\n\n const hasSelf = config.participants.some((p) => p.isSelf);\n let warnedNoSelf = false;\n const messageIds = new Set<string>();\n let priorMessages = 0;\n\n config.timeline.forEach((step, i) => {\n const loc = `timeline[${i}]`;\n\n const from = field(step, \"from\");\n if (from !== undefined && !idSet.has(from)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Step references unknown participant \"${from}\".`,\n location: `${loc}.from`,\n hint: `Add a participant with id \"${from}\" or fix the reference.`,\n });\n }\n\n if (step.type === \"readReceipt\") {\n const by = field(step, \"by\");\n if (by !== undefined && !idSet.has(by)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Read receipt references unknown participant \"${by}\".`,\n location: `${loc}.by`,\n hint: `Add a participant with id \"${by}\" or fix the reference.`,\n });\n }\n }\n\n if (\n (step.type === \"composerType\" || step.type === \"send\") &&\n !hasSelf &&\n !warnedNoSelf\n ) {\n warnedNoSelf = true;\n diagnostics.push({\n code: \"W_NO_SELF\",\n severity: \"warning\",\n message: \"The composer is used but no participant is marked as self.\",\n location: loc,\n hint: 'Mark a participant with `\"isSelf\": true`.',\n });\n }\n\n if (\n (step.type === \"message\" || step.type === \"system\") &&\n typeof step.id === \"string\"\n ) {\n messageIds.add(step.id);\n }\n\n if (\n step.type === \"reaction\" ||\n step.type === \"edit\" ||\n step.type === \"delete\"\n ) {\n const target = step.target;\n if (target === \"$prev\") {\n if (priorMessages === 0) {\n diagnostics.push({\n code: \"W_NO_PREV\",\n severity: \"warning\",\n message: '\"$prev\" target has no preceding message.',\n location: `${loc}.target`,\n hint: \"Place this after a message, or target a message id.\",\n });\n }\n } else if (!messageIds.has(target)) {\n diagnostics.push({\n code: \"W_TARGET\",\n severity: \"warning\",\n message: `Target \"${target}\" matches no preceding message id.`,\n location: `${loc}.target`,\n hint: 'Give the target message an `\"id\"`, or check the reference.',\n });\n }\n }\n\n if (step.type === \"message\" || step.type === \"system\") priorMessages++;\n });\n\n return diagnostics;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/meta.ts","../src/participants.ts","../src/pacing.ts","../src/content-nodes.ts","../src/content-registry.ts","../src/content-sugar.ts","../src/timeline.ts","../src/config.ts","../src/validate.ts"],"names":["z"],"mappings":";;;AAGO,IAAM,UAAA,GAAa,EAAE,MAAA,CAAO;AAAA,EACjC,OAAO,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA,EACjC,QAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA;AAC3B,CAAC;AAgBM,IAAM,gBAAgB,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,OAAA,EAAS,OAAO,CAAC;AASzD,IAAM,qBAAqB,CAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,QAAA,EAAU,OAAO,CAAC;AAQ7D,IAAM,kBAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,OAAA,EAAS,MAAA,EAAQ,MAAM,CAAC;AAQxD,IAAM,kBAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,QAAA,EAAU,KAAK,CAAC;AAIhD,IAAM,aAAA,GAAgB,EAAE,MAAA,CAAO;AAAA,EACpC,EAAA,EAAI,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,OAAA,EAAS,CAAA,CA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A,CAAW,GAAA,CAAI,KAAK,EAAE,CAAA;AAAA,IACxB;AAEA,IAAA,IACE,IAAA,CAAK,SAAS,UAAA,IACd,IAAA,CAAK,SAAS,MAAA,IACd,IAAA,CAAK,SAAS,QAAA,EACd;AACA,MAAA,MAAM,SAAS,IAAA,CAAK,MAAA;AAEpB,MAAA,IAAI,CAAC,MAAA,IAAU,MAAA,KAAW,OAAA,EAAS;AACjC,QAAA,IAAI,kBAAkB,CAAA,EAAG;AACvB,UAAA,WAAA,CAAY,IAAA,CAAK;AAAA,YACf,IAAA,EAAM,WAAA;AAAA,YACN,QAAA,EAAU,SAAA;AAAA,YACV,OAAA,EAAS,0CAAA;AAAA,YACT,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,YAChB,IAAA,EAAM;AAAA,WACP,CAAA;AAAA,QACH;AAAA,MACF,CAAA,MAAA,IAAW,CAAC,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA,EAAG;AAClC,QAAA,WAAA,CAAY,IAAA,CAAK;AAAA,UACf,IAAA,EAAM,UAAA;AAAA,UACN,QAAA,EAAU,SAAA;AAAA,UACV,OAAA,EAAS,WAAW,MAAM,CAAA,kCAAA,CAAA;AAAA,UAC1B,QAAA,EAAU,GAAG,GAAG,CAAA,OAAA,CAAA;AAAA,UAChB,IAAA,EAAM;AAAA,SACP,CAAA;AAAA,MACH;AAAA,IACF;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,SAAA,IAAa,IAAA,CAAK,SAAS,QAAA,EAAU,aAAA,EAAA;AAAA,EACzD,CAAC,CAAA;AAED,EAAA,OAAO,WAAA;AACT","file":"index.js","sourcesContent":["import { z } from \"zod\";\n\n/** A pixel dimension pair (authoring reference; the exact frame for video). */\nexport const sizeSchema = z.object({\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n});\nexport type Size = z.infer<typeof sizeSchema>;\n\n/**\n * How the rendered conversation fills its container. The widget is\n * **container-driven** in the first two modes — its size never grows\n * with content; messages clip when they overflow the bottom-anchored\n * thread.\n * - `reflow`: fills the container in both axes; bubbles re-wrap to the\n * container width.\n * - `scale`: renders at the exact authored canvas size and CSS-scales\n * to fit (preserves the canonical layout — letterboxes if the\n * container's aspect doesn't match the canvas).\n * - `fixed`: pins the widget to the authored canvas px; clips. The only\n * non-container-driven mode.\n */\nexport const fitModeSchema = z.enum([\"reflow\", \"scale\", \"fixed\"]);\nexport type FitMode = z.infer<typeof fitModeSchema>;\n\n/**\n * Reply-box (composer) visibility:\n * - `auto`: shown only while someone is typing/sending (default).\n * - `always`: keep the message input visible the whole time.\n * - `never`: never show it.\n */\nexport const composerModeSchema = z.enum([\"auto\", \"always\", \"never\"]);\nexport type ComposerMode = z.infer<typeof composerModeSchema>;\n\n/**\n * Color theme. `auto` inherits the host page's `prefers-color-scheme` (live\n * preview) and falls back to `light`; video export resolves `auto` to a\n * concrete mode and defaults to `light` when unspecified.\n */\nexport const themeModeSchema = z.enum([\"light\", \"dark\", \"auto\"]);\nexport type ThemeMode = z.infer<typeof themeModeSchema>;\n\n/**\n * Asset resolution strategy.\n * - `inline`: embed images as data URLs (self-contained config; default).\n * - `url`: reference hosted images (smaller config; user hosts their own).\n */\nexport const assetModeSchema = z.enum([\"inline\", \"url\"]);\nexport type AssetMode = z.infer<typeof assetModeSchema>;\n\n/** Reference to a skin plus its skin-specific options (validated by the skin). */\nexport const skinRefSchema = z.object({\n id: z.string().min(1),\n options: z.record(z.string(), z.unknown()).optional(),\n});\nexport type SkinRef = z.infer<typeof skinRefSchema>;\n\n/** Top-level rendering/authoring metadata. */\nexport const metaSchema = z.object({\n /** Authoring reference size; fixed frame for video. */\n canvas: sizeSchema,\n fps: z.number().int().positive().default(30),\n fit: fitModeSchema.default(\"reflow\"),\n theme: themeModeSchema.default(\"auto\"),\n skin: skinRefSchema,\n /** Seed for all deterministic jitter (no `Math.random`). */\n seed: z.number().int().default(42),\n /** Canvas background: `\"transparent\"` or any CSS color. */\n background: z.string().default(\"transparent\"),\n assets: assetModeSchema.default(\"inline\"),\n /** Reply-box visibility (see `composerModeSchema`). */\n composer: composerModeSchema.default(\"auto\"),\n /**\n * Auto-replay when the timeline reaches the end. Honored by the builder\n * preview and by `<Typecaast>` when the consumer doesn't pass an explicit\n * `loop` prop.\n */\n loop: z.boolean().default(false),\n});\n\n/** `meta` as it appears after parsing (defaults applied). */\nexport type Meta = z.infer<typeof metaSchema>;\n/** `meta` as authored (fields with defaults are optional). */\nexport type MetaInput = z.input<typeof metaSchema>;\n","import { z } from \"zod\";\n\n/** Whether a participant is a human or an app/bot (changes how skins render it). */\nexport const participantKindSchema = z.enum([\"person\", \"app\"]);\nexport type ParticipantKind = z.infer<typeof participantKindSchema>;\n\n/** A speaker in the conversation. */\nexport const participantSchema = z.object({\n /** Stable id referenced by timeline steps (`from`, `target`, …). */\n id: z.string().min(1),\n name: z.string().min(1),\n /** Avatar asset (data URL or referenced URL per `meta.assets`). */\n avatar: z.string().optional(),\n /** Accent color (CSS color) some skins use for the author. */\n color: z.string().optional(),\n /** The viewer — rendered as the \"self\" side and the composer's author. */\n isSelf: z.boolean().optional(),\n kind: participantKindSchema.default(\"person\"),\n});\nexport type Participant = z.infer<typeof participantSchema>;\nexport type ParticipantInput = z.input<typeof participantSchema>;\n\nexport const participantsSchema = z.array(participantSchema);\n","import { z } from \"zod\";\n\n/**\n * Global auto-pacing defaults. Every value is overridable per step in the\n * timeline; the engine computes delays/durations from these and bakes in\n * seeded, deterministic jitter (`humanize`).\n */\nexport const pacingSchema = z.object({\n /** Gap before an incoming message ≈ reading time of the prior message. */\n readingWpm: z.number().positive().default(240),\n /** Chars/sec for composer typing + sender typing duration. */\n typingCps: z.number().positive().default(14),\n /** ±fraction of seeded jitter so pacing doesn't feel robotic (0–1). */\n humanize: z.number().min(0).max(1).default(0.15),\n /** Delay before the first event. */\n startDelayMs: z.number().nonnegative().default(400),\n});\nexport type Pacing = z.infer<typeof pacingSchema>;\nexport type PacingInput = z.input<typeof pacingSchema>;\n","import { z } from \"zod\";\n\n/**\n * Inline marks inside a text node. `text` runs carry plain content; the others\n * are the recognized marks (`code`, `link`, `mention`, `emoji`). The set is\n * intentionally small in v1 — new marks can be added without a schema-version\n * bump (unknown content node types are handled leniently; see the registry).\n */\nexport const inlineTextSchema = z.object({\n type: z.literal(\"text\"),\n value: z.string(),\n});\nexport const inlineCodeSchema = z.object({\n type: z.literal(\"code\"),\n value: z.string(),\n});\nexport const inlineLinkSchema = z.object({\n type: z.literal(\"link\"),\n href: z.string(),\n label: z.string().optional(),\n});\nexport const inlineMentionSchema = z.object({\n type: z.literal(\"mention\"),\n /** Display label as authored, e.g. `\"@PostHog\"`. */\n label: z.string(),\n /** Resolved participant id, filled when the mention binds to a participant. */\n id: z.string().optional(),\n});\nexport const inlineEmojiSchema = z.object({\n type: z.literal(\"emoji\"),\n /** The rendered glyph, e.g. `\"🦔\"`. */\n value: z.string(),\n /** Optional shortcode, e.g. `\"hedgehog\"`. */\n shortcode: z.string().optional(),\n});\n\nexport const inlineNodeSchema = z.discriminatedUnion(\"type\", [\n inlineTextSchema,\n inlineCodeSchema,\n inlineLinkSchema,\n inlineMentionSchema,\n inlineEmojiSchema,\n]);\nexport type InlineNode = z.infer<typeof inlineNodeSchema>;\n\n/** A block of inline content. */\nexport const textNodeSchema = z.object({\n type: z.literal(\"text\"),\n spans: z.array(inlineNodeSchema),\n});\nexport type TextNode = z.infer<typeof textNodeSchema>;\n\n/** An in-message image (same hosting model as avatars, per `meta.assets`). */\nexport const imageNodeSchema = z.object({\n type: z.literal(\"image\"),\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\nexport type ImageNode = z.infer<typeof imageNodeSchema>;\n\n/**\n * A content node whose `type` the runtime doesn't recognize. It validates\n * leniently (only `type` is required) and is skipped by skins that don't handle\n * it — so future node types (`attachment`, `linkPreview`, …) slot in without\n * breaking older runtimes or bumping the schema version.\n */\nexport interface UnknownContentNode {\n type: string;\n [key: string]: unknown;\n}\n\n/** The body of a message: an ordered list of content nodes. */\nexport type ContentNode = TextNode | ImageNode | UnknownContentNode;\n","import { z } from \"zod\";\nimport {\n imageNodeSchema,\n textNodeSchema,\n type ContentNode,\n} from \"./content-nodes.js\";\n\n/**\n * The content-type registry. Each message body node has a `type` resolved\n * through here. v1 registers `text` and `image`; additional types can be\n * registered (with their own strict schema) without a schema-version bump.\n *\n * Nodes whose `type` is **not** registered validate leniently (only `type` is\n * required) and are skipped by skins that don't handle them. Nodes whose `type`\n * **is** registered must satisfy that type's schema — so a malformed `text`\n * node is an error rather than silently passing through the lenient path.\n */\nconst registry = new Map<string, z.ZodTypeAny>([\n [\"text\", textNodeSchema],\n [\"image\", imageNodeSchema],\n]);\n\n/** Register (or override) the strict schema for a content node type. */\nexport function registerContentNodeType(\n type: string,\n schema: z.ZodTypeAny,\n): void {\n registry.set(type, schema);\n}\n\n/** The content node types the runtime validates strictly. */\nexport function knownContentNodeTypes(): string[] {\n return [...registry.keys()];\n}\n\nexport function isKnownContentNodeType(type: string): boolean {\n return registry.has(type);\n}\n\n/** Accepts any object with a string `type` that isn't a registered type. */\nconst lenientUnknownNodeSchema = z\n .looseObject({ type: z.string() })\n .refine((node) => !registry.has(node.type), {\n message: \"malformed content node for a registered type\",\n });\n\n/**\n * Build a content-node schema from the current registry state. Call this after\n * registering a new type to pick it up; `contentNodeSchema` below is the\n * default built from the v1 registry (`text` + `image`).\n */\nexport function buildContentNodeSchema(): z.ZodType<ContentNode> {\n return z.union([\n ...registry.values(),\n lenientUnknownNodeSchema,\n ]) as unknown as z.ZodType<ContentNode>;\n}\n\n/** Default content-node schema (text + image + lenient unknown). */\nexport const contentNodeSchema = buildContentNodeSchema();\n\n/** A message body: an ordered array of content nodes. */\nexport const contentSchema = z.array(contentNodeSchema);\n","import type {\n ContentNode,\n ImageNode,\n InlineNode,\n TextNode,\n} from \"./content-nodes.js\";\n\n/**\n * Matches an inline mark: a backtick code span, an http(s) link, or an\n * `@mention`. Everything else becomes plain text runs.\n */\nconst INLINE_TOKEN = /`([^`]+)`|(https?:\\/\\/[^\\s]+)|(@[A-Za-z0-9_][\\w.-]*)/g;\n\n/**\n * Parse a plain authoring string into inline nodes, extracting inline `code`,\n * links, and `@mentions`. Emoji are left inside text runs in v1 (they render\n * fine and a dedicated emoji mark can be authored explicitly).\n */\nexport function parseInline(text: string): InlineNode[] {\n if (text.length === 0) return [];\n const spans: InlineNode[] = [];\n const re = new RegExp(INLINE_TOKEN.source, \"g\");\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = re.exec(text)) !== null) {\n const matchText = match[0] ?? \"\";\n if (match.index > lastIndex) {\n spans.push({ type: \"text\", value: text.slice(lastIndex, match.index) });\n }\n if (match[1] !== undefined) {\n spans.push({ type: \"code\", value: match[1] });\n } else if (match[2] !== undefined) {\n spans.push({ type: \"link\", href: match[2] });\n } else if (match[3] !== undefined) {\n spans.push({ type: \"mention\", label: match[3] });\n }\n lastIndex = match.index + matchText.length;\n }\n if (lastIndex < text.length) {\n spans.push({ type: \"text\", value: text.slice(lastIndex) });\n }\n return spans;\n}\n\n/** Convenience shape for authoring an in-message image. */\nexport interface ImageSugar {\n src: string;\n alt?: string;\n width?: number;\n height?: number;\n}\n\n/** `text` string → a single text content node. */\nexport function textToContentNode(text: string): TextNode {\n return { type: \"text\", spans: parseInline(text) };\n}\n\n/** `image` sugar → an image content node (drops undefined optionals). */\nexport function imageToContentNode(image: ImageSugar): ImageNode {\n const node: ImageNode = { type: \"image\", src: image.src };\n if (image.alt !== undefined) node.alt = image.alt;\n if (image.width !== undefined) node.width = image.width;\n if (image.height !== undefined) node.height = image.height;\n return node;\n}\n\n/** The sugar fields a message may carry instead of explicit `content`. */\nexport interface MessageBodySugar {\n /** Authored text (parsed into inline marks). */\n text?: string;\n /** In-message images, rendered after the text. */\n images?: ImageSugar[];\n /** Explicit content nodes; when present, wins over `text`/`images`. */\n content?: ContentNode[];\n}\n\n/**\n * Resolve a message's body sugar to content nodes. Explicit `content` is\n * authoritative; otherwise the text node (if any) comes first, then images —\n * matching the \"here's the toast: [image]\" ordering in the spec example.\n */\nexport function toContentNodes(body: MessageBodySugar): ContentNode[] {\n if (body.content) return body.content;\n const nodes: ContentNode[] = [];\n if (body.text !== undefined && body.text.length > 0) {\n nodes.push(textToContentNode(body.text));\n }\n if (body.images) {\n for (const image of body.images) nodes.push(imageToContentNode(image));\n }\n return nodes;\n}\n","import { z } from \"zod\";\nimport { contentSchema } from \"./content-registry.js\";\n\n/**\n * Per-step overrides shared by every step. The engine computes timing from the\n * pacing model; these win over the computed values. Use a dedicated `delay`\n * step type to insert explicit pauses on the timeline.\n */\nconst stepBaseShape = {\n /** Optional id so reactions/edits/deletes can target this step's message. */\n id: z.string().optional(),\n /** Reveal with no animation and no computed delay. */\n instant: z.boolean().optional(),\n};\n\n/** Authoring sugar for an in-message image (compiled to an image node). */\nexport const imageSugarSchema = z.object({\n src: z.string(),\n alt: z.string().optional(),\n width: z.number().positive().optional(),\n height: z.number().positive().optional(),\n});\n\n/** Message-body sugar fields; `content` (explicit nodes) wins when present. */\nconst bodyShape = {\n text: z.string().optional(),\n images: z.array(imageSugarSchema).optional(),\n content: contentSchema.optional(),\n};\n\n/** Optional typing indicator preceding a message. */\nconst messageTypingSchema = z.union([\n z.boolean(),\n z.object({ showTypingFor: z.number().nonnegative().optional() }),\n]);\n\n/** An incoming message, optionally preceded by a typing indicator. */\nexport const messageStepSchema = z.object({\n type: z.literal(\"message\"),\n from: z.string(),\n typing: messageTypingSchema.optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** A reaction landing on a target message (`$prev` or a message id). */\nexport const reactionStepSchema = z.object({\n type: z.literal(\"reaction\"),\n /** Message id to react to. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n emoji: z.string(),\n /** Emoji shortcode without colons, e.g. `\"eyes\"` — shown in skin tooltips. */\n shortcode: z.string().optional(),\n from: z.string().optional(),\n /** Gap from when the target appears, before the reaction lands (ms). */\n delay: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** A standalone typing indicator (no message necessarily follows). */\nexport const typingStepSchema = z.object({\n type: z.literal(\"typing\"),\n from: z.string(),\n showTypingFor: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** The self participant typing into the composer, char by char. */\nexport const composerTypeStepSchema = z.object({\n type: z.literal(\"composerType\"),\n from: z.string(),\n text: z.string(),\n /** Override the computed typing duration (ms). */\n typingDuration: z.number().nonnegative().optional(),\n ...stepBaseShape,\n});\n\n/** Commit the composer's current text to the thread. */\nexport const sendStepSchema = z.object({\n type: z.literal(\"send\"),\n from: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** Edit a previously sent message's body. */\nexport const editStepSchema = z.object({\n type: z.literal(\"edit\"),\n /** Message id to edit. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** Delete a previously sent message. */\nexport const deleteStepSchema = z.object({\n type: z.literal(\"delete\"),\n /** Message id to delete. Defaults to `$prev` (the most-recent message). */\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** A read receipt (optionally by a participant, optionally up to a message). */\nexport const readReceiptStepSchema = z.object({\n type: z.literal(\"readReceipt\"),\n by: z.string().optional(),\n target: z.string().optional(),\n ...stepBaseShape,\n});\n\n/** An app/system card (e.g. \"Pull request opened\" with action buttons). */\nexport const systemStepSchema = z.object({\n type: z.literal(\"system\"),\n from: z.string().optional(),\n /** Named card variant the skin renders, e.g. `\"pr-opened\"`. */\n card: z.string().optional(),\n /**\n * Buttons rendered alongside the system message. When `href` is set the\n * skin should render the button as a link that opens in a new tab; when\n * absent it should be visibly inert (e.g. `cursor: not-allowed`). `variant`\n * controls visual emphasis; if omitted the first action defaults to\n * `\"primary\"` and the rest to `\"secondary\"`.\n */\n actions: z\n .array(\n z.object({\n label: z.string(),\n href: z.string().optional(),\n variant: z.enum([\"primary\", \"secondary\"]).optional(),\n }),\n )\n .optional(),\n ...bodyShape,\n ...stepBaseShape,\n});\n\n/** An explicit pause in the timeline (formerly `beat`). */\nexport const delayStepSchema = z.object({\n type: z.literal(\"delay\"),\n duration: z.number().nonnegative(),\n ...stepBaseShape,\n});\n\nexport const timelineStepSchema = z.discriminatedUnion(\"type\", [\n messageStepSchema,\n reactionStepSchema,\n typingStepSchema,\n composerTypeStepSchema,\n sendStepSchema,\n editStepSchema,\n deleteStepSchema,\n readReceiptStepSchema,\n systemStepSchema,\n delayStepSchema,\n]);\nexport type TimelineStep = z.infer<typeof timelineStepSchema>;\nexport type TimelineStepInput = z.input<typeof timelineStepSchema>;\n\nexport const timelineSchema = z.array(timelineStepSchema);\n\n/** The discriminant values of every timeline step. */\nexport const STEP_TYPES = [\n \"message\",\n \"reaction\",\n \"typing\",\n \"composerType\",\n \"send\",\n \"edit\",\n \"delete\",\n \"readReceipt\",\n \"system\",\n \"delay\",\n] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n","import { z } from \"zod\";\nimport { metaSchema } from \"./meta.js\";\nimport { participantsSchema } from \"./participants.js\";\nimport { pacingSchema } from \"./pacing.js\";\nimport { timelineSchema } from \"./timeline.js\";\n\n/**\n * The config schema version. Distinct from the `@typecaast/schema` package\n * version (related but versioned independently — see PLAN §22). A config newer\n * than the installed runtime fails parsing with a clear error.\n */\nexport const CONFIG_VERSION = 1;\n\n/** The complete Typecaast config: the single source of truth for a simulation. */\nexport const configSchema = z.object({\n version: z.literal(CONFIG_VERSION),\n meta: metaSchema,\n participants: participantsSchema,\n /** Optional; omitted pacing resolves to the full default model. */\n pacing: pacingSchema.default(() => pacingSchema.parse({})),\n timeline: timelineSchema,\n});\n\n/** A parsed config (defaults applied). */\nexport type Config = z.infer<typeof configSchema>;\n/** A config as authored (fields with defaults are optional). */\nexport type ConfigInput = z.input<typeof configSchema>;\n\n/**\n * Generate the JSON Schema for a Typecaast config (for editor autocomplete and\n * `$schema` references). Lazy so importing the package never eagerly runs the\n * conversion. Refinements (e.g. the lenient content-node guard) are not\n * representable in JSON Schema and are dropped.\n */\nexport function configJsonSchema(): Record<string, unknown> {\n return z.toJSONSchema(configSchema, {\n unrepresentable: \"any\",\n target: \"draft-7\",\n }) as Record<string, unknown>;\n}\n","import { CONFIG_VERSION, configSchema } from \"./config.js\";\n\n/** Diagnostic severity tiers (PLAN §23). */\nexport type Severity = \"error\" | \"warning\" | \"info\";\n\n/**\n * A single validation finding. Every diagnostic carries a stable `code`, the\n * offending `location` (step/message/path), and a `hint` for remediation.\n */\nexport interface Diagnostic {\n code: string;\n severity: Severity;\n message: string;\n /** Dotted/indexed path, e.g. `timeline[3].from` or `meta.canvas.width`. */\n location?: string;\n hint?: string;\n}\n\nfunction formatPath(path: ReadonlyArray<PropertyKey>): string {\n let out = \"\";\n for (const key of path) {\n if (typeof key === \"number\") out += `[${key}]`;\n else if (out === \"\") out += String(key);\n else out += `.${String(key)}`;\n }\n return out;\n}\n\n/** Read an optional `from`/`by`/`target` field off any step shape. */\nfunction field(step: unknown, key: string): string | undefined {\n const value = (step as Record<string, unknown>)[key];\n return typeof value === \"string\" ? value : undefined;\n}\n\n/**\n * Validate a parsed config value (already JSON-decoded). Returns all\n * diagnostics — schema errors, then semantic checks (reference integrity,\n * target resolution). Reusable by the CLI and the builder's lint panel.\n *\n * A version newer than the runtime short-circuits with a single hard error.\n */\nexport function validateConfig(raw: unknown): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n\n if (raw && typeof raw === \"object\" && \"version\" in raw) {\n const version = (raw as { version: unknown }).version;\n if (typeof version === \"number\" && version > CONFIG_VERSION) {\n return [\n {\n code: \"E_VERSION\",\n severity: \"error\",\n message: `Config version ${version} is newer than this runtime supports (max ${CONFIG_VERSION}).`,\n location: \"version\",\n hint: \"Upgrade Typecaast (e.g. `npm i @typecaast/cli@latest`).\",\n },\n ];\n }\n }\n\n const result = configSchema.safeParse(raw);\n if (!result.success) {\n for (const issue of result.error.issues) {\n diagnostics.push({\n code: \"E_SCHEMA\",\n severity: \"error\",\n message: issue.message,\n location: formatPath(issue.path) || undefined,\n });\n }\n return diagnostics;\n }\n\n const config = result.data;\n\n // Duplicate participant ids.\n const ids = config.participants.map((p) => p.id);\n const idSet = new Set(ids);\n for (const dup of new Set(ids.filter((id, i) => ids.indexOf(id) !== i))) {\n diagnostics.push({\n code: \"E_DUP_PARTICIPANT\",\n severity: \"error\",\n message: `Duplicate participant id \"${dup}\".`,\n location: \"participants\",\n hint: \"Participant ids must be unique.\",\n });\n }\n\n const hasSelf = config.participants.some((p) => p.isSelf);\n let warnedNoSelf = false;\n const messageIds = new Set<string>();\n let priorMessages = 0;\n\n config.timeline.forEach((step, i) => {\n const loc = `timeline[${i}]`;\n\n const from = field(step, \"from\");\n if (from !== undefined && !idSet.has(from)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Step references unknown participant \"${from}\".`,\n location: `${loc}.from`,\n hint: `Add a participant with id \"${from}\" or fix the reference.`,\n });\n }\n\n if (step.type === \"readReceipt\") {\n const by = field(step, \"by\");\n if (by !== undefined && !idSet.has(by)) {\n diagnostics.push({\n code: \"E_REF_PARTICIPANT\",\n severity: \"error\",\n message: `Read receipt references unknown participant \"${by}\".`,\n location: `${loc}.by`,\n hint: `Add a participant with id \"${by}\" or fix the reference.`,\n });\n }\n }\n\n if (\n (step.type === \"composerType\" || step.type === \"send\") &&\n !hasSelf &&\n !warnedNoSelf\n ) {\n warnedNoSelf = true;\n diagnostics.push({\n code: \"W_NO_SELF\",\n severity: \"warning\",\n message: \"The composer is used but no participant is marked as self.\",\n location: loc,\n hint: 'Mark a participant with `\"isSelf\": true`.',\n });\n }\n\n if (\n (step.type === \"message\" || step.type === \"system\") &&\n typeof step.id === \"string\"\n ) {\n messageIds.add(step.id);\n }\n\n if (\n step.type === \"reaction\" ||\n step.type === \"edit\" ||\n step.type === \"delete\"\n ) {\n const target = step.target;\n // Blank/`$prev` both mean \"the most-recent message\".\n if (!target || target === \"$prev\") {\n if (priorMessages === 0) {\n diagnostics.push({\n code: \"W_NO_PREV\",\n severity: \"warning\",\n message: \"Default target has no preceding message.\",\n location: `${loc}.target`,\n hint: \"Place this after a message, or set a target message id.\",\n });\n }\n } else if (!messageIds.has(target)) {\n diagnostics.push({\n code: \"W_TARGET\",\n severity: \"warning\",\n message: `Target \"${target}\" matches no preceding message id.`,\n location: `${loc}.target`,\n hint: 'Give the target message an `\"id\"`, or check the reference.',\n });\n }\n }\n\n if (step.type === \"message\" || step.type === \"system\") priorMessages++;\n });\n\n return diagnostics;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typecaast/schema",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Versioned, Zod-validated config schema for Typecaast (JSON Schema + TS types).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/corywatilo/typecaast.git",
|
|
9
|
+
"directory": "packages/schema"
|
|
10
|
+
},
|
|
6
11
|
"type": "module",
|
|
7
12
|
"sideEffects": false,
|
|
8
13
|
"files": [
|
package/typecaast.schema.json
CHANGED
|
@@ -92,6 +92,19 @@
|
|
|
92
92
|
"inline",
|
|
93
93
|
"url"
|
|
94
94
|
]
|
|
95
|
+
},
|
|
96
|
+
"composer": {
|
|
97
|
+
"default": "auto",
|
|
98
|
+
"type": "string",
|
|
99
|
+
"enum": [
|
|
100
|
+
"auto",
|
|
101
|
+
"always",
|
|
102
|
+
"never"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"loop": {
|
|
106
|
+
"default": false,
|
|
107
|
+
"type": "boolean"
|
|
95
108
|
}
|
|
96
109
|
},
|
|
97
110
|
"required": [
|
|
@@ -102,7 +115,9 @@
|
|
|
102
115
|
"skin",
|
|
103
116
|
"seed",
|
|
104
117
|
"background",
|
|
105
|
-
"assets"
|
|
118
|
+
"assets",
|
|
119
|
+
"composer",
|
|
120
|
+
"loop"
|
|
106
121
|
],
|
|
107
122
|
"additionalProperties": false
|
|
108
123
|
},
|
|
@@ -149,8 +164,6 @@
|
|
|
149
164
|
"default": {
|
|
150
165
|
"readingWpm": 240,
|
|
151
166
|
"typingCps": 14,
|
|
152
|
-
"reactionDelayMs": 700,
|
|
153
|
-
"interMessageGapMs": 900,
|
|
154
167
|
"humanize": 0.15,
|
|
155
168
|
"startDelayMs": 400
|
|
156
169
|
},
|
|
@@ -166,16 +179,6 @@
|
|
|
166
179
|
"type": "number",
|
|
167
180
|
"exclusiveMinimum": 0
|
|
168
181
|
},
|
|
169
|
-
"reactionDelayMs": {
|
|
170
|
-
"default": 700,
|
|
171
|
-
"type": "number",
|
|
172
|
-
"minimum": 0
|
|
173
|
-
},
|
|
174
|
-
"interMessageGapMs": {
|
|
175
|
-
"default": 900,
|
|
176
|
-
"type": "number",
|
|
177
|
-
"minimum": 0
|
|
178
|
-
},
|
|
179
182
|
"humanize": {
|
|
180
183
|
"default": 0.15,
|
|
181
184
|
"type": "number",
|
|
@@ -191,8 +194,6 @@
|
|
|
191
194
|
"required": [
|
|
192
195
|
"readingWpm",
|
|
193
196
|
"typingCps",
|
|
194
|
-
"reactionDelayMs",
|
|
195
|
-
"interMessageGapMs",
|
|
196
197
|
"humanize",
|
|
197
198
|
"startDelayMs"
|
|
198
199
|
],
|
|
@@ -423,15 +424,8 @@
|
|
|
423
424
|
"id": {
|
|
424
425
|
"type": "string"
|
|
425
426
|
},
|
|
426
|
-
"delay": {
|
|
427
|
-
"type": "number"
|
|
428
|
-
},
|
|
429
427
|
"instant": {
|
|
430
428
|
"type": "boolean"
|
|
431
|
-
},
|
|
432
|
-
"holdAfter": {
|
|
433
|
-
"type": "number",
|
|
434
|
-
"minimum": 0
|
|
435
429
|
}
|
|
436
430
|
},
|
|
437
431
|
"required": [
|
|
@@ -453,26 +447,25 @@
|
|
|
453
447
|
"emoji": {
|
|
454
448
|
"type": "string"
|
|
455
449
|
},
|
|
456
|
-
"
|
|
450
|
+
"shortcode": {
|
|
457
451
|
"type": "string"
|
|
458
452
|
},
|
|
459
|
-
"
|
|
453
|
+
"from": {
|
|
460
454
|
"type": "string"
|
|
461
455
|
},
|
|
462
456
|
"delay": {
|
|
463
|
-
"type": "number"
|
|
457
|
+
"type": "number",
|
|
458
|
+
"minimum": 0
|
|
459
|
+
},
|
|
460
|
+
"id": {
|
|
461
|
+
"type": "string"
|
|
464
462
|
},
|
|
465
463
|
"instant": {
|
|
466
464
|
"type": "boolean"
|
|
467
|
-
},
|
|
468
|
-
"holdAfter": {
|
|
469
|
-
"type": "number",
|
|
470
|
-
"minimum": 0
|
|
471
465
|
}
|
|
472
466
|
},
|
|
473
467
|
"required": [
|
|
474
468
|
"type",
|
|
475
|
-
"target",
|
|
476
469
|
"emoji"
|
|
477
470
|
],
|
|
478
471
|
"additionalProperties": false
|
|
@@ -494,15 +487,8 @@
|
|
|
494
487
|
"id": {
|
|
495
488
|
"type": "string"
|
|
496
489
|
},
|
|
497
|
-
"delay": {
|
|
498
|
-
"type": "number"
|
|
499
|
-
},
|
|
500
490
|
"instant": {
|
|
501
491
|
"type": "boolean"
|
|
502
|
-
},
|
|
503
|
-
"holdAfter": {
|
|
504
|
-
"type": "number",
|
|
505
|
-
"minimum": 0
|
|
506
492
|
}
|
|
507
493
|
},
|
|
508
494
|
"required": [
|
|
@@ -531,15 +517,8 @@
|
|
|
531
517
|
"id": {
|
|
532
518
|
"type": "string"
|
|
533
519
|
},
|
|
534
|
-
"delay": {
|
|
535
|
-
"type": "number"
|
|
536
|
-
},
|
|
537
520
|
"instant": {
|
|
538
521
|
"type": "boolean"
|
|
539
|
-
},
|
|
540
|
-
"holdAfter": {
|
|
541
|
-
"type": "number",
|
|
542
|
-
"minimum": 0
|
|
543
522
|
}
|
|
544
523
|
},
|
|
545
524
|
"required": [
|
|
@@ -562,15 +541,8 @@
|
|
|
562
541
|
"id": {
|
|
563
542
|
"type": "string"
|
|
564
543
|
},
|
|
565
|
-
"delay": {
|
|
566
|
-
"type": "number"
|
|
567
|
-
},
|
|
568
544
|
"instant": {
|
|
569
545
|
"type": "boolean"
|
|
570
|
-
},
|
|
571
|
-
"holdAfter": {
|
|
572
|
-
"type": "number",
|
|
573
|
-
"minimum": 0
|
|
574
546
|
}
|
|
575
547
|
},
|
|
576
548
|
"required": [
|
|
@@ -782,20 +754,12 @@
|
|
|
782
754
|
"id": {
|
|
783
755
|
"type": "string"
|
|
784
756
|
},
|
|
785
|
-
"delay": {
|
|
786
|
-
"type": "number"
|
|
787
|
-
},
|
|
788
757
|
"instant": {
|
|
789
758
|
"type": "boolean"
|
|
790
|
-
},
|
|
791
|
-
"holdAfter": {
|
|
792
|
-
"type": "number",
|
|
793
|
-
"minimum": 0
|
|
794
759
|
}
|
|
795
760
|
},
|
|
796
761
|
"required": [
|
|
797
|
-
"type"
|
|
798
|
-
"target"
|
|
762
|
+
"type"
|
|
799
763
|
],
|
|
800
764
|
"additionalProperties": false
|
|
801
765
|
},
|
|
@@ -812,20 +776,12 @@
|
|
|
812
776
|
"id": {
|
|
813
777
|
"type": "string"
|
|
814
778
|
},
|
|
815
|
-
"delay": {
|
|
816
|
-
"type": "number"
|
|
817
|
-
},
|
|
818
779
|
"instant": {
|
|
819
780
|
"type": "boolean"
|
|
820
|
-
},
|
|
821
|
-
"holdAfter": {
|
|
822
|
-
"type": "number",
|
|
823
|
-
"minimum": 0
|
|
824
781
|
}
|
|
825
782
|
},
|
|
826
783
|
"required": [
|
|
827
|
-
"type"
|
|
828
|
-
"target"
|
|
784
|
+
"type"
|
|
829
785
|
],
|
|
830
786
|
"additionalProperties": false
|
|
831
787
|
},
|
|
@@ -845,15 +801,8 @@
|
|
|
845
801
|
"id": {
|
|
846
802
|
"type": "string"
|
|
847
803
|
},
|
|
848
|
-
"delay": {
|
|
849
|
-
"type": "number"
|
|
850
|
-
},
|
|
851
804
|
"instant": {
|
|
852
805
|
"type": "boolean"
|
|
853
|
-
},
|
|
854
|
-
"holdAfter": {
|
|
855
|
-
"type": "number",
|
|
856
|
-
"minimum": 0
|
|
857
806
|
}
|
|
858
807
|
},
|
|
859
808
|
"required": [
|
|
@@ -884,6 +833,13 @@
|
|
|
884
833
|
},
|
|
885
834
|
"href": {
|
|
886
835
|
"type": "string"
|
|
836
|
+
},
|
|
837
|
+
"variant": {
|
|
838
|
+
"type": "string",
|
|
839
|
+
"enum": [
|
|
840
|
+
"primary",
|
|
841
|
+
"secondary"
|
|
842
|
+
]
|
|
887
843
|
}
|
|
888
844
|
},
|
|
889
845
|
"required": [
|
|
@@ -1086,15 +1042,8 @@
|
|
|
1086
1042
|
"id": {
|
|
1087
1043
|
"type": "string"
|
|
1088
1044
|
},
|
|
1089
|
-
"delay": {
|
|
1090
|
-
"type": "number"
|
|
1091
|
-
},
|
|
1092
1045
|
"instant": {
|
|
1093
1046
|
"type": "boolean"
|
|
1094
|
-
},
|
|
1095
|
-
"holdAfter": {
|
|
1096
|
-
"type": "number",
|
|
1097
|
-
"minimum": 0
|
|
1098
1047
|
}
|
|
1099
1048
|
},
|
|
1100
1049
|
"required": [
|
|
@@ -1107,7 +1056,7 @@
|
|
|
1107
1056
|
"properties": {
|
|
1108
1057
|
"type": {
|
|
1109
1058
|
"type": "string",
|
|
1110
|
-
"const": "
|
|
1059
|
+
"const": "delay"
|
|
1111
1060
|
},
|
|
1112
1061
|
"duration": {
|
|
1113
1062
|
"type": "number",
|
|
@@ -1116,15 +1065,8 @@
|
|
|
1116
1065
|
"id": {
|
|
1117
1066
|
"type": "string"
|
|
1118
1067
|
},
|
|
1119
|
-
"delay": {
|
|
1120
|
-
"type": "number"
|
|
1121
|
-
},
|
|
1122
1068
|
"instant": {
|
|
1123
1069
|
"type": "boolean"
|
|
1124
|
-
},
|
|
1125
|
-
"holdAfter": {
|
|
1126
|
-
"type": "number",
|
|
1127
|
-
"minimum": 0
|
|
1128
1070
|
}
|
|
1129
1071
|
},
|
|
1130
1072
|
"required": [
|