@valbuild/shared 0.148.3 → 0.148.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @valbuild/shared
2
2
 
3
+ ## 0.148.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#902](https://github.com/valbuild/val/pull/902) [`b580292`](https://github.com/valbuild/val/commit/b580292ac3c335b055f5ed5f18d6a12d075169c7) Thanks [@freekh](https://github.com/freekh)! - The demo has a script: `<ValApp demo={{ tours, audiences }}>`. Instead of a tour that opens by itself, the demo card asks "What brings you here?" and lists short tours for the answer, each ticked off once done. `/val?tour=<id>` starts one from a link.
8
+
9
+ A tour can start on a page of its own (`start`). A step can ask for a new page (`moveOn: { newPage }`), write any value or add one (`moveOn: { edit, value, add }`), and show the code behind what it is about (`code`).
10
+
3
11
  ## 0.148.3
4
12
 
5
13
  ### Patch Changes
@@ -1,3 +1,4 @@
1
+ import type { JSONValue } from "@valbuild/core/patch";
1
2
  /**
2
3
  * A Val demo, as the page hands it to the Studio.
3
4
  *
@@ -28,6 +29,10 @@ export type ValDemoRuntime = {
28
29
  * `ValDemoTourStep`. Absent: the Studio's.
29
30
  */
30
31
  tour?: ValDemoTourStep[];
32
+ /** The demo script. See `ValDemoOptions.tours`. */
33
+ tours?: ValDemoTour[];
34
+ /** "What brings you here?". See `ValDemoOptions.audiences`. */
35
+ audiences?: ValDemoAudience[];
31
36
  };
32
37
  /**
33
38
  * What the site starts the demo with: `<ValApp demo={{ tour }}>`.
@@ -35,7 +40,55 @@ export type ValDemoRuntime = {
35
40
  * `demo` alone (`true`) is the same with nothing given.
36
41
  */
37
42
  export type ValDemoOptions = {
43
+ /**
44
+ * One tour, behind the demo card's Tour button, opened on a first visit.
45
+ * `tours` replaces it: given both, `tours` is used.
46
+ */
38
47
  tour?: ValDemoTourStep[];
48
+ /**
49
+ * The demo script: short tours the visitor picks from on the demo card,
50
+ * each ticked off once done. A tour can be started from a link too:
51
+ * `/val?tour=<id>`.
52
+ */
53
+ tours?: ValDemoTour[];
54
+ /**
55
+ * What the demo card asks first, "What brings you here?": each answer is a
56
+ * list of `tours`, by id, and the card shows the list for the answer. With
57
+ * two or more, the Studio adds "Show me everything", all of them in order.
58
+ * Absent: every tour, in the order given.
59
+ */
60
+ audiences?: ValDemoAudience[];
61
+ };
62
+ /** One item of the demo script. */
63
+ export type ValDemoTour = {
64
+ /** Stable: the answer's list names it, and `?tour=` starts it. */
65
+ id: string;
66
+ title: string;
67
+ /** How long it takes, as the card says it: "30 s", "1 min". */
68
+ duration?: string;
69
+ /**
70
+ * Where the tour starts, as a source path: a page of the site (a page
71
+ * router's module and the page's key). The Studio goes there first, so a
72
+ * tour about the home page is not started on whatever page the last one
73
+ * left open.
74
+ */
75
+ start?: string;
76
+ steps: ValDemoTourStep[];
77
+ };
78
+ /**
79
+ * An answer to "What brings you here?".
80
+ *
81
+ * The first tour of its list is the one the card offers first, with a
82
+ * button of its own: the one to start with.
83
+ */
84
+ export type ValDemoAudience = {
85
+ id: string;
86
+ /** "I write and edit content". */
87
+ title: string;
88
+ /** What the list has in it, in a line: "Pages, photos, languages". */
89
+ description?: string;
90
+ /** Tours by id, in order. */
91
+ tours: string[];
39
92
  };
40
93
  /**
41
94
  * A control of the Studio's a step can point at.
@@ -44,7 +97,7 @@ export type ValDemoOptions = {
44
97
  * screen (the rail on a phone) leaves the card on its own, so a step's words
45
98
  * must work without the arrow: never "this button here".
46
99
  */
47
- export type ValDemoTourTarget = "canvas" | "pages" | "media" | "data" | "review" | "preview" | "publish" | "ai" | "locale" | "demo" | "utility";
100
+ export type ValDemoTourTarget = "canvas" | "pages" | "media" | "data" | "review" | "preview" | "publish" | "ai" | "locale" | "demo" | "utility" | "new-page";
48
101
  /** A panel a step opens, so what it is about is on screen behind the card. */
49
102
  export type ValDemoTourPanel = "pages" | "media" | "data" | "settings" | "ai";
50
103
  /**
@@ -55,8 +108,13 @@ export type ValDemoTourPanel = "pages" | "media" | "data" | "settings" | "ai";
55
108
  *
56
109
  * - `open`: a field at or below this source path is opened -- by clicking it
57
110
  * on the page, or anywhere else. Do it for me opens it.
58
- * - `edit`: a change is made. Do it for me writes `value` at `path`; without
59
- * them, it is offered nowhere and the step waits for the visitor.
111
+ * - `edit`: a change is made. Do it for me writes `value` at `path` --
112
+ * replacing what is there, or with `add: true` adding it, as a new entry of
113
+ * a record or a new item of a list at that index; without them, it is
114
+ * offered nowhere and the step waits for the visitor.
115
+ * - `newPage`: a page is added. Do it for me adds the page this source path
116
+ * names (a page router's module and the new page's key, `?p="/journal/x"`)
117
+ * the way the New page form does, empty, and opens it.
60
118
  * - `panel`: that panel is opened. Do it for me opens it.
61
119
  * - `locale`: the language shown is changed. Do it for me picks the next one.
62
120
  */
@@ -65,7 +123,10 @@ export type ValDemoTourMoveOn = {
65
123
  } | {
66
124
  edit: true;
67
125
  path?: string;
68
- value?: string;
126
+ value?: JSONValue;
127
+ add?: boolean;
128
+ } | {
129
+ newPage: string;
69
130
  } | {
70
131
  panel: ValDemoTourPanel;
71
132
  } | {
@@ -99,6 +160,15 @@ export type ValDemoTourStep = {
99
160
  page?: string;
100
161
  panel?: ValDemoTourPanel;
101
162
  moveOn?: ValDemoTourMoveOn;
163
+ /**
164
+ * Code to show in the card: the line of a `.val.ts` behind what the step is
165
+ * about, for a visitor who builds sites. Written by the site, so it has to
166
+ * be kept the same as the file; `file` says which one.
167
+ */
168
+ code?: {
169
+ file: string;
170
+ text: string;
171
+ };
102
172
  };
103
173
  declare global {
104
174
  var __VAL_DEMO__: ValDemoRuntime | undefined;
@@ -4162,6 +4162,15 @@ function isRetryable(error) {
4162
4162
  * `demo` alone (`true`) is the same with nothing given.
4163
4163
  */
4164
4164
 
4165
+ /** One item of the demo script. */
4166
+
4167
+ /**
4168
+ * An answer to "What brings you here?".
4169
+ *
4170
+ * The first tour of its list is the one the card offers first, with a
4171
+ * button of its own: the one to start with.
4172
+ */
4173
+
4165
4174
  /**
4166
4175
  * A control of the Studio's a step can point at.
4167
4176
  *
@@ -4180,8 +4189,13 @@ function isRetryable(error) {
4180
4189
  *
4181
4190
  * - `open`: a field at or below this source path is opened -- by clicking it
4182
4191
  * on the page, or anywhere else. Do it for me opens it.
4183
- * - `edit`: a change is made. Do it for me writes `value` at `path`; without
4184
- * them, it is offered nowhere and the step waits for the visitor.
4192
+ * - `edit`: a change is made. Do it for me writes `value` at `path` --
4193
+ * replacing what is there, or with `add: true` adding it, as a new entry of
4194
+ * a record or a new item of a list at that index; without them, it is
4195
+ * offered nowhere and the step waits for the visitor.
4196
+ * - `newPage`: a page is added. Do it for me adds the page this source path
4197
+ * names (a page router's module and the new page's key, `?p="/journal/x"`)
4198
+ * the way the New page form does, empty, and opens it.
4185
4199
  * - `panel`: that panel is opened. Do it for me opens it.
4186
4200
  * - `locale`: the language shown is changed. Do it for me picks the next one.
4187
4201
  */
@@ -4162,6 +4162,15 @@ function isRetryable(error) {
4162
4162
  * `demo` alone (`true`) is the same with nothing given.
4163
4163
  */
4164
4164
 
4165
+ /** One item of the demo script. */
4166
+
4167
+ /**
4168
+ * An answer to "What brings you here?".
4169
+ *
4170
+ * The first tour of its list is the one the card offers first, with a
4171
+ * button of its own: the one to start with.
4172
+ */
4173
+
4165
4174
  /**
4166
4175
  * A control of the Studio's a step can point at.
4167
4176
  *
@@ -4180,8 +4189,13 @@ function isRetryable(error) {
4180
4189
  *
4181
4190
  * - `open`: a field at or below this source path is opened -- by clicking it
4182
4191
  * on the page, or anywhere else. Do it for me opens it.
4183
- * - `edit`: a change is made. Do it for me writes `value` at `path`; without
4184
- * them, it is offered nowhere and the step waits for the visitor.
4192
+ * - `edit`: a change is made. Do it for me writes `value` at `path` --
4193
+ * replacing what is there, or with `add: true` adding it, as a new entry of
4194
+ * a record or a new item of a list at that index; without them, it is
4195
+ * offered nowhere and the step waits for the visitor.
4196
+ * - `newPage`: a page is added. Do it for me adds the page this source path
4197
+ * names (a page router's module and the new page's key, `?p="/journal/x"`)
4198
+ * the way the New page form does, empty, and opens it.
4185
4199
  * - `panel`: that panel is opened. Do it for me opens it.
4186
4200
  * - `locale`: the language shown is changed. Do it for me picks the next one.
4187
4201
  */
@@ -4155,6 +4155,15 @@ function isRetryable(error) {
4155
4155
  * `demo` alone (`true`) is the same with nothing given.
4156
4156
  */
4157
4157
 
4158
+ /** One item of the demo script. */
4159
+
4160
+ /**
4161
+ * An answer to "What brings you here?".
4162
+ *
4163
+ * The first tour of its list is the one the card offers first, with a
4164
+ * button of its own: the one to start with.
4165
+ */
4166
+
4158
4167
  /**
4159
4168
  * A control of the Studio's a step can point at.
4160
4169
  *
@@ -4173,8 +4182,13 @@ function isRetryable(error) {
4173
4182
  *
4174
4183
  * - `open`: a field at or below this source path is opened -- by clicking it
4175
4184
  * on the page, or anywhere else. Do it for me opens it.
4176
- * - `edit`: a change is made. Do it for me writes `value` at `path`; without
4177
- * them, it is offered nowhere and the step waits for the visitor.
4185
+ * - `edit`: a change is made. Do it for me writes `value` at `path` --
4186
+ * replacing what is there, or with `add: true` adding it, as a new entry of
4187
+ * a record or a new item of a list at that index; without them, it is
4188
+ * offered nowhere and the step waits for the visitor.
4189
+ * - `newPage`: a page is added. Do it for me adds the page this source path
4190
+ * names (a page router's module and the new page's key, `?p="/journal/x"`)
4191
+ * the way the New page form does, empty, and opens it.
4178
4192
  * - `panel`: that panel is opened. Do it for me opens it.
4179
4193
  * - `locale`: the language shown is changed. Do it for me picks the next one.
4180
4194
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.148.3",
3
+ "version": "0.148.6",
4
4
  "private": false,
5
5
  "description": "Val shared types and utilities",
6
6
  "repository": {