@effindomv2/fui-rs 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "fui-rs"
3
- version = "0.1.21"
3
+ version = "0.1.22"
4
4
  edition = "2021"
5
5
  license = "AGPL-3.0-only OR LicenseRef-EffinDom-Commercial"
6
6
 
package/README.md CHANGED
@@ -7,27 +7,35 @@ macros for browser-hosted Rust WASM apps.
7
7
 
8
8
  ## Quickstart
9
9
 
10
+ Create a FUI-RS application with the published scaffolder:
11
+
10
12
  ```bash
11
- # Prerequisites: Rust + wasm32-unknown-unknown target + Binaryen
13
+ # Install Rust and the WebAssembly target once
12
14
  curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
15
+ source "$HOME/.cargo/env"
13
16
  rustup target add wasm32-unknown-unknown
14
- brew install binaryen
15
-
16
- # Clone and build
17
- git clone https://github.com/zion-sati/fui-rs.git
18
- cd fui-rs
19
- npm ci
20
- npm run build
21
- npm run serve
17
+
18
+ # Create and run an app
19
+ npx @effindomv2/create-fui-rs-app my-app
20
+ cd my-app
21
+ npm install
22
+ npm run dev
22
23
  ```
23
24
 
24
- Open:
25
+ For a routed application with one independently built WASM module per route:
25
26
 
26
- ```text
27
- http://127.0.0.1:8080/v2/fui-rs/demo/index.html
27
+ ```bash
28
+ npx @effindomv2/create-fui-rs-app my-routed-app -- --template routed
29
+ cd my-routed-app
30
+ npm install
31
+ npm run dev
28
32
  ```
29
33
 
30
- Full quickstart: [docs/v2/fui-rs/QUICKSTART.md](../../docs/v2/fui-rs/QUICKSTART.md)
34
+ Install [Binaryen](https://github.com/WebAssembly/binaryen) to make release
35
+ builds run `wasm-opt`. Development builds do not require it.
36
+
37
+ Application setup, retained-mode guidance, and entrypoint examples are covered
38
+ in the [FUI-RS developer quickstart](../../docs/v2/fui-rs/QUICKSTART.md).
31
39
 
32
40
  ## Minimal app
33
41
 
@@ -46,6 +54,23 @@ fn build_page() -> FlexBox {
46
54
  fui_app!(FlexBox, build_page);
47
55
  ```
48
56
 
57
+ ## Rich text
58
+
59
+ Use `rich_text!` to create retained rich text without manually constructing a
60
+ span vector. String literals become spans, braced expressions provide dynamic
61
+ text, and `span => expression` accepts an existing `RichTextSpan`:
62
+
63
+ ```rust
64
+ let value = 42;
65
+ let suffix = span("!").underline();
66
+ let label = rich_text![
67
+ "Current value: ".italic(),
68
+ { format!("{value}") }.bold().text_color(rgb(0x3a, 0xc5, 0x6c)),
69
+ span => suffix,
70
+ ]
71
+ .font_size(18.0);
72
+ ```
73
+
49
74
  ## SDK docs
50
75
 
51
76
  - [SDK docs index](../../docs/v2/fui-rs/SDK_INDEX.md)
@@ -56,6 +81,14 @@ fui_app!(FlexBox, build_page);
56
81
  - [Forms and autofill](../../docs/v2/fui-rs/FORMS_AND_AUTOFILL.md)
57
82
  - [Theming and style matrix](../../docs/v2/fui-rs/THEMING_STYLE_MATRIX.md)
58
83
 
84
+ ## Contributing to FUI-RS
85
+
86
+ The commands above are for developers building applications with the published
87
+ FUI-RS SDK. Contributors working on the SDK, EffinDom runtime, browser bridge,
88
+ or repository demos should follow the
89
+ [FUI-RS contributor quickstart](../../docs/v2/fui-rs/CONTRIBUTOR_QUICKSTART.md).
90
+ It covers the standalone repository toolchain, SDK build, lint, and test lanes.
91
+
59
92
  ## What is included
60
93
 
61
94
  | Area | Status |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effindomv2/fui-rs",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "private": false,
5
5
  "license": "AGPL-3.0-only OR LicenseRef-EffinDom-Commercial",
6
6
  "description": "EffinDom v2 Rust frontend framework SDK and host generators",
package/src/app.rs CHANGED
@@ -3,7 +3,7 @@ use crate::context_menu_manager;
3
3
  use crate::ffi::HandleValue;
4
4
  use crate::frame_scheduler;
5
5
  use crate::mobile_text_selection_toolbar;
6
- use crate::node::{flex_box, FlexBox, Node, NodeRef};
6
+ use crate::node::{flex_box, FlexBox, Node, NodeRef, ThemeBindable};
7
7
  use crate::panic_hook;
8
8
  use crate::selection_handle_adorner;
9
9
  use crate::theme;
@@ -95,6 +95,9 @@ fn application_shell<T: Node>(root: &T) -> FlexBox {
95
95
  .child(&focus_adorner::create_default_host())
96
96
  .child(&tool_tip_manager::ToolTipManager::create_default_host())
97
97
  .child(&context_menu_manager::create_default_menu());
98
+ shell.bind_theme(|shell, theme| {
99
+ shell.bg_color(theme.colors.background);
100
+ });
98
101
  shell
99
102
  }
100
103
 
package/src/lib.rs CHANGED
@@ -63,6 +63,45 @@ macro_rules! children {
63
63
  };
64
64
  }
65
65
 
66
+ #[doc(hidden)]
67
+ #[macro_export]
68
+ macro_rules! __fui_rs_rich_text_spans {
69
+ (@collect [$($span:expr,)*]) => {
70
+ vec![$($span,)*]
71
+ };
72
+ (@collect [$($span:expr,)*] , $($rest:tt)*) => {
73
+ $crate::__fui_rs_rich_text_spans!(@collect [$($span,)*] $($rest)*)
74
+ };
75
+ (@collect [$($span:expr,)*] span => $value:expr, $($rest:tt)*) => {
76
+ $crate::__fui_rs_rich_text_spans!(@collect [$($span,)* $value,] $($rest)*)
77
+ };
78
+ (@collect [$($span:expr,)*] { $text:expr } $(.$method:ident($($argument:expr),* $(,)?))* , $($rest:tt)*) => {
79
+ $crate::__fui_rs_rich_text_spans!(@collect [
80
+ $($span,)*
81
+ $crate::text::span($text)$(.$method($($argument),*))*,
82
+ ] $($rest)*)
83
+ };
84
+ (@collect [$($span:expr,)*] $text:literal $(.$method:ident($($argument:expr),* $(,)?))* , $($rest:tt)*) => {
85
+ $crate::__fui_rs_rich_text_spans!(@collect [
86
+ $($span,)*
87
+ $crate::text::span($text)$(.$method($($argument),*))*,
88
+ ] $($rest)*)
89
+ };
90
+ }
91
+
92
+ /// Builds retained rich text with fluent span styling.
93
+ ///
94
+ /// String literals become spans automatically. Wrap a dynamic text expression
95
+ /// in braces, or use `span => expression` to provide a prebuilt span.
96
+ #[macro_export]
97
+ macro_rules! rich_text {
98
+ ($($span:tt)*) => {
99
+ $crate::text::RichText::new(
100
+ $crate::__fui_rs_rich_text_spans!(@collect [] $($span)* ,)
101
+ )
102
+ };
103
+ }
104
+
66
105
  pub trait Configure: Sized {
67
106
  fn configure(self, configure: impl FnOnce(&Self)) -> Self {
68
107
  configure(&self);
@@ -525,7 +564,7 @@ pub mod prelude {
525
564
  pub use crate::worker_job::{WorkerJob, WorkerJobState};
526
565
  #[cfg(feature = "worker-runtime")]
527
566
  pub use crate::worker_runtime::{file_read_chunk, file_worker_write_chunk, WorkerRuntime};
528
- pub use crate::{children, fui_app, fui_managed_app, ui, Configure};
567
+ pub use crate::{children, fui_app, fui_managed_app, rich_text, ui, Configure};
529
568
  }
530
569
 
531
570
  pub use animation::{