├── .babelrc
├── .gitignore
├── .npmignore
├── .travis.yml
├── .zuul.yml
├── README.md
├── book.json
├── docs
├── README.md
├── advanced
│ ├── context.md
│ ├── dispatcher.md
│ ├── hmr.md
│ ├── index.md
│ ├── keys.md
│ ├── lifecycle.md
│ └── model.md
├── api
│ ├── create-app.md
│ ├── diff.md
│ ├── dom.md
│ ├── element.md
│ ├── index.md
│ ├── string.md
│ └── vnode.md
├── basics
│ ├── components.md
│ ├── elements.md
│ ├── events.md
│ ├── getting-started.md
│ ├── index.md
│ ├── jsx.md
│ └── migrating.md
├── contributing.md
├── motivation.md
└── tips
│ └── innerhtml.md
├── examples
└── basic
│ ├── app.js
│ └── index.js
├── package.json
├── src
├── app
│ └── index.js
├── diff
│ └── index.js
├── dom
│ ├── create.js
│ ├── events.js
│ ├── index.js
│ ├── setAttribute.js
│ └── update.js
├── element
│ └── index.js
├── index.js
└── string
│ ├── index.js
│ └── renderString.js
└── test
├── app
├── index.js
└── thunk.js
├── diff
├── attributes.js
├── children.js
└── node.js
├── dom
├── create.js
├── setAttribute.js
└── update.js
├── element
└── index.js
├── index.js
└── string
└── index.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["stage-2"],
3 | "sourceMaps": true,
4 | "plugins": [
5 | ["transform-react-jsx", {"pragma": "h"}],
6 | "transform-es2015-template-literals",
7 | "transform-es2015-literals",
8 | "transform-es2015-function-name",
9 | "transform-es2015-arrow-functions",
10 | "transform-es2015-block-scoped-functions",
11 | "transform-es2015-classes",
12 | "transform-es2015-object-super",
13 | "transform-es2015-shorthand-properties",
14 | "transform-es2015-duplicate-keys",
15 | "transform-es2015-computed-properties",
16 | "transform-es2015-for-of",
17 | "transform-es2015-sticky-regex",
18 | "transform-es2015-unicode-regex",
19 | "check-es2015-constants",
20 | "transform-es2015-spread",
21 | "transform-es2015-parameters",
22 | "transform-es2015-destructuring",
23 | "transform-es2015-block-scoping",
24 | "transform-es2015-typeof-symbol",
25 | ["transform-regenerator", { "async": false, "asyncGenerators": false }],
26 | ],
27 | "env": {
28 | "commonjs": {
29 | "plugins": [
30 | ["transform-es2015-modules-commonjs", { "loose": true }]
31 | ]
32 | },
33 | "es": {}
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 | _book
4 | dist
5 | lib
6 | es
7 | npm-debug.log
8 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .babelrc
2 | test
3 | src
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "5"
4 | script:
5 | - npm run test:lint
6 | - npm run test:headless
7 | addons:
8 | apt:
9 | packages:
10 | - xvfb
11 | install:
12 | - export DISPLAY=':99.0'
13 | - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
14 | - npm install
15 |
--------------------------------------------------------------------------------
/.zuul.yml:
--------------------------------------------------------------------------------
1 | ui: tape
2 | concurrency: 5
3 | browsers:
4 | - name: chrome
5 | version: latest
6 | - name: firefox
7 | version: latest
8 | - name: iphone
9 | version: latest
10 | - name: ipad
11 | version: latest
12 | - name: android
13 | version: latest
14 | - name: ie
15 | version: 10..latest
16 | - name: microsoftedge
17 | version: latest
18 | - name: safari
19 | version: latest
20 | browserify:
21 | - transform: babelify
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Deku
2 |
3 | [](https://travis-ci.org/dekujs/deku)
4 | [](https://www.npmjs.com/package/deku)
5 | [](https://github.com/feross/standard)
6 | [](https://www.npmjs.com/package/deku)
7 | [](https://discord.gg/0gNkyCAVkDYsBaFe)
8 |
9 | Deku is a library for rendering interfaces using pure functions and virtual DOM.
10 |
11 | Instead of using classes and local state, Deku just uses functions and pushes the responsibility of all state management and side-effects onto tools like [Redux](http://redux.js.org/). It also aims to support only modern browsers to keep things simple.
12 |
13 | It can be used in place of libraries like React and works well with Redux and other libraries in the React ecosystem.
14 |
15 | Deku consists of 5 modules packaged together for convenience:
16 |
17 | * `element`: Create virtual elements.
18 | * `diff`: Compute the difference between two virtual elements. You can use this if you're creating a custom renderer.
19 | * `dom`: Create DOM elements from virtual elements and update them using the result of a diff. You'll only use this directly if you're building your own app creator.
20 | * `string`: Render a HTML string from virtual elements.
21 | * `createApp`: Kickstart an app for the browser.
22 |
23 | ### Installation
24 |
25 | ```
26 | npm install --save deku
27 | ```
28 |
29 | We support the latest two versions of each browser. This means we only support IE10+.
30 |
31 | [](https://saucelabs.com/u/deku)
32 |
33 | ### Example
34 |
35 | ```js
36 | /** @jsx element */
37 | import {element, createApp} from 'deku'
38 | import {createStore} from 'redux'
39 | import reducer from './reducer'
40 |
41 | // Dispatch an action when the button is clicked
42 | let log = dispatch => event => {
43 | dispatch({
44 | type: 'CLICKED'
45 | })
46 | }
47 |
48 | // Define a state-less component
49 | let MyButton = {
50 | render: ({ props, children, dispatch }) => {
51 | return
52 | }
53 | }
54 |
55 | // Create a Redux store to handle all UI actions and side-effects
56 | let store = createStore(reducer)
57 |
58 | // Create an app that can turn vnodes into real DOM elements
59 | let render = createApp(document.body, store.dispatch)
60 |
61 | // Update the page and add redux state to the context
62 | render(
63 |
Hello World!
127 | 128 |Hello World
8 | } 9 | ``` 10 | 11 | ## Properties 12 | 13 | ### `model.attributes` 14 | 15 | The values passed into your component as virtual element attributes. For example, passing these attributes into the component: 16 | 17 | ```js 18 |Hello World
80 | } 81 | ``` 82 | 83 | ### Properties 84 | 85 | #### `props` 86 | 87 | The values passed into your component as virtual element attributes. For example, passing these attributes into the component: 88 | 89 | ```js 90 |