@arcanejs/toolkit 0.2.0 → 0.2.2

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 (77) hide show
  1. package/dist/backend/components/base.d.mts +69 -2
  2. package/dist/backend/components/base.d.ts +69 -2
  3. package/dist/backend/components/base.js +10 -188
  4. package/dist/backend/components/base.mjs +2 -1
  5. package/dist/backend/components/button.d.mts +5 -4
  6. package/dist/backend/components/button.d.ts +5 -4
  7. package/dist/backend/components/button.js +5 -165
  8. package/dist/backend/components/button.mjs +3 -2
  9. package/dist/backend/components/group.d.mts +9 -7
  10. package/dist/backend/components/group.d.ts +9 -7
  11. package/dist/backend/components/group.js +6 -282
  12. package/dist/backend/components/group.mjs +3 -2
  13. package/dist/backend/components/label.d.mts +5 -3
  14. package/dist/backend/components/label.d.ts +5 -3
  15. package/dist/backend/components/label.js +5 -102
  16. package/dist/backend/components/label.mjs +3 -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 +5 -102
  20. package/dist/backend/components/rect.mjs +3 -2
  21. package/dist/backend/components/slider-button.d.mts +5 -4
  22. package/dist/backend/components/slider-button.d.ts +5 -4
  23. package/dist/backend/components/slider-button.js +5 -158
  24. package/dist/backend/components/slider-button.mjs +3 -2
  25. package/dist/backend/components/switch.d.mts +5 -4
  26. package/dist/backend/components/switch.d.ts +5 -4
  27. package/dist/backend/components/switch.js +5 -141
  28. package/dist/backend/components/switch.mjs +3 -2
  29. package/dist/backend/components/tabs.d.mts +5 -4
  30. package/dist/backend/components/tabs.d.ts +5 -4
  31. package/dist/backend/components/tabs.js +7 -206
  32. package/dist/backend/components/tabs.mjs +3 -2
  33. package/dist/backend/components/text-input.d.mts +5 -4
  34. package/dist/backend/components/text-input.d.ts +5 -4
  35. package/dist/backend/components/text-input.js +5 -143
  36. package/dist/backend/components/text-input.mjs +3 -2
  37. package/dist/backend/components/timeline.d.mts +6 -5
  38. package/dist/backend/components/timeline.d.ts +6 -5
  39. package/dist/backend/components/timeline.js +5 -106
  40. package/dist/backend/components/timeline.mjs +3 -2
  41. package/dist/backend/util/index.d.mts +7 -0
  42. package/dist/backend/util/index.d.ts +7 -0
  43. package/dist/backend/util/index.js +7 -0
  44. package/dist/backend/util/index.mjs +7 -0
  45. package/dist/{chunk-L243ZOAR.mjs → chunk-3O4P67DM.mjs} +2 -4
  46. package/dist/chunk-3RG5ZIWI.js +10 -0
  47. package/dist/{chunk-37VNFO5S.mjs → chunk-APCR3ITH.mjs} +1 -1
  48. package/dist/chunk-EABM5X65.js +17 -0
  49. package/dist/{chunk-P6X5GIDT.mjs → chunk-HNEUZVCX.mjs} +1 -1
  50. package/dist/{chunk-6LL3X7ZZ.mjs → chunk-IXTM35YM.mjs} +1 -1
  51. package/dist/{chunk-HVFTRNLQ.mjs → chunk-JW4GXS54.mjs} +1 -1
  52. package/dist/chunk-K24YPCR5.js +104 -0
  53. package/dist/chunk-KVJU3EAD.js +66 -0
  54. package/dist/chunk-M6EFK4GP.js +42 -0
  55. package/dist/chunk-MDFDWKGW.js +44 -0
  56. package/dist/chunk-OEIGZ3NQ.js +33 -0
  57. package/dist/chunk-P43QUQ4T.js +29 -0
  58. package/dist/chunk-RGHJEMWG.mjs +17 -0
  59. package/dist/chunk-RGIB65TI.js +29 -0
  60. package/dist/chunk-RJS32OOA.js +55 -0
  61. package/dist/{chunk-DBW4OPGN.mjs → chunk-SOC4TF3J.mjs} +1 -1
  62. package/dist/chunk-T2PJEXYO.js +59 -0
  63. package/dist/{chunk-DP3QFYSS.mjs → chunk-TAZH4BBH.mjs} +1 -1
  64. package/dist/{chunk-3ZBM7Q4A.mjs → chunk-TQ27Y7F4.mjs} +1 -1
  65. package/dist/chunk-UBWCVW2U.js +163 -0
  66. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  67. package/dist/{chunk-HF77PS7J.mjs → chunk-ZCHM3JJJ.mjs} +0 -8
  68. package/dist/{chunk-GQZA5K4M.mjs → chunk-ZU5H6SVA.mjs} +1 -1
  69. package/dist/frontend.js +1345 -398
  70. package/dist/frontend.js.map +4 -4
  71. package/dist/index.d.mts +4 -2
  72. package/dist/index.d.ts +4 -2
  73. package/dist/index.js +82 -658
  74. package/dist/index.mjs +14 -24
  75. package/package.json +10 -2
  76. package/dist/base-BJAPu0O1.d.mts +0 -234
  77. package/dist/base-BJAPu0O1.d.ts +0 -234
@@ -1,5 +1,6 @@
1
- import { e as Base, L as Listenable, I as IDMap, g as Component, d as ClientComponentMessage } from '../../base-BJAPu0O1.js';
2
- import '@arcanejs/diff';
1
+ import * as proto from '@arcanejs/protocol';
2
+ import { IDMap } from '../util/index.js';
3
+ import { Base, Listenable } from './base.js';
3
4
 
4
5
  type Events = {
5
6
  change: (value: string) => void | Promise<void>;
@@ -15,9 +16,9 @@ declare class TextInput extends Base<InternalProps> implements Listenable<Events
15
16
  addListener: <T extends "change">(type: T, listener: Events[T]) => void;
16
17
  removeListener: <T extends "change">(type: T, listener: Events[T]) => void;
17
18
  /** @hidden */
18
- getProtoInfo: (idMap: IDMap) => Component;
19
+ getProtoInfo: (idMap: IDMap) => proto.Component;
19
20
  /** @hidden */
20
- handleMessage: (message: ClientComponentMessage) => void;
21
+ handleMessage: (message: proto.ClientComponentMessage) => void;
21
22
  getValue: () => string | null;
22
23
  getValidatedValue: <T>(validator: (text: string) => T) => null | T;
23
24
  setValue: (value: string) => void;
@@ -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 _chunkMDFDWKGWjs = require('../../chunk-MDFDWKGW.js');
4
+ require('../../chunk-UBWCVW2U.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 = _chunkMDFDWKGWjs.TextInput;
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  TextInput
3
- } from "../../chunk-6LL3X7ZZ.mjs";
4
- import "../../chunk-HF77PS7J.mjs";
3
+ } from "../../chunk-IXTM35YM.mjs";
4
+ import "../../chunk-ZCHM3JJJ.mjs";
5
+ import "../../chunk-Y6FXYEAI.mjs";
5
6
  export {
6
7
  TextInput
7
8
  };
@@ -1,17 +1,18 @@
1
- import { e as Base, I as IDMap, g as Component, j as TimelineState, k as TimelineComponent } from '../../base-BJAPu0O1.mjs';
2
- import '@arcanejs/diff';
1
+ import * as proto from '@arcanejs/protocol';
2
+ import { IDMap } from '../util/index.mjs';
3
+ import { Base } from './base.mjs';
3
4
 
4
5
  type InternalProps = {
5
- state: TimelineState;
6
+ state: proto.TimelineState;
6
7
  title: string | null;
7
8
  subtitles: string[] | null;
8
- source: TimelineComponent['source'] | null;
9
+ source: proto.TimelineComponent['source'] | null;
9
10
  };
10
11
  type Props = Partial<InternalProps>;
11
12
  declare class Timeline extends Base<InternalProps> {
12
13
  constructor(props?: Props);
13
14
  /** @hidden */
14
- getProtoInfo: (idMap: IDMap) => Component;
15
+ getProtoInfo: (idMap: IDMap) => proto.Component;
15
16
  }
16
17
 
17
18
  export { type Props, Timeline };
@@ -1,17 +1,18 @@
1
- import { e as Base, I as IDMap, g as Component, j as TimelineState, k as TimelineComponent } from '../../base-BJAPu0O1.js';
2
- import '@arcanejs/diff';
1
+ import * as proto from '@arcanejs/protocol';
2
+ import { IDMap } from '../util/index.js';
3
+ import { Base } from './base.js';
3
4
 
4
5
  type InternalProps = {
5
- state: TimelineState;
6
+ state: proto.TimelineState;
6
7
  title: string | null;
7
8
  subtitles: string[] | null;
8
- source: TimelineComponent['source'] | null;
9
+ source: proto.TimelineComponent['source'] | null;
9
10
  };
10
11
  type Props = Partial<InternalProps>;
11
12
  declare class Timeline extends Base<InternalProps> {
12
13
  constructor(props?: Props);
13
14
  /** @hidden */
14
- getProtoInfo: (idMap: IDMap) => Component;
15
+ getProtoInfo: (idMap: IDMap) => proto.Component;
15
16
  }
16
17
 
17
18
  export { type Props, Timeline };
@@ -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 _chunkOEIGZ3NQjs = require('../../chunk-OEIGZ3NQ.js');
4
+ require('../../chunk-UBWCVW2U.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 = _chunkOEIGZ3NQjs.Timeline;
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  Timeline
3
- } from "../../chunk-DBW4OPGN.mjs";
4
- import "../../chunk-HF77PS7J.mjs";
3
+ } from "../../chunk-SOC4TF3J.mjs";
4
+ import "../../chunk-ZCHM3JJJ.mjs";
5
+ import "../../chunk-Y6FXYEAI.mjs";
5
6
  export {
6
7
  Timeline
7
8
  };
@@ -0,0 +1,7 @@
1
+ declare class IDMap {
2
+ private readonly idMap;
3
+ private nextId;
4
+ getId(object: object): number;
5
+ }
6
+
7
+ export { IDMap };
@@ -0,0 +1,7 @@
1
+ declare class IDMap {
2
+ private readonly idMap;
3
+ private nextId;
4
+ getId(object: object): number;
5
+ }
6
+
7
+ export { IDMap };
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkEABM5X65js = require('../../chunk-EABM5X65.js');
4
+ require('../../chunk-3RG5ZIWI.js');
5
+
6
+
7
+ exports.IDMap = _chunkEABM5X65js.IDMap;
@@ -0,0 +1,7 @@
1
+ import {
2
+ IDMap
3
+ } from "../../chunk-RGHJEMWG.mjs";
4
+ import "../../chunk-Y6FXYEAI.mjs";
5
+ export {
6
+ IDMap
7
+ };
@@ -1,14 +1,12 @@
1
1
  import {
2
2
  BaseParent,
3
3
  EventEmitter
4
- } from "./chunk-HF77PS7J.mjs";
4
+ } from "./chunk-ZCHM3JJJ.mjs";
5
5
 
6
- // src/shared/styles.ts
6
+ // src/backend/components/group.ts
7
7
  var GROUP_DEFAULT_STYLE = {
8
8
  direction: "horizontal"
9
9
  };
10
-
11
- // src/backend/components/group.ts
12
10
  var DEFAULT_PROPS = {
13
11
  ...GROUP_DEFAULT_STYLE,
14
12
  title: null,
@@ -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
  Base,
3
3
  EventEmitter
4
- } from "./chunk-HF77PS7J.mjs";
4
+ } from "./chunk-ZCHM3JJJ.mjs";
5
5
 
6
6
  // src/backend/components/switch.ts
7
7
  var DEFAULT_PROPS = {
@@ -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;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Base
3
- } from "./chunk-HF77PS7J.mjs";
3
+ } from "./chunk-ZCHM3JJJ.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-HF77PS7J.mjs";
4
+ } from "./chunk-ZCHM3JJJ.mjs";
5
5
 
6
6
  // src/backend/components/text-input.ts
7
7
  var DEFAULT_PROPS = {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Base,
3
3
  EventEmitter
4
- } from "./chunk-HF77PS7J.mjs";
4
+ } from "./chunk-ZCHM3JJJ.mjs";
5
5
 
6
6
  // src/backend/components/slider-button.ts
7
7
  var DEFAULT_PROPS = {
@@ -0,0 +1,104 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class; var _class2;
2
+
3
+
4
+ var _chunkUBWCVW2Ujs = require('./chunk-UBWCVW2U.js');
5
+
6
+ // src/backend/components/group.ts
7
+ var GROUP_DEFAULT_STYLE = {
8
+ direction: "horizontal"
9
+ };
10
+ var DEFAULT_PROPS = {
11
+ ...GROUP_DEFAULT_STYLE,
12
+ title: null,
13
+ labels: null
14
+ };
15
+ var GroupHeader = (_class = class extends _chunkUBWCVW2Ujs.BaseParent {constructor(...args) { super(...args); _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
16
+ __init() {this.validateChildren = () => {
17
+ }}
18
+ /** @hidden */
19
+ __init2() {this.getProtoInfo = (idMap) => ({
20
+ component: "group-header",
21
+ key: idMap.getId(this),
22
+ children: this.getChildren().map((c) => c.getProtoInfo(idMap))
23
+ })}
24
+ }, _class);
25
+ var Group = (_class2 = class extends _chunkUBWCVW2Ujs.BaseParent {
26
+ /** @hidden */
27
+ __init3() {this.events = new (0, _chunkUBWCVW2Ujs.EventEmitter)()}
28
+ constructor(props) {
29
+ super(DEFAULT_PROPS, props);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_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);_class2.prototype.__init12.call(this);_class2.prototype.__init13.call(this);_class2.prototype.__init14.call(this);_class2.prototype.__init15.call(this);;
30
+ }
31
+ __init4() {this.addListener = this.events.addListener}
32
+ __init5() {this.removeListener = this.events.removeListener}
33
+ __init6() {this.validateChildren = () => {
34
+ }}
35
+ __init7() {this.setOptions = (options) => {
36
+ this.updateProps(options);
37
+ }}
38
+ __init8() {this.setTitle = (title) => {
39
+ this.updateProps({ title });
40
+ }}
41
+ __init9() {this.addLabel = (label) => {
42
+ this.updateProps({ labels: [...this.props.labels || [], label] });
43
+ }}
44
+ __init10() {this.setLabels = (labels) => {
45
+ this.updateProps({ labels });
46
+ }}
47
+ __init11() {this.addHeaderChild = (child) => {
48
+ const header = new GroupHeader({});
49
+ header.appendChild(child);
50
+ this.appendChild(header);
51
+ return child;
52
+ }}
53
+ __init12() {this.removeHeaderChild = (child) => {
54
+ for (const c of this.getChildren()) {
55
+ if (c instanceof GroupHeader) {
56
+ c.removeChild(child);
57
+ }
58
+ }
59
+ }}
60
+ __init13() {this.removeAllHeaderChildren = () => {
61
+ for (const child of this.getChildren()) {
62
+ if (child instanceof GroupHeader) {
63
+ child.removeAllChildren();
64
+ }
65
+ }
66
+ }}
67
+ /** @hidden */
68
+ __init14() {this.getProtoInfo = (idMap) => {
69
+ const children = [];
70
+ const headers = [];
71
+ for (const c of this.getChildren()) {
72
+ const childProto = c.getProtoInfo(idMap);
73
+ if (childProto.component === "group-header") {
74
+ headers.push(childProto);
75
+ } else {
76
+ children.push(childProto);
77
+ }
78
+ }
79
+ return {
80
+ component: "group",
81
+ key: idMap.getId(this),
82
+ title: _nullishCoalesce(this.props.title, () => ( void 0)),
83
+ direction: this.props.direction,
84
+ border: this.props.border,
85
+ wrap: this.props.wrap,
86
+ children,
87
+ headers: headers.length > 0 ? headers : void 0,
88
+ labels: _nullishCoalesce(this.props.labels, () => ( void 0)),
89
+ editableTitle: this.props.editableTitle || false,
90
+ defaultCollapsibleState: this.props.defaultCollapsibleState
91
+ };
92
+ }}
93
+ /** @hidden */
94
+ __init15() {this.handleMessage = (message) => {
95
+ if (message.component === "group") {
96
+ this.events.emit("title-changed", message.title);
97
+ }
98
+ }}
99
+ }, _class2);
100
+
101
+
102
+
103
+
104
+ exports.GroupHeader = GroupHeader; exports.Group = Group;
@@ -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 _chunkUBWCVW2Ujs = require('./chunk-UBWCVW2U.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 _chunkUBWCVW2Ujs.Base {
14
+ /** @hidden */
15
+ __init() {this.events = new (0, _chunkUBWCVW2Ujs.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;