text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>use std::ops::DerefMut; use crate::{MappedStore, store::Store}; use dioxus_signals::{Readable, ReadableExt}; impl<Lens: Readable<Target = Option<T>> + 'static, T: 'static> Store<Option<T>, Lens> { /// Checks if the `Option` is `Some`. This will only track the shallow state of the `Option`. It will ...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>o_selector().child(1, map, map_mut).into()) } } /// Unwraps the `Result` and returns a `Store<T>`. This will only track the shallow state of the `Result`. /// It will only cause a re-run if the `Result` could change from `Err` to `Ok` or vice versa. /// /// # Example /// `...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>//! Additional utilities for `Vec` stores. use std::{iter::FusedIterator, panic::Location}; use crate::{ReadStore, impls::index::IndexSelector, store::Store}; use dioxus_signals::{ AnyStorage, BorrowError, BorrowMutError, ReadSignal, Readable, ReadableExt, UnsyncStorage, Writable, WriteLock, Wri...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use crate::store::Store; use dioxus_signals::Writable; impl<Lens: Writable<Target = Vec<T>> + 'static, T: 'static> Store<Vec<T>, Lens> { /// Pushes an item to the end of the vector. This will only mark the length of the vector as dirty. /// /// # Example /// ```rust, no_run /// use di...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>{Store, store}; /// Re-exports for the store derive macro #[doc(hidden)] pub mod macro_helpers { pub use dioxus_core; pub use dioxus_signals; } <|fim_prefix|>#![doc = include_str!("../README.md")] #![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")] #![doc(html_favicon_url ...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|> path: self.path, store: self.store, write: map(self.write), } } /// Write without notifying subscribers. pub fn write_untracked(&self) -> WritableRef<'static, Lens> where Lens: Writable, { self.write.write_unchecked() } ...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>f>, BorrowMutError> { self.selector.try_write_unchecked() } } impl<T, Lens> IntoAttributeValue for Store<T, Lens> where Self: Readable<Target = T>, T: ::std::clone::Clone + IntoAttributeValue + 'static, { fn into_value(self) -> AttributeValue { ReadableExt::cloned(&self).in...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use dioxus_core::{ReactiveContext, SubscriberList, Subscribers}; use dioxus_signals::{CopyValue, ReadableExt, SyncStorage, Writable, WritableExt}; use std::collections::HashSet; use std::fmt::Debug; use std::hash::BuildHasher; use std::ops::BitOrAssign; use std::{collections::HashMap, hash::Hash, ops::Der...
fim
DioxusLabs/dioxus
rust
#![allow(unused)] use dioxus::prelude::*; use dioxus_stores::*; #[derive(Store)] struct TodoItem { checked: bool, contents: String, } fn app() -> Element { let item = use_store(|| TodoItem { checked: false, contents: "Learn about stores".to_string(), }); rsx! { TakesReadS...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>//! Cross-crate sealing tests for `#[derive(Store)]`. //! //! `pack<|fim_suffix|>iled as an //! external downstream crate and assert that only the `pub` accessor — not the //! `pub(crate)` or private ones — can be called from outside the defining //! crate. The same goes for transposed-struct field access...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>//! Compile-time tests for the Store derive macro. //! //! These tests verify that the macro generates valid, well-typed code. They are not //! executed at runtime—the test functions exist only to ensure the generated code compiles. //! Visibility enforcement is validated via `compile_fail` doctests in `l...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|> counter.borrow_mut().other += 1; rsx! { "other = {value}" } } let counter = Rc::new(RefCell::new(RunCounter::default())); let mut dom = VirtualDom::new_with_props( |counter: Rc<RefCell<RunCounter>>| { let y = STORE.resolve(); ...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>t.compile_fail("tests/ui/fail_store_assoc_type.rs"); } <|fim_prefix|>#[test] fn store_impl_rejects_non_methods() { <|fim_middle|> let t = trybuild::TestCases::new(); t.compile_fail("tests/ui/fail_store_assoc_const.rs"); <|endoftext|>
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>//! A downstream crate MUST NOT be able to call the `pub(crate)` field accessor. use dioxus_stores::*; use dioxus_stores_visibility_helper::{Item, ItemStoreExt}; fn main() { let store = use_store(Item::new); let _ <|fim_suffix|>d(); } <|fim_middle|>= store.crate_fiel<|endoftext|>
fim
DioxusLabs/dioxus
rust
//! A downstream crate MUST NOT be able to call a private field accessor. use dioxus_stores::*; use dioxus_stores_visibility_helper::{Item, ItemStoreExt}; fn main() { let store = use_store(Item::new); let _ = store.private_field(); } <|endoftext|>
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>ECRET: i32 = 7; } fn main() { let _ = Item { value: 0 }; } <|fim_prefix|>use dioxus_stores::*; #[derive(Store)] struct Item { value: i32, } #[s<|fim_middle|>tore] impl Store<Item> { const S<|endoftext|>
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use <|fim_suffix|>impl Store<Item> { type Hidden = i32; } fn main() { let _ = Item { value: 0 }; } <|fim_middle|>dioxus_stores::*; #[derive(Store)] struct Item { value: i32, } #[store] <|endoftext|>
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>//! The transposed struct must preserve private field visibilit<|fim_suffix|>:*; use dioxus_stores_visibility_helper::{Item, ItemStoreExt}; fn main() { let store = use_store(Item::new); let _ = store.transpose().private_field; } <|fim_middle|>y across crates. use dioxus_stores:<|endoftext|>
fim
DioxusLabs/dioxus
rust
//! Public enum accessors (is_variant / variant-downcast / transpose) should //! remain reachable from downstream crates after the witness-seal plumbing was //! extended to cover enums. use dioxus_stores::*; use dioxus_stores_visibility_helper::{PubEnum, PubEnumStoreExt}; #[allow(dead_code)] fn uses_enum_accessors() ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>//! A downstream crate can call the `<|fim_suffix|> let store = use_store(Item::new); let _: Store<i32, _> = store.public_field(); } fn main() {} <|fim_middle|>pub` field accessor. use dioxus_stores::*; use dioxus_stores_visibility_helper::{Item, ItemStoreExt}; #[allow(dead_code)] fn uses_public_...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|> store.remove(0); } rsx! { for item in store.iter() { li { key: "{item.id()}", ListItemElement { list_item: item } } } } } #[component] fn ListItemElement(list_item: ReadSignal<ListItem>) -> E...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>//! Fixture crate for cross-crate visibility tests on `#[derive(Store)]`. //! //! Defines a public struct with fields at every visibility tier so downstream //! fixtures ca<|fim_suffix|>e boundary. use dioxus_stores::Store; #[derive(Store)] pub struct Item { pub public_field: i32, pub(crate) cra...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>es::Store<#enum_name #ty_generics, __Lens> }; // Every accessor is gated on the enum's own visibility, since variant // fields inherit it. let mut witness_extension_generics = extension_generics.clone(); witness_extension_generics .params .insert(0, parse_quote!(__V)); ...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>_token: syn::Token![=] = input.parse()?; let ident: Ident = input.parse()?; Some(ident) } else { None }; Ok(ExtendArgs { name, visibility }) } } <|fim_prefix|>use proc_macro2::TokenStream; use quote::quote; use syn::spanned::Spanned; use syn:...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use proc_macro::TokenStream; use syn::{DeriveInput, ItemImpl, parse_macro_input}; use crate::extend::ExtendArgs; mod derive; mod extend; mod seal; /// # `derive(Store)` /// /// The `Store` macro is used to create an extension trait for stores that makes it possible to access the fields or variants /// ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>//! Shared builder used by `#[derive(Store)]` and the `#[store]` attribute //! macro to emit an extension trait + its impl, both gated by a private //! sealed supertrait and optional per-visibility witness seals. //! //! The builder stores only source data (bucket entries, queued items) — all //! to<|fim_...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>#![allow(clippy::needless_doctest_main)] //! # Subsecond: Hot-patching for Rust //! //! Subsecond is a library that enables hot-patching for Rust applications. This allows you to change //! the code of a running application without restarting it. This is useful for game engines, servers, //! and other lon...
fim
DioxusLabs/dioxus
rust
pub use std::cell::Cell; use std::{cell::RefCell, thread::LocalKey}; #[derive(Debug)] pub struct StoredItem { pub name: String, pub value: f32, pub items: Vec<String>, } thread_local! { pub static BAR: RefCell<Option<StoredItem>> = const { RefCell::new(None) }; } pub fn get_bar() -> &'static LocalKey...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>pub use std::cell::Cell; use std::{cell::RefCell, thread::LocalKey}; #[derive(D<|fim_suffix|>tem { name: "BAR".to_string(), value: 0.0, items: vec!["item1".to_string(), "item2".to_string()], })); } &BAZ } <|fim_middle|>ebug)] pub struct StoredItem { ...
fim
DioxusLabs/dioxus
rust
use std::{cell::Cell, thread, time::Duration}; use cross_tls_crate::get_bar; use cross_tls_crate_dylib::get_baz; fn main() { dioxus_devtools::connect_subsecond(); loop { dioxus_devtools::subsecond::call(|| { use cross_tls_crate::BAR; use cross_tls_crate_dylib::BAZ; ...
fim
DioxusLabs/dioxus
rust
use serde::{Deserialize, Serialize}; use std::{ collections::HashMap, hash::{BuildHasherDefault, Hasher}, path::PathBuf, }; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] pub struct JumpTable { /// The dylib containing the patch. This should be a valid path so you can just pass it to LibLoa...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use std::{ cell::Cell, ffi::c_void, future::Future, pin::Pin, rc::Rc, task::{Context, Poll, Waker}, thread::LocalKey, }; pub use wasm_split_macro::{lazy_loader, wasm_split}; pub type Result<T> = std::result::Result<T, SplitLoaderError>; #[non_exhaustive] #[derive(Debug, Clon...
fim
DioxusLabs/dioxus
rust
// when running the harness we need to make sure to uncommon this out... export function makeLoad(url, deps, fusedImports, initIt) { let alreadyLoaded = false; return async (callbackIndex, callbackData) => { await Promise.all(deps.map((dep) => dep())); if (alreadyLoaded) return; try { const respo...
fim
DioxusLabs/dioxus
javascript
use anyhow::{Context, Result}; use itertools::Itertools; use rayon::prelude::{IntoParallelIterator, ParallelIterator}; use std::{ collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque}, hash::Hash, ops::Range, sync::{Arc, RwLock}, }; use walrus::{ ConstExpr, DataKind, ElementItems, ElementKin...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|> idx, module.component_name.as_ref().unwrap() )), &module.bytes, ) .expect("failed to write chunk"); } } fn emit_js(chunks: &[SplitModule], modules: &[SplitModule]) -> String { use std::fmt::Write; let mut glue = format!( ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use proc_macro::TokenStream; use digest::Digest; use quote::{format_ident, quote}; use syn::{FnArg, Ident, ItemFn, ReturnType, Signature, parse_macro_input, parse_quote}; #[proc_macro_attribute] pub fn wasm_split(args: TokenStream, input: TokenStream) -> TokenStream { let module_ident = parse_macro_...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use std::collections::HashSet; use id_arena::Id; use walrus::{ConstExpr, Data, DataId, DataKind, Element, ExportItem, Function}; use walrus::{ElementId, ElementItems, ElementKind, Module, RefType, Type, TypeId}; use walrus::{ExportId, ir::*}; use walrus::{FunctionId, FunctionKind, Global, GlobalId}; use ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>fn main() { // If any TS files change, re-run the build script lazy_js_bundle::LazyTypeSc<|fim_suffix|>tching("./src/ts") .with_binding("./src/ts/eval.ts", "./src/js/eval.js") .run(); } <|fim_middle|>riptBindings::new() .with_wa<|endoftext|>
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use std::rc::Rc; use dioxus_core::LaunchConfig; use wasm_bindgen::JsCast as _; /// Configuration for the WebSys renderer for the Dioxus VirtualDOM. /// /// This struct helps configure the specifics of hydration and render destination for WebSys. /// /// # Example /// /// ```rust, ignore /// dioxus_web:...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use crate::WebFileData; use dioxus_html::{FileData, NativeDataTransfer}; /// A wrapper around the web_sys::DataTransfer to implement NativeDataTransfer #[derive(Clone)] pub struct WebDataTransfer { pub(crate) data: web_sys::DataTransfer, } impl WebDataTransfer { /// Create a new WebDataTransfer ...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>f (typeof showDXToast !== "undefined") {{ window.showDXToast(header_text, message, level, as_ms); }} } export function js_schedule_toast(header_text, message, level, as_ms) { if (typeof scheduleDXToast !== "undefined") {{ window.scheduleDXToast(header_text, message, level, as_ms); ...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>ent(); } if has_context::<Rc<dyn History>>().is_none() { history(); } }) } /// Provides the Document through [`dioxus_core::provide_context`]. pub fn init_document() { // If hydrate is enabled, we add the FullstackWebDocument with the initial hydration data ...
fim
DioxusLabs/dioxus
rust
//! Implementation of a renderer for Dioxus on the web. //! //! Outstanding todos: //! - Passive event listeners //! - no-op event listener patch for safari //! - tests to ensure dyn_into works for various event types. //! - Partial delegation? use std::{any::Any, rc::Rc}; use dioxus_core::Runtime; use dioxus_core::{...
fim
DioxusLabs/dioxus
rust
use dioxus_html::HasAnimationData; use web_sys::AnimationEvent; use super::{Synthetic, WebEventExt}; impl HasAnimationData for Synthetic<AnimationEvent> { fn animation_name(&self) -> String { self.event.animation_name() } fn pseudo_element(&self) -> String { self.event.pseudo_element() ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use dioxus_html::{HasBeforeInputData, InputType}; use web_sys::{Element, InputEvent}; use super::WebEventExt; pub(crate) struct WebBeforeInputData { element: Element, event: InputEvent, } impl WebBeforeInputData { pub f<|fim_suffix|>ng { super::editable_element_value(&self.element)....
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use super::{Synthetic, WebEventExt}; use dioxus_html::HasCancelData; impl HasCancelData for Synthetic<web_sys::Event> { fn as_any(&self) -> &dyn std::any::Any { &self.event } } impl WebEventExt for dioxus_html::CancelData { type WebEvent = web_sys::Event; #[inline(always)] f...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>Data { fn as_any(&self) -> &dyn std::any::Any { &self.event as &dyn std::any::Any } } impl HasDataTransferData for WebClipboardData { fn data_transfer(&self) -> DataTransfer { let data = self .event .clipboard_data() // No `clipboardData` (e...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>vent> { self.downcast::<web_sys::CompositionEvent>().cloned() } } <|fim_prefix|>use dioxus_html::HasCompositionData; use web_sys::CompositionEvent; use super::{Synthetic, WebEventExt}; impl HasCompositionData for Synthet<|fim_middle|>ic<CompositionEvent> { fn data(&self) -> std::string::...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use crate::{WebDataTransfer, WebFileData, WebFileEngine}; use super::{Synthetic, WebEventExt}; use dioxus_html::{ FileData, HasDataTransferData, HasDragData, HasFileData, HasMouseData, InteractionElementOffset, InteractionLocation, Modifiers, ModifiersInteraction, PointerInteraction, geom...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use dioxus_html::{FileData, HasFileData}; use web_sys::FileReader; use crate::{WebFileData, WebFileEngine}; use super::Syntheti<|fim_suffix|> } else { let items = data_transfer.items(); let mut files = vec![]; for i in 0..items.length() { ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use dioxus_html::HasFocusData; use super::{Synthetic, WebEventExt}; impl HasFocusData for Synthetic<web_sys::FocusEv<|fim_suffix|>Ext for dioxus_html::FocusData { type WebEvent = web_sys::FocusEvent; #[inline(always)] fn try_as_web_event(&self) -> Option<Self::WebEvent> { self.downc...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use super::WebEventExt; use crate::WebFileData; use dioxus_html::{FileData, FormValue, HasFileData, HasFormData}; use js_sys::Array; use std::any::Any; use wasm_bindgen::{JsCast, prelude::wasm_bindgen}; use web_sys::{Element, Event, FileReader}; pub(crate) struct WebFormData { element: Element, e...
fim
DioxusLabs/dioxus
rust
use std::str::FromStr; use dioxus_html::{ Code, HasKeyboardData, Key, Location, Modifiers, ModifiersInteraction, input_data::decode_key_location, }; use web_sys::KeyboardEvent; use super::{Synthetic, WebEventExt}; impl HasKeyboardData for Synthetic<KeyboardEvent> { fn key(&self) -> Key { Key::fro...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use std::any::Any; use dioxus_html::HasImageData; us<|fim_suffix|> &self.raw } } impl WebEventExt for dioxus_html::ImageData { type WebEvent = Event; #[inline(always)] fn try_as_web_event(&self) -> Option<Event> { self.downcast::<WebImageEvent>().map(|e| e.raw.clone()) } } ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use super::{Synthetic, WebEventExt}; use dioxus_html::HasMediaData; impl HasMediaData for Synthetic<web_sys::Event> { f<|fim_suffix|>pe WebEvent = web_sys::Event; #[inline(always)] fn try_as_web_event(&self) -> Option<Self::WebEvent> { self.downcast::<web_sys::Event>().cloned() }...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>$converter:ident] #[events = [ $( $( #[$attr:meta] )* $name:ident => $raw:ident, )* ]] $(#[raw = [$($raw_only:ident),* $(,)?]])? $group:ident($data:ident)...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use dioxus_html::{ MountedData, geometry::euclid::{Point2D, Size2D}, }; use wasm_bindgen::JsCast; use super::{Synthetic, WebEventExt}; impl dioxus_html::RenderedElementBacking for Synthetic<web_sys::Element> { fn get_scroll_offset( &self, ) -> std::pin::Pin< Box< ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use dioxus_html::{ HasMouseData, InteractionElementOffset, InteractionLocation, Modifiers, ModifiersInteraction, PointerInteraction, geometry::{ClientPoint, ElementPoint, PagePoint, ScreenPoint}, input_data::{MouseButton, decode_mouse_button_set}, }; use web_sys::MouseEvent; use super::{S...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|> { fn held_buttons(&self) -> dioxus_html::input_data::MouseButtonSet { decode_mouse_button_set(self.event.buttons()) } fn trigger_button(&self) -> Option<MouseButton> { Some(MouseButton::from_web_code(self.event.button())) } } impl WebEventExt for dioxus_html::PointerData...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>Ok(PixelsSize::new(inline_size, block_size)) } <|fim_prefix|>use dioxus_html::{HasResizeData, ResizeResult, geometry::PixelsSize}; use wasm_bindgen::JsCast; use web_sys::{CustomEvent, Event, ResizeObserverEntry}; use super::{Synthetic, WebEventExt}; impl From<Event> for Synthetic<ResizeObserverEntry> { ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use dioxus_html::HasScrollData; use wasm_bindgen::JsCast; use web_sys::{Document, Element, Event}; use super::{Synthetic, WebEventExt}; impl HasScrollData for Synthetic<Event> { fn as_any(&self) -> &dyn std::any::Any { &self.event } fn scroll_top(&self) -> f64 { if let Some(...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>JsValue> { match self { Self::Input(input) => input.selection_direction(), Self::TextArea(textarea) => textarea.selection_direction(), } } } <|fim_prefix|>use super::{Synthetic, WebEventExt}; use dioxus_html::{HasSelectionData, SelectionDirection, TextSelection}...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use super::{Synthetic, WebEventExt}; us<|fim_suffix|>WebEventExt for dioxus_html::ToggleData { type WebEvent = web_sys::Event; #[inline(always)] fn try_as_web_event(&self) -> Option<Self::WebEvent> { self.downcast::<web_sys::Event>().cloned() } } <|fim_middle|>e dioxus_html::HasTo...
fim
DioxusLabs/dioxus
rust
use dioxus_html::{ HasTouchPointData, InteractionLocation, Modifiers, ModifiersInteraction, TouchPoint, geometry::{ClientPoint, PagePoint, ScreenPoint}, }; use web_sys::{Touch, TouchEvent}; use super::{Synthetic, WebEventExt}; impl ModifiersInteraction for Synthetic<TouchEvent> { fn modifiers(&self) -> Mo...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>f.event.pseudo_element() } fn as_any(&self) -> &dyn std::any::Any { &self.event } } <|fim_prefix|>use dioxus_html::HasTransitionData; use web_sys::TransitionEvent; use super:<|fim_middle|>:Synthetic; impl HasTransitionData for Synthetic<TransitionEvent> { fn elapsed_time(&self) ...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>use std::time::SystemTime; use dioxus_html::{ HasVisibleData, VisibleData, VisibleError, VisibleResult, geometry::{ PixelsRect, euclid::{Point2D, Size2D}, }, }; use wasm_bindgen::JsCast; use web_sys::{CustomEvent, DomRectReadOnly, Event, IntersectionObserverEntry}; use super:...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>elf) -> PagePoint { PagePoint::new(self.event.page_x().into(), self.event.page_y().into()) } } impl InteractionElementOffset for Synthetic<WheelEvent> { fn element_coordinates(&self) -> ElementPoint { ElementPoint::new(self.event.offset_x().into(), self.event.offset_y().into()) ...
fim
DioxusLabs/dioxus
rust
use dioxus_core::AnyhowContext; use dioxus_html::{FileData, NativeFileData, bytes::Bytes}; use futures_channel::oneshot; use js_sys::Uint8Array; use send_wrapper::SendWrapper; use std::{pin::Pin, prelude::rust_2024::Future}; use wasm_bindgen::{JsCast, prelude::Closure}; use web_sys::{File, FileList, FileReader}; /// A...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>_scroll_restoration { self.window.scroll_to_with_x_and_y(0.0, 0.0) } } } impl dioxus_history::History for HashHistory { fn current_route(&self) -> String { let location = self.window.location(); let hash = location.hash().unwrap(); if hash.is_empty() {...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>//! When hydrating streaming components: //! 1. Just hydrate the template on the outside //! 2. As we render the virtual dom initially, keep track of the server ids of the suspense boundaries //! 3. Register a callback for dx_hydrate(id, data) that takes some new data, reruns the suspense boundary with th...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>#[cfg(feature = "hydrate")] mod hydrate; #[cfg(feature = "hydrate")<|fim_suffix|>#[cfg(debug_assertions)] /// The location of the data in the source code debug_locations: Option<Vec<String>>, } <|fim_middle|>] #[allow(unused)] pub use hydrate::*; /// The message sent from the server to the clien...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>to_js.recv()}send(data){this.js_to_rust.send(data)}rustSend(data){this.rust_to_js.send(data)}async rustRecv(){return await this.js_to_rust.recv()}close(){globalThis.__channels[this.id]=null}}export{WebDioxusChannel,WeakDioxusChannel}; <|fim_prefix|>class Channel{pending;waiting;constructor(){this.pending=...
fim
DioxusLabs/dioxus
javascript
<|fim_suffix|>oxus` crate. pub fn launch_virtual_dom(vdom: VirtualDom, platform_config: Config) { wasm_bindgen_futures::spawn_local(async move { crate::run(vdom, platform_config).await; }); } /// Launch the web application with the given root component and config pub fn launch_cfg(root: fn() -> Element...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|> extern "C" { fn get_initial_hydration_data() -> js_sys::Uint8Array; fn get_initial_hydration_debug_types() -> Option<Vec<String>>; fn get_initial_hydration_debug_locations() -> Option<Vec<String>>; } let hydration_data = g...
fim
DioxusLabs/dioxus
rust
<|fim_suffix|>ns() { return; } self.interpreter.create_placeholder(id.0 as u32) } fn create_text_node(&mut self, value: &str, id: ElementId) { if self.skip_mutations() { return; } self.interpreter.create_text_node(value, id.0 as u32) } fn...
fim
DioxusLabs/dioxus
rust
<|fim_prefix|>import { DioxusChannel, Channel, WeakDioxusChannel, } from "../../../document/src/ts/eval"; globalThis.__nextChannelId = 0; globalThis.__channels = []; export { WeakDioxusChannel }; export class WebDioxusChannel extends DioxusChannel { js_to_rust: Channel; rust_to_j<|fim_suffix|>er: any) { ...
fim
DioxusLabs/dioxus
typescript
<|fim_suffix|>'compress:parallax_template', 'replace:version', 'replace:readme', 'rename:rename_src', 'rename:rename_compiled', 'clean:temp' ]); grunt.task.registerTask('configureBabel', 'configures babel options', function() { config.babel.bin.options.inputSourceMap = grunt.file.readJSON(c...
fim
Dogfalo/materialize
javascript
<|fim_suffix|>ingActionButton({ toolbarEnabled: true }); }); // end of document ready })(jQuery); // end of jQuery name space <|fim_prefix|>(function($) { $(function() { var window_width = $(window).width(); // convert rgb to hex value string function rgb2hex(rgb) { if (/^#[0-9A-F]{6}$/...
fim
Dogfalo/materialize
javascript
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(t){function e(){var e=a(this),o=r.settings;return isNaN(e.datetime)||(0==o.cutoff||Math.abs(n(e.datetime))<o.cutoff)&&t(this).text(i(e.datetime)),this}function a(e){if(e=t(e),!e.data("timeago")){e.data("timeago",{datetime:r.date...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>/** * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12 * Copyright (C) 2015 Oliver Nightingale * MIT Licensed * @license */ !function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+scss+bash */ self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>(function ($) { $(document).ready(function() { window.index = lunr(function () { this.field('title', {boost: 10}); this.field('body'); this.ref('href'); }); window.index.pipeline.reset(); window.index.add({ href: 'http://materializecss.com/about.html', titl...
fim
Dogfalo/materialize
javascript
<|fim_suffix|> // Updates scope_Locations and scope_Values, updates visual state function updateHandlePosition ( handleNumber, to ) { // Update locations. scope_Locations[handleNumber] = to; // Convert the value to the slider stepping/range. scope_Values[handleN...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>!function(){function h(t){return t.split("").reverse().join("")}function o(t,e,n){if((t[e]||t[n])&&t[e]===t[n])throw Error(e)}function n(t,e,n,r,i,o,s,a,l,u,c,p){s=p;var f,d=c="";return o&&(p=o(p)),!("number"!=typeof p||!isFinite(p))&&(t&&0===parseFloat(p.toFixed(t))&&(p=0),p<0&&(f=!0,p=Math.abs(p)),t&&(o...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>/* v2.2.0 2017 Julian Garnier Released under the MIT license */ var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,r,p){if(p.get||p.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.p...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>(function($) { 'use strict'; let _defaults = { data: {}, // Autocomplete data set limit: Infinity, // Limit of results the autocomplete shows onAutocomplete: null, // Callback for when autocompleted minLength: 1, // Min characters before autocomplete starts sortFunction: function(...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>(function($, anim) { 'use strict'; let _defaults = { direction: 'top', hoverEnabled: true, toolbarEnabled: false }; $.fn.reverse = [].reverse; /** * @class * */ class FloatingActionButton extends Component { /** * Construct FloatingActionButton instance * ...
fim
Dogfalo/materialize
javascript
<|fim_suffix|>ction(anim) { let el = anim.animatables[0].target; $(el).css({ display: 'none' }); $card.css('overflow', $card.data('initialOverflow')); } }); } else if ($(e.target).is($('.card .activator')) || $(e.target).is($('.card .activator i'))) { ...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>(function($) { 'use strict'; let _defaults = { duration: 200, // ms dist: -100, // zoom scale TODO: make this more intuitive as an option shift: 0, // spacing for center image padding: 0, // Padding between non center items numVisible: 5, // Number of visible items in carousel ...
fim
Dogfalo/materialize
javascript
<|fim_suffix|> function hasClass(v, c) { return (v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className)); } function addClass(v, c, spacedName) { if (v.classList) { v.classList.add(c); } else if (spacedName.indexOf(" " + c + " ")) { v.className +=...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>(function($) { 'use strict'; let _defaults = {}; /** * @class * */ class CharacterCounter extends Component { /** * Construct CharacterCounter instance * @constructor * @param {Element} el * @param {Object} options */ constructor(el, options) { sup...
fim
Dogfalo/materialize
javascript
(function($) { 'use strict'; let _defaults = { data: [], placeholder: '', secondaryPlaceholder: '', autocompleteOptions: {}, limit: Infinity, onChipAdd: null, onChipSelect: null, onChipDelete: null }; /** * @typedef {Object} chip * @property {String} tag chip tag string ...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>(function($, anim) { 'use strict'; let _defaults = { accordion: true, onOpenStart: undefined, onOpenEnd: undefined, onCloseStart: undefined, onCloseEnd: undefined, inDuration: 300, outDuration: 300 }; /** * @class * */ class Collapsible extends Component { ...
fim
Dogfalo/materialize
javascript
<|fim_suffix|> instances = new classDef(els, options); } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) { let instancesArr = []; for (let i = 0; i < els.length; i++) { instancesArr.push(new classDef(els[i], options)); } instances = instancesArr; } ...
fim
Dogfalo/materialize
javascript
<|fim_suffix|>Month >= month)) { prev = false; } if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { next = false; } let rightArrow = '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.34l4.58-4....
fim
Dogfalo/materialize
javascript
<|fim_suffix|>nt, horizontalAlignment: horizontalAlignment, height: idealHeight, width: idealWidth }; } /** * Animate in dropdown */ _animateIn() { anim.remove(this.dropdownEl); anim({ targets: this.dropdownEl, opacity: { value: ...
fim
Dogfalo/materialize
javascript
<|fim_suffix|>ont-family', fontFamily); } if (lineHeight) { hiddenDiv.css('line-height', lineHeight); } if (paddingTop) { hiddenDiv.css('padding-top', paddingTop); } if (paddingRight) { hiddenDiv.css('padding-right', paddingRight); } if (paddingBottom) { hiddenDiv...
fim
Dogfalo/materialize
javascript
<|fim_prefix|>// Required for Meteor package, the use of window prevents export by Meteor (function(window) { if (window.Package) { M = {}; } else { window.M = {}; } // Check for jQuery M.jQueryLoaded = !!window.jQuery; })(window); // AMD if (typeof define === 'function' && define.amd) { define('M...
fim
Dogfalo/materialize
javascript
<|fim_suffix|> // Set states this.doneAnimating = false; this.$el.addClass('active'); this.overlayActive = true; // onOpenStart callback if (typeof this.options.onOpenStart === 'function') { this.options.onOpenStart.call(this, this.el); } // Set positioning for plac...
fim
Dogfalo/materialize
javascript
<|fim_suffix|>1; // Set opening trigger, undefined indicates modal was opened by javascript this._openingTrigger = !!$trigger ? $trigger[0] : undefined; // onOpenStart callback if (typeof this.options.onOpenStart === 'function') { this.options.onOpenStart.call(this, this.el, this._open...
fim
Dogfalo/materialize
javascript