@arcanejs/toolkit 3.1.0 → 4.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.
- package/README.md +1 -1
- package/dist/backend/components/base.d.mts +1 -1
- package/dist/backend/components/base.d.ts +1 -1
- 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 +1 -1
- package/dist/backend/components/rect.d.ts +1 -1
- package/dist/backend/components/rect.js +3 -3
- package/dist/backend/components/rect.mjs +2 -2
- package/dist/backend/components/slider-button.d.mts +1 -1
- package/dist/backend/components/slider-button.d.ts +1 -1
- 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 +1 -1
- package/dist/backend/components/switch.d.ts +1 -1
- 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/{chunk-VEZGD2PG.js → chunk-3VAHVFJ3.js} +3 -3
- package/dist/{chunk-4OZ22IQU.js → chunk-4EOCJT6W.js} +3 -3
- package/dist/{chunk-W42AOMM6.mjs → chunk-6BVEU2NV.mjs} +5 -14
- package/dist/{chunk-CME7HZZK.js → chunk-6KPK5YOL.js} +3 -3
- package/dist/{chunk-NEQRLPXK.mjs → chunk-GIXAFIEY.mjs} +1 -1
- package/dist/{chunk-SGACFY53.js → chunk-HTM2L3DT.js} +19 -0
- package/dist/{chunk-RYR5I5FT.mjs → chunk-JKTEVA75.mjs} +19 -0
- package/dist/{chunk-7OX2FB6C.js → chunk-JSZMJCCH.js} +2 -2
- package/dist/{chunk-GMDJYFHD.js → chunk-LGIWNJQA.js} +3 -3
- package/dist/{chunk-7TTY7CBH.mjs → chunk-MMK3PCSS.mjs} +1 -1
- package/dist/{chunk-5D7OSUZ6.mjs → chunk-PIVARHCZ.mjs} +1 -1
- package/dist/{chunk-JFZXSCGK.mjs → chunk-PYJC5BFZ.mjs} +1 -1
- package/dist/{chunk-O5ZW6JYG.js → chunk-QT43ONN5.js} +4 -4
- package/dist/{chunk-YBBUC3QC.mjs → chunk-VJ3Q2HZJ.mjs} +1 -1
- package/dist/{chunk-6CWEURJP.js → chunk-VXNNW2KH.js} +2 -2
- package/dist/{chunk-N6IHYBZH.mjs → chunk-XMP5XJWR.mjs} +1 -1
- package/dist/{chunk-CUZSHFDP.mjs → chunk-XYFDH3E7.mjs} +1 -1
- package/dist/{chunk-K37TZB75.mjs → chunk-YN7LHBRI.mjs} +1 -1
- package/dist/{chunk-DRQVYGTI.js → chunk-Z3HEU534.js} +2 -2
- package/dist/{chunk-DG75CS7F.js → chunk-ZWYJEKZP.js} +7 -16
- package/dist/frontend/entrypoint.js +84 -31
- package/dist/frontend/entrypoint.js.map +3 -3
- package/dist/frontend/index.js +62 -19
- package/dist/frontend/index.mjs +62 -19
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +47 -14
- package/dist/index.mjs +43 -10
- package/dist/{toolkit-2w2SWHlT.d.ts → toolkit-BjYBFkG8.d.ts} +17 -6
- package/dist/{toolkit-DB8G2TaA.d.mts → toolkit-k-CCIw3V.d.mts} +17 -6
- package/package.json +5 -5
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHTM2L3DTjs = require('./chunk-HTM2L3DT.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 _chunkHTM2L3DTjs.Base {
|
|
10
10
|
constructor(props) {
|
|
11
11
|
super(DEFAULT_PROPS, props);
|
|
12
12
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class; var _class2;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHTM2L3DTjs = require('./chunk-HTM2L3DT.js');
|
|
4
4
|
|
|
5
5
|
// src/backend/components/tabs.ts
|
|
6
|
-
var Tab = (_class = class extends
|
|
6
|
+
var Tab = (_class = class extends _chunkHTM2L3DTjs.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");
|
|
@@ -18,7 +18,7 @@ var Tab = (_class = class extends _chunkSGACFY53js.BaseParent {constructor(...ar
|
|
|
18
18
|
child: this.getChildren().slice(0, 1).map((c) => c.getProtoInfo(idMap))[0]
|
|
19
19
|
})}
|
|
20
20
|
}, _class);
|
|
21
|
-
var Tabs = (_class2 = class extends
|
|
21
|
+
var Tabs = (_class2 = class extends _chunkHTM2L3DTjs.BaseParent {
|
|
22
22
|
__init3() {this.validateChildren = (children) => {
|
|
23
23
|
for (const child of children) {
|
|
24
24
|
if (!(child instanceof Tab)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class; var _class2;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkHTM2L3DTjs = require('./chunk-HTM2L3DT.js');
|
|
5
5
|
|
|
6
6
|
// src/backend/components/group.ts
|
|
7
7
|
var _core = require('@arcanejs/protocol/core'); var proto = _interopRequireWildcard(_core);
|
|
@@ -13,7 +13,7 @@ var DEFAULT_PROPS = {
|
|
|
13
13
|
title: null,
|
|
14
14
|
labels: null
|
|
15
15
|
};
|
|
16
|
-
var GroupHeader = (_class = class extends
|
|
16
|
+
var GroupHeader = (_class = class extends _chunkHTM2L3DTjs.BaseParent {constructor(...args) { super(...args); _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
|
|
17
17
|
__init() {this.validateChildren = () => {
|
|
18
18
|
}}
|
|
19
19
|
/** @hidden */
|
|
@@ -24,9 +24,9 @@ var GroupHeader = (_class = class extends _chunkSGACFY53js.BaseParent {construct
|
|
|
24
24
|
children: this.getChildren().map((c) => c.getProtoInfo(idMap))
|
|
25
25
|
})}
|
|
26
26
|
}, _class);
|
|
27
|
-
var Group = (_class2 = class extends
|
|
27
|
+
var Group = (_class2 = class extends _chunkHTM2L3DTjs.BaseParent {
|
|
28
28
|
/** @hidden */
|
|
29
|
-
__init3() {this.events = new (0,
|
|
29
|
+
__init3() {this.events = new (0, _chunkHTM2L3DTjs.EventEmitter)()}
|
|
30
30
|
constructor(props) {
|
|
31
31
|
super(DEFAULT_PROPS, props, {
|
|
32
32
|
onPropsUpdated: (oldProps) => this.events.processPropChanges(
|
|
@@ -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 _chunkHTM2L3DTjs = require('./chunk-HTM2L3DT.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 _chunkHTM2L3DTjs.Base {
|
|
17
17
|
constructor(props) {
|
|
18
18
|
super(DEFAULT_PROPS, props);_class.prototype.__init.call(this);;
|
|
19
19
|
}
|
|
@@ -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 _chunkHTM2L3DTjs = require('./chunk-HTM2L3DT.js');
|
|
4
4
|
|
|
5
5
|
// src/backend/components/label.ts
|
|
6
|
-
var Label = class extends
|
|
6
|
+
var Label = class extends _chunkHTM2L3DTjs.Base {
|
|
7
7
|
constructor(props) {
|
|
8
8
|
super({ text: null }, props);
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkHTM2L3DTjs = require('./chunk-HTM2L3DT.js');
|
|
5
5
|
|
|
6
6
|
// src/backend/components/button.ts
|
|
7
7
|
var _core = require('@arcanejs/protocol/core'); var proto = _interopRequireWildcard(_core);
|
|
@@ -12,9 +12,9 @@ var DEFAULT_PROPS = {
|
|
|
12
12
|
error: null,
|
|
13
13
|
onClick: null
|
|
14
14
|
};
|
|
15
|
-
var Button = (_class = class extends
|
|
15
|
+
var Button = (_class = class extends _chunkHTM2L3DTjs.Base {
|
|
16
16
|
/** @hidden */
|
|
17
|
-
__init() {this.events = new (0,
|
|
17
|
+
__init() {this.events = new (0, _chunkHTM2L3DTjs.EventEmitter)()}
|
|
18
18
|
constructor(props) {
|
|
19
19
|
super(DEFAULT_PROPS, props, {
|
|
20
20
|
onPropsUpdated: (oldProps) => this.events.processPropChanges(
|
|
@@ -56,20 +56,11 @@ var Button = (_class = class extends _chunkSGACFY53js.Base {
|
|
|
56
56
|
};
|
|
57
57
|
}}
|
|
58
58
|
/** @hidden */
|
|
59
|
-
__init8() {this.
|
|
60
|
-
if (proto.
|
|
61
|
-
this.events.emit("click", connection).then(() =>
|
|
62
|
-
if (this.props.error) {
|
|
63
|
-
this.updateProps({
|
|
64
|
-
error: null
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}).catch((e) => {
|
|
68
|
-
this.updateProps({
|
|
69
|
-
error: `${e}`
|
|
70
|
-
});
|
|
71
|
-
});
|
|
59
|
+
__init8() {this.handleCall = (call, connection) => {
|
|
60
|
+
if (proto.isCoreComponentCall(call, "press")) {
|
|
61
|
+
return this.events.emit("click", connection).then(() => true);
|
|
72
62
|
}
|
|
63
|
+
throw new Error(`Unhandled call action: ${call.action}`);
|
|
73
64
|
}}
|
|
74
65
|
}, _class);
|
|
75
66
|
|
|
@@ -26202,6 +26202,7 @@ body {
|
|
|
26202
26202
|
})
|
|
26203
26203
|
);
|
|
26204
26204
|
var TOUCH_INDICATOR_CLASS = "touch-indicator";
|
|
26205
|
+
var LOADING_CLASS = "loading";
|
|
26205
26206
|
var TOUCHING_CLASS = "touching";
|
|
26206
26207
|
var ERROR_CLASS = "error";
|
|
26207
26208
|
var ButtonContents = dt.div`
|
|
@@ -26218,22 +26219,31 @@ body {
|
|
|
26218
26219
|
padding: 0 4px;
|
|
26219
26220
|
`;
|
|
26220
26221
|
var Button = (props) => {
|
|
26221
|
-
const {
|
|
26222
|
-
const
|
|
26223
|
-
|
|
26224
|
-
|
|
26225
|
-
|
|
26226
|
-
|
|
26227
|
-
|
|
26228
|
-
|
|
26229
|
-
|
|
26230
|
-
|
|
26222
|
+
const { call } = import_react4.default.useContext(StageContext);
|
|
26223
|
+
const [localState, setLocalState] = import_react4.default.useState(null);
|
|
26224
|
+
const state = localState ?? props.info.state;
|
|
26225
|
+
const { touching, handlers } = usePressable(async () => {
|
|
26226
|
+
try {
|
|
26227
|
+
if (!call) return;
|
|
26228
|
+
setLocalState({ state: "loading" });
|
|
26229
|
+
await call?.({
|
|
26230
|
+
type: "component-call",
|
|
26231
|
+
namespace: "core",
|
|
26232
|
+
componentKey: props.info.key,
|
|
26233
|
+
action: "press"
|
|
26234
|
+
});
|
|
26235
|
+
setLocalState(null);
|
|
26236
|
+
} catch (e) {
|
|
26237
|
+
setLocalState({ state: "error", error: `${e}` });
|
|
26238
|
+
}
|
|
26239
|
+
});
|
|
26231
26240
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
26232
26241
|
"div",
|
|
26233
26242
|
{
|
|
26234
26243
|
className: calculateClass(
|
|
26235
26244
|
props.className,
|
|
26236
|
-
touching || state.state === "pressed"
|
|
26245
|
+
(touching || state.state === "pressed") && TOUCHING_CLASS,
|
|
26246
|
+
state.state === "loading" && LOADING_CLASS,
|
|
26237
26247
|
state.state === "error" && ERROR_CLASS
|
|
26238
26248
|
),
|
|
26239
26249
|
...handlers,
|
|
@@ -26264,7 +26274,7 @@ body {
|
|
|
26264
26274
|
border-color: ${(p2) => p2.theme.colorRed};
|
|
26265
26275
|
}
|
|
26266
26276
|
|
|
26267
|
-
&.${TOUCHING_CLASS} {
|
|
26277
|
+
&.${TOUCHING_CLASS}, &.${LOADING_CLASS} {
|
|
26268
26278
|
${buttonStateNormalActive}
|
|
26269
26279
|
|
|
26270
26280
|
.${TOUCH_INDICATOR_CLASS} {
|
|
@@ -27469,6 +27479,10 @@ body {
|
|
|
27469
27479
|
);
|
|
27470
27480
|
const socket = (0, import_react15.useRef)(null);
|
|
27471
27481
|
const uuid = (0, import_react15.useRef)(null);
|
|
27482
|
+
const calls = (0, import_react15.useRef)({
|
|
27483
|
+
nextId: 1,
|
|
27484
|
+
calls: /* @__PURE__ */ new Map()
|
|
27485
|
+
});
|
|
27472
27486
|
const preparedRenderers = (0, import_react15.useMemo)(() => {
|
|
27473
27487
|
const prepared = {};
|
|
27474
27488
|
for (const renderer of renderers) {
|
|
@@ -27486,10 +27500,36 @@ body {
|
|
|
27486
27500
|
},
|
|
27487
27501
|
[preparedRenderers]
|
|
27488
27502
|
);
|
|
27489
|
-
(0, import_react15.
|
|
27490
|
-
|
|
27503
|
+
const handleMessage = (0, import_react15.useCallback)((msg) => {
|
|
27504
|
+
switch (msg.type) {
|
|
27505
|
+
case "metadata":
|
|
27506
|
+
uuid.current = msg.connectionUuid;
|
|
27507
|
+
return;
|
|
27508
|
+
case "tree-full":
|
|
27509
|
+
setRoot(msg.root);
|
|
27510
|
+
return;
|
|
27511
|
+
case "tree-diff":
|
|
27512
|
+
setRoot((prevRoot) => patchJson(prevRoot, msg.diff));
|
|
27513
|
+
return;
|
|
27514
|
+
case "call-response": {
|
|
27515
|
+
const call2 = calls.current.calls.get(msg.requestId);
|
|
27516
|
+
if (call2) {
|
|
27517
|
+
calls.current.calls.delete(msg.requestId);
|
|
27518
|
+
if (msg.success) {
|
|
27519
|
+
call2.resolve(msg.returnValue);
|
|
27520
|
+
} else {
|
|
27521
|
+
call2.reject(msg.errorMessage);
|
|
27522
|
+
}
|
|
27523
|
+
} else {
|
|
27524
|
+
console.warn(
|
|
27525
|
+
`Received response for unknown call request ID ${msg.requestId}`
|
|
27526
|
+
);
|
|
27527
|
+
}
|
|
27528
|
+
return;
|
|
27529
|
+
}
|
|
27530
|
+
}
|
|
27491
27531
|
}, []);
|
|
27492
|
-
const initializeWebsocket = async () => {
|
|
27532
|
+
const initializeWebsocket = (0, import_react15.useCallback)(async () => {
|
|
27493
27533
|
console.log("initializing websocket");
|
|
27494
27534
|
const wsUrl = new URL(window.location.href);
|
|
27495
27535
|
wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
@@ -27513,29 +27553,42 @@ body {
|
|
|
27513
27553
|
};
|
|
27514
27554
|
});
|
|
27515
27555
|
return ws;
|
|
27516
|
-
};
|
|
27517
|
-
const sendMessage = async (msg) => {
|
|
27556
|
+
}, []);
|
|
27557
|
+
const sendMessage = (0, import_react15.useCallback)(async (msg) => {
|
|
27518
27558
|
(await (socket.current || initializeWebsocket())).send(JSON.stringify(msg));
|
|
27519
|
-
};
|
|
27520
|
-
const
|
|
27521
|
-
|
|
27522
|
-
|
|
27523
|
-
|
|
27524
|
-
|
|
27525
|
-
|
|
27526
|
-
|
|
27527
|
-
|
|
27528
|
-
|
|
27529
|
-
|
|
27530
|
-
|
|
27531
|
-
|
|
27532
|
-
|
|
27559
|
+
}, []);
|
|
27560
|
+
const call = (0, import_react15.useCallback)(
|
|
27561
|
+
async (msg) => {
|
|
27562
|
+
const requestId = calls.current.nextId++;
|
|
27563
|
+
const sendMsg = {
|
|
27564
|
+
...msg,
|
|
27565
|
+
requestId
|
|
27566
|
+
};
|
|
27567
|
+
const promise = new Promise(
|
|
27568
|
+
(resolve, reject) => {
|
|
27569
|
+
calls.current.calls.set(requestId, {
|
|
27570
|
+
resolve,
|
|
27571
|
+
reject
|
|
27572
|
+
});
|
|
27573
|
+
(socket.current || initializeWebsocket()).then(
|
|
27574
|
+
(s2) => s2.send(JSON.stringify(sendMsg))
|
|
27575
|
+
);
|
|
27576
|
+
}
|
|
27577
|
+
);
|
|
27578
|
+
return promise;
|
|
27579
|
+
},
|
|
27580
|
+
[]
|
|
27581
|
+
);
|
|
27582
|
+
(0, import_react15.useEffect)(() => {
|
|
27583
|
+
initializeWebsocket();
|
|
27584
|
+
}, [initializeWebsocket]);
|
|
27533
27585
|
return /* @__PURE__ */ import_react15.default.createElement(
|
|
27534
27586
|
StageContext.Provider,
|
|
27535
27587
|
{
|
|
27536
27588
|
value: {
|
|
27537
27589
|
sendMessage,
|
|
27538
27590
|
renderComponent,
|
|
27591
|
+
call,
|
|
27539
27592
|
get connectionUuid() {
|
|
27540
27593
|
if (!uuid.current) {
|
|
27541
27594
|
throw new Error("Unexpected missing UUID");
|