@lukaskj/xmonkey 2.0.1 → 2.0.3

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 (80) hide show
  1. package/dist/build.js +8 -0
  2. package/dist/{cjs/decorators → decorators}/console-script.decorator.d.ts +1 -1
  3. package/dist/{esm/decorators → decorators}/console-script.decorator.js +1 -1
  4. package/dist/{cjs/decorators → decorators}/ui-script.decorator.d.ts +2 -2
  5. package/dist/decorators/ui-script.decorator.js +20 -0
  6. package/dist/esbuild/build.js +26 -0
  7. package/dist/esbuild/plugins/xmonkey-strip-metadata-plugin.js +77 -0
  8. package/dist/esbuild/plugins/xmonkey-styles-plugin.js +34 -0
  9. package/dist/{cjs/example-scripts → example-scripts}/example-console-script.d.ts +1 -1
  10. package/dist/example-scripts/example-console-script.js +28 -0
  11. package/dist/{cjs/example-scripts → example-scripts}/example-ui-script.d.ts +1 -1
  12. package/dist/{esm/example-scripts → example-scripts}/example-ui-script.js +20 -23
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.js +4 -0
  15. package/dist/interfaces/console-script.interface.js +3 -0
  16. package/dist/styles/_colors.scss +13 -0
  17. package/dist/styles/_variables.scss +9 -0
  18. package/dist/styles/base.scss +4 -0
  19. package/dist/styles/lit/_base.scss +173 -0
  20. package/dist/styles/lit/_util.scss +340 -0
  21. package/dist/styles/lit/index.scss +2 -0
  22. package/dist/styles/utils.css +70 -0
  23. package/dist/styles/xmonkey-wrapper.scss +59 -0
  24. package/dist/types.js +1 -0
  25. package/dist/{esm/utils → utils}/is-null-or-undefined.js +1 -1
  26. package/dist/utils/sleep.js +3 -0
  27. package/dist/{esm/ui/x-monkey-window-component.js → x-monkey-window-component.js} +5 -6
  28. package/package.json +11 -9
  29. package/dist/cjs/decorators/console-script.decorator.js +0 -13
  30. package/dist/cjs/decorators/ui-script.decorator.js +0 -25
  31. package/dist/cjs/esbuild/build.js +0 -100
  32. package/dist/cjs/esbuild/plugins/xmonkey-strip-metadata-plugin.js +0 -142
  33. package/dist/cjs/esbuild/plugins/xmonkey-styles-plugin.js +0 -85
  34. package/dist/cjs/example-scripts/example-console-script.js +0 -87
  35. package/dist/cjs/example-scripts/example-ui-script.js +0 -40
  36. package/dist/cjs/index.d.ts +0 -3
  37. package/dist/cjs/index.js +0 -27
  38. package/dist/cjs/interfaces/console-script.interface.js +0 -7
  39. package/dist/cjs/interfaces/index.d.ts +0 -2
  40. package/dist/cjs/interfaces/index.js +0 -18
  41. package/dist/cjs/interfaces/ui-script.interface.js +0 -2
  42. package/dist/cjs/types.js +0 -2
  43. package/dist/cjs/ui/x-monkey-window-component.js +0 -18
  44. package/dist/cjs/utils/is-null-or-undefined.js +0 -9
  45. package/dist/cjs/utils/sleep.js +0 -7
  46. package/dist/esm/decorators/console-script.decorator.d.ts +0 -3
  47. package/dist/esm/decorators/ui-script.decorator.d.ts +0 -4
  48. package/dist/esm/decorators/ui-script.decorator.js +0 -21
  49. package/dist/esm/esbuild/build.d.ts +0 -1
  50. package/dist/esm/esbuild/build.js +0 -73
  51. package/dist/esm/esbuild/plugins/xmonkey-strip-metadata-plugin.d.ts +0 -2
  52. package/dist/esm/esbuild/plugins/xmonkey-strip-metadata-plugin.js +0 -138
  53. package/dist/esm/esbuild/plugins/xmonkey-styles-plugin.d.ts +0 -2
  54. package/dist/esm/esbuild/plugins/xmonkey-styles-plugin.js +0 -81
  55. package/dist/esm/example-scripts/example-console-script.d.ts +0 -4
  56. package/dist/esm/example-scripts/example-console-script.js +0 -84
  57. package/dist/esm/example-scripts/example-ui-script.d.ts +0 -6
  58. package/dist/esm/index.d.ts +0 -3
  59. package/dist/esm/index.js +0 -11
  60. package/dist/esm/interfaces/console-script.interface.d.ts +0 -6
  61. package/dist/esm/interfaces/console-script.interface.js +0 -6
  62. package/dist/esm/interfaces/index.d.ts +0 -2
  63. package/dist/esm/interfaces/index.js +0 -2
  64. package/dist/esm/interfaces/ui-script.interface.d.ts +0 -5
  65. package/dist/esm/types.d.ts +0 -28
  66. package/dist/esm/ui/x-monkey-window-component.d.ts +0 -7
  67. package/dist/esm/utils/is-null-or-undefined.d.ts +0 -2
  68. package/dist/esm/utils/sleep.d.ts +0 -1
  69. package/dist/esm/utils/sleep.js +0 -3
  70. /package/dist/{esm/interfaces/ui-script.interface.js → build.d.ts} +0 -0
  71. /package/dist/{cjs/esbuild → esbuild}/build.d.ts +0 -0
  72. /package/dist/{cjs/esbuild → esbuild}/plugins/xmonkey-strip-metadata-plugin.d.ts +0 -0
  73. /package/dist/{cjs/esbuild → esbuild}/plugins/xmonkey-styles-plugin.d.ts +0 -0
  74. /package/dist/{cjs/interfaces → interfaces}/console-script.interface.d.ts +0 -0
  75. /package/dist/{cjs/interfaces → interfaces}/ui-script.interface.d.ts +0 -0
  76. /package/dist/{esm/types.js → interfaces/ui-script.interface.js} +0 -0
  77. /package/dist/{cjs/types.d.ts → types.d.ts} +0 -0
  78. /package/dist/{cjs/utils → utils}/is-null-or-undefined.d.ts +0 -0
  79. /package/dist/{cjs/utils → utils}/sleep.d.ts +0 -0
  80. /package/dist/{cjs/ui/x-monkey-window-component.d.ts → x-monkey-window-component.d.ts} +0 -0
@@ -0,0 +1,340 @@
1
+ @use "../variables" as vars;
2
+ @use "../colors";
3
+
4
+ ##{vars.$xmonkey-wrapper} {
5
+ /*Colors*/
6
+
7
+ .white {
8
+ color: #fff;
9
+ }
10
+ .bg-white {
11
+ background-color: #fff;
12
+ }
13
+ .b-white {
14
+ border-color: #fff;
15
+ }
16
+ .gray {
17
+ color: colors.$gray;
18
+ }
19
+ .bg-gray {
20
+ background-color: colors.$gray;
21
+ }
22
+ .b-gray {
23
+ border-color: colors.$gray;
24
+ }
25
+ .black {
26
+ color: #000;
27
+ }
28
+ .bg-black {
29
+ background-color: #000;
30
+ }
31
+ .b-black {
32
+ border-color: #000;
33
+ }
34
+ .accent {
35
+ color: colors.$secondary;
36
+ }
37
+ .bg-accent {
38
+ background-color: colors.$secondary;
39
+ }
40
+ .b-accent {
41
+ border-color: colors.$secondary;
42
+ }
43
+ .warning {
44
+ color: colors.$warning;
45
+ }
46
+ .bg-warning {
47
+ background-color: colors.$warning;
48
+ }
49
+ .b-warning {
50
+ border-color: colors.$warning;
51
+ }
52
+ .error {
53
+ color: colors.$error;
54
+ }
55
+ .bg-error {
56
+ background-color: colors.$error;
57
+ }
58
+ .b-error {
59
+ border-color: colors.$error;
60
+ }
61
+ .success {
62
+ color: colors.$success;
63
+ }
64
+ .bg-success {
65
+ background-color: colors.$success;
66
+ }
67
+ .b-success {
68
+ border-color: colors.$success;
69
+ }
70
+ .info {
71
+ color: colors.$info;
72
+ }
73
+ .bg-info {
74
+ background-color: colors.$info;
75
+ }
76
+ .b-info {
77
+ border-color: colors.$info;
78
+ }
79
+ .bg-primary {
80
+ background-color: colors.$primary;
81
+ }
82
+ .b-primary {
83
+ border-color: colors.$primary;
84
+ }
85
+
86
+ /*Margin+Padding*/
87
+
88
+ .m0 {
89
+ margin: 0;
90
+ }
91
+
92
+ .m1 {
93
+ margin: 0.5em;
94
+ }
95
+
96
+ .m2 {
97
+ margin: 1em;
98
+ }
99
+
100
+ .m3 {
101
+ margin: 2em;
102
+ }
103
+
104
+ .m4 {
105
+ margin: 4em;
106
+ }
107
+
108
+ .mt0 {
109
+ margin-top: 0;
110
+ }
111
+
112
+ .mt1 {
113
+ margin-top: 0.5em;
114
+ }
115
+
116
+ .mt2 {
117
+ margin-top: 1em;
118
+ }
119
+
120
+ .mt3 {
121
+ margin-top: 2em;
122
+ }
123
+
124
+ .mt4 {
125
+ margin-top: 4em;
126
+ }
127
+
128
+ .mr0 {
129
+ margin-right: 0;
130
+ }
131
+
132
+ .mr1 {
133
+ margin-right: 0.5em;
134
+ }
135
+
136
+ .mr2 {
137
+ margin-right: 1em;
138
+ }
139
+
140
+ .mr3 {
141
+ margin-right: 2em;
142
+ }
143
+
144
+ .mr4 {
145
+ margin-right: 4em;
146
+ }
147
+
148
+ .mb0 {
149
+ margin-bottom: 0;
150
+ }
151
+
152
+ .mb1 {
153
+ margin-bottom: 0.5em;
154
+ }
155
+
156
+ .mb2 {
157
+ margin-bottom: 1em;
158
+ }
159
+
160
+ .mb3 {
161
+ margin-bottom: 2em;
162
+ }
163
+
164
+ .mb4 {
165
+ margin-bottom: 4em;
166
+ }
167
+
168
+ .ml0 {
169
+ margin-left: 0;
170
+ }
171
+
172
+ .ml1 {
173
+ margin-left: 0.5em;
174
+ }
175
+
176
+ .ml2 {
177
+ margin-left: 1em;
178
+ }
179
+
180
+ .ml3 {
181
+ margin-left: 2em;
182
+ }
183
+
184
+ .ml4 {
185
+ margin-left: 4em;
186
+ }
187
+
188
+ .p0 {
189
+ padding: 0;
190
+ }
191
+
192
+ .p1 {
193
+ padding: 0.5em;
194
+ }
195
+
196
+ .p2 {
197
+ padding: 1em;
198
+ }
199
+
200
+ .p3 {
201
+ padding: 2em;
202
+ }
203
+
204
+ .p4 {
205
+ padding: 4em;
206
+ }
207
+
208
+ .pv0 {
209
+ padding-top: 0;
210
+ padding-bottom: 0;
211
+ }
212
+
213
+ .pv1 {
214
+ padding-top: 0.5em;
215
+ padding-bottom: 0.5em;
216
+ }
217
+
218
+ .pv2 {
219
+ padding-top: 1em;
220
+ padding-bottom: 1em;
221
+ }
222
+
223
+ .pv3 {
224
+ padding-top: 2em;
225
+ padding-bottom: 2em;
226
+ }
227
+
228
+ .pv4 {
229
+ padding-top: 4em;
230
+ padding-bottom: 4em;
231
+ }
232
+
233
+ .ph0 {
234
+ padding-right: 0;
235
+ padding-left: 0;
236
+ }
237
+
238
+ .ph1 {
239
+ padding-right: 0.5em;
240
+ padding-left: 0.5em;
241
+ }
242
+
243
+ .ph2 {
244
+ padding-right: 1em;
245
+ padding-left: 1em;
246
+ }
247
+
248
+ .ph3 {
249
+ padding-right: 2em;
250
+ padding-left: 2em;
251
+ }
252
+
253
+ .ph4 {
254
+ padding-right: 4em;
255
+ padding-left: 4em;
256
+ }
257
+
258
+ /*Misc Utilities*/
259
+ .gapless {
260
+ border-spacing: 0;
261
+ }
262
+ .vc {
263
+ position: relative;
264
+ top: 40%;
265
+ transform: perspective(1px) translateY(-45%);
266
+ }
267
+ .pill {
268
+ border-radius: 9999px;
269
+ }
270
+ .rounded {
271
+ border-radius: 4px;
272
+ }
273
+ .tc {
274
+ text-align: center;
275
+ }
276
+ .mega {
277
+ font-size: 3.5em;
278
+ }
279
+ .large {
280
+ font-size: 1.5em;
281
+ }
282
+ .small {
283
+ font-size: 0.8em;
284
+ }
285
+ .caps {
286
+ text-transform: uppercase;
287
+ }
288
+ .tracked {
289
+ letter-spacing: 0.1em;
290
+ }
291
+ .vh-100 {
292
+ height: 100vh;
293
+ }
294
+
295
+ .inline {
296
+ display: inline-block;
297
+ }
298
+ .bold {
299
+ font-weight: 700;
300
+ }
301
+ .normal {
302
+ font-weight: 400;
303
+ }
304
+ .light {
305
+ font-weight: 300;
306
+ }
307
+ .dim {
308
+ opacity: 1;
309
+ transition: opacity 0.15s ease-in;
310
+ }
311
+
312
+ .dim:hover,
313
+ .dim:focus {
314
+ opacity: 0.5;
315
+ transition: opacity 0.15s ease-in;
316
+ }
317
+ .ta-center {
318
+ text-align: center;
319
+ }
320
+ .ta-left {
321
+ text-align: left;
322
+ }
323
+ .ta-right {
324
+ text-align: right;
325
+ }
326
+
327
+ .w-10 {width: 10% !important;}
328
+ .w-20 {width: 20% !important;}
329
+ .w-30 {width: 30% !important;}
330
+ .w-40 {width: 40% !important;}
331
+ .w-48 {width: 48% !important;}
332
+ .w-50 {width: 50% !important;}
333
+ .w-60 {width: 60% !important;}
334
+ .w-70 {width: 70% !important;}
335
+ .w-80 {width: 80% !important;}
336
+ .w-90 {width: 90% !important;}
337
+ .w-100 {width: 100% !important;}
338
+ .fg-0 {flex-grow: 0!important;}
339
+ .fg-1 {flex-grow: 1!important;}
340
+ }
@@ -0,0 +1,2 @@
1
+ @use "base";
2
+ @use "util";
@@ -0,0 +1,70 @@
1
+ /* https://gist.github.com/jonsuh/b2347347480105874cda110b2afc53f4 */
2
+ /* Flexbox
3
+ // ================================================== */
4
+ .d--f { display: flex !important; flex-direction: column; }
5
+ .d--if { display: inline-flex !important; flex-direction: column; }
6
+
7
+ /* Flex direction */
8
+ .fd--r { flex-direction: row; } /* Default */
9
+ .fd--rr { flex-direction: row-reverse; }
10
+ .fd--c { flex-direction: column; }
11
+ .fd--cr { flex-direction: column-reverse; }
12
+
13
+
14
+ /* Flex wrap */
15
+ .fw--n { flex-wrap: nowrap; } /* Default */
16
+ .fw--w { flex-wrap: wrap; }
17
+ .fw--wr { flex-wrap: wrap-reverse; }
18
+
19
+
20
+ /* Justify content */
21
+ .jc--fe { justify-content: flex-end; }
22
+ .jc--fs { justify-content: flex-start; } /* Default */
23
+ .jc--c { justify-content: center; }
24
+ .jc--sa { justify-content: space-around; }
25
+ .jc--sb { justify-content: space-between; }
26
+
27
+
28
+ /* Align items */
29
+ .ai--fs { align-items: flex-start; }
30
+ .ai--c { align-items: center; }
31
+ .ai--fe { align-items: flex-end; }
32
+ .ai--s { align-items: stretch; } /* Default */
33
+ .ai--b { align-items: baseline; }
34
+
35
+
36
+ /* Flex grow */
37
+ .fg--0 { flex-grow: 0; } /* Default */
38
+ .fg--1 { flex-grow: 1; }
39
+
40
+
41
+ /* Flex shrink */
42
+ .fs--0 { flex-shrink: 0; }
43
+ .fs--1 { flex-shrink: 1; } /* Default */
44
+
45
+
46
+ /* Flex basis */
47
+ .fb--a { flex-basis: auto; } /* Default */
48
+ .fb--0 { flex-basis: 0; }
49
+
50
+
51
+ /* Align self */
52
+ .as--a { align-self: auto; } /* Default */
53
+ .as--fs { align-self: flex-start; }
54
+ .as--c { align-self: center; }
55
+ .as--fe { align-self: flex-end; }
56
+ .as--s { align-self: stretch; }
57
+ .as--b { align-self: baseline }
58
+
59
+
60
+ .noselect {
61
+ -webkit-touch-callout: none; /* iOS Safari */
62
+ -webkit-user-select: none; /* Safari */
63
+ -khtml-user-select: none; /* Konqueror HTML */
64
+ -moz-user-select: none; /* Old versions of Firefox */
65
+ -ms-user-select: none; /* Internet Explorer/Edge */
66
+ user-select: none; /* Non-prefixed version, currently
67
+ supported by Chrome, Edge, Opera and Firefox */
68
+ }
69
+
70
+ .hidden {display: none !important;}
@@ -0,0 +1,59 @@
1
+ @use "variables" as vars;
2
+ @use "colors";
3
+
4
+ ##{vars.$xmonkey-wrapper} {
5
+ width: 250px;
6
+ position: absolute;
7
+ top: 10px;
8
+ left: 10px;
9
+ background-color: rgba(colors.$bg, 0.9);
10
+ border-radius: vars.$border-radius;
11
+ z-index: 999999;
12
+ overflow: hidden;
13
+
14
+ * {
15
+ color: colors.$white;
16
+ }
17
+
18
+ input,
19
+ select,
20
+ option,
21
+ textarea {
22
+ color: colors.$bg;
23
+ background-color: colors.$white !important;
24
+ }
25
+
26
+ input[type="checkbox"] {
27
+ margin-left: 2px;
28
+ margin-right: 2px;
29
+ }
30
+
31
+ .#{vars.$xmonkey-container} {
32
+ max-height: 1000px;
33
+ transition: max-height 70ms;
34
+ &:has(.b-collapsed) {
35
+ max-height: 15px;
36
+ }
37
+ &:has(.#{vars.$xmonkey-header}) {
38
+ margin-top: 0;
39
+ }
40
+ }
41
+
42
+ .#{vars.$xmonkey-header} {
43
+ height: 15px;
44
+ line-height: 15px !important;
45
+ // border-top-left-radius: vars.$border-radius;
46
+ // border-top-right-radius: vars.$border-radius;
47
+ .xmwr-x {
48
+ font-family: monospace !important;
49
+ cursor: pointer;
50
+ position: absolute;
51
+ right: 0px;
52
+ top: 0px;
53
+ font-weight: bold;
54
+ background-color: colors.$black;
55
+ padding: 0 5px;
56
+ height: 15px;
57
+ }
58
+ }
59
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- export var isNullOrUndefined = function (value) { return value === null || value === undefined; };
1
+ export const isNullOrUndefined = (value) => value === null || value === undefined;
2
2
  export function isNullOrEmptyOrUndefined(value) {
3
3
  return isNullOrUndefined(value) || value === "" || value.toString().trim() === "";
4
4
  }
@@ -0,0 +1,3 @@
1
+ export function sleep(ms) {
2
+ return new Promise((resolve) => setTimeout(resolve, ms));
3
+ }
@@ -1,14 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
2
  import { useState } from "preact/hooks";
3
3
  export function XMonkeyWindowComponent(props) {
4
- var _a = useState(false), minimized = _a[0], setMinimized = _a[1];
4
+ const [minimized, setMinimized] = useState(false);
5
5
  function toggleMinimize() {
6
6
  setMinimized(!minimized);
7
7
  }
8
- return (_jsxs("div", { className: "xmwr_c d--f fd--c ai--c jc--sb", children: [_jsxs("div", { className: "xmwr-h w-100 m0 d--f fd--r jc--c bg-primary noselect", children: [_jsx("div", { className: "xmwr-title m0", children: props.title }), _jsx(MinimizeButton, { toggleMinimize: toggleMinimize, minimized: minimized })] }), _jsx("div", { className: "xmwr-b w-100 d--f jc--c " + (minimized ? "b-collapsed" : ""), children: props.children })] }));
8
+ return (_jsxs("div", { className: "xmwr_c d--f fd--c ai--c jc--sb", children: [_jsxs("div", { className: "xmwr-h w-100 m0 d--f fd--r jc--c bg-primary noselect", children: [_jsx("div", { className: "xmwr-title m0", children: props.title }), _jsx(MinimizeButton, { toggleMinimize: toggleMinimize, minimized: minimized })] }), _jsx("div", { className: `xmwr-b w-100 d--f jc--c ` + (minimized ? "b-collapsed" : ""), children: props.children })] }));
9
9
  }
10
- function MinimizeButton(_a) {
11
- var minimized = _a.minimized, toggleMinimize = _a.toggleMinimize;
12
- var minimizeChar = minimized ? "+" : "-";
13
- return (_jsx("div", { className: "xmwr-x m0", onClick: function () { return toggleMinimize(); }, children: minimizeChar }));
10
+ function MinimizeButton({ minimized, toggleMinimize }) {
11
+ const minimizeChar = minimized ? "+" : "-";
12
+ return (_jsx("div", { className: "xmwr-x m0", onClick: () => toggleMinimize(), children: minimizeChar }));
14
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukaskj/xmonkey",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "author": "lukaskj",
5
5
  "license": "ISC",
6
6
  "scripts": {
@@ -8,12 +8,13 @@
8
8
  "prebuild": "pnpm run clean",
9
9
  "prepublish": "pnpm run build",
10
10
  "build:old": "node esbuild/build.mjs",
11
- "build": "pnpm build:esm && pnpm build:cjs",
12
- "build:esm": "tsc -p tsconfig.build.json --outDir dist/esm",
11
+ "build": "pnpm build:esm && pnpm copy-styles",
12
+ "build:esm": "tsc -p tsconfig.build.json",
13
13
  "build:cjs": "tsc -p tsconfig.build.json --module CommonJS --outDir dist/cjs",
14
14
  "build:prod": "pnpm run lint && pnpm run build",
15
15
  "build:dev": "DEBUG=1 node esbuild/build.mjs",
16
16
  "build:debug": "DEBUG=1 node esbuild/build.mjs",
17
+ "copy-styles": "cp -R src/styles/ dist/styles",
17
18
  "dev": "nodemon",
18
19
  "start": "tsx --watch ./src/index.ts",
19
20
  "format": "prettier --write src/",
@@ -25,11 +26,11 @@
25
26
  "prepare": "husky"
26
27
  },
27
28
  "dependencies": {
29
+ "esbuild": "^0.20.1",
28
30
  "esbuild-sass-plugin": "^3.1.0",
29
- "preact": "^10.19.6",
30
31
  "postcss": "^8.4.35",
31
32
  "postcss-modules": "^6.0.0",
32
- "esbuild": "^0.20.1"
33
+ "preact": "^10.19.6"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@faker-js/faker": "^8.4.1",
@@ -49,6 +50,7 @@
49
50
  "prettier": "^3.2.5",
50
51
  "rimraf": "^5.0.5",
51
52
  "ts-jest": "^29.1.2",
53
+ "tslib": "^2.6.2",
52
54
  "tsx": "^4.7.1",
53
55
  "typescript": "^5.3.0"
54
56
  },
@@ -67,12 +69,12 @@
67
69
  "*.{js,mjs,ts,tsx,jsx}": "eslint --fix"
68
70
  },
69
71
  "exports": {
70
- ".": "./dist/**/*",
72
+ ".": "./dist/index.js",
71
73
  "./decorators": "./dist/decorators/*",
72
74
  "./interfaces": "./dist/interfaces/*"
73
75
  },
74
- "main": "dist/cjs/index.js",
75
- "module": "dist/esm/index.js",
76
+ "main": "dist/index.js",
77
+ "module": "dist/index.js",
76
78
  "types": "dist/index.d.js",
77
79
  "files": [
78
80
  "dist",
@@ -80,6 +82,6 @@
80
82
  "!node_modules"
81
83
  ],
82
84
  "bin": {
83
- "xmonkey": "dist/cjs/index.js"
85
+ "xmonkey": "dist/build.js"
84
86
  }
85
87
  }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConsoleScript = void 0;
4
- function ConsoleScript(_metadata) {
5
- return function (target) {
6
- if (!target) {
7
- throw new Error("Script not defined.");
8
- }
9
- var scriptObject = new target();
10
- scriptObject.execute();
11
- };
12
- }
13
- exports.ConsoleScript = ConsoleScript;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UiScript = void 0;
4
- var preact_1 = require("preact");
5
- var x_monkey_window_component_1 = require("../ui/x-monkey-window-component");
6
- require("../ui/styles/base.scss");
7
- function UiScript(_metadata) {
8
- return function (_target) {
9
- var _a;
10
- var scriptObject = new _target();
11
- var rootComponent = xMonkeyWrapperElement();
12
- (0, preact_1.render)((0, preact_1.h)(x_monkey_window_component_1.XMonkeyWindowComponent, { title: (_a = scriptObject.title) !== null && _a !== void 0 ? _a : "" }, scriptObject.render()), rootComponent);
13
- };
14
- }
15
- exports.UiScript = UiScript;
16
- function xMonkeyWrapperElement() {
17
- var ID = "__xmwr";
18
- var div = document.getElementById(ID);
19
- if (div)
20
- return div;
21
- div = document.createElement("div");
22
- div.id = ID;
23
- document.body.appendChild(div);
24
- return div;
25
- }