@monimesl/dot-cli 0.1.0-alpha.9 → 1.0.0-beta.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.
- package/README.md +72 -59
- package/dist/cli.js +530 -339
- package/dist/cli.js.map +1 -1
- package/dist/{server-BfPAnsSf.js → server-DMnWDdJ6.js} +570 -478
- package/dist/server-DMnWDdJ6.js.map +1 -0
- package/dist/templates/showcase/dot.ts +53 -16
- package/dist/templates/showcase/pages/basics/bars/controller.ts +47 -0
- package/dist/templates/showcase/pages/basics/bars/state.ts +7 -0
- package/dist/templates/showcase/pages/basics/bars/view.dml +36 -0
- package/dist/templates/showcase/pages/{text → basics/bindings}/controller.ts +5 -0
- package/dist/templates/showcase/pages/basics/bindings/state.ts +14 -0
- package/dist/templates/showcase/pages/basics/bindings/view.dml +41 -0
- package/dist/templates/showcase/pages/basics/colors/controller.ts +112 -0
- package/dist/templates/showcase/pages/basics/colors/palette.ts +52 -0
- package/dist/templates/showcase/pages/basics/colors/state.ts +17 -0
- package/dist/templates/showcase/pages/basics/colors/view.dml +142 -0
- package/dist/templates/showcase/pages/basics/concert/controller.ts +16 -0
- package/dist/templates/showcase/pages/basics/concert/state.ts +7 -0
- package/dist/templates/showcase/pages/basics/concert/view.dml +20 -0
- package/dist/templates/showcase/pages/basics/control-flow/controller.ts +18 -0
- package/dist/templates/showcase/pages/basics/control-flow/state.ts +16 -0
- package/dist/templates/showcase/pages/basics/control-flow/view.dml +55 -0
- package/dist/templates/showcase/pages/basics/events/controller.ts +43 -0
- package/dist/templates/showcase/pages/basics/events/state.ts +11 -0
- package/dist/templates/showcase/pages/basics/events/view.dml +51 -0
- package/dist/templates/showcase/pages/basics/hooks/controller.ts +43 -0
- package/dist/templates/showcase/pages/basics/hooks/state.ts +10 -0
- package/dist/templates/showcase/pages/basics/hooks/view.dml +37 -0
- package/dist/templates/showcase/pages/basics/navigation/controller.ts +41 -0
- package/dist/templates/showcase/pages/basics/navigation/state.ts +11 -0
- package/dist/templates/showcase/pages/basics/navigation/view.dml +48 -0
- package/dist/templates/showcase/pages/basics/pick-genre/controller.ts +18 -0
- package/dist/templates/showcase/pages/basics/pick-genre/state.ts +3 -0
- package/dist/templates/showcase/pages/basics/pick-genre/view.dml +10 -0
- package/dist/templates/showcase/pages/basics/share/concerts.ts +31 -0
- package/dist/templates/showcase/pages/basics/share/controller.ts +12 -0
- package/dist/templates/showcase/pages/basics/share/state.ts +5 -0
- package/dist/templates/showcase/pages/basics/share/view.dml +21 -0
- package/dist/templates/showcase/pages/{state → basics/state}/controller.ts +1 -0
- package/dist/templates/showcase/pages/basics/state/view.dml +46 -0
- package/dist/templates/showcase/pages/{carousel → components/carousel}/controller.ts +2 -1
- package/dist/templates/showcase/pages/{carousel → components/carousel}/state.ts +5 -5
- package/dist/templates/showcase/pages/{carousel → components/carousel}/view.dml +7 -5
- package/dist/templates/showcase/pages/{feedback → components/feedback}/controller.ts +13 -2
- package/dist/templates/showcase/pages/components/feedback/state.ts +41 -0
- package/dist/templates/showcase/pages/{feedback → components/feedback}/view.dml +38 -9
- package/dist/templates/showcase/pages/{forms → components/forms}/controller.ts +23 -19
- package/dist/templates/showcase/pages/{forms → components/forms}/state.ts +6 -3
- package/dist/templates/showcase/pages/components/forms/view.dml +97 -0
- package/dist/templates/showcase/pages/components/icons/controller.ts +15 -0
- package/dist/templates/showcase/pages/components/icons/state.ts +75 -0
- package/dist/templates/showcase/pages/components/icons/view.dml +36 -0
- package/dist/templates/showcase/pages/{images → components/images}/controller.ts +4 -1
- package/dist/templates/showcase/pages/components/images/view.dml +83 -0
- package/dist/templates/showcase/pages/{layout → components/layout}/controller.ts +3 -2
- package/dist/templates/showcase/pages/components/layout/view.dml +143 -0
- package/dist/templates/showcase/pages/components/lists/controller.ts +18 -0
- package/dist/templates/showcase/pages/{lists → components/lists}/state.ts +43 -30
- package/dist/templates/showcase/pages/components/lists/view.dml +88 -0
- package/dist/templates/showcase/pages/{payments → components/money}/controller.ts +7 -8
- package/dist/templates/showcase/pages/components/money/view.dml +54 -0
- package/dist/templates/showcase/pages/components/reading/controller.ts +6 -0
- package/dist/templates/showcase/pages/components/reading/state.ts +23 -0
- package/dist/templates/showcase/pages/components/reading/view.dml +42 -0
- package/dist/templates/showcase/pages/{lists → components/sheets}/controller.ts +10 -11
- package/dist/templates/showcase/pages/components/sheets/state.ts +26 -0
- package/dist/templates/showcase/pages/components/sheets/view.dml +38 -0
- package/dist/templates/showcase/pages/components/styles/controller.ts +6 -0
- package/dist/templates/showcase/pages/components/styles/state.ts +3 -0
- package/dist/templates/showcase/pages/components/styles/view.dml +101 -0
- package/dist/templates/showcase/pages/components/tabs/controller.ts +41 -0
- package/dist/templates/showcase/pages/{filters → components/tabs}/state.ts +32 -23
- package/dist/templates/showcase/pages/components/tabs/view.dml +57 -0
- package/dist/templates/showcase/pages/components/text/controller.ts +10 -0
- package/dist/templates/showcase/pages/components/text/state.ts +3 -0
- package/dist/templates/showcase/pages/components/text/view.dml +95 -0
- package/dist/templates/showcase/pages/dash/account/controller.ts +32 -0
- package/dist/templates/showcase/pages/dash/account/state.ts +9 -0
- package/dist/templates/showcase/pages/dash/account/view.dml +33 -0
- package/dist/templates/showcase/pages/{cache → dash/cache}/controller.ts +9 -4
- package/dist/templates/showcase/pages/dash/cache/view.dml +48 -0
- package/dist/templates/showcase/pages/dash/calls/controller.ts +67 -0
- package/dist/templates/showcase/pages/dash/calls/state.ts +9 -0
- package/dist/templates/showcase/pages/dash/calls/view.dml +69 -0
- package/dist/templates/showcase/pages/dash/contacts/controller.ts +30 -0
- package/dist/templates/showcase/pages/dash/contacts/state.ts +6 -0
- package/dist/templates/showcase/pages/dash/contacts/view.dml +33 -0
- package/dist/templates/showcase/pages/dash/crypto/controller.ts +38 -0
- package/dist/templates/showcase/pages/dash/crypto/state.ts +10 -0
- package/dist/templates/showcase/pages/dash/crypto/view.dml +48 -0
- package/dist/templates/showcase/pages/{files → dash/files}/controller.ts +7 -2
- package/dist/templates/showcase/pages/{files → dash/files}/state.ts +4 -0
- package/dist/templates/showcase/pages/dash/files/view.dml +78 -0
- package/dist/templates/showcase/pages/dash/media/controller.ts +65 -0
- package/dist/templates/showcase/pages/dash/media/state.ts +12 -0
- package/dist/templates/showcase/pages/dash/media/view.dml +53 -0
- package/dist/templates/showcase/pages/{network → dash/network}/controller.ts +84 -20
- package/dist/templates/showcase/pages/{network → dash/network}/state.ts +14 -1
- package/dist/templates/showcase/pages/dash/network/view.dml +108 -0
- package/dist/templates/showcase/pages/dash/payments/cases.ts +445 -0
- package/dist/templates/showcase/pages/dash/payments/controller.ts +149 -0
- package/dist/templates/showcase/pages/dash/payments/state.ts +33 -0
- package/dist/templates/showcase/pages/dash/payments/view.dml +71 -0
- package/dist/templates/showcase/pages/{secrets → dash/secrets}/controller.ts +2 -1
- package/dist/templates/showcase/pages/dash/secrets/view.dml +26 -0
- package/dist/templates/showcase/pages/dash/system/controller.ts +89 -0
- package/dist/templates/showcase/pages/dash/system/state.ts +13 -0
- package/dist/templates/showcase/pages/dash/system/view.dml +96 -0
- package/dist/templates/showcase/pages/dash/ui/controller.ts +70 -0
- package/dist/templates/showcase/pages/dash/ui/state.ts +8 -0
- package/dist/templates/showcase/pages/dash/ui/view.dml +31 -0
- package/dist/templates/showcase/pages/index/controller.ts +1 -1
- package/dist/templates/showcase/pages/index/state.ts +175 -60
- package/dist/templates/showcase/pages/index/view.dml +6 -3
- package/package.json +6 -6
- package/dist/server-BfPAnsSf.js.map +0 -1
- package/dist/templates/showcase/pages/cache/view.dml +0 -36
- package/dist/templates/showcase/pages/device/controller.ts +0 -80
- package/dist/templates/showcase/pages/device/state.ts +0 -7
- package/dist/templates/showcase/pages/device/view.dml +0 -49
- package/dist/templates/showcase/pages/feedback/state.ts +0 -8
- package/dist/templates/showcase/pages/files/view.dml +0 -50
- package/dist/templates/showcase/pages/filters/controller.ts +0 -27
- package/dist/templates/showcase/pages/filters/view.dml +0 -44
- package/dist/templates/showcase/pages/forms/view.dml +0 -49
- package/dist/templates/showcase/pages/images/view.dml +0 -53
- package/dist/templates/showcase/pages/layout/view.dml +0 -103
- package/dist/templates/showcase/pages/lists/view.dml +0 -59
- package/dist/templates/showcase/pages/navigation/controller.ts +0 -65
- package/dist/templates/showcase/pages/navigation/state.ts +0 -17
- package/dist/templates/showcase/pages/navigation/view.dml +0 -34
- package/dist/templates/showcase/pages/network/view.dml +0 -67
- package/dist/templates/showcase/pages/payments/view.dml +0 -45
- package/dist/templates/showcase/pages/secrets/view.dml +0 -24
- package/dist/templates/showcase/pages/state/view.dml +0 -33
- package/dist/templates/showcase/pages/text/state.ts +0 -8
- package/dist/templates/showcase/pages/text/view.dml +0 -58
- /package/dist/templates/showcase/pages/{state → basics/state}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{images → components/images}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{layout → components/layout}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{payments → components/money}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{cache → dash/cache}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{secrets → dash/secrets}/state.ts +0 -0
|
@@ -5,13 +5,14 @@ const NAME = 'session-name';
|
|
|
5
5
|
|
|
6
6
|
export default definePage({
|
|
7
7
|
initialState: state,
|
|
8
|
+
configs: { navigationBar: { title: 'Secrets' } },
|
|
8
9
|
hooks: {
|
|
9
10
|
async onShow() {
|
|
10
11
|
await this.actions.refresh();
|
|
11
12
|
},
|
|
12
13
|
},
|
|
13
14
|
mutations: {
|
|
14
|
-
setName: (_state, event:
|
|
15
|
+
setName: (_state, event: ValueEvent) => ({ name: event.detail.value }),
|
|
15
16
|
},
|
|
16
17
|
actions: {
|
|
17
18
|
async refresh() {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">dash.storage.secret</Text>
|
|
3
|
+
<Text>Secrets hold sign-in tokens from the dot's own server. Dash keeps them encrypted on the phone. A dot can keep up to 32, of up to 4 KB each.</Text>
|
|
4
|
+
|
|
5
|
+
<View gap="small">
|
|
6
|
+
<Text variant="subtitle">set, get, remove and clear</Text>
|
|
7
|
+
<Text variant="caption" tone="muted">A sign-in that stays. Sign out removes the token, and Forget every secret clears them all.</Text>
|
|
8
|
+
<View variant="card" gap="small">
|
|
9
|
+
<If condition="{{ token }}">
|
|
10
|
+
<Text>Signed in as {{ signedInAs }}</Text>
|
|
11
|
+
<Text variant="caption" tone="muted">Session token {{ token }}</Text>
|
|
12
|
+
<View direction="row" gap="small">
|
|
13
|
+
<Button variant="secondary" onClick="signOut">Sign out</Button>
|
|
14
|
+
<Button variant="secondary" onClick="forgetAll">Forget every secret</Button>
|
|
15
|
+
</View>
|
|
16
|
+
</If>
|
|
17
|
+
<Else>
|
|
18
|
+
<Input label="Name" placeholder="Mariama" value="{{ name }}" maxLength="40" onChange="setName" onSubmit="signIn" />
|
|
19
|
+
<Button onClick="signIn" disabled="{{ !name }}">Sign in</Button>
|
|
20
|
+
<Text variant="caption" tone="muted">Sign in, then close and reopen the dot. You stay signed in.</Text>
|
|
21
|
+
</Else>
|
|
22
|
+
</View>
|
|
23
|
+
</View>
|
|
24
|
+
|
|
25
|
+
<Notice tone="warning" title="Keep keys off the phone">Only the token is a secret here: your name is in the cache. Never put API keys in a dot's code or .env, since anyone with the dot can read them.</Notice>
|
|
26
|
+
</View>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { VibrationStyle } from '@monimesl/dot-runtime';
|
|
2
|
+
import { errorMessage } from '@monimesl/dot-runtime';
|
|
3
|
+
|
|
4
|
+
import state from './state';
|
|
5
|
+
|
|
6
|
+
export default definePage({
|
|
7
|
+
initialState: state,
|
|
8
|
+
configs: { navigationBar: { title: 'System' } },
|
|
9
|
+
mutations: {
|
|
10
|
+
clearToast: () => ({ toast: '' }),
|
|
11
|
+
setNumber: (_state, event: ValueEvent) => ({ number: event.detail.value }),
|
|
12
|
+
},
|
|
13
|
+
actions: {
|
|
14
|
+
async vibrate(_state, event: DataEvent<{ style: VibrationStyle }>) {
|
|
15
|
+
await this.dash.system.vibrate({ style: event.data.style });
|
|
16
|
+
},
|
|
17
|
+
async copySong() {
|
|
18
|
+
await this.dash.system.copyText('Exodus, by Drizilik');
|
|
19
|
+
this.setState({ toast: 'Song copied' });
|
|
20
|
+
},
|
|
21
|
+
async shareText() {
|
|
22
|
+
try {
|
|
23
|
+
await this.dash.system.share({
|
|
24
|
+
text: 'Salone Sounds Live, Freetown, 24 October. See you there!',
|
|
25
|
+
});
|
|
26
|
+
} catch (error) {
|
|
27
|
+
this.setState({ note: errorMessage(error) });
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
async shareLink() {
|
|
31
|
+
try {
|
|
32
|
+
await this.dash.system.share({
|
|
33
|
+
title: 'Music of Sierra Leone',
|
|
34
|
+
url: 'https://en.wikipedia.org/wiki/Music_of_Sierra_Leone',
|
|
35
|
+
});
|
|
36
|
+
} catch (error) {
|
|
37
|
+
this.setState({ note: errorMessage(error) });
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
async openDrizilik() {
|
|
41
|
+
try {
|
|
42
|
+
await this.dash.system.openUrl('https://drizilik.com/');
|
|
43
|
+
} catch (error) {
|
|
44
|
+
this.setState({ note: errorMessage(error) });
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
async countDown() {
|
|
48
|
+
for (let seconds = 10; seconds > 0; seconds--) {
|
|
49
|
+
this.setState({ showIn: seconds });
|
|
50
|
+
await this.dash.system.delay(1000);
|
|
51
|
+
}
|
|
52
|
+
this.setState({ showIn: 0, toast: "It's showtime" });
|
|
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
|
+
},
|
|
79
|
+
async toggleTorch(state) {
|
|
80
|
+
const torchOn = !state.torchOn;
|
|
81
|
+
try {
|
|
82
|
+
await this.dash.system.torch(torchOn);
|
|
83
|
+
this.setState({ torchOn, note: '' });
|
|
84
|
+
} catch (error) {
|
|
85
|
+
this.setState({ note: errorMessage(error) });
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SystemInfo, VibrationStyle } from '@monimesl/dot-runtime';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
styles: ['light', 'medium', 'heavy', 'success', 'warning', 'error'] as VibrationStyle[],
|
|
5
|
+
torchOn: false,
|
|
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#',
|
|
10
|
+
showIn: 0,
|
|
11
|
+
note: '',
|
|
12
|
+
toast: '',
|
|
13
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">dash.system</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
|
+
</If>
|
|
15
|
+
<Else>
|
|
16
|
+
<Button variant="secondary" onClick="readInfo">Read the phone's details</Button>
|
|
17
|
+
</Else>
|
|
18
|
+
</View>
|
|
19
|
+
</View>
|
|
20
|
+
|
|
21
|
+
<View gap="small">
|
|
22
|
+
<Text variant="subtitle">keepAwake and brightness</Text>
|
|
23
|
+
<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>
|
|
24
|
+
<View variant="card" align="center" gap="medium">
|
|
25
|
+
<If condition="{{ ticketShown }}">
|
|
26
|
+
<QRCode value="TICKET-SSL-0042" size="160" label="Your ticket's QR code" />
|
|
27
|
+
<Text tone="muted">Show this at the door</Text>
|
|
28
|
+
</If>
|
|
29
|
+
<Button variant="secondary" onClick="toggleTicket">{{ ticketShown ? 'Hide the ticket' : 'Show my ticket' }}</Button>
|
|
30
|
+
</View>
|
|
31
|
+
</View>
|
|
32
|
+
|
|
33
|
+
<View gap="small">
|
|
34
|
+
<Text variant="subtitle">vibrate</Text>
|
|
35
|
+
<Text variant="caption" tone="muted">A short buzz, in a style that suits what happened.</Text>
|
|
36
|
+
<View variant="card" direction="row" wrap gap="small">
|
|
37
|
+
<For each="{{ styles }}" item="style" key="*this">
|
|
38
|
+
<Button variant="secondary" data-style="{{ style }}" onClick="vibrate">{{ style }}</Button>
|
|
39
|
+
</For>
|
|
40
|
+
</View>
|
|
41
|
+
</View>
|
|
42
|
+
|
|
43
|
+
<View gap="small">
|
|
44
|
+
<Text variant="subtitle">copyText</Text>
|
|
45
|
+
<View variant="card">
|
|
46
|
+
<Button variant="secondary" onClick="copySong">Copy a song's name</Button>
|
|
47
|
+
</View>
|
|
48
|
+
</View>
|
|
49
|
+
|
|
50
|
+
<View gap="small">
|
|
51
|
+
<Text variant="subtitle">share</Text>
|
|
52
|
+
<Text variant="caption" tone="muted">Opens the phone's share sheet with text, a link or a file. The dash.network page shares a file.</Text>
|
|
53
|
+
<View variant="card" direction="row" wrap gap="small">
|
|
54
|
+
<Button variant="secondary" onClick="shareText">Share text</Button>
|
|
55
|
+
<Button variant="secondary" onClick="shareLink">Share a link</Button>
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
|
|
59
|
+
<View gap="small">
|
|
60
|
+
<Text variant="subtitle">openUrl</Text>
|
|
61
|
+
<Text variant="caption" tone="muted">Opens a web page in the phone's browser.</Text>
|
|
62
|
+
<View variant="card">
|
|
63
|
+
<Button variant="secondary" onClick="openDrizilik">Open Drizilik's website</Button>
|
|
64
|
+
</View>
|
|
65
|
+
</View>
|
|
66
|
+
|
|
67
|
+
<View gap="small">
|
|
68
|
+
<Text variant="subtitle">delay</Text>
|
|
69
|
+
<Text variant="caption" tone="muted">Waits for a number of milliseconds. Dash keeps time, so it's cancelled when the page closes.</Text>
|
|
70
|
+
<View variant="card">
|
|
71
|
+
<Button variant="secondary" onClick="countDown" disabled="{{ showIn > 0 }}">{{ showIn > 0 ? 'Showtime in ' + showIn + 's' : 'Count down to showtime' }}</Button>
|
|
72
|
+
</View>
|
|
73
|
+
</View>
|
|
74
|
+
|
|
75
|
+
<View gap="small">
|
|
76
|
+
<Text variant="subtitle">dial</Text>
|
|
77
|
+
<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>
|
|
78
|
+
<View variant="card">
|
|
79
|
+
<Input label="Number or code" type="phone" value="{{ number }}" onChange="setNumber" onSubmit="dialNumber" />
|
|
80
|
+
<Button variant="secondary" onClick="dialNumber" disabled="{{ !number }}">Open the dialer</Button>
|
|
81
|
+
</View>
|
|
82
|
+
</View>
|
|
83
|
+
|
|
84
|
+
<View gap="small">
|
|
85
|
+
<Text variant="subtitle">torch</Text>
|
|
86
|
+
<Text variant="caption" tone="muted">Turns the camera's light on or off.</Text>
|
|
87
|
+
<View variant="card">
|
|
88
|
+
<Button variant="secondary" onClick="toggleTorch">{{ torchOn ? 'Turn the torch off' : 'Lights up for the slow song' }}</Button>
|
|
89
|
+
</View>
|
|
90
|
+
</View>
|
|
91
|
+
|
|
92
|
+
<If condition="{{ note }}">
|
|
93
|
+
<Notice tone="danger">{{ note }}</Notice>
|
|
94
|
+
</If>
|
|
95
|
+
<Toast message="{{ toast }}" tone="success" onHide="clearToast" />
|
|
96
|
+
</View>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { errorMessage, unlessCancelled } from '@monimesl/dot-runtime';
|
|
2
|
+
|
|
3
|
+
import state from './state';
|
|
4
|
+
|
|
5
|
+
export default definePage({
|
|
6
|
+
initialState: state,
|
|
7
|
+
configs: { navigationBar: { title: 'Dialogs and pickers' } },
|
|
8
|
+
actions: {
|
|
9
|
+
async greet() {
|
|
10
|
+
try {
|
|
11
|
+
const { action } = await this.dash.ui.alert({
|
|
12
|
+
title: 'Kushé',
|
|
13
|
+
message: 'Kushé means hello in Krio, and tenki means thanks.',
|
|
14
|
+
actions: [
|
|
15
|
+
{ id: 'tenki', label: 'Tenki' },
|
|
16
|
+
{ id: 'close', label: 'Close', role: 'cancel' },
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
this.setState({ choice: action, note: '' });
|
|
20
|
+
} catch (error) {
|
|
21
|
+
this.setState({ note: errorMessage(error) });
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
async confirmRemove() {
|
|
25
|
+
try {
|
|
26
|
+
const { action } = await this.dash.ui.alert({
|
|
27
|
+
title: 'Remove this song from your library?',
|
|
28
|
+
message: 'Its download goes too.',
|
|
29
|
+
actions: [
|
|
30
|
+
{ id: 'keep', label: 'Keep', role: 'cancel' },
|
|
31
|
+
{ id: 'remove', label: 'Remove', role: 'destructive' },
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
this.setState({ choice: action, note: '' });
|
|
35
|
+
} catch (error) {
|
|
36
|
+
this.setState({ note: errorMessage(error) });
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
// unlessCancelled gives undefined when the person closes the picker, which isn't a problem.
|
|
40
|
+
async chooseNight(state) {
|
|
41
|
+
try {
|
|
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
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
this.setState({ note: errorMessage(error) });
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
async chooseArrival(state) {
|
|
58
|
+
try {
|
|
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
|
+
} catch (error) {
|
|
66
|
+
this.setState({ note: errorMessage(error) });
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">dash.ui</Text>
|
|
3
|
+
<Text>Dash shows these over the dot, in the phone's own style. Each call waits until the person answers.</Text>
|
|
4
|
+
|
|
5
|
+
<View gap="small">
|
|
6
|
+
<Text variant="subtitle">alert</Text>
|
|
7
|
+
<Text variant="caption" tone="muted">A title, a message and buttons. It gives back the id of the button tapped. role="cancel" and role="destructive" style a button.</Text>
|
|
8
|
+
<View variant="card" gap="small">
|
|
9
|
+
<View direction="row" wrap gap="small">
|
|
10
|
+
<Button onClick="greet">Say kushé</Button>
|
|
11
|
+
<Button variant="secondary" onClick="confirmRemove">Remove a song</Button>
|
|
12
|
+
</View>
|
|
13
|
+
<If condition="{{ choice }}">
|
|
14
|
+
<Text>You tapped "{{ choice }}"</Text>
|
|
15
|
+
</If>
|
|
16
|
+
</View>
|
|
17
|
+
</View>
|
|
18
|
+
|
|
19
|
+
<View gap="small">
|
|
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 DashError coded cancelled.</Text>
|
|
22
|
+
<List>
|
|
23
|
+
<ListItem icon="calendar" title="Night" subtitle="Shows run from October to December" value="{{ night || 'Choose' }}" onTap="chooseNight" />
|
|
24
|
+
<ListItem icon="clock" title="Arriving at" subtitle="Doors open at 18:00" value="{{ arrival || 'Choose' }}" onTap="chooseArrival" />
|
|
25
|
+
</List>
|
|
26
|
+
</View>
|
|
27
|
+
|
|
28
|
+
<If condition="{{ note }}">
|
|
29
|
+
<Notice tone="danger">{{ note }}</Notice>
|
|
30
|
+
</If>
|
|
31
|
+
</View>
|
|
@@ -1,127 +1,242 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface Topic {
|
|
2
2
|
page: PageId;
|
|
3
3
|
title: string;
|
|
4
|
-
|
|
4
|
+
// The API names the page shows, so it's easy to find the one you need.
|
|
5
|
+
covers: string;
|
|
5
6
|
icon: string;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export interface Section {
|
|
9
10
|
title: string;
|
|
10
|
-
|
|
11
|
+
text: string;
|
|
12
|
+
topics: Topic[];
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export default {
|
|
14
16
|
title: 'Salone Sounds',
|
|
15
17
|
sections: [
|
|
16
18
|
{
|
|
17
|
-
title: '
|
|
18
|
-
|
|
19
|
+
title: 'Basics',
|
|
20
|
+
text: 'How a page works: pages/<name>/ with state.ts, view.dml and controller.ts',
|
|
21
|
+
topics: [
|
|
19
22
|
{
|
|
20
|
-
page: '
|
|
23
|
+
page: 'basics/state',
|
|
24
|
+
title: 'State, mutations and actions',
|
|
25
|
+
covers: 'state.ts, setState, mutations, actions',
|
|
26
|
+
icon: 'refresh',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
page: 'basics/bindings',
|
|
30
|
+
title: 'Bindings',
|
|
31
|
+
covers: '{{ }}, expressions, env',
|
|
32
|
+
icon: 'link',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
page: 'basics/control-flow',
|
|
36
|
+
title: 'If and For',
|
|
37
|
+
covers: 'If, ElseIf, Else, For',
|
|
38
|
+
icon: 'list',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
page: 'basics/events',
|
|
42
|
+
title: 'Events',
|
|
43
|
+
covers: 'onTap, onChange, event.detail, data-*',
|
|
44
|
+
icon: 'bolt',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
page: 'basics/navigation',
|
|
48
|
+
title: 'Navigation',
|
|
49
|
+
covers: 'push, replace, back, reset, pushForResult, backWithResult',
|
|
50
|
+
icon: 'arrow-right',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
page: 'basics/hooks',
|
|
54
|
+
title: 'Page hooks',
|
|
55
|
+
covers: 'onLoad, onShow, onHide, onUnload, onRefresh',
|
|
56
|
+
icon: 'history',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
page: 'basics/bars',
|
|
60
|
+
title: "Dash's bars",
|
|
61
|
+
covers: 'configs, setNavigationBar, setTabBar, setColors',
|
|
62
|
+
icon: 'settings',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
page: 'basics/colors',
|
|
66
|
+
title: 'Page colours',
|
|
67
|
+
covers: 'configs.colors, setColors, background, primary, surfaces',
|
|
68
|
+
icon: 'water',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
page: 'basics/share',
|
|
72
|
+
title: 'Share links',
|
|
73
|
+
covers: "share, opening a link, checking a link's options",
|
|
74
|
+
icon: 'share',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
title: 'Components',
|
|
80
|
+
text: 'What a view.dml can show',
|
|
81
|
+
topics: [
|
|
82
|
+
{
|
|
83
|
+
page: 'components/layout',
|
|
21
84
|
title: 'Layout',
|
|
22
|
-
|
|
85
|
+
covers: 'View, Stack, Scroll, Grid, Divider',
|
|
23
86
|
icon: 'grid',
|
|
24
87
|
},
|
|
25
88
|
{
|
|
26
|
-
page: '
|
|
27
|
-
title: '
|
|
28
|
-
|
|
89
|
+
page: 'components/styles',
|
|
90
|
+
title: 'Styles',
|
|
91
|
+
covers: 'background, border, radius, sizes, theme colours',
|
|
92
|
+
icon: 'star',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
page: 'components/text',
|
|
96
|
+
title: 'Text and links',
|
|
97
|
+
covers: 'Text, Link',
|
|
29
98
|
icon: 'edit',
|
|
30
99
|
},
|
|
31
100
|
{
|
|
32
|
-
page: '
|
|
101
|
+
page: 'components/icons',
|
|
102
|
+
title: 'Icons',
|
|
103
|
+
covers: 'Icon, every name',
|
|
104
|
+
icon: 'heart',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
page: 'components/reading',
|
|
108
|
+
title: 'Reading',
|
|
109
|
+
covers: 'Prose, Quote, BulletList, RichText',
|
|
110
|
+
icon: 'file',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
page: 'components/images',
|
|
33
114
|
title: 'Images',
|
|
34
|
-
|
|
115
|
+
covers: 'Image, Avatar',
|
|
35
116
|
icon: 'image',
|
|
36
117
|
},
|
|
37
118
|
{
|
|
38
|
-
page: 'carousel',
|
|
119
|
+
page: 'components/carousel',
|
|
39
120
|
title: 'Carousel',
|
|
40
|
-
|
|
41
|
-
icon: '
|
|
121
|
+
covers: 'Carousel',
|
|
122
|
+
icon: 'video',
|
|
42
123
|
},
|
|
43
124
|
{
|
|
44
|
-
page: 'lists',
|
|
45
|
-
title: 'Lists
|
|
46
|
-
|
|
125
|
+
page: 'components/lists',
|
|
126
|
+
title: 'Lists',
|
|
127
|
+
covers: 'List, ListItem, DetailRow, Disclosure, EmptyState',
|
|
47
128
|
icon: 'list',
|
|
48
129
|
},
|
|
49
130
|
{
|
|
50
|
-
page: '
|
|
51
|
-
title: 'Tabs and
|
|
52
|
-
|
|
131
|
+
page: 'components/tabs',
|
|
132
|
+
title: 'Tabs and chips',
|
|
133
|
+
covers: 'Tabs, Tab, Chip',
|
|
53
134
|
icon: 'search',
|
|
54
135
|
},
|
|
55
136
|
{
|
|
56
|
-
page: 'forms',
|
|
137
|
+
page: 'components/forms',
|
|
57
138
|
title: 'Forms',
|
|
58
|
-
|
|
139
|
+
covers: 'Input, TextArea, Select, Stepper, Checkbox, Radio, Switch, Slider, Footer',
|
|
59
140
|
icon: 'check',
|
|
60
141
|
},
|
|
61
142
|
{
|
|
62
|
-
page: '
|
|
63
|
-
title: '
|
|
64
|
-
|
|
143
|
+
page: 'components/money',
|
|
144
|
+
title: 'Money and codes',
|
|
145
|
+
covers: 'AmountInput, CodeInput, QRCode',
|
|
65
146
|
icon: 'cash',
|
|
66
147
|
},
|
|
67
148
|
{
|
|
68
|
-
page: 'feedback',
|
|
149
|
+
page: 'components/feedback',
|
|
69
150
|
title: 'Feedback',
|
|
70
|
-
|
|
151
|
+
covers: 'Spinner, Skeleton, ProgressBar, Notice, Steps, Badge, Toast',
|
|
71
152
|
icon: 'bell',
|
|
72
153
|
},
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
title: 'Logic',
|
|
77
|
-
features: [
|
|
78
154
|
{
|
|
79
|
-
page: '
|
|
80
|
-
title: '
|
|
81
|
-
|
|
82
|
-
icon: '
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
page: 'navigation',
|
|
86
|
-
title: 'Navigation and hooks',
|
|
87
|
-
summary: 'Opening pages, going back, and page hooks',
|
|
88
|
-
icon: 'arrow-right',
|
|
155
|
+
page: 'components/sheets',
|
|
156
|
+
title: 'Sheets',
|
|
157
|
+
covers: 'Sheet',
|
|
158
|
+
icon: 'more',
|
|
89
159
|
},
|
|
90
160
|
],
|
|
91
161
|
},
|
|
92
162
|
{
|
|
93
163
|
title: 'Dash',
|
|
94
|
-
|
|
164
|
+
text: "The phone's features, through this.dash",
|
|
165
|
+
topics: [
|
|
95
166
|
{
|
|
96
|
-
page: '
|
|
97
|
-
title: '
|
|
98
|
-
|
|
167
|
+
page: 'dash/ui',
|
|
168
|
+
title: 'dash.ui',
|
|
169
|
+
covers: 'alert, pickDate, pickTime',
|
|
170
|
+
icon: 'calendar',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
page: 'dash/system',
|
|
174
|
+
title: 'dash.system',
|
|
175
|
+
covers:
|
|
176
|
+
'info, keepAwake, brightness, vibrate, copyText, share, openUrl, dial, delay, torch',
|
|
99
177
|
icon: 'mobile',
|
|
100
178
|
},
|
|
101
179
|
{
|
|
102
|
-
page: '
|
|
103
|
-
title: '
|
|
104
|
-
|
|
180
|
+
page: 'dash/media',
|
|
181
|
+
title: 'dash.media',
|
|
182
|
+
covers: 'pickPhoto, pickFile, scanCode',
|
|
183
|
+
icon: 'image',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
page: 'dash/contacts',
|
|
187
|
+
title: 'dash.contacts',
|
|
188
|
+
covers: 'pickPhone',
|
|
189
|
+
icon: 'users',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
page: 'dash/account',
|
|
193
|
+
title: 'dash.account',
|
|
194
|
+
covers: 'signIn',
|
|
195
|
+
icon: 'user',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
page: 'dash/payments',
|
|
199
|
+
title: 'dash.payments',
|
|
200
|
+
covers: 'request, get',
|
|
201
|
+
icon: 'card',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
page: 'dash/crypto',
|
|
205
|
+
title: 'dash.crypto',
|
|
206
|
+
covers:
|
|
207
|
+
'sha256, sha512, hmac, randomBytes, randomUUID, and dash.utils for base64 and hex',
|
|
208
|
+
icon: 'lock',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
page: 'dash/network',
|
|
212
|
+
title: 'dash.network',
|
|
213
|
+
covers: 'status, http.request, http.download, http.upload, debounce, latest',
|
|
105
214
|
icon: 'wifi',
|
|
106
215
|
},
|
|
107
216
|
{
|
|
108
|
-
page: 'files',
|
|
109
|
-
title: '
|
|
110
|
-
|
|
217
|
+
page: 'dash/files',
|
|
218
|
+
title: 'dash.storage.file',
|
|
219
|
+
covers: 'write, read, list, move, copy, remove, save, stat, open, usage',
|
|
111
220
|
icon: 'file',
|
|
112
221
|
},
|
|
113
222
|
{
|
|
114
|
-
page: 'cache',
|
|
115
|
-
title: '
|
|
116
|
-
|
|
117
|
-
icon: '
|
|
223
|
+
page: 'dash/cache',
|
|
224
|
+
title: 'dash.storage.cache',
|
|
225
|
+
covers: 'set, get, keys, exists, remove, clear',
|
|
226
|
+
icon: 'history',
|
|
118
227
|
},
|
|
119
228
|
{
|
|
120
|
-
page: 'secrets',
|
|
121
|
-
title: '
|
|
122
|
-
|
|
229
|
+
page: 'dash/secrets',
|
|
230
|
+
title: 'dash.storage.secret',
|
|
231
|
+
covers: 'set, get, remove, clear',
|
|
123
232
|
icon: 'lock',
|
|
124
233
|
},
|
|
234
|
+
{
|
|
235
|
+
page: 'dash/calls',
|
|
236
|
+
title: 'Calls and errors',
|
|
237
|
+
covers: 'timeout, cancel, DashError, isDashError',
|
|
238
|
+
icon: 'warning',
|
|
239
|
+
},
|
|
125
240
|
],
|
|
126
241
|
},
|
|
127
242
|
] as Section[],
|