# cycle-snabbdom

> Snabbdom driver for Cycle.js.

Latest version **3.0.0** (published 2016-06-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install cycle-snabbdom
pnpm add cycle-snabbdom
yarn add cycle-snabbdom
bun add cycle-snabbdom
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2016-06-04 |
| First published | 2015-11-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 41 |
| Author | Tylor Steinberger |
| Maintainers | motorcycle, tylors |
| Keywords | Cyclejs, Cycle, Reactive, Framework |

## Links

- npm: https://www.npmjs.com/package/cycle-snabbdom
- Repository: https://github.com/TylorS/cycle-snabbdom
- Homepage: https://github.com/TylorS/cycle-snabbdom#readme
- Issues: https://github.com/TylorS/cycle-snabbdom/issues
- npm.io page: https://npm.io/package/cycle-snabbdom

## Dependencies (5)

- [rx](https://npm.io/package/rx.md) ^4.1.0
- [snabbdom](https://npm.io/package/snabbdom.md) ^0.5.0
- [matches-selector](https://npm.io/package/matches-selector.md) ^1.0.0
- [snabbdom-to-html](https://npm.io/package/snabbdom-to-html.md) ^2.1.3
- [snabbdom-selector](https://npm.io/package/snabbdom-selector.md) ^0.4.0

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@atlaskit/theme](https://npm.io/package/@atlaskit/theme.md) — 402.0K weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2016-06-04
- 1.3.0 — 2016-04-30
- 1.2.1 — 2016-03-30
- 1.2.0 — 2016-03-14
- 1.1.1 — 2016-02-23
- 1.1.0 — 2016-02-22
- 1.0.3 — 2016-02-03
- 1.0.2 — 2016-01-28
- 1.0.1 — 2016-01-26
- 1.0.0 — 2016-01-26
- 0.4.2 — 2016-01-12
- 0.4.1 — 2016-01-09
- 0.4.0 — 2015-12-07
- 0.2.0 — 2015-11-17

## README

# cycle-snabbdom [![Build Status](https://travis-ci.org/TylorS/cycle-snabbdom.svg?branch=master)](https://travis-ci.org/TylorS/cycle-snabbdom)

# Deprecation

**It's been great, and thank you for using this library :)
@cycle/dom is likely reached it's last release candidate, and will be released soon! This library is at 100% parity with it,
and is actually a slight step ahead as it has updated to the latest snabbdom 0.5.0 in the process. However, this will be the very last update this library will see.
I strongly urge you to start updating your application to Cycle.js Diversity as soon as you can, and to stop using Rx ;)**

Alternative DOM driver utilizing the [snabbdom](https://github.com/paldepind/snabbdom) library


# Install
```js
$ npm install cycle-snabbdom
```
## API

##### makeDOMDriver(container: string|Element, {modules?: Array<SnabbdomModules>})

```js
import {makeDOMDriver} from 'cycle-snabbdom'
```

##### makeHTMLDriver()
```js
import {makeHTMLDriver} from 'cycle-snabbdom'
```
##### h - thunk - hyperscript-helpers
Shorcuts to `snabbdom/h`, `snabbdom/thunk` and `hyperscript-helpers`
```js
import {h, thunk, div, span, h4} from 'cycle-snabbdom'
```

##### modules : Array<SnabbdomModules>

Shortcut to snabbdom modules.

```js
import Cycle from '@cycle/core'
import {modules, makeDOMDriver} from 'cycle-snabbdom'
const {
  StyleModule, PropsModule,
  AttrsModule, ClassModule,
  HeroModule, EventsModule,
} = modules
...

Cycle.run(main, {
  DOM: makeDOMDriver('#app', {modules: [
    StyleModule, PropsModule,
    AttrsModule, ClassModule,
    HeroModule, EventsModule
  ]})
})

```

##### mockDOMSource()
A testing utility which aids in creating a queryable collection of Observables. Call mockDOMSource giving it an object specifying selectors, eventTypes and their Observables, and get as output an object following the same format as the DOM Driver's source.

Example:
```js
const userEvents = mockDOMSource({
 '.foo': {
   'click': Rx.Observable.just({target: {}}),
   'mouseover': Rx.Observable.just({target: {}})
 },
 '.bar': {
   'scroll': Rx.Observable.just({target: {}})
 }
});

// Usage
const click$ = userEvents.select('.foo').events('click');
```
Arguments:

mockedSelectors :: Object an object where keys are selector strings and values are objects. Those nested objects have eventType strings as keys and values are Observables you created.
Return:

(Object) fake DOM source object, containing a function select() which can be used just like the DOM Driver's source. Call select(selector).events(eventType) on the source object to get the Observable you defined in the input of mockDOMSource.

---
_Source: https://npm.io/package/cycle-snabbdom · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
