@wix/himalaya-cli 0.1865.0 → 0.1866.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.
package/dist/cli.mjs
CHANGED
|
@@ -4452,6 +4452,7 @@ var init_himi_package = __esm({
|
|
|
4452
4452
|
var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
|
|
4453
4453
|
var init_icon_catalog_generated = __esm({
|
|
4454
4454
|
"../../core/ts/src/icon-catalog.generated.ts"() {
|
|
4455
|
+
"use strict";
|
|
4455
4456
|
init_define_HHP_CATALOG();
|
|
4456
4457
|
ICON_VIEW_BOX = 24;
|
|
4457
4458
|
ICON_STROKE_WIDTH = 2;
|
|
@@ -43123,6 +43124,7 @@ function shouldRevealError(args) {
|
|
|
43123
43124
|
var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
|
|
43124
43125
|
var init_validation = __esm({
|
|
43125
43126
|
"../../core/ts/src/validation.ts"() {
|
|
43127
|
+
"use strict";
|
|
43126
43128
|
init_define_HHP_CATALOG();
|
|
43127
43129
|
EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
|
|
43128
43130
|
URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
|
|
@@ -278970,6 +278972,11 @@ function galleryCards(id, s5, index, ctx, options2) {
|
|
|
278970
278972
|
children2.push(ctx.recipe(options2.layout, { svc, id }), ...viewAll ? [viewAll] : [], ...ctx.optionalRecipe("section-error", { svc, id, action: "load" }));
|
|
278971
278973
|
return vstack(`${id}.box`, children2, 12, { ...inset(16, 16), onAppear: { actionId: `tier5.${svc}.load`, params: {} } });
|
|
278972
278974
|
}
|
|
278975
|
+
function galleryCollage(id, index, ctx, options2) {
|
|
278976
|
+
if (!ctx.hasScreen("himi_gallery")) throw new RecipeError("this scaffold has no himi_gallery screen for a gallery tile to open, so the section keeps its title and a See All link.");
|
|
278977
|
+
const svc = ctx.uses("galleries", `galleries${index}`, { limit: 1, showName: options2.showName, collage: true });
|
|
278978
|
+
return vstack(`${id}.box`, [ctx.recipe("galleries-collage", { svc, id }), ...ctx.optionalRecipe("section-error", { svc, id, action: "load" })], 12, { ...inset(16, 16), onAppear: { actionId: `tier5.${svc}.load`, params: {} } });
|
|
278979
|
+
}
|
|
278973
278980
|
function groupsSection(recipe, type2) {
|
|
278974
278981
|
return (id, s5, st2, index, ctx, sectionId) => {
|
|
278975
278982
|
if (!ctx.hasScreen("himi_group")) return ctx.unsupported(sectionId, type2, "this scaffold has no himi_group screen for a row to open");
|
|
@@ -280235,13 +280242,17 @@ var init_generate2 = __esm({
|
|
|
280235
280242
|
return plansSection(id, s5, index, ctx, { planIds: selectedPlanIds(st2), showBenefits: true, ...order ? { order } : {} });
|
|
280236
280243
|
},
|
|
280237
280244
|
// The site's first Pro Gallery galleries as cover cards (a rail, or full-width cards when the source turns its carousel off), as many as
|
|
280238
|
-
// the source's `maxGalleries
|
|
280245
|
+
// the source's `maxGalleries`; with exactly one (and the carousel on) the source shows that gallery as a collage, and so does the section. Like the source, which lists a member's non-hidden, non-empty galleries and shows a visitor (or a list it
|
|
280239
280246
|
// cannot read) its empty state, the module reads for a signed-in member only. A card opens the template's gallery screen and View All its galleries screen: a scaffold without either
|
|
280240
280247
|
// keeps the title and a link, as every data section does.
|
|
280241
280248
|
progallery_carousel_section: (id, s5, st2, index, ctx, sectionId) => {
|
|
280242
280249
|
const asked = typeof st2.maxGalleries === "number" && st2.maxGalleries >= 1 ? Math.floor(st2.maxGalleries) : void 0;
|
|
280243
280250
|
const limit = asked !== void 0 ? Math.min(asked, GALLERIES_INLINE_MAX) : void 0;
|
|
280244
280251
|
if (asked !== void 0 && limit !== asked) ctx.gap(sectionId, "progallery_carousel_section", `the source shows ${asked} galleries; the section shows the first ${limit}`);
|
|
280252
|
+
if (limit === 1 && st2.isCarousel !== false) {
|
|
280253
|
+
ctx.gap(sectionId, "progallery_carousel_section", "the source's single-gallery section is a collage of the gallery's first five pictures; a picture's caption over its tile is not shown");
|
|
280254
|
+
return galleryCollage(id, index, ctx, { showName: st2.isShowName !== false });
|
|
280255
|
+
}
|
|
280245
280256
|
return galleryCards(id, s5, index, ctx, { layout: st2.isCarousel === false ? "galleries-list" : "galleries-carousel", showName: st2.isShowName !== false, ...limit !== void 0 ? { limit } : {} });
|
|
280246
280257
|
},
|
|
280247
280258
|
// The Pro Gallery list section is the source's whole galleries screen and has no settings of its own (no count, layout or names switch),
|
|
@@ -225,6 +225,7 @@ source's title (only when the source shows it) and a **See All** button to the s
|
|
|
225
225
|
| `platform_general_upcoming_section` | `himi_agenda` | nothing: the source strip is the Bookings member widget (the business's next 3 bookable sessions with the member's booked status; the Events module does not feed it), whatever its `interval` says |
|
|
226
226
|
| `vod_list_section` | `himi_videos` | nothing: the screen is the channel list |
|
|
227
227
|
| `bookings_agenda_section` | `himi_agenda` | nothing: the screen is the calendar of the site's class and course sessions |
|
|
228
|
+
| `progallery_carousel_section` | `himi_galleries` | `maxGalleries`, `isCarousel`, `isShowName`: a rail of the first `maxGalleries` gallery covers (full-width cards when the carousel is off). With exactly ONE gallery and the carousel on, the source shows that gallery as a collage, and so does the section: the gallery's name (when names are on) with View All, then its first five pictures as one big tile and four small, the last small tile with "+N" for the pictures past the five; a tile and View All open the gallery (`himi_gallery`). The section's own title is not shown there (the header is the gallery's name), and a picture's caption over its tile is reported as a gap. Like the list section it reads the One App's galleries service as a member: a visitor sees the "no galleries" state |
|
|
228
229
|
| `proGallery_gallery_list_section` | `himi_galleries` | nothing: the section has no settings. Beside other sections it shows the site's first 10 galleries as full-width cards (a card opens `himi_gallery`), with View All to this screen, and reports that gap. Like the source, which reads the One App's own galleries service as a member and never shows hidden or empty galleries, the section lists them for a signed-in member only: a visitor sees the "no galleries" state, and so does a member where that service cannot be read (the web bridge refuses its host: the public Pro Gallery list has no hidden flag, so it is never used as a stand-in) |
|
|
229
230
|
| `shared_gallery_list_section` | `himi_galleries` | nothing. Never shown inline: it is the members' Shared Gallery, a different data source from the site's Pro Gallery. It keeps its title and a See All link that opens the site's galleries, not the members' shared ones, and reports that gap |
|
|
230
231
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1866.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"artifactId": "himalaya-cli"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
"falconPackageHash": "
|
|
85
|
+
"falconPackageHash": "54120d07b557f53abd06d3c143d44ebd49482b6665d4084e4123cd75"
|
|
86
86
|
}
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_recipe": "A Pro Gallery section's single-gallery collage, as the source shows it with one gallery: the gallery's name and View All, then its first pictures as one big tile and a 2x2 block of small ones, the last small tile carrying a +N pill for the pictures past the five. A tap on a tile or View All opens the gallery. ONE node, always mounted. Service: registerGalleriesSection(svc, { collage: true, showName }); the section has no title of its own and no separate View All button (the header has it).",
|
|
3
|
+
"_placeholders": {
|
|
4
|
+
"svc": "service name the page worker registered with registerGalleriesSection",
|
|
5
|
+
"id": "unique node id prefix for this section"
|
|
6
|
+
},
|
|
7
|
+
"node": {
|
|
8
|
+
"id": "{{id}}.galleries",
|
|
9
|
+
"body": {
|
|
10
|
+
"package": "himalaya",
|
|
11
|
+
"type": "VStack",
|
|
12
|
+
"props": {
|
|
13
|
+
"spacing": 12,
|
|
14
|
+
"alignment": "leading",
|
|
15
|
+
"children": [
|
|
16
|
+
{
|
|
17
|
+
"id": "{{id}}.loading",
|
|
18
|
+
"body": {
|
|
19
|
+
"package": "himalaya",
|
|
20
|
+
"type": "Skeleton",
|
|
21
|
+
"props": {
|
|
22
|
+
"height": 180,
|
|
23
|
+
"count": 1,
|
|
24
|
+
"cornerRadius": 8
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"modifiers": {
|
|
28
|
+
"padding": {
|
|
29
|
+
"leading": 0,
|
|
30
|
+
"trailing": 0,
|
|
31
|
+
"top": 0,
|
|
32
|
+
"bottom": 0
|
|
33
|
+
},
|
|
34
|
+
"hiddenPath": "$service:{{svc}}.notLoading"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "{{id}}.header",
|
|
39
|
+
"body": {
|
|
40
|
+
"package": "himalaya",
|
|
41
|
+
"type": "Grid",
|
|
42
|
+
"props": {
|
|
43
|
+
"columns": 1,
|
|
44
|
+
"spacing": 0,
|
|
45
|
+
"itemsPath": "$service:{{svc}}.rows",
|
|
46
|
+
"items": [
|
|
47
|
+
{
|
|
48
|
+
"id": "{{id}}.headerRow",
|
|
49
|
+
"body": {
|
|
50
|
+
"package": "himalaya",
|
|
51
|
+
"type": "HStack",
|
|
52
|
+
"props": {
|
|
53
|
+
"spacing": 12,
|
|
54
|
+
"alignment": "center",
|
|
55
|
+
"children": [
|
|
56
|
+
{
|
|
57
|
+
"id": "",
|
|
58
|
+
"body": {
|
|
59
|
+
"package": "himalaya",
|
|
60
|
+
"type": "Text",
|
|
61
|
+
"props": {
|
|
62
|
+
"text": "$item.name",
|
|
63
|
+
"style": "title3",
|
|
64
|
+
"maxLines": 2,
|
|
65
|
+
"collapseWhenEmpty": true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"modifiers": {
|
|
69
|
+
"weight": 1
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "",
|
|
74
|
+
"body": {
|
|
75
|
+
"package": "himalaya",
|
|
76
|
+
"type": "Button",
|
|
77
|
+
"props": {
|
|
78
|
+
"title": "View All",
|
|
79
|
+
"style": "link",
|
|
80
|
+
"size": "sm",
|
|
81
|
+
"action": {
|
|
82
|
+
"actionId": "himi.open",
|
|
83
|
+
"params": {
|
|
84
|
+
"screenId": "$item.detailScreenId",
|
|
85
|
+
"id": "$item.id",
|
|
86
|
+
"name": "$item.label",
|
|
87
|
+
"source": "$item.source"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"modifiers": {
|
|
97
|
+
"fillMaxWidth": true
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"modifiers": {
|
|
104
|
+
"hiddenPath": "$service:{{svc}}.noRows"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "{{id}}.mosaic",
|
|
109
|
+
"body": {
|
|
110
|
+
"package": "himalaya",
|
|
111
|
+
"type": "HStack",
|
|
112
|
+
"props": {
|
|
113
|
+
"spacing": 8,
|
|
114
|
+
"alignment": "leading",
|
|
115
|
+
"children": [
|
|
116
|
+
{
|
|
117
|
+
"id": "{{id}}.big",
|
|
118
|
+
"body": {
|
|
119
|
+
"package": "himalaya",
|
|
120
|
+
"type": "Grid",
|
|
121
|
+
"props": {
|
|
122
|
+
"columns": 1,
|
|
123
|
+
"spacing": 8,
|
|
124
|
+
"itemsPath": "$service:{{svc}}.bigTile",
|
|
125
|
+
"items": [
|
|
126
|
+
{
|
|
127
|
+
"id": "{{id}}.bigTile",
|
|
128
|
+
"body": {
|
|
129
|
+
"package": "himalaya",
|
|
130
|
+
"type": "VStack",
|
|
131
|
+
"props": {
|
|
132
|
+
"spacing": 0,
|
|
133
|
+
"alignment": "leading",
|
|
134
|
+
"children": [
|
|
135
|
+
{
|
|
136
|
+
"id": "",
|
|
137
|
+
"body": {
|
|
138
|
+
"package": "himalaya",
|
|
139
|
+
"type": "ZStack",
|
|
140
|
+
"props": {
|
|
141
|
+
"alignment": "center",
|
|
142
|
+
"children": [
|
|
143
|
+
{
|
|
144
|
+
"id": "",
|
|
145
|
+
"body": {
|
|
146
|
+
"package": "himalaya",
|
|
147
|
+
"type": "Image",
|
|
148
|
+
"props": {
|
|
149
|
+
"url": "$item.image",
|
|
150
|
+
"fillWidth": true,
|
|
151
|
+
"contentMode": "fill",
|
|
152
|
+
"aspectRatio": 1,
|
|
153
|
+
"contentDescription": "$item.label",
|
|
154
|
+
"shape": "rounded"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"modifiers": {
|
|
158
|
+
"cornerRadius": 8,
|
|
159
|
+
"fillMaxWidth": true
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"id": "",
|
|
164
|
+
"body": {
|
|
165
|
+
"package": "himalaya",
|
|
166
|
+
"type": "VStack",
|
|
167
|
+
"props": {
|
|
168
|
+
"spacing": 0,
|
|
169
|
+
"alignment": "center",
|
|
170
|
+
"children": [
|
|
171
|
+
{
|
|
172
|
+
"id": "",
|
|
173
|
+
"body": {
|
|
174
|
+
"package": "himalaya",
|
|
175
|
+
"type": "Text",
|
|
176
|
+
"props": {
|
|
177
|
+
"text": "$item.more",
|
|
178
|
+
"style": "bodyEmphasis",
|
|
179
|
+
"maxLines": 1,
|
|
180
|
+
"color": "textOnAccent"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"modifiers": {
|
|
188
|
+
"background": {
|
|
189
|
+
"token": "accentPrimary"
|
|
190
|
+
},
|
|
191
|
+
"cornerRadius": 10,
|
|
192
|
+
"padding": {
|
|
193
|
+
"leading": 12,
|
|
194
|
+
"trailing": 12,
|
|
195
|
+
"top": 6,
|
|
196
|
+
"bottom": 6
|
|
197
|
+
},
|
|
198
|
+
"hiddenPath": "$item.noMore"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"modifiers": {
|
|
205
|
+
"fillMaxWidth": true
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"modifiers": {
|
|
212
|
+
"fillMaxWidth": true,
|
|
213
|
+
"onTap": {
|
|
214
|
+
"actionId": "himi.open",
|
|
215
|
+
"params": {
|
|
216
|
+
"screenId": "$item.detailScreenId",
|
|
217
|
+
"id": "$item.id",
|
|
218
|
+
"name": "$item.label",
|
|
219
|
+
"source": "$item.source"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"pressFeedback": "scale",
|
|
223
|
+
"haptic": "light",
|
|
224
|
+
"accessibilityLabel": "$item.label"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"modifiers": {
|
|
231
|
+
"weight": 1
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"id": "{{id}}.small",
|
|
236
|
+
"body": {
|
|
237
|
+
"package": "himalaya",
|
|
238
|
+
"type": "Grid",
|
|
239
|
+
"props": {
|
|
240
|
+
"columns": 2,
|
|
241
|
+
"spacing": 8,
|
|
242
|
+
"itemsPath": "$service:{{svc}}.smallTiles",
|
|
243
|
+
"items": [
|
|
244
|
+
{
|
|
245
|
+
"id": "{{id}}.smallTile",
|
|
246
|
+
"body": {
|
|
247
|
+
"package": "himalaya",
|
|
248
|
+
"type": "VStack",
|
|
249
|
+
"props": {
|
|
250
|
+
"spacing": 0,
|
|
251
|
+
"alignment": "leading",
|
|
252
|
+
"children": [
|
|
253
|
+
{
|
|
254
|
+
"id": "",
|
|
255
|
+
"body": {
|
|
256
|
+
"package": "himalaya",
|
|
257
|
+
"type": "ZStack",
|
|
258
|
+
"props": {
|
|
259
|
+
"alignment": "center",
|
|
260
|
+
"children": [
|
|
261
|
+
{
|
|
262
|
+
"id": "",
|
|
263
|
+
"body": {
|
|
264
|
+
"package": "himalaya",
|
|
265
|
+
"type": "Image",
|
|
266
|
+
"props": {
|
|
267
|
+
"url": "$item.image",
|
|
268
|
+
"fillWidth": true,
|
|
269
|
+
"contentMode": "fill",
|
|
270
|
+
"aspectRatio": 1,
|
|
271
|
+
"contentDescription": "$item.label",
|
|
272
|
+
"shape": "rounded"
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
"modifiers": {
|
|
276
|
+
"cornerRadius": 8,
|
|
277
|
+
"fillMaxWidth": true
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"id": "",
|
|
282
|
+
"body": {
|
|
283
|
+
"package": "himalaya",
|
|
284
|
+
"type": "VStack",
|
|
285
|
+
"props": {
|
|
286
|
+
"spacing": 0,
|
|
287
|
+
"alignment": "center",
|
|
288
|
+
"children": [
|
|
289
|
+
{
|
|
290
|
+
"id": "",
|
|
291
|
+
"body": {
|
|
292
|
+
"package": "himalaya",
|
|
293
|
+
"type": "Text",
|
|
294
|
+
"props": {
|
|
295
|
+
"text": "$item.more",
|
|
296
|
+
"style": "bodyEmphasis",
|
|
297
|
+
"maxLines": 1,
|
|
298
|
+
"color": "textOnAccent"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"modifiers": {
|
|
306
|
+
"background": {
|
|
307
|
+
"token": "accentPrimary"
|
|
308
|
+
},
|
|
309
|
+
"cornerRadius": 10,
|
|
310
|
+
"padding": {
|
|
311
|
+
"leading": 12,
|
|
312
|
+
"trailing": 12,
|
|
313
|
+
"top": 6,
|
|
314
|
+
"bottom": 6
|
|
315
|
+
},
|
|
316
|
+
"hiddenPath": "$item.noMore"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"modifiers": {
|
|
323
|
+
"fillMaxWidth": true
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"modifiers": {
|
|
330
|
+
"fillMaxWidth": true,
|
|
331
|
+
"onTap": {
|
|
332
|
+
"actionId": "himi.open",
|
|
333
|
+
"params": {
|
|
334
|
+
"screenId": "$item.detailScreenId",
|
|
335
|
+
"id": "$item.id",
|
|
336
|
+
"name": "$item.label",
|
|
337
|
+
"source": "$item.source"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"pressFeedback": "scale",
|
|
341
|
+
"haptic": "light",
|
|
342
|
+
"accessibilityLabel": "$item.label"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"modifiers": {
|
|
349
|
+
"weight": 1
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"modifiers": {
|
|
356
|
+
"fillMaxWidth": true,
|
|
357
|
+
"hiddenPath": "$service:{{svc}}.noCollage"
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"id": "{{id}}.empty",
|
|
362
|
+
"body": {
|
|
363
|
+
"package": "himalaya",
|
|
364
|
+
"type": "Text",
|
|
365
|
+
"props": {
|
|
366
|
+
"text": "$service:{{svc}}.emptyText",
|
|
367
|
+
"style": "body",
|
|
368
|
+
"color": "textSecondary"
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"modifiers": {
|
|
372
|
+
"hiddenPath": "$service:{{svc}}.noEmpty"
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
// - a member reads that service (`photography-one-app-viewer/galleries`), which a native host reaches;
|
|
10
10
|
// - where it cannot be read (the published web bridge refuses that host) the member gets the empty state too: a hidden gallery must never show.
|
|
11
11
|
// A page worker registers it under a service name; the descriptor binds `$service:<serviceName>.*` (recipes galleries-carousel / galleries-list).
|
|
12
|
+
// `collage: true` is the source's single-gallery mode (`maxGalleries: 1`): the first gallery's name, View All, and its first five pictures as one
|
|
13
|
+
// big tile and four small ones, the last small tile carrying "+N" for the pictures past the five (recipe galleries-collage).
|
|
12
14
|
import { defineService } from "@himalaya/state";
|
|
13
15
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
14
16
|
import { copyParam, stashCopy, copyTemplate } from "./himi-copy.js";
|
|
@@ -19,6 +21,17 @@ export interface GalleriesSectionOptions {
|
|
|
19
21
|
limit?: number;
|
|
20
22
|
/** Whether a card shows the gallery's name. */
|
|
21
23
|
showName?: boolean;
|
|
24
|
+
/** The single-gallery collage: the first visible gallery's first pictures as tiles (and `limit` is 1). */
|
|
25
|
+
collage?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A tile of the collage: a picture of the gallery, opening it. The last small tile carries the count of pictures past the tiles. */
|
|
29
|
+
export interface CollageTile {
|
|
30
|
+
image: string; hasImage: boolean; noImage: boolean;
|
|
31
|
+
/** "+16" on the last small tile when the gallery has pictures past the five shown; "" on every other tile. */
|
|
32
|
+
more: string; hasMore: boolean; noMore: boolean;
|
|
33
|
+
/** The gallery the tile opens (a tile opens its gallery, not the picture): the same params as a card. */
|
|
34
|
+
id: string; label: string; detailScreenId: string; source: string;
|
|
22
35
|
}
|
|
23
36
|
|
|
24
37
|
export interface GalleryRow {
|
|
@@ -41,6 +54,11 @@ export interface GalleriesSectionState {
|
|
|
41
54
|
notLoading: boolean; notErrored: boolean; noRows: boolean; noEmpty: boolean;
|
|
42
55
|
/** false when the site has more galleries than the section shows. */
|
|
43
56
|
noMore: boolean;
|
|
57
|
+
/** The collage's tiles: the first one, and up to four after it (both empty outside `collage`). */
|
|
58
|
+
bigTile: CollageTile[];
|
|
59
|
+
smallTiles: CollageTile[];
|
|
60
|
+
/** true when there is no collage to show (not in `collage` mode, or the gallery has no pictures). */
|
|
61
|
+
noCollage: boolean;
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
/** The One App's own list: what the source section reads (its `API_BASE_URL` + `/galleries`), as a member, without hidden galleries. */
|
|
@@ -50,17 +68,26 @@ const DEFAULT_LIMIT = 10;
|
|
|
50
68
|
const PAGE_SIZE = 10, MAX_GALLERIES = 30;
|
|
51
69
|
/** A 240pt card at 3x: the shared list size (1000px) would ship far more pixels than a rail shows. */
|
|
52
70
|
const CARD_IMAGE = { width: 720, height: 540, quality: 85 };
|
|
71
|
+
/** The collage shows the first five pictures: one big tile and four small ones. */
|
|
72
|
+
const COLLAGE_TILES = 5;
|
|
73
|
+
/** A big tile is about half the screen wide at 3x, a small one a quarter. */
|
|
74
|
+
const BIG_TILE_IMAGE = { width: 720, height: 720, quality: 85 };
|
|
75
|
+
const SMALL_TILE_IMAGE = { width: 360, height: 360, quality: 85 };
|
|
53
76
|
|
|
54
77
|
type WixApi = { call: (method: string, path: string) => Promise<unknown> };
|
|
55
78
|
interface RawItem { mediaUrl?: unknown; dataType?: unknown; videoMetadata?: { posters?: Array<{ url?: unknown }> } }
|
|
56
79
|
/** A gallery of the One App's list. */
|
|
57
80
|
interface RawGallery { id?: unknown; name?: unknown; items?: RawItem[]; totalItemsCount?: unknown; isHidden?: unknown }
|
|
58
81
|
|
|
59
|
-
/**
|
|
60
|
-
function
|
|
61
|
-
const item = Array.isArray(gallery.items) ? gallery.items[0] : undefined;
|
|
82
|
+
/** An item's picture (a video gives its poster), sized for its tile. */
|
|
83
|
+
function pictureOf(item: RawItem | undefined, size: { width: number; height: number; quality: number }): string {
|
|
62
84
|
const poster = item?.dataType === "Video" ? item.videoMetadata?.posters?.find((p) => typeof p?.url === "string" && p.url)?.url : undefined;
|
|
63
|
-
return wixMediaUrl(poster ?? item?.mediaUrl,
|
|
85
|
+
return wixMediaUrl(poster ?? item?.mediaUrl, size);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A gallery's cover: the first item's picture. */
|
|
89
|
+
function coverOf(gallery: RawGallery): string {
|
|
90
|
+
return pictureOf(Array.isArray(gallery.items) ? gallery.items[0] : undefined, CARD_IMAGE);
|
|
64
91
|
}
|
|
65
92
|
|
|
66
93
|
function rowOf(gallery: RawGallery, index: number, showName: boolean): GalleryRow {
|
|
@@ -74,6 +101,26 @@ function rowOf(gallery: RawGallery, index: number, showName: boolean): GalleryRo
|
|
|
74
101
|
};
|
|
75
102
|
}
|
|
76
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The collage's tiles of one gallery: its first five pictures that have a url (a picture with none is skipped), the first as the big tile and
|
|
106
|
+
* the rest as the small ones, the last small tile carrying "+N" for the pictures past the ones looked at. Size and "+N" go by a tile's place
|
|
107
|
+
* among the SHOWN ones, never by the picture's original index: a skipped first picture must not leave the big tile at a small size, and a
|
|
108
|
+
* skipped fifth one must not take the "+N" away.
|
|
109
|
+
*/
|
|
110
|
+
function collageOf(gallery: RawGallery, row: GalleryRow): { big: CollageTile[]; small: CollageTile[] } {
|
|
111
|
+
const looked = (Array.isArray(gallery.items) ? gallery.items : []).slice(0, COLLAGE_TILES);
|
|
112
|
+
const total = typeof gallery.totalItemsCount === "number" ? gallery.totalItemsCount : looked.length;
|
|
113
|
+
const past = Math.max(0, total - looked.length);
|
|
114
|
+
const shown = looked.filter((item) => pictureOf(item, SMALL_TILE_IMAGE));
|
|
115
|
+
const tiles = shown.map((item, place): CollageTile => {
|
|
116
|
+
const image = pictureOf(item, place === 0 ? BIG_TILE_IMAGE : SMALL_TILE_IMAGE);
|
|
117
|
+
const last = place >= 1 && place === shown.length - 1 && past > 0;
|
|
118
|
+
return { image, hasImage: true, noImage: false, more: last ? `+${past}` : "", hasMore: last, noMore: !last,
|
|
119
|
+
id: row.id, label: row.label, detailScreenId: row.detailScreenId, source: row.source };
|
|
120
|
+
});
|
|
121
|
+
return { big: tiles.slice(0, 1), small: tiles.slice(1) };
|
|
122
|
+
}
|
|
123
|
+
|
|
77
124
|
/** A gallery the section may show: the source drops hidden and empty galleries. An unknown count is not "empty". */
|
|
78
125
|
function visible(gallery: RawGallery): boolean {
|
|
79
126
|
const count = gallery.totalItemsCount;
|
|
@@ -85,8 +132,8 @@ const MAX_SCANNED = 200;
|
|
|
85
132
|
|
|
86
133
|
/** One page of the One App's list, as the source section reads it (`withHidden=false`). A native transport may hand the body over bare or wrapped as
|
|
87
134
|
* `{ data }`. The service drops hidden galleries after it pages, so only its `totalGalleriesCount` says where the list ends: a body without one is not read. */
|
|
88
|
-
async function readPage(api: WixApi, offset: number): Promise<{ galleries: RawGallery[]; total: number }> {
|
|
89
|
-
const res = await api.call("GET", `${ONE_APP_GALLERIES_URL}?itemsPerGallery
|
|
135
|
+
async function readPage(api: WixApi, offset: number, itemsPerGallery: number): Promise<{ galleries: RawGallery[]; total: number }> {
|
|
136
|
+
const res = await api.call("GET", `${ONE_APP_GALLERIES_URL}?itemsPerGallery=${itemsPerGallery}&offset=${offset}&limit=${PAGE_SIZE}&withHidden=false&useNew=true`);
|
|
90
137
|
const body = (res as { data?: unknown } | null)?.data ?? res;
|
|
91
138
|
const { galleries, totalGalleriesCount } = (body ?? {}) as { galleries?: unknown; totalGalleriesCount?: unknown };
|
|
92
139
|
if (!Array.isArray(galleries) || typeof totalGalleriesCount !== "number") throw new Error("Malformed One App galleries response");
|
|
@@ -94,12 +141,12 @@ async function readPage(api: WixApi, offset: number): Promise<{ galleries: RawGa
|
|
|
94
141
|
}
|
|
95
142
|
|
|
96
143
|
/** The first `limit` visible galleries, page by page, and whether there are more. A page can hold fewer than `PAGE_SIZE` visible galleries, so paging goes by the offset and the total. */
|
|
97
|
-
async function readGalleries(api: WixApi, limit: number): Promise<{ galleries: RawGallery[]; more: boolean }> {
|
|
144
|
+
async function readGalleries(api: WixApi, limit: number, itemsPerGallery: number): Promise<{ galleries: RawGallery[]; more: boolean }> {
|
|
98
145
|
const galleries: RawGallery[] = [];
|
|
99
146
|
let offset = 0, total = Infinity;
|
|
100
147
|
// One more than the section shows, so "more" is known without a second read.
|
|
101
148
|
while (galleries.length <= limit && offset < total && offset < MAX_SCANNED) {
|
|
102
|
-
const page = await readPage(api, offset);
|
|
149
|
+
const page = await readPage(api, offset, itemsPerGallery);
|
|
103
150
|
galleries.push(...page.galleries.filter(visible));
|
|
104
151
|
total = page.total;
|
|
105
152
|
offset += PAGE_SIZE;
|
|
@@ -108,10 +155,11 @@ async function readGalleries(api: WixApi, limit: number): Promise<{ galleries: R
|
|
|
108
155
|
}
|
|
109
156
|
|
|
110
157
|
export function registerGalleriesSection(serviceName: string, options: GalleriesSectionOptions = {}) {
|
|
111
|
-
const
|
|
158
|
+
const collage = options.collage === true;
|
|
159
|
+
const limit = collage ? 1 : Math.min(Math.max(Math.floor(options.limit ?? DEFAULT_LIMIT), 1), MAX_GALLERIES);
|
|
112
160
|
const showName = options.showName !== false;
|
|
113
|
-
const view = (status: GalleriesSectionState["status"], rows: GalleryRow[], more: boolean): GalleriesSectionState => ({
|
|
114
|
-
status, rows,
|
|
161
|
+
const view = (status: GalleriesSectionState["status"], rows: GalleryRow[], more: boolean, tiles: { big: CollageTile[]; small: CollageTile[] } = { big: [], small: [] }): GalleriesSectionState => ({
|
|
162
|
+
status, rows, bigTile: tiles.big, smallTiles: tiles.small, noCollage: !tiles.big.length,
|
|
115
163
|
emptyText: status === "ready" && !rows.length ? copyParam("galleries.sectionEmptyText", "No galleries yet.") : "",
|
|
116
164
|
notLoading: status !== "loading", notErrored: status !== "error",
|
|
117
165
|
noRows: !rows.length, noEmpty: !(status === "ready" && !rows.length),
|
|
@@ -127,13 +175,13 @@ export function registerGalleriesSection(serviceName: string, options: Galleries
|
|
|
127
175
|
if (!(await memberAccess()).signedIn) return view("ready", [], false);
|
|
128
176
|
const api = (globalThis as { himalaya?: { wixApi?: WixApi } }).himalaya?.wixApi;
|
|
129
177
|
if (!api) throw new Error("Wix bridge unavailable");
|
|
130
|
-
const { galleries, more } = await readGalleries(api, limit).catch((oneAppError) => {
|
|
178
|
+
const { galleries, more } = await readGalleries(api, limit, collage ? COLLAGE_TILES : 1).catch((oneAppError) => {
|
|
131
179
|
// As in the source, a list that cannot be read is its "no galleries" state (and it is never replaced by the public list: that one cannot tell a hidden gallery).
|
|
132
180
|
console.warn("galleries_section: the One App galleries service could not be read", oneAppError);
|
|
133
181
|
return { galleries: [] as RawGallery[], more: false };
|
|
134
182
|
});
|
|
135
183
|
const rows = galleries.slice(0, limit).map((gallery, index) => rowOf(gallery, index, showName));
|
|
136
|
-
return view("ready", rows, more);
|
|
184
|
+
return view("ready", rows, more, collage && rows[0] && galleries[0] ? collageOf(galleries[0], rows[0]) : undefined);
|
|
137
185
|
} catch (error) {
|
|
138
186
|
console.warn("galleries_section: the galleries could not be read", error);
|
|
139
187
|
return view("error", [], false);
|