@monimesl/dot-cli 0.1.0-alpha.2 → 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.
- package/README.md +91 -17
- package/dist/cli.js +832 -156
- package/dist/cli.js.map +1 -1
- package/dist/server-B9-F93mS.js +11295 -0
- package/dist/server-B9-F93mS.js.map +1 -0
- package/dist/templates/showcase/.env +3 -0
- package/dist/templates/showcase/dot.ts +52 -0
- package/dist/templates/showcase/pages/basics/bars/controller.ts +36 -0
- package/dist/templates/showcase/pages/basics/bars/state.ts +6 -0
- package/dist/templates/showcase/pages/basics/bars/view.dml +28 -0
- package/dist/templates/showcase/pages/basics/bindings/controller.ts +15 -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/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 +12 -0
- package/dist/templates/showcase/pages/basics/pick-genre/state.ts +3 -0
- package/dist/templates/showcase/pages/basics/pick-genre/view.dml +9 -0
- package/dist/templates/showcase/pages/basics/state/controller.ts +23 -0
- package/dist/templates/showcase/pages/basics/state/state.ts +10 -0
- package/dist/templates/showcase/pages/basics/state/view.dml +46 -0
- package/dist/templates/showcase/pages/components/carousel/controller.ts +41 -0
- package/dist/templates/showcase/pages/components/carousel/state.ts +77 -0
- package/dist/templates/showcase/pages/components/carousel/view.dml +42 -0
- package/dist/templates/showcase/pages/components/feedback/controller.ts +32 -0
- package/dist/templates/showcase/pages/components/feedback/state.ts +41 -0
- package/dist/templates/showcase/pages/components/feedback/view.dml +116 -0
- package/dist/templates/showcase/pages/components/forms/controller.ts +72 -0
- package/dist/templates/showcase/pages/components/forms/state.ts +37 -0
- 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/components/images/controller.ts +44 -0
- package/dist/templates/showcase/pages/components/images/state.ts +10 -0
- package/dist/templates/showcase/pages/components/images/view.dml +83 -0
- package/dist/templates/showcase/pages/components/layout/controller.ts +61 -0
- package/dist/templates/showcase/pages/components/layout/state.ts +34 -0
- 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/components/lists/state.ts +130 -0
- package/dist/templates/showcase/pages/components/lists/view.dml +88 -0
- package/dist/templates/showcase/pages/components/money/controller.ts +45 -0
- package/dist/templates/showcase/pages/components/money/state.ts +13 -0
- 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/components/sheets/controller.ts +36 -0
- 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/components/tabs/state.ts +127 -0
- 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/cache/controller.ts +50 -0
- package/dist/templates/showcase/pages/dash/cache/state.ts +17 -0
- package/dist/templates/showcase/pages/dash/cache/view.dml +48 -0
- package/dist/templates/showcase/pages/dash/calls/controller.ts +50 -0
- package/dist/templates/showcase/pages/dash/calls/state.ts +6 -0
- package/dist/templates/showcase/pages/dash/calls/view.dml +52 -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/files/controller.ts +91 -0
- package/dist/templates/showcase/pages/dash/files/state.ts +24 -0
- package/dist/templates/showcase/pages/dash/files/view.dml +79 -0
- package/dist/templates/showcase/pages/dash/media/controller.ts +36 -0
- package/dist/templates/showcase/pages/dash/media/state.ts +8 -0
- package/dist/templates/showcase/pages/dash/media/view.dml +34 -0
- package/dist/templates/showcase/pages/dash/network/controller.ts +215 -0
- package/dist/templates/showcase/pages/dash/network/state.ts +35 -0
- package/dist/templates/showcase/pages/dash/network/view.dml +108 -0
- package/dist/templates/showcase/pages/dash/secrets/controller.ts +44 -0
- package/dist/templates/showcase/pages/dash/secrets/state.ts +5 -0
- 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 +97 -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 +10 -0
- package/dist/templates/showcase/pages/index/state.ts +212 -0
- package/dist/templates/showcase/pages/index/view.dml +23 -0
- package/dist/templates/showcase/statics/logo.png +0 -0
- package/dist/templates/starter/.env +3 -0
- package/dist/templates/starter/dot.ts +3 -0
- package/dist/templates/starter/pages/index/controller.ts +9 -0
- package/dist/templates/starter/pages/index/state.ts +4 -0
- package/dist/templates/starter/pages/index/view.dml +16 -0
- package/package.json +12 -7
- package/dist/template/.env +0 -3
- package/dist/template/dot.ts +0 -6
- package/dist/template/pages/help/tips/controller.ts +0 -30
- package/dist/template/pages/help/tips/state.ts +0 -11
- package/dist/template/pages/help/tips/view.dml +0 -15
- package/dist/template/pages/index/controller.ts +0 -67
- package/dist/template/pages/index/state.ts +0 -17
- package/dist/template/pages/index/view.dml +0 -66
- /package/dist/{template → templates/starter}/statics/logo.png +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">Lists</Text>
|
|
3
|
+
<Text>A List shows rows in a card. A ListItem can show an icon or a picture, a subtitle, and a value or a badge at its end. A row you can tap shows an arrow.</Text>
|
|
4
|
+
|
|
5
|
+
<View gap="small">
|
|
6
|
+
<Text variant="subtitle">List and ListItem</Text>
|
|
7
|
+
<Text variant="caption" tone="muted">Artists in a small list. Tap one: its data-id tells the page which one.</Text>
|
|
8
|
+
<List>
|
|
9
|
+
<For each="{{ artists }}" item="artist" key="id">
|
|
10
|
+
<ListItem icon="microphone" title="{{ artist.name }}" subtitle="{{ artist.song }}" value="{{ artist.genre }}" data-id="{{ artist.id }}" onTap="choose" />
|
|
11
|
+
</For>
|
|
12
|
+
</List>
|
|
13
|
+
<If condition="{{ chosen }}">
|
|
14
|
+
<Text>You chose {{ chosen }}</Text>
|
|
15
|
+
</If>
|
|
16
|
+
</View>
|
|
17
|
+
|
|
18
|
+
<View gap="small">
|
|
19
|
+
<Text variant="subtitle">size="md", with a picture and a badge</Text>
|
|
20
|
+
<Text variant="caption" tone="muted">Medium lists have more room. A ListItem's children show at its end, in place of value.</Text>
|
|
21
|
+
<List size="md">
|
|
22
|
+
<For each="{{ releases }}" item="release" key="id">
|
|
23
|
+
<ListItem image="statics/logo.png" title="{{ release.title }}" subtitle="{{ release.artist }} · {{ release.year }}">
|
|
24
|
+
<Badge tone="{{ release.tone }}">{{ release.note }}</Badge>
|
|
25
|
+
</ListItem>
|
|
26
|
+
</For>
|
|
27
|
+
</List>
|
|
28
|
+
</View>
|
|
29
|
+
|
|
30
|
+
<View gap="small">
|
|
31
|
+
<Text variant="subtitle">onEndReached</Text>
|
|
32
|
+
<Text variant="caption" tone="muted">Comes when the last row scrolls into view, so the page can add more. {{ chart.length }} of {{ chartSize }} songs so far.</Text>
|
|
33
|
+
<List onEndReached="showMore">
|
|
34
|
+
<For each="{{ chart }}" item="song" key="id">
|
|
35
|
+
<ListItem title="{{ song.id }}. {{ song.title }}" value="{{ song.plays }}" />
|
|
36
|
+
</For>
|
|
37
|
+
</List>
|
|
38
|
+
</View>
|
|
39
|
+
|
|
40
|
+
<View gap="small">
|
|
41
|
+
<Text variant="subtitle">DetailRow</Text>
|
|
42
|
+
<Text variant="caption" tone="muted">A label with its value, such as on a receipt. tone and weight change the value.</Text>
|
|
43
|
+
<View variant="card" gap="none">
|
|
44
|
+
<DetailRow label="Show" value="Salone Sounds Live" />
|
|
45
|
+
<DetailRow label="Seats" value="2, near the stage" tone="muted" />
|
|
46
|
+
<DetailRow label="Doors open" value="18:00" tone="info" />
|
|
47
|
+
<DetailRow label="Status" value="Paid" tone="success" />
|
|
48
|
+
<DetailRow label="Refunds" value="Not after Friday" tone="warning" />
|
|
49
|
+
<DetailRow label="Total" value="SLE 800" weight="bold" />
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
|
|
53
|
+
<View gap="small">
|
|
54
|
+
<Text variant="subtitle">Disclosure</Text>
|
|
55
|
+
<Text variant="caption" tone="muted">A row that opens to show more, such as an answer. The person opens and closes it, and open sets how it starts.</Text>
|
|
56
|
+
<View variant="card" gap="none">
|
|
57
|
+
<Disclosure title="Can I get a refund?" subtitle="Tickets and refunds" open>
|
|
58
|
+
<Text>Yes, until the Friday before the show. After that, you can give your ticket to someone else.</Text>
|
|
59
|
+
</Disclosure>
|
|
60
|
+
<Divider />
|
|
61
|
+
<Disclosure title="When do doors open?">
|
|
62
|
+
<Text>At 6 pm. The music starts at 7.</Text>
|
|
63
|
+
</Disclosure>
|
|
64
|
+
<Divider />
|
|
65
|
+
<Disclosure title="Is there parking?">
|
|
66
|
+
<Text>Yes, at the Lumley junction car park, a short walk away.</Text>
|
|
67
|
+
</Disclosure>
|
|
68
|
+
</View>
|
|
69
|
+
</View>
|
|
70
|
+
|
|
71
|
+
<View gap="small">
|
|
72
|
+
<Text variant="subtitle">EmptyState</Text>
|
|
73
|
+
<Text variant="caption" tone="muted">Shows when a list has nothing in it, with a way forward.</Text>
|
|
74
|
+
<View variant="card">
|
|
75
|
+
<If condition="{{ saved.length > 0 }}">
|
|
76
|
+
<For each="{{ saved }}" item="title" key="*this">
|
|
77
|
+
<Text>{{ title }}</Text>
|
|
78
|
+
</For>
|
|
79
|
+
<Button variant="secondary" onClick="clearSaved">Clear</Button>
|
|
80
|
+
</If>
|
|
81
|
+
<Else>
|
|
82
|
+
<EmptyState icon="heart" title="No saved songs" text="Save a song to find it here later.">
|
|
83
|
+
<Button variant="secondary" onClick="saveSome">Save two songs</Button>
|
|
84
|
+
</EmptyState>
|
|
85
|
+
</Else>
|
|
86
|
+
</View>
|
|
87
|
+
</View>
|
|
88
|
+
</View>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import state from './state';
|
|
2
|
+
|
|
3
|
+
// The code this page accepts; a real dot checks it with its server.
|
|
4
|
+
const RIGHT_CODE = '123456';
|
|
5
|
+
|
|
6
|
+
// In dollars, as the pledge field sends them.
|
|
7
|
+
const MAX_PLEDGE = 1000;
|
|
8
|
+
|
|
9
|
+
export default definePage({
|
|
10
|
+
initialState: state,
|
|
11
|
+
configs: { navigationBar: { title: 'Money and codes' } },
|
|
12
|
+
mutations: {
|
|
13
|
+
setAmount: (_state, event: ValueEvent<number | null>) => {
|
|
14
|
+
const amount = event.detail.value;
|
|
15
|
+
if (!amount) {
|
|
16
|
+
return { amount, amountText: '', request: '' };
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
amount,
|
|
20
|
+
amountText: (amount / 100).toLocaleString('en-US', { minimumFractionDigits: 2 }),
|
|
21
|
+
request: `https://pay.example.com/tip?amount=${amount}¤cy=SLE&in=cents`,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
setCode: (_state, event: ValueEvent) => ({ code: event.detail.value, codeError: '' }),
|
|
25
|
+
checkCode: (_state, event: ValueEvent) => {
|
|
26
|
+
if (event.detail.value === RIGHT_CODE) {
|
|
27
|
+
return { verified: true };
|
|
28
|
+
}
|
|
29
|
+
return { code: '', codeError: 'That code is wrong. Try again.' };
|
|
30
|
+
},
|
|
31
|
+
startAgain: () => ({ verified: false, code: '' }),
|
|
32
|
+
setPin: (_state, event: ValueEvent) => ({ pin: event.detail.value }),
|
|
33
|
+
clearPin: () => ({ pin: '' }),
|
|
34
|
+
setLocked: (_state, event: CheckedEvent) => ({
|
|
35
|
+
locked: event.detail.checked,
|
|
36
|
+
}),
|
|
37
|
+
setPledge: (_state, event: ValueEvent<number | null>) => {
|
|
38
|
+
const pledge = event.detail.value;
|
|
39
|
+
return {
|
|
40
|
+
pledge,
|
|
41
|
+
pledgeError: pledge !== null && pledge > MAX_PLEDGE ? 'Pledge up to USD 1,000' : '',
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
amount: null as number | null,
|
|
3
|
+
// The amount with its thousands grouped, and what the QR code asks for.
|
|
4
|
+
amountText: '',
|
|
5
|
+
request: '',
|
|
6
|
+
code: '',
|
|
7
|
+
codeError: '',
|
|
8
|
+
verified: false,
|
|
9
|
+
pin: '',
|
|
10
|
+
locked: false,
|
|
11
|
+
pledge: null as number | null,
|
|
12
|
+
pledgeError: '',
|
|
13
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">Money and codes</Text>
|
|
3
|
+
<Text>Fields for amounts and codes, and QR codes to scan. Tip the band, pledge to its tour, and confirm your tickets.</Text>
|
|
4
|
+
|
|
5
|
+
<View gap="small">
|
|
6
|
+
<Text variant="subtitle">AmountInput</Text>
|
|
7
|
+
<Text variant="caption" tone="muted">Formats the amount as you type. It sends a number in cents, the minor unit, so 150 is SLE 1.50.</Text>
|
|
8
|
+
<AmountInput label="Tip for the band" placeholder="0.00" value="{{ amount }}" disabled="{{ locked }}" onChange="setAmount" hint="The QR code below asks for it" />
|
|
9
|
+
<Switch label="Lock the tip" checked="{{ locked }}" onChange="setLocked" />
|
|
10
|
+
</View>
|
|
11
|
+
|
|
12
|
+
<View gap="small">
|
|
13
|
+
<Text variant="subtitle">QRCode</Text>
|
|
14
|
+
<Text variant="caption" tone="muted">Shows text, such as a payment link, as a QR code. It's dark on light in every theme, so any camera can read it.</Text>
|
|
15
|
+
<View variant="card" align="center" gap="medium">
|
|
16
|
+
<If condition="{{ request }}">
|
|
17
|
+
<QRCode value="{{ request }}" size="180" label="A QR code to tip SLE {{ amountText }}" />
|
|
18
|
+
<Text tone="muted">Scan to tip the band SLE {{ amountText }}</Text>
|
|
19
|
+
</If>
|
|
20
|
+
<Else>
|
|
21
|
+
<EmptyState icon="qr-code" title="No tip yet" text="Type an amount above to make a QR code the crowd can scan." />
|
|
22
|
+
</Else>
|
|
23
|
+
</View>
|
|
24
|
+
</View>
|
|
25
|
+
|
|
26
|
+
<View gap="small">
|
|
27
|
+
<Text variant="subtitle">currency, unit and minorUnits</Text>
|
|
28
|
+
<Text variant="caption" tone="muted">In US dollars. unit="major" sends dollars, not cents, and minorUnits="0" leaves the cents off.</Text>
|
|
29
|
+
<AmountInput label="Pledge for the band's Mano River tour" currency="USD" unit="major" minorUnits="0" value="{{ pledge }}" error="{{ pledgeError }}" hint="Up to USD 1,000" onChange="setPledge" />
|
|
30
|
+
</View>
|
|
31
|
+
|
|
32
|
+
<View gap="small">
|
|
33
|
+
<Text variant="subtitle">CodeInput</Text>
|
|
34
|
+
<Text variant="caption" tone="muted">A one-time code, one box per digit. Type it, paste it, or let the phone fill it from an SMS. onComplete comes when the last box fills.</Text>
|
|
35
|
+
<If condition="{{ verified }}">
|
|
36
|
+
<Notice tone="success" title="Code accepted">Your two tickets are confirmed.</Notice>
|
|
37
|
+
<Button variant="secondary" onClick="startAgain">Start again</Button>
|
|
38
|
+
</If>
|
|
39
|
+
<Else>
|
|
40
|
+
<CodeInput label="The code we sent to 076 •••• 21" value="{{ code }}" onChange="setCode" onComplete="checkCode" error="{{ codeError }}" hint="Use 123456" />
|
|
41
|
+
</Else>
|
|
42
|
+
</View>
|
|
43
|
+
|
|
44
|
+
<View gap="small">
|
|
45
|
+
<Text variant="subtitle">A PIN</Text>
|
|
46
|
+
<Text variant="caption" tone="muted">length="4" and secure, which hides the digits. Here it locks once complete.</Text>
|
|
47
|
+
<CodeInput label="PIN" length="4" secure value="{{ pin }}" disabled="{{ pin.length === 4 }}" onChange="setPin" />
|
|
48
|
+
<View direction="row" align="center" gap="small">
|
|
49
|
+
<Text tone="muted">{{ pin.length }} of 4 digits</Text>
|
|
50
|
+
<View grow />
|
|
51
|
+
<Button variant="secondary" onClick="clearPin" disabled="{{ pin.length === 0 }}">Clear the PIN</Button>
|
|
52
|
+
</View>
|
|
53
|
+
</View>
|
|
54
|
+
</View>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// As a news app would get an article's body from its server. The lines are joined here so the
|
|
2
|
+
// production build stays on one line.
|
|
3
|
+
const body = [
|
|
4
|
+
"## What's on sale",
|
|
5
|
+
'',
|
|
6
|
+
'Stalls opened before dawn, and by eight the **rice** sellers had a queue. Prices are set each morning and shown at the gate:',
|
|
7
|
+
'',
|
|
8
|
+
'- Rice, a cup: SLE 5',
|
|
9
|
+
'- Palm oil, a pint: SLE 12',
|
|
10
|
+
'- Pepper, a heap: SLE 3',
|
|
11
|
+
'',
|
|
12
|
+
"> The roof keeps the rain off. That's half the battle in July.",
|
|
13
|
+
'',
|
|
14
|
+
"Read the [council's notice](https://example.com/lumley-market) for opening hours, or see _Getting there_ below.",
|
|
15
|
+
'',
|
|
16
|
+
'### Getting there',
|
|
17
|
+
'',
|
|
18
|
+
'Poda-podas from Lumley junction stop at the gate. The car park opens next month.',
|
|
19
|
+
].join('\n');
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
body,
|
|
23
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">Reading</Text>
|
|
3
|
+
<Text>Prose lays out long text, such as a news story, so it reads well. Quote sets someone's words apart. BulletList lists points. RichText draws Markdown from a server.</Text>
|
|
4
|
+
<Divider />
|
|
5
|
+
|
|
6
|
+
<Prose>
|
|
7
|
+
<Text variant="caption" tone="muted" weight="medium">FREETOWN · 11 OCTOBER</Text>
|
|
8
|
+
<Text variant="title">Lumley's new market opens to traders and a long queue</Text>
|
|
9
|
+
<Text variant="lead">More than two hundred traders moved into the covered market on Saturday, the first in the west of the city.</Text>
|
|
10
|
+
<Text variant="caption" tone="muted">By Mariama Kamara</Text>
|
|
11
|
+
<Text>The market took two years to build, on the old lorry park by the junction. Each trader has:</Text>
|
|
12
|
+
<BulletList>
|
|
13
|
+
<Bullet>
|
|
14
|
+
<Text>a stall with a lock</Text>
|
|
15
|
+
</Bullet>
|
|
16
|
+
<Bullet>
|
|
17
|
+
<Text>water at both ends of the hall</Text>
|
|
18
|
+
</Bullet>
|
|
19
|
+
<Bullet>
|
|
20
|
+
<Text>a place in the car park, from next month</Text>
|
|
21
|
+
</Bullet>
|
|
22
|
+
</BulletList>
|
|
23
|
+
<Quote cite="Fatmata Conteh, who sells cloth">
|
|
24
|
+
<Text>For twelve years I sold under an umbrella. Now I have a door that closes.</Text>
|
|
25
|
+
</Quote>
|
|
26
|
+
<Text>The council says it will open a second market in Kissy next year. <Text weight="bold">Stalls there are free</Text> for the first six months. To get one:</Text>
|
|
27
|
+
<BulletList ordered>
|
|
28
|
+
<Bullet>
|
|
29
|
+
<Text>Register at the council office in Lumley.</Text>
|
|
30
|
+
</Bullet>
|
|
31
|
+
<Bullet>
|
|
32
|
+
<Text>Bring a photo and your trader's card.</Text>
|
|
33
|
+
</Bullet>
|
|
34
|
+
<Bullet>
|
|
35
|
+
<Text>Wait for an SMS with your stall number.</Text>
|
|
36
|
+
</Bullet>
|
|
37
|
+
</BulletList>
|
|
38
|
+
<Divider />
|
|
39
|
+
<Text variant="caption" tone="muted">The rest of the story comes as Markdown from the newsroom's server, drawn by RichText.</Text>
|
|
40
|
+
</Prose>
|
|
41
|
+
<RichText markdown="{{ body }}" />
|
|
42
|
+
</View>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import state from './state';
|
|
2
|
+
|
|
3
|
+
export default definePage({
|
|
4
|
+
initialState: state,
|
|
5
|
+
configs: { navigationBar: { title: 'Sheets' } },
|
|
6
|
+
mutations: {
|
|
7
|
+
openRelease: (state, event: DataEvent<{ id: string }>) => ({
|
|
8
|
+
selected: state.releases.find((release) => release.id === event.data.id) ?? null,
|
|
9
|
+
}),
|
|
10
|
+
// A sheet doesn't close itself: the page sets `open` back to false.
|
|
11
|
+
closeRelease: () => ({ selected: null }),
|
|
12
|
+
openRating: () => ({ rating: true }),
|
|
13
|
+
closeRating: () => ({ rating: false }),
|
|
14
|
+
setStars: (_state, event: ValueEvent<number>) => ({ stars: event.detail.value }),
|
|
15
|
+
saveRating: (state) => ({ rating: false, saved: state.stars, toast: 'Thanks for rating' }),
|
|
16
|
+
clearToast: () => ({ toast: '' }),
|
|
17
|
+
},
|
|
18
|
+
actions: {
|
|
19
|
+
async copyTitle(state) {
|
|
20
|
+
if (!state.selected) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const { title, artist } = state.selected;
|
|
24
|
+
await this.dash.system.copyText(`${title}, by ${artist}`);
|
|
25
|
+
this.setState({ selected: null, toast: 'Title copied' });
|
|
26
|
+
},
|
|
27
|
+
async shareRelease(state) {
|
|
28
|
+
if (!state.selected) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const { title, artist, year } = state.selected;
|
|
32
|
+
this.setState({ selected: null });
|
|
33
|
+
await this.dash.system.share({ title, text: `${title}, by ${artist} (${year})` });
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface Release {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
artist: string;
|
|
5
|
+
year: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
releases: [
|
|
10
|
+
{
|
|
11
|
+
id: 'rise-and-shine',
|
|
12
|
+
title: 'Rise & Shine',
|
|
13
|
+
artist: "Sierra Leone's Refugee All Stars",
|
|
14
|
+
year: 2010,
|
|
15
|
+
},
|
|
16
|
+
{ id: 'kormot-bi-en-me', title: 'Kormot Bi En Me', artist: 'Steady Bongo', year: 1996 },
|
|
17
|
+
{ id: 'borbor-bele', title: 'Borbor Bele', artist: 'Emmerson', year: 2004 },
|
|
18
|
+
] as Release[],
|
|
19
|
+
// The record whose actions the sheet shows.
|
|
20
|
+
selected: null as Release | null,
|
|
21
|
+
// The rating sheet, and the rating it last saved.
|
|
22
|
+
rating: false,
|
|
23
|
+
stars: 3,
|
|
24
|
+
saved: 0,
|
|
25
|
+
toast: '',
|
|
26
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">Sheets</Text>
|
|
3
|
+
<Text>A Sheet slides up over the page while open is true. Tapping outside it, or its close icon, raises onClose. The page closes it by setting open back to false.</Text>
|
|
4
|
+
|
|
5
|
+
<View gap="small">
|
|
6
|
+
<Text variant="subtitle">An action sheet</Text>
|
|
7
|
+
<Text variant="caption" tone="muted">Tap a record to see what you can do with it.</Text>
|
|
8
|
+
<List>
|
|
9
|
+
<For each="{{ releases }}" item="release" key="id">
|
|
10
|
+
<ListItem icon="music" title="{{ release.title }}" subtitle="{{ release.artist }} · {{ release.year }}" data-id="{{ release.id }}" onTap="openRelease" />
|
|
11
|
+
</For>
|
|
12
|
+
</List>
|
|
13
|
+
</View>
|
|
14
|
+
|
|
15
|
+
<View gap="small">
|
|
16
|
+
<Text variant="subtitle">A sheet with a form</Text>
|
|
17
|
+
<Text variant="caption" tone="muted">Any component can go in a sheet. This one has no close icon, and more room inside.</Text>
|
|
18
|
+
<View variant="card" direction="row" align="center" gap="small">
|
|
19
|
+
<View grow>
|
|
20
|
+
<Text>{{ saved ? 'You gave ' + saved + ' stars' : 'Not rated yet' }}</Text>
|
|
21
|
+
</View>
|
|
22
|
+
<Button variant="secondary" onClick="openRating">Rate the show</Button>
|
|
23
|
+
</View>
|
|
24
|
+
</View>
|
|
25
|
+
|
|
26
|
+
<Sheet open="{{ selected !== null }}" title="{{ selected.title }} · {{ selected.year }}" showCloseIcon onClose="closeRelease">
|
|
27
|
+
<Button variant="secondary" onClick="copyTitle">Copy the title</Button>
|
|
28
|
+
<Button variant="secondary" onClick="shareRelease">Share it</Button>
|
|
29
|
+
<Button onClick="closeRelease">Cancel</Button>
|
|
30
|
+
</Sheet>
|
|
31
|
+
|
|
32
|
+
<Sheet open="{{ rating }}" title="Rate Salone Sounds Live" padding="large" onClose="closeRating">
|
|
33
|
+
<Slider label="Stars" min="1" max="5" showValue value="{{ stars }}" onChange="setStars" />
|
|
34
|
+
<Button onClick="saveRating">Save</Button>
|
|
35
|
+
</Sheet>
|
|
36
|
+
|
|
37
|
+
<Toast message="{{ toast }}" tone="success" onHide="clearToast" />
|
|
38
|
+
</View>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">Styles</Text>
|
|
3
|
+
<Text>A View's colours, outlines, corners and sizes come from the theme, so a dot looks right in light and dark.</Text>
|
|
4
|
+
|
|
5
|
+
<View gap="small">
|
|
6
|
+
<Text variant="subtitle">background</Text>
|
|
7
|
+
<Text variant="caption" tone="muted">With primary, write text with tone="onPrimary" so it reads.</Text>
|
|
8
|
+
<View background="primary" radius="large" padding="large" gap="small">
|
|
9
|
+
<Text variant="caption" tone="onPrimary">Your balance</Text>
|
|
10
|
+
<Text variant="display" tone="onPrimary" numeric>{{ balance }}</Text>
|
|
11
|
+
</View>
|
|
12
|
+
<Text variant="caption" tone="muted">The page's own colours</Text>
|
|
13
|
+
<View direction="row" gap="small" wrap>
|
|
14
|
+
<View background="background" border="subtle" radius="medium" padding="small">
|
|
15
|
+
<Text>background</Text>
|
|
16
|
+
</View>
|
|
17
|
+
<View background="surface" border="subtle" radius="medium" padding="small">
|
|
18
|
+
<Text>surface</Text>
|
|
19
|
+
</View>
|
|
20
|
+
<View background="muted" radius="medium" padding="small">
|
|
21
|
+
<Text>muted</Text>
|
|
22
|
+
</View>
|
|
23
|
+
</View>
|
|
24
|
+
<Text variant="caption" tone="muted">A tone is a soft tint</Text>
|
|
25
|
+
<View direction="row" gap="small" wrap>
|
|
26
|
+
<View background="info" radius="medium" padding="small">
|
|
27
|
+
<Text tone="info" weight="medium">New</Text>
|
|
28
|
+
</View>
|
|
29
|
+
<View background="success" radius="medium" padding="small">
|
|
30
|
+
<Text tone="success" weight="medium">Paid</Text>
|
|
31
|
+
</View>
|
|
32
|
+
<View background="warning" radius="medium" padding="small">
|
|
33
|
+
<Text tone="warning" weight="medium">Due Friday</Text>
|
|
34
|
+
</View>
|
|
35
|
+
<View background="danger" radius="medium" padding="small">
|
|
36
|
+
<Text tone="danger" weight="medium">Failed</Text>
|
|
37
|
+
</View>
|
|
38
|
+
</View>
|
|
39
|
+
</View>
|
|
40
|
+
|
|
41
|
+
<View gap="small">
|
|
42
|
+
<Text variant="subtitle">Theme colours</Text>
|
|
43
|
+
<Text variant="caption" tone="muted">The dot's own colours, named in dot.ts: gold and ink. Use the names as a background or a text tone.</Text>
|
|
44
|
+
<View direction="row" gap="small" align="center">
|
|
45
|
+
<View background="gold" radius="full" paddingTop="small" paddingBottom="small" paddingStart="medium" paddingEnd="medium">
|
|
46
|
+
<Text weight="medium" tone="ink">Gold member</Text>
|
|
47
|
+
</View>
|
|
48
|
+
<Text tone="gold" weight="bold">Since 2024</Text>
|
|
49
|
+
</View>
|
|
50
|
+
</View>
|
|
51
|
+
|
|
52
|
+
<View gap="small">
|
|
53
|
+
<Text variant="subtitle">border and radius</Text>
|
|
54
|
+
<Text variant="caption" tone="muted">border is none, subtle or strong. radius rounds the corners, and full makes a circle or a pill.</Text>
|
|
55
|
+
<View direction="row" gap="medium" align="end" wrap>
|
|
56
|
+
<View width="56" height="56" background="muted" radius="none" />
|
|
57
|
+
<View width="56" height="56" background="muted" radius="small" />
|
|
58
|
+
<View width="56" height="56" background="muted" radius="medium" />
|
|
59
|
+
<View width="56" height="56" background="muted" radius="large" />
|
|
60
|
+
<View width="56" height="56" background="muted" radius="full" />
|
|
61
|
+
<View width="56" height="56" border="subtle" radius="medium" />
|
|
62
|
+
<View width="56" height="56" border="strong" radius="medium" />
|
|
63
|
+
</View>
|
|
64
|
+
</View>
|
|
65
|
+
|
|
66
|
+
<View gap="small">
|
|
67
|
+
<Text variant="subtitle">width and height</Text>
|
|
68
|
+
<Text variant="caption" tone="muted">In points, or fill for all the room there is.</Text>
|
|
69
|
+
<View background="muted" radius="medium" width="120" height="40" justify="center" align="center">
|
|
70
|
+
<Text>120 points</Text>
|
|
71
|
+
</View>
|
|
72
|
+
<View background="muted" radius="medium" width="fill" height="40" justify="center" align="center">
|
|
73
|
+
<Text>fill</Text>
|
|
74
|
+
</View>
|
|
75
|
+
</View>
|
|
76
|
+
|
|
77
|
+
<View gap="small">
|
|
78
|
+
<Text variant="subtitle">minHeight, maxWidth and aspect</Text>
|
|
79
|
+
<Text variant="caption" tone="muted">minHeight keeps a box tall when it holds little. maxWidth stops it growing too wide. aspect sets its height from its width.</Text>
|
|
80
|
+
<View variant="card" minHeight="96" justify="center">
|
|
81
|
+
<Text>At least 96 points tall</Text>
|
|
82
|
+
</View>
|
|
83
|
+
<View variant="card" maxWidth="200">
|
|
84
|
+
<Text>No wider than 200 points, however wide the phone is</Text>
|
|
85
|
+
</View>
|
|
86
|
+
<View background="muted" radius="large" aspect="16:9" justify="center" align="center">
|
|
87
|
+
<Text>16:9</Text>
|
|
88
|
+
</View>
|
|
89
|
+
</View>
|
|
90
|
+
|
|
91
|
+
<View gap="small">
|
|
92
|
+
<Text variant="subtitle">Together</Text>
|
|
93
|
+
<Text variant="caption" tone="muted">A price with even digits, and the old one crossed out.</Text>
|
|
94
|
+
<View variant="card" direction="row" align="center" gap="small">
|
|
95
|
+
<Text variant="subtitle">Freetown Jazz Night</Text>
|
|
96
|
+
<View grow />
|
|
97
|
+
<Text tone="muted" decoration="strikethrough" numeric>SLE 150</Text>
|
|
98
|
+
<Text weight="bold" numeric>SLE 120</Text>
|
|
99
|
+
</View>
|
|
100
|
+
</View>
|
|
101
|
+
</View>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Release } from './state';
|
|
2
|
+
import state from './state';
|
|
3
|
+
|
|
4
|
+
export default definePage({
|
|
5
|
+
initialState: state,
|
|
6
|
+
configs: { navigationBar: { title: 'Tabs and chips' } },
|
|
7
|
+
mutations: {
|
|
8
|
+
chooseTab: (state, event: ValueEvent) => {
|
|
9
|
+
const tab = event.detail.value;
|
|
10
|
+
return { tab, shown: filter(state.releases, { ...state, tab }) };
|
|
11
|
+
},
|
|
12
|
+
chooseGenre: (state, event: DataEvent<{ genre: string }>) => {
|
|
13
|
+
const { genre } = event.data;
|
|
14
|
+
return { genre, shown: filter(state.releases, { ...state, genre }) };
|
|
15
|
+
},
|
|
16
|
+
search: (state, event: ValueEvent) => {
|
|
17
|
+
const query = event.detail.value;
|
|
18
|
+
return { query, shown: filter(state.releases, { ...state, query }) };
|
|
19
|
+
},
|
|
20
|
+
clearFilters: (state) => ({ tab: 'all', genre: 'All', query: '', shown: state.releases }),
|
|
21
|
+
chooseWhere: (_state, event: ValueEvent) => ({ where: event.detail.value }),
|
|
22
|
+
toggleLiked: (state) => ({ liked: !state.liked }),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
interface Filters {
|
|
27
|
+
tab: string;
|
|
28
|
+
genre: string;
|
|
29
|
+
// Words the title contains, in any case.
|
|
30
|
+
query: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function filter(releases: readonly Release[], { tab, genre, query }: Filters): Release[] {
|
|
34
|
+
const words = query.trim().toLowerCase();
|
|
35
|
+
return releases.filter(
|
|
36
|
+
(release) =>
|
|
37
|
+
(tab === 'all' || release.kind === tab) &&
|
|
38
|
+
(genre === 'All' || release.genre === genre) &&
|
|
39
|
+
release.title.toLowerCase().includes(words),
|
|
40
|
+
);
|
|
41
|
+
}
|