git.iko.soy/purestack-dev/purescript-plum
on master help sign in
Switch to snabbdom
e03eaf5iko
plum/index.js+1464−1456
@@ -2,9 +2,9 @@
2 // output/Control.Semigroupoid/index.js
2 // output/Control.Semigroupoid/index.js
3 var semigroupoidFn = {
3 var semigroupoidFn = {
4 compose: function(f) {
4 compose: function(f) {
5− return function(g) {
5+ return function(g2) {
6− return function(x) {
6+ return function(x2) {
7− return f(g(x));
7+ return f(g2(x2));
8 };
8 };
9 };
9 };
10 }
10 }
@@ -15,8 +15,8 @@
15 return dict.identity;
15 return dict.identity;
16 };
16 };
17 var categoryFn = {
17 var categoryFn = {
18− identity: function(x) {
18+ identity: function(x2) {
19− return x;
19+ return x2;
20 },
20 },
21 Semigroupoid0: function() {
21 Semigroupoid0: function() {
22 return semigroupoidFn;
22 return semigroupoidFn;
@@ -28,30 +28,30 @@
28
28
29 // output/Data.Function/index.js
29 // output/Data.Function/index.js
30 var flip = function(f) {
30 var flip = function(f) {
31− return function(b) {
31+ return function(b2) {
32− return function(a) {
32+ return function(a2) {
33− return f(a)(b);
33+ return f(a2)(b2);
34 };
34 };
35 };
35 };
36 };
36 };
37− var $$const = function(a) {
37+ var $$const = function(a2) {
38− return function(v) {
38+ return function(v2) {
39− return a;
39+ return a2;
40 };
40 };
41 };
41 };
42− var applyFlipped = function(x) {
42+ var applyFlipped = function(x2) {
43 return function(f) {
43 return function(f) {
44− return f(x);
44+ return f(x2);
45 };
45 };
46 };
46 };
47
47
48 // output/Data.Functor/foreign.js
48 // output/Data.Functor/foreign.js
49 var arrayMap = function(f) {
49 var arrayMap = function(f) {
50 return function(arr) {
50 return function(arr) {
51− var l = arr.length;
51+ var l2 = arr.length;
52− var result = new Array(l);
52+ var result = new Array(l2);
53− for (var i = 0; i < l; i++) {
53+ for (var i2 = 0; i2 < l2; i2++) {
54− result[i] = f(arr[i]);
54+ result[i2] = f(arr[i2]);
55 }
55 }
56 return result;
56 return result;
57 };
57 };
@@ -73,6 +73,14 @@
73 var map = function(dict) {
73 var map = function(dict) {
74 return dict.map;
74 return dict.map;
75 };
75 };
76+ var mapFlipped = function(dictFunctor) {
77+ var map12 = map(dictFunctor);
78+ return function(fa) {
79+ return function(f) {
80+ return map12(f)(fa);
81+ };
82+ };
83+ };
76 var functorArray = {
84 var functorArray = {
77 map: arrayMap
85 map: arrayMap
78 };
86 };
@@ -85,9 +93,9 @@
85 var apply1 = apply(dictApply);
93 var apply1 = apply(dictApply);
86 var map4 = map(dictApply.Functor0());
94 var map4 = map(dictApply.Functor0());
87 return function(f) {
95 return function(f) {
88− return function(a) {
96+ return function(a2) {
89− return function(b) {
97+ return function(b2) {
90− return apply1(map4(f)(a))(b);
98+ return apply1(map4(f)(a2))(b2);
91 };
99 };
92 };
100 };
93 };
101 };
@@ -98,11 +106,11 @@
98 return dict.pure;
106 return dict.pure;
99 };
107 };
100 var liftA1 = function(dictApplicative) {
108 var liftA1 = function(dictApplicative) {
101− var apply2 = apply(dictApplicative.Apply0());
109+ var apply3 = apply(dictApplicative.Apply0());
102− var pure1 = pure(dictApplicative);
110+ var pure12 = pure(dictApplicative);
103 return function(f) {
111 return function(f) {
104− return function(a) {
112+ return function(a2) {
105− return apply2(pure1(f))(a);
113+ return apply3(pure12(f))(a2);
106 };
114 };
107 };
115 };
108 };
116 };
@@ -115,9 +123,9 @@
115 } : function(arr) {
123 } : function(arr) {
116 return function(f) {
124 return function(f) {
117 var result = [];
125 var result = [];
118− var l = arr.length;
126+ var l2 = arr.length;
119− for (var i = 0; i < l; i++) {
127+ for (var i2 = 0; i2 < l2; i2++) {
120− var xs = f(arr[i]);
128+ var xs = f(arr[i2]);
121 var k = xs.length;
129 var k = xs.length;
122 for (var j = 0; j < k; j++) {
130 for (var j = 0; j < k; j++) {
123 result.push(xs[j]);
131 result.push(xs[j]);
@@ -221,7 +229,7 @@
221
229
222 // output/Data.Semigroup/index.js
230 // output/Data.Semigroup/index.js
223 var semigroupUnit = {
231 var semigroupUnit = {
224− append: function(v) {
232+ append: function(v2) {
225 return function(v1) {
233 return function(v1) {
226 return unit;
234 return unit;
227 };
235 };
@@ -231,9 +239,9 @@
231 append: concatString
239 append: concatString
232 };
240 };
233 var semigroupRecordNil = {
241 var semigroupRecordNil = {
234− appendRecord: function(v) {
242+ appendRecord: function(v2) {
235 return function(v1) {
243 return function(v1) {
236− return function(v2) {
244+ return function(v22) {
237 return {};
245 return {};
238 };
246 };
239 };
247 };
@@ -263,7 +271,7 @@
263 return function(dictSemigroup) {
271 return function(dictSemigroup) {
264 var append1 = append(dictSemigroup);
272 var append1 = append(dictSemigroup);
265 return {
273 return {
266− appendRecord: function(v) {
274+ appendRecord: function(v2) {
267 return function(ra) {
275 return function(ra) {
268 return function(rb) {
276 return function(rb) {
269 var tail = appendRecord1($$Proxy.value)(ra)(rb);
277 var tail = appendRecord1($$Proxy.value)(ra)(rb);
@@ -295,7 +303,7 @@
295 }
303 }
296 };
304 };
297 var monoidRecordNil = {
305 var monoidRecordNil = {
298− memptyRecord: function(v) {
306+ memptyRecord: function(v2) {
299 return {};
307 return {};
300 },
308 },
301 SemigroupRecord0: function() {
309 SemigroupRecord0: function() {
@@ -336,7 +344,7 @@
336 var memptyRecord1 = memptyRecord(dictMonoidRecord);
344 var memptyRecord1 = memptyRecord(dictMonoidRecord);
337 var semigroupRecordCons1 = semigroupRecordCons3(dictMonoidRecord.SemigroupRecord0())(Semigroup0);
345 var semigroupRecordCons1 = semigroupRecordCons3(dictMonoidRecord.SemigroupRecord0())(Semigroup0);
338 return {
346 return {
339− memptyRecord: function(v) {
347+ memptyRecord: function(v2) {
340 var tail = memptyRecord1($$Proxy.value);
348 var tail = memptyRecord1($$Proxy.value);
341 var key = reflectSymbol2($$Proxy.value);
349 var key = reflectSymbol2($$Proxy.value);
342 var insert2 = unsafeSet(key);
350 var insert2 = unsafeSet(key);
@@ -352,15 +360,15 @@
352 };
360 };
353
361
354 // output/Effect/foreign.js
362 // output/Effect/foreign.js
355− var pureE = function(a) {
363+ var pureE = function(a2) {
356 return function() {
364 return function() {
357− return a;
365+ return a2;
358 };
366 };
359 };
367 };
360− var bindE = function(a) {
368+ var bindE = function(a2) {
361 return function(f) {
369 return function(f) {
362 return function() {
370 return function() {
363− return f(a())();
371+ return f(a2())();
364 };
372 };
365 };
373 };
366 };
374 };
@@ -368,12 +376,12 @@
368 // output/Control.Monad/index.js
376 // output/Control.Monad/index.js
369 var ap = function(dictMonad) {
377 var ap = function(dictMonad) {
370 var bind4 = bind(dictMonad.Bind1());
378 var bind4 = bind(dictMonad.Bind1());
371− var pure4 = pure(dictMonad.Applicative0());
379+ var pure5 = pure(dictMonad.Applicative0());
372 return function(f) {
380 return function(f) {
373− return function(a) {
381+ return function(a2) {
374 return bind4(f)(function(f$prime) {
382 return bind4(f)(function(f$prime) {
375− return bind4(a)(function(a$prime) {
383+ return bind4(a2)(function(a$prime) {
376− return pure4(f$prime(a$prime));
384+ return pure5(f$prime(a$prime));
377 });
385 });
378 });
386 });
379 };
387 };
@@ -381,14 +389,14 @@
381 };
389 };
382
390
383 // output/Effect/index.js
391 // output/Effect/index.js
384− var $runtime_lazy = function(name15, moduleName, init) {
392+ var $runtime_lazy = function(name15, moduleName, init3) {
385 var state3 = 0;
393 var state3 = 0;
386 var val;
394 var val;
387 return function(lineNumber) {
395 return function(lineNumber) {
388 if (state3 === 2) return val;
396 if (state3 === 2) return val;
389 if (state3 === 1) throw new ReferenceError(name15 + " was needed before it finished initializing (module " + moduleName + ", line " + lineNumber + ")", moduleName, lineNumber);
397 if (state3 === 1) throw new ReferenceError(name15 + " was needed before it finished initializing (module " + moduleName + ", line " + lineNumber + ")", moduleName, lineNumber);
390 state3 = 1;
398 state3 = 1;
391− val = init();
399+ val = init3();
392 state3 = 2;
400 state3 = 2;
393 return val;
401 return val;
394 };
402 };
@@ -438,24 +446,24 @@
438 };
446 };
439 var replicatePolyfill = function(count, value12) {
447 var replicatePolyfill = function(count, value12) {
440 var result = [];
448 var result = [];
441− var n = 0;
449+ var n2 = 0;
442− for (var i = 0; i < count; i++) {
450+ for (var i2 = 0; i2 < count; i2++) {
443− result[n++] = value12;
451+ result[n2++] = value12;
444 }
452 }
445 return result;
453 return result;
446 };
454 };
447 var replicateImpl = typeof Array.prototype.fill === "function" ? replicateFill : replicatePolyfill;
455 var replicateImpl = typeof Array.prototype.fill === "function" ? replicateFill : replicatePolyfill;
448− var indexImpl = function(just, nothing, xs, i) {
456+ var unconsImpl = function(empty3, next, xs) {
449− return i < 0 || i >= xs.length ? nothing : just(xs[i]);
457+ return xs.length === 0 ? empty3({}) : next(xs[0])(xs.slice(1));
450 };
458 };
451 var concat = function(xss) {
459 var concat = function(xss) {
452 if (xss.length <= 1e4) {
460 if (xss.length <= 1e4) {
453 return Array.prototype.concat.apply([], xss);
461 return Array.prototype.concat.apply([], xss);
454 }
462 }
455 var result = [];
463 var result = [];
456− for (var i = 0, l = xss.length; i < l; i++) {
464+ for (var i2 = 0, l2 = xss.length; i2 < l2; i2++) {
457− var xs = xss[i];
465+ var xs = xss[i2];
458− for (var j = 0, m2 = xs.length; j < m2; j++) {
466+ for (var j = 0, m3 = xs.length; j < m3; j++) {
459 result.push(xs[j]);
467 result.push(xs[j]);
460 }
468 }
461 }
469 }
@@ -474,9 +482,9 @@
474 var unsafeCompareImpl = function(lt) {
482 var unsafeCompareImpl = function(lt) {
475 return function(eq2) {
483 return function(eq2) {
476 return function(gt) {
484 return function(gt) {
477− return function(x) {
485+ return function(x2) {
478 return function(y) {
486 return function(y) {
479− return x < y ? lt : x === y ? eq2 : gt;
487+ return x2 < y ? lt : x2 === y ? eq2 : gt;
480 };
488 };
481 };
489 };
482 };
490 };
@@ -510,11 +518,11 @@
510 };
518 };
511
519
512 // output/Data.Show/foreign.js
520 // output/Data.Show/foreign.js
513− var showIntImpl = function(n) {
521+ var showIntImpl = function(n2) {
514− return n.toString();
522+ return n2.toString();
515 };
523 };
516− var showNumberImpl = function(n) {
524+ var showNumberImpl = function(n2) {
517− var str = n.toString();
525+ var str = n2.toString();
518 return isNaN(str + ".0") ? str : str + ".0";
526 return isNaN(str + ".0") ? str : str + ".0";
519 };
527 };
520
528
@@ -548,40 +556,40 @@
548 };
556 };
549 return Just2;
557 return Just2;
550 }();
558 }();
551− var maybe = function(v) {
559+ var maybe = function(v2) {
552 return function(v1) {
560 return function(v1) {
553− return function(v2) {
561+ return function(v22) {
554− if (v2 instanceof Nothing) {
562+ if (v22 instanceof Nothing) {
555− return v;
563+ return v2;
556 }
564 }
557 ;
565 ;
558− if (v2 instanceof Just) {
566+ if (v22 instanceof Just) {
559− return v1(v2.value0);
567+ return v1(v22.value0);
560 }
568 }
561 ;
569 ;
562− throw new Error("Failed pattern match at Data.Maybe (line 237, column 1 - line 237, column 51): " + [v.constructor.name, v1.constructor.name, v2.constructor.name]);
570+ throw new Error("Failed pattern match at Data.Maybe (line 237, column 1 - line 237, column 51): " + [v2.constructor.name, v1.constructor.name, v22.constructor.name]);
563 };
571 };
564 };
572 };
565 };
573 };
566− var fromMaybe = function(a) {
574+ var fromMaybe = function(a2) {
567− return maybe(a)(identity2);
575+ return maybe(a2)(identity2);
568 };
576 };
569
577
570 // output/Data.Identity/index.js
578 // output/Data.Identity/index.js
571− var Identity = function(x) {
579+ var Identity = function(x2) {
572− return x;
580+ return x2;
573 };
581 };
574 var functorIdentity = {
582 var functorIdentity = {
575 map: function(f) {
583 map: function(f) {
576− return function(m2) {
584+ return function(m3) {
577− return f(m2);
585+ return f(m3);
578 };
586 };
579 }
587 }
580 };
588 };
581 var applyIdentity = {
589 var applyIdentity = {
582− apply: function(v) {
590+ apply: function(v2) {
583 return function(v1) {
591 return function(v1) {
584− return v(v1);
592+ return v2(v1);
585 };
593 };
586 },
594 },
587 Functor0: function() {
595 Functor0: function() {
@@ -589,9 +597,9 @@
589 }
597 }
590 };
598 };
591 var bindIdentity = {
599 var bindIdentity = {
592− bind: function(v) {
600+ bind: function(v2) {
593 return function(f) {
601 return function(f) {
594− return f(v);
602+ return f(v2);
595 };
603 };
596 },
604 },
597 Apply0: function() {
605 Apply0: function() {
@@ -637,34 +645,34 @@
637
645
638 // output/Control.Monad.ST.Internal/foreign.js
646 // output/Control.Monad.ST.Internal/foreign.js
639 var map_ = function(f) {
647 var map_ = function(f) {
640− return function(a) {
648+ return function(a2) {
641 return function() {
649 return function() {
642− return f(a());
650+ return f(a2());
643 };
651 };
644 };
652 };
645 };
653 };
646− var pure_ = function(a) {
654+ var pure_ = function(a2) {
647 return function() {
655 return function() {
648− return a;
656+ return a2;
649 };
657 };
650 };
658 };
651− var bind_ = function(a) {
659+ var bind_ = function(a2) {
652 return function(f) {
660 return function(f) {
653 return function() {
661 return function() {
654− return f(a())();
662+ return f(a2())();
655 };
663 };
656 };
664 };
657 };
665 };
658
666
659 // output/Control.Monad.ST.Internal/index.js
667 // output/Control.Monad.ST.Internal/index.js
660− var $runtime_lazy2 = function(name15, moduleName, init) {
668+ var $runtime_lazy2 = function(name15, moduleName, init3) {
661 var state3 = 0;
669 var state3 = 0;
662 var val;
670 var val;
663 return function(lineNumber) {
671 return function(lineNumber) {
664 if (state3 === 2) return val;
672 if (state3 === 2) return val;
665 if (state3 === 1) throw new ReferenceError(name15 + " was needed before it finished initializing (module " + moduleName + ", line " + lineNumber + ")", moduleName, lineNumber);
673 if (state3 === 1) throw new ReferenceError(name15 + " was needed before it finished initializing (module " + moduleName + ", line " + lineNumber + ")", moduleName, lineNumber);
666 state3 = 1;
674 state3 = 1;
667− val = init();
675+ val = init3();
668 state3 = 2;
676 state3 = 2;
669 return val;
677 return val;
670 };
678 };
@@ -703,24 +711,24 @@
703
711
704 // output/Data.Foldable/foreign.js
712 // output/Data.Foldable/foreign.js
705 var foldrArray = function(f) {
713 var foldrArray = function(f) {
706− return function(init) {
714+ return function(init3) {
707 return function(xs) {
715 return function(xs) {
708− var acc = init;
716+ var acc = init3;
709 var len = xs.length;
717 var len = xs.length;
710− for (var i = len - 1; i >= 0; i--) {
718+ for (var i2 = len - 1; i2 >= 0; i2--) {
711− acc = f(xs[i])(acc);
719+ acc = f(xs[i2])(acc);
712 }
720 }
713 return acc;
721 return acc;
714 };
722 };
715 };
723 };
716 };
724 };
717 var foldlArray = function(f) {
725 var foldlArray = function(f) {
718− return function(init) {
726+ return function(init3) {
719 return function(xs) {
727 return function(xs) {
720− var acc = init;
728+ var acc = init3;
721 var len = xs.length;
729 var len = xs.length;
722− for (var i = 0; i < len; i++) {
730+ for (var i2 = 0; i2 < len; i2++) {
723− acc = f(acc)(xs[i]);
731+ acc = f(acc)(xs[i2]);
724 }
732 }
725 return acc;
733 return acc;
726 };
734 };
@@ -742,14 +750,14 @@
742 return Tuple2;
750 return Tuple2;
743 }();
751 }();
744 var uncurry = function(f) {
752 var uncurry = function(f) {
745− return function(v) {
753+ return function(v2) {
746− return f(v.value0)(v.value1);
754+ return f(v2.value0)(v2.value1);
747 };
755 };
748 };
756 };
749
757
750 // output/Unsafe.Coerce/foreign.js
758 // output/Unsafe.Coerce/foreign.js
751− var unsafeCoerce2 = function(x) {
759+ var unsafeCoerce2 = function(x2) {
752− return x;
760+ return x2;
753 };
761 };
754
762
755 // output/Safe.Coerce/index.js
763 // output/Safe.Coerce/index.js
@@ -777,9 +785,9 @@
777 var mempty6 = mempty(dictMonoid);
785 var mempty6 = mempty(dictMonoid);
778 return function(sep) {
786 return function(sep) {
779 return function(xs) {
787 return function(xs) {
780− var go2 = function(v) {
788+ var go2 = function(v2) {
781 return function(v1) {
789 return function(v1) {
782− if (v.init) {
790+ if (v2.init) {
783 return {
791 return {
784 init: false,
792 init: false,
785 acc: v1
793 acc: v1
@@ -788,7 +796,7 @@
788 ;
796 ;
789 return {
797 return {
790 init: false,
798 init: false,
791− acc: append3(v.acc)(append3(sep)(v1))
799+ acc: append3(v2.acc)(append3(sep)(v1))
792 };
800 };
793 };
801 };
794 };
802 };
@@ -806,9 +814,9 @@
806 var append3 = append(dictMonoid.Semigroup0());
814 var append3 = append(dictMonoid.Semigroup0());
807 var mempty6 = mempty(dictMonoid);
815 var mempty6 = mempty(dictMonoid);
808 return function(f) {
816 return function(f) {
809− return foldr22(function(x) {
817+ return foldr22(function(x2) {
810 return function(acc) {
818 return function(acc) {
811− return append3(f(x))(acc);
819+ return append3(f(x2))(acc);
812 };
820 };
813 })(mempty6);
821 })(mempty6);
814 };
822 };
@@ -823,19 +831,21 @@
823 };
831 };
824
832
825 // output/Data.Function.Uncurried/foreign.js
833 // output/Data.Function.Uncurried/foreign.js
826− var runFn2 = function(fn) {
834+ var runFn3 = function(fn) {
827− return function(a) {
835+ return function(a2) {
828− return function(b) {
836+ return function(b2) {
829− return fn(a, b);
837+ return function(c) {
838+ return fn(a2, b2, c);
839+ };
830 };
840 };
831 };
841 };
832 };
842 };
833 var runFn4 = function(fn) {
843 var runFn4 = function(fn) {
834− return function(a) {
844+ return function(a2) {
835− return function(b) {
845+ return function(b2) {
836 return function(c) {
846 return function(c) {
837 return function(d) {
847 return function(d) {
838− return fn(a, b, c, d);
848+ return fn(a2, b2, c, d);
839 };
849 };
840 };
850 };
841 };
851 };
@@ -844,18 +854,18 @@
844
854
845 // output/Data.Traversable/foreign.js
855 // output/Data.Traversable/foreign.js
846 var traverseArrayImpl = /* @__PURE__ */ function() {
856 var traverseArrayImpl = /* @__PURE__ */ function() {
847− function array1(a) {
857+ function array1(a2) {
848− return [a];
858+ return [a2];
849 }
859 }
850− function array2(a) {
860+ function array2(a2) {
851− return function(b) {
861+ return function(b2) {
852− return [a, b];
862+ return [a2, b2];
853 };
863 };
854 }
864 }
855− function array3(a) {
865+ function array3(a2) {
856− return function(b) {
866+ return function(b2) {
857 return function(c) {
867 return function(c) {
858− return [a, b, c];
868+ return [a2, b2, c];
859 };
869 };
860 };
870 };
861 }
871 }
@@ -864,24 +874,24 @@
864 return xs.concat(ys);
874 return xs.concat(ys);
865 };
875 };
866 }
876 }
867− return function(apply2) {
877+ return function(apply3) {
868 return function(map4) {
878 return function(map4) {
869− return function(pure4) {
879+ return function(pure5) {
870 return function(f) {
880 return function(f) {
871 return function(array) {
881 return function(array) {
872 function go2(bot, top3) {
882 function go2(bot, top3) {
873 switch (top3 - bot) {
883 switch (top3 - bot) {
874 case 0:
884 case 0:
875− return pure4([]);
885+ return pure5([]);
876 case 1:
886 case 1:
877 return map4(array1)(f(array[bot]));
887 return map4(array1)(f(array[bot]));
878 case 2:
888 case 2:
879− return apply2(map4(array2)(f(array[bot])))(f(array[bot + 1]));
889+ return apply3(map4(array2)(f(array[bot])))(f(array[bot + 1]));
880 case 3:
890 case 3:
881− return apply2(apply2(map4(array3)(f(array[bot])))(f(array[bot + 1])))(f(array[bot + 2]));
891+ return apply3(apply3(map4(array3)(f(array[bot])))(f(array[bot + 1])))(f(array[bot + 2]));
882 default:
892 default:
883 var pivot = bot + Math.floor((top3 - bot) / 4) * 2;
893 var pivot = bot + Math.floor((top3 - bot) / 4) * 2;
884− return apply2(map4(concat2)(go2(bot, pivot)))(go2(pivot, top3));
894+ return apply3(map4(concat2)(go2(bot, pivot)))(go2(pivot, top3));
885 }
895 }
886 }
896 }
887 return go2(0, array.length);
897 return go2(0, array.length);
@@ -921,853 +931,374 @@
921
931
922 // output/Data.Array/index.js
932 // output/Data.Array/index.js
923 var intercalate1 = /* @__PURE__ */ intercalate(foldableArray);
933 var intercalate1 = /* @__PURE__ */ intercalate(foldableArray);
934+ var uncons = /* @__PURE__ */ function() {
935+ return runFn3(unconsImpl)($$const(Nothing.value))(function(x2) {
936+ return function(xs) {
937+ return new Just({
938+ head: x2,
939+ tail: xs
940+ });
941+ };
942+ });
943+ }();
924 var intercalate2 = function(dictMonoid) {
944 var intercalate2 = function(dictMonoid) {
925 return intercalate1(dictMonoid);
945 return intercalate1(dictMonoid);
926 };
946 };
927− var index = /* @__PURE__ */ function() {
928− return runFn4(indexImpl)(Just.create)(Nothing.value);
929− }();
930− var head = function(xs) {
931− return index(xs)(0);
932− };
933
947
934− // output/Maquette/foreign.js
948+ // output/Foreign.Object/foreign.js
935− var NAMESPACE_W3 = "http://www.w3.org/";
949+ function _copyST(m3) {
936− var NAMESPACE_SVG = NAMESPACE_W3 + "2000/svg";
950+ return function() {
937− var NAMESPACE_XLINK = NAMESPACE_W3 + "1999/xlink";
951+ var r2 = {};
938− var emptyArray = [];
952+ for (var k in m3) {
939− var extend2 = function(base, overrides) {
953+ if (hasOwnProperty.call(m3, k)) {
940− var result = {};
954+ r2[k] = m3[k];
941− Object.keys(base).forEach(function(key) {
942− result[key] = base[key];
943− });
944− if (overrides) {
945− Object.keys(overrides).forEach(function(key) {
946− result[key] = overrides[key];
947− });
948− }
949− return result;
950− };
951− var same = function(vnode1, vnode2) {
952− if (vnode1.vnodeSelector !== vnode2.vnodeSelector) {
953− return false;
954− }
955− if (vnode1.properties && vnode2.properties) {
956− if (vnode1.properties.key !== vnode2.properties.key) {
957− return false;
958− }
959− return vnode1.properties.bind === vnode2.properties.bind;
960− }
961− return !vnode1.properties && !vnode2.properties;
962− };
963− var checkStyleValue = function(styleValue) {
964− if (typeof styleValue !== "string") {
965− throw new Error("Style values must be strings");
966− }
967− };
968− var findIndexOfChild = function(children, sameAs, start2) {
969− if (sameAs.vnodeSelector !== "") {
970− for (var i = start2; i < children.length; i++) {
971− if (same(children[i], sameAs)) {
972− return i;
973− }
974− }
975− }
976− return -1;
977− };
978− var checkDistinguishable = function(childNodes, indexToCheck, parentVNode, operation) {
979− var childNode = childNodes[indexToCheck];
980− if (childNode.vnodeSelector === "") {
981− return;
982− }
983− var properties = childNode.properties;
984− var key = properties ? properties.key === void 0 ? properties.bind : properties.key : void 0;
985− if (!key) {
986− for (var i = 0; i < childNodes.length; i++) {
987− if (i !== indexToCheck) {
988− var node = childNodes[i];
989− if (same(node, childNode)) {
990− throw {
991− error: new Error(parentVNode.vnodeSelector + " had a " + childNode.vnodeSelector + " child " + (operation === "added" ? operation : "removed") + ", but there is now more than one. You must add unique key properties to make them distinguishable."),
992− parentNode: parentVNode,
993− childNode
994− };
995− }
996 }
955 }
997 }
956 }
998− }
999− };
1000− var nodeAdded = function(vNode) {
1001− if (vNode.properties) {
1002− var enterAnimation = vNode.properties.enterAnimation;
1003− if (enterAnimation) {
1004− enterAnimation(vNode.domNode, vNode.properties);
1005− }
1006− }
1007− };
1008− var removedNodes = [];
1009− var requestedIdleCallback = false;
1010− var visitRemovedNode = function(node) {
1011− (node.children || []).forEach(visitRemovedNode);
1012− if (node.properties && node.properties.afterRemoved) {
1013− node.properties.afterRemoved.apply(node.properties.bind || node.properties, [
1014− node.domNode
1015− ]);
1016− }
1017− };
1018− var processPendingNodeRemovals = function() {
1019− requestedIdleCallback = false;
1020− removedNodes.forEach(visitRemovedNode);
1021− removedNodes.length = 0;
1022− };
1023− var scheduleNodeRemoval = function(vNode) {
1024− removedNodes.push(vNode);
1025− if (!requestedIdleCallback) {
1026− requestedIdleCallback = true;
1027− if (typeof window !== "undefined" && "requestIdleCallback" in window) {
1028− window.requestIdleCallback(processPendingNodeRemovals, { timeout: 16 });
1029− } else {
1030− setTimeout(processPendingNodeRemovals, 16);
1031− }
1032− }
1033− };
1034− var nodeToRemove = function(vNode) {
1035− var domNode = vNode.domNode;
1036− if (vNode.properties) {
1037− var exitAnimation = vNode.properties.exitAnimation;
1038− if (exitAnimation) {
1039− domNode.style.pointerEvents = "none";
1040− var removeDomNode = function() {
1041− if (domNode.parentNode) {
1042− domNode.parentNode.removeChild(domNode);
1043− scheduleNodeRemoval(vNode);
1044− }
1045− };
1046− exitAnimation(domNode, removeDomNode, vNode.properties);
1047− return;
957+ return r2;
1048− }
1049− }
1050− if (domNode.parentNode) {
1051− domNode.parentNode.removeChild(domNode);
1052− scheduleNodeRemoval(vNode);
1053− }
958+ };
1054− };
1055− var vnodeOnlyProps = [
1056− "afterCreate",
1057− "afterUpdate",
1058− "afterRemoved",
1059− "enterAnimation",
1060− "exitAnimation",
1061− "updateAnimation"
1062− ];
1063− function filterVNodeOnlyProps(name15) {
1064− return !vnodeOnlyProps.includes(name15);
1065 }
959 }
1066− var setProperties = function(domNode, properties, projectionOptions) {
960+ var empty2 = {};
1067− if (!properties) {
961+ function runST(f) {
1068− return;
962+ return f();
1069− }
963+ }
1070− var eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;
964+ function _fmapObject(m0, f) {
1071− var propNames = Object.keys(properties).filter(filterVNodeOnlyProps);
965+ var m3 = {};
1072− var propCount = propNames.length;
1073− for (var i = 0; i < propCount; i++) {
966+ for (var k in m0) {
1074− var propName = propNames[i];
967+ if (hasOwnProperty.call(m0, k)) {
1075− var propValue = properties[propName];
968+ m3[k] = f(m0[k]);
1076− if (propName === "className") {
1077− throw new Error('Property "className" is not supported, use "class".');
1078− } else if (propName === "class") {
1079− toggleClasses(domNode, propValue, true);
1080− } else if (propName === "classes") {
1081− var classNames = Object.keys(propValue);
1082− var classNameCount = classNames.length;
1083− for (var j = 0; j < classNameCount; j++) {
1084− var className = classNames[j];
1085− if (propValue[className]) {
1086− domNode.classList.add(className);
1087− }
1088− }
1089− } else if (propName === "styles") {
1090− var styleNames = Object.keys(propValue);
1091− var styleCount = styleNames.length;
1092− for (var j = 0; j < styleCount; j++) {
1093− var styleName = styleNames[j];
1094− var styleValue = propValue[styleName];
1095− if (styleValue) {
1096− checkStyleValue(styleValue);
1097− projectionOptions.styleApplyer(domNode, styleName, styleValue);
1098− }
1099− }
1100− } else if (propName === "on" && propValue) {
1101− for (var _i = 0, _a = Object.entries(properties.on); _i < _a.length; _i++) {
1102− var _b = _a[_i], key = _b[0], handler = _b[1];
1103− var listener = typeof handler === "function" ? handler : handler.listener;
1104− if (eventHandlerInterceptor) {
1105− listener = eventHandlerInterceptor(key, listener, domNode, properties);
1106− }
1107− if (listener) {
1108− domNode.addEventListener(key, listener, typeof handler === "function" ? void 0 : handler.options);
1109− }
1110− }
1111− } else if (propName !== "key" && propValue !== null && propValue !== void 0) {
1112− var type = typeof propValue;
1113− if (type === "function") {
1114− if (propName.lastIndexOf("on", 0) === 0) {
1115− if (eventHandlerInterceptor) {
1116− propValue = eventHandlerInterceptor(propName, propValue, domNode, properties);
1117− }
1118− }
1119− domNode[propName] = propValue;
1120− } else if (projectionOptions.namespace === NAMESPACE_SVG) {
1121− if (propName === "href") {
1122− domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);
1123− } else {
1124− domNode.setAttribute(propName, propValue);
1125− }
1126− } else if (type === "string" && propName !== "value" && propName !== "innerHTML") {
1127− domNode.setAttribute(propName, propValue);
1128− } else {
1129− domNode[propName] = propValue;
1130− }
1131− }
1132− }
1133− };
1134− var addChildren = function(domNode, children, projectionOptions) {
1135− if (!children) {
1136− return;
1137− }
1138− for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
1139− var child = children_1[_i];
1140− createDom(child, domNode, void 0, projectionOptions);
1141− }
1142− };
1143− var initPropertiesAndChildren = function(domNode, vnode, projectionOptions) {
1144− addChildren(domNode, vnode.children, projectionOptions);
1145− if (vnode.text) {
1146− domNode.textContent = vnode.text;
1147− }
1148− setProperties(domNode, vnode.properties, projectionOptions);
1149− if (vnode.properties && vnode.properties.afterCreate) {
1150− vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [
1151− domNode,
1152− projectionOptions,
1153− vnode.vnodeSelector,
1154− vnode.properties,
1155− vnode.children
1156− ]);
1157− }
1158− };
1159− var createDom = function(vnode, parentNode, insertBefore, projectionOptions) {
1160− var _a;
1161− var domNode;
1162− var start2 = 0;
1163− var vnodeSelector = vnode.vnodeSelector;
1164− var doc = parentNode.ownerDocument;
1165− if (vnodeSelector === "") {
1166− if (vnode.domNode) {
1167− vnode.domNode.nodeValue = vnode.text;
1168− } else {
1169− domNode = vnode.domNode = doc.createTextNode(vnode.text);
1170− if (insertBefore !== void 0) {
1171− parentNode.insertBefore(domNode, insertBefore);
1172− } else {
1173− parentNode.appendChild(domNode);
1174− }
1175− }
1176− } else {
1177− for (var i = 0; i <= vnodeSelector.length; ++i) {
1178− var c = vnodeSelector.charAt(i);
1179− if (i === vnodeSelector.length || c === "." || c === "#") {
1180− var type = vnodeSelector.charAt(start2 - 1);
1181− var found = vnodeSelector.slice(start2, i);
1182− if (type === ".") {
1183− domNode.classList.add(found);
1184− } else if (type === "#") {
1185− domNode.id = found;
1186− } else {
1187− if (found === "svg") {
1188− projectionOptions = extend2(projectionOptions, {
1189− namespace: NAMESPACE_SVG
1190− });
1191− }
1192− if (projectionOptions.namespace !== void 0) {
1193− domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);
1194− } else {
1195− domNode = vnode.domNode = vnode.domNode || (((_a = vnode.properties) === null || _a === void 0 ? void 0 : _a.is) ? doc.createElement(found, { is: vnode.properties.is }) : doc.createElement(found));
1196− if (found === "input" && vnode.properties && vnode.properties.type !== void 0) {
1197− domNode.setAttribute("type", vnode.properties.type);
1198− }
1199− }
1200− if (insertBefore !== void 0) {
1201− parentNode.insertBefore(domNode, insertBefore);
1202− } else if (domNode.parentNode !== parentNode) {
1203− parentNode.appendChild(domNode);
1204− }
1205− }
1206− start2 = i + 1;
1207− }
1208 }
969 }
1209− initPropertiesAndChildren(domNode, vnode, projectionOptions);
1210− }
1211− };
1212− var updateDom;
1213− var toggleClasses = function(domNode, classes, on2) {
1214− if (!classes) {
1215− return;
1216 }
970 }
1217− classes.split(" ").forEach(function(classToToggle) {
971+ return m3;
1218− if (classToToggle) {
972+ }
1219− domNode.classList.toggle(classToToggle, on2);
973+ function _mapWithKey(m0, f) {
974+ var m3 = {};
975+ for (var k in m0) {
976+ if (hasOwnProperty.call(m0, k)) {
977+ m3[k] = f(k)(m0[k]);
1220 }
978 }
1221− });
1222− };
1223− var updateProperties = function(domNode, previousProperties, properties, projectionOptions) {
1224− if (!properties) {
1225− return;
1226 }
979 }
1227− var propertiesUpdated = false;
980+ return m3;
1228− var propNames = Object.keys(properties).filter(filterVNodeOnlyProps);
981+ }
1229− var propCount = propNames.length;
982+ function _foldM(bind4) {
1230− for (var i = 0; i < propCount; i++) {
983+ return function(f) {
1231− var propName = propNames[i];
984+ return function(mz) {
1232− var propValue = properties[propName];
985+ return function(m3) {
1233− var previousValue = previousProperties[propName];
986+ var acc = mz;
1234− if (propName === "class") {
987+ function g2(k2) {
1235− if (previousValue !== propValue) {
988+ return function(z) {
1236− toggleClasses(domNode, previousValue, false);
989+ return f(z)(k2)(m3[k2]);
1237− toggleClasses(domNode, propValue, true);
990+ };
1238− }
1239− } else if (propName === "classes") {
1240− var classList = domNode.classList;
1241− var classNames = Object.keys(propValue);
1242− var classNameCount = classNames.length;
1243− for (var j = 0; j < classNameCount; j++) {
1244− var className = classNames[j];
1245− var on2 = !!propValue[className];
1246− var previousOn = !!previousValue[className];
1247− if (on2 === previousOn) {
1248− continue;
1249− }
1250− propertiesUpdated = true;
1251− if (on2) {
1252− classList.add(className);
1253− } else {
1254− classList.remove(className);
1255− }
1256− }
1257− } else if (propName === "styles") {
1258− var styleNames = Object.keys(propValue);
1259− var styleCount = styleNames.length;
1260− for (var j = 0; j < styleCount; j++) {
1261− var styleName = styleNames[j];
1262− var newStyleValue = propValue[styleName];
1263− var oldStyleValue = previousValue[styleName];
1264− if (newStyleValue === oldStyleValue) {
1265− continue;
1266− }
1267− propertiesUpdated = true;
1268− if (newStyleValue) {
1269− checkStyleValue(newStyleValue);
1270− projectionOptions.styleApplyer(domNode, styleName, newStyleValue);
1271− } else {
1272− projectionOptions.styleApplyer(domNode, styleName, "");
1273− }
1274− }
1275− } else {
1276− if (!propValue && typeof previousValue === "string") {
1277− propValue = "";
1278− }
1279− if (propName === "value") {
1280− var domValue = domNode[propName];
1281− if (domValue !== propValue && // The 'value' in the DOM tree !== newValue
1282− propValue !== previousValue) {
1283− domNode[propName] = propValue;
1284− }
1285− if (propValue !== previousValue) {
1286− propertiesUpdated = true;
1287 }
991 }
1288− } else if (propValue !== previousValue) {
992+ for (var k in m3) {
1289− var type = typeof propValue;
993+ if (hasOwnProperty.call(m3, k)) {
1290− if (type !== "function" || !projectionOptions.eventHandlerInterceptor) {
994+ acc = bind4(acc)(g2(k));
1291− if (projectionOptions.namespace === NAMESPACE_SVG) {
1292− if (propName === "href") {
1293− domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);
1294− } else {
1295− domNode.setAttribute(propName, propValue);
1296− }
1297− } else if (type === "string" && propName !== "innerHTML") {
1298− if (propName === "role" && propValue === "") {
1299− domNode.removeAttribute(propName);
1300− } else {
1301− domNode.setAttribute(propName, propValue);
1302− }
1303− } else if (domNode[propName] !== propValue) {
1304− domNode[propName] = propValue;
1305 }
995 }
1306− propertiesUpdated = true;
1307− }
1308− }
1309− }
1310− }
1311− return propertiesUpdated;
1312− };
1313− var updateChildren = function(vnode, domNode, oldChildren, newChildren, projectionOptions) {
1314− if (oldChildren === newChildren) {
1315− return false;
1316− }
1317− oldChildren = oldChildren || emptyArray;
1318− newChildren = newChildren || emptyArray;
1319− var oldChildrenLength = oldChildren.length;
1320− var newChildrenLength = newChildren.length;
1321− var oldIndex = 0;
1322− var newIndex = 0;
1323− var i;
1324− var textUpdated = false;
1325− while (newIndex < newChildrenLength) {
1326− var oldChild = oldIndex < oldChildrenLength ? oldChildren[oldIndex] : void 0;
1327− var newChild = newChildren[newIndex];
1328− if (oldChild !== void 0 && same(oldChild, newChild)) {
1329− textUpdated = updateDom(oldChild, newChild, projectionOptions, domNode, oldChildren) || textUpdated;
1330− oldIndex++;
1331− } else {
1332− var findOldIndex = findIndexOfChild(oldChildren, newChild, oldIndex + 1);
1333− if (findOldIndex >= 0) {
1334− for (i = oldIndex; i < findOldIndex; i++) {
1335− nodeToRemove(oldChildren[i]);
1336− checkDistinguishable(oldChildren, i, vnode, "removed");
1337− }
1338− textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions, domNode, oldChildren) || textUpdated;
1339− oldIndex = findOldIndex + 1;
1340− } else {
1341− createDom(newChild, domNode, oldIndex < oldChildrenLength ? oldChildren[oldIndex].domNode : void 0, projectionOptions);
1342− nodeAdded(newChild);
1343− checkDistinguishable(newChildren, newIndex, vnode, "added");
1344− }
1345− }
1346− newIndex++;
1347− }
1348− if (oldChildrenLength > oldIndex) {
1349− for (i = oldIndex; i < oldChildrenLength; i++) {
1350− nodeToRemove(oldChildren[i]);
1351− checkDistinguishable(oldChildren, i, vnode, "removed");
1352− }
1353− }
1354− return textUpdated;
1355− };
1356− updateDom = function(previous, vnode, projectionOptions, parentNode, oldChildren) {
1357− var domNode = previous.domNode;
1358− var textUpdated = false;
1359− if (previous === vnode) {
1360− return false;
1361− }
1362− var updated = false;
1363− if (vnode.vnodeSelector === "") {
1364− if (vnode.text !== previous.text) {
1365− var newTextNode = domNode.ownerDocument.createTextNode(vnode.text);
1366− try {
1367− parentNode.replaceChild(newTextNode, domNode);
1368− } catch (e) {
1369− parentNode.replaceChild(newTextNode, parentNode.childNodes[oldChildren.indexOf(previous)]);
1370− }
1371− vnode.domNode = newTextNode;
1372− textUpdated = true;
1373− return textUpdated;
1374− }
1375− vnode.domNode = domNode;
1376− } else {
1377− if (vnode.vnodeSelector.lastIndexOf("svg", 0) === 0) {
1378− projectionOptions = extend2(projectionOptions, {
1379− namespace: NAMESPACE_SVG
1380− });
1381− }
1382− if (previous.text !== vnode.text) {
1383− updated = true;
1384− if (vnode.text === void 0) {
1385− domNode.removeChild(domNode.firstChild);
1386− } else {
1387− domNode.textContent = vnode.text;
1388− }
1389− }
1390− vnode.domNode = domNode;
1391− updated = updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) || updated;
1392− updated = updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) || updated;
1393− if (vnode.properties && vnode.properties.afterUpdate) {
1394− vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [
1395− domNode,
1396− projectionOptions,
1397− vnode.vnodeSelector,
1398− vnode.properties,
1399− vnode.children
1400− ]);
1401− }
1402− }
1403− if (updated && vnode.properties && vnode.properties.updateAnimation) {
1404− vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);
1405− }
1406− return textUpdated;
1407− };
1408− var createProjection = function(vnode, projectionOptions) {
1409− return {
1410− getLastRender: function() {
1411− return vnode;
1412− },
1413− update: function(updatedVnode) {
1414− if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {
1415− throw new Error("The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)");
1416− }
1417− var previousVNode = vnode;
1418− vnode = updatedVnode;
1419− updateDom(previousVNode, updatedVnode, projectionOptions, previousVNode.domNode.parentNode, [previousVNode]);
1420− },
1421− domNode: vnode.domNode
1422− };
1423− };
1424− var DEFAULT_PROJECTION_OPTIONS = {
1425− namespace: void 0,
1426− performanceLogger: function() {
1427− return void 0;
1428− },
1429− eventHandlerInterceptor: void 0,
1430− styleApplyer: function(domNode, styleName, value12) {
1431− if (styleName.charAt(0) === "-") {
1432− domNode.style.setProperty(styleName, value12);
1433− } else {
1434− domNode.style[styleName] = value12;
1435− }
1436− }
1437− };
1438− var applyDefaultProjectionOptions = function(projectorOptions) {
1439− return extend2(DEFAULT_PROJECTION_OPTIONS, projectorOptions);
1440− };
1441− var dom = {
1442− /**
1443− * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in
1444− * its [[Projection.domNode|domNode]] property.
1445− * This is a low-level method. Users will typically use a [[Projector]] instead.
1446− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
1447− * objects may only be rendered once.
1448− * @param projectionOptions - Options to be used to create and update the projection.
1449− * @returns The [[Projection]] which also contains the DOM Node that was created.
1450− */
1451− create: function(vnode, projectionOptions) {
1452− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1453− createDom(vnode, document.createElement("div"), void 0, projectionOptions);
1454− return createProjection(vnode, projectionOptions);
1455− },
1456− /**
1457− * Appends a new child node to the DOM which is generated from a [[VNode]].
1458− * This is a low-level method. Users will typically use a [[Projector]] instead.
1459− * @param parentNode - The parent node for the new child node.
1460− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
1461− * objects may only be rendered once.
1462− * @param projectionOptions - Options to be used to create and update the [[Projection]].
1463− * @returns The [[Projection]] that was created.
1464− */
1465− append: function(parentNode, vnode, projectionOptions) {
1466− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1467− createDom(vnode, parentNode, void 0, projectionOptions);
1468− return createProjection(vnode, projectionOptions);
1469− },
1470− /**
1471− * Inserts a new DOM node which is generated from a [[VNode]].
1472− * This is a low-level method. Users wil typically use a [[Projector]] instead.
1473− * @param beforeNode - The node that the DOM Node is inserted before.
1474− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.
1475− * NOTE: [[VNode]] objects may only be rendered once.
1476− * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].
1477− * @returns The [[Projection]] that was created.
1478− */
1479− insertBefore: function(beforeNode, vnode, projectionOptions) {
1480− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1481− createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);
1482− return createProjection(vnode, projectionOptions);
1483− },
1484− /**
1485− * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.
1486− * This means that the virtual DOM and the real DOM will have one overlapping element.
1487− * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.
1488− * This is a low-level method. Users wil typically use a [[Projector]] instead.
1489− * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.
1490− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects
1491− * may only be rendered once.
1492− * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].
1493− * @returns The [[Projection]] that was created.
1494− */
1495− merge: function(element, vnode, projectionOptions) {
1496− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1497− vnode.domNode = element;
1498− initPropertiesAndChildren(element, vnode, projectionOptions);
1499− return createProjection(vnode, projectionOptions);
1500− },
1501− /**
1502− * Replaces an existing DOM node with a node generated from a [[VNode]].
1503− * This is a low-level method. Users will typically use a [[Projector]] instead.
1504− * @param element - The node for the [[VNode]] to replace.
1505− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
1506− * objects may only be rendered once.
1507− * @param projectionOptions - Options to be used to create and update the [[Projection]].
1508− * @returns The [[Projection]] that was created.
1509− */
1510− replace: function(element, vnode, projectionOptions) {
1511− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
1512− createDom(vnode, element.parentNode, element, projectionOptions);
1513− element.parentNode.removeChild(element);
1514− return createProjection(vnode, projectionOptions);
1515− }
1516− };
1517− var toTextVNode = function(data) {
1518− return {
1519− vnodeSelector: "",
1520− properties: void 0,
1521− children: void 0,
1522− text: data.toString(),
1523− domNode: null
1524− };
1525− };
1526− var appendChildren = function(parentSelector, insertions, main2) {
1527− for (var i = 0, length_1 = insertions.length; i < length_1; i++) {
1528− var item = insertions[i];
1529− if (Array.isArray(item)) {
1530− appendChildren(parentSelector, item, main2);
1531− } else {
1532− if (item !== null && item !== void 0 && item !== false) {
1533− if (typeof item === "string") {
1534− item = toTextVNode(item);
1535 }
996 }
1536− main2.push(item);
1537− }
1538− }
1539− }
1540− };
1541− function h(selector, properties, children) {
1542− if (Array.isArray(properties)) {
1543− children = properties;
1544− properties = void 0;
1545− } else if (properties && (typeof properties === "string" || properties.vnodeSelector) || children && (typeof children === "string" || children.vnodeSelector)) {
1546− throw new Error("h called with invalid arguments");
1547− }
1548− var text6;
1549− var flattenedChildren;
1550− if (children && children.length === 1 && typeof children[0] === "string") {
1551− text6 = children[0];
1552− } else if (children) {
1553− flattenedChildren = [];
1554− appendChildren(selector, children, flattenedChildren);
1555− if (flattenedChildren.length === 0) {
1556− flattenedChildren = void 0;
1557− }
1558− }
1559− return {
997+ return acc;
1560− vnodeSelector: selector,
998+ };
1561− properties,
999+ };
1562− children: flattenedChildren,
1563− text: text6 === "" ? void 0 : text6,
1564− domNode: null
1565 };
1000 };
1566 }
1001 }
1567− var createParentNodePath = function(node, rootNode) {
1002+ function _lookup(no, yes, k, m3) {
1568− var parentNodePath = [];
1003+ return k in m3 ? yes(m3[k]) : no;
1569− while (node && node !== rootNode) {
1570− parentNodePath.push(node);
1571− node = node.parentNode;
1572− }
1573− return parentNodePath;
1574− };
1575− var find2;
1576− if (Array.prototype.find) {
1577− find2 = function(items, predicate) {
1578− return items.find(predicate);
1579− };
1580− } else {
1581− find2 = function(items, predicate) {
1582− return items.filter(predicate)[0];
1583− };
1584 }
1004 }
1585− var findVNodeByParentNodePath = function(vnode, parentNodePath) {
1005+ function toArrayWithKey(f) {
1586− var result = vnode;
1587− parentNodePath.forEach(function(node) {
1588− result = result && result.children ? find2(result.children, function(child) {
1589− return child.domNode === node;
1590− }) : void 0;
1591− });
1592− return result;
1593− };
1594− var createEventHandlerInterceptor = function(projector, getProjection, performanceLogger) {
1595− return function(propertyName, eventHandler, domNode, properties) {
1596− return modifiedEventHandler;
1597− };
1598− function modifiedEventHandler(evt) {
1599− var _a, _b;
1600− performanceLogger("domEvent", evt);
1601− var projection = getProjection();
1602− var parentNodePath = createParentNodePath(evt.currentTarget, projection.domNode);
1603− parentNodePath.reverse();
1604− var matchingVNode = findVNodeByParentNodePath(projection.getLastRender(), parentNodePath);
1605− projector.scheduleRender();
1606− var result;
1607− if (matchingVNode) {
1608− var listener = (_b = (_a = matchingVNode.properties["on" + evt.type]) !== null && _a !== void 0 ? _a : matchingVNode.properties.on[evt.type].listener) !== null && _b !== void 0 ? _b : matchingVNode.properties.on[evt.type];
1609− result = listener.apply(matchingVNode.properties.bind || this, arguments);
1610− }
1611− performanceLogger("domEventProcessed", evt);
1612− return result;
1613− }
1614− };
1615− var createProjector = function(projectorOptions) {
1616− var projector;
1617− var projectionOptions = applyDefaultProjectionOptions(projectorOptions);
1618− var performanceLogger = projectionOptions.performanceLogger;
1619− var renderCompleted = true;
1620− var scheduled;
1621− var stopped = false;
1622− var projections = [];
1623− var renderFunctions = [];
1624− var addProjection = function(domFunction, node, renderFunction) {
1625− var projection;
1626− var getProjection = function() {
1627− return projection;
1628− };
1629− projectionOptions.eventHandlerInterceptor = createEventHandlerInterceptor(projector, getProjection, performanceLogger);
1630− projection = domFunction(node, renderFunction(), projectionOptions);
1631− projections.push(projection);
1632− renderFunctions.push(renderFunction);
1633− };
1634− var doRender = function() {
1635− scheduled = void 0;
1636− if (!renderCompleted) {
1637− return;
1638− }
1639− renderCompleted = false;
1640− performanceLogger("renderStart", void 0);
1641− for (var i = 0; i < projections.length; i++) {
1642− var updatedVnode = renderFunctions[i]();
1643− performanceLogger("rendered", void 0);
1644− projections[i].update(updatedVnode);
1645− performanceLogger("patched", void 0);
1646− }
1647− performanceLogger("renderDone", void 0);
1648− renderCompleted = true;
1649− };
1650− projector = {
1651− renderNow: doRender,
1652− scheduleRender: function() {
1653− if (!scheduled && !stopped) {
1654− scheduled = requestAnimationFrame(doRender);
1655− }
1656− },
1657− stop: function() {
1658− if (scheduled) {
1659− cancelAnimationFrame(scheduled);
1660− scheduled = void 0;
1661− }
1662− stopped = true;
1663− },
1664− resume: function() {
1006+ return function(m3) {
1665− stopped = false;
1007+ var r2 = [];
1666− renderCompleted = true;
1008+ for (var k in m3) {
1667− projector.scheduleRender();
1009+ if (hasOwnProperty.call(m3, k)) {
1668− },
1010+ r2.push(f(k)(m3[k]));
1669− append: function(parentNode, renderFunction) {
1670− addProjection(dom.append, parentNode, renderFunction);
1671− },
1672− insertBefore: function(beforeNode, renderFunction) {
1673− addProjection(dom.insertBefore, beforeNode, renderFunction);
1674− },
1675− merge: function(domNode, renderFunction) {
1676− addProjection(dom.merge, domNode, renderFunction);
1677− },
1678− replace: function(domNode, renderFunction) {
1679− addProjection(dom.replace, domNode, renderFunction);
1680− },
1681− detach: function(renderFunction) {
1682− for (var i = 0; i < renderFunctions.length; i++) {
1683− if (renderFunctions[i] === renderFunction) {
1684− renderFunctions.splice(i, 1);
1685− return projections.splice(i, 1)[0];
1686− }
1687 }
1011 }
1688− throw new Error("renderFunction was not found");
1689 }
1012 }
1690− };
1691− return projector;
1692− };
1693− function _h(selector) {
1694− return function(properties) {
1695− return function(children) {
1013+ return r2;
1696− return h(selector, properties, children);
1697− };
1698 };
1014 };
1699 }
1015 }
1700− function scheduleRender(projector) {
1016+ var keys = Object.keys || toArrayWithKey(function(k) {
1701 return function() {
1017 return function() {
1702− projector.scheduleRender();
1018+ return k;
1703 };
1019 };
1704− }
1020+ });
1021+
1022+ // output/Data.TraversableWithIndex/index.js
1023+ var traverseWithIndex = function(dict) {
1024+ return dict.traverseWithIndex;
1025+ };
1026+
1027+ // output/Foreign.Object.ST/foreign.js
1028+ var newImpl = function() {
1029+ return {};
1030+ };
1705− function replace(projector) {
1031+ function poke2(k) {
1706− return function(el) {
1032+ return function(v2) {
1707− return function(render4) {
1033+ return function(m3) {
1708 return function() {
1034 return function() {
1709− projector.replace(el, render4);
1035+ m3[k] = v2;
1036+ return m3;
1710 };
1037 };
1711 };
1038 };
1712 };
1039 };
1713 }
1040 }
1714
1041
1715− // output/Maquette/index.js
1042+ // output/Foreign.Object/index.js
1716− var string = unsafeCoerce2;
1043+ var bindFlipped2 = /* @__PURE__ */ bindFlipped(bindST);
1717− var h2 = _h;
1044+ var foldr2 = /* @__PURE__ */ foldr(foldableArray);
1718−
1045+ var identity4 = /* @__PURE__ */ identity(categoryFn);
1719− // output/Control.Monad.Writer.Class/index.js
1046+ var values = /* @__PURE__ */ toArrayWithKey(function(v2) {
1720− var tell = function(dict) {
1721− return dict.tell;
1047+ return function(v1) {
1048+ return v1;
1049+ };
1722− };
1050+ });
1723−
1051+ var thawST = _copyST;
1724− // output/Control.Monad.Writer.Trans/index.js
1725− var WriterT = function(x) {
1052+ var singleton2 = function(k) {
1726− return x;
1053+ return function(v2) {
1054+ return runST(bindFlipped2(poke2(k)(v2))(newImpl));
1055+ };
1727 };
1056 };
1728− var runWriterT = function(v) {
1057+ var mutate = function(f) {
1729− return v;
1058+ return function(m3) {
1059+ return runST(function __do() {
1060+ var s2 = thawST(m3)();
1061+ f(s2)();
1062+ return s2;
1063+ });
1064+ };
1730 };
1065 };
1731− var mapWriterT = function(f) {
1066+ var mapWithKey = function(f) {
1732− return function(v) {
1067+ return function(m3) {
1733− return f(v);
1068+ return _mapWithKey(m3, f);
1734 };
1069 };
1735 };
1070 };
1736− var functorWriterT = function(dictFunctor) {
1071+ var insert = function(k) {
1737− var map4 = map(dictFunctor);
1738− return {
1739− map: function(f) {
1072+ return function(v2) {
1740− return mapWriterT(map4(function(v) {
1073+ return mutate(poke2(k)(v2));
1741− return new Tuple(f(v.value0), v.value1);
1742− }));
1743− }
1744 };
1074 };
1745 };
1075 };
1746− var applyWriterT = function(dictSemigroup) {
1076+ var functorObject = {
1747− var append3 = append(dictSemigroup);
1748− return function(dictApply) {
1749− var apply2 = apply(dictApply);
1750− var Functor0 = dictApply.Functor0();
1751− var map4 = map(Functor0);
1752− var functorWriterT1 = functorWriterT(Functor0);
1753− return {
1754− apply: function(v) {
1077+ map: function(f) {
1755− return function(v1) {
1078+ return function(m3) {
1756− var k = function(v3) {
1079+ return _fmapObject(m3, f);
1757− return function(v4) {
1758− return new Tuple(v3.value0(v4.value0), append3(v3.value1)(v4.value1));
1759− };
1760− };
1761− return apply2(map4(k)(v))(v1);
1762− };
1763− },
1764− Functor0: function() {
1765− return functorWriterT1;
1766− }
1767 };
1080 };
1768− };
1081+ }
1769 };
1082 };
1083+ var functorWithIndexObject = {
1084+ mapWithIndex: mapWithKey,
1085+ Functor0: function() {
1086+ return functorObject;
1087+ }
1088+ };
1089+ var fromHomogeneous = function() {
1090+ return unsafeCoerce2;
1091+ };
1092+ var foldM = function(dictMonad) {
1093+ var bind1 = bind(dictMonad.Bind1());
1094+ var pure12 = pure(dictMonad.Applicative0());
1095+ return function(f) {
1096+ return function(z) {
1097+ return _foldM(bind1)(f)(pure12(z));
1098+ };
1099+ };
1100+ };
1101+ var foldM1 = /* @__PURE__ */ foldM(monadST);
1102+ var union = function(m3) {
1103+ return mutate(function(s2) {
1104+ return foldM1(function(s$prime) {
1105+ return function(k) {
1106+ return function(v2) {
1107+ return poke2(k)(v2)(s$prime);
1108+ };
1109+ };
1110+ })(s2)(m3);
1111+ });
1112+ };
1113+ var unionWith = function(f) {
1114+ return function(m1) {
1115+ return function(m22) {
1116+ return mutate(function(s1) {
1117+ return foldM1(function(s2) {
1118+ return function(k) {
1119+ return function(v1) {
1120+ return poke2(k)(_lookup(v1, function(v2) {
1121+ return f(v1)(v2);
1122+ }, k, m22))(s2);
1123+ };
1124+ };
1125+ })(s1)(m1);
1126+ })(m22);
1127+ };
1128+ };
1129+ };
1130+ var semigroupObject = function(dictSemigroup) {
1131+ return {
1132+ append: unionWith(append(dictSemigroup))
1133+ };
1134+ };
1135+ var monoidObject = function(dictSemigroup) {
1136+ var semigroupObject1 = semigroupObject(dictSemigroup);
1137+ return {
1138+ mempty: empty2,
1139+ Semigroup0: function() {
1140+ return semigroupObject1;
1141+ }
1142+ };
1143+ };
1144+ var fold2 = /* @__PURE__ */ _foldM(applyFlipped);
1145+ var foldMap2 = function(dictMonoid) {
1146+ var append1 = append(dictMonoid.Semigroup0());
1147+ var mempty6 = mempty(dictMonoid);
1148+ return function(f) {
1149+ return fold2(function(acc) {
1150+ return function(k) {
1151+ return function(v2) {
1152+ return append1(acc)(f(k)(v2));
1153+ };
1154+ };
1155+ })(mempty6);
1156+ };
1157+ };
1158+ var foldableObject = {
1159+ foldl: function(f) {
1160+ return fold2(function(z) {
1161+ return function(v2) {
1162+ return f(z);
1163+ };
1164+ });
1165+ },
1166+ foldr: function(f) {
1167+ return function(z) {
1168+ return function(m3) {
1169+ return foldr2(f)(z)(values(m3));
1170+ };
1171+ };
1172+ },
1173+ foldMap: function(dictMonoid) {
1174+ var foldMap12 = foldMap2(dictMonoid);
1175+ return function(f) {
1176+ return foldMap12($$const(f));
1177+ };
1178+ }
1179+ };
1180+ var foldableWithIndexObject = {
1181+ foldlWithIndex: function(f) {
1182+ return fold2(flip(f));
1183+ },
1184+ foldrWithIndex: function(f) {
1185+ return function(z) {
1186+ return function(m3) {
1187+ return foldr2(uncurry(f))(z)(toArrayWithKey(Tuple.create)(m3));
1188+ };
1189+ };
1190+ },
1191+ foldMapWithIndex: function(dictMonoid) {
1192+ return foldMap2(dictMonoid);
1193+ },
1194+ Foldable0: function() {
1195+ return foldableObject;
1196+ }
1197+ };
1198+ var traversableWithIndexObject = {
1199+ traverseWithIndex: function(dictApplicative) {
1200+ var Apply0 = dictApplicative.Apply0();
1201+ var apply3 = apply(Apply0);
1202+ var map4 = map(Apply0.Functor0());
1203+ var pure12 = pure(dictApplicative);
1204+ return function(f) {
1205+ return function(ms) {
1206+ return fold2(function(acc) {
1207+ return function(k) {
1208+ return function(v2) {
1209+ return apply3(map4(flip(insert(k)))(acc))(f(k)(v2));
1210+ };
1211+ };
1212+ })(pure12(empty2))(ms);
1213+ };
1214+ };
1215+ },
1216+ FunctorWithIndex0: function() {
1217+ return functorWithIndexObject;
1218+ },
1219+ FoldableWithIndex1: function() {
1220+ return foldableWithIndexObject;
1221+ },
1222+ Traversable2: function() {
1223+ return traversableObject;
1224+ }
1225+ };
1226+ var traversableObject = {
1227+ traverse: function(dictApplicative) {
1228+ var $96 = traverseWithIndex(traversableWithIndexObject)(dictApplicative);
1229+ return function($97) {
1230+ return $96($$const($97));
1231+ };
1232+ },
1233+ sequence: function(dictApplicative) {
1234+ return traverse(traversableObject)(dictApplicative)(identity4);
1235+ },
1236+ Functor0: function() {
1237+ return functorObject;
1238+ },
1239+ Foldable1: function() {
1240+ return foldableObject;
1241+ }
1242+ };
1243+
1244+ // output/Literals.Undefined/foreign.js
1245+ var _undefined = void 0;
1246+
1247+ // output/Literals.Undefined/index.js
1248+ var $$undefined = _undefined;
1249+
1250+ // output/Control.Monad.Writer.Class/index.js
1251+ var tell = function(dict) {
1252+ return dict.tell;
1253+ };
1254+
1255+ // output/Control.Monad.Writer.Trans/index.js
1256+ var WriterT = function(x2) {
1257+ return x2;
1258+ };
1259+ var runWriterT = function(v2) {
1260+ return v2;
1261+ };
1262+ var mapWriterT = function(f) {
1263+ return function(v2) {
1264+ return f(v2);
1265+ };
1266+ };
1267+ var functorWriterT = function(dictFunctor) {
1268+ var map4 = map(dictFunctor);
1269+ return {
1270+ map: function(f) {
1271+ return mapWriterT(map4(function(v2) {
1272+ return new Tuple(f(v2.value0), v2.value1);
1273+ }));
1274+ }
1275+ };
1276+ };
1277+ var applyWriterT = function(dictSemigroup) {
1278+ var append3 = append(dictSemigroup);
1279+ return function(dictApply) {
1280+ var apply3 = apply(dictApply);
1281+ var Functor0 = dictApply.Functor0();
1282+ var map4 = map(Functor0);
1283+ var functorWriterT1 = functorWriterT(Functor0);
1284+ return {
1285+ apply: function(v2) {
1286+ return function(v1) {
1287+ var k = function(v3) {
1288+ return function(v4) {
1289+ return new Tuple(v3.value0(v4.value0), append3(v3.value1)(v4.value1));
1290+ };
1291+ };
1292+ return apply3(map4(k)(v2))(v1);
1293+ };
1294+ },
1295+ Functor0: function() {
1296+ return functorWriterT1;
1297+ }
1298+ };
1299+ };
1300+ };
1770− var bindWriterT = function(dictSemigroup) {
1301+ var bindWriterT = function(dictSemigroup) {
1771 var append3 = append(dictSemigroup);
1302 var append3 = append(dictSemigroup);
1772 var applyWriterT1 = applyWriterT(dictSemigroup);
1303 var applyWriterT1 = applyWriterT(dictSemigroup);
1773 return function(dictBind) {
1304 return function(dictBind) {
@@ -1776,13 +1307,13 @@
1776 var map4 = map(Apply0.Functor0());
1307 var map4 = map(Apply0.Functor0());
1777 var applyWriterT2 = applyWriterT1(Apply0);
1308 var applyWriterT2 = applyWriterT1(Apply0);
1778 return {
1309 return {
1779− bind: function(v) {
1310+ bind: function(v2) {
1780 return function(k) {
1311 return function(k) {
1781− return bind4(v)(function(v1) {
1312+ return bind4(v2)(function(v1) {
1782− var v2 = k(v1.value0);
1313+ var v22 = k(v1.value0);
1783 return map4(function(v3) {
1314 return map4(function(v3) {
1784 return new Tuple(v3.value0, append3(v1.value1)(v3.value1));
1315 return new Tuple(v3.value0, append3(v1.value1)(v3.value1));
1785− })(v2);
1316+ })(v22);
1786 });
1317 });
1787 };
1318 };
1788 },
1319 },
@@ -1806,11 +1337,11 @@
1806 var mempty6 = mempty(dictMonoid);
1337 var mempty6 = mempty(dictMonoid);
1807 var applyWriterT1 = applyWriterT(dictMonoid.Semigroup0());
1338 var applyWriterT1 = applyWriterT(dictMonoid.Semigroup0());
1808 return function(dictApplicative) {
1339 return function(dictApplicative) {
1809− var pure4 = pure(dictApplicative);
1340+ var pure5 = pure(dictApplicative);
1810 var applyWriterT2 = applyWriterT1(dictApplicative.Apply0());
1341 var applyWriterT2 = applyWriterT1(dictApplicative.Apply0());
1811 return {
1342 return {
1812− pure: function(a) {
1343+ pure: function(a2) {
1813− return pure4(new Tuple(a, mempty6));
1344+ return pure5(new Tuple(a2, mempty6));
1814 },
1345 },
1815 Apply0: function() {
1346 Apply0: function() {
1816 return applyWriterT2;
1347 return applyWriterT2;
@@ -1859,12 +1390,12 @@
1859 var monoidWriterT = function(dictApplicative) {
1390 var monoidWriterT = function(dictApplicative) {
1860 var semigroupWriterT1 = semigroupWriterT(dictApplicative.Apply0());
1391 var semigroupWriterT1 = semigroupWriterT(dictApplicative.Apply0());
1861 return function(dictMonoid) {
1392 return function(dictMonoid) {
1862− var pure4 = pure(applicativeWriterT(dictMonoid)(dictApplicative));
1393+ var pure5 = pure(applicativeWriterT(dictMonoid)(dictApplicative));
1863 var semigroupWriterT2 = semigroupWriterT1(dictMonoid.Semigroup0());
1394 var semigroupWriterT2 = semigroupWriterT1(dictMonoid.Semigroup0());
1864 return function(dictMonoid1) {
1395 return function(dictMonoid1) {
1865 var semigroupWriterT3 = semigroupWriterT2(dictMonoid1.Semigroup0());
1396 var semigroupWriterT3 = semigroupWriterT2(dictMonoid1.Semigroup0());
1866 return {
1397 return {
1867− mempty: pure4(mempty(dictMonoid1)),
1398+ mempty: pure5(mempty(dictMonoid1)),
1868 Semigroup0: function() {
1399 Semigroup0: function() {
1869 return semigroupWriterT3;
1400 return semigroupWriterT3;
1870 }
1401 }
@@ -1882,13 +1413,13 @@
1882 // output/Data.Int/foreign.js
1413 // output/Data.Int/foreign.js
1883 var fromNumberImpl = function(just) {
1414 var fromNumberImpl = function(just) {
1884 return function(nothing) {
1415 return function(nothing) {
1885− return function(n) {
1416+ return function(n2) {
1886− return (n | 0) === n ? just(n) : nothing;
1417+ return (n2 | 0) === n2 ? just(n2) : nothing;
1887 };
1418 };
1888 };
1419 };
1889 };
1420 };
1890− var toNumber = function(n) {
1421+ var toNumber = function(n2) {
1891− return n;
1422+ return n2;
1892 };
1423 };
1893
1424
1894 // output/Data.Number/foreign.js
1425 // output/Data.Number/foreign.js
@@ -1901,340 +1432,423 @@
1901 var fromNumber = /* @__PURE__ */ function() {
1432 var fromNumber = /* @__PURE__ */ function() {
1902 return fromNumberImpl(Just.create)(Nothing.value);
1433 return fromNumberImpl(Just.create)(Nothing.value);
1903 }();
1434 }();
1904− var unsafeClamp = function(x) {
1435+ var unsafeClamp = function(x2) {
1905− if (!isFiniteImpl(x)) {
1436+ if (!isFiniteImpl(x2)) {
1906 return 0;
1437 return 0;
1907 }
1438 }
1908 ;
1439 ;
1909− if (x >= toNumber(top2)) {
1440+ if (x2 >= toNumber(top2)) {
1910 return top2;
1441 return top2;
1911 }
1442 }
1912 ;
1443 ;
1913− if (x <= toNumber(bottom2)) {
1444+ if (x2 <= toNumber(bottom2)) {
1914 return bottom2;
1445 return bottom2;
1915 }
1446 }
1916 ;
1447 ;
1917 if (otherwise) {
1448 if (otherwise) {
1918− return fromMaybe(0)(fromNumber(x));
1449+ return fromMaybe(0)(fromNumber(x2));
1919 }
1450 }
1920 ;
1451 ;
1921− throw new Error("Failed pattern match at Data.Int (line 72, column 1 - line 72, column 29): " + [x.constructor.name]);
1452+ throw new Error("Failed pattern match at Data.Int (line 72, column 1 - line 72, column 29): " + [x2.constructor.name]);
1922 };
1453 };
1923 var round2 = function($37) {
1454 var round2 = function($37) {
1924 return unsafeClamp(round($37));
1455 return unsafeClamp(round($37));
1925 };
1456 };
1926
1457
1927− // output/Data.TraversableWithIndex/index.js
1458+ // output/Data.String.Common/foreign.js
1928− var traverseWithIndex = function(dict) {
1459+ var replaceAll = function(s1) {
1929− return dict.traverseWithIndex;
1460+ return function(s2) {
1461+ return function(s3) {
1462+ return s3.replace(new RegExp(s1.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), "g"), s2);
1463+ };
1464+ };
1930 };
1465 };
1931
1466
1932− // output/Foreign.Object/foreign.js
1467+ // output/Snabbdom/foreign.js
1933− function _copyST(m2) {
1468+ function h(z, J) {
1469+ let P, G = J.elm, X2 = z.data.attrs, $ = J.data.attrs;
1934− return function() {
1470+ if (!X2 && !$) return;
1935− var r = {};
1471+ if (X2 === $) return;
1472+ X2 = X2 || {}, $ = $ || {};
1936− for (var k in m2) {
1473+ for (P in $) {
1937− if (hasOwnProperty.call(m2, k)) {
1474+ let U = $[P];
1938− r[k] = m2[k];
1475+ if (X2[P] !== U) if (U === true) G.setAttribute(P, "");
1939− }
1476+ else if (U === false) G.removeAttribute(P);
1940− }
1477+ else if (P.charCodeAt(0) !== 120) G.setAttribute(P, U);
1941− return r;
1478+ else if (P.charCodeAt(3) === 58) G.setAttributeNS("http://www.w3.org/XML/1998/namespace", P, U);
1479+ else if (P.charCodeAt(5) === 58) P.charCodeAt(1) === 109 ? G.setAttributeNS("http://www.w3.org/2000/xmlns/", P, U) : G.setAttributeNS("http://www.w3.org/1999/xlink", P, U);
1480+ else G.setAttribute(P, U);
1942− };
1481+ }
1482+ for (P in X2) if (!(P in $)) G.removeAttribute(P);
1943 }
1483 }
1944− var empty2 = {};
1484+ var v = { create: h, update: h };
1945− function runST(f) {
1485+ function i(z, J, P) {
1946− return f();
1486+ if (typeof z === "function") z.call(J, P, J);
1487+ else if (typeof z === "object") for (let G = 0; G < z.length; G++) i(z[G], J, P);
1947 }
1488 }
1948− function _fmapObject(m0, f) {
1489+ function e(z, J) {
1949− var m2 = {};
1490+ let P = z.type, G = J.data.on;
1950− for (var k in m0) {
1491+ if (G && G[P]) i(G[P], J, z);
1951− if (hasOwnProperty.call(m0, k)) {
1952− m2[k] = f(m0[k]);
1953− }
1954− }
1955− return m2;
1956 }
1492 }
1957− function _mapWithKey(m0, f) {
1493+ function zz() {
1958− var m2 = {};
1494+ return function z(J) {
1959− for (var k in m0) {
1495+ e(J, z.vnode);
1960− if (hasOwnProperty.call(m0, k)) {
1496+ };
1961− m2[k] = f(k)(m0[k]);
1497+ }
1962− }
1498+ function E(z, J) {
1499+ let P = z.data.on, G = z.listener, X2 = z.elm, $ = J && J.data.on, U = J && J.elm, L;
1500+ if (P === $) return;
1501+ if (P && G) {
1502+ if (!$) for (L in P) X2.removeEventListener(L, G, false);
1503+ else for (L in P) if (!$[L]) X2.removeEventListener(L, G, false);
1504+ }
1505+ if ($) {
1506+ let F = J.listener = z.listener || zz();
1507+ if (F.vnode = J, !P) for (L in $) U.addEventListener(L, F, false);
1508+ else for (L in $) if (!P[L]) U.addEventListener(L, F, false);
1963 }
1509 }
1964− return m2;
1965 }
1510 }
1966− function _foldM(bind4) {
1511+ var m = { create: E, update: E, destroy: E };
1967− return function(f) {
1968− return function(mz) {
1969− return function(m2) {
1970− var acc = mz;
1971− function g(k2) {
1512+ function C(z, J, P, G, X2) {
1972− return function(z) {
1513+ let $ = J === void 0 ? void 0 : J.key;
1973− return f(z)(k2)(m2[k2]);
1514+ return { sel: z, data: J, children: P, text: G, elm: X2, key: $ };
1974− };
1975− }
1976− for (var k in m2) {
1977− if (hasOwnProperty.call(m2, k)) {
1978− acc = bind4(acc)(g(k));
1979− }
1980− }
1981− return acc;
1982− };
1983− };
1984− };
1985 }
1515 }
1516+ var w = Array.isArray;
1986− function _lookup(no, yes, k, m2) {
1517+ function s(z) {
1987− return k in m2 ? yes(m2[k]) : no;
1518+ return typeof z === "string" || typeof z === "number" || z instanceof String || z instanceof Number;
1988 }
1519 }
1989− function toArrayWithKey(f) {
1520+ function Jz(z, J) {
1990− return function(m2) {
1521+ return document.createElement(z, J);
1991− var r = [];
1992− for (var k in m2) {
1993− if (hasOwnProperty.call(m2, k)) {
1994− r.push(f(k)(m2[k]));
1995− }
1996− }
1997− return r;
1998− };
1999 }
1522 }
2000− var keys = Object.keys || toArrayWithKey(function(k) {
2001− return function() {
1523+ function Pz(z, J, P) {
2002− return k;
1524+ return document.createElementNS(z, J, P);
2003− };
2004− });
2005−
2006− // output/Foreign.Object.ST/foreign.js
2007− var newImpl = function() {
2008− return {};
2009− };
2010− function poke2(k) {
2011− return function(v) {
2012− return function(m2) {
2013− return function() {
2014− m2[k] = v;
2015− return m2;
2016− };
2017− };
2018− };
2019 }
1525 }
2020−
1526+ function Wz() {
2021− // output/Foreign.Object/index.js
1527+ return g(document.createDocumentFragment());
2022− var bindFlipped2 = /* @__PURE__ */ bindFlipped(bindST);
1528+ }
2023− var foldr2 = /* @__PURE__ */ foldr(foldableArray);
1529+ function Xz(z) {
2024− var identity4 = /* @__PURE__ */ identity(categoryFn);
1530+ return document.createTextNode(z);
2025− var values = /* @__PURE__ */ toArrayWithKey(function(v) {
2026− return function(v1) {
2027− return v1;
2028− };
2029− });
1531+ }
2030− var thawST = _copyST;
1532+ function Yz(z) {
2031− var singleton2 = function(k) {
1533+ return document.createComment(z);
2032− return function(v) {
1534+ }
2033− return runST(bindFlipped2(poke2(k)(v))(newImpl));
1535+ function Zz(z, J, P) {
2034− };
1536+ if (b(z)) {
1537+ let G = z;
1538+ while (G && b(G)) G = g(G).parent;
1539+ z = G !== null && G !== void 0 ? G : z;
2035− };
1540+ }
2036− var mutate = function(f) {
1541+ if (b(J)) J = g(J, z);
2037− return function(m2) {
1542+ if (P && b(P)) P = g(P).firstChildNode;
2038− return runST(function __do() {
1543+ z.insertBefore(J, P);
2039− var s = thawST(m2)();
2040− f(s)();
2041− return s;
2042− });
1544+ }
2043− };
1545+ function $z(z, J) {
1546+ z.removeChild(J);
2044− };
1547+ }
2045− var mapWithKey = function(f) {
1548+ function Bz(z, J) {
2046− return function(m2) {
1549+ if (b(J)) J = g(J, z);
2047− return _mapWithKey(m2, f);
1550+ z.appendChild(J);
2048− };
2049− };
1551+ }
2050− var insert = function(k) {
1552+ function r(z) {
2051− return function(v) {
1553+ if (b(z)) {
2052− return mutate(poke2(k)(v));
1554+ while (z && b(z)) z = g(z).parent;
2053− };
1555+ return z !== null && z !== void 0 ? z : null;
2054− };
2055− var functorObject = {
2056− map: function(f) {
2057− return function(m2) {
2058− return _fmapObject(m2, f);
2059− };
2060− }
2061− };
2062− var functorWithIndexObject = {
2063− mapWithIndex: mapWithKey,
2064− Functor0: function() {
2065− return functorObject;
2066 }
1556 }
1557+ return z.parentNode;
2067− };
1558+ }
2068− var foldM = function(dictMonad) {
1559+ function qz(z) {
2069− var bind1 = bind(dictMonad.Bind1());
1560+ var J;
2070− var pure1 = pure(dictMonad.Applicative0());
1561+ if (b(z)) {
2071− return function(f) {
1562+ let P = g(z), G = r(P);
2072− return function(z) {
1563+ if (G && P.lastChildNode) {
2073− return _foldM(bind1)(f)(pure1(z));
1564+ let X2 = Array.from(G.childNodes), $ = X2.indexOf(P.lastChildNode);
2074− };
1565+ return (J = X2[$ + 1]) !== null && J !== void 0 ? J : null;
2075− };
2076− };
2077− var foldM1 = /* @__PURE__ */ foldM(monadST);
2078− var union = function(m2) {
2079− return mutate(function(s) {
2080− return foldM1(function(s$prime) {
2081− return function(k) {
2082− return function(v) {
2083− return poke2(k)(v)(s$prime);
2084− };
2085− };
2086− })(s)(m2);
2087− });
2088− };
2089− var unionWith = function(f) {
2090− return function(m1) {
2091− return function(m2) {
2092− return mutate(function(s1) {
2093− return foldM1(function(s2) {
2094− return function(k) {
2095− return function(v1) {
2096− return poke2(k)(_lookup(v1, function(v2) {
2097− return f(v1)(v2);
2098− }, k, m2))(s2);
2099− };
2100− };
2101− })(s1)(m1);
2102− })(m2);
2103− };
2104− };
2105− };
2106− var semigroupObject = function(dictSemigroup) {
2107− return {
2108− append: unionWith(append(dictSemigroup))
2109− };
2110− };
2111− var monoidObject = function(dictSemigroup) {
2112− var semigroupObject1 = semigroupObject(dictSemigroup);
2113− return {
2114− mempty: empty2,
2115− Semigroup0: function() {
2116− return semigroupObject1;
2117 }
1566 }
2118− };
1567+ return null;
2119− };
2120− var fold2 = /* @__PURE__ */ _foldM(applyFlipped);
2121− var foldMap2 = function(dictMonoid) {
2122− var append1 = append(dictMonoid.Semigroup0());
2123− var mempty6 = mempty(dictMonoid);
2124− return function(f) {
2125− return fold2(function(acc) {
2126− return function(k) {
2127− return function(v) {
2128− return append1(acc)(f(k)(v));
2129− };
2130− };
2131− })(mempty6);
2132− };
2133− };
2134− var foldableObject = {
2135− foldl: function(f) {
2136− return fold2(function(z) {
2137− return function(v) {
2138− return f(z);
2139− };
2140− });
2141− },
2142− foldr: function(f) {
2143− return function(z) {
2144− return function(m2) {
2145− return foldr2(f)(z)(values(m2));
2146− };
2147− };
2148− },
2149− foldMap: function(dictMonoid) {
2150− var foldMap1 = foldMap2(dictMonoid);
2151− return function(f) {
2152− return foldMap1($$const(f));
2153− };
2154 }
1568 }
1569+ return z.nextSibling;
2155− };
1570+ }
2156− var foldableWithIndexObject = {
1571+ function Kz(z) {
1572+ return z.tagName;
1573+ }
2157− foldlWithIndex: function(f) {
1574+ function Uz(z, J) {
2158− return fold2(flip(f));
1575+ z.textContent = J;
2159− },
1576+ }
2160− foldrWithIndex: function(f) {
1577+ function Hz(z) {
1578+ return z.textContent;
1579+ }
2161− return function(z) {
1580+ function Oz(z) {
1581+ return z.nodeType === 1;
1582+ }
2162− return function(m2) {
1583+ function Rz(z) {
2163− return foldr2(uncurry(f))(z)(toArrayWithKey(Tuple.create)(m2));
1584+ return z.nodeType === 3;
2164− };
1585+ }
2165− };
1586+ function Az(z) {
2166− },
1587+ return z.nodeType === 8;
2167− foldMapWithIndex: function(dictMonoid) {
2168− return foldMap2(dictMonoid);
2169− },
1588+ }
2170− Foldable0: function() {
1589+ function b(z) {
2171− return foldableObject;
1590+ return z.nodeType === 11;
2172− }
2173− };
1591+ }
2174− var traversableWithIndexObject = {
1592+ function g(z, J) {
2175− traverseWithIndex: function(dictApplicative) {
1593+ var P, G, X2;
2176− var Apply0 = dictApplicative.Apply0();
1594+ let $ = z;
2177− var apply2 = apply(Apply0);
1595+ return (P = $.parent) !== null && P !== void 0 || ($.parent = J !== null && J !== void 0 ? J : null), (G = $.firstChildNode) !== null && G !== void 0 || ($.firstChildNode = z.firstChild), (X2 = $.lastChildNode) !== null && X2 !== void 0 || ($.lastChildNode = z.lastChild), $;
2178− var map4 = map(Apply0.Functor0());
1596+ }
2179− var pure1 = pure(dictApplicative);
1597+ var l = { createElement: Jz, createElementNS: Pz, createTextNode: Xz, createDocumentFragment: Wz, createComment: Yz, insertBefore: Zz, removeChild: $z, appendChild: Bz, parentNode: r, nextSibling: qz, tagName: Kz, setTextContent: Uz, getTextContent: Hz, isElement: Oz, isText: Rz, isComment: Az, isDocumentFragment: b };
1598+ var x = C("", {}, [], void 0, void 0);
2180− return function(f) {
1599+ function I(z, J) {
2181− return function(ms) {
1600+ var P, G;
2182− return fold2(function(acc) {
1601+ let X2 = z.key === J.key, $ = ((P = z.data) === null || P === void 0 ? void 0 : P.is) === ((G = J.data) === null || G === void 0 ? void 0 : G.is), U = z.sel === J.sel, L = !z.sel && z.sel === J.sel ? typeof z.text === typeof J.text : true;
2183− return function(k) {
1602+ return U && X2 && $ && L;
2184− return function(v) {
1603+ }
2185− return apply2(map4(flip(insert(k)))(acc))(f(k)(v));
1604+ function Mz() {
1605+ throw new Error("The document fragment is not supported on this platform.");
1606+ }
1607+ function Tz(z, J) {
1608+ return z.isElement(J);
1609+ }
1610+ function Lz(z, J) {
1611+ return z.isDocumentFragment(J);
2186− };
1612+ }
2187− };
1613+ function Dz(z, J, P) {
2188− })(pure1(empty2))(ms);
1614+ var G;
2189− };
1615+ let X2 = {};
2190− };
1616+ for (let $ = J; $ <= P; ++$) {
2191− },
1617+ let U = (G = z[$]) === null || G === void 0 ? void 0 : G.key;
2192− FunctorWithIndex0: function() {
1618+ if (U !== void 0) X2[U] = $;
2193− return functorWithIndexObject;
2194− },
2195− FoldableWithIndex1: function() {
2196− return foldableWithIndexObject;
2197− },
2198− Traversable2: function() {
2199− return traversableObject;
2200 }
1619 }
1620+ return X2;
2201− };
1621+ }
2202− var traversableObject = {
1622+ var jz = ["create", "update", "remove", "destroy", "pre", "post"];
2203− traverse: function(dictApplicative) {
1623+ function a(z, J, P) {
2204− var $96 = traverseWithIndex(traversableWithIndexObject)(dictApplicative);
1624+ let G = { create: [], update: [], remove: [], destroy: [], pre: [], post: [] }, X2 = J !== void 0 ? J : l;
1625+ for (let W of jz) for (let Y2 of z) {
1626+ let q = Y2[W];
1627+ if (q !== void 0) G[W].push(q);
1628+ }
1629+ function $(W) {
1630+ let Y2 = W.id ? "#" + W.id : "", q = W.getAttribute("class"), B = q ? "." + q.split(" ").join(".") : "";
1631+ return C(X2.tagName(W).toLowerCase() + Y2 + B, {}, [], void 0, W);
1632+ }
1633+ function U(W) {
1634+ return C(void 0, {}, [], void 0, W);
1635+ }
1636+ function L(W, Y2) {
2205− return function($97) {
1637+ return function q() {
2206− return $96($$const($97));
1638+ if (--Y2 === 0) {
1639+ let B = X2.parentNode(W);
1640+ if (B !== null) X2.removeChild(B, W);
1641+ }
2207 };
1642 };
2208− },
2209− sequence: function(dictApplicative) {
2210− return traverse(traversableObject)(dictApplicative)(identity4);
2211− },
2212− Functor0: function() {
2213− return functorObject;
2214− },
2215− Foldable1: function() {
2216− return foldableObject;
2217 }
1643 }
2218− };
1644+ function F(W, Y2) {
2219−
1645+ var q, B, K, O, M;
2220− // output/Record.Unsafe.Union/foreign.js
1646+ let Z, R = W.data, T = R === null || R === void 0 ? void 0 : R.hook;
2221− function unsafeUnionFn(r1, r2) {
1647+ (q = T === null || T === void 0 ? void 0 : T.init) === null || q === void 0 || q.call(T, W);
2222− var copy = {};
1648+ let { children: A, sel: H } = W;
2223− for (var k1 in r2) {
1649+ if (H === "!") (B = W.text) !== null && B !== void 0 || (W.text = ""), W.elm = X2.createComment(W.text);
2224− if ({}.hasOwnProperty.call(r2, k1)) {
1650+ else if (H === "") W.elm = X2.createTextNode(W.text);
2225− copy[k1] = r2[k1];
1651+ else if (H !== void 0) {
1652+ let D = H.indexOf("#"), j = H.indexOf(".", D), Q = D > 0 ? D : H.length, f = j > 0 ? j : H.length, c = D !== -1 || j !== -1 ? H.slice(0, Math.min(Q, f)) : H, V = R === null || R === void 0 ? void 0 : R.ns, S = V === void 0 ? X2.createElement(c, R) : X2.createElementNS(V, c, R);
1653+ if (W.elm = S, Q < f) S.setAttribute("id", H.slice(Q + 1, f));
1654+ if (j > 0) S.setAttribute("class", H.slice(f + 1).replace(/\./g, " "));
1655+ for (Z = 0; Z < G.create.length; ++Z) G.create[Z](x, W);
1656+ if (s(W.text) && (!w(A) || A.length === 0)) X2.appendChild(S, X2.createTextNode(W.text));
1657+ if (w(A)) for (Z = 0; Z < A.length; ++Z) {
1658+ let p = A[Z];
1659+ if (p != null) X2.appendChild(S, F(p, Y2));
1660+ }
1661+ if (T !== void 0) {
1662+ if ((K = T.create) === null || K === void 0 || K.call(T, x, W), T.insert !== void 0) Y2.push(W);
1663+ }
1664+ } else if (((O = P === null || P === void 0 ? void 0 : P.experimental) === null || O === void 0 ? void 0 : O.fragments) && W.children) {
1665+ W.elm = ((M = X2.createDocumentFragment) !== null && M !== void 0 ? M : Mz)();
1666+ for (Z = 0; Z < G.create.length; ++Z) G.create[Z](x, W);
1667+ for (Z = 0; Z < W.children.length; ++Z) {
1668+ let D = W.children[Z];
1669+ if (D != null) X2.appendChild(W.elm, F(D, Y2));
1670+ }
1671+ } else W.elm = X2.createTextNode(W.text);
1672+ return W.elm;
1673+ }
1674+ function _(W, Y2, q, B, K, O) {
1675+ for (; B <= K; ++B) {
1676+ let M = q[B];
1677+ if (M != null) X2.insertBefore(W, F(M, O), Y2);
1678+ }
1679+ }
1680+ function N(W) {
1681+ var Y2, q;
1682+ let B = W.data;
1683+ if (B !== void 0) {
1684+ (q = (Y2 = B === null || B === void 0 ? void 0 : B.hook) === null || Y2 === void 0 ? void 0 : Y2.destroy) === null || q === void 0 || q.call(Y2, W);
1685+ for (let K = 0; K < G.destroy.length; ++K) G.destroy[K](W);
1686+ if (W.children !== void 0) for (let K = 0; K < W.children.length; ++K) {
1687+ let O = W.children[K];
1688+ if (O != null && typeof O !== "string") N(O);
1689+ }
2226 }
1690 }
2227 }
1691 }
2228− for (var k2 in r1) {
1692+ function k(W, Y2, q, B) {
2229− if ({}.hasOwnProperty.call(r1, k2)) {
1693+ var K, O;
2230− copy[k2] = r1[k2];
1694+ for (; q <= B; ++q) {
1695+ let M, Z = Y2[q];
1696+ if (Z != null) if (Z.sel !== void 0) {
1697+ N(Z), M = G.remove.length + 1;
1698+ let R = L(Z.elm, M);
1699+ for (let A = 0; A < G.remove.length; ++A) G.remove[A](Z, R);
1700+ let T = (O = (K = Z === null || Z === void 0 ? void 0 : Z.data) === null || K === void 0 ? void 0 : K.hook) === null || O === void 0 ? void 0 : O.remove;
1701+ if (T !== void 0) T(Z, R);
1702+ else R();
1703+ } else if (Z.children) N(Z), k(W, Z.children, 0, Z.children.length - 1);
1704+ else X2.removeChild(W, Z.elm);
1705+ }
1706+ }
1707+ function d(W, Y2, q, B) {
1708+ let K = 0, O = 0, M = Y2.length - 1, Z = Y2[0], R = Y2[M], T = q.length - 1, A = q[0], H = q[T], D, j, Q, f;
1709+ while (K <= M && O <= T) if (Z == null) Z = Y2[++K];
1710+ else if (R == null) R = Y2[--M];
1711+ else if (A == null) A = q[++O];
1712+ else if (H == null) H = q[--T];
1713+ else if (I(Z, A)) y(Z, A, B), Z = Y2[++K], A = q[++O];
1714+ else if (I(R, H)) y(R, H, B), R = Y2[--M], H = q[--T];
1715+ else if (I(Z, H)) y(Z, H, B), X2.insertBefore(W, Z.elm, X2.nextSibling(R.elm)), Z = Y2[++K], H = q[--T];
1716+ else if (I(R, A)) y(R, A, B), X2.insertBefore(W, R.elm, Z.elm), R = Y2[--M], A = q[++O];
1717+ else {
1718+ if (D === void 0) D = Dz(Y2, K, M);
1719+ if (j = D[A.key], j === void 0) X2.insertBefore(W, F(A, B), Z.elm), A = q[++O];
1720+ else if (D[H.key] === void 0) X2.insertBefore(W, F(H, B), X2.nextSibling(R.elm)), H = q[--T];
1721+ else {
1722+ if (Q = Y2[j], Q.sel !== A.sel) X2.insertBefore(W, F(A, B), Z.elm);
1723+ else y(Q, A, B), Y2[j] = void 0, X2.insertBefore(W, Q.elm, Z.elm);
1724+ A = q[++O];
1725+ }
2231 }
1726 }
1727+ if (O <= T) f = q[T + 1] == null ? null : q[T + 1].elm, _(W, f, q, O, T, B);
1728+ if (K <= M) k(W, Y2, K, M);
1729+ }
1730+ function y(W, Y2, q) {
1731+ var B, K, O, M, Z, R, T, A;
1732+ let H = (B = Y2.data) === null || B === void 0 ? void 0 : B.hook;
1733+ (K = H === null || H === void 0 ? void 0 : H.prepatch) === null || K === void 0 || K.call(H, W, Y2);
1734+ let D = Y2.elm = W.elm;
1735+ if (W === Y2) return;
1736+ if (Y2.data !== void 0 || Y2.text !== void 0 && Y2.text !== W.text) {
1737+ (O = Y2.data) !== null && O !== void 0 || (Y2.data = {}), (M = W.data) !== null && M !== void 0 || (W.data = {});
1738+ for (let f = 0; f < G.update.length; ++f) G.update[f](W, Y2);
1739+ (T = (R = (Z = Y2.data) === null || Z === void 0 ? void 0 : Z.hook) === null || R === void 0 ? void 0 : R.update) === null || T === void 0 || T.call(R, W, Y2);
1740+ }
1741+ let j = W.children, Q = Y2.children;
1742+ if (Y2.text === void 0) {
1743+ if (j !== void 0 && Q !== void 0) {
1744+ if (j !== Q) d(D, j, Q, q);
1745+ } else if (Q !== void 0) {
1746+ if (W.text !== void 0) X2.setTextContent(D, "");
1747+ _(D, null, Q, 0, Q.length - 1, q);
1748+ } else if (j !== void 0) k(D, j, 0, j.length - 1);
1749+ else if (W.text !== void 0) X2.setTextContent(D, "");
1750+ } else if (W.text !== Y2.text) {
1751+ if (j !== void 0) k(D, j, 0, j.length - 1);
1752+ X2.setTextContent(D, Y2.text);
1753+ }
1754+ (A = H === null || H === void 0 ? void 0 : H.postpatch) === null || A === void 0 || A.call(H, W, Y2);
1755+ }
1756+ return function W(Y2, q) {
1757+ let B, K, O, M = [];
1758+ for (B = 0; B < G.pre.length; ++B) G.pre[B]();
1759+ if (Tz(X2, Y2)) Y2 = $(Y2);
1760+ else if (Lz(X2, Y2)) Y2 = U(Y2);
1761+ if (I(Y2, q)) y(Y2, q, M);
1762+ else if (K = Y2.elm, O = X2.parentNode(K), F(q, M), O !== null) X2.insertBefore(O, q.elm, X2.nextSibling(K)), k(O, [Y2], 0, 0);
1763+ for (B = 0; B < M.length; ++B) M[B].data.hook.insert(M[B]);
1764+ for (B = 0; B < G.post.length; ++B) G.post[B]();
1765+ return q;
1766+ };
1767+ }
1768+ var t = typeof (window === null || window === void 0 ? void 0 : window.requestAnimationFrame) === "function" ? window.requestAnimationFrame.bind(window) : setTimeout;
1769+ var Fz = (z) => {
1770+ t(() => {
1771+ t(z);
1772+ });
1773+ };
1774+ var u = false;
1775+ function Qz(z, J, P) {
1776+ Fz(() => {
1777+ z[J] = P;
1778+ });
1779+ }
1780+ function o(z, J) {
1781+ let P, G, X2 = J.elm, $ = z.data.style, U = J.data.style;
1782+ if (!$ && !U) return;
1783+ if ($ === U) return;
1784+ $ = $ || {}, U = U || {};
1785+ let L = "delayed" in $;
1786+ for (G in $) if (!(G in U)) if (G[0] === "-" && G[1] === "-") X2.style.removeProperty(G);
1787+ else X2.style[G] = "";
1788+ for (G in U) if (P = U[G], G === "delayed" && U.delayed) {
1789+ for (let F in U.delayed) if (P = U.delayed[F], !L || P !== $.delayed[F]) Qz(X2.style, F, P);
1790+ } else if (G !== "remove" && P !== $[G]) if (G[0] === "-" && G[1] === "-") X2.style.setProperty(G, P);
1791+ else X2.style[G] = P;
1792+ }
1793+ function fz(z) {
1794+ let J, P, G = z.elm, X2 = z.data.style;
1795+ if (!X2 || !(J = X2.destroy)) return;
1796+ for (P in J) G.style[P] = J[P];
1797+ }
1798+ function bz(z, J) {
1799+ let P = z.data.style;
1800+ if (!P || !P.remove) {
1801+ J();
1802+ return;
2232 }
1803 }
2233− return copy;
1804+ if (!u) z.elm.offsetLeft, u = true;
1805+ let G, X2 = z.elm, $ = 0, U = P.remove, L = 0, F = [];
1806+ for (G in U) F.push(G), X2.style[G] = U[G];
1807+ let N = getComputedStyle(X2)["transition-property"].split(", ");
1808+ for (; $ < N.length; ++$) if (F.indexOf(N[$]) !== -1) L++;
1809+ X2.addEventListener("transitionend", (k) => {
1810+ if (k.target === X2) --L;
1811+ if (L === 0) J();
1812+ });
2234 }
1813 }
1814+ function kz() {
1815+ u = false;
1816+ }
1817+ var n = { pre: kz, create: o, update: o, destroy: fz, remove: bz };
1818+ function Vz() {
1819+ return a([v, m, n]);
1820+ }
1821+
1822+ // output/Effect.Uncurried/foreign.js
1823+ var runEffectFn2 = function runEffectFn22(fn) {
1824+ return function(a2) {
1825+ return function(b2) {
1826+ return function() {
1827+ return fn(a2, b2);
1828+ };
1829+ };
1830+ };
1831+ };
1832+
1833+ // output/Snabbdom/index.js
1834+ var init = /* @__PURE__ */ mapFlipped(functorEffect)(Vz)(runEffectFn2);
1835+ var h2 = /* @__PURE__ */ runFn4(C);
1836+
1837+ // output/Foreign/foreign.js
1838+ var isArray = Array.isArray || function(value12) {
1839+ return Object.prototype.toString.call(value12) === "[object Array]";
1840+ };
1841+
1842+ // output/Untagged.Castable/index.js
1843+ var cast = function() {
1844+ return unsafeCoerce2;
1845+ };
2235
1846
2236− // output/Record.Unsafe.Union/index.js
1847+ // output/Untagged.Union/index.js
2237− var unsafeUnion = /* @__PURE__ */ runFn2(unsafeUnionFn);
1848+ var cast2 = /* @__PURE__ */ cast();
1849+ var asOneOf = function() {
1850+ return cast2;
1851+ };
2238
1852
2239 // output/Plum.View/index.js
1853 // output/Plum.View/index.js
2240 var append2 = /* @__PURE__ */ append(semigroupArray);
1854 var append2 = /* @__PURE__ */ append(semigroupArray);
@@ -2283,10 +1897,12 @@
2283 var monoidRecordCons3 = /* @__PURE__ */ monoidRecordCons(childrenIsSymbol);
1897 var monoidRecordCons3 = /* @__PURE__ */ monoidRecordCons(childrenIsSymbol);
2284 var monoidRecordCons4 = /* @__PURE__ */ monoidRecordCons2(monoidArray)()(/* @__PURE__ */ monoidRecordCons1(monoidArray)()(/* @__PURE__ */ monoidRecordCons22(monoidArray)()(/* @__PURE__ */ monoidRecordCons(nervesIsSymbol)(monoidArray)()(monoidRecordNil))));
1898 var monoidRecordCons4 = /* @__PURE__ */ monoidRecordCons2(monoidArray)()(/* @__PURE__ */ monoidRecordCons1(monoidArray)()(/* @__PURE__ */ monoidRecordCons22(monoidArray)()(/* @__PURE__ */ monoidRecordCons(nervesIsSymbol)(monoidArray)()(monoidRecordNil))));
2285 var mempty1 = /* @__PURE__ */ mempty(/* @__PURE__ */ monoidRecord2(/* @__PURE__ */ monoidRecordCons3(monoidArray)()(monoidRecordCons4)));
1899 var mempty1 = /* @__PURE__ */ mempty(/* @__PURE__ */ monoidRecord2(/* @__PURE__ */ monoidRecordCons3(monoidArray)()(monoidRecordCons4)));
2286− var foldMap3 = /* @__PURE__ */ foldMap2(monoidString);
1900+ var foldMap4 = /* @__PURE__ */ foldMap2(monoidString);
1901+ var intercalate3 = /* @__PURE__ */ intercalate2(monoidString);
1902+ var asOneOf2 = /* @__PURE__ */ asOneOf();
2287 var show1 = /* @__PURE__ */ show(showNumber);
1903 var show1 = /* @__PURE__ */ show(showNumber);
2288 var mempty22 = /* @__PURE__ */ mempty(monoidUnit);
1904 var mempty22 = /* @__PURE__ */ mempty(monoidUnit);
2289− var intercalate3 = /* @__PURE__ */ intercalate2(monoidString);
1905+ var fromHomogeneous2 = /* @__PURE__ */ fromHomogeneous();
2290 var map2 = /* @__PURE__ */ map(/* @__PURE__ */ functorWriterT(functorIdentity));
1906 var map2 = /* @__PURE__ */ map(/* @__PURE__ */ functorWriterT(functorIdentity));
2291 var map1 = /* @__PURE__ */ map(functorArray);
1907 var map1 = /* @__PURE__ */ map(functorArray);
2292 var Top = /* @__PURE__ */ function() {
1908 var Top = /* @__PURE__ */ function() {
@@ -2381,6 +1997,34 @@
2381 Y2.value = new Y2();
1997 Y2.value = new Y2();
2382 return Y2;
1998 return Y2;
2383 }();
1999 }();
2000+ var TopLeft = /* @__PURE__ */ function() {
2001+ function TopLeft2() {
2002+ }
2003+ ;
2004+ TopLeft2.value = new TopLeft2();
2005+ return TopLeft2;
2006+ }();
2007+ var TopRight = /* @__PURE__ */ function() {
2008+ function TopRight2() {
2009+ }
2010+ ;
2011+ TopRight2.value = new TopRight2();
2012+ return TopRight2;
2013+ }();
2014+ var BottomRight = /* @__PURE__ */ function() {
2015+ function BottomRight2() {
2016+ }
2017+ ;
2018+ BottomRight2.value = new BottomRight2();
2019+ return BottomRight2;
2020+ }();
2021+ var BottomLeft = /* @__PURE__ */ function() {
2022+ function BottomLeft2() {
2023+ }
2024+ ;
2025+ BottomLeft2.value = new BottomLeft2();
2026+ return BottomLeft2;
2027+ }();
2384 var Grid = /* @__PURE__ */ function() {
2028 var Grid = /* @__PURE__ */ function() {
2385 function Grid2() {
2029 function Grid2() {
2386 }
2030 }
@@ -2412,6 +2056,27 @@
2412 Span2.value = new Span2();
2056 Span2.value = new Span2();
2413 return Span2;
2057 return Span2;
2414 }();
2058 }();
2059+ var Solid = /* @__PURE__ */ function() {
2060+ function Solid2() {
2061+ }
2062+ ;
2063+ Solid2.value = new Solid2();
2064+ return Solid2;
2065+ }();
2066+ var Dashed = /* @__PURE__ */ function() {
2067+ function Dashed2() {
2068+ }
2069+ ;
2070+ Dashed2.value = new Dashed2();
2071+ return Dashed2;
2072+ }();
2073+ var Dotted = /* @__PURE__ */ function() {
2074+ function Dotted2() {
2075+ }
2076+ ;
2077+ Dotted2.value = new Dotted2();
2078+ return Dotted2;
2079+ }();
2415 var Start = /* @__PURE__ */ function() {
2080 var Start = /* @__PURE__ */ function() {
2416 function Start2() {
2081 function Start2() {
2417 }
2082 }
@@ -2560,6 +2225,102 @@
2560 };
2225 };
2561 return Clip2;
2226 return Clip2;
2562 }();
2227 }();
2228+ var BorderWidth = /* @__PURE__ */ function() {
2229+ function BorderWidth2(value0, value1) {
2230+ this.value0 = value0;
2231+ this.value1 = value1;
2232+ }
2233+ ;
2234+ BorderWidth2.create = function(value0) {
2235+ return function(value1) {
2236+ return new BorderWidth2(value0, value1);
2237+ };
2238+ };
2239+ return BorderWidth2;
2240+ }();
2241+ var BorderStyle = /* @__PURE__ */ function() {
2242+ function BorderStyle2(value0) {
2243+ this.value0 = value0;
2244+ }
2245+ ;
2246+ BorderStyle2.create = function(value0) {
2247+ return new BorderStyle2(value0);
2248+ };
2249+ return BorderStyle2;
2250+ }();
2251+ var Round = /* @__PURE__ */ function() {
2252+ function Round2(value0, value1) {
2253+ this.value0 = value0;
2254+ this.value1 = value1;
2255+ }
2256+ ;
2257+ Round2.create = function(value0) {
2258+ return function(value1) {
2259+ return new Round2(value0, value1);
2260+ };
2261+ };
2262+ return Round2;
2263+ }();
2264+ var Shadow = /* @__PURE__ */ function() {
2265+ function Shadow2(value0) {
2266+ this.value0 = value0;
2267+ }
2268+ ;
2269+ Shadow2.create = function(value0) {
2270+ return new Shadow2(value0);
2271+ };
2272+ return Shadow2;
2273+ }();
2274+ var InnerShadow = /* @__PURE__ */ function() {
2275+ function InnerShadow2(value0) {
2276+ this.value0 = value0;
2277+ }
2278+ ;
2279+ InnerShadow2.create = function(value0) {
2280+ return new InnerShadow2(value0);
2281+ };
2282+ return InnerShadow2;
2283+ }();
2284+ var FontColor = /* @__PURE__ */ function() {
2285+ function FontColor2(value0) {
2286+ this.value0 = value0;
2287+ }
2288+ ;
2289+ FontColor2.create = function(value0) {
2290+ return new FontColor2(value0);
2291+ };
2292+ return FontColor2;
2293+ }();
2294+ var FontWeight = /* @__PURE__ */ function() {
2295+ function FontWeight2(value0) {
2296+ this.value0 = value0;
2297+ }
2298+ ;
2299+ FontWeight2.create = function(value0) {
2300+ return new FontWeight2(value0);
2301+ };
2302+ return FontWeight2;
2303+ }();
2304+ var FontSize = /* @__PURE__ */ function() {
2305+ function FontSize2(value0) {
2306+ this.value0 = value0;
2307+ }
2308+ ;
2309+ FontSize2.create = function(value0) {
2310+ return new FontSize2(value0);
2311+ };
2312+ return FontSize2;
2313+ }();
2314+ var Font = /* @__PURE__ */ function() {
2315+ function Font2(value0) {
2316+ this.value0 = value0;
2317+ }
2318+ ;
2319+ Font2.create = function(value0) {
2320+ return new Font2(value0);
2321+ };
2322+ return Font2;
2323+ }();
2563 var UI = /* @__PURE__ */ function() {
2324 var UI = /* @__PURE__ */ function() {
2564 function UI2(value0, value1) {
2325 function UI2(value0, value1) {
2565 this.value0 = value0;
2326 this.value0 = value0;
@@ -2676,12 +2437,12 @@
2676 return None3;
2437 return None3;
2677 }();
2438 }();
2678 var semigroupSkinGrowth = {
2439 var semigroupSkinGrowth = {
2679− append: function(v) {
2440+ append: function(v2) {
2680 return function(v1) {
2441 return function(v1) {
2681 return {
2442 return {
2682− meat: union(v.meat)(v1.meat),
2443+ meat: union(v2.meat)(v1.meat),
2683− hover: union(v.hover)(v1.hover),
2444+ hover: union(v2.hover)(v1.hover),
2684− down: union(v.down)(v1.down)
2445+ down: union(v2.down)(v1.down)
2685 };
2446 };
2686 };
2447 };
2687 }
2448 }
@@ -2691,10 +2452,10 @@
2691 var bind2 = /* @__PURE__ */ bind(bindWriterT2);
2452 var bind2 = /* @__PURE__ */ bind(bindWriterT2);
2692 var append22 = /* @__PURE__ */ append(/* @__PURE__ */ semigroupWriterT(applyIdentity)(semigroupSkinGrowth)(semigroupArray));
2453 var append22 = /* @__PURE__ */ append(/* @__PURE__ */ semigroupWriterT(applyIdentity)(semigroupSkinGrowth)(semigroupArray));
2693 var semigroupMutation = {
2454 var semigroupMutation = {
2694− append: function(v) {
2455+ append: function(v2) {
2695 return function(v1) {
2456 return function(v1) {
2696 return {
2457 return {
2697− extraSkin: append2(v.extraSkin)(v1.extraSkin)
2458+ extraSkin: append2(v2.extraSkin)(v1.extraSkin)
2698 };
2459 };
2699 };
2460 };
2700 }
2461 }
@@ -2704,60 +2465,132 @@
2704 return function(dictSemigroup1) {
2465 return function(dictSemigroup1) {
2705 var append4 = append(dictSemigroup1);
2466 var append4 = append(dictSemigroup1);
2706 return {
2467 return {
2707− append: function(v) {
2468+ append: function(v2) {
2708 return function(v1) {
2469 return function(v1) {
2709− return new UI(append3(v.value0)(v1.value0), append4(v.value1)(v1.value1));
2470+ return new UI(append3(v2.value0)(v1.value0), append4(v2.value1)(v1.value1));
2710 };
2471 };
2711 }
2472 }
2712 };
2473 };
2713 };
2474 };
2714 };
2475 };
2715 var renderableSide = {
2476 var renderableSide = {
2716− render: function(v) {
2477+ render: function(v2) {
2717− if (v instanceof Top) {
2478+ if (v2 instanceof Top) {
2718 return "top";
2479 return "top";
2719 }
2480 }
2720 ;
2481 ;
2721− if (v instanceof Right2) {
2482+ if (v2 instanceof Right2) {
2722 return "right";
2483 return "right";
2723 }
2484 }
2724 ;
2485 ;
2725− if (v instanceof Bottom) {
2486+ if (v2 instanceof Bottom) {
2726 return "bottom";
2487 return "bottom";
2727 }
2488 }
2728 ;
2489 ;
2729− if (v instanceof Left2) {
2490+ if (v2 instanceof Left2) {
2730 return "left";
2491 return "left";
2731 }
2492 }
2732 ;
2493 ;
2733− throw new Error("Failed pattern match at Plum.View (line 263, column 12 - line 267, column 19): " + [v.constructor.name]);
2494+ throw new Error("Failed pattern match at Plum.View (line 383, column 12 - line 387, column 19): " + [v2.constructor.name]);
2734 },
2495 },
2735− renderKey: function(v) {
2496+ renderKey: function(v2) {
2736− if (v instanceof Top) {
2497+ if (v2 instanceof Top) {
2737 return "top";
2498 return "top";
2738 }
2499 }
2739 ;
2500 ;
2740− if (v instanceof Right2) {
2501+ if (v2 instanceof Right2) {
2741 return "right";
2502 return "right";
2742 }
2503 }
2743 ;
2504 ;
2744− if (v instanceof Bottom) {
2505+ if (v2 instanceof Bottom) {
2745 return "bottom";
2506 return "bottom";
2746 }
2507 }
2747 ;
2508 ;
2748− if (v instanceof Left2) {
2509+ if (v2 instanceof Left2) {
2749 return "left";
2510 return "left";
2750 }
2511 }
2751 ;
2512 ;
2752− throw new Error("Failed pattern match at Plum.View (line 268, column 15 - line 272, column 19): " + [v.constructor.name]);
2513+ throw new Error("Failed pattern match at Plum.View (line 388, column 15 - line 392, column 19): " + [v2.constructor.name]);
2514+ }
2515+ };
2516+ var renderableCorner = {
2517+ render: function(v2) {
2518+ if (v2 instanceof TopLeft) {
2519+ return "top-left";
2520+ }
2521+ ;
2522+ if (v2 instanceof TopRight) {
2523+ return "top-right";
2524+ }
2525+ ;
2526+ if (v2 instanceof BottomRight) {
2527+ return "bottom-right";
2528+ }
2529+ ;
2530+ if (v2 instanceof BottomLeft) {
2531+ return "bottom-left";
2532+ }
2533+ ;
2534+ throw new Error("Failed pattern match at Plum.View (line 357, column 12 - line 361, column 32): " + [v2.constructor.name]);
2535+ },
2536+ renderKey: function(v2) {
2537+ if (v2 instanceof TopLeft) {
2538+ return "top-left";
2539+ }
2540+ ;
2541+ if (v2 instanceof TopRight) {
2542+ return "top-right";
2543+ }
2544+ ;
2545+ if (v2 instanceof BottomRight) {
2546+ return "bottom-right";
2547+ }
2548+ ;
2549+ if (v2 instanceof BottomLeft) {
2550+ return "bottom-left";
2551+ }
2552+ ;
2553+ throw new Error("Failed pattern match at Plum.View (line 362, column 15 - line 366, column 32): " + [v2.constructor.name]);
2753 }
2554 }
2754 };
2555 };
2755 var renderableColor = {
2556 var renderableColor = {
2756− render: function(v) {
2557+ render: function(v2) {
2757− return "rgb(" + (show2(v.r) + ("," + (show2(v.g) + ("," + (show2(v.b) + ("," + (show2(v.a) + "%)")))))));
2558+ return "rgb(" + (show2(v2.r) + ("," + (show2(v2.g) + ("," + (show2(v2.b) + ("," + (show2(v2.a) + "%)")))))));
2758 },
2559 },
2759− renderKey: function(v) {
2560+ renderKey: function(v2) {
2760− return show2(v.r) + ("-" + (show2(v.g) + ("-" + (show2(v.b) + ("-" + show2(v.a))))));
2561+ return show2(v2.r) + ("-" + (show2(v2.g) + ("-" + (show2(v2.b) + ("-" + show2(v2.a))))));
2562+ }
2563+ };
2564+ var renderableBorderStyle = {
2565+ render: function(v2) {
2566+ if (v2 instanceof Solid) {
2567+ return "solid";
2568+ }
2569+ ;
2570+ if (v2 instanceof Dashed) {
2571+ return "dashed";
2572+ }
2573+ ;
2574+ if (v2 instanceof Dotted) {
2575+ return "dotted";
2576+ }
2577+ ;
2578+ throw new Error("Failed pattern match at Plum.View (line 371, column 12 - line 374, column 23): " + [v2.constructor.name]);
2579+ },
2580+ renderKey: function(v2) {
2581+ if (v2 instanceof Solid) {
2582+ return "solid";
2583+ }
2584+ ;
2585+ if (v2 instanceof Dashed) {
2586+ return "dashed";
2587+ }
2588+ ;
2589+ if (v2 instanceof Dotted) {
2590+ return "dotted";
2591+ }
2592+ ;
2593+ throw new Error("Failed pattern match at Plum.View (line 375, column 15 - line 378, column 23): " + [v2.constructor.name]);
2761 }
2594 }
2762 };
2595 };
2763 var monoidSkinGrowth = {
2596 var monoidSkinGrowth = {
@@ -2796,17 +2629,17 @@
2796 };
2629 };
2797 var functorGenericUI = {
2630 var functorGenericUI = {
2798 map: function(f) {
2631 map: function(f) {
2799− return function(v) {
2632+ return function(v2) {
2800− return new UI(v.value0, f(v.value1));
2633+ return new UI(v2.value0, f(v2.value1));
2801 };
2634 };
2802 }
2635 }
2803 };
2636 };
2804 var applyGenericUI = function(dictMonoid) {
2637 var applyGenericUI = function(dictMonoid) {
2805 var append3 = append(semigroupRecord3(semigroupRecordCons2(dictMonoid.Semigroup0())));
2638 var append3 = append(semigroupRecord3(semigroupRecordCons2(dictMonoid.Semigroup0())));
2806 return {
2639 return {
2807− apply: function(v) {
2640+ apply: function(v2) {
2808 return function(v1) {
2641 return function(v1) {
2809− return new UI(append3(v.value0)(v1.value0), v.value1(v1.value1));
2642+ return new UI(append3(v2.value0)(v1.value0), v2.value1(v1.value1));
2810 };
2643 };
2811 },
2644 },
2812 Functor0: function() {
2645 Functor0: function() {
@@ -2818,10 +2651,10 @@
2818 var append3 = append(semigroupRecord3(semigroupRecordCons2(dictMonoid.Semigroup0())));
2651 var append3 = append(semigroupRecord3(semigroupRecordCons2(dictMonoid.Semigroup0())));
2819 var applyGenericUI1 = applyGenericUI(dictMonoid);
2652 var applyGenericUI1 = applyGenericUI(dictMonoid);
2820 return {
2653 return {
2821− bind: function(v) {
2654+ bind: function(v2) {
2822 return function(f) {
2655 return function(f) {
2823− var v1 = f(v.value1);
2656+ var v1 = f(v2.value1);
2824− return new UI(append3(v.value0)(v1.value0), v1.value1);
2657+ return new UI(append3(v2.value0)(v1.value0), v1.value1);
2825 };
2658 };
2826 },
2659 },
2827 Apply0: function() {
2660 Apply0: function() {
@@ -2829,36 +2662,70 @@
2829 }
2662 }
2830 };
2663 };
2831 };
2664 };
2665+ var applicativeGenericUI = function(dictMonoid) {
2666+ var applyGenericUI1 = applyGenericUI(dictMonoid);
2667+ return {
2668+ pure: UI.create(mempty(monoidRecord2(monoidRecordCons3(dictMonoid)()(monoidRecordCons4)))),
2669+ Apply0: function() {
2670+ return applyGenericUI1;
2671+ }
2672+ };
2673+ };
2832− var text = function(s) {
2674+ var text = function(s2) {
2833− return function(v) {
2675+ return function(v2) {
2834 return new UI({
2676 return new UI({
2835 nerves: mempty1.nerves,
2677 nerves: mempty1.nerves,
2836 meat: mempty1.meat,
2678 meat: mempty1.meat,
2837 hover: mempty1.hover,
2679 hover: mempty1.hover,
2838 down: mempty1.down,
2680 down: mempty1.down,
2839 children: [new Tuple({
2681 children: [new Tuple({
2840− meat: v.value0.meat,
2682+ meat: v2.value0.meat,
2841− nerves: v.value0.nerves,
2683+ nerves: v2.value0.nerves,
2842− hover: v.value0.hover,
2684+ hover: v2.value0.hover,
2843− down: v.value0.down
2685+ down: v2.value0.down
2844− }, new Text(s))]
2686+ }, new Text(s2))]
2845− }, v.value1);
2687+ }, v2.value1);
2846 };
2688 };
2847 };
2689 };
2848− var styleSkinGrowth = function(v) {
2690+ var styleSkinGrowth = function(v2) {
2849− return foldMap3(function(className) {
2691+ return foldMap4(function(className) {
2850 return function(v1) {
2692 return function(v1) {
2851 return "." + (className + ("{" + (v1.key + (":" + (v1.value + ";}")))));
2693 return "." + (className + ("{" + (v1.key + (":" + (v1.value + ";}")))));
2852 };
2694 };
2853− })(v.meat) + (foldMap3(function(className) {
2695+ })(v2.meat) + (foldMap4(function(className) {
2854 return function(v1) {
2696 return function(v1) {
2855 return "." + (className + ("{" + (v1.key + (":" + (v1.value + ";}")))));
2697 return "." + (className + ("{" + (v1.key + (":" + (v1.value + ";}")))));
2856 };
2698 };
2857− })(v.hover) + foldMap3(function(className) {
2699+ })(v2.hover) + foldMap4(function(className) {
2858 return function(v1) {
2700 return function(v1) {
2859 return "." + (className + ("{" + (v1.key + (":" + (v1.value + ";}")))));
2701 return "." + (className + ("{" + (v1.key + (":" + (v1.value + ";}")))));
2860 };
2702 };
2861− })(v.down));
2703+ })(v2.down));
2704+ };
2705+ var string = function(elem2) {
2706+ return function(classes) {
2707+ return function(string1) {
2708+ return h2(elem2)({
2709+ attrs: singleton2("class")(intercalate3(" ")(classes)),
2710+ on: empty2,
2711+ style: empty2
2712+ })([])(asOneOf2(string1));
2713+ };
2714+ };
2715+ };
2716+ var stack = function(v2) {
2717+ return new UI({
2718+ nerves: mempty1.nerves,
2719+ meat: mempty1.meat,
2720+ hover: mempty1.hover,
2721+ down: mempty1.down,
2722+ children: [new Tuple({
2723+ meat: v2.value0.meat,
2724+ nerves: v2.value0.nerves,
2725+ hover: v2.value0.hover,
2726+ down: v2.value0.down
2727+ }, new Stack(v2.value0.children))]
2728+ }, v2.value1);
2862 };
2729 };
2863 var sk = function(cName) {
2730 var sk = function(cName) {
2864 return function(key) {
2731 return function(key) {
@@ -2876,13 +2743,27 @@
2876 };
2743 };
2877 };
2744 };
2878 };
2745 };
2746+ var row = function(v2) {
2747+ return new UI({
2748+ nerves: mempty1.nerves,
2749+ meat: mempty1.meat,
2750+ hover: mempty1.hover,
2751+ down: mempty1.down,
2752+ children: [new Tuple({
2753+ meat: v2.value0.meat,
2754+ nerves: v2.value0.nerves,
2755+ hover: v2.value0.hover,
2756+ down: v2.value0.down
2757+ }, new Row(v2.value0.children))]
2758+ }, v2.value1);
2759+ };
2879− var rgb = function(r) {
2760+ var rgb = function(r2) {
2880− return function(g) {
2761+ return function(g2) {
2881− return function(b) {
2762+ return function(b2) {
2882 return {
2763 return {
2883− r: round2(r * 255),
2764+ r: round2(r2 * 255),
2884− g: round2(g * 255),
2765+ g: round2(g2 * 255),
2885− b: round2(b * 255),
2766+ b: round2(b2 * 255),
2886 a: 100
2767 a: 100
2887 };
2768 };
2888 };
2769 };
@@ -2893,72 +2774,87 @@
2893 };
2774 };
2894 var renderKey1 = /* @__PURE__ */ renderKey(renderableColor);
2775 var renderKey1 = /* @__PURE__ */ renderKey(renderableColor);
2895 var renderKey2 = /* @__PURE__ */ renderKey(renderableSide);
2776 var renderKey2 = /* @__PURE__ */ renderKey(renderableSide);
2777+ var renderKey3 = /* @__PURE__ */ renderKey(renderableBorderStyle);
2778+ var renderKey4 = /* @__PURE__ */ renderKey(renderableCorner);
2896 var render = function(dict) {
2779 var render = function(dict) {
2897 return dict.render;
2780 return dict.render;
2898 };
2781 };
2899 var render1 = /* @__PURE__ */ render(renderableColor);
2782 var render1 = /* @__PURE__ */ render(renderableColor);
2900 var render2 = /* @__PURE__ */ render(renderableSide);
2783 var render2 = /* @__PURE__ */ render(renderableSide);
2784+ var render3 = /* @__PURE__ */ render(renderableBorderStyle);
2785+ var render4 = /* @__PURE__ */ render(renderableCorner);
2901 var renderableLength = {
2786 var renderableLength = {
2902− render: function(v) {
2787+ render: function(v2) {
2903− if (v instanceof Px) {
2788+ if (v2 instanceof Px) {
2904− return show2(v.value0) + "px";
2789+ return show2(v2.value0) + "px";
2905 }
2790 }
2906 ;
2791 ;
2907− if (v instanceof Fit) {
2792+ if (v2 instanceof Fit) {
2908 return "fit-content";
2793 return "fit-content";
2909 }
2794 }
2910 ;
2795 ;
2911− if (v instanceof Fill) {
2796+ if (v2 instanceof Fill) {
2912 return "100%";
2797 return "100%";
2913 }
2798 }
2914 ;
2799 ;
2915− if (v instanceof Max2) {
2800+ if (v2 instanceof Max2) {
2916− return "max(" + (show2(v.value0) + ("px," + (render(renderableLength)(v.value1) + ")")));
2801+ return "max(" + (show2(v2.value0) + ("px," + (render(renderableLength)(v2.value1) + ")")));
2917 }
2802 }
2918 ;
2803 ;
2919− if (v instanceof Min2) {
2804+ if (v2 instanceof Min2) {
2920− return "min(" + (show2(v.value0) + ("px," + (render(renderableLength)(v.value1) + ")")));
2805+ return "min(" + (show2(v2.value0) + ("px," + (render(renderableLength)(v2.value1) + ")")));
2921 }
2806 }
2922 ;
2807 ;
2923− throw new Error("Failed pattern match at Plum.View (line 362, column 12 - line 367, column 62): " + [v.constructor.name]);
2808+ throw new Error("Failed pattern match at Plum.View (line 494, column 12 - line 499, column 62): " + [v2.constructor.name]);
2924 },
2809 },
2925− renderKey: function(v) {
2810+ renderKey: function(v2) {
2926− if (v instanceof Px) {
2811+ if (v2 instanceof Px) {
2927− return show2(v.value0);
2812+ return show2(v2.value0);
2928 }
2813 }
2929 ;
2814 ;
2930− if (v instanceof Fit) {
2815+ if (v2 instanceof Fit) {
2931 return "fit-content";
2816 return "fit-content";
2932 }
2817 }
2933 ;
2818 ;
2934− if (v instanceof Fill) {
2819+ if (v2 instanceof Fill) {
2935 return "fill";
2820 return "fill";
2936 }
2821 }
2937 ;
2822 ;
2938− if (v instanceof Max2) {
2823+ if (v2 instanceof Max2) {
2939− return "max-" + (show2(v.value0) + ("-" + renderKey(renderableLength)(v.value1)));
2824+ return "max-" + (show2(v2.value0) + ("-" + renderKey(renderableLength)(v2.value1)));
2940 }
2825 }
2941 ;
2826 ;
2942− if (v instanceof Min2) {
2827+ if (v2 instanceof Min2) {
2943− return "min-" + (show2(v.value0) + ("-" + renderKey(renderableLength)(v.value1)));
2828+ return "min-" + (show2(v2.value0) + ("-" + renderKey(renderableLength)(v2.value1)));
2944 }
2829 }
2945 ;
2830 ;
2946− throw new Error("Failed pattern match at Plum.View (line 368, column 15 - line 373, column 56): " + [v.constructor.name]);
2831+ throw new Error("Failed pattern match at Plum.View (line 500, column 15 - line 505, column 56): " + [v2.constructor.name]);
2832+ }
2833+ };
2834+ var renderKey5 = /* @__PURE__ */ renderKey(renderableLength);
2835+ var render5 = /* @__PURE__ */ render(renderableLength);
2836+ var renderableShadow = {
2837+ render: function(v2) {
2838+ return show2(v2.offset.x) + ("px " + (show2(v2.offset.y) + ("px " + (show1(v2.blur) + ("px " + (show1(v2.size) + ("px " + render1(v2.color))))))));
2839+ },
2840+ renderKey: function(v2) {
2841+ return show2(v2.offset.x) + ("-" + (show2(v2.offset.y) + ("-" + (show1(v2.blur) + ("-" + (show1(v2.size) + ("-" + renderKey1(v2.color))))))));
2947 }
2842 }
2948 };
2843 };
2949− var renderKey3 = /* @__PURE__ */ renderKey(renderableLength);
2844+ var renderKey6 = /* @__PURE__ */ renderKey(renderableShadow);
2950− var render3 = /* @__PURE__ */ render(renderableLength);
2845+ var render6 = /* @__PURE__ */ render(renderableShadow);
2846+ var removeSpaces = /* @__PURE__ */ replaceAll(" ")("-");
2951 var skin = function(ctx) {
2847 var skin = function(ctx) {
2952− return function(v) {
2848+ return function(v2) {
2953− if (v instanceof Spacing) {
2849+ if (v2 instanceof Spacing) {
2954− return sk("spacing-" + (show2(v.value0) + ("-" + show2(v.value1))))("gap")(show2(v.value0) + ("px " + (show2(v.value1) + "px")));
2850+ return sk("spacing-" + (show2(v2.value0) + ("-" + show2(v2.value1))))("gap")(show2(v2.value0) + ("px " + (show2(v2.value1) + "px")));
2955 }
2851 }
2956 ;
2852 ;
2957− if (v instanceof Explain) {
2853+ if (v2 instanceof Explain) {
2958 return sk("explain")("border")("dashed magenta");
2854 return sk("explain")("border")("dashed magenta");
2959 }
2855 }
2960 ;
2856 ;
2961− if (v instanceof Align) {
2857+ if (v2 instanceof Align) {
2962 if (ctx instanceof Generic) {
2858 if (ctx instanceof Generic) {
2963 return mempty3;
2859 return mempty3;
2964 }
2860 }
@@ -2969,85 +2865,85 @@
2969 ;
2865 ;
2970 if (ctx instanceof Grid) {
2866 if (ctx instanceof Grid) {
2971 var v1 = function() {
2867 var v1 = function() {
2972− if (v.value1 instanceof Start) {
2868+ if (v2.value1 instanceof Start) {
2973 return "start";
2869 return "start";
2974 }
2870 }
2975 ;
2871 ;
2976− if (v.value1 instanceof Center) {
2872+ if (v2.value1 instanceof Center) {
2977 return "center";
2873 return "center";
2978 }
2874 }
2979 ;
2875 ;
2980− if (v.value1 instanceof End) {
2876+ if (v2.value1 instanceof End) {
2981 return "end";
2877 return "end";
2982 }
2878 }
2983 ;
2879 ;
2984− throw new Error("Failed pattern match at Plum.View (line 311, column 13 - line 314, column 27): " + [v.value1.constructor.name]);
2880+ throw new Error("Failed pattern match at Plum.View (line 431, column 13 - line 434, column 27): " + [v2.value1.constructor.name]);
2985 }();
2881 }();
2986 var k = function() {
2882 var k = function() {
2987− if (v.value0 instanceof X) {
2883+ if (v2.value0 instanceof X) {
2988 return "justify-items";
2884 return "justify-items";
2989 }
2885 }
2990 ;
2886 ;
2991− if (v.value0 instanceof Y) {
2887+ if (v2.value0 instanceof Y) {
2992 return "align-items";
2888 return "align-items";
2993 }
2889 }
2994 ;
2890 ;
2995− throw new Error("Failed pattern match at Plum.View (line 306, column 13 - line 308, column 33): " + [v.value0.constructor.name]);
2891+ throw new Error("Failed pattern match at Plum.View (line 426, column 13 - line 428, column 33): " + [v2.value0.constructor.name]);
2996 }();
2892 }();
2997 return sk("align-grid-" + (k + ("-" + v1)))(k)(v1);
2893 return sk("align-grid-" + (k + ("-" + v1)))(k)(v1);
2998 }
2894 }
2999 ;
2895 ;
3000 if (ctx instanceof Flexbox) {
2896 if (ctx instanceof Flexbox) {
3001 var v1 = function() {
2897 var v1 = function() {
3002− if (v.value1 instanceof Start) {
2898+ if (v2.value1 instanceof Start) {
3003 return "flex-start";
2899 return "flex-start";
3004 }
2900 }
3005 ;
2901 ;
3006− if (v.value1 instanceof Center) {
2902+ if (v2.value1 instanceof Center) {
3007 return "center";
2903 return "center";
3008 }
2904 }
3009 ;
2905 ;
3010− if (v.value1 instanceof End) {
2906+ if (v2.value1 instanceof End) {
3011 return "flex-end";
2907 return "flex-end";
3012 }
2908 }
3013 ;
2909 ;
3014− throw new Error("Failed pattern match at Plum.View (line 330, column 13 - line 333, column 32): " + [v.value1.constructor.name]);
2910+ throw new Error("Failed pattern match at Plum.View (line 450, column 13 - line 453, column 32): " + [v2.value1.constructor.name]);
3015 }();
2911 }();
3016 var k = function() {
2912 var k = function() {
3017− var v2 = new Tuple(ctx.value0, v.value0);
2913+ var v22 = new Tuple(ctx.value0, v2.value0);
3018− if (v2.value0 instanceof X && v2.value1 instanceof X) {
2914+ if (v22.value0 instanceof X && v22.value1 instanceof X) {
3019 return "justify-content";
2915 return "justify-content";
3020 }
2916 }
3021 ;
2917 ;
3022− if (v2.value0 instanceof X && v2.value1 instanceof Y) {
2918+ if (v22.value0 instanceof X && v22.value1 instanceof Y) {
3023 return "align-items";
2919 return "align-items";
3024 }
2920 }
3025 ;
2921 ;
3026− if (v2.value0 instanceof Y && v2.value1 instanceof X) {
2922+ if (v22.value0 instanceof Y && v22.value1 instanceof X) {
3027 return "align-items";
2923 return "align-items";
3028 }
2924 }
3029 ;
2925 ;
3030− if (v2.value0 instanceof Y && v2.value1 instanceof Y) {
2926+ if (v22.value0 instanceof Y && v22.value1 instanceof Y) {
3031 return "justify-content";
2927 return "justify-content";
3032 }
2928 }
3033 ;
2929 ;
3034− throw new Error("Failed pattern match at Plum.View (line 322, column 13 - line 326, column 42): " + [v2.constructor.name]);
2930+ throw new Error("Failed pattern match at Plum.View (line 442, column 13 - line 446, column 42): " + [v22.constructor.name]);
3035 }();
2931 }();
3036 return sk("align-flexbox-" + (k + ("-" + v1)))(k)(v1);
2932 return sk("align-flexbox-" + (k + ("-" + v1)))(k)(v1);
3037 }
2933 }
3038 ;
2934 ;
3039− throw new Error("Failed pattern match at Plum.View (line 300, column 26 - line 336, column 51): " + [ctx.constructor.name]);
2935+ throw new Error("Failed pattern match at Plum.View (line 420, column 26 - line 456, column 51): " + [ctx.constructor.name]);
3040 }
2936 }
3041 ;
2937 ;
3042− if (v instanceof Width) {
2938+ if (v2 instanceof Width) {
3043− return sk("width-" + renderKey3(v.value0))("width")(render3(v.value0));
2939+ return sk("width-" + renderKey5(v2.value0))("width")(render5(v2.value0));
3044 }
2940 }
3045 ;
2941 ;
3046− if (v instanceof Height) {
2942+ if (v2 instanceof Height) {
3047− return sk("height-" + renderKey3(v.value0))("height")(render3(v.value0));
2943+ return sk("height-" + renderKey5(v2.value0))("height")(render5(v2.value0));
3048 }
2944 }
3049 ;
2945 ;
3050− if (v instanceof Wrapped) {
2946+ if (v2 instanceof Wrapped) {
3051 if (ctx instanceof Flexbox) {
2947 if (ctx instanceof Flexbox) {
3052 return sk("wrapped")("flex-wrap")("wrap");
2948 return sk("wrapped")("flex-wrap")("wrap");
3053 }
2949 }
@@ -3055,15 +2951,15 @@
3055 return pure2([]);
2951 return pure2([]);
3056 }
2952 }
3057 ;
2953 ;
3058− if (v instanceof BackgroundColor) {
2954+ if (v2 instanceof BackgroundColor) {
3059− return sk("bg-color-" + renderKey1(v.value0))("background-color")(render1(v.value0));
2955+ return sk("bg-color-" + renderKey1(v2.value0))("background-color")(render1(v2.value0));
3060 }
2956 }
3061 ;
2957 ;
3062− if (v instanceof Padding) {
2958+ if (v2 instanceof Padding) {
3063− return sk("padding-" + (renderKey2(v.value0) + ("-" + show2(v.value1))))("padding-" + render2(v.value0))(show2(v.value1) + "px");
2959+ return sk("padding-" + (renderKey2(v2.value0) + ("-" + show2(v2.value1))))("padding-" + render2(v2.value0))(show2(v2.value1) + "px");
3064 }
2960 }
3065 ;
2961 ;
3066− if (v instanceof Spread) {
2962+ if (v2 instanceof Spread) {
3067 if (ctx instanceof Flexbox) {
2963 if (ctx instanceof Flexbox) {
3068 return sk("spread")("justify-content")("space-between");
2964 return sk("spread")("justify-content")("space-between");
3069 }
2965 }
@@ -3071,54 +2967,66 @@
3071 return pure2([]);
2967 return pure2([]);
3072 }
2968 }
3073 ;
2969 ;
3074− if (v instanceof Opacity) {
2970+ if (v2 instanceof Opacity) {
3075− return sk("opacity-" + show1(v.value0))("opacity")(show1(v.value0));
2971+ return sk("opacity-" + show1(v2.value0))("opacity")(show1(v2.value0));
3076 }
2972 }
3077 ;
2973 ;
3078− if (v instanceof Pointer) {
2974+ if (v2 instanceof Pointer) {
3079 return sk("pointer")("cursor")("pointer");
2975 return sk("pointer")("cursor")("pointer");
3080 }
2976 }
3081 ;
2977 ;
3082− if (v instanceof Move) {
2978+ if (v2 instanceof Move) {
3083− return sk("move-" + (show2(v.value0.x) + ("-" + show2(v.value0.y))))("transform")("translate(" + (show2(v.value0.x) + ("px, " + (show2(v.value0.y) + "px)"))));
2979+ return sk("move-" + (show2(v2.value0.x) + ("-" + show2(v2.value0.y))))("transform")("translate(" + (show2(v2.value0.x) + ("px, " + (show2(v2.value0.y) + "px)"))));
3084 }
2980 }
3085 ;
2981 ;
3086− if (v instanceof Clip && v.value0 instanceof X) {
2982+ if (v2 instanceof Clip && v2.value0 instanceof X) {
3087 return sk("clip-x")("overflow-x")("hidden");
2983 return sk("clip-x")("overflow-x")("hidden");
3088 }
2984 }
3089 ;
2985 ;
3090− if (v instanceof Clip && v.value0 instanceof Y) {
2986+ if (v2 instanceof Clip && v2.value0 instanceof Y) {
3091 return sk("clip-y")("overflow-y")("hidden");
2987 return sk("clip-y")("overflow-y")("hidden");
3092 }
2988 }
3093 ;
2989 ;
2990+ if (v2 instanceof BorderWidth) {
2991+ return sk("border-width-" + (renderKey2(v2.value0) + ("-" + show2(v2.value1))))("border-" + (render2(v2.value0) + "-width"))(show2(v2.value1) + "px");
2992+ }
2993+ ;
2994+ if (v2 instanceof BorderStyle) {
2995+ return sk("border-style-" + renderKey3(v2.value0))("border-style")(render3(v2.value0));
2996+ }
2997+ ;
2998+ if (v2 instanceof Round) {
2999+ return sk("round-" + (renderKey4(v2.value0) + ("-" + show2(v2.value1))))("border-" + (render4(v2.value0) + "-radius"))(show2(v2.value1) + "px");
3000+ }
3001+ ;
3002+ if (v2 instanceof Shadow) {
3003+ return sk("shadow-" + renderKey6(v2.value0))("box-shadow")(render6(v2.value0));
3004+ }
3005+ ;
3006+ if (v2 instanceof InnerShadow) {
3007+ return sk("inner-shadow-" + renderKey6(v2.value0))("box-shadow")(render6(v2.value0) + " inset");
3008+ }
3009+ ;
3010+ if (v2 instanceof FontColor) {
3011+ return sk("font-color-" + renderKey1(v2.value0))("color")(render1(v2.value0));
3012+ }
3013+ ;
3014+ if (v2 instanceof FontSize) {
3015+ return sk("font-size-" + show2(v2.value0))("font-size")(show2(v2.value0) + "px");
3016+ }
3017+ ;
3018+ if (v2 instanceof Font) {
3019+ return sk("font-" + removeSpaces(v2.value0))("font-family")(v2.value0);
3020+ }
3021+ ;
3022+ if (v2 instanceof FontWeight) {
3023+ return sk("font-weight-" + show2(v2.value0))("font-weight")(show2(v2.value0));
3024+ }
3025+ ;
3094− throw new Error("Failed pattern match at Plum.View (line 297, column 12 - line 355, column 46): " + [v.constructor.name]);
3026+ throw new Error("Failed pattern match at Plum.View (line 417, column 12 - line 484, column 71): " + [v2.constructor.name]);
3095− };
3096− };
3097− var onMouseDown = function(dictMonoid) {
3098− var mempty52 = mempty(monoidRecord2(monoidRecordCons3(dictMonoid)()(monoidRecordCons4)));
3099− return function(v) {
3100− return new UI({
3101− nerves: mempty52.nerves,
3102− meat: mempty52.meat,
3103− hover: mempty52.hover,
3104− children: mempty52.children,
3105− down: v.value0.meat
3106− }, v.value1);
3107− };
3108− };
3109− var onHover = function(dictMonoid) {
3110− var mempty52 = mempty(monoidRecord2(monoidRecordCons3(dictMonoid)()(monoidRecordCons4)));
3111− return function(v) {
3112− return new UI({
3113− nerves: mempty52.nerves,
3114− meat: mempty52.meat,
3115− down: mempty52.down,
3116− children: mempty52.children,
3117− hover: v.value0.meat
3118− }, v.value1);
3119 };
3027 };
3120 };
3028 };
3121− var m = function(dictMonoid) {
3029+ var m2 = function(dictMonoid) {
3122 var mempty52 = mempty(monoidRecord2(monoidRecordCons3(dictMonoid)()(monoidRecordCons4)));
3030 var mempty52 = mempty(monoidRecord2(monoidRecordCons3(dictMonoid)()(monoidRecordCons4)));
3123 return function(meat) {
3031 return function(meat) {
3124 return new UI({
3032 return new UI({
@@ -3130,36 +3038,55 @@
3130 }, mempty22);
3038 }, mempty22);
3131 };
3039 };
3132 };
3040 };
3041+ var width = function(dictMonoid) {
3042+ var m1 = m2(dictMonoid);
3043+ return function(l2) {
3044+ return m1(new Width(l2));
3045+ };
3046+ };
3047+ var height = function(dictMonoid) {
3048+ var m1 = m2(dictMonoid);
3049+ return function(l2) {
3050+ return m1(new Height(l2));
3051+ };
3052+ };
3133− var hWith = function(elem2) {
3053+ var hWith = function() {
3134− return function(props) {
3054+ return function(elem2) {
3135− return function(classes) {
3055+ return function(props) {
3136− return function(children) {
3056+ return function(classes) {
3057+ return function(children) {
3137− return h2(elem2)(unsafeUnion(props)({
3058+ return h2(elem2)({
3138− "class": intercalate3(" ")(classes)
3059+ attrs: union(fromHomogeneous2(props))(singleton2("class")(intercalate3(" ")(classes))),
3060+ on: empty2,
3061+ style: empty2
3139− }))(children);
3062+ })(children)(asOneOf2($$undefined));
3063+ };
3140 };
3064 };
3141 };
3065 };
3142 };
3066 };
3143 };
3067 };
3068+ var hWith1 = /* @__PURE__ */ hWith();
3144 var h3 = function(elem2) {
3069 var h3 = function(elem2) {
3145 return function(classes) {
3070 return function(classes) {
3146 return function(children) {
3071 return function(children) {
3147 return h2(elem2)({
3072 return h2(elem2)({
3148− "class": intercalate3(" ")(classes)
3073+ attrs: singleton2("class")(intercalate3(" ")(classes)),
3074+ on: empty2,
3075+ style: empty2
3149− })(children);
3076+ })(children)(asOneOf2($$undefined));
3150 };
3077 };
3151 };
3078 };
3152 };
3079 };
3153 var growSkin = function(fire) {
3080 var growSkin = function(fire) {
3154− return function(v) {
3081+ return function(v2) {
3155 return function(v1) {
3082 return function(v1) {
3156 var widthFill = [new Width(Fill.value), new Height(Fill.value)];
3083 var widthFill = [new Width(Fill.value), new Height(Fill.value)];
3157 var alignCenter = [new Align(X.value, Center.value), new Align(Y.value, Center.value)];
3084 var alignCenter = [new Align(X.value, Center.value), new Align(Y.value, Center.value)];
3158 var skn = function(ctx) {
3085 var skn = function(ctx) {
3159− return bind2(map2(function($513) {
3086+ return bind2(map2(function($574) {
3160− return function(v2) {
3087+ return function(v22) {
3161− return append2(v2)(v.extraSkin);
3088+ return append2(v22)(v2.extraSkin);
3162− }(concat($513));
3089+ }(concat($574));
3163 })(traverse2(skin(ctx))(append2(v1.value0.meat)(append2(function() {
3090 })(traverse2(skin(ctx))(append2(v1.value0.meat)(append2(function() {
3164 if (ctx instanceof Span) {
3091 if (ctx instanceof Span) {
3165 return mempty2;
3092 return mempty2;
@@ -3177,7 +3104,7 @@
3177 return widthFill;
3104 return widthFill;
3178 }
3105 }
3179 ;
3106 ;
3180− throw new Error("Failed pattern match at Plum.View (line 445, column 16 - line 449, column 35): " + [ctx.constructor.name]);
3107+ throw new Error("Failed pattern match at Plum.View (line 577, column 16 - line 581, column 35): " + [ctx.constructor.name]);
3181 }())(function() {
3108 }())(function() {
3182 if (ctx instanceof Grid) {
3109 if (ctx instanceof Grid) {
3183 return alignCenter;
3110 return alignCenter;
@@ -3195,9 +3122,9 @@
3195 return alignCenter;
3122 return alignCenter;
3196 }
3123 }
3197 ;
3124 ;
3198− throw new Error("Failed pattern match at Plum.View (line 450, column 16 - line 454, column 37): " + [ctx.constructor.name]);
3125+ throw new Error("Failed pattern match at Plum.View (line 582, column 16 - line 586, column 37): " + [ctx.constructor.name]);
3199 }())))))(function(meatClasses) {
3126 }())))))(function(meatClasses) {
3200− var v2 = runWriter(traverse2(skin(ctx))(v1.value0.hover));
3127+ var v22 = runWriter(traverse2(skin(ctx))(v1.value0.hover));
3201 return bind2(traverseWithIndex2(function(key) {
3128 return bind2(traverseWithIndex2(function(key) {
3202 return function(val) {
3129 return function(val) {
3203 return tell2({
3130 return tell2({
@@ -3206,7 +3133,7 @@
3206 down: empty2
3133 down: empty2
3207 });
3134 });
3208 };
3135 };
3209− })(v2.value1.meat))(function() {
3136+ })(v22.value1.meat))(function() {
3210 var v3 = runWriter(traverse2(skin(ctx))(v1.value0.down));
3137 var v3 = runWriter(traverse2(skin(ctx))(v1.value0.down));
3211 return bind2(traverseWithIndex2(function(key) {
3138 return bind2(traverseWithIndex2(function(key) {
3212 return function(val) {
3139 return function(val) {
@@ -3219,7 +3146,7 @@
3219 })(v3.value1.meat))(function() {
3146 })(v3.value1.meat))(function() {
3220 return pure2(append2(meatClasses)(append2(map1(function(v4) {
3147 return pure2(append2(meatClasses)(append2(map1(function(v4) {
3221 return v4 + "-hover";
3148 return v4 + "-hover";
3222− })(concat(v2.value0)))(map1(function(v4) {
3149+ })(concat(v22.value0)))(map1(function(v4) {
3223 return v4 + "-down";
3150 return v4 + "-down";
3224 })(concat(v3.value0)))));
3151 })(concat(v3.value0)))));
3225 });
3152 });
@@ -3228,7 +3155,7 @@
3228 };
3155 };
3229 if (v1.value1 instanceof Text) {
3156 if (v1.value1 instanceof Text) {
3230 return map2(function(c) {
3157 return map2(function(c) {
3231− return h3("span")(c)([string(v1.value1.value0)]);
3158+ return string("span")(c)(v1.value1.value0);
3232 })(skn(Span.value));
3159 })(skn(Span.value));
3233 }
3160 }
3234 ;
3161 ;
@@ -3271,7 +3198,7 @@
3271 if (v1.value1 instanceof Link) {
3198 if (v1.value1 instanceof Link) {
3272 return bind2(append22(skn(new Flexbox(X.value)))(append22(sk("display-flex")("display")("flex"))(sk("flex-direction-row")("flex-direction")("row"))))(function(classes) {
3199 return bind2(append22(skn(new Flexbox(X.value)))(append22(sk("display-flex")("display")("flex"))(sk("flex-direction-row")("flex-direction")("row"))))(function(classes) {
3273 return bind2(growSkin(fire)(mempty4)(v1.value1.value2))(function(child$prime) {
3200 return bind2(growSkin(fire)(mempty4)(v1.value1.value2))(function(child$prime) {
3274− return pure2(hWith("a")({
3201+ return pure2(hWith1("a")({
3275 href: v1.value1.value0,
3202 href: v1.value1.value0,
3276 rel: "noopener noreferrer",
3203 rel: "noopener noreferrer",
3277 target: function() {
3204 target: function() {
@@ -3289,7 +3216,7 @@
3289 if (v1.value1 instanceof Download) {
3216 if (v1.value1 instanceof Download) {
3290 return bind2(append22(skn(new Flexbox(X.value)))(append22(sk("display-flex")("display")("flex"))(sk("flex-direction-row")("flex-direction")("row"))))(function(classes) {
3217 return bind2(append22(skn(new Flexbox(X.value)))(append22(sk("display-flex")("display")("flex"))(sk("flex-direction-row")("flex-direction")("row"))))(function(classes) {
3291 return bind2(growSkin(fire)(mempty4)(v1.value1.value2))(function(child$prime) {
3218 return bind2(growSkin(fire)(mempty4)(v1.value1.value2))(function(child$prime) {
3292− return pure2(hWith("a")({
3219+ return pure2(hWith1("a")({
3293 href: v1.value1.value0,
3220 href: v1.value1.value0,
3294 download: fromMaybe("")(v1.value1.value1.filename)
3221 download: fromMaybe("")(v1.value1.value1.filename)
3295 })(classes)([child$prime]));
3222 })(classes)([child$prime]));
@@ -3299,7 +3226,7 @@
3299 ;
3226 ;
3300 if (v1.value1 instanceof Image2) {
3227 if (v1.value1 instanceof Image2) {
3301 return map2(function(c) {
3228 return map2(function(c) {
3302− return hWith("img")({
3229+ return hWith1("img")({
3303 src: v1.value1.value0,
3230 src: v1.value1.value0,
3304 alt: v1.value1.value1.description
3231 alt: v1.value1.value1.description
3305 })(c)([]);
3232 })(c)([]);
@@ -3310,39 +3237,65 @@
3310 return pure2(h3("div")(mempty2)([]));
3237 return pure2(h3("div")(mempty2)([]));
3311 }
3238 }
3312 ;
3239 ;
3313− throw new Error("Failed pattern match at Plum.View (line 477, column 3 - line 518, column 37): " + [v1.value1.constructor.name]);
3240+ throw new Error("Failed pattern match at Plum.View (line 609, column 3 - line 650, column 37): " + [v1.value1.constructor.name]);
3314 };
3241 };
3315 };
3242 };
3316 };
3243 };
3317 var grow = function(fire) {
3244 var grow = function(fire) {
3318− return function(v) {
3245+ return function(v2) {
3319− var v1 = runWriter(growSkin(fire)(mempty4)(v));
3246+ var v1 = runWriter(growSkin(fire)(mempty4)(v2));
3320 return {
3247 return {
3321 node: v1.value0,
3248 node: v1.value0,
3322 style: styleSkinGrowth(v1.value1)
3249 style: styleSkinGrowth(v1.value1)
3323 };
3250 };
3324 };
3251 };
3325 };
3252 };
3253+ var fontWeight = function(dictMonoid) {
3254+ var m1 = m2(dictMonoid);
3255+ return function(f) {
3256+ return m1(new FontWeight(f));
3257+ };
3258+ };
3259+ var fontSize = function(dictMonoid) {
3260+ var m1 = m2(dictMonoid);
3261+ return function(f) {
3262+ return m1(new FontSize(f));
3263+ };
3264+ };
3265+ var font = function(dictMonoid) {
3266+ var m1 = m2(dictMonoid);
3267+ return function(f) {
3268+ return m1(new Font(f));
3269+ };
3270+ };
3326− var column = function(v) {
3271+ var column = function(v2) {
3327 return new UI({
3272 return new UI({
3328 nerves: mempty1.nerves,
3273 nerves: mempty1.nerves,
3329 meat: mempty1.meat,
3274 meat: mempty1.meat,
3330 hover: mempty1.hover,
3275 hover: mempty1.hover,
3331 down: mempty1.down,
3276 down: mempty1.down,
3332 children: [new Tuple({
3277 children: [new Tuple({
3333− meat: v.value0.meat,
3278+ meat: v2.value0.meat,
3334− nerves: v.value0.nerves,
3279+ nerves: v2.value0.nerves,
3335− hover: v.value0.hover,
3280+ hover: v2.value0.hover,
3336− down: v.value0.down
3281+ down: v2.value0.down
3337− }, new Column(v.value0.children))]
3282+ }, new Column(v2.value0.children))]
3338− }, v.value1);
3283+ }, unit);
3339 };
3284 };
3340 var bgColor = function(dictMonoid) {
3285 var bgColor = function(dictMonoid) {
3341− var m1 = m(dictMonoid);
3286+ var m1 = m2(dictMonoid);
3342 return function(c) {
3287 return function(c) {
3343 return m1(new BackgroundColor(c));
3288 return m1(new BackgroundColor(c));
3344 };
3289 };
3345 };
3290 };
3291+ var align = function(dictMonoid) {
3292+ var m1 = m2(dictMonoid);
3293+ return function(dir2) {
3294+ return function(al) {
3295+ return m1(new Align(dir2, al));
3296+ };
3297+ };
3298+ };
3346
3299
3347 // output/Web.DOM.NonElementParentNode/foreign.js
3300 // output/Web.DOM.NonElementParentNode/foreign.js
3348 function _getElementById(id) {
3301 function _getElementById(id) {
@@ -3354,13 +3307,13 @@
3354 }
3307 }
3355
3308
3356 // output/Data.Nullable/foreign.js
3309 // output/Data.Nullable/foreign.js
3357− function nullable(a, r, f) {
3310+ function nullable(a2, r2, f) {
3358− return a == null ? r : f(a);
3311+ return a2 == null ? r2 : f(a2);
3359 }
3312 }
3360
3313
3361 // output/Data.Nullable/index.js
3314 // output/Data.Nullable/index.js
3362− var toMaybe = function(n) {
3315+ var toMaybe = function(n2) {
3363− return nullable(n, Nothing.value, Just.create);
3316+ return nullable(n2, Nothing.value, Just.create);
3364 };
3317 };
3365
3318
3366 // output/Web.DOM.NonElementParentNode/index.js
3319 // output/Web.DOM.NonElementParentNode/index.js
@@ -3390,80 +3343,135 @@
3390
3343
3391 // output/Plum/index.js
3344 // output/Plum/index.js
3392 var bind3 = /* @__PURE__ */ bind(bindEffect);
3345 var bind3 = /* @__PURE__ */ bind(bindEffect);
3346+ var pure3 = /* @__PURE__ */ pure(applicativeEffect);
3347+ var asOneOf3 = /* @__PURE__ */ asOneOf();
3393 var outerStyle = "html,body{height:100%;padding:0;margin:0;}";
3348 var outerStyle = "html,body{height:100%;padding:0;margin:0;}";
3394 var run3 = function(id) {
3349 var run3 = function(id) {
3395 return function(plum2) {
3350 return function(plum2) {
3396 return function __do() {
3351 return function __do() {
3397− var modelRef = bind3(plum2.init)($$new)();
3352+ var initModel = plum2.init();
3353+ var modelRef = $$new(initModel)();
3398− var v = bind3(bind3(windowImpl)(document2))(function() {
3354+ var v2 = bind3(bind3(windowImpl)(document2))(function() {
3399− var $21 = getElementById(id);
3355+ var $23 = getElementById(id);
3400− return function($22) {
3356+ return function($24) {
3401− return $21(toNonElementParentNode($22));
3357+ return $23(toNonElementParentNode($24));
3402 };
3358 };
3403 }())();
3359 }())();
3404− if (v instanceof Just) {
3360+ if (v2 instanceof Just) {
3405− var projector = createProjector();
3361+ var patch = init();
3406− return replace(projector)(v.value0)(function __do2() {
3362+ var view = function(model) {
3407− var model = read(modelRef)();
3408 var v1 = plum2.view(model);
3363 var v1 = plum2.view(model);
3409− var v2 = head(v1.value0.children);
3364+ var v22 = uncons(v1.value0.children);
3410− if (v2 instanceof Nothing) {
3411− return h2("div")({})([]);
3412− }
3413− ;
3414− if (v2 instanceof Just) {
3365+ if (v22 instanceof Just) {
3415 var v3 = grow(function(msg) {
3366 var v3 = grow(function(msg) {
3416− return function __do3() {
3367+ return function __do2() {
3417− var m2 = read(modelRef)();
3368+ var m3 = read(modelRef)();
3418− var m_ = plum2.update(msg)(m2)();
3369+ var m_ = plum2.update(msg)(m3)();
3419 write(m_)(modelRef)();
3370 write(m_)(modelRef)();
3420− return scheduleRender(projector)();
3371+ var node2 = view(m_)();
3372+ patch(v2.value0)(node2)();
3373+ return unit;
3421 };
3374 };
3422− })(v2.value0);
3375+ })(v22.value0.head);
3423− return h2("div")({
3376+ return pure3(h2("div")({
3424− styles: {
3377+ attrs: empty2,
3425− height: "100%",
3378+ on: empty2,
3426− width: "100%"
3379+ style: empty2
3427− }
3380+ })([h2("style")({
3381+ attrs: empty2,
3382+ on: empty2,
3383+ style: empty2
3428− })([h2("style")({})([string(outerStyle + v3.style)]), v3.node]);
3384+ })([])(asOneOf3(outerStyle + v3.style)), v3.node])(asOneOf3($$undefined)));
3385+ }
3386+ ;
3387+ if (v22 instanceof Nothing) {
3388+ return pure3(h2("div")({
3389+ attrs: empty2,
3390+ on: empty2,
3391+ style: empty2
3392+ })([])(asOneOf3($$undefined)));
3429 }
3393 }
3430 ;
3394 ;
3431− throw new Error("Failed pattern match at Plum (line 35, column 20 - line 52, column 94): " + [v2.constructor.name]);
3395+ throw new Error("Failed pattern match at Plum (line 38, column 11 - line 74, column 36): " + [v22.constructor.name]);
3432− })();
3396+ };
3397+ var node = view(initModel)();
3398+ patch(v2.value0)(node)();
3399+ return unit;
3433 }
3400 }
3434 ;
3401 ;
3435− if (v instanceof Nothing) {
3402+ if (v2 instanceof Nothing) {
3436 return unit;
3403 return unit;
3437 }
3404 }
3438 ;
3405 ;
3439− throw new Error("Failed pattern match at Plum (line 26, column 92 - line 54, column 25): " + [v.constructor.name]);
3406+ throw new Error("Failed pattern match at Plum (line 32, column 92 - line 79, column 25): " + [v2.constructor.name]);
3440 };
3407 };
3441 };
3408 };
3442 };
3409 };
3443
3410
3444 // output/Main/index.js
3411 // output/Main/index.js
3445− var pure3 = /* @__PURE__ */ pure(applicativeEffect);
3412+ var pure4 = /* @__PURE__ */ pure(applicativeEffect);
3446 var discard3 = /* @__PURE__ */ discard(discardUnit);
3413 var discard3 = /* @__PURE__ */ discard(discardUnit);
3447 var discard1 = /* @__PURE__ */ discard3(/* @__PURE__ */ bindGenericUI(monoidArray));
3414 var discard1 = /* @__PURE__ */ discard3(/* @__PURE__ */ bindGenericUI(monoidArray));
3415+ var align2 = /* @__PURE__ */ align(monoidArray);
3416+ var height9 = /* @__PURE__ */ height(monoidArray);
3417+ var bgColor2 = /* @__PURE__ */ bgColor(monoidArray);
3418+ var mempty5 = /* @__PURE__ */ mempty(/* @__PURE__ */ monoidGenericUI(monoidArray)(monoidUnit));
3419+ var pure1 = /* @__PURE__ */ pure(/* @__PURE__ */ applicativeGenericUI(monoidArray));
3420+ var font2 = /* @__PURE__ */ font(monoidArray);
3421+ var width9 = /* @__PURE__ */ width(monoidArray);
3448 var discard22 = /* @__PURE__ */ discard3(/* @__PURE__ */ bindGenericUI(monoidUnit));
3422 var discard22 = /* @__PURE__ */ discard3(/* @__PURE__ */ bindGenericUI(monoidUnit));
3449− var onHover2 = /* @__PURE__ */ onHover(monoidUnit);
3450− var bgColor2 = /* @__PURE__ */ bgColor(monoidUnit);
3451− var onMouseDown2 = /* @__PURE__ */ onMouseDown(monoidUnit);
3423+ var fontSize2 = /* @__PURE__ */ fontSize(monoidUnit);
3452− var mempty5 = /* @__PURE__ */ mempty(/* @__PURE__ */ monoidGenericUI(monoidUnit)(monoidUnit));
3424+ var fontWeight2 = /* @__PURE__ */ fontWeight(monoidUnit);
3453 var plum = {
3425 var plum = {
3454− init: /* @__PURE__ */ pure3({
3426+ init: /* @__PURE__ */ pure4({
3455 text: "Test"
3427 text: "Test"
3456 }),
3428 }),
3457 view: function(model) {
3429 view: function(model) {
3458− return column(discard1(text("hi")(discard22(onHover2(bgColor2(rgb(1)(0)(0))))(function() {
3430+ return stack(discard1(align2(Y.value)(End.value))(function() {
3431+ return discard1(height9(Fit.value))(function() {
3432+ return discard1(row(discard1(align2(Y.value)(End.value))(function() {
3459− return onMouseDown2(bgColor2(rgb(0)(1)(0)));
3433+ return discard1(column(discard1(bgColor2(rgb(0)(0)(0)))(function() {
3434+ return height9(new Px(10));
3460− })))(function() {
3435+ })))(function() {
3461− return text("hello")(mempty5);
3436+ return discard1(column(mempty5))(function() {
3437+ return pure1(unit);
3438+ });
3439+ });
3440+ })))(function() {
3441+ return discard1(column(discard1(font2("sans-serif"))(function() {
3442+ return discard1(column(discard1(height9(new Px(100)))(function() {
3443+ return width9(Fit.value);
3444+ })))(function() {
3445+ return discard1(align2(Y.value)(Start.value))(function() {
3446+ return discard1(width9(Fill.value))(function() {
3447+ return column(discard1(width9(Fill.value))(function() {
3448+ return discard1(width9(Fit.value))(function() {
3449+ return discard1(height9(Fit.value))(function() {
3450+ return discard1(text("PureStack")(discard22(fontSize2(72))(function() {
3451+ return fontWeight2(1e3);
3452+ })))(function() {
3453+ return column(discard1(bgColor2(rgb(0)(0)(0)))(function() {
3454+ return discard1(height9(new Px(10)))(function() {
3455+ return width9(Fill.value);
3456+ });
3457+ }));
3458+ });
3459+ });
3460+ });
3461+ }));
3462+ });
3463+ });
3464+ });
3465+ })))(function() {
3466+ return column(width9(Fill.value));
3467+ });
3468+ });
3469+ });
3462 }));
3470 }));
3463 },
3471 },
3464 update: function(msg) {
3472 update: function(msg) {
3465 return function(model) {
3473 return function(model) {
3466− return pure3({
3474+ return pure4({
3467 text: "Button pressed"
3475 text: "Button pressed"
3468 });
3476 });
3469 };
3477 };
plum/spago.dhall+4
@@ -6,12 +6,15 @@
6 , "effect"
6 , "effect"
7 , "foldable-traversable"
7 , "foldable-traversable"
8 , "foreign-object"
8 , "foreign-object"
9+ , "functions"
9 , "integers"
10 , "integers"
11+ , "literals"
10 , "maybe"
12 , "maybe"
11 , "numbers"
13 , "numbers"
12 , "prelude"
14 , "prelude"
13 , "record"
15 , "record"
14 , "refs"
16 , "refs"
17+ , "strings"
15 , "strings-extra"
18 , "strings-extra"
16 , "transformers"
19 , "transformers"
17 , "tuples"
20 , "tuples"
@@ -19,6 +22,7 @@
19 , "unsafe-coerce"
22 , "unsafe-coerce"
20 , "untagged-union"
23 , "untagged-union"
21 , "web-dom"
24 , "web-dom"
25+ , "web-events"
22 , "web-html"
26 , "web-html"
23 ]
27 ]
24, packages = ../packages.dhall
28, packages = ../packages.dhall
plum/src/Main.purs+38−8
@@ -1,10 +1,10 @@
1module Main where
1module Main where
2
2
3+import Plum.View
3import Prelude
4import Prelude
4
5
5import Effect (Effect)
6import Effect (Effect)
6import Plum as Plum
7import Plum as Plum
7−import Plum.View
8
8
9main :: Effect Unit
9main :: Effect Unit
10main = do
10main = do
@@ -16,13 +16,43 @@ plum :: Plum.Plum Unit Model
16plum =
16plum =
17 { init: pure { text: "Test" }
17 { init: pure { text: "Test" }
18 , view: \model -> do
18 , view: \model -> do
19+ stack do
20+ align Y End
21+ height Fit
22+ row do
23+ align Y End
24+ column do
25+ bgColor $ rgb 0.0 0.0 0.0
26+ height (Px 10)
27+ column mempty
28+ pure unit
29+ column do
30+ font "sans-serif"
31+ column do
32+ height (Px 100)
33+ width Fit
34+ align Y Start
35+ width Fill
36+ column $ do
37+ width Fill
38+ width Fit
39+ height Fit
40+ text "PureStack" do
41+ fontSize 72
42+ fontWeight 1000
19− column do
43+ column do
44+ bgColor $ rgb 0.0 0.0 0.0
45+ height (Px 10)
46+ width Fill
47+ column do
48+ width Fill
49+
20− text "hi" do
50+ -- text "hi" do
21− onHover do
51+ -- onHover do
22− bgColor $ rgb 1.0 0.0 0.0
52+ -- bgColor $ rgb 1.0 0.0 0.0
23− onMouseDown $ do
53+ -- onMouseDown $ do
24− bgColor $ rgb 0.0 1.0 0.0
54+ -- bgColor $ rgb 0.0 1.0 0.0
25− text "hello" mempty
55+ -- text "hello" mempty
26 , update: \msg model -> case msg of
56 , update: \msg model -> case msg of
27 _ -> pure { text: "Button pressed" }
57 _ -> pure { text: "Button pressed" }
28 }
58 }
plum/src/Maquette.jsdeleted−953
@@ -1,953 +0,0 @@
1−'use strict';
2−
3−var NAMESPACE_W3 = "http://www.w3.org/";
4−var NAMESPACE_SVG = NAMESPACE_W3 + "2000/svg";
5−var NAMESPACE_XLINK = NAMESPACE_W3 + "1999/xlink";
6−var emptyArray = [];
7−var extend = function (base, overrides) {
8− var result = {};
9− Object.keys(base).forEach(function (key) {
10− result[key] = base[key];
11− });
12− if (overrides) {
13− Object.keys(overrides).forEach(function (key) {
14− result[key] = overrides[key];
15− });
16− }
17− return result;
18−};
19−var same = function (vnode1, vnode2) {
20− if (vnode1.vnodeSelector !== vnode2.vnodeSelector) {
21− return false;
22− }
23− if (vnode1.properties && vnode2.properties) {
24− if (vnode1.properties.key !== vnode2.properties.key) {
25− return false;
26− }
27− return vnode1.properties.bind === vnode2.properties.bind;
28− }
29− return !vnode1.properties && !vnode2.properties;
30−};
31−var checkStyleValue = function (styleValue) {
32− if (typeof styleValue !== "string") {
33− throw new Error("Style values must be strings");
34− }
35−};
36−var findIndexOfChild = function (children, sameAs, start) {
37− if (sameAs.vnodeSelector !== "") {
38− // Never scan for text-nodes
39− for (var i = start; i < children.length; i++) {
40− if (same(children[i], sameAs)) {
41− return i;
42− }
43− }
44− }
45− return -1;
46−};
47−var checkDistinguishable = function (childNodes, indexToCheck, parentVNode, operation) {
48− var childNode = childNodes[indexToCheck];
49− if (childNode.vnodeSelector === "") {
50− return; // Text nodes need not be distinguishable
51− }
52− var properties = childNode.properties;
53− var key = properties
54− ? properties.key === undefined
55− ? properties.bind
56− : properties.key
57− : undefined;
58− if (!key) {
59− // A key is just assumed to be unique
60− for (var i = 0; i < childNodes.length; i++) {
61− if (i !== indexToCheck) {
62− var node = childNodes[i];
63− if (same(node, childNode)) {
64− throw {
65− error: new Error(parentVNode.vnodeSelector + " had a " + childNode.vnodeSelector + " child " + (operation === "added" ? operation : "removed") + ", but there is now more than one. You must add unique key properties to make them distinguishable."),
66− parentNode: parentVNode,
67− childNode: childNode,
68− };
69− }
70− }
71− }
72− }
73−};
74−var nodeAdded = function (vNode) {
75− if (vNode.properties) {
76− var enterAnimation = vNode.properties.enterAnimation;
77− if (enterAnimation) {
78− enterAnimation(vNode.domNode, vNode.properties);
79− }
80− }
81−};
82−var removedNodes = [];
83−var requestedIdleCallback = false;
84−var visitRemovedNode = function (node) {
85− (node.children || []).forEach(visitRemovedNode);
86− if (node.properties && node.properties.afterRemoved) {
87− node.properties.afterRemoved.apply(node.properties.bind || node.properties, [
88− node.domNode,
89− ]);
90− }
91−};
92−var processPendingNodeRemovals = function () {
93− requestedIdleCallback = false;
94− removedNodes.forEach(visitRemovedNode);
95− removedNodes.length = 0;
96−};
97−var scheduleNodeRemoval = function (vNode) {
98− removedNodes.push(vNode);
99− if (!requestedIdleCallback) {
100− requestedIdleCallback = true;
101− if (typeof window !== "undefined" && "requestIdleCallback" in window) {
102− window.requestIdleCallback(processPendingNodeRemovals, { timeout: 16 });
103− }
104− else {
105− setTimeout(processPendingNodeRemovals, 16);
106− }
107− }
108−};
109−var nodeToRemove = function (vNode) {
110− var domNode = vNode.domNode;
111− if (vNode.properties) {
112− var exitAnimation = vNode.properties.exitAnimation;
113− if (exitAnimation) {
114− domNode.style.pointerEvents = "none";
115− var removeDomNode = function () {
116− if (domNode.parentNode) {
117− domNode.parentNode.removeChild(domNode);
118− scheduleNodeRemoval(vNode);
119− }
120− };
121− exitAnimation(domNode, removeDomNode, vNode.properties);
122− return;
123− }
124− }
125− if (domNode.parentNode) {
126− domNode.parentNode.removeChild(domNode);
127− scheduleNodeRemoval(vNode);
128− }
129−};
130−var vnodeOnlyProps = [
131− "afterCreate",
132− "afterUpdate",
133− "afterRemoved",
134− "enterAnimation",
135− "exitAnimation",
136− "updateAnimation",
137−];
138−function filterVNodeOnlyProps(name) {
139− return !vnodeOnlyProps.includes(name);
140−}
141−var setProperties = function (domNode, properties, projectionOptions) {
142− if (!properties) {
143− return;
144− }
145− var eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor;
146− var propNames = Object.keys(properties).filter(filterVNodeOnlyProps);
147− var propCount = propNames.length;
148− for (var i = 0; i < propCount; i++) {
149− var propName = propNames[i];
150− var propValue = properties[propName];
151− if (propName === "className") {
152− throw new Error('Property "className" is not supported, use "class".');
153− }
154− else if (propName === "class") {
155− toggleClasses(domNode, propValue, true);
156− }
157− else if (propName === "classes") {
158− // object with string keys and boolean values
159− var classNames = Object.keys(propValue);
160− var classNameCount = classNames.length;
161− for (var j = 0; j < classNameCount; j++) {
162− var className = classNames[j];
163− if (propValue[className]) {
164− domNode.classList.add(className);
165− }
166− }
167− }
168− else if (propName === "styles") {
169− // object with string keys and string (!) values
170− var styleNames = Object.keys(propValue);
171− var styleCount = styleNames.length;
172− for (var j = 0; j < styleCount; j++) {
173− var styleName = styleNames[j];
174− var styleValue = propValue[styleName];
175− if (styleValue) {
176− checkStyleValue(styleValue);
177− projectionOptions.styleApplyer(domNode, styleName, styleValue);
178− }
179− }
180− }
181− else if (propName === "on" && propValue) {
182− // object with string keys and function values
183− for (var _i = 0, _a = Object.entries(properties.on); _i < _a.length; _i++) {
184− var _b = _a[_i], key = _b[0], handler = _b[1];
185− var listener = typeof handler === "function" ? handler : handler.listener;
186− if (eventHandlerInterceptor) {
187− listener = eventHandlerInterceptor(key, listener, domNode, properties);
188− }
189− if (listener) {
190− domNode.addEventListener(key, listener, typeof handler === "function" ? undefined : handler.options);
191− }
192− }
193− }
194− else if (propName !== "key" && propValue !== null && propValue !== undefined) {
195− var type = typeof propValue;
196− if (type === "function") {
197− if (propName.lastIndexOf("on", 0) === 0) {
198− // lastIndexOf(,0)===0 -> startsWith
199− if (eventHandlerInterceptor) {
200− propValue = eventHandlerInterceptor(propName, propValue, domNode, properties); // intercept eventhandlers
201− }
202− }
203− domNode[propName] = propValue;
204− }
205− else if (projectionOptions.namespace === NAMESPACE_SVG) {
206− if (propName === "href") {
207− domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);
208− }
209− else {
210− // all SVG attributes are read-only in DOM, so...
211− domNode.setAttribute(propName, propValue);
212− }
213− }
214− else if (type === "string" && propName !== "value" && propName !== "innerHTML") {
215− domNode.setAttribute(propName, propValue);
216− }
217− else {
218− domNode[propName] = propValue;
219− }
220− }
221− }
222−};
223−var addChildren = function (domNode, children, projectionOptions) {
224− if (!children) {
225− return;
226− }
227− for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
228− var child = children_1[_i];
229− createDom(child, domNode, undefined, projectionOptions);
230− }
231−};
232−var initPropertiesAndChildren = function (domNode, vnode, projectionOptions) {
233− addChildren(domNode, vnode.children, projectionOptions); // children before properties, needed for value property of <select>.
234− if (vnode.text) {
235− domNode.textContent = vnode.text;
236− }
237− setProperties(domNode, vnode.properties, projectionOptions);
238− if (vnode.properties && vnode.properties.afterCreate) {
239− vnode.properties.afterCreate.apply(vnode.properties.bind || vnode.properties, [
240− domNode,
241− projectionOptions,
242− vnode.vnodeSelector,
243− vnode.properties,
244− vnode.children,
245− ]);
246− }
247−};
248−var createDom = function (vnode, parentNode, insertBefore, projectionOptions) {
249− var _a;
250− var domNode;
251− var start = 0;
252− var vnodeSelector = vnode.vnodeSelector;
253− var doc = parentNode.ownerDocument;
254− if (vnodeSelector === "") {
255− if (vnode.domNode) {
256− vnode.domNode.nodeValue = vnode.text;
257− }
258− else {
259− domNode = vnode.domNode = doc.createTextNode(vnode.text);
260− if (insertBefore !== undefined) {
261− parentNode.insertBefore(domNode, insertBefore);
262− }
263− else {
264− parentNode.appendChild(domNode);
265− }
266− }
267− }
268− else {
269− for (var i = 0; i <= vnodeSelector.length; ++i) {
270− var c = vnodeSelector.charAt(i);
271− if (i === vnodeSelector.length || c === "." || c === "#") {
272− var type = vnodeSelector.charAt(start - 1);
273− var found = vnodeSelector.slice(start, i);
274− if (type === ".") {
275− domNode.classList.add(found);
276− }
277− else if (type === "#") {
278− domNode.id = found;
279− }
280− else {
281− if (found === "svg") {
282− projectionOptions = extend(projectionOptions, {
283− namespace: NAMESPACE_SVG,
284− });
285− }
286− if (projectionOptions.namespace !== undefined) {
287− domNode = vnode.domNode = doc.createElementNS(projectionOptions.namespace, found);
288− }
289− else {
290− domNode = vnode.domNode =
291− vnode.domNode ||
292− (((_a = vnode.properties) === null || _a === void 0 ? void 0 : _a.is) ? doc.createElement(found, { is: vnode.properties.is })
293− : doc.createElement(found));
294− if (found === "input" && vnode.properties && vnode.properties.type !== undefined) {
295− // IE8 and older don't support setting input type after the DOM Node has been added to the document
296− domNode.setAttribute("type", vnode.properties.type);
297− }
298− }
299− if (insertBefore !== undefined) {
300− parentNode.insertBefore(domNode, insertBefore);
301− }
302− else if (domNode.parentNode !== parentNode) {
303− parentNode.appendChild(domNode);
304− }
305− }
306− start = i + 1;
307− }
308− }
309− initPropertiesAndChildren(domNode, vnode, projectionOptions);
310− }
311−};
312−var updateDom;
313−/**
314− * Adds or removes classes from an Element
315− * @param domNode the element
316− * @param classes a string separated list of classes
317− * @param on true means add classes, false means remove
318− */
319−var toggleClasses = function (domNode, classes, on) {
320− if (!classes) {
321− return;
322− }
323− classes.split(" ").forEach(function (classToToggle) {
324− if (classToToggle) {
325− domNode.classList.toggle(classToToggle, on);
326− }
327− });
328−};
329−var updateProperties = function (domNode, previousProperties, properties, projectionOptions) {
330− if (!properties) {
331− return;
332− }
333− var propertiesUpdated = false;
334− var propNames = Object.keys(properties).filter(filterVNodeOnlyProps);
335− var propCount = propNames.length;
336− for (var i = 0; i < propCount; i++) {
337− var propName = propNames[i];
338− // assuming that properties will be nullified instead of missing is by design
339− var propValue = properties[propName];
340− var previousValue = previousProperties[propName];
341− if (propName === "class") {
342− if (previousValue !== propValue) {
343− toggleClasses(domNode, previousValue, false);
344− toggleClasses(domNode, propValue, true);
345− }
346− }
347− else if (propName === "classes") {
348− var classList = domNode.classList;
349− var classNames = Object.keys(propValue);
350− var classNameCount = classNames.length;
351− for (var j = 0; j < classNameCount; j++) {
352− var className = classNames[j];
353− var on = !!propValue[className];
354− var previousOn = !!previousValue[className];
355− if (on === previousOn) {
356− continue;
357− }
358− propertiesUpdated = true;
359− if (on) {
360− classList.add(className);
361− }
362− else {
363− classList.remove(className);
364− }
365− }
366− }
367− else if (propName === "styles") {
368− var styleNames = Object.keys(propValue);
369− var styleCount = styleNames.length;
370− for (var j = 0; j < styleCount; j++) {
371− var styleName = styleNames[j];
372− var newStyleValue = propValue[styleName];
373− var oldStyleValue = previousValue[styleName];
374− if (newStyleValue === oldStyleValue) {
375− continue;
376− }
377− propertiesUpdated = true;
378− if (newStyleValue) {
379− checkStyleValue(newStyleValue);
380− projectionOptions.styleApplyer(domNode, styleName, newStyleValue);
381− }
382− else {
383− projectionOptions.styleApplyer(domNode, styleName, "");
384− }
385− }
386− }
387− else {
388− if (!propValue && typeof previousValue === "string") {
389− propValue = "";
390− }
391− if (propName === "value") {
392− // value can be manipulated by the user directly and using event.preventDefault() is not an option
393− var domValue = domNode[propName];
394− if (domValue !== propValue && // The 'value' in the DOM tree !== newValue
395− propValue !== previousValue // Only update the value if the vdom changed
396− ) {
397− // The edge cases are described in the tests
398− domNode[propName] = propValue; // Reset the value, even if the virtual DOM did not change
399− } // else do not update the domNode, otherwise the cursor position would be changed
400− if (propValue !== previousValue) {
401− propertiesUpdated = true;
402− }
403− }
404− else if (propValue !== previousValue) {
405− var type = typeof propValue;
406− if (type !== "function" || !projectionOptions.eventHandlerInterceptor) {
407− // Function updates are expected to be handled by the EventHandlerInterceptor
408− if (projectionOptions.namespace === NAMESPACE_SVG) {
409− if (propName === "href") {
410− domNode.setAttributeNS(NAMESPACE_XLINK, propName, propValue);
411− }
412− else {
413− // all SVG attributes are read-only in DOM, so...
414− domNode.setAttribute(propName, propValue);
415− }
416− }
417− else if (type === "string" && propName !== "innerHTML") {
418− if (propName === "role" && propValue === "") {
419− domNode.removeAttribute(propName);
420− }
421− else {
422− domNode.setAttribute(propName, propValue);
423− }
424− }
425− else if (domNode[propName] !== propValue) {
426− // Comparison is here for side-effects in Edge with scrollLeft and scrollTop
427− domNode[propName] = propValue;
428− }
429− propertiesUpdated = true;
430− }
431− }
432− }
433− }
434− return propertiesUpdated;
435−};
436−var updateChildren = function (vnode, domNode, oldChildren, newChildren, projectionOptions) {
437− if (oldChildren === newChildren) {
438− return false;
439− }
440− oldChildren = oldChildren || emptyArray;
441− newChildren = newChildren || emptyArray;
442− var oldChildrenLength = oldChildren.length;
443− var newChildrenLength = newChildren.length;
444− var oldIndex = 0;
445− var newIndex = 0;
446− var i;
447− var textUpdated = false;
448− while (newIndex < newChildrenLength) {
449− var oldChild = oldIndex < oldChildrenLength ? oldChildren[oldIndex] : undefined;
450− var newChild = newChildren[newIndex];
451− if (oldChild !== undefined && same(oldChild, newChild)) {
452− textUpdated =
453− updateDom(oldChild, newChild, projectionOptions, domNode, oldChildren) || textUpdated;
454− oldIndex++;
455− }
456− else {
457− var findOldIndex = findIndexOfChild(oldChildren, newChild, oldIndex + 1);
458− if (findOldIndex >= 0) {
459− // Remove preceding missing children
460− for (i = oldIndex; i < findOldIndex; i++) {
461− nodeToRemove(oldChildren[i]);
462− checkDistinguishable(oldChildren, i, vnode, "removed");
463− }
464− textUpdated =
465− updateDom(oldChildren[findOldIndex], newChild, projectionOptions, domNode, oldChildren) ||
466− textUpdated;
467− oldIndex = findOldIndex + 1;
468− }
469− else {
470− // New child
471− createDom(newChild, domNode, oldIndex < oldChildrenLength ? oldChildren[oldIndex].domNode : undefined, projectionOptions);
472− nodeAdded(newChild);
473− checkDistinguishable(newChildren, newIndex, vnode, "added");
474− }
475− }
476− newIndex++;
477− }
478− if (oldChildrenLength > oldIndex) {
479− // Remove child fragments
480− for (i = oldIndex; i < oldChildrenLength; i++) {
481− nodeToRemove(oldChildren[i]);
482− checkDistinguishable(oldChildren, i, vnode, "removed");
483− }
484− }
485− return textUpdated;
486−};
487−updateDom = function (previous, vnode, projectionOptions, parentNode, oldChildren) {
488− var domNode = previous.domNode;
489− var textUpdated = false;
490− if (previous === vnode) {
491− return false; // By contract, VNode objects may not be modified anymore after passing them to maquette
492− }
493− var updated = false;
494− if (vnode.vnodeSelector === "") {
495− if (vnode.text !== previous.text) {
496− var newTextNode = domNode.ownerDocument.createTextNode(vnode.text);
497− try {
498− parentNode.replaceChild(newTextNode, domNode);
499− }
500− catch (e) {
501− // Text nodes can be substituted by google translate
502− parentNode.replaceChild(newTextNode, parentNode.childNodes[oldChildren.indexOf(previous)]);
503− }
504− vnode.domNode = newTextNode;
505− textUpdated = true;
506− return textUpdated;
507− }
508− vnode.domNode = domNode;
509− }
510− else {
511− if (vnode.vnodeSelector.lastIndexOf("svg", 0) === 0) {
512− // lastIndexOf(needle,0)===0 means StartsWith
513− projectionOptions = extend(projectionOptions, {
514− namespace: NAMESPACE_SVG,
515− });
516− }
517− if (previous.text !== vnode.text) {
518− updated = true;
519− if (vnode.text === undefined) {
520− domNode.removeChild(domNode.firstChild); // the only textnode presumably
521− }
522− else {
523− domNode.textContent = vnode.text;
524− }
525− }
526− vnode.domNode = domNode;
527− updated =
528− updateChildren(vnode, domNode, previous.children, vnode.children, projectionOptions) ||
529− updated;
530− updated =
531− updateProperties(domNode, previous.properties, vnode.properties, projectionOptions) ||
532− updated;
533− if (vnode.properties && vnode.properties.afterUpdate) {
534− vnode.properties.afterUpdate.apply(vnode.properties.bind || vnode.properties, [
535− domNode,
536− projectionOptions,
537− vnode.vnodeSelector,
538− vnode.properties,
539− vnode.children,
540− ]);
541− }
542− }
543− if (updated && vnode.properties && vnode.properties.updateAnimation) {
544− vnode.properties.updateAnimation(domNode, vnode.properties, previous.properties);
545− }
546− return textUpdated;
547−};
548−var createProjection = function (vnode, projectionOptions) {
549− return {
550− getLastRender: function () { return vnode; },
551− update: function (updatedVnode) {
552− if (vnode.vnodeSelector !== updatedVnode.vnodeSelector) {
553− throw new Error("The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)");
554− }
555− var previousVNode = vnode;
556− vnode = updatedVnode;
557− updateDom(previousVNode, updatedVnode, projectionOptions, previousVNode.domNode.parentNode, [previousVNode]);
558− },
559− domNode: vnode.domNode,
560− };
561−};
562−
563−var DEFAULT_PROJECTION_OPTIONS = {
564− namespace: undefined,
565− performanceLogger: function () { return undefined; },
566− eventHandlerInterceptor: undefined,
567− styleApplyer: function (domNode, styleName, value) {
568− if (styleName.charAt(0) === "-") {
569− // CSS variables must be set using setProperty
570− domNode.style.setProperty(styleName, value);
571− }
572− else {
573− // properties like 'backgroundColor' must be set as a js-property
574− domNode.style[styleName] = value;
575− }
576− },
577−};
578−var applyDefaultProjectionOptions = function (projectorOptions) {
579− return extend(DEFAULT_PROJECTION_OPTIONS, projectorOptions);
580−};
581−export var dom = {
582− /**
583− * Creates a real DOM tree from `vnode`. The [[Projection]] object returned will contain the resulting DOM Node in
584− * its [[Projection.domNode|domNode]] property.
585− * This is a low-level method. Users will typically use a [[Projector]] instead.
586− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
587− * objects may only be rendered once.
588− * @param projectionOptions - Options to be used to create and update the projection.
589− * @returns The [[Projection]] which also contains the DOM Node that was created.
590− */
591− create: function (vnode, projectionOptions) {
592− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
593− createDom(vnode, document.createElement("div"), undefined, projectionOptions);
594− return createProjection(vnode, projectionOptions);
595− },
596− /**
597− * Appends a new child node to the DOM which is generated from a [[VNode]].
598− * This is a low-level method. Users will typically use a [[Projector]] instead.
599− * @param parentNode - The parent node for the new child node.
600− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
601− * objects may only be rendered once.
602− * @param projectionOptions - Options to be used to create and update the [[Projection]].
603− * @returns The [[Projection]] that was created.
604− */
605− append: function (parentNode, vnode, projectionOptions) {
606− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
607− createDom(vnode, parentNode, undefined, projectionOptions);
608− return createProjection(vnode, projectionOptions);
609− },
610− /**
611− * Inserts a new DOM node which is generated from a [[VNode]].
612− * This is a low-level method. Users wil typically use a [[Projector]] instead.
613− * @param beforeNode - The node that the DOM Node is inserted before.
614− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function.
615− * NOTE: [[VNode]] objects may only be rendered once.
616− * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].
617− * @returns The [[Projection]] that was created.
618− */
619− insertBefore: function (beforeNode, vnode, projectionOptions) {
620− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
621− createDom(vnode, beforeNode.parentNode, beforeNode, projectionOptions);
622− return createProjection(vnode, projectionOptions);
623− },
624− /**
625− * Merges a new DOM node which is generated from a [[VNode]] with an existing DOM Node.
626− * This means that the virtual DOM and the real DOM will have one overlapping element.
627− * Therefore the selector for the root [[VNode]] will be ignored, but its properties and children will be applied to the Element provided.
628− * This is a low-level method. Users wil typically use a [[Projector]] instead.
629− * @param element - The existing element to adopt as the root of the new virtual DOM. Existing attributes and child nodes are preserved.
630− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]] objects
631− * may only be rendered once.
632− * @param projectionOptions - Options to be used to create and update the projection, see [[createProjector]].
633− * @returns The [[Projection]] that was created.
634− */
635− merge: function (element, vnode, projectionOptions) {
636− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
637− vnode.domNode = element;
638− initPropertiesAndChildren(element, vnode, projectionOptions);
639− return createProjection(vnode, projectionOptions);
640− },
641− /**
642− * Replaces an existing DOM node with a node generated from a [[VNode]].
643− * This is a low-level method. Users will typically use a [[Projector]] instead.
644− * @param element - The node for the [[VNode]] to replace.
645− * @param vnode - The root of the virtual DOM tree that was created using the [[h]] function. NOTE: [[VNode]]
646− * objects may only be rendered once.
647− * @param projectionOptions - Options to be used to create and update the [[Projection]].
648− * @returns The [[Projection]] that was created.
649− */
650− replace: function (element, vnode, projectionOptions) {
651− projectionOptions = applyDefaultProjectionOptions(projectionOptions);
652− createDom(vnode, element.parentNode, element, projectionOptions);
653− element.parentNode.removeChild(element);
654− return createProjection(vnode, projectionOptions);
655− },
656−};
657−
658−var toTextVNode = function (data) {
659− return {
660− vnodeSelector: "",
661− properties: undefined,
662− children: undefined,
663− text: data.toString(),
664− domNode: null,
665− };
666−};
667−var appendChildren = function (parentSelector, insertions, main) {
668− for (var i = 0, length_1 = insertions.length; i < length_1; i++) {
669− var item = insertions[i];
670− if (Array.isArray(item)) {
671− appendChildren(parentSelector, item, main);
672− }
673− else {
674− if (item !== null && item !== undefined && item !== false) {
675− if (typeof item === "string") {
676− item = toTextVNode(item);
677− }
678− main.push(item);
679− }
680− }
681− }
682−};
683−function h(selector, properties, children) {
684− if (Array.isArray(properties)) {
685− children = properties;
686− properties = undefined;
687− }
688− else if ((properties && (typeof properties === "string" || properties.vnodeSelector)) ||
689− (children && (typeof children === "string" || children.vnodeSelector))) {
690− throw new Error("h called with invalid arguments");
691− }
692− var text;
693− var flattenedChildren;
694− // Recognize a common special case where there is only a single text node
695− if (children && children.length === 1 && typeof children[0] === "string") {
696− text = children[0];
697− }
698− else if (children) {
699− flattenedChildren = [];
700− appendChildren(selector, children, flattenedChildren);
701− if (flattenedChildren.length === 0) {
702− flattenedChildren = undefined;
703− }
704− }
705− return {
706− vnodeSelector: selector,
707− properties: properties,
708− children: flattenedChildren,
709− text: text === "" ? undefined : text,
710− domNode: null,
711− };
712−}
713−
714−var createParentNodePath = function (node, rootNode) {
715− var parentNodePath = [];
716− while (node && node !== rootNode) {
717− parentNodePath.push(node);
718− node = node.parentNode;
719− }
720− return parentNodePath;
721−};
722−var find;
723−if (Array.prototype.find) {
724− find = function (items, predicate) { return items.find(predicate); };
725−}
726−else {
727− find = function (items, predicate) { return items.filter(predicate)[0]; };
728−}
729−var findVNodeByParentNodePath = function (vnode, parentNodePath) {
730− var result = vnode;
731− parentNodePath.forEach(function (node) {
732− result =
733− result && result.children
734− ? find(result.children, function (child) { return child.domNode === node; })
735− : undefined;
736− });
737− return result;
738−};
739−var createEventHandlerInterceptor = function (projector, getProjection, performanceLogger) {
740− return function (propertyName, eventHandler, domNode, properties) { return modifiedEventHandler; };
741− function modifiedEventHandler(evt) {
742− var _a, _b;
743− performanceLogger("domEvent", evt);
744− var projection = getProjection();
745− var parentNodePath = createParentNodePath(evt.currentTarget, projection.domNode);
746− parentNodePath.reverse();
747− var matchingVNode = findVNodeByParentNodePath(projection.getLastRender(), parentNodePath);
748− projector.scheduleRender();
749− var result;
750− if (matchingVNode) {
751− /* eslint-disable prefer-rest-params */
752− var listener = (_b = (_a = matchingVNode.properties["on" + evt.type]) !== null && _a !== void 0 ? _a : matchingVNode.properties.on[evt.type].listener) !== null && _b !== void 0 ? _b : matchingVNode.properties.on[evt.type];
753− result = listener.apply(matchingVNode.properties.bind || this, arguments);
754− /* eslint-enable prefer-rest-params */
755− }
756− performanceLogger("domEventProcessed", evt);
757− return result;
758− }
759−};
760−/**
761− * Creates a [[Projector]] instance using the provided projectionOptions.
762− *
763− * For more information, see [[Projector]].
764− *
765− * @param projectorOptions Options that influence how the DOM is rendered and updated.
766− */
767−export var createProjector = function (projectorOptions) {
768− var projector;
769− var projectionOptions = applyDefaultProjectionOptions(projectorOptions);
770− var performanceLogger = projectionOptions.performanceLogger;
771− var renderCompleted = true;
772− var scheduled;
773− var stopped = false;
774− var projections = [];
775− var renderFunctions = []; // matches the projections array
776− var addProjection = function (
777− /* one of: dom.append, dom.insertBefore, dom.replace, dom.merge */
778− domFunction,
779− /* the parameter of the domFunction */
780− node, renderFunction) {
781− var projection;
782− var getProjection = function () { return projection; };
783− projectionOptions.eventHandlerInterceptor = createEventHandlerInterceptor(projector, getProjection, performanceLogger);
784− projection = domFunction(node, renderFunction(), projectionOptions);
785− projections.push(projection);
786− renderFunctions.push(renderFunction);
787− };
788− var doRender = function () {
789− scheduled = undefined;
790− if (!renderCompleted) {
791− return; // The last render threw an error, it should have been logged in the browser console.
792− }
793− renderCompleted = false;
794− performanceLogger("renderStart", undefined);
795− for (var i = 0; i < projections.length; i++) {
796− var updatedVnode = renderFunctions[i]();
797− performanceLogger("rendered", undefined);
798− projections[i].update(updatedVnode);
799− performanceLogger("patched", undefined);
800− }
801− performanceLogger("renderDone", undefined);
802− renderCompleted = true;
803− };
804− projector = {
805− renderNow: doRender,
806− scheduleRender: function () {
807− if (!scheduled && !stopped) {
808− scheduled = requestAnimationFrame(doRender);
809− }
810− },
811− stop: function () {
812− if (scheduled) {
813− cancelAnimationFrame(scheduled);
814− scheduled = undefined;
815− }
816− stopped = true;
817− },
818− resume: function () {
819− stopped = false;
820− renderCompleted = true;
821− projector.scheduleRender();
822− },
823− append: function (parentNode, renderFunction) {
824− addProjection(dom.append, parentNode, renderFunction);
825− },
826− insertBefore: function (beforeNode, renderFunction) {
827− addProjection(dom.insertBefore, beforeNode, renderFunction);
828− },
829− merge: function (domNode, renderFunction) {
830− addProjection(dom.merge, domNode, renderFunction);
831− },
832− replace: function (domNode, renderFunction) {
833− addProjection(dom.replace, domNode, renderFunction);
834− },
835− detach: function (renderFunction) {
836− for (var i = 0; i < renderFunctions.length; i++) {
837− if (renderFunctions[i] === renderFunction) {
838− renderFunctions.splice(i, 1);
839− return projections.splice(i, 1)[0];
840− }
841− }
842− throw new Error("renderFunction was not found");
843− },
844− };
845− return projector;
846−};
847−
848−/**
849− * Creates a [[CalculationCache]] object, useful for caching [[VNode]] trees.
850− * In practice, caching of [[VNode]] trees is not needed, because achieving 60 frames per second is almost never a problem.
851− * For more information, see [[CalculationCache]].
852− *
853− * @param <Result> The type of the value that is cached.
854− */
855−export var createCache = function () {
856− var cachedInputs;
857− var cachedOutcome;
858− return {
859− invalidate: function () {
860− cachedOutcome = undefined;
861− cachedInputs = undefined;
862− },
863− result: function (inputs, calculation) {
864− if (cachedInputs) {
865− for (var i = 0; i < inputs.length; i++) {
866− if (cachedInputs[i] !== inputs[i]) {
867− cachedOutcome = undefined;
868− }
869− }
870− }
871− if (!cachedOutcome) {
872− cachedOutcome = calculation();
873− cachedInputs = inputs;
874− }
875− return cachedOutcome;
876− },
877− };
878−};
879−
880−/**
881− * Creates a {@link Mapping} instance that keeps an array of result objects synchronized with an array of source objects.
882− * See {@link http://maquettejs.org/docs/arrays.html Working with arrays}.
883− *
884− * @param <Source> The type of source items. A database-record for instance.
885− * @param <Target> The type of target items. A [[MaquetteComponent]] for instance.
886− * @param getSourceKey `function(source)` that must return a key to identify each source object. The result must either be a string or a number.
887− * @param createResult `function(source, index)` that must create a new result object from a given source. This function is identical
888− * to the `callback` argument in `Array.map(callback)`.
889− * @param updateResult `function(source, target, index)` that updates a result to an updated source.
890− */
891−export var createMapping = function (getSourceKey, createResult, updateResult) {
892− var keys = [];
893− var results = [];
894− return {
895− results: results,
896− map: function (newSources) {
897− var newKeys = newSources.map(getSourceKey);
898− var oldTargets = results.slice();
899− var oldIndex = 0;
900− for (var i = 0; i < newSources.length; i++) {
901− var source = newSources[i];
902− var sourceKey = newKeys[i];
903− if (sourceKey === keys[oldIndex]) {
904− results[i] = oldTargets[oldIndex];
905− updateResult(source, oldTargets[oldIndex], i);
906− oldIndex++;
907− }
908− else {
909− var found = false;
910− for (var j = 1; j < keys.length + 1; j++) {
911− var searchIndex = (oldIndex + j) % keys.length;
912− if (keys[searchIndex] === sourceKey) {
913− results[i] = oldTargets[searchIndex];
914− updateResult(newSources[i], oldTargets[searchIndex], i);
915− oldIndex = searchIndex + 1;
916− found = true;
917− break;
918− }
919− }
920− if (!found) {
921− results[i] = createResult(source, i);
922− }
923− }
924− }
925− results.length = newSources.length;
926− keys = newKeys;
927− },
928− };
929−};
930−
931−export function _h(selector) {
932− return function (properties) {
933− return function (children) {
934− return h(selector, properties, children)
935− }
936− }
937−}
938−
939−export function scheduleRender(projector) {
940− return function () {
941− projector.scheduleRender()
942− }
943−}
944−
945−export function replace(projector) {
946− return function (el) {
947− return function (render) {
948− return function () {
949− projector.replace(el, render)
950− }
951− }
952− }
953−}
plum/src/Maquette.pursdeleted−33
@@ -1,33 +0,0 @@
1−module Maquette
2− ( Projector
3− , createProjector
4− , string
5− , VNode
6− , h
7− , replace
8− , scheduleRender
9− ) where
10−
11−import Prelude
12−
13−import Effect (Effect)
14−import Unsafe.Coerce (unsafeCoerce)
15−import Web.DOM (Element)
16−
17−foreign import data Projector :: Type
18−
19−foreign import createProjector :: Effect Projector
20−
21−foreign import data VNode :: Type
22−
23−foreign import _h :: forall props. String -> { | props } -> Array VNode -> VNode
24−
25−h :: forall props. String -> Record props -> Array VNode -> VNode
26−h = _h
27−
28−string :: String -> VNode
29−string = unsafeCoerce
30−
31−foreign import scheduleRender :: Projector -> Effect Unit
32−
33−foreign import replace :: Projector -> Element -> Effect VNode -> Effect Unit
plum/src/Plum.purs+52−27
@@ -4,11 +4,16 @@ import Prelude
4
4
5import Data.Array ((:))
5import Data.Array ((:))
6import Data.Array as Array
6import Data.Array as Array
7+import Data.Function.Uncurried (runFn2)
7import Data.Maybe (Maybe(..))
8import Data.Maybe (Maybe(..))
8import Effect (Effect)
9import Effect (Effect)
10+import Effect.Console (log)
9import Effect.Ref as Ref
11import Effect.Ref as Ref
10−import Maquette as Maquette
12+import Foreign.Object as Object
13+import Literals.Undefined (undefined)
11import Plum.View (GenericUI(..), UI, grow)
14import Plum.View (GenericUI(..), UI, grow)
15+import Snabbdom as Snabbdom
16+import Untagged.Union (asOneOf)
12import Web.DOM.NonElementParentNode (getElementById) as Web
17import Web.DOM.NonElementParentNode (getElementById) as Web
13import Web.HTML (window) as Web
18import Web.HTML (window) as Web
14import Web.HTML.HTMLDocument (toNonElementParentNode) as Web
19import Web.HTML.HTMLDocument (toNonElementParentNode) as Web
@@ -22,35 +27,55 @@ type Plum msg model =
22
27
23run :: forall msg model. String -> Plum msg model -> Effect Unit
28run :: forall msg model. String -> Plum msg model -> Effect Unit
24run id plum = do
29run id plum = do
25− modelRef <- plum.init >>= Ref.new
30+ initModel <- plum.init
31+ modelRef <- Ref.new initModel
26 Web.window >>= Web.document >>= Web.getElementById id <<< Web.toNonElementParentNode >>= case _ of
32 Web.window >>= Web.document >>= Web.getElementById id <<< Web.toNonElementParentNode >>= case _ of
27 Just element -> do
33 Just element -> do
28− projector <- Maquette.createProjector
34+ patch <- Snabbdom.init
29− Maquette.replace projector element do
35+ let
36+ view model = do
37+ let UI { children } _ = plum.view model
38+ case Array.uncons children of
39+ Just { head: child } -> do
40+ let
41+ { node, style } = grow
42+ ( \msg -> do
30− model <- Ref.read modelRef
43+ m <- Ref.read modelRef
44+ m_ <- plum.update msg m
45+ Ref.write m_ modelRef
46+ node <- view m_
47+ _ <- patch element node
48+ pure unit
49+ )
50+ child
51+ pure $
52+ Snabbdom.h "div"
53+ { attrs: Object.empty
54+ , on: Object.empty
55+ , style: Object.empty
56+ }
57+ [ Snabbdom.h "style"
58+ { attrs: Object.empty
59+ , on: Object.empty
60+ , style: Object.empty
61+ }
62+ []
63+ (asOneOf $ outerStyle <> style)
64+ , node
65+ ]
66+ (asOneOf undefined)
67+ Nothing -> pure $
68+ Snabbdom.h "div"
69+ { attrs: Object.empty
70+ , on: Object.empty
71+ , style: Object.empty
72+ }
73+ []
74+ (asOneOf undefined)
75+ node <- view initModel
76+ _ <- patch element node
31
77
32− ( let
78+ pure unit
33− UI { children } _ = plum.view model
34− in
35− pure $ case Array.head children of
36− Nothing -> Maquette.h "div" {} []
37− Just child ->
38− let
39− { node, style } =
40− ( grow
41− ( \msg -> do
42− m <- Ref.read modelRef
43− m_ <- plum.update msg m
44− Ref.write m_ modelRef
45− Maquette.scheduleRender projector
46− )
47− ) child
48− in
49− Maquette.h
50− "div"
51− { styles: { height: "100%", width: "100%" } }
52− [ Maquette.h "style" {} [ Maquette.string (outerStyle <> style) ], node ]
53− )
54 Nothing -> pure unit
79 Nothing -> pure unit
55
80
56outerStyle :: String
81outerStyle :: String
plum/src/Plum/View.purs+68−12
@@ -2,6 +2,7 @@ module Plum.View
2 ( View
2 ( View
3 , Nerve(..)
3 , Nerve(..)
4 , Meat(..)
4 , Meat(..)
5+ , Font
5 , BorderStyle(..)
6 , BorderStyle(..)
6 , Corner(..)
7 , Corner(..)
7 , Shadow(..)
8 , Shadow(..)
@@ -26,7 +27,7 @@ module Plum.View
26 , text
27 , text
27 , link
28 , link
28 , newTabLink
29 , newTabLink
29− , el
30+ -- , el
30 , download
31 , download
31 , downloadAs
32 , downloadAs
32 , image
33 , image
@@ -52,6 +53,9 @@ module Plum.View
52 , innerShadow
53 , innerShadow
53 , onHover
54 , onHover
54 , onMouseDown
55 , onMouseDown
56+ , font
57+ , fontSize
58+ , fontWeight
55 ) where
59 ) where
56
60
57import Prelude
61import Prelude
@@ -61,15 +65,21 @@ import Data.Array as Array
61import Data.Int as Int
65import Data.Int as Int
62import Data.Maybe (Maybe(..))
66import Data.Maybe (Maybe(..))
63import Data.Maybe as Maybe
67import Data.Maybe as Maybe
68+import Data.String as String
64import Data.Traversable (traverse)
69import Data.Traversable (traverse)
65import Data.TraversableWithIndex (traverseWithIndex)
70import Data.TraversableWithIndex (traverseWithIndex)
66import Data.Tuple.Nested (type (/\), (/\))
71import Data.Tuple.Nested (type (/\), (/\))
67import Effect (Effect)
72import Effect (Effect)
68import Foreign.Object (Object)
73import Foreign.Object (Object)
69import Foreign.Object as Object
74import Foreign.Object as Object
70−import Maquette (VNode, string)
75+import Literals.Undefined (undefined)
71−import Maquette as Maquette
76+import Prim.TypeError (class Warn)
77+import Prim.TypeError as TypeError
72import Record.Unsafe.Union as Record
78import Record.Unsafe.Union as Record
79+import Snabbdom (VNode)
80+import Snabbdom as Snabbdom
81+import Type.Row.Homogeneous (class Homogeneous)
82+import Untagged.Union (type (|+|), asOneOf)
73
83
74type GenericUIView children msg =
84type GenericUIView children msg =
75 { nerves :: Array (Nerve msg)
85 { nerves :: Array (Nerve msg)
@@ -109,9 +119,9 @@ instance Monoid children => Bind (GenericUI children msg) where
109
119
110instance Monoid children => Monad (GenericUI children msg)
120instance Monoid children => Monad (GenericUI children msg)
111
121
112−column :: forall msg a. UI msg a -> UI msg a
122+column :: forall msg. UI msg Unit -> UI msg Unit
113−column (UI { nerves, meat, hover, down, children } a) =
123+column (UI { nerves, meat, hover, down, children } _) =
114− UI (mempty :: UIView msg) { children = [ { meat, nerves, hover, down } /\ Column children ] } a
124+ UI (mempty :: UIView msg) { children = [ { meat, nerves, hover, down } /\ Column children ] } unit
115
125
116row :: forall msg a. UI msg a -> UI msg a
126row :: forall msg a. UI msg a -> UI msg a
117row (UI { nerves, meat, hover, down, children } a) =
127row (UI { nerves, meat, hover, down, children } a) =
@@ -193,11 +203,35 @@ image :: forall msg a. String -> { description :: String } -> GenericUI Unit msg
193image url description (UI { nerves, meat, hover, down } a) =
203image url description (UI { nerves, meat, hover, down } a) =
194 UI (mempty :: UIView msg) { children = [ { meat, nerves, hover, down } /\ Image url description ] } a
204 UI (mempty :: UIView msg) { children = [ { meat, nerves, hover, down } /\ Image url description ] } a
195
205
196−h :: String -> Classes -> Array VNode -> VNode
206+string :: String -> Classes -> String -> VNode
207+string elem classes string =
208+ Snabbdom.h elem
197−h elem classes children = Maquette.h elem { class: Array.intercalate " " classes } children
209+ { attrs: Object.singleton "class" (Array.intercalate " " classes)
210+ , on: Object.empty
211+ , style: Object.empty
212+ }
213+ []
214+ (asOneOf string)
198
215
216+h :: String -> Classes -> Array VNode -> VNode
217+h elem classes children =
218+ Snabbdom.h elem
219+ { attrs: Object.singleton "class" (Array.intercalate " " classes)
220+ , on: Object.empty
221+ , style: Object.empty
222+ }
223+ children
224+ (asOneOf undefined)
225+
199−hWith :: forall props. String -> Record props -> Classes -> Array VNode -> VNode
226+hWith :: forall props. Homogeneous props String => String -> Record props -> Classes -> Array VNode -> VNode
200−hWith elem props classes children = Maquette.h elem (Record.unsafeUnion props { class: Array.intercalate " " classes }) children
227+hWith elem props classes children =
228+ Snabbdom.h elem
229+ { attrs: Object.union (Object.fromHomogeneous props) (Object.singleton "class" (Array.intercalate " " classes))
230+ , on: Object.empty
231+ , style: Object.empty
232+ }
233+ children
234+ (asOneOf undefined)
201
235
202data Length = Px Int | Fill | Fit | Max Int Length | Min Int Length
236data Length = Px Int | Fill | Fit | Max Int Length | Min Int Length
203
237
@@ -211,7 +245,7 @@ m meat = UI (mempty :: GenericUIView ch msg) { meat = [ meat ] } mempty
211spacing :: forall ch msg. Monoid ch => { x :: Int, y :: Int } -> GenericUI ch msg Unit
245spacing :: forall ch msg. Monoid ch => { x :: Int, y :: Int } -> GenericUI ch msg Unit
212spacing { x, y } = m $ Spacing x y
246spacing { x, y } = m $ Spacing x y
213
247
214−explain :: forall ch msg. Monoid ch => GenericUI ch msg Unit
248+explain :: forall ch msg. Monoid ch => Warn (TypeError.Text "Debug explain present") => GenericUI ch msg Unit
215explain = m Explain
249explain = m Explain
216
250
217align :: forall ch msg. Monoid ch => Direction -> Alignment -> GenericUI ch msg Unit
251align :: forall ch msg. Monoid ch => Direction -> Alignment -> GenericUI ch msg Unit
@@ -274,6 +308,15 @@ shadow cfg = m $ Shadow $ ShadowCfg cfg
274innerShadow :: forall ch msg. Monoid ch => ShadowCfg -> GenericUI ch msg Unit
308innerShadow :: forall ch msg. Monoid ch => ShadowCfg -> GenericUI ch msg Unit
275innerShadow cfg = m $ InnerShadow $ ShadowCfg cfg
309innerShadow cfg = m $ InnerShadow $ ShadowCfg cfg
276
310
311+font :: forall ch msg. Monoid ch => String -> GenericUI ch msg Unit
312+font f = m $ Font f
313+
314+fontSize :: forall ch msg. Monoid ch => Int -> GenericUI ch msg Unit
315+fontSize f = m $ FontSize f
316+
317+fontWeight :: forall ch msg. Monoid ch => Int -> GenericUI ch msg Unit
318+fontWeight f = m $ FontWeight f
319+
277data Meat
320data Meat
278 = Spacing Int Int
321 = Spacing Int Int
279 | Explain
322 | Explain
@@ -293,6 +336,12 @@ data Meat
293 | Round Corner Int
336 | Round Corner Int
294 | Shadow Shadow
337 | Shadow Shadow
295 | InnerShadow Shadow
338 | InnerShadow Shadow
339+ | FontColor Color
340+ | FontWeight Int
341+ | FontSize Int
342+ | Font Font
343+
344+type Font = String
296
345
297type ShadowCfg = { offset :: { x :: Int, y :: Int }, size :: Number, blur :: Number, color :: Color }
346type ShadowCfg = { offset :: { x :: Int, y :: Int }, size :: Number, blur :: Number, color :: Color }
298
347
@@ -429,6 +478,13 @@ skin ctx = case _ of
429 Round corner l -> sk ("round-" <> renderKey corner <> "-" <> show l) ("border-" <> render corner <> "-radius") (show l <> "px")
478 Round corner l -> sk ("round-" <> renderKey corner <> "-" <> show l) ("border-" <> render corner <> "-radius") (show l <> "px")
430 Shadow s -> sk ("shadow-" <> renderKey s) "box-shadow" (render s)
479 Shadow s -> sk ("shadow-" <> renderKey s) "box-shadow" (render s)
431 InnerShadow s -> sk ("inner-shadow-" <> renderKey s) "box-shadow" (render s <> " inset")
480 InnerShadow s -> sk ("inner-shadow-" <> renderKey s) "box-shadow" (render s <> " inset")
481+ FontColor c -> sk ("font-color-" <> renderKey c) "color" (render c)
482+ FontSize l -> sk ("font-size-" <> show l) "font-size" (show l <> "px")
483+ Font f -> sk ("font-" <> removeSpaces f) "font-family" f
484+ FontWeight w -> sk ("font-weight-" <> show w) "font-weight" (show w)
485+
486+removeSpaces :: String -> String
487+removeSpaces = String.replaceAll (String.Pattern " ") (String.Replacement "-")
432
488
433class Renderable x where
489class Renderable x where
434 render :: x -> String
490 render :: x -> String
@@ -551,7 +607,7 @@ growSkin fire (Mutation mutation) ({ meat, hover, down, nerves } /\ bones) = do
551 pure $ meatClasses <> map (_ <> "-hover") (Array.concat hoverClasses) <> map (_ <> "-down") (Array.concat downClasses)
607 pure $ meatClasses <> map (_ <> "-hover") (Array.concat hoverClasses) <> map (_ <> "-down") (Array.concat downClasses)
552
608
553 case bones of
609 case bones of
554− Text t -> (\c -> h "span" c [ string t ]) <$> (skn Span)
610+ Text t -> (\c -> string "span" c t) <$> (skn Span)
555 Wrapper x -> do
611 Wrapper x -> do
556 classes <- (skn (Flexbox X) <> sk "display-flex" "display" "flex" <> sk "flex-direction-row" "flex-direction" "row")
612 classes <- (skn (Flexbox X) <> sk "display-flex" "display" "flex" <> sk "flex-direction-row" "flex-direction" "row")
557 x' <- growSkin fire mempty x
613 x' <- growSkin fire mempty x
plum/src/Snabbdom.jsnew file+1
@@ -0,0 +1 @@
1+function h(z,J){let P,G=J.elm,X=z.data.attrs,$=J.data.attrs;if(!X&&!$)return;if(X===$)return;X=X||{},$=$||{};for(P in $){let U=$[P];if(X[P]!==U)if(U===!0)G.setAttribute(P,"");else if(U===!1)G.removeAttribute(P);else if(P.charCodeAt(0)!==120)G.setAttribute(P,U);else if(P.charCodeAt(3)===58)G.setAttributeNS("http://www.w3.org/XML/1998/namespace",P,U);else if(P.charCodeAt(5)===58)P.charCodeAt(1)===109?G.setAttributeNS("http://www.w3.org/2000/xmlns/",P,U):G.setAttributeNS("http://www.w3.org/1999/xlink",P,U);else G.setAttribute(P,U)}for(P in X)if(!(P in $))G.removeAttribute(P)}var v={create:h,update:h};function i(z,J,P){if(typeof z==="function")z.call(J,P,J);else if(typeof z==="object")for(let G=0;G<z.length;G++)i(z[G],J,P)}function e(z,J){let P=z.type,G=J.data.on;if(G&&G[P])i(G[P],J,z)}function zz(){return function z(J){e(J,z.vnode)}}function E(z,J){let P=z.data.on,G=z.listener,X=z.elm,$=J&&J.data.on,U=J&&J.elm,L;if(P===$)return;if(P&&G){if(!$)for(L in P)X.removeEventListener(L,G,!1);else for(L in P)if(!$[L])X.removeEventListener(L,G,!1)}if($){let F=J.listener=z.listener||zz();if(F.vnode=J,!P)for(L in $)U.addEventListener(L,F,!1);else for(L in $)if(!P[L])U.addEventListener(L,F,!1)}}var m={create:E,update:E,destroy:E};function C(z,J,P,G,X){let $=J===void 0?void 0:J.key;return{sel:z,data:J,children:P,text:G,elm:X,key:$}}var w=Array.isArray;function s(z){return typeof z==="string"||typeof z==="number"||z instanceof String||z instanceof Number}function Jz(z,J){return document.createElement(z,J)}function Pz(z,J,P){return document.createElementNS(z,J,P)}function Wz(){return g(document.createDocumentFragment())}function Xz(z){return document.createTextNode(z)}function Yz(z){return document.createComment(z)}function Zz(z,J,P){if(b(z)){let G=z;while(G&&b(G))G=g(G).parent;z=G!==null&&G!==void 0?G:z}if(b(J))J=g(J,z);if(P&&b(P))P=g(P).firstChildNode;z.insertBefore(J,P)}function $z(z,J){z.removeChild(J)}function Bz(z,J){if(b(J))J=g(J,z);z.appendChild(J)}function r(z){if(b(z)){while(z&&b(z))z=g(z).parent;return z!==null&&z!==void 0?z:null}return z.parentNode}function qz(z){var J;if(b(z)){let P=g(z),G=r(P);if(G&&P.lastChildNode){let X=Array.from(G.childNodes),$=X.indexOf(P.lastChildNode);return(J=X[$+1])!==null&&J!==void 0?J:null}return null}return z.nextSibling}function Kz(z){return z.tagName}function Uz(z,J){z.textContent=J}function Hz(z){return z.textContent}function Oz(z){return z.nodeType===1}function Rz(z){return z.nodeType===3}function Az(z){return z.nodeType===8}function b(z){return z.nodeType===11}function g(z,J){var P,G,X;let $=z;return(P=$.parent)!==null&&P!==void 0||($.parent=J!==null&&J!==void 0?J:null),(G=$.firstChildNode)!==null&&G!==void 0||($.firstChildNode=z.firstChild),(X=$.lastChildNode)!==null&&X!==void 0||($.lastChildNode=z.lastChild),$}var l={createElement:Jz,createElementNS:Pz,createTextNode:Xz,createDocumentFragment:Wz,createComment:Yz,insertBefore:Zz,removeChild:$z,appendChild:Bz,parentNode:r,nextSibling:qz,tagName:Kz,setTextContent:Uz,getTextContent:Hz,isElement:Oz,isText:Rz,isComment:Az,isDocumentFragment:b};var x=C("",{},[],void 0,void 0);function I(z,J){var P,G;let X=z.key===J.key,$=((P=z.data)===null||P===void 0?void 0:P.is)===((G=J.data)===null||G===void 0?void 0:G.is),U=z.sel===J.sel,L=!z.sel&&z.sel===J.sel?typeof z.text===typeof J.text:!0;return U&&X&&$&&L}function Mz(){throw new Error("The document fragment is not supported on this platform.")}function Tz(z,J){return z.isElement(J)}function Lz(z,J){return z.isDocumentFragment(J)}function Dz(z,J,P){var G;let X={};for(let $=J;$<=P;++$){let U=(G=z[$])===null||G===void 0?void 0:G.key;if(U!==void 0)X[U]=$}return X}var jz=["create","update","remove","destroy","pre","post"];function a(z,J,P){let G={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},X=J!==void 0?J:l;for(let W of jz)for(let Y of z){let q=Y[W];if(q!==void 0)G[W].push(q)}function $(W){let Y=W.id?"#"+W.id:"",q=W.getAttribute("class"),B=q?"."+q.split(" ").join("."):"";return C(X.tagName(W).toLowerCase()+Y+B,{},[],void 0,W)}function U(W){return C(void 0,{},[],void 0,W)}function L(W,Y){return function q(){if(--Y===0){let B=X.parentNode(W);if(B!==null)X.removeChild(B,W)}}}function F(W,Y){var q,B,K,O,M;let Z,R=W.data,T=R===null||R===void 0?void 0:R.hook;(q=T===null||T===void 0?void 0:T.init)===null||q===void 0||q.call(T,W);let{children:A,sel:H}=W;if(H==="!")(B=W.text)!==null&&B!==void 0||(W.text=""),W.elm=X.createComment(W.text);else if(H==="")W.elm=X.createTextNode(W.text);else if(H!==void 0){let D=H.indexOf("#"),j=H.indexOf(".",D),Q=D>0?D:H.length,f=j>0?j:H.length,c=D!==-1||j!==-1?H.slice(0,Math.min(Q,f)):H,V=R===null||R===void 0?void 0:R.ns,S=V===void 0?X.createElement(c,R):X.createElementNS(V,c,R);if(W.elm=S,Q<f)S.setAttribute("id",H.slice(Q+1,f));if(j>0)S.setAttribute("class",H.slice(f+1).replace(/\./g," "));for(Z=0;Z<G.create.length;++Z)G.create[Z](x,W);if(s(W.text)&&(!w(A)||A.length===0))X.appendChild(S,X.createTextNode(W.text));if(w(A))for(Z=0;Z<A.length;++Z){let p=A[Z];if(p!=null)X.appendChild(S,F(p,Y))}if(T!==void 0){if((K=T.create)===null||K===void 0||K.call(T,x,W),T.insert!==void 0)Y.push(W)}}else if(((O=P===null||P===void 0?void 0:P.experimental)===null||O===void 0?void 0:O.fragments)&&W.children){W.elm=((M=X.createDocumentFragment)!==null&&M!==void 0?M:Mz)();for(Z=0;Z<G.create.length;++Z)G.create[Z](x,W);for(Z=0;Z<W.children.length;++Z){let D=W.children[Z];if(D!=null)X.appendChild(W.elm,F(D,Y))}}else W.elm=X.createTextNode(W.text);return W.elm}function _(W,Y,q,B,K,O){for(;B<=K;++B){let M=q[B];if(M!=null)X.insertBefore(W,F(M,O),Y)}}function N(W){var Y,q;let B=W.data;if(B!==void 0){(q=(Y=B===null||B===void 0?void 0:B.hook)===null||Y===void 0?void 0:Y.destroy)===null||q===void 0||q.call(Y,W);for(let K=0;K<G.destroy.length;++K)G.destroy[K](W);if(W.children!==void 0)for(let K=0;K<W.children.length;++K){let O=W.children[K];if(O!=null&&typeof O!=="string")N(O)}}}function k(W,Y,q,B){var K,O;for(;q<=B;++q){let M,Z=Y[q];if(Z!=null)if(Z.sel!==void 0){N(Z),M=G.remove.length+1;let R=L(Z.elm,M);for(let A=0;A<G.remove.length;++A)G.remove[A](Z,R);let T=(O=(K=Z===null||Z===void 0?void 0:Z.data)===null||K===void 0?void 0:K.hook)===null||O===void 0?void 0:O.remove;if(T!==void 0)T(Z,R);else R()}else if(Z.children)N(Z),k(W,Z.children,0,Z.children.length-1);else X.removeChild(W,Z.elm)}}function d(W,Y,q,B){let K=0,O=0,M=Y.length-1,Z=Y[0],R=Y[M],T=q.length-1,A=q[0],H=q[T],D,j,Q,f;while(K<=M&&O<=T)if(Z==null)Z=Y[++K];else if(R==null)R=Y[--M];else if(A==null)A=q[++O];else if(H==null)H=q[--T];else if(I(Z,A))y(Z,A,B),Z=Y[++K],A=q[++O];else if(I(R,H))y(R,H,B),R=Y[--M],H=q[--T];else if(I(Z,H))y(Z,H,B),X.insertBefore(W,Z.elm,X.nextSibling(R.elm)),Z=Y[++K],H=q[--T];else if(I(R,A))y(R,A,B),X.insertBefore(W,R.elm,Z.elm),R=Y[--M],A=q[++O];else{if(D===void 0)D=Dz(Y,K,M);if(j=D[A.key],j===void 0)X.insertBefore(W,F(A,B),Z.elm),A=q[++O];else if(D[H.key]===void 0)X.insertBefore(W,F(H,B),X.nextSibling(R.elm)),H=q[--T];else{if(Q=Y[j],Q.sel!==A.sel)X.insertBefore(W,F(A,B),Z.elm);else y(Q,A,B),Y[j]=void 0,X.insertBefore(W,Q.elm,Z.elm);A=q[++O]}}if(O<=T)f=q[T+1]==null?null:q[T+1].elm,_(W,f,q,O,T,B);if(K<=M)k(W,Y,K,M)}function y(W,Y,q){var B,K,O,M,Z,R,T,A;let H=(B=Y.data)===null||B===void 0?void 0:B.hook;(K=H===null||H===void 0?void 0:H.prepatch)===null||K===void 0||K.call(H,W,Y);let D=Y.elm=W.elm;if(W===Y)return;if(Y.data!==void 0||Y.text!==void 0&&Y.text!==W.text){(O=Y.data)!==null&&O!==void 0||(Y.data={}),(M=W.data)!==null&&M!==void 0||(W.data={});for(let f=0;f<G.update.length;++f)G.update[f](W,Y);(T=(R=(Z=Y.data)===null||Z===void 0?void 0:Z.hook)===null||R===void 0?void 0:R.update)===null||T===void 0||T.call(R,W,Y)}let j=W.children,Q=Y.children;if(Y.text===void 0){if(j!==void 0&&Q!==void 0){if(j!==Q)d(D,j,Q,q)}else if(Q!==void 0){if(W.text!==void 0)X.setTextContent(D,"");_(D,null,Q,0,Q.length-1,q)}else if(j!==void 0)k(D,j,0,j.length-1);else if(W.text!==void 0)X.setTextContent(D,"")}else if(W.text!==Y.text){if(j!==void 0)k(D,j,0,j.length-1);X.setTextContent(D,Y.text)}(A=H===null||H===void 0?void 0:H.postpatch)===null||A===void 0||A.call(H,W,Y)}return function W(Y,q){let B,K,O,M=[];for(B=0;B<G.pre.length;++B)G.pre[B]();if(Tz(X,Y))Y=$(Y);else if(Lz(X,Y))Y=U(Y);if(I(Y,q))y(Y,q,M);else if(K=Y.elm,O=X.parentNode(K),F(q,M),O!==null)X.insertBefore(O,q.elm,X.nextSibling(K)),k(O,[Y],0,0);for(B=0;B<M.length;++B)M[B].data.hook.insert(M[B]);for(B=0;B<G.post.length;++B)G.post[B]();return q}}var t=typeof(window===null||window===void 0?void 0:window.requestAnimationFrame)==="function"?window.requestAnimationFrame.bind(window):setTimeout,Fz=(z)=>{t(()=>{t(z)})},u=!1;function Qz(z,J,P){Fz(()=>{z[J]=P})}function o(z,J){let P,G,X=J.elm,$=z.data.style,U=J.data.style;if(!$&&!U)return;if($===U)return;$=$||{},U=U||{};let L="delayed"in $;for(G in $)if(!(G in U))if(G[0]==="-"&&G[1]==="-")X.style.removeProperty(G);else X.style[G]="";for(G in U)if(P=U[G],G==="delayed"&&U.delayed){for(let F in U.delayed)if(P=U.delayed[F],!L||P!==$.delayed[F])Qz(X.style,F,P)}else if(G!=="remove"&&P!==$[G])if(G[0]==="-"&&G[1]==="-")X.style.setProperty(G,P);else X.style[G]=P}function fz(z){let J,P,G=z.elm,X=z.data.style;if(!X||!(J=X.destroy))return;for(P in J)G.style[P]=J[P]}function bz(z,J){let P=z.data.style;if(!P||!P.remove){J();return}if(!u)z.elm.offsetLeft,u=!0;let G,X=z.elm,$=0,U=P.remove,L=0,F=[];for(G in U)F.push(G),X.style[G]=U[G];let N=getComputedStyle(X)["transition-property"].split(", ");for(;$<N.length;++$)if(F.indexOf(N[$])!==-1)L++;X.addEventListener("transitionend",(k)=>{if(k.target===X)--L;if(L===0)J()})}function kz(){u=!1}var n={pre:kz,create:o,update:o,destroy:fz,remove:bz};function Vz(){return a([v,m,n])}export{C as vnode,Vz as initWithModules};
plum/src/Snabbdom.pursnew file+32
@@ -0,0 +1,32 @@
1+module Snabbdom (h, VNode, init) where
2+
3+import Prelude
4+
5+import Data.Function.Uncurried (Fn4, runFn4)
6+import Effect (Effect)
7+import Effect.Uncurried (EffectFn2, runEffectFn2)
8+import Foreign.Object (Object)
9+import Literals.Undefined (Undefined)
10+import Untagged.Union (type (|+|))
11+import Web.DOM (Element)
12+import Web.Event.Event (Event)
13+
14+foreign import data VNode :: Type
15+
16+foreign import initWithModules :: Effect (EffectFn2 Element VNode VNode)
17+
18+init :: Effect (Element -> VNode -> Effect VNode)
19+init = initWithModules <#> runEffectFn2
20+
21+foreign import vnode :: forall props. Fn4 String (Record props) (Array VNode) (String |+| Undefined) VNode
22+
23+h
24+ :: String
25+ -> { attrs :: Object String
26+ , on :: Object (Event -> Effect Unit)
27+ , style :: Object String
28+ }
29+ -> Array VNode
30+ -> (String |+| Undefined)
31+ -> VNode
32+h = runFn4 vnode