@arcanejs/toolkit 0.2.1 → 0.3.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 (70) hide show
  1. package/dist/backend/components/base.d.mts +4 -1
  2. package/dist/backend/components/base.d.ts +4 -1
  3. package/dist/backend/components/base.js +10 -188
  4. package/dist/backend/components/base.mjs +1 -1
  5. package/dist/backend/components/button.d.mts +1 -0
  6. package/dist/backend/components/button.d.ts +1 -0
  7. package/dist/backend/components/button.js +5 -165
  8. package/dist/backend/components/button.mjs +2 -2
  9. package/dist/backend/components/group.d.mts +1 -0
  10. package/dist/backend/components/group.d.ts +1 -0
  11. package/dist/backend/components/group.js +7 -281
  12. package/dist/backend/components/group.mjs +2 -2
  13. package/dist/backend/components/label.d.mts +1 -0
  14. package/dist/backend/components/label.d.ts +1 -0
  15. package/dist/backend/components/label.js +5 -102
  16. package/dist/backend/components/label.mjs +2 -2
  17. package/dist/backend/components/rect.d.mts +1 -0
  18. package/dist/backend/components/rect.d.ts +1 -0
  19. package/dist/backend/components/rect.js +5 -102
  20. package/dist/backend/components/rect.mjs +2 -2
  21. package/dist/backend/components/slider-button.d.mts +1 -0
  22. package/dist/backend/components/slider-button.d.ts +1 -0
  23. package/dist/backend/components/slider-button.js +5 -158
  24. package/dist/backend/components/slider-button.mjs +2 -2
  25. package/dist/backend/components/switch.d.mts +1 -0
  26. package/dist/backend/components/switch.d.ts +1 -0
  27. package/dist/backend/components/switch.js +5 -141
  28. package/dist/backend/components/switch.mjs +2 -2
  29. package/dist/backend/components/tabs.d.mts +1 -0
  30. package/dist/backend/components/tabs.d.ts +1 -0
  31. package/dist/backend/components/tabs.js +7 -206
  32. package/dist/backend/components/tabs.mjs +2 -2
  33. package/dist/backend/components/text-input.d.mts +1 -0
  34. package/dist/backend/components/text-input.d.ts +1 -0
  35. package/dist/backend/components/text-input.js +5 -143
  36. package/dist/backend/components/text-input.mjs +2 -2
  37. package/dist/backend/components/timeline.d.mts +1 -0
  38. package/dist/backend/components/timeline.d.ts +1 -0
  39. package/dist/backend/components/timeline.js +5 -106
  40. package/dist/backend/components/timeline.mjs +2 -2
  41. package/dist/backend/util/index.js +5 -41
  42. package/dist/chunk-3RG5ZIWI.js +10 -0
  43. package/dist/{chunk-3O4P67DM.mjs → chunk-3Y3HRYLC.mjs} +1 -1
  44. package/dist/{chunk-HNEUZVCX.mjs → chunk-7ITSSJE2.mjs} +1 -1
  45. package/dist/chunk-DNCHAOYH.js +42 -0
  46. package/dist/chunk-DV5WTSFW.js +33 -0
  47. package/dist/chunk-EABM5X65.js +17 -0
  48. package/dist/{chunk-ZCHM3JJJ.mjs → chunk-EDTJ75FT.mjs} +4 -3
  49. package/dist/{chunk-TAZH4BBH.mjs → chunk-EH73E5FP.mjs} +1 -1
  50. package/dist/{chunk-JW4GXS54.mjs → chunk-H2UQDFTS.mjs} +1 -1
  51. package/dist/chunk-IW3JCC73.js +44 -0
  52. package/dist/chunk-J46AJUGE.js +66 -0
  53. package/dist/{chunk-IXTM35YM.mjs → chunk-NKNDCRUR.mjs} +1 -1
  54. package/dist/chunk-NZUYU32Z.js +164 -0
  55. package/dist/{chunk-SOC4TF3J.mjs → chunk-POUQGJN4.mjs} +1 -1
  56. package/dist/chunk-QUA3NBLD.js +104 -0
  57. package/dist/{chunk-ZU5H6SVA.mjs → chunk-SMTUN6HG.mjs} +1 -1
  58. package/dist/chunk-TSC5C5XR.js +29 -0
  59. package/dist/chunk-WIPEQNWR.js +29 -0
  60. package/dist/chunk-WXSKMMCV.js +55 -0
  61. package/dist/{chunk-TQ27Y7F4.mjs → chunk-YIXRQHTA.mjs} +1 -1
  62. package/dist/chunk-YN3FZMXY.js +59 -0
  63. package/dist/{chunk-APCR3ITH.mjs → chunk-YYM7PBRN.mjs} +1 -1
  64. package/dist/frontend.js +0 -3
  65. package/dist/frontend.js.map +2 -2
  66. package/dist/index.d.mts +21 -3
  67. package/dist/index.d.ts +21 -3
  68. package/dist/index.js +99 -669
  69. package/dist/index.mjs +28 -24
  70. package/package.json +5 -5
@@ -1,146 +1,8 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
19
2
 
20
- // src/backend/components/text-input.ts
21
- var text_input_exports = {};
22
- __export(text_input_exports, {
23
- TextInput: () => TextInput
24
- });
25
- module.exports = __toCommonJS(text_input_exports);
3
+ var _chunkIW3JCC73js = require('../../chunk-IW3JCC73.js');
4
+ require('../../chunk-NZUYU32Z.js');
5
+ require('../../chunk-3RG5ZIWI.js');
26
6
 
27
- // src/backend/components/base.ts
28
- var Base = class {
29
- /** @hidden */
30
- parent = null;
31
- /** @hidden */
32
- defaultProps;
33
- /** @hidden */
34
- _props;
35
- constructor(defaultProps, props) {
36
- this.defaultProps = defaultProps;
37
- this._props = Object.freeze({
38
- ...defaultProps,
39
- ...props
40
- });
41
- }
42
- get props() {
43
- return this._props;
44
- }
45
- set props(props) {
46
- this.setProps(props);
47
- }
48
- setProps = (props) => {
49
- this._props = Object.freeze({
50
- ...this.defaultProps,
51
- ...props
52
- });
53
- this.updateTree();
54
- };
55
- updateProps = (updates) => {
56
- this._props = Object.freeze({
57
- ...this._props,
58
- ...updates
59
- });
60
- this.updateTree();
61
- };
62
- /** @hidden */
63
- setParent(parent) {
64
- if (this.parent && this.parent !== parent) {
65
- this.parent.removeChild(this);
66
- }
67
- this.parent = parent;
68
- }
69
- /** @hidden */
70
- updateTree() {
71
- if (this.parent) this.parent.updateTree();
72
- }
73
- /** @hidden */
74
- handleMessage(message) {
75
- console.log("Component Received Message:", message);
76
- }
77
- routeMessage(_idMap, _message) {
78
- }
79
- };
80
- var EventEmitter = class {
81
- listeners = /* @__PURE__ */ new Map();
82
- addListener = (type, listener) => {
83
- let set = this.listeners.get(type);
84
- if (!set) {
85
- set = /* @__PURE__ */ new Set();
86
- this.listeners.set(type, set);
87
- }
88
- set.add(listener);
89
- };
90
- removeListener = (type, listener) => {
91
- this.listeners.get(type)?.delete(listener);
92
- };
93
- emit = (type, ...args) => {
94
- return Promise.all(
95
- [...this.listeners.get(type) || []].map(
96
- (l) => new Promise((resolve, reject) => {
97
- try {
98
- resolve(l(...args));
99
- } catch (e) {
100
- reject(e);
101
- }
102
- })
103
- )
104
- );
105
- };
106
- };
107
7
 
108
- // src/backend/components/text-input.ts
109
- var DEFAULT_PROPS = {
110
- value: null
111
- };
112
- var TextInput = class extends Base {
113
- /** @hidden */
114
- events = new EventEmitter();
115
- constructor(props) {
116
- super(DEFAULT_PROPS, props);
117
- }
118
- addListener = this.events.addListener;
119
- removeListener = this.events.removeListener;
120
- /** @hidden */
121
- getProtoInfo = (idMap) => {
122
- return {
123
- component: "text-input",
124
- key: idMap.getId(this),
125
- value: this.props.value ?? ""
126
- };
127
- };
128
- /** @hidden */
129
- handleMessage = (message) => {
130
- if (message.component === "text-input") {
131
- if (this.props.value !== message.value) {
132
- this.updateProps({ value: message.value });
133
- this.events.emit("change", message.value);
134
- }
135
- }
136
- };
137
- getValue = () => this.props.value;
138
- getValidatedValue = (validator) => this.props.value === "" ? null : validator(this.props.value || "");
139
- setValue = (value) => {
140
- this.updateProps({ value });
141
- };
142
- };
143
- // Annotate the CommonJS export names for ESM import in node:
144
- 0 && (module.exports = {
145
- TextInput
146
- });
8
+ exports.TextInput = _chunkIW3JCC73js.TextInput;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TextInput
3
- } from "../../chunk-IXTM35YM.mjs";
4
- import "../../chunk-ZCHM3JJJ.mjs";
3
+ } from "../../chunk-NKNDCRUR.mjs";
4
+ import "../../chunk-EDTJ75FT.mjs";
5
5
  import "../../chunk-Y6FXYEAI.mjs";
6
6
  export {
7
7
  TextInput
@@ -1,6 +1,7 @@
1
1
  import * as proto from '@arcanejs/protocol';
2
2
  import { IDMap } from '../util/index.mjs';
3
3
  import { Base } from './base.mjs';
4
+ import '@arcanejs/protocol/logging';
4
5
 
5
6
  type InternalProps = {
6
7
  state: proto.TimelineState;
@@ -1,6 +1,7 @@
1
1
  import * as proto from '@arcanejs/protocol';
2
2
  import { IDMap } from '../util/index.js';
3
3
  import { Base } from './base.js';
4
+ import '@arcanejs/protocol/logging';
4
5
 
5
6
  type InternalProps = {
6
7
  state: proto.TimelineState;
@@ -1,109 +1,8 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
19
2
 
20
- // src/backend/components/timeline.ts
21
- var timeline_exports = {};
22
- __export(timeline_exports, {
23
- Timeline: () => Timeline
24
- });
25
- module.exports = __toCommonJS(timeline_exports);
3
+ var _chunkDV5WTSFWjs = require('../../chunk-DV5WTSFW.js');
4
+ require('../../chunk-NZUYU32Z.js');
5
+ require('../../chunk-3RG5ZIWI.js');
26
6
 
27
- // src/backend/components/base.ts
28
- var Base = class {
29
- /** @hidden */
30
- parent = null;
31
- /** @hidden */
32
- defaultProps;
33
- /** @hidden */
34
- _props;
35
- constructor(defaultProps, props) {
36
- this.defaultProps = defaultProps;
37
- this._props = Object.freeze({
38
- ...defaultProps,
39
- ...props
40
- });
41
- }
42
- get props() {
43
- return this._props;
44
- }
45
- set props(props) {
46
- this.setProps(props);
47
- }
48
- setProps = (props) => {
49
- this._props = Object.freeze({
50
- ...this.defaultProps,
51
- ...props
52
- });
53
- this.updateTree();
54
- };
55
- updateProps = (updates) => {
56
- this._props = Object.freeze({
57
- ...this._props,
58
- ...updates
59
- });
60
- this.updateTree();
61
- };
62
- /** @hidden */
63
- setParent(parent) {
64
- if (this.parent && this.parent !== parent) {
65
- this.parent.removeChild(this);
66
- }
67
- this.parent = parent;
68
- }
69
- /** @hidden */
70
- updateTree() {
71
- if (this.parent) this.parent.updateTree();
72
- }
73
- /** @hidden */
74
- handleMessage(message) {
75
- console.log("Component Received Message:", message);
76
- }
77
- routeMessage(_idMap, _message) {
78
- }
79
- };
80
7
 
81
- // src/backend/components/timeline.ts
82
- var DEFAULT_PROPS = {
83
- state: {
84
- state: "stopped",
85
- totalTimeMillis: 0,
86
- currentTimeMillis: 0
87
- },
88
- title: null,
89
- subtitles: null,
90
- source: null
91
- };
92
- var Timeline = class extends Base {
93
- constructor(props) {
94
- super(DEFAULT_PROPS, props);
95
- }
96
- /** @hidden */
97
- getProtoInfo = (idMap) => ({
98
- component: "timeline",
99
- key: idMap.getId(this),
100
- state: this.props.state,
101
- title: this.props.title ?? void 0,
102
- subtitles: this.props.subtitles ?? void 0,
103
- source: this.props.source ?? void 0
104
- });
105
- };
106
- // Annotate the CommonJS export names for ESM import in node:
107
- 0 && (module.exports = {
108
- Timeline
109
- });
8
+ exports.Timeline = _chunkDV5WTSFWjs.Timeline;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Timeline
3
- } from "../../chunk-SOC4TF3J.mjs";
4
- import "../../chunk-ZCHM3JJJ.mjs";
3
+ } from "../../chunk-POUQGJN4.mjs";
4
+ import "../../chunk-EDTJ75FT.mjs";
5
5
  import "../../chunk-Y6FXYEAI.mjs";
6
6
  export {
7
7
  Timeline
@@ -1,43 +1,7 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
19
2
 
20
- // src/backend/util/index.ts
21
- var util_exports = {};
22
- __export(util_exports, {
23
- IDMap: () => IDMap
24
- });
25
- module.exports = __toCommonJS(util_exports);
3
+ var _chunkEABM5X65js = require('../../chunk-EABM5X65.js');
4
+ require('../../chunk-3RG5ZIWI.js');
26
5
 
27
- // src/backend/util/id-map.ts
28
- var IDMap = class {
29
- idMap = /* @__PURE__ */ new WeakMap();
30
- nextId = 0;
31
- getId(object) {
32
- let i = this.idMap.get(object);
33
- if (i === void 0) {
34
- i = this.nextId++;
35
- this.idMap.set(object, i);
36
- }
37
- return i;
38
- }
39
- };
40
- // Annotate the CommonJS export names for ESM import in node:
41
- 0 && (module.exports = {
42
- IDMap
43
- });
6
+
7
+ exports.IDMap = _chunkEABM5X65js.IDMap;
@@ -0,0 +1,10 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+
9
+
10
+ exports.__require = __require;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BaseParent,
3
3
  EventEmitter
4
- } from "./chunk-ZCHM3JJJ.mjs";
4
+ } from "./chunk-EDTJ75FT.mjs";
5
5
 
6
6
  // src/backend/components/group.ts
7
7
  var GROUP_DEFAULT_STYLE = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Base
3
- } from "./chunk-ZCHM3JJJ.mjs";
3
+ } from "./chunk-EDTJ75FT.mjs";
4
4
 
5
5
  // src/backend/components/label.ts
6
6
  var Label = class extends Base {
@@ -0,0 +1,42 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
2
+
3
+
4
+ var _chunkNZUYU32Zjs = require('./chunk-NZUYU32Z.js');
5
+
6
+ // src/backend/components/switch.ts
7
+ var DEFAULT_PROPS = {
8
+ state: "off"
9
+ };
10
+ var Switch = (_class = class extends _chunkNZUYU32Zjs.Base {
11
+ /** @hidden */
12
+ __init() {this.events = new (0, _chunkNZUYU32Zjs.EventEmitter)()}
13
+ constructor(props) {
14
+ super(DEFAULT_PROPS, props);_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);;
15
+ }
16
+ __init2() {this.addListener = this.events.addListener}
17
+ __init3() {this.removeListener = this.events.removeListener}
18
+ /** @hidden */
19
+ getProtoInfo(idMap) {
20
+ return {
21
+ component: "switch",
22
+ key: idMap.getId(this),
23
+ state: this.props.state
24
+ };
25
+ }
26
+ /** @hidden */
27
+ handleMessage(message) {
28
+ if (message.component === "switch") {
29
+ const state = this.props.state === "on" ? "off" : "on";
30
+ this.updateProps({ state });
31
+ this.events.emit("change", state);
32
+ }
33
+ }
34
+ setValue(state) {
35
+ if (state === this.props.state) return;
36
+ this.updateProps({ state });
37
+ }
38
+ }, _class);
39
+
40
+
41
+
42
+ exports.Switch = Switch;
@@ -0,0 +1,33 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
2
+
3
+ var _chunkNZUYU32Zjs = require('./chunk-NZUYU32Z.js');
4
+
5
+ // src/backend/components/timeline.ts
6
+ var DEFAULT_PROPS = {
7
+ state: {
8
+ state: "stopped",
9
+ totalTimeMillis: 0,
10
+ currentTimeMillis: 0
11
+ },
12
+ title: null,
13
+ subtitles: null,
14
+ source: null
15
+ };
16
+ var Timeline = (_class = class extends _chunkNZUYU32Zjs.Base {
17
+ constructor(props) {
18
+ super(DEFAULT_PROPS, props);_class.prototype.__init.call(this);;
19
+ }
20
+ /** @hidden */
21
+ __init() {this.getProtoInfo = (idMap) => ({
22
+ component: "timeline",
23
+ key: idMap.getId(this),
24
+ state: this.props.state,
25
+ title: _nullishCoalesce(this.props.title, () => ( void 0)),
26
+ subtitles: _nullishCoalesce(this.props.subtitles, () => ( void 0)),
27
+ source: _nullishCoalesce(this.props.source, () => ( void 0))
28
+ })}
29
+ }, _class);
30
+
31
+
32
+
33
+ exports.Timeline = Timeline;
@@ -0,0 +1,17 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;// src/backend/util/id-map.ts
2
+ var IDMap = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
3
+ __init() {this.idMap = /* @__PURE__ */ new WeakMap()}
4
+ __init2() {this.nextId = 0}
5
+ getId(object) {
6
+ let i = this.idMap.get(object);
7
+ if (i === void 0) {
8
+ i = this.nextId++;
9
+ this.idMap.set(object, i);
10
+ }
11
+ return i;
12
+ }
13
+ }, _class);
14
+
15
+
16
+
17
+ exports.IDMap = IDMap;
@@ -13,6 +13,9 @@ var Base = class {
13
13
  ...props
14
14
  });
15
15
  }
16
+ log = () => {
17
+ return this.parent?.log() || null;
18
+ };
16
19
  get props() {
17
20
  return this._props;
18
21
  }
@@ -45,8 +48,7 @@ var Base = class {
45
48
  if (this.parent) this.parent.updateTree();
46
49
  }
47
50
  /** @hidden */
48
- handleMessage(message) {
49
- console.log("Component Received Message:", message);
51
+ handleMessage(_message) {
50
52
  }
51
53
  routeMessage(_idMap, _message) {
52
54
  }
@@ -113,7 +115,6 @@ var BaseParent = class extends Base {
113
115
  insertBefore(child, beforeChild) {
114
116
  const filteredChildren = this.children.filter((c) => c !== child);
115
117
  let match = filteredChildren.findIndex((c) => c === beforeChild);
116
- console.log("match", match);
117
118
  if (match === -1) {
118
119
  match = filteredChildren.length;
119
120
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-ZCHM3JJJ.mjs";
4
+ } from "./chunk-EDTJ75FT.mjs";
5
5
 
6
6
  // src/backend/components/button.ts
7
7
  var DEFAULT_PROPS = {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-ZCHM3JJJ.mjs";
4
+ } from "./chunk-EDTJ75FT.mjs";
5
5
 
6
6
  // src/backend/components/slider-button.ts
7
7
  var DEFAULT_PROPS = {
@@ -0,0 +1,44 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
2
+
3
+
4
+ var _chunkNZUYU32Zjs = require('./chunk-NZUYU32Z.js');
5
+
6
+ // src/backend/components/text-input.ts
7
+ var DEFAULT_PROPS = {
8
+ value: null
9
+ };
10
+ var TextInput = (_class = class extends _chunkNZUYU32Zjs.Base {
11
+ /** @hidden */
12
+ __init() {this.events = new (0, _chunkNZUYU32Zjs.EventEmitter)()}
13
+ constructor(props) {
14
+ super(DEFAULT_PROPS, props);_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);;
15
+ }
16
+ __init2() {this.addListener = this.events.addListener}
17
+ __init3() {this.removeListener = this.events.removeListener}
18
+ /** @hidden */
19
+ __init4() {this.getProtoInfo = (idMap) => {
20
+ return {
21
+ component: "text-input",
22
+ key: idMap.getId(this),
23
+ value: _nullishCoalesce(this.props.value, () => ( ""))
24
+ };
25
+ }}
26
+ /** @hidden */
27
+ __init5() {this.handleMessage = (message) => {
28
+ if (message.component === "text-input") {
29
+ if (this.props.value !== message.value) {
30
+ this.updateProps({ value: message.value });
31
+ this.events.emit("change", message.value);
32
+ }
33
+ }
34
+ }}
35
+ __init6() {this.getValue = () => this.props.value}
36
+ __init7() {this.getValidatedValue = (validator) => this.props.value === "" ? null : validator(this.props.value || "")}
37
+ __init8() {this.setValue = (value) => {
38
+ this.updateProps({ value });
39
+ }}
40
+ }, _class);
41
+
42
+
43
+
44
+ exports.TextInput = TextInput;
@@ -0,0 +1,66 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
2
+
3
+
4
+ var _chunkNZUYU32Zjs = require('./chunk-NZUYU32Z.js');
5
+
6
+ // src/backend/components/button.ts
7
+ var DEFAULT_PROPS = {
8
+ text: null,
9
+ icon: null,
10
+ mode: "normal",
11
+ error: null
12
+ };
13
+ var Button = (_class = class extends _chunkNZUYU32Zjs.Base {
14
+ /** @hidden */
15
+ __init() {this.events = new (0, _chunkNZUYU32Zjs.EventEmitter)()}
16
+ constructor(props) {
17
+ super(DEFAULT_PROPS, props);_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);;
18
+ }
19
+ __init2() {this.addListener = this.events.addListener}
20
+ __init3() {this.removeListener = this.events.removeListener}
21
+ __init4() {this.setText = (text) => {
22
+ this.updateProps({ text });
23
+ return this;
24
+ }}
25
+ __init5() {this.setIcon = (icon) => {
26
+ this.updateProps({ icon: _nullishCoalesce(icon, () => ( null)) });
27
+ return this;
28
+ }}
29
+ __init6() {this.setMode = (mode) => {
30
+ this.updateProps({
31
+ mode,
32
+ error: null
33
+ });
34
+ return this;
35
+ }}
36
+ /** @hidden */
37
+ __init7() {this.getProtoInfo = (idMap) => {
38
+ return {
39
+ component: "button",
40
+ key: idMap.getId(this),
41
+ text: this.props.text || "",
42
+ state: this.props.error ? { state: "error", error: this.props.error } : { state: this.props.mode },
43
+ icon: _nullishCoalesce(this.props.icon, () => ( void 0))
44
+ };
45
+ }}
46
+ /** @hidden */
47
+ __init8() {this.handleMessage = (message) => {
48
+ if (message.component === "button") {
49
+ this.events.emit("click").then(() => {
50
+ if (this.props.error) {
51
+ this.updateProps({
52
+ error: null
53
+ });
54
+ }
55
+ }).catch((e) => {
56
+ this.updateProps({
57
+ error: `${e}`
58
+ });
59
+ });
60
+ }
61
+ }}
62
+ }, _class);
63
+
64
+
65
+
66
+ exports.Button = Button;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-ZCHM3JJJ.mjs";
4
+ } from "./chunk-EDTJ75FT.mjs";
5
5
 
6
6
  // src/backend/components/text-input.ts
7
7
  var DEFAULT_PROPS = {