@arcanejs/toolkit 5.0.0 → 6.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.
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 +29 -22
  22. package/dist/frontend/entrypoint.js.map +2 -2
  23. package/dist/frontend/index.js +32 -22
  24. package/dist/frontend/index.mjs +33 -23
  25. package/dist/index.d.mts +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +56 -24
  28. package/dist/index.mjs +47 -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,39 @@ 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
+ const ws = new WebSocket(wsUrl.href);
27589
27593
  ws.onmessage = (event) => {
27590
27594
  handleMessage(JSON.parse(event.data));
27591
27595
  };
27592
27596
  ws.onclose = () => {
27597
+ setConnection({ state: "closed" });
27593
27598
  console.log("socket closed");
27594
27599
  socket.current = null;
27595
27600
  };
27596
27601
  socket.current = new Promise((resolve, reject) => {
27597
27602
  ws.onopen = () => {
27603
+ console.log("socket opened");
27604
+ setConnection({ state: "connected", uuid: null });
27598
27605
  resolve(ws);
27599
27606
  };
27600
27607
  ws.onerror = (err) => {
27608
+ setConnection({
27609
+ state: "error",
27610
+ error: err instanceof Error ? err : new Error("Unable to connect", { cause: err })
27611
+ });
27612
+ console.error("socket error", err);
27601
27613
  reject(err);
27602
27614
  socket.current = null;
27603
27615
  };
27604
27616
  });
27605
- return ws;
27617
+ return socket.current;
27606
27618
  }, []);
27607
27619
  const sendMessage = (0, import_react15.useCallback)(async (msg) => {
27608
27620
  (await (socket.current || initializeWebsocket())).send(JSON.stringify(msg));
@@ -27632,23 +27644,18 @@ body {
27632
27644
  (0, import_react15.useEffect)(() => {
27633
27645
  initializeWebsocket();
27634
27646
  }, [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")))
27647
+ const stageContext = (0, import_react15.useMemo)(
27648
+ () => ({
27649
+ sendMessage,
27650
+ renderComponent,
27651
+ call,
27652
+ connectionUuid: connection.state === "connected" ? connection.uuid : null,
27653
+ connection,
27654
+ reconnect: () => void initializeWebsocket()
27655
+ }),
27656
+ [sendMessage, renderComponent, call, initializeWebsocket, connection]
27651
27657
  );
27658
+ 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
27659
  };
27653
27660
  var StyledStage = dt(Stage)`
27654
27661
  width: 100%;