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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
|
// build/dev/javascript/prelude.mjs
var CustomType = class {
withFields(fields) {
let properties = Object.keys(this).map(
(label2) => label2 in fields ? fields[label2] : this[label2]
);
return new this.constructor(...properties);
}
};
var List = class {
static fromArray(array3, tail) {
let t = tail || new Empty();
for (let i = array3.length - 1; i >= 0; --i) {
t = new NonEmpty(array3[i], t);
}
return t;
}
[Symbol.iterator]() {
return new ListIterator(this);
}
toArray() {
return [...this];
}
// @internal
atLeastLength(desired) {
for (let _ of this) {
if (desired <= 0)
return true;
desired--;
}
return desired <= 0;
}
// @internal
hasLength(desired) {
for (let _ of this) {
if (desired <= 0)
return false;
desired--;
}
return desired === 0;
}
countLength() {
let length2 = 0;
for (let _ of this)
length2++;
return length2;
}
};
function prepend(element3, tail) {
return new NonEmpty(element3, tail);
}
function toList(elements, tail) {
return List.fromArray(elements, tail);
}
var ListIterator = class {
#current;
constructor(current) {
this.#current = current;
}
next() {
if (this.#current instanceof Empty) {
return { done: true };
} else {
let { head, tail } = this.#current;
this.#current = tail;
return { value: head, done: false };
}
}
};
var Empty = class extends List {
};
var NonEmpty = class extends List {
constructor(head, tail) {
super();
this.head = head;
this.tail = tail;
}
};
var Result = class _Result extends CustomType {
// @internal
static isResult(data) {
return data instanceof _Result;
}
};
var Ok = class extends Result {
constructor(value) {
super();
this[0] = value;
}
// @internal
isOk() {
return true;
}
};
var Error = class extends Result {
constructor(detail) {
super();
this[0] = detail;
}
// @internal
isOk() {
return false;
}
};
function isEqual(x, y) {
let values = [x, y];
while (values.length) {
let a = values.pop();
let b = values.pop();
if (a === b)
continue;
if (!isObject(a) || !isObject(b))
return false;
let unequal = !structurallyCompatibleObjects(a, b) || unequalDates(a, b) || unequalBuffers(a, b) || unequalArrays(a, b) || unequalMaps(a, b) || unequalSets(a, b) || unequalRegExps(a, b);
if (unequal)
return false;
const proto = Object.getPrototypeOf(a);
if (proto !== null && typeof proto.equals === "function") {
try {
if (a.equals(b))
continue;
else
return false;
} catch {
}
}
let [keys2, get2] = getters(a);
for (let k of keys2(a)) {
values.push(get2(a, k), get2(b, k));
}
}
return true;
}
function getters(object3) {
if (object3 instanceof Map) {
return [(x) => x.keys(), (x, y) => x.get(y)];
} else {
let extra = object3 instanceof globalThis.Error ? ["message"] : [];
return [(x) => [...extra, ...Object.keys(x)], (x, y) => x[y]];
}
}
function unequalDates(a, b) {
return a instanceof Date && (a > b || a < b);
}
function unequalBuffers(a, b) {
return a.buffer instanceof ArrayBuffer && a.BYTES_PER_ELEMENT && !(a.byteLength === b.byteLength && a.every((n, i) => n === b[i]));
}
function unequalArrays(a, b) {
return Array.isArray(a) && a.length !== b.length;
}
function unequalMaps(a, b) {
return a instanceof Map && a.size !== b.size;
}
function unequalSets(a, b) {
return a instanceof Set && (a.size != b.size || [...a].some((e) => !b.has(e)));
}
function unequalRegExps(a, b) {
return a instanceof RegExp && (a.source !== b.source || a.flags !== b.flags);
}
function isObject(a) {
return typeof a === "object" && a !== null;
}
function structurallyCompatibleObjects(a, b) {
if (typeof a !== "object" && typeof b !== "object" && (!a || !b))
return false;
let nonstructural = [Promise, WeakSet, WeakMap, Function];
if (nonstructural.some((c) => a instanceof c))
return false;
return a.constructor === b.constructor;
}
function makeError(variant, module, line, fn, message, extra) {
let error = new globalThis.Error(message);
error.gleam_error = variant;
error.module = module;
error.line = line;
error.fn = fn;
for (let k in extra)
error[k] = extra[k];
return error;
}
// build/dev/javascript/gleam_stdlib/gleam/option.mjs
var None = class extends CustomType {
};
// build/dev/javascript/gleam_stdlib/dict.mjs
var tempDataView = new DataView(new ArrayBuffer(8));
var SHIFT = 5;
var BUCKET_SIZE = Math.pow(2, SHIFT);
var MASK = BUCKET_SIZE - 1;
var MAX_INDEX_NODE = BUCKET_SIZE / 2;
var MIN_ARRAY_NODE = BUCKET_SIZE / 4;
// build/dev/javascript/gleam_stdlib/gleam_stdlib.mjs
function identity(x) {
return x;
}
// build/dev/javascript/gleam_stdlib/gleam/list.mjs
function fold(loop$list, loop$initial, loop$fun) {
while (true) {
let list = loop$list;
let initial = loop$initial;
let fun = loop$fun;
if (list.hasLength(0)) {
return initial;
} else {
let x = list.head;
let rest$1 = list.tail;
loop$list = rest$1;
loop$initial = fun(initial, x);
loop$fun = fun;
}
}
}
// build/dev/javascript/gleam_stdlib/gleam/dynamic.mjs
function from(a) {
return identity(a);
}
// build/dev/javascript/gleam_stdlib/gleam/bool.mjs
function guard(requirement, consequence, alternative) {
if (requirement) {
return consequence;
} else {
return alternative();
}
}
// build/dev/javascript/lustre/lustre/effect.mjs
var Effect = class extends CustomType {
constructor(all) {
super();
this.all = all;
}
};
function none() {
return new Effect(toList([]));
}
// build/dev/javascript/lustre/lustre/internals/vdom.mjs
var Text = class extends CustomType {
constructor(content) {
super();
this.content = content;
}
};
var Element = class extends CustomType {
constructor(key, namespace, tag2, attrs, children, self_closing, void$) {
super();
this.key = key;
this.namespace = namespace;
this.tag = tag2;
this.attrs = attrs;
this.children = children;
this.self_closing = self_closing;
this.void = void$;
}
};
var Attribute = class extends CustomType {
constructor(x0, x1, as_property) {
super();
this[0] = x0;
this[1] = x1;
this.as_property = as_property;
}
};
// build/dev/javascript/lustre/lustre/attribute.mjs
function attribute(name, value) {
return new Attribute(name, from(value), false);
}
function style(properties) {
return attribute(
"style",
fold(
properties,
"",
(styles, _use1) => {
let name$1 = _use1[0];
let value$1 = _use1[1];
return styles + name$1 + ":" + value$1 + ";";
}
)
);
}
function class$(name) {
return attribute("class", name);
}
// build/dev/javascript/lustre/lustre/element.mjs
function element(tag2, attrs, children) {
if (tag2 === "area") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "base") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "br") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "col") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "embed") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "hr") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "img") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "input") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "link") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "meta") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "param") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "source") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "track") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else if (tag2 === "wbr") {
return new Element("", "", tag2, attrs, toList([]), false, true);
} else {
return new Element("", "", tag2, attrs, children, false, false);
}
}
function text(content) {
return new Text(content);
}
// build/dev/javascript/lustre/lustre/internals/runtime.mjs
var Dispatch = class extends CustomType {
constructor(x0) {
super();
this[0] = x0;
}
};
var Shutdown = class extends CustomType {
};
// build/dev/javascript/lustre/vdom.ffi.mjs
function morph(prev, next, dispatch, isComponent = false) {
let out;
let stack2 = [{ prev, next, parent: prev.parentNode }];
while (stack2.length) {
let { prev: prev2, next: next2, parent } = stack2.pop();
if (next2.subtree !== void 0)
next2 = next2.subtree();
if (next2.content !== void 0) {
if (!prev2) {
const created = document.createTextNode(next2.content);
parent.appendChild(created);
out ??= created;
} else if (prev2.nodeType === Node.TEXT_NODE) {
if (prev2.textContent !== next2.content)
prev2.textContent = next2.content;
out ??= prev2;
} else {
const created = document.createTextNode(next2.content);
parent.replaceChild(created, prev2);
out ??= created;
}
} else if (next2.tag !== void 0) {
const created = createElementNode({
prev: prev2,
next: next2,
dispatch,
stack: stack2,
isComponent
});
if (!prev2) {
parent.appendChild(created);
} else if (prev2 !== created) {
parent.replaceChild(created, prev2);
}
out ??= created;
}
}
return out;
}
function createElementNode({ prev, next, dispatch, stack: stack2 }) {
const namespace = next.namespace || "http://www.w3.org/1999/xhtml";
const canMorph = prev && prev.nodeType === Node.ELEMENT_NODE && prev.localName === next.tag && prev.namespaceURI === (next.namespace || "http://www.w3.org/1999/xhtml");
const el2 = canMorph ? prev : namespace ? document.createElementNS(namespace, next.tag) : document.createElement(next.tag);
let handlersForEl;
if (!registeredHandlers.has(el2)) {
const emptyHandlers = /* @__PURE__ */ new Map();
registeredHandlers.set(el2, emptyHandlers);
handlersForEl = emptyHandlers;
} else {
handlersForEl = registeredHandlers.get(el2);
}
const prevHandlers = canMorph ? new Set(handlersForEl.keys()) : null;
const prevAttributes = canMorph ? new Set(Array.from(prev.attributes, (a) => a.name)) : null;
let className = null;
let style2 = null;
let innerHTML = null;
for (const attr of next.attrs) {
const name = attr[0];
const value = attr[1];
const isProperty = attr[2];
if (isProperty) {
el2[name] = value;
} else if (name.startsWith("on")) {
const eventName = name.slice(2);
const callback = dispatch(value);
if (!handlersForEl.has(eventName)) {
el2.addEventListener(eventName, lustreGenericEventHandler);
}
handlersForEl.set(eventName, callback);
if (canMorph)
prevHandlers.delete(eventName);
} else if (name.startsWith("data-lustre-on-")) {
const eventName = name.slice(15);
const callback = dispatch(lustreServerEventHandler);
if (!handlersForEl.has(eventName)) {
el2.addEventListener(eventName, lustreGenericEventHandler);
}
handlersForEl.set(eventName, callback);
el2.setAttribute(name, value);
} else if (name === "class") {
className = className === null ? value : className + " " + value;
} else if (name === "style") {
style2 = style2 === null ? value : style2 + value;
} else if (name === "dangerous-unescaped-html") {
innerHTML = value;
} else {
el2.setAttribute(name, value);
if (name === "value")
el2[name] = value;
if (canMorph)
prevAttributes.delete(name);
}
}
if (className !== null) {
el2.setAttribute("class", className);
if (canMorph)
prevAttributes.delete("class");
}
if (style2 !== null) {
el2.setAttribute("style", style2);
if (canMorph)
prevAttributes.delete("style");
}
if (canMorph) {
for (const attr of prevAttributes) {
el2.removeAttribute(attr);
}
for (const eventName of prevHandlers) {
handlersForEl.delete(eventName);
el2.removeEventListener(eventName, lustreGenericEventHandler);
}
}
if (next.key !== void 0 && next.key !== "") {
el2.setAttribute("data-lustre-key", next.key);
} else if (innerHTML !== null) {
el2.innerHTML = innerHTML;
return el2;
}
let prevChild = el2.firstChild;
let seenKeys = null;
let keyedChildren = null;
let incomingKeyedChildren = null;
let firstChild = next.children[Symbol.iterator]().next().value;
if (canMorph && firstChild !== void 0 && // Explicit checks are more verbose but truthy checks force a bunch of comparisons
// we don't care about: it's never gonna be a number etc.
firstChild.key !== void 0 && firstChild.key !== "") {
seenKeys = /* @__PURE__ */ new Set();
keyedChildren = getKeyedChildren(prev);
incomingKeyedChildren = getKeyedChildren(next);
}
for (const child of next.children) {
if (child.key !== void 0 && seenKeys !== null) {
while (prevChild && !incomingKeyedChildren.has(prevChild.getAttribute("data-lustre-key"))) {
const nextChild = prevChild.nextSibling;
el2.removeChild(prevChild);
prevChild = nextChild;
}
if (keyedChildren.size === 0) {
stack2.unshift({ prev: prevChild, next: child, parent: el2 });
prevChild = prevChild?.nextSibling;
continue;
}
if (seenKeys.has(child.key)) {
console.warn(`Duplicate key found in Lustre vnode: ${child.key}`);
stack2.unshift({ prev: null, next: child, parent: el2 });
continue;
}
seenKeys.add(child.key);
const keyedChild = keyedChildren.get(child.key);
if (!keyedChild && !prevChild) {
stack2.unshift({ prev: null, next: child, parent: el2 });
continue;
}
if (!keyedChild && prevChild !== null) {
const placeholder = document.createTextNode("");
el2.insertBefore(placeholder, prevChild);
stack2.unshift({ prev: placeholder, next: child, parent: el2 });
continue;
}
if (!keyedChild || keyedChild === prevChild) {
stack2.unshift({ prev: prevChild, next: child, parent: el2 });
prevChild = prevChild?.nextSibling;
continue;
}
el2.insertBefore(keyedChild, prevChild);
stack2.unshift({ prev: keyedChild, next: child, parent: el2 });
} else {
stack2.unshift({ prev: prevChild, next: child, parent: el2 });
prevChild = prevChild?.nextSibling;
}
}
while (prevChild) {
const next2 = prevChild.nextSibling;
el2.removeChild(prevChild);
prevChild = next2;
}
return el2;
}
var registeredHandlers = /* @__PURE__ */ new WeakMap();
function lustreGenericEventHandler(event) {
const target = event.currentTarget;
if (!registeredHandlers.has(target)) {
target.removeEventListener(event.type, lustreGenericEventHandler);
return;
}
const handlersForEventTarget = registeredHandlers.get(target);
if (!handlersForEventTarget.has(event.type)) {
target.removeEventListener(event.type, lustreGenericEventHandler);
return;
}
handlersForEventTarget.get(event.type)(event);
}
function lustreServerEventHandler(event) {
const el2 = event.target;
const tag2 = el2.getAttribute(`data-lustre-on-${event.type}`);
const data = JSON.parse(el2.getAttribute("data-lustre-data") || "{}");
const include = JSON.parse(el2.getAttribute("data-lustre-include") || "[]");
switch (event.type) {
case "input":
case "change":
include.push("target.value");
break;
}
return {
tag: tag2,
data: include.reduce(
(data2, property) => {
const path = property.split(".");
for (let i = 0, o = data2, e = event; i < path.length; i++) {
if (i === path.length - 1) {
o[path[i]] = e[path[i]];
} else {
o[path[i]] ??= {};
e = e[path[i]];
o = o[path[i]];
}
}
return data2;
},
{ data }
)
};
}
function getKeyedChildren(el2) {
const keyedChildren = /* @__PURE__ */ new Map();
if (el2) {
for (const child of el2.children) {
const key = child.key || child?.getAttribute("data-lustre-key");
if (key)
keyedChildren.set(key, child);
}
}
return keyedChildren;
}
// build/dev/javascript/lustre/client-runtime.ffi.mjs
var LustreClientApplication2 = class _LustreClientApplication {
#root = null;
#queue = [];
#effects = [];
#didUpdate = false;
#isComponent = false;
#model = null;
#update = null;
#view = null;
static start(flags, selector, init2, update2, view) {
if (!is_browser())
return new Error(new NotABrowser());
const root2 = selector instanceof HTMLElement ? selector : document.querySelector(selector);
if (!root2)
return new Error(new ElementNotFound(selector));
const app = new _LustreClientApplication(init2(flags), update2, view, root2);
return new Ok((msg) => app.send(msg));
}
constructor([model, effects], update2, view, root2 = document.body, isComponent = false) {
this.#model = model;
this.#update = update2;
this.#view = view;
this.#root = root2;
this.#effects = effects.all.toArray();
this.#didUpdate = true;
this.#isComponent = isComponent;
window.requestAnimationFrame(() => this.#tick());
}
send(action) {
switch (true) {
case action instanceof Dispatch: {
this.#queue.push(action[0]);
this.#tick();
return;
}
case action instanceof Shutdown: {
this.#shutdown();
return;
}
default:
return;
}
}
emit(event, data) {
this.#root.dispatchEvent(
new CustomEvent(event, {
bubbles: true,
detail: data,
composed: true
})
);
}
#tick() {
this.#flush_queue();
const vdom = this.#view(this.#model);
const dispatch = (handler) => (e) => {
const result = handler(e);
if (result instanceof Ok) {
this.send(new Dispatch(result[0]));
}
};
this.#didUpdate = false;
this.#root = morph(this.#root, vdom, dispatch, this.#isComponent);
}
#flush_queue(iterations = 0) {
while (this.#queue.length) {
const [next, effects] = this.#update(this.#model, this.#queue.shift());
this.#didUpdate ||= !isEqual(this.#model, next);
this.#model = next;
this.#effects = this.#effects.concat(effects.all.toArray());
}
while (this.#effects.length) {
this.#effects.shift()(
(msg) => this.send(new Dispatch(msg)),
(event, data) => this.emit(event, data)
);
}
if (this.#queue.length) {
if (iterations < 5) {
this.#flush_queue(++iterations);
} else {
window.requestAnimationFrame(() => this.#tick());
}
}
}
#shutdown() {
this.#root.remove();
this.#root = null;
this.#model = null;
this.#queue = [];
this.#effects = [];
this.#didUpdate = false;
this.#update = () => {
};
this.#view = () => {
};
}
};
var start = (app, selector, flags) => LustreClientApplication2.start(
flags,
selector,
app.init,
app.update,
app.view
);
var is_browser = () => window && window.document;
// build/dev/javascript/lustre/lustre.mjs
var App = class extends CustomType {
constructor(init2, update2, view, on_attribute_change) {
super();
this.init = init2;
this.update = update2;
this.view = view;
this.on_attribute_change = on_attribute_change;
}
};
var ElementNotFound = class extends CustomType {
constructor(selector) {
super();
this.selector = selector;
}
};
var NotABrowser = class extends CustomType {
};
function application(init2, update2, view) {
return new App(init2, update2, view, new None());
}
function element2(html) {
let init2 = (_) => {
return [void 0, none()];
};
let update2 = (_, _1) => {
return [void 0, none()];
};
let view = (_) => {
return html;
};
return application(init2, update2, view);
}
function start3(app, selector, flags) {
return guard(
!is_browser(),
new Error(new NotABrowser()),
() => {
return start(app, selector, flags);
}
);
}
// build/dev/javascript/lustre/lustre/element/html.mjs
function h1(attrs, children) {
return element("h1", attrs, children);
}
function h2(attrs, children) {
return element("h2", attrs, children);
}
function div(attrs, children) {
return element("div", attrs, children);
}
// build/dev/javascript/lustre_ui/lustre/ui/layout/centre.mjs
function of2(element3, attributes, children) {
return element3(
prepend(class$("lustre-ui-centre"), attributes),
toList([children])
);
}
function centre(attributes, children) {
return of2(div, attributes, children);
}
// build/dev/javascript/gleam_community_colour/gleam_community/colour.mjs
var Rgba = class extends CustomType {
constructor(r, g, b, a) {
super();
this.r = r;
this.g = g;
this.b = b;
this.a = a;
}
};
var light_red = new Rgba(
0.9372549019607843,
0.1607843137254902,
0.1607843137254902,
1
);
var red = new Rgba(0.8, 0, 0, 1);
var dark_red = new Rgba(0.6431372549019608, 0, 0, 1);
var light_orange = new Rgba(
0.9882352941176471,
0.6862745098039216,
0.24313725490196078,
1
);
var orange = new Rgba(0.9607843137254902, 0.4745098039215686, 0, 1);
var dark_orange = new Rgba(
0.807843137254902,
0.3607843137254902,
0,
1
);
var light_yellow = new Rgba(
1,
0.9137254901960784,
0.30980392156862746,
1
);
var yellow = new Rgba(0.9294117647058824, 0.8313725490196079, 0, 1);
var dark_yellow = new Rgba(
0.7686274509803922,
0.6274509803921569,
0,
1
);
var light_green = new Rgba(
0.5411764705882353,
0.8862745098039215,
0.20392156862745098,
1
);
var green = new Rgba(
0.45098039215686275,
0.8235294117647058,
0.08627450980392157,
1
);
var dark_green = new Rgba(
0.3058823529411765,
0.6039215686274509,
0.023529411764705882,
1
);
var light_blue = new Rgba(
0.4470588235294118,
0.6235294117647059,
0.8117647058823529,
1
);
var blue = new Rgba(
0.20392156862745098,
0.396078431372549,
0.6431372549019608,
1
);
var dark_blue = new Rgba(
0.12549019607843137,
0.2901960784313726,
0.5294117647058824,
1
);
var light_purple = new Rgba(
0.6784313725490196,
0.4980392156862745,
0.6588235294117647,
1
);
var purple = new Rgba(
0.4588235294117647,
0.3137254901960784,
0.4823529411764706,
1
);
var dark_purple = new Rgba(
0.3607843137254902,
0.20784313725490197,
0.4,
1
);
var light_brown = new Rgba(
0.9137254901960784,
0.7254901960784313,
0.43137254901960786,
1
);
var brown = new Rgba(
0.7568627450980392,
0.49019607843137253,
0.06666666666666667,
1
);
var dark_brown = new Rgba(
0.5607843137254902,
0.34901960784313724,
0.00784313725490196,
1
);
var black = new Rgba(0, 0, 0, 1);
var white = new Rgba(1, 1, 1, 1);
var light_grey = new Rgba(
0.9333333333333333,
0.9333333333333333,
0.9254901960784314,
1
);
var grey = new Rgba(
0.8274509803921568,
0.8431372549019608,
0.8117647058823529,
1
);
var dark_grey = new Rgba(
0.7294117647058823,
0.7411764705882353,
0.7137254901960784,
1
);
var light_gray = new Rgba(
0.9333333333333333,
0.9333333333333333,
0.9254901960784314,
1
);
var gray = new Rgba(
0.8274509803921568,
0.8431372549019608,
0.8117647058823529,
1
);
var dark_gray = new Rgba(
0.7294117647058823,
0.7411764705882353,
0.7137254901960784,
1
);
var light_charcoal = new Rgba(
0.5333333333333333,
0.5411764705882353,
0.5215686274509804,
1
);
var charcoal = new Rgba(
0.3333333333333333,
0.3411764705882353,
0.3254901960784314,
1
);
var dark_charcoal = new Rgba(
0.1803921568627451,
0.20392156862745098,
0.21176470588235294,
1
);
var pink = new Rgba(1, 0.6862745098039216, 0.9529411764705882, 1);
// build/dev/javascript/lustre_ui/lustre/ui.mjs
var centre2 = centre;
// build/dev/javascript/app/app.mjs
function main() {
let styles = toList([
["width", "100vw"],
["height", "100vh"],
["padding", "1rem"]
]);
let app = element2(
centre2(
toList([style(styles)]),
div(
toList([]),
toList([
h1(toList([]), toList([text("Hello, world.")])),
h2(toList([]), toList([text("Welcome to Lustre.")]))
])
)
)
);
let $ = start3(app, "#app", void 0);
if (!$.isOk()) {
throw makeError(
"assignment_no_match",
"app",
17,
"main",
"Assignment pattern did not match",
{ value: $ }
);
}
return void 0;
}
// build/.lustre/entry.mjs
main();
|