Commit Graph
94 Commits
Author SHA1 Message Date
Carl Törnqvist d62691f207 Disable hash routing by default (#699) 2019-06-11 23:05:15 +02:00
alex 555ab4b5f9 Use Object.assign instead of xtend (#616)
As described by #563:

> https://polyfill.io provides a fallback for browsers that don't support it, so for most people this will be a strict improvement.
2019-06-11 22:50:34 +02:00
Carl Törnqvist 4c15924308 Revert init order change 2019-04-03 10:51:41 +02:00
Carl Törnqvist a22fca69de Add browser tests (#696) 2019-04-02 14:55:21 +02:00
Carl Törnqvist 6a2f14c292 Fix location missing on store init (#695) 2019-04-02 09:27:06 +02:00
Maximilian Antoni c9356a6837 Fix wrong this usage in nanohref integration (#689)
I currently see `TypeError: undefined is not an object (evaluating 'this._hashEnabled')` being thrown by clients. This should fix it.
2018-10-30 12:05:52 +01:00
Carl Törnqvist 6513f4288f Add hash option (#667)
* Add hash option

* Avoid unecessary scroll into view-call

* Update readme with hash option

* Fix typo

* Remove nanolocation dep

* Default hash option to true
2018-07-12 11:29:31 +02:00
Yoshua Wuyts bddcfbe838 choo components (#639)
* add components

* example: componentize header

* fix choo SSR

* example: componentize footer

* example: fix footer

* update component cache asserts

* componentize todos

* reorder example dir

* fix example tests

* fix dep check test

* Add garbage collection of unused components

* Apply args when calling identity

* update to new component preview

* update nanocomponent

* fix cache err name

* remove static methods from example

* restore app.emit() function

* public API tests

* offset component cache iteration by 2

* whitelist contents of component folder (#643)

* allow lru number arg

* fix lint typo
2018-03-30 18:19:06 +02:00
Yoshua Wuyts b1fa6f19af move ._handler off state (#637) 2018-03-14 12:25:26 +01:00
Yoshua Wuyts 52ec4f3ad3 assert for arrays on .toString() (#642) 2018-03-14 12:21:05 +01:00
Yoshua Wuyts f20deb69e7 create stores lazily (#638) 2018-03-07 13:20:47 +01:00
Nate Goldman cf1f99b94a add support for hyperscript in choo.toString (#635)
* add failing test for hyperscript (#634)

* add support for hyperscript in choo.toString (#634)
2018-03-05 08:11:07 -08:00
Renée Kooi a23dc51397 server: Store mount selector and return this (#625)
* Store mount selector and return `this`

This allows `.mount('body')` to be used on the server like so:

```js
module.exports = app.mount('body')
```

Then, when server rendering you can do:

```js
var app = require('./app')
fillServerTemplate(html, app.selector, app.toString('/'))
```

Where `fillServerTemplate` is a function that replaces the HTML at a
CSS selector with some string.

This way you do not need to check for `typeof window` in your
application entry point to do server rendering, and it allows tools like
bankai to automatically inline server rendered html in the correct place.

* docs

* better words
2018-02-13 22:09:08 +01:00
Marc Bachmann cf8c316189 Separate route matching from rendering (#613)
- This fixes https://github.com/choojs/choo/issues/530
- Adds support for wayfarer/nanorouter subrouters
2018-01-17 23:58:42 +01:00
Yerko Palma 73b1a82684 handle multiple arguments for emitter in views (#615)
* handle multiple arguments for emitter in views

* fix emit call
2017-12-28 22:17:47 +01:00
Moszeed 242128bb8c add support for HTMLElement on choo.mount (#597)
* add support for HTMLElement on choo.mount

- removed explicit "string" test and for selector variable, replaced by
"is available and filled" test
- add "if" to separate by incoming "string" or "HTMLElement"

* remove semicolons and white spaces

* add "is in Browser" check for HTMLElement

* add window to HTMLElement

* optimizing "mount" commit

* remove window.HTMLElement check

* change .mount documentation

- add info that selector can be also a DOM element
- remove "nanomount" infos

* add missing line
2017-11-15 12:44:45 +01:00
Carl Törnqvist b0754869fc Fix missing underscore in _hasWindow (#589) 2017-10-22 15:24:19 +02:00
Yoshua Wuyts 5561566dd5 add initial state support (#574)
* add initial state support

* clean up initial state from window

* fix initial state if none
2017-10-20 16:30:58 +02:00
Simon Lawrence 8595f1f765 Populate state.query before calling router (#575)
Ensure querystring parameters are available to views.
2017-10-08 13:58:27 -04:00
Yoshua Wuyts 92372b9bff use .storeName during tracing (#560) 2017-10-03 12:34:36 -04:00
Carl Törnqvist fccb408a8c Fix toString remove last letter in href (#559) 2017-09-11 23:36:03 +02:00
Yoshua Wuyts [taking a vacation, back 31/07] 681bb4a39a don't rerender before load (#541) 2017-08-01 02:08:12 +02:00
LOUIS b23183137e fix .toString() state (#531) (#533)
* fix .toString() state (#531)

* updated .toString() state fix (#531)

* updated .toString() state fix (#531)
2017-07-26 19:32:05 +02:00
Yoshua Wuyts 9c8c5b3c85 Save location (#534)
* add location

* remove zopfli from build

* state.location -> state.href

* add state.href docs
2017-07-26 19:31:15 +02:00
Yoshua Wuyts a703ac5c56 State in tostring (#529)
* add state to toString

* set initial state if possible

* add window assertion for tostring
2017-07-11 15:07:53 +02:00
Yoshua Wuyts 38a875a0d6 add DOMTitleChange event (#525) 2017-07-03 10:43:44 +02:00
Yoshua Wuyts 711f92a7c1 use nanolocation (#523) 2017-07-01 13:50:14 +02:00
Yoshua Wuyts 5d2104963c remove default route, parse qs (#521) 2017-06-29 17:20:00 +02:00
Yoshua Wuyts eb9b7fd59f v6 beta branch (#489)
* become prototype based

upgrade to new nanobus

remove nanohistory

add nanotiming

remove nanomount

move newTree to next tick

upgrade timing API

add more node warnings to .start/.mount

add morph timing

pass app instance to .use()

self-clearing async-timing

clean up timings

better mount error

fix mount bug

de-prototype helper functions

update to latest nanotiming

upgrade to nanotiming 5

update nanotiming

add toString asserts

more assertions

add event based tracing

expose createlocation

assert return types from render to always be the same

add navigate event

expose route on state

expose events

update uglify

use scroll-to-anchor

update nanobus

document events

update docs

more docs

changelog v6

upgrade nanomorph

fixup! neatify morph assertions

update bel dep

add popstate docs to changelog

* expose events on state

* upgrade deps
2017-06-28 15:53:37 +02:00
Yoshua Wuyts 6bd9a39cee fix .toString() (#510)
Closes GH-509. Thanks!
2017-06-02 12:33:51 +02:00
Yoshua Wuyts 8ff7deea3c add server tests (#501)
* add server tests

* remove node 4 tests
2017-05-24 13:02:33 +02:00
Kasper Lewau 9708859894 pass through emit args to updateHistory (#496) 2017-05-20 18:52:18 +02:00
Emil Bay 736e4b4514 Add hook for replaceState (#494)
* Add hook for replaceState

* Clarify why replaceState is dangerous
2017-05-19 14:56:45 +02:00
Emil Bay fe7f3a1695 Allow listeners to attach before rendering (#493)
* Allow listeners to attach before rendering

* Move rerender listeners down. Subtle sequencing

* Update docs to reflect changes
2017-05-19 14:20:39 +02:00
Yoshua Wuyts 6cf13af5ce warn on unmount (#485) 2017-04-26 13:52:34 +02:00
Yoshua Wuyts f45e1646ec expose router (#482)
In preparation for GH-480, but also because choo 4 exposed the router, and we need it for server rendering
2017-04-25 02:50:58 +02:00
Yoshua Wuyts 305d0a1ce5 run choo event handlers first (#479) 2017-04-19 13:02:43 +02:00
Yoshua Wuyts 30429d5970 Unlib (#477)
* use nanohref

* use nanohistory
2017-04-14 17:10:21 +02:00
Yoshua Wuyts 16d15d0e88 optimize example further (#462) 2017-04-02 01:19:59 +02:00
Carl Törnqvist 81216840c9 Add safer check for window properties (#458) 2017-03-31 22:01:58 +02:00
Yoshua Wuyts 2bbcb53f4a restore document-ready dep (#454) 2017-03-30 12:20:57 +02:00
Yoshua Wuyts b7b85261eb Remove unused variables (#453)
Closes https://github.com/yoshuawuyts/choo/issues/451
2017-03-30 11:48:21 +02:00
Yoshua Wuyts 4ef1f411b5 add timing API support (#448)
* add timing API support

* fixup! bump package.json
2017-03-29 10:43:42 +02:00
Yoshua Wuyts 4f8bd24169 fix server render (#443) 2017-03-25 10:45:44 +01:00
Seth Vincent 4e410ce50b hash fix: wait to run scrollIntoView (#439)
* simplify createLocation and wait to run scrollIntoView

* remove createLocation change
2017-03-25 10:17:43 +01:00
Yoshua Wuyts c2e4bb4963 fix pushState event (#434) 2017-03-22 20:42:53 +01:00
Yoshua Wuyts 8e8e870d45 implement choo v5 API (#425)
* implement choo v5 API

* fix tests

* 5.0.0-3

* 4kb now

* bump nanomorph

* 5.0.0-4

* fix missing deps stuff

* 5.0.0-5

* fix travis

* fixup! oops standard

* chooexpose

* fix state passing

* fixup! update example

* fixup! incorporate feedback

* fixup! more docs

* fixup! even more docs
2017-03-21 03:00:45 +01:00
Ben Gourley eed3a41797 feat(stop): expose barracks stop() fn (#359) 2017-01-21 18:08:43 +01:00
unaffiliated 6daf2e69f0 ignore state updates when on node
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

Closes #390
2017-01-21 16:21:48 +01:00
Tim Wisniewski 3b5740c00e Assert that tree exists, fix tests (#358)
* assert that tree exists, fix tests

* make assertions more helpful
2016-12-22 06:55:36 -05:00