forked from stephband/fn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.template.html
201 lines (177 loc) · 8.01 KB
/
index.template.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html lang="en">
<head build-fn="fetch:package.json">
<template build-src="/fn/templates.html#head-template"></template>
<script build-remove>
window.DEBUG = true;
</script>
<link rel="stylesheet" href="style.min.css" />
<!--link rel="stylesheet" href="style.css" /-->
</head>
<body class="grid @1-6x-grid @3-9x-grid">
<header class="x-1 3x @1-6x @2-9x @3-x-2 @3-11x" id="header">
<template build-fn="fetch:package.json" build-src="/fn/templates.html#header-template"></template>
</header>
<section class="x-1 3x @1-6x @2-9x @3-x-2 grid" locateable id="functions">
<header class="x-1 3x @1-4x">
<h2 class="doctext-02">Functions</h2>
<p class="doctext-08">Import functions from the Fn module:</p>
<pre><code class="language-js">import { get, matches } from '/fn/module.js';</code></pre>
</header>
<div class="x-1 3x">
<h4 class="doctext-03">Functions</h4>
<template build-fn="docs:
modules/cache.js,
modules/compose.js,
modules/curry.js,
modules/choose.js,
modules/once.js,
modules/overload.js,
modules/pipe.js,
modules/weak-cache.js
filter-function each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
<div class="x-1 3x @2-4x">
<p class="doctext-08">
The functions below are curried (where they take more than one
parameter). They may be partially applied.
</p>
</div>
<div class="x-1 3x column-grid grid">
<div class="x-1">
<h4 class="doctext-03">Objects</h4>
<template build-fn="docs:
modules/argument.js,
modules/call.js,
modules/equals.js,
modules/get.js,
modules/get-path.js,
modules/has.js,
modules/id.js,
modules/invoke.js,
modules/is.js,
modules/is-defined.js,
modules/matches.js,
modules/noop.js,
modules/not.js,
modules/request-tick.js,
modules/self.js,
modules/set.js,
modules/set-path.js,
modules/to-array.js,
modules/to-class.js,
modules/to-fixed.js,
modules/to-string.js,
modules/to-type.js
filter-function each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
</div>
<div class="x-1 3x @1-x-4 column-grid grid">
<div class="x-1">
<h4 class="doctext-03">Strings</h4>
<template build-fn="docs:
modules/strings/append.js,
modules/strings/prepend.js,
modules/strings/prepad.js,
modules/strings/postpad.js,
modules/capture.js,
modules/exec.js,
modules/parse-int.js,
modules/strings/slugify.js,
modules/strings/to-camel-case.js,
modules/strings/to-plain-text.js
filter-function each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
<div class="x-1">
<h4 class="doctext-03">Maths</h4>
<template build-fn="docs:
modules/maths/core.js,
modules/maths/clamp.js,
modules/maths/mod.js,
modules/maths/ratios.js,
modules/maths/cubic-bezier.js,
modules/maths/to-cartesian.js,
modules/maths/to-polar.js
filter-function each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
</div>
<div class="x-1 3x @2-x-7 column-grid grid">
<div class="x-1">
<h4 class="doctext-03">Arrays</h4>
<template build-fn="docs:
modules/lists/core.js,
modules/lists/insert.js,
modules/lists/last.js,
modules/lists/remove.js,
modules/lists/rest.js,
modules/lists/take.js,
modules/lists/unique.js,
modules/lists/update.js
filter-function each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
<div class="x-1">
<h4 class="doctext-03">Time</h4>
<template build-fn="docs:
modules/date.js,
modules/time.js
filter-function each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
</div>
</section>
<section class="x-1 3x @1-6x @2-9x @3-x-2 columns-grid grid" locateable id="observer">
<header class="x-1 3x @1-4x">
<h2 class="doctext-02" style="font-size: 1.875rem;">Observer</h2>
<p class="doctext-08">An observer is an ES6 Proxy of an object that intercepts and
reports mutations. Import and create an observer:</p>
<pre><code class="language-js">import { Observer, observe } from '/fn/module.js';
const data = Observer({ value: true });</code></pre>
<p class="doctext-08">
There is only ever one observer per object, ie, calling
<code>Observer(object)</code> multiple times with the same object
(or proxy of that object) always returns the same observer proxy.
Observers can be observed for mutations with the observe function:
</p>
<pre><code class="language-js">observe('value', console.log, data);</code></pre>
<p class="doctext-08">Mutations made to the observer proxy's <code>value</code>
property are now logged to the console.</p>
<pre><code class="language-js">data.value = false; // Logs `false`</code></pre>
</header>
<div class="x-1 3x list-grid grid">
<template build-fn="docs:
modules/observer/observer.js,
modules/observer/observe.js
filter-function each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
</section>
<!--div class="x-1 3x @2-x-2 @3-6x @4-5x @5-3x">
<p class="doctext-08">Text things</p>
</div-->
<!--div class="x-1 3x @2-x-2 @3-6x @4-5x @5-3x" build-fn="docs:'./modules/stream.js'"></div-->
<section class="x-1 3x @1-6x @2-9x @3-x-2 columns-grid grid" locateable id="stream">
<header class="x-1 3x @1-4x">
<h2 class="doctext-02" style="font-size: 1.875rem;">Stream</h2>
<p class="doctext-08">Import and create a stream:</p>
<pre><code class="language-js">import { Stream } from '/fn/module.js';
const stream = Stream.of(1,2,3,4);</code></pre>
</header>
<div class="x-1 3x list-grid grid">
<template build-fn="docs:modules/stream.js filter-function each" build-src="/fn/templates.html#{[type]}-template"></template>
<template build-fn="docs:modules/fn.js filter-property each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
<div class="x-1 3x @1-x-4 list-grid grid">
<template build-fn="docs:modules/stream.js filter-method take:16 each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
<div class="x-1 3x @2-x-7 list-grid grid">
<template build-fn="docs:modules/stream.js filter-method rest:16 each" build-src="/fn/templates.html#{[type]}-template"></template>
</div>
</section>
<script build-remove type="module" src="../fn/docs-build.js"></script>
<!-- Document interactivity -->
<script type="module">
import '../bolt/modules/device.js';
import '../bolt/modules/toggleable.js';
import '../bolt/modules/locateable.js';
import * as Fn from './module.js';
window.Fn = Fn;
</script>
</body>