@monimesl/dot-cli 0.1.0-alpha.8 → 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.
Files changed (162) hide show
  1. package/README.md +75 -54
  2. package/dist/cli.js +628 -348
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{server-DFOUQnLA.js → server-DMnWDdJ6.js} +582 -537
  5. package/dist/server-DMnWDdJ6.js.map +1 -0
  6. package/dist/templates/showcase/.env +1 -1
  7. package/dist/templates/showcase/dot.ts +53 -14
  8. package/dist/templates/showcase/pages/basics/bars/controller.ts +47 -0
  9. package/dist/templates/showcase/pages/basics/bars/state.ts +7 -0
  10. package/dist/templates/showcase/pages/basics/bars/view.dml +36 -0
  11. package/dist/templates/showcase/pages/basics/bindings/controller.ts +15 -0
  12. package/dist/templates/showcase/pages/basics/bindings/state.ts +14 -0
  13. package/dist/templates/showcase/pages/basics/bindings/view.dml +41 -0
  14. package/dist/templates/showcase/pages/basics/colors/controller.ts +112 -0
  15. package/dist/templates/showcase/pages/basics/colors/palette.ts +52 -0
  16. package/dist/templates/showcase/pages/basics/colors/state.ts +17 -0
  17. package/dist/templates/showcase/pages/basics/colors/view.dml +142 -0
  18. package/dist/templates/showcase/pages/basics/concert/controller.ts +16 -0
  19. package/dist/templates/showcase/pages/basics/concert/state.ts +7 -0
  20. package/dist/templates/showcase/pages/basics/concert/view.dml +20 -0
  21. package/dist/templates/showcase/pages/basics/control-flow/controller.ts +18 -0
  22. package/dist/templates/showcase/pages/basics/control-flow/state.ts +16 -0
  23. package/dist/templates/showcase/pages/basics/control-flow/view.dml +55 -0
  24. package/dist/templates/showcase/pages/basics/events/controller.ts +43 -0
  25. package/dist/templates/showcase/pages/basics/events/state.ts +11 -0
  26. package/dist/templates/showcase/pages/basics/events/view.dml +51 -0
  27. package/dist/templates/showcase/pages/basics/hooks/controller.ts +43 -0
  28. package/dist/templates/showcase/pages/basics/hooks/state.ts +10 -0
  29. package/dist/templates/showcase/pages/basics/hooks/view.dml +37 -0
  30. package/dist/templates/showcase/pages/basics/navigation/controller.ts +41 -0
  31. package/dist/templates/showcase/pages/basics/navigation/state.ts +11 -0
  32. package/dist/templates/showcase/pages/basics/navigation/view.dml +48 -0
  33. package/dist/templates/showcase/pages/basics/pick-genre/controller.ts +18 -0
  34. package/dist/templates/showcase/pages/basics/pick-genre/state.ts +3 -0
  35. package/dist/templates/showcase/pages/basics/pick-genre/view.dml +10 -0
  36. package/dist/templates/showcase/pages/basics/share/concerts.ts +31 -0
  37. package/dist/templates/showcase/pages/basics/share/controller.ts +12 -0
  38. package/dist/templates/showcase/pages/basics/share/state.ts +5 -0
  39. package/dist/templates/showcase/pages/basics/share/view.dml +21 -0
  40. package/dist/templates/showcase/pages/{state → basics/state}/controller.ts +1 -0
  41. package/dist/templates/showcase/pages/{state → basics/state}/state.ts +1 -1
  42. package/dist/templates/showcase/pages/basics/state/view.dml +46 -0
  43. package/dist/templates/showcase/pages/components/carousel/controller.ts +41 -0
  44. package/dist/templates/showcase/pages/components/carousel/state.ts +77 -0
  45. package/dist/templates/showcase/pages/components/carousel/view.dml +42 -0
  46. package/dist/templates/showcase/pages/components/feedback/controller.ts +32 -0
  47. package/dist/templates/showcase/pages/components/feedback/state.ts +41 -0
  48. package/dist/templates/showcase/pages/components/feedback/view.dml +116 -0
  49. package/dist/templates/showcase/pages/components/forms/controller.ts +72 -0
  50. package/dist/templates/showcase/pages/components/forms/state.ts +37 -0
  51. package/dist/templates/showcase/pages/components/forms/view.dml +97 -0
  52. package/dist/templates/showcase/pages/components/icons/controller.ts +15 -0
  53. package/dist/templates/showcase/pages/components/icons/state.ts +75 -0
  54. package/dist/templates/showcase/pages/components/icons/view.dml +36 -0
  55. package/dist/templates/showcase/pages/components/images/controller.ts +44 -0
  56. package/dist/templates/showcase/pages/{images → components/images}/state.ts +3 -0
  57. package/dist/templates/showcase/pages/components/images/view.dml +83 -0
  58. package/dist/templates/showcase/pages/components/layout/controller.ts +61 -0
  59. package/dist/templates/showcase/pages/components/layout/state.ts +34 -0
  60. package/dist/templates/showcase/pages/components/layout/view.dml +143 -0
  61. package/dist/templates/showcase/pages/components/lists/controller.ts +18 -0
  62. package/dist/templates/showcase/pages/components/lists/state.ts +130 -0
  63. package/dist/templates/showcase/pages/components/lists/view.dml +88 -0
  64. package/dist/templates/showcase/pages/components/money/controller.ts +45 -0
  65. package/dist/templates/showcase/pages/{payments → components/money}/state.ts +3 -0
  66. package/dist/templates/showcase/pages/components/money/view.dml +54 -0
  67. package/dist/templates/showcase/pages/components/reading/controller.ts +6 -0
  68. package/dist/templates/showcase/pages/components/reading/state.ts +23 -0
  69. package/dist/templates/showcase/pages/components/reading/view.dml +42 -0
  70. package/dist/templates/showcase/pages/components/sheets/controller.ts +36 -0
  71. package/dist/templates/showcase/pages/components/sheets/state.ts +26 -0
  72. package/dist/templates/showcase/pages/components/sheets/view.dml +38 -0
  73. package/dist/templates/showcase/pages/components/styles/controller.ts +6 -0
  74. package/dist/templates/showcase/pages/components/styles/state.ts +3 -0
  75. package/dist/templates/showcase/pages/components/styles/view.dml +101 -0
  76. package/dist/templates/showcase/pages/components/tabs/controller.ts +41 -0
  77. package/dist/templates/showcase/pages/components/tabs/state.ts +127 -0
  78. package/dist/templates/showcase/pages/components/tabs/view.dml +57 -0
  79. package/dist/templates/showcase/pages/components/text/controller.ts +10 -0
  80. package/dist/templates/showcase/pages/components/text/state.ts +3 -0
  81. package/dist/templates/showcase/pages/components/text/view.dml +95 -0
  82. package/dist/templates/showcase/pages/dash/account/controller.ts +32 -0
  83. package/dist/templates/showcase/pages/dash/account/state.ts +9 -0
  84. package/dist/templates/showcase/pages/dash/account/view.dml +33 -0
  85. package/dist/templates/showcase/pages/dash/cache/controller.ts +50 -0
  86. package/dist/templates/showcase/pages/dash/cache/state.ts +17 -0
  87. package/dist/templates/showcase/pages/dash/cache/view.dml +48 -0
  88. package/dist/templates/showcase/pages/dash/calls/controller.ts +67 -0
  89. package/dist/templates/showcase/pages/dash/calls/state.ts +9 -0
  90. package/dist/templates/showcase/pages/dash/calls/view.dml +69 -0
  91. package/dist/templates/showcase/pages/dash/contacts/controller.ts +30 -0
  92. package/dist/templates/showcase/pages/dash/contacts/state.ts +6 -0
  93. package/dist/templates/showcase/pages/dash/contacts/view.dml +33 -0
  94. package/dist/templates/showcase/pages/dash/crypto/controller.ts +38 -0
  95. package/dist/templates/showcase/pages/dash/crypto/state.ts +10 -0
  96. package/dist/templates/showcase/pages/dash/crypto/view.dml +48 -0
  97. package/dist/templates/showcase/pages/dash/files/controller.ts +71 -0
  98. package/dist/templates/showcase/pages/dash/files/state.ts +23 -0
  99. package/dist/templates/showcase/pages/dash/files/view.dml +78 -0
  100. package/dist/templates/showcase/pages/dash/media/controller.ts +65 -0
  101. package/dist/templates/showcase/pages/dash/media/state.ts +12 -0
  102. package/dist/templates/showcase/pages/dash/media/view.dml +53 -0
  103. package/dist/templates/showcase/pages/dash/network/controller.ts +215 -0
  104. package/dist/templates/showcase/pages/dash/network/state.ts +35 -0
  105. package/dist/templates/showcase/pages/dash/network/view.dml +108 -0
  106. package/dist/templates/showcase/pages/dash/payments/cases.ts +445 -0
  107. package/dist/templates/showcase/pages/dash/payments/controller.ts +149 -0
  108. package/dist/templates/showcase/pages/dash/payments/state.ts +33 -0
  109. package/dist/templates/showcase/pages/dash/payments/view.dml +71 -0
  110. package/dist/templates/showcase/pages/dash/secrets/controller.ts +44 -0
  111. package/dist/templates/showcase/pages/dash/secrets/state.ts +5 -0
  112. package/dist/templates/showcase/pages/dash/secrets/view.dml +26 -0
  113. package/dist/templates/showcase/pages/dash/system/controller.ts +89 -0
  114. package/dist/templates/showcase/pages/dash/system/state.ts +13 -0
  115. package/dist/templates/showcase/pages/dash/system/view.dml +96 -0
  116. package/dist/templates/showcase/pages/dash/ui/controller.ts +70 -0
  117. package/dist/templates/showcase/pages/dash/ui/state.ts +8 -0
  118. package/dist/templates/showcase/pages/dash/ui/view.dml +31 -0
  119. package/dist/templates/showcase/pages/index/controller.ts +1 -1
  120. package/dist/templates/showcase/pages/index/state.ts +181 -54
  121. package/dist/templates/showcase/pages/index/view.dml +8 -5
  122. package/dist/templates/showcase/statics/logo.png +0 -0
  123. package/package.json +6 -6
  124. package/dist/server-DFOUQnLA.js.map +0 -1
  125. package/dist/templates/showcase/pages/carousel/controller.ts +0 -10
  126. package/dist/templates/showcase/pages/carousel/state.ts +0 -40
  127. package/dist/templates/showcase/pages/carousel/view.dml +0 -37
  128. package/dist/templates/showcase/pages/device/controller.ts +0 -70
  129. package/dist/templates/showcase/pages/device/state.ts +0 -7
  130. package/dist/templates/showcase/pages/device/view.dml +0 -44
  131. package/dist/templates/showcase/pages/feedback/controller.ts +0 -16
  132. package/dist/templates/showcase/pages/feedback/state.ts +0 -7
  133. package/dist/templates/showcase/pages/feedback/view.dml +0 -87
  134. package/dist/templates/showcase/pages/files/controller.ts +0 -47
  135. package/dist/templates/showcase/pages/files/state.ts +0 -11
  136. package/dist/templates/showcase/pages/files/view.dml +0 -35
  137. package/dist/templates/showcase/pages/filters/controller.ts +0 -28
  138. package/dist/templates/showcase/pages/filters/state.ts +0 -72
  139. package/dist/templates/showcase/pages/filters/view.dml +0 -43
  140. package/dist/templates/showcase/pages/forms/controller.ts +0 -44
  141. package/dist/templates/showcase/pages/forms/state.ts +0 -15
  142. package/dist/templates/showcase/pages/forms/view.dml +0 -39
  143. package/dist/templates/showcase/pages/images/controller.ts +0 -15
  144. package/dist/templates/showcase/pages/images/view.dml +0 -38
  145. package/dist/templates/showcase/pages/layout/controller.ts +0 -26
  146. package/dist/templates/showcase/pages/layout/state.ts +0 -14
  147. package/dist/templates/showcase/pages/layout/view.dml +0 -80
  148. package/dist/templates/showcase/pages/lists/controller.ts +0 -36
  149. package/dist/templates/showcase/pages/lists/state.ts +0 -96
  150. package/dist/templates/showcase/pages/lists/view.dml +0 -59
  151. package/dist/templates/showcase/pages/navigation/controller.ts +0 -64
  152. package/dist/templates/showcase/pages/navigation/state.ts +0 -17
  153. package/dist/templates/showcase/pages/navigation/view.dml +0 -34
  154. package/dist/templates/showcase/pages/network/controller.ts +0 -107
  155. package/dist/templates/showcase/pages/network/state.ts +0 -15
  156. package/dist/templates/showcase/pages/network/view.dml +0 -56
  157. package/dist/templates/showcase/pages/payments/controller.ts +0 -42
  158. package/dist/templates/showcase/pages/payments/view.dml +0 -35
  159. package/dist/templates/showcase/pages/state/view.dml +0 -33
  160. package/dist/templates/showcase/pages/text/controller.ts +0 -10
  161. package/dist/templates/showcase/pages/text/state.ts +0 -7
  162. package/dist/templates/showcase/pages/text/view.dml +0 -49
@@ -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,6 @@
1
+ import state from './state';
2
+
3
+ export default definePage({
4
+ initialState: state,
5
+ configs: { navigationBar: { title: 'Reading' } },
6
+ });
@@ -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,6 @@
1
+ import state from './state';
2
+
3
+ export default definePage({
4
+ initialState: state,
5
+ configs: { navigationBar: { title: 'Styles' } },
6
+ });
@@ -0,0 +1,3 @@
1
+ export default {
2
+ balance: 'SLE 1,250.00',
3
+ };
@@ -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 theme in dot.ts can set primary, background, surface, text, muted, border and subtle, for light and dark, and a page can set its own with configs.colors. Left out, they're Dash's, or worked out from a new background. The theme can also name its own colours, such as gold and ink here, to use 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
+ }
@@ -0,0 +1,127 @@
1
+ export type Kind = 'album' | 'song';
2
+ export type Genre = 'Kriofusion' | 'Afropop' | 'Hip hop' | 'R&B' | 'Palm-wine' | 'Gospel' | 'Bubu';
3
+
4
+ export interface Release {
5
+ id: string;
6
+ title: string;
7
+ artist: string;
8
+ year: number;
9
+ kind: Kind;
10
+ genre: Genre;
11
+ }
12
+
13
+ export interface Show {
14
+ id: string;
15
+ title: string;
16
+ place: string;
17
+ date: string;
18
+ city: string;
19
+ }
20
+
21
+ function release(
22
+ id: string,
23
+ title: string,
24
+ artist: string,
25
+ year: number,
26
+ kind: Kind,
27
+ genre: Genre,
28
+ ): Release {
29
+ return { id, title, artist, year, kind, genre };
30
+ }
31
+
32
+ // Newest first.
33
+ const releases: Release[] = [
34
+ release('audacity', 'AUDACITY', 'Drizilik', 2026, 'album', 'Kriofusion'),
35
+ release('money-or-honey', 'Money or Honey', 'Boii', 2025, 'album', 'R&B'),
36
+ release('control', 'Control', 'ApreeL', 2025, 'song', 'Afropop'),
37
+ release('wait-and-see', 'Wait and See', 'Drizilik', 2025, 'album', 'Kriofusion'),
38
+ release('blunt', 'Blunt', 'Donii Major', 2023, 'song', 'R&B'),
39
+ release('ashobi', 'Ashobi', 'Drizilik', 2022, 'album', 'Kriofusion'),
40
+ release('nack', 'Nack', 'The Therapist', 2022, 'song', 'Afropop'),
41
+ release('hannah', 'Hannah', 'Donii Major', 2021, 'song', 'R&B'),
42
+ release('shukubly', 'Shukubly', 'Drizilik', 2018, 'album', 'Kriofusion'),
43
+ release('en-yay-sah', 'En Yay Sah', 'Janka Nabay and the Bubu Gang', 2012, 'album', 'Bubu'),
44
+ release('red-album', 'Red Album', 'LAJ', 2013, 'album', 'Hip hop'),
45
+ release(
46
+ 'ghetto-struggle',
47
+ 'Ghetto Struggle',
48
+ 'Kao Denero, with Busy Signal',
49
+ 2013,
50
+ 'song',
51
+ 'Hip hop',
52
+ ),
53
+ release('borbor-bele', 'Borbor Bele', 'Emmerson', 2004, 'album', 'Afropop'),
54
+ release('corruption', 'Corruption', 'Daddy Saj', 2003, 'album', 'Hip hop'),
55
+ release('cry-africa', 'Cry Africa', 'Vicky Fornah', 1999, 'song', 'Gospel'),
56
+ release('kormot-bi-en-me', 'Kormot Bi En Me', 'Steady Bongo', 1996, 'album', 'Afropop'),
57
+ release('dead-men', "Dead Men Don't Smoke Marijuana", 'S. E. Rogie', 1994, 'album', 'Palm-wine'),
58
+ release('let-me-love-you', 'Let Me Love You', 'Bunny Mack', 1981, 'song', 'Afropop'),
59
+ ];
60
+
61
+ export default {
62
+ releases,
63
+ // The releases the tab and the chosen genre leave.
64
+ shown: releases,
65
+ tab: 'all',
66
+ albums: releases.filter((item) => item.kind === 'album').length,
67
+ songs: releases.filter((item) => item.kind === 'song').length,
68
+ genres: ['All', 'Kriofusion', 'Afropop', 'Hip hop', 'R&B', 'Palm-wine', 'Gospel', 'Bubu'],
69
+ genre: 'All',
70
+ query: '',
71
+ liked: false,
72
+ // Shows at home in Sierra Leone, and abroad in the Mano River region.
73
+ where: 'home',
74
+ home: [
75
+ {
76
+ id: 'sledu-2026',
77
+ title: 'SLeDU National Music Awards',
78
+ place: 'Bintumani Conference Centre',
79
+ date: '27 March 2026',
80
+ city: 'Freetown',
81
+ },
82
+ {
83
+ id: 'special-guests-4',
84
+ title: 'Drizilik & Special Guests',
85
+ place: 'Fourah Bay College Amphitheatre',
86
+ date: '28 November 2025',
87
+ city: 'Freetown',
88
+ },
89
+ {
90
+ id: 'christmas-jam',
91
+ title: 'Christmas Jam',
92
+ place: 'Coronation Field',
93
+ date: '26 December 2025',
94
+ city: 'Bo',
95
+ },
96
+ {
97
+ id: 'gospel-night',
98
+ title: 'Gospel Night',
99
+ place: 'Kenema City Hall',
100
+ date: '15 November 2025',
101
+ city: 'Kenema',
102
+ },
103
+ ] as Show[],
104
+ abroad: [
105
+ {
106
+ id: 'monrovia-live',
107
+ title: 'Salone Sounds Live',
108
+ place: 'EJS Ministerial Complex',
109
+ date: '20 December 2025',
110
+ city: 'Monrovia',
111
+ },
112
+ {
113
+ id: 'mano-river-festival',
114
+ title: 'Mano River Music Festival',
115
+ place: 'Palais du Peuple',
116
+ date: '8 November 2025',
117
+ city: 'Conakry',
118
+ },
119
+ {
120
+ id: 'abidjan-night',
121
+ title: 'Salone Night',
122
+ place: 'Palais de la Culture',
123
+ date: '13 September 2025',
124
+ city: 'Abidjan',
125
+ },
126
+ ] as Show[],
127
+ };
@@ -0,0 +1,57 @@
1
+ <View>
2
+ <Text variant="title">Tabs and chips</Text>
3
+ <Text>Tabs change what the page shows. Chips and a search 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. An Input with type="search" and clearable makes a search box.</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
+ <Input type="search" placeholder="Search by title" clearable value="{{ query }}" onChange="search" />
14
+ <View direction="row" gap="small" wrap>
15
+ <For each="{{ genres }}" item="option" key="*this">
16
+ <Chip label="{{ option }}" selected="{{ option === genre }}" data-genre="{{ option }}" onTap="chooseGenre" />
17
+ </For>
18
+ </View>
19
+ <If condition="{{ shown.length > 0 }}">
20
+ <List>
21
+ <For each="{{ shown }}" item="release" key="id">
22
+ <ListItem icon="{{ release.kind === 'album' ? 'playlist' : 'music' }}" title="{{ release.title }}" subtitle="{{ release.artist }} · {{ release.genre }}">
23
+ <Badge>{{ release.year }}</Badge>
24
+ </ListItem>
25
+ </For>
26
+ </List>
27
+ </If>
28
+ <Else>
29
+ <EmptyState icon="search" title="Nothing here" text="No release matches this tab, genre and search.">
30
+ <Button variant="secondary" onClick="clearFilters">Clear filters</Button>
31
+ </EmptyState>
32
+ </Else>
33
+ </View>
34
+
35
+ <View gap="small">
36
+ <Text variant="subtitle">Chip with an icon</Text>
37
+ <Text variant="caption" tone="muted">A disabled chip can't be tapped, such as a filter with nothing behind it.</Text>
38
+ <View direction="row" gap="small" wrap>
39
+ <Chip icon="heart" label="Liked" selected="{{ liked }}" onTap="toggleLiked" />
40
+ <Chip icon="download" label="Downloaded" disabled />
41
+ </View>
42
+ </View>
43
+
44
+ <View gap="small">
45
+ <Text variant="subtitle">variant="segmented"</Text>
46
+ <Text variant="caption" tone="muted">For a few short choices. Shows at home and in the Mano River region.</Text>
47
+ <Tabs variant="segmented" value="{{ where }}" onChange="chooseWhere">
48
+ <Tab value="home" label="Sierra Leone" />
49
+ <Tab value="abroad" label="Abroad" />
50
+ </Tabs>
51
+ <List>
52
+ <For each="{{ where === 'home' ? home : abroad }}" item="show" key="id">
53
+ <ListItem icon="ticket" title="{{ show.title }}" subtitle="{{ show.place }} · {{ show.date }}" value="{{ show.city }}" />
54
+ </For>
55
+ </List>
56
+ </View>
57
+ </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,3 @@
1
+ export default {
2
+ likes: 12,
3
+ };