@velumo/core 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/background-validation.d.ts +3 -0
  2. package/dist/background-validation.d.ts.map +1 -0
  3. package/dist/background-validation.js +177 -0
  4. package/dist/background-validation.js.map +1 -0
  5. package/dist/builders.d.ts +134 -0
  6. package/dist/builders.d.ts.map +1 -0
  7. package/dist/builders.js +332 -0
  8. package/dist/builders.js.map +1 -0
  9. package/dist/capabilities.d.ts +7 -0
  10. package/dist/capabilities.d.ts.map +1 -0
  11. package/dist/capabilities.js +59 -0
  12. package/dist/capabilities.js.map +1 -0
  13. package/dist/index.d.ts +9 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +7 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/layout-validation.d.ts +4 -0
  18. package/dist/layout-validation.d.ts.map +1 -0
  19. package/dist/layout-validation.js +745 -0
  20. package/dist/layout-validation.js.map +1 -0
  21. package/dist/manifest-schema.d.ts +1328 -0
  22. package/dist/manifest-schema.d.ts.map +1 -0
  23. package/dist/manifest-schema.js +774 -0
  24. package/dist/manifest-schema.js.map +1 -0
  25. package/dist/theme-validation.d.ts +3 -0
  26. package/dist/theme-validation.d.ts.map +1 -0
  27. package/dist/theme-validation.js +239 -0
  28. package/dist/theme-validation.js.map +1 -0
  29. package/dist/tsconfig.tsbuildinfo +1 -0
  30. package/dist/types.d.ts +398 -0
  31. package/dist/types.d.ts.map +1 -0
  32. package/dist/types.js +2 -0
  33. package/dist/types.js.map +1 -0
  34. package/dist/validation-issue.d.ts +18 -0
  35. package/dist/validation-issue.d.ts.map +1 -0
  36. package/dist/validation-issue.js +30 -0
  37. package/dist/validation-issue.js.map +1 -0
  38. package/dist/validation.d.ts +4 -0
  39. package/dist/validation.d.ts.map +1 -0
  40. package/dist/validation.js +274 -0
  41. package/dist/validation.js.map +1 -0
  42. package/package.json +16 -0
  43. package/src/background-validation.ts +315 -0
  44. package/src/builders.ts +626 -0
  45. package/src/capabilities.ts +99 -0
  46. package/src/index.ts +147 -0
  47. package/src/layout-validation.ts +1385 -0
  48. package/src/manifest-schema.ts +823 -0
  49. package/src/theme-validation.ts +410 -0
  50. package/src/types.ts +560 -0
  51. package/src/validation-issue.ts +43 -0
  52. package/src/validation.ts +468 -0
  53. package/tsconfig.json +9 -0
@@ -0,0 +1,3 @@
1
+ import type { ValidationIssue } from "./types.js";
2
+ export declare function validateBackground(value: unknown, path: string): readonly ValidationIssue[];
3
+ //# sourceMappingURL=background-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background-validation.d.ts","sourceRoot":"","sources":["../src/background-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAiRlD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,GACX,SAAS,eAAe,EAAE,CAsC5B"}
@@ -0,0 +1,177 @@
1
+ import { describeType, issue } from "./validation-issue.js";
2
+ const BLEND_MODES = ["normal", "screen", "multiply", "overlay"];
3
+ const SHAPE_VALUES = ["circle", "ellipse"];
4
+ const BACKGROUND_KEYS = new Set(["color", "layers"]);
5
+ const LINEAR_KEYS = new Set(["type", "stops", "angle", "blend", "opacity"]);
6
+ const RADIAL_KEYS = new Set([
7
+ "type",
8
+ "stops",
9
+ "shape",
10
+ "position",
11
+ "blend",
12
+ "opacity",
13
+ ]);
14
+ const STOP_KEYS = new Set(["color", "at"]);
15
+ const POSITION_KEYS = new Set(["x", "y"]);
16
+ const LAYER_TYPES = "linear, radial";
17
+ function isRecord(value) {
18
+ return typeof value === "object" && value !== null && !Array.isArray(value);
19
+ }
20
+ function isNonEmptyString(value) {
21
+ return typeof value === "string" && value.trim().length > 0;
22
+ }
23
+ function isFiniteInRange(value, min, max) {
24
+ return (typeof value === "number" &&
25
+ Number.isFinite(value) &&
26
+ value >= min &&
27
+ value <= max);
28
+ }
29
+ function typeIssue(path, message, expected, received) {
30
+ return issue(path, "wrong_type", message, {
31
+ expected,
32
+ received: describeType(received),
33
+ });
34
+ }
35
+ function requiredIssue(path, message) {
36
+ return issue(path, "required", message, {
37
+ suggestion: `Provide a value for \`${path}\`.`,
38
+ });
39
+ }
40
+ function enumIssue(path, message, allowed, received) {
41
+ return issue(path, "invalid_enum", message, {
42
+ expected: allowed.join(", "),
43
+ received: typeof received === "string" ? received : describeType(received),
44
+ suggestion: `Use one of: ${allowed.join(", ")}.`,
45
+ });
46
+ }
47
+ function valueIssue(path, message, received) {
48
+ return issue(path, "invalid_value", message, {
49
+ received: typeof received === "number" ? String(received) : describeType(received),
50
+ });
51
+ }
52
+ function unknownFields(node, allowed, path) {
53
+ return Object.keys(node)
54
+ .filter((key) => !allowed.has(key))
55
+ .map((key) => issue(`${path}.${key}`, "unknown_field", `${path}.${key} is not allowed`, {
56
+ expected: [...allowed].join(", "),
57
+ suggestion: `Remove \`${key}\`; it is not a recognized field here.`,
58
+ }));
59
+ }
60
+ function validateStop(value, path) {
61
+ if (!isRecord(value)) {
62
+ return [typeIssue(path, `${path} must be an object`, "object", value)];
63
+ }
64
+ const issues = [];
65
+ issues.push(...unknownFields(value, STOP_KEYS, path));
66
+ if (!isNonEmptyString(value.color)) {
67
+ issues.push(requiredIssue(`${path}.color`, `${path}.color is required`));
68
+ }
69
+ if (value.at !== undefined && !isFiniteInRange(value.at, 0, 100)) {
70
+ issues.push(valueIssue(`${path}.at`, `${path}.at must be a percentage 0-100`, value.at));
71
+ }
72
+ return issues;
73
+ }
74
+ function validateStops(value, path) {
75
+ if (!Array.isArray(value)) {
76
+ if (value === undefined) {
77
+ return [requiredIssue(path, `${path} is required`)];
78
+ }
79
+ return [typeIssue(path, `${path} must be an array`, "array", value)];
80
+ }
81
+ if (value.length === 0) {
82
+ return [
83
+ issue(path, "required", `${path} must have at least one stop`, {
84
+ suggestion: "A gradient needs one or more color stops.",
85
+ }),
86
+ ];
87
+ }
88
+ const issues = [];
89
+ value.forEach((stop, index) => {
90
+ issues.push(...validateStop(stop, `${path}[${index}]`));
91
+ });
92
+ return issues;
93
+ }
94
+ function validateCompositing(node, path) {
95
+ const issues = [];
96
+ if (node.blend !== undefined &&
97
+ !(typeof node.blend === "string" &&
98
+ BLEND_MODES.includes(node.blend))) {
99
+ issues.push(enumIssue(`${path}.blend`, `${path}.blend must be normal, screen, multiply, or overlay`, BLEND_MODES, node.blend));
100
+ }
101
+ if (node.opacity !== undefined && !isFiniteInRange(node.opacity, 0, 1)) {
102
+ issues.push(valueIssue(`${path}.opacity`, `${path}.opacity must be a number 0-1`, node.opacity));
103
+ }
104
+ return issues;
105
+ }
106
+ function validateLayer(value, path) {
107
+ if (!isRecord(value)) {
108
+ return [typeIssue(path, `${path} must be an object`, "object", value)];
109
+ }
110
+ const issues = [];
111
+ if (value.type === "linear") {
112
+ issues.push(...unknownFields(value, LINEAR_KEYS, path));
113
+ issues.push(...validateStops(value.stops, `${path}.stops`));
114
+ if (value.angle !== undefined &&
115
+ !(typeof value.angle === "number" && Number.isFinite(value.angle))) {
116
+ issues.push(valueIssue(`${path}.angle`, `${path}.angle must be a finite number`, value.angle));
117
+ }
118
+ issues.push(...validateCompositing(value, path));
119
+ }
120
+ else if (value.type === "radial") {
121
+ issues.push(...unknownFields(value, RADIAL_KEYS, path));
122
+ issues.push(...validateStops(value.stops, `${path}.stops`));
123
+ if (value.shape !== undefined &&
124
+ !(typeof value.shape === "string" &&
125
+ SHAPE_VALUES.includes(value.shape))) {
126
+ issues.push(enumIssue(`${path}.shape`, `${path}.shape must be circle or ellipse`, SHAPE_VALUES, value.shape));
127
+ }
128
+ if (value.position !== undefined) {
129
+ if (!isRecord(value.position)) {
130
+ issues.push(typeIssue(`${path}.position`, `${path}.position must be an object`, "object", value.position));
131
+ }
132
+ else {
133
+ issues.push(...unknownFields(value.position, POSITION_KEYS, `${path}.position`));
134
+ for (const axis of ["x", "y"]) {
135
+ if (!isFiniteInRange(value.position[axis], 0, 100)) {
136
+ issues.push(valueIssue(`${path}.position.${axis}`, `${path}.position.${axis} must be a percentage 0-100`, value.position[axis]));
137
+ }
138
+ }
139
+ }
140
+ }
141
+ issues.push(...validateCompositing(value, path));
142
+ }
143
+ else {
144
+ issues.push(issue(`${path}.type`, "unknown_kind", `${path}.type must be a known gradient type`, {
145
+ expected: LAYER_TYPES,
146
+ received: typeof value.type === "string"
147
+ ? value.type
148
+ : describeType(value.type),
149
+ suggestion: `Use one of: ${LAYER_TYPES}.`,
150
+ }));
151
+ }
152
+ return issues;
153
+ }
154
+ export function validateBackground(value, path) {
155
+ if (!isRecord(value)) {
156
+ return [typeIssue(path, `${path} must be an object`, "object", value)];
157
+ }
158
+ const issues = [];
159
+ issues.push(...unknownFields(value, BACKGROUND_KEYS, path));
160
+ if (value.color !== undefined && !isNonEmptyString(value.color)) {
161
+ issues.push(value.color === ""
162
+ ? requiredIssue(`${path}.color`, `${path}.color must not be empty`)
163
+ : typeIssue(`${path}.color`, `${path}.color must be a string`, "string", value.color));
164
+ }
165
+ if (value.layers !== undefined) {
166
+ if (!Array.isArray(value.layers)) {
167
+ issues.push(typeIssue(`${path}.layers`, `${path}.layers must be an array`, "array", value.layers));
168
+ }
169
+ else {
170
+ value.layers.forEach((layer, index) => {
171
+ issues.push(...validateLayer(layer, `${path}.layers[${index}]`));
172
+ });
173
+ }
174
+ }
175
+ return issues;
176
+ }
177
+ //# sourceMappingURL=background-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background-validation.js","sourceRoot":"","sources":["../src/background-validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI5D,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AACzE,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAU,CAAC;AACpD,MAAM,e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,IAAI,CACT,SAAS,CACP,GAAG,IAAI,SAAS,EAChB,GAAG,IAAI,0BAA0B,EACjC,OAAO,EACP,KAAK,CAAC,MAAM,CACb,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACpC,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,GAAG,IAAI,WAAW,KAAK,GAAG,CAAC,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,134 @@
1
+ import type { AnimateLayout, AnimationName, CalloutElement, CameraStop, CameraView, CanvasItem, CanvasLayout, CodeElement, CodeToken, CodeTokenKind, ConnectorElement, ConnectorPoint, Cue, CueAction, ExportOptions, FrameLayout, Fragment, GridLayout, HeadingElement, HeroLayout, BadgeElement, IconElement, RuleElement, IconName, JsonValue, Layer, LayoutMeta, LayoutNode, Manifest, MediaElement, Plugin, Scene, Slide, SlideEntry, SplitLayout, StackLayout, TableColumn, TableLayout, TextElement, Theme } from "./types.js";
2
+ export interface DeckInput {
3
+ readonly title: string;
4
+ readonly description?: string;
5
+ readonly author?: string;
6
+ readonly watermark?: string;
7
+ readonly slides: readonly SlideEntry[];
8
+ readonly assets?: Manifest["assets"];
9
+ readonly plugins?: readonly Plugin[];
10
+ readonly theme?: Theme;
11
+ readonly export?: ExportOptions;
12
+ }
13
+ export type SlideOptions = Omit<Slide, "id" | "kind">;
14
+ export type SceneOptions = Omit<Scene, "id" | "kind">;
15
+ export type LayerOptions = Omit<Layer, "type">;
16
+ export type FragmentOptions = Omit<Fragment, "id">;
17
+ export type StackOptions = Omit<StackLayout, "kind" | "children">;
18
+ export type GridOptions = Omit<GridLayout, "kind" | "children">;
19
+ export type SplitOptions = Omit<SplitLayout, "kind" | "children">;
20
+ export type HeroOptions = Omit<HeroLayout, "kind" | "children">;
21
+ export type FrameOptions = Omit<FrameLayout, "kind" | "children">;
22
+ export type CanvasOptions = Omit<CanvasLayout, "kind" | "items">;
23
+ export type CameraStopOptions = Omit<CameraStop, "camera">;
24
+ export interface AtOptions {
25
+ readonly width?: number;
26
+ readonly height?: number;
27
+ }
28
+ export interface AnimateOptions {
29
+ readonly delay?: number;
30
+ readonly duration?: number;
31
+ readonly easing?: string;
32
+ }
33
+ export type HeadingOptions = Omit<HeadingElement, "kind" | "text">;
34
+ export type TextOptions = Omit<TextElement, "kind" | "text">;
35
+ export type MediaOptions = Omit<MediaElement, "kind" | "src" | "alt"> & {
36
+ readonly alt?: string;
37
+ };
38
+ export type CalloutOptions = Omit<CalloutElement, "kind" | "children">;
39
+ export type LayoutChildInput = LayoutNode | readonly LayoutNode[];
40
+ export type LayoutSlideOptions = Omit<SlideOptions, "layout">;
41
+ export type LayoutSceneOptions = Omit<SceneOptions, "layout">;
42
+ export interface TitleLayoutOptions {
43
+ readonly subtitle?: string;
44
+ readonly kicker?: string;
45
+ readonly level?: HeadingElement["level"];
46
+ }
47
+ export interface SectionLayoutOptions {
48
+ readonly level?: HeadingElement["level"];
49
+ }
50
+ export interface TwoColumnOptions {
51
+ readonly weights?: readonly [number, number];
52
+ }
53
+ export interface MediaHeroOptions {
54
+ readonly alt?: string;
55
+ readonly title?: string;
56
+ readonly body?: string;
57
+ readonly fit?: MediaElement["fit"];
58
+ }
59
+ export interface QuoteOptions {
60
+ readonly attribution?: string;
61
+ }
62
+ export interface VelumoConfig {
63
+ readonly entry?: string;
64
+ readonly root?: string;
65
+ readonly outDir?: string;
66
+ readonly theme?: string;
67
+ readonly [key: string]: JsonValue | undefined;
68
+ }
69
+ export declare function deck(input: DeckInput): Manifest;
70
+ export declare function slide(id: string, options?: SlideOptions): Slide;
71
+ export declare function scene(id: string, options?: SceneOptions): Scene;
72
+ export declare function layer(type: string, options?: LayerOptions): Layer;
73
+ export declare function markdown(content: string, options?: LayerOptions): Layer;
74
+ export declare function stack(children?: readonly LayoutNode[], options?: StackOptions): StackLayout;
75
+ export declare function grid(children?: readonly LayoutNode[], options?: GridOptions): GridLayout;
76
+ export declare function split(children: readonly LayoutNode[], options?: SplitOptions): SplitLayout;
77
+ export declare function hero(children: readonly LayoutNode[], options?: HeroOptions): HeroLayout;
78
+ export declare function frame(children?: readonly LayoutNode[], options?: FrameOptions): FrameLayout;
79
+ export declare function canvas(items?: readonly CanvasItem[], options?: CanvasOptions): CanvasLayout;
80
+ export declare function col(header?: LayoutNode, options?: {
81
+ readonly weight?: number;
82
+ readonly align?: TableColumn["align"];
83
+ readonly emphasis?: boolean;
84
+ }): TableColumn;
85
+ export declare function table(columns: readonly TableColumn[], rows: readonly (readonly LayoutNode[])[], options?: {
86
+ readonly meta?: LayoutMeta;
87
+ }): TableLayout;
88
+ export declare function at(x: number, y: number, child: LayoutNode, options?: AtOptions): CanvasItem;
89
+ export declare function cameraView(x: number, y: number, zoom?: number): CameraView;
90
+ export declare function cameraStop(camera: CameraView, options?: CameraStopOptions): CameraStop;
91
+ export declare function animate(name: AnimationName, child: LayoutNode, options?: AnimateOptions): AnimateLayout;
92
+ export declare function heading(text: string, options?: HeadingOptions): HeadingElement;
93
+ export declare function text(text: string, options?: TextOptions): TextElement;
94
+ export declare function media(src: string, options?: MediaOptions): MediaElement;
95
+ export declare function callout(children?: readonly LayoutNode[], options?: CalloutOptions): CalloutElement;
96
+ export declare function token(text: string, kind?: CodeTokenKind): CodeToken;
97
+ export declare function code(lines: readonly (readonly CodeToken[])[]): CodeElement;
98
+ export declare function icon(name: IconName, options?: {
99
+ readonly tone?: IconElement["tone"];
100
+ readonly label?: string;
101
+ }): IconElement;
102
+ export declare function badge(text: string, options?: {
103
+ readonly tone?: BadgeElement["tone"];
104
+ readonly variant?: BadgeElement["variant"];
105
+ readonly dot?: BadgeElement["tone"];
106
+ readonly mono?: boolean;
107
+ }): BadgeElement;
108
+ export declare function rule(options?: {
109
+ readonly length?: string | number;
110
+ readonly thickness?: number;
111
+ readonly tone?: RuleElement["tone"];
112
+ readonly gradient?: RuleElement["gradient"];
113
+ readonly radius?: number;
114
+ }): RuleElement;
115
+ export declare function point(x: number, y: number): ConnectorPoint;
116
+ export declare function connector(from: ConnectorPoint, to: ConnectorPoint, options?: {
117
+ readonly control?: ConnectorPoint;
118
+ readonly arrow?: ConnectorElement["arrow"];
119
+ readonly dashed?: boolean;
120
+ readonly tone?: ConnectorElement["tone"];
121
+ }): ConnectorElement;
122
+ export declare function layoutSlide(id: string, layout: LayoutNode, options?: LayoutSlideOptions): Slide;
123
+ export declare function layoutScene(id: string, layout: LayoutNode, options?: LayoutSceneOptions): Scene;
124
+ export declare function titleLayout(title: string, options?: TitleLayoutOptions): HeroLayout;
125
+ export declare function sectionLayout(title: string, children?: LayoutChildInput, options?: SectionLayoutOptions): StackLayout;
126
+ export declare function twoColumn(left: LayoutChildInput, right: LayoutChildInput, options?: TwoColumnOptions): SplitLayout;
127
+ export declare function mediaHero(src: string, options?: MediaHeroOptions): HeroLayout;
128
+ export declare function quote(value: string, options?: QuoteOptions): CalloutElement;
129
+ export declare function fragment(id: string, options?: FragmentOptions): Fragment;
130
+ export declare function cue(time: number, action: CueAction): Cue;
131
+ export declare function defineTheme<TTheme extends Theme>(theme: TTheme): TTheme;
132
+ export declare function definePlugin<TPlugin extends Plugin>(plugin: TPlugin): TPlugin;
133
+ export declare function defineConfig<TConfig extends VelumoConfig>(config: TConfig): TConfig;
134
+ //# sourceMappingURL=builders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,GAAG,EACH,SAAS,EACT,aAAa,EACb,WAAW,EACX,QAAQ,E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,MAAM,EAAE,OAAO,GACd,OAAO,CAET"}
@@ -0,0 +1,332 @@
1
+ function assertUniqueSlideEntryIds(slides) {
2
+ const seen = new Set();
3
+ for (const entry of slides) {
4
+ if (seen.has(entry.id)) {
5
+ throw new Error(`duplicate slide/scene id: ${entry.id}`);
6
+ }
7
+ seen.add(entry.id);
8
+ }
9
+ }
10
+ export function deck(input) {
11
+ assertUniqueSlideEntryIds(input.slides);
12
+ return {
13
+ deck: {
14
+ title: input.title,
15
+ ...(input.description === undefined
16
+ ? {}
17
+ : { description: input.description }),
18
+ ...(input.author === undefined ? {} : { author: input.author }),
19
+ ...(input.watermark === undefined ? {} : { watermark: input.watermark }),
20
+ },
21
+ slides: input.slides,
22
+ ...(input.assets === undefined ? {} : { assets: input.assets }),
23
+ ...(input.plugins === undefined ? {} : { plugins: input.plugins }),
24
+ ...(input.theme === undefined ? {} : { theme: input.theme }),
25
+ ...(input.export === undefined ? {} : { export: input.export }),
26
+ };
27
+ }
28
+ export function slide(id, options = {}) {
29
+ return {
30
+ id,
31
+ kind: "slide",
32
+ ...options,
33
+ };
34
+ }
35
+ export function scene(id, options = {}) {
36
+ return {
37
+ id,
38
+ kind: "scene",
39
+ ...options,
40
+ };
41
+ }
42
+ export function layer(type, options = {}) {
43
+ return {
44
+ ...options,
45
+ type,
46
+ };
47
+ }
48
+ export function markdown(content, options = {}) {
49
+ return layer("markdown", {
50
+ ...options,
51
+ content,
52
+ });
53
+ }
54
+ function normalizeLayoutChildren(input) {
55
+ if (input === undefined) {
56
+ return [];
57
+ }
58
+ if (Array.isArray(input)) {
59
+ return [...input];
60
+ }
61
+ return [input];
62
+ }
63
+ function normalizeColumnLayout(input) {
64
+ const children = normalizeLayoutChildren(input);
65
+ if (Array.isArray(input)) {
66
+ return stack(children);
67
+ }
68
+ return children[0];
69
+ }
70
+ function headingOptions(level) {
71
+ return level === undefined ? {} : { level };
72
+ }
73
+ export function stack(children = [], options = {}) {
74
+ return {
75
+ kind: "stack",
76
+ children,
77
+ ...options,
78
+ };
79
+ }
80
+ export function grid(children = [], options = {}) {
81
+ return {
82
+ kind: "grid",
83
+ children,
84
+ ...options,
85
+ };
86
+ }
87
+ export function split(children, options = {}) {
88
+ return {
89
+ kind: "split",
90
+ children,
91
+ ...options,
92
+ };
93
+ }
94
+ export function hero(children, options = {}) {
95
+ return {
96
+ kind: "hero",
97
+ children,
98
+ ...options,
99
+ };
100
+ }
101
+ export function frame(children = [], options = {}) {
102
+ return {
103
+ kind: "frame",
104
+ children,
105
+ ...options,
106
+ };
107
+ }
108
+ export function canvas(items = [], options = {}) {
109
+ return {
110
+ kind: "canvas",
111
+ items,
112
+ ...options,
113
+ };
114
+ }
115
+ export function col(header, options = {}) {
116
+ return {
117
+ ...(header === undefined ? {} : { header }),
118
+ ...(options.weight === undefined ? {} : { weight: options.weight }),
119
+ ...(options.align === undefined ? {} : { align: options.align }),
120
+ ...(options.emphasis === undefined ? {} : { emphasis: options.emphasis }),
121
+ };
122
+ }
123
+ export function table(columns, rows, options = {}) {
124
+ return {
125
+ kind: "table",
126
+ columns,
127
+ rows,
128
+ ...(options.meta === undefined ? {} : { meta: options.meta }),
129
+ };
130
+ }
131
+ export function at(x, y, child, options = {}) {
132
+ return {
133
+ x,
134
+ y,
135
+ ...(options.width === undefined ? {} : { width: options.width }),
136
+ ...(options.height === undefined ? {} : { height: options.height }),
137
+ child,
138
+ };
139
+ }
140
+ export function cameraView(x, y, zoom) {
141
+ return zoom === undefined ? { x, y } : { x, y, zoom };
142
+ }
143
+ export function cameraStop(camera, options = {}) {
144
+ return {
145
+ camera,
146
+ ...(options.transition === undefined
147
+ ? {}
148
+ : { transition: options.transition }),
149
+ ...(options.cues === undefined ? {} : { cues: options.cues }),
150
+ ...(options.hold === undefined ? {} : { hold: options.hold }),
151
+ };
152
+ }
153
+ export function animate(name, child, options = {}) {
154
+ return {
155
+ kind: "animate",
156
+ name,
157
+ ...(options.delay === undefined ? {} : { delay: options.delay }),
158
+ ...(options.duration === undefined ? {} : { duration: options.duration }),
159
+ ...(options.easing === undefined ? {} : { easing: options.easing }),
160
+ child,
161
+ };
162
+ }
163
+ export function heading(text, options = {}) {
164
+ return {
165
+ kind: "heading",
166
+ text,
167
+ ...options,
168
+ };
169
+ }
170
+ export function text(text, options = {}) {
171
+ return {
172
+ kind: "text",
173
+ text,
174
+ ...options,
175
+ };
176
+ }
177
+ /**
178
+ * Derive a sensible, non-empty `alt` from a media `src` so a minimal
179
+ * `media(src)` call still produces a valid (non-empty alt) manifest. This is a
180
+ * fallback, not a substitute for authored alt text: explicit `alt` should
181
+ * always be preferred and overrides this default.
182
+ */
183
+ function deriveMediaAlt(src) {
184
+ if (typeof src !== "string") {
185
+ return "image";
186
+ }
187
+ const base = src.split(/[/\\]/).pop() ?? "";
188
+ const withoutExtension = base.replace(/\.[^.]+$/, "");
189
+ const words = withoutExtension.replace(/[-_]+/g, " ").trim();
190
+ return words.length > 0 ? words : "image";
191
+ }
192
+ export function media(src, options = {}) {
193
+ const { alt, ...rest } = options;
194
+ return {
195
+ kind: "media",
196
+ src,
197
+ alt: alt ?? deriveMediaAlt(src),
198
+ ...rest,
199
+ };
200
+ }
201
+ export function callout(children = [], options = {}) {
202
+ return {
203
+ kind: "callout",
204
+ children,
205
+ ...options,
206
+ };
207
+ }
208
+ export function token(text, kind) {
209
+ return kind === undefined ? { text } : { text, kind };
210
+ }
211
+ export function code(lines) {
212
+ return { kind: "code", lines };
213
+ }
214
+ export function icon(name, options = {}) {
215
+ return {
216
+ kind: "icon",
217
+ name,
218
+ ...(options.tone === undefined ? {} : { tone: options.tone }),
219
+ ...(options.label === undefined ? {} : { label: options.label }),
220
+ };
221
+ }
222
+ export function badge(text, options = {}) {
223
+ return {
224
+ kind: "badge",
225
+ text,
226
+ ...(options.tone === undefined ? {} : { tone: options.tone }),
227
+ ...(options.variant === undefined ? {} : { variant: options.variant }),
228
+ ...(options.dot === undefined ? {} : { dot: options.dot }),
229
+ ...(options.mono === undefined ? {} : { mono: options.mono }),
230
+ };
231
+ }
232
+ export function rule(options = {}) {
233
+ return {
234
+ kind: "rule",
235
+ ...(options.length === undefined ? {} : { length: options.length }),
236
+ ...(options.thickness === undefined
237
+ ? {}
238
+ : { thickness: options.thickness }),
239
+ ...(options.tone === undefined ? {} : { tone: options.tone }),
240
+ ...(options.gradient === undefined ? {} : { gradient: options.gradient }),
241
+ ...(options.radius === undefined ? {} : { radius: options.radius }),
242
+ };
243
+ }
244
+ export function point(x, y) {
245
+ return { x, y };
246
+ }
247
+ export function connector(from, to, options = {}) {
248
+ return {
249
+ kind: "connector",
250
+ from,
251
+ to,
252
+ ...(options.control === undefined ? {} : { control: options.control }),
253
+ ...(options.arrow === undefined ? {} : { arrow: options.arrow }),
254
+ ...(options.dashed === undefined ? {} : { dashed: options.dashed }),
255
+ ...(options.tone === undefined ? {} : { tone: options.tone }),
256
+ };
257
+ }
258
+ export function layoutSlide(id, layout, options = {}) {
259
+ return slide(id, {
260
+ ...options,
261
+ layout,
262
+ });
263
+ }
264
+ export function layoutScene(id, layout, options = {}) {
265
+ return scene(id, {
266
+ ...options,
267
+ layout,
268
+ });
269
+ }
270
+ export function titleLayout(title, options = {}) {
271
+ const children = [];
272
+ if (options.kicker !== undefined) {
273
+ children.push(text(options.kicker, { variant: "caption" }));
274
+ }
275
+ children.push(heading(title, headingOptions(options.level)));
276
+ if (options.subtitle !== undefined) {
277
+ children.push(text(options.subtitle, { variant: "lead" }));
278
+ }
279
+ return hero(children);
280
+ }
281
+ export function sectionLayout(title, children, options = {}) {
282
+ return stack([
283
+ heading(title, headingOptions(options.level)),
284
+ ...normalizeLayoutChildren(children),
285
+ ]);
286
+ }
287
+ export function twoColumn(left, right, options = {}) {
288
+ return split([normalizeColumnLayout(left), normalizeColumnLayout(right)], options);
289
+ }
290
+ export function mediaHero(src, options = {}) {
291
+ const children = [];
292
+ if (options.title !== undefined) {
293
+ children.push(heading(options.title));
294
+ }
295
+ if (options.body !== undefined) {
296
+ children.push(text(options.body, { variant: "lead" }));
297
+ }
298
+ children.push(media(src, {
299
+ ...(options.alt === undefined ? {} : { alt: options.alt }),
300
+ ...(options.fit === undefined ? {} : { fit: options.fit }),
301
+ }));
302
+ return hero(children);
303
+ }
304
+ export function quote(value, options = {}) {
305
+ const children = [text(value)];
306
+ if (options.attribution !== undefined) {
307
+ children.push(text(options.attribution, { variant: "caption" }));
308
+ }
309
+ return callout(children, { tone: "quote" });
310
+ }
311
+ export function fragment(id, options = {}) {
312
+ return {
313
+ id,
314
+ ...options,
315
+ };
316
+ }
317
+ export function cue(time, action) {
318
+ return {
319
+ time,
320
+ action,
321
+ };
322
+ }
323
+ export function defineTheme(theme) {
324
+ return theme;
325
+ }
326
+ export function definePlugin(plugin) {
327
+ return plugin;
328
+ }
329
+ export function defineConfig(config) {
330
+ return config;
331
+ }
332
+ //# sourceMappingURL=builders.js.map