@rust-js/resources 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rust-js/resources",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
package/react/Cargo.toml CHANGED
@@ -3,7 +3,7 @@
3
3
  # latest the crate knows (ADR 0043); build.rs gives its `cfg`s.
4
4
  [package]
5
5
  name = "rust-js-react"
6
- version = "0.0.1"
6
+ version = "0.0.2"
7
7
  edition = "2024"
8
8
  description = "React for rust-js: components written in Rust, compiled to the JSX you'd write"
9
9
  license = "MIT"
@@ -22,6 +22,11 @@ path = "src/lib.rs"
22
22
  js = { package = "rust-js-builtins", path = "../builtins", version = "~0.0.1" }
23
23
  webapi = { package = "rust-js-webapi", path = "../webapi", version = "~0.0.1" }
24
24
 
25
+ # The npm packages it binds, which an app has beside it: from 18.0, the
26
+ # first React its gates have (ADR 0043). Its npm package's peer dependencies.
27
+ [package.metadata.rust-js]
28
+ npm = { react = ">=18.0.0", react-dom = ">=18.0.0" }
29
+
25
30
  # rust-js compiles with `--cfg=rust_js` (ADR 0113): a `cfg` Cargo checks for.
26
31
  [lints.rust]
27
32
  unexpected_cfgs = { level = "warn", check-cfg = ["cfg(rust_js)"] }
package/webapi/Cargo.toml CHANGED
@@ -2,7 +2,7 @@
2
2
  # webapi/build.sh does, and rust-js reads its metadata (ADR 0024).
3
3
  [package]
4
4
  name = "rust-js-webapi"
5
- version = "0.0.1"
5
+ version = "0.0.2"
6
6
  edition = "2024"
7
7
  description = "The web platform for rust-js programs: DOM bindings generated from WebIDL"
8
8
  license = "MIT"
package/webapi/src/lib.rs CHANGED
@@ -1496,10 +1496,6 @@ pub mod html_element {
1496
1496
  use super::*;
1497
1497
 
1498
1498
  unsafe extern "Rust" {
1499
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLElement/HTMLElement)
1500
- #[link_name = "new HTMLElement"]
1501
- pub safe fn new() -> &'static HtmlElement;
1502
-
1503
1499
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLElement/title)
1504
1500
  #[link_name = "get title"]
1505
1501
  pub safe fn title(this: &HtmlElement) -> String;
@@ -1775,10 +1771,6 @@ pub mod html_anchor_element {
1775
1771
  use super::*;
1776
1772
 
1777
1773
  unsafe extern "Rust" {
1778
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/HTMLAnchorElement)
1779
- #[link_name = "new HTMLAnchorElement"]
1780
- pub safe fn new() -> &'static HtmlAnchorElement;
1781
-
1782
1774
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/download)
1783
1775
  #[link_name = "get download"]
1784
1776
  pub safe fn download(this: &HtmlAnchorElement) -> String;
@@ -1993,10 +1985,6 @@ pub mod html_button_element {
1993
1985
  use super::*;
1994
1986
 
1995
1987
  unsafe extern "Rust" {
1996
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement/HTMLButtonElement)
1997
- #[link_name = "new HTMLButtonElement"]
1998
- pub safe fn new() -> &'static HtmlButtonElement;
1999
-
2000
1988
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLButtonElement/command)
2001
1989
  #[link_name = "get command"]
2002
1990
  pub safe fn command(this: &HtmlButtonElement) -> String;
@@ -2151,10 +2139,6 @@ pub mod html_div_element {
2151
2139
  use super::*;
2152
2140
 
2153
2141
  unsafe extern "Rust" {
2154
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLDivElement/HTMLDivElement)
2155
- #[link_name = "new HTMLDivElement"]
2156
- pub safe fn new() -> &'static HtmlDivElement;
2157
-
2158
2142
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLDivElement/align)
2159
2143
  #[link_name = "get align"]
2160
2144
  pub safe fn align(this: &HtmlDivElement) -> String;
@@ -2185,10 +2169,6 @@ pub mod html_form_element {
2185
2169
  use super::*;
2186
2170
 
2187
2171
  unsafe extern "Rust" {
2188
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/HTMLFormElement)
2189
- #[link_name = "new HTMLFormElement"]
2190
- pub safe fn new() -> &'static HtmlFormElement;
2191
-
2192
2172
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/acceptCharset)
2193
2173
  #[link_name = "get acceptCharset"]
2194
2174
  pub safe fn accept_charset(this: &HtmlFormElement) -> String;
@@ -2321,10 +2301,6 @@ pub mod html_heading_element {
2321
2301
  use super::*;
2322
2302
 
2323
2303
  unsafe extern "Rust" {
2324
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLHeadingElement/HTMLHeadingElement)
2325
- #[link_name = "new HTMLHeadingElement"]
2326
- pub safe fn new() -> &'static HtmlHeadingElement;
2327
-
2328
2304
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLHeadingElement/align)
2329
2305
  #[link_name = "get align"]
2330
2306
  pub safe fn align(this: &HtmlHeadingElement) -> String;
@@ -2355,10 +2331,6 @@ pub mod html_image_element {
2355
2331
  use super::*;
2356
2332
 
2357
2333
  unsafe extern "Rust" {
2358
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLImageElement/HTMLImageElement)
2359
- #[link_name = "new HTMLImageElement"]
2360
- pub safe fn new() -> &'static HtmlImageElement;
2361
-
2362
2334
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLImageElement/alt)
2363
2335
  #[link_name = "get alt"]
2364
2336
  pub safe fn alt(this: &HtmlImageElement) -> String;
@@ -2576,10 +2548,6 @@ pub mod html_input_element {
2576
2548
  use super::*;
2577
2549
 
2578
2550
  unsafe extern "Rust" {
2579
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/HTMLInputElement)
2580
- #[link_name = "new HTMLInputElement"]
2581
- pub safe fn new() -> &'static HtmlInputElement;
2582
-
2583
2551
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/accept)
2584
2552
  #[link_name = "get accept"]
2585
2553
  pub safe fn accept(this: &HtmlInputElement) -> String;
@@ -3009,10 +2977,6 @@ pub mod html_label_element {
3009
2977
  use super::*;
3010
2978
 
3011
2979
  unsafe extern "Rust" {
3012
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLLabelElement/HTMLLabelElement)
3013
- #[link_name = "new HTMLLabelElement"]
3014
- pub safe fn new() -> &'static HtmlLabelElement;
3015
-
3016
2980
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLLabelElement/form)
3017
2981
  #[link_name = "get form"]
3018
2982
  pub safe fn form(this: &HtmlLabelElement) -> Option<&'static HtmlFormElement>;
@@ -3051,10 +3015,6 @@ pub mod html_li_element {
3051
3015
  use super::*;
3052
3016
 
3053
3017
  unsafe extern "Rust" {
3054
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLLIElement/HTMLLIElement)
3055
- #[link_name = "new HTMLLIElement"]
3056
- pub safe fn new() -> &'static HtmlLiElement;
3057
-
3058
3018
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLLIElement/value)
3059
3019
  #[link_name = "get value"]
3060
3020
  pub safe fn value(this: &HtmlLiElement) -> i32;
@@ -3093,10 +3053,6 @@ pub mod html_o_list_element {
3093
3053
  use super::*;
3094
3054
 
3095
3055
  unsafe extern "Rust" {
3096
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLOListElement/HTMLOListElement)
3097
- #[link_name = "new HTMLOListElement"]
3098
- pub safe fn new() -> &'static HtmlOListElement;
3099
-
3100
3056
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLOListElement/reversed)
3101
3057
  #[link_name = "get reversed"]
3102
3058
  pub safe fn reversed(this: &HtmlOListElement) -> bool;
@@ -3151,10 +3107,6 @@ pub mod html_option_element {
3151
3107
  use super::*;
3152
3108
 
3153
3109
  unsafe extern "Rust" {
3154
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLOptionElement/HTMLOptionElement)
3155
- #[link_name = "new HTMLOptionElement"]
3156
- pub safe fn new() -> &'static HtmlOptionElement;
3157
-
3158
3110
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLOptionElement/disabled)
3159
3111
  #[link_name = "get disabled"]
3160
3112
  pub safe fn disabled(this: &HtmlOptionElement) -> bool;
@@ -3233,10 +3185,6 @@ pub mod html_output_element {
3233
3185
  use super::*;
3234
3186
 
3235
3187
  unsafe extern "Rust" {
3236
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLOutputElement/HTMLOutputElement)
3237
- #[link_name = "new HTMLOutputElement"]
3238
- pub safe fn new() -> &'static HtmlOutputElement;
3239
-
3240
3188
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLOutputElement/htmlFor)
3241
3189
  #[link_name = "get htmlFor"]
3242
3190
  pub safe fn html_for(this: &HtmlOutputElement) -> &'static DomTokenList;
@@ -3319,10 +3267,6 @@ pub mod html_paragraph_element {
3319
3267
  use super::*;
3320
3268
 
3321
3269
  unsafe extern "Rust" {
3322
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLParagraphElement/HTMLParagraphElement)
3323
- #[link_name = "new HTMLParagraphElement"]
3324
- pub safe fn new() -> &'static HtmlParagraphElement;
3325
-
3326
3270
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLParagraphElement/align)
3327
3271
  #[link_name = "get align"]
3328
3272
  pub safe fn align(this: &HtmlParagraphElement) -> String;
@@ -3353,10 +3297,6 @@ pub mod html_select_element {
3353
3297
  use super::*;
3354
3298
 
3355
3299
  unsafe extern "Rust" {
3356
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLSelectElement/HTMLSelectElement)
3357
- #[link_name = "new HTMLSelectElement"]
3358
- pub safe fn new() -> &'static HtmlSelectElement;
3359
-
3360
3300
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLSelectElement/autocomplete)
3361
3301
  #[link_name = "get autocomplete"]
3362
3302
  pub safe fn autocomplete(this: &HtmlSelectElement) -> String;
@@ -3516,10 +3456,6 @@ pub mod html_span_element {
3516
3456
  use super::*;
3517
3457
 
3518
3458
  unsafe extern "Rust" {
3519
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLSpanElement/HTMLSpanElement)
3520
- #[link_name = "new HTMLSpanElement"]
3521
- pub safe fn new() -> &'static HtmlSpanElement;
3522
-
3523
3459
  /// Treats `this` as `HtmlSpanElement` without checking that it is one.
3524
3460
  #[link_name = "this"]
3525
3461
  pub safe fn unchecked_from(this: &EventTarget) -> &'static HtmlSpanElement;
@@ -3542,10 +3478,6 @@ pub mod html_text_area_element {
3542
3478
  use super::*;
3543
3479
 
3544
3480
  unsafe extern "Rust" {
3545
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/HTMLTextAreaElement)
3546
- #[link_name = "new HTMLTextAreaElement"]
3547
- pub safe fn new() -> &'static HtmlTextAreaElement;
3548
-
3549
3481
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/autocomplete)
3550
3482
  #[link_name = "get autocomplete"]
3551
3483
  pub safe fn autocomplete(this: &HtmlTextAreaElement) -> String;
@@ -3763,10 +3695,6 @@ pub mod html_u_list_element {
3763
3695
  use super::*;
3764
3696
 
3765
3697
  unsafe extern "Rust" {
3766
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLUListElement/HTMLUListElement)
3767
- #[link_name = "new HTMLUListElement"]
3768
- pub safe fn new() -> &'static HtmlUListElement;
3769
-
3770
3698
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLUListElement/compact)
3771
3699
  #[link_name = "get compact"]
3772
3700
  pub safe fn compact(this: &HtmlUListElement) -> bool;
@@ -3805,10 +3733,6 @@ pub mod html_table_element {
3805
3733
  use super::*;
3806
3734
 
3807
3735
  unsafe extern "Rust" {
3808
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTableElement/HTMLTableElement)
3809
- #[link_name = "new HTMLTableElement"]
3810
- pub safe fn new() -> &'static HtmlTableElement;
3811
-
3812
3736
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTableElement/deleteCaption)
3813
3737
  #[link_name = "deleteCaption"]
3814
3738
  pub safe fn delete_caption(this: &HtmlTableElement);
@@ -3963,10 +3887,6 @@ pub mod html_table_section_element {
3963
3887
  use super::*;
3964
3888
 
3965
3889
  unsafe extern "Rust" {
3966
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTableSectionElement/HTMLTableSectionElement)
3967
- #[link_name = "new HTMLTableSectionElement"]
3968
- pub safe fn new() -> &'static HtmlTableSectionElement;
3969
-
3970
3890
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTableSectionElement/rows)
3971
3891
  #[link_name = "get rows"]
3972
3892
  pub safe fn rows(this: &HtmlTableSectionElement) -> &'static HtmlCollection;
@@ -4037,10 +3957,6 @@ pub mod html_table_row_element {
4037
3957
  use super::*;
4038
3958
 
4039
3959
  unsafe extern "Rust" {
4040
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTableRowElement/HTMLTableRowElement)
4041
- #[link_name = "new HTMLTableRowElement"]
4042
- pub safe fn new() -> &'static HtmlTableRowElement;
4043
-
4044
3960
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTableRowElement/rowIndex)
4045
3961
  #[link_name = "get rowIndex"]
4046
3962
  pub safe fn row_index(this: &HtmlTableRowElement) -> i32;
@@ -4127,10 +4043,6 @@ pub mod html_table_cell_element {
4127
4043
  use super::*;
4128
4044
 
4129
4045
  unsafe extern "Rust" {
4130
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTableCellElement/HTMLTableCellElement)
4131
- #[link_name = "new HTMLTableCellElement"]
4132
- pub safe fn new() -> &'static HtmlTableCellElement;
4133
-
4134
4046
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLTableCellElement/colSpan)
4135
4047
  #[link_name = "get colSpan"]
4136
4048
  pub safe fn col_span(this: &HtmlTableCellElement) -> u32;
@@ -4269,10 +4181,6 @@ pub mod html_i_frame_element {
4269
4181
  use super::*;
4270
4182
 
4271
4183
  unsafe extern "Rust" {
4272
- /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLIFrameElement/HTMLIFrameElement)
4273
- #[link_name = "new HTMLIFrameElement"]
4274
- pub safe fn new() -> &'static HtmlIFrameElement;
4275
-
4276
4184
  /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLIFrameElement/src)
4277
4185
  #[link_name = "get src"]
4278
4186
  pub safe fn src(this: &HtmlIFrameElement) -> String;
@@ -4411,6 +4319,52 @@ pub mod html_i_frame_element {
4411
4319
  }
4412
4320
  }
4413
4321
 
4322
+ /// [`HTMLCanvasElement`](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement)
4323
+ pub struct HtmlCanvasElement(PhantomData<JsObject>);
4324
+
4325
+ impl Deref for HtmlCanvasElement {
4326
+ type Target = HtmlElement;
4327
+
4328
+ fn deref(&self) -> &HtmlElement {
4329
+ // Never runs: rust-js compiles this `Deref` to the object itself.
4330
+ unsafe { &*(self as *const Self as *const HtmlElement) }
4331
+ }
4332
+ }
4333
+
4334
+ pub mod html_canvas_element {
4335
+ use super::*;
4336
+
4337
+ unsafe extern "Rust" {
4338
+ /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/width)
4339
+ #[link_name = "get width"]
4340
+ pub safe fn width(this: &HtmlCanvasElement) -> u32;
4341
+
4342
+ /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/width)
4343
+ #[link_name = "set width"]
4344
+ pub safe fn set_width(this: &HtmlCanvasElement, value: u32);
4345
+
4346
+ /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/height)
4347
+ #[link_name = "get height"]
4348
+ pub safe fn height(this: &HtmlCanvasElement) -> u32;
4349
+
4350
+ /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/height)
4351
+ #[link_name = "set height"]
4352
+ pub safe fn set_height(this: &HtmlCanvasElement, value: u32);
4353
+
4354
+ /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/toDataURL)
4355
+ #[link_name = "toDataURL"]
4356
+ pub safe fn to_data_url(this: &HtmlCanvasElement) -> String;
4357
+
4358
+ /// [MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/toDataURL)
4359
+ #[link_name = "toDataURL"]
4360
+ pub safe fn to_data_url_with_type(this: &HtmlCanvasElement, type_: &str) -> String;
4361
+
4362
+ /// Treats `this` as `HtmlCanvasElement` without checking that it is one.
4363
+ #[link_name = "this"]
4364
+ pub safe fn unchecked_from(this: &EventTarget) -> &'static HtmlCanvasElement;
4365
+ }
4366
+ }
4367
+
4414
4368
  /// [`Window`](https://developer.mozilla.org/docs/Web/API/Window)
4415
4369
  pub struct Window(PhantomData<JsObject>);
4416
4370