@monimesl/dot-cli 0.1.0-alpha.19 → 0.1.0-alpha.21

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 (58) hide show
  1. package/dist/cli.js +381 -261
  2. package/dist/cli.js.map +1 -1
  3. package/dist/{server-uIyYmYnp.js → server-B9-F93mS.js} +539 -464
  4. package/dist/server-B9-F93mS.js.map +1 -0
  5. package/dist/templates/showcase/dot.ts +2 -0
  6. package/dist/templates/showcase/pages/basics/bars/controller.ts +1 -1
  7. package/dist/templates/showcase/pages/basics/control-flow/controller.ts +1 -1
  8. package/dist/templates/showcase/pages/basics/events/controller.ts +4 -4
  9. package/dist/templates/showcase/pages/basics/events/view.dml +2 -2
  10. package/dist/templates/showcase/pages/basics/hooks/controller.ts +6 -0
  11. package/dist/templates/showcase/pages/basics/hooks/view.dml +5 -0
  12. package/dist/templates/showcase/pages/basics/navigation/controller.ts +7 -0
  13. package/dist/templates/showcase/pages/basics/navigation/state.ts +2 -0
  14. package/dist/templates/showcase/pages/basics/navigation/view.dml +11 -0
  15. package/dist/templates/showcase/pages/basics/pick-genre/controller.ts +12 -0
  16. package/dist/templates/showcase/pages/basics/pick-genre/state.ts +3 -0
  17. package/dist/templates/showcase/pages/basics/pick-genre/view.dml +9 -0
  18. package/dist/templates/showcase/pages/components/carousel/controller.ts +1 -1
  19. package/dist/templates/showcase/pages/components/feedback/controller.ts +12 -2
  20. package/dist/templates/showcase/pages/components/feedback/state.ts +33 -0
  21. package/dist/templates/showcase/pages/components/feedback/view.dml +21 -1
  22. package/dist/templates/showcase/pages/components/forms/controller.ts +22 -22
  23. package/dist/templates/showcase/pages/components/forms/state.ts +3 -3
  24. package/dist/templates/showcase/pages/components/forms/view.dml +9 -2
  25. package/dist/templates/showcase/pages/components/icons/controller.ts +1 -1
  26. package/dist/templates/showcase/pages/components/images/controller.ts +3 -1
  27. package/dist/templates/showcase/pages/components/images/view.dml +13 -0
  28. package/dist/templates/showcase/pages/components/layout/controller.ts +2 -2
  29. package/dist/templates/showcase/pages/components/lists/controller.ts +1 -1
  30. package/dist/templates/showcase/pages/components/lists/view.dml +18 -0
  31. package/dist/templates/showcase/pages/components/money/controller.ts +6 -8
  32. package/dist/templates/showcase/pages/components/sheets/controller.ts +2 -2
  33. package/dist/templates/showcase/pages/components/tabs/controller.ts +22 -10
  34. package/dist/templates/showcase/pages/components/tabs/state.ts +1 -0
  35. package/dist/templates/showcase/pages/components/tabs/view.dml +4 -3
  36. package/dist/templates/showcase/pages/dash/cache/controller.ts +2 -2
  37. package/dist/templates/showcase/pages/dash/calls/controller.ts +7 -6
  38. package/dist/templates/showcase/pages/dash/calls/state.ts +1 -1
  39. package/dist/templates/showcase/pages/dash/calls/view.dml +3 -2
  40. package/dist/templates/showcase/pages/dash/contacts/controller.ts +30 -0
  41. package/dist/templates/showcase/pages/dash/contacts/state.ts +6 -0
  42. package/dist/templates/showcase/pages/dash/contacts/view.dml +33 -0
  43. package/dist/templates/showcase/pages/dash/files/controller.ts +15 -13
  44. package/dist/templates/showcase/pages/dash/files/state.ts +3 -6
  45. package/dist/templates/showcase/pages/dash/media/controller.ts +16 -13
  46. package/dist/templates/showcase/pages/dash/network/controller.ts +71 -16
  47. package/dist/templates/showcase/pages/dash/network/state.ts +10 -0
  48. package/dist/templates/showcase/pages/dash/network/view.dml +32 -4
  49. package/dist/templates/showcase/pages/dash/secrets/controller.ts +1 -1
  50. package/dist/templates/showcase/pages/dash/system/controller.ts +32 -5
  51. package/dist/templates/showcase/pages/dash/system/state.ts +6 -2
  52. package/dist/templates/showcase/pages/dash/system/view.dml +39 -1
  53. package/dist/templates/showcase/pages/dash/ui/controller.ts +23 -23
  54. package/dist/templates/showcase/pages/dash/ui/view.dml +1 -1
  55. package/dist/templates/showcase/pages/index/controller.ts +1 -1
  56. package/dist/templates/showcase/pages/index/state.ts +17 -10
  57. package/package.json +6 -6
  58. package/dist/server-uIyYmYnp.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import type { VibrationStyle } from '@monimesl/dot-runtime';
2
+ import { errorMessage } from '@monimesl/dot-runtime';
2
3
 
3
4
  import state from './state';
4
5
 
@@ -7,9 +8,10 @@ export default definePage({
7
8
  configs: { navigationBar: { title: 'dash.system' } },
8
9
  mutations: {
9
10
  clearToast: () => ({ toast: '' }),
11
+ setNumber: (_state, event: ValueEvent) => ({ number: event.detail.value }),
10
12
  },
11
13
  actions: {
12
- async vibrate(_state, event: DotEvent<unknown, { style: VibrationStyle }>) {
14
+ async vibrate(_state, event: DataEvent<{ style: VibrationStyle }>) {
13
15
  await this.dash.system.vibrate({ style: event.data.style });
14
16
  },
15
17
  async copySong() {
@@ -22,7 +24,7 @@ export default definePage({
22
24
  text: 'Salone Sounds Live, Freetown, 24 October. See you there!',
23
25
  });
24
26
  } catch (error) {
25
- this.setState({ note: (error as Error).message });
27
+ this.setState({ note: errorMessage(error) });
26
28
  }
27
29
  },
28
30
  async shareLink() {
@@ -32,14 +34,14 @@ export default definePage({
32
34
  url: 'https://en.wikipedia.org/wiki/Music_of_Sierra_Leone',
33
35
  });
34
36
  } catch (error) {
35
- this.setState({ note: (error as Error).message });
37
+ this.setState({ note: errorMessage(error) });
36
38
  }
37
39
  },
38
40
  async openDrizilik() {
39
41
  try {
40
42
  await this.dash.system.openUrl('https://drizilik.com/');
41
43
  } catch (error) {
42
- this.setState({ note: (error as Error).message });
44
+ this.setState({ note: errorMessage(error) });
43
45
  }
44
46
  },
45
47
  async countDown() {
@@ -49,13 +51,38 @@ export default definePage({
49
51
  }
50
52
  this.setState({ showIn: 0, toast: "It's showtime" });
51
53
  },
54
+ async readInfo() {
55
+ try {
56
+ this.setState({ info: await this.dash.system.info(), note: '' });
57
+ } catch (error) {
58
+ this.setState({ note: errorMessage(error) });
59
+ }
60
+ },
61
+ async toggleTicket(state) {
62
+ const ticketShown = !state.ticketShown;
63
+ try {
64
+ await this.dash.system.keepAwake(ticketShown);
65
+ await this.dash.system.brightness(ticketShown ? 'max' : 'normal');
66
+ this.setState({ ticketShown, note: '' });
67
+ } catch (error) {
68
+ this.setState({ note: errorMessage(error) });
69
+ }
70
+ },
71
+ async dialNumber(state) {
72
+ try {
73
+ await this.dash.system.dial(state.number);
74
+ this.setState({ note: '' });
75
+ } catch (error) {
76
+ this.setState({ note: errorMessage(error) });
77
+ }
78
+ },
52
79
  async toggleTorch(state) {
53
80
  const next = state.torch === 'on' ? 'off' : 'on';
54
81
  try {
55
82
  await this.dash.system.torch(next);
56
83
  this.setState({ torch: next, note: '' });
57
84
  } catch (error) {
58
- this.setState({ note: (error as Error).message });
85
+ this.setState({ note: errorMessage(error) });
59
86
  }
60
87
  },
61
88
  },
@@ -1,8 +1,12 @@
1
- import type { VibrationStyle } from '@monimesl/dot-runtime';
1
+ import type { SystemInfo, TorchState, VibrationStyle } from '@monimesl/dot-runtime';
2
2
 
3
3
  export default {
4
4
  styles: ['light', 'medium', 'heavy', 'success', 'warning', 'error'] as VibrationStyle[],
5
- torch: 'off' as 'on' | 'off',
5
+ torch: 'off' as TorchState,
6
+ info: null as SystemInfo | null,
7
+ // The ticket's QR code shows awake and bright, so a scanner at the door reads it.
8
+ ticketShown: false,
9
+ number: '*715#',
6
10
  showIn: 0,
7
11
  note: '',
8
12
  toast: '',
@@ -1,6 +1,35 @@
1
1
  <View>
2
2
  <Text variant="title">dash.system</Text>
3
- <Text>The phone's own features: vibration, the clipboard, sharing, the browser, timers and the torch.</Text>
3
+ <Text>The phone's own features: what it is, its screen, vibration, the clipboard, sharing, the browser, the dialer, timers and the torch.</Text>
4
+
5
+ <View gap="small">
6
+ <Text variant="subtitle">info</Text>
7
+ <Text variant="caption" tone="muted">The phone and the app the dot runs in, without anything that identifies the person or the phone.</Text>
8
+ <View variant="card" gap="none">
9
+ <If condition="{{ info }}">
10
+ <DetailRow label="Platform" value="{{ info.platform }} {{ info.osVersion }}" />
11
+ <DetailRow label="Language" value="{{ info.language }}{{ info.region ? ' · ' + info.region : '' }}" />
12
+ <DetailRow label="Time zone" value="{{ info.timeZone }}" />
13
+ <DetailRow label="Dash" value="{{ info.dashVersion }}" />
14
+ <DetailRow label="DotHost" value="{{ info.hostVersion }}" />
15
+ </If>
16
+ <Else>
17
+ <Button variant="secondary" onClick="readInfo">Read the phone's details</Button>
18
+ </Else>
19
+ </View>
20
+ </View>
21
+
22
+ <View gap="small">
23
+ <Text variant="subtitle">keepAwake and brightness</Text>
24
+ <Text variant="caption" tone="muted">Keep the screen on and as bright as it goes while a QR code shows, so a scanner reads it. Dash puts both back when the dot closes.</Text>
25
+ <View variant="card" align="center" gap="medium">
26
+ <If condition="{{ ticketShown }}">
27
+ <QRCode value="TICKET-SSL-0042" size="160" label="Your ticket's QR code" />
28
+ <Text tone="muted">Show this at the door</Text>
29
+ </If>
30
+ <Button variant="secondary" onClick="toggleTicket">{{ ticketShown ? 'Hide the ticket' : 'Show my ticket' }}</Button>
31
+ </View>
32
+ </View>
4
33
 
5
34
  <View gap="small">
6
35
  <Text variant="subtitle">vibrate</Text>
@@ -44,6 +73,15 @@
44
73
  </View>
45
74
  </View>
46
75
 
76
+ <View gap="small">
77
+ <Text variant="subtitle">dial</Text>
78
+ <Text variant="caption" tone="muted">Opens the phone's dialer with a number ready, or a USSD code such as *715#. The person taps Call.</Text>
79
+ <View variant="card">
80
+ <Input label="Number or code" type="phone" value="{{ number }}" onChange="setNumber" onSubmit="dialNumber" />
81
+ <Button variant="secondary" onClick="dialNumber" disabled="{{ !number }}">Open the dialer</Button>
82
+ </View>
83
+ </View>
84
+
47
85
  <View gap="small">
48
86
  <Text variant="subtitle">torch</Text>
49
87
  <Text variant="caption" tone="muted">Turns the camera's light on or off.</Text>
@@ -1,13 +1,7 @@
1
- import { HostError } from '@monimesl/dot-runtime';
1
+ import { errorMessage, unlessCancelled } from '@monimesl/dot-runtime';
2
2
 
3
3
  import state from './state';
4
4
 
5
- // Closing a picker isn't a problem to show. Anything else is.
6
- function problemToShow(error: unknown): string {
7
- const closedByPerson = error instanceof HostError && error.code === 'cancelled';
8
- return closedByPerson ? '' : (error as Error).message;
9
- }
10
-
11
5
  export default definePage({
12
6
  initialState: state,
13
7
  configs: { navigationBar: { title: 'dash.ui' } },
@@ -24,7 +18,7 @@ export default definePage({
24
18
  });
25
19
  this.setState({ choice: action, note: '' });
26
20
  } catch (error) {
27
- this.setState({ note: problemToShow(error) });
21
+ this.setState({ note: errorMessage(error) });
28
22
  }
29
23
  },
30
24
  async confirmRemove() {
@@ -39,31 +33,37 @@ export default definePage({
39
33
  });
40
34
  this.setState({ choice: action, note: '' });
41
35
  } catch (error) {
42
- this.setState({ note: problemToShow(error) });
36
+ this.setState({ note: errorMessage(error) });
43
37
  }
44
38
  },
39
+ // unlessCancelled gives undefined when the person closes the picker, which isn't a problem.
45
40
  async chooseNight(state) {
46
41
  try {
47
- const night = await this.dash.ui.pickDate({
48
- title: 'Choose a night',
49
- value: state.night || undefined,
50
- min: '2026-10-01',
51
- max: '2026-12-31',
52
- });
53
- this.setState({ night, note: '' });
42
+ const night = await unlessCancelled(
43
+ this.dash.ui.pickDate({
44
+ title: 'Choose a night',
45
+ value: state.night || undefined,
46
+ min: '2026-10-01',
47
+ max: '2026-12-31',
48
+ }),
49
+ );
50
+ if (night) {
51
+ this.setState({ night, note: '' });
52
+ }
54
53
  } catch (error) {
55
- this.setState({ note: problemToShow(error) });
54
+ this.setState({ note: errorMessage(error) });
56
55
  }
57
56
  },
58
57
  async chooseArrival(state) {
59
58
  try {
60
- const arrival = await this.dash.ui.pickTime({
61
- title: 'Arriving at',
62
- value: state.arrival || '18:00',
63
- });
64
- this.setState({ arrival, note: '' });
59
+ const arrival = await unlessCancelled(
60
+ this.dash.ui.pickTime({ title: 'Arriving at', value: state.arrival || '18:00' }),
61
+ );
62
+ if (arrival) {
63
+ this.setState({ arrival, note: '' });
64
+ }
65
65
  } catch (error) {
66
- this.setState({ note: problemToShow(error) });
66
+ this.setState({ note: errorMessage(error) });
67
67
  }
68
68
  },
69
69
  },
@@ -18,7 +18,7 @@
18
18
 
19
19
  <View gap="small">
20
20
  <Text variant="subtitle">pickDate and pickTime</Text>
21
- <Text variant="caption" tone="muted">The phone's own pickers. A date comes back as "2026-10-24" and a time as "19:30". min and max limit the dates. Closing a picker rejects with a HostError coded cancelled.</Text>
21
+ <Text variant="caption" tone="muted">The phone's own pickers. A date comes back as "2026-10-24" and a time as "19:30". min and max limit the dates. Closing a picker rejects with a DashError coded cancelled.</Text>
22
22
  <List>
23
23
  <ListItem icon="calendar" title="Night" subtitle="Shows run from October to December" value="{{ night || 'Choose' }}" onTap="chooseNight" />
24
24
  <ListItem icon="clock" title="Arriving at" subtitle="Doors open at 18:00" value="{{ arrival || 'Choose' }}" onTap="chooseArrival" />
@@ -3,7 +3,7 @@ import state from './state';
3
3
  export default definePage({
4
4
  initialState: state,
5
5
  actions: {
6
- open(_state, event: DotEvent<unknown, { page: PageId }>) {
6
+ open(_state, event: DataEvent<{ page: PageId }>) {
7
7
  this.navigation.push(event.data.page);
8
8
  },
9
9
  },
@@ -46,13 +46,13 @@ export default {
46
46
  {
47
47
  page: 'basics/navigation',
48
48
  title: 'Navigation',
49
- covers: 'push, replace, back, reset',
49
+ covers: 'push, replace, back, reset, pushForResult, backWithResult',
50
50
  icon: 'arrow-right',
51
51
  },
52
52
  {
53
53
  page: 'basics/hooks',
54
54
  title: 'Page hooks',
55
- covers: 'onLoad, onShow, onHide, onUnload',
55
+ covers: 'onLoad, onShow, onHide, onUnload, onRefresh',
56
56
  icon: 'history',
57
57
  },
58
58
  {
@@ -100,7 +100,7 @@ export default {
100
100
  {
101
101
  page: 'components/images',
102
102
  title: 'Images',
103
- covers: 'Image',
103
+ covers: 'Image, Avatar',
104
104
  icon: 'image',
105
105
  },
106
106
  {
@@ -112,7 +112,7 @@ export default {
112
112
  {
113
113
  page: 'components/lists',
114
114
  title: 'Lists',
115
- covers: 'List, ListItem, DetailRow, EmptyState',
115
+ covers: 'List, ListItem, DetailRow, Disclosure, EmptyState',
116
116
  icon: 'list',
117
117
  },
118
118
  {
@@ -124,7 +124,7 @@ export default {
124
124
  {
125
125
  page: 'components/forms',
126
126
  title: 'Forms',
127
- covers: 'Input, TextArea, Select, Checkbox, Radio, Switch, Slider, Footer',
127
+ covers: 'Input, TextArea, Select, Stepper, Checkbox, Radio, Switch, Slider, Footer',
128
128
  icon: 'check',
129
129
  },
130
130
  {
@@ -136,7 +136,7 @@ export default {
136
136
  {
137
137
  page: 'components/feedback',
138
138
  title: 'Feedback',
139
- covers: 'Spinner, Skeleton, ProgressBar, Notice, Badge, Toast',
139
+ covers: 'Spinner, Skeleton, ProgressBar, Notice, Steps, Badge, Toast',
140
140
  icon: 'bell',
141
141
  },
142
142
  {
@@ -160,7 +160,8 @@ export default {
160
160
  {
161
161
  page: 'dash/system',
162
162
  title: 'dash.system',
163
- covers: 'vibrate, copyText, share, openUrl, delay, torch',
163
+ covers:
164
+ 'info, keepAwake, brightness, vibrate, copyText, share, openUrl, dial, delay, torch',
164
165
  icon: 'mobile',
165
166
  },
166
167
  {
@@ -169,10 +170,16 @@ export default {
169
170
  covers: 'pickPhoto, scanCode',
170
171
  icon: 'image',
171
172
  },
173
+ {
174
+ page: 'dash/contacts',
175
+ title: 'dash.contacts',
176
+ covers: 'pickPhone',
177
+ icon: 'users',
178
+ },
172
179
  {
173
180
  page: 'dash/network',
174
- title: 'dash.network.http',
175
- covers: 'request, download, upload',
181
+ title: 'dash.network',
182
+ covers: 'status, http.request, http.download, http.upload, debounce, latest',
176
183
  icon: 'wifi',
177
184
  },
178
185
  {
@@ -196,7 +203,7 @@ export default {
196
203
  {
197
204
  page: 'dash/calls',
198
205
  title: 'Calls and errors',
199
- covers: 'timeout, cancel, HostError',
206
+ covers: 'timeout, cancel, DashError, isDashError, isDashCancelled',
200
207
  icon: 'warning',
201
208
  },
202
209
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monimesl/dot-cli",
3
- "version": "0.1.0-alpha.19",
3
+ "version": "0.1.0-alpha.21",
4
4
  "description": "The dotctl command: build mini apps and run them in the simulator",
5
5
  "type": "module",
6
6
  "repository": {
@@ -24,11 +24,11 @@
24
24
  "dependencies": {
25
25
  "typescript": "^5.9.3",
26
26
  "uqr": "^0.1.3",
27
- "@monimesl/dot-compiler": "0.1.0-alpha.19",
28
- "@monimesl/dot-dml-parser": "0.1.0-alpha.19",
29
- "@monimesl/dot-script-parser": "0.1.0-alpha.19",
30
- "@monimesl/dot-core": "0.1.0-alpha.19",
31
- "@monimesl/dot-simulator": "0.1.0-alpha.19"
27
+ "@monimesl/dot-core": "0.1.0-alpha.21",
28
+ "@monimesl/dot-compiler": "0.1.0-alpha.21",
29
+ "@monimesl/dot-script-parser": "0.1.0-alpha.21",
30
+ "@monimesl/dot-dml-parser": "0.1.0-alpha.21",
31
+ "@monimesl/dot-simulator": "0.1.0-alpha.21"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^22.20.4",