@arcanejs/toolkit 0.3.0 → 0.5.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 (76) hide show
  1. package/dist/backend/components/base.d.mts +6 -2
  2. package/dist/backend/components/base.d.ts +6 -2
  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 +2 -4
  18. package/dist/backend/components/rect.d.ts +2 -4
  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 +11 -9
  22. package/dist/backend/components/slider-button.d.ts +11 -9
  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 +9 -2
  26. package/dist/backend/components/switch.d.ts +9 -2
  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/backend/util/index.d.mts +8 -6
  42. package/dist/backend/util/index.d.ts +8 -6
  43. package/dist/backend/util/index.js +13 -1
  44. package/dist/backend/util/index.mjs +12 -0
  45. package/dist/{chunk-QUA3NBLD.js → chunk-4HHKW7VA.js} +4 -4
  46. package/dist/{chunk-J46AJUGE.js → chunk-4X3QY5EP.js} +3 -3
  47. package/dist/chunk-53DEDXHG.js +78 -0
  48. package/dist/{chunk-WXSKMMCV.js → chunk-C2TVGO43.js} +3 -3
  49. package/dist/{chunk-NZUYU32Z.js → chunk-CFO5PSSK.js} +25 -20
  50. package/dist/{chunk-POUQGJN4.mjs → chunk-DBSYI5Z4.mjs} +1 -1
  51. package/dist/{chunk-IW3JCC73.js → chunk-DONU33U4.js} +3 -3
  52. package/dist/{chunk-SMTUN6HG.mjs → chunk-ESMRIWOM.mjs} +2 -2
  53. package/dist/{chunk-TSC5C5XR.js → chunk-FLRGYURV.js} +2 -2
  54. package/dist/{chunk-DV5WTSFW.js → chunk-FUINWM5H.js} +2 -2
  55. package/dist/{chunk-EH73E5FP.mjs → chunk-G5QXW2L3.mjs} +1 -1
  56. package/dist/{chunk-YIXRQHTA.mjs → chunk-H734NV65.mjs} +1 -1
  57. package/dist/{chunk-WIPEQNWR.js → chunk-IQ4SDDYP.js} +3 -3
  58. package/dist/{chunk-7ITSSJE2.mjs → chunk-JOW3XRQI.mjs} +1 -1
  59. package/dist/{chunk-3Y3HRYLC.mjs → chunk-KBPQZJKE.mjs} +1 -1
  60. package/dist/{chunk-NKNDCRUR.mjs → chunk-KR6LSBBX.mjs} +1 -1
  61. package/dist/{chunk-EDTJ75FT.mjs → chunk-PW7QVLLF.mjs} +6 -1
  62. package/dist/chunk-Q3NG5UUN.mjs +61 -0
  63. package/dist/chunk-Q5TEM6MM.js +61 -0
  64. package/dist/{chunk-H2UQDFTS.mjs → chunk-SN2XKRYX.mjs} +30 -11
  65. package/dist/frontend.js +146 -69
  66. package/dist/frontend.js.map +4 -4
  67. package/dist/id-map-DxQ3_gyA.d.mts +7 -0
  68. package/dist/id-map-DxQ3_gyA.d.ts +7 -0
  69. package/dist/index.d.mts +1 -1
  70. package/dist/index.d.ts +1 -1
  71. package/dist/index.js +11 -11
  72. package/dist/index.mjs +10 -10
  73. package/package.json +7 -5
  74. package/dist/chunk-DNCHAOYH.js +0 -42
  75. package/dist/chunk-YN3FZMXY.js +0 -59
  76. package/dist/chunk-YYM7PBRN.mjs +0 -42
@@ -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 as I };
@@ -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 as I };
package/dist/index.d.mts CHANGED
@@ -17,7 +17,7 @@ export { Tab, Tabs } from './backend/components/tabs.mjs';
17
17
  export { TextInput } from './backend/components/text-input.mjs';
18
18
  export { Timeline } from './backend/components/timeline.mjs';
19
19
  import '@arcanejs/protocol/styles';
20
- import './backend/util/index.mjs';
20
+ import './id-map-DxQ3_gyA.mjs';
21
21
 
22
22
  interface Connection {
23
23
  sendMessage(msg: ServerMessage): void;
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export { Tab, Tabs } from './backend/components/tabs.js';
17
17
  export { TextInput } from './backend/components/text-input.js';
18
18
  export { Timeline } from './backend/components/timeline.js';
19
19
  import '@arcanejs/protocol/styles';
20
- import './backend/util/index.js';
20
+ import './id-map-DxQ3_gyA.js';
21
21
 
22
22
  interface Connection {
23
23
  sendMessage(msg: ServerMessage): void;
package/dist/index.js CHANGED
@@ -1,36 +1,36 @@
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; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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;
2
2
 
3
3
 
4
- var _chunkWXSKMMCVjs = require('./chunk-WXSKMMCV.js');
4
+ var _chunkC2TVGO43js = require('./chunk-C2TVGO43.js');
5
5
 
6
6
 
7
- var _chunkIW3JCC73js = require('./chunk-IW3JCC73.js');
7
+ var _chunkDONU33U4js = require('./chunk-DONU33U4.js');
8
8
 
9
9
 
10
- var _chunkDV5WTSFWjs = require('./chunk-DV5WTSFW.js');
10
+ var _chunkFUINWM5Hjs = require('./chunk-FUINWM5H.js');
11
11
 
12
12
 
13
13
  var _chunkEABM5X65js = require('./chunk-EABM5X65.js');
14
14
 
15
15
 
16
- var _chunkJ46AJUGEjs = require('./chunk-J46AJUGE.js');
16
+ var _chunk4X3QY5EPjs = require('./chunk-4X3QY5EP.js');
17
17
 
18
18
 
19
19
 
20
- var _chunkQUA3NBLDjs = require('./chunk-QUA3NBLD.js');
20
+ var _chunk4HHKW7VAjs = require('./chunk-4HHKW7VA.js');
21
21
 
22
22
 
23
- var _chunkTSC5C5XRjs = require('./chunk-TSC5C5XR.js');
23
+ var _chunkFLRGYURVjs = require('./chunk-FLRGYURV.js');
24
24
 
25
25
 
26
- var _chunkWIPEQNWRjs = require('./chunk-WIPEQNWR.js');
26
+ var _chunkIQ4SDDYPjs = require('./chunk-IQ4SDDYP.js');
27
27
 
28
28
 
29
- var _chunkYN3FZMXYjs = require('./chunk-YN3FZMXY.js');
29
+ var _chunk53DEDXHGjs = require('./chunk-53DEDXHG.js');
30
30
 
31
31
 
32
- var _chunkDNCHAOYHjs = require('./chunk-DNCHAOYH.js');
33
- require('./chunk-NZUYU32Z.js');
32
+ var _chunkQ5TEM6MMjs = require('./chunk-Q5TEM6MM.js');
33
+ require('./chunk-CFO5PSSK.js');
34
34
 
35
35
 
36
36
  var _chunk3RG5ZIWIjs = require('./chunk-3RG5ZIWI.js');
@@ -279,4 +279,4 @@ var Toolkit = (_class2 = class {
279
279
 
280
280
 
281
281
 
282
- exports.Button = _chunkJ46AJUGEjs.Button; exports.Group = _chunkQUA3NBLDjs.Group; exports.GroupHeader = _chunkQUA3NBLDjs.GroupHeader; exports.Label = _chunkTSC5C5XRjs.Label; exports.Rect = _chunkWIPEQNWRjs.Rect; exports.SliderButton = _chunkYN3FZMXYjs.SliderButton; exports.Switch = _chunkDNCHAOYHjs.Switch; exports.Tab = _chunkWXSKMMCVjs.Tab; exports.Tabs = _chunkWXSKMMCVjs.Tabs; exports.TextInput = _chunkIW3JCC73js.TextInput; exports.Timeline = _chunkDV5WTSFWjs.Timeline; exports.Toolkit = Toolkit;
282
+ exports.Button = _chunk4X3QY5EPjs.Button; exports.Group = _chunk4HHKW7VAjs.Group; exports.GroupHeader = _chunk4HHKW7VAjs.GroupHeader; exports.Label = _chunkFLRGYURVjs.Label; exports.Rect = _chunkIQ4SDDYPjs.Rect; exports.SliderButton = _chunk53DEDXHGjs.SliderButton; exports.Switch = _chunkQ5TEM6MMjs.Switch; exports.Tab = _chunkC2TVGO43js.Tab; exports.Tabs = _chunkC2TVGO43js.Tabs; exports.TextInput = _chunkDONU33U4js.TextInput; exports.Timeline = _chunkFUINWM5Hjs.Timeline; exports.Toolkit = Toolkit;
package/dist/index.mjs CHANGED
@@ -1,36 +1,36 @@
1
1
  import {
2
2
  Tab,
3
3
  Tabs
4
- } from "./chunk-YIXRQHTA.mjs";
4
+ } from "./chunk-H734NV65.mjs";
5
5
  import {
6
6
  TextInput
7
- } from "./chunk-NKNDCRUR.mjs";
7
+ } from "./chunk-KR6LSBBX.mjs";
8
8
  import {
9
9
  Timeline
10
- } from "./chunk-POUQGJN4.mjs";
10
+ } from "./chunk-DBSYI5Z4.mjs";
11
11
  import {
12
12
  IDMap
13
13
  } from "./chunk-RGHJEMWG.mjs";
14
14
  import {
15
15
  Button
16
- } from "./chunk-EH73E5FP.mjs";
16
+ } from "./chunk-G5QXW2L3.mjs";
17
17
  import {
18
18
  Group,
19
19
  GroupHeader
20
- } from "./chunk-3Y3HRYLC.mjs";
20
+ } from "./chunk-KBPQZJKE.mjs";
21
21
  import {
22
22
  Label
23
- } from "./chunk-7ITSSJE2.mjs";
23
+ } from "./chunk-JOW3XRQI.mjs";
24
24
  import {
25
25
  Rect
26
- } from "./chunk-SMTUN6HG.mjs";
26
+ } from "./chunk-ESMRIWOM.mjs";
27
27
  import {
28
28
  SliderButton
29
- } from "./chunk-H2UQDFTS.mjs";
29
+ } from "./chunk-SN2XKRYX.mjs";
30
30
  import {
31
31
  Switch
32
- } from "./chunk-YYM7PBRN.mjs";
33
- import "./chunk-EDTJ75FT.mjs";
32
+ } from "./chunk-Q3NG5UUN.mjs";
33
+ import "./chunk-PW7QVLLF.mjs";
34
34
  import {
35
35
  __require
36
36
  } from "./chunk-Y6FXYEAI.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcanejs/toolkit",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "description": "Build web-accessible control interfaces for your long-running Node.js processes",
6
6
  "keywords": [
@@ -88,7 +88,8 @@
88
88
  "import": "./dist/backend/util/index.mjs",
89
89
  "require": "./dist/backend/util/index.js",
90
90
  "types": "./dist/backend/util/index.d.ts"
91
- }
91
+ },
92
+ "./package.json": "./package.json"
92
93
  },
93
94
  "devDependencies": {
94
95
  "@types/eslint": "^8.56.5",
@@ -98,6 +99,7 @@
98
99
  "@types/react": "^18",
99
100
  "@types/react-dom": "^18",
100
101
  "@types/ws": "^8.5.12",
102
+ "check-export-map": "^1.3.1",
101
103
  "esbuild": "^0.24.0",
102
104
  "eslint": "^8.57.0",
103
105
  "react": "^18",
@@ -106,7 +108,7 @@
106
108
  "tsup": "^8.1.0",
107
109
  "typescript": "^5.3.3",
108
110
  "@arcanejs/eslint-config": "^0.0.0",
109
- "@arcanejs/toolkit-frontend": "^0.1.0",
111
+ "@arcanejs/toolkit-frontend": "^0.2.0",
110
112
  "@arcanejs/typescript-config": "^0.0.0"
111
113
  },
112
114
  "dependencies": {
@@ -115,7 +117,7 @@
115
117
  "material-symbols": "^0.25.0",
116
118
  "ws": "^8.18.0",
117
119
  "@arcanejs/diff": "^0.4.0",
118
- "@arcanejs/protocol": "^0.2.0"
120
+ "@arcanejs/protocol": "^0.3.0"
119
121
  },
120
122
  "files": [
121
123
  "dist"
@@ -125,7 +127,7 @@
125
127
  },
126
128
  "scripts": {
127
129
  "lint": "eslint . --max-warnings 0",
128
- "build": "pnpm build:backend && pnpm type-check:frontend && pnpm build:frontend",
130
+ "build": "rm -rf dist && pnpm build:backend && pnpm type-check:frontend && pnpm build:frontend && check-export-map",
129
131
  "build:backend": "tsup",
130
132
  "build:frontend": "esbuild src/frontend/frontend.ts --bundle --sourcemap --outfile=dist/frontend.js",
131
133
  "dev": "pnpm dev:backend & pnpm dev:frontend",
@@ -1,42 +0,0 @@
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;
@@ -1,59 +0,0 @@
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/slider-button.ts
7
- var DEFAULT_PROPS = {
8
- value: null,
9
- min: 0,
10
- max: 255,
11
- step: 5,
12
- mode: "writeBack"
13
- };
14
- var SliderButton = (_class = class extends _chunkNZUYU32Zjs.Base {
15
- /** @hidden */
16
- __init() {this.events = new (0, _chunkNZUYU32Zjs.EventEmitter)()}
17
- constructor(props) {
18
- super(DEFAULT_PROPS, props);_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);;
19
- }
20
- __init2() {this.addListener = this.events.addListener}
21
- __init3() {this.removeListener = this.events.removeListener}
22
- /** @hidden */
23
- getProtoInfo(idMap) {
24
- return {
25
- component: "slider_button",
26
- key: idMap.getId(this),
27
- min: this.props.min,
28
- max: this.props.max,
29
- step: this.props.step,
30
- value: this.props.value
31
- };
32
- }
33
- /** @hidden */
34
- handleMessage(message) {
35
- if (message.component !== "slider_button") return;
36
- const newValue = this.sanitizeNumber(message.value);
37
- if (this.props.value === newValue) return;
38
- if (this.props.mode === "writeBack") {
39
- this.updateProps({ value: newValue });
40
- }
41
- this.events.emit("change", newValue);
42
- }
43
- setValue(value) {
44
- const newValue = this.sanitizeNumber(value);
45
- if (newValue === this.props.value) return;
46
- this.updateProps({ value });
47
- this.updateTree();
48
- }
49
- sanitizeNumber(value) {
50
- const i = Math.round((value - this.props.min) / this.props.step);
51
- const v = i * this.props.step + this.props.min;
52
- const clampedValue = Math.max(this.props.min, Math.min(this.props.max, v));
53
- return clampedValue;
54
- }
55
- }, _class);
56
-
57
-
58
-
59
- exports.SliderButton = SliderButton;
@@ -1,42 +0,0 @@
1
- import {
2
- Base,
3
- EventEmitter
4
- } from "./chunk-EDTJ75FT.mjs";
5
-
6
- // src/backend/components/switch.ts
7
- var DEFAULT_PROPS = {
8
- state: "off"
9
- };
10
- var Switch = class extends Base {
11
- /** @hidden */
12
- events = new EventEmitter();
13
- constructor(props) {
14
- super(DEFAULT_PROPS, props);
15
- }
16
- addListener = this.events.addListener;
17
- 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
- };
39
-
40
- export {
41
- Switch
42
- };