diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 60e45c575..480062772 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -24,7 +24,7 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Environment** -- Maple: [e.g. 0.1.0, master] +- Sycamore: [e.g. 0.1.0, master] - Browser: [e.g. chrome, safari, if applicable] - OS: [e.g. Windows, if applicable] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1fd473cd8..d2d4d4a0c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: if: always() - name: Run headless browser tests - run: wasm-pack test maple-core --firefox --chrome --headless + run: wasm-pack test sycamore --firefox --chrome --headless if: always() clippy: @@ -83,5 +83,5 @@ jobs: - name: Run tests run: | - cd maple-core + cd sycamore cargo miri test diff --git a/CHANGELOG.md b/CHANGELOG.md index 26638065a..95fcbcc99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,11 +12,11 @@ button(aria-hidden="true") } ``` - [[@lukechu10], [#79](https://github.com/lukechu10/maple/pull/79)] + [[@lukechu10], [#79](https://github.com/lukechu10/sycamore/pull/79)] - #### 🛠 Fixes - - Delete removed nodes in `Keyed` first before adding new nodes and moving existing nodes [[@lukechu10], [#77](https://github.com/lukechu10/maple/pull/77)] + - Delete removed nodes in `Keyed` first before adding new nodes and moving existing nodes [[@lukechu10], [#77](https://github.com/lukechu10/sycamore/pull/77)] ## ✨ **0.4.2** _(2021-03-31)_ @@ -24,7 +24,7 @@ - #### 🛠 Fixes - - Fix `Keyed` iteration (hopefully for the last time) when moving nodes already inserted [[@lukechu10], [#75](https://github.com/lukechu10/maple/pull/75)] + - Fix `Keyed` iteration (hopefully for the last time) when moving nodes already inserted [[@lukechu10], [#75](https://github.com/lukechu10/sycamore/pull/75)] ## ✨ **0.4.1** _(2021-03-31)_ @@ -32,16 +32,16 @@ - #### 🛠 Fixes - - Fix `Keyed` iteration (swapping and inserting not at the end) [[@lukechu10], [#73](https://github.com/lukechu10/maple/pull/73)] + - Fix `Keyed` iteration (swapping and inserting not at the end) [[@lukechu10], [#73](https://github.com/lukechu10/sycamore/pull/73)] - #### 📃 Documentation Fixes - - Fix typo in `README.md` [[@iwburns], [#64](https://github.com/lukechu10/maple/pull/64)]] - - Add discord server link to issue template [[@lukechu10], [#68](https://github.com/lukechu10/maple/pull/68)] + - Fix typo in `README.md` [[@iwburns], [#64](https://github.com/lukechu10/sycamore/pull/64)]] + - Add discord server link to issue template [[@lukechu10], [#68](https://github.com/lukechu10/sycamore/pull/68)] - #### 🎁 Example Fixes - - Fix filter links in TodoMVC example [[@lukechu10], [#65](https://github.com/lukechu10/maple/pull/65)] + - Fix filter links in TodoMVC example [[@lukechu10], [#65](https://github.com/lukechu10/sycamore/pull/65)] ## ✨ **0.4.0** _(2021-03-25)_ @@ -49,21 +49,21 @@ - #### ⚡️ Features - - Iteration using `SignalVec`. This is more of an experiment and there are some bugs. This will most likely be removed in a future version [[@lukechu10], [#49](https://github.com/lukechu10/maple/pull/49)] - - Keyed iteration using `Keyed` and non-keyed iteration using `Indexed` which can iterate over a `Signal`. This is the recommended way to iterate over a list of values [[@lukechu10], [#51](https://github.com/lukechu10/maple/pull/51), [#53](https://github.com/lukechu10/maple/pull/53) and [#54](https://github.com/lukechu10/maple/pull/54)] - - Node references. Use the `ref` attribute to bind an HTML element to a `NodeRef` [[@lukechu10], [#57](https://github.com/lukechu10/maple/pull/57)] + - Iteration using `SignalVec`. This is more of an experiment and there are some bugs. This will most likely be removed in a future version [[@lukechu10], [#49](https://github.com/lukechu10/sycamore/pull/49)] + - Keyed iteration using `Keyed` and non-keyed iteration using `Indexed` which can iterate over a `Signal`. This is the recommended way to iterate over a list of values [[@lukechu10], [#51](https://github.com/lukechu10/sycamore/pull/51), [#53](https://github.com/lukechu10/sycamore/pull/53) and [#54](https://github.com/lukechu10/sycamore/pull/54)] + - Node references. Use the `ref` attribute to bind an HTML element to a `NodeRef` [[@lukechu10], [#57](https://github.com/lukechu10/sycamore/pull/57)] - #### 🛠 Fixes - - Fix debug assertions in `Keyed` [[@lukechu10], [#53](https://github.com/lukechu10/maple/pull/53)] + - Fix debug assertions in `Keyed` [[@lukechu10], [#53](https://github.com/lukechu10/sycamore/pull/53)] - #### 🛠 Internal Fixes and Improvements - - Setup integration tests [[@lukechu10], [#51](https://github.com/lukechu10/maple/pull/51)] + - Setup integration tests [[@lukechu10], [#51](https://github.com/lukechu10/sycamore/pull/51)] - #### 🎁 Examples - - Complete spec conforming TodoMVC implementation [[@lukechu10], [#60](https://github.com/lukechu10/maple/pull/60)] + - Complete spec conforming TodoMVC implementation [[@lukechu10], [#60](https://github.com/lukechu10/sycamore/pull/60)] ## ✨ **0.3.1** _(2021-03-16)_ @@ -71,12 +71,12 @@ - #### ⚡️ Features - - More types in `template!` macro. `template!` can now be nested [[@lukechu10], [#45](https://github.com/lukechu10/maple/pull/45)] - - Component lifecycle using `on_cleanup` [[@lukechu10], [#24](https://github.com/lukechu10/maple/pull/24)] + - More types in `template!` macro. `template!` can now be nested [[@lukechu10], [#45](https://github.com/lukechu10/sycamore/pull/45)] + - Component lifecycle using `on_cleanup` [[@lukechu10], [#24](https://github.com/lukechu10/sycamore/pull/24)] - #### 🛠 Fixes - - Add some badges to `README.md` [[@lukechu10], [#44](https://github.com/lukechu10/maple/pull/44) and [#48](https://github.com/lukechu10/maple/pull/48)] + - Add some badges to `README.md` [[@lukechu10], [#44](https://github.com/lukechu10/sycamore/pull/44) and [#48](https://github.com/lukechu10/sycamore/pull/48)] ## ✨ **0.3.0** _(2021-03-13)_ @@ -84,30 +84,30 @@ - #### ⚡️ Features - - Nested effects. Inner effects are destroyed and recreated when outer effects re-run [[@lukechu10], [#29](https://github.com/lukechu10/maple/pull/29)] - - `cloned!` macro for making it easier to clone items into a new scope [[@lukechu10], [#34](https://github.com/lukechu10/maple/pull/34)] - - Effects are created inside a reactivity root (using `create_root`). When the root `Owner` is dropped, all effects are also destroyed [[@lukechu10], [37](https://github.com/lukechu10/maple/pull/37)] - - Nested templates. Using this, it is also possible to build simple `if`/`else` control flow although there will be a more polished version [[@lukechu10], [#41](https://github.com/lukechu10/maple/pull/41)] + - Nested effects. Inner effects are destroyed and recreated when outer effects re-run [[@lukechu10], [#29](https://github.com/lukechu10/sycamore/pull/29)] + - `cloned!` macro for making it easier to clone items into a new scope [[@lukechu10], [#34](https://github.com/lukechu10/sycamore/pull/34)] + - Effects are created inside a reactivity root (using `create_root`). When the root `Owner` is dropped, all effects are also destroyed [[@lukechu10], [37](https://github.com/lukechu10/sycamore/pull/37)] + - Nested templates. Using this, it is also possible to build simple `if`/`else` control flow although there will be a more polished version [[@lukechu10], [#41](https://github.com/lukechu10/sycamore/pull/41)] - #### 🛠 Fixes - - Parse html root as an `HtmlTree` [[@lukechu10], [#25](https://github.com/lukechu10/maple/pull/25)] - - Recreate effect dependencies on each re-run [[@lukechu10], [#29](https://github.com/lukechu10/maple/pull/29)] + - Parse html root as an `HtmlTree` [[@lukechu10], [#25](https://github.com/lukechu10/sycamore/pull/25)] + - Recreate effect dependencies on each re-run [[@lukechu10], [#29](https://github.com/lukechu10/sycamore/pull/29)] - #### 🛠 Internal Fixes and Improvements - - Remove double boxing of `Computation` [[@Kestrer], [#31](https://github.com/lukechu10/maple/pull/31)] - - Create `CODE_OF_CONDUCT.md` [[@lukechu10], [#33](https://github.com/lukechu10/maple/pull/33)] - - Add some preliminary benchmarks for signals and effects [[@lukechu10], [#35](https://github.com/lukechu10/maple/pull/35)] - - Add clippy to CI workflow [[@Kestrer], [#42](https://github.com/lukechu10/maple/pull/42)] + - Remove double boxing of `Computation` [[@Kestrer], [#31](https://github.com/lukechu10/sycamore/pull/31)] + - Create `CODE_OF_CONDUCT.md` [[@lukechu10], [#33](https://github.com/lukechu10/sycamore/pull/33)] + - Add some preliminary benchmarks for signals and effects [[@lukechu10], [#35](https://github.com/lukechu10/sycamore/pull/35)] + - Add clippy to CI workflow [[@Kestrer], [#42](https://github.com/lukechu10/sycamore/pull/42)] - #### ⚠ **BREAKING CHANGES** - - Replaced `create_signal` with `Signal::new(...)` and return `Signal` instead of getter/setter functions for increased type safety [[@Kestrer], [#20](https://github.com/lukechu10/maple/pull/20)] + - Replaced `create_signal` with `Signal::new(...)` and return `Signal` instead of getter/setter functions for increased type safety [[@Kestrer], [#20](https://github.com/lukechu10/sycamore/pull/20)] - #### 📢 Announcements - - New documentation website: https://maple-rs.netlify.app/ [[@lukechu10], [#26](https://github.com/lukechu10/maple/pull/26) and [#40](https://github.com/lukechu10/maple/pull/40)] + - New documentation website: https://sycamore-rs.netlify.app/ [[@lukechu10], [#26](https://github.com/lukechu10/sycamore/pull/26) and [#40](https://github.com/lukechu10/sycamore/pull/40)] ## ✨ **0.2.0** _(2021-03-07)_ @@ -115,12 +115,12 @@ - #### ⚡️ Features - - Components! In `maple` they are simply plain old functions that take their props via their parameters [[#9](https://github.com/lukechu10/maple/pull/9)] - - Event listeners now have access to the `Event` object [[#16](https://github.com/lukechu10/maple/pull/16)] + - Components! In `sycamore` they are simply plain old functions that take their props via their parameters [[#9](https://github.com/lukechu10/sycamore/pull/9)] + - Event listeners now have access to the `Event` object [[#16](https://github.com/lukechu10/sycamore/pull/16)] - #### 🛠 Changes - - The `template!` macro now returns a `TemplateResult` instead of raw DOM nodes for increased type safety [[#10](https://github.com/lukechu10/maple/pull/10)] + - The `template!` macro now returns a `TemplateResult` instead of raw DOM nodes for increased type safety [[#10](https://github.com/lukechu10/sycamore/pull/10)] ## ✨ **0.1.1** _(2021-03-07)_ @@ -128,10 +128,10 @@ - #### ⚡️ Features - - New `untracked` utility for explicitly opting out of automatic dependency detection in reactive contexts [[#8](https://github.com/lukechu10/maple/pull/8)] + - New `untracked` utility for explicitly opting out of automatic dependency detection in reactive contexts [[#8](https://github.com/lukechu10/sycamore/pull/8)] - #### 🛠 Fixes - - Only subscribe to a dependency once in an effect, even if it is called multiple times [[#7](https://github.com/lukechu10/maple/pull/7)] + - Only subscribe to a dependency once in an effect, even if it is called multiple times [[#7](https://github.com/lukechu10/sycamore/pull/7)] ## ✨ **0.1.0** _(2021-03-06)_ diff --git a/Cargo.toml b/Cargo.toml index 6825586b1..64d5a3db6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ - "maple-core", - "maple-core-macro", + "packages/sycamore", + "packages/sycamore-macro", "examples/components", "examples/counter", "examples/hello", diff --git a/README.md b/README.md index 7a40ec102..aaec976ef 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,25 @@ -# Maple +# Sycamore -[![Crates.io](https://img.shields.io/crates/v/maple-core)](https://crates.io/crates/maple-core) -[![docs.rs](https://img.shields.io/docsrs/maple-core?color=blue&label=docs.rs)](https://docs.rs/maple-core) -[![GitHub contributors](https://img.shields.io/github/contributors/lukechu10/maple)](https://github.com/lukechu10/maple/graphs/contributors) +[![Crates.io](https://img.shields.io/crates/v/sycamore)](https://crates.io/crates/sycamore) +[![docs.rs](https://img.shields.io/docsrs/sycamore?color=blue&label=docs.rs)](https://docs.rs/sycamore) +[![GitHub contributors](https://img.shields.io/github/contributors/lukechu10/sycamore)](https://github.com/lukechu10/sycamore/graphs/contributors) [![Discord](https://img.shields.io/discord/820400041332179004?label=discord)](https://discord.gg/vDwFUmm6mU) -## What is Maple? +## What is Sycamore? -Maple is a modern VDOM-less web library with fine-grained reactivity in [Rust](https://www.rust-lang.org/) and [WebAssembly](https://webassembly.org/). +Sycamore is a modern VDOM-less web library with fine-grained reactivity in [Rust](https://www.rust-lang.org/) and [WebAssembly](https://webassembly.org/). -Learn more at the [Maple website](https://maple-rs.netlify.app), or stop by the [Discord server](https://discord.gg/vDwFUmm6mU). +Learn more at the [Sycamore website](https://sycamore-rs.netlify.app), or stop by the [Discord server](https://discord.gg/vDwFUmm6mU). ## Contributing Issue reports and Pull Requests are always welcome! -Check out the [section on contributing](https://maple-rs.netlify.app/contribute/architecture) in the docs. +Check out the [section on contributing](https://sycamore-rs.netlify.app/contribute/architecture) in the docs. ## Contributors -Maple would not have been possible without the wonderful work of all the people who contributed. Thank you! +Sycamore would not have been possible without the wonderful work of all the people who contributed. Thank you! - - + + diff --git a/docs/Cargo.toml b/docs/Cargo.toml index a042d43b0..ad5132250 100644 --- a/docs/Cargo.toml +++ b/docs/Cargo.toml @@ -11,7 +11,7 @@ console_error_panic_hook = "0.1.6" console_log = "0.2.0" js-sys = "0.3" log = "0.4.14" -maple-core = {path = "../maple-core"} +sycamore = {path = "../packages/sycamore"} pulldown-cmark = "0.8" wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" diff --git a/docs/index.html b/docs/index.html index fba3e46b2..b9618b787 100644 --- a/docs/index.html +++ b/docs/index.html @@ -11,7 +11,7 @@ /> - Maple + Sycamore diff --git a/docs/markdown/advanced/css.md b/docs/markdown/advanced/css.md index 0beaf185b..3637a3510 100644 --- a/docs/markdown/advanced/css.md +++ b/docs/markdown/advanced/css.md @@ -2,4 +2,4 @@ TODO -CSS in Maple needs more design before anything can be implemented. +CSS in Sycamore needs more design before anything can be implemented. diff --git a/docs/markdown/advanced/routing.md b/docs/markdown/advanced/routing.md index 90f509652..6cf3df991 100644 --- a/docs/markdown/advanced/routing.md +++ b/docs/markdown/advanced/routing.md @@ -1,3 +1,3 @@ # Routing -Routing is still work-in-progress. Visit [#85](https://github.com/lukechu10/maple/issues/85) for more details. +Routing is still work-in-progress. Visit [#85](https://github.com/lukechu10/sycamore/issues/85) for more details. diff --git a/docs/markdown/advanced/ssr.md b/docs/markdown/advanced/ssr.md index 40aa7815b..39dfa1316 100644 --- a/docs/markdown/advanced/ssr.md +++ b/docs/markdown/advanced/ssr.md @@ -1,3 +1,3 @@ # Server Side Rendering -Server Side Rendering is still work-in-progress. Visit [#47](https://github.com/lukechu10/maple/issues/47) for more details. +Server Side Rendering is still work-in-progress. Visit [#47](https://github.com/lukechu10/sycamore/issues/47) for more details. diff --git a/docs/markdown/advanced/testing.md b/docs/markdown/advanced/testing.md index 6e548932a..6ae7d4dfc 100644 --- a/docs/markdown/advanced/testing.md +++ b/docs/markdown/advanced/testing.md @@ -1,3 +1,3 @@ # Testing -A testing story is still work-in-progress. Visit [#55](https://github.com/lukechu10/maple/issues/55) for more details. +A testing story is still work-in-progress. Visit [#55](https://github.com/lukechu10/sycamore/issues/55) for more details. diff --git a/docs/markdown/advanced/tweened.md b/docs/markdown/advanced/tweened.md index 2963b9593..0a2acf630 100644 --- a/docs/markdown/advanced/tweened.md +++ b/docs/markdown/advanced/tweened.md @@ -6,12 +6,12 @@ For example, the following code snippet interpolates a value from 0 to 100 over ```rust use std::time::Duration; -use maple_core::reactive::Tweened; -use maple_core::{easing, prelude::*}; +use sycamore::reactive::Tweened; +use sycamore::{easing, prelude::*}; let tweened = Tweened::new(0, Duration::from_millis(200), easing::linear); tweened.set(100); ``` -Different easing functions are provided in the `maple_core::easing` module. +Different easing functions are provided in the `sycamore::easing` module. diff --git a/docs/markdown/basics/components.md b/docs/markdown/basics/components.md index a6b7aa21b..6941672ef 100644 --- a/docs/markdown/basics/components.md +++ b/docs/markdown/basics/components.md @@ -1,6 +1,6 @@ # Components -Components in `maple` are structs that implement `Component`. A component can automatically be +Components in `sycamore` are structs that implement `Component`. A component can automatically be created with the `#[component(ComponentName)]` attribute on a function. Components receive their props through function arguments. @@ -13,7 +13,7 @@ Getting a `StateHandle` from a `Signal` is easy. Just call the `.handle()` Here is an example of a simple component that displays the value of its prop: ```rust -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(MyComponent)] fn my_component(value: StateHandle) -> TemplateResult { diff --git a/docs/markdown/basics/data_binding.md b/docs/markdown/basics/data_binding.md index 613a35a92..660a548a6 100644 --- a/docs/markdown/basics/data_binding.md +++ b/docs/markdown/basics/data_binding.md @@ -3,7 +3,7 @@ You can bind your `Signal` to a DOM property with the `bind:` directive. When the DOM property is updated, so is your `Signal`. Here is an example. ```rust -use maple_core::prelude::*; +use sycamore::prelude::*; let value = Signal::new(String::new()); diff --git a/docs/markdown/basics/reactivity.md b/docs/markdown/basics/reactivity.md index 422f1e98f..dd6bb8232 100644 --- a/docs/markdown/basics/reactivity.md +++ b/docs/markdown/basics/reactivity.md @@ -1,12 +1,12 @@ # Reactivity -Instead of relying on a Virtual DOM (VDOM), Maple uses fine-grained reactivity to keep the DOM and state in sync. -In fact, the reactivity part of Maple can be used on its own without the DOM rendering part. +Instead of relying on a Virtual DOM (VDOM), Sycamore uses fine-grained reactivity to keep the DOM and state in sync. +In fact, the reactivity part of Sycamore can be used on its own without the DOM rendering part. Reactivity is based on reactive primitives. Here is an example: ```rust -use maple_core::prelude::*; +use sycamore::prelude::*; let state = Signal::new(0); // create an atom with an initial value of 0 ``` @@ -72,14 +72,14 @@ assert_eq!(*double.get(), 2); `create_memo(...)` automatically recomputes the derived value when any of its dependencies change. -Now that you understand `maple`'s reactivity system, we can look at how to use this to update the DOM. +Now that you understand `sycamore`'s reactivity system, we can look at how to use this to update the DOM. ### Using reactivity with DOM updates Reactivity is automatically built-in into the `template!` macro. Say we have the following code: ```rust -use maple_core::prelude::*; +use sycamore::prelude::*; let state = Signal::new(0); @@ -93,7 +93,7 @@ let root = template! { This will expand to something approximately like: ```rust -use maple_core::prelude::*; +use sycamore::prelude::*; let state = Signal::new(0); diff --git a/docs/markdown/basics/template.md b/docs/markdown/basics/template.md index c052f4c89..449428660 100644 --- a/docs/markdown/basics/template.md +++ b/docs/markdown/basics/template.md @@ -1,6 +1,6 @@ # `template!` -Maple uses the `template!` macro as an ergonomic way to create complex user interfaces. You might have already seen it in the _"Hello, World!"_ example. +Sycamore uses the `template!` macro as an ergonomic way to create complex user interfaces. You might have already seen it in the _"Hello, World!"_ example. The `template!` macro is quite powerful. You can create nested nodes like so. diff --git a/docs/markdown/contribute/architecture.md b/docs/markdown/contribute/architecture.md index bdb180db1..e193f8fd2 100644 --- a/docs/markdown/contribute/architecture.md +++ b/docs/markdown/contribute/architecture.md @@ -1,17 +1,17 @@ # Project architecture -All non proc-macro related code is in `/maple-core`. -Proc-macro related code is in `/maple-core-macro`. +All non proc-macro related code is in `/sycamore`. +Proc-macro related code is in `/sycamore-macro`. ## Concepts and where to find them - #### Reactivity - - All the reactivity primitives are defined in `/maple-core/src/reactive.rs`. + - All the reactivity primitives are defined in `/sycamore/src/reactive.rs`. - #### `template!` - - The template macro is defined in `/maple-core-macro/src/lib.rs`. + - The template macro is defined in `/sycamore-macro/src/lib.rs`. - Different DOM node types are defined in separate files under the same directory. - [`trybuild`](https://github.com/dtolnay/trybuild) is used for testing proc-macros. diff --git a/docs/markdown/contribute/development.md b/docs/markdown/contribute/development.md index 1f96416e0..2fbd72207 100644 --- a/docs/markdown/contribute/development.md +++ b/docs/markdown/contribute/development.md @@ -2,17 +2,17 @@ ## Using [gitpod.io](https://www.gitpod.io) -The Maple repository is configured for [gitpod.io](https://www.gitpod.io). This is the easiest way to contribute. Just click on the button below and a full-fledged development workspace will be spun up with all dependencies pre-installed and VSCode ready to go. +The Sycamore repository is configured for [gitpod.io](https://www.gitpod.io). This is the easiest way to contribute. Just click on the button below and a full-fledged development workspace will be spun up with all dependencies pre-installed and VSCode ready to go. -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lukechu10/maple) +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lukechu10/sycamore) ## Using your local dev machine -To install and work on Maple locally: +To install and work on Sycamore locally: ```bash -git clone https://github.com/lukechu10/maple -cd maple +git clone https://github.com/lukechu10/sycamore +cd sycamore ``` ## Testing @@ -26,7 +26,7 @@ cargo test To run integration tests in the browser, you will need to have [wasm-pack](https://rustwasm.github.io/wasm-pack/) installed: ```bash -wasm-pack test maple-core --firefox # or --chrome +wasm-pack test sycamore --firefox # or --chrome ``` If you want to run the tests in a headless browser, pass the `--headless` flag as well. @@ -37,4 +37,4 @@ Before your PR can be merged, we ask that your code is properly formatted using If your code introduces new functionality, we also ask you to write some unit tests and eventually some integration tests. -Thank you for taking the time to contribute to Maple! +Thank you for taking the time to contribute to Sycamore! diff --git a/docs/markdown/getting_started/hello_world.md b/docs/markdown/getting_started/hello_world.md index 4155c4120..af6154af4 100644 --- a/docs/markdown/getting_started/hello_world.md +++ b/docs/markdown/getting_started/hello_world.md @@ -1,13 +1,13 @@ # Hello, World! -Maple tries to have as simple of an API as possible. In fact, the Hello World program in Maple is but slightly longer than the console version! +Sycamore tries to have as simple of an API as possible. In fact, the Hello World program in Sycamore is but slightly longer than the console version! Here it is: ```rust // main.rs -use maple_core::prelude::*; +use sycamore::prelude::*; fn main() { render(|| template! { @@ -28,7 +28,7 @@ Nothing really special here. Trunk automatically uses `fn main` as your project' render(...) ``` -This function is provided by Maple and is used to render your app to the DOM (browser window). `render` accepts a closure (aka. lambda function) which should return a template to be rendered. +This function is provided by Sycamore and is used to render your app to the DOM (browser window). `render` accepts a closure (aka. lambda function) which should return a template to be rendered. ```rust template! { diff --git a/docs/markdown/getting_started/installation.md b/docs/markdown/getting_started/installation.md index a7e5f6f22..25743b952 100644 --- a/docs/markdown/getting_started/installation.md +++ b/docs/markdown/getting_started/installation.md @@ -14,7 +14,7 @@ rustup target add wasm32-unknown-unknown ## Install Trunk -[Trunk](https://trunkrs.dev) is the recommended build tool for Maple. +[Trunk](https://trunkrs.dev) is the recommended build tool for Sycamore. If you are from JS land, Trunk is like [webpack](https://webpack.js.org/) or [rollup](https://rollupjs.org/) but specifically tailored to Rust + WASM apps. You can use `cargo` to install Trunk: @@ -25,7 +25,7 @@ cargo install trunk wasm-bindgen-cli For more information, head over to the [Trunk website](https://trunkrs.dev) -## Create a new Maple project +## Create a new Sycamore project Create a new Rust project using `cargo`: @@ -34,12 +34,12 @@ cargo new my-project --bin cd my-project ``` -You now need to add Maple to your new project's dependencies. Add the following to your `Cargo.toml` file in your project folder: +You now need to add Sycamore to your new project's dependencies. Add the following to your `Cargo.toml` file in your project folder: ```toml -maple-core = "0.4.3" +sycamore = "0.4.3" ``` -Be careful, the crate name is **`maple-core`**, not `maple`. +Be careful, the crate name is **`sycamore`**, not `sycamore`. -You should now be all set for your Maple adventure! +You should now be all set for your Sycamore adventure! diff --git a/docs/src/content.rs b/docs/src/content.rs index b23550ae7..bb9aa01f2 100644 --- a/docs/src/content.rs +++ b/docs/src/content.rs @@ -1,5 +1,5 @@ -use maple_core::prelude::*; use pulldown_cmark::{html, Options, Parser}; +use sycamore::prelude::*; use wasm_bindgen::prelude::*; use web_sys::HtmlElement; diff --git a/docs/src/header.rs b/docs/src/header.rs index efb98bd48..ff2e0a03e 100644 --- a/docs/src/header.rs +++ b/docs/src/header.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(Header)] pub fn header() -> TemplateResult { @@ -6,17 +6,17 @@ pub fn header() -> TemplateResult { header { nav(class="navbar navbar-expand-sm navbar-dark bg-dark") { div(class="container-fluid") { - a(class="navbar-brand", href="/#") { "Maple" } + a(class="navbar-brand", href="/#") { "Sycamore" } ul(class="navbar-nav") { li(class="nav-item") { a(class="nav-link", href="/getting_started/installation") { "Docs" } } li(class="nav-item") { - a(class="nav-link", href="https://docs.rs/maple-core") { "API" } + a(class="nav-link", href="https://docs.rs/sycamore") { "API" } } li(class="nav-item") { - a(class="nav-link", href="https://github.com/lukechu10/maple") { "Repository" } + a(class="nav-link", href="https://github.com/lukechu10/sycamore") { "Repository" } } } } diff --git a/docs/src/index.rs b/docs/src/index.rs index 691685956..ebc5e2027 100644 --- a/docs/src/index.rs +++ b/docs/src/index.rs @@ -1,11 +1,11 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(Index)] pub fn index() -> TemplateResult { template! { div { h1 { - "Maple" + "Sycamore" } a(class="btn btn-primary", href="/getting_started/installation") { diff --git a/docs/src/main.rs b/docs/src/main.rs index bb1b497b7..73513d912 100644 --- a/docs/src/main.rs +++ b/docs/src/main.rs @@ -3,7 +3,7 @@ mod header; mod index; mod sidebar; -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(App)] fn app() -> TemplateResult { diff --git a/docs/src/sidebar.rs b/docs/src/sidebar.rs index b52e6e721..333f05ef0 100644 --- a/docs/src/sidebar.rs +++ b/docs/src/sidebar.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(Sidebar)] pub fn sidebar() -> TemplateResult { diff --git a/examples/components/Cargo.toml b/examples/components/Cargo.toml index 3e923f1bd..8b2b699d9 100644 --- a/examples/components/Cargo.toml +++ b/examples/components/Cargo.toml @@ -11,4 +11,4 @@ version = "0.1.0" console_error_panic_hook = "0.1.6" console_log = "0.2.0" log = "0.4.14" -maple-core = {path = "../../maple-core"} +sycamore = {path = "../../packages/sycamore"} diff --git a/examples/components/src/main.rs b/examples/components/src/main.rs index 8a3742bed..a41f2efa2 100644 --- a/examples/components/src/main.rs +++ b/examples/components/src/main.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(MyComponent)] fn my_component(num: StateHandle) -> TemplateResult { diff --git a/examples/counter/Cargo.toml b/examples/counter/Cargo.toml index b99bead94..ce0baf1eb 100644 --- a/examples/counter/Cargo.toml +++ b/examples/counter/Cargo.toml @@ -11,4 +11,4 @@ version = "0.1.0" console_error_panic_hook = "0.1.6" console_log = "0.2.0" log = "0.4.14" -maple-core = {path = "../../maple-core"} +sycamore = {path = "../../packages/sycamore"} diff --git a/examples/counter/src/main.rs b/examples/counter/src/main.rs index 27c081795..73fc776f8 100644 --- a/examples/counter/src/main.rs +++ b/examples/counter/src/main.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(App)] fn app() -> TemplateResult { diff --git a/examples/hello/Cargo.toml b/examples/hello/Cargo.toml index c00605932..65c5942f0 100644 --- a/examples/hello/Cargo.toml +++ b/examples/hello/Cargo.toml @@ -11,5 +11,5 @@ version = "0.1.0" console_error_panic_hook = "0.1.6" console_log = "0.2.0" log = "0.4.14" -maple-core = {path = "../../maple-core"} +sycamore = {path = "../../packages/sycamore"} wasm-bindgen = "0.2" diff --git a/examples/hello/src/main.rs b/examples/hello/src/main.rs index 1736ce697..ad9a69a13 100644 --- a/examples/hello/src/main.rs +++ b/examples/hello/src/main.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(App)] fn app() -> TemplateResult { diff --git a/examples/iteration/Cargo.toml b/examples/iteration/Cargo.toml index 3b79788a7..bf4c9133d 100644 --- a/examples/iteration/Cargo.toml +++ b/examples/iteration/Cargo.toml @@ -11,5 +11,5 @@ version = "0.1.0" console_error_panic_hook = "0.1.6" console_log = "0.2.0" log = "0.4.14" -maple-core = {path = "../../maple-core"} +sycamore = {path = "../../packages/sycamore"} wasm-bindgen = "0.2" diff --git a/examples/iteration/src/main.rs b/examples/iteration/src/main.rs index 83dd25691..ab724eb59 100644 --- a/examples/iteration/src/main.rs +++ b/examples/iteration/src/main.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(App)] fn app() -> TemplateResult { diff --git a/examples/ssr/Cargo.toml b/examples/ssr/Cargo.toml index 822e479ca..50c08782c 100644 --- a/examples/ssr/Cargo.toml +++ b/examples/ssr/Cargo.toml @@ -8,4 +8,4 @@ version = "0.1.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -maple-core = {path = "../../maple-core", features = ["ssr"]} +sycamore = {path = "../../packages/sycamore", features = ["ssr"]} diff --git a/examples/ssr/src/main.rs b/examples/ssr/src/main.rs index 19d24353e..503d0903f 100644 --- a/examples/ssr/src/main.rs +++ b/examples/ssr/src/main.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(App)] fn app() -> TemplateResult { diff --git a/examples/todomvc/Cargo.toml b/examples/todomvc/Cargo.toml index d8a57b146..d7fad6208 100644 --- a/examples/todomvc/Cargo.toml +++ b/examples/todomvc/Cargo.toml @@ -11,7 +11,7 @@ version = "0.1.0" console_error_panic_hook = "0.1.6" console_log = "0.2.0" log = "0.4.14" -maple-core = {path = "../../maple-core", features = ["serde"]} +sycamore = {path = "../../packages/sycamore", features = ["serde"]} serde = {version = "1.0.125", features = ["derive"]} serde_json = "1.0.64" uuid = {version = "0.8", features = ["v4", "wasm-bindgen", "serde"]} diff --git a/examples/todomvc/index.html b/examples/todomvc/index.html index 6fcd6dd51..276efbb93 100644 --- a/examples/todomvc/index.html +++ b/examples/todomvc/index.html @@ -3,7 +3,7 @@ - Maple • TodoMVC + Sycamore • TodoMVC )] pub fn copyright() -> TemplateResult { diff --git a/examples/todomvc/src/footer.rs b/examples/todomvc/src/footer.rs index d2bfe0021..ed6d4d144 100644 --- a/examples/todomvc/src/footer.rs +++ b/examples/todomvc/src/footer.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; use crate::{AppState, Filter}; diff --git a/examples/todomvc/src/header.rs b/examples/todomvc/src/header.rs index f0fe5c4a1..e39728370 100644 --- a/examples/todomvc/src/header.rs +++ b/examples/todomvc/src/header.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; use wasm_bindgen::JsCast; use web_sys::{Event, KeyboardEvent}; diff --git a/examples/todomvc/src/item.rs b/examples/todomvc/src/item.rs index 9729f01d4..95bf4c824 100644 --- a/examples/todomvc/src/item.rs +++ b/examples/todomvc/src/item.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; use wasm_bindgen::JsCast; use web_sys::{Event, HtmlInputElement, KeyboardEvent}; diff --git a/examples/todomvc/src/list.rs b/examples/todomvc/src/list.rs index 6c340ef96..ab8a18737 100644 --- a/examples/todomvc/src/list.rs +++ b/examples/todomvc/src/list.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; use web_sys::HtmlInputElement; use crate::{AppState, Filter}; diff --git a/examples/todomvc/src/main.rs b/examples/todomvc/src/main.rs index 0aa40b887..013bea222 100644 --- a/examples/todomvc/src/main.rs +++ b/examples/todomvc/src/main.rs @@ -4,8 +4,8 @@ mod header; mod item; mod list; -use maple_core::prelude::*; use serde::{Deserialize, Serialize}; +use sycamore::prelude::*; use uuid::Uuid; #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] @@ -128,7 +128,7 @@ impl Filter { } } -const KEY: &str = "todos-maple"; +const KEY: &str = "todos-sycamore"; #[component(App)] fn app() -> TemplateResult { diff --git a/examples/tweened/Cargo.toml b/examples/tweened/Cargo.toml index 9dfb0eb6b..397f7b6d8 100644 --- a/examples/tweened/Cargo.toml +++ b/examples/tweened/Cargo.toml @@ -11,6 +11,6 @@ version = "0.1.0" console_error_panic_hook = "0.1.6" console_log = "0.2.0" log = "0.4.14" -maple-core = {path = "../../maple-core"} +sycamore = {path = "../../packages/sycamore"} wasm-bindgen = "0.2" web-sys = "0.3" diff --git a/examples/tweened/src/main.rs b/examples/tweened/src/main.rs index 5a5f68b59..029b40cad 100644 --- a/examples/tweened/src/main.rs +++ b/examples/tweened/src/main.rs @@ -1,7 +1,7 @@ use std::time::Duration; -use maple_core::reactive::Tweened; -use maple_core::{easing, prelude::*}; +use sycamore::reactive::Tweened; +use sycamore::{easing, prelude::*}; #[component(App)] fn app() -> TemplateResult { diff --git a/maple-core-macro/Cargo.toml b/packages/sycamore-macro/Cargo.toml similarity index 77% rename from maple-core-macro/Cargo.toml rename to packages/sycamore-macro/Cargo.toml index 840d490af..c53d46a02 100644 --- a/maple-core-macro/Cargo.toml +++ b/packages/sycamore-macro/Cargo.toml @@ -3,12 +3,12 @@ authors = ["Luke Chu <37006668+lukechu10@users.noreply.github.com>"] categories = ["gui", "wasm", "web-programming"] description = "A VDOM-less web library with fine grained reactivity" edition = "2018" -homepage = "https://github.com/lukechu10/maple" +homepage = "https://github.com/lukechu10/sycamore" keywords = ["wasm", "gui", "reactive"] license = "MIT" -name = "maple-core-macro" +name = "sycamore-macro" readme = "../README.md" -repository = "https://github.com/lukechu10/maple" +repository = "https://github.com/lukechu10/sycamore" version = "0.4.3" [lib] @@ -22,5 +22,5 @@ quote = "1.0" syn = {version = "1.0", features = ["full"]} [dev-dependencies] -maple-core = {path = "../maple-core"} +sycamore = {path = "../sycamore"} trybuild = "1.0" diff --git a/maple-core-macro/src/component/mod.rs b/packages/sycamore-macro/src/component/mod.rs similarity index 92% rename from maple-core-macro/src/component/mod.rs rename to packages/sycamore-macro/src/component/mod.rs index 2bd475482..68656b4c2 100644 --- a/maple-core-macro/src/component/mod.rs +++ b/packages/sycamore-macro/src/component/mod.rs @@ -106,14 +106,15 @@ impl Parse for ComponentFunction { )); } - let return_type = - match sig.output { - ReturnType::Default => return Err(syn::Error::new_spanned( + let return_type = match sig.output { + ReturnType::Default => { + return Err(syn::Error::new_spanned( sig, - "function must return `maple_core::template_result::TemplateResult`", - )), - ReturnType::Type(_, ty) => ty, - }; + "function must return `sycamore::template_result::TemplateResult`", + )) + } + ReturnType::Type(_, ty) => ty, + }; let mut inputs = sig.inputs.into_iter(); let arg: FnArg = inputs.next().unwrap_or_else(|| syn::parse_quote! { _: () }); @@ -167,7 +168,7 @@ pub fn component_impl( let component_name_str = component_name.to_string(); let generic_node_ty = generic_node_ty.type_params().next().unwrap(); let generic_node: TypeParam = syn::parse_quote! { - #generic_node_ty: ::maple_core::generic_node::GenericNode + #generic_node_ty: ::sycamore::generic_node::GenericNode }; let ComponentFunction { @@ -197,7 +198,7 @@ pub fn component_impl( _marker: ::std::marker::PhantomData<#generic_node_ty>, } - impl<#generic_node> ::maple_core::component::Component<#generic_node_ty> + impl<#generic_node> ::sycamore::component::Component<#generic_node_ty> for #component_name<#generic_node_ty> { #[cfg(debug_assertions)] diff --git a/maple-core-macro/src/lib.rs b/packages/sycamore-macro/src/lib.rs similarity index 100% rename from maple-core-macro/src/lib.rs rename to packages/sycamore-macro/src/lib.rs diff --git a/maple-core-macro/src/template/attributes.rs b/packages/sycamore-macro/src/template/attributes.rs similarity index 85% rename from maple-core-macro/src/template/attributes.rs rename to packages/sycamore-macro/src/template/attributes.rs index 062bc6420..d687e01d9 100644 --- a/maple-core-macro/src/template/attributes.rs +++ b/packages/sycamore-macro/src/template/attributes.rs @@ -78,10 +78,10 @@ impl ToTokens for Attribute { AttributeType::DomAttribute { name } => { let name = name.to_string(); tokens.extend(quote_spanned! { expr_span=> - ::maple_core::reactive::create_effect({ + ::sycamore::reactive::create_effect({ let _el = ::std::clone::Clone::clone(&_el); move || { - ::maple_core::generic_node::GenericNode::set_attribute( + ::sycamore::generic_node::GenericNode::set_attribute( &_el, #name, &::std::format!("{}", #expr), @@ -93,7 +93,7 @@ impl ToTokens for Attribute { AttributeType::Event { event } => { // TODO: Should events be reactive? tokens.extend(quote_spanned! { expr_span=> - ::maple_core::generic_node::GenericNode::event( + ::sycamore::generic_node::GenericNode::event( &_el, #event, ::std::boxed::Box::new(#expr), @@ -129,37 +129,37 @@ impl ToTokens for Attribute { let convert_into_jsvalue_fn = match property_ty { JsPropertyType::Bool => { - quote! { ::maple_core::rt::JsValue::from_bool(*signal.get()) } + quote! { ::sycamore::rt::JsValue::from_bool(*signal.get()) } } JsPropertyType::String => { - quote! { ::maple_core::rt::JsValue::from_str(&::std::format!("{}", signal.get())) } + quote! { ::sycamore::rt::JsValue::from_str(&::std::format!("{}", signal.get())) } } }; let event_target_prop = quote! { - ::maple_core::rt::Reflect::get( + ::sycamore::rt::Reflect::get( &event.target().unwrap(), - &::std::convert::Into::<::maple_core::rt::JsValue>::into(#prop) + &::std::convert::Into::<::sycamore::rt::JsValue>::into(#prop) ).unwrap() }; let convert_from_jsvalue_fn = match property_ty { JsPropertyType::Bool => quote! { - ::maple_core::rt::JsValue::as_bool(&#event_target_prop).unwrap() + ::sycamore::rt::JsValue::as_bool(&#event_target_prop).unwrap() }, JsPropertyType::String => quote! { - ::maple_core::rt::JsValue::as_string(&#event_target_prop).unwrap() + ::sycamore::rt::JsValue::as_string(&#event_target_prop).unwrap() }, }; tokens.extend(quote_spanned! { expr_span=> { - let signal: ::maple_core::reactive::Signal<#value_ty> = #expr; + let signal: ::sycamore::reactive::Signal<#value_ty> = #expr; - ::maple_core::reactive::create_effect({ + ::sycamore::reactive::create_effect({ let signal = ::std::clone::Clone::clone(&signal); let _el = ::std::clone::Clone::clone(&_el); move || { - ::maple_core::generic_node::GenericNode::set_property( + ::sycamore::generic_node::GenericNode::set_property( &_el, #prop, &#convert_into_jsvalue_fn, @@ -167,10 +167,10 @@ impl ToTokens for Attribute { } }); - ::maple_core::generic_node::GenericNode::event( + ::sycamore::generic_node::GenericNode::event( &_el, #event_name, - ::std::boxed::Box::new(move |event: ::maple_core::rt::Event| { + ::std::boxed::Box::new(move |event: ::sycamore::rt::Event| { signal.set(#convert_from_jsvalue_fn); }), ) @@ -178,7 +178,7 @@ impl ToTokens for Attribute { } AttributeType::Ref => { tokens.extend(quote_spanned! { expr_span=>{ - ::maple_core::noderef::NodeRef::set( + ::sycamore::noderef::NodeRef::set( &#expr, ::std::clone::Clone::clone(&_el), ); diff --git a/maple-core-macro/src/template/children.rs b/packages/sycamore-macro/src/template/children.rs similarity index 100% rename from maple-core-macro/src/template/children.rs rename to packages/sycamore-macro/src/template/children.rs diff --git a/maple-core-macro/src/template/component.rs b/packages/sycamore-macro/src/template/component.rs similarity index 92% rename from maple-core-macro/src/template/component.rs rename to packages/sycamore-macro/src/template/component.rs index b37c3066b..b89ca07e2 100644 --- a/maple-core-macro/src/template/component.rs +++ b/packages/sycamore-macro/src/template/component.rs @@ -35,13 +35,13 @@ impl ToTokens for Component { let quoted = if args.empty_or_trailing() { quote_spanned! { paren.span=> - ::maple_core::reactive::untrack(|| + ::sycamore::reactive::untrack(|| #path::<_>::__create_component#generics(()) ) } } else { quote_spanned! { path.span()=> - ::maple_core::reactive::untrack(|| + ::sycamore::reactive::untrack(|| #path::<_>::__create_component#generics(#args) ) } diff --git a/maple-core-macro/src/template/element.rs b/packages/sycamore-macro/src/template/element.rs similarity index 77% rename from maple-core-macro/src/template/element.rs rename to packages/sycamore-macro/src/template/element.rs index e319ca8a2..206224dbd 100644 --- a/maple-core-macro/src/template/element.rs +++ b/packages/sycamore-macro/src/template/element.rs @@ -62,34 +62,34 @@ impl ToTokens for Element { for child in &children.body { quoted.extend(match child { HtmlTree::Component(component) => quote_spanned! { component.span()=> - let __marker = ::maple_core::generic_node::GenericNode::marker(); - ::maple_core::generic_node::GenericNode::append_child(&_el, &__marker); - ::maple_core::generic_node::render::insert( + let __marker = ::sycamore::generic_node::GenericNode::marker(); + ::sycamore::generic_node::GenericNode::append_child(&_el, &__marker); + ::sycamore::generic_node::render::insert( ::std::clone::Clone::clone(&_el), #component, None, Some(__marker), ); }, HtmlTree::Element(element) => quote_spanned! { element.span()=> - ::maple_core::generic_node::GenericNode::append_child(&_el, &#element); + ::sycamore::generic_node::GenericNode::append_child(&_el, &#element); }, HtmlTree::Text(text) => match text { Text::Str(_) => { quote_spanned! { text.span()=> - ::maple_core::generic_node::GenericNode::append_child( + ::sycamore::generic_node::GenericNode::append_child( &_el, - &::maple_core::generic_node::GenericNode::text_node(#text), + &::sycamore::generic_node::GenericNode::text_node(#text), ); } } Text::Splice(_, _) => { quote_spanned! { text.span()=> - let __marker = ::maple_core::generic_node::GenericNode::marker(); - ::maple_core::generic_node::GenericNode::append_child(&_el, &__marker); - ::maple_core::generic_node::render::insert( + let __marker = ::sycamore::generic_node::GenericNode::marker(); + ::sycamore::generic_node::GenericNode::append_child(&_el, &__marker); + ::sycamore::generic_node::render::insert( ::std::clone::Clone::clone(&_el), - ::maple_core::template_result::TemplateResult::new_lazy(move || - ::maple_core::render::IntoTemplate::create(&#text) + ::sycamore::template_result::TemplateResult::new_lazy(move || + ::sycamore::render::IntoTemplate::create(&#text) ), None, Some(__marker), ); @@ -132,7 +132,7 @@ impl ToTokens for TagName { let tag_str = self.to_string(); let quoted = quote! { - ::maple_core::generic_node::GenericNode::element(#tag_str) + ::sycamore::generic_node::GenericNode::element(#tag_str) }; tokens.extend(quoted); diff --git a/maple-core-macro/src/template/mod.rs b/packages/sycamore-macro/src/template/mod.rs similarity index 85% rename from maple-core-macro/src/template/mod.rs rename to packages/sycamore-macro/src/template/mod.rs index 3ef61eafd..577f74ed3 100644 --- a/maple-core-macro/src/template/mod.rs +++ b/packages/sycamore-macro/src/template/mod.rs @@ -76,17 +76,17 @@ impl ToTokens for HtmlTree { #component }, Self::Element(element) => quote! { - ::maple_core::template_result::TemplateResult::new_node(#element) + ::sycamore::template_result::TemplateResult::new_node(#element) }, Self::Text(text) => match text { Text::Str(_) => quote! { - ::maple_core::template_result::TemplateResult::new_node( - ::maple_core::generic_node::GenericNode::text_node(#text), + ::sycamore::template_result::TemplateResult::new_node( + ::sycamore::generic_node::GenericNode::text_node(#text), ) }, Text::Splice(_, _) => quote! { - ::maple_core::template_result::TemplateResult::new_lazy(move || - ::maple_core::render::IntoTemplate::create(&#text) + ::sycamore::template_result::TemplateResult::new_lazy(move || + ::sycamore::render::IntoTemplate::create(&#text) ) }, }, @@ -116,11 +116,11 @@ impl ToTokens for HtmlRoot { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { let quoted = match self.children.as_slice() { [] => quote! { - ::maple_core::template_result::TemplateResult::empty() + ::sycamore::template_result::TemplateResult::empty() }, [node] => node.to_token_stream(), nodes => quote! { - ::maple_core::template_result::TemplateResult::new_fragment({ + ::sycamore::template_result::TemplateResult::new_fragment({ let mut children = ::std::vec::Vec::new(); #( children.push(#nodes); diff --git a/maple-core-macro/src/template/text.rs b/packages/sycamore-macro/src/template/text.rs similarity index 100% rename from maple-core-macro/src/template/text.rs rename to packages/sycamore-macro/src/template/text.rs diff --git a/maple-core-macro/tests/template/component-fail.rs b/packages/sycamore-macro/tests/template/component-fail.rs similarity index 91% rename from maple-core-macro/tests/template/component-fail.rs rename to packages/sycamore-macro/tests/template/component-fail.rs index 4841c3dfe..5ab0e34dc 100644 --- a/maple-core-macro/tests/template/component-fail.rs +++ b/packages/sycamore-macro/tests/template/component-fail.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(C)] fn c() -> TemplateResult { diff --git a/maple-core-macro/tests/template/component-fail.stderr b/packages/sycamore-macro/tests/template/component-fail.stderr similarity index 100% rename from maple-core-macro/tests/template/component-fail.stderr rename to packages/sycamore-macro/tests/template/component-fail.stderr diff --git a/maple-core-macro/tests/template/component-pass.rs b/packages/sycamore-macro/tests/template/component-pass.rs similarity index 88% rename from maple-core-macro/tests/template/component-pass.rs rename to packages/sycamore-macro/tests/template/component-pass.rs index cd87efdba..aceb9d146 100644 --- a/maple-core-macro/tests/template/component-pass.rs +++ b/packages/sycamore-macro/tests/template/component-pass.rs @@ -1,6 +1,6 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[component(Component)] pub fn component() -> TemplateResult { diff --git a/maple-core-macro/tests/template/element-fail.rs b/packages/sycamore-macro/tests/template/element-fail.rs similarity index 93% rename from maple-core-macro/tests/template/element-fail.rs rename to packages/sycamore-macro/tests/template/element-fail.rs index ab69b8d2b..b4500e301 100644 --- a/maple-core-macro/tests/template/element-fail.rs +++ b/packages/sycamore-macro/tests/template/element-fail.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; fn compile_fail() { let _: TemplateResult = template! { p.my-class#id }; diff --git a/maple-core-macro/tests/template/element-fail.stderr b/packages/sycamore-macro/tests/template/element-fail.stderr similarity index 100% rename from maple-core-macro/tests/template/element-fail.stderr rename to packages/sycamore-macro/tests/template/element-fail.stderr diff --git a/maple-core-macro/tests/template/element-pass.rs b/packages/sycamore-macro/tests/template/element-pass.rs similarity index 95% rename from maple-core-macro/tests/template/element-pass.rs rename to packages/sycamore-macro/tests/template/element-pass.rs index 1aeaf3421..32032063f 100644 --- a/maple-core-macro/tests/template/element-pass.rs +++ b/packages/sycamore-macro/tests/template/element-pass.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; fn compile_pass() { let _: TemplateResult = template! { p }; diff --git a/maple-core-macro/tests/template/root-pass.rs b/packages/sycamore-macro/tests/template/root-pass.rs similarity index 91% rename from maple-core-macro/tests/template/root-pass.rs rename to packages/sycamore-macro/tests/template/root-pass.rs index d138fefad..d72491f70 100644 --- a/maple-core-macro/tests/template/root-pass.rs +++ b/packages/sycamore-macro/tests/template/root-pass.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; fn compile_pass() { let _: TemplateResult = template! { "Raw text nodes!" }; diff --git a/maple-core-macro/tests/template_macro.rs b/packages/sycamore-macro/tests/template_macro.rs similarity index 95% rename from maple-core-macro/tests/template_macro.rs rename to packages/sycamore-macro/tests/template_macro.rs index 37d46a3e8..b0927d7ab 100644 --- a/maple-core-macro/tests/template_macro.rs +++ b/packages/sycamore-macro/tests/template_macro.rs @@ -1,7 +1,7 @@ -#[test] -fn ui() { - let t = trybuild::TestCases::new(); - t.compile_fail("tests/template/*-fail.rs"); - - t.pass("tests/template/*-pass.rs"); -} +#[test] +fn ui() { + let t = trybuild::TestCases::new(); + t.compile_fail("tests/template/*-fail.rs"); + + t.pass("tests/template/*-pass.rs"); +} diff --git a/maple-core/Cargo.toml b/packages/sycamore/Cargo.toml similarity index 87% rename from maple-core/Cargo.toml rename to packages/sycamore/Cargo.toml index d8cff1ab9..b4533793a 100644 --- a/maple-core/Cargo.toml +++ b/packages/sycamore/Cargo.toml @@ -3,12 +3,12 @@ authors = ["Luke Chu <37006668+lukechu10@users.noreply.github.com>"] categories = ["gui", "wasm", "web-programming"] description = "A VDOM-less web library with fine grained reactivity" edition = "2018" -homepage = "https://github.com/lukechu10/maple" +homepage = "https://github.com/lukechu10/sycamore" keywords = ["wasm", "gui", "reactive"] license = "MIT" -name = "maple-core" +name = "sycamore" readme = "../README.md" -repository = "https://github.com/lukechu10/maple" +repository = "https://github.com/lukechu10/sycamore" version = "0.4.3" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -17,7 +17,7 @@ version = "0.4.3" chrono = {version = "0.4", features = ["wasmbind"]} html-escape = {version = "0.2.7", optional = true} js-sys = {version = "0.3", optional = true} -maple-core-macro = {path = "../maple-core-macro", version = "0.4.3"} +sycamore-macro = {path = "../sycamore-macro", version = "0.4.3"} ref-cast = "1.0" serde = {version = "1.0", optional = true} wasm-bindgen = {version = "0.2", optional = true} diff --git a/maple-core/benches/reactivity.rs b/packages/sycamore/benches/reactivity.rs similarity index 96% rename from maple-core/benches/reactivity.rs rename to packages/sycamore/benches/reactivity.rs index 5c195830c..bbbee21ee 100644 --- a/maple-core/benches/reactivity.rs +++ b/packages/sycamore/benches/reactivity.rs @@ -1,5 +1,5 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use maple_core::prelude::*; +use sycamore::prelude::*; pub fn bench(c: &mut Criterion) { c.bench_function("reactivity_signals", |b| { diff --git a/maple-core/benches/ssr.rs b/packages/sycamore/benches/ssr.rs similarity index 98% rename from maple-core/benches/ssr.rs rename to packages/sycamore/benches/ssr.rs index f07ad15bc..cb42a9181 100644 --- a/maple-core/benches/ssr.rs +++ b/packages/sycamore/benches/ssr.rs @@ -1,5 +1,5 @@ use criterion::{criterion_group, criterion_main, Criterion}; -use maple_core::prelude::*; +use sycamore::prelude::*; pub fn bench(c: &mut Criterion) { c.bench_function("ssr_small", |b| { diff --git a/maple-core/src/component.rs b/packages/sycamore/src/component.rs similarity index 100% rename from maple-core/src/component.rs rename to packages/sycamore/src/component.rs diff --git a/maple-core/src/easing.rs b/packages/sycamore/src/easing.rs similarity index 100% rename from maple-core/src/easing.rs rename to packages/sycamore/src/easing.rs diff --git a/maple-core/src/flow.rs b/packages/sycamore/src/flow.rs similarity index 98% rename from maple-core/src/flow.rs rename to packages/sycamore/src/flow.rs index 3f195eab3..92341ab4d 100644 --- a/maple-core/src/flow.rs +++ b/packages/sycamore/src/flow.rs @@ -31,7 +31,7 @@ where /// /// # Example /// ```no_run -/// use maple_core::prelude::*; +/// use sycamore::prelude::*; /// /// let count = Signal::new(vec![1, 2]); /// @@ -87,7 +87,7 @@ where /// /// # Example /// ```no_run -/// use maple_core::prelude::*; +/// use sycamore::prelude::*; /// /// let count = Signal::new(vec![1, 2]); /// diff --git a/maple-core/src/generic_node.rs b/packages/sycamore/src/generic_node.rs similarity index 98% rename from maple-core/src/generic_node.rs rename to packages/sycamore/src/generic_node.rs index 851ba4d6a..8b10c2aa2 100644 --- a/maple-core/src/generic_node.rs +++ b/packages/sycamore/src/generic_node.rs @@ -29,7 +29,7 @@ pub type EventListener = dyn Fn(Event); /// _disappearing_, meaning that they are simply functions that generate [`GenericNode`]s inside a /// new reactive context. This means that there is no overhead whatsoever when using components. /// -/// Maple ships with 2 rendering backends out of the box: +/// Sycamore ships with 2 rendering backends out of the box: /// * [`DomNode`] - Rendering in the browser (to real DOM nodes). /// * [`SsrNode`] - Render to a static string (often on the server side for Server Side Rendering, /// aka. SSR). diff --git a/maple-core/src/generic_node/dom_node.rs b/packages/sycamore/src/generic_node/dom_node.rs similarity index 99% rename from maple-core/src/generic_node/dom_node.rs rename to packages/sycamore/src/generic_node/dom_node.rs index 561c06233..3016ac352 100644 --- a/maple-core/src/generic_node/dom_node.rs +++ b/packages/sycamore/src/generic_node/dom_node.rs @@ -17,10 +17,10 @@ use crate::template_result::TemplateResult; // TODO: remove js snippet #[wasm_bindgen(inline_js = "\ export function set_node_id(node, id) {\ - node.__mapleNodeId = id\ + node.__sycamoreNodeId = id\ }\ export function get_node_id(node) {\ - return node.__mapleNodeId\ + return node.__sycamoreNodeId\ }\ ")] extern "C" { diff --git a/maple-core/src/generic_node/render.rs b/packages/sycamore/src/generic_node/render.rs similarity index 100% rename from maple-core/src/generic_node/render.rs rename to packages/sycamore/src/generic_node/render.rs diff --git a/maple-core/src/generic_node/ssr_node.rs b/packages/sycamore/src/generic_node/ssr_node.rs similarity index 100% rename from maple-core/src/generic_node/ssr_node.rs rename to packages/sycamore/src/generic_node/ssr_node.rs diff --git a/maple-core/src/lib.rs b/packages/sycamore/src/lib.rs similarity index 74% rename from maple-core/src/lib.rs rename to packages/sycamore/src/lib.rs index 0878d45fb..d9cd671f2 100644 --- a/maple-core/src/lib.rs +++ b/packages/sycamore/src/lib.rs @@ -1,8 +1,9 @@ -//! # Maple API Documentation +//! # Sycamore API Documentation //! -//! Maple is a VDOM-less web library with fine-grained reactivity. +//! Sycamore is a VDOM-less web library with fine-grained reactivity. //! -//! This is the API docs for maple. If you are looking for the usage docs, checkout the [README](https://github.com/lukechu10/maple). +//! This is the API docs for sycamore. If you are looking for the usage docs, checkout the +//! [Sycamore Book](https://sycamore-rs.netlify.app/getting_started/installation). //! //! ## Features //! - `dom` (_default_) - Enables rendering templates to DOM nodes. Only useful on @@ -19,7 +20,7 @@ #![deny(clippy::trait_duplication_in_bounds)] #![deny(clippy::type_repetition_in_bounds)] -pub use maple_core_macro::{component, template}; +pub use sycamore_macro::{component, template}; pub mod component; pub mod easing; @@ -32,12 +33,12 @@ pub mod render; pub mod template_result; pub mod utils; -/// Alias self to maple_core for proc-macros. -extern crate self as maple_core; +/// Alias self to sycamore for proc-macros. +extern crate self as sycamore; -/// The maple prelude. +/// The sycamore prelude. pub mod prelude { - pub use maple_core_macro::{component, template}; + pub use sycamore_macro::{component, template}; pub use crate::cloned; pub use crate::flow::{Indexed, IndexedProps, Keyed, KeyedProps}; @@ -55,7 +56,7 @@ pub mod prelude { pub use crate::template_result::TemplateResult; } -/// Re-exports for use by `maple-core-macro`. Not intended for use by end-users. +/// Re-exports for use by `sycamore-macro`. Not intended for use by end-users. #[doc(hidden)] pub mod rt { pub use js_sys::Reflect; diff --git a/maple-core/src/macros.rs b/packages/sycamore/src/macros.rs similarity index 94% rename from maple-core/src/macros.rs rename to packages/sycamore/src/macros.rs index 52e95ece7..b482f7c7d 100644 --- a/maple-core/src/macros.rs +++ b/packages/sycamore/src/macros.rs @@ -1,4 +1,4 @@ -//! Definition of `cloned!` macro. Proc-macros are defined in the separate `maple-core-macro` crate. +//! Definition of `cloned!` macro. Proc-macros are defined in the separate `sycamore-macro` crate. /// Utility macro for cloning all the arguments and expanding the expression. /// @@ -6,7 +6,7 @@ /// /// # Example /// ``` -/// use maple_core::prelude::*; +/// use sycamore::prelude::*; /// /// let state = Signal::new(0); /// diff --git a/maple-core/src/noderef.rs b/packages/sycamore/src/noderef.rs similarity index 100% rename from maple-core/src/noderef.rs rename to packages/sycamore/src/noderef.rs diff --git a/maple-core/src/reactive.rs b/packages/sycamore/src/reactive.rs similarity index 98% rename from maple-core/src/reactive.rs rename to packages/sycamore/src/reactive.rs index 4a2062d18..b451f7b84 100644 --- a/maple-core/src/reactive.rs +++ b/packages/sycamore/src/reactive.rs @@ -15,7 +15,7 @@ pub use signal::*; /// /// # Example /// ``` -/// use maple_core::prelude::*; +/// use sycamore::prelude::*; /// /// let trigger = Signal::new(()); /// let counter = Signal::new(0); diff --git a/maple-core/src/reactive/effect.rs b/packages/sycamore/src/reactive/effect.rs similarity index 99% rename from maple-core/src/reactive/effect.rs rename to packages/sycamore/src/reactive/effect.rs index 09fbd8a6f..1669dc58a 100644 --- a/maple-core/src/reactive/effect.rs +++ b/packages/sycamore/src/reactive/effect.rs @@ -268,7 +268,7 @@ pub fn create_effect_initial( /// /// # Example /// ``` -/// use maple_core::prelude::*; +/// use sycamore::prelude::*; /// /// let state = Signal::new(0); /// @@ -297,7 +297,7 @@ where /// /// # Example /// ``` -/// use maple_core::prelude::*; +/// use sycamore::prelude::*; /// /// let state = Signal::new(0); /// @@ -371,7 +371,7 @@ where /// # Example /// /// ``` -/// use maple_core::prelude::*; +/// use sycamore::prelude::*; /// /// let state = Signal::new(1); /// @@ -410,7 +410,7 @@ pub fn untrack(f: impl FnOnce() -> T) -> T { /// /// # Example /// ``` -/// use maple_core::prelude::*; +/// use sycamore::prelude::*; /// /// let cleanup_called = Signal::new(false); /// diff --git a/maple-core/src/reactive/iter.rs b/packages/sycamore/src/reactive/iter.rs similarity index 100% rename from maple-core/src/reactive/iter.rs rename to packages/sycamore/src/reactive/iter.rs diff --git a/maple-core/src/reactive/motion.rs b/packages/sycamore/src/reactive/motion.rs similarity index 100% rename from maple-core/src/reactive/motion.rs rename to packages/sycamore/src/reactive/motion.rs diff --git a/maple-core/src/reactive/signal.rs b/packages/sycamore/src/reactive/signal.rs similarity index 98% rename from maple-core/src/reactive/signal.rs rename to packages/sycamore/src/reactive/signal.rs index 9556f2b21..db63c01c2 100644 --- a/maple-core/src/reactive/signal.rs +++ b/packages/sycamore/src/reactive/signal.rs @@ -43,7 +43,7 @@ impl StateHandle { /// # Example /// /// ``` - /// use maple_core::prelude::*; + /// use sycamore::prelude::*; /// /// let state = Signal::new(1); /// @@ -101,7 +101,7 @@ impl<'de, T: serde::Deserialize<'de>> serde::Deserialize<'de> for StateHandle /// /// # Example /// ``` -/// use maple_core::prelude::*; +/// use sycamore::prelude::*; /// /// let state = Signal::new(0); /// assert_eq!(*state.get(), 0); @@ -118,7 +118,7 @@ impl Signal { /// /// # Example /// ``` - /// # use maple_core::prelude::*; + /// # use sycamore::prelude::*; /// let state = Signal::new(0); /// # assert_eq!(*state.get(), 0); /// ``` @@ -134,7 +134,7 @@ impl Signal { /// /// # Example /// ``` - /// # use maple_core::prelude::*; + /// # use sycamore::prelude::*; /// /// let state = Signal::new(0); /// assert_eq!(*state.get(), 0); diff --git a/maple-core/src/render.rs b/packages/sycamore/src/render.rs similarity index 100% rename from maple-core/src/render.rs rename to packages/sycamore/src/render.rs diff --git a/maple-core/src/template_result.rs b/packages/sycamore/src/template_result.rs similarity index 100% rename from maple-core/src/template_result.rs rename to packages/sycamore/src/template_result.rs diff --git a/maple-core/src/utils.rs b/packages/sycamore/src/utils.rs similarity index 98% rename from maple-core/src/utils.rs rename to packages/sycamore/src/utils.rs index 7f995121c..a687f2f70 100644 --- a/maple-core/src/utils.rs +++ b/packages/sycamore/src/utils.rs @@ -1,4 +1,4 @@ -//! Internal utilities for Maple. +//! Internal utilities for Sycamore. //! //! # Stability //! This API is currently unstable and can have breaking changed without a semver release. diff --git a/maple-core/tests/ssr/main.rs b/packages/sycamore/tests/ssr/main.rs similarity index 96% rename from maple-core/tests/ssr/main.rs rename to packages/sycamore/tests/ssr/main.rs index 970d92337..48585238d 100644 --- a/maple-core/tests/ssr/main.rs +++ b/packages/sycamore/tests/ssr/main.rs @@ -1,4 +1,4 @@ -use maple_core::prelude::*; +use sycamore::prelude::*; #[test] fn hello_world() { diff --git a/maple-core/tests/web/keyed.rs b/packages/sycamore/tests/web/keyed.rs similarity index 100% rename from maple-core/tests/web/keyed.rs rename to packages/sycamore/tests/web/keyed.rs diff --git a/maple-core/tests/web/main.rs b/packages/sycamore/tests/web/main.rs similarity index 96% rename from maple-core/tests/web/main.rs rename to packages/sycamore/tests/web/main.rs index ebb5fdb9f..6409185f8 100644 --- a/maple-core/tests/web/main.rs +++ b/packages/sycamore/tests/web/main.rs @@ -3,7 +3,7 @@ pub mod non_keyed; pub mod reconcile; pub mod render; -use maple_core::prelude::*; +use sycamore::prelude::*; use wasm_bindgen::JsCast; use wasm_bindgen_test::*; use web_sys::{Document, Event, HtmlElement, HtmlInputElement, Node, Window}; @@ -100,7 +100,7 @@ fn hello_world_noderef() { #[wasm_bindgen_test] fn interpolation() { - let text = "Hello Maple!"; + let text = "Hello Sycamore!"; let node = template! { p { (text) } }; @@ -114,13 +114,13 @@ fn interpolation() { .unwrap() .text_content() .unwrap(), - "Hello Maple!" + "Hello Sycamore!" ); } #[wasm_bindgen_test] fn template_interpolation() { - let text = template! { "Hello Maple!" }; + let text = template! { "Hello Sycamore!" }; let node = template! { p { (text) @@ -136,7 +136,7 @@ fn template_interpolation() { .unwrap() .text_content() .unwrap(), - "Hello Maple!" + "Hello Sycamore!" ); } @@ -146,7 +146,7 @@ fn template_interpolation_if_else() { let node = cloned!((show) => template! { p { (if *show.get() { - template! { "Hello Maple!" } + template! { "Hello Sycamore!" } } else { template! {} }) @@ -162,7 +162,7 @@ fn template_interpolation_if_else() { .unwrap() .text_content() .unwrap(), - "Hello Maple!" + "Hello Sycamore!" ); show.set(false); @@ -184,7 +184,7 @@ fn template_interpolation_if_else() { .unwrap() .text_content() .unwrap(), - "Hello Maple!" + "Hello Sycamore!" ); } diff --git a/maple-core/tests/web/non_keyed.rs b/packages/sycamore/tests/web/non_keyed.rs similarity index 100% rename from maple-core/tests/web/non_keyed.rs rename to packages/sycamore/tests/web/non_keyed.rs diff --git a/maple-core/tests/web/reconcile.rs b/packages/sycamore/tests/web/reconcile.rs similarity index 98% rename from maple-core/tests/web/reconcile.rs rename to packages/sycamore/tests/web/reconcile.rs index 82aca1781..71a87d013 100644 --- a/maple-core/tests/web/reconcile.rs +++ b/packages/sycamore/tests/web/reconcile.rs @@ -1,7 +1,7 @@ //! Tests for [`reconcile_fragments`]. -use maple_core::generic_node::render::{append_nodes, insert, reconcile_fragments}; -use maple_core::generic_node::DomNode; +use sycamore::generic_node::render::{append_nodes, insert, reconcile_fragments}; +use sycamore::generic_node::DomNode; use super::*; diff --git a/maple-core/tests/web/render.rs b/packages/sycamore/tests/web/render.rs similarity index 100% rename from maple-core/tests/web/render.rs rename to packages/sycamore/tests/web/render.rs