vasille 3.0.2 → 3.2.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.
- package/README.md +10 -10
- package/lib/core/core.js +40 -24
- package/lib/core/ivalue.js +1 -2
- package/lib/index.js +20 -22
- package/lib/node/app.js +7 -7
- package/lib/node/node.js +47 -360
- package/lib/node/watch.js +5 -6
- package/lib/{binding → runner/web/binding}/attribute.js +1 -1
- package/lib/{binding → runner/web/binding}/binding.js +1 -1
- package/lib/{binding → runner/web/binding}/class.js +3 -1
- package/lib/{binding → runner/web/binding}/style.js +2 -1
- package/lib/runner/web/runner.js +165 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/value/expression.js +3 -2
- package/lib/value/pointer.js +8 -12
- package/lib/value/reference.js +2 -2
- package/lib/views/array-view.js +1 -1
- package/lib/views/base-view.js +3 -3
- package/lib/views/map-view.js +1 -1
- package/lib/views/repeat-node.js +5 -6
- package/lib/views/set-view.js +3 -3
- package/package.json +31 -25
- package/types/core/core.d.ts +14 -13
- package/types/index.d.ts +22 -24
- package/types/node/app.d.ts +8 -7
- package/types/node/node.d.ts +49 -144
- package/types/node/runner.d.ts +10 -0
- package/types/node/watch.d.ts +7 -6
- package/types/{binding → runner/web/binding}/attribute.d.ts +4 -4
- package/types/{binding → runner/web/binding}/binding.d.ts +2 -2
- package/types/runner/web/binding/class.d.ts +11 -0
- package/types/{binding → runner/web/binding}/style.d.ts +4 -4
- package/types/runner/web/runner.d.ts +42 -0
- package/types/tsconfig-types.tsbuildinfo +1 -1
- package/types/value/expression.d.ts +2 -2
- package/types/value/pointer.d.ts +1 -1
- package/types/value/reference.d.ts +1 -1
- package/types/views/array-view.d.ts +5 -5
- package/types/views/base-view.d.ts +7 -6
- package/types/views/map-view.d.ts +3 -3
- package/types/views/repeat-node.d.ts +8 -7
- package/types/views/set-view.d.ts +5 -4
- package/lib/core/config.js +0 -3
- package/lib/models/array-model.js +0 -147
- package/lib/models/listener.js +0 -66
- package/lib/models/map-model.js +0 -59
- package/lib/models/model.js +0 -1
- package/lib/models/object-model.js +0 -78
- package/lib/models/set-model.js +0 -55
- package/lib/spec/html.js +0 -1
- package/lib/spec/react.js +0 -1
- package/lib/spec/svg.js +0 -1
- package/lib/tsconfig-build.tsbuildinfo +0 -1
- package/lib/value/mirror.js +0 -42
- package/lib/views/object-view.js +0 -17
- package/lib-node/binding/attribute.js +0 -34
- package/lib-node/binding/binding.js +0 -32
- package/lib-node/binding/class.js +0 -46
- package/lib-node/binding/style.js +0 -36
- package/lib-node/core/config.js +0 -6
- package/lib-node/core/core.js +0 -101
- package/lib-node/core/destroyable.js +0 -14
- package/lib-node/core/errors.js +0 -22
- package/lib-node/core/ivalue.js +0 -19
- package/lib-node/functional/options.js +0 -2
- package/lib-node/functional/safety.js +0 -12
- package/lib-node/index.js +0 -51
- package/lib-node/models/array-model.js +0 -152
- package/lib-node/models/listener.js +0 -70
- package/lib-node/models/map-model.js +0 -63
- package/lib-node/models/model.js +0 -2
- package/lib-node/models/object-model.js +0 -82
- package/lib-node/models/set-model.js +0 -59
- package/lib-node/node/app.js +0 -34
- package/lib-node/node/node.js +0 -656
- package/lib-node/node/watch.js +0 -26
- package/lib-node/spec/html.js +0 -2
- package/lib-node/spec/react.js +0 -2
- package/lib-node/spec/svg.js +0 -2
- package/lib-node/tsconfig-build-node.tsbuildinfo +0 -1
- package/lib-node/value/expression.js +0 -65
- package/lib-node/value/mirror.js +0 -46
- package/lib-node/value/pointer.js +0 -79
- package/lib-node/value/reference.js +0 -50
- package/lib-node/views/array-view.js +0 -21
- package/lib-node/views/base-view.js +0 -31
- package/lib-node/views/map-view.js +0 -18
- package/lib-node/views/object-view.js +0 -21
- package/lib-node/views/repeat-node.js +0 -53
- package/lib-node/views/set-view.js +0 -22
- package/types/binding/class.d.ts +0 -11
- package/types/core/config.d.ts +0 -3
- package/types/functional/options.d.ts +0 -10
- package/types/models/array-model.d.ts +0 -55
- package/types/models/listener.d.ts +0 -48
- package/types/models/map-model.d.ts +0 -34
- package/types/models/model.d.ts +0 -14
- package/types/models/object-model.d.ts +0 -38
- package/types/models/set-model.d.ts +0 -33
- package/types/spec/html.d.ts +0 -975
- package/types/spec/react.d.ts +0 -4
- package/types/spec/svg.d.ts +0 -314
- package/types/value/mirror.d.ts +0 -33
- package/types/views/object-view.d.ts +0 -10
- /package/lib/{functional/options.js → node/runner.js} +0 -0
package/lib-node/spec/react.js
DELETED
package/lib-node/spec/svg.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Expression = void 0;
|
|
4
|
-
const reference_js_1 = require("./reference.js");
|
|
5
|
-
const ivalue_1 = require("../core/ivalue");
|
|
6
|
-
/**
|
|
7
|
-
* Bind some values to one expression
|
|
8
|
-
* @class Expression
|
|
9
|
-
* @extends IValue
|
|
10
|
-
*/
|
|
11
|
-
class Expression extends ivalue_1.IValue {
|
|
12
|
-
/**
|
|
13
|
-
* Creates a function bounded to N values
|
|
14
|
-
* @param func {Function} the function to bound
|
|
15
|
-
* @param values
|
|
16
|
-
* @param link {Boolean} links immediately if true
|
|
17
|
-
*/
|
|
18
|
-
constructor(func, ...values) {
|
|
19
|
-
super();
|
|
20
|
-
/**
|
|
21
|
-
* Expression will link different handler for each value of the list
|
|
22
|
-
*/
|
|
23
|
-
this.linkedFunc = [];
|
|
24
|
-
const handler = (i) => {
|
|
25
|
-
if (typeof i === "number") {
|
|
26
|
-
this.valuesCache[i] = this.values[i].$;
|
|
27
|
-
}
|
|
28
|
-
this.sync.$ = func.apply(this, this.valuesCache);
|
|
29
|
-
};
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
this.valuesCache = values.map(item => item.$);
|
|
33
|
-
this.sync = new reference_js_1.Reference(func.apply(this, this.valuesCache));
|
|
34
|
-
let i = 0;
|
|
35
|
-
values.forEach(value => {
|
|
36
|
-
const updater = handler.bind(this, Number(i++));
|
|
37
|
-
this.linkedFunc.push(updater);
|
|
38
|
-
value.on(updater);
|
|
39
|
-
});
|
|
40
|
-
this.values = values;
|
|
41
|
-
this.func = handler;
|
|
42
|
-
}
|
|
43
|
-
get $() {
|
|
44
|
-
return this.sync.$;
|
|
45
|
-
}
|
|
46
|
-
set $(value) {
|
|
47
|
-
this.sync.$ = value;
|
|
48
|
-
}
|
|
49
|
-
on(handler) {
|
|
50
|
-
this.sync.on(handler);
|
|
51
|
-
}
|
|
52
|
-
off(handler) {
|
|
53
|
-
this.sync.off(handler);
|
|
54
|
-
}
|
|
55
|
-
destroy() {
|
|
56
|
-
for (let i = 0; i < this.values.length; i++) {
|
|
57
|
-
this.values[i].off(this.linkedFunc[i]);
|
|
58
|
-
}
|
|
59
|
-
this.values.splice(0);
|
|
60
|
-
this.valuesCache.splice(0);
|
|
61
|
-
this.linkedFunc.splice(0);
|
|
62
|
-
super.destroy();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.Expression = Expression;
|
package/lib-node/value/mirror.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Mirror = void 0;
|
|
4
|
-
const reference_1 = require("./reference");
|
|
5
|
-
/**
|
|
6
|
-
* Declares a notifiable bind to a value
|
|
7
|
-
* @class Mirror
|
|
8
|
-
* @extends IValue
|
|
9
|
-
* @version 2
|
|
10
|
-
*/
|
|
11
|
-
class Mirror extends reference_1.Reference {
|
|
12
|
-
/**
|
|
13
|
-
* Constructs a notifiable bind to a value
|
|
14
|
-
* @param value {IValue} is initial value
|
|
15
|
-
* @param forwardOnly {boolean} ensure forward only synchronization
|
|
16
|
-
*/
|
|
17
|
-
constructor(value, forwardOnly = false) {
|
|
18
|
-
super(value.$);
|
|
19
|
-
this.handler = (v) => {
|
|
20
|
-
this.$ = v;
|
|
21
|
-
};
|
|
22
|
-
this.value = value;
|
|
23
|
-
this.forward = forwardOnly;
|
|
24
|
-
value.on(this.handler);
|
|
25
|
-
}
|
|
26
|
-
get $() {
|
|
27
|
-
// this is a ts bug
|
|
28
|
-
// eslint-disable-next-line
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
return super.$;
|
|
31
|
-
}
|
|
32
|
-
set $(v) {
|
|
33
|
-
if (!this.forward) {
|
|
34
|
-
this.value.$ = v;
|
|
35
|
-
}
|
|
36
|
-
// this is a ts bug
|
|
37
|
-
// eslint-disable-next-line
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
super.$ = v;
|
|
40
|
-
}
|
|
41
|
-
destroy() {
|
|
42
|
-
this.value.off(this.handler);
|
|
43
|
-
super.destroy();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.Mirror = Mirror;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OwningPointer = exports.Pointer = void 0;
|
|
4
|
-
const ivalue_1 = require("../core/ivalue");
|
|
5
|
-
const reference_1 = require("./reference");
|
|
6
|
-
/**
|
|
7
|
-
* r/w pointer to a value
|
|
8
|
-
* @class Pointer
|
|
9
|
-
* @extends IValue
|
|
10
|
-
*/
|
|
11
|
-
class Pointer extends ivalue_1.IValue {
|
|
12
|
-
/**
|
|
13
|
-
* Constructs a notifiable bind to a value
|
|
14
|
-
* @param value {IValue} is initial valu
|
|
15
|
-
*/
|
|
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);
|
|
24
|
-
}
|
|
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;
|
|
48
|
-
}
|
|
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
|
-
}
|
|
66
|
-
}
|
|
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;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Reference = void 0;
|
|
4
|
-
const ivalue_1 = require("../core/ivalue");
|
|
5
|
-
const safety_1 = require("../functional/safety");
|
|
6
|
-
/**
|
|
7
|
-
* Declares a notifiable value
|
|
8
|
-
* @class Reference
|
|
9
|
-
* @extends IValue
|
|
10
|
-
*/
|
|
11
|
-
class Reference extends ivalue_1.IValue {
|
|
12
|
-
/**
|
|
13
|
-
* @param value {any} the initial value
|
|
14
|
-
*/
|
|
15
|
-
constructor(value) {
|
|
16
|
-
super();
|
|
17
|
-
this.state = value;
|
|
18
|
-
this.onChange = new Set();
|
|
19
|
-
}
|
|
20
|
-
get $() {
|
|
21
|
-
return this.state;
|
|
22
|
-
}
|
|
23
|
-
set $(value) {
|
|
24
|
-
if (this.state !== value) {
|
|
25
|
-
this.state = value;
|
|
26
|
-
this.updateDeps(value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
on(handler) {
|
|
30
|
-
this.onChange.add(handler);
|
|
31
|
-
}
|
|
32
|
-
off(handler) {
|
|
33
|
-
this.onChange.delete(handler);
|
|
34
|
-
}
|
|
35
|
-
destroy() {
|
|
36
|
-
super.destroy();
|
|
37
|
-
this.onChange.clear();
|
|
38
|
-
}
|
|
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
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.Reference = Reference;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArrayView = void 0;
|
|
4
|
-
const base_view_1 = require("./base-view");
|
|
5
|
-
/**
|
|
6
|
-
* Represents a view of an array model
|
|
7
|
-
* @class ArrayView
|
|
8
|
-
* @extends BaseView
|
|
9
|
-
*/
|
|
10
|
-
class ArrayView extends base_view_1.BaseView {
|
|
11
|
-
createChild(input, id, item, before) {
|
|
12
|
-
super.createChild(input, item, item, before || this.nodes.get(id));
|
|
13
|
-
}
|
|
14
|
-
compose() {
|
|
15
|
-
super.compose();
|
|
16
|
-
this.input.model.forEach(item => {
|
|
17
|
-
this.createChild(this.input, item, item);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.ArrayView = ArrayView;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseView = void 0;
|
|
4
|
-
const repeat_node_1 = require("./repeat-node");
|
|
5
|
-
/**
|
|
6
|
-
* Base class of default views
|
|
7
|
-
* @class BaseView
|
|
8
|
-
* @extends RepeatNode
|
|
9
|
-
* @implements IModel
|
|
10
|
-
*/
|
|
11
|
-
class BaseView extends repeat_node_1.RepeatNode {
|
|
12
|
-
constructor(input, name) {
|
|
13
|
-
super(input, name);
|
|
14
|
-
}
|
|
15
|
-
compose() {
|
|
16
|
-
this.addHandler = (id, item) => {
|
|
17
|
-
this.createChild(this.input, id, item);
|
|
18
|
-
};
|
|
19
|
-
this.removeHandler = (id, item) => {
|
|
20
|
-
this.destroyChild(id, item);
|
|
21
|
-
};
|
|
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();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.BaseView = BaseView;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MapView = void 0;
|
|
4
|
-
const base_view_1 = require("./base-view");
|
|
5
|
-
/**
|
|
6
|
-
* Create a children pack for each map value
|
|
7
|
-
* @class MapView
|
|
8
|
-
* @extends BaseView
|
|
9
|
-
*/
|
|
10
|
-
class MapView extends base_view_1.BaseView {
|
|
11
|
-
compose() {
|
|
12
|
-
super.compose();
|
|
13
|
-
this.input.model.forEach((value, key) => {
|
|
14
|
-
this.createChild(this.input, key, value);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.MapView = MapView;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ObjectView = void 0;
|
|
4
|
-
const base_view_1 = require("./base-view");
|
|
5
|
-
/**
|
|
6
|
-
* Create a children pack for each object field
|
|
7
|
-
* @class ObjectView
|
|
8
|
-
* @extends BaseView
|
|
9
|
-
*/
|
|
10
|
-
class ObjectView extends base_view_1.BaseView {
|
|
11
|
-
compose(input) {
|
|
12
|
-
super.compose(input);
|
|
13
|
-
const obj = input.model.values;
|
|
14
|
-
for (const key in obj) {
|
|
15
|
-
this.createChild(input, key, obj[key]);
|
|
16
|
-
}
|
|
17
|
-
super.ready();
|
|
18
|
-
return {};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.ObjectView = ObjectView;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RepeatNode = void 0;
|
|
4
|
-
const config_1 = require("../core/config");
|
|
5
|
-
const node_1 = require("../node/node");
|
|
6
|
-
/**
|
|
7
|
-
* Repeat node repeats its children
|
|
8
|
-
* @class RepeatNode
|
|
9
|
-
* @extends Fragment
|
|
10
|
-
*/
|
|
11
|
-
class RepeatNode extends node_1.Fragment {
|
|
12
|
-
constructor(input, name) {
|
|
13
|
-
super(input, name);
|
|
14
|
-
/**
|
|
15
|
-
* Children node hash
|
|
16
|
-
* @type {Map}
|
|
17
|
-
*/
|
|
18
|
-
this.nodes = new Map();
|
|
19
|
-
}
|
|
20
|
-
createChild(opts, id, item, before) {
|
|
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;
|
|
24
|
-
this.destroyChild(id, item);
|
|
25
|
-
if (before) {
|
|
26
|
-
this.children.add(node);
|
|
27
|
-
before.insertBefore(node);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
const lastChild = this.lastChild;
|
|
31
|
-
if (lastChild) {
|
|
32
|
-
lastChild.insertAfter(node);
|
|
33
|
-
}
|
|
34
|
-
this.children.add(node);
|
|
35
|
-
}
|
|
36
|
-
this.lastChild = node;
|
|
37
|
-
opts.slot && opts.slot(node, item, id);
|
|
38
|
-
this.nodes.set(id, node);
|
|
39
|
-
}
|
|
40
|
-
destroyChild(id, item) {
|
|
41
|
-
const child = this.nodes.get(id);
|
|
42
|
-
if (child) {
|
|
43
|
-
child.remove();
|
|
44
|
-
child.destroy();
|
|
45
|
-
this.nodes.delete(id);
|
|
46
|
-
this.children.delete(child);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
destroy() {
|
|
50
|
-
this.nodes.clear();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.RepeatNode = RepeatNode;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetView = void 0;
|
|
4
|
-
const base_view_1 = require("./base-view");
|
|
5
|
-
/**
|
|
6
|
-
* Create a children pack for each set value
|
|
7
|
-
* @class SetView
|
|
8
|
-
* @extends BaseView
|
|
9
|
-
*/
|
|
10
|
-
class SetView extends base_view_1.BaseView {
|
|
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);
|
|
18
|
-
});
|
|
19
|
-
return {};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.SetView = SetView;
|
package/types/binding/class.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Binding } from "./binding";
|
|
2
|
-
import type { INode } from "../node/node";
|
|
3
|
-
import type { IValue } from "../core/ivalue";
|
|
4
|
-
export declare class StaticClassBinding extends Binding<boolean> {
|
|
5
|
-
private current;
|
|
6
|
-
constructor(node: INode, name: string, value: IValue<boolean>);
|
|
7
|
-
}
|
|
8
|
-
export declare class DynamicalClassBinding extends Binding<string> {
|
|
9
|
-
private current;
|
|
10
|
-
constructor(node: INode, value: IValue<string>);
|
|
11
|
-
}
|
package/types/core/config.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IValue } from "../core/ivalue";
|
|
2
|
-
export type AttrType<T> = IValue<T | string | null> | T | string | null | undefined;
|
|
3
|
-
export type StyleType<T> = T | number | number[] | IValue<string | number | number[]>;
|
|
4
|
-
export interface TagOptions {
|
|
5
|
-
attr?: Record<string, AttrType<number | boolean>>;
|
|
6
|
-
class?: (string | IValue<string> | Record<string, boolean | IValue<boolean>>)[];
|
|
7
|
-
style?: Record<string, StyleType<string>>;
|
|
8
|
-
events?: Record<string, (...args: unknown[]) => unknown>;
|
|
9
|
-
bind?: Record<string, any>;
|
|
10
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Listener } from "./listener";
|
|
2
|
-
import { ListenableModel } from "./model";
|
|
3
|
-
/**
|
|
4
|
-
* Model based on Array class
|
|
5
|
-
* @extends Array
|
|
6
|
-
* @implements IModel
|
|
7
|
-
*/
|
|
8
|
-
export declare class ArrayModel<T> extends Array<T> implements ListenableModel<T, T> {
|
|
9
|
-
listener: Listener<T, T>;
|
|
10
|
-
passive: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* @param data {Array} input data
|
|
13
|
-
*/
|
|
14
|
-
constructor(data?: Array<T> | number);
|
|
15
|
-
/**
|
|
16
|
-
* Calls Array.fill and notify about changes
|
|
17
|
-
* @param value {*} value to fill with
|
|
18
|
-
* @param start {?number} begin index
|
|
19
|
-
* @param end {?number} end index
|
|
20
|
-
*/
|
|
21
|
-
fill(value: T, start?: number, end?: number): this;
|
|
22
|
-
/**
|
|
23
|
-
* Calls Array.pop and notify about changes
|
|
24
|
-
* @return {*} removed value
|
|
25
|
-
*/
|
|
26
|
-
pop(): T | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Calls Array.push and notify about changes
|
|
29
|
-
* @param items {...*} values to push
|
|
30
|
-
* @return {number} new length of array
|
|
31
|
-
*/
|
|
32
|
-
push(...items: Array<T>): number;
|
|
33
|
-
/**
|
|
34
|
-
* Calls Array.shift and notify about changed
|
|
35
|
-
* @return {*} the shifted value
|
|
36
|
-
*/
|
|
37
|
-
shift(): T | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Calls Array.splice and notify about changed
|
|
40
|
-
* @param start {number} start index
|
|
41
|
-
* @param deleteCount {?number} delete count
|
|
42
|
-
* @param items {...*}
|
|
43
|
-
* @return {ArrayModel} a pointer to this
|
|
44
|
-
*/
|
|
45
|
-
splice(start: number, deleteCount?: number, ...items: Array<T>): ArrayModel<T>;
|
|
46
|
-
/**
|
|
47
|
-
* Calls Array.unshift and notify about changed
|
|
48
|
-
* @param items {...*} values to insert
|
|
49
|
-
* @return {number} the length after prepend
|
|
50
|
-
*/
|
|
51
|
-
unshift(...items: Array<T>): number;
|
|
52
|
-
replace(at: number, with_: T): this;
|
|
53
|
-
destroy(): void;
|
|
54
|
-
}
|
|
55
|
-
export declare function proxyArrayModel<T>(arr: ArrayModel<T>): ArrayModel<T>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represent a listener for a model
|
|
3
|
-
* @class Listener
|
|
4
|
-
*/
|
|
5
|
-
export declare class Listener<ValueT, IndexT = string | number> {
|
|
6
|
-
/**
|
|
7
|
-
* Functions to run on adding new items
|
|
8
|
-
* @type Set
|
|
9
|
-
*/
|
|
10
|
-
private readonly onAdded;
|
|
11
|
-
/**
|
|
12
|
-
* Functions to run on item removing
|
|
13
|
-
* @type Set
|
|
14
|
-
*/
|
|
15
|
-
private readonly onRemoved;
|
|
16
|
-
/**
|
|
17
|
-
* Emits added event to listeners
|
|
18
|
-
* @param index {*} index of value
|
|
19
|
-
* @param value {*} value of added item
|
|
20
|
-
*/
|
|
21
|
-
emitAdded(index: IndexT, value: ValueT): void;
|
|
22
|
-
/**
|
|
23
|
-
* Emits removed event to listeners
|
|
24
|
-
* @param index {*} index of removed value
|
|
25
|
-
* @param value {*} value of removed item
|
|
26
|
-
*/
|
|
27
|
-
emitRemoved(index: IndexT, value: ValueT): void;
|
|
28
|
-
/**
|
|
29
|
-
* Adds a handler to added event
|
|
30
|
-
* @param handler {function} function to run on event emitting
|
|
31
|
-
*/
|
|
32
|
-
onAdd(handler: (index: IndexT, value: ValueT) => void): void;
|
|
33
|
-
/**
|
|
34
|
-
* Adds a handler to removed event
|
|
35
|
-
* @param handler {function} function to run on event emitting
|
|
36
|
-
*/
|
|
37
|
-
onRemove(handler: (index: IndexT, value: ValueT) => void): void;
|
|
38
|
-
/**
|
|
39
|
-
* Removes an handler from added event
|
|
40
|
-
* @param handler {function} handler to remove
|
|
41
|
-
*/
|
|
42
|
-
offAdd(handler: (index: IndexT, value: ValueT) => void): void;
|
|
43
|
-
/**
|
|
44
|
-
* Removes an handler form removed event
|
|
45
|
-
* @param handler {function} handler to remove
|
|
46
|
-
*/
|
|
47
|
-
offRemove(handler: (index: IndexT, value: ValueT) => void): void;
|
|
48
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Listener } from "./listener";
|
|
2
|
-
import { ListenableModel } from "./model";
|
|
3
|
-
/**
|
|
4
|
-
* A Map based memory
|
|
5
|
-
* @class MapModel
|
|
6
|
-
* @extends Map
|
|
7
|
-
* @implements IModel
|
|
8
|
-
*/
|
|
9
|
-
export declare class MapModel<K, T> extends Map<K, T> implements ListenableModel<K, T> {
|
|
10
|
-
listener: Listener<T, K>;
|
|
11
|
-
/**
|
|
12
|
-
* Constructs a map model
|
|
13
|
-
* @param map {[*, *][]} input data
|
|
14
|
-
*/
|
|
15
|
-
constructor(map?: [K, T][]);
|
|
16
|
-
/**
|
|
17
|
-
* Calls Map.clear and notify about changes
|
|
18
|
-
*/
|
|
19
|
-
clear(): void;
|
|
20
|
-
/**
|
|
21
|
-
* Calls Map.delete and notify abut changes
|
|
22
|
-
* @param key {*} key
|
|
23
|
-
* @return {boolean} true if removed something, otherwise false
|
|
24
|
-
*/
|
|
25
|
-
delete(key: K): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Calls Map.set and notify abut changes
|
|
28
|
-
* @param key {*} key
|
|
29
|
-
* @param value {*} value
|
|
30
|
-
* @return {MapModel} a pointer to this
|
|
31
|
-
*/
|
|
32
|
-
set(key: K, value: T): this;
|
|
33
|
-
destroy(): void;
|
|
34
|
-
}
|
package/types/models/model.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IDestroyable } from "../core/destroyable";
|
|
2
|
-
import { Listener } from "./listener";
|
|
3
|
-
/**
|
|
4
|
-
* @interface IModel
|
|
5
|
-
*/
|
|
6
|
-
export interface IModel extends IDestroyable {
|
|
7
|
-
}
|
|
8
|
-
export interface ListenableModel<K, T> extends IModel {
|
|
9
|
-
/**
|
|
10
|
-
* The listener of model
|
|
11
|
-
* @type Listener
|
|
12
|
-
*/
|
|
13
|
-
listener: Listener<T, K>;
|
|
14
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Listener } from "./listener";
|
|
2
|
-
import { ListenableModel } from "./model";
|
|
3
|
-
/**
|
|
4
|
-
* Object based model
|
|
5
|
-
* @extends Object
|
|
6
|
-
*/
|
|
7
|
-
export declare class ObjectModel<T> extends Object implements ListenableModel<string, T> {
|
|
8
|
-
listener: Listener<T, string>;
|
|
9
|
-
private container;
|
|
10
|
-
/**
|
|
11
|
-
* Constructs a object model
|
|
12
|
-
* @param obj {Object} input data
|
|
13
|
-
*/
|
|
14
|
-
constructor(obj?: {
|
|
15
|
-
[p: string]: T;
|
|
16
|
-
});
|
|
17
|
-
/**
|
|
18
|
-
* Gets a value of a field
|
|
19
|
-
* @param key {string}
|
|
20
|
-
* @return {*}
|
|
21
|
-
*/
|
|
22
|
-
get(key: string): T;
|
|
23
|
-
/**
|
|
24
|
-
* Sets an object property value
|
|
25
|
-
* @param key {string} property name
|
|
26
|
-
* @param v {*} property value
|
|
27
|
-
* @return {ObjectModel} a pointer to this
|
|
28
|
-
*/
|
|
29
|
-
set(key: string, v: T): this;
|
|
30
|
-
get values(): Record<string, T>;
|
|
31
|
-
/**
|
|
32
|
-
* Deletes an object property
|
|
33
|
-
* @param key {string} property name
|
|
34
|
-
*/
|
|
35
|
-
delete(key: string): void;
|
|
36
|
-
enableReactivity(): void;
|
|
37
|
-
disableReactivity(): void;
|
|
38
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Listener } from "./listener";
|
|
2
|
-
import { ListenableModel } from "./model";
|
|
3
|
-
/**
|
|
4
|
-
* A Set based model
|
|
5
|
-
* @class SetModel
|
|
6
|
-
* @extends Set
|
|
7
|
-
* @implements IModel
|
|
8
|
-
*/
|
|
9
|
-
export declare class SetModel<T> extends Set<T> implements ListenableModel<T, T> {
|
|
10
|
-
listener: Listener<T, T>;
|
|
11
|
-
/**
|
|
12
|
-
* Constructs a set model based on a set
|
|
13
|
-
* @param set {Set} input data
|
|
14
|
-
*/
|
|
15
|
-
constructor(set?: T[]);
|
|
16
|
-
/**
|
|
17
|
-
* Calls Set.add and notify abut changes
|
|
18
|
-
* @param value {*} value
|
|
19
|
-
* @return {this} a pointer to this
|
|
20
|
-
*/
|
|
21
|
-
add(value: T): this;
|
|
22
|
-
/**
|
|
23
|
-
* Calls Set.clear and notify abut changes
|
|
24
|
-
*/
|
|
25
|
-
clear(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Calls Set.delete and notify abut changes
|
|
28
|
-
* @param value {*}
|
|
29
|
-
* @return {boolean} true if a value was deleted, otherwise false
|
|
30
|
-
*/
|
|
31
|
-
delete(value: T): boolean;
|
|
32
|
-
destroy(): void;
|
|
33
|
-
}
|