Skip to content

Commit

Permalink
update to latest dom expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Oct 18, 2019
1 parent f636274 commit efb5fb0
Show file tree
Hide file tree
Showing 16 changed files with 1,242 additions and 2,442 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules/
lib/
dist/
node_modules/
lib/
dist/
types/
6 changes: 3 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src/
types/tsconfig.tsbuildinfo
*.config.js
src/
types/tsconfig.tsbuildinfo
*.config.js
tsconfig.json
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2018 Ryan Carniato

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2018 Ryan Carniato
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
88 changes: 44 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
# S JSX

This library is a demonstration of the raw performance of S.js when used with the DOM Expressions runtime. This is an experimental approach used mostly for benchmarking and I'd recommend you checkout the official renderer for S.js, [Surplus](https://github.com/adamhaile/surplus) or [Solid](https://github.com/ryansolid/solid) which are better tested and provide a more comprehensive set of features.

It accomplishes this with using [Babel Plugin JSX DOM Expressions](https://github.com/ryansolid/babel-plugin-jsx-dom-expressions). It compiles JSX to DOM statements and by using inner parenthesis syntax ```{( )}``` wraps expressions in functions that can be called by the library of choice. In this case autorun wrap these expressions ensuring the view stays up to date. Unlike Virtual DOM only the changed nodes are affected and the whole tree is not re-rendered over and over.

To use simply wrap your code in a root:

```js
import S from 's-js';

S.root(() => document.body.appendChild(<App />))
```

And include 'babel-plugin-jsx-dom-expressions' in your babelrc, webpack babel loader, or rollup babel plugin.

```js
"plugins": [["jsx-dom-expressions", {moduleName: 's-jsx'}]]
```

# Installation

```sh
> npm install s-jsx babel-plugin-jsx-dom-expressions
```

## API

Control flow is handled through a special $ JSX element that compiles down to optimized reconciled code that supports conditionals `when`, loops `each`, separate render trees `portal`, and async offscreen rendering `suspend`. Example:

```jsx
const list = S.data(["Alpha", "Beta", "Gamma"]);

<ul>
<$ each={state.list}>{item => <li>{item}</li>}</$>
</ul>
```

Alternatively this library supports Tagged Template Literals or HyperScript for non-precompiled environments by installing the companion library and including variants:
```js
import { html } from 's-jsx/html'; // or
import { h } from 's-jsx/h';
```
There is a small performance overhead of using these runtimes but the performance is still very impressive. Further documentation available at: [Lit DOM Expressions](https://github.com/ryansolid/lit-dom-expressions) and [Hyper DOM Expressions](https://github.com/ryansolid/hyper-dom-expressions).
# S JSX

This library is a demonstration of the raw performance of S.js when used with the DOM Expressions runtime. This is an experimental approach used mostly for benchmarking and I'd recommend you checkout the official renderer for S.js, [Surplus](https://github.com/adamhaile/surplus) or [Solid](https://github.com/ryansolid/solid) which are better tested and provide a more comprehensive set of features.

It accomplishes this with using [Babel Plugin JSX DOM Expressions](https://github.com/ryansolid/babel-plugin-jsx-dom-expressions). It compiles JSX to DOM statements and by using inner parenthesis syntax ```{( )}``` wraps expressions in functions that can be called by the library of choice. In this case autorun wrap these expressions ensuring the view stays up to date. Unlike Virtual DOM only the changed nodes are affected and the whole tree is not re-rendered over and over.

To use simply wrap your code in a root:

```js
import S from 's-js';

S.root(() => document.body.appendChild(<App />))
```

And include 'babel-plugin-jsx-dom-expressions' in your babelrc, webpack babel loader, or rollup babel plugin.

```js
"plugins": [["jsx-dom-expressions", {moduleName: 's-jsx'}]]
```

# Installation

```sh
> npm install s-jsx babel-plugin-jsx-dom-expressions
```

## API

Control flow is handled through a special $ JSX element that compiles down to optimized reconciled code that supports conditionals `when`, loops `each`, separate render trees `portal`, and async offscreen rendering `suspend`. Example:

```jsx
const list = S.data(["Alpha", "Beta", "Gamma"]);

<ul>
<$ each={state.list}>{item => <li>{item}</li>}</$>
</ul>
```

Alternatively this library supports Tagged Template Literals or HyperScript for non-precompiled environments by installing the companion library and including variants:
```js
import { html } from 's-jsx/html'; // or
import { h } from 's-jsx/h';
```
There is a small performance overhead of using these runtimes but the performance is still very impressive. Further documentation available at: [Lit DOM Expressions](https://github.com/ryansolid/lit-dom-expressions) and [Hyper DOM Expressions](https://github.com/ryansolid/hyper-dom-expressions).
17 changes: 7 additions & 10 deletions dom-expressions.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
module.exports = {
output: 'src/runtime.js',
includeTypes: true,
variables: {
imports: [ `import S from 's-js'` ],
computed: 'S',
sample: 'S.sample',
root: 'S.root',
cleanup: 'S.cleanup'
}
module.exports = {
output: 'src/runtime.js',
includeTypes: true,
variables: {
imports: [ `import wrap from 's-js'` ],
includeContext: false
}
}
12 changes: 6 additions & 6 deletions h/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "s-jsx/h",
"main": "../lib/h.js",
"module": "../dist/h.js",
"types": "../types/h.d.ts",
"sideEffects": false
{
"name": "s-jsx/h",
"main": "../lib/h.js",
"module": "../dist/h.js",
"types": "../types/h.d.ts",
"sideEffects": false
}
12 changes: 6 additions & 6 deletions html/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "s-jsx/html",
"main": "../lib/html.js",
"module": "../dist/html.js",
"types": "../types/html.d.ts",
"sideEffects": false
{
"name": "s-jsx/html",
"main": "../lib/html.js",
"module": "../dist/html.js",
"types": "../types/html.d.ts",
"sideEffects": false
}
Loading

0 comments on commit efb5fb0

Please sign in to comment.