Skip to content

Commit

Permalink
speed up
Browse files Browse the repository at this point in the history
new reactivitiy engine (observable slim) and awc router implementation
  • Loading branch information
fehmi committed Aug 31, 2024
1 parent ff756cd commit 290e8ae
Show file tree
Hide file tree
Showing 37 changed files with 6,338 additions and 399 deletions.
47 changes: 0 additions & 47 deletions docs/__sidebar.md

This file was deleted.

3 changes: 3 additions & 0 deletions docs/awc-router.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## AWC Router

This part of the documentation is work in progress. You can check [AWC router repo](https://github.com/colscott/a-wc-router) for more info.
4 changes: 3 additions & 1 deletion docs/design-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ Simply.js provides several methods for design token management. Just choose one
<repl-component id="st5t6rasly8yim6"></repl-component>

## Tokens in a global state object

?> Only use `state` variables in a global style tag. variables in `data` object cannot pass to children.

<repl-component id="3ar1za5hmuy5fal"></repl-component>

## CSS variable in :host
## CSS variable in ':host'
<repl-component id="vi3k3uspqvsrvfl"></repl-component>

## Manage all with UNO!
Expand Down
2 changes: 2 additions & 0 deletions docs/electron.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Electron Integration

!> The router module is deprecated and will be deleted on upcoming releases. Use [AWC router](docs/awc-router) instead.

Add the index.html path as base href.

```html
Expand Down
2 changes: 1 addition & 1 deletion docs/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

## Usage Example

<repl-component id="ugyr2hpkpqeithx" donwload="true"></repl-component>
<repl-component id="sp34gk6ealoxiwu" donwload="true"></repl-component>
3 changes: 3 additions & 0 deletions docs/reactivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ You can disable reactivity for specific elements in your template like below. Th

## Make changes without triggering react/render

?> This aproach can be unnecessary because new template and reactivity engine is fast enough to handle cases like that. Need more test though. This section can be deleted after some battle tests.

It can be helpful for performance reasons. In that scenario, do your changes withot triggering reaction and then render manually when you finish.

<repl-component id="t509ixnfmmbk0n5" donwload="true"></repl-component>

You can also use built-in method to set data without triggering render. Then you can render manually for increasing performance.

```js
simply.setWithoutRender(data, {
total: response.response.headers["X-WP-Total"],
Expand Down
2 changes: 2 additions & 0 deletions docs/router.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Router

!> The router module is deprecated and will be deleted on upcoming releases. Use [AWC router](docs/awc-router) instead.

Add your site path as base href.

```html
Expand Down
2 changes: 1 addition & 1 deletion docs/sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
- [Design Tokens](docs/design-tokens.md)

- <br>Router

- [AWC Router](docs/awc-router.md)
- [Router](docs/router.md)
- [Electron](docs/electron.md)

Expand Down
4 changes: 1 addition & 3 deletions docs/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ You can use your reactive data variables as a property value in style tag.
## Changing variable values in `<html>`
It's totally acceptable to change variables in template. Just do like `{data.name = "marilyn monroe"}`. It will change and render the new value right away and trigger reactions. If you want to change the variable value wihout rendering it just comment it like `<!-- {data.name = "marilyn monroe"} -->`
<repl-component id="pg5njqyn1pyud0g" download="true"></repl-component>
!> It's totally unacceptable to change variables in template like `{data.name = "marilyn monroe"}` or `<!-- {data.name = "marilyn monroe"} -->`. It will cause infinite reaction/render loop. So, simply just don't do it.
## Using variables from functions that returns values
Expand Down
2 changes: 1 addition & 1 deletion docs/watch.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This special event is triggered when a variable in data, state or prop has changed. Here is an example about how you can use it.

<repl-component id="reb9ov0xtlzmyfk" donwload="true"></repl-component>
<repl-component id="b6rzcjea60h3xot" donwload="true"></repl-component>
9 changes: 9 additions & 0 deletions examples/app-router/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.html [L]
</IfModule>
40 changes: 40 additions & 0 deletions examples/app-router/a-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<html>
a pages {state.name}
</html>
<style>
p {
background: aquamarine;
border-radius: 30px;
padding: 20px;
font-size: 20px;
text-align: center;
width: 300px;
margin: 0 auto;
color: aquamarine;
color: "{data.color}";
}
</style>
<script>
class {
data = {
name: "fehmi",
age: 37,
personalities: ["Calm", "Creative", "Passionate"],
hobbies: {
"Music Producing": "Kırk yılda bir",
Gaming: "Aydı yılda bir",
Sports: "Meeeh",
},
color: "blue"
};
methods = {
asd(e) {
alert("asd function called");
console.log(event);
},
bcd() {
alert("bcd")
}
};
}
</script>
Loading

0 comments on commit 290e8ae

Please sign in to comment.