vasille 2.3.9 → 3.0.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.
Files changed (91) hide show
  1. package/README.md +57 -155
  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 +9 -6
  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
@@ -8,17 +8,19 @@ const node_1 = require("./node");
8
8
  * @extends Fragment
9
9
  */
10
10
  class Watch extends node_1.Fragment {
11
- compose(input) {
12
- this.watch((value) => {
11
+ constructor(input) {
12
+ super(input, ":watch");
13
+ }
14
+ compose() {
15
+ this.watch(value => {
16
+ var _a, _b;
13
17
  this.children.forEach(child => {
14
- child.$destroy();
18
+ child.destroy();
15
19
  });
16
20
  this.children.clear();
17
- this.lastChild = null;
18
- input.slot && input.slot(this, value);
19
- }, input.model);
20
- input.slot(this, input.model.$);
21
- return {};
21
+ this.lastChild = undefined;
22
+ (_b = (_a = this.input).slot) === null || _b === void 0 ? void 0 : _b.call(_a, this, value);
23
+ }, this.input.model);
22
24
  }
23
25
  }
24
26
  exports.Watch = Watch;
@@ -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/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"}
@@ -15,14 +15,14 @@ class Expression extends ivalue_1.IValue {
15
15
  * @param values
16
16
  * @param link {Boolean} links immediately if true
17
17
  */
18
- constructor(func, link, ...values) {
19
- super(false);
18
+ constructor(func, ...values) {
19
+ super();
20
20
  /**
21
- * Expression will link different handler for each value of list
21
+ * Expression will link different handler for each value of the list
22
22
  */
23
23
  this.linkedFunc = [];
24
24
  const handler = (i) => {
25
- if (i != null) {
25
+ if (typeof i === "number") {
26
26
  this.valuesCache[i] = this.values[i].$;
27
27
  }
28
28
  this.sync.$ = func.apply(this, this.valuesCache);
@@ -32,18 +32,13 @@ class Expression extends ivalue_1.IValue {
32
32
  this.valuesCache = values.map(item => item.$);
33
33
  this.sync = new reference_js_1.Reference(func.apply(this, this.valuesCache));
34
34
  let i = 0;
35
- values.forEach(() => {
36
- this.linkedFunc.push(handler.bind(this, Number(i++)));
35
+ values.forEach(value => {
36
+ const updater = handler.bind(this, Number(i++));
37
+ this.linkedFunc.push(updater);
38
+ value.on(updater);
37
39
  });
38
40
  this.values = values;
39
41
  this.func = handler;
40
- if (link) {
41
- this.$enable();
42
- }
43
- else {
44
- handler();
45
- }
46
- this.$seal();
47
42
  }
48
43
  get $() {
49
44
  return this.sync.$;
@@ -51,40 +46,20 @@ class Expression extends ivalue_1.IValue {
51
46
  set $(value) {
52
47
  this.sync.$ = value;
53
48
  }
54
- $on(handler) {
55
- this.sync.$on(handler);
56
- return this;
49
+ on(handler) {
50
+ this.sync.on(handler);
57
51
  }
58
- $off(handler) {
59
- this.sync.$off(handler);
60
- return this;
61
- }
62
- $enable() {
63
- if (!this.isEnabled) {
64
- for (let i = 0; i < this.values.length; i++) {
65
- this.values[i].$on(this.linkedFunc[i]);
66
- this.valuesCache[i] = this.values[i].$;
67
- }
68
- this.func();
69
- this.isEnabled = true;
70
- }
71
- return this;
52
+ off(handler) {
53
+ this.sync.off(handler);
72
54
  }
73
- $disable() {
74
- if (this.isEnabled) {
75
- for (let i = 0; i < this.values.length; i++) {
76
- this.values[i].$off(this.linkedFunc[i]);
77
- }
78
- this.isEnabled = false;
55
+ destroy() {
56
+ for (let i = 0; i < this.values.length; i++) {
57
+ this.values[i].off(this.linkedFunc[i]);
79
58
  }
80
- return this;
81
- }
82
- $destroy() {
83
- this.$disable();
84
59
  this.values.splice(0);
85
60
  this.valuesCache.splice(0);
86
61
  this.linkedFunc.splice(0);
87
- super.$destroy();
62
+ super.destroy();
88
63
  }
89
64
  }
90
65
  exports.Expression = Expression;
@@ -16,13 +16,12 @@ class Mirror extends reference_1.Reference {
16
16
  */
17
17
  constructor(value, forwardOnly = false) {
18
18
  super(value.$);
19
- this.$handler = (v) => {
19
+ this.handler = (v) => {
20
20
  this.$ = v;
21
21
  };
22
- this.$pointedValue = value;
23
- this.$forwardOnly = forwardOnly;
24
- value.$on(this.$handler);
25
- this.$seal();
22
+ this.value = value;
23
+ this.forward = forwardOnly;
24
+ value.on(this.handler);
26
25
  }
27
26
  get $() {
28
27
  // this is a ts bug
@@ -31,30 +30,17 @@ class Mirror extends reference_1.Reference {
31
30
  return super.$;
32
31
  }
33
32
  set $(v) {
34
- if (!this.$forwardOnly) {
35
- this.$pointedValue.$ = v;
33
+ if (!this.forward) {
34
+ this.value.$ = v;
36
35
  }
37
36
  // this is a ts bug
38
37
  // eslint-disable-next-line
39
38
  // @ts-ignore
40
39
  super.$ = v;
41
40
  }
42
- $enable() {
43
- if (!this.isEnabled) {
44
- this.isEnabled = true;
45
- this.$pointedValue.$on(this.$handler);
46
- this.$ = this.$pointedValue.$;
47
- }
48
- }
49
- $disable() {
50
- if (this.isEnabled) {
51
- this.$pointedValue.$off(this.$handler);
52
- this.isEnabled = false;
53
- }
54
- }
55
- $destroy() {
56
- this.$disable();
57
- super.$destroy();
41
+ destroy() {
42
+ this.value.off(this.handler);
43
+ super.destroy();
58
44
  }
59
45
  }
60
46
  exports.Mirror = Mirror;
@@ -1,30 +1,79 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Pointer = void 0;
4
- const mirror_1 = require("./mirror");
3
+ exports.OwningPointer = exports.Pointer = void 0;
4
+ const ivalue_1 = require("../core/ivalue");
5
+ const reference_1 = require("./reference");
5
6
  /**
6
7
  * r/w pointer to a value
7
8
  * @class Pointer
8
- * @extends Mirror
9
+ * @extends IValue
9
10
  */
10
- class Pointer extends mirror_1.Mirror {
11
+ class Pointer extends ivalue_1.IValue {
11
12
  /**
12
- * @param value {IValue} value to point
13
- * @param forwardOnly {boolean} forward only data flow
13
+ * Constructs a notifiable bind to a value
14
+ * @param value {IValue} is initial valu
14
15
  */
15
- constructor(value, forwardOnly = false) {
16
- super(value, forwardOnly);
16
+ constructor(value) {
17
+ super();
18
+ this.handler = (v) => {
19
+ this.reference.$ = v;
20
+ };
21
+ this.target = value;
22
+ this.reference = new reference_1.Reference(value.$);
23
+ value.on(this.handler);
17
24
  }
18
- /**
19
- * Point a new ivalue
20
- * @param value {IValue} value to point
21
- */
22
- set $$(value) {
23
- if (this.$pointedValue !== value) {
24
- this.$disable();
25
- this.$pointedValue = value;
26
- this.$enable();
25
+ get $() {
26
+ return this.reference.$;
27
+ }
28
+ set $(v) {
29
+ var _a;
30
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.off(this.handler);
31
+ this.target = null;
32
+ this.reference.$ = v;
33
+ }
34
+ get $$() {
35
+ return this.reference.$;
36
+ }
37
+ set $$(v) {
38
+ if (this.target !== v) {
39
+ this.disconnectTarget();
40
+ }
41
+ if (v instanceof ivalue_1.IValue) {
42
+ this.target = v;
43
+ this.target.on(this.handler);
44
+ this.reference.$ = v.$;
45
+ }
46
+ else {
47
+ this.$ = v;
27
48
  }
28
49
  }
50
+ on(handler) {
51
+ this.reference.on(handler);
52
+ }
53
+ off(handler) {
54
+ this.reference.off(handler);
55
+ }
56
+ destroy() {
57
+ var _a;
58
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.off(this.handler);
59
+ this.reference.destroy();
60
+ super.destroy();
61
+ }
62
+ disconnectTarget() {
63
+ var _a;
64
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.off(this.handler);
65
+ }
29
66
  }
30
67
  exports.Pointer = Pointer;
68
+ class OwningPointer extends Pointer {
69
+ destroy() {
70
+ var _a;
71
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.destroy();
72
+ super.destroy();
73
+ }
74
+ disconnectTarget() {
75
+ var _a;
76
+ (_a = this.target) === null || _a === void 0 ? void 0 : _a.destroy();
77
+ }
78
+ }
79
+ exports.OwningPointer = OwningPointer;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Reference = void 0;
4
4
  const ivalue_1 = require("../core/ivalue");
5
+ const safety_1 = require("../functional/safety");
5
6
  /**
6
7
  * Declares a notifiable value
7
8
  * @class Reference
@@ -12,44 +13,38 @@ class Reference extends ivalue_1.IValue {
12
13
  * @param value {any} the initial value
13
14
  */
14
15
  constructor(value) {
15
- super(true);
16
- this.$value = value;
17
- this.$onchange = new Set;
18
- this.$seal();
16
+ super();
17
+ this.state = value;
18
+ this.onChange = new Set();
19
19
  }
20
20
  get $() {
21
- return this.$value;
21
+ return this.state;
22
22
  }
23
23
  set $(value) {
24
- if (this.$value !== value) {
25
- this.$value = value;
26
- if (this.isEnabled) {
27
- this.$onchange.forEach(handler => {
28
- handler(value);
29
- });
30
- }
31
- }
32
- }
33
- $enable() {
34
- if (!this.isEnabled) {
35
- this.$onchange.forEach(handler => {
36
- handler(this.$value);
37
- });
38
- this.isEnabled = true;
24
+ if (this.state !== value) {
25
+ this.state = value;
26
+ this.updateDeps(value);
39
27
  }
40
28
  }
41
- $disable() {
42
- this.isEnabled = false;
29
+ on(handler) {
30
+ this.onChange.add(handler);
43
31
  }
44
- $on(handler) {
45
- this.$onchange.add(handler);
32
+ off(handler) {
33
+ this.onChange.delete(handler);
46
34
  }
47
- $off(handler) {
48
- this.$onchange.delete(handler);
35
+ destroy() {
36
+ super.destroy();
37
+ this.onChange.clear();
49
38
  }
50
- $destroy() {
51
- super.$destroy();
52
- this.$onchange.clear();
39
+ updateDeps(value) {
40
+ this.onChange.forEach(handler => {
41
+ try {
42
+ handler(value);
43
+ }
44
+ catch (e) {
45
+ (0, safety_1.reportError)(e);
46
+ }
47
+ });
53
48
  }
54
49
  }
55
50
  exports.Reference = Reference;
@@ -9,14 +9,13 @@ const base_view_1 = require("./base-view");
9
9
  */
10
10
  class ArrayView extends base_view_1.BaseView {
11
11
  createChild(input, id, item, before) {
12
- super.createChild(input, item, item, before || this.$.nodes.get(id));
12
+ super.createChild(input, item, item, before || this.nodes.get(id));
13
13
  }
14
- compose(input) {
15
- super.compose(input);
16
- input.model.forEach(item => {
17
- this.createChild(input, item, item);
14
+ compose() {
15
+ super.compose();
16
+ this.input.model.forEach(item => {
17
+ this.createChild(this.input, item, item);
18
18
  });
19
- return {};
20
19
  }
21
20
  }
22
21
  exports.ArrayView = ArrayView;
@@ -1,19 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseView = exports.BaseViewPrivate = void 0;
3
+ exports.BaseView = void 0;
4
4
  const repeat_node_1 = require("./repeat-node");
5
- /**
6
- * Private part of BaseView
7
- * @class BaseViewPrivate
8
- * @extends RepeatNodePrivate
9
- */
10
- class BaseViewPrivate extends repeat_node_1.RepeatNodePrivate {
11
- constructor() {
12
- super();
13
- this.$seal();
14
- }
15
- }
16
- exports.BaseViewPrivate = BaseViewPrivate;
17
5
  /**
18
6
  * Base class of default views
19
7
  * @class BaseView
@@ -21,24 +9,23 @@ exports.BaseViewPrivate = BaseViewPrivate;
21
9
  * @implements IModel
22
10
  */
23
11
  class BaseView extends repeat_node_1.RepeatNode {
24
- constructor(input, $) {
25
- super(input, $ || new BaseViewPrivate);
12
+ constructor(input, name) {
13
+ super(input, name);
26
14
  }
27
- compose(input) {
28
- const $ = this.$;
29
- $.addHandler = (id, item) => {
30
- this.createChild(input, id, item);
15
+ compose() {
16
+ this.addHandler = (id, item) => {
17
+ this.createChild(this.input, id, item);
31
18
  };
32
- $.removeHandler = (id, item) => {
19
+ this.removeHandler = (id, item) => {
33
20
  this.destroyChild(id, item);
34
21
  };
35
- input.model.listener.onAdd($.addHandler);
36
- input.model.listener.onRemove($.removeHandler);
37
- this.runOnDestroy(() => {
38
- input.model.listener.offAdd($.addHandler);
39
- input.model.listener.offRemove($.removeHandler);
40
- });
41
- return {};
22
+ this.input.model.listener.onAdd(this.addHandler);
23
+ this.input.model.listener.onRemove(this.removeHandler);
24
+ }
25
+ destroy() {
26
+ this.input.model.listener.offAdd(this.addHandler);
27
+ this.input.model.listener.offRemove(this.removeHandler);
28
+ super.destroy();
42
29
  }
43
30
  }
44
31
  exports.BaseView = BaseView;
@@ -8,12 +8,11 @@ const base_view_1 = require("./base-view");
8
8
  * @extends BaseView
9
9
  */
10
10
  class MapView extends base_view_1.BaseView {
11
- compose(input) {
12
- super.compose(input);
13
- input.model.forEach((value, key) => {
14
- this.createChild(input, key, value);
11
+ compose() {
12
+ super.compose();
13
+ this.input.model.forEach((value, key) => {
14
+ this.createChild(this.input, key, value);
15
15
  });
16
- return {};
17
16
  }
18
17
  }
19
18
  exports.MapView = MapView;
@@ -1,43 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RepeatNode = exports.RepeatNodePrivate = void 0;
3
+ exports.RepeatNode = void 0;
4
+ const config_1 = require("../core/config");
4
5
  const node_1 = require("../node/node");
5
- /**
6
- * Private part of repeat node
7
- * @class RepeatNodePrivate
8
- * @extends INodePrivate
9
- */
10
- class RepeatNodePrivate extends node_1.INodePrivate {
11
- constructor() {
12
- super();
13
- /**
14
- * Children node hash
15
- * @type {Map}
16
- */
17
- this.nodes = new Map();
18
- this.$seal();
19
- }
20
- $destroy() {
21
- this.nodes.clear();
22
- super.$destroy();
23
- }
24
- }
25
- exports.RepeatNodePrivate = RepeatNodePrivate;
26
6
  /**
27
7
  * Repeat node repeats its children
28
8
  * @class RepeatNode
29
9
  * @extends Fragment
30
10
  */
31
11
  class RepeatNode extends node_1.Fragment {
32
- constructor(input, $) {
33
- super(input, $);
12
+ constructor(input, name) {
13
+ super(input, name);
34
14
  /**
35
- * If false will use timeout executor, otherwise the app executor
15
+ * Children node hash
16
+ * @type {Map}
36
17
  */
37
- this.freezeUi = true;
18
+ this.nodes = new Map();
38
19
  }
39
20
  createChild(opts, id, item, before) {
40
- const node = new node_1.Fragment({});
21
+ const _id = id && typeof id === "object" && "id" in id ? id.id : config_1.config.debugUi ? JSON.stringify(id) : id;
22
+ const node = new node_1.Fragment({}, `${_id}`);
23
+ node.parent = this;
41
24
  this.destroyChild(id, item);
42
25
  if (before) {
43
26
  this.children.add(node);
@@ -51,21 +34,20 @@ class RepeatNode extends node_1.Fragment {
51
34
  this.children.add(node);
52
35
  }
53
36
  this.lastChild = node;
54
- node.preinit(this.$.app, this);
55
- node.init();
56
37
  opts.slot && opts.slot(node, item, id);
57
- node.ready();
58
- this.$.nodes.set(id, node);
38
+ this.nodes.set(id, node);
59
39
  }
60
40
  destroyChild(id, item) {
61
- const $ = this.$;
62
- const child = $.nodes.get(id);
41
+ const child = this.nodes.get(id);
63
42
  if (child) {
64
43
  child.remove();
65
- child.$destroy();
66
- this.$.nodes.delete(id);
44
+ child.destroy();
45
+ this.nodes.delete(id);
67
46
  this.children.delete(child);
68
47
  }
69
48
  }
49
+ destroy() {
50
+ this.nodes.clear();
51
+ }
70
52
  }
71
53
  exports.RepeatNode = RepeatNode;
@@ -8,11 +8,13 @@ const base_view_1 = require("./base-view");
8
8
  * @extends BaseView
9
9
  */
10
10
  class SetView extends base_view_1.BaseView {
11
- compose(input) {
12
- super.compose(input);
13
- const set = input.model;
14
- set.forEach(item => {
15
- this.createChild(input, item, item);
11
+ constructor(input) {
12
+ super(input, ":set-view");
13
+ }
14
+ compose() {
15
+ super.compose();
16
+ this.input.model.forEach(item => {
17
+ this.createChild(this.input, item, item);
16
18
  });
17
19
  return {};
18
20
  }
package/package.json CHANGED
@@ -3,18 +3,17 @@
3
3
  "description": "Vasille - Safe. Simple. Powerful.",
4
4
  "main": "lib/index.js",
5
5
  "types": "types/index.d.ts",
6
- "version": "2.3.9",
6
+ "version": "3.0.2",
7
7
  "exports": {
8
8
  "import": "./lib/index.js",
9
9
  "browser": "./lib/index.js",
10
10
  "node": "./lib-node/index.js",
11
11
  "require": "./lib-node/index.js"
12
12
  },
13
- "unpkg": "./cdn/es2015.js",
14
13
  "scripts": {
15
14
  "prepack": "cp -f ../README.md ./README.md",
16
- "prettier": "npx prettier src test --check",
17
- "build": "tsc --build tsconfig-build.json",
15
+ "prettier": "npx prettier src test --write",
16
+ "build": "tsc --build tsconfig.json",
18
17
  "build-node": "tsc --build tsconfig-build-node.json",
19
18
  "test": "jest",
20
19
  "test-coverage": "jest --coverage",
@@ -23,7 +22,7 @@
23
22
  },
24
23
  "repository": {
25
24
  "type": "git",
26
- "url": "https://gitlab.com/vasille-js/vasille-js.git"
25
+ "url": "git+https://github.com/vasille-js/vasille-js.git"
27
26
  },
28
27
  "type": "module",
29
28
  "keywords": [
@@ -34,8 +33,12 @@
34
33
  "simple",
35
34
  "poweful"
36
35
  ],
37
- "author": "Vasile Lixcode <lixcode@vivaldi.net> (https://t.me/lixcode)",
36
+ "author": "lixcode",
38
37
  "license": "MIT",
38
+ "bugs": {
39
+ "url": "https://github.com/vasille-js/vasille-js/issues"
40
+ },
41
+ "homepage": "https://github.com/vasille-js/vasille-js#readme",
39
42
  "devDependencies": {
40
43
  "@types/debug": "4.1.12",
41
44
  "@types/eslint": "9.6.1",
@@ -6,12 +6,12 @@ import type { IValue } from "../core/ivalue";
6
6
  * @class AttributeBinding
7
7
  * @extends Binding
8
8
  */
9
- export declare class AttributeBinding extends Binding<string | number | boolean | null> {
9
+ export declare class AttributeBinding extends Binding<string | number | boolean | null | undefined> {
10
10
  /**
11
11
  * Constructs an attribute binding description
12
12
  * @param node {INode} the vasille node
13
13
  * @param name {String} the name of attribute
14
14
  * @param value {IValue} value to bind
15
15
  */
16
- constructor(node: INode, name: string, value: IValue<string | number | boolean | null>);
16
+ constructor(node: INode, name: string, value: IValue<string | number | boolean | null | undefined>);
17
17
  }
@@ -17,5 +17,5 @@ export declare class Binding<T> extends Destroyable {
17
17
  /**
18
18
  * Just clear bindings
19
19
  */
20
- $destroy(): void;
20
+ destroy(): void;
21
21
  }
@@ -1,17 +1,18 @@
1
1
  import { Binding } from "./binding";
2
2
  import type { INode } from "../node/node";
3
3
  import type { IValue } from "../core/ivalue";
4
+ export declare function stringifyStyleValue(value: string | number | number[]): string;
4
5
  /**
5
6
  * Describes a style attribute binding
6
7
  * @class StyleBinding
7
8
  * @extends Binding
8
9
  */
9
- export declare class StyleBinding extends Binding<string> {
10
+ export declare class StyleBinding extends Binding<string | number | number[]> {
10
11
  /**
11
12
  * Constructs a style binding attribute
12
13
  * @param node {INode} the vasille node
13
14
  * @param name {string} the name of style property
14
15
  * @param value {IValue} the value to bind
15
16
  */
16
- constructor(node: INode, name: string, value: IValue<string>);
17
+ constructor(node: INode, name: string, value: IValue<string | number | number[]>);
17
18
  }
@@ -0,0 +1,3 @@
1
+ export declare const config: {
2
+ debugUi: boolean;
3
+ };