@monimesl/dot-simulator 0.1.0-alpha.2 → 0.1.0-alpha.4
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.
- package/dist/client/service-bridge.js +486 -48
- package/dist/client/service-bridge.js.map +1 -1
- package/dist/client/simulator.js +633 -62
- package/dist/client/simulator.js.map +1 -1
- package/dist/client/webview-bridge.js +12 -0
- package/dist/client/webview-bridge.js.map +1 -1
- package/dist/node/index.d.ts +18 -3
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +702 -14
- package/dist/node/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -15,72 +15,498 @@
|
|
|
15
15
|
}
|
|
16
16
|
return registry;
|
|
17
17
|
}
|
|
18
|
+
const AmountInput = defineComponent({
|
|
19
|
+
name: "AmountInput",
|
|
20
|
+
props: {
|
|
21
|
+
value: "number",
|
|
22
|
+
currency: "string",
|
|
23
|
+
decimals: "number",
|
|
24
|
+
label: "string",
|
|
25
|
+
placeholder: "string",
|
|
26
|
+
hint: "string",
|
|
27
|
+
error: "string",
|
|
28
|
+
disabled: "boolean"
|
|
29
|
+
},
|
|
30
|
+
events: ["change"],
|
|
31
|
+
children: "none"
|
|
32
|
+
});
|
|
33
|
+
const Button = defineComponent({
|
|
34
|
+
name: "Button",
|
|
35
|
+
props: {
|
|
36
|
+
variant: ["primary", "secondary"],
|
|
37
|
+
disabled: "boolean",
|
|
38
|
+
loading: "boolean"
|
|
39
|
+
},
|
|
40
|
+
events: ["click"],
|
|
41
|
+
children: "text"
|
|
42
|
+
});
|
|
43
|
+
const SIZES = [
|
|
44
|
+
"small",
|
|
45
|
+
"medium",
|
|
46
|
+
"large"
|
|
47
|
+
];
|
|
48
|
+
const SPACES = [
|
|
49
|
+
"none",
|
|
50
|
+
"small",
|
|
51
|
+
"medium",
|
|
52
|
+
"large"
|
|
53
|
+
];
|
|
54
|
+
const TONES = [
|
|
55
|
+
"default",
|
|
56
|
+
"muted",
|
|
57
|
+
"info",
|
|
58
|
+
"success",
|
|
59
|
+
"warning",
|
|
60
|
+
"danger"
|
|
61
|
+
];
|
|
62
|
+
const STATUS_TONES = [
|
|
63
|
+
"default",
|
|
64
|
+
"info",
|
|
65
|
+
"success",
|
|
66
|
+
"warning",
|
|
67
|
+
"danger"
|
|
68
|
+
];
|
|
69
|
+
const ICON_NAMES = [
|
|
70
|
+
"arrow-down",
|
|
71
|
+
"arrow-left",
|
|
72
|
+
"arrow-right",
|
|
73
|
+
"arrow-up",
|
|
74
|
+
"bank",
|
|
75
|
+
"bell",
|
|
76
|
+
"bolt",
|
|
77
|
+
"calendar",
|
|
78
|
+
"card",
|
|
79
|
+
"cart",
|
|
80
|
+
"cash",
|
|
81
|
+
"check",
|
|
82
|
+
"chevron-down",
|
|
83
|
+
"chevron-left",
|
|
84
|
+
"chevron-right",
|
|
85
|
+
"chevron-up",
|
|
86
|
+
"clock",
|
|
87
|
+
"close",
|
|
88
|
+
"copy",
|
|
89
|
+
"download",
|
|
90
|
+
"edit",
|
|
91
|
+
"error",
|
|
92
|
+
"eye",
|
|
93
|
+
"eye-off",
|
|
94
|
+
"file",
|
|
95
|
+
"gift",
|
|
96
|
+
"grid",
|
|
97
|
+
"heart",
|
|
98
|
+
"help",
|
|
99
|
+
"history",
|
|
100
|
+
"home",
|
|
101
|
+
"image",
|
|
102
|
+
"info",
|
|
103
|
+
"list",
|
|
104
|
+
"location",
|
|
105
|
+
"lock",
|
|
106
|
+
"logout",
|
|
107
|
+
"mail",
|
|
108
|
+
"minus",
|
|
109
|
+
"mobile",
|
|
110
|
+
"more",
|
|
111
|
+
"phone",
|
|
112
|
+
"plus",
|
|
113
|
+
"qr-code",
|
|
114
|
+
"receipt",
|
|
115
|
+
"refresh",
|
|
116
|
+
"search",
|
|
117
|
+
"send",
|
|
118
|
+
"settings",
|
|
119
|
+
"share",
|
|
120
|
+
"star",
|
|
121
|
+
"success",
|
|
122
|
+
"trash",
|
|
123
|
+
"upload",
|
|
124
|
+
"user",
|
|
125
|
+
"users",
|
|
126
|
+
"wallet",
|
|
127
|
+
"warning",
|
|
128
|
+
"water",
|
|
129
|
+
"wifi"
|
|
130
|
+
];
|
|
131
|
+
const Carousel = defineComponent({
|
|
132
|
+
name: "Carousel",
|
|
133
|
+
props: {
|
|
134
|
+
autoplay: "boolean",
|
|
135
|
+
interval: "number",
|
|
136
|
+
loop: "boolean",
|
|
137
|
+
indicator: ["dots", "none"],
|
|
138
|
+
gap: SPACES,
|
|
139
|
+
effect: ["slide", "scale"],
|
|
140
|
+
index: "number"
|
|
141
|
+
},
|
|
142
|
+
events: ["change"],
|
|
143
|
+
children: "elements"
|
|
144
|
+
});
|
|
145
|
+
const Chip = defineComponent({
|
|
146
|
+
name: "Chip",
|
|
147
|
+
props: {
|
|
148
|
+
label: "string",
|
|
149
|
+
icon: ICON_NAMES,
|
|
150
|
+
selected: "boolean",
|
|
151
|
+
disabled: "boolean"
|
|
152
|
+
},
|
|
153
|
+
events: ["tap"],
|
|
154
|
+
children: "none"
|
|
155
|
+
});
|
|
156
|
+
const CodeInput = defineComponent({
|
|
157
|
+
name: "CodeInput",
|
|
158
|
+
props: {
|
|
159
|
+
value: "string",
|
|
160
|
+
length: "number",
|
|
161
|
+
label: "string",
|
|
162
|
+
hint: "string",
|
|
163
|
+
error: "string",
|
|
164
|
+
secure: "boolean",
|
|
165
|
+
disabled: "boolean"
|
|
166
|
+
},
|
|
167
|
+
events: ["change", "complete"],
|
|
168
|
+
children: "none"
|
|
169
|
+
});
|
|
170
|
+
const Divider = defineComponent({
|
|
171
|
+
name: "Divider",
|
|
172
|
+
children: "none"
|
|
173
|
+
});
|
|
174
|
+
const EmptyState = defineComponent({
|
|
175
|
+
name: "EmptyState",
|
|
176
|
+
props: {
|
|
177
|
+
icon: ICON_NAMES,
|
|
178
|
+
title: "string",
|
|
179
|
+
text: "string"
|
|
180
|
+
},
|
|
181
|
+
children: "elements"
|
|
182
|
+
});
|
|
183
|
+
const Spinner = defineComponent({
|
|
184
|
+
name: "Spinner",
|
|
185
|
+
props: { size: SIZES },
|
|
186
|
+
children: "none"
|
|
187
|
+
});
|
|
188
|
+
const ProgressBar = defineComponent({
|
|
189
|
+
name: "ProgressBar",
|
|
190
|
+
props: { value: "number" },
|
|
191
|
+
children: "none"
|
|
192
|
+
});
|
|
193
|
+
const Notice = defineComponent({
|
|
194
|
+
name: "Notice",
|
|
195
|
+
props: {
|
|
196
|
+
tone: STATUS_TONES,
|
|
197
|
+
title: "string"
|
|
198
|
+
},
|
|
199
|
+
children: "text"
|
|
200
|
+
});
|
|
201
|
+
const Badge = defineComponent({
|
|
202
|
+
name: "Badge",
|
|
203
|
+
props: { tone: STATUS_TONES },
|
|
204
|
+
children: "text"
|
|
205
|
+
});
|
|
206
|
+
const Footer = defineComponent({
|
|
207
|
+
name: "Footer",
|
|
208
|
+
children: "elements"
|
|
209
|
+
});
|
|
210
|
+
const Grid = defineComponent({
|
|
211
|
+
name: "Grid",
|
|
212
|
+
props: {
|
|
213
|
+
columns: "number",
|
|
214
|
+
gap: SPACES
|
|
215
|
+
},
|
|
216
|
+
children: "elements"
|
|
217
|
+
});
|
|
218
|
+
const GridItem = defineComponent({
|
|
219
|
+
name: "GridItem",
|
|
220
|
+
props: {
|
|
221
|
+
label: "string",
|
|
222
|
+
icon: ICON_NAMES,
|
|
223
|
+
image: "string",
|
|
224
|
+
badge: "string"
|
|
225
|
+
},
|
|
226
|
+
events: ["tap"],
|
|
227
|
+
children: "none"
|
|
228
|
+
});
|
|
229
|
+
const Icon = defineComponent({
|
|
230
|
+
name: "Icon",
|
|
231
|
+
props: {
|
|
232
|
+
name: ICON_NAMES,
|
|
233
|
+
size: SIZES,
|
|
234
|
+
tone: TONES
|
|
235
|
+
},
|
|
236
|
+
children: "none",
|
|
237
|
+
inline: true
|
|
238
|
+
});
|
|
239
|
+
const Image = defineComponent({
|
|
240
|
+
name: "Image",
|
|
241
|
+
props: {
|
|
242
|
+
src: "string",
|
|
243
|
+
alt: "string",
|
|
244
|
+
width: "number",
|
|
245
|
+
height: "number",
|
|
246
|
+
fit: ["cover", "contain"],
|
|
247
|
+
shape: [
|
|
248
|
+
"rounded",
|
|
249
|
+
"square",
|
|
250
|
+
"circle"
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
events: ["load", "error"],
|
|
254
|
+
children: "none"
|
|
255
|
+
});
|
|
256
|
+
const Input = defineComponent({
|
|
257
|
+
name: "Input",
|
|
258
|
+
props: {
|
|
259
|
+
value: "string",
|
|
260
|
+
placeholder: "string",
|
|
261
|
+
label: "string",
|
|
262
|
+
hint: "string",
|
|
263
|
+
error: "string",
|
|
264
|
+
prefix: "string",
|
|
265
|
+
suffix: "string",
|
|
266
|
+
type: [
|
|
267
|
+
"text",
|
|
268
|
+
"number",
|
|
269
|
+
"email",
|
|
270
|
+
"phone",
|
|
271
|
+
"password"
|
|
272
|
+
],
|
|
273
|
+
maxLength: "number",
|
|
274
|
+
disabled: "boolean"
|
|
275
|
+
},
|
|
276
|
+
events: ["change", "submit"],
|
|
277
|
+
children: "none"
|
|
278
|
+
});
|
|
279
|
+
const List = defineComponent({
|
|
280
|
+
name: "List",
|
|
281
|
+
children: "elements"
|
|
282
|
+
});
|
|
283
|
+
const ListItem = defineComponent({
|
|
284
|
+
name: "ListItem",
|
|
285
|
+
props: {
|
|
286
|
+
title: "string",
|
|
287
|
+
subtitle: "string",
|
|
288
|
+
value: "string",
|
|
289
|
+
icon: ICON_NAMES,
|
|
290
|
+
image: "string"
|
|
291
|
+
},
|
|
292
|
+
events: ["tap"],
|
|
293
|
+
children: "elements"
|
|
294
|
+
});
|
|
295
|
+
const Sheet = defineComponent({
|
|
296
|
+
name: "Sheet",
|
|
297
|
+
props: {
|
|
298
|
+
open: "boolean",
|
|
299
|
+
title: "string"
|
|
300
|
+
},
|
|
301
|
+
events: ["close"],
|
|
302
|
+
children: "elements"
|
|
303
|
+
});
|
|
304
|
+
const Toast = defineComponent({
|
|
305
|
+
name: "Toast",
|
|
306
|
+
props: {
|
|
307
|
+
message: "string",
|
|
308
|
+
tone: STATUS_TONES,
|
|
309
|
+
duration: "number"
|
|
310
|
+
},
|
|
311
|
+
events: ["hide"],
|
|
312
|
+
children: "none"
|
|
313
|
+
});
|
|
314
|
+
const QRCode = defineComponent({
|
|
315
|
+
name: "QRCode",
|
|
316
|
+
props: {
|
|
317
|
+
value: "string",
|
|
318
|
+
size: "number",
|
|
319
|
+
label: "string"
|
|
320
|
+
},
|
|
321
|
+
children: "none"
|
|
322
|
+
});
|
|
323
|
+
const Select = defineComponent({
|
|
324
|
+
name: "Select",
|
|
325
|
+
props: {
|
|
326
|
+
value: "string",
|
|
327
|
+
label: "string",
|
|
328
|
+
placeholder: "string",
|
|
329
|
+
hint: "string",
|
|
330
|
+
error: "string",
|
|
331
|
+
disabled: "boolean"
|
|
332
|
+
},
|
|
333
|
+
events: ["change"],
|
|
334
|
+
children: "elements"
|
|
335
|
+
});
|
|
336
|
+
const Option = defineComponent({
|
|
337
|
+
name: "Option",
|
|
338
|
+
props: {
|
|
339
|
+
value: "string",
|
|
340
|
+
label: "string"
|
|
341
|
+
},
|
|
342
|
+
children: "none"
|
|
343
|
+
});
|
|
344
|
+
const Skeleton = defineComponent({
|
|
345
|
+
name: "Skeleton",
|
|
346
|
+
props: {
|
|
347
|
+
shape: [
|
|
348
|
+
"text",
|
|
349
|
+
"circle",
|
|
350
|
+
"box"
|
|
351
|
+
],
|
|
352
|
+
lines: "number",
|
|
353
|
+
height: "number"
|
|
354
|
+
},
|
|
355
|
+
children: "none"
|
|
356
|
+
});
|
|
357
|
+
const Tabs = defineComponent({
|
|
358
|
+
name: "Tabs",
|
|
359
|
+
props: {
|
|
360
|
+
value: "string",
|
|
361
|
+
variant: ["underline", "segmented"]
|
|
362
|
+
},
|
|
363
|
+
events: ["change"],
|
|
364
|
+
children: "elements"
|
|
365
|
+
});
|
|
366
|
+
const Tab = defineComponent({
|
|
367
|
+
name: "Tab",
|
|
368
|
+
props: {
|
|
369
|
+
value: "string",
|
|
370
|
+
label: "string",
|
|
371
|
+
badge: "number"
|
|
372
|
+
},
|
|
373
|
+
children: "none"
|
|
374
|
+
});
|
|
375
|
+
const Text = defineComponent({
|
|
376
|
+
name: "Text",
|
|
377
|
+
props: {
|
|
378
|
+
variant: [
|
|
379
|
+
"title",
|
|
380
|
+
"body",
|
|
381
|
+
"caption"
|
|
382
|
+
],
|
|
383
|
+
tone: TONES,
|
|
384
|
+
weight: [
|
|
385
|
+
"regular",
|
|
386
|
+
"medium",
|
|
387
|
+
"bold"
|
|
388
|
+
],
|
|
389
|
+
align: [
|
|
390
|
+
"start",
|
|
391
|
+
"center",
|
|
392
|
+
"end"
|
|
393
|
+
],
|
|
394
|
+
maxLines: "number"
|
|
395
|
+
},
|
|
396
|
+
children: "text",
|
|
397
|
+
inline: true
|
|
398
|
+
});
|
|
399
|
+
const TextArea = defineComponent({
|
|
400
|
+
name: "TextArea",
|
|
401
|
+
props: {
|
|
402
|
+
value: "string",
|
|
403
|
+
placeholder: "string",
|
|
404
|
+
label: "string",
|
|
405
|
+
hint: "string",
|
|
406
|
+
error: "string",
|
|
407
|
+
rows: "number",
|
|
408
|
+
maxLength: "number",
|
|
409
|
+
disabled: "boolean"
|
|
410
|
+
},
|
|
411
|
+
events: ["change"],
|
|
412
|
+
children: "none"
|
|
413
|
+
});
|
|
414
|
+
const Switch = defineComponent({
|
|
415
|
+
name: "Switch",
|
|
416
|
+
props: {
|
|
417
|
+
checked: "boolean",
|
|
418
|
+
label: "string",
|
|
419
|
+
disabled: "boolean"
|
|
420
|
+
},
|
|
421
|
+
events: ["change"],
|
|
422
|
+
children: "none"
|
|
423
|
+
});
|
|
424
|
+
const Checkbox = defineComponent({
|
|
425
|
+
name: "Checkbox",
|
|
426
|
+
props: {
|
|
427
|
+
checked: "boolean",
|
|
428
|
+
label: "string",
|
|
429
|
+
disabled: "boolean"
|
|
430
|
+
},
|
|
431
|
+
events: ["change"],
|
|
432
|
+
children: "none"
|
|
433
|
+
});
|
|
434
|
+
const RadioGroup = defineComponent({
|
|
435
|
+
name: "RadioGroup",
|
|
436
|
+
props: {
|
|
437
|
+
value: "string",
|
|
438
|
+
label: "string",
|
|
439
|
+
disabled: "boolean"
|
|
440
|
+
},
|
|
441
|
+
events: ["change"],
|
|
442
|
+
children: "elements"
|
|
443
|
+
});
|
|
18
444
|
const builtinComponents = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
445
|
+
AmountInput,
|
|
446
|
+
Badge,
|
|
447
|
+
Button,
|
|
448
|
+
Carousel,
|
|
449
|
+
Checkbox,
|
|
450
|
+
Chip,
|
|
451
|
+
CodeInput,
|
|
452
|
+
Divider,
|
|
453
|
+
EmptyState,
|
|
454
|
+
Footer,
|
|
455
|
+
Grid,
|
|
456
|
+
GridItem,
|
|
457
|
+
Icon,
|
|
458
|
+
Image,
|
|
459
|
+
Input,
|
|
460
|
+
List,
|
|
461
|
+
ListItem,
|
|
462
|
+
Notice,
|
|
463
|
+
Option,
|
|
464
|
+
ProgressBar,
|
|
465
|
+
QRCode,
|
|
466
|
+
Radio: defineComponent({
|
|
467
|
+
name: "Radio",
|
|
41
468
|
props: {
|
|
42
469
|
value: "string",
|
|
43
|
-
placeholder: "string",
|
|
44
470
|
label: "string",
|
|
45
|
-
type: [
|
|
46
|
-
"text",
|
|
47
|
-
"number",
|
|
48
|
-
"email",
|
|
49
|
-
"phone",
|
|
50
|
-
"password"
|
|
51
|
-
],
|
|
52
|
-
maxLength: "number",
|
|
53
471
|
disabled: "boolean"
|
|
54
472
|
},
|
|
55
|
-
events: ["change", "submit"],
|
|
56
473
|
children: "none"
|
|
57
474
|
}),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
475
|
+
RadioGroup,
|
|
476
|
+
Select,
|
|
477
|
+
Sheet,
|
|
478
|
+
Skeleton,
|
|
479
|
+
Spinner,
|
|
480
|
+
Switch,
|
|
481
|
+
Tab,
|
|
482
|
+
Tabs,
|
|
483
|
+
Text,
|
|
484
|
+
TextArea,
|
|
485
|
+
Toast,
|
|
68
486
|
View: defineComponent({
|
|
69
487
|
name: "View",
|
|
70
488
|
props: {
|
|
489
|
+
gap: SPACES,
|
|
71
490
|
direction: ["column", "row"],
|
|
72
|
-
gap: [
|
|
73
|
-
"none",
|
|
74
|
-
"small",
|
|
75
|
-
"medium",
|
|
76
|
-
"large"
|
|
77
|
-
],
|
|
78
491
|
align: [
|
|
79
492
|
"stretch",
|
|
80
493
|
"start",
|
|
81
494
|
"center",
|
|
82
495
|
"end"
|
|
83
496
|
],
|
|
497
|
+
justify: [
|
|
498
|
+
"start",
|
|
499
|
+
"center",
|
|
500
|
+
"end",
|
|
501
|
+
"between"
|
|
502
|
+
],
|
|
503
|
+
wrap: "boolean",
|
|
504
|
+
grow: "boolean",
|
|
505
|
+
padding: SPACES,
|
|
506
|
+
paddingTop: SPACES,
|
|
507
|
+
paddingStart: SPACES,
|
|
508
|
+
paddingEnd: SPACES,
|
|
509
|
+
paddingBottom: SPACES,
|
|
84
510
|
variant: ["plain", "card"]
|
|
85
511
|
},
|
|
86
512
|
events: ["tap"],
|
|
@@ -88,6 +514,8 @@
|
|
|
88
514
|
})
|
|
89
515
|
};
|
|
90
516
|
componentRegistry(Object.values(builtinComponents));
|
|
517
|
+
const LABEL = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
|
|
518
|
+
new RegExp(`^(?:\\*\\.${LABEL}(?:\\.${LABEL})+|${LABEL}(?:\\.${LABEL})*)$`);
|
|
91
519
|
function createAdaptorTransport(adapter) {
|
|
92
520
|
return {
|
|
93
521
|
post: (message) => adapter.postMessage(message),
|
|
@@ -100,6 +528,12 @@
|
|
|
100
528
|
}
|
|
101
529
|
const SERVICE_URL = `/dot/logic/dot.js`;
|
|
102
530
|
//#endregion
|
|
531
|
+
//#region src/client/hot-reload.ts
|
|
532
|
+
function hotReloadIn(data) {
|
|
533
|
+
const reload = data?.dotHotReload;
|
|
534
|
+
return typeof reload === "number" ? reload : void 0;
|
|
535
|
+
}
|
|
536
|
+
//#endregion
|
|
103
537
|
//#region src/client/wire.ts
|
|
104
538
|
function isWire(data) {
|
|
105
539
|
return typeof data?.dot === "string";
|
|
@@ -117,6 +551,10 @@
|
|
|
117
551
|
const scope = globalThis;
|
|
118
552
|
globalThis.__hostTransport = wireTransport(createAdaptorTransport(scope));
|
|
119
553
|
scope.importScripts(SERVICE_URL);
|
|
554
|
+
scope.addEventListener("message", ({ data }) => {
|
|
555
|
+
const reload = hotReloadIn(data);
|
|
556
|
+
if (reload !== void 0) scope.importScripts(`${SERVICE_URL}?hot=${reload}`);
|
|
557
|
+
});
|
|
120
558
|
//#endregion
|
|
121
559
|
})();
|
|
122
560
|
|