@monimesl/dot-cli 0.1.0-alpha.16 → 0.1.0-alpha.19
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/cli.js +16 -9
- package/dist/cli.js.map +1 -1
- package/dist/templates/showcase/dot.ts +32 -17
- 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/{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/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 +37 -0
- package/dist/templates/showcase/pages/basics/hooks/state.ts +10 -0
- package/dist/templates/showcase/pages/basics/hooks/view.dml +32 -0
- package/dist/templates/showcase/pages/basics/navigation/controller.ts +34 -0
- package/dist/templates/showcase/pages/basics/navigation/state.ts +9 -0
- package/dist/templates/showcase/pages/basics/navigation/view.dml +37 -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 +1 -0
- package/dist/templates/showcase/pages/{carousel → components/carousel}/view.dml +7 -5
- package/dist/templates/showcase/pages/{feedback → components/feedback}/controller.ts +1 -0
- package/dist/templates/showcase/pages/{feedback → components/feedback}/view.dml +18 -9
- package/dist/templates/showcase/pages/{forms → components/forms}/controller.ts +5 -1
- package/dist/templates/showcase/pages/{forms → components/forms}/state.ts +3 -0
- package/dist/templates/showcase/pages/components/forms/view.dml +90 -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 +1 -0
- package/dist/templates/showcase/pages/components/images/view.dml +70 -0
- package/dist/templates/showcase/pages/{layout → components/layout}/controller.ts +1 -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/{lists → components/lists}/state.ts +43 -30
- package/dist/templates/showcase/pages/components/lists/view.dml +70 -0
- package/dist/templates/showcase/pages/{payments → components/money}/controller.ts +1 -0
- package/dist/templates/showcase/pages/{payments → components/money}/view.dml +17 -8
- 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 +9 -10
- 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/{styles → components/styles}/controller.ts +1 -0
- package/dist/templates/showcase/pages/components/styles/view.dml +101 -0
- package/dist/templates/showcase/pages/{filters → components/tabs}/controller.ts +2 -0
- package/dist/templates/showcase/pages/{filters → components/tabs}/state.ts +1 -0
- package/dist/templates/showcase/pages/components/tabs/view.dml +56 -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/{cache → dash/cache}/controller.ts +5 -0
- package/dist/templates/showcase/pages/dash/cache/view.dml +48 -0
- package/dist/templates/showcase/pages/dash/calls/controller.ts +49 -0
- package/dist/templates/showcase/pages/dash/calls/state.ts +6 -0
- package/dist/templates/showcase/pages/dash/calls/view.dml +51 -0
- package/dist/templates/showcase/pages/{files → dash/files}/controller.ts +1 -0
- package/dist/templates/showcase/pages/dash/files/view.dml +79 -0
- package/dist/templates/showcase/pages/dash/media/controller.ts +33 -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/{network → dash/network}/controller.ts +14 -5
- package/dist/templates/showcase/pages/{network → dash/network}/state.ts +4 -1
- package/dist/templates/showcase/pages/dash/network/view.dml +80 -0
- package/dist/templates/showcase/pages/{secrets → dash/secrets}/controller.ts +1 -0
- package/dist/templates/showcase/pages/dash/secrets/view.dml +26 -0
- package/dist/templates/showcase/pages/dash/system/controller.ts +62 -0
- package/dist/templates/showcase/pages/dash/system/state.ts +9 -0
- package/dist/templates/showcase/pages/dash/system/view.dml +59 -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/state.ts +135 -64
- package/dist/templates/showcase/pages/index/view.dml +6 -3
- package/package.json +6 -6
- package/dist/templates/showcase/pages/cache/view.dml +0 -36
- package/dist/templates/showcase/pages/device/controller.ts +0 -105
- package/dist/templates/showcase/pages/device/state.ts +0 -16
- package/dist/templates/showcase/pages/device/view.dml +0 -69
- package/dist/templates/showcase/pages/files/view.dml +0 -64
- 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/secrets/view.dml +0 -24
- package/dist/templates/showcase/pages/state/view.dml +0 -33
- package/dist/templates/showcase/pages/styles/view.dml +0 -61
- 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/{carousel → components/carousel}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{feedback → components/feedback}/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/{styles → components/styles}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{cache → dash/cache}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{files → dash/files}/state.ts +0 -0
- /package/dist/templates/showcase/pages/{secrets → dash/secrets}/state.ts +0 -0
|
@@ -10,6 +10,7 @@ const MAX_PLEDGE = 1000;
|
|
|
10
10
|
|
|
11
11
|
export default definePage({
|
|
12
12
|
initialState: state,
|
|
13
|
+
configs: { navigationBar: { title: 'Money and codes' } },
|
|
13
14
|
mutations: {
|
|
14
15
|
setAmount: (_state, event: DotEvent<{ value: number | null }>) => {
|
|
15
16
|
const amount = event.detail.value;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
<View>
|
|
2
|
-
<Text variant="title">
|
|
3
|
-
<Text>Fields for
|
|
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
4
|
|
|
5
5
|
<View gap="small">
|
|
6
|
-
<Text variant="
|
|
7
|
-
<
|
|
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" />
|
|
8
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>
|
|
9
15
|
<View variant="card" align="center" gap="medium">
|
|
10
16
|
<If condition="{{ request }}">
|
|
11
17
|
<QRCode value="{{ request }}" size="180" label="A QR code to tip SLE {{ amountText }}" />
|
|
@@ -18,12 +24,14 @@
|
|
|
18
24
|
</View>
|
|
19
25
|
|
|
20
26
|
<View gap="small">
|
|
21
|
-
<Text variant="
|
|
22
|
-
<
|
|
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" />
|
|
23
30
|
</View>
|
|
24
31
|
|
|
25
32
|
<View gap="small">
|
|
26
|
-
<Text variant="
|
|
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>
|
|
27
35
|
<If condition="{{ verified }}">
|
|
28
36
|
<Notice tone="success" title="Code accepted">Your two tickets are confirmed.</Notice>
|
|
29
37
|
<Button variant="secondary" onClick="startAgain">Start again</Button>
|
|
@@ -34,7 +42,8 @@
|
|
|
34
42
|
</View>
|
|
35
43
|
|
|
36
44
|
<View gap="small">
|
|
37
|
-
<Text variant="
|
|
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>
|
|
38
47
|
<CodeInput label="PIN" length="4" secure value="{{ pin }}" disabled="{{ pin.length === 4 }}" onChange="setPin" />
|
|
39
48
|
<View direction="row" align="center" gap="small">
|
|
40
49
|
<Text tone="muted">{{ pin.length }} of 4 digits</Text>
|
|
@@ -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>
|
|
@@ -2,15 +2,17 @@ import state from './state';
|
|
|
2
2
|
|
|
3
3
|
export default definePage({
|
|
4
4
|
initialState: state,
|
|
5
|
+
configs: { navigationBar: { title: 'Sheets' } },
|
|
5
6
|
mutations: {
|
|
6
|
-
choose: (state, event: DotEvent<unknown, { id: string }>) => {
|
|
7
|
-
const artist = state.artists.find((candidate) => candidate.id === event.data.id);
|
|
8
|
-
return { chosen: artist?.name ?? '' };
|
|
9
|
-
},
|
|
10
7
|
openRelease: (state, event: DotEvent<unknown, { id: string }>) => ({
|
|
11
8
|
selected: state.releases.find((release) => release.id === event.data.id) ?? null,
|
|
12
9
|
}),
|
|
13
|
-
|
|
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: DotEvent<{ value: number }>) => ({ stars: event.detail.value }),
|
|
15
|
+
saveRating: (state) => ({ rating: false, saved: state.stars, toast: 'Thanks for rating' }),
|
|
14
16
|
clearToast: () => ({ toast: '' }),
|
|
15
17
|
},
|
|
16
18
|
actions: {
|
|
@@ -26,12 +28,9 @@ export default definePage({
|
|
|
26
28
|
if (!state.selected) {
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
|
-
const { title, artist, year
|
|
31
|
+
const { title, artist, year } = state.selected;
|
|
30
32
|
this.setState({ selected: null });
|
|
31
|
-
await this.dash.system.share({
|
|
32
|
-
title,
|
|
33
|
-
text: `${title}, by ${artist} (${year}): ${note.toLowerCase()}.`,
|
|
34
|
-
});
|
|
33
|
+
await this.dash.system.share({ title, text: `${title}, by ${artist} (${year})` });
|
|
35
34
|
},
|
|
36
35
|
},
|
|
37
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>
|
|
@@ -5,6 +5,7 @@ type Chosen = DotEvent<{ value: string }>;
|
|
|
5
5
|
|
|
6
6
|
export default definePage({
|
|
7
7
|
initialState: state,
|
|
8
|
+
configs: { navigationBar: { title: 'Tabs and chips' } },
|
|
8
9
|
mutations: {
|
|
9
10
|
chooseTab: (state, event: Chosen) => {
|
|
10
11
|
const tab = event.detail.value;
|
|
@@ -16,6 +17,7 @@ export default definePage({
|
|
|
16
17
|
},
|
|
17
18
|
clearFilters: (state) => ({ tab: 'all', genre: 'All', shown: state.releases }),
|
|
18
19
|
chooseWhere: (_state, event: Chosen) => ({ where: event.detail.value }),
|
|
20
|
+
toggleLiked: (state) => ({ liked: !state.liked }),
|
|
19
21
|
},
|
|
20
22
|
});
|
|
21
23
|
|
|
@@ -67,6 +67,7 @@ export default {
|
|
|
67
67
|
songs: releases.filter((item) => item.kind === 'song').length,
|
|
68
68
|
genres: ['All', 'Kriofusion', 'Afropop', 'Hip hop', 'R&B', 'Palm-wine', 'Gospel', 'Bubu'],
|
|
69
69
|
genre: 'All',
|
|
70
|
+
liked: false,
|
|
70
71
|
// Shows at home in Sierra Leone, and abroad in the Mano River region.
|
|
71
72
|
where: 'home',
|
|
72
73
|
home: [
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">Tabs and chips</Text>
|
|
3
|
+
<Text>Tabs change what the page shows. Chips narrow it down. Try Songs with Palm-wine: nothing matches.</Text>
|
|
4
|
+
|
|
5
|
+
<View gap="small">
|
|
6
|
+
<Text variant="subtitle">Tabs and Chip</Text>
|
|
7
|
+
<Text variant="caption" tone="muted">The underline tabs, with a badge for each count. A chip is selected when the page says so.</Text>
|
|
8
|
+
<Tabs variant="underline" value="{{ tab }}" onChange="chooseTab">
|
|
9
|
+
<Tab value="all" label="All" />
|
|
10
|
+
<Tab value="album" label="Albums" badge="{{ albums }}" />
|
|
11
|
+
<Tab value="song" label="Songs" badge="{{ songs }}" />
|
|
12
|
+
</Tabs>
|
|
13
|
+
<View direction="row" gap="small" wrap>
|
|
14
|
+
<For each="{{ genres }}" item="option" key="*this">
|
|
15
|
+
<Chip label="{{ option }}" selected="{{ option === genre }}" data-genre="{{ option }}" onTap="chooseGenre" />
|
|
16
|
+
</For>
|
|
17
|
+
</View>
|
|
18
|
+
<If condition="{{ shown.length > 0 }}">
|
|
19
|
+
<List>
|
|
20
|
+
<For each="{{ shown }}" item="release" key="id">
|
|
21
|
+
<ListItem icon="{{ release.kind === 'album' ? 'playlist' : 'music' }}" title="{{ release.title }}" subtitle="{{ release.artist }} · {{ release.genre }}">
|
|
22
|
+
<Badge>{{ release.year }}</Badge>
|
|
23
|
+
</ListItem>
|
|
24
|
+
</For>
|
|
25
|
+
</List>
|
|
26
|
+
</If>
|
|
27
|
+
<Else>
|
|
28
|
+
<EmptyState icon="search" title="Nothing here" text="No release matches this tab and genre.">
|
|
29
|
+
<Button variant="secondary" onClick="clearFilters">Clear filters</Button>
|
|
30
|
+
</EmptyState>
|
|
31
|
+
</Else>
|
|
32
|
+
</View>
|
|
33
|
+
|
|
34
|
+
<View gap="small">
|
|
35
|
+
<Text variant="subtitle">Chip with an icon</Text>
|
|
36
|
+
<Text variant="caption" tone="muted">A disabled chip can't be tapped, such as a filter with nothing behind it.</Text>
|
|
37
|
+
<View direction="row" gap="small" wrap>
|
|
38
|
+
<Chip icon="heart" label="Liked" selected="{{ liked }}" onTap="toggleLiked" />
|
|
39
|
+
<Chip icon="download" label="Downloaded" disabled />
|
|
40
|
+
</View>
|
|
41
|
+
</View>
|
|
42
|
+
|
|
43
|
+
<View gap="small">
|
|
44
|
+
<Text variant="subtitle">variant="segmented"</Text>
|
|
45
|
+
<Text variant="caption" tone="muted">For a few short choices. Shows at home and in the Mano River region.</Text>
|
|
46
|
+
<Tabs variant="segmented" value="{{ where }}" onChange="chooseWhere">
|
|
47
|
+
<Tab value="home" label="Sierra Leone" />
|
|
48
|
+
<Tab value="abroad" label="Abroad" />
|
|
49
|
+
</Tabs>
|
|
50
|
+
<List>
|
|
51
|
+
<For each="{{ where === 'home' ? home : abroad }}" item="show" key="id">
|
|
52
|
+
<ListItem icon="ticket" title="{{ show.title }}" subtitle="{{ show.place }} · {{ show.date }}" value="{{ show.city }}" />
|
|
53
|
+
</For>
|
|
54
|
+
</List>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import state from './state';
|
|
2
|
+
|
|
3
|
+
export default definePage({
|
|
4
|
+
initialState: state,
|
|
5
|
+
configs: { navigationBar: { title: 'Text and links' } },
|
|
6
|
+
mutations: {
|
|
7
|
+
like: (state) => ({ likes: state.likes + 1 }),
|
|
8
|
+
unlike: (state) => ({ likes: Math.max(0, state.likes - 1) }),
|
|
9
|
+
},
|
|
10
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">Text and links</Text>
|
|
3
|
+
<Text>Text shows words. Its variant sets the size, and the theme sets the font and colours.</Text>
|
|
4
|
+
|
|
5
|
+
<View gap="small">
|
|
6
|
+
<Text variant="subtitle">variant</Text>
|
|
7
|
+
<View variant="card" gap="small">
|
|
8
|
+
<Text variant="display" numeric>SLE 1,250</Text>
|
|
9
|
+
<Text variant="title">Palm-wine, a title</Text>
|
|
10
|
+
<Text variant="subtitle">S. E. Rogie, a subtitle</Text>
|
|
11
|
+
<Text variant="lead">A lead opens an article. It's a little bigger than body text.</Text>
|
|
12
|
+
<Text variant="body">Guitar music for a calm evening. This is body text, the default.</Text>
|
|
13
|
+
<Text variant="caption">Recorded in Freetown, in a caption</Text>
|
|
14
|
+
</View>
|
|
15
|
+
</View>
|
|
16
|
+
|
|
17
|
+
<View gap="small">
|
|
18
|
+
<Text variant="subtitle">tone</Text>
|
|
19
|
+
<View variant="card" direction="row" wrap gap="medium">
|
|
20
|
+
<Text tone="default">default</Text>
|
|
21
|
+
<Text tone="muted">muted</Text>
|
|
22
|
+
<Text tone="info">info</Text>
|
|
23
|
+
<Text tone="success">success</Text>
|
|
24
|
+
<Text tone="warning">warning</Text>
|
|
25
|
+
<Text tone="danger">danger</Text>
|
|
26
|
+
</View>
|
|
27
|
+
</View>
|
|
28
|
+
|
|
29
|
+
<View gap="small">
|
|
30
|
+
<Text variant="subtitle">weight, italic and decoration</Text>
|
|
31
|
+
<View variant="card" gap="small">
|
|
32
|
+
<View direction="row" wrap gap="medium">
|
|
33
|
+
<Text weight="regular">regular</Text>
|
|
34
|
+
<Text weight="medium">medium</Text>
|
|
35
|
+
<Text weight="bold">bold</Text>
|
|
36
|
+
<Text italic>italic</Text>
|
|
37
|
+
</View>
|
|
38
|
+
<View direction="row" wrap gap="medium">
|
|
39
|
+
<Text decoration="underline">underline</Text>
|
|
40
|
+
<Text decoration="strikethrough">strikethrough</Text>
|
|
41
|
+
<Text decoration="none">none</Text>
|
|
42
|
+
</View>
|
|
43
|
+
</View>
|
|
44
|
+
</View>
|
|
45
|
+
|
|
46
|
+
<View gap="small">
|
|
47
|
+
<Text variant="subtitle">align and numeric</Text>
|
|
48
|
+
<Text variant="caption" tone="muted">numeric gives every digit the same width, so amounts line up.</Text>
|
|
49
|
+
<View variant="card" gap="small">
|
|
50
|
+
<Text align="start">At the start</Text>
|
|
51
|
+
<Text align="center">In the center</Text>
|
|
52
|
+
<Text align="end">At the end</Text>
|
|
53
|
+
<Text align="end" numeric>SLE 1,111.11</Text>
|
|
54
|
+
<Text align="end" numeric>SLE 8,888.88</Text>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
|
|
58
|
+
<View gap="small">
|
|
59
|
+
<Text variant="subtitle">maxLines</Text>
|
|
60
|
+
<Text variant="caption" tone="muted">Cuts the text off after this many lines.</Text>
|
|
61
|
+
<View variant="card">
|
|
62
|
+
<Text maxLines="2">Sierra Leone's Refugee All Stars came together in refugee camps in Guinea, recorded their first album, Living Like a Refugee, back in Freetown, and carried Salone music to stages around the world. Two lines are allowed here, so the rest is cut off.</Text>
|
|
63
|
+
</View>
|
|
64
|
+
</View>
|
|
65
|
+
|
|
66
|
+
<View gap="small">
|
|
67
|
+
<Text variant="subtitle">leading and selectable</Text>
|
|
68
|
+
<Text variant="caption" tone="muted">leading moves the lines closer or further apart. selectable lets the person copy the text: hold your finger on the last one.</Text>
|
|
69
|
+
<View variant="card" gap="medium">
|
|
70
|
+
<Text leading="tight">Tight lines. Palm-wine music grew in the bars of Freetown, played on guitar and sung in Krio.</Text>
|
|
71
|
+
<Text leading="normal">Normal lines. Palm-wine music grew in the bars of Freetown, played on guitar and sung in Krio.</Text>
|
|
72
|
+
<Text leading="relaxed" selectable>Relaxed lines, and you can select them. Palm-wine music grew in the bars of Freetown, played on guitar and sung in Krio.</Text>
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
|
|
76
|
+
<View gap="small">
|
|
77
|
+
<Text variant="subtitle">Text inside text</Text>
|
|
78
|
+
<View variant="card">
|
|
79
|
+
<Text>Text can hold <Text weight="bold">bold</Text> and <Text tone="danger">red</Text> words.</Text>
|
|
80
|
+
</View>
|
|
81
|
+
</View>
|
|
82
|
+
|
|
83
|
+
<View gap="small">
|
|
84
|
+
<Text variant="subtitle">Link</Text>
|
|
85
|
+
<Text variant="caption" tone="muted">With href, a link opens a web page in the phone's browser. With onTap, it runs a handler.</Text>
|
|
86
|
+
<View variant="card" gap="small">
|
|
87
|
+
<Text>Read about <Link href="https://en.wikipedia.org/wiki/Music_of_Sierra_Leone">the music of Sierra Leone</Link>.</Text>
|
|
88
|
+
<View direction="row" gap="medium">
|
|
89
|
+
<Link onTap="like">Like the song</Link>
|
|
90
|
+
<Link tone="danger" onTap="unlike">Take it back</Link>
|
|
91
|
+
</View>
|
|
92
|
+
<Text tone="muted">{{ likes }} {{ likes === 1 ? 'like' : 'likes' }}</Text>
|
|
93
|
+
</View>
|
|
94
|
+
</View>
|
|
95
|
+
</View>
|
|
@@ -6,6 +6,7 @@ const RECENT_SECONDS = 30;
|
|
|
6
6
|
|
|
7
7
|
export default definePage({
|
|
8
8
|
initialState: state,
|
|
9
|
+
configs: { navigationBar: { title: 'dash.storage.cache' } },
|
|
9
10
|
hooks: {
|
|
10
11
|
async onShow() {
|
|
11
12
|
await this.actions.refresh();
|
|
@@ -37,6 +38,10 @@ export default definePage({
|
|
|
37
38
|
await this.dash.storage.cache.set(GENRE, event.detail.value);
|
|
38
39
|
await this.actions.refresh();
|
|
39
40
|
},
|
|
41
|
+
async forgetGenre() {
|
|
42
|
+
await this.dash.storage.cache.remove(GENRE);
|
|
43
|
+
await this.actions.refresh();
|
|
44
|
+
},
|
|
40
45
|
async clear() {
|
|
41
46
|
await this.dash.storage.cache.clear();
|
|
42
47
|
await this.actions.refresh();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<View>
|
|
2
|
+
<Text variant="title">dash.storage.cache</Text>
|
|
3
|
+
<Text>The cache keeps small values by name, such as text, numbers or JSON. A value can expire after a while, or stay until it's removed.</Text>
|
|
4
|
+
|
|
5
|
+
<View gap="small">
|
|
6
|
+
<Text variant="subtitle">set with a ttl, keys and get</Text>
|
|
7
|
+
<Text variant="caption" tone="muted">Tap an artist. ttl: 30 keeps it for 30 seconds.</Text>
|
|
8
|
+
<List>
|
|
9
|
+
<For each="{{ artists }}" item="artist" key="id">
|
|
10
|
+
<ListItem icon="microphone" title="{{ artist.name }}" data-id="{{ artist.id }}" data-name="{{ artist.name }}" onTap="view" />
|
|
11
|
+
</For>
|
|
12
|
+
</List>
|
|
13
|
+
<View variant="card" gap="small">
|
|
14
|
+
<If condition="{{ recent.length > 0 }}">
|
|
15
|
+
<For each="{{ recent }}" item="name" key="*this">
|
|
16
|
+
<Text>{{ name }}</Text>
|
|
17
|
+
</For>
|
|
18
|
+
</If>
|
|
19
|
+
<Else>
|
|
20
|
+
<Text variant="caption" tone="muted">No artists viewed in the last 30 seconds</Text>
|
|
21
|
+
</Else>
|
|
22
|
+
<Button variant="secondary" onClick="refresh">Check again</Button>
|
|
23
|
+
</View>
|
|
24
|
+
</View>
|
|
25
|
+
|
|
26
|
+
<View gap="small">
|
|
27
|
+
<Text variant="subtitle">set without a ttl, and exists</Text>
|
|
28
|
+
<Text variant="caption" tone="muted">Your favourite genre stays until it's removed, even after the dot closes.</Text>
|
|
29
|
+
<View variant="card">
|
|
30
|
+
<Select label="Genre" placeholder="Choose a genre" value="{{ genre }}" onChange="setGenre">
|
|
31
|
+
<Option value="Afropop" label="Afropop" />
|
|
32
|
+
<Option value="Palm-wine" label="Palm-wine" />
|
|
33
|
+
<Option value="Gumbe" label="Gumbe" />
|
|
34
|
+
</Select>
|
|
35
|
+
</View>
|
|
36
|
+
</View>
|
|
37
|
+
|
|
38
|
+
<View gap="small">
|
|
39
|
+
<Text variant="subtitle">remove and clear</Text>
|
|
40
|
+
<View variant="card" gap="small">
|
|
41
|
+
<Text>Keys in the cache: {{ keys || 'none' }}</Text>
|
|
42
|
+
<View direction="row" wrap gap="small">
|
|
43
|
+
<Button variant="secondary" onClick="forgetGenre" disabled="{{ !genre }}">Forget the genre</Button>
|
|
44
|
+
<Button variant="secondary" onClick="clear" disabled="{{ !keys }}">Clear the cache</Button>
|
|
45
|
+
</View>
|
|
46
|
+
</View>
|
|
47
|
+
</View>
|
|
48
|
+
</View>
|