@explorable-viz/fluid 0.0.23
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 +36 -0
- package/dist/article/app.js +40580 -0
- package/dist/article/css/styles.css +191 -0
- package/dist/article/css/view-styles.css +141 -0
- package/dist/article/fluid/dataset/renewables-restricted.fld +139 -0
- package/dist/article/fluid/example/arithmetic.fld +1 -0
- package/dist/article/fluid/example/array.fld +2 -0
- package/dist/article/fluid/example/compose.fld +2 -0
- package/dist/article/fluid/example/desugar/list-comp-1.fld +1 -0
- package/dist/article/fluid/example/desugar/list-comp-10.fld +1 -0
- package/dist/article/fluid/example/desugar/list-comp-2.fld +1 -0
- package/dist/article/fluid/example/desugar/list-comp-3.fld +1 -0
- package/dist/article/fluid/example/desugar/list-comp-4.fld +1 -0
- package/dist/article/fluid/example/desugar/list-comp-5.fld +1 -0
- package/dist/article/fluid/example/desugar/list-comp-6.fld +1 -0
- package/dist/article/fluid/example/desugar/list-comp-7.fld +1 -0
- package/dist/article/fluid/example/desugar/list-comp-8.fld +1 -0
- package/dist/article/fluid/example/desugar/list-comp-9.fld +1 -0
- package/dist/article/fluid/example/desugar/list-enum.fld +1 -0
- package/dist/article/fluid/example/dicts.fld +11 -0
- package/dist/article/fluid/example/div-mod-quot-rem.fld +4 -0
- package/dist/article/fluid/example/factorial.fld +6 -0
- package/dist/article/fluid/example/filter.fld +1 -0
- package/dist/article/fluid/example/first-class-constr.fld +1 -0
- package/dist/article/fluid/example/flatten.fld +12 -0
- package/dist/article/fluid/example/foldr-sumSquares.fld +1 -0
- package/dist/article/fluid/example/graphics/background.fld +7 -0
- package/dist/article/fluid/example/graphics/grouped-bar-chart.fld +9 -0
- package/dist/article/fluid/example/graphics/line-chart.fld +13 -0
- package/dist/article/fluid/example/graphics/small-barchart.fld +5 -0
- package/dist/article/fluid/example/graphics/stacked-bar-chart.fld +3 -0
- package/dist/article/fluid/example/include-input-into-output.fld +1 -0
- package/dist/article/fluid/example/length.fld +1 -0
- package/dist/article/fluid/example/lexicalScoping.fld +3 -0
- package/dist/article/fluid/example/lib/some-constants.fld +1 -0
- package/dist/article/fluid/example/linked-inputs/energyscatter.fld +24 -0
- package/dist/article/fluid/example/linked-inputs/mini-energyscatter.fld +30 -0
- package/dist/article/fluid/example/linked-inputs/mini-non-renewables.fld +3 -0
- package/dist/article/fluid/example/linked-inputs/mini-renewables.fld +6 -0
- package/dist/article/fluid/example/linked-inputs/non-renewables.fld +67 -0
- package/dist/article/fluid/example/linked-inputs/renewables.fld +301 -0
- package/dist/article/fluid/example/linked-outputs/bar-chart-line-chart.expect.fld +0 -0
- package/dist/article/fluid/example/linked-outputs/bar-chart-line-chart.fld +26 -0
- package/dist/article/fluid/example/linked-outputs/convolution-data.fld +5 -0
- package/dist/article/fluid/example/linked-outputs/convolution.fld +12 -0
- package/dist/article/fluid/example/linked-outputs/line-chart.fld +13 -0
- package/dist/article/fluid/example/linked-outputs/moving-average-data.fld +9 -0
- package/dist/article/fluid/example/linked-outputs/moving-average.fld +15 -0
- package/dist/article/fluid/example/linked-outputs/pairs-data.fld +1 -0
- package/dist/article/fluid/example/linked-outputs/pairs.fld +3 -0
- package/dist/article/fluid/example/linked-outputs/renewables.fld +100 -0
- package/dist/article/fluid/example/linked-outputs/stacked-bar-chart-scatter-plot.fld +38 -0
- package/dist/article/fluid/example/lookup.fld +15 -0
- package/dist/article/fluid/example/map.fld +1 -0
- package/dist/article/fluid/example/mergeSort.fld +22 -0
- package/dist/article/fluid/example/normalise.fld +3 -0
- package/dist/article/fluid/example/nub.fld +1 -0
- package/dist/article/fluid/example/pattern-match.fld +12 -0
- package/dist/article/fluid/example/range.fld +4 -0
- package/dist/article/fluid/example/record-lookup.fld +3 -0
- package/dist/article/fluid/example/records.fld +11 -0
- package/dist/article/fluid/example/reverse.fld +1 -0
- package/dist/article/fluid/example/scratchpad.fld +6 -0
- package/dist/article/fluid/example/slicing/add.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/add.fld +1 -0
- package/dist/article/fluid/example/slicing/array/array.expect.fld +2 -0
- package/dist/article/fluid/example/slicing/array/array.fld +4 -0
- package/dist/article/fluid/example/slicing/array/dims.expect.fld +3 -0
- package/dist/article/fluid/example/slicing/array/dims.fld +3 -0
- package/dist/article/fluid/example/slicing/array/lookup.expect.fld +3 -0
- package/dist/article/fluid/example/slicing/array/lookup.fld +5 -0
- package/dist/article/fluid/example/slicing/convolution/edgeDetect.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/convolution/edgeDetect.fld +1 -0
- package/dist/article/fluid/example/slicing/convolution/emboss-wrap.fld +1 -0
- package/dist/article/fluid/example/slicing/convolution/emboss.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/convolution/emboss.fld +1 -0
- package/dist/article/fluid/example/slicing/convolution/filter/edge-detect.fld +5 -0
- package/dist/article/fluid/example/slicing/convolution/filter/emboss.fld +5 -0
- package/dist/article/fluid/example/slicing/convolution/filter/gaussian.fld +5 -0
- package/dist/article/fluid/example/slicing/convolution/gaussian.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/convolution/gaussian.fld +1 -0
- package/dist/article/fluid/example/slicing/convolution/test-image.fld +7 -0
- package/dist/article/fluid/example/slicing/dict/create.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/dict/create.fld +1 -0
- package/dist/article/fluid/example/slicing/dict/difference.expect.fld +3 -0
- package/dist/article/fluid/example/slicing/dict/difference.fld +3 -0
- package/dist/article/fluid/example/slicing/dict/disjointUnion.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/dict/disjointUnion.fld +1 -0
- package/dist/article/fluid/example/slicing/dict/foldl.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/dict/foldl.fld +1 -0
- package/dist/article/fluid/example/slicing/dict/fromRecord.expect.fld +2 -0
- package/dist/article/fluid/example/slicing/dict/fromRecord.fld +1 -0
- package/dist/article/fluid/example/slicing/dict/get.expect.fld +3 -0
- package/dist/article/fluid/example/slicing/dict/get.fld +2 -0
- package/dist/article/fluid/example/slicing/dict/intersectionWith.expect.fld +2 -0
- package/dist/article/fluid/example/slicing/dict/intersectionWith.fld +4 -0
- package/dist/article/fluid/example/slicing/dict/map.expect.fld +6 -0
- package/dist/article/fluid/example/slicing/dict/map.fld +5 -0
- package/dist/article/fluid/example/slicing/divide.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/divide.fld +1 -0
- package/dist/article/fluid/example/slicing/dtw/average-series.expect.fld +8 -0
- package/dist/article/fluid/example/slicing/dtw/average-series.fld +8 -0
- package/dist/article/fluid/example/slicing/dtw/compute-dtw.expect.fld +6 -0
- package/dist/article/fluid/example/slicing/dtw/compute-dtw.fld +6 -0
- package/dist/article/fluid/example/slicing/filter.expect.fld +4 -0
- package/dist/article/fluid/example/slicing/filter.fld +6 -0
- package/dist/article/fluid/example/slicing/intersperse-1.expect.fld +4 -0
- package/dist/article/fluid/example/slicing/intersperse-2.expect.fld +4 -0
- package/dist/article/fluid/example/slicing/intersperse.fld +5 -0
- package/dist/article/fluid/example/slicing/length.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/length.fld +1 -0
- package/dist/article/fluid/example/slicing/linked-outputs/bar-chart-line-chart.expect.fld +0 -0
- package/dist/article/fluid/example/slicing/linked-outputs/bar-chart-line-chart.fld +26 -0
- package/dist/article/fluid/example/slicing/linked-outputs/renewables.fld +100 -0
- package/dist/article/fluid/example/slicing/linked-outputs/stacked-bar-scatter-plot.expect.fld +0 -0
- package/dist/article/fluid/example/slicing/linked-outputs/stacked-bar-scatter-plot.fld +38 -0
- package/dist/article/fluid/example/slicing/list-comp-1.expect.fld +6 -0
- package/dist/article/fluid/example/slicing/list-comp-2.expect.fld +6 -0
- package/dist/article/fluid/example/slicing/list-comp.fld +8 -0
- package/dist/article/fluid/example/slicing/lookup.expect.fld +6 -0
- package/dist/article/fluid/example/slicing/lookup.fld +14 -0
- package/dist/article/fluid/example/slicing/map.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/map.fld +1 -0
- package/dist/article/fluid/example/slicing/matrix-update.expect.fld +5 -0
- package/dist/article/fluid/example/slicing/matrix-update.fld +10 -0
- package/dist/article/fluid/example/slicing/multiply.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/multiply.fld +1 -0
- package/dist/article/fluid/example/slicing/nth.expect.fld +1 -0
- package/dist/article/fluid/example/slicing/nth.fld +1 -0
- package/dist/article/fluid/example/slicing/output-not-source.expect.fld +2 -0
- package/dist/article/fluid/example/slicing/output-not-source.fld +1 -0
- package/dist/article/fluid/example/slicing/section-5-example-1.expect.fld +10 -0
- package/dist/article/fluid/example/slicing/section-5-example-2.expect.fld +10 -0
- package/dist/article/fluid/example/slicing/section-5-example-3.expect.fld +10 -0
- package/dist/article/fluid/example/slicing/section-5-example.fld +14 -0
- package/dist/article/fluid/example/slicing/zeros-1.expect.fld +3 -0
- package/dist/article/fluid/example/slicing/zeros-2.expect.fld +3 -0
- package/dist/article/fluid/example/slicing/zeros.fld +4 -0
- package/dist/article/fluid/example/slicing/zipWith-1.expect.fld +4 -0
- package/dist/article/fluid/example/slicing/zipWith.fld +4 -0
- package/dist/article/fluid/example/text.fld +27 -0
- package/dist/article/fluid/lib/convolution.fld +16 -0
- package/dist/article/fluid/lib/dtw.fld +47 -0
- package/dist/article/fluid/lib/fnum.fld +22 -0
- package/dist/article/fluid/lib/graphics.fld +221 -0
- package/dist/article/fluid/lib/moving-average.fld +35 -0
- package/dist/article/fluid/lib/nombre.fld +14 -0
- package/dist/article/fluid/lib/prelude.fld +246 -0
- package/dist/article/index.html +44 -0
- package/fluid.js +46 -0
- package/package.json +80 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
-- "Num" throughout means (Int + Float).
|
|
2
|
+
|
|
3
|
+
-- Bool -> Bool
|
|
4
|
+
let and False y = False;
|
|
5
|
+
and True y = y;
|
|
6
|
+
|
|
7
|
+
-- Bool -> Bool
|
|
8
|
+
let or True y = True;
|
|
9
|
+
or False y = y;
|
|
10
|
+
|
|
11
|
+
-- Bool -> Bool
|
|
12
|
+
let not True = False;
|
|
13
|
+
not False = True;
|
|
14
|
+
|
|
15
|
+
-- Int -> Int -> Ordering
|
|
16
|
+
let compare x y =
|
|
17
|
+
if x > y
|
|
18
|
+
then GT
|
|
19
|
+
else if x < y
|
|
20
|
+
then LT
|
|
21
|
+
else EQ;
|
|
22
|
+
|
|
23
|
+
-- Num -> Num
|
|
24
|
+
let negate = (-) 0;
|
|
25
|
+
|
|
26
|
+
-- Log of x in base y.
|
|
27
|
+
-- Float -> Float -> Float
|
|
28
|
+
let logBase x y = log y / log x;
|
|
29
|
+
|
|
30
|
+
-- Float -> Float -> Float
|
|
31
|
+
let ceilingToNearest n m =
|
|
32
|
+
ceiling (n / m) * m;
|
|
33
|
+
|
|
34
|
+
-- (b -> c) -> (a -> b) -> a -> c
|
|
35
|
+
-- Want infix <<<
|
|
36
|
+
let compose f g x = f (g x);
|
|
37
|
+
|
|
38
|
+
-- ((a, b) -> c) -> a -> b -> c
|
|
39
|
+
let curry f x y = f (x, y);
|
|
40
|
+
|
|
41
|
+
-- (a -> b -> c) -> (a, b) -> c
|
|
42
|
+
let uncurry f (x, y) = f x y;
|
|
43
|
+
|
|
44
|
+
-- a -> b -> a
|
|
45
|
+
let const x _ = x;
|
|
46
|
+
|
|
47
|
+
-- (a -> b) -> (a, c) -> (b, c)
|
|
48
|
+
let first f (a, c) = (f a, c);
|
|
49
|
+
|
|
50
|
+
-- (a, b) -> b
|
|
51
|
+
let snd (_, y) = y;
|
|
52
|
+
|
|
53
|
+
-- (a -> b) -> (c, a) -> (c, b)
|
|
54
|
+
let second f (c, a) = (c, f a);
|
|
55
|
+
|
|
56
|
+
-- (a -> b -> c) -> b -> a -> c
|
|
57
|
+
let flip f x y = f y x;
|
|
58
|
+
|
|
59
|
+
-- (a, b) -> a
|
|
60
|
+
let fst (x, _) = x;
|
|
61
|
+
|
|
62
|
+
-- a -> a
|
|
63
|
+
let id x = x;
|
|
64
|
+
|
|
65
|
+
-- (a -> b) -> (a -> c) -> a -> (b, c)
|
|
66
|
+
-- Want infix &&&
|
|
67
|
+
let prod f g x = (f x, g x);
|
|
68
|
+
|
|
69
|
+
-- (a, b) -> (b, a)
|
|
70
|
+
let swap (a, b) = (b, a);
|
|
71
|
+
|
|
72
|
+
-- List a -> a
|
|
73
|
+
let head [] = error "Can't take head of empty list";
|
|
74
|
+
head (x : _) = x;
|
|
75
|
+
|
|
76
|
+
-- List a -> List a
|
|
77
|
+
let tail [] = error "Can't take tail of empty list";
|
|
78
|
+
tail (_ : xs) = xs;
|
|
79
|
+
|
|
80
|
+
-- Int -> List Int -> Bool
|
|
81
|
+
let elem x [] = False;
|
|
82
|
+
elem x (x' : xs) = (x == x') `or` (elem x xs);
|
|
83
|
+
|
|
84
|
+
-- (a -> Bool) -> List a -> List a
|
|
85
|
+
let filter p [] = [];
|
|
86
|
+
filter p (x : xs) =
|
|
87
|
+
let ys = filter p xs in
|
|
88
|
+
if p x then x : ys else ys;
|
|
89
|
+
|
|
90
|
+
-- (a -> b -> a) -> a -> List b -> a
|
|
91
|
+
let foldl op z [] = z;
|
|
92
|
+
foldl op z (x : xs) = foldl op (op z x) xs;
|
|
93
|
+
|
|
94
|
+
-- (a -> b -> a) -> List b -> a
|
|
95
|
+
let foldl1 op (x : xs) = foldl op x xs;
|
|
96
|
+
|
|
97
|
+
-- (a -> b -> b) -> b -> List a -> b
|
|
98
|
+
let foldr op z [] = z;
|
|
99
|
+
foldr op z (x : xs) = op x (foldr op z xs);
|
|
100
|
+
|
|
101
|
+
-- (a -> b -> b) -> List a -> b
|
|
102
|
+
let foldr1 op [x] = x;
|
|
103
|
+
foldr1 op (x : y : xs) = op x (foldr1 op (y : xs));
|
|
104
|
+
|
|
105
|
+
-- (a -> b -> a) -> a -> List b -> List a
|
|
106
|
+
let scanl1 op z xs =
|
|
107
|
+
let go x continue acc =
|
|
108
|
+
let next = op acc x in
|
|
109
|
+
next : continue next in
|
|
110
|
+
foldr go (const []) xs z;
|
|
111
|
+
|
|
112
|
+
-- (a -> b -> a) -> a -> List b -> List a
|
|
113
|
+
let scanl op z xs =
|
|
114
|
+
z : scanl1 op z xs;
|
|
115
|
+
|
|
116
|
+
-- (a -> b) -> List a -> List b
|
|
117
|
+
let map f [] = [];
|
|
118
|
+
map f (x : xs) = f x : map f xs;
|
|
119
|
+
|
|
120
|
+
-- (List a, List a) -> List a
|
|
121
|
+
let append ([], ys) = ys;
|
|
122
|
+
append (x : xs, ys) = x : append (xs, ys);
|
|
123
|
+
|
|
124
|
+
-- List a -> List -> List a
|
|
125
|
+
-- Want infix ++
|
|
126
|
+
let concat2 [] ys = ys;
|
|
127
|
+
concat2 (x : xs) ys = x : concat2 xs ys;
|
|
128
|
+
|
|
129
|
+
-- List (List a) -> List a
|
|
130
|
+
let concat = foldl concat2 [];
|
|
131
|
+
|
|
132
|
+
-- (a -> List b) -> List a -> List b
|
|
133
|
+
let concatMap f xs = concat (map f xs);
|
|
134
|
+
|
|
135
|
+
-- List a -> a -> List a
|
|
136
|
+
let intersperse [] _ = [];
|
|
137
|
+
intersperse [x] _ = [x];
|
|
138
|
+
intersperse (x : y : ys) sep = x : sep : intersperse (y : ys) sep;
|
|
139
|
+
|
|
140
|
+
-- Int -> (a -> a) -> a -> List a
|
|
141
|
+
let iterate n f z =
|
|
142
|
+
if n == 0 then [] else z : map f (iterate (n - 1) f z);
|
|
143
|
+
|
|
144
|
+
-- List Int -> Int
|
|
145
|
+
let sum = foldr (+) 0;
|
|
146
|
+
|
|
147
|
+
-- List a -> a
|
|
148
|
+
let last [x] = x;
|
|
149
|
+
last (x : y : ys) = last (y : ys);
|
|
150
|
+
|
|
151
|
+
-- List a -> Int
|
|
152
|
+
let length [] = 0;
|
|
153
|
+
length (_ : xs) = 1 + length xs;
|
|
154
|
+
|
|
155
|
+
-- List a -> List a
|
|
156
|
+
let reverse [] = [];
|
|
157
|
+
reverse (x : xs) = append (reverse xs, [x]);
|
|
158
|
+
|
|
159
|
+
-- Int -> a -> List a
|
|
160
|
+
let repeat = flip iterate id;
|
|
161
|
+
|
|
162
|
+
-- Int -> List a -> List a
|
|
163
|
+
let take n xs =
|
|
164
|
+
if n <= 0
|
|
165
|
+
then []
|
|
166
|
+
else match xs as {
|
|
167
|
+
[] -> [];
|
|
168
|
+
x : xs -> x : take (n - 1) xs
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
-- Int -> List a -> List a
|
|
172
|
+
let drop n xs =
|
|
173
|
+
if n <= 0
|
|
174
|
+
then xs
|
|
175
|
+
else match xs as {
|
|
176
|
+
[] -> [];
|
|
177
|
+
_ : xs -> drop (n - 1) xs
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
-- Int -> List a -> List a
|
|
181
|
+
let lastN n xs =
|
|
182
|
+
foldl (compose const (drop 1)) xs (drop n xs);
|
|
183
|
+
|
|
184
|
+
-- Expects non-negative integer as first argument and non-empty list as second argument.
|
|
185
|
+
-- Int -> List a -> a
|
|
186
|
+
let nth n (x : xs) =
|
|
187
|
+
if n == 0 then x else nth (n - 1) xs;
|
|
188
|
+
|
|
189
|
+
-- Matrix Int -> Int -> Int -> Int
|
|
190
|
+
let nth2 i j xss =
|
|
191
|
+
nth (j - 1) (nth (i - 1) xss);
|
|
192
|
+
|
|
193
|
+
-- Partial; requires k to be in the map.
|
|
194
|
+
-- Int -> List (Int, b) -> b
|
|
195
|
+
let lookup k [] = error "Key not found in map";
|
|
196
|
+
lookup k ((k', v) : kvs) =
|
|
197
|
+
if k == k' then v else lookup k kvs;
|
|
198
|
+
|
|
199
|
+
-- Int -> Int -> Int
|
|
200
|
+
let max n m =
|
|
201
|
+
if n > m then n else m;
|
|
202
|
+
|
|
203
|
+
-- Int -> Int -> Int
|
|
204
|
+
let min n m =
|
|
205
|
+
if n < m then n else m;
|
|
206
|
+
|
|
207
|
+
-- List Int -> Int
|
|
208
|
+
let maximum = foldr1 max;
|
|
209
|
+
|
|
210
|
+
-- List Int -> Int
|
|
211
|
+
let minimum = foldr1 min;
|
|
212
|
+
|
|
213
|
+
-- List (a, b) -> (List a, List b)
|
|
214
|
+
let unzip [] = ([], []);
|
|
215
|
+
unzip ((x, y) : zs) =
|
|
216
|
+
let (xs, ys) = unzip zs in
|
|
217
|
+
(x : xs, y : ys);
|
|
218
|
+
|
|
219
|
+
-- (a -> b -> c) -> List a -> List b -> List c
|
|
220
|
+
let zipWith op [] ys = [];
|
|
221
|
+
zipWith op (x : xs) [] = [];
|
|
222
|
+
zipWith op (x : xs) (y : ys) = op x y : zipWith op xs ys;
|
|
223
|
+
|
|
224
|
+
-- List a -> List b -> List (a, b)
|
|
225
|
+
let zip = zipWith (curry id);
|
|
226
|
+
|
|
227
|
+
-- Int -> Int -> List Int
|
|
228
|
+
let enumFromTo n m =
|
|
229
|
+
if n <= m then n : [n + 1 .. m] else [];
|
|
230
|
+
|
|
231
|
+
let range (m1, n1) (m2, n2) =
|
|
232
|
+
[ (i1, i2) | i1 <- [m1 .. m2], i2 <- [n1 .. n2] ];
|
|
233
|
+
|
|
234
|
+
-- Int -> Int -> Int
|
|
235
|
+
let abs x y =
|
|
236
|
+
if x - y < 0 then negate (x - y) else (x - y);
|
|
237
|
+
|
|
238
|
+
-- Eq a => [a] -> [a]
|
|
239
|
+
let nub xs =
|
|
240
|
+
let nub' [] _ = [];
|
|
241
|
+
nub' (x : xs) ys = if x `elem` ys then nub' xs ys else x : nub' xs (x : ys) in
|
|
242
|
+
nub' xs [];
|
|
243
|
+
|
|
244
|
+
-- Int -> Int -> [a] -> [a]
|
|
245
|
+
let slice begin end xs =
|
|
246
|
+
take (end - begin) (drop begin xs);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
7
|
+
<title>Fluid: Data-Linked Visualisations</title>
|
|
8
|
+
<link href="/css/styles.css" rel="stylesheet" type="text/css">
|
|
9
|
+
<link href="/css/view-styles.css" rel="stylesheet" type="text/css">
|
|
10
|
+
<script src="https://use.fontawesome.com/1091715d00.js"></script>
|
|
11
|
+
<script>
|
|
12
|
+
// move to PureScript
|
|
13
|
+
function toggle(id) {
|
|
14
|
+
const elem = document.getElementById(id)
|
|
15
|
+
if (elem.style.visibility == 'hidden')
|
|
16
|
+
elem.style.visibility = 'visible'
|
|
17
|
+
else
|
|
18
|
+
elem.style.visibility = 'hidden'
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
</head>
|
|
22
|
+
<body class="standalone">
|
|
23
|
+
<div class="grid-container double-size">
|
|
24
|
+
<div></div>
|
|
25
|
+
<div></div>
|
|
26
|
+
<div></div>
|
|
27
|
+
<div></div>
|
|
28
|
+
<div></div>
|
|
29
|
+
<div id="fig-input" class="flex-right-align data-pane"></div>
|
|
30
|
+
<div>
|
|
31
|
+
<div onclick="toggle('fig-input')"><span class="data-pane-button toggle-button">◀▶</span></div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="flex-left-align">
|
|
34
|
+
<div id="fig"></div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<script src="app.js"></script>
|
|
39
|
+
<script>
|
|
40
|
+
// move to PureScript
|
|
41
|
+
toggle('fig-input')
|
|
42
|
+
</script>
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
package/fluid.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { program } = require('commander');
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const webFS = require('fs').promises;
|
|
5
|
+
const filenameRegex = /\w+\.yml/ //may need to expand character set
|
|
6
|
+
const express = require('express');
|
|
7
|
+
const serve = require('express-static');
|
|
8
|
+
|
|
9
|
+
const app = express();
|
|
10
|
+
const host = '127.0.0.1';
|
|
11
|
+
const port = 8080;
|
|
12
|
+
|
|
13
|
+
program.command('load')
|
|
14
|
+
.arguments('<file>')
|
|
15
|
+
.action(function(file)
|
|
16
|
+
{
|
|
17
|
+
if (file.match(filenameRegex) != null)
|
|
18
|
+
{
|
|
19
|
+
try
|
|
20
|
+
{
|
|
21
|
+
//read data stream if file is large
|
|
22
|
+
//const data = fs.readFileSync(__dirname + "/" + file, 'utf8');
|
|
23
|
+
const data = fs.readFileSync(process.cwd() + "/" + file, 'utf8'); //assuming file is located at command line's current directory
|
|
24
|
+
console.log(data);
|
|
25
|
+
|
|
26
|
+
app.use(serve(__dirname + '/dist/article'));
|
|
27
|
+
|
|
28
|
+
const server = app.listen(port, host, function()
|
|
29
|
+
{
|
|
30
|
+
console.log("Server running: " + __dirname + '/dist/article\n' +
|
|
31
|
+
`Access on http://${host}:${port}`
|
|
32
|
+
);
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
catch (err)
|
|
36
|
+
{
|
|
37
|
+
console.error(err);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else
|
|
41
|
+
{
|
|
42
|
+
console.error("Invalid input file: Must be a .yml file.")
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
program.parse()
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@explorable-viz/fluid",
|
|
3
|
+
"version": "0.0.23",
|
|
4
|
+
"description": "Fluid is an experimental programming language which integrates a bidirectional dynamic analysis to connect outputs to data sources in a fine-grained way. Fluid is implemented in PureScript and runs in the browser.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/explorable-viz/fluid.git#release"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"PureScript",
|
|
12
|
+
"JavaScript"
|
|
13
|
+
],
|
|
14
|
+
"author": "explorable-viz",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/explorable-viz/fluid/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://f.luid.org",
|
|
20
|
+
"files": ["dist/article/"],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"tidy": "./script/tidy.sh",
|
|
23
|
+
|
|
24
|
+
"build-app": "./script/build.sh app App",
|
|
25
|
+
"serve-app": "./script/serve.sh app",
|
|
26
|
+
|
|
27
|
+
"build-artifact": "./script/build.sh artifact Artifact",
|
|
28
|
+
"serve-artifact": "./script/serve.sh artifact",
|
|
29
|
+
|
|
30
|
+
"build-standalone-all": "./script/build-standalone-all.sh",
|
|
31
|
+
"build-standalone": "./script/build-standalone.sh",
|
|
32
|
+
|
|
33
|
+
"build-bench": "./script/build.sh bench Test.Benchmark",
|
|
34
|
+
"bench": "./script/serve.sh bench",
|
|
35
|
+
|
|
36
|
+
"build": "./script/build.sh test Test.Test",
|
|
37
|
+
"test": "./script/test.sh",
|
|
38
|
+
"test-browser": "./script/test.sh --browsers=Chrome --singleRun=false",
|
|
39
|
+
|
|
40
|
+
"build-puppeteer": "./script/build.sh test-puppeteer Test.Puppeteer --platform=node",
|
|
41
|
+
"test-puppeteer": "./script/test-puppeteer.sh",
|
|
42
|
+
|
|
43
|
+
"build-article": "./script/build-article.sh",
|
|
44
|
+
|
|
45
|
+
"npm-publish": "./script/npm-publish.sh"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@codemirror/commands": "6.2.2",
|
|
49
|
+
"@codemirror/state": "6.2.0",
|
|
50
|
+
"@codemirror/view": "6.9.3",
|
|
51
|
+
"benchmark": "^2.1.4",
|
|
52
|
+
"commander": "^12.1.0",
|
|
53
|
+
"d3": "^7.9.0",
|
|
54
|
+
"datetime": "^0.0.3",
|
|
55
|
+
"express": "^4.19.2",
|
|
56
|
+
"express-static": "^1.2.6",
|
|
57
|
+
"http-shutdown": "^1.2.2",
|
|
58
|
+
"node-process": "^1.0.1",
|
|
59
|
+
"purescript": "^0.15.10"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"esbuild": "0.15.1",
|
|
63
|
+
"gh-pages": "^6.1.1",
|
|
64
|
+
"karma": "6.4.0",
|
|
65
|
+
"karma-chrome-launcher": "3.1.1",
|
|
66
|
+
"karma-mocha": "2.0.1",
|
|
67
|
+
"karma-mocha-reporter": "2.2.5",
|
|
68
|
+
"mocha": "10.0.0",
|
|
69
|
+
"puppeteer": "^23.1.0",
|
|
70
|
+
"purescript-language-server": "0.16.6",
|
|
71
|
+
"purescript-psa": "0.8.2",
|
|
72
|
+
"purs-backend-es": "1.1.0",
|
|
73
|
+
"purs-tidy": "^0.9.3",
|
|
74
|
+
"spago": "^0.21.0",
|
|
75
|
+
"typescript": "^5.5.3"
|
|
76
|
+
},
|
|
77
|
+
"bin": {
|
|
78
|
+
"fluid": "./fluid.js"
|
|
79
|
+
}
|
|
80
|
+
}
|