@arcanejs/toolkit 0.0.2 → 0.1.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 +2 -0
- package/dist/backend/components/base.d.ts +2 -0
- package/dist/backend/components/base.js +189 -0
- package/dist/backend/components/base.mjs +10 -0
- package/dist/backend/components/button.d.mts +30 -0
- package/dist/backend/components/button.d.ts +30 -0
- package/dist/backend/components/button.js +168 -0
- package/dist/backend/components/button.mjs +7 -0
- package/dist/backend/components/group.d.mts +51 -0
- package/dist/backend/components/group.d.ts +51 -0
- package/dist/backend/components/group.js +287 -0
- package/dist/backend/components/group.mjs +9 -0
- package/dist/backend/components/label.d.mts +21 -0
- package/dist/backend/components/label.d.ts +21 -0
- package/dist/backend/components/label.js +105 -0
- package/dist/backend/components/label.mjs +7 -0
- package/dist/backend/components/rect.d.mts +20 -0
- package/dist/backend/components/rect.d.ts +20 -0
- package/dist/backend/components/rect.js +105 -0
- package/dist/backend/components/rect.mjs +7 -0
- package/dist/backend/components/slider-button.d.mts +31 -0
- package/dist/backend/components/slider-button.d.ts +31 -0
- package/dist/backend/components/slider-button.js +161 -0
- package/dist/backend/components/slider-button.mjs +7 -0
- package/dist/backend/components/switch.d.mts +24 -0
- package/dist/backend/components/switch.d.ts +24 -0
- package/dist/backend/components/switch.js +144 -0
- package/dist/backend/components/switch.mjs +7 -0
- package/dist/backend/components/tabs.d.mts +28 -0
- package/dist/backend/components/tabs.d.ts +28 -0
- package/dist/backend/components/tabs.js +209 -0
- package/dist/backend/components/tabs.mjs +9 -0
- package/dist/backend/components/text-input.d.mts +26 -0
- package/dist/backend/components/text-input.d.ts +26 -0
- package/dist/backend/components/text-input.js +146 -0
- package/dist/backend/components/text-input.mjs +7 -0
- package/dist/backend/components/timeline.d.mts +17 -0
- package/dist/backend/components/timeline.d.ts +17 -0
- package/dist/backend/components/timeline.js +109 -0
- package/dist/backend/components/timeline.mjs +7 -0
- package/dist/base-BJAPu0O1.d.mts +234 -0
- package/dist/base-BJAPu0O1.d.ts +234 -0
- package/dist/chunk-37VNFO5S.mjs +42 -0
- package/dist/chunk-3ZBM7Q4A.mjs +55 -0
- package/dist/chunk-6LL3X7ZZ.mjs +44 -0
- package/dist/chunk-DBW4OPGN.mjs +33 -0
- package/dist/chunk-DP3QFYSS.mjs +66 -0
- package/dist/chunk-GQZA5K4M.mjs +29 -0
- package/dist/chunk-HF77PS7J.mjs +171 -0
- package/dist/chunk-HVFTRNLQ.mjs +59 -0
- package/dist/chunk-P6X5GIDT.mjs +29 -0
- package/dist/chunk-S5DQIYC2.mjs +107 -0
- package/dist/frontend.js +26321 -0
- package/dist/frontend.js.map +7 -0
- package/dist/index.d.mts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +852 -1
- package/dist/index.mjs +288 -2
- package/package.json +86 -6
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Base,
|
|
3
|
+
EventEmitter
|
|
4
|
+
} from "./chunk-HF77PS7J.mjs";
|
|
5
|
+
|
|
6
|
+
// src/backend/components/slider-button.ts
|
|
7
|
+
var DEFAULT_PROPS = {
|
|
8
|
+
value: null,
|
|
9
|
+
min: 0,
|
|
10
|
+
max: 255,
|
|
11
|
+
step: 5,
|
|
12
|
+
mode: "writeBack"
|
|
13
|
+
};
|
|
14
|
+
var SliderButton = class extends Base {
|
|
15
|
+
/** @hidden */
|
|
16
|
+
events = new EventEmitter();
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(DEFAULT_PROPS, props);
|
|
19
|
+
}
|
|
20
|
+
addListener = this.events.addListener;
|
|
21
|
+
removeListener = this.events.removeListener;
|
|
22
|
+
/** @hidden */
|
|
23
|
+
getProtoInfo(idMap) {
|
|
24
|
+
return {
|
|
25
|
+
component: "slider_button",
|
|
26
|
+
key: idMap.getId(this),
|
|
27
|
+
min: this.props.min,
|
|
28
|
+
max: this.props.max,
|
|
29
|
+
step: this.props.step,
|
|
30
|
+
value: this.props.value
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** @hidden */
|
|
34
|
+
handleMessage(message) {
|
|
35
|
+
if (message.component !== "slider_button") return;
|
|
36
|
+
const newValue = this.sanitizeNumber(message.value);
|
|
37
|
+
if (this.props.value === newValue) return;
|
|
38
|
+
if (this.props.mode === "writeBack") {
|
|
39
|
+
this.updateProps({ value: newValue });
|
|
40
|
+
}
|
|
41
|
+
this.events.emit("change", newValue);
|
|
42
|
+
}
|
|
43
|
+
setValue(value) {
|
|
44
|
+
const newValue = this.sanitizeNumber(value);
|
|
45
|
+
if (newValue === this.props.value) return;
|
|
46
|
+
this.updateProps({ value });
|
|
47
|
+
this.updateTree();
|
|
48
|
+
}
|
|
49
|
+
sanitizeNumber(value) {
|
|
50
|
+
const i = Math.round((value - this.props.min) / this.props.step);
|
|
51
|
+
const v = i * this.props.step + this.props.min;
|
|
52
|
+
const clampedValue = Math.max(this.props.min, Math.min(this.props.max, v));
|
|
53
|
+
return clampedValue;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
SliderButton
|
|
59
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Base
|
|
3
|
+
} from "./chunk-HF77PS7J.mjs";
|
|
4
|
+
|
|
5
|
+
// src/backend/components/label.ts
|
|
6
|
+
var Label = class extends Base {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super({ text: null }, props);
|
|
9
|
+
}
|
|
10
|
+
/** @hidden */
|
|
11
|
+
getProtoInfo(idMap) {
|
|
12
|
+
return {
|
|
13
|
+
component: "label",
|
|
14
|
+
key: idMap.getId(this),
|
|
15
|
+
bold: this.props.bold,
|
|
16
|
+
text: this.props.text ?? ""
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
setText(text) {
|
|
20
|
+
this.updateProps({
|
|
21
|
+
text
|
|
22
|
+
});
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
Label
|
|
29
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseParent,
|
|
3
|
+
EventEmitter
|
|
4
|
+
} from "./chunk-HF77PS7J.mjs";
|
|
5
|
+
|
|
6
|
+
// src/shared/styles.ts
|
|
7
|
+
var GROUP_DEFAULT_STYLE = {
|
|
8
|
+
direction: "horizontal"
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// src/backend/components/group.ts
|
|
12
|
+
var DEFAULT_PROPS = {
|
|
13
|
+
...GROUP_DEFAULT_STYLE,
|
|
14
|
+
title: null,
|
|
15
|
+
labels: null,
|
|
16
|
+
headerComponents: null
|
|
17
|
+
};
|
|
18
|
+
var GroupHeader = class extends BaseParent {
|
|
19
|
+
validateChildren = () => {
|
|
20
|
+
};
|
|
21
|
+
/** @hidden */
|
|
22
|
+
getProtoInfo = (idMap) => ({
|
|
23
|
+
component: "group-header",
|
|
24
|
+
key: idMap.getId(this),
|
|
25
|
+
children: this.getChildren().map((c) => c.getProtoInfo(idMap))
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var Group = class extends BaseParent {
|
|
29
|
+
/** @hidden */
|
|
30
|
+
events = new EventEmitter();
|
|
31
|
+
constructor(props) {
|
|
32
|
+
super(DEFAULT_PROPS, props);
|
|
33
|
+
}
|
|
34
|
+
addListener = this.events.addListener;
|
|
35
|
+
removeListener = this.events.removeListener;
|
|
36
|
+
validateChildren = () => {
|
|
37
|
+
};
|
|
38
|
+
setOptions = (options) => {
|
|
39
|
+
this.updateProps(options);
|
|
40
|
+
};
|
|
41
|
+
setTitle = (title) => {
|
|
42
|
+
this.updateProps({ title });
|
|
43
|
+
};
|
|
44
|
+
addLabel = (label) => {
|
|
45
|
+
this.updateProps({ labels: [...this.props.labels || [], label] });
|
|
46
|
+
};
|
|
47
|
+
setLabels = (labels) => {
|
|
48
|
+
this.updateProps({ labels });
|
|
49
|
+
};
|
|
50
|
+
addHeaderChild = (child) => {
|
|
51
|
+
const header = new GroupHeader({});
|
|
52
|
+
header.appendChild(child);
|
|
53
|
+
this.appendChild(header);
|
|
54
|
+
return child;
|
|
55
|
+
};
|
|
56
|
+
removeHeaderChild = (child) => {
|
|
57
|
+
for (const c of this.getChildren()) {
|
|
58
|
+
if (c instanceof GroupHeader) {
|
|
59
|
+
c.removeChild(child);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
removeAllHeaderChildren = () => {
|
|
64
|
+
for (const child of this.getChildren()) {
|
|
65
|
+
if (child instanceof GroupHeader) {
|
|
66
|
+
child.removeAllChildren();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/** @hidden */
|
|
71
|
+
getProtoInfo = (idMap) => {
|
|
72
|
+
const children = [];
|
|
73
|
+
const headers = [];
|
|
74
|
+
for (const c of this.getChildren()) {
|
|
75
|
+
const childProto = c.getProtoInfo(idMap);
|
|
76
|
+
if (childProto.component === "group-header") {
|
|
77
|
+
headers.push(childProto);
|
|
78
|
+
} else {
|
|
79
|
+
children.push(childProto);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
component: "group",
|
|
84
|
+
key: idMap.getId(this),
|
|
85
|
+
title: this.props.title ?? void 0,
|
|
86
|
+
direction: this.props.direction,
|
|
87
|
+
border: this.props.border,
|
|
88
|
+
wrap: this.props.wrap,
|
|
89
|
+
children,
|
|
90
|
+
headers: headers.length > 0 ? headers : void 0,
|
|
91
|
+
labels: this.props.labels ?? void 0,
|
|
92
|
+
editableTitle: this.props.editableTitle || false,
|
|
93
|
+
defaultCollapsibleState: this.props.defaultCollapsibleState
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/** @hidden */
|
|
97
|
+
handleMessage = (message) => {
|
|
98
|
+
if (message.component === "group") {
|
|
99
|
+
this.events.emit("title-changed", message.title);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export {
|
|
105
|
+
GroupHeader,
|
|
106
|
+
Group
|
|
107
|
+
};
|