@talyaron1/mithril 0.0.0-stage → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +89 -2
- package/api/mount-redraw.js +49 -0
- package/api/router.js +252 -0
- package/browser.js +5 -0
- package/hyperscript.js +8 -0
- package/index.js +26 -0
- package/mithril.js +1775 -0
- package/mithril.min.js +1 -0
- package/mount-redraw.js +5 -0
- package/mount.js +3 -0
- package/package.json +36 -4
- package/pathname/build.js +45 -0
- package/pathname/compileTemplate.js +44 -0
- package/pathname/parse.js +25 -0
- package/querystring/build.js +26 -0
- package/querystring/parse.js +48 -0
- package/redraw.js +3 -0
- package/render/cachedAttrsIsStaticMap.js +12 -0
- package/render/delayedRemoval.js +3 -0
- package/render/domFor.js +24 -0
- package/render/emptyAttrs.js +4 -0
- package/render/fragment.js +13 -0
- package/render/hyperscript.js +101 -0
- package/render/hyperscriptVnode.js +23 -0
- package/render/render.js +964 -0
- package/render/trust.js +8 -0
- package/render/vnode.js +34 -0
- package/render.js +3 -0
- package/request/request.js +205 -0
- package/request.js +5 -0
- package/route.js +5 -0
- package/stream/stream.js +267 -0
- package/stream/stream.min.js +1 -0
- package/stream.js +3 -0
- package/util/censor.js +47 -0
- package/util/decodeURIComponentSafe.js +35 -0
- package/util/hasOwn.js +4 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Leo Horie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Mithril.js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/mithril)
|
|
4
|
+
[](https://github.com/MithrilJS/mithril.js/blob/main/LICENSE)
|
|
5
|
+
[](https://www.npmjs.com/package/mithril)
|
|
6
|
+
[](https://github.com/MithrilJS/mithril.js/actions)
|
|
7
|
+
[](https://opencollective.com/mithriljs)
|
|
8
|
+
[](https://mithril.zulipchat.com/)
|
|
9
|
+
|
|
10
|
+
> **This is a fork.** [talyaron/mithril.js](https://github.com/talyaron/mithril.js) is Mithril.js v2 with bug fixes that are not in an upstream release. The API is unchanged. See the [list of changes](docs/recent-changes.md), and [Installing this fork](#installing-this-fork) below.
|
|
11
|
+
|
|
12
|
+
- [What is Mithril.js?](#what-is-mithriljs)
|
|
13
|
+
- [Installation](#installation)
|
|
14
|
+
- [Documentation](#documentation)
|
|
15
|
+
- [Getting Help](#getting-help)
|
|
16
|
+
- [Contributing](#contributing)
|
|
17
|
+
|
|
18
|
+
## What is Mithril.js?
|
|
19
|
+
|
|
20
|
+
A modern client-side JavaScript framework for building Single Page Applications. It's small (<!-- size -->9.15 KB<!-- /size --> gzipped), fast and provides routing and XHR utilities out of the box.
|
|
21
|
+
|
|
22
|
+
Mithril.js is used by companies like Vimeo and Nike, and open source platforms like Lichess 👍.
|
|
23
|
+
|
|
24
|
+
Mithril.js supports Firefox ESR, and the last two versions of Firefox, Edge, Safari, and Chrome. No polyfills required. 👌
|
|
25
|
+
|
|
26
|
+
## Installing this fork
|
|
27
|
+
|
|
28
|
+
From npm, under the name `mithril`:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install mithril@npm:@talyaron1/mithril
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Installing it under that alias means `import m from "mithril"`, `mithril/stream` and `@types/mithril` work as usual, and other packages that depend on `mithril` get this fork too.
|
|
35
|
+
|
|
36
|
+
Or straight from GitHub, pinned to a release tag:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install mithril@github:talyaron/mithril.js#v2.4.0-fork
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
The instructions below are for the upstream package.
|
|
45
|
+
|
|
46
|
+
### CDN
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<!-- Development: whichever you prefer -->
|
|
50
|
+
<script src="https://unpkg.com/mithril/mithril.js"></script>
|
|
51
|
+
<script src="https://cdn.jsdelivr.net/npm/mithril/mithril.js"></script>
|
|
52
|
+
|
|
53
|
+
<!-- Production: whichever you prefer -->
|
|
54
|
+
<script src="https://unpkg.com/mithril/mithril.min.js"></script>
|
|
55
|
+
<script src="https://cdn.jsdelivr.net/npm/mithril/mithril.min.js"></script>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### npm
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install mithril --save
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The ["Getting started" guide](https://mithril.js.org/#getting-started) is a good place to start learning how to use Mithril.js.
|
|
65
|
+
|
|
66
|
+
TypeScript type definitions are available from DefinitelyTyped. They can be installed with:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
$ npm install @types/mithril --save-dev
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
Documentation lives on [mithril.js.org](https://mithril.js.org).
|
|
75
|
+
|
|
76
|
+
You may be interested in the [API Docs](https://mithril.js.org/api.html), a [Simple Application](https://mithril.js.org/simple-application.html), or perhaps some [Examples](https://mithril.js.org/examples.html).
|
|
77
|
+
|
|
78
|
+
## Getting Help
|
|
79
|
+
|
|
80
|
+
Mithril.js has an active & welcoming community on [Zulip](https://mithril.zulipchat.com/), or feel free to ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/mithril.js) using the `mithril.js` tag.
|
|
81
|
+
|
|
82
|
+
## Contributing
|
|
83
|
+
|
|
84
|
+
There's a [Contributing FAQ](https://mithril.js.org/contributing.html) on the Mithril.js site that hopefully helps, but if not definitely hop into the [Zulip stream](https://mithril.zulipchat.com/) and ask away!
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
Thanks for reading!
|
|
89
|
+
|
|
90
|
+
🎁
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
var Vnode = require("../render/vnode")
|
|
4
|
+
|
|
5
|
+
module.exports = function(render, schedule, console) {
|
|
6
|
+
var subscriptions = []
|
|
7
|
+
var pending = false
|
|
8
|
+
var offset = -1
|
|
9
|
+
|
|
10
|
+
function sync() {
|
|
11
|
+
for (offset = 0; offset < subscriptions.length; offset += 2) {
|
|
12
|
+
try { render(subscriptions[offset], Vnode(subscriptions[offset + 1]), redraw) }
|
|
13
|
+
catch (e) { console.error(e) }
|
|
14
|
+
}
|
|
15
|
+
offset = -1
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function redraw() {
|
|
19
|
+
if (!pending) {
|
|
20
|
+
pending = true
|
|
21
|
+
schedule(function() {
|
|
22
|
+
pending = false
|
|
23
|
+
sync()
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
redraw.sync = sync
|
|
29
|
+
|
|
30
|
+
function mount(root, component) {
|
|
31
|
+
if (component != null && component.view == null && typeof component !== "function") {
|
|
32
|
+
throw new TypeError("m.mount expects a component, not a vnode.")
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var index = subscriptions.indexOf(root)
|
|
36
|
+
if (index >= 0) {
|
|
37
|
+
subscriptions.splice(index, 2)
|
|
38
|
+
if (index <= offset) offset -= 2
|
|
39
|
+
render(root, [])
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (component != null) {
|
|
43
|
+
subscriptions.push(root, component)
|
|
44
|
+
render(root, Vnode(component), redraw)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {mount: mount, redraw: redraw}
|
|
49
|
+
}
|
package/api/router.js
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
var Vnode = require("../render/vnode")
|
|
4
|
+
var hyperscript = require("../render/hyperscript")
|
|
5
|
+
|
|
6
|
+
var decodeURIComponentSafe = require("../util/decodeURIComponentSafe")
|
|
7
|
+
var buildPathname = require("../pathname/build")
|
|
8
|
+
var parsePathname = require("../pathname/parse")
|
|
9
|
+
var compileTemplate = require("../pathname/compileTemplate")
|
|
10
|
+
var censor = require("../util/censor")
|
|
11
|
+
|
|
12
|
+
module.exports = function($window, mountRedraw) {
|
|
13
|
+
var p = Promise.resolve()
|
|
14
|
+
|
|
15
|
+
var scheduled = false
|
|
16
|
+
|
|
17
|
+
var ready = false
|
|
18
|
+
var hasBeenResolved = false
|
|
19
|
+
|
|
20
|
+
var dom, compiled, fallbackRoute
|
|
21
|
+
|
|
22
|
+
var currentResolver, component, attrs, currentPath, lastUpdate
|
|
23
|
+
|
|
24
|
+
var RouterRoot = {
|
|
25
|
+
onremove: function() {
|
|
26
|
+
ready = hasBeenResolved = false
|
|
27
|
+
$window.removeEventListener("popstate", fireAsync, false)
|
|
28
|
+
},
|
|
29
|
+
view: function() {
|
|
30
|
+
// The route has already been resolved.
|
|
31
|
+
// Therefore, the following early return is not needed.
|
|
32
|
+
// if (!hasBeenResolved) return
|
|
33
|
+
|
|
34
|
+
var vnode = Vnode(component, attrs.key, attrs)
|
|
35
|
+
if (currentResolver) return currentResolver.render(vnode)
|
|
36
|
+
// Wrap in a fragment to preserve existing key semantics
|
|
37
|
+
return [vnode]
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var SKIP = route.SKIP = {}
|
|
42
|
+
|
|
43
|
+
function resolveRoute() {
|
|
44
|
+
scheduled = false
|
|
45
|
+
// Consider the pathname holistically. The prefix might even be invalid,
|
|
46
|
+
// but that's not our problem.
|
|
47
|
+
var prefix = $window.location.hash
|
|
48
|
+
if (route.prefix[0] !== "#") {
|
|
49
|
+
prefix = $window.location.search + prefix
|
|
50
|
+
if (route.prefix[0] !== "?") {
|
|
51
|
+
prefix = $window.location.pathname + prefix
|
|
52
|
+
if (prefix[0] !== "/") prefix = "/" + prefix
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// This seemingly useless `.concat()` speeds up the tests quite a bit,
|
|
56
|
+
// since the representation is consistently a relatively poorly
|
|
57
|
+
// optimized cons string.
|
|
58
|
+
var path = prefix.concat()
|
|
59
|
+
.replace(/(?:%[a-f89][a-f0-9])+/gim, decodeURIComponentSafe)
|
|
60
|
+
.slice(route.prefix.length)
|
|
61
|
+
var data = parsePathname(path)
|
|
62
|
+
|
|
63
|
+
Object.assign(data.params, $window.history.state)
|
|
64
|
+
|
|
65
|
+
function reject(e) {
|
|
66
|
+
console.error(e)
|
|
67
|
+
route.set(fallbackRoute, null, {replace: true})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
loop(0)
|
|
71
|
+
function loop(i) {
|
|
72
|
+
for (; i < compiled.length; i++) {
|
|
73
|
+
if (compiled[i].check(data)) {
|
|
74
|
+
var payload = compiled[i].component
|
|
75
|
+
var matchedRoute = compiled[i].route
|
|
76
|
+
var localComp = payload
|
|
77
|
+
var update = lastUpdate = function(comp) {
|
|
78
|
+
if (update !== lastUpdate) return
|
|
79
|
+
if (comp === SKIP) return loop(i + 1)
|
|
80
|
+
component = comp != null && (typeof comp.view === "function" || typeof comp === "function")? comp : "div"
|
|
81
|
+
attrs = data.params, currentPath = path, lastUpdate = null
|
|
82
|
+
currentResolver = payload.render ? payload : null
|
|
83
|
+
if (hasBeenResolved) mountRedraw.redraw()
|
|
84
|
+
else {
|
|
85
|
+
hasBeenResolved = true
|
|
86
|
+
mountRedraw.mount(dom, RouterRoot)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// There's no understating how much I *wish* I could
|
|
90
|
+
// use `async`/`await` here...
|
|
91
|
+
if (payload.view || typeof payload === "function") {
|
|
92
|
+
payload = {}
|
|
93
|
+
update(localComp)
|
|
94
|
+
}
|
|
95
|
+
else if (payload.onmatch) {
|
|
96
|
+
p.then(function () {
|
|
97
|
+
return payload.onmatch(data.params, path, matchedRoute)
|
|
98
|
+
}).then(update, path === fallbackRoute ? null : function (e) {
|
|
99
|
+
// Only the latest navigation may redirect to the fallback
|
|
100
|
+
// route. A stale rejection is still reported.
|
|
101
|
+
if (update === lastUpdate) reject(e)
|
|
102
|
+
else console.error(e)
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
else update(/* "div" */)
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (path === fallbackRoute) {
|
|
111
|
+
throw new Error("Could not resolve default route " + fallbackRoute + ".")
|
|
112
|
+
}
|
|
113
|
+
route.set(fallbackRoute, null, {replace: true})
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function fireAsync() {
|
|
118
|
+
if (!scheduled) {
|
|
119
|
+
scheduled = true
|
|
120
|
+
// TODO: just do `mountRedraw.redraw()` here and elide the timer
|
|
121
|
+
// dependency. Note that this will muck with tests a *lot*, so it's
|
|
122
|
+
// not as easy of a change as it sounds.
|
|
123
|
+
setTimeout(resolveRoute)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function route(root, defaultRoute, routes) {
|
|
128
|
+
if (!root) throw new TypeError("DOM element being rendered to does not exist.")
|
|
129
|
+
|
|
130
|
+
compiled = Object.keys(routes).map(function(route) {
|
|
131
|
+
if (route[0] !== "/") throw new SyntaxError("Routes must start with a '/'.")
|
|
132
|
+
if ((/:([^\/\.-]+)(\.{3})?:/).test(route)) {
|
|
133
|
+
throw new SyntaxError("Route parameter names must be separated with either '/', '.', or '-'.")
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
route: route,
|
|
137
|
+
component: routes[route],
|
|
138
|
+
check: compileTemplate(route),
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
fallbackRoute = defaultRoute
|
|
142
|
+
if (defaultRoute != null) {
|
|
143
|
+
var defaultData = parsePathname(defaultRoute)
|
|
144
|
+
|
|
145
|
+
if (!compiled.some(function (i) { return i.check(defaultData) })) {
|
|
146
|
+
throw new ReferenceError("Default route doesn't match any known routes.")
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
dom = root
|
|
150
|
+
|
|
151
|
+
$window.addEventListener("popstate", fireAsync, false)
|
|
152
|
+
|
|
153
|
+
ready = true
|
|
154
|
+
|
|
155
|
+
// The RouterRoot component is mounted when the route is first resolved.
|
|
156
|
+
resolveRoute()
|
|
157
|
+
}
|
|
158
|
+
route.set = function(path, data, options) {
|
|
159
|
+
// A navigation that interrupts a pending one replaces its history entry.
|
|
160
|
+
// Note: `options` belongs to the caller, so it must not be modified.
|
|
161
|
+
var replace = lastUpdate != null || options != null && options.replace
|
|
162
|
+
lastUpdate = null
|
|
163
|
+
|
|
164
|
+
path = buildPathname(path, data)
|
|
165
|
+
if (ready) {
|
|
166
|
+
fireAsync()
|
|
167
|
+
var state = options ? options.state : null
|
|
168
|
+
var title = options ? options.title : null
|
|
169
|
+
if (replace) $window.history.replaceState(state, title, route.prefix + path)
|
|
170
|
+
else $window.history.pushState(state, title, route.prefix + path)
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
$window.location.href = route.prefix + path
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
route.get = function() {return currentPath}
|
|
177
|
+
route.prefix = "#!"
|
|
178
|
+
route.Link = {
|
|
179
|
+
view: function(vnode) {
|
|
180
|
+
// Omit the used parameters from the rendered element - they are
|
|
181
|
+
// internal. Also, censor the various lifecycle methods.
|
|
182
|
+
//
|
|
183
|
+
// We don't strip the other parameters because for convenience we
|
|
184
|
+
// let them be specified in the selector as well.
|
|
185
|
+
var child = hyperscript(
|
|
186
|
+
vnode.attrs.selector || "a",
|
|
187
|
+
censor(vnode.attrs, ["options", "params", "selector", "onclick"]),
|
|
188
|
+
vnode.children
|
|
189
|
+
)
|
|
190
|
+
var options, onclick, href
|
|
191
|
+
|
|
192
|
+
// Let's provide a *right* way to disable a route link, rather than
|
|
193
|
+
// letting people screw up accessibility on accident.
|
|
194
|
+
//
|
|
195
|
+
// The attribute is coerced so users don't get surprised over
|
|
196
|
+
// `disabled: 0` resulting in a button that's somehow routable
|
|
197
|
+
// despite being visibly disabled.
|
|
198
|
+
if (child.attrs.disabled = Boolean(child.attrs.disabled)) {
|
|
199
|
+
child.attrs.href = null
|
|
200
|
+
child.attrs["aria-disabled"] = "true"
|
|
201
|
+
// If you *really* do want add `onclick` on a disabled link, use
|
|
202
|
+
// an `oncreate` hook to add it.
|
|
203
|
+
} else {
|
|
204
|
+
options = vnode.attrs.options
|
|
205
|
+
onclick = vnode.attrs.onclick
|
|
206
|
+
// Easier to build it now to keep it isomorphic.
|
|
207
|
+
href = buildPathname(child.attrs.href, vnode.attrs.params)
|
|
208
|
+
child.attrs.href = route.prefix + href
|
|
209
|
+
child.attrs.onclick = function(e) {
|
|
210
|
+
var result
|
|
211
|
+
if (typeof onclick === "function") {
|
|
212
|
+
result = onclick.call(e.currentTarget, e)
|
|
213
|
+
} else if (onclick == null || typeof onclick !== "object") {
|
|
214
|
+
// do nothing
|
|
215
|
+
} else if (typeof onclick.handleEvent === "function") {
|
|
216
|
+
onclick.handleEvent(e)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Adapted from React Router's implementation:
|
|
220
|
+
// https://github.com/ReactTraining/react-router/blob/520a0acd48ae1b066eb0b07d6d4d1790a1d02482/packages/react-router-dom/modules/Link.js
|
|
221
|
+
//
|
|
222
|
+
// Try to be flexible and intuitive in how we handle links.
|
|
223
|
+
// Fun fact: links aren't as obvious to get right as you
|
|
224
|
+
// would expect. There's a lot more valid ways to click a
|
|
225
|
+
// link than this, and one might want to not simply click a
|
|
226
|
+
// link, but right click or command-click it to copy the
|
|
227
|
+
// link target, etc. Nope, this isn't just for blind people.
|
|
228
|
+
if (
|
|
229
|
+
// Skip if `onclick` prevented default
|
|
230
|
+
result !== false && !e.defaultPrevented &&
|
|
231
|
+
// Ignore everything but left clicks
|
|
232
|
+
(e.button === 0 || e.which === 0 || e.which === 1) &&
|
|
233
|
+
// Let the browser handle `target=_blank`, etc.
|
|
234
|
+
(!e.currentTarget.target || e.currentTarget.target === "_self") &&
|
|
235
|
+
// No modifier keys
|
|
236
|
+
!e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey
|
|
237
|
+
) {
|
|
238
|
+
e.preventDefault()
|
|
239
|
+
e.redraw = false
|
|
240
|
+
route.set(href, null, options)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return child
|
|
245
|
+
},
|
|
246
|
+
}
|
|
247
|
+
route.param = function(key) {
|
|
248
|
+
return attrs && key != null ? attrs[key] : attrs
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return route
|
|
252
|
+
}
|
package/browser.js
ADDED
package/hyperscript.js
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
var hyperscript = require("./hyperscript")
|
|
4
|
+
var mountRedraw = require("./mount-redraw")
|
|
5
|
+
var request = require("./request")
|
|
6
|
+
var router = require("./route")
|
|
7
|
+
|
|
8
|
+
var m = function m() { return hyperscript.apply(this, arguments) }
|
|
9
|
+
m.m = hyperscript
|
|
10
|
+
m.trust = hyperscript.trust
|
|
11
|
+
m.fragment = hyperscript.fragment
|
|
12
|
+
m.Fragment = "["
|
|
13
|
+
m.mount = mountRedraw.mount
|
|
14
|
+
m.route = router
|
|
15
|
+
m.render = require("./render")
|
|
16
|
+
m.redraw = mountRedraw.redraw
|
|
17
|
+
m.request = request.request
|
|
18
|
+
m.parseQueryString = require("./querystring/parse")
|
|
19
|
+
m.buildQueryString = require("./querystring/build")
|
|
20
|
+
m.parsePathname = require("./pathname/parse")
|
|
21
|
+
m.buildPathname = require("./pathname/build")
|
|
22
|
+
m.vnode = require("./render/vnode")
|
|
23
|
+
m.censor = require("./util/censor")
|
|
24
|
+
m.domFor = require("./render/domFor")
|
|
25
|
+
|
|
26
|
+
module.exports = m
|