Skip to main content

pocopine_core/
lib.rs

1//! pocopine-core — client-side reactive runtime.
2//!
3//! Pure compiled-views runtime (RFC-058 Phase 6.5). Every `.poco`
4//! template lifts via `#[component]` into a static template plan;
5//! mounting walks that plan instead of scanning the DOM for `pp-*`
6//! directives. Reactivity is implemented against a real
7//! `js_sys::Proxy` so `get`/`set` traps match Alpine-style semantics
8//! for dependency tracking; signals, computed values, and watchers
9//! compose with the same engine via a synthetic
10//! [`reactive::SIGNAL_SCOPE`].
11
12pub mod animate;
13pub mod app;
14pub mod client_module;
15pub mod component_computed;
16pub mod computed;
17pub mod context;
18#[cfg(feature = "devtools")]
19pub mod devtools;
20pub mod directives;
21pub mod dom;
22pub mod emit;
23pub mod events;
24pub mod expr;
25pub mod extractors;
26pub mod fetch;
27pub mod focus;
28pub mod handle;
29pub mod handler;
30pub mod id;
31pub mod lifecycle;
32pub mod loop_scope;
33pub mod magics;
34pub mod model_runtime;
35pub mod mount;
36pub mod path;
37pub mod plugin;
38pub mod profiler;
39pub mod props;
40pub mod reactive;
41pub mod refs;
42pub mod registry;
43pub mod router;
44pub mod scope;
45pub mod scroll_lock;
46pub mod server;
47pub mod signal;
48pub mod slot_fragment;
49pub mod slot_scope;
50pub mod storage;
51pub mod store;
52pub mod styles;
53pub mod task;
54pub mod templates;
55pub mod templates_plan;
56pub mod text;
57pub mod tick;
58pub mod timers;
59pub mod watch;
60pub mod web;
61
62pub use app::{
63    encode_route_fragment, encode_route_path_segment, encode_route_query_part, App, AppPlugin,
64    Component, IntoRouteTarget, Loader, LoaderContext, LoaderError, PageLink, PageMeta,
65    PageMetaContext, PageMetaTag, Prefetch, PrefetchTrigger, RouteComponent, RouteConfig,
66    RouteContext, RouteErrorSurface, RouteGuard, RouteGuardDecision, RouteLoader,
67    RouteLoaderFuture, RouteMeta, RouteMetaKey, RouteName, RouteQuery, RouteRejection,
68    RouteRejectionAction, RouteRejectionContext, RouteRejectionHandler, RouteTarget,
69    RouteTargetBuilder, RouteTargetError, RouteUrl, SubtreeHandle,
70};
71pub use client_module::{ClientModule, ClientModuleError};
72pub use computed::{computed, Computed};
73#[allow(deprecated)]
74pub use context::InjectKey;
75pub use context::{inject, provide, ContextKey, ContextMarker};
76pub use directives::for_plan::{
77    register_row_plans, BindingKind, StaticBinding, StaticListener, StaticRowPlan,
78};
79pub use emit::{
80    emit, emit_cancelable, emit_cancelable_from, emit_event, emit_event_from, emit_from,
81    emit_from_host, emit_model, emit_model_field, emit_raw, emit_raw_from, Emit,
82};
83pub use events::{on_scope_unmount, on_scope_unmount_for, DomEventName, ListenerHandle};
84pub use expr::{StaticBinOp, StaticExpr, StaticLiteral};
85pub use extractors::{Inject, NearestParent, Parent};
86pub use handle::{this, Handle};
87pub use handler::{FromHandlerArg, HandlerDispatch};
88pub use lifecycle::{
89    Body, Doc, El, Elapsed, HostEl, IsTeleported, LifecycleContext, LifecyclePhase, MountEpoch,
90    ParentId, Refs, ScopePath, TagName, TeleportHost, TypedEl, Win,
91};
92pub use magics::dispatch_event;
93pub use model_runtime::{with_write_origin, WriteOrigin};
94pub use plugin::{
95    AppBootCompleted, AppBootFailed, AppBootStarted, ComponentEvent, ComponentMounted,
96    ComponentPluginExt, ComponentReady, ComponentSetup, ComponentUnmounted, ForComponent, Hook,
97    Plugin, PluginValidationError, Plugins, RouteNavigationCompleted, RouteNavigationFailed,
98    RouteNavigationStarted, ServerFunctionClientCompleted, ServerFunctionClientFailed,
99    ServerFunctionClientStarted,
100};
101pub use profiler::mount::{
102    enabled as mount_profile_enabled, report as report_mount_profile, reset as reset_mount_profile,
103};
104pub use props::{PropValue, Props};
105pub use reactive::{
106    batch, current_effect, effect, effect_scoped, effect_with, flush_sync, on_cleanup, release,
107    run_now, set_auto_flush, track, trigger_scope, EffectId, EffectOptions, ScopeId, SignalId,
108    SIGNAL_SCOPE,
109};
110pub use registry::{
111    assert_registry_clean, canonical_component_name, mark_registered, register_component,
112    register_component_as, register_component_prefixed, register_component_with_mount,
113    registered_component_names, registry_errors, render_boot_error, verify_registry, ComponentCtor,
114    ComponentEntry, ComponentMountFn, ComponentVTable, RegisteredComponent, RegistryError,
115    RegistryErrorKind, COMPONENT_ENTRIES,
116};
117pub use router::{
118    go, navigate, prefetch, push, reevaluate_current, register_route, replace, NavigationFailure,
119    NavigationResult, PrefetchResult, PrefetchSkip, ReturnTo, RouteLocation, RouteToken,
120};
121pub use scope::{
122    append_list_inline, current_scope_id, invalidate_field, invalidate_field_cache,
123    patch_list_at_inline, patch_list_indices_inline, prepend_list_inline, remove_list_at_inline,
124    replace_field_inline, swap_list_indices_inline, ComponentState, Scope, StaticPropKind,
125};
126pub use server::{Result as ServerResult, ServerError};
127pub use signal::{rw_signal, signal, RwSignal, Setter, Signal};
128pub use storage::{LocalStorage, StorageError};
129pub use store::{register_store_scope, store, store_scope, stores_object, Store, StoreHandle};
130pub use styles::inject_style;
131pub use task::{
132    spawn, spawn_for_scope, spawn_latest, spawn_latest_for_scope, spawn_scoped, TaskHandle,
133};
134pub use templates::{
135    compile_template, inject_pp_data, is_registered, register_template, template_for,
136};
137pub use watch::{
138    watch, watch_field, watch_field_scoped, watch_scope_field, watch_scope_field_now,
139    watch_scope_field_scoped, watch_scoped,
140};