From 21539f33ff57054db987731a3bb3221895d6d57d Mon Sep 17 00:00:00 2001 From: bokuweb Date: Fri, 19 Jan 2024 19:41:39 +0900 Subject: [PATCH] chore: add some types --- Cargo.lock | 51 ++++++++++++------- docx-core/Cargo.toml | 2 +- docx-core/bindings/FontGroup.ts | 1 + docx-core/bindings/FontScheme.ts | 1 + docx-core/bindings/FontSchemeFont.ts | 1 + docx-core/bindings/Theme.ts | 1 + docx-core/src/documents/elements/bold.rs | 12 ++--- docx-core/src/documents/elements/bold_cs.rs | 12 ++--- docx-core/src/documents/elements/br.rs | 2 + docx-core/src/documents/elements/caps.rs | 12 ++--- .../documents/elements/character_spacing.rs | 15 +++--- docx-core/src/documents/elements/color.rs | 12 ++--- docx-core/src/documents/elements/comment.rs | 3 ++ .../documents/elements/comment_range_end.rs | 2 + .../documents/elements/comment_range_start.rs | 2 + docx-core/src/documents/elements/delete.rs | 4 ++ .../src/documents/elements/delete_text.rs | 2 + docx-core/src/documents/elements/highlight.rs | 12 ++--- docx-core/src/documents/elements/insert.rs | 5 ++ .../src/documents/elements/instr_pageref.rs | 7 ++- docx-core/src/documents/elements/instr_tc.rs | 2 + .../src/documents/elements/instr_text.rs | 2 + docx-core/src/documents/elements/italic.rs | 12 ++--- docx-core/src/documents/elements/italic_cs.rs | 12 ++--- docx-core/src/documents/elements/paragraph.rs | 1 + docx-core/src/documents/elements/run.rs | 3 ++ docx-core/src/documents/elements/run_fonts.rs | 2 + .../src/documents/elements/run_property.rs | 2 + docx-core/src/documents/elements/run_style.rs | 16 +++--- .../src/documents/elements/spec_vanish.rs | 10 ++-- docx-core/src/documents/elements/strike.rs | 12 ++--- docx-core/src/documents/elements/sym.rs | 2 + docx-core/src/documents/elements/sz.rs | 13 ++--- docx-core/src/documents/elements/sz_cs.rs | 14 ++--- docx-core/src/documents/elements/tab.rs | 2 + docx-core/src/documents/elements/text.rs | 2 + .../src/documents/elements/text_border.rs | 2 + docx-core/src/documents/elements/text_box.rs | 1 + docx-core/src/documents/elements/underline.rs | 12 ++--- docx-core/src/documents/elements/vanish.rs | 8 +-- .../src/documents/elements/vert_align.rs | 15 +++--- docx-core/src/types/border_type.rs | 2 + docx-core/src/types/break_type.rs | 2 + docx-core/src/types/tab_leader_type.rs | 2 + docx-core/src/types/tab_value_type.rs | 2 + docx-wasm/js/json/bindings/Bold.ts | 3 ++ docx-wasm/js/json/bindings/BoldCs.ts | 3 ++ docx-wasm/js/json/bindings/BorderType.ts | 3 ++ docx-wasm/js/json/bindings/Break.ts | 4 ++ docx-wasm/js/json/bindings/BreakType.ts | 3 ++ docx-wasm/js/json/bindings/Caps.ts | 3 ++ .../js/json/bindings/CharacterSpacing.ts | 3 ++ docx-wasm/js/json/bindings/Color.ts | 3 ++ docx-wasm/js/json/bindings/Comment.ts | 3 ++ docx-wasm/js/json/bindings/CommentRangeEnd.ts | 3 ++ .../js/json/bindings/CommentRangeStart.ts | 4 ++ docx-wasm/js/json/bindings/Delete.ts | 4 ++ docx-wasm/js/json/bindings/DeleteChild.ts | 6 +++ docx-wasm/js/json/bindings/DeleteText.ts | 3 ++ docx-wasm/js/json/bindings/DrawingPosition.ts | 3 +- .../js/json/bindings/DrawingPositionType.ts | 1 + docx-wasm/js/json/bindings/FieldChar.ts | 1 + docx-wasm/js/json/bindings/FieldCharType.ts | 1 + docx-wasm/js/json/bindings/FontGroup.ts | 1 + docx-wasm/js/json/bindings/FontScheme.ts | 1 + docx-wasm/js/json/bindings/FontSchemeFont.ts | 1 + docx-wasm/js/json/bindings/FooterReference.ts | 2 + docx-wasm/js/json/bindings/HeaderReference.ts | 2 + docx-wasm/js/json/bindings/Highlight.ts | 3 ++ docx-wasm/js/json/bindings/HyperlinkType.ts | 1 + docx-wasm/js/json/bindings/ImageData.ts | 1 + docx-wasm/js/json/bindings/Insert.ts | 3 ++ docx-wasm/js/json/bindings/InsertChild.ts | 7 +++ docx-wasm/js/json/bindings/InstrHyperlink.ts | 1 + docx-wasm/js/json/bindings/InstrPAGEREF.ts | 3 ++ docx-wasm/js/json/bindings/InstrTC.ts | 3 ++ docx-wasm/js/json/bindings/InstrText.ts | 7 +++ docx-wasm/js/json/bindings/InstrToC.ts | 1 + docx-wasm/js/json/bindings/Italic.ts | 3 ++ docx-wasm/js/json/bindings/ItalicCs.ts | 3 ++ docx-wasm/js/json/bindings/Pic.ts | 1 + docx-wasm/js/json/bindings/PicAlign.ts | 1 + .../js/json/bindings/RelativeFromHType.ts | 3 +- .../js/json/bindings/RelativeFromVType.ts | 3 +- docx-wasm/js/json/bindings/Run.ts | 4 ++ docx-wasm/js/json/bindings/RunFonts.ts | 3 ++ docx-wasm/js/json/bindings/RunProperty.ts | 23 +++++++++ docx-wasm/js/json/bindings/RunStyle.ts | 3 ++ docx-wasm/js/json/bindings/Shape.ts | 1 + docx-wasm/js/json/bindings/SpecVanish.ts | 3 ++ docx-wasm/js/json/bindings/Strike.ts | 3 ++ docx-wasm/js/json/bindings/StyleWithLevel.ts | 1 + docx-wasm/js/json/bindings/Sym.ts | 3 ++ docx-wasm/js/json/bindings/Sz.ts | 3 ++ docx-wasm/js/json/bindings/SzCs.ts | 3 ++ docx-wasm/js/json/bindings/Tab.ts | 5 ++ docx-wasm/js/json/bindings/TabLeaderType.ts | 3 ++ docx-wasm/js/json/bindings/TabValueType.ts | 3 ++ docx-wasm/js/json/bindings/Text.ts | 3 ++ docx-wasm/js/json/bindings/TextBorder.ts | 4 ++ docx-wasm/js/json/bindings/Theme.ts | 1 + docx-wasm/js/json/bindings/Underline.ts | 3 ++ docx-wasm/js/json/bindings/Vanish.ts | 3 ++ docx-wasm/js/json/bindings/VertAlign.ts | 3 ++ 104 files changed, 373 insertions(+), 122 deletions(-) create mode 100644 docx-wasm/js/json/bindings/Bold.ts create mode 100644 docx-wasm/js/json/bindings/BoldCs.ts create mode 100644 docx-wasm/js/json/bindings/BorderType.ts create mode 100644 docx-wasm/js/json/bindings/Break.ts create mode 100644 docx-wasm/js/json/bindings/BreakType.ts create mode 100644 docx-wasm/js/json/bindings/Caps.ts create mode 100644 docx-wasm/js/json/bindings/CharacterSpacing.ts create mode 100644 docx-wasm/js/json/bindings/Color.ts create mode 100644 docx-wasm/js/json/bindings/Comment.ts create mode 100644 docx-wasm/js/json/bindings/CommentRangeEnd.ts create mode 100644 docx-wasm/js/json/bindings/CommentRangeStart.ts create mode 100644 docx-wasm/js/json/bindings/Delete.ts create mode 100644 docx-wasm/js/json/bindings/DeleteChild.ts create mode 100644 docx-wasm/js/json/bindings/DeleteText.ts create mode 100644 docx-wasm/js/json/bindings/FooterReference.ts create mode 100644 docx-wasm/js/json/bindings/HeaderReference.ts create mode 100644 docx-wasm/js/json/bindings/Highlight.ts create mode 100644 docx-wasm/js/json/bindings/Insert.ts create mode 100644 docx-wasm/js/json/bindings/InsertChild.ts create mode 100644 docx-wasm/js/json/bindings/InstrPAGEREF.ts create mode 100644 docx-wasm/js/json/bindings/InstrTC.ts create mode 100644 docx-wasm/js/json/bindings/InstrText.ts create mode 100644 docx-wasm/js/json/bindings/Italic.ts create mode 100644 docx-wasm/js/json/bindings/ItalicCs.ts create mode 100644 docx-wasm/js/json/bindings/Run.ts create mode 100644 docx-wasm/js/json/bindings/RunFonts.ts create mode 100644 docx-wasm/js/json/bindings/RunProperty.ts create mode 100644 docx-wasm/js/json/bindings/RunStyle.ts create mode 100644 docx-wasm/js/json/bindings/SpecVanish.ts create mode 100644 docx-wasm/js/json/bindings/Strike.ts create mode 100644 docx-wasm/js/json/bindings/Sym.ts create mode 100644 docx-wasm/js/json/bindings/Sz.ts create mode 100644 docx-wasm/js/json/bindings/SzCs.ts create mode 100644 docx-wasm/js/json/bindings/Tab.ts create mode 100644 docx-wasm/js/json/bindings/TabLeaderType.ts create mode 100644 docx-wasm/js/json/bindings/TabValueType.ts create mode 100644 docx-wasm/js/json/bindings/Text.ts create mode 100644 docx-wasm/js/json/bindings/TextBorder.ts create mode 100644 docx-wasm/js/json/bindings/Underline.ts create mode 100644 docx-wasm/js/json/bindings/Vanish.ts create mode 100644 docx-wasm/js/json/bindings/VertAlign.ts diff --git a/Cargo.lock b/Cargo.lock index e3226949d..bb0d4f77f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,7 +123,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd8ce37ad4184ab2ce004c33bf6379185d3b1c95801cab51026bd271bf68eedc" dependencies = [ "quote", - "syn", + "syn 1.0.76", ] [[package]] @@ -250,9 +250,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.66" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "linked-hash-map" @@ -349,18 +349,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.29" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -388,7 +388,7 @@ checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.76", ] [[package]] @@ -431,6 +431,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "termcolor" version = "1.1.2" @@ -467,7 +478,7 @@ checksum = "24069c0ba08aab54289d6a25f5036d94afc61e1538bbc42ae5501df141c9027d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.76", ] [[package]] @@ -483,9 +494,9 @@ dependencies = [ [[package]] name = "ts-rs" -version = "6.1.1" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df082879c2ca6521d54bedd7d6d2e9407b7d457dede64415f1739d3a44a19b05" +checksum = "ee928abbcfd4d13e0a65a30c5e9904aad823d3053cbdc4327e4c7fa053140c6e" dependencies = [ "thiserror", "ts-rs-macros", @@ -493,17 +504,23 @@ dependencies = [ [[package]] name = "ts-rs-macros" -version = "6.1.1" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f402688b565efbe1a0ffb296e201c12f1986fd02eba37f4dc62c13098a6218c1" +checksum = "89d1f9819299b55836a08a7a6f7cfe3a6f405c03831c81b2e45f8a38b1b1531c" dependencies = [ "Inflector", "proc-macro2", "quote", - "syn", + "syn 2.0.48", "termcolor", ] +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + [[package]] name = "unicode-xid" version = "0.2.0" @@ -531,7 +548,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 1.0.76", "wasm-bindgen-shared", ] @@ -553,7 +570,7 @@ checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.76", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/docx-core/Cargo.toml b/docx-core/Cargo.toml index 3d9cde804..469f40277 100644 --- a/docx-core/Cargo.toml +++ b/docx-core/Cargo.toml @@ -31,7 +31,7 @@ serde_json = {version = "1.0" } base64 = "0.13.1" image = { version = "0.24.4", default-features = false, features=["gif", "jpeg", "png", "bmp", "tiff"] } wasm-bindgen = { version = "0.2.78", optional = true } -ts-rs = { version = "6.1", optional = true } +ts-rs = { version = "7.1", optional = true } [dev-dependencies] pretty_assertions = "1.3.0" diff --git a/docx-core/bindings/FontGroup.ts b/docx-core/bindings/FontGroup.ts index 9c9d50a1b..14dbc7205 100644 --- a/docx-core/bindings/FontGroup.ts +++ b/docx-core/bindings/FontGroup.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { FontSchemeFont } from "./FontSchemeFont"; export interface FontGroup { latin: string, ea: string, cs: string, fonts: Array, } \ No newline at end of file diff --git a/docx-core/bindings/FontScheme.ts b/docx-core/bindings/FontScheme.ts index b1bd36a02..20060138e 100644 --- a/docx-core/bindings/FontScheme.ts +++ b/docx-core/bindings/FontScheme.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { FontGroup } from "./FontGroup"; export interface FontScheme { majorFont: FontGroup, minorFont: FontGroup, } \ No newline at end of file diff --git a/docx-core/bindings/FontSchemeFont.ts b/docx-core/bindings/FontSchemeFont.ts index e8e8100ee..42b1586d5 100644 --- a/docx-core/bindings/FontSchemeFont.ts +++ b/docx-core/bindings/FontSchemeFont.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export interface FontSchemeFont { script: string, typeface: string, } \ No newline at end of file diff --git a/docx-core/bindings/Theme.ts b/docx-core/bindings/Theme.ts index 5845646f6..1f78a2449 100644 --- a/docx-core/bindings/Theme.ts +++ b/docx-core/bindings/Theme.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { FontScheme } from "./FontScheme"; export interface Theme { fontSchema: FontScheme, } \ No newline at end of file diff --git a/docx-core/src/documents/elements/bold.rs b/docx-core/src/documents/elements/bold.rs index 404945235..da9f1d636 100644 --- a/docx-core/src/documents/elements/bold.rs +++ b/docx-core/src/documents/elements/bold.rs @@ -4,9 +4,9 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct Bold { - val: bool, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct Bold(pub bool); impl Bold { pub fn new() -> Bold { @@ -14,14 +14,14 @@ impl Bold { } pub fn disable(mut self) -> Bold { - self.val = false; + self.0 = false; self } } impl Default for Bold { fn default() -> Self { - Self { val: true } + Self(true) } } @@ -30,7 +30,7 @@ impl Serialize for Bold { where S: Serializer, { - serializer.serialize_bool(self.val) + serializer.serialize_bool(self.0) } } diff --git a/docx-core/src/documents/elements/bold_cs.rs b/docx-core/src/documents/elements/bold_cs.rs index 82a5c8227..81338a48a 100644 --- a/docx-core/src/documents/elements/bold_cs.rs +++ b/docx-core/src/documents/elements/bold_cs.rs @@ -4,23 +4,23 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct BoldCs { - val: bool, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct BoldCs(pub bool); impl BoldCs { pub fn new() -> BoldCs { Default::default() } pub fn disable(mut self) -> BoldCs { - self.val = false; + self.0 = false; self } } impl Default for BoldCs { fn default() -> Self { - Self { val: true } + Self(true) } } @@ -29,7 +29,7 @@ impl Serialize for BoldCs { where S: Serializer, { - serializer.serialize_bool(self.val) + serializer.serialize_bool(self.0) } } diff --git a/docx-core/src/documents/elements/br.rs b/docx-core/src/documents/elements/br.rs index ee7a5adb2..9dca0f29d 100644 --- a/docx-core/src/documents/elements/br.rs +++ b/docx-core/src/documents/elements/br.rs @@ -6,6 +6,8 @@ use crate::types::*; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct Break { break_type: BreakType, } diff --git a/docx-core/src/documents/elements/caps.rs b/docx-core/src/documents/elements/caps.rs index 8da7ba2a8..0726492b9 100644 --- a/docx-core/src/documents/elements/caps.rs +++ b/docx-core/src/documents/elements/caps.rs @@ -4,9 +4,9 @@ use serde::{Deserialize, Serialize, Serializer}; // use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct Caps { - val: bool, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct Caps(pub bool); impl Caps { pub fn new() -> Caps { @@ -14,14 +14,14 @@ impl Caps { } pub fn disable(mut self) -> Caps { - self.val = false; + self.0 = false; self } } impl Default for Caps { fn default() -> Self { - Self { val: true } + Self(true) } } @@ -30,6 +30,6 @@ impl Serialize for Caps { where S: Serializer, { - serializer.serialize_bool(self.val) + serializer.serialize_bool(self.0) } } diff --git a/docx-core/src/documents/elements/character_spacing.rs b/docx-core/src/documents/elements/character_spacing.rs index 4e159cf49..3ccad1f0d 100644 --- a/docx-core/src/documents/elements/character_spacing.rs +++ b/docx-core/src/documents/elements/character_spacing.rs @@ -4,21 +4,20 @@ use crate::xml_builder::*; use serde::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -#[serde(rename_all = "camelCase")] -pub struct CharacterSpacing { - value: i32, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct CharacterSpacing(pub i32); impl CharacterSpacing { pub fn new(s: i32) -> CharacterSpacing { - Self { value: s } + Self(s) } } impl BuildXML for CharacterSpacing { fn build(&self) -> Vec { let b = XMLBuilder::new(); - b.spacing(self.value).build() + b.spacing(self.0).build() } } @@ -27,7 +26,7 @@ impl Serialize for CharacterSpacing { where S: Serializer, { - serializer.serialize_i32(self.value) + serializer.serialize_i32(self.0) } } @@ -47,7 +46,7 @@ mod tests { #[test] fn test_spacing_json() { - let s = CharacterSpacing { value: 100 }; + let s = CharacterSpacing(100); assert_eq!(serde_json::to_string(&s).unwrap(), r#"100"#); } } diff --git a/docx-core/src/documents/elements/color.rs b/docx-core/src/documents/elements/color.rs index 9c4543a41..5ac957ea3 100644 --- a/docx-core/src/documents/elements/color.rs +++ b/docx-core/src/documents/elements/color.rs @@ -4,19 +4,19 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Deserialize, Debug, Clone, PartialEq)] -pub struct Color { - val: String, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct Color(pub String); impl Color { pub fn new(val: impl Into) -> Color { - Color { val: val.into() } + Self(val.into()) } } impl BuildXML for Color { fn build(&self) -> Vec { - XMLBuilder::new().color(&self.val).build() + XMLBuilder::new().color(&self.0).build() } } @@ -25,7 +25,7 @@ impl Serialize for Color { where S: Serializer, { - serializer.serialize_str(&self.val) + serializer.serialize_str(&self.0) } } diff --git a/docx-core/src/documents/elements/comment.rs b/docx-core/src/documents/elements/comment.rs index dcd11a423..2d562a15f 100644 --- a/docx-core/src/documents/elements/comment.rs +++ b/docx-core/src/documents/elements/comment.rs @@ -6,10 +6,13 @@ use crate::xml_builder::*; #[derive(Serialize, Debug, Clone, PartialEq)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct Comment { pub id: usize, pub author: String, pub date: String, + #[cfg_attr(feature = "wasm", ts(type = "any[]"))] // TODO: pub children: Vec, pub parent_comment_id: Option, } diff --git a/docx-core/src/documents/elements/comment_range_end.rs b/docx-core/src/documents/elements/comment_range_end.rs index 5313f78fb..3807ba2d3 100644 --- a/docx-core/src/documents/elements/comment_range_end.rs +++ b/docx-core/src/documents/elements/comment_range_end.rs @@ -4,6 +4,8 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Serialize, Debug, Clone, PartialEq)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct CommentRangeEnd { id: usize, } diff --git a/docx-core/src/documents/elements/comment_range_start.rs b/docx-core/src/documents/elements/comment_range_start.rs index 1faeb3e9e..3b3979c85 100644 --- a/docx-core/src/documents/elements/comment_range_start.rs +++ b/docx-core/src/documents/elements/comment_range_start.rs @@ -5,6 +5,8 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Serialize, Debug, Clone, PartialEq)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct CommentRangeStart { pub id: usize, pub comment: Comment, diff --git a/docx-core/src/documents/elements/delete.rs b/docx-core/src/documents/elements/delete.rs index a8632198a..c34dd652a 100644 --- a/docx-core/src/documents/elements/delete.rs +++ b/docx-core/src/documents/elements/delete.rs @@ -5,6 +5,8 @@ use crate::xml_builder::*; use crate::{documents::*, escape}; #[derive(Serialize, Debug, Clone, PartialEq)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct Delete { pub author: String, pub date: String, @@ -12,6 +14,8 @@ pub struct Delete { } #[derive(Debug, Clone, PartialEq)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub enum DeleteChild { Run(Run), CommentStart(Box), diff --git a/docx-core/src/documents/elements/delete_text.rs b/docx-core/src/documents/elements/delete_text.rs index 949c42fec..4b01176ab 100644 --- a/docx-core/src/documents/elements/delete_text.rs +++ b/docx-core/src/documents/elements/delete_text.rs @@ -6,6 +6,8 @@ use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct DeleteText { text: String, preserve_space: bool, diff --git a/docx-core/src/documents/elements/highlight.rs b/docx-core/src/documents/elements/highlight.rs index fcbc23370..3274bd262 100644 --- a/docx-core/src/documents/elements/highlight.rs +++ b/docx-core/src/documents/elements/highlight.rs @@ -4,19 +4,19 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct Highlight { - val: String, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct Highlight(pub String); impl Highlight { pub fn new(val: impl Into) -> Highlight { - Highlight { val: val.into() } + Highlight(val.into()) } } impl BuildXML for Highlight { fn build(&self) -> Vec { - XMLBuilder::new().highlight(&self.val).build() + XMLBuilder::new().highlight(&self.0).build() } } @@ -25,7 +25,7 @@ impl Serialize for Highlight { where S: Serializer, { - serializer.serialize_str(&self.val) + serializer.serialize_str(&self.0) } } diff --git a/docx-core/src/documents/elements/insert.rs b/docx-core/src/documents/elements/insert.rs index 1d851130a..37b432136 100644 --- a/docx-core/src/documents/elements/insert.rs +++ b/docx-core/src/documents/elements/insert.rs @@ -7,6 +7,8 @@ use crate::documents::{BuildXML, HistoryId, Run}; use crate::{escape, xml_builder::*}; #[derive(Debug, Clone, PartialEq)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub enum InsertChild { Run(Box), Delete(Delete), @@ -60,7 +62,10 @@ impl Serialize for InsertChild { } #[derive(Serialize, Debug, Clone, PartialEq)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct Insert { + #[cfg_attr(feature = "wasm", ts(type = "any[]"))] // TODO: pub children: Vec, pub author: String, pub date: String, diff --git a/docx-core/src/documents/elements/instr_pageref.rs b/docx-core/src/documents/elements/instr_pageref.rs index 4f8a9bb17..e7f675ce8 100644 --- a/docx-core/src/documents/elements/instr_pageref.rs +++ b/docx-core/src/documents/elements/instr_pageref.rs @@ -5,6 +5,8 @@ use crate::documents::*; // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_PAGEREFPAGEREF_topic_ID0EHXK1.html #[derive(Serialize, Debug, Clone, PartialEq, Default)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct InstrPAGEREF { pub page_ref: String, pub hyperlink: bool, @@ -78,9 +80,6 @@ mod tests { #[test] fn test_page_ref() { let b = InstrPAGEREF::new("_Toc00000000").hyperlink().build(); - assert_eq!( - str::from_utf8(&b).unwrap(), - r#"PAGEREF _Toc00000000 \h"# - ); + assert_eq!(str::from_utf8(&b).unwrap(), r#"PAGEREF _Toc00000000 \h"#); } } diff --git a/docx-core/src/documents/elements/instr_tc.rs b/docx-core/src/documents/elements/instr_tc.rs index 5583fdffa..b842b338a 100644 --- a/docx-core/src/documents/elements/instr_tc.rs +++ b/docx-core/src/documents/elements/instr_tc.rs @@ -5,6 +5,8 @@ use crate::documents::*; // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_TCTC_topic_ID0EU2N1.html #[derive(Serialize, Debug, Clone, PartialEq, Default)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct InstrTC { pub text: String, // \n Omits the page number for the entry. diff --git a/docx-core/src/documents/elements/instr_text.rs b/docx-core/src/documents/elements/instr_text.rs index f2def1d74..d4f80d4c8 100644 --- a/docx-core/src/documents/elements/instr_text.rs +++ b/docx-core/src/documents/elements/instr_text.rs @@ -5,6 +5,8 @@ use crate::documents::*; use crate::xml_builder::*; #[derive(Debug, Clone, PartialEq)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub enum InstrText { TOC(InstrToC), TC(InstrTC), diff --git a/docx-core/src/documents/elements/italic.rs b/docx-core/src/documents/elements/italic.rs index 597ce27d1..97e3b3392 100644 --- a/docx-core/src/documents/elements/italic.rs +++ b/docx-core/src/documents/elements/italic.rs @@ -4,9 +4,9 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct Italic { - val: bool, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct Italic(pub bool); impl Italic { pub fn new() -> Italic { @@ -14,14 +14,14 @@ impl Italic { } pub fn disable(mut self) -> Self { - self.val = false; + self.0 = false; self } } impl Default for Italic { fn default() -> Self { - Self { val: true } + Self(true) } } @@ -30,7 +30,7 @@ impl Serialize for Italic { where S: Serializer, { - serializer.serialize_bool(self.val) + serializer.serialize_bool(self.0) } } diff --git a/docx-core/src/documents/elements/italic_cs.rs b/docx-core/src/documents/elements/italic_cs.rs index edc78ee76..5a0f53d1a 100644 --- a/docx-core/src/documents/elements/italic_cs.rs +++ b/docx-core/src/documents/elements/italic_cs.rs @@ -4,9 +4,9 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct ItalicCs { - val: bool, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct ItalicCs(pub bool); impl ItalicCs { pub fn new() -> ItalicCs { @@ -14,14 +14,14 @@ impl ItalicCs { } pub fn disable(mut self) -> Self { - self.val = false; + self.0 = false; self } } impl Default for ItalicCs { fn default() -> Self { - Self { val: true } + Self(true) } } @@ -30,7 +30,7 @@ impl Serialize for ItalicCs { where S: Serializer, { - serializer.serialize_bool(self.val) + serializer.serialize_bool(self.0) } } diff --git a/docx-core/src/documents/elements/paragraph.rs b/docx-core/src/documents/elements/paragraph.rs index 69509165d..67b7bb372 100644 --- a/docx-core/src/documents/elements/paragraph.rs +++ b/docx-core/src/documents/elements/paragraph.rs @@ -7,6 +7,7 @@ use crate::types::*; use crate::xml_builder::*; #[derive(Serialize, Debug, Clone, PartialEq)] + #[serde(rename_all = "camelCase")] pub struct Paragraph { pub id: String, diff --git a/docx-core/src/documents/elements/run.rs b/docx-core/src/documents/elements/run.rs index 9827c1b08..d51579e5e 100644 --- a/docx-core/src/documents/elements/run.rs +++ b/docx-core/src/documents/elements/run.rs @@ -8,8 +8,11 @@ use crate::xml_builder::*; #[derive(Serialize, Debug, Clone, PartialEq)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct Run { pub run_property: RunProperty, + #[cfg_attr(feature = "wasm", ts(type = "any[]"))] // TODO: pub children: Vec, } diff --git a/docx-core/src/documents/elements/run_fonts.rs b/docx-core/src/documents/elements/run_fonts.rs index baba5dda4..631730258 100644 --- a/docx-core/src/documents/elements/run_fonts.rs +++ b/docx-core/src/documents/elements/run_fonts.rs @@ -13,6 +13,8 @@ use crate::xml_builder::*; */ #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct RunFonts { #[serde(skip_serializing_if = "Option::is_none")] ascii: Option, diff --git a/docx-core/src/documents/elements/run_property.rs b/docx-core/src/documents/elements/run_property.rs index 750378720..b4635f698 100644 --- a/docx-core/src/documents/elements/run_property.rs +++ b/docx-core/src/documents/elements/run_property.rs @@ -7,6 +7,8 @@ use crate::xml_builder::*; #[derive(Debug, Clone, Serialize, PartialEq, Default)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct RunProperty { #[serde(skip_serializing_if = "Option::is_none")] pub style: Option, diff --git a/docx-core/src/documents/elements/run_style.rs b/docx-core/src/documents/elements/run_style.rs index 0f69c0594..b5fa559b6 100644 --- a/docx-core/src/documents/elements/run_style.rs +++ b/docx-core/src/documents/elements/run_style.rs @@ -4,27 +4,25 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, PartialEq)] -pub struct RunStyle { - pub val: String, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct RunStyle(pub String); impl Default for RunStyle { fn default() -> Self { - RunStyle { - val: "Normal".to_owned(), - } + RunStyle("Normal".to_owned()) } } impl RunStyle { pub fn new(val: impl Into) -> RunStyle { - RunStyle { val: val.into() } + RunStyle(val.into()) } } impl BuildXML for RunStyle { fn build(&self) -> Vec { - XMLBuilder::new().run_style(&self.val).build() + XMLBuilder::new().run_style(&self.0).build() } } @@ -33,7 +31,7 @@ impl Serialize for RunStyle { where S: Serializer, { - serializer.serialize_str(&self.val) + serializer.serialize_str(&self.0) } } diff --git a/docx-core/src/documents/elements/spec_vanish.rs b/docx-core/src/documents/elements/spec_vanish.rs index b262eb8d5..641c52b94 100644 --- a/docx-core/src/documents/elements/spec_vanish.rs +++ b/docx-core/src/documents/elements/spec_vanish.rs @@ -4,24 +4,26 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct SpecVanish {} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct SpecVanish(pub bool); impl SpecVanish { pub fn new() -> SpecVanish { - SpecVanish {} + SpecVanish(true) } } impl Default for SpecVanish { fn default() -> Self { - SpecVanish {} + SpecVanish(true) } } impl BuildXML for SpecVanish { fn build(&self) -> Vec { let b = XMLBuilder::new(); - b.spec_vanish().build() + b.vanish().build() } } diff --git a/docx-core/src/documents/elements/strike.rs b/docx-core/src/documents/elements/strike.rs index 8c2e8d352..2f7af7b72 100644 --- a/docx-core/src/documents/elements/strike.rs +++ b/docx-core/src/documents/elements/strike.rs @@ -4,9 +4,9 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct Strike { - pub val: bool, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct Strike(pub bool); impl Strike { pub fn new() -> Strike { @@ -14,14 +14,14 @@ impl Strike { } pub fn disable(mut self) -> Strike { - self.val = false; + self.0 = false; self } } impl Default for Strike { fn default() -> Self { - Self { val: true } + Self(true) } } @@ -30,7 +30,7 @@ impl Serialize for Strike { where S: Serializer, { - serializer.serialize_bool(self.val) + serializer.serialize_bool(self.0) } } diff --git a/docx-core/src/documents/elements/sym.rs b/docx-core/src/documents/elements/sym.rs index b6de20880..b2e183326 100644 --- a/docx-core/src/documents/elements/sym.rs +++ b/docx-core/src/documents/elements/sym.rs @@ -6,6 +6,8 @@ use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct Sym { pub font: String, pub char: String, diff --git a/docx-core/src/documents/elements/sz.rs b/docx-core/src/documents/elements/sz.rs index d93d1b502..a0710e196 100644 --- a/docx-core/src/documents/elements/sz.rs +++ b/docx-core/src/documents/elements/sz.rs @@ -2,22 +2,23 @@ use serde::{Deserialize, Serialize, Serializer}; use crate::documents::BuildXML; use crate::xml_builder::*; +use ts_rs::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct Sz { - val: usize, -} +#[cfg_attr(feature = "wasm", derive(TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct Sz(usize); impl Sz { pub fn new(val: usize) -> Sz { - Sz { val } + Sz(val) } } impl BuildXML for Sz { fn build(&self) -> Vec { let b = XMLBuilder::new(); - b.sz(self.val).build() + b.sz(self.0).build() } } @@ -26,7 +27,7 @@ impl Serialize for Sz { where S: Serializer, { - serializer.serialize_u32(self.val as u32) + serializer.serialize_u32(self.0 as u32) } } diff --git a/docx-core/src/documents/elements/sz_cs.rs b/docx-core/src/documents/elements/sz_cs.rs index fef38b20d..70957f6db 100644 --- a/docx-core/src/documents/elements/sz_cs.rs +++ b/docx-core/src/documents/elements/sz_cs.rs @@ -3,19 +3,19 @@ use crate::xml_builder::*; use serde::{Deserialize, Serialize, Serializer}; #[derive(Deserialize, Debug, Clone, PartialEq)] -pub struct SzCs { - val: usize, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct SzCs(pub usize); impl SzCs { - pub fn new(val: usize) -> SzCs { - SzCs { val } + pub fn new(val: usize) -> Self { + Self(val) } } impl BuildXML for SzCs { fn build(&self) -> Vec { - XMLBuilder::new().sz_cs(self.val).build() + XMLBuilder::new().sz_cs(self.0).build() } } @@ -24,7 +24,7 @@ impl Serialize for SzCs { where S: Serializer, { - serializer.serialize_u32(self.val as u32) + serializer.serialize_u32(self.0 as u32) } } diff --git a/docx-core/src/documents/elements/tab.rs b/docx-core/src/documents/elements/tab.rs index f10a92b1b..46c6ca296 100644 --- a/docx-core/src/documents/elements/tab.rs +++ b/docx-core/src/documents/elements/tab.rs @@ -5,6 +5,8 @@ use crate::types::*; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Default)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct Tab { pub val: Option, pub leader: Option, diff --git a/docx-core/src/documents/elements/text.rs b/docx-core/src/documents/elements/text.rs index aab291c27..2d41234c6 100644 --- a/docx-core/src/documents/elements/text.rs +++ b/docx-core/src/documents/elements/text.rs @@ -7,6 +7,8 @@ use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct Text { pub text: String, pub preserve_space: bool, diff --git a/docx-core/src/documents/elements/text_border.rs b/docx-core/src/documents/elements/text_border.rs index eb14d8c07..33daa46d6 100644 --- a/docx-core/src/documents/elements/text_border.rs +++ b/docx-core/src/documents/elements/text_border.rs @@ -6,6 +6,8 @@ use crate::xml_builder::*; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub struct TextBorder { pub border_type: BorderType, pub size: usize, diff --git a/docx-core/src/documents/elements/text_box.rs b/docx-core/src/documents/elements/text_box.rs index f6ea0bc79..abf78f194 100644 --- a/docx-core/src/documents/elements/text_box.rs +++ b/docx-core/src/documents/elements/text_box.rs @@ -5,6 +5,7 @@ use crate::types::*; #[derive(Debug, Clone, Serialize, PartialEq)] #[serde(rename_all = "camelCase")] + pub struct TextBox { // For writer only pub children: Vec, diff --git a/docx-core/src/documents/elements/underline.rs b/docx-core/src/documents/elements/underline.rs index 1a8a88f84..338b1857b 100644 --- a/docx-core/src/documents/elements/underline.rs +++ b/docx-core/src/documents/elements/underline.rs @@ -4,19 +4,19 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct Underline { - val: String, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct Underline(pub String); impl Underline { pub fn new(val: impl Into) -> Underline { - Underline { val: val.into() } + Self(val.into()) } } impl BuildXML for Underline { fn build(&self) -> Vec { - XMLBuilder::new().underline(&self.val).build() + XMLBuilder::new().underline(&self.0).build() } } @@ -25,7 +25,7 @@ impl Serialize for Underline { where S: Serializer, { - serializer.serialize_str(&self.val) + serializer.serialize_str(&self.0) } } diff --git a/docx-core/src/documents/elements/vanish.rs b/docx-core/src/documents/elements/vanish.rs index 51034250a..acfac551f 100644 --- a/docx-core/src/documents/elements/vanish.rs +++ b/docx-core/src/documents/elements/vanish.rs @@ -4,17 +4,19 @@ use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Deserialize, PartialEq)] -pub struct Vanish {} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct Vanish(pub bool); impl Vanish { pub fn new() -> Vanish { - Vanish {} + Vanish(true) } } impl Default for Vanish { fn default() -> Self { - Vanish {} + Vanish(true) } } diff --git a/docx-core/src/documents/elements/vert_align.rs b/docx-core/src/documents/elements/vert_align.rs index becc9971a..f7300ce81 100644 --- a/docx-core/src/documents/elements/vert_align.rs +++ b/docx-core/src/documents/elements/vert_align.rs @@ -5,13 +5,16 @@ use crate::types::*; use crate::xml_builder::*; #[derive(Debug, Clone, PartialEq)] -pub struct VertAlign { - val: VertAlignType, -} +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] +pub struct VertAlign( + #[cfg_attr(feature = "wasm", ts(type = "string"))] // TODO: + VertAlignType, +); impl VertAlign { pub fn new(val: VertAlignType) -> VertAlign { - Self { val } + Self(val) } } @@ -20,13 +23,13 @@ impl Serialize for VertAlign { where S: Serializer, { - serializer.serialize_str(&format!("{}", &self.val)) + serializer.serialize_str(&format!("{}", &self.0)) } } impl BuildXML for VertAlign { fn build(&self) -> Vec { let b = XMLBuilder::new(); - b.vert_align(&self.val.to_string() ).build() + b.vert_align(&self.0.to_string()).build() } } diff --git a/docx-core/src/types/border_type.rs b/docx-core/src/types/border_type.rs index d3212de9e..f8b893ee0 100644 --- a/docx-core/src/types/border_type.rs +++ b/docx-core/src/types/border_type.rs @@ -12,6 +12,8 @@ use std::str::FromStr; #[cfg_attr(feature = "wasm", wasm_bindgen)] #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub enum BorderType { Nil, None, diff --git a/docx-core/src/types/break_type.rs b/docx-core/src/types/break_type.rs index 44fad3735..3404a37cd 100644 --- a/docx-core/src/types/break_type.rs +++ b/docx-core/src/types/break_type.rs @@ -13,6 +13,8 @@ use super::errors; #[cfg_attr(feature = "wasm", wasm_bindgen)] #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq)] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub enum BreakType { Page, Column, diff --git a/docx-core/src/types/tab_leader_type.rs b/docx-core/src/types/tab_leader_type.rs index 27eb55a8e..e6b755f0f 100644 --- a/docx-core/src/types/tab_leader_type.rs +++ b/docx-core/src/types/tab_leader_type.rs @@ -10,6 +10,8 @@ use super::errors; #[cfg_attr(feature = "wasm", wasm_bindgen)] #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub enum TabLeaderType { Dot, Heavy, diff --git a/docx-core/src/types/tab_value_type.rs b/docx-core/src/types/tab_value_type.rs index 26e4c221e..04826b2c4 100644 --- a/docx-core/src/types/tab_value_type.rs +++ b/docx-core/src/types/tab_value_type.rs @@ -10,6 +10,8 @@ use super::errors; #[cfg_attr(feature = "wasm", wasm_bindgen)] #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq)] #[serde(rename_all = "camelCase")] +#[cfg_attr(feature = "wasm", derive(ts_rs::TS))] +#[cfg_attr(feature = "wasm", ts(export))] pub enum TabValueType { Bar, Center, diff --git a/docx-wasm/js/json/bindings/Bold.ts b/docx-wasm/js/json/bindings/Bold.ts new file mode 100644 index 000000000..dd342407d --- /dev/null +++ b/docx-wasm/js/json/bindings/Bold.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Bold = boolean; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/BoldCs.ts b/docx-wasm/js/json/bindings/BoldCs.ts new file mode 100644 index 000000000..35b88e469 --- /dev/null +++ b/docx-wasm/js/json/bindings/BoldCs.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type BoldCs = boolean; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/BorderType.ts b/docx-wasm/js/json/bindings/BorderType.ts new file mode 100644 index 000000000..ae262faaa --- /dev/null +++ b/docx-wasm/js/json/bindings/BorderType.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type BorderType = "nil" | "none" | "single" | "thick" | "double" | "dotted" | "dashed" | "dotdash" | "dotdotdash" | "triple" | "thinthicksmallgap" | "thickthinsmallgap" | "thinthickthinsmallgap" | "thinthickmediumgap" | "thickthinmediumgap" | "thinthickthinmediumgap" | "thinthicklargegap" | "thickthinlargegap" | "thinthickthinlargegap" | "wave" | "doublewave" | "dashsmallgap" | "dashdotstroked" | "threedemboss" | "threedengrave" | "outset" | "inset" | "apples" | "archedscallops" | "babypacifier" | "babyrattle"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Break.ts b/docx-wasm/js/json/bindings/Break.ts new file mode 100644 index 000000000..a06726788 --- /dev/null +++ b/docx-wasm/js/json/bindings/Break.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BreakType } from "./BreakType"; + +export interface Break { break_type: BreakType, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/BreakType.ts b/docx-wasm/js/json/bindings/BreakType.ts new file mode 100644 index 000000000..7d9ee9bc2 --- /dev/null +++ b/docx-wasm/js/json/bindings/BreakType.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type BreakType = "Page" | "Column" | "TextWrapping" | "Unsupported"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Caps.ts b/docx-wasm/js/json/bindings/Caps.ts new file mode 100644 index 000000000..a9a7bea23 --- /dev/null +++ b/docx-wasm/js/json/bindings/Caps.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Caps = boolean; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/CharacterSpacing.ts b/docx-wasm/js/json/bindings/CharacterSpacing.ts new file mode 100644 index 000000000..d66aac6e8 --- /dev/null +++ b/docx-wasm/js/json/bindings/CharacterSpacing.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type CharacterSpacing = number; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Color.ts b/docx-wasm/js/json/bindings/Color.ts new file mode 100644 index 000000000..3bd812f84 --- /dev/null +++ b/docx-wasm/js/json/bindings/Color.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Color = string; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Comment.ts b/docx-wasm/js/json/bindings/Comment.ts new file mode 100644 index 000000000..2b977fbdb --- /dev/null +++ b/docx-wasm/js/json/bindings/Comment.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface Comment { id: number, author: string, date: string, children: any[], parentCommentId: number | null, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/CommentRangeEnd.ts b/docx-wasm/js/json/bindings/CommentRangeEnd.ts new file mode 100644 index 000000000..58ae0c49f --- /dev/null +++ b/docx-wasm/js/json/bindings/CommentRangeEnd.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface CommentRangeEnd { id: number, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/CommentRangeStart.ts b/docx-wasm/js/json/bindings/CommentRangeStart.ts new file mode 100644 index 000000000..ac84a3c12 --- /dev/null +++ b/docx-wasm/js/json/bindings/CommentRangeStart.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Comment } from "./Comment"; + +export interface CommentRangeStart { id: number, comment: Comment, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Delete.ts b/docx-wasm/js/json/bindings/Delete.ts new file mode 100644 index 000000000..5d80d4472 --- /dev/null +++ b/docx-wasm/js/json/bindings/Delete.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { DeleteChild } from "./DeleteChild"; + +export interface Delete { author: string, date: string, children: Array, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/DeleteChild.ts b/docx-wasm/js/json/bindings/DeleteChild.ts new file mode 100644 index 000000000..78fcfa5a5 --- /dev/null +++ b/docx-wasm/js/json/bindings/DeleteChild.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CommentRangeEnd } from "./CommentRangeEnd"; +import type { CommentRangeStart } from "./CommentRangeStart"; +import type { Run } from "./Run"; + +export type DeleteChild = { "Run": Run } | { "CommentStart": CommentRangeStart } | { "CommentEnd": CommentRangeEnd }; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/DeleteText.ts b/docx-wasm/js/json/bindings/DeleteText.ts new file mode 100644 index 000000000..8c917c80e --- /dev/null +++ b/docx-wasm/js/json/bindings/DeleteText.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface DeleteText { text: string, preserveSpace: boolean, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/DrawingPosition.ts b/docx-wasm/js/json/bindings/DrawingPosition.ts index e54349d0b..a04ef6a91 100644 --- a/docx-wasm/js/json/bindings/DrawingPosition.ts +++ b/docx-wasm/js/json/bindings/DrawingPosition.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { PicAlign } from "./PicAlign"; -export type DrawingPosition = { offset: number } | { align: PicAlign }; \ No newline at end of file +export type DrawingPosition = { "offset": number } | { "align": PicAlign }; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/DrawingPositionType.ts b/docx-wasm/js/json/bindings/DrawingPositionType.ts index 9f02187a1..f185059c7 100644 --- a/docx-wasm/js/json/bindings/DrawingPositionType.ts +++ b/docx-wasm/js/json/bindings/DrawingPositionType.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export type DrawingPositionType = "anchor" | "inline"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/FieldChar.ts b/docx-wasm/js/json/bindings/FieldChar.ts index 63a32744f..31a5425e8 100644 --- a/docx-wasm/js/json/bindings/FieldChar.ts +++ b/docx-wasm/js/json/bindings/FieldChar.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { FieldCharType } from "./FieldCharType"; export interface FieldChar { fieldCharType: FieldCharType, dirty: boolean, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/FieldCharType.ts b/docx-wasm/js/json/bindings/FieldCharType.ts index 49c863ace..29f387793 100644 --- a/docx-wasm/js/json/bindings/FieldCharType.ts +++ b/docx-wasm/js/json/bindings/FieldCharType.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export type FieldCharType = "begin" | "separate" | "end" | "unsupported"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/FontGroup.ts b/docx-wasm/js/json/bindings/FontGroup.ts index 9c9d50a1b..14dbc7205 100644 --- a/docx-wasm/js/json/bindings/FontGroup.ts +++ b/docx-wasm/js/json/bindings/FontGroup.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { FontSchemeFont } from "./FontSchemeFont"; export interface FontGroup { latin: string, ea: string, cs: string, fonts: Array, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/FontScheme.ts b/docx-wasm/js/json/bindings/FontScheme.ts index b1bd36a02..20060138e 100644 --- a/docx-wasm/js/json/bindings/FontScheme.ts +++ b/docx-wasm/js/json/bindings/FontScheme.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { FontGroup } from "./FontGroup"; export interface FontScheme { majorFont: FontGroup, minorFont: FontGroup, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/FontSchemeFont.ts b/docx-wasm/js/json/bindings/FontSchemeFont.ts index e8e8100ee..42b1586d5 100644 --- a/docx-wasm/js/json/bindings/FontSchemeFont.ts +++ b/docx-wasm/js/json/bindings/FontSchemeFont.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export interface FontSchemeFont { script: string, typeface: string, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/FooterReference.ts b/docx-wasm/js/json/bindings/FooterReference.ts new file mode 100644 index 000000000..74e453f51 --- /dev/null +++ b/docx-wasm/js/json/bindings/FooterReference.ts @@ -0,0 +1,2 @@ + +export interface FooterReference { footerType: string, id: string, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/HeaderReference.ts b/docx-wasm/js/json/bindings/HeaderReference.ts new file mode 100644 index 000000000..f61a68a95 --- /dev/null +++ b/docx-wasm/js/json/bindings/HeaderReference.ts @@ -0,0 +1,2 @@ + +export interface HeaderReference { headerType: string, id: string, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Highlight.ts b/docx-wasm/js/json/bindings/Highlight.ts new file mode 100644 index 000000000..9e212c06a --- /dev/null +++ b/docx-wasm/js/json/bindings/Highlight.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Highlight = string; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/HyperlinkType.ts b/docx-wasm/js/json/bindings/HyperlinkType.ts index 5005afd4b..8b6a72ed7 100644 --- a/docx-wasm/js/json/bindings/HyperlinkType.ts +++ b/docx-wasm/js/json/bindings/HyperlinkType.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export type HyperlinkType = "anchor" | "external"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/ImageData.ts b/docx-wasm/js/json/bindings/ImageData.ts index 617356e6a..99832aef8 100644 --- a/docx-wasm/js/json/bindings/ImageData.ts +++ b/docx-wasm/js/json/bindings/ImageData.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export interface ImageData { id: string, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Insert.ts b/docx-wasm/js/json/bindings/Insert.ts new file mode 100644 index 000000000..e0a12cb1a --- /dev/null +++ b/docx-wasm/js/json/bindings/Insert.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface Insert { children: any[], author: string, date: string, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/InsertChild.ts b/docx-wasm/js/json/bindings/InsertChild.ts new file mode 100644 index 000000000..e1dc33ed9 --- /dev/null +++ b/docx-wasm/js/json/bindings/InsertChild.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { CommentRangeEnd } from "./CommentRangeEnd"; +import type { CommentRangeStart } from "./CommentRangeStart"; +import type { Delete } from "./Delete"; +import type { Run } from "./Run"; + +export type InsertChild = { "Run": Run } | { "Delete": Delete } | { "CommentStart": CommentRangeStart } | { "CommentEnd": CommentRangeEnd }; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/InstrHyperlink.ts b/docx-wasm/js/json/bindings/InstrHyperlink.ts index e69561668..3309d754d 100644 --- a/docx-wasm/js/json/bindings/InstrHyperlink.ts +++ b/docx-wasm/js/json/bindings/InstrHyperlink.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export interface InstrHyperlink { target: string, anchor: boolean, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/InstrPAGEREF.ts b/docx-wasm/js/json/bindings/InstrPAGEREF.ts new file mode 100644 index 000000000..5faeac44d --- /dev/null +++ b/docx-wasm/js/json/bindings/InstrPAGEREF.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface InstrPAGEREF { pageRef: string, hyperlink: boolean, relativePosition: boolean, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/InstrTC.ts b/docx-wasm/js/json/bindings/InstrTC.ts new file mode 100644 index 000000000..af3317d43 --- /dev/null +++ b/docx-wasm/js/json/bindings/InstrTC.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface InstrTC { text: string, omitsPageNumber: boolean, level: number | null, itemTypeIdentifier: string | null, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/InstrText.ts b/docx-wasm/js/json/bindings/InstrText.ts new file mode 100644 index 000000000..0f25d1aa1 --- /dev/null +++ b/docx-wasm/js/json/bindings/InstrText.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstrHyperlink } from "./InstrHyperlink"; +import type { InstrPAGEREF } from "./InstrPAGEREF"; +import type { InstrTC } from "./InstrTC"; +import type { InstrToC } from "./InstrToC"; + +export type InstrText = { "TOC": InstrToC } | { "TC": InstrTC } | { "PAGEREF": InstrPAGEREF } | { "HYPERLINK": InstrHyperlink } | { "Unsupported": string }; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/InstrToC.ts b/docx-wasm/js/json/bindings/InstrToC.ts index 6f227f322..93a019855 100644 --- a/docx-wasm/js/json/bindings/InstrToC.ts +++ b/docx-wasm/js/json/bindings/InstrToC.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { StyleWithLevel } from "./StyleWithLevel"; export interface InstrToC { headingStylesRange?: [number, number], tcFieldLevelRange?: [number, number], omitPageNumbersLevelRange?: [number, number], entryBookmarkName?: string, stylesWithLevels: Array, entryAndPageNumberSeparator?: string, sequenceAndPageNumbersSeparator?: string, captionLabel: string | null, captionLabelIncludingNumbers?: string, seqFieldIdentifierForPrefix?: string, tcFieldIdentifier?: string, hyperlink: boolean, preserveTab: boolean, preserveNewLine: boolean, useAppliedParagraphLineLevel: boolean, hideTabAndPageNumbersInWebview: boolean, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Italic.ts b/docx-wasm/js/json/bindings/Italic.ts new file mode 100644 index 000000000..0bed4df5a --- /dev/null +++ b/docx-wasm/js/json/bindings/Italic.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Italic = boolean; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/ItalicCs.ts b/docx-wasm/js/json/bindings/ItalicCs.ts new file mode 100644 index 000000000..582b2b5ca --- /dev/null +++ b/docx-wasm/js/json/bindings/ItalicCs.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type ItalicCs = boolean; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Pic.ts b/docx-wasm/js/json/bindings/Pic.ts index 53dcd1791..6324392f9 100644 --- a/docx-wasm/js/json/bindings/Pic.ts +++ b/docx-wasm/js/json/bindings/Pic.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { DrawingPosition } from "./DrawingPosition"; import type { DrawingPositionType } from "./DrawingPositionType"; import type { RelativeFromHType } from "./RelativeFromHType"; diff --git a/docx-wasm/js/json/bindings/PicAlign.ts b/docx-wasm/js/json/bindings/PicAlign.ts index c82a21bd1..4c9dd65f7 100644 --- a/docx-wasm/js/json/bindings/PicAlign.ts +++ b/docx-wasm/js/json/bindings/PicAlign.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export type PicAlign = "left" | "right" | "center" | "bottom" | "top"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/RelativeFromHType.ts b/docx-wasm/js/json/bindings/RelativeFromHType.ts index f62a24be0..c716d411c 100644 --- a/docx-wasm/js/json/bindings/RelativeFromHType.ts +++ b/docx-wasm/js/json/bindings/RelativeFromHType.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type RelativeFromHType = "character" | "column" | "insideMargin" | "leftMargin" | "margin" | "outsizeMargin" | "page" | "rightMargin"; \ No newline at end of file +export type RelativeFromHType = "character" | "column" | "insidemargin" | "leftmargin" | "margin" | "outsizemargin" | "page" | "rightmargin"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/RelativeFromVType.ts b/docx-wasm/js/json/bindings/RelativeFromVType.ts index 4014c9c05..51d72b553 100644 --- a/docx-wasm/js/json/bindings/RelativeFromVType.ts +++ b/docx-wasm/js/json/bindings/RelativeFromVType.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type RelativeFromVType = "bottomMargin" | "insideMargin" | "line" | "margin" | "outsizeMargin" | "page" | "paragraph" | "topMargin"; \ No newline at end of file +export type RelativeFromVType = "bottommargin" | "insidemargin" | "line" | "margin" | "outsizemargin" | "page" | "paragraph" | "topmargin"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Run.ts b/docx-wasm/js/json/bindings/Run.ts new file mode 100644 index 000000000..42c2d0e2f --- /dev/null +++ b/docx-wasm/js/json/bindings/Run.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { RunProperty } from "./RunProperty"; + +export interface Run { runProperty: RunProperty, children: any[], } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/RunFonts.ts b/docx-wasm/js/json/bindings/RunFonts.ts new file mode 100644 index 000000000..5bb3683c6 --- /dev/null +++ b/docx-wasm/js/json/bindings/RunFonts.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface RunFonts { ascii?: string, hiAnsi?: string, eastAsia?: string, cs?: string, asciiTheme?: string, hiAnsiTheme?: string, eastAsiaTheme?: string, csTheme?: string, hint?: string, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/RunProperty.ts b/docx-wasm/js/json/bindings/RunProperty.ts new file mode 100644 index 000000000..aaad666eb --- /dev/null +++ b/docx-wasm/js/json/bindings/RunProperty.ts @@ -0,0 +1,23 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Bold } from "./Bold"; +import type { BoldCs } from "./BoldCs"; +import type { Caps } from "./Caps"; +import type { CharacterSpacing } from "./CharacterSpacing"; +import type { Color } from "./Color"; +import type { Delete } from "./Delete"; +import type { Highlight } from "./Highlight"; +import type { Insert } from "./Insert"; +import type { Italic } from "./Italic"; +import type { ItalicCs } from "./ItalicCs"; +import type { RunFonts } from "./RunFonts"; +import type { RunStyle } from "./RunStyle"; +import type { SpecVanish } from "./SpecVanish"; +import type { Strike } from "./Strike"; +import type { Sz } from "./Sz"; +import type { SzCs } from "./SzCs"; +import type { TextBorder } from "./TextBorder"; +import type { Underline } from "./Underline"; +import type { Vanish } from "./Vanish"; +import type { VertAlign } from "./VertAlign"; + +export interface RunProperty { style?: RunStyle, sz?: Sz, szCs?: SzCs, color?: Color, highlight?: Highlight, vertAlign?: VertAlign, underline?: Underline, bold?: Bold, boldCs?: BoldCs, caps?: Caps, italic?: Italic, italicCs?: ItalicCs, vanish?: Vanish, specVanish?: SpecVanish, characterSpacing?: CharacterSpacing, fonts?: RunFonts, textBorder?: TextBorder, del?: Delete, ins?: Insert, strike?: Strike, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/RunStyle.ts b/docx-wasm/js/json/bindings/RunStyle.ts new file mode 100644 index 000000000..b8a92cf54 --- /dev/null +++ b/docx-wasm/js/json/bindings/RunStyle.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type RunStyle = string; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Shape.ts b/docx-wasm/js/json/bindings/Shape.ts index ccdccd73d..8193c5540 100644 --- a/docx-wasm/js/json/bindings/Shape.ts +++ b/docx-wasm/js/json/bindings/Shape.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { ImageData } from "./ImageData"; export interface Shape { style?: string, imageData?: ImageData, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/SpecVanish.ts b/docx-wasm/js/json/bindings/SpecVanish.ts new file mode 100644 index 000000000..c2e00fc47 --- /dev/null +++ b/docx-wasm/js/json/bindings/SpecVanish.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type SpecVanish = boolean; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Strike.ts b/docx-wasm/js/json/bindings/Strike.ts new file mode 100644 index 000000000..e1cf96a4c --- /dev/null +++ b/docx-wasm/js/json/bindings/Strike.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Strike = boolean; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/StyleWithLevel.ts b/docx-wasm/js/json/bindings/StyleWithLevel.ts index fe57b6873..1de09defa 100644 --- a/docx-wasm/js/json/bindings/StyleWithLevel.ts +++ b/docx-wasm/js/json/bindings/StyleWithLevel.ts @@ -1,2 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export type StyleWithLevel = [string, number]; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Sym.ts b/docx-wasm/js/json/bindings/Sym.ts new file mode 100644 index 000000000..0a244b94c --- /dev/null +++ b/docx-wasm/js/json/bindings/Sym.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface Sym { font: string, char: string, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Sz.ts b/docx-wasm/js/json/bindings/Sz.ts new file mode 100644 index 000000000..7eccc4936 --- /dev/null +++ b/docx-wasm/js/json/bindings/Sz.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Sz = number; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/SzCs.ts b/docx-wasm/js/json/bindings/SzCs.ts new file mode 100644 index 000000000..bd33d455c --- /dev/null +++ b/docx-wasm/js/json/bindings/SzCs.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type SzCs = number; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Tab.ts b/docx-wasm/js/json/bindings/Tab.ts new file mode 100644 index 000000000..475e4e4f2 --- /dev/null +++ b/docx-wasm/js/json/bindings/Tab.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TabLeaderType } from "./TabLeaderType"; +import type { TabValueType } from "./TabValueType"; + +export interface Tab { val: TabValueType | null, leader: TabLeaderType | null, pos: number | null, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/TabLeaderType.ts b/docx-wasm/js/json/bindings/TabLeaderType.ts new file mode 100644 index 000000000..67657924b --- /dev/null +++ b/docx-wasm/js/json/bindings/TabLeaderType.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type TabLeaderType = "dot" | "heavy" | "hyphen" | "middledot" | "none" | "underscore"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/TabValueType.ts b/docx-wasm/js/json/bindings/TabValueType.ts new file mode 100644 index 000000000..d4d067116 --- /dev/null +++ b/docx-wasm/js/json/bindings/TabValueType.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type TabValueType = "bar" | "center" | "clear" | "decimal" | "end" | "right" | "num" | "start" | "left"; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Text.ts b/docx-wasm/js/json/bindings/Text.ts new file mode 100644 index 000000000..1e0a4f5a0 --- /dev/null +++ b/docx-wasm/js/json/bindings/Text.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export interface Text { text: string, preserveSpace: boolean, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/TextBorder.ts b/docx-wasm/js/json/bindings/TextBorder.ts new file mode 100644 index 000000000..ff9ea55aa --- /dev/null +++ b/docx-wasm/js/json/bindings/TextBorder.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { BorderType } from "./BorderType"; + +export interface TextBorder { borderType: BorderType, size: number, color: string, space: number, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Theme.ts b/docx-wasm/js/json/bindings/Theme.ts index 5845646f6..1f78a2449 100644 --- a/docx-wasm/js/json/bindings/Theme.ts +++ b/docx-wasm/js/json/bindings/Theme.ts @@ -1,3 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. import type { FontScheme } from "./FontScheme"; export interface Theme { fontSchema: FontScheme, } \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Underline.ts b/docx-wasm/js/json/bindings/Underline.ts new file mode 100644 index 000000000..fa8c86c5b --- /dev/null +++ b/docx-wasm/js/json/bindings/Underline.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Underline = string; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/Vanish.ts b/docx-wasm/js/json/bindings/Vanish.ts new file mode 100644 index 000000000..51d217b0a --- /dev/null +++ b/docx-wasm/js/json/bindings/Vanish.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Vanish = boolean; \ No newline at end of file diff --git a/docx-wasm/js/json/bindings/VertAlign.ts b/docx-wasm/js/json/bindings/VertAlign.ts new file mode 100644 index 000000000..3c09188dc --- /dev/null +++ b/docx-wasm/js/json/bindings/VertAlign.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type VertAlign = string; \ No newline at end of file