vasille 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/es2015.js CHANGED
@@ -1,24 +1,4 @@
1
1
  (function(){
2
- // ./lib/v/index.js
3
-
4
- const v = Object.assign(Object.assign({ ref(value) {
5
- return current.ref(value);
6
- }, expr: expr, of: valueOf, sv: setValue, alwaysFalse: new Reference(false), app,
7
- component,
8
- fragment,
9
- extension,
10
- text,
11
- tag,
12
- create }, vx), { merge,
13
- destructor() {
14
- return current.destroy.bind(current);
15
- },
16
- runOnDestroy(callback) {
17
- current.runOnDestroy(callback);
18
- } });
19
-
20
- window.v = v;
21
-
22
2
  // ./lib/models/model.js
23
3
 
24
4
 
@@ -606,387 +586,127 @@ class ArrayModel extends Array {
606
586
 
607
587
  window.ArrayModel = ArrayModel;
608
588
 
609
- // ./lib/functional/merge.js
610
- function merge(main, ...targets) {
611
- function refactorClass(obj) {
612
- if (Array.isArray(obj.class)) {
613
- const out = {
614
- $: []
615
- };
616
- obj.class.forEach(item => {
617
- if (item instanceof IValue) {
618
- out.$.push(item);
619
- }
620
- else if (typeof item === 'string') {
621
- out[item] = true;
622
- }
623
- else if (typeof item === 'object') {
624
- Object.assign(out, item);
625
- }
626
- });
627
- obj.class = out;
628
- }
589
+ // ./lib/core/signal.js
590
+ /**
591
+ * Signal is an event generator
592
+ * @class Signal
593
+ */
594
+ class Signal {
595
+ constructor() {
596
+ /**
597
+ * Handler of event
598
+ * @type {Set}
599
+ * @private
600
+ */
601
+ this.handlers = new Set;
629
602
  }
630
- refactorClass(main);
631
- targets.forEach(target => {
632
- Reflect.ownKeys(target).forEach((prop) => {
633
- if (!Reflect.has(main, prop)) {
634
- main[prop] = target[prop];
603
+ /**
604
+ * Emit event
605
+ * @param a1 {*} argument
606
+ * @param a2 {*} argument
607
+ * @param a3 {*} argument
608
+ * @param a4 {*} argument
609
+ * @param a5 {*} argument
610
+ * @param a6 {*} argument
611
+ * @param a7 {*} argument
612
+ * @param a8 {*} argument
613
+ * @param a9 {*} argument
614
+ */
615
+ emit(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
616
+ this.handlers.forEach(handler => {
617
+ try {
618
+ handler(a1, a2, a3, a4, a5, a6, a7, a8, a9);
635
619
  }
636
- else if (typeof main[prop] === 'object' && typeof target[prop] === 'object') {
637
- if (prop === 'class') {
638
- refactorClass(target);
639
- }
640
- if (prop === '$' && Array.isArray(main[prop]) && Array.isArray(target[prop])) {
641
- main.$.push(...target.$);
642
- }
643
- else {
644
- merge(main[prop], target[prop]);
645
- }
620
+ catch (e) {
621
+ console.error(`Vasille.js: Handler throw exception: `, e);
646
622
  }
647
623
  });
648
- });
624
+ }
625
+ /**
626
+ * Subscribe to event
627
+ * @param func {function} handler
628
+ */
629
+ subscribe(func) {
630
+ this.handlers.add(func);
631
+ }
632
+ /**
633
+ * Unsubscribe from event
634
+ * @param func {function} handler
635
+ */
636
+ unsubscribe(func) {
637
+ this.handlers.delete(func);
638
+ }
649
639
  }
650
640
 
651
- window.merge = merge;
641
+ window.Signal = Signal;
652
642
 
653
- // ./lib/functional/stack.js
654
- function app(renderer) {
655
- return (node, opts) => {
656
- return new App(node, opts).runFunctional(renderer, opts);
657
- };
658
- }
659
- function component(renderer) {
660
- return (opts, callback) => {
661
- const component = new Component(opts);
662
- if (!(current instanceof Fragment))
663
- throw userError('missing parent node', 'out-of-context');
664
- let ret;
665
- if (callback)
666
- opts.slot = callback;
667
- current.create(component, node => {
668
- ret = node.runFunctional(renderer, opts);
669
- });
670
- return ret;
671
- };
643
+ // ./lib/core/slot.js
644
+ /**
645
+ * Component slot
646
+ * @class Slot
647
+ */
648
+ class Slot {
649
+ /**
650
+ * Sets the runner
651
+ * @param func {function} the function to run
652
+ */
653
+ insert(func) {
654
+ this.runner = func;
655
+ }
656
+ /**
657
+ * @param a0 {Fragment} node to paste content
658
+ * @param a1 {*} 1st argument
659
+ * @param a2 {*} 2nd argument
660
+ * @param a3 {*} 3rd argument
661
+ * @param a4 {*} 4th argument
662
+ * @param a5 {*} 5th argument
663
+ * @param a6 {*} 6th argument
664
+ * @param a7 {*} 7th argument
665
+ * @param a8 {*} 8th argument
666
+ * @param a9 {*} 9th argument
667
+ */
668
+ release(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
669
+ if (this.runner) {
670
+ this.runner(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
671
+ }
672
+ }
673
+ /**
674
+ * Predefine a handler for a slot
675
+ * @param func {function(node : Fragment)} Function to run if no handler specified
676
+ * @param a0 {Fragment} node to paste content
677
+ * @param a1 {*} 1st argument
678
+ * @param a2 {*} 2nd argument
679
+ * @param a3 {*} 3rd argument
680
+ * @param a4 {*} 4th argument
681
+ * @param a5 {*} 5th argument
682
+ * @param a6 {*} 6th argument
683
+ * @param a7 {*} 7th argument
684
+ * @param a8 {*} 8th argument
685
+ * @param a9 {*} 9th argument
686
+ */
687
+ predefine(func, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
688
+ (this.runner || func)(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
689
+ }
672
690
  }
673
- function fragment(renderer) {
674
- return (opts, callback) => {
675
- const frag = new Fragment(opts);
676
- if (!(current instanceof Fragment))
677
- throw userError('missing parent node', 'out-of-context');
678
- if (callback)
679
- opts.slot = callback;
680
- current.create(frag);
681
- return frag.runFunctional(renderer, opts);
682
- };
691
+
692
+ window.Slot = Slot;
693
+
694
+ // ./lib/core/errors.js
695
+ const reportIt = "Report it here: https://gitlab.com/vasille-js/vasille-js/-/issues";
696
+ function notOverwritten() {
697
+ console.error("Vasille-SFP: Internal error", "Must be overwritten", reportIt);
698
+ return "not-overwritten";
683
699
  }
684
- function extension(renderer) {
685
- return (opts, callback) => {
686
- const ext = new Extension(opts);
687
- if (!(current instanceof Fragment))
688
- throw userError('missing parent node', 'out-of-context');
689
- if (callback)
690
- opts.slot = callback;
691
- current.create(ext);
692
- return ext.runFunctional(renderer, opts);
693
- };
700
+ function internalError(msg) {
701
+ console.error("Vasille-SFP: Internal error", msg, reportIt);
702
+ return "internal-error";
694
703
  }
695
- function tag(name, opts, callback) {
696
- if (!(current instanceof Fragment))
697
- throw userError('missing parent node', 'out-of-context');
698
- return {
699
- node: current.tag(name, opts, (node) => {
700
- callback && node.runFunctional(callback);
701
- })
702
- };
704
+ function userError(msg, err) {
705
+ console.error("Vasille-SFP: User error", msg);
706
+ return err;
703
707
  }
704
- function create(node, callback) {
705
- if (!(current instanceof Fragment))
706
- throw userError('missing current node', 'out-of-context');
707
- current.create(node, (node, ...args) => {
708
- callback && node.runFunctional(callback, ...args);
709
- });
710
- return node;
711
- }
712
- const vx = {
713
- if(condition, callback) {
714
- if (current instanceof Fragment) {
715
- current.if(condition, node => node.runFunctional(callback));
716
- }
717
- else {
718
- throw userError("wrong use of `v.if` function", "logic-error");
719
- }
720
- },
721
- else(callback) {
722
- if (current instanceof Fragment) {
723
- current.else(node => node.runFunctional(callback));
724
- }
725
- else {
726
- throw userError("wrong use of `v.else` function", "logic-error");
727
- }
728
- },
729
- elif(condition, callback) {
730
- if (current instanceof Fragment) {
731
- current.elif(condition, node => node.runFunctional(callback));
732
- }
733
- else {
734
- throw userError("wrong use of `v.elif` function", "logic-error");
735
- }
736
- },
737
- for(model, callback) {
738
- if (model instanceof ArrayModel) {
739
- // for arrays T & K are the same type
740
- create(new ArrayView({ model }), callback);
741
- }
742
- else if (model instanceof MapModel) {
743
- create(new MapView({ model }), callback);
744
- }
745
- else if (model instanceof SetModel) {
746
- // for sets T & K are the same type
747
- create(new SetView({ model }), callback);
748
- }
749
- else if (model instanceof ObjectModel) {
750
- // for objects K is always string
751
- create(new ObjectView({ model }), callback);
752
- }
753
- else {
754
- throw userError("wrong use of `v.for` function", 'wrong-model');
755
- }
756
- },
757
- watch(model, callback) {
758
- const opts = { model };
759
- create(new Watch(opts), callback);
760
- },
761
- nextTick(callback) {
762
- const node = current;
763
- window.setTimeout(() => {
764
- node.runFunctional(callback);
765
- }, 0);
766
- }
767
- };
768
-
769
- window.app = app;
770
- window.component = component;
771
- window.fragment = fragment;
772
- window.extension = extension;
773
- window.tag = tag;
774
- window.create = create;
775
- window.vx = vx;
776
-
777
- // ./lib/functional/models.js
778
- function arrayModel(arr = []) {
779
- if (!current)
780
- throw userError('missing parent node', 'out-of-context');
781
- return current.register(new ArrayModel(arr)).proxy();
782
- }
783
- function mapModel(map = []) {
784
- if (!current)
785
- throw userError('missing parent node', 'out-of-context');
786
- return current.register(new MapModel(map));
787
- }
788
- function setModel(arr = []) {
789
- if (!current)
790
- throw userError('missing parent node', 'out-of-context');
791
- return current.register(new SetModel(arr));
792
- }
793
- function objectModel(obj = {}) {
794
- if (!current)
795
- throw userError('missing parent node', 'out-of-context');
796
- return current.register(new ObjectModel(obj));
797
- }
798
-
799
- window.arrayModel = arrayModel;
800
- window.mapModel = mapModel;
801
- window.setModel = setModel;
802
- window.objectModel = objectModel;
803
-
804
- // ./lib/functional/options.js
805
-
806
-
807
-
808
- // ./lib/functional/reactivity.js
809
- function ref(value) {
810
- const ref = current.ref(value);
811
- return [ref, (value) => ref.$ = value];
812
- }
813
- function mirror(value) {
814
- return current.mirror(value);
815
- }
816
- function forward(value) {
817
- return current.forward(value);
818
- }
819
- function point(value) {
820
- return current.point(value);
821
- }
822
- function expr(func, ...values) {
823
- return current.expr(func, ...values);
824
- }
825
- function watch(func, ...values) {
826
- current.watch(func, ...values);
827
- }
828
- function valueOf(value) {
829
- return value.$;
830
- }
831
- function setValue(ref, value) {
832
- if (ref instanceof Pointer && value instanceof IValue) {
833
- ref.point(value);
834
- }
835
- else {
836
- ref.$ = value instanceof IValue ? value.$ : value;
837
- }
838
- }
839
-
840
- window.ref = ref;
841
- window.mirror = mirror;
842
- window.forward = forward;
843
- window.point = point;
844
- window.expr = expr;
845
- window.watch = watch;
846
- window.valueOf = valueOf;
847
- window.setValue = setValue;
848
-
849
- // ./lib/functional/components.js
850
- function text(text) {
851
- if (!(current instanceof Fragment))
852
- throw userError('missing parent node', 'out-of-context');
853
- ;
854
- current.text(text);
855
- }
856
- function debug(text) {
857
- if (!(current instanceof Fragment))
858
- throw userError('missing parent node', 'out-of-context');
859
- current.debug(text);
860
- }
861
- function predefine(slot, predefined) {
862
- return slot || predefined;
863
- }
864
-
865
- window.text = text;
866
- window.debug = debug;
867
- window.predefine = predefine;
868
-
869
- // ./lib/core/signal.js
870
- /**
871
- * Signal is an event generator
872
- * @class Signal
873
- */
874
- class Signal {
875
- constructor() {
876
- /**
877
- * Handler of event
878
- * @type {Set}
879
- * @private
880
- */
881
- this.handlers = new Set;
882
- }
883
- /**
884
- * Emit event
885
- * @param a1 {*} argument
886
- * @param a2 {*} argument
887
- * @param a3 {*} argument
888
- * @param a4 {*} argument
889
- * @param a5 {*} argument
890
- * @param a6 {*} argument
891
- * @param a7 {*} argument
892
- * @param a8 {*} argument
893
- * @param a9 {*} argument
894
- */
895
- emit(a1, a2, a3, a4, a5, a6, a7, a8, a9) {
896
- this.handlers.forEach(handler => {
897
- try {
898
- handler(a1, a2, a3, a4, a5, a6, a7, a8, a9);
899
- }
900
- catch (e) {
901
- console.error(`Vasille.js: Handler throw exception: `, e);
902
- }
903
- });
904
- }
905
- /**
906
- * Subscribe to event
907
- * @param func {function} handler
908
- */
909
- subscribe(func) {
910
- this.handlers.add(func);
911
- }
912
- /**
913
- * Unsubscribe from event
914
- * @param func {function} handler
915
- */
916
- unsubscribe(func) {
917
- this.handlers.delete(func);
918
- }
919
- }
920
-
921
- window.Signal = Signal;
922
-
923
- // ./lib/core/slot.js
924
- /**
925
- * Component slot
926
- * @class Slot
927
- */
928
- class Slot {
929
- /**
930
- * Sets the runner
931
- * @param func {function} the function to run
932
- */
933
- insert(func) {
934
- this.runner = func;
935
- }
936
- /**
937
- * @param a0 {Fragment} node to paste content
938
- * @param a1 {*} 1st argument
939
- * @param a2 {*} 2nd argument
940
- * @param a3 {*} 3rd argument
941
- * @param a4 {*} 4th argument
942
- * @param a5 {*} 5th argument
943
- * @param a6 {*} 6th argument
944
- * @param a7 {*} 7th argument
945
- * @param a8 {*} 8th argument
946
- * @param a9 {*} 9th argument
947
- */
948
- release(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
949
- if (this.runner) {
950
- this.runner(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
951
- }
952
- }
953
- /**
954
- * Predefine a handler for a slot
955
- * @param func {function(node : Fragment)} Function to run if no handler specified
956
- * @param a0 {Fragment} node to paste content
957
- * @param a1 {*} 1st argument
958
- * @param a2 {*} 2nd argument
959
- * @param a3 {*} 3rd argument
960
- * @param a4 {*} 4th argument
961
- * @param a5 {*} 5th argument
962
- * @param a6 {*} 6th argument
963
- * @param a7 {*} 7th argument
964
- * @param a8 {*} 8th argument
965
- * @param a9 {*} 9th argument
966
- */
967
- predefine(func, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
968
- (this.runner || func)(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
969
- }
970
- }
971
-
972
- window.Slot = Slot;
973
-
974
- // ./lib/core/errors.js
975
- const reportIt = "Report it here: https://gitlab.com/vasille-js/vasille-js/-/issues";
976
- function notOverwritten() {
977
- console.error("Vasille-SFP: Internal error", "Must be overwritten", reportIt);
978
- return "not-overwritten";
979
- }
980
- function internalError(msg) {
981
- console.error("Vasille-SFP: Internal error", msg, reportIt);
982
- return "internal-error";
983
- }
984
- function userError(msg, err) {
985
- console.error("Vasille-SFP: User error", msg);
986
- return err;
987
- }
988
- function wrongBinding(msg) {
989
- return userError(msg, "wrong-binding");
708
+ function wrongBinding(msg) {
709
+ return userError(msg, "wrong-binding");
990
710
  }
991
711
 
992
712
  window.notOverwritten = notOverwritten;
@@ -1165,7 +885,7 @@ class Destroyable {
1165
885
  * Make object fields non configurable
1166
886
  * @protected
1167
887
  */
1168
- seal() {
888
+ $seal() {
1169
889
  const $ = this;
1170
890
  Object.keys($).forEach(i => {
1171
891
  // eslint-disable-next-line no-prototype-builtins
@@ -1197,7 +917,7 @@ class Destroyable {
1197
917
  /**
1198
918
  * Garbage collector method
1199
919
  */
1200
- destroy() {
920
+ $destroy() {
1201
921
  // nothing here
1202
922
  }
1203
923
  }
@@ -1209,13 +929,13 @@ class Switchable extends Destroyable {
1209
929
  /**
1210
930
  * Enable update handlers triggering
1211
931
  */
1212
- enable() {
932
+ $enable() {
1213
933
  throw notOverwritten();
1214
934
  }
1215
935
  /**
1216
936
  * disable update handlers triggering
1217
937
  */
1218
- disable() {
938
+ $disable() {
1219
939
  throw notOverwritten();
1220
940
  }
1221
941
  }
@@ -1250,14 +970,14 @@ class IValue extends Switchable {
1250
970
  * Add a new handler to value change
1251
971
  * @param handler {function(value : *)} the handler to add
1252
972
  */
1253
- on(handler) {
973
+ $on(handler) {
1254
974
  throw notOverwritten();
1255
975
  }
1256
976
  /**
1257
977
  * Removes a handler of value change
1258
978
  * @param handler {function(value : *)} the handler to remove
1259
979
  */
1260
- off(handler) {
980
+ $off(handler) {
1261
981
  throw notOverwritten();
1262
982
  }
1263
983
  }
@@ -1317,12 +1037,12 @@ class Expression extends IValue {
1317
1037
  this.values = values;
1318
1038
  this.func = handler;
1319
1039
  if (link) {
1320
- this.enable();
1040
+ this.$enable();
1321
1041
  }
1322
1042
  else {
1323
1043
  handler();
1324
1044
  }
1325
- this.seal();
1045
+ this.$seal();
1326
1046
  }
1327
1047
  get $() {
1328
1048
  return this.sync.$;
@@ -1330,18 +1050,18 @@ class Expression extends IValue {
1330
1050
  set $(value) {
1331
1051
  this.sync.$ = value;
1332
1052
  }
1333
- on(handler) {
1334
- this.sync.on(handler);
1053
+ $on(handler) {
1054
+ this.sync.$on(handler);
1335
1055
  return this;
1336
1056
  }
1337
- off(handler) {
1338
- this.sync.off(handler);
1057
+ $off(handler) {
1058
+ this.sync.$off(handler);
1339
1059
  return this;
1340
1060
  }
1341
- enable() {
1061
+ $enable() {
1342
1062
  if (!this.isEnabled) {
1343
1063
  for (let i = 0; i < this.values.length; i++) {
1344
- this.values[i].on(this.linkedFunc[i]);
1064
+ this.values[i].$on(this.linkedFunc[i]);
1345
1065
  this.valuesCache[i] = this.values[i].$;
1346
1066
  }
1347
1067
  this.func();
@@ -1349,21 +1069,21 @@ class Expression extends IValue {
1349
1069
  }
1350
1070
  return this;
1351
1071
  }
1352
- disable() {
1072
+ $disable() {
1353
1073
  if (this.isEnabled) {
1354
1074
  for (let i = 0; i < this.values.length; i++) {
1355
- this.values[i].off(this.linkedFunc[i]);
1075
+ this.values[i].$off(this.linkedFunc[i]);
1356
1076
  }
1357
1077
  this.isEnabled = false;
1358
1078
  }
1359
1079
  return this;
1360
1080
  }
1361
- destroy() {
1362
- this.disable();
1081
+ $destroy() {
1082
+ this.$disable();
1363
1083
  this.values.splice(0);
1364
1084
  this.valuesCache.splice(0);
1365
1085
  this.linkedFunc.splice(0);
1366
- super.destroy();
1086
+ super.$destroy();
1367
1087
  }
1368
1088
  }
1369
1089
 
@@ -1381,43 +1101,43 @@ class Reference extends IValue {
1381
1101
  */
1382
1102
  constructor(value) {
1383
1103
  super(true);
1384
- this.value = value;
1385
- this.onchange = new Set;
1386
- this.seal();
1104
+ this.$value = value;
1105
+ this.$onchange = new Set;
1106
+ this.$seal();
1387
1107
  }
1388
1108
  get $() {
1389
- return this.value;
1109
+ return this.$value;
1390
1110
  }
1391
1111
  set $(value) {
1392
- if (this.value !== value) {
1393
- this.value = value;
1112
+ if (this.$value !== value) {
1113
+ this.$value = value;
1394
1114
  if (this.isEnabled) {
1395
- this.onchange.forEach(handler => {
1115
+ this.$onchange.forEach(handler => {
1396
1116
  handler(value);
1397
1117
  });
1398
1118
  }
1399
1119
  }
1400
1120
  }
1401
- enable() {
1121
+ $enable() {
1402
1122
  if (!this.isEnabled) {
1403
- this.onchange.forEach(handler => {
1404
- handler(this.value);
1123
+ this.$onchange.forEach(handler => {
1124
+ handler(this.$value);
1405
1125
  });
1406
1126
  this.isEnabled = true;
1407
1127
  }
1408
1128
  }
1409
- disable() {
1129
+ $disable() {
1410
1130
  this.isEnabled = false;
1411
1131
  }
1412
- on(handler) {
1413
- this.onchange.add(handler);
1132
+ $on(handler) {
1133
+ this.$onchange.add(handler);
1414
1134
  }
1415
- off(handler) {
1416
- this.onchange.delete(handler);
1135
+ $off(handler) {
1136
+ this.$onchange.delete(handler);
1417
1137
  }
1418
- destroy() {
1419
- super.destroy();
1420
- this.onchange.clear();
1138
+ $destroy() {
1139
+ super.$destroy();
1140
+ this.$onchange.clear();
1421
1141
  }
1422
1142
  }
1423
1143
 
@@ -1438,13 +1158,13 @@ class Mirror extends Reference {
1438
1158
  */
1439
1159
  constructor(value, forwardOnly = false) {
1440
1160
  super(value.$);
1441
- this.handler = (v) => {
1161
+ this.$handler = (v) => {
1442
1162
  this.$ = v;
1443
1163
  };
1444
- this.pointedValue = value;
1445
- this.forwardOnly = forwardOnly;
1446
- value.on(this.handler);
1447
- this.seal();
1164
+ this.$pointedValue = value;
1165
+ this.$forwardOnly = forwardOnly;
1166
+ value.$on(this.$handler);
1167
+ this.$seal();
1448
1168
  }
1449
1169
  get $() {
1450
1170
  // this is a ts bug
@@ -1453,30 +1173,30 @@ class Mirror extends Reference {
1453
1173
  return super.$;
1454
1174
  }
1455
1175
  set $(v) {
1456
- if (!this.forwardOnly) {
1457
- this.pointedValue.$ = v;
1176
+ if (!this.$forwardOnly) {
1177
+ this.$pointedValue.$ = v;
1458
1178
  }
1459
1179
  // this is a ts bug
1460
1180
  // eslint-disable-next-line
1461
1181
  // @ts-ignore
1462
1182
  super.$ = v;
1463
1183
  }
1464
- enable() {
1184
+ $enable() {
1465
1185
  if (!this.isEnabled) {
1466
1186
  this.isEnabled = true;
1467
- this.pointedValue.on(this.handler);
1468
- this.$ = this.pointedValue.$;
1187
+ this.$pointedValue.$on(this.$handler);
1188
+ this.$ = this.$pointedValue.$;
1469
1189
  }
1470
1190
  }
1471
- disable() {
1191
+ $disable() {
1472
1192
  if (this.isEnabled) {
1473
- this.pointedValue.off(this.handler);
1193
+ this.$pointedValue.$off(this.$handler);
1474
1194
  this.isEnabled = false;
1475
1195
  }
1476
1196
  }
1477
- destroy() {
1478
- this.disable();
1479
- super.destroy();
1197
+ $destroy() {
1198
+ this.$disable();
1199
+ super.$destroy();
1480
1200
  }
1481
1201
  }
1482
1202
 
@@ -1500,11 +1220,11 @@ class Pointer extends Mirror {
1500
1220
  * Point a new ivalue
1501
1221
  * @param value {IValue} value to point
1502
1222
  */
1503
- point(value) {
1504
- if (this.pointedValue !== value) {
1505
- this.disable();
1506
- this.pointedValue = value;
1507
- this.enable();
1223
+ set $$(value) {
1224
+ if (this.$pointedValue !== value) {
1225
+ this.$disable();
1226
+ this.$pointedValue = value;
1227
+ this.$enable();
1508
1228
  }
1509
1229
  }
1510
1230
  }
@@ -1525,19 +1245,19 @@ class Binding extends Destroyable {
1525
1245
  constructor(value) {
1526
1246
  super();
1527
1247
  this.binding = value;
1528
- this.seal();
1248
+ this.$seal();
1529
1249
  }
1530
1250
  init(bounded) {
1531
1251
  this.func = bounded;
1532
- this.binding.on(this.func);
1252
+ this.binding.$on(this.func);
1533
1253
  this.func(this.binding.$);
1534
1254
  }
1535
1255
  /**
1536
1256
  * Just clear bindings
1537
1257
  */
1538
- destroy() {
1539
- this.binding.off(this.func);
1540
- super.destroy();
1258
+ $destroy() {
1259
+ this.binding.$off(this.func);
1260
+ super.$destroy();
1541
1261
  }
1542
1262
  }
1543
1263
 
@@ -1585,18 +1305,18 @@ class ReactivePrivate extends Destroyable {
1585
1305
  * @type {boolean}
1586
1306
  */
1587
1307
  this.frozen = false;
1588
- this.seal();
1308
+ this.$seal();
1589
1309
  }
1590
- destroy() {
1591
- this.watch.forEach(value => value.destroy());
1310
+ $destroy() {
1311
+ this.watch.forEach(value => value.$destroy());
1592
1312
  this.watch.clear();
1593
- this.bindings.forEach(binding => binding.destroy());
1313
+ this.bindings.forEach(binding => binding.$destroy());
1594
1314
  this.bindings.clear();
1595
1315
  this.models.forEach(model => model.disableReactivity());
1596
1316
  this.models.clear();
1597
- this.freezeExpr && this.freezeExpr.destroy();
1317
+ this.freezeExpr && this.freezeExpr.$destroy();
1598
1318
  this.onDestroy && this.onDestroy();
1599
- super.destroy();
1319
+ super.$destroy();
1600
1320
  }
1601
1321
  }
1602
1322
  /**
@@ -1609,7 +1329,7 @@ class Reactive extends Destroyable {
1609
1329
  super();
1610
1330
  this.input = input;
1611
1331
  this.$ = $ || new ReactivePrivate;
1612
- this.seal();
1332
+ this.$seal();
1613
1333
  }
1614
1334
  /**
1615
1335
  * Get parent node
@@ -1692,7 +1412,7 @@ class Reactive extends Destroyable {
1692
1412
  const $ = this.$;
1693
1413
  if (!$.enabled) {
1694
1414
  $.watch.forEach(watcher => {
1695
- watcher.enable();
1415
+ watcher.$enable();
1696
1416
  });
1697
1417
  $.models.forEach(model => {
1698
1418
  model.enableReactivity();
@@ -1707,7 +1427,7 @@ class Reactive extends Destroyable {
1707
1427
  const $ = this.$;
1708
1428
  if ($.enabled) {
1709
1429
  $.watch.forEach(watcher => {
1710
- watcher.disable();
1430
+ watcher.$disable();
1711
1431
  });
1712
1432
  $.models.forEach(model => {
1713
1433
  model.disableReactivity();
@@ -1770,9 +1490,9 @@ class Reactive extends Destroyable {
1770
1490
  runOnDestroy(func) {
1771
1491
  this.$.onDestroy = func;
1772
1492
  }
1773
- destroy() {
1774
- super.destroy();
1775
- this.$.destroy();
1493
+ $destroy() {
1494
+ super.$destroy();
1495
+ this.$.$destroy();
1776
1496
  this.$ = null;
1777
1497
  }
1778
1498
  }
@@ -1789,7 +1509,7 @@ window.Reactive = Reactive;
1789
1509
  class FragmentPrivate extends ReactivePrivate {
1790
1510
  constructor() {
1791
1511
  super();
1792
- this.seal();
1512
+ this.$seal();
1793
1513
  }
1794
1514
  /**
1795
1515
  * Pre-initializes the base of a fragment
@@ -1803,10 +1523,10 @@ class FragmentPrivate extends ReactivePrivate {
1803
1523
  /**
1804
1524
  * Unlinks all bindings
1805
1525
  */
1806
- destroy() {
1526
+ $destroy() {
1807
1527
  this.next = null;
1808
1528
  this.prev = null;
1809
- super.destroy();
1529
+ super.$destroy();
1810
1530
  }
1811
1531
  }
1812
1532
  /**
@@ -2029,14 +1749,14 @@ class Fragment extends Reactive {
2029
1749
  $.prev.$.next = $.next;
2030
1750
  }
2031
1751
  }
2032
- destroy() {
2033
- this.children.forEach(child => child.destroy());
1752
+ $destroy() {
1753
+ this.children.forEach(child => child.$destroy());
2034
1754
  this.children.clear();
2035
1755
  this.lastChild = null;
2036
1756
  if (this.$.parent.lastChild === this) {
2037
1757
  this.$.parent.lastChild = this.$.prev;
2038
1758
  }
2039
- super.destroy();
1759
+ super.$destroy();
2040
1760
  }
2041
1761
  }
2042
1762
  const trueIValue = new Reference(true);
@@ -2048,7 +1768,7 @@ const trueIValue = new Reference(true);
2048
1768
  class TextNodePrivate extends FragmentPrivate {
2049
1769
  constructor() {
2050
1770
  super();
2051
- this.seal();
1771
+ this.$seal();
2052
1772
  }
2053
1773
  /**
2054
1774
  * Pre-initializes a text node
@@ -2068,8 +1788,8 @@ class TextNodePrivate extends FragmentPrivate {
2068
1788
  /**
2069
1789
  * Clear node data
2070
1790
  */
2071
- destroy() {
2072
- super.destroy();
1791
+ $destroy() {
1792
+ super.$destroy();
2073
1793
  }
2074
1794
  }
2075
1795
  /**
@@ -2080,7 +1800,7 @@ class TextNodePrivate extends FragmentPrivate {
2080
1800
  class TextNode extends Fragment {
2081
1801
  constructor($ = new TextNodePrivate()) {
2082
1802
  super({}, $);
2083
- this.seal();
1803
+ this.$seal();
2084
1804
  }
2085
1805
  preinit(app, parent, text) {
2086
1806
  const $ = this.$;
@@ -2093,10 +1813,10 @@ class TextNode extends Fragment {
2093
1813
  findFirstChild() {
2094
1814
  return this.$.node;
2095
1815
  }
2096
- destroy() {
1816
+ $destroy() {
2097
1817
  this.$.node.remove();
2098
- this.$.destroy();
2099
- super.destroy();
1818
+ this.$.$destroy();
1819
+ super.$destroy();
2100
1820
  }
2101
1821
  }
2102
1822
  /**
@@ -2112,10 +1832,10 @@ class INodePrivate extends FragmentPrivate {
2112
1832
  * @type {boolean}
2113
1833
  */
2114
1834
  this.unmounted = false;
2115
- this.seal();
1835
+ this.$seal();
2116
1836
  }
2117
- destroy() {
2118
- super.destroy();
1837
+ $destroy() {
1838
+ super.$destroy();
2119
1839
  }
2120
1840
  }
2121
1841
  /**
@@ -2131,7 +1851,7 @@ class INode extends Fragment {
2131
1851
  */
2132
1852
  constructor(input, $) {
2133
1853
  super(input, $ || new INodePrivate);
2134
- this.seal();
1854
+ this.$seal();
2135
1855
  }
2136
1856
  /**
2137
1857
  * Get the bound node
@@ -2374,7 +2094,7 @@ class INode extends Fragment {
2374
2094
  class Tag extends INode {
2375
2095
  constructor(input) {
2376
2096
  super(input);
2377
- this.seal();
2097
+ this.$seal();
2378
2098
  }
2379
2099
  preinit(app, parent, tagName) {
2380
2100
  if (!tagName || typeof tagName !== "string") {
@@ -2427,9 +2147,9 @@ class Tag extends INode {
2427
2147
  /**
2428
2148
  * Runs GC
2429
2149
  */
2430
- destroy() {
2150
+ $destroy() {
2431
2151
  this.node.remove();
2432
- super.destroy();
2152
+ super.$destroy();
2433
2153
  }
2434
2154
  }
2435
2155
  /**
@@ -2452,8 +2172,8 @@ class Extension extends INode {
2452
2172
  throw userError("A extension node can be encapsulated only in a tag/extension/component", "virtual-dom");
2453
2173
  }
2454
2174
  }
2455
- destroy() {
2456
- super.destroy();
2175
+ $destroy() {
2176
+ super.$destroy();
2457
2177
  }
2458
2178
  }
2459
2179
  /**
@@ -2498,18 +2218,18 @@ class SwitchedNodePrivate extends FragmentPrivate {
2498
2218
  * @type {Array<{cond : IValue<boolean>, cb : function(Fragment)}>}
2499
2219
  */
2500
2220
  this.cases = [];
2501
- this.seal();
2221
+ this.$seal();
2502
2222
  }
2503
2223
  /**
2504
2224
  * Runs GC
2505
2225
  */
2506
- destroy() {
2226
+ $destroy() {
2507
2227
  this.cases.forEach(c => {
2508
2228
  delete c.cond;
2509
2229
  delete c.cb;
2510
2230
  });
2511
2231
  this.cases.splice(0);
2512
- super.destroy();
2232
+ super.$destroy();
2513
2233
  }
2514
2234
  }
2515
2235
  /**
@@ -2533,7 +2253,7 @@ class SwitchedNode extends Fragment {
2533
2253
  return;
2534
2254
  }
2535
2255
  if (this.lastChild) {
2536
- this.lastChild.destroy();
2256
+ this.lastChild.$destroy();
2537
2257
  this.children.clear();
2538
2258
  this.lastChild = null;
2539
2259
  }
@@ -2545,11 +2265,11 @@ class SwitchedNode extends Fragment {
2545
2265
  $.index = -1;
2546
2266
  }
2547
2267
  };
2548
- this.seal();
2268
+ this.$seal();
2549
2269
  }
2550
2270
  addCase(case_) {
2551
2271
  this.$.cases.push(case_);
2552
- case_.cond.on(this.$.sync);
2272
+ case_.cond.$on(this.$.sync);
2553
2273
  this.$.sync();
2554
2274
  }
2555
2275
  /**
@@ -2567,16 +2287,16 @@ class SwitchedNode extends Fragment {
2567
2287
  ready() {
2568
2288
  const $ = this.$;
2569
2289
  $.cases.forEach(c => {
2570
- c.cond.on($.sync);
2290
+ c.cond.$on($.sync);
2571
2291
  });
2572
2292
  $.sync();
2573
2293
  }
2574
- destroy() {
2294
+ $destroy() {
2575
2295
  const $ = this.$;
2576
2296
  $.cases.forEach(c => {
2577
- c.cond.off($.sync);
2297
+ c.cond.$off($.sync);
2578
2298
  });
2579
- super.destroy();
2299
+ super.$destroy();
2580
2300
  }
2581
2301
  }
2582
2302
  /**
@@ -2585,7 +2305,7 @@ class SwitchedNode extends Fragment {
2585
2305
  class DebugPrivate extends FragmentPrivate {
2586
2306
  constructor() {
2587
2307
  super();
2588
- this.seal();
2308
+ this.$seal();
2589
2309
  }
2590
2310
  /**
2591
2311
  * Pre-initializes a text node
@@ -2604,9 +2324,9 @@ class DebugPrivate extends FragmentPrivate {
2604
2324
  /**
2605
2325
  * Clear node data
2606
2326
  */
2607
- destroy() {
2327
+ $destroy() {
2608
2328
  this.node.remove();
2609
- super.destroy();
2329
+ super.$destroy();
2610
2330
  }
2611
2331
  }
2612
2332
  /**
@@ -2622,7 +2342,7 @@ class DebugNode extends Fragment {
2622
2342
  * @type {DebugNode}
2623
2343
  */
2624
2344
  this.$ = new DebugPrivate();
2625
- this.seal();
2345
+ this.$seal();
2626
2346
  }
2627
2347
  preinit(app, parent, text) {
2628
2348
  const $ = this.$;
@@ -2634,9 +2354,9 @@ class DebugNode extends Fragment {
2634
2354
  /**
2635
2355
  * Runs garbage collector
2636
2356
  */
2637
- destroy() {
2638
- this.$.destroy();
2639
- super.destroy();
2357
+ $destroy() {
2358
+ this.$.$destroy();
2359
+ super.$destroy();
2640
2360
  }
2641
2361
  }
2642
2362
 
@@ -2667,7 +2387,7 @@ class AppNode extends INode {
2667
2387
  constructor(input) {
2668
2388
  super(input);
2669
2389
  this.debugUi = input.debugUi || false;
2670
- this.seal();
2390
+ this.$seal();
2671
2391
  }
2672
2392
  }
2673
2393
  /**
@@ -2686,7 +2406,7 @@ class App extends AppNode {
2686
2406
  this.$.node = node;
2687
2407
  this.preinit(this, this);
2688
2408
  this.init();
2689
- this.seal();
2409
+ this.$seal();
2690
2410
  }
2691
2411
  appendNode(node) {
2692
2412
  this.$.node.appendChild(node);
@@ -2696,7 +2416,7 @@ class Portal extends AppNode {
2696
2416
  constructor(input) {
2697
2417
  super(input);
2698
2418
  this.$.node = input.node;
2699
- this.seal();
2419
+ this.$seal();
2700
2420
  }
2701
2421
  appendNode(node) {
2702
2422
  this.$.node.appendChild(node);
@@ -2819,7 +2539,7 @@ class AttributeBinding extends Binding {
2819
2539
  node.node.removeAttribute(name);
2820
2540
  }
2821
2541
  });
2822
- this.seal();
2542
+ this.$seal();
2823
2543
  }
2824
2544
  }
2825
2545
 
@@ -2845,7 +2565,7 @@ class StyleBinding extends Binding {
2845
2565
  node.node.style.setProperty(name, value);
2846
2566
  }
2847
2567
  });
2848
- this.seal();
2568
+ this.$seal();
2849
2569
  }
2850
2570
  }
2851
2571
 
@@ -2873,7 +2593,7 @@ class StaticClassBinding extends Binding {
2873
2593
  this.current = value;
2874
2594
  }
2875
2595
  });
2876
- this.seal();
2596
+ this.$seal();
2877
2597
  }
2878
2598
  }
2879
2599
  class DynamicalClassBinding extends Binding {
@@ -2891,7 +2611,7 @@ class DynamicalClassBinding extends Binding {
2891
2611
  this.current = value;
2892
2612
  }
2893
2613
  });
2894
- this.seal();
2614
+ this.$seal();
2895
2615
  }
2896
2616
  }
2897
2617
 
@@ -2912,11 +2632,11 @@ class RepeatNodePrivate extends INodePrivate {
2912
2632
  * @type {Map}
2913
2633
  */
2914
2634
  this.nodes = new Map();
2915
- this.seal();
2635
+ this.$seal();
2916
2636
  }
2917
- destroy() {
2637
+ $destroy() {
2918
2638
  this.nodes.clear();
2919
- super.destroy();
2639
+ super.$destroy();
2920
2640
  }
2921
2641
  }
2922
2642
  /**
@@ -2958,7 +2678,7 @@ class RepeatNode extends Fragment {
2958
2678
  const child = $.nodes.get(id);
2959
2679
  if (child) {
2960
2680
  child.remove();
2961
- child.destroy();
2681
+ child.$destroy();
2962
2682
  this.$.nodes.delete(id);
2963
2683
  this.children.delete(child);
2964
2684
  }
@@ -3043,7 +2763,7 @@ window.Repeater = Repeater;
3043
2763
  class BaseViewPrivate extends RepeatNodePrivate {
3044
2764
  constructor() {
3045
2765
  super();
3046
- this.seal();
2766
+ this.$seal();
3047
2767
  }
3048
2768
  }
3049
2769
  /**
@@ -3106,7 +2826,7 @@ class Watch extends Fragment {
3106
2826
  compose(input) {
3107
2827
  this.watch((value) => {
3108
2828
  this.children.forEach(child => {
3109
- child.destroy();
2829
+ child.$destroy();
3110
2830
  });
3111
2831
  this.children.clear();
3112
2832
  this.lastChild = null;
@@ -3172,4 +2892,284 @@ class SetView extends BaseView {
3172
2892
 
3173
2893
  window.SetView = SetView;
3174
2894
 
2895
+ // ./lib/functional/merge.js
2896
+ function merge(main, ...targets) {
2897
+ function refactorClass(obj) {
2898
+ if (Array.isArray(obj.class)) {
2899
+ const out = {
2900
+ $: []
2901
+ };
2902
+ obj.class.forEach(item => {
2903
+ if (item instanceof IValue) {
2904
+ out.$.push(item);
2905
+ }
2906
+ else if (typeof item === 'string') {
2907
+ out[item] = true;
2908
+ }
2909
+ else if (typeof item === 'object') {
2910
+ Object.assign(out, item);
2911
+ }
2912
+ });
2913
+ obj.class = out;
2914
+ }
2915
+ }
2916
+ refactorClass(main);
2917
+ targets.forEach(target => {
2918
+ Reflect.ownKeys(target).forEach((prop) => {
2919
+ if (!Reflect.has(main, prop)) {
2920
+ main[prop] = target[prop];
2921
+ }
2922
+ else if (typeof main[prop] === 'object' && typeof target[prop] === 'object') {
2923
+ if (prop === 'class') {
2924
+ refactorClass(target);
2925
+ }
2926
+ if (prop === '$' && Array.isArray(main[prop]) && Array.isArray(target[prop])) {
2927
+ main.$.push(...target.$);
2928
+ }
2929
+ else {
2930
+ merge(main[prop], target[prop]);
2931
+ }
2932
+ }
2933
+ });
2934
+ });
2935
+ }
2936
+
2937
+ window.merge = merge;
2938
+
2939
+ // ./lib/functional/stack.js
2940
+ function app(renderer) {
2941
+ return (node, opts) => {
2942
+ return new App(node, opts).runFunctional(renderer, opts);
2943
+ };
2944
+ }
2945
+ function component(renderer) {
2946
+ return (opts, callback) => {
2947
+ const component = new Component(opts);
2948
+ if (!(current instanceof Fragment))
2949
+ throw userError('missing parent node', 'out-of-context');
2950
+ let ret;
2951
+ if (callback)
2952
+ opts.slot = callback;
2953
+ current.create(component, node => {
2954
+ ret = node.runFunctional(renderer, opts);
2955
+ });
2956
+ return ret;
2957
+ };
2958
+ }
2959
+ function fragment(renderer) {
2960
+ return (opts, callback) => {
2961
+ const frag = new Fragment(opts);
2962
+ if (!(current instanceof Fragment))
2963
+ throw userError('missing parent node', 'out-of-context');
2964
+ if (callback)
2965
+ opts.slot = callback;
2966
+ current.create(frag);
2967
+ return frag.runFunctional(renderer, opts);
2968
+ };
2969
+ }
2970
+ function extension(renderer) {
2971
+ return (opts, callback) => {
2972
+ const ext = new Extension(opts);
2973
+ if (!(current instanceof Fragment))
2974
+ throw userError('missing parent node', 'out-of-context');
2975
+ if (callback)
2976
+ opts.slot = callback;
2977
+ current.create(ext);
2978
+ return ext.runFunctional(renderer, opts);
2979
+ };
2980
+ }
2981
+ function tag(name, opts, callback) {
2982
+ if (!(current instanceof Fragment))
2983
+ throw userError('missing parent node', 'out-of-context');
2984
+ return {
2985
+ node: current.tag(name, opts, (node) => {
2986
+ callback && node.runFunctional(callback);
2987
+ })
2988
+ };
2989
+ }
2990
+ function create(node, callback) {
2991
+ if (!(current instanceof Fragment))
2992
+ throw userError('missing current node', 'out-of-context');
2993
+ current.create(node, (node, ...args) => {
2994
+ callback && node.runFunctional(callback, ...args);
2995
+ });
2996
+ return node;
2997
+ }
2998
+ const vx = {
2999
+ if(condition, callback) {
3000
+ if (current instanceof Fragment) {
3001
+ current.if(condition, node => node.runFunctional(callback));
3002
+ }
3003
+ else {
3004
+ throw userError("wrong use of `v.if` function", "logic-error");
3005
+ }
3006
+ },
3007
+ else(callback) {
3008
+ if (current instanceof Fragment) {
3009
+ current.else(node => node.runFunctional(callback));
3010
+ }
3011
+ else {
3012
+ throw userError("wrong use of `v.else` function", "logic-error");
3013
+ }
3014
+ },
3015
+ elif(condition, callback) {
3016
+ if (current instanceof Fragment) {
3017
+ current.elif(condition, node => node.runFunctional(callback));
3018
+ }
3019
+ else {
3020
+ throw userError("wrong use of `v.elif` function", "logic-error");
3021
+ }
3022
+ },
3023
+ for(model, callback) {
3024
+ if (model instanceof ArrayModel) {
3025
+ // for arrays T & K are the same type
3026
+ create(new ArrayView({ model }), callback);
3027
+ }
3028
+ else if (model instanceof MapModel) {
3029
+ create(new MapView({ model }), callback);
3030
+ }
3031
+ else if (model instanceof SetModel) {
3032
+ // for sets T & K are the same type
3033
+ create(new SetView({ model }), callback);
3034
+ }
3035
+ else if (model instanceof ObjectModel) {
3036
+ // for objects K is always string
3037
+ create(new ObjectView({ model }), callback);
3038
+ }
3039
+ else {
3040
+ throw userError("wrong use of `v.for` function", 'wrong-model');
3041
+ }
3042
+ },
3043
+ watch(model, callback) {
3044
+ const opts = { model };
3045
+ create(new Watch(opts), callback);
3046
+ },
3047
+ nextTick(callback) {
3048
+ const node = current;
3049
+ window.setTimeout(() => {
3050
+ node.runFunctional(callback);
3051
+ }, 0);
3052
+ }
3053
+ };
3054
+
3055
+ window.app = app;
3056
+ window.component = component;
3057
+ window.fragment = fragment;
3058
+ window.extension = extension;
3059
+ window.tag = tag;
3060
+ window.create = create;
3061
+ window.vx = vx;
3062
+
3063
+ // ./lib/functional/models.js
3064
+ function arrayModel(arr = []) {
3065
+ if (!current)
3066
+ throw userError('missing parent node', 'out-of-context');
3067
+ return current.register(new ArrayModel(arr)).proxy();
3068
+ }
3069
+ function mapModel(map = []) {
3070
+ if (!current)
3071
+ throw userError('missing parent node', 'out-of-context');
3072
+ return current.register(new MapModel(map));
3073
+ }
3074
+ function setModel(arr = []) {
3075
+ if (!current)
3076
+ throw userError('missing parent node', 'out-of-context');
3077
+ return current.register(new SetModel(arr));
3078
+ }
3079
+ function objectModel(obj = {}) {
3080
+ if (!current)
3081
+ throw userError('missing parent node', 'out-of-context');
3082
+ return current.register(new ObjectModel(obj));
3083
+ }
3084
+
3085
+ window.arrayModel = arrayModel;
3086
+ window.mapModel = mapModel;
3087
+ window.setModel = setModel;
3088
+ window.objectModel = objectModel;
3089
+
3090
+ // ./lib/functional/options.js
3091
+
3092
+
3093
+
3094
+ // ./lib/functional/reactivity.js
3095
+ function ref(value) {
3096
+ const ref = current.ref(value);
3097
+ return [ref, (value) => ref.$ = value];
3098
+ }
3099
+ function mirror(value) {
3100
+ return current.mirror(value);
3101
+ }
3102
+ function forward(value) {
3103
+ return current.forward(value);
3104
+ }
3105
+ function point(value) {
3106
+ return current.point(value);
3107
+ }
3108
+ function expr(func, ...values) {
3109
+ return current.expr(func, ...values);
3110
+ }
3111
+ function watch(func, ...values) {
3112
+ current.watch(func, ...values);
3113
+ }
3114
+ function valueOf(value) {
3115
+ return value.$;
3116
+ }
3117
+ function setValue(ref, value) {
3118
+ if (ref instanceof Pointer && value instanceof IValue) {
3119
+ ref.$$ = value;
3120
+ }
3121
+ else {
3122
+ ref.$ = value instanceof IValue ? value.$ : value;
3123
+ }
3124
+ }
3125
+
3126
+ window.ref = ref;
3127
+ window.mirror = mirror;
3128
+ window.forward = forward;
3129
+ window.point = point;
3130
+ window.expr = expr;
3131
+ window.watch = watch;
3132
+ window.valueOf = valueOf;
3133
+ window.setValue = setValue;
3134
+
3135
+ // ./lib/functional/components.js
3136
+ function text(text) {
3137
+ if (!(current instanceof Fragment))
3138
+ throw userError('missing parent node', 'out-of-context');
3139
+ ;
3140
+ current.text(text);
3141
+ }
3142
+ function debug(text) {
3143
+ if (!(current instanceof Fragment))
3144
+ throw userError('missing parent node', 'out-of-context');
3145
+ current.debug(text);
3146
+ }
3147
+ function predefine(slot, predefined) {
3148
+ return slot || predefined;
3149
+ }
3150
+
3151
+ window.text = text;
3152
+ window.debug = debug;
3153
+ window.predefine = predefine;
3154
+
3155
+ // ./lib/v/index.js
3156
+
3157
+ const v = Object.assign(Object.assign({ ref(value) {
3158
+ return current.ref(value);
3159
+ }, expr: expr, of: valueOf, sv: setValue, alwaysFalse: new Reference(false), app,
3160
+ component,
3161
+ fragment,
3162
+ extension,
3163
+ text,
3164
+ tag,
3165
+ create }, vx), { merge,
3166
+ destructor() {
3167
+ return current.$destroy.bind(current);
3168
+ },
3169
+ runOnDestroy(callback) {
3170
+ current.runOnDestroy(callback);
3171
+ } });
3172
+
3173
+ window.v = v;
3174
+
3175
3175
  })();