Skip to content

Commit b50476d

Browse files
committed
Remove builder api and assosciated support code.
Questions remain as to how this affects the concens in seed-rs#277 `rerender_vdom` and `bootstrap_vdom` may need more looking into now that the `MountType` has been cleared.
1 parent dc23088 commit b50476d

26 files changed

+321
-1691
lines changed

src/app.rs

Lines changed: 180 additions & 420 deletions
Large diffs are not rendered by default.

src/app/builder.rs

Lines changed: 0 additions & 587 deletions
This file was deleted.

src/app/builder/after_mount.rs

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/app/builder/before_mount.rs

Lines changed: 0 additions & 118 deletions
This file was deleted.

src/app/builder/init.rs

Lines changed: 0 additions & 110 deletions
This file was deleted.

src/app/cfg.rs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,18 @@
1-
use super::types::{SinkFn, UpdateFn, ViewFn, WindowEventsFn};
2-
use super::{builder::IntoAfterMount, MountType};
1+
use super::types::{UpdateFn, ViewFn};
32
use crate::virtual_dom::IntoNodes;
4-
use std::marker::PhantomData;
53
use std::rc::Rc;
64

75
#[allow(clippy::module_name_repetitions)]
8-
pub struct AppInitCfg<Ms, Mdl, INodes, GMs, IAM: ?Sized>
6+
pub struct AppCfg<Ms, Mdl, INodes>
97
where
108
Ms: 'static,
119
Mdl: 'static,
1210
INodes: IntoNodes<Ms>,
13-
IAM: IntoAfterMount<Ms, Mdl, INodes, GMs>,
1411
{
15-
pub mount_type: MountType,
16-
pub into_after_mount: Box<IAM>,
17-
pub phantom: PhantomData<(Ms, Mdl, INodes, GMs)>,
18-
}
19-
20-
#[allow(clippy::module_name_repetitions)]
21-
pub struct AppCfg<Ms, Mdl, INodes, GMs>
22-
where
23-
Ms: 'static,
24-
Mdl: 'static,
25-
INodes: IntoNodes<Ms>,
26-
{
27-
pub document: web_sys::Document,
28-
pub mount_point: web_sys::Element,
29-
pub update: UpdateFn<Ms, Mdl, INodes, GMs>,
30-
pub sink: Option<SinkFn<Ms, Mdl, INodes, GMs>>,
31-
pub view: ViewFn<Mdl, INodes>,
32-
pub window_events: Option<WindowEventsFn<Ms, Mdl>>,
33-
pub base_path: Rc<Vec<String>>,
12+
pub(crate) document: web_sys::Document,
13+
// @TODO: Look into removing mount_point
14+
pub(crate) mount_point: web_sys::Element,
15+
pub(crate) update: UpdateFn<Ms, Mdl, INodes>,
16+
pub(crate) view: ViewFn<Mdl, INodes>,
17+
pub(crate) base_path: Rc<Vec<String>>,
3418
}

src/app/cmd_manager.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
use futures::future::{abortable, AbortHandle, Future, FutureExt};
22
use wasm_bindgen_futures::spawn_local;
33

4-
// @TODO: Tighten up access - e.g. replace `pub` with `pub(crate)`. Applicable to the entire code base.
5-
64
// ------ CmdManager ------
75

8-
pub struct CmdManager;
6+
pub(crate) struct CmdManager;
97

108
impl CmdManager {
119
pub fn perform_cmd(cmd: impl Future<Output = ()> + 'static) {

src/app/data.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::types::{MsgListeners, RoutesFn};
1+
use super::types::MsgListeners;
22
use super::{RenderInfo, SubManager};
33
use crate::browser::util;
44
use crate::virtual_dom::{El, EventHandlerManager};
@@ -7,15 +7,15 @@ use wasm_bindgen::closure::Closure;
77

88
type StoredPopstate = RefCell<Option<Closure<dyn FnMut(web_sys::Event)>>>;
99

10-
/// Used as part of an interior-mutability pattern, ie Rc<RefCell<>>
11-
#[allow(clippy::type_complexity, clippy::module_name_repetitions)]
12-
pub struct AppData<Ms: 'static, Mdl> {
10+
// Used as part of an interior-mutability pattern, ie Rc<RefCell<>>
11+
#[allow(clippy::type_complexity)]
12+
pub(crate) struct AppData<Ms: 'static, Mdl> {
1313
// Model is in a RefCell here so we can modify it in self.update().
1414
pub model: RefCell<Option<Mdl>>,
15-
pub main_el_vdom: RefCell<Option<El<Ms>>>,
15+
// @TODO: Look into removing/renaming main_el_vdom
16+
pub(crate) main_el_vdom: RefCell<Option<El<Ms>>>,
1617
pub popstate_closure: StoredPopstate,
1718
pub hashchange_closure: StoredPopstate,
18-
pub routes: RefCell<Option<RoutesFn<Ms>>>,
1919
pub window_event_handler_manager: RefCell<EventHandlerManager<Ms>>,
2020
pub sub_manager: RefCell<SubManager<Ms>>,
2121
pub msg_listeners: RefCell<MsgListeners<Ms>>,

0 commit comments

Comments
 (0)