@arcanejs/toolkit 5.0.1 → 6.0.1

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 (31) hide show
  1. package/dist/backend/components/base.d.mts +1 -1
  2. package/dist/backend/components/base.d.ts +1 -1
  3. package/dist/backend/components/button.d.mts +1 -1
  4. package/dist/backend/components/button.d.ts +1 -1
  5. package/dist/backend/components/group.d.mts +1 -1
  6. package/dist/backend/components/group.d.ts +1 -1
  7. package/dist/backend/components/label.d.mts +1 -1
  8. package/dist/backend/components/label.d.ts +1 -1
  9. package/dist/backend/components/rect.d.mts +1 -1
  10. package/dist/backend/components/rect.d.ts +1 -1
  11. package/dist/backend/components/slider-button.d.mts +1 -1
  12. package/dist/backend/components/slider-button.d.ts +1 -1
  13. package/dist/backend/components/switch.d.mts +1 -1
  14. package/dist/backend/components/switch.d.ts +1 -1
  15. package/dist/backend/components/tabs.d.mts +1 -1
  16. package/dist/backend/components/tabs.d.ts +1 -1
  17. package/dist/backend/components/text-input.d.mts +1 -1
  18. package/dist/backend/components/text-input.d.ts +1 -1
  19. package/dist/backend/components/timeline.d.mts +1 -1
  20. package/dist/backend/components/timeline.d.ts +1 -1
  21. package/dist/frontend/entrypoint.js +30 -22
  22. package/dist/frontend/entrypoint.js.map +2 -2
  23. package/dist/frontend/index.js +33 -22
  24. package/dist/frontend/index.mjs +34 -23
  25. package/dist/index.d.mts +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +55 -24
  28. package/dist/index.mjs +46 -15
  29. package/dist/{toolkit-C37sQAkD.d.ts → toolkit-C_2Y8N9R.d.ts} +10 -1
  30. package/dist/{toolkit-CQMnQMOF.d.mts → toolkit-CohVRj6u.d.mts} +10 -1
  31. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  import '@arcanejs/protocol';
2
2
  import '../../id-map-DxQ3_gyA.mjs';
3
3
  import '@arcanejs/protocol/logging';
4
- export { A as AnyComponent, d as Base, e as BaseParent, E as EventEmitter, L as Listenable, P as Parent } from '../../toolkit-CQMnQMOF.mjs';
4
+ export { A as AnyComponent, f as Base, g as BaseParent, E as EventEmitter, L as Listenable, P as Parent } from '../../toolkit-CohVRj6u.mjs';
5
5
  import 'lodash';
6
6
  import 'http';
7
7
  import 'express';
@@ -1,7 +1,7 @@
1
1
  import '@arcanejs/protocol';
2
2
  import '../../id-map-DxQ3_gyA.js';
3
3
  import '@arcanejs/protocol/logging';
4
- export { A as AnyComponent, d as Base, e as BaseParent, E as EventEmitter, L as Listenable, P as Parent } from '../../toolkit-C37sQAkD.js';
4
+ export { A as AnyComponent, f as Base, g as BaseParent, E as EventEmitter, L as Listenable, P as Parent } from '../../toolkit-C_2Y8N9R.js';
5
5
  import 'lodash';
6
6
  import 'http';
7
7
  import 'express';
@@ -1,6 +1,6 @@
1
1
  import '@arcanejs/protocol/core';
2
2
  import '../../id-map-DxQ3_gyA.mjs';
3
- export { B as Button, g as ButtonMode, f as Events, I as InternalProps, h as Props } from '../../toolkit-CQMnQMOF.mjs';
3
+ export { B as Button, i as ButtonMode, h as Events, I as InternalProps, j as Props } from '../../toolkit-CohVRj6u.mjs';
4
4
  import '@arcanejs/protocol';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
@@ -1,6 +1,6 @@
1
1
  import '@arcanejs/protocol/core';
2
2
  import '../../id-map-DxQ3_gyA.js';
3
- export { B as Button, g as ButtonMode, f as Events, I as InternalProps, h as Props } from '../../toolkit-C37sQAkD.js';
3
+ export { B as Button, i as ButtonMode, h as Events, I as InternalProps, j as Props } from '../../toolkit-C_2Y8N9R.js';
4
4
  import '@arcanejs/protocol';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
@@ -1,7 +1,7 @@
1
1
  import '@arcanejs/protocol/core';
2
2
  import '@arcanejs/protocol/styles';
3
3
  import '../../id-map-DxQ3_gyA.mjs';
4
- export { i as Events, G as Group, c as GroupHeader, j as InternalProps, k as Props } from '../../toolkit-CQMnQMOF.mjs';
4
+ export { k as Events, G as Group, e as GroupHeader, l as InternalProps, m as Props } from '../../toolkit-CohVRj6u.mjs';
5
5
  import '@arcanejs/protocol';
6
6
  import '@arcanejs/protocol/logging';
7
7
  import 'lodash';
@@ -1,7 +1,7 @@
1
1
  import '@arcanejs/protocol/core';
2
2
  import '@arcanejs/protocol/styles';
3
3
  import '../../id-map-DxQ3_gyA.js';
4
- export { i as Events, G as Group, c as GroupHeader, j as InternalProps, k as Props } from '../../toolkit-C37sQAkD.js';
4
+ export { k as Events, G as Group, e as GroupHeader, l as InternalProps, m as Props } from '../../toolkit-C_2Y8N9R.js';
5
5
  import '@arcanejs/protocol';
6
6
  import '@arcanejs/protocol/logging';
7
7
  import 'lodash';
@@ -1,7 +1,7 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { LabelComponentStyle } from '@arcanejs/protocol/styles';
3
3
  import { I as IDMap } from '../../id-map-DxQ3_gyA.mjs';
4
- import { d as Base } from '../../toolkit-CQMnQMOF.mjs';
4
+ import { f as Base } from '../../toolkit-CohVRj6u.mjs';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
7
7
  import 'http';
@@ -1,7 +1,7 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { LabelComponentStyle } from '@arcanejs/protocol/styles';
3
3
  import { I as IDMap } from '../../id-map-DxQ3_gyA.js';
4
- import { d as Base } from '../../toolkit-C37sQAkD.js';
4
+ import { f as Base } from '../../toolkit-C_2Y8N9R.js';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
7
7
  import 'http';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.mjs';
3
- import { d as Base } from '../../toolkit-CQMnQMOF.mjs';
3
+ import { f as Base } from '../../toolkit-CohVRj6u.mjs';
4
4
  import '@arcanejs/protocol/logging';
5
5
  import 'lodash';
6
6
  import 'http';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.js';
3
- import { d as Base } from '../../toolkit-C37sQAkD.js';
3
+ import { f as Base } from '../../toolkit-C_2Y8N9R.js';
4
4
  import '@arcanejs/protocol/logging';
5
5
  import 'lodash';
6
6
  import 'http';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.mjs';
3
- import { a as ToolkitConnection, d as Base, L as Listenable } from '../../toolkit-CQMnQMOF.mjs';
3
+ import { a as ToolkitConnection, f as Base, L as Listenable } from '../../toolkit-CohVRj6u.mjs';
4
4
  import { AnyClientComponentMessage } from '@arcanejs/protocol';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.js';
3
- import { a as ToolkitConnection, d as Base, L as Listenable } from '../../toolkit-C37sQAkD.js';
3
+ import { a as ToolkitConnection, f as Base, L as Listenable } from '../../toolkit-C_2Y8N9R.js';
4
4
  import { AnyClientComponentMessage } from '@arcanejs/protocol';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.mjs';
3
- import { a as ToolkitConnection, d as Base, L as Listenable } from '../../toolkit-CQMnQMOF.mjs';
3
+ import { a as ToolkitConnection, f as Base, L as Listenable } from '../../toolkit-CohVRj6u.mjs';
4
4
  import { AnyClientComponentMessage } from '@arcanejs/protocol';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.js';
3
- import { a as ToolkitConnection, d as Base, L as Listenable } from '../../toolkit-C37sQAkD.js';
3
+ import { a as ToolkitConnection, f as Base, L as Listenable } from '../../toolkit-C_2Y8N9R.js';
4
4
  import { AnyClientComponentMessage } from '@arcanejs/protocol';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.mjs';
3
- import { e as BaseParent, A as AnyComponent } from '../../toolkit-CQMnQMOF.mjs';
3
+ import { g as BaseParent, A as AnyComponent } from '../../toolkit-CohVRj6u.mjs';
4
4
  import '@arcanejs/protocol/logging';
5
5
  import 'lodash';
6
6
  import 'http';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.js';
3
- import { e as BaseParent, A as AnyComponent } from '../../toolkit-C37sQAkD.js';
3
+ import { g as BaseParent, A as AnyComponent } from '../../toolkit-C_2Y8N9R.js';
4
4
  import '@arcanejs/protocol/logging';
5
5
  import 'lodash';
6
6
  import 'http';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.mjs';
3
- import { a as ToolkitConnection, d as Base, L as Listenable } from '../../toolkit-CQMnQMOF.mjs';
3
+ import { a as ToolkitConnection, f as Base, L as Listenable } from '../../toolkit-CohVRj6u.mjs';
4
4
  import { AnyClientComponentMessage } from '@arcanejs/protocol';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.js';
3
- import { a as ToolkitConnection, d as Base, L as Listenable } from '../../toolkit-C37sQAkD.js';
3
+ import { a as ToolkitConnection, f as Base, L as Listenable } from '../../toolkit-C_2Y8N9R.js';
4
4
  import { AnyClientComponentMessage } from '@arcanejs/protocol';
5
5
  import '@arcanejs/protocol/logging';
6
6
  import 'lodash';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.mjs';
3
- import { d as Base } from '../../toolkit-CQMnQMOF.mjs';
3
+ import { f as Base } from '../../toolkit-CohVRj6u.mjs';
4
4
  import '@arcanejs/protocol/logging';
5
5
  import 'lodash';
6
6
  import 'http';
@@ -1,6 +1,6 @@
1
1
  import * as proto from '@arcanejs/protocol/core';
2
2
  import { I as IDMap } from '../../id-map-DxQ3_gyA.js';
3
- import { d as Base } from '../../toolkit-C37sQAkD.js';
3
+ import { f as Base } from '../../toolkit-C_2Y8N9R.js';
4
4
  import '@arcanejs/protocol/logging';
5
5
  import 'lodash';
6
6
  import 'http';
@@ -27528,7 +27528,9 @@ body {
27528
27528
  void 0
27529
27529
  );
27530
27530
  const socket = (0, import_react15.useRef)(null);
27531
- const uuid = (0, import_react15.useRef)(null);
27531
+ const [connection, setConnection] = (0, import_react15.useState)({
27532
+ state: "connecting"
27533
+ });
27532
27534
  const calls = (0, import_react15.useRef)({
27533
27535
  nextId: 1,
27534
27536
  calls: /* @__PURE__ */ new Map()
@@ -27553,7 +27555,7 @@ body {
27553
27555
  const handleMessage = (0, import_react15.useCallback)((msg) => {
27554
27556
  switch (msg.type) {
27555
27557
  case "metadata":
27556
- uuid.current = msg.connectionUuid;
27558
+ setConnection({ state: "connected", uuid: msg.connectionUuid });
27557
27559
  return;
27558
27560
  case "tree-full":
27559
27561
  setRoot(msg.root);
@@ -27580,29 +27582,40 @@ body {
27580
27582
  }
27581
27583
  }, []);
27582
27584
  const initializeWebsocket = (0, import_react15.useCallback)(async () => {
27585
+ if (socket.current) {
27586
+ socket.current.then((s2) => s2.close()).catch((err) => console.error(err));
27587
+ socket.current = null;
27588
+ }
27583
27589
  console.log("initializing websocket");
27584
27590
  const wsUrl = new URL(window.location.href);
27585
27591
  wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
27586
- const ws = new WebSocket(
27587
- `ws://${window.location.hostname}:${window.location.port}${window.location.pathname}`
27588
- );
27592
+ wsUrl.hash = "";
27593
+ const ws = new WebSocket(wsUrl.href);
27589
27594
  ws.onmessage = (event) => {
27590
27595
  handleMessage(JSON.parse(event.data));
27591
27596
  };
27592
27597
  ws.onclose = () => {
27598
+ setConnection({ state: "closed" });
27593
27599
  console.log("socket closed");
27594
27600
  socket.current = null;
27595
27601
  };
27596
27602
  socket.current = new Promise((resolve, reject) => {
27597
27603
  ws.onopen = () => {
27604
+ console.log("socket opened");
27605
+ setConnection({ state: "connected", uuid: null });
27598
27606
  resolve(ws);
27599
27607
  };
27600
27608
  ws.onerror = (err) => {
27609
+ setConnection({
27610
+ state: "error",
27611
+ error: err instanceof Error ? err : new Error("Unable to connect", { cause: err })
27612
+ });
27613
+ console.error("socket error", err);
27601
27614
  reject(err);
27602
27615
  socket.current = null;
27603
27616
  };
27604
27617
  });
27605
- return ws;
27618
+ return socket.current;
27606
27619
  }, []);
27607
27620
  const sendMessage = (0, import_react15.useCallback)(async (msg) => {
27608
27621
  (await (socket.current || initializeWebsocket())).send(JSON.stringify(msg));
@@ -27632,23 +27645,18 @@ body {
27632
27645
  (0, import_react15.useEffect)(() => {
27633
27646
  initializeWebsocket();
27634
27647
  }, [initializeWebsocket]);
27635
- return /* @__PURE__ */ import_react15.default.createElement(
27636
- StageContext.Provider,
27637
- {
27638
- value: {
27639
- sendMessage,
27640
- renderComponent,
27641
- call,
27642
- get connectionUuid() {
27643
- if (!uuid.current) {
27644
- throw new Error("Unexpected missing UUID");
27645
- }
27646
- return uuid.current;
27647
- }
27648
- }
27649
- },
27650
- /* @__PURE__ */ import_react15.default.createElement(GroupStateWrapper, { openByDefault: false }, /* @__PURE__ */ import_react15.default.createElement("div", { className }, root ? renderComponent(root) : /* @__PURE__ */ import_react15.default.createElement("div", { className: "no-root" }, "No root has been added to the light desk")))
27648
+ const stageContext = (0, import_react15.useMemo)(
27649
+ () => ({
27650
+ sendMessage,
27651
+ renderComponent,
27652
+ call,
27653
+ connectionUuid: connection.state === "connected" ? connection.uuid : null,
27654
+ connection,
27655
+ reconnect: () => void initializeWebsocket()
27656
+ }),
27657
+ [sendMessage, renderComponent, call, initializeWebsocket, connection]
27651
27658
  );
27659
+ return /* @__PURE__ */ import_react15.default.createElement(StageContext.Provider, { value: stageContext }, /* @__PURE__ */ import_react15.default.createElement(GroupStateWrapper, { openByDefault: false }, /* @__PURE__ */ import_react15.default.createElement("div", { className }, root ? renderComponent(root) : /* @__PURE__ */ import_react15.default.createElement("div", { className: "no-root" }, "No root has been added to the light desk"))));
27652
27660
  };
27653
27661
  var StyledStage = dt(Stage)`
27654
27662
  width: 100%;