@arcanejs/toolkit 0.3.0 → 0.5.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/dist/backend/components/base.d.mts +6 -2
- package/dist/backend/components/base.d.ts +6 -2
- package/dist/backend/components/base.js +2 -2
- package/dist/backend/components/base.mjs +1 -1
- package/dist/backend/components/button.d.mts +1 -1
- package/dist/backend/components/button.d.ts +1 -1
- package/dist/backend/components/button.js +3 -3
- package/dist/backend/components/button.mjs +2 -2
- package/dist/backend/components/group.d.mts +1 -1
- package/dist/backend/components/group.d.ts +1 -1
- package/dist/backend/components/group.js +3 -3
- package/dist/backend/components/group.mjs +2 -2
- package/dist/backend/components/label.d.mts +1 -1
- package/dist/backend/components/label.d.ts +1 -1
- package/dist/backend/components/label.js +3 -3
- package/dist/backend/components/label.mjs +2 -2
- package/dist/backend/components/rect.d.mts +2 -4
- package/dist/backend/components/rect.d.ts +2 -4
- package/dist/backend/components/rect.js +3 -3
- package/dist/backend/components/rect.mjs +2 -2
- package/dist/backend/components/slider-button.d.mts +11 -9
- package/dist/backend/components/slider-button.d.ts +11 -9
- package/dist/backend/components/slider-button.js +3 -3
- package/dist/backend/components/slider-button.mjs +2 -2
- package/dist/backend/components/switch.d.mts +9 -2
- package/dist/backend/components/switch.d.ts +9 -2
- package/dist/backend/components/switch.js +3 -3
- package/dist/backend/components/switch.mjs +2 -2
- package/dist/backend/components/tabs.d.mts +1 -1
- package/dist/backend/components/tabs.d.ts +1 -1
- package/dist/backend/components/tabs.js +3 -3
- package/dist/backend/components/tabs.mjs +2 -2
- package/dist/backend/components/text-input.d.mts +1 -1
- package/dist/backend/components/text-input.d.ts +1 -1
- package/dist/backend/components/text-input.js +3 -3
- package/dist/backend/components/text-input.mjs +2 -2
- package/dist/backend/components/timeline.d.mts +1 -1
- package/dist/backend/components/timeline.d.ts +1 -1
- package/dist/backend/components/timeline.js +3 -3
- package/dist/backend/components/timeline.mjs +2 -2
- package/dist/backend/util/index.d.mts +8 -6
- package/dist/backend/util/index.d.ts +8 -6
- package/dist/backend/util/index.js +13 -1
- package/dist/backend/util/index.mjs +12 -0
- package/dist/{chunk-QUA3NBLD.js → chunk-4HHKW7VA.js} +4 -4
- package/dist/{chunk-J46AJUGE.js → chunk-4X3QY5EP.js} +3 -3
- package/dist/chunk-53DEDXHG.js +78 -0
- package/dist/{chunk-WXSKMMCV.js → chunk-C2TVGO43.js} +3 -3
- package/dist/{chunk-NZUYU32Z.js → chunk-CFO5PSSK.js} +25 -20
- package/dist/{chunk-POUQGJN4.mjs → chunk-DBSYI5Z4.mjs} +1 -1
- package/dist/{chunk-IW3JCC73.js → chunk-DONU33U4.js} +3 -3
- package/dist/{chunk-SMTUN6HG.mjs → chunk-ESMRIWOM.mjs} +2 -2
- package/dist/{chunk-TSC5C5XR.js → chunk-FLRGYURV.js} +2 -2
- package/dist/{chunk-DV5WTSFW.js → chunk-FUINWM5H.js} +2 -2
- package/dist/{chunk-EH73E5FP.mjs → chunk-G5QXW2L3.mjs} +1 -1
- package/dist/{chunk-YIXRQHTA.mjs → chunk-H734NV65.mjs} +1 -1
- package/dist/{chunk-WIPEQNWR.js → chunk-IQ4SDDYP.js} +3 -3
- package/dist/{chunk-7ITSSJE2.mjs → chunk-JOW3XRQI.mjs} +1 -1
- package/dist/{chunk-3Y3HRYLC.mjs → chunk-KBPQZJKE.mjs} +1 -1
- package/dist/{chunk-NKNDCRUR.mjs → chunk-KR6LSBBX.mjs} +1 -1
- package/dist/{chunk-EDTJ75FT.mjs → chunk-PW7QVLLF.mjs} +6 -1
- package/dist/chunk-Q3NG5UUN.mjs +61 -0
- package/dist/chunk-Q5TEM6MM.js +61 -0
- package/dist/{chunk-H2UQDFTS.mjs → chunk-SN2XKRYX.mjs} +30 -11
- package/dist/frontend.js +146 -69
- package/dist/frontend.js.map +4 -4
- package/dist/id-map-DxQ3_gyA.d.mts +7 -0
- package/dist/id-map-DxQ3_gyA.d.ts +7 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -11
- package/dist/index.mjs +10 -10
- package/package.json +7 -5
- package/dist/chunk-DNCHAOYH.js +0 -42
- package/dist/chunk-YN3FZMXY.js +0 -59
- package/dist/chunk-YYM7PBRN.mjs +0 -42
|
@@ -2,6 +2,18 @@ import {
|
|
|
2
2
|
IDMap
|
|
3
3
|
} from "../../chunk-RGHJEMWG.mjs";
|
|
4
4
|
import "../../chunk-Y6FXYEAI.mjs";
|
|
5
|
+
|
|
6
|
+
// src/backend/util/color.ts
|
|
7
|
+
var HUE_GRADIENT = [
|
|
8
|
+
{ color: "red", position: 0 },
|
|
9
|
+
{ color: "yellow", position: 60 / 360 },
|
|
10
|
+
{ color: "green", position: 120 / 360 },
|
|
11
|
+
{ color: "cyan", position: 180 / 360 },
|
|
12
|
+
{ color: "blue", position: 240 / 360 },
|
|
13
|
+
{ color: "magenta", position: 300 / 360 },
|
|
14
|
+
{ color: "red", position: 1 }
|
|
15
|
+
];
|
|
5
16
|
export {
|
|
17
|
+
HUE_GRADIENT,
|
|
6
18
|
IDMap
|
|
7
19
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class; var _class2;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
|
|
5
5
|
|
|
6
6
|
// src/backend/components/group.ts
|
|
7
7
|
var GROUP_DEFAULT_STYLE = {
|
|
@@ -12,7 +12,7 @@ var DEFAULT_PROPS = {
|
|
|
12
12
|
title: null,
|
|
13
13
|
labels: null
|
|
14
14
|
};
|
|
15
|
-
var GroupHeader = (_class = class extends
|
|
15
|
+
var GroupHeader = (_class = class extends _chunkCFO5PSSKjs.BaseParent {constructor(...args) { super(...args); _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
|
|
16
16
|
__init() {this.validateChildren = () => {
|
|
17
17
|
}}
|
|
18
18
|
/** @hidden */
|
|
@@ -22,9 +22,9 @@ var GroupHeader = (_class = class extends _chunkNZUYU32Zjs.BaseParent {construct
|
|
|
22
22
|
children: this.getChildren().map((c) => c.getProtoInfo(idMap))
|
|
23
23
|
})}
|
|
24
24
|
}, _class);
|
|
25
|
-
var Group = (_class2 = class extends
|
|
25
|
+
var Group = (_class2 = class extends _chunkCFO5PSSKjs.BaseParent {
|
|
26
26
|
/** @hidden */
|
|
27
|
-
__init3() {this.events = new (0,
|
|
27
|
+
__init3() {this.events = new (0, _chunkCFO5PSSKjs.EventEmitter)()}
|
|
28
28
|
constructor(props) {
|
|
29
29
|
super(DEFAULT_PROPS, props);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this);_class2.prototype.__init12.call(this);_class2.prototype.__init13.call(this);_class2.prototype.__init14.call(this);_class2.prototype.__init15.call(this);;
|
|
30
30
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
|
|
5
5
|
|
|
6
6
|
// src/backend/components/button.ts
|
|
7
7
|
var DEFAULT_PROPS = {
|
|
@@ -10,9 +10,9 @@ var DEFAULT_PROPS = {
|
|
|
10
10
|
mode: "normal",
|
|
11
11
|
error: null
|
|
12
12
|
};
|
|
13
|
-
var Button = (_class = class extends
|
|
13
|
+
var Button = (_class = class extends _chunkCFO5PSSKjs.Base {
|
|
14
14
|
/** @hidden */
|
|
15
|
-
__init() {this.events = new (0,
|
|
15
|
+
__init() {this.events = new (0, _chunkCFO5PSSKjs.EventEmitter)()}
|
|
16
16
|
constructor(props) {
|
|
17
17
|
super(DEFAULT_PROPS, props);_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);;
|
|
18
18
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
|
|
5
|
+
|
|
6
|
+
// src/backend/components/slider-button.ts
|
|
7
|
+
var DEFAULT_PROPS = {
|
|
8
|
+
min: 0,
|
|
9
|
+
max: 255,
|
|
10
|
+
step: 5
|
|
11
|
+
};
|
|
12
|
+
var SliderButton = (_class = class extends _chunkCFO5PSSKjs.Base {
|
|
13
|
+
/** @hidden */
|
|
14
|
+
__init() {this.events = new (0, _chunkCFO5PSSKjs.EventEmitter)()}
|
|
15
|
+
/**
|
|
16
|
+
* Manually manage the state of the slider,
|
|
17
|
+
* to support both controlled and uncontrolled inputs.
|
|
18
|
+
*/
|
|
19
|
+
__init2() {this._value = null}
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(DEFAULT_PROPS, props, {
|
|
22
|
+
onPropsUpdated: () => this.onPropsUpdated()
|
|
23
|
+
});_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);;
|
|
24
|
+
this.onPropsUpdated();
|
|
25
|
+
}
|
|
26
|
+
__init3() {this.addListener = this.events.addListener}
|
|
27
|
+
__init4() {this.removeListener = this.events.removeListener}
|
|
28
|
+
/** @hidden */
|
|
29
|
+
getProtoInfo(idMap) {
|
|
30
|
+
return {
|
|
31
|
+
component: "slider_button",
|
|
32
|
+
key: idMap.getId(this),
|
|
33
|
+
min: this.props.min,
|
|
34
|
+
max: this.props.max,
|
|
35
|
+
step: this.props.step,
|
|
36
|
+
value: this._value,
|
|
37
|
+
gradient: this.props.gradient,
|
|
38
|
+
grow: this.props.grow
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** @hidden */
|
|
42
|
+
handleMessage(message) {
|
|
43
|
+
if (message.component !== "slider_button") return;
|
|
44
|
+
const newValue = this.sanitizeNumber(message.value);
|
|
45
|
+
if (this._value === newValue) return;
|
|
46
|
+
if (this.props.value === void 0) {
|
|
47
|
+
this._value = newValue;
|
|
48
|
+
this.updateTree();
|
|
49
|
+
}
|
|
50
|
+
this.events.emit("change", newValue);
|
|
51
|
+
}
|
|
52
|
+
setValue(value) {
|
|
53
|
+
if (this.props.value) {
|
|
54
|
+
throw new Error("Cannot set value on controlled input");
|
|
55
|
+
}
|
|
56
|
+
const newValue = this.sanitizeNumber(value);
|
|
57
|
+
if (this._value === newValue) return;
|
|
58
|
+
this._value = newValue;
|
|
59
|
+
this.updateTree();
|
|
60
|
+
}
|
|
61
|
+
sanitizeNumber(value) {
|
|
62
|
+
const i = Math.round((value - this.props.min) / this.props.step);
|
|
63
|
+
const v = i * this.props.step + this.props.min;
|
|
64
|
+
const clampedValue = Math.max(this.props.min, Math.min(this.props.max, v));
|
|
65
|
+
return clampedValue;
|
|
66
|
+
}
|
|
67
|
+
__init5() {this.onPropsUpdated = () => {
|
|
68
|
+
if (this.props.value !== void 0) {
|
|
69
|
+
this._value = this.props.value;
|
|
70
|
+
} else if (this._value === null && this.props.defaultValue) {
|
|
71
|
+
this._value = this.props.defaultValue;
|
|
72
|
+
}
|
|
73
|
+
}}
|
|
74
|
+
}, _class);
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
exports.SliderButton = SliderButton;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class; var _class2;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
|
|
4
4
|
|
|
5
5
|
// src/backend/components/tabs.ts
|
|
6
|
-
var Tab = (_class = class extends
|
|
6
|
+
var Tab = (_class = class extends _chunkCFO5PSSKjs.BaseParent {constructor(...args) { super(...args); _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
|
|
7
7
|
__init() {this.validateChildren = (children) => {
|
|
8
8
|
if (children.length > 1) {
|
|
9
9
|
throw new Error("Tab can only have one child");
|
|
@@ -17,7 +17,7 @@ var Tab = (_class = class extends _chunkNZUYU32Zjs.BaseParent {constructor(...ar
|
|
|
17
17
|
child: this.getChildren().slice(0, 1).map((c) => c.getProtoInfo(idMap))[0]
|
|
18
18
|
})}
|
|
19
19
|
}, _class);
|
|
20
|
-
var Tabs = (_class2 = class extends
|
|
20
|
+
var Tabs = (_class2 = class extends _chunkCFO5PSSKjs.BaseParent {
|
|
21
21
|
__init3() {this.validateChildren = (children) => {
|
|
22
22
|
for (const child of children) {
|
|
23
23
|
if (!(child instanceof Tab)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;// src/backend/components/base.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;// src/backend/components/base.ts
|
|
2
2
|
var Base = (_class = class {
|
|
3
3
|
/** @hidden */
|
|
4
4
|
__init() {this.parent = null}
|
|
@@ -6,15 +6,18 @@ var Base = (_class = class {
|
|
|
6
6
|
|
|
7
7
|
/** @hidden */
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/** @hidden */
|
|
10
|
+
__init2() {this._onPropsUpdated = null}
|
|
11
|
+
constructor(defaultProps, props, options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);
|
|
10
12
|
this.defaultProps = defaultProps;
|
|
11
13
|
this._props = Object.freeze({
|
|
12
14
|
...defaultProps,
|
|
13
15
|
...props
|
|
14
16
|
});
|
|
17
|
+
this._onPropsUpdated = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _8 => _8.onPropsUpdated]), () => ( null));
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
return _optionalChain([this, 'access',
|
|
19
|
+
__init3() {this.log = () => {
|
|
20
|
+
return _optionalChain([this, 'access', _9 => _9.parent, 'optionalAccess', _10 => _10.log, 'call', _11 => _11()]) || null;
|
|
18
21
|
}}
|
|
19
22
|
get props() {
|
|
20
23
|
return this._props;
|
|
@@ -22,18 +25,20 @@ var Base = (_class = class {
|
|
|
22
25
|
set props(props) {
|
|
23
26
|
this.setProps(props);
|
|
24
27
|
}
|
|
25
|
-
|
|
28
|
+
__init4() {this.setProps = (props) => {
|
|
26
29
|
this._props = Object.freeze({
|
|
27
30
|
...this.defaultProps,
|
|
28
31
|
...props
|
|
29
32
|
});
|
|
33
|
+
_optionalChain([this, 'access', _12 => _12._onPropsUpdated, 'optionalCall', _13 => _13()]);
|
|
30
34
|
this.updateTree();
|
|
31
35
|
}}
|
|
32
|
-
|
|
36
|
+
__init5() {this.updateProps = (updates) => {
|
|
33
37
|
this._props = Object.freeze({
|
|
34
38
|
...this._props,
|
|
35
39
|
...updates
|
|
36
40
|
});
|
|
41
|
+
_optionalChain([this, 'access', _14 => _14._onPropsUpdated, 'optionalCall', _15 => _15()]);
|
|
37
42
|
this.updateTree();
|
|
38
43
|
}}
|
|
39
44
|
/** @hidden */
|
|
@@ -53,10 +58,10 @@ var Base = (_class = class {
|
|
|
53
58
|
routeMessage(_idMap, _message) {
|
|
54
59
|
}
|
|
55
60
|
}, _class);
|
|
56
|
-
var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(...args2); _class2.prototype.
|
|
61
|
+
var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(...args2); _class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this); }
|
|
57
62
|
/** @hidden */
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
__init6() {this.children = []}
|
|
64
|
+
__init7() {this.appendChildren = (...children) => {
|
|
60
65
|
for (const c of children) {
|
|
61
66
|
const newChildren = [...this.children.filter((ch) => ch !== c), c];
|
|
62
67
|
this.validateChildren(newChildren);
|
|
@@ -66,11 +71,11 @@ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(..
|
|
|
66
71
|
this.updateTree();
|
|
67
72
|
return children;
|
|
68
73
|
}}
|
|
69
|
-
|
|
74
|
+
__init8() {this.appendChild = (child) => {
|
|
70
75
|
this.appendChildren(child);
|
|
71
76
|
return child;
|
|
72
77
|
}}
|
|
73
|
-
|
|
78
|
+
__init9() {this.removeChild = (component) => {
|
|
74
79
|
const match = this.children.findIndex((c) => c === component);
|
|
75
80
|
if (match >= 0) {
|
|
76
81
|
const removingChild = this.children[match];
|
|
@@ -80,11 +85,11 @@ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(..
|
|
|
80
85
|
];
|
|
81
86
|
this.validateChildren(newChildren);
|
|
82
87
|
this.children = Object.freeze(newChildren);
|
|
83
|
-
_optionalChain([removingChild, 'optionalAccess',
|
|
88
|
+
_optionalChain([removingChild, 'optionalAccess', _18 => _18.setParent, 'call', _19 => _19(null)]);
|
|
84
89
|
this.updateTree();
|
|
85
90
|
}
|
|
86
91
|
}}
|
|
87
|
-
|
|
92
|
+
__init10() {this.removeAllChildren = () => {
|
|
88
93
|
this.children.map((c) => c.setParent(null));
|
|
89
94
|
this.children = Object.freeze([]);
|
|
90
95
|
this.updateTree();
|
|
@@ -92,7 +97,7 @@ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(..
|
|
|
92
97
|
/**
|
|
93
98
|
* Return all children components that messages need to be routed to
|
|
94
99
|
*/
|
|
95
|
-
|
|
100
|
+
__init11() {this.getChildren = () => this.children}
|
|
96
101
|
/**
|
|
97
102
|
* TODO: we can do this better, right now it broadcasts the message to all
|
|
98
103
|
* components of the tree
|
|
@@ -129,9 +134,9 @@ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(..
|
|
|
129
134
|
this.updateTree();
|
|
130
135
|
}
|
|
131
136
|
}, _class2);
|
|
132
|
-
var EventEmitter = (_class3 = class {constructor() { _class3.prototype.
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
var EventEmitter = (_class3 = class {constructor() { _class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this); }
|
|
138
|
+
__init12() {this.listeners = /* @__PURE__ */ new Map()}
|
|
139
|
+
__init13() {this.addListener = (type, listener) => {
|
|
135
140
|
let set = this.listeners.get(type);
|
|
136
141
|
if (!set) {
|
|
137
142
|
set = /* @__PURE__ */ new Set();
|
|
@@ -139,10 +144,10 @@ var EventEmitter = (_class3 = class {constructor() { _class3.prototype.__init11.
|
|
|
139
144
|
}
|
|
140
145
|
set.add(listener);
|
|
141
146
|
}}
|
|
142
|
-
|
|
143
|
-
_optionalChain([this, 'access',
|
|
147
|
+
__init14() {this.removeListener = (type, listener) => {
|
|
148
|
+
_optionalChain([this, 'access', _25 => _25.listeners, 'access', _26 => _26.get, 'call', _27 => _27(type), 'optionalAccess', _28 => _28.delete, 'call', _29 => _29(listener)]);
|
|
144
149
|
}}
|
|
145
|
-
|
|
150
|
+
__init15() {this.emit = (type, ...args) => {
|
|
146
151
|
return Promise.all(
|
|
147
152
|
[...this.listeners.get(type) || []].map(
|
|
148
153
|
(l) => new Promise((resolve, reject) => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
|
|
5
5
|
|
|
6
6
|
// src/backend/components/text-input.ts
|
|
7
7
|
var DEFAULT_PROPS = {
|
|
8
8
|
value: null
|
|
9
9
|
};
|
|
10
|
-
var TextInput = (_class = class extends
|
|
10
|
+
var TextInput = (_class = class extends _chunkCFO5PSSKjs.Base {
|
|
11
11
|
/** @hidden */
|
|
12
|
-
__init() {this.events = new (0,
|
|
12
|
+
__init() {this.events = new (0, _chunkCFO5PSSKjs.EventEmitter)()}
|
|
13
13
|
constructor(props) {
|
|
14
14
|
super(DEFAULT_PROPS, props);_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);;
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Base
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PW7QVLLF.mjs";
|
|
4
4
|
|
|
5
5
|
// src/backend/components/rect.ts
|
|
6
6
|
var DEFAULT_PROPS = {
|
|
@@ -15,7 +15,7 @@ var Rect = class extends Base {
|
|
|
15
15
|
return {
|
|
16
16
|
component: "rect",
|
|
17
17
|
key: idMap.getId(this),
|
|
18
|
-
|
|
18
|
+
...this.props
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
setColor(color) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
|
|
4
4
|
|
|
5
5
|
// src/backend/components/label.ts
|
|
6
|
-
var Label = class extends
|
|
6
|
+
var Label = class extends _chunkCFO5PSSKjs.Base {
|
|
7
7
|
constructor(props) {
|
|
8
8
|
super({ text: null }, props);
|
|
9
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
|
|
4
4
|
|
|
5
5
|
// src/backend/components/timeline.ts
|
|
6
6
|
var DEFAULT_PROPS = {
|
|
@@ -13,7 +13,7 @@ var DEFAULT_PROPS = {
|
|
|
13
13
|
subtitles: null,
|
|
14
14
|
source: null
|
|
15
15
|
};
|
|
16
|
-
var Timeline = (_class = class extends
|
|
16
|
+
var Timeline = (_class = class extends _chunkCFO5PSSKjs.Base {
|
|
17
17
|
constructor(props) {
|
|
18
18
|
super(DEFAULT_PROPS, props);_class.prototype.__init.call(this);;
|
|
19
19
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
|
|
4
4
|
|
|
5
5
|
// src/backend/components/rect.ts
|
|
6
6
|
var DEFAULT_PROPS = {
|
|
7
7
|
color: "rgba(0, 0, 0, 0)"
|
|
8
8
|
};
|
|
9
|
-
var Rect = class extends
|
|
9
|
+
var Rect = class extends _chunkCFO5PSSKjs.Base {
|
|
10
10
|
constructor(props) {
|
|
11
11
|
super(DEFAULT_PROPS, props);
|
|
12
12
|
}
|
|
@@ -15,7 +15,7 @@ var Rect = class extends _chunkNZUYU32Zjs.Base {
|
|
|
15
15
|
return {
|
|
16
16
|
component: "rect",
|
|
17
17
|
key: idMap.getId(this),
|
|
18
|
-
|
|
18
|
+
...this.props
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
setColor(color) {
|
|
@@ -6,12 +6,15 @@ var Base = class {
|
|
|
6
6
|
defaultProps;
|
|
7
7
|
/** @hidden */
|
|
8
8
|
_props;
|
|
9
|
-
|
|
9
|
+
/** @hidden */
|
|
10
|
+
_onPropsUpdated = null;
|
|
11
|
+
constructor(defaultProps, props, options) {
|
|
10
12
|
this.defaultProps = defaultProps;
|
|
11
13
|
this._props = Object.freeze({
|
|
12
14
|
...defaultProps,
|
|
13
15
|
...props
|
|
14
16
|
});
|
|
17
|
+
this._onPropsUpdated = options?.onPropsUpdated ?? null;
|
|
15
18
|
}
|
|
16
19
|
log = () => {
|
|
17
20
|
return this.parent?.log() || null;
|
|
@@ -27,6 +30,7 @@ var Base = class {
|
|
|
27
30
|
...this.defaultProps,
|
|
28
31
|
...props
|
|
29
32
|
});
|
|
33
|
+
this._onPropsUpdated?.();
|
|
30
34
|
this.updateTree();
|
|
31
35
|
};
|
|
32
36
|
updateProps = (updates) => {
|
|
@@ -34,6 +38,7 @@ var Base = class {
|
|
|
34
38
|
...this._props,
|
|
35
39
|
...updates
|
|
36
40
|
});
|
|
41
|
+
this._onPropsUpdated?.();
|
|
37
42
|
this.updateTree();
|
|
38
43
|
};
|
|
39
44
|
/** @hidden */
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Base,
|
|
3
|
+
EventEmitter
|
|
4
|
+
} from "./chunk-PW7QVLLF.mjs";
|
|
5
|
+
|
|
6
|
+
// src/backend/components/switch.ts
|
|
7
|
+
var DEFAULT_PROPS = {};
|
|
8
|
+
var Switch = class extends Base {
|
|
9
|
+
/** @hidden */
|
|
10
|
+
events = new EventEmitter();
|
|
11
|
+
/**
|
|
12
|
+
* Manually manage the state of the switch,
|
|
13
|
+
* to support both controlled and uncontrolled inputs.
|
|
14
|
+
*/
|
|
15
|
+
_value = null;
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(DEFAULT_PROPS, props, {
|
|
18
|
+
onPropsUpdated: () => this.onPropsUpdated()
|
|
19
|
+
});
|
|
20
|
+
this.onPropsUpdated();
|
|
21
|
+
}
|
|
22
|
+
addListener = this.events.addListener;
|
|
23
|
+
removeListener = this.events.removeListener;
|
|
24
|
+
/** @hidden */
|
|
25
|
+
getProtoInfo(idMap) {
|
|
26
|
+
return {
|
|
27
|
+
component: "switch",
|
|
28
|
+
key: idMap.getId(this),
|
|
29
|
+
state: this._value ?? "off"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** @hidden */
|
|
33
|
+
handleMessage(message) {
|
|
34
|
+
if (message.component === "switch") {
|
|
35
|
+
const state = this._value === "on" ? "off" : "on";
|
|
36
|
+
if (this.props.value === void 0) {
|
|
37
|
+
this._value = state;
|
|
38
|
+
this.updateTree();
|
|
39
|
+
}
|
|
40
|
+
this.events.emit("change", state);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
setValue(state) {
|
|
44
|
+
if (this.props.value) {
|
|
45
|
+
throw new Error("Cannot set value on controlled input");
|
|
46
|
+
}
|
|
47
|
+
this._value = state;
|
|
48
|
+
this.updateTree();
|
|
49
|
+
}
|
|
50
|
+
onPropsUpdated = () => {
|
|
51
|
+
if (this.props.value !== void 0) {
|
|
52
|
+
this._value = this.props.value;
|
|
53
|
+
} else if (this._value === null && this.props.defaultValue) {
|
|
54
|
+
this._value = this.props.defaultValue;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
Switch
|
|
61
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
|
|
5
|
+
|
|
6
|
+
// src/backend/components/switch.ts
|
|
7
|
+
var DEFAULT_PROPS = {};
|
|
8
|
+
var Switch = (_class = class extends _chunkCFO5PSSKjs.Base {
|
|
9
|
+
/** @hidden */
|
|
10
|
+
__init() {this.events = new (0, _chunkCFO5PSSKjs.EventEmitter)()}
|
|
11
|
+
/**
|
|
12
|
+
* Manually manage the state of the switch,
|
|
13
|
+
* to support both controlled and uncontrolled inputs.
|
|
14
|
+
*/
|
|
15
|
+
__init2() {this._value = null}
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(DEFAULT_PROPS, props, {
|
|
18
|
+
onPropsUpdated: () => this.onPropsUpdated()
|
|
19
|
+
});_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);;
|
|
20
|
+
this.onPropsUpdated();
|
|
21
|
+
}
|
|
22
|
+
__init3() {this.addListener = this.events.addListener}
|
|
23
|
+
__init4() {this.removeListener = this.events.removeListener}
|
|
24
|
+
/** @hidden */
|
|
25
|
+
getProtoInfo(idMap) {
|
|
26
|
+
return {
|
|
27
|
+
component: "switch",
|
|
28
|
+
key: idMap.getId(this),
|
|
29
|
+
state: _nullishCoalesce(this._value, () => ( "off"))
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** @hidden */
|
|
33
|
+
handleMessage(message) {
|
|
34
|
+
if (message.component === "switch") {
|
|
35
|
+
const state = this._value === "on" ? "off" : "on";
|
|
36
|
+
if (this.props.value === void 0) {
|
|
37
|
+
this._value = state;
|
|
38
|
+
this.updateTree();
|
|
39
|
+
}
|
|
40
|
+
this.events.emit("change", state);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
setValue(state) {
|
|
44
|
+
if (this.props.value) {
|
|
45
|
+
throw new Error("Cannot set value on controlled input");
|
|
46
|
+
}
|
|
47
|
+
this._value = state;
|
|
48
|
+
this.updateTree();
|
|
49
|
+
}
|
|
50
|
+
__init5() {this.onPropsUpdated = () => {
|
|
51
|
+
if (this.props.value !== void 0) {
|
|
52
|
+
this._value = this.props.value;
|
|
53
|
+
} else if (this._value === null && this.props.defaultValue) {
|
|
54
|
+
this._value = this.props.defaultValue;
|
|
55
|
+
}
|
|
56
|
+
}}
|
|
57
|
+
}, _class);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
exports.Switch = Switch;
|