@arcanejs/toolkit 0.5.1 → 1.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 (75) hide show
  1. package/dist/backend/components/base.d.mts +25 -22
  2. package/dist/backend/components/base.d.ts +25 -22
  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 +5 -3
  6. package/dist/backend/components/button.d.ts +5 -3
  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 +6 -4
  10. package/dist/backend/components/group.d.ts +6 -4
  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 +4 -3
  14. package/dist/backend/components/label.d.ts +4 -3
  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 +4 -3
  18. package/dist/backend/components/rect.d.ts +4 -3
  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 +6 -4
  22. package/dist/backend/components/slider-button.d.ts +6 -4
  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 +6 -4
  26. package/dist/backend/components/switch.d.ts +6 -4
  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 +9 -8
  30. package/dist/backend/components/tabs.d.ts +9 -8
  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 +6 -4
  34. package/dist/backend/components/text-input.d.ts +6 -4
  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 +4 -3
  38. package/dist/backend/components/timeline.d.ts +4 -3
  39. package/dist/backend/components/timeline.js +3 -3
  40. package/dist/backend/components/timeline.mjs +2 -2
  41. package/dist/backend/util/index.d.mts +1 -1
  42. package/dist/backend/util/index.d.ts +1 -1
  43. package/dist/{chunk-Q5TEM6MM.js → chunk-25LALCAN.js} +17 -7
  44. package/dist/{chunk-IQ4SDDYP.js → chunk-5JPYL5IU.js} +3 -2
  45. package/dist/{chunk-KBPQZJKE.mjs → chunk-5TGGF5UJ.mjs} +17 -5
  46. package/dist/{chunk-PW7QVLLF.mjs → chunk-7SZA6JUN.mjs} +34 -3
  47. package/dist/{chunk-CFO5PSSK.js → chunk-ADH7RZG5.js} +54 -23
  48. package/dist/{chunk-C2TVGO43.js → chunk-ARRRZPUK.js} +5 -3
  49. package/dist/{chunk-ESMRIWOM.mjs → chunk-BDBRQJSI.mjs} +2 -1
  50. package/dist/{chunk-G5QXW2L3.mjs → chunk-EFNFSHV3.mjs} +16 -4
  51. package/dist/chunk-HNFNG5MD.js +55 -0
  52. package/dist/{chunk-SN2XKRYX.mjs → chunk-IBIEYR3L.mjs} +14 -4
  53. package/dist/{chunk-KR6LSBBX.mjs → chunk-ISHGZXPO.mjs} +14 -3
  54. package/dist/{chunk-DBSYI5Z4.mjs → chunk-LX5IL6WX.mjs} +2 -1
  55. package/dist/{chunk-JOW3XRQI.mjs → chunk-OAPIVG6M.mjs} +2 -1
  56. package/dist/{chunk-H734NV65.mjs → chunk-PXYXUWXE.mjs} +3 -1
  57. package/dist/{chunk-Q3NG5UUN.mjs → chunk-SBHNIFAS.mjs} +14 -4
  58. package/dist/{chunk-53DEDXHG.js → chunk-SIXWXDZW.js} +17 -7
  59. package/dist/{chunk-FUINWM5H.js → chunk-T4TMVBFM.js} +3 -2
  60. package/dist/{chunk-4HHKW7VA.js → chunk-TOPIQUBZ.js} +21 -9
  61. package/dist/{chunk-FLRGYURV.js → chunk-V5T44HCM.js} +3 -2
  62. package/dist/{chunk-4X3QY5EP.js → chunk-ZLJECS4H.js} +19 -7
  63. package/dist/{frontend.js → frontend/entrypoint.js} +20302 -20279
  64. package/dist/frontend/entrypoint.js.map +7 -0
  65. package/dist/frontend/index.d.mts +8 -0
  66. package/dist/frontend/index.d.ts +8 -0
  67. package/dist/frontend/index.js +123 -0
  68. package/dist/frontend/index.mjs +123 -0
  69. package/dist/index.d.mts +16 -3
  70. package/dist/index.d.ts +16 -3
  71. package/dist/index.js +40 -22
  72. package/dist/index.mjs +39 -21
  73. package/package.json +55 -29
  74. package/dist/chunk-DONU33U4.js +0 -44
  75. package/dist/frontend.js.map +0 -7
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;// src/backend/components/base.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;// src/backend/components/base.ts
2
2
  var Base = (_class = class {
3
3
  /** @hidden */
4
4
  __init() {this.parent = null}
@@ -8,16 +8,31 @@ var Base = (_class = class {
8
8
 
9
9
  /** @hidden */
10
10
  __init2() {this._onPropsUpdated = null}
11
- constructor(defaultProps, props, options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);
11
+ constructor(defaultProps, props, options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);
12
12
  this.defaultProps = defaultProps;
13
13
  this._props = Object.freeze({
14
14
  ...defaultProps,
15
15
  ...props
16
16
  });
17
- this._onPropsUpdated = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _8 => _8.onPropsUpdated]), () => ( null));
17
+ if (_optionalChain([options, 'optionalAccess', _13 => _13.onPropsUpdated])) {
18
+ const initialProps = this._props;
19
+ this._onPropsUpdated = {
20
+ listener: options.onPropsUpdated,
21
+ canSendInitialPropsUpdate: () => this._props === initialProps
22
+ };
23
+ }
18
24
  }
19
- __init3() {this.log = () => {
20
- return _optionalChain([this, 'access', _9 => _9.parent, 'optionalAccess', _10 => _10.log, 'call', _11 => _11()]) || null;
25
+ /**
26
+ * Call if
27
+ */
28
+ __init3() {this.triggerInitialPropsUpdate = () => {
29
+ if (!_optionalChain([this, 'access', _14 => _14._onPropsUpdated, 'optionalAccess', _15 => _15.canSendInitialPropsUpdate, 'call', _16 => _16()])) {
30
+ throw new Error("Cannot call triggerInitialPropsUpdate()");
31
+ }
32
+ this._onPropsUpdated.listener(this.defaultProps);
33
+ }}
34
+ __init4() {this.log = () => {
35
+ return _optionalChain([this, 'access', _17 => _17.parent, 'optionalAccess', _18 => _18.log, 'call', _19 => _19()]) || null;
21
36
  }}
22
37
  get props() {
23
38
  return this._props;
@@ -25,20 +40,22 @@ var Base = (_class = class {
25
40
  set props(props) {
26
41
  this.setProps(props);
27
42
  }
28
- __init4() {this.setProps = (props) => {
43
+ __init5() {this.setProps = (props) => {
44
+ const oldProps = this._props;
29
45
  this._props = Object.freeze({
30
46
  ...this.defaultProps,
31
47
  ...props
32
48
  });
33
- _optionalChain([this, 'access', _12 => _12._onPropsUpdated, 'optionalCall', _13 => _13()]);
49
+ _optionalChain([this, 'access', _20 => _20._onPropsUpdated, 'optionalAccess', _21 => _21.listener, 'optionalCall', _22 => _22(oldProps)]);
34
50
  this.updateTree();
35
51
  }}
36
- __init5() {this.updateProps = (updates) => {
52
+ __init6() {this.updateProps = (updates) => {
53
+ const oldProps = this._props;
37
54
  this._props = Object.freeze({
38
55
  ...this._props,
39
56
  ...updates
40
57
  });
41
- _optionalChain([this, 'access', _14 => _14._onPropsUpdated, 'optionalCall', _15 => _15()]);
58
+ _optionalChain([this, 'access', _23 => _23._onPropsUpdated, 'optionalAccess', _24 => _24.listener, 'optionalCall', _25 => _25(oldProps)]);
42
59
  this.updateTree();
43
60
  }}
44
61
  /** @hidden */
@@ -58,10 +75,10 @@ var Base = (_class = class {
58
75
  routeMessage(_idMap, _message) {
59
76
  }
60
77
  }, _class);
61
- var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(...args2); _class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this); }
78
+ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(...args2); _class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this);_class2.prototype.__init12.call(this); }
62
79
  /** @hidden */
63
- __init6() {this.children = []}
64
- __init7() {this.appendChildren = (...children) => {
80
+ __init7() {this.children = []}
81
+ __init8() {this.appendChildren = (...children) => {
65
82
  for (const c of children) {
66
83
  const newChildren = [...this.children.filter((ch) => ch !== c), c];
67
84
  this.validateChildren(newChildren);
@@ -71,11 +88,11 @@ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(..
71
88
  this.updateTree();
72
89
  return children;
73
90
  }}
74
- __init8() {this.appendChild = (child) => {
91
+ __init9() {this.appendChild = (child) => {
75
92
  this.appendChildren(child);
76
93
  return child;
77
94
  }}
78
- __init9() {this.removeChild = (component) => {
95
+ __init10() {this.removeChild = (component) => {
79
96
  const match = this.children.findIndex((c) => c === component);
80
97
  if (match >= 0) {
81
98
  const removingChild = this.children[match];
@@ -85,11 +102,11 @@ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(..
85
102
  ];
86
103
  this.validateChildren(newChildren);
87
104
  this.children = Object.freeze(newChildren);
88
- _optionalChain([removingChild, 'optionalAccess', _18 => _18.setParent, 'call', _19 => _19(null)]);
105
+ _optionalChain([removingChild, 'optionalAccess', _28 => _28.setParent, 'call', _29 => _29(null)]);
89
106
  this.updateTree();
90
107
  }
91
108
  }}
92
- __init10() {this.removeAllChildren = () => {
109
+ __init11() {this.removeAllChildren = () => {
93
110
  this.children.map((c) => c.setParent(null));
94
111
  this.children = Object.freeze([]);
95
112
  this.updateTree();
@@ -97,7 +114,7 @@ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(..
97
114
  /**
98
115
  * Return all children components that messages need to be routed to
99
116
  */
100
- __init11() {this.getChildren = () => this.children}
117
+ __init12() {this.getChildren = () => this.children}
101
118
  /**
102
119
  * TODO: we can do this better, right now it broadcasts the message to all
103
120
  * components of the tree
@@ -134,9 +151,9 @@ var BaseParent = (_class2 = class extends Base {constructor(...args2) { super(..
134
151
  this.updateTree();
135
152
  }
136
153
  }, _class2);
137
- var EventEmitter = (_class3 = class {constructor() { _class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this); }
138
- __init12() {this.listeners = /* @__PURE__ */ new Map()}
139
- __init13() {this.addListener = (type, listener) => {
154
+ 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); }
155
+ __init13() {this.listeners = /* @__PURE__ */ new Map()}
156
+ __init14() {this.addListener = (type, listener) => {
140
157
  let set = this.listeners.get(type);
141
158
  if (!set) {
142
159
  set = /* @__PURE__ */ new Set();
@@ -144,10 +161,10 @@ var EventEmitter = (_class3 = class {constructor() { _class3.prototype.__init12.
144
161
  }
145
162
  set.add(listener);
146
163
  }}
147
- __init14() {this.removeListener = (type, listener) => {
148
- _optionalChain([this, 'access', _25 => _25.listeners, 'access', _26 => _26.get, 'call', _27 => _27(type), 'optionalAccess', _28 => _28.delete, 'call', _29 => _29(listener)]);
164
+ __init15() {this.removeListener = (type, listener) => {
165
+ _optionalChain([this, 'access', _35 => _35.listeners, 'access', _36 => _36.get, 'call', _37 => _37(type), 'optionalAccess', _38 => _38.delete, 'call', _39 => _39(listener)]);
149
166
  }}
150
- __init15() {this.emit = (type, ...args) => {
167
+ __init16() {this.emit = (type, ...args) => {
151
168
  return Promise.all(
152
169
  [...this.listeners.get(type) || []].map(
153
170
  (l) => new Promise((resolve, reject) => {
@@ -160,6 +177,20 @@ var EventEmitter = (_class3 = class {constructor() { _class3.prototype.__init12.
160
177
  )
161
178
  );
162
179
  }}
180
+ /**
181
+ * Process prop changes to update listeners
182
+ */
183
+ __init17() {this.processPropChanges = (mapping, oldProps, newProps) => {
184
+ for (const key of Object.keys(mapping)) {
185
+ const prev = oldProps[key];
186
+ const next = newProps[key];
187
+ if (prev !== next) {
188
+ const eventName = mapping[key];
189
+ prev && this.removeListener(eventName, prev);
190
+ next && this.addListener(eventName, next);
191
+ }
192
+ }
193
+ }}
163
194
  }, _class3);
164
195
 
165
196
 
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class; var _class2;
2
2
 
3
- var _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
3
+ var _chunkADH7RZG5js = require('./chunk-ADH7RZG5.js');
4
4
 
5
5
  // src/backend/components/tabs.ts
6
- var Tab = (_class = class extends _chunkCFO5PSSKjs.BaseParent {constructor(...args) { super(...args); _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
6
+ var Tab = (_class = class extends _chunkADH7RZG5js.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");
@@ -11,13 +11,14 @@ var Tab = (_class = class extends _chunkCFO5PSSKjs.BaseParent {constructor(...ar
11
11
  }}
12
12
  /** @hidden */
13
13
  __init2() {this.getProtoInfo = (idMap) => ({
14
+ namespace: "core",
14
15
  component: "tab",
15
16
  key: idMap.getId(this),
16
17
  name: this.props.name,
17
18
  child: this.getChildren().slice(0, 1).map((c) => c.getProtoInfo(idMap))[0]
18
19
  })}
19
20
  }, _class);
20
- var Tabs = (_class2 = class extends _chunkCFO5PSSKjs.BaseParent {
21
+ var Tabs = (_class2 = class extends _chunkADH7RZG5js.BaseParent {
21
22
  __init3() {this.validateChildren = (children) => {
22
23
  for (const child of children) {
23
24
  if (!(child instanceof Tab)) {
@@ -42,6 +43,7 @@ var Tabs = (_class2 = class extends _chunkCFO5PSSKjs.BaseParent {
42
43
  /** @hidden */
43
44
  getProtoInfo(idMap) {
44
45
  return {
46
+ namespace: "core",
45
47
  component: "tabs",
46
48
  key: idMap.getId(this),
47
49
  tabs: this.getChildren().map((c) => c.getProtoInfo(idMap))
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Base
3
- } from "./chunk-PW7QVLLF.mjs";
3
+ } from "./chunk-7SZA6JUN.mjs";
4
4
 
5
5
  // src/backend/components/rect.ts
6
6
  var DEFAULT_PROPS = {
@@ -13,6 +13,7 @@ var Rect = class extends Base {
13
13
  /** @hidden */
14
14
  getProtoInfo(idMap) {
15
15
  return {
16
+ namespace: "core",
16
17
  component: "rect",
17
18
  key: idMap.getId(this),
18
19
  ...this.props
@@ -1,20 +1,31 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-PW7QVLLF.mjs";
4
+ } from "./chunk-7SZA6JUN.mjs";
5
5
 
6
6
  // src/backend/components/button.ts
7
+ import * as proto from "@arcanejs/protocol/core";
7
8
  var DEFAULT_PROPS = {
8
9
  text: null,
9
10
  icon: null,
10
11
  mode: "normal",
11
- error: null
12
+ error: null,
13
+ onClick: null
12
14
  };
13
15
  var Button = class extends Base {
14
16
  /** @hidden */
15
17
  events = new EventEmitter();
16
18
  constructor(props) {
17
- super(DEFAULT_PROPS, props);
19
+ super(DEFAULT_PROPS, props, {
20
+ onPropsUpdated: (oldProps) => this.events.processPropChanges(
21
+ {
22
+ onClick: "click"
23
+ },
24
+ oldProps,
25
+ this.props
26
+ )
27
+ });
28
+ this.triggerInitialPropsUpdate();
18
29
  }
19
30
  addListener = this.events.addListener;
20
31
  removeListener = this.events.removeListener;
@@ -36,6 +47,7 @@ var Button = class extends Base {
36
47
  /** @hidden */
37
48
  getProtoInfo = (idMap) => {
38
49
  return {
50
+ namespace: "core",
39
51
  component: "button",
40
52
  key: idMap.getId(this),
41
53
  text: this.props.text || "",
@@ -45,7 +57,7 @@ var Button = class extends Base {
45
57
  };
46
58
  /** @hidden */
47
59
  handleMessage = (message) => {
48
- if (message.component === "button") {
60
+ if (proto.isCoreComponentMessage(message, "button")) {
49
61
  this.events.emit("click").then(() => {
50
62
  if (this.props.error) {
51
63
  this.updateProps({
@@ -0,0 +1,55 @@
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
+
3
+
4
+ var _chunkADH7RZG5js = require('./chunk-ADH7RZG5.js');
5
+
6
+ // src/backend/components/text-input.ts
7
+ var _core = require('@arcanejs/protocol/core'); var proto = _interopRequireWildcard(_core);
8
+ var DEFAULT_PROPS = {
9
+ value: null
10
+ };
11
+ var TextInput = (_class = class extends _chunkADH7RZG5js.Base {
12
+ /** @hidden */
13
+ __init() {this.events = new (0, _chunkADH7RZG5js.EventEmitter)()}
14
+ constructor(props) {
15
+ super(DEFAULT_PROPS, props, {
16
+ onPropsUpdated: (oldProps) => this.events.processPropChanges(
17
+ {
18
+ onChange: "change"
19
+ },
20
+ oldProps,
21
+ this.props
22
+ )
23
+ });_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);;
24
+ this.triggerInitialPropsUpdate();
25
+ }
26
+ __init2() {this.addListener = this.events.addListener}
27
+ __init3() {this.removeListener = this.events.removeListener}
28
+ /** @hidden */
29
+ __init4() {this.getProtoInfo = (idMap) => {
30
+ return {
31
+ namespace: "core",
32
+ component: "text-input",
33
+ key: idMap.getId(this),
34
+ value: _nullishCoalesce(this.props.value, () => ( ""))
35
+ };
36
+ }}
37
+ /** @hidden */
38
+ __init5() {this.handleMessage = (message) => {
39
+ if (proto.isCoreComponentMessage(message, "text-input")) {
40
+ if (this.props.value !== message.value) {
41
+ this.updateProps({ value: message.value });
42
+ this.events.emit("change", message.value);
43
+ }
44
+ }
45
+ }}
46
+ __init6() {this.getValue = () => this.props.value}
47
+ __init7() {this.getValidatedValue = (validator) => this.props.value === "" ? null : validator(this.props.value || "")}
48
+ __init8() {this.setValue = (value) => {
49
+ this.updateProps({ value });
50
+ }}
51
+ }, _class);
52
+
53
+
54
+
55
+ exports.TextInput = TextInput;
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-PW7QVLLF.mjs";
4
+ } from "./chunk-7SZA6JUN.mjs";
5
5
 
6
6
  // src/backend/components/slider-button.ts
7
+ import * as proto from "@arcanejs/protocol/core";
7
8
  var DEFAULT_PROPS = {
8
9
  min: 0,
9
10
  max: 255,
@@ -19,15 +20,24 @@ var SliderButton = class extends Base {
19
20
  _value = null;
20
21
  constructor(props) {
21
22
  super(DEFAULT_PROPS, props, {
22
- onPropsUpdated: () => this.onPropsUpdated()
23
+ onPropsUpdated: (oldProps) => {
24
+ this.events.processPropChanges(
25
+ {
26
+ onChange: "change"
27
+ },
28
+ oldProps,
29
+ this.props
30
+ ), this.onPropsUpdated();
31
+ }
23
32
  });
24
- this.onPropsUpdated();
33
+ this.triggerInitialPropsUpdate();
25
34
  }
26
35
  addListener = this.events.addListener;
27
36
  removeListener = this.events.removeListener;
28
37
  /** @hidden */
29
38
  getProtoInfo(idMap) {
30
39
  return {
40
+ namespace: "core",
31
41
  component: "slider_button",
32
42
  key: idMap.getId(this),
33
43
  min: this.props.min,
@@ -40,7 +50,7 @@ var SliderButton = class extends Base {
40
50
  }
41
51
  /** @hidden */
42
52
  handleMessage(message) {
43
- if (message.component !== "slider_button") return;
53
+ if (!proto.isCoreComponentMessage(message, "slider_button")) return;
44
54
  const newValue = this.sanitizeNumber(message.value);
45
55
  if (this._value === newValue) return;
46
56
  if (this.props.value === void 0) {
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-PW7QVLLF.mjs";
4
+ } from "./chunk-7SZA6JUN.mjs";
5
5
 
6
6
  // src/backend/components/text-input.ts
7
+ import * as proto from "@arcanejs/protocol/core";
7
8
  var DEFAULT_PROPS = {
8
9
  value: null
9
10
  };
@@ -11,13 +12,23 @@ var TextInput = class extends Base {
11
12
  /** @hidden */
12
13
  events = new EventEmitter();
13
14
  constructor(props) {
14
- super(DEFAULT_PROPS, props);
15
+ super(DEFAULT_PROPS, props, {
16
+ onPropsUpdated: (oldProps) => this.events.processPropChanges(
17
+ {
18
+ onChange: "change"
19
+ },
20
+ oldProps,
21
+ this.props
22
+ )
23
+ });
24
+ this.triggerInitialPropsUpdate();
15
25
  }
16
26
  addListener = this.events.addListener;
17
27
  removeListener = this.events.removeListener;
18
28
  /** @hidden */
19
29
  getProtoInfo = (idMap) => {
20
30
  return {
31
+ namespace: "core",
21
32
  component: "text-input",
22
33
  key: idMap.getId(this),
23
34
  value: this.props.value ?? ""
@@ -25,7 +36,7 @@ var TextInput = class extends Base {
25
36
  };
26
37
  /** @hidden */
27
38
  handleMessage = (message) => {
28
- if (message.component === "text-input") {
39
+ if (proto.isCoreComponentMessage(message, "text-input")) {
29
40
  if (this.props.value !== message.value) {
30
41
  this.updateProps({ value: message.value });
31
42
  this.events.emit("change", message.value);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Base
3
- } from "./chunk-PW7QVLLF.mjs";
3
+ } from "./chunk-7SZA6JUN.mjs";
4
4
 
5
5
  // src/backend/components/timeline.ts
6
6
  var DEFAULT_PROPS = {
@@ -19,6 +19,7 @@ var Timeline = class extends Base {
19
19
  }
20
20
  /** @hidden */
21
21
  getProtoInfo = (idMap) => ({
22
+ namespace: "core",
22
23
  component: "timeline",
23
24
  key: idMap.getId(this),
24
25
  state: this.props.state,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Base
3
- } from "./chunk-PW7QVLLF.mjs";
3
+ } from "./chunk-7SZA6JUN.mjs";
4
4
 
5
5
  // src/backend/components/label.ts
6
6
  var Label = class extends Base {
@@ -10,6 +10,7 @@ var Label = class extends Base {
10
10
  /** @hidden */
11
11
  getProtoInfo(idMap) {
12
12
  return {
13
+ namespace: "core",
13
14
  component: "label",
14
15
  key: idMap.getId(this),
15
16
  bold: this.props.bold,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseParent
3
- } from "./chunk-PW7QVLLF.mjs";
3
+ } from "./chunk-7SZA6JUN.mjs";
4
4
 
5
5
  // src/backend/components/tabs.ts
6
6
  var Tab = class extends BaseParent {
@@ -11,6 +11,7 @@ var Tab = class extends BaseParent {
11
11
  };
12
12
  /** @hidden */
13
13
  getProtoInfo = (idMap) => ({
14
+ namespace: "core",
14
15
  component: "tab",
15
16
  key: idMap.getId(this),
16
17
  name: this.props.name,
@@ -42,6 +43,7 @@ var Tabs = class extends BaseParent {
42
43
  /** @hidden */
43
44
  getProtoInfo(idMap) {
44
45
  return {
46
+ namespace: "core",
45
47
  component: "tabs",
46
48
  key: idMap.getId(this),
47
49
  tabs: this.getChildren().map((c) => c.getProtoInfo(idMap))
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-PW7QVLLF.mjs";
4
+ } from "./chunk-7SZA6JUN.mjs";
5
5
 
6
6
  // src/backend/components/switch.ts
7
+ import * as proto from "@arcanejs/protocol/core";
7
8
  var DEFAULT_PROPS = {};
8
9
  var Switch = class extends Base {
9
10
  /** @hidden */
@@ -15,15 +16,24 @@ var Switch = class extends Base {
15
16
  _value = null;
16
17
  constructor(props) {
17
18
  super(DEFAULT_PROPS, props, {
18
- onPropsUpdated: () => this.onPropsUpdated()
19
+ onPropsUpdated: (oldProps) => {
20
+ this.events.processPropChanges(
21
+ {
22
+ onChange: "change"
23
+ },
24
+ oldProps,
25
+ this.props
26
+ ), this.onPropsUpdated();
27
+ }
19
28
  });
20
- this.onPropsUpdated();
29
+ this.triggerInitialPropsUpdate();
21
30
  }
22
31
  addListener = this.events.addListener;
23
32
  removeListener = this.events.removeListener;
24
33
  /** @hidden */
25
34
  getProtoInfo(idMap) {
26
35
  return {
36
+ namespace: "core",
27
37
  component: "switch",
28
38
  key: idMap.getId(this),
29
39
  state: this._value ?? "off"
@@ -31,7 +41,7 @@ var Switch = class extends Base {
31
41
  }
32
42
  /** @hidden */
33
43
  handleMessage(message) {
34
- if (message.component === "switch") {
44
+ if (proto.isCoreComponentMessage(message, "switch")) {
35
45
  const state = this._value === "on" ? "off" : "on";
36
46
  if (this.props.value === void 0) {
37
47
  this._value = state;
@@ -1,17 +1,18 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
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 _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
4
+ var _chunkADH7RZG5js = require('./chunk-ADH7RZG5.js');
5
5
 
6
6
  // src/backend/components/slider-button.ts
7
+ var _core = require('@arcanejs/protocol/core'); var proto = _interopRequireWildcard(_core);
7
8
  var DEFAULT_PROPS = {
8
9
  min: 0,
9
10
  max: 255,
10
11
  step: 5
11
12
  };
12
- var SliderButton = (_class = class extends _chunkCFO5PSSKjs.Base {
13
+ var SliderButton = (_class = class extends _chunkADH7RZG5js.Base {
13
14
  /** @hidden */
14
- __init() {this.events = new (0, _chunkCFO5PSSKjs.EventEmitter)()}
15
+ __init() {this.events = new (0, _chunkADH7RZG5js.EventEmitter)()}
15
16
  /**
16
17
  * Manually manage the state of the slider,
17
18
  * to support both controlled and uncontrolled inputs.
@@ -19,15 +20,24 @@ var SliderButton = (_class = class extends _chunkCFO5PSSKjs.Base {
19
20
  __init2() {this._value = null}
20
21
  constructor(props) {
21
22
  super(DEFAULT_PROPS, props, {
22
- onPropsUpdated: () => this.onPropsUpdated()
23
+ onPropsUpdated: (oldProps) => {
24
+ this.events.processPropChanges(
25
+ {
26
+ onChange: "change"
27
+ },
28
+ oldProps,
29
+ this.props
30
+ ), this.onPropsUpdated();
31
+ }
23
32
  });_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);;
24
- this.onPropsUpdated();
33
+ this.triggerInitialPropsUpdate();
25
34
  }
26
35
  __init3() {this.addListener = this.events.addListener}
27
36
  __init4() {this.removeListener = this.events.removeListener}
28
37
  /** @hidden */
29
38
  getProtoInfo(idMap) {
30
39
  return {
40
+ namespace: "core",
31
41
  component: "slider_button",
32
42
  key: idMap.getId(this),
33
43
  min: this.props.min,
@@ -40,7 +50,7 @@ var SliderButton = (_class = class extends _chunkCFO5PSSKjs.Base {
40
50
  }
41
51
  /** @hidden */
42
52
  handleMessage(message) {
43
- if (message.component !== "slider_button") return;
53
+ if (!proto.isCoreComponentMessage(message, "slider_button")) return;
44
54
  const newValue = this.sanitizeNumber(message.value);
45
55
  if (this._value === newValue) return;
46
56
  if (this.props.value === void 0) {
@@ -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 _chunkCFO5PSSKjs = require('./chunk-CFO5PSSK.js');
3
+ var _chunkADH7RZG5js = require('./chunk-ADH7RZG5.js');
4
4
 
5
5
  // src/backend/components/timeline.ts
6
6
  var DEFAULT_PROPS = {
@@ -13,12 +13,13 @@ var DEFAULT_PROPS = {
13
13
  subtitles: null,
14
14
  source: null
15
15
  };
16
- var Timeline = (_class = class extends _chunkCFO5PSSKjs.Base {
16
+ var Timeline = (_class = class extends _chunkADH7RZG5js.Base {
17
17
  constructor(props) {
18
18
  super(DEFAULT_PROPS, props);_class.prototype.__init.call(this);;
19
19
  }
20
20
  /** @hidden */
21
21
  __init() {this.getProtoInfo = (idMap) => ({
22
+ namespace: "core",
22
23
  component: "timeline",
23
24
  key: idMap.getId(this),
24
25
  state: this.props.state,