• Stars
    star
    3,414
  • Rank 13,101 (Top 0.3 %)
  • Language
    JavaScript
  • Created over 10 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Render interfaces using pure functions and virtual DOM

Deku

version version js-standard-style npm downloads discord

Deku is a library for rendering interfaces using pure functions and virtual DOM.

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. It also aims to support only modern browsers to keep things simple.

It can be used in place of libraries like React and works well with Redux and other libraries in the React ecosystem.

Deku consists of 5 modules packaged together for convenience:

  • element: Create virtual elements.
  • diff: Compute the difference between two virtual elements. You can use this if you're creating a custom renderer.
  • 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.
  • string: Render a HTML string from virtual elements.
  • createApp: Kickstart an app for the browser.

Installation

npm install --save deku

We support the latest two versions of each browser. This means we only support IE10+.

Sauce Test Status

Example

/** @jsx element */
import {element, createApp} from 'deku'
import {createStore} from 'redux'
import reducer from './reducer'

// Dispatch an action when the button is clicked
let log = dispatch => event => {
  dispatch({
    type: 'CLICKED'
  })
}

// Define a state-less component
let MyButton = {
  render: ({ props, children, dispatch }) => {
    return <button onClick={log(dispatch)}>{children}</button>
  }
}

// Create a Redux store to handle all UI actions and side-effects
let store = createStore(reducer)

// Create an app that can turn vnodes into real DOM elements
let render = createApp(document.body, store.dispatch)

// Update the page and add redux state to the context
render(
  <MyButton>Hello World!</MyButton>,
  store.getState()
)

Documentation

You can read the documentation online.

License

The MIT License (MIT) Copyright (c) 2015 Anthony Short

More Repositories

1

stitch-css

CSS patterns for Compass
Ruby
260
star
2

idiomatic-sass

Principles for writing consistent, clean, friendly Sass
228
star
3

use-next-route

React hook for easy routing within a Next.js app
TypeScript
74
star
4

backbone.collectionsubset

Create sub-collections from other collections and keep them in sync
JavaScript
72
star
5

expressionengine.sugar

Sugar for Espresso which adds ExpressionEngine template support, codesense and more
Ruby
54
star
6

backbone.include

Simple interface for mixins for views, models and collections. No more long prototype chains.
JavaScript
38
star
7

grunt-component-build

Build Components using Grunt.
JavaScript
29
star
8

quiet-night.foam

Espresso theme based on Blackboard for TextMate, but better.
24
star
9

cappuccino.foam

Themes for MacRabbit's Espresso.
23
star
10

backbone.collectionview

Easily render models in a collection as views - with magic.
JavaScript
21
star
11

tumblr.sugar

Tumblr sugar for Espresso
PHP
20
star
12

virtualize

A simple DSL for building virtual DOM trees
JavaScript
18
star
13

waypoints

Trigger methods when scrolling up and down the page
JavaScript
18
star
14

component-coffee

Component(1) plugin to compile CoffeeScript on-the-fly
JavaScript
15
star
15

after-transition

Fire a callback after a transition or fire immediately if the browser doesn't support them
JavaScript
14
star
16

raf-queue

Batch jobs to fire in the next frame using requestAnimationFrame.
JavaScript
13
star
17

offset

Get the xy offset of an element
JavaScript
12
star
18

react-notification-provider

Headless notification system for React using hooks.
TypeScript
11
star
19

scroll-to

Animated scrolling
JavaScript
11
star
20

ok

Simple javascript model validation library
JavaScript
9
star
21

component-cdn

component-as-a-service
9
star
22

element-query

Media queries for elements
JavaScript
8
star
23

dom-walk

Walk down a DOM tree and run a callback on each element
JavaScript
8
star
24

date-suffix

Given a date of the month, returns a suffixed version
JavaScript
8
star
25

component-assets

Easily add all your scripts, styles, images and files to your component.json file.
JavaScript
7
star
26

static-router

Simple router to match URLs and fire callbacks without pushState.
JavaScript
7
star
27

rework-project

Project to test using Rework + Component instead of Sass
JavaScript
6
star
28

component-sass

Component(1) plugin for SCSS files
JavaScript
4
star
29

anthonyshort.me

My Site
Ruby
4
star
30

reworker

Simple way to use Rework from the CLI
JavaScript
4
star
31

component-string

Component(1) plugin to allow you to require any file as a string
JavaScript
4
star
32

reactive-if-matches

JavaScript
3
star
33

number-price

Takes a number and returns a nicely formatted price
JavaScript
3
star
34

stitch-triangle

Triangles are awesome.
Ruby
2
star
35

is-boolean-attribute

Checks if a HTML attribute is a boolean
JavaScript
2
star
36

grunt-component-install

Install dependencies for multiple components
JavaScript
2
star
37

component-trace

Track down dependencies
JavaScript
2
star
38

virtualize-diff

Create a diff between two virtualize nodes
JavaScript
2
star
39

duoify

Browserify transform to allow bundles to be loaded by Duo
JavaScript
1
star
40

symbol

ES6 Symbol shim thing
JavaScript
1
star
41

freshie.tmtheme

Dark textmate theme for CSS/SCSS/Sass
1
star
42

emitter-manager

Manager for component-emitter to easily add or remove events from groups of objects.
JavaScript
1
star
43

has-transitions

Tiny component to detect for transition support
JavaScript
1
star
44

observable

Get and set attributes and watch for changes. The simplest type of model there is.
JavaScript
1
star
45

next-router-provider

Mockable, testable, simplified router for Next.js.
TypeScript
1
star
46

piccolo

Theme for Espresso
1
star
47

stitch-text

Text helpers for Sass
Ruby
1
star
48

next-analytics-provider

Segment analytics in your Next.js application
TypeScript
1
star
49

flying-fox

Demo Firefox OS app for CampJS
JavaScript
1
star
50

ts-modules

Monorepo for all of my npm packages
TypeScript
1
star
51

next-bug-example

A repo for me to reproduce next bugs for issues
TypeScript
1
star
52

map

Simple map, similar to ES6 map
JavaScript
1
star
53

css-bundler

Bundle a CSS file and all of its assets into a single directory
JavaScript
1
star
54

gitorious-component-server

Routes github-style urls to gitorious-style urls so you can use Gitorious to host Components
Ruby
1
star
55

human-number

Takes a number and returns one formatted with commas
JavaScript
1
star
56

object-validator

Validate objects using a simple object schema
JavaScript
1
star