@monimesl/dot-cli 0.1.0-alpha.15 → 0.1.0-alpha.18

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 (109) hide show
  1. package/dist/cli.js +17 -10
  2. package/dist/cli.js.map +1 -1
  3. package/dist/{server-Dbrgkelo.js → server-uIyYmYnp.js} +7 -2
  4. package/dist/{server-Dbrgkelo.js.map → server-uIyYmYnp.js.map} +1 -1
  5. package/dist/templates/showcase/dot.ts +42 -16
  6. package/dist/templates/showcase/pages/basics/bars/controller.ts +36 -0
  7. package/dist/templates/showcase/pages/basics/bars/state.ts +6 -0
  8. package/dist/templates/showcase/pages/basics/bars/view.dml +28 -0
  9. package/dist/templates/showcase/pages/{text → basics/bindings}/controller.ts +4 -0
  10. package/dist/templates/showcase/pages/basics/bindings/state.ts +14 -0
  11. package/dist/templates/showcase/pages/basics/bindings/view.dml +41 -0
  12. package/dist/templates/showcase/pages/basics/control-flow/controller.ts +17 -0
  13. package/dist/templates/showcase/pages/basics/control-flow/state.ts +16 -0
  14. package/dist/templates/showcase/pages/basics/control-flow/view.dml +55 -0
  15. package/dist/templates/showcase/pages/basics/events/controller.ts +42 -0
  16. package/dist/templates/showcase/pages/basics/events/state.ts +11 -0
  17. package/dist/templates/showcase/pages/basics/events/view.dml +51 -0
  18. package/dist/templates/showcase/pages/basics/hooks/controller.ts +36 -0
  19. package/dist/templates/showcase/pages/basics/hooks/state.ts +10 -0
  20. package/dist/templates/showcase/pages/basics/hooks/view.dml +32 -0
  21. package/dist/templates/showcase/pages/basics/navigation/controller.ts +33 -0
  22. package/dist/templates/showcase/pages/basics/navigation/state.ts +9 -0
  23. package/dist/templates/showcase/pages/basics/navigation/view.dml +37 -0
  24. package/dist/templates/showcase/pages/basics/state/view.dml +46 -0
  25. package/dist/templates/showcase/pages/{carousel → components/carousel}/view.dml +7 -5
  26. package/dist/templates/showcase/pages/{feedback → components/feedback}/view.dml +18 -9
  27. package/dist/templates/showcase/pages/{forms → components/forms}/controller.ts +4 -1
  28. package/dist/templates/showcase/pages/{forms → components/forms}/state.ts +3 -0
  29. package/dist/templates/showcase/pages/components/forms/view.dml +90 -0
  30. package/dist/templates/showcase/pages/components/icons/controller.ts +14 -0
  31. package/dist/templates/showcase/pages/components/icons/state.ts +75 -0
  32. package/dist/templates/showcase/pages/components/icons/view.dml +36 -0
  33. package/dist/templates/showcase/pages/components/images/view.dml +70 -0
  34. package/dist/templates/showcase/pages/components/layout/view.dml +143 -0
  35. package/dist/templates/showcase/pages/components/lists/controller.ts +17 -0
  36. package/dist/templates/showcase/pages/{lists → components/lists}/state.ts +43 -30
  37. package/dist/templates/showcase/pages/components/lists/view.dml +70 -0
  38. package/dist/templates/showcase/pages/{payments → components/money}/view.dml +17 -8
  39. package/dist/templates/showcase/pages/components/reading/controller.ts +5 -0
  40. package/dist/templates/showcase/pages/components/reading/state.ts +23 -0
  41. package/dist/templates/showcase/pages/components/reading/view.dml +42 -0
  42. package/dist/templates/showcase/pages/{lists → components/sheets}/controller.ts +8 -10
  43. package/dist/templates/showcase/pages/components/sheets/state.ts +26 -0
  44. package/dist/templates/showcase/pages/components/sheets/view.dml +38 -0
  45. package/dist/templates/showcase/pages/components/styles/controller.ts +5 -0
  46. package/dist/templates/showcase/pages/components/styles/state.ts +3 -0
  47. package/dist/templates/showcase/pages/components/styles/view.dml +101 -0
  48. package/dist/templates/showcase/pages/{filters → components/tabs}/controller.ts +1 -0
  49. package/dist/templates/showcase/pages/{filters → components/tabs}/state.ts +1 -0
  50. package/dist/templates/showcase/pages/components/tabs/view.dml +56 -0
  51. package/dist/templates/showcase/pages/components/text/controller.ts +9 -0
  52. package/dist/templates/showcase/pages/components/text/state.ts +3 -0
  53. package/dist/templates/showcase/pages/components/text/view.dml +95 -0
  54. package/dist/templates/showcase/pages/{cache → dash/cache}/controller.ts +4 -0
  55. package/dist/templates/showcase/pages/dash/cache/view.dml +48 -0
  56. package/dist/templates/showcase/pages/dash/calls/controller.ts +48 -0
  57. package/dist/templates/showcase/pages/dash/calls/state.ts +6 -0
  58. package/dist/templates/showcase/pages/dash/calls/view.dml +51 -0
  59. package/dist/templates/showcase/pages/{files → dash/files}/controller.ts +23 -1
  60. package/dist/templates/showcase/pages/{files → dash/files}/state.ts +8 -0
  61. package/dist/templates/showcase/pages/dash/files/view.dml +79 -0
  62. package/dist/templates/showcase/pages/dash/media/controller.ts +32 -0
  63. package/dist/templates/showcase/pages/dash/media/state.ts +12 -0
  64. package/dist/templates/showcase/pages/dash/media/view.dml +34 -0
  65. package/dist/templates/showcase/pages/dash/network/view.dml +80 -0
  66. package/dist/templates/showcase/pages/dash/secrets/view.dml +26 -0
  67. package/dist/templates/showcase/pages/{device → dash/system}/controller.ts +11 -30
  68. package/dist/templates/showcase/pages/dash/system/state.ts +9 -0
  69. package/dist/templates/showcase/pages/dash/system/view.dml +59 -0
  70. package/dist/templates/showcase/pages/dash/ui/controller.ts +69 -0
  71. package/dist/templates/showcase/pages/dash/ui/state.ts +8 -0
  72. package/dist/templates/showcase/pages/dash/ui/view.dml +31 -0
  73. package/dist/templates/showcase/pages/index/state.ts +137 -60
  74. package/dist/templates/showcase/pages/index/view.dml +6 -3
  75. package/package.json +6 -6
  76. package/dist/templates/showcase/pages/cache/view.dml +0 -36
  77. package/dist/templates/showcase/pages/device/state.ts +0 -7
  78. package/dist/templates/showcase/pages/device/view.dml +0 -49
  79. package/dist/templates/showcase/pages/files/view.dml +0 -50
  80. package/dist/templates/showcase/pages/filters/view.dml +0 -44
  81. package/dist/templates/showcase/pages/forms/view.dml +0 -49
  82. package/dist/templates/showcase/pages/images/view.dml +0 -53
  83. package/dist/templates/showcase/pages/layout/view.dml +0 -103
  84. package/dist/templates/showcase/pages/lists/view.dml +0 -59
  85. package/dist/templates/showcase/pages/navigation/controller.ts +0 -65
  86. package/dist/templates/showcase/pages/navigation/state.ts +0 -17
  87. package/dist/templates/showcase/pages/navigation/view.dml +0 -34
  88. package/dist/templates/showcase/pages/network/view.dml +0 -67
  89. package/dist/templates/showcase/pages/secrets/view.dml +0 -24
  90. package/dist/templates/showcase/pages/state/view.dml +0 -33
  91. package/dist/templates/showcase/pages/text/state.ts +0 -8
  92. package/dist/templates/showcase/pages/text/view.dml +0 -58
  93. /package/dist/templates/showcase/pages/{state → basics/state}/controller.ts +0 -0
  94. /package/dist/templates/showcase/pages/{state → basics/state}/state.ts +0 -0
  95. /package/dist/templates/showcase/pages/{carousel → components/carousel}/controller.ts +0 -0
  96. /package/dist/templates/showcase/pages/{carousel → components/carousel}/state.ts +0 -0
  97. /package/dist/templates/showcase/pages/{feedback → components/feedback}/controller.ts +0 -0
  98. /package/dist/templates/showcase/pages/{feedback → components/feedback}/state.ts +0 -0
  99. /package/dist/templates/showcase/pages/{images → components/images}/controller.ts +0 -0
  100. /package/dist/templates/showcase/pages/{images → components/images}/state.ts +0 -0
  101. /package/dist/templates/showcase/pages/{layout → components/layout}/controller.ts +0 -0
  102. /package/dist/templates/showcase/pages/{layout → components/layout}/state.ts +0 -0
  103. /package/dist/templates/showcase/pages/{payments → components/money}/controller.ts +0 -0
  104. /package/dist/templates/showcase/pages/{payments → components/money}/state.ts +0 -0
  105. /package/dist/templates/showcase/pages/{cache → dash/cache}/state.ts +0 -0
  106. /package/dist/templates/showcase/pages/{network → dash/network}/controller.ts +0 -0
  107. /package/dist/templates/showcase/pages/{network → dash/network}/state.ts +0 -0
  108. /package/dist/templates/showcase/pages/{secrets → dash/secrets}/controller.ts +0 -0
  109. /package/dist/templates/showcase/pages/{secrets → dash/secrets}/state.ts +0 -0
@@ -3,7 +3,8 @@
3
3
  <Text>Show that something is loading, how far it has gone, and how it ended.</Text>
4
4
 
5
5
  <View gap="small">
6
- <Text variant="caption" tone="muted">Spinners, while something loads</Text>
6
+ <Text variant="subtitle">Spinner</Text>
7
+ <Text variant="caption" tone="muted">While something loads, in three sizes.</Text>
7
8
  <View variant="card" direction="row" gap="large" align="center">
8
9
  <Spinner size="small" />
9
10
  <Spinner />
@@ -12,7 +13,8 @@
12
13
  </View>
13
14
 
14
15
  <View gap="small">
15
- <Text variant="caption" tone="muted">Skeletons show the shape of what is loading</Text>
16
+ <Text variant="subtitle">Skeleton</Text>
17
+ <Text variant="caption" tone="muted">Shows the shape of what is loading: lines of text, a circle or a box.</Text>
16
18
  <View variant="card">
17
19
  <If condition="{{ loaded }}">
18
20
  <View direction="row" align="center" gap="large">
@@ -27,7 +29,7 @@
27
29
  <Else>
28
30
  <View direction="row" align="center" gap="large">
29
31
  <Skeleton shape="circle" />
30
- <Skeleton lines="2" />
32
+ <Skeleton shape="text" lines="2" />
31
33
  </View>
32
34
  <Skeleton shape="box" height="80" />
33
35
  </Else>
@@ -36,15 +38,19 @@
36
38
  </View>
37
39
 
38
40
  <View gap="small">
39
- <Text variant="caption" tone="muted">Toasts disappear on their own. The offline one stays for 6 seconds.</Text>
40
- <View direction="row" gap="small">
41
+ <Text variant="subtitle">Toast</Text>
42
+ <Text variant="caption" tone="muted">A short message over the page that goes on its own. The offline one stays for 6 seconds.</Text>
43
+ <View direction="row" wrap gap="small">
41
44
  <Button variant="secondary" data-message="Added to your library" data-tone="success" onClick="showToast">Add a song</Button>
42
45
  <Button variant="secondary" data-message="You're offline. Only downloads will play." data-tone="warning" data-duration="6000" onClick="showToast">Go offline</Button>
46
+ <Button variant="secondary" data-message="A new song from Boii" data-tone="info" onClick="showToast">New song</Button>
47
+ <Button variant="secondary" data-message="That song can't play here" data-tone="danger" onClick="showToast">Fail</Button>
43
48
  </View>
44
49
  </View>
45
50
 
46
51
  <View gap="small">
47
- <Text variant="caption" tone="muted">A progress bar for an album download, from 0 to 100</Text>
52
+ <Text variant="subtitle">ProgressBar</Text>
53
+ <Text variant="caption" tone="muted">How far something has gone, from 0 to 100, such as an album download.</Text>
48
54
  <View variant="card">
49
55
  <ProgressBar value="{{ progress }}" />
50
56
  <Text>{{ progress }}% downloaded</Text>
@@ -56,7 +62,8 @@
56
62
  </View>
57
63
 
58
64
  <View gap="small">
59
- <Text variant="caption" tone="muted">A busy button ignores taps</Text>
65
+ <Text variant="subtitle">A busy Button</Text>
66
+ <Text variant="caption" tone="muted">loading shows a spinner, and the button ignores taps.</Text>
60
67
  <View variant="card">
61
68
  <Button loading="{{ busy }}">{{ busy ? 'Paying…' : 'Pay Le 300 for two tickets' }}</Button>
62
69
  <Switch label="Busy" checked="{{ busy }}" onChange="toggleBusy" />
@@ -64,7 +71,8 @@
64
71
  </View>
65
72
 
66
73
  <View gap="small">
67
- <Text variant="caption" tone="muted">Notices sit inside the page</Text>
74
+ <Text variant="subtitle">Notice</Text>
75
+ <Text variant="caption" tone="muted">A message that stays in the page, in a tone.</Text>
68
76
  <Notice title="Heads up">Doors open at 7 pm, and the music starts at 8.</Notice>
69
77
  <Notice tone="info" title="New">Tickets for gospel night in Kenema are on sale.</Notice>
70
78
  <Notice tone="success" title="Booked">Two tickets for Salone Sounds Live.</Notice>
@@ -73,7 +81,8 @@
73
81
  </View>
74
82
 
75
83
  <View gap="small">
76
- <Text variant="caption" tone="muted">Badges show a status</Text>
84
+ <Text variant="subtitle">Badge</Text>
85
+ <Text variant="caption" tone="muted">A short status.</Text>
77
86
  <View direction="row" wrap gap="small">
78
87
  <Badge>Demo</Badge>
79
88
  <Badge tone="info">New release</Badge>
@@ -2,13 +2,13 @@ import type { TicketType } from './state';
2
2
  import state, { SHOWS, TICKETS } from './state';
3
3
 
4
4
  type Typed = DotEvent<{ value: string }>;
5
+ type Toggled = DotEvent<{ checked: boolean }>;
5
6
 
6
7
  // "2" tickets of a Le 1,200 type -> "Le 2,400"
7
8
  function total(tickets: string, ticket: TicketType): string {
8
9
  const leones = (Number(tickets) || 0) * TICKETS[ticket].price;
9
10
  return `Le ${leones.toLocaleString('en-US')}`;
10
11
  }
11
- type Toggled = DotEvent<{ checked: boolean }>;
12
12
 
13
13
  export default definePage({
14
14
  initialState: state,
@@ -25,6 +25,9 @@ export default definePage({
25
25
  total: total(event.detail.value, state.ticket),
26
26
  }),
27
27
  setShoutOut: (_state, event: Typed) => ({ shoutOut: event.detail.value }),
28
+ setPromo: (_state, event: Typed) => ({ promo: event.detail.value }),
29
+ setChairs: (_state, event: DotEvent<{ value: number }>) => ({ chairs: event.detail.value }),
30
+ setTip: (_state, event: DotEvent<{ value: number }>) => ({ tip: event.detail.value }),
28
31
  setTicket: (state, event: DotEvent<{ value: TicketType }>) => ({
29
32
  ticket: event.detail.value,
30
33
  ticketName: TICKETS[event.detail.value].name,
@@ -23,6 +23,9 @@ export default {
23
23
  email: '',
24
24
  phone: '',
25
25
  tickets: '',
26
+ promo: '',
27
+ chairs: 2,
28
+ tip: 20,
26
29
  shoutOut: '',
27
30
  ticket: 'regular' as TicketType,
28
31
  eTickets: true,
@@ -0,0 +1,90 @@
1
+ <View>
2
+ <Text variant="title">Forms</Text>
3
+ <Text>Buy tickets for a show. Each field sends onChange as you use it, and the page keeps its value in state. The page checks the form when you send it.</Text>
4
+
5
+ <View gap="small">
6
+ <Text variant="subtitle">Select</Text>
7
+ <View variant="card">
8
+ <Select label="Show" placeholder="Choose a show" hint="Every show has the same prices" value="{{ show }}" error="{{ errors.show }}" disabled="{{ sending }}" onChange="setShow">
9
+ <Option value="freetown" label="Salone Sounds Live · Freetown" />
10
+ <Option value="bo" label="Palm-wine evening · Bo" />
11
+ <Option value="kenema" label="Gospel night · Kenema" />
12
+ </Select>
13
+ </View>
14
+ </View>
15
+
16
+ <View gap="small">
17
+ <Text variant="subtitle">Input</Text>
18
+ <Text variant="caption" tone="muted">type sets the keyboard: text, email, phone, number or password. prefix and suffix sit inside the field. error shows under it.</Text>
19
+ <View variant="card">
20
+ <Input label="Name" placeholder="Mariama Kamara" value="{{ name }}" maxLength="40" onChange="setName" />
21
+ <Input label="Email" type="email" placeholder="mariama@example.com" hint="{{ eTickets ? 'For the e-tickets' : 'Turn on e-tickets below to use it' }}" value="{{ email }}" disabled="{{ !eTickets }}" onChange="setEmail" />
22
+ <Input label="Phone" type="phone" prefix="+232" placeholder="76 123456" value="{{ phone }}" error="{{ errors.phone }}" onChange="setPhone" />
23
+ <Input label="Tickets" type="number" placeholder="2" suffix="at most 10" value="{{ tickets }}" error="{{ errors.tickets }}" onChange="setTickets" />
24
+ <Input label="Promo code" type="password" placeholder="Hidden as you type" value="{{ promo }}" onChange="setPromo" onSubmit="send" />
25
+ </View>
26
+ </View>
27
+
28
+ <View gap="small">
29
+ <Text variant="subtitle">RadioGroup and Radio</Text>
30
+ <Text variant="caption" tone="muted">One choice from a few. A Radio, or the whole group, can be disabled.</Text>
31
+ <View variant="card">
32
+ <RadioGroup label="Ticket" value="{{ ticket }}" disabled="{{ sending }}" onChange="setTicket">
33
+ <Radio value="regular" label="Regular · Le 150" />
34
+ <Radio value="vip" label="VIP, near the stage · Le 400" />
35
+ <Radio value="table" label="Table for four · Le 1,200" />
36
+ <Radio value="backstage" label="Backstage · sold out" disabled />
37
+ </RadioGroup>
38
+ </View>
39
+ </View>
40
+
41
+ <View gap="small">
42
+ <Text variant="subtitle">TextArea</Text>
43
+ <View variant="card">
44
+ <TextArea label="Shout-out" placeholder="A message for the band, read out on the night" rows="3" maxLength="140" hint="{{ ticket === 'regular' ? 'Shout-outs come with VIP and table tickets' : shoutOut.length + ' of 140' }}" value="{{ shoutOut }}" error="{{ errors.shoutOut }}" disabled="{{ ticket === 'regular' }}" onChange="setShoutOut" />
45
+ </View>
46
+ </View>
47
+
48
+ <View gap="small">
49
+ <Text variant="subtitle">Slider</Text>
50
+ <Text variant="caption" tone="muted">A number between min and max, in steps. showValue shows it beside the label.</Text>
51
+ <View variant="card">
52
+ <Slider label="Chairs near the stage" min="0" max="10" showValue value="{{ chairs }}" disabled="{{ ticket === 'regular' }}" hint="{{ ticket === 'regular' ? 'Chairs come with VIP and table tickets' : '' }}" onChange="setChairs" />
53
+ <Slider label="Tip for the band, in leones" min="0" max="100" step="10" showValue value="{{ tip }}" onChange="setTip" />
54
+ </View>
55
+ </View>
56
+
57
+ <View gap="small">
58
+ <Text variant="subtitle">Switch and Checkbox</Text>
59
+ <View variant="card">
60
+ <Switch label="Email me the e-tickets" checked="{{ eTickets }}" onChange="setETickets" />
61
+ <Switch label="Text me on the night" disabled />
62
+ <Checkbox label="I agree to the terms" checked="{{ agreed }}" onChange="setAgreed" />
63
+ <Checkbox label="I'm over 18" checked disabled />
64
+ </View>
65
+ </View>
66
+
67
+ <View gap="small">
68
+ <Text variant="subtitle">Your order</Text>
69
+ <View variant="card" gap="none">
70
+ <DetailRow label="Show" value="{{ showName }}" />
71
+ <DetailRow label="Ticket" value="{{ ticketName }}" />
72
+ <DetailRow label="How many" value="{{ tickets || '0' }}" />
73
+ <Divider />
74
+ <DetailRow label="Total" value="{{ total }}" weight="bold" paddingTop="medium" />
75
+ <DetailRow label="Paid" value="{{ sent ? 'Yes' : 'Not yet' }}" tone="{{ sent ? 'success' : 'warning' }}" />
76
+ </View>
77
+ </View>
78
+
79
+ <If condition="{{ sent }}">
80
+ <Notice tone="success" title="Booked">{{ sent }}</Notice>
81
+ </If>
82
+ <If condition="{{ failure }}">
83
+ <Notice tone="danger" title="Not booked">{{ failure }}</Notice>
84
+ </If>
85
+
86
+ <Text variant="caption" tone="muted">A Footer keeps its buttons at the bottom of the screen.</Text>
87
+ <Footer>
88
+ <Button onClick="send" loading="{{ sending }}" disabled="{{ !agreed }}">Buy tickets</Button>
89
+ </Footer>
90
+ </View>
@@ -0,0 +1,14 @@
1
+ import state from './state';
2
+
3
+ export default definePage({
4
+ initialState: state,
5
+ mutations: {
6
+ clearToast: () => ({ toast: '' }),
7
+ },
8
+ actions: {
9
+ async copyName(_state, event: DotEvent<unknown, { name: string }>) {
10
+ await this.dash.system.copyText(event.data.name);
11
+ this.setState({ toast: `Copied "${event.data.name}"` });
12
+ },
13
+ },
14
+ });
@@ -0,0 +1,75 @@
1
+ export default {
2
+ // Every icon name, as Icon's name, and ListItem's, Chip's, GridItem's and EmptyState's icon take.
3
+ names: [
4
+ 'arrow-down',
5
+ 'arrow-left',
6
+ 'arrow-right',
7
+ 'arrow-up',
8
+ 'bank',
9
+ 'bell',
10
+ 'bolt',
11
+ 'calendar',
12
+ 'card',
13
+ 'cart',
14
+ 'cash',
15
+ 'check',
16
+ 'chevron-down',
17
+ 'chevron-left',
18
+ 'chevron-right',
19
+ 'chevron-up',
20
+ 'clock',
21
+ 'close',
22
+ 'copy',
23
+ 'download',
24
+ 'edit',
25
+ 'error',
26
+ 'external-link',
27
+ 'eye',
28
+ 'eye-off',
29
+ 'file',
30
+ 'gift',
31
+ 'globe',
32
+ 'grid',
33
+ 'headphones',
34
+ 'heart',
35
+ 'help',
36
+ 'history',
37
+ 'home',
38
+ 'image',
39
+ 'info',
40
+ 'link',
41
+ 'list',
42
+ 'location',
43
+ 'lock',
44
+ 'logout',
45
+ 'mail',
46
+ 'microphone',
47
+ 'minus',
48
+ 'mobile',
49
+ 'more',
50
+ 'music',
51
+ 'phone',
52
+ 'playlist',
53
+ 'plus',
54
+ 'qr-code',
55
+ 'receipt',
56
+ 'refresh',
57
+ 'search',
58
+ 'send',
59
+ 'settings',
60
+ 'share',
61
+ 'star',
62
+ 'success',
63
+ 'ticket',
64
+ 'trash',
65
+ 'upload',
66
+ 'user',
67
+ 'users',
68
+ 'video',
69
+ 'wallet',
70
+ 'warning',
71
+ 'water',
72
+ 'wifi',
73
+ ],
74
+ toast: '',
75
+ };
@@ -0,0 +1,36 @@
1
+ <View>
2
+ <Text variant="title">Icons</Text>
3
+ <Text>Icon shows a small picture by its name. Lists, chips, grids and empty states take the same names.</Text>
4
+
5
+ <View gap="small">
6
+ <Text variant="subtitle">size and tone</Text>
7
+ <View variant="card" direction="row" wrap gap="large" align="center">
8
+ <Icon name="music" size="small" />
9
+ <Icon name="music" size="medium" />
10
+ <Icon name="music" size="large" />
11
+ <Icon name="info" tone="info" />
12
+ <Icon name="success" tone="success" />
13
+ <Icon name="warning" tone="warning" />
14
+ <Icon name="error" tone="danger" />
15
+ <Icon name="star" tone="muted" />
16
+ <Icon name="heart" tone="default" />
17
+ </View>
18
+ </View>
19
+
20
+ <View gap="small">
21
+ <Text variant="subtitle">Every name</Text>
22
+ <Text variant="caption" tone="muted">Tap one to copy its name.</Text>
23
+ <View variant="card">
24
+ <Grid columns="3" gap="medium">
25
+ <For each="{{ names }}" item="name" key="*this">
26
+ <View align="center" gap="small" padding="small" data-name="{{ name }}" onTap="copyName">
27
+ <Icon name="{{ name }}" />
28
+ <Text variant="caption" tone="muted" align="center">{{ name }}</Text>
29
+ </View>
30
+ </For>
31
+ </Grid>
32
+ </View>
33
+ </View>
34
+
35
+ <Toast message="{{ toast }}" tone="success" onHide="clearToast" />
36
+ </View>
@@ -0,0 +1,70 @@
1
+ <View>
2
+ <Text variant="title">Images</Text>
3
+ <Text>Image shows a picture from the dot's statics/ folder or from the web. Give it alt text, which screen readers say aloud.</Text>
4
+
5
+ <View gap="small">
6
+ <Text variant="subtitle">From statics/</Text>
7
+ <Text variant="caption" tone="muted">These pictures come with the dot, and the build checks each one exists.</Text>
8
+ <View variant="card" direction="row" align="end" gap="large">
9
+ <Image src="statics/logo.png" alt="Small logo" width="24" height="24" />
10
+ <Image src="statics/logo.png" alt="Medium logo" width="48" height="48" />
11
+ <Image src="statics/logo.png" alt="Large logo" width="96" height="96" />
12
+ </View>
13
+ </View>
14
+
15
+ <View gap="small">
16
+ <Text variant="subtitle">From the web</Text>
17
+ <Text variant="caption" tone="muted">The cover of Drizilik's album AUDACITY. With aspect="1:1" and no width, it fills the card.</Text>
18
+ <View variant="card" gap="small">
19
+ <If condition="{{ cover }}">
20
+ <Image src="{{ cover }}" alt="The cover of AUDACITY, by Drizilik" aspect="1:1" />
21
+ <Text weight="medium">AUDACITY</Text>
22
+ <Text variant="caption" tone="muted">Drizilik raps mostly in Krio, in a style called Kriofusion. He won Best Male Artist at the 2026 SLeDU awards.</Text>
23
+ </If>
24
+ <ElseIf condition="{{ coverNote }}">
25
+ <Text variant="caption" tone="muted">{{ coverNote }}</Text>
26
+ </ElseIf>
27
+ <Else>
28
+ <Skeleton shape="box" height="280" />
29
+ </Else>
30
+ </View>
31
+ </View>
32
+
33
+ <View gap="small">
34
+ <Text variant="subtitle">shape and fit</Text>
35
+ <Text variant="caption" tone="muted">Rounded, square or circle. fit="contain" shows the whole picture; cover, the default, fills the box.</Text>
36
+ <View variant="card" direction="row" align="center" gap="large">
37
+ <Image src="statics/logo.png" alt="Rounded" width="56" height="56" shape="rounded" />
38
+ <Image src="statics/logo.png" alt="Square" width="56" height="56" shape="square" />
39
+ <Image src="statics/logo.png" alt="Circle" width="56" height="56" shape="circle" />
40
+ <Image src="statics/logo.png" alt="Contained" width="96" height="56" fit="contain" />
41
+ <Image src="statics/logo.png" alt="Covered" width="96" height="56" fit="cover" />
42
+ </View>
43
+ </View>
44
+
45
+ <View gap="small">
46
+ <Text variant="subtitle">onLoad</Text>
47
+ <Text variant="caption" tone="muted">Tells the page the picture's own size once it loads. The size on screen comes from state here.</Text>
48
+ <View variant="card" gap="small">
49
+ <Image src="statics/logo.png" alt="Logo" width="{{ size }}" height="{{ size }}" onLoad="logoLoaded" />
50
+ <Text>{{ size }} × {{ size }} on screen, {{ loaded }} in the file</Text>
51
+ <View direction="row" gap="small">
52
+ <Button variant="secondary" onClick="shrink" disabled="{{ size <= 16 }}">Smaller</Button>
53
+ <Button variant="secondary" onClick="grow" disabled="{{ size >= 128 }}">Bigger</Button>
54
+ </View>
55
+ </View>
56
+ </View>
57
+
58
+ <View gap="small">
59
+ <Text variant="subtitle">onError</Text>
60
+ <Text variant="caption" tone="muted">Tells the page why a picture didn't load.</Text>
61
+ <View variant="card">
62
+ <If condition="{{ failure }}">
63
+ <Text>{{ failure }}</Text>
64
+ </If>
65
+ <Else>
66
+ <Image src="{{ missing }}" alt="" width="48" height="48" onError="missingFailed" />
67
+ </Else>
68
+ </View>
69
+ </View>
70
+ </View>
@@ -0,0 +1,143 @@
1
+ <View>
2
+ <Text variant="title">Layout</Text>
3
+ <Text>Views hold other components and lay them out. Every page starts with one.</Text>
4
+
5
+ <View gap="small">
6
+ <Text variant="subtitle">View</Text>
7
+ <Text variant="caption" tone="muted">A View puts its items in a column or a row. variant="card" gives it a card's look. Change the one below.</Text>
8
+ <View variant="card" direction="{{ direction }}" justify="{{ justify }}" align="{{ align }}" gap="{{ gap }}" wrap="{{ wrap }}">
9
+ <Button variant="secondary">Palm-wine</Button>
10
+ <Button variant="secondary">Gumbe</Button>
11
+ <Text variant="title">Afropop</Text>
12
+ <Button variant="secondary">Bubu</Button>
13
+ <Text variant="caption" tone="muted">Milo jazz</Text>
14
+ </View>
15
+ <View gap="small">
16
+ <View direction="row" align="center">
17
+ <Text>direction="{{ direction }}"</Text>
18
+ <View grow />
19
+ <Button variant="secondary" onClick="nextDirection">Change</Button>
20
+ </View>
21
+ <View direction="row" align="center">
22
+ <Text>justify="{{ justify }}"</Text>
23
+ <View grow />
24
+ <Button variant="secondary" onClick="nextJustify">Change</Button>
25
+ </View>
26
+ <View direction="row" align="center">
27
+ <Text>align="{{ align }}"</Text>
28
+ <View grow />
29
+ <Button variant="secondary" onClick="nextAlign">Change</Button>
30
+ </View>
31
+ <View direction="row" align="center">
32
+ <Text>gap="{{ gap }}"</Text>
33
+ <View grow />
34
+ <Button variant="secondary" onClick="nextGap">Change</Button>
35
+ </View>
36
+ <View direction="row" align="center">
37
+ <Text>wrap="{{ wrap }}"</Text>
38
+ <View grow />
39
+ <Button variant="secondary" onClick="toggleWrap">Change</Button>
40
+ </View>
41
+ </View>
42
+ </View>
43
+
44
+ <View gap="small">
45
+ <Text variant="subtitle">grow and onTap</Text>
46
+ <Text variant="caption" tone="muted">grow fills the space left over: the song grows, the year does not. A View can be tapped: tap the song.</Text>
47
+ <View direction="row" gap="small">
48
+ <View variant="card" grow onTap="playSong">
49
+ <Text>{{ playing ? 'Playing Exodus, by Drizilik' : 'Exodus, by Drizilik' }}</Text>
50
+ </View>
51
+ <View variant="card">
52
+ <Text>2021</Text>
53
+ </View>
54
+ </View>
55
+ </View>
56
+
57
+ <View gap="small">
58
+ <Text variant="subtitle">padding</Text>
59
+ <Text variant="caption" tone="muted">The space inside the edges, on every side or on one side. Most components take it.</Text>
60
+ <View direction="row" gap="small">
61
+ <View variant="card" padding="small">
62
+ <Text>small</Text>
63
+ </View>
64
+ <View variant="card" padding="large">
65
+ <Text>large</Text>
66
+ </View>
67
+ <View variant="card" padding="small" paddingStart="large">
68
+ <Text>start</Text>
69
+ </View>
70
+ </View>
71
+ </View>
72
+
73
+ <View gap="small">
74
+ <Text variant="subtitle">Stack</Text>
75
+ <Text variant="caption" tone="muted">A Stack lays its children on top of each other, such as words over a picture.</Text>
76
+ <Stack radius="large" aspect="16:9">
77
+ <View background="gold" />
78
+ <View justify="end" padding="large">
79
+ <Text variant="subtitle" tone="ink">Bo market day</Text>
80
+ <Text tone="ink">Every Saturday, from 7 am</Text>
81
+ </View>
82
+ <View align="end" padding="medium">
83
+ <View background="primary" radius="full" paddingStart="small" paddingEnd="small">
84
+ <Text variant="caption" tone="onPrimary" weight="bold">New</Text>
85
+ </View>
86
+ </View>
87
+ </Stack>
88
+ </View>
89
+
90
+ <View gap="small">
91
+ <Text variant="subtitle">Scroll</Text>
92
+ <Text variant="caption" tone="muted">A Scroll moves a row sideways. It stops at the start of each release. The buttons scroll it too.</Text>
93
+ <Scroll gap="medium" snap="start" index="{{ first }}" onChange="showFirst">
94
+ <For each="{{ releases }}" item="release" key="id">
95
+ <View gap="small">
96
+ <If condition="{{ release.cover }}">
97
+ <Image src="{{ release.cover }}" alt="{{ release.title }}" width="128" height="128" />
98
+ </If>
99
+ <Else>
100
+ <Skeleton shape="box" height="128" />
101
+ </Else>
102
+ <Text weight="medium" maxLines="2">{{ release.title }}</Text>
103
+ <Text variant="caption" tone="muted">{{ release.year }}</Text>
104
+ </View>
105
+ </For>
106
+ </Scroll>
107
+ <Text tone="muted">First on the shelf: {{ releases[first].title }}</Text>
108
+ <View direction="row" gap="small">
109
+ <Button variant="secondary" onClick="shelfStart" disabled="{{ first === 0 }}">To the start</Button>
110
+ <Button variant="secondary" onClick="shelfEnd" disabled="{{ first === releases.length - 1 }}">To the end</Button>
111
+ </View>
112
+ </View>
113
+
114
+ <View gap="small">
115
+ <Text variant="subtitle">Grid</Text>
116
+ <Text variant="caption" tone="muted">A Grid keeps its columns the same width. A GridItem shows an icon or a picture, with a label.</Text>
117
+ <View variant="card" gap="medium">
118
+ <Grid columns="4" gap="small">
119
+ <GridItem icon="microphone" label="Artists" data-name="Artists" onTap="openSection" />
120
+ <GridItem icon="music" label="Albums" data-name="Albums" onTap="openSection" />
121
+ <GridItem icon="playlist" label="Playlists" data-name="Playlists" onTap="openSection" />
122
+ <GridItem icon="star" label="Charts" badge="New" data-name="Charts" onTap="openSection" />
123
+ <GridItem icon="calendar" label="Shows" data-name="Shows" onTap="openSection" />
124
+ <GridItem icon="ticket" label="Tickets" data-name="Tickets" onTap="openSection" />
125
+ <GridItem icon="headphones" label="Library" data-name="Library" onTap="openSection" />
126
+ <GridItem image="statics/logo.png" label="Salone" data-name="Salone" onTap="openSection" />
127
+ </Grid>
128
+ <If condition="{{ section }}">
129
+ <Text tone="muted">You tapped {{ section }}</Text>
130
+ </If>
131
+ </View>
132
+ </View>
133
+
134
+ <View gap="small">
135
+ <Text variant="subtitle">Divider</Text>
136
+ <Text variant="caption" tone="muted">A line between parts.</Text>
137
+ <View variant="card">
138
+ <Text>Side A</Text>
139
+ <Divider />
140
+ <Text>Side B</Text>
141
+ </View>
142
+ </View>
143
+ </View>
@@ -0,0 +1,17 @@
1
+ import state, { CHART } from './state';
2
+
3
+ // Rows to add each time the list's end comes into view.
4
+ const MORE = 5;
5
+
6
+ export default definePage({
7
+ initialState: state,
8
+ mutations: {
9
+ choose: (state, event: DotEvent<unknown, { id: string }>) => {
10
+ const artist = state.artists.find((candidate) => candidate.id === event.data.id);
11
+ return { chosen: artist?.name ?? '' };
12
+ },
13
+ showMore: (state) => ({ chart: CHART.slice(0, state.chart.length + MORE) }),
14
+ saveSome: () => ({ saved: ['Exodus, by Drizilik', 'Control, by ApreeL'] }),
15
+ clearSaved: () => ({ saved: [] }),
16
+ },
17
+ });