Remove use of --cfg=web_sys_unstable_apis

This commit is contained in:
Joshua McQuistan 2023-11-07 10:13:55 +00:00
parent 7084b91c0a
commit 40b369d36a
9 changed files with 8 additions and 37 deletions

View file

@ -1,3 +0,0 @@
[unstable]
rustflags = ["--cfg=web_sys_unstable_apis"]
rustdocflags = ["--cfg=web_sys_unstable_apis"]

View file

@ -97,6 +97,3 @@ ssr = []
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true
rustdoc-args = ["--cfg=web_sys_unstable_apis"]
rustc-args = ["--cfg=web_sys_unstable_apis"]

View file

@ -1,2 +0,0 @@
[build]
rustflags = ["--cfg=web_sys_unstable_apis", "--cfg=has_std"]

View file

@ -1,2 +0,0 @@
[build]
rustflags = ["--cfg=web_sys_unstable_apis"]

View file

@ -1,8 +1,6 @@
// #![feature(doc_cfg)] // #![feature(doc_cfg)]
//! Collection of essential Leptos utilities inspired by SolidJS USE / VueUse //! Collection of essential Leptos utilities inspired by SolidJS USE / VueUse
use cfg_if::cfg_if;
pub mod core; pub mod core;
#[cfg(feature = "docs")] #[cfg(feature = "docs")]
pub mod docs; pub mod docs;
@ -12,14 +10,6 @@ pub mod math;
pub mod storage; pub mod storage;
pub mod utils; pub mod utils;
cfg_if! { if #[cfg(web_sys_unstable_apis)] {
mod use_element_size;
mod use_resize_observer;
pub use use_element_size::*;
pub use use_resize_observer::*;
}}
mod is_err; mod is_err;
mod is_none; mod is_none;
mod is_ok; mod is_ok;
@ -38,6 +28,7 @@ mod use_document_visibility;
mod use_draggable; mod use_draggable;
mod use_drop_zone; mod use_drop_zone;
mod use_element_hover; mod use_element_hover;
mod use_element_size;
mod use_element_visibility; mod use_element_visibility;
mod use_event_listener; mod use_event_listener;
mod use_favicon; mod use_favicon;
@ -54,6 +45,7 @@ mod use_mutation_observer;
mod use_preferred_contrast; mod use_preferred_contrast;
mod use_preferred_dark; mod use_preferred_dark;
mod use_raf_fn; mod use_raf_fn;
mod use_resize_observer;
mod use_scroll; mod use_scroll;
mod use_service_worker; mod use_service_worker;
mod use_sorted; mod use_sorted;
@ -90,6 +82,7 @@ pub use use_document_visibility::*;
pub use use_draggable::*; pub use use_draggable::*;
pub use use_drop_zone::*; pub use use_drop_zone::*;
pub use use_element_hover::*; pub use use_element_hover::*;
pub use use_element_size::*;
pub use use_element_visibility::*; pub use use_element_visibility::*;
pub use use_event_listener::*; pub use use_event_listener::*;
pub use use_favicon::*; pub use use_favicon::*;
@ -106,6 +99,7 @@ pub use use_mutation_observer::*;
pub use use_preferred_contrast::*; pub use use_preferred_contrast::*;
pub use use_preferred_dark::*; pub use use_preferred_dark::*;
pub use use_raf_fn::*; pub use use_raf_fn::*;
pub use use_resize_observer::*;
pub use use_scroll::*; pub use use_scroll::*;
pub use use_service_worker::*; pub use use_service_worker::*;
pub use use_sorted::*; pub use use_sorted::*;

View file

@ -12,9 +12,6 @@ cfg_if! { if #[cfg(not(feature = "ssr"))] {
/// Reactive size of an HTML element. /// Reactive size of an HTML element.
/// ///
/// > This function requires `--cfg=web_sys_unstable_apis` to be activated as
/// [described in the wasm-bindgen guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html).
///
/// Please refer to [ResizeObserver on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) /// Please refer to [ResizeObserver on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver)
/// for more details. /// for more details.
/// ///
@ -25,12 +22,12 @@ cfg_if! { if #[cfg(not(feature = "ssr"))] {
/// ## Usage /// ## Usage
/// ///
/// ``` /// ```
/// # use leptos::*; /// # use leptos::{html::Div, *};
/// # use leptos_use::{use_element_size, UseElementSizeReturn}; /// # use leptos_use::{use_element_size, UseElementSizeReturn};
/// # /// #
/// # #[component] /// # #[component]
/// # fn Demo() -> impl IntoView { /// # fn Demo() -> impl IntoView {
/// let el = create_node_ref(); /// let el = create_node_ref::<Div>();
/// ///
/// let UseElementSizeReturn { width, height } = use_element_size(el); /// let UseElementSizeReturn { width, height } = use_element_size(el);
/// ///

View file

@ -12,9 +12,6 @@ cfg_if! { if #[cfg(not(feature = "ssr"))] {
/// Reports changes to the dimensions of an Element's content or the border-box. /// Reports changes to the dimensions of an Element's content or the border-box.
/// ///
/// > This function requires `--cfg=web_sys_unstable_apis` to be activated as
/// [described in the wasm-bindgen guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html).
///
/// Please refer to [ResizeObserver on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) /// Please refer to [ResizeObserver on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver)
/// for more details. /// for more details.
/// ///
@ -25,12 +22,12 @@ cfg_if! { if #[cfg(not(feature = "ssr"))] {
/// ## Usage /// ## Usage
/// ///
/// ``` /// ```
/// # use leptos::*; /// # use leptos::{html::Div, *};
/// # use leptos_use::use_resize_observer; /// # use leptos_use::use_resize_observer;
/// # /// #
/// # #[component] /// # #[component]
/// # fn Demo() -> impl IntoView { /// # fn Demo() -> impl IntoView {
/// let el = create_node_ref(); /// let el = create_node_ref::<Div>();
/// let (text, set_text) = create_signal("".to_string()); /// let (text, set_text) = create_signal("".to_string());
/// ///
/// use_resize_observer( /// use_resize_observer(

View file

@ -3,10 +3,6 @@ variables:
ask: Name of the function ask: Name of the function
- name: category - name: category
ask: Documentation category (lower case) ask: Documentation category (lower case)
- name: unstable_apis
default_value: "false"
ask: Does the function require `--cfg=web_sys_unstable_apis` to be activated?
select_in_values: ["true", "false"]
- name: module - name: module
default_value: "" default_value: ""
ask: Module [optional] ask: Module [optional]

View file

@ -3,9 +3,6 @@ use leptos::*;
///{{#if (eq unstable_apis "true")}} ///{{#if (eq unstable_apis "true")}}
/// ///
/// > This function requires `--cfg=web_sys_unstable_apis` to be activated as
/// [described in the wasm-bindgen guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html).{{/if}}
///
/// ## Demo /// ## Demo
/// ///
/// [Link to Demo](https://github.com/Synphonyte/leptos-use/tree/main/examples/{{ function_name }}) /// [Link to Demo](https://github.com/Synphonyte/leptos-use/tree/main/examples/{{ function_name }})