pub(crate) mod animated;
mod asset;
mod back;
mod component;
mod element;
mod element_ref;
pub(crate) mod env;
mod events;
pub(crate) mod host;
mod module;
pub mod palette;
pub(crate) mod responder;
mod scrollable;
pub(crate) mod services;
pub(crate) mod status_bar;
mod style;
pub(crate) mod task;
mod theme;
mod value;
pub(crate) mod virtual_list;
pub use nsh_animation::{
Curve, EaseMode, Easing, Extrapolate, Output as AnimationOutput, sample_easing,
};
pub use nsh_macros::{
Event, JsObject, PropEnum, Props, asset, assets, methods, module, native_module,
};
pub use self::{
animated::{
Animated, Animation, AnimationEnd, AnimationOperand, Interpolation, NativeNode,
NativeValue, Spring, Timing, sample_decay, sample_decay_within, sample_spring,
},
asset::{AssetFile, AssetKind, FileAsset, FontAsset, ImageAsset, ImageSrc},
back::BackSubscription,
component::{
Component, ComponentError, ComponentSpec, Event, EventSpec, Method, MethodSpec, NoEvent,
Param, PropKind, PropSpec, Props, Registry, Root, declarations,
},
element::{
Accessible, AnyElement, Attrs, Child, Children, ComponentElement, Context, ElNode, Element,
FluentBuilder, Image, Interactive, IntoElement, Items, ListConfig, ListElement, Listener,
ParentElement, Position, RenderCx, Slot, SlotElement, Style, Text, View, image, text, view,
},
element_ref::{ComponentRef, ElementRef},
env::Environment,
events::{
GestureEvent, ImageProgress, NativeEvent, PanEvent, ScrollEvent, ScrollOffset, Selection,
VideoInfo, VideoProgress, WebNavigation,
},
host::{
CanvasArg, CanvasPaint, CanvasView, Input, InputAccessoryView, Modal, NativeView,
Orientation, Painter, Screen, Scroll, Stack, Video, WebView, canvas, input,
input_accessory_view, modal, native, screen, scroll, stack, video, web_view, web_view_html,
},
module::{
Function, FunctionCall, FunctionSpec, Module, ModuleCx, ModuleFuture, ModuleParam,
ModuleSpec,
},
responder::{ClaimRequest, PanGesture, ResponderEvent, TouchClaim},
scrollable::Scrollable,
services::{Prefetch, ToastDuration},
status_bar::StatusBarEntry,
style::{
AdaptiveColor, BorderCurve, FontWeight, Length, StyleRefinement, Styled, WritingDirection,
px, relative, rgb, rgba,
},
task::{Answer, AsyncCx, DialogAnswer, ImageSize, Task, Updated, WeakComponent},
theme::{Theme, ThemeColors, ThemeError},
value::{JsValue, NodeRef, PropError, SharedString, TsType, TsTypes},
virtual_list::{ListLayout, ViewableItems, VirtualList, virtual_list},
};
pub(crate) use self::{
back::BackListener,
component::{AnyInstance, caught},
element::{ElKind, ErasedCx, Globals, PlaceFn, Provided, RenderReads, RenderScope},
task::{Action, AnswerSlot, ClipboardRead, Executor},
};
pub use crate::{
AccessibilityRole, AccessibilityState, AutoCapitalize, AutoFill, BlendMode, BoxShadow, Dialog,
DialogButton, DialogButtonStyle, EdgeInsets, EllipsizeMode, EventKind, EventPayload,
KeyboardAppearance, KeyboardDismissMode, KeyboardTaps, KeyboardType, KeyframeAnimation,
Keyframes, LayoutAnimation, LayoutCurve, LayoutProperty, LayoutTransition, Measurement,
ModalAnimation, ModalPresentation, PanActivation, PointerEvents, ResizeMode, ReturnKeyType,
ScreenAnimation, SnapAlignment, StatusBarConfig, StatusBarSetting, StatusBarStyle,
SubmitBehavior, TouchEvent, TransformKind, TransformOrigin, Viewability,
platform::{Appearance, Idiom, Locale, Os},
style::{Color, OriginLen},
};
pub mod prelude {
pub use super::{
AccessibilityRole,
AccessibilityState,
Accessible,
AdaptiveColor,
Animated,
Animation,
AnimationOutput,
AnyElement,
Appearance,
AsyncCx,
AutoCapitalize,
BackSubscription,
BlendMode,
BorderCurve,
BoxShadow,
CanvasView,
Child,
Children,
ClaimRequest,
Color,
Component,
ComponentElement,
ComponentError,
ComponentRef,
Context,
Curve,
DialogAnswer,
EaseMode,
Easing,
EdgeInsets,
Element,
ElementRef,
Environment,
Event,
EventKind,
EventPayload,
Extrapolate,
FluentBuilder,
FontAsset,
FontWeight,
GestureEvent,
ImageAsset,
Input,
InputAccessoryView,
Interactive,
Interpolation,
IntoElement,
Items,
JsObject,
JsValue,
KeyboardAppearance,
KeyboardDismissMode,
KeyboardTaps,
KeyboardType,
KeyframeAnimation,
Keyframes,
Length,
ListLayout,
Listener,
Measurement,
Method,
Modal,
ModalAnimation,
ModalPresentation,
ModuleCx,
NativeEvent,
NativeNode,
NativeValue,
NativeView,
NoEvent,
Orientation,
Painter,
PanActivation,
PanEvent,
PanGesture,
ParentElement,
PointerEvents,
Position,
PropEnum,
Props,
Registry,
RenderCx,
ResizeMode,
ResponderEvent,
ReturnKeyType,
Screen,
ScreenAnimation,
Scroll,
ScrollEvent,
ScrollOffset,
Scrollable,
Selection,
SharedString,
Slot,
SnapAlignment,
Spring,
Stack,
Styled,
SubmitBehavior,
Task,
Text,
Theme,
Timing,
ToastDuration,
TouchClaim,
Video,
VideoInfo,
VideoProgress,
View,
Viewability,
ViewableItems,
VirtualList,
WeakComponent,
WebNavigation,
WebView,
WritingDirection,
asset,
assets,
canvas,
image,
input,
input_accessory_view,
methods,
modal,
module,
native,
native_module,
px,
relative,
rgb,
rgba,
screen,
scroll,
stack,
text,
video,
view,
virtual_list,
web_view,
web_view_html,
};
}
#[doc(hidden)]
pub mod __private {
pub use serde_json::Map as JsonMap;
#[diagnostic::on_unimplemented(
message = "the app's crate (nsh.json \"rust\") has no `#[native_module(\"…\")]` at its root",
label = "the app's UI set",
note = "add to the crate's lib.rs, with the specifier its TSX imports the set by: `#[native_module(\"my-app/native\")] fn native(registry: &mut Registry) {{ registry.register::<MyComponent>(); }}` (`use nsh_core::ui::prelude::*`)"
)]
pub trait NoNativeModule {}
#[diagnostic::on_unimplemented(
message = "`#[native_module]` goes at the root of the crate (lib.rs)",
label = "nsh's generated workspace calls the entry it makes there",
note = "move the function with `#[native_module(\"…\")]` to the crate's lib.rs"
)]
pub trait NotAtRoot {}
pub fn no_native_module<R: NoNativeModule>() -> R {
unreachable!("never compiles")
}
pub fn native_module_not_at_root<R: NotAtRoot>() -> R {
unreachable!("never compiles")
}
}