vasille 2.3.8 → 3.0.0

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.
Files changed (91) hide show
  1. package/README.md +122 -0
  2. package/lib/binding/attribute.js +4 -5
  3. package/lib/binding/binding.js +4 -5
  4. package/lib/binding/class.js +2 -4
  5. package/lib/binding/style.js +12 -4
  6. package/lib/core/config.js +3 -0
  7. package/lib/core/core.js +39 -177
  8. package/lib/core/destroyable.js +1 -36
  9. package/lib/core/ivalue.js +6 -49
  10. package/lib/functional/safety.js +7 -0
  11. package/lib/index.js +7 -8
  12. package/lib/models/array-model.js +40 -107
  13. package/lib/models/listener.js +16 -80
  14. package/lib/models/map-model.js +6 -13
  15. package/lib/models/object-model.js +6 -6
  16. package/lib/models/set-model.js +5 -12
  17. package/lib/node/app.js +8 -27
  18. package/lib/node/node.js +294 -524
  19. package/lib/node/watch.js +10 -8
  20. package/lib/tsconfig-build.tsbuildinfo +1 -1
  21. package/lib/tsconfig.tsbuildinfo +1 -0
  22. package/lib/value/expression.js +16 -41
  23. package/lib/value/mirror.js +9 -23
  24. package/lib/value/pointer.js +64 -16
  25. package/lib/value/reference.js +24 -29
  26. package/lib/views/array-view.js +5 -6
  27. package/lib/views/base-view.js +14 -26
  28. package/lib/views/map-view.js +4 -5
  29. package/lib/views/repeat-node.js +17 -34
  30. package/lib/views/set-view.js +7 -5
  31. package/lib-node/binding/attribute.js +4 -5
  32. package/lib-node/binding/binding.js +4 -5
  33. package/lib-node/binding/class.js +2 -4
  34. package/lib-node/binding/style.js +13 -4
  35. package/lib-node/core/config.js +6 -0
  36. package/lib-node/core/core.js +39 -180
  37. package/lib-node/core/destroyable.js +1 -36
  38. package/lib-node/core/ivalue.js +7 -51
  39. package/lib-node/functional/safety.js +12 -0
  40. package/lib-node/index.js +7 -12
  41. package/lib-node/models/array-model.js +41 -107
  42. package/lib-node/models/listener.js +16 -80
  43. package/lib-node/models/map-model.js +6 -13
  44. package/lib-node/models/object-model.js +6 -6
  45. package/lib-node/models/set-model.js +5 -12
  46. package/lib-node/node/app.js +8 -28
  47. package/lib-node/node/node.js +294 -529
  48. package/lib-node/node/watch.js +10 -8
  49. package/lib-node/tsconfig-build-node.tsbuildinfo +1 -1
  50. package/lib-node/value/expression.js +16 -41
  51. package/lib-node/value/mirror.js +9 -23
  52. package/lib-node/value/pointer.js +66 -17
  53. package/lib-node/value/reference.js +24 -29
  54. package/lib-node/views/array-view.js +5 -6
  55. package/lib-node/views/base-view.js +14 -27
  56. package/lib-node/views/map-view.js +4 -5
  57. package/lib-node/views/repeat-node.js +17 -35
  58. package/lib-node/views/set-view.js +7 -5
  59. package/package.json +4 -4
  60. package/types/binding/attribute.d.ts +2 -2
  61. package/types/binding/binding.d.ts +1 -1
  62. package/types/binding/style.d.ts +3 -2
  63. package/types/core/config.d.ts +3 -0
  64. package/types/core/core.d.ts +18 -93
  65. package/types/core/destroyable.d.ts +11 -6
  66. package/types/core/ivalue.d.ts +7 -24
  67. package/types/functional/options.d.ts +7 -22
  68. package/types/functional/safety.d.ts +2 -0
  69. package/types/index.d.ts +8 -10
  70. package/types/models/array-model.d.ts +6 -55
  71. package/types/models/listener.d.ts +0 -26
  72. package/types/models/map-model.d.ts +3 -4
  73. package/types/models/model.d.ts +2 -9
  74. package/types/models/set-model.d.ts +1 -2
  75. package/types/node/app.d.ts +7 -25
  76. package/types/node/node.d.ts +105 -222
  77. package/types/node/watch.d.ts +4 -5
  78. package/types/spec/html.d.ts +231 -231
  79. package/types/spec/svg.d.ts +166 -166
  80. package/types/tsconfig-types.tsbuildinfo +1 -1
  81. package/types/value/expression.d.ts +5 -7
  82. package/types/value/mirror.d.ts +4 -6
  83. package/types/value/pointer.d.ts +26 -9
  84. package/types/value/reference.d.ts +6 -7
  85. package/types/views/array-view.d.ts +3 -3
  86. package/types/views/base-view.d.ts +15 -23
  87. package/types/views/map-view.d.ts +2 -2
  88. package/types/views/repeat-node.d.ts +9 -23
  89. package/types/views/set-view.d.ts +3 -2
  90. package/cdn/es2015.js +0 -2480
  91. package/flow-typed/vasille.js +0 -2613
package/lib/node/watch.js CHANGED
@@ -5,16 +5,18 @@ import { Fragment } from "./node";
5
5
  * @extends Fragment
6
6
  */
7
7
  export class Watch extends Fragment {
8
- compose(input) {
9
- this.watch((value) => {
8
+ constructor(input) {
9
+ super(input, ":watch");
10
+ }
11
+ compose() {
12
+ this.watch(value => {
13
+ var _a, _b;
10
14
  this.children.forEach(child => {
11
- child.$destroy();
15
+ child.destroy();
12
16
  });
13
17
  this.children.clear();
14
- this.lastChild = null;
15
- input.slot && input.slot(this, value);
16
- }, input.model);
17
- input.slot(this, input.model.$);
18
- return {};
18
+ this.lastChild = undefined;
19
+ (_b = (_a = this.input).slot) === null || _b === void 0 ? void 0 : _b.call(_a, this, value);
20
+ }, this.input.model);
19
21
  }
20
22
  }
@@ -1 +1 @@
1
- {"root":["../src/index.ts","../src/binding/attribute.ts","../src/binding/binding.ts","../src/binding/class.ts","../src/binding/style.ts","../src/core/core.ts","../src/core/destroyable.ts","../src/core/errors.ts","../src/core/ivalue.ts","../src/functional/options.ts","../src/models/array-model.ts","../src/models/listener.ts","../src/models/map-model.ts","../src/models/model.ts","../src/models/object-model.ts","../src/models/set-model.ts","../src/node/app.ts","../src/node/node.ts","../src/node/watch.ts","../src/spec/html.ts","../src/spec/react.ts","../src/spec/svg.ts","../src/value/expression.ts","../src/value/mirror.ts","../src/value/pointer.ts","../src/value/reference.ts","../src/views/array-view.ts","../src/views/base-view.ts","../src/views/map-view.ts","../src/views/object-view.ts","../src/views/repeat-node.ts","../src/views/set-view.ts"],"version":"5.6.2"}
1
+ {"root":["../src/index.ts","../src/binding/attribute.ts","../src/binding/binding.ts","../src/binding/class.ts","../src/binding/style.ts","../src/core/core.ts","../src/core/destroyable.ts","../src/core/errors.ts","../src/core/ivalue.ts","../src/functional/options.ts","../src/functional/safety.ts","../src/models/array-model.ts","../src/models/listener.ts","../src/models/map-model.ts","../src/models/model.ts","../src/models/object-model.ts","../src/models/set-model.ts","../src/node/app.ts","../src/node/node.ts","../src/node/watch.ts","../src/spec/html.ts","../src/spec/react.ts","../src/spec/svg.ts","../src/value/expression.ts","../src/value/mirror.ts","../src/value/pointer.ts","../src/value/reference.ts","../src/views/array-view.ts","../src/views/base-view.ts","../src/views/map-view.ts","../src/views/object-view.ts","../src/views/repeat-node.ts","../src/views/set-view.ts"],"version":"5.6.2"}
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts","../src/binding/attribute.ts","../src/binding/binding.ts","../src/binding/class.ts","../src/binding/style.ts","../src/core/config.ts","../src/core/core.ts","../src/core/destroyable.ts","../src/core/errors.ts","../src/core/ivalue.ts","../src/functional/options.ts","../src/functional/safety.ts","../src/models/array-model.ts","../src/models/listener.ts","../src/models/map-model.ts","../src/models/model.ts","../src/models/set-model.ts","../src/node/app.ts","../src/node/node.ts","../src/node/watch.ts","../src/value/expression.ts","../src/value/pointer.ts","../src/value/reference.ts","../src/views/array-view.ts","../src/views/base-view.ts","../src/views/map-view.ts","../src/views/repeat-node.ts","../src/views/set-view.ts"],"version":"5.6.2"}
@@ -12,14 +12,14 @@ export class Expression extends IValue {
12
12
  * @param values
13
13
  * @param link {Boolean} links immediately if true
14
14
  */
15
- constructor(func, link, ...values) {
16
- super(false);
15
+ constructor(func, ...values) {
16
+ super();
17
17
  /**
18
- * Expression will link different handler for each value of list
18
+ * Expression will link different handler for each value of the list
19
19
  */
20
20
  this.linkedFunc = [];
21
21
  const handler = (i) => {
22
- if (i != null) {
22
+ if (typeof i === "number") {
23
23
  this.valuesCache[i] = this.values[i].$;
24
24
  }
25
25
  this.sync.$ = func.apply(this, this.valuesCache);
@@ -29,18 +29,13 @@ export class Expression extends IValue {
29
29
  this.valuesCache = values.map(item => item.$);
30
30
  this.sync = new Reference(func.apply(this, this.valuesCache));
31
31
  let i = 0;
32
- values.forEach(() => {
33
- this.linkedFunc.push(handler.bind(this, Number(i++)));
32
+ values.forEach(value => {
33
+ const updater = handler.bind(this, Number(i++));
34
+ this.linkedFunc.push(updater);
35
+ value.on(updater);
34
36
  });
35
37
  this.values = values;
36
38
  this.func = handler;
37
- if (link) {
38
- this.$enable();
39
- }
40
- else {
41
- handler();
42
- }
43
- this.$seal();
44
39
  }
45
40
  get $() {
46
41
  return this.sync.$;
@@ -48,39 +43,19 @@ export class Expression extends IValue {
48
43
  set $(value) {
49
44
  this.sync.$ = value;
50
45
  }
51
- $on(handler) {
52
- this.sync.$on(handler);
53
- return this;
46
+ on(handler) {
47
+ this.sync.on(handler);
54
48
  }
55
- $off(handler) {
56
- this.sync.$off(handler);
57
- return this;
58
- }
59
- $enable() {
60
- if (!this.isEnabled) {
61
- for (let i = 0; i < this.values.length; i++) {
62
- this.values[i].$on(this.linkedFunc[i]);
63
- this.valuesCache[i] = this.values[i].$;
64
- }
65
- this.func();
66
- this.isEnabled = true;
67
- }
68
- return this;
49
+ off(handler) {
50
+ this.sync.off(handler);
69
51
  }
70
- $disable() {
71
- if (this.isEnabled) {
72
- for (let i = 0; i < this.values.length; i++) {
73
- this.values[i].$off(this.linkedFunc[i]);
74
- }
75
- this.isEnabled = false;
52
+ destroy() {
53
+ for (let i = 0; i < this.values.length; i++) {
54
+ this.values[i].off(this.linkedFunc[i]);
76
55
  }
77
- return this;
78
- }
79
- $destroy() {
80
- this.$disable();
81
56
  this.values.splice(0);
82
57
  this.valuesCache.splice(0);
83
58
  this.linkedFunc.splice(0);
84
- super.$destroy();
59
+ super.destroy();
85
60
  }
86
61
  }
@@ -13,13 +13,12 @@ export class Mirror extends Reference {
13
13
  */
14
14
  constructor(value, forwardOnly = false) {
15
15
  super(value.$);
16
- this.$handler = (v) => {
16
+ this.handler = (v) => {
17
17
  this.$ = v;
18
18
  };
19
- this.$pointedValue = value;
20
- this.$forwardOnly = forwardOnly;
21
- value.$on(this.$handler);
22
- this.$seal();
19
+ this.value = value;
20
+ this.forward = forwardOnly;
21
+ value.on(this.handler);
23
22
  }
24
23
  get $() {
25
24
  // this is a ts bug
@@ -28,29 +27,16 @@ export class Mirror extends Reference {
28
27
  return super.$;
29
28
  }
30
29
  set $(v) {
31
- if (!this.$forwardOnly) {
32
- this.$pointedValue.$ = v;
30
+ if (!this.forward) {
31
+ this.value.$ = v;
33
32
  }
34
33
  // this is a ts bug
35
34
  // eslint-disable-next-line
36
35
  // @ts-ignore
37
36
  super.$ = v;
38
37
  }
39
- $enable() {
40
- if (!this.isEnabled) {
41
- this.isEnabled = true;
42
- this.$pointedValue.$on(this.$handler);
43
- this.$ = this.$pointedValue.$;
44
- }
45
- }
46
- $disable() {
47
- if (this.isEnabled) {
48
- this.$pointedValue.$off(this.$handler);
49
- this.isEnabled = false;
50
- }
51
- }
52
- $destroy() {
53
- this.$disable();
54
- super.$destroy();
38
+ destroy() {
39
+ this.value.off(this.handler);
40
+ super.destroy();
55
41
  }
56
42
  }
@@ -1,26 +1,74 @@
1
- import { Mirror } from "./mirror";
1
+ import { IValue } from "../core/ivalue";
2
+ import { Reference } from "./reference";
2
3
  /**
3
4
  * r/w pointer to a value
4
5
  * @class Pointer
5
- * @extends Mirror
6
+ * @extends IValue
6
7
  */
7
- export class Pointer extends Mirror {
8
+ export class Pointer extends IValue {
8
9
  /**
9
- * @param value {IValue} value to point
10
- * @param forwardOnly {boolean} forward only data flow
10
+ * Constructs a notifiable bind to a value
11
+ * @param value {IValue} is initial valu
11
12
  */
12
- constructor(value, forwardOnly = false) {
13
- super(value, forwardOnly);
13
+ constructor(value) {
14
+ super();
15
+ this.handler = (v) => {
16
+ this.reference.$ = v;
17
+ };
18
+ this.target = value;
19
+ this.reference = new Reference(value.$);
20
+ value.on(this.handler);
14
21
  }
15
- /**
16
- * Point a new ivalue
17
- * @param value {IValue} value to point
18
- */
19
- set $$(value) {
20
- if (this.$pointedValue !== value) {
21
- this.$disable();
22
- this.$pointedValue = value;
23
- this.$enable();
22
+ get $() {
23
+ return this.reference.$;
24
+ }
25
+ set $(v) {
26
+ var _a;
27
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.off(this.handler);
28
+ this.target = null;
29
+ this.reference.$ = v;
30
+ }
31
+ get $$() {
32
+ return this.reference.$;
33
+ }
34
+ set $$(v) {
35
+ if (this.target !== v) {
36
+ this.disconnectTarget();
37
+ }
38
+ if (v instanceof IValue) {
39
+ this.target = v;
40
+ this.target.on(this.handler);
41
+ this.reference.$ = v.$;
42
+ }
43
+ else {
44
+ this.$ = v;
24
45
  }
25
46
  }
47
+ on(handler) {
48
+ this.reference.on(handler);
49
+ }
50
+ off(handler) {
51
+ this.reference.off(handler);
52
+ }
53
+ destroy() {
54
+ var _a;
55
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.off(this.handler);
56
+ this.reference.destroy();
57
+ super.destroy();
58
+ }
59
+ disconnectTarget() {
60
+ var _a;
61
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.off(this.handler);
62
+ }
63
+ }
64
+ export class OwningPointer extends Pointer {
65
+ destroy() {
66
+ var _a;
67
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.destroy();
68
+ super.destroy();
69
+ }
70
+ disconnectTarget() {
71
+ var _a;
72
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.destroy();
73
+ }
26
74
  }
@@ -1,4 +1,5 @@
1
1
  import { IValue } from "../core/ivalue";
2
+ import { reportError } from "../functional/safety";
2
3
  /**
3
4
  * Declares a notifiable value
4
5
  * @class Reference
@@ -9,43 +10,37 @@ export class Reference extends IValue {
9
10
  * @param value {any} the initial value
10
11
  */
11
12
  constructor(value) {
12
- super(true);
13
- this.$value = value;
14
- this.$onchange = new Set;
15
- this.$seal();
13
+ super();
14
+ this.state = value;
15
+ this.onChange = new Set();
16
16
  }
17
17
  get $() {
18
- return this.$value;
18
+ return this.state;
19
19
  }
20
20
  set $(value) {
21
- if (this.$value !== value) {
22
- this.$value = value;
23
- if (this.isEnabled) {
24
- this.$onchange.forEach(handler => {
25
- handler(value);
26
- });
27
- }
28
- }
29
- }
30
- $enable() {
31
- if (!this.isEnabled) {
32
- this.$onchange.forEach(handler => {
33
- handler(this.$value);
34
- });
35
- this.isEnabled = true;
21
+ if (this.state !== value) {
22
+ this.state = value;
23
+ this.updateDeps(value);
36
24
  }
37
25
  }
38
- $disable() {
39
- this.isEnabled = false;
26
+ on(handler) {
27
+ this.onChange.add(handler);
40
28
  }
41
- $on(handler) {
42
- this.$onchange.add(handler);
29
+ off(handler) {
30
+ this.onChange.delete(handler);
43
31
  }
44
- $off(handler) {
45
- this.$onchange.delete(handler);
32
+ destroy() {
33
+ super.destroy();
34
+ this.onChange.clear();
46
35
  }
47
- $destroy() {
48
- super.$destroy();
49
- this.$onchange.clear();
36
+ updateDeps(value) {
37
+ this.onChange.forEach(handler => {
38
+ try {
39
+ handler(value);
40
+ }
41
+ catch (e) {
42
+ reportError(e);
43
+ }
44
+ });
50
45
  }
51
46
  }
@@ -6,13 +6,12 @@ import { BaseView } from "./base-view";
6
6
  */
7
7
  export class ArrayView extends BaseView {
8
8
  createChild(input, id, item, before) {
9
- super.createChild(input, item, item, before || this.$.nodes.get(id));
9
+ super.createChild(input, item, item, before || this.nodes.get(id));
10
10
  }
11
- compose(input) {
12
- super.compose(input);
13
- input.model.forEach(item => {
14
- this.createChild(input, item, item);
11
+ compose() {
12
+ super.compose();
13
+ this.input.model.forEach(item => {
14
+ this.createChild(this.input, item, item);
15
15
  });
16
- return {};
17
16
  }
18
17
  }
@@ -1,15 +1,4 @@
1
- import { RepeatNode, RepeatNodePrivate } from "./repeat-node";
2
- /**
3
- * Private part of BaseView
4
- * @class BaseViewPrivate
5
- * @extends RepeatNodePrivate
6
- */
7
- export class BaseViewPrivate extends RepeatNodePrivate {
8
- constructor() {
9
- super();
10
- this.$seal();
11
- }
12
- }
1
+ import { RepeatNode } from "./repeat-node";
13
2
  /**
14
3
  * Base class of default views
15
4
  * @class BaseView
@@ -17,23 +6,22 @@ export class BaseViewPrivate extends RepeatNodePrivate {
17
6
  * @implements IModel
18
7
  */
19
8
  export class BaseView extends RepeatNode {
20
- constructor(input, $) {
21
- super(input, $ || new BaseViewPrivate);
9
+ constructor(input, name) {
10
+ super(input, name);
22
11
  }
23
- compose(input) {
24
- const $ = this.$;
25
- $.addHandler = (id, item) => {
26
- this.createChild(input, id, item);
12
+ compose() {
13
+ this.addHandler = (id, item) => {
14
+ this.createChild(this.input, id, item);
27
15
  };
28
- $.removeHandler = (id, item) => {
16
+ this.removeHandler = (id, item) => {
29
17
  this.destroyChild(id, item);
30
18
  };
31
- input.model.listener.onAdd($.addHandler);
32
- input.model.listener.onRemove($.removeHandler);
33
- this.runOnDestroy(() => {
34
- input.model.listener.offAdd($.addHandler);
35
- input.model.listener.offRemove($.removeHandler);
36
- });
37
- return {};
19
+ this.input.model.listener.onAdd(this.addHandler);
20
+ this.input.model.listener.onRemove(this.removeHandler);
21
+ }
22
+ destroy() {
23
+ this.input.model.listener.offAdd(this.addHandler);
24
+ this.input.model.listener.offRemove(this.removeHandler);
25
+ super.destroy();
38
26
  }
39
27
  }
@@ -5,11 +5,10 @@ import { BaseView } from "./base-view";
5
5
  * @extends BaseView
6
6
  */
7
7
  export class MapView extends BaseView {
8
- compose(input) {
9
- super.compose(input);
10
- input.model.forEach((value, key) => {
11
- this.createChild(input, key, value);
8
+ compose() {
9
+ super.compose();
10
+ this.input.model.forEach((value, key) => {
11
+ this.createChild(this.input, key, value);
12
12
  });
13
- return {};
14
13
  }
15
14
  }
@@ -1,39 +1,23 @@
1
- import { Fragment, INodePrivate } from "../node/node";
2
- /**
3
- * Private part of repeat node
4
- * @class RepeatNodePrivate
5
- * @extends INodePrivate
6
- */
7
- export class RepeatNodePrivate extends INodePrivate {
8
- constructor() {
9
- super();
10
- /**
11
- * Children node hash
12
- * @type {Map}
13
- */
14
- this.nodes = new Map();
15
- this.$seal();
16
- }
17
- $destroy() {
18
- this.nodes.clear();
19
- super.$destroy();
20
- }
21
- }
1
+ import { config } from "../core/config";
2
+ import { Fragment } from "../node/node";
22
3
  /**
23
4
  * Repeat node repeats its children
24
5
  * @class RepeatNode
25
6
  * @extends Fragment
26
7
  */
27
8
  export class RepeatNode extends Fragment {
28
- constructor(input, $) {
29
- super(input, $);
9
+ constructor(input, name) {
10
+ super(input, name);
30
11
  /**
31
- * If false will use timeout executor, otherwise the app executor
12
+ * Children node hash
13
+ * @type {Map}
32
14
  */
33
- this.freezeUi = true;
15
+ this.nodes = new Map();
34
16
  }
35
17
  createChild(opts, id, item, before) {
36
- const node = new Fragment({});
18
+ const _id = id && typeof id === "object" && "id" in id ? id.id : config.debugUi ? JSON.stringify(id) : id;
19
+ const node = new Fragment({}, `${_id}`);
20
+ node.parent = this;
37
21
  this.destroyChild(id, item);
38
22
  if (before) {
39
23
  this.children.add(node);
@@ -47,20 +31,19 @@ export class RepeatNode extends Fragment {
47
31
  this.children.add(node);
48
32
  }
49
33
  this.lastChild = node;
50
- node.preinit(this.$.app, this);
51
- node.init();
52
34
  opts.slot && opts.slot(node, item, id);
53
- node.ready();
54
- this.$.nodes.set(id, node);
35
+ this.nodes.set(id, node);
55
36
  }
56
37
  destroyChild(id, item) {
57
- const $ = this.$;
58
- const child = $.nodes.get(id);
38
+ const child = this.nodes.get(id);
59
39
  if (child) {
60
40
  child.remove();
61
- child.$destroy();
62
- this.$.nodes.delete(id);
41
+ child.destroy();
42
+ this.nodes.delete(id);
63
43
  this.children.delete(child);
64
44
  }
65
45
  }
46
+ destroy() {
47
+ this.nodes.clear();
48
+ }
66
49
  }
@@ -5,11 +5,13 @@ import { BaseView } from "./base-view";
5
5
  * @extends BaseView
6
6
  */
7
7
  export class SetView extends BaseView {
8
- compose(input) {
9
- super.compose(input);
10
- const set = input.model;
11
- set.forEach(item => {
12
- this.createChild(input, item, item);
8
+ constructor(input) {
9
+ super(input, ":set-view");
10
+ }
11
+ compose() {
12
+ super.compose();
13
+ this.input.model.forEach(item => {
14
+ this.createChild(this.input, item, item);
13
15
  });
14
16
  return {};
15
17
  }
@@ -18,18 +18,17 @@ class AttributeBinding extends binding_1.Binding {
18
18
  super(value);
19
19
  this.init((value) => {
20
20
  if (value) {
21
- if (typeof value === 'boolean') {
22
- node.node.setAttribute(name, "");
21
+ if (typeof value === "boolean") {
22
+ node.element.setAttribute(name, "");
23
23
  }
24
24
  else {
25
- node.node.setAttribute(name, `${value}`);
25
+ node.element.setAttribute(name, `${value}`);
26
26
  }
27
27
  }
28
28
  else {
29
- node.node.removeAttribute(name);
29
+ node.element.removeAttribute(name);
30
30
  }
31
31
  });
32
- this.$seal();
33
32
  }
34
33
  }
35
34
  exports.AttributeBinding = AttributeBinding;
@@ -15,19 +15,18 @@ class Binding extends destroyable_1.Destroyable {
15
15
  constructor(value) {
16
16
  super();
17
17
  this.binding = value;
18
- this.$seal();
19
18
  }
20
19
  init(bounded) {
21
20
  this.func = bounded;
22
- this.binding.$on(this.func);
21
+ this.binding.on(this.func);
23
22
  this.func(this.binding.$);
24
23
  }
25
24
  /**
26
25
  * Just clear bindings
27
26
  */
28
- $destroy() {
29
- this.binding.$off(this.func);
30
- super.$destroy();
27
+ destroy() {
28
+ this.binding.off(this.func);
29
+ super.destroy();
31
30
  }
32
31
  }
33
32
  exports.Binding = Binding;
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DynamicalClassBinding = exports.StaticClassBinding = void 0;
4
4
  const binding_1 = require("./binding");
5
5
  function addClass(node, cl) {
6
- node.node.classList.add(cl);
6
+ node.element.classList.add(cl);
7
7
  }
8
8
  function removeClass(node, cl) {
9
- node.node.classList.remove(cl);
9
+ node.element.classList.remove(cl);
10
10
  }
11
11
  class StaticClassBinding extends binding_1.Binding {
12
12
  constructor(node, name, value) {
@@ -23,7 +23,6 @@ class StaticClassBinding extends binding_1.Binding {
23
23
  this.current = value;
24
24
  }
25
25
  });
26
- this.$seal();
27
26
  }
28
27
  }
29
28
  exports.StaticClassBinding = StaticClassBinding;
@@ -42,7 +41,6 @@ class DynamicalClassBinding extends binding_1.Binding {
42
41
  this.current = value;
43
42
  }
44
43
  });
45
- this.$seal();
46
44
  }
47
45
  }
48
46
  exports.DynamicalClassBinding = DynamicalClassBinding;
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StyleBinding = void 0;
4
+ exports.stringifyStyleValue = stringifyStyleValue;
4
5
  const binding_1 = require("./binding");
6
+ function stringifyStyleValue(value) {
7
+ if (value instanceof Array) {
8
+ return value.map(item => `${item}px`).join(" ");
9
+ }
10
+ if (typeof value === "number") {
11
+ return `${value}px`;
12
+ }
13
+ return value;
14
+ }
5
15
  /**
6
16
  * Describes a style attribute binding
7
17
  * @class StyleBinding
@@ -16,12 +26,11 @@ class StyleBinding extends binding_1.Binding {
16
26
  */
17
27
  constructor(node, name, value) {
18
28
  super(value);
19
- this.init((value) => {
20
- if (node.node instanceof HTMLElement) {
21
- node.node.style.setProperty(name, value);
29
+ this.init(value => {
30
+ if (node.element instanceof HTMLElement) {
31
+ node.element.style.setProperty(name, stringifyStyleValue(value));
22
32
  }
23
33
  });
24
- this.$seal();
25
34
  }
26
35
  }
27
36
  exports.StyleBinding = StyleBinding;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config = void 0;
4
+ exports.config = {
5
+ debugUi: true,
6
+ };