@monimesl/dot-cli 0.1.0-alpha.18 → 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.
Files changed (31) hide show
  1. package/dist/templates/showcase/pages/basics/bindings/controller.ts +1 -0
  2. package/dist/templates/showcase/pages/basics/control-flow/controller.ts +1 -0
  3. package/dist/templates/showcase/pages/basics/events/controller.ts +1 -0
  4. package/dist/templates/showcase/pages/basics/hooks/controller.ts +1 -0
  5. package/dist/templates/showcase/pages/basics/navigation/controller.ts +1 -0
  6. package/dist/templates/showcase/pages/basics/state/controller.ts +1 -0
  7. package/dist/templates/showcase/pages/components/carousel/controller.ts +1 -0
  8. package/dist/templates/showcase/pages/components/feedback/controller.ts +1 -0
  9. package/dist/templates/showcase/pages/components/forms/controller.ts +1 -0
  10. package/dist/templates/showcase/pages/components/icons/controller.ts +1 -0
  11. package/dist/templates/showcase/pages/components/images/controller.ts +1 -0
  12. package/dist/templates/showcase/pages/components/layout/controller.ts +1 -0
  13. package/dist/templates/showcase/pages/components/lists/controller.ts +1 -0
  14. package/dist/templates/showcase/pages/components/money/controller.ts +1 -0
  15. package/dist/templates/showcase/pages/components/reading/controller.ts +1 -0
  16. package/dist/templates/showcase/pages/components/sheets/controller.ts +1 -0
  17. package/dist/templates/showcase/pages/components/styles/controller.ts +1 -0
  18. package/dist/templates/showcase/pages/components/tabs/controller.ts +1 -0
  19. package/dist/templates/showcase/pages/components/text/controller.ts +1 -0
  20. package/dist/templates/showcase/pages/dash/cache/controller.ts +1 -0
  21. package/dist/templates/showcase/pages/dash/calls/controller.ts +1 -0
  22. package/dist/templates/showcase/pages/dash/files/controller.ts +1 -0
  23. package/dist/templates/showcase/pages/dash/media/controller.ts +1 -0
  24. package/dist/templates/showcase/pages/dash/media/state.ts +2 -6
  25. package/dist/templates/showcase/pages/dash/network/controller.ts +14 -5
  26. package/dist/templates/showcase/pages/dash/network/state.ts +4 -1
  27. package/dist/templates/showcase/pages/dash/network/view.dml +4 -4
  28. package/dist/templates/showcase/pages/dash/secrets/controller.ts +1 -0
  29. package/dist/templates/showcase/pages/dash/system/controller.ts +1 -0
  30. package/dist/templates/showcase/pages/dash/ui/controller.ts +1 -0
  31. package/package.json +6 -6
@@ -2,6 +2,7 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'Bindings' } },
5
6
  mutations: {
6
7
  addTicket: (state) => ({ tickets: state.tickets + 1 }),
7
8
  removeTicket: (state) => ({ tickets: Math.max(0, state.tickets - 1) }),
@@ -2,6 +2,7 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'If and For' } },
5
6
  mutations: {
6
7
  // Sells five tickets for the show the button belongs to.
7
8
  sell: (state, event: DotEvent<unknown, { id: string }>) => ({
@@ -12,6 +12,7 @@ function describe(handler: string, event: DotEvent) {
12
12
 
13
13
  export default definePage({
14
14
  initialState: state,
15
+ configs: { navigationBar: { title: 'Events' } },
15
16
  mutations: {
16
17
  // No detail: a tap is all there is to know.
17
18
  countTap: (state, event: DotEvent) => ({
@@ -10,6 +10,7 @@ function ran(runs: readonly HookRun[], hook: string): HookRun[] {
10
10
 
11
11
  export default definePage({
12
12
  initialState: state,
13
+ configs: { navigationBar: { title: 'Page hooks' } },
13
14
  hooks: {
14
15
  // Runs once, when the page opens, with the options it opened with.
15
16
  onLoad(options) {
@@ -2,6 +2,7 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'Navigation' } },
5
6
  hooks: {
6
7
  // Options come from the page that opened this one, as text.
7
8
  onLoad(options) {
@@ -2,6 +2,7 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'State' } },
5
6
  mutations: {
6
7
  increment: (state) => {
7
8
  const count = state.count + 1;
@@ -6,6 +6,7 @@ interface Lookup {
6
6
 
7
7
  export default definePage({
8
8
  initialState: state,
9
+ configs: { navigationBar: { title: 'Carousel' } },
9
10
  hooks: {
10
11
  // Each artist's photo is the cover of one of their releases, from Apple's catalog.
11
12
  async onLoad() {
@@ -2,6 +2,7 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'Feedback' } },
5
6
  mutations: {
6
7
  advance: (state) => ({ progress: Math.min(100, state.progress + 20) }),
7
8
  restart: () => ({ progress: 0 }),
@@ -12,6 +12,7 @@ function total(tickets: string, ticket: TicketType): string {
12
12
 
13
13
  export default definePage({
14
14
  initialState: state,
15
+ configs: { navigationBar: { title: 'Forms' } },
15
16
  mutations: {
16
17
  setShow: (_state, event: Typed) => ({
17
18
  show: event.detail.value,
@@ -2,6 +2,7 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'Icons' } },
5
6
  mutations: {
6
7
  clearToast: () => ({ toast: '' }),
7
8
  },
@@ -9,6 +9,7 @@ interface Lookup {
9
9
 
10
10
  export default definePage({
11
11
  initialState: state,
12
+ configs: { navigationBar: { title: 'Images' } },
12
13
  hooks: {
13
14
  async onLoad() {
14
15
  try {
@@ -12,6 +12,7 @@ interface Lookup {
12
12
 
13
13
  export default definePage({
14
14
  initialState: state,
15
+ configs: { navigationBar: { title: 'Layout' } },
15
16
  hooks: {
16
17
  // The shelf's covers come from Apple's catalog.
17
18
  async onLoad() {
@@ -5,6 +5,7 @@ const MORE = 5;
5
5
 
6
6
  export default definePage({
7
7
  initialState: state,
8
+ configs: { navigationBar: { title: 'Lists' } },
8
9
  mutations: {
9
10
  choose: (state, event: DotEvent<unknown, { id: string }>) => {
10
11
  const artist = state.artists.find((candidate) => candidate.id === event.data.id);
@@ -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;
@@ -2,4 +2,5 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'Reading' } },
5
6
  });
@@ -2,6 +2,7 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'Sheets' } },
5
6
  mutations: {
6
7
  openRelease: (state, event: DotEvent<unknown, { id: string }>) => ({
7
8
  selected: state.releases.find((release) => release.id === event.data.id) ?? null,
@@ -2,4 +2,5 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'Styles' } },
5
6
  });
@@ -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;
@@ -2,6 +2,7 @@ import state from './state';
2
2
 
3
3
  export default definePage({
4
4
  initialState: state,
5
+ configs: { navigationBar: { title: 'Text and links' } },
5
6
  mutations: {
6
7
  like: (state) => ({ likes: state.likes + 1 }),
7
8
  unlike: (state) => ({ likes: Math.max(0, state.likes - 1) }),
@@ -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();
@@ -8,6 +8,7 @@ let wait: DashRequest<void> | null = null;
8
8
 
9
9
  export default definePage({
10
10
  initialState: state,
11
+ configs: { navigationBar: { title: 'Calls and errors' } },
11
12
  actions: {
12
13
  // Makes the call a button names, and shows how it ended.
13
14
  async show(_state, event: DotEvent<unknown, { call: string }>) {
@@ -7,6 +7,7 @@ const PICTURE = 'pictures/artwork.jpg';
7
7
 
8
8
  export default definePage({
9
9
  initialState: state,
10
+ configs: { navigationBar: { title: 'dash.storage.file' } },
10
11
  hooks: {
11
12
  async onShow() {
12
13
  await this.actions.refresh();
@@ -10,6 +10,7 @@ function problemToShow(error: unknown): string {
10
10
 
11
11
  export default definePage({
12
12
  initialState: state,
13
+ configs: { navigationBar: { title: 'dash.media' } },
13
14
  actions: {
14
15
  async pickPhoto(_state, event: DotEvent<unknown, { source: 'library' | 'camera' }>) {
15
16
  try {
@@ -1,11 +1,7 @@
1
- export interface Photo {
2
- name: string;
3
- size: number;
4
- url: string;
5
- }
1
+ import type { DotFile } from '@monimesl/dot-runtime';
6
2
 
7
3
  export default {
8
- photo: null as Photo | null,
4
+ photo: null as DotFile | null,
9
5
  photoDetails: '',
10
6
  scanned: '',
11
7
  note: '',
@@ -30,6 +30,7 @@ function searchUrl(artist: string, limit = PAGE): string {
30
30
 
31
31
  export default definePage({
32
32
  initialState: state,
33
+ configs: { navigationBar: { title: 'dash.network.http' } },
33
34
  mutations: {
34
35
  setArtist: (_state, event: DotEvent<{ value: string }>) => ({ artist: event.detail.value }),
35
36
  },
@@ -103,8 +104,7 @@ export default definePage({
103
104
  name: 'artwork.jpg',
104
105
  });
105
106
  if (response.ok) {
106
- const { id, url, size } = response.file;
107
- this.setState({ picture: { id, url, size }, kept: false });
107
+ this.setState({ picture: response.file, kept: false });
108
108
  } else {
109
109
  this.setState({ note: `Apple answered ${response.status}` });
110
110
  }
@@ -113,11 +113,14 @@ export default definePage({
113
113
  }
114
114
  },
115
115
  async upload(state) {
116
+ if (!state.picture) {
117
+ return;
118
+ }
116
119
  try {
117
120
  const { body } = await this.dash.network.http.upload<Echo>({
118
121
  url: 'https://httpbin.org/post',
119
122
  fields: { artist: state.artist },
120
- files: [{ field: 'artwork', file: state.picture.id }],
123
+ files: [{ field: 'artwork', file: state.picture }],
121
124
  as: 'json',
122
125
  });
123
126
  this.setState({ uploaded: Object.keys(body.files).join(', ') });
@@ -126,15 +129,21 @@ export default definePage({
126
129
  }
127
130
  },
128
131
  async sharePicture(state) {
132
+ if (!state.picture) {
133
+ return;
134
+ }
129
135
  try {
130
- await this.dash.system.share({ file: state.picture.id });
136
+ await this.dash.system.share({ file: state.picture });
131
137
  } catch (error) {
132
138
  this.setState({ note: (error as Error).message });
133
139
  }
134
140
  },
135
141
  async keep(state) {
142
+ if (!state.picture) {
143
+ return;
144
+ }
136
145
  try {
137
- await this.dash.storage.file.save(state.picture.id, PICTURE, { overwrite: true });
146
+ await this.dash.storage.file.save(state.picture, PICTURE, { overwrite: true });
138
147
  this.setState({ kept: true });
139
148
  } catch (error) {
140
149
  this.setState({ note: (error as Error).message });
@@ -1,3 +1,5 @@
1
+ import type { DotFile } from '@monimesl/dot-runtime';
2
+
1
3
  export interface Release {
2
4
  id: number;
3
5
  title: string;
@@ -15,7 +17,8 @@ export default {
15
17
  limit: 10,
16
18
  searching: false,
17
19
  echo: '',
18
- picture: { id: '', url: '', size: 0 },
20
+ // The downloaded artwork, in a temporary file until the dot closes.
21
+ picture: null as DotFile | null,
19
22
  uploaded: '',
20
23
  kept: false,
21
24
  note: '',
@@ -48,11 +48,11 @@
48
48
  <View variant="card" gap="small">
49
49
  <View direction="row" wrap gap="small">
50
50
  <Button variant="secondary" onClick="download" disabled="{{ releases.length === 0 }}">Download</Button>
51
- <Button variant="secondary" onClick="upload" disabled="{{ !picture.id }}">Upload</Button>
52
- <Button variant="secondary" onClick="sharePicture" disabled="{{ !picture.id }}">Share</Button>
53
- <Button variant="secondary" onClick="keep" disabled="{{ !picture.id || kept }}">Keep</Button>
51
+ <Button variant="secondary" onClick="upload" disabled="{{ !picture }}">Upload</Button>
52
+ <Button variant="secondary" onClick="sharePicture" disabled="{{ !picture }}">Share</Button>
53
+ <Button variant="secondary" onClick="keep" disabled="{{ !picture || kept }}">Keep</Button>
54
54
  </View>
55
- <If condition="{{ picture.url }}">
55
+ <If condition="{{ picture }}">
56
56
  <View direction="row" align="center" gap="medium">
57
57
  <Image src="{{ picture.url }}" alt="Artwork" width="64" height="64" />
58
58
  <Text variant="caption" tone="muted">{{ picture.size }} bytes, in a temporary file until the dot closes</Text>
@@ -5,6 +5,7 @@ const NAME = 'session-name';
5
5
 
6
6
  export default definePage({
7
7
  initialState: state,
8
+ configs: { navigationBar: { title: 'dash.storage.secret' } },
8
9
  hooks: {
9
10
  async onShow() {
10
11
  await this.actions.refresh();
@@ -4,6 +4,7 @@ import state from './state';
4
4
 
5
5
  export default definePage({
6
6
  initialState: state,
7
+ configs: { navigationBar: { title: 'dash.system' } },
7
8
  mutations: {
8
9
  clearToast: () => ({ toast: '' }),
9
10
  },
@@ -10,6 +10,7 @@ function problemToShow(error: unknown): string {
10
10
 
11
11
  export default definePage({
12
12
  initialState: state,
13
+ configs: { navigationBar: { title: 'dash.ui' } },
13
14
  actions: {
14
15
  async greet() {
15
16
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monimesl/dot-cli",
3
- "version": "0.1.0-alpha.18",
3
+ "version": "0.1.0-alpha.19",
4
4
  "description": "The dotctl command: build mini apps and run them in the simulator",
5
5
  "type": "module",
6
6
  "repository": {
@@ -24,11 +24,11 @@
24
24
  "dependencies": {
25
25
  "typescript": "^5.9.3",
26
26
  "uqr": "^0.1.3",
27
- "@monimesl/dot-compiler": "0.1.0-alpha.18",
28
- "@monimesl/dot-dml-parser": "0.1.0-alpha.18",
29
- "@monimesl/dot-core": "0.1.0-alpha.18",
30
- "@monimesl/dot-script-parser": "0.1.0-alpha.18",
31
- "@monimesl/dot-simulator": "0.1.0-alpha.18"
27
+ "@monimesl/dot-compiler": "0.1.0-alpha.19",
28
+ "@monimesl/dot-dml-parser": "0.1.0-alpha.19",
29
+ "@monimesl/dot-script-parser": "0.1.0-alpha.19",
30
+ "@monimesl/dot-core": "0.1.0-alpha.19",
31
+ "@monimesl/dot-simulator": "0.1.0-alpha.19"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^22.20.4",