@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
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import * as _arcanejs_protocol_logging from '@arcanejs/protocol/logging';
2
+ import { Logger } from '@arcanejs/protocol/logging';
1
3
  import _ from 'lodash';
2
4
  import * as http from 'http';
3
5
  import { Application } from 'express';
@@ -5,7 +7,7 @@ import { WebSocket } from 'ws';
5
7
  import { ClientMessage, ServerMessage } from '@arcanejs/protocol';
6
8
  import { Group } from './backend/components/group.mjs';
7
9
  export { GroupHeader } from './backend/components/group.mjs';
8
- import { Component } from './backend/components/base.mjs';
10
+ import { Parent, Component } from './backend/components/base.mjs';
9
11
  export { Button } from './backend/components/button.mjs';
10
12
  export { Label } from './backend/components/label.mjs';
11
13
  export { Rect } from './backend/components/rect.mjs';
@@ -25,7 +27,8 @@ declare class Server {
25
27
  private readonly onNewConnection;
26
28
  private readonly onClosedConnection;
27
29
  private readonly onMessage;
28
- constructor(options: LightDeskOptions, onNewConnection: (connection: Connection) => void, onClosedConnection: (connection: Connection) => void, onMessage: (connection: Connection, message: ClientMessage) => void);
30
+ private readonly log?;
31
+ constructor(options: LightDeskOptions, onNewConnection: (connection: Connection) => void, onClosedConnection: (connection: Connection) => void, onMessage: (connection: Connection, message: ClientMessage) => void, log?: Logger | undefined);
29
32
  handleHttpRequest: (req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
30
33
  private sendStaticFile;
31
34
  handleWsConnection: <S extends WebSocket>(ws: S) => void;
@@ -38,12 +41,26 @@ interface LightDeskOptions {
38
41
  * This is important if a express server will be used that serves other paths.
39
42
  */
40
43
  path: string;
44
+ /**
45
+ * An optional object that can be used to output log events,
46
+ * we recommend using `pino` for this,
47
+ * as log levels etc... can be controlled.
48
+ *
49
+ * You can also always use `console` for logging,
50
+ * but this will be quite verbose.
51
+ */
52
+ log?: Logger;
41
53
  }
42
54
  type InitializationOptions =
43
55
  /** automatically start a simple */
44
56
  {
45
57
  mode: 'automatic';
46
58
  port: number;
59
+ /**
60
+ * Optional callback that is called when the server is ready,
61
+ * with the url that the server is running on.
62
+ */
63
+ onReady?: (url: string) => void;
47
64
  }
48
65
  /** Create a websocket server that attaches to an existing express and http server */
49
66
  | {
@@ -57,7 +74,7 @@ type InitializationOptions =
57
74
  setup: (server: Server) => void;
58
75
  };
59
76
 
60
- declare class Toolkit {
77
+ declare class Toolkit implements Parent {
61
78
  private readonly options;
62
79
  /**
63
80
  * Mapping from components to unique IDs that identify them
@@ -68,6 +85,7 @@ declare class Toolkit {
68
85
  constructor(options?: Partial<LightDeskOptions>);
69
86
  start: (opts: InitializationOptions) => void;
70
87
  setRoot: (group: Group) => void;
88
+ log(): _arcanejs_protocol_logging.Logger | null;
71
89
  updateTree: _.DebouncedFuncLeading<() => void>;
72
90
  removeChild: (component: Component) => void;
73
91
  private onNewConnection;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import * as _arcanejs_protocol_logging from '@arcanejs/protocol/logging';
2
+ import { Logger } from '@arcanejs/protocol/logging';
1
3
  import _ from 'lodash';
2
4
  import * as http from 'http';
3
5
  import { Application } from 'express';
@@ -5,7 +7,7 @@ import { WebSocket } from 'ws';
5
7
  import { ClientMessage, ServerMessage } from '@arcanejs/protocol';
6
8
  import { Group } from './backend/components/group.js';
7
9
  export { GroupHeader } from './backend/components/group.js';
8
- import { Component } from './backend/components/base.js';
10
+ import { Parent, Component } from './backend/components/base.js';
9
11
  export { Button } from './backend/components/button.js';
10
12
  export { Label } from './backend/components/label.js';
11
13
  export { Rect } from './backend/components/rect.js';
@@ -25,7 +27,8 @@ declare class Server {
25
27
  private readonly onNewConnection;
26
28
  private readonly onClosedConnection;
27
29
  private readonly onMessage;
28
- constructor(options: LightDeskOptions, onNewConnection: (connection: Connection) => void, onClosedConnection: (connection: Connection) => void, onMessage: (connection: Connection, message: ClientMessage) => void);
30
+ private readonly log?;
31
+ constructor(options: LightDeskOptions, onNewConnection: (connection: Connection) => void, onClosedConnection: (connection: Connection) => void, onMessage: (connection: Connection, message: ClientMessage) => void, log?: Logger | undefined);
29
32
  handleHttpRequest: (req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
30
33
  private sendStaticFile;
31
34
  handleWsConnection: <S extends WebSocket>(ws: S) => void;
@@ -38,12 +41,26 @@ interface LightDeskOptions {
38
41
  * This is important if a express server will be used that serves other paths.
39
42
  */
40
43
  path: string;
44
+ /**
45
+ * An optional object that can be used to output log events,
46
+ * we recommend using `pino` for this,
47
+ * as log levels etc... can be controlled.
48
+ *
49
+ * You can also always use `console` for logging,
50
+ * but this will be quite verbose.
51
+ */
52
+ log?: Logger;
41
53
  }
42
54
  type InitializationOptions =
43
55
  /** automatically start a simple */
44
56
  {
45
57
  mode: 'automatic';
46
58
  port: number;
59
+ /**
60
+ * Optional callback that is called when the server is ready,
61
+ * with the url that the server is running on.
62
+ */
63
+ onReady?: (url: string) => void;
47
64
  }
48
65
  /** Create a websocket server that attaches to an existing express and http server */
49
66
  | {
@@ -57,7 +74,7 @@ type InitializationOptions =
57
74
  setup: (server: Server) => void;
58
75
  };
59
76
 
60
- declare class Toolkit {
77
+ declare class Toolkit implements Parent {
61
78
  private readonly options;
62
79
  /**
63
80
  * Mapping from components to unique IDs that identify them
@@ -68,6 +85,7 @@ declare class Toolkit {
68
85
  constructor(options?: Partial<LightDeskOptions>);
69
86
  start: (opts: InitializationOptions) => void;
70
87
  setRoot: (group: Group) => void;
88
+ log(): _arcanejs_protocol_logging.Logger | null;
71
89
  updateTree: _.DebouncedFuncLeading<() => void>;
72
90
  removeChild: (component: Component) => void;
73
91
  private onNewConnection;