Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat(types): ts-rs derives on every wire type, behind a types feature

Jareer3eede14ad2ad
diff --git a/desktop/src-tauri/Cargo.lock b/desktop/src-tauri/Cargo.lock
index dae2c962..a4290e81 100644
--- a/desktop/src-tauri/Cargo.lock
+++ b/desktop/src-tauri/Cargo.lock
@@ -4601,6 +4601,28 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+[[package]]
+name = "ts-rs"
+version = "12.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "756050066659291d47a554a9f558125db17428b073c5ffce1daf5dcb0f7231d8"
+dependencies = [
+ "thiserror 2.0.20",
+ "ts-rs-macros",
+]
+
+[[package]]
+name = "ts-rs-macros"
+version = "12.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38d90eea51bc7988ef9e674bf80a85ba6804739e535e9cab48e4bb34a8b652aa"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+ "termcolor",
+]
+
[[package]]
name = "typeid"
version = "1.0.3"
@@ -5757,6 +5779,7 @@ dependencies = [
"tauri-build",
"tauri-plugin-dialog",
"tauri-plugin-opener",
+ "ts-rs",
"ureq",
"wolfcut-core",
"wolfcut-export",
@@ -5772,6 +5795,7 @@ dependencies = [
"serde",
"wolfcut-core",
"wolfcut-media",
+ "wolfcut-project",
"wolfcut-render",
]
@@ -5790,6 +5814,8 @@ version = "0.1.0"
dependencies = [
"serde",
"serde_json",
+ "thiserror 2.0.20",
+ "ts-rs",
]
[[package]]
diff --git a/desktop/src-tauri/Cargo.toml b/desktop/src-tauri/Cargo.toml
index 28b45af0..f91a74ff 100644
--- a/desktop/src-tauri/Cargo.toml
+++ b/desktop/src-tauri/Cargo.toml
@@ -40,6 +40,15 @@ memmap2 = "0.9"
# worth of dependencies for one GET.
ureq = "2"
+# TypeScript bindings for the host's own wire types (EditorView and friends),
+# generated by `cargo test --features types export_bindings` with
+# TS_RS_EXPORT_DIR pointed at desktop/src/lib/generated - see the README
+# there. Optional so normal builds never pay for it.
+ts-rs = { version = "12", optional = true }
+
+[features]
+types = ["dep:ts-rs", "wolfcut-project/types"]
+
[lints.clippy]
# Same stance as the engine workspace: a Tauri command's arguments are its
# wire signature, and splitting one to satisfy a count is cleverness.
diff --git a/desktop/src-tauri/src/editor_api.rs b/desktop/src-tauri/src/editor_api.rs
index 7179fed3..be3f6ce3 100644
--- a/desktop/src-tauri/src/editor_api.rs
+++ b/desktop/src-tauri/src/editor_api.rs
@@ -30,6 +30,8 @@ pub struct Session {
/// What every mutating call returns: the authoritative state plus history
/// availability, so the UI's undo/redo affordances are never guessing.
#[derive(Serialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct EditorView {
project: wolfcut_project::Project,
@@ -41,16 +43,23 @@ pub struct EditorView {
settings: SettingsView,
/// The id a creating command minted, if any.
#[serde(skip_serializing_if = "Option::is_none")]
+ #[cfg_attr(feature = "types", ts(optional))]
created_id: Option<String>,
}
#[derive(Serialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct SettingsView {
name: String,
width: u32,
height: u32,
+ // i64 over the wire is a plain JSON number, not a bigint - serde_json
+ // writes it bare and the UI reads it with JSON.parse.
+ #[cfg_attr(feature = "types", ts(type = "number"))]
rate_num: i64,
+ #[cfg_attr(feature = "types", ts(type = "number"))]
rate_den: i64,
}
diff --git a/engine/Cargo.lock b/engine/Cargo.lock
index dab58e29..991b5065 100644
--- a/engine/Cargo.lock
+++ b/engine/Cargo.lock
@@ -1092,6 +1092,28 @@ dependencies = [
"syn 3.0.4",
]
+[[package]]
+name = "ts-rs"
+version = "12.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "756050066659291d47a554a9f558125db17428b073c5ffce1daf5dcb0f7231d8"
+dependencies = [
+ "thiserror",
+ "ts-rs-macros",
+]
+
+[[package]]
+name = "ts-rs-macros"
+version = "12.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38d90eea51bc7988ef9e674bf80a85ba6804739e535e9cab48e4bb34a8b652aa"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+ "termcolor",
+]
+
[[package]]
name = "unicode-ident"
version = "1.0.24"
@@ -1513,6 +1535,7 @@ name = "wolfcut-export"
version = "0.1.0"
dependencies = [
"serde",
+ "ts-rs",
"wolfcut-core",
"wolfcut-media",
"wolfcut-project",
@@ -1536,6 +1559,7 @@ dependencies = [
"serde",
"serde_json",
"thiserror",
+ "ts-rs",
]
[[package]]
diff --git a/engine/crates/wolfcut-export/Cargo.toml b/engine/crates/wolfcut-export/Cargo.toml
index c37a1684..990442f7 100644
--- a/engine/crates/wolfcut-export/Cargo.toml
+++ b/engine/crates/wolfcut-export/Cargo.toml
@@ -10,6 +10,10 @@ description = "Rendering a timeline to a file, and one true frame of it to a mon
# The GPU compositor for full exports. Off by default for the same reason as
# wolfcut-render's: engine-only work never pays for the wgpu tree.
gpu = ["wolfcut-render/gpu"]
+# TypeScript bindings for the wire types the UI sends (rasterised title
+# overlays ride the export request as ExportClips). Off by default; see
+# desktop/src/lib/generated/README.md for the generator command.
+types = ["dep:ts-rs"]
[dependencies]
wolfcut-core.workspace = true
@@ -17,6 +21,7 @@ wolfcut-media.workspace = true
wolfcut-render.workspace = true
wolfcut-project = { path = "../wolfcut-project" }
serde = { version = "1", features = ["derive"] }
+ts-rs = { version = "12", optional = true }
[lints]
workspace = true
diff --git a/engine/crates/wolfcut-export/src/lib.rs b/engine/crates/wolfcut-export/src/lib.rs
index 8f1d625f..8bb7939a 100644
--- a/engine/crates/wolfcut-export/src/lib.rs
+++ b/engine/crates/wolfcut-export/src/lib.rs
@@ -39,6 +39,8 @@ use wolfcut_render::{Compositor, CpuCompositor, Layer, Placement, plan_frame};
/// What a flattened clip is. Typed, so a kind check the compiler has not
/// seen cannot exist - the wire still says "video"/"audio"/"image".
#[derive(Deserialize, Clone, Copy, PartialEq, Eq)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export, export_to = "export/"))]
#[serde(rename_all = "lowercase")]
pub enum ClipKind {
/// Footage: pictures over time, possibly with its own sound.
@@ -58,6 +60,8 @@ impl ClipKind {
/// One clip, as the frontend's flattener describes it.
#[derive(Deserialize, Clone)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export, export_to = "export/"))]
#[serde(rename_all = "camelCase")]
pub struct ExportClip {
/// The media file this clip shows or plays.
@@ -117,29 +121,36 @@ pub struct ExportClip {
/// The transition into this clip's cut, when the UI put one there. The
/// clip before it on the same track is found here, by adjacency - the UI
/// only says what it wants, never how to overlap decoders.
+ #[cfg_attr(feature = "types", ts(optional = nullable))]
#[serde(default)]
pub transition: Option<TransitionSpec>,
/// Video opacity ramp up from the clip's start, in seconds. Set by
/// transition resolution below, never by the UI directly.
+ #[cfg_attr(feature = "types", ts(as = "Option<f64>", optional))]
#[serde(default)]
pub video_fade_in: f64,
/// The source's pixel width, when the UI knows it. What makes an
/// aspect-correct decode possible - absent, the frame is filled edge to
/// edge the way it always was.
+ #[cfg_attr(feature = "types", ts(optional = nullable))]
#[serde(default)]
pub media_width: Option<u32>,
/// The source's pixel height; see `media_width`.
+ #[cfg_attr(feature = "types", ts(optional = nullable))]
#[serde(default)]
pub media_height: Option<u32>,
/// Whether the file carries an audio stream, when the UI knows (the
/// document records it at import). Absent falls back to probing, so an
/// older caller still exports correctly - just slower to start.
+ #[cfg_attr(feature = "types", ts(optional = nullable))]
#[serde(default)]
pub has_audio: Option<bool>,
}
/// A transition on the cut into a clip.
#[derive(Deserialize, Clone)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export, export_to = "export/"))]
#[serde(rename_all = "camelCase")]
pub struct TransitionSpec {
/// "cross-fade", "fade-black" or "fade-white". Anything else is ignored.
diff --git a/engine/crates/wolfcut-project/Cargo.toml b/engine/crates/wolfcut-project/Cargo.toml
index b717fdee..4807efb9 100644
--- a/engine/crates/wolfcut-project/Cargo.toml
+++ b/engine/crates/wolfcut-project/Cargo.toml
@@ -6,10 +6,19 @@ rust-version.workspace = true
license.workspace = true
description = "The edit itself: the project document, its operations, and undo. The engine's ownership of the model."
+[features]
+# TypeScript bindings for the wire types, generated straight from these serde
+# structs so the UI cannot drift from the engine. Off by default: normal
+# builds never pay for the generator. Regenerate with
+# `TS_RS_EXPORT_DIR=<abs path to desktop/src/lib/generated> cargo test -p wolfcut-project --features types export_bindings`
+# (see desktop/src/lib/generated/README.md).
+types = ["dep:ts-rs"]
+
[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json.workspace = true
thiserror.workspace = true
+ts-rs = { version = "12", optional = true }
[lints]
workspace = true
diff --git a/engine/crates/wolfcut-project/src/commands.rs b/engine/crates/wolfcut-project/src/commands.rs
index f627a467..973ace0a 100644
--- a/engine/crates/wolfcut-project/src/commands.rs
+++ b/engine/crates/wolfcut-project/src/commands.rs
@@ -34,6 +34,8 @@ const JOIN_EPSILON: f64 = 1e-6;
/// Which end of a clip a trim drags. The two are not symmetric: see
/// [`Command::TrimClip`].
#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "lowercase")]
pub enum TrimEdge {
/// The head. Trimming here moves the in-point with the edge, so the
@@ -45,6 +47,8 @@ pub enum TrimEdge {
/// Which per-track toggle a [`Command::SetTrackFlag`] flips.
#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "lowercase")]
pub enum TrackFlag {
/// [`Track::visible`]: whether the track's video reaches the composite.
@@ -55,6 +59,8 @@ pub enum TrackFlag {
/// Where one clip is going, in a multi-clip move.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct ClipMove {
/// The clip to move. An unknown id is skipped, not an error - the rest
@@ -71,34 +77,46 @@ pub struct ClipMove {
/// `text` are double-optional so "clear it" and "leave it alone" stay
/// distinct on the wire (absent = untouched, null = cleared).
#[derive(Clone, Default, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct ClipPatch {
/// New display name, taken verbatim. A later `text` patch overwrites it
/// with the title's first line.
+ #[cfg_attr(feature = "types", ts(optional))]
pub name: Option<String>,
/// New gain; floored at 0, deliberately not capped at 1 - boosting quiet
/// footage is legitimate.
+ #[cfg_attr(feature = "types", ts(optional))]
pub volume: Option<f64>,
/// New fade-in length in seconds, floored at 0.
+ #[cfg_attr(feature = "types", ts(optional))]
pub fade_in: Option<f64>,
/// New fade-out length in seconds, floored at 0.
+ #[cfg_attr(feature = "types", ts(optional))]
pub fade_out: Option<f64>,
/// New opacity, clamped into 0..=1.
+ #[cfg_attr(feature = "types", ts(optional))]
pub opacity: Option<f64>,
/// New pitch-preservation setting, taken as sent.
+ #[cfg_attr(feature = "types", ts(optional))]
pub preserve_pitch: Option<bool>,
/// Wholesale replacement of the audio filter chain - the UI sends the
/// full list, not a diff.
+ #[cfg_attr(feature = "types", ts(optional))]
pub filters: Option<Vec<AppliedFilter>>,
/// Wholesale replacement of the video effect chain, like `filters`.
+ #[cfg_attr(feature = "types", ts(optional))]
pub video_effects: Option<Vec<AppliedFilter>>,
/// The transition on the cut into the clip: absent leaves it alone,
/// null clears it, a value replaces it.
#[serde(default, with = "double_option", skip_serializing_if = "Option::is_none")]
+ #[cfg_attr(feature = "types", ts(as = "Option<Transition>", optional = nullable))]
pub transition_in: Option<Option<Transition>>,
/// The title styling, same three-way wire semantics as `transition_in`.
/// Setting a style also renames the clip after its first line.
#[serde(default, with = "double_option", skip_serializing_if = "Option::is_none")]
+ #[cfg_attr(feature = "types", ts(as = "Option<TextStyle>", optional = nullable))]
pub text: Option<Option<TextStyle>>,
}
@@ -125,6 +143,8 @@ mod double_option {
/// A media item as probed by the host, before the model mints its id.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct NewMedia {
/// Absolute path on disk. Adding a path already in the bin is a no-op,
@@ -158,6 +178,8 @@ pub struct NewMedia {
/// notes here state the contract - clamps, tolerances, what gets minted -
/// so a caller need not read `apply` to know what a command will do.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(tag = "op", rename_all = "camelCase", rename_all_fields = "camelCase")]
pub enum Command {
/// Imports a file into the bin, minting an "m" id. A path already
@@ -231,10 +253,12 @@ pub enum Command {
/// Seconds on the timeline; the editorial default when absent. Here
/// so a caption run can land as one batch instead of add-then-trim
/// per clip - a batch cannot trim a clip whose id it cannot know yet.
+ #[cfg_attr(feature = "types", ts(optional))]
#[serde(default)]
duration: Option<f64>,
/// Vertical placement as a frame-height fraction, clamped like
/// SetClipTransform. Lower thirds are made of this.
+ #[cfg_attr(feature = "types", ts(optional))]
#[serde(default)]
offset_y: Option<f64>,
},
@@ -304,13 +328,17 @@ pub enum Command {
/// The clip to place. An unknown id is a no-op.
clip_id: String,
/// New scale, clamped into 0.05..=8.
+ #[cfg_attr(feature = "types", ts(optional))]
scale: Option<f64>,
/// New horizontal offset as a frame-width fraction, clamped to ±3.
+ #[cfg_attr(feature = "types", ts(optional))]
offset_x: Option<f64>,
/// New vertical offset as a frame-height fraction, clamped to ±3.
+ #[cfg_attr(feature = "types", ts(optional))]
offset_y: Option<f64>,
/// New rotation in degrees, wrapped into (-180, 180] so a full drag
/// never accumulates turns.
+ #[cfg_attr(feature = "types", ts(optional))]
rotation: Option<f64>,
},
/// Pulls a video clip's sound out into its own audio clip on a free
@@ -395,11 +423,14 @@ pub enum Command {
/// What a command produced, beyond the new state: the ids it minted, so the
/// UI can select what it just created, and whether anything changed at all.
#[derive(Clone, Default, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct Outcome {
/// The id of what the command created - a clip, track, timeline, or
/// media item - or, for a batch, the last id minted inside it. Absent
/// when nothing was created, including tolerated no-ops.
+ #[cfg_attr(feature = "types", ts(optional))]
#[serde(skip_serializing_if = "Option::is_none")]
pub created_id: Option<String>,
/// Whether the command actually changed the project. A tolerated no-op -
diff --git a/engine/crates/wolfcut-project/src/model.rs b/engine/crates/wolfcut-project/src/model.rs
index 0b427171..2a5eb74f 100644
--- a/engine/crates/wolfcut-project/src/model.rs
+++ b/engine/crates/wolfcut-project/src/model.rs
@@ -17,6 +17,8 @@ use serde::{Deserialize, Serialize};
/// What a piece of media is. A still is not a video with one frame: it has no
/// intrinsic duration, so its length on a timeline is editorial.
#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "lowercase")]
pub enum MediaKind {
/// Moving pictures, with or without embedded sound.
@@ -30,6 +32,8 @@ pub enum MediaKind {
/// What a clip can be - wider than [`MediaKind`] because a text clip has no
/// file behind it; it *is* its own content.
#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "lowercase")]
pub enum ClipKind {
/// A cut of a video media item.
@@ -53,6 +57,8 @@ impl ClipKind {
/// probe learned about it. The probe metadata is stored, not re-derived, so a
/// document opens meaningfully even when the file itself is missing.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct MediaItem {
/// Minted by the editor ("m1", "m2", ...) and never re-issued, even
@@ -87,6 +93,7 @@ pub struct MediaItem {
/// own file (`Command::FillSlot`). In a creator's own project the path is
/// still real; only a packed template bundle blanks it. Skipped when
/// false, so documents without templates stay byte-identical.
+ #[cfg_attr(feature = "types", ts(as = "Option<bool>", optional))]
#[serde(default, skip_serializing_if = "is_false")]
pub placeholder: bool,
}
@@ -97,6 +104,8 @@ fn is_false(value: &bool) -> bool {
/// A lane. Deliberately untyped: any media goes on any track.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct Track {
/// Minted per timeline ("t5", or "T1".."T4" for the first timeline's
@@ -115,6 +124,8 @@ pub struct Track {
/// parameters were set. The catalogues themselves (and the FFmpeg strings
/// they build) live in the UI today; the model only stores the numbers.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct AppliedFilter {
/// Which catalogue entry this is, e.g. "sepia". Not minted; an id the
@@ -125,6 +136,7 @@ pub struct AppliedFilter {
#[serde(default)]
pub params: BTreeMap<String, f64>,
/// False bypasses without losing settings. Absent means enabled.
+ #[cfg_attr(feature = "types", ts(as = "Option<bool>", optional))]
#[serde(default = "yes")]
pub enabled: bool,
}
@@ -135,6 +147,8 @@ fn yes() -> bool {
/// A transition on the cut into a clip.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct Transition {
/// Which transition from the catalogue, e.g. "cross-fade".
@@ -146,6 +160,8 @@ pub struct Transition {
/// How a title's lines sit within their block. The block itself is placed by
/// the clip's transform, so this only matters for multi-line text.
#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "lowercase")]
pub enum TextAlign {
/// Lines share a left edge.
@@ -160,6 +176,8 @@ pub enum TextAlign {
/// A title's styling. Sizes are fractions of the frame, so a title composed
/// against 1080p lands correctly exported at 4K.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct TextStyle {
/// The words themselves, newlines included. The clip's display name is
@@ -224,6 +242,8 @@ impl Default for TextStyle {
/// timing, mix, transform, and effects. Everything an edit decision touches
/// lives here, which is why most commands are clip commands.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct Clip {
/// Minted by the editor ("c1", "c2", ...); how every command names its
@@ -275,15 +295,19 @@ pub struct Clip {
#[serde(default)]
pub video_effects: Vec<AppliedFilter>,
/// True when a video clip's embedded audio is detached out of it.
+ #[cfg_attr(feature = "types", ts(optional))]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub muted: Option<bool>,
/// On a detached audio clip: the video clip the sound came from.
+ #[cfg_attr(feature = "types", ts(optional))]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub detached_from: Option<String>,
/// The transition on the cut into this clip, if any.
+ #[cfg_attr(feature = "types", ts(optional))]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub transition_in: Option<Transition>,
/// The overlay, when this is a text clip.
+ #[cfg_attr(feature = "types", ts(optional))]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text: Option<TextStyle>,
}
@@ -293,6 +317,8 @@ pub struct Clip {
/// operations could stay ignorant of timelines. Here every operation takes
/// the project and works on whichever timeline is active.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct Timeline {
/// Minted by the editor ("tl2", ...), except the founding "TL1".
@@ -309,6 +335,8 @@ pub struct Timeline {
/// A font the user added from disk.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct CustomFont {
/// The family name titles refer to; removal leaves referring clips
@@ -322,6 +350,8 @@ pub struct CustomFont {
/// The edit: everything the document stores except the app-level settings
/// (name, output format) that the host manages around it.
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
+#[cfg_attr(feature = "types", derive(ts_rs::TS))]
+#[cfg_attr(feature = "types", ts(export))]
#[serde(rename_all = "camelCase")]
pub struct Project {
/// The bin: every imported file, shared by all timelines.