@arcanejs/toolkit 4.0.0 → 5.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 (71) 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/base.js +2 -2
  4. package/dist/backend/components/base.mjs +1 -1
  5. package/dist/backend/components/button.d.mts +1 -1
  6. package/dist/backend/components/button.d.ts +1 -1
  7. package/dist/backend/components/button.js +3 -3
  8. package/dist/backend/components/button.mjs +2 -2
  9. package/dist/backend/components/group.d.mts +1 -1
  10. package/dist/backend/components/group.d.ts +1 -1
  11. package/dist/backend/components/group.js +3 -3
  12. package/dist/backend/components/group.mjs +2 -2
  13. package/dist/backend/components/label.d.mts +1 -1
  14. package/dist/backend/components/label.d.ts +1 -1
  15. package/dist/backend/components/label.js +3 -3
  16. package/dist/backend/components/label.mjs +2 -2
  17. package/dist/backend/components/rect.d.mts +1 -1
  18. package/dist/backend/components/rect.d.ts +1 -1
  19. package/dist/backend/components/rect.js +3 -3
  20. package/dist/backend/components/rect.mjs +2 -2
  21. package/dist/backend/components/slider-button.d.mts +1 -1
  22. package/dist/backend/components/slider-button.d.ts +1 -1
  23. package/dist/backend/components/slider-button.js +3 -3
  24. package/dist/backend/components/slider-button.mjs +2 -2
  25. package/dist/backend/components/switch.d.mts +1 -1
  26. package/dist/backend/components/switch.d.ts +1 -1
  27. package/dist/backend/components/switch.js +3 -3
  28. package/dist/backend/components/switch.mjs +2 -2
  29. package/dist/backend/components/tabs.d.mts +1 -1
  30. package/dist/backend/components/tabs.d.ts +1 -1
  31. package/dist/backend/components/tabs.js +3 -3
  32. package/dist/backend/components/tabs.mjs +2 -2
  33. package/dist/backend/components/text-input.d.mts +1 -1
  34. package/dist/backend/components/text-input.d.ts +1 -1
  35. package/dist/backend/components/text-input.js +3 -3
  36. package/dist/backend/components/text-input.mjs +2 -2
  37. package/dist/backend/components/timeline.d.mts +1 -1
  38. package/dist/backend/components/timeline.d.ts +1 -1
  39. package/dist/backend/components/timeline.js +3 -3
  40. package/dist/backend/components/timeline.mjs +2 -2
  41. package/dist/{chunk-Z3HEU534.js → chunk-3GTEUTFT.js} +2 -2
  42. package/dist/{chunk-YN7LHBRI.mjs → chunk-3TXBS2UN.mjs} +1 -1
  43. package/dist/{chunk-ZWYJEKZP.js → chunk-4OCRZD4F.js} +3 -3
  44. package/dist/{chunk-3VAHVFJ3.js → chunk-53EOA4UE.js} +3 -3
  45. package/dist/{chunk-XMP5XJWR.mjs → chunk-6ELB27LK.mjs} +1 -1
  46. package/dist/{chunk-VXNNW2KH.js → chunk-6QWYIJLM.js} +2 -2
  47. package/dist/{chunk-QT43ONN5.js → chunk-7JIC2XBC.js} +4 -4
  48. package/dist/{chunk-PIVARHCZ.mjs → chunk-E6FGU7DA.mjs} +1 -1
  49. package/dist/{chunk-JKTEVA75.mjs → chunk-GONHNB6V.mjs} +14 -0
  50. package/dist/{chunk-4EOCJT6W.js → chunk-HTCWMJUA.js} +3 -3
  51. package/dist/{chunk-MMK3PCSS.mjs → chunk-KMEDXCBI.mjs} +1 -1
  52. package/dist/{chunk-6BVEU2NV.mjs → chunk-LK6MGXYC.mjs} +1 -1
  53. package/dist/{chunk-6KPK5YOL.js → chunk-NL3W4M7J.js} +3 -3
  54. package/dist/{chunk-GIXAFIEY.mjs → chunk-PG5EAV5X.mjs} +1 -1
  55. package/dist/{chunk-JSZMJCCH.js → chunk-QAH2OSHR.js} +2 -2
  56. package/dist/{chunk-PYJC5BFZ.mjs → chunk-QB2WPBWV.mjs} +1 -1
  57. package/dist/{chunk-LGIWNJQA.js → chunk-U6FSQBQ3.js} +3 -3
  58. package/dist/{chunk-XYFDH3E7.mjs → chunk-UQWCTVMC.mjs} +1 -1
  59. package/dist/{chunk-VJ3Q2HZJ.mjs → chunk-WDB3IMOP.mjs} +1 -1
  60. package/dist/{chunk-HTM2L3DT.js → chunk-WN3GXVUE.js} +16 -2
  61. package/dist/frontend/entrypoint.js +54 -4
  62. package/dist/frontend/entrypoint.js.map +4 -4
  63. package/dist/frontend/index.js +51 -1
  64. package/dist/frontend/index.mjs +51 -1
  65. package/dist/index.d.mts +1 -1
  66. package/dist/index.d.ts +1 -1
  67. package/dist/index.js +12 -12
  68. package/dist/index.mjs +10 -10
  69. package/dist/{toolkit-BjYBFkG8.d.ts → toolkit-C37sQAkD.d.ts} +6 -1
  70. package/dist/{toolkit-k-CCIw3V.d.mts → toolkit-CQMnQMOF.d.mts} +6 -1
  71. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-JKTEVA75.mjs";
4
+ } from "./chunk-GONHNB6V.mjs";
5
5
 
6
6
  // src/backend/components/button.ts
7
7
  import * as proto from "@arcanejs/protocol/core";
@@ -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; } } var _class;
2
2
 
3
3
 
4
- var _chunkHTM2L3DTjs = require('./chunk-HTM2L3DT.js');
4
+ var _chunkWN3GXVUEjs = require('./chunk-WN3GXVUE.js');
5
5
 
6
6
  // src/backend/components/slider-button.ts
7
7
  var _core = require('@arcanejs/protocol/core'); var proto = _interopRequireWildcard(_core);
@@ -10,9 +10,9 @@ var DEFAULT_PROPS = {
10
10
  max: 255,
11
11
  step: 5
12
12
  };
13
- var SliderButton = (_class = class extends _chunkHTM2L3DTjs.Base {
13
+ var SliderButton = (_class = class extends _chunkWN3GXVUEjs.Base {
14
14
  /** @hidden */
15
- __init() {this.events = new (0, _chunkHTM2L3DTjs.EventEmitter)()}
15
+ __init() {this.events = new (0, _chunkWN3GXVUEjs.EventEmitter)()}
16
16
  /**
17
17
  * Manually manage the state of the slider,
18
18
  * to support both controlled and uncontrolled inputs.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-JKTEVA75.mjs";
4
+ } from "./chunk-GONHNB6V.mjs";
5
5
 
6
6
  // src/backend/components/switch.ts
7
7
  import * as proto from "@arcanejs/protocol/core";
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHTM2L3DTjs = require('./chunk-HTM2L3DT.js');
3
+ var _chunkWN3GXVUEjs = require('./chunk-WN3GXVUE.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 _chunkHTM2L3DTjs.Base {
9
+ var Rect = class extends _chunkWN3GXVUEjs.Base {
10
10
  constructor(props) {
11
11
  super(DEFAULT_PROPS, props);
12
12
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-JKTEVA75.mjs";
4
+ } from "./chunk-GONHNB6V.mjs";
5
5
 
6
6
  // src/backend/components/slider-button.ts
7
7
  import * as proto from "@arcanejs/protocol/core";
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class; var _class2;
2
2
 
3
- var _chunkHTM2L3DTjs = require('./chunk-HTM2L3DT.js');
3
+ var _chunkWN3GXVUEjs = require('./chunk-WN3GXVUE.js');
4
4
 
5
5
  // src/backend/components/tabs.ts
6
- var Tab = (_class = class extends _chunkHTM2L3DTjs.BaseParent {constructor(...args) { super(...args); _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
6
+ var Tab = (_class = class extends _chunkWN3GXVUEjs.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 _chunkHTM2L3DTjs.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 _chunkHTM2L3DTjs.BaseParent {
21
+ var Tabs = (_class2 = class extends _chunkWN3GXVUEjs.BaseParent {
22
22
  __init3() {this.validateChildren = (children) => {
23
23
  for (const child of children) {
24
24
  if (!(child instanceof Tab)) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Base
3
- } from "./chunk-JKTEVA75.mjs";
3
+ } from "./chunk-GONHNB6V.mjs";
4
4
 
5
5
  // src/backend/components/label.ts
6
6
  var Label = class extends Base {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-JKTEVA75.mjs";
4
+ } from "./chunk-GONHNB6V.mjs";
5
5
 
6
6
  // src/backend/components/text-input.ts
7
7
  import * as proto from "@arcanejs/protocol/core";
@@ -170,7 +170,7 @@ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(..
170
170
  this.updateTree();
171
171
  }
172
172
  }, _class2);
173
- var EventEmitter = (_class3 = class {constructor() { _class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this); }
173
+ var EventEmitter = (_class3 = class {constructor() { _class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this);_class3.prototype.__init18.call(this); }
174
174
  __init13() {this.listeners = /* @__PURE__ */ new Map()}
175
175
  __init14() {this.addListener = (type, listener) => {
176
176
  let set = this.listeners.get(type);
@@ -196,10 +196,24 @@ var EventEmitter = (_class3 = class {constructor() { _class3.prototype.__init13.
196
196
  )
197
197
  );
198
198
  }}
199
+ /**
200
+ * Like {@link emit},
201
+ * but ensures only a single listener exists and returns its result.
202
+ */
203
+ __init17() {this.call = async (type, ...args) => {
204
+ const result = await this.emit(type, ...args);
205
+ if (result.length > 1) {
206
+ throw new Error(`Multiple listeners for call: ${String(type)}`);
207
+ } else if (result[0]) {
208
+ return result[0];
209
+ } else {
210
+ throw new Error(`No listeners for call: ${String(type)}`);
211
+ }
212
+ }}
199
213
  /**
200
214
  * Process prop changes to update listeners
201
215
  */
202
- __init17() {this.processPropChanges = (mapping, oldProps, newProps) => {
216
+ __init18() {this.processPropChanges = (mapping, oldProps, newProps) => {
203
217
  for (const key of Object.keys(mapping)) {
204
218
  const prev = oldProps[key];
205
219
  const next = newProps[key];
@@ -24524,7 +24524,7 @@
24524
24524
  }
24525
24525
  });
24526
24526
 
24527
- // ../toolkit-frontend/dist/chunk-E7JSREGM.mjs
24527
+ // ../toolkit-frontend/dist/chunk-PTANIWKR.mjs
24528
24528
  var import_react = __toESM(require_react(), 1);
24529
24529
  var import_react2 = __toESM(require_react(), 1);
24530
24530
  var __defProp2 = Object.defineProperty;
@@ -25947,7 +25947,7 @@
25947
25947
  var St = "__sc-".concat(f, "__");
25948
25948
  "undefined" != typeof window && (window[St] || (window[St] = 0), 1 === window[St] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window[St] += 1);
25949
25949
 
25950
- // ../toolkit-frontend/dist/chunk-MESQQRK3.mjs
25950
+ // ../toolkit-frontend/dist/chunk-GMPDVDSW.mjs
25951
25951
  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
25952
25952
  var core_exports = {};
25953
25953
  __export(core_exports, {
@@ -25982,7 +25982,7 @@
25982
25982
  `;
25983
25983
  var TRANSPARENCY_SVG_URI = `data:image/svg+xml,${encodeURIComponent(TRANSPARENCY_SVG)}`;
25984
25984
 
25985
- // ../toolkit-frontend/dist/chunk-BQS6YM6U.mjs
25985
+ // ../toolkit-frontend/dist/chunk-6XOE7F7U.mjs
25986
25986
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
25987
25987
  var GlobalStyle = ft`
25988
25988
  body {
@@ -27263,7 +27263,57 @@ body {
27263
27263
  var import_react13 = __toESM(require_react());
27264
27264
 
27265
27265
  // ../toolkit-frontend/src/util/index.ts
27266
+ var COLOR_SCHEME_SETTINGS = "arcane-color-scheme-preference";
27267
+ var VALID_COLOR_SCHEME_PREFS2 = ["auto", "dark", "light"];
27268
+ var isValidColorSchemePreference = (value) => {
27269
+ return VALID_COLOR_SCHEME_PREFS2.includes(value);
27270
+ };
27271
+ var useColorSchemePreferences2 = () => {
27272
+ if (typeof window === "undefined") {
27273
+ return {
27274
+ colorSchemePreference: "auto",
27275
+ setColorSchemePreference: () => {
27276
+ }
27277
+ };
27278
+ }
27279
+ const [preference, setPreference] = (0, import_react14.useState)(
27280
+ window.localStorage.getItem(
27281
+ COLOR_SCHEME_SETTINGS
27282
+ ) || "auto"
27283
+ );
27284
+ const setColorSchemePreference = (newPreference) => {
27285
+ if (!isValidColorSchemePreference(newPreference)) {
27286
+ throw new Error(`Invalid color scheme preference: ${newPreference}`);
27287
+ }
27288
+ window.localStorage.setItem(COLOR_SCHEME_SETTINGS, newPreference);
27289
+ window.dispatchEvent(
27290
+ new StorageEvent("storage", {
27291
+ key: COLOR_SCHEME_SETTINGS,
27292
+ newValue: newPreference
27293
+ })
27294
+ );
27295
+ };
27296
+ (0, import_react14.useEffect)(() => {
27297
+ const onStorageChange = (event) => {
27298
+ if (event.key === COLOR_SCHEME_SETTINGS) {
27299
+ const newValue = event.newValue;
27300
+ if (isValidColorSchemePreference(newValue)) {
27301
+ setPreference(newValue);
27302
+ }
27303
+ }
27304
+ };
27305
+ window.addEventListener("storage", onStorageChange);
27306
+ return () => {
27307
+ window.removeEventListener("storage", onStorageChange);
27308
+ };
27309
+ }, []);
27310
+ return {
27311
+ colorSchemePreference: isValidColorSchemePreference(preference) ? preference : "auto",
27312
+ setColorSchemePreference
27313
+ };
27314
+ };
27266
27315
  var usePreferredColorScheme2 = () => {
27316
+ const { colorSchemePreference } = useColorSchemePreferences2();
27267
27317
  const [theme, setTheme] = (0, import_react14.useState)("light");
27268
27318
  (0, import_react14.useEffect)(() => {
27269
27319
  if (typeof window !== "undefined") {
@@ -27278,7 +27328,7 @@ body {
27278
27328
  };
27279
27329
  }
27280
27330
  }, []);
27281
- return theme;
27331
+ return colorSchemePreference === "auto" ? theme : colorSchemePreference;
27282
27332
  };
27283
27333
 
27284
27334
  // ../toolkit-frontend/src/styling.tsx