@wix/himalaya-cli 0.1260.0 → 0.1262.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 +36 -22
- package/dist/preview-assets.generated.bin +0 -0
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +45 -7
- package/templates/beauty-salon/tier5-src/_shared/home-service.ts +18 -5
- package/templates/beauty-salon-owner/dev/index.ts +45 -7
- package/templates/beauty-salon-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-product-form/index.ts +21 -7
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-service-form/index.ts +10 -8
- package/templates/branded-lite/dev/index.ts +45 -7
- package/templates/branded-lite/tier5-src/_shared/home-service.ts +18 -5
- package/templates/community-club/dev/index.ts +45 -7
- package/templates/community-club/tier5-src/_shared/home-service.ts +18 -5
- package/templates/community-club-owner/dev/index.ts +45 -7
- package/templates/community-club-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/community-club-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -6
- package/templates/community-club-owner/tier5-src/himi-owner-lite-product-form/index.ts +21 -7
- package/templates/events-meetups/dev/index.ts +45 -7
- package/templates/events-meetups/tier5-src/_shared/home-service.ts +18 -5
- package/templates/events-meetups-owner/dev/index.ts +45 -7
- package/templates/events-meetups-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -6
- package/templates/gym-fitness/dev/index.ts +45 -7
- package/templates/gym-fitness/tier5-src/_shared/home-service.ts +18 -5
- package/templates/gym-fitness-owner/dev/index.ts +45 -7
- package/templates/gym-fitness-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -6
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-product-form/index.ts +21 -7
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-service-form/index.ts +10 -8
- package/templates/nonprofit-cause/dev/index.ts +45 -7
- package/templates/nonprofit-cause/tier5-src/_shared/home-service.ts +18 -5
- package/templates/nonprofit-cause-owner/dev/index.ts +45 -7
- package/templates/nonprofit-cause-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -6
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-service-form/index.ts +10 -8
- package/templates/owner-lite/dev/index.ts +45 -7
- package/templates/owner-lite/tier5-src/_shared/home-service.ts +18 -5
- package/templates/owner-lite/tier5-src/himi-owner-lite-event-form/index.ts +16 -6
- package/templates/owner-lite/tier5-src/himi-owner-lite-product-form/index.ts +21 -7
- package/templates/owner-lite/tier5-src/himi-owner-lite-service-form/index.ts +10 -8
- package/templates/podcast-creator/dev/index.ts +45 -7
- package/templates/podcast-creator/tier5-src/_shared/home-service.ts +18 -5
- package/templates/podcast-creator-owner/dev/index.ts +45 -7
- package/templates/podcast-creator-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -6
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-product-form/index.ts +21 -7
- package/templates/portfolio-creative/dev/index.ts +45 -7
- package/templates/portfolio-creative/tier5-src/_shared/home-service.ts +18 -5
- package/templates/portfolio-creative-owner/dev/index.ts +45 -7
- package/templates/portfolio-creative-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-product-form/index.ts +21 -7
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-service-form/index.ts +10 -8
- package/templates/restaurant/dev/index.ts +45 -7
- package/templates/restaurant/tier5-src/_shared/home-service.ts +18 -5
- package/templates/restaurant-owner/dev/index.ts +45 -7
- package/templates/restaurant-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -6
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-product-form/index.ts +21 -7
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-service-form/index.ts +10 -8
- package/templates/retail-store/dev/index.ts +45 -7
- package/templates/retail-store/tier5-src/_shared/home-service.ts +18 -5
- package/templates/retail-store-owner/dev/index.ts +45 -7
- package/templates/retail-store-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-product-form/index.ts +21 -7
- package/templates/yoga-studio/dev/index.ts +45 -7
- package/templates/yoga-studio/tier5-src/_shared/home-service.ts +18 -5
- package/templates/yoga-studio-owner/dev/index.ts +45 -7
- package/templates/yoga-studio-owner/tier5-src/_shared/home-service.ts +18 -5
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-event-form/index.ts +16 -6
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-service-form/index.ts +10 -8
|
@@ -1909,6 +1909,9 @@ const SCREENS = runtimeSetting({
|
|
|
1909
1909
|
"type": "BottomSheet",
|
|
1910
1910
|
"props": {
|
|
1911
1911
|
"presentedPath": "$service:himiBrandedHome.homeModules.presented",
|
|
1912
|
+
"detents": [
|
|
1913
|
+
0.95
|
|
1914
|
+
],
|
|
1912
1915
|
"dismissible": true,
|
|
1913
1916
|
"showGrabber": true,
|
|
1914
1917
|
"onDismiss": {
|
|
@@ -2010,6 +2013,9 @@ const SCREENS = runtimeSetting({
|
|
|
2010
2013
|
}
|
|
2011
2014
|
}
|
|
2012
2015
|
}
|
|
2016
|
+
},
|
|
2017
|
+
"modifiers": {
|
|
2018
|
+
"accessibilityLabel": "$item.pinA11yLabel"
|
|
2013
2019
|
}
|
|
2014
2020
|
},
|
|
2015
2021
|
{
|
|
@@ -2027,31 +2033,63 @@ const SCREENS = runtimeSetting({
|
|
|
2027
2033
|
}
|
|
2028
2034
|
}
|
|
2029
2035
|
}
|
|
2036
|
+
},
|
|
2037
|
+
"modifiers": {
|
|
2038
|
+
"accessibilityLabel": "$item.visibilityA11yLabel"
|
|
2030
2039
|
}
|
|
2031
|
-
}
|
|
2040
|
+
}
|
|
2041
|
+
]
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
},
|
|
2045
|
+
{
|
|
2046
|
+
"id": "",
|
|
2047
|
+
"body": {
|
|
2048
|
+
"package": "himalaya",
|
|
2049
|
+
"type": "HStack",
|
|
2050
|
+
"props": {
|
|
2051
|
+
"spacing": 8,
|
|
2052
|
+
"children": [
|
|
2032
2053
|
{
|
|
2033
|
-
"id": "",
|
|
2054
|
+
"id": "btn_tier5_himibrandedhome_homemoveup",
|
|
2034
2055
|
"body": {
|
|
2035
2056
|
"package": "himalaya",
|
|
2036
|
-
"type": "
|
|
2037
|
-
"props": {
|
|
2057
|
+
"type": "Button",
|
|
2058
|
+
"props": {
|
|
2059
|
+
"title": "Move up",
|
|
2060
|
+
"style": "plain",
|
|
2061
|
+
"action": {
|
|
2062
|
+
"actionId": "tier5.himiBrandedHome.homeMoveUp",
|
|
2063
|
+
"params": {
|
|
2064
|
+
"id": "$item.id"
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
},
|
|
2069
|
+
"modifiers": {
|
|
2070
|
+
"accessibilityLabel": "$item.moveUpA11yLabel",
|
|
2071
|
+
"hiddenPath": "$item.isFirst"
|
|
2038
2072
|
}
|
|
2039
2073
|
},
|
|
2040
2074
|
{
|
|
2041
|
-
"id": "
|
|
2075
|
+
"id": "btn_tier5_himibrandedhome_homemovedown",
|
|
2042
2076
|
"body": {
|
|
2043
2077
|
"package": "himalaya",
|
|
2044
2078
|
"type": "Button",
|
|
2045
2079
|
"props": {
|
|
2046
|
-
"title": "Move
|
|
2080
|
+
"title": "Move down",
|
|
2047
2081
|
"style": "plain",
|
|
2048
2082
|
"action": {
|
|
2049
|
-
"actionId": "tier5.himiBrandedHome.
|
|
2083
|
+
"actionId": "tier5.himiBrandedHome.homeMoveDown",
|
|
2050
2084
|
"params": {
|
|
2051
2085
|
"id": "$item.id"
|
|
2052
2086
|
}
|
|
2053
2087
|
}
|
|
2054
2088
|
}
|
|
2089
|
+
},
|
|
2090
|
+
"modifiers": {
|
|
2091
|
+
"accessibilityLabel": "$item.moveDownA11yLabel",
|
|
2092
|
+
"hiddenPath": "$item.isLast"
|
|
2055
2093
|
}
|
|
2056
2094
|
}
|
|
2057
2095
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineService as register, type ServiceDefinition } from '@himalaya/state';
|
|
2
2
|
import { normalizeHome, visibleHome, moduleIsEmpty, type HomeModule, type HomePreferences } from './home-modules.js';
|
|
3
|
-
import { copyParam, stashCopy } from './himi-copy.js';
|
|
3
|
+
import { copyParam, copyTemplate, stashCopy } from './himi-copy.js';
|
|
4
4
|
import { localPreferences } from './local-preferences.js';
|
|
5
5
|
type State = Record<string, unknown>;
|
|
6
6
|
type Action = (s: State, ...args: unknown[]) => State | undefined | Promise<State | undefined>;
|
|
@@ -32,10 +32,22 @@ export function decorateHome(def: { state: State; actions?: Record<string, Actio
|
|
|
32
32
|
return { ...s, homeModules: { presented, visible: painted.map(id => ({ id })),
|
|
33
33
|
persistenceLabel: persisted.available ? copyParam('homeModules.onDevice', 'Saved on this device') : copyParam('homeModules.sessionOnly', 'Choices last for this session'),
|
|
34
34
|
slots: Object.fromEntries(modules.map((_, i) => [`slot${i}`, order[i] ?? 'empty'])),
|
|
35
|
-
choices: prefs.order.map(id =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
choices: prefs.order.map((id, index) => {
|
|
36
|
+
const module = modules.find(candidate => candidate.id === id);
|
|
37
|
+
const name = module?.label ?? id;
|
|
38
|
+
const isHidden = prefs.hidden.includes(id);
|
|
39
|
+
const isPinned = prefs.pinned.includes(id);
|
|
40
|
+
return { ...module,
|
|
41
|
+
isFirst: index === 0,
|
|
42
|
+
isLast: index === prefs.order.length - 1,
|
|
43
|
+
visibility: isHidden ? copyParam('homeModules.show', 'Show') : copyParam('homeModules.hide', 'Hide'),
|
|
44
|
+
pinLabel: isPinned ? copyParam('homeModules.unpin', 'Unpin') : copyParam('homeModules.pin', 'Pin'),
|
|
45
|
+
visibilityA11yLabel: copyTemplate(isHidden ? 'homeModules.showA11y' : 'homeModules.hideA11y', isHidden ? 'Show {module}' : 'Hide {module}', { module: name }),
|
|
46
|
+
pinA11yLabel: copyTemplate(isPinned ? 'homeModules.unpinA11y' : 'homeModules.pinA11y', isPinned ? 'Unpin {module}' : 'Pin {module}', { module: name }),
|
|
47
|
+
moveUpA11yLabel: copyTemplate('homeModules.moveUpA11y', 'Move {module} up', { module: name }),
|
|
48
|
+
moveDownA11yLabel: copyTemplate('homeModules.moveDownA11y', 'Move {module} down', { module: name }),
|
|
49
|
+
};
|
|
50
|
+
}) } };
|
|
39
51
|
};
|
|
40
52
|
const actions: Record<string, Action> = {};
|
|
41
53
|
for (const [name, action] of Object.entries(def.actions ?? {})) actions[name] = (s, ...args) => {
|
|
@@ -72,6 +84,7 @@ export function decorateHome(def: { state: State; actions?: Record<string, Actio
|
|
|
72
84
|
actions.homeToggle = change(id => { if (modules.some(m => m.id === id)) prefs.hidden = prefs.hidden.includes(id) ? prefs.hidden.filter(x => x !== id) : [...prefs.hidden, id]; });
|
|
73
85
|
actions.homePin = change(id => { if (modules.some(m => m.id === id)) { prefs.pinned = prefs.pinned.includes(id) ? prefs.pinned.filter(x => x !== id) : [...prefs.pinned, id]; prefs.hidden = prefs.hidden.filter(x => x !== id); } });
|
|
74
86
|
actions.homeMoveUp = change(id => { const index = prefs.order.indexOf(id); if (index > 0) [prefs.order[index - 1], prefs.order[index]] = [prefs.order[index], prefs.order[index - 1]]; });
|
|
87
|
+
actions.homeMoveDown = change(id => { const index = prefs.order.indexOf(id); if (index >= 0 && index < prefs.order.length - 1) [prefs.order[index], prefs.order[index + 1]] = [prefs.order[index + 1], prefs.order[index]]; });
|
|
75
88
|
return { state: derive(def.state), actions };
|
|
76
89
|
}
|
|
77
90
|
export const defineService: typeof register = ((name: string, def: ServiceDefinition<unknown>) => register(name, decorateHome(def as unknown as { state: State; actions?: Record<string, Action> }))) as typeof register;
|
|
@@ -50097,6 +50097,9 @@ const SCREENS = runtimeSetting({
|
|
|
50097
50097
|
"type": "BottomSheet",
|
|
50098
50098
|
"props": {
|
|
50099
50099
|
"presentedPath": "$service:himiOwnerLiteHome.homeModules.presented",
|
|
50100
|
+
"detents": [
|
|
50101
|
+
0.95
|
|
50102
|
+
],
|
|
50100
50103
|
"dismissible": true,
|
|
50101
50104
|
"showGrabber": true,
|
|
50102
50105
|
"onDismiss": {
|
|
@@ -50198,6 +50201,9 @@ const SCREENS = runtimeSetting({
|
|
|
50198
50201
|
}
|
|
50199
50202
|
}
|
|
50200
50203
|
}
|
|
50204
|
+
},
|
|
50205
|
+
"modifiers": {
|
|
50206
|
+
"accessibilityLabel": "$item.pinA11yLabel"
|
|
50201
50207
|
}
|
|
50202
50208
|
},
|
|
50203
50209
|
{
|
|
@@ -50215,31 +50221,63 @@ const SCREENS = runtimeSetting({
|
|
|
50215
50221
|
}
|
|
50216
50222
|
}
|
|
50217
50223
|
}
|
|
50224
|
+
},
|
|
50225
|
+
"modifiers": {
|
|
50226
|
+
"accessibilityLabel": "$item.visibilityA11yLabel"
|
|
50218
50227
|
}
|
|
50219
|
-
}
|
|
50228
|
+
}
|
|
50229
|
+
]
|
|
50230
|
+
}
|
|
50231
|
+
}
|
|
50232
|
+
},
|
|
50233
|
+
{
|
|
50234
|
+
"id": "",
|
|
50235
|
+
"body": {
|
|
50236
|
+
"package": "himalaya",
|
|
50237
|
+
"type": "HStack",
|
|
50238
|
+
"props": {
|
|
50239
|
+
"spacing": 8,
|
|
50240
|
+
"children": [
|
|
50220
50241
|
{
|
|
50221
|
-
"id": "",
|
|
50242
|
+
"id": "btn_tier5_himiownerlitehome_homemoveup",
|
|
50222
50243
|
"body": {
|
|
50223
50244
|
"package": "himalaya",
|
|
50224
|
-
"type": "
|
|
50225
|
-
"props": {
|
|
50245
|
+
"type": "Button",
|
|
50246
|
+
"props": {
|
|
50247
|
+
"title": "Move up",
|
|
50248
|
+
"style": "plain",
|
|
50249
|
+
"action": {
|
|
50250
|
+
"actionId": "tier5.himiOwnerLiteHome.homeMoveUp",
|
|
50251
|
+
"params": {
|
|
50252
|
+
"id": "$item.id"
|
|
50253
|
+
}
|
|
50254
|
+
}
|
|
50255
|
+
}
|
|
50256
|
+
},
|
|
50257
|
+
"modifiers": {
|
|
50258
|
+
"accessibilityLabel": "$item.moveUpA11yLabel",
|
|
50259
|
+
"hiddenPath": "$item.isFirst"
|
|
50226
50260
|
}
|
|
50227
50261
|
},
|
|
50228
50262
|
{
|
|
50229
|
-
"id": "
|
|
50263
|
+
"id": "btn_tier5_himiownerlitehome_homemovedown",
|
|
50230
50264
|
"body": {
|
|
50231
50265
|
"package": "himalaya",
|
|
50232
50266
|
"type": "Button",
|
|
50233
50267
|
"props": {
|
|
50234
|
-
"title": "Move
|
|
50268
|
+
"title": "Move down",
|
|
50235
50269
|
"style": "plain",
|
|
50236
50270
|
"action": {
|
|
50237
|
-
"actionId": "tier5.himiOwnerLiteHome.
|
|
50271
|
+
"actionId": "tier5.himiOwnerLiteHome.homeMoveDown",
|
|
50238
50272
|
"params": {
|
|
50239
50273
|
"id": "$item.id"
|
|
50240
50274
|
}
|
|
50241
50275
|
}
|
|
50242
50276
|
}
|
|
50277
|
+
},
|
|
50278
|
+
"modifiers": {
|
|
50279
|
+
"accessibilityLabel": "$item.moveDownA11yLabel",
|
|
50280
|
+
"hiddenPath": "$item.isLast"
|
|
50243
50281
|
}
|
|
50244
50282
|
}
|
|
50245
50283
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineService as register, type ServiceDefinition } from '@himalaya/state';
|
|
2
2
|
import { normalizeHome, visibleHome, moduleIsEmpty, type HomeModule, type HomePreferences } from './home-modules.js';
|
|
3
|
-
import { copyParam, stashCopy } from './himi-copy.js';
|
|
3
|
+
import { copyParam, copyTemplate, stashCopy } from './himi-copy.js';
|
|
4
4
|
import { localPreferences } from './local-preferences.js';
|
|
5
5
|
type State = Record<string, unknown>;
|
|
6
6
|
type Action = (s: State, ...args: unknown[]) => State | undefined | Promise<State | undefined>;
|
|
@@ -32,10 +32,22 @@ export function decorateHome(def: { state: State; actions?: Record<string, Actio
|
|
|
32
32
|
return { ...s, homeModules: { presented, visible: painted.map(id => ({ id })),
|
|
33
33
|
persistenceLabel: persisted.available ? copyParam('homeModules.onDevice', 'Saved on this device') : copyParam('homeModules.sessionOnly', 'Choices last for this session'),
|
|
34
34
|
slots: Object.fromEntries(modules.map((_, i) => [`slot${i}`, order[i] ?? 'empty'])),
|
|
35
|
-
choices: prefs.order.map(id =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
choices: prefs.order.map((id, index) => {
|
|
36
|
+
const module = modules.find(candidate => candidate.id === id);
|
|
37
|
+
const name = module?.label ?? id;
|
|
38
|
+
const isHidden = prefs.hidden.includes(id);
|
|
39
|
+
const isPinned = prefs.pinned.includes(id);
|
|
40
|
+
return { ...module,
|
|
41
|
+
isFirst: index === 0,
|
|
42
|
+
isLast: index === prefs.order.length - 1,
|
|
43
|
+
visibility: isHidden ? copyParam('homeModules.show', 'Show') : copyParam('homeModules.hide', 'Hide'),
|
|
44
|
+
pinLabel: isPinned ? copyParam('homeModules.unpin', 'Unpin') : copyParam('homeModules.pin', 'Pin'),
|
|
45
|
+
visibilityA11yLabel: copyTemplate(isHidden ? 'homeModules.showA11y' : 'homeModules.hideA11y', isHidden ? 'Show {module}' : 'Hide {module}', { module: name }),
|
|
46
|
+
pinA11yLabel: copyTemplate(isPinned ? 'homeModules.unpinA11y' : 'homeModules.pinA11y', isPinned ? 'Unpin {module}' : 'Pin {module}', { module: name }),
|
|
47
|
+
moveUpA11yLabel: copyTemplate('homeModules.moveUpA11y', 'Move {module} up', { module: name }),
|
|
48
|
+
moveDownA11yLabel: copyTemplate('homeModules.moveDownA11y', 'Move {module} down', { module: name }),
|
|
49
|
+
};
|
|
50
|
+
}) } };
|
|
39
51
|
};
|
|
40
52
|
const actions: Record<string, Action> = {};
|
|
41
53
|
for (const [name, action] of Object.entries(def.actions ?? {})) actions[name] = (s, ...args) => {
|
|
@@ -72,6 +84,7 @@ export function decorateHome(def: { state: State; actions?: Record<string, Actio
|
|
|
72
84
|
actions.homeToggle = change(id => { if (modules.some(m => m.id === id)) prefs.hidden = prefs.hidden.includes(id) ? prefs.hidden.filter(x => x !== id) : [...prefs.hidden, id]; });
|
|
73
85
|
actions.homePin = change(id => { if (modules.some(m => m.id === id)) { prefs.pinned = prefs.pinned.includes(id) ? prefs.pinned.filter(x => x !== id) : [...prefs.pinned, id]; prefs.hidden = prefs.hidden.filter(x => x !== id); } });
|
|
74
86
|
actions.homeMoveUp = change(id => { const index = prefs.order.indexOf(id); if (index > 0) [prefs.order[index - 1], prefs.order[index]] = [prefs.order[index], prefs.order[index - 1]]; });
|
|
87
|
+
actions.homeMoveDown = change(id => { const index = prefs.order.indexOf(id); if (index >= 0 && index < prefs.order.length - 1) [prefs.order[index], prefs.order[index + 1]] = [prefs.order[index + 1], prefs.order[index]]; });
|
|
75
88
|
return { state: derive(def.state), actions };
|
|
76
89
|
}
|
|
77
90
|
export const defineService: typeof register = ((name: string, def: ServiceDefinition<unknown>) => register(name, decorateHome(def as unknown as { state: State; actions?: Record<string, Action> }))) as typeof register;
|
|
@@ -268,6 +268,7 @@ const svc = defineService<EventFormState, {
|
|
|
268
268
|
submit: async (s, values): Promise<EventFormState> => settleOverLive(svc, s, await (async (): Promise<EventFormState> => {
|
|
269
269
|
if (isOwnerPreviewDemo() || s.demoNote) return demoRefusal(s);
|
|
270
270
|
const v = values ?? {};
|
|
271
|
+
const targetId = s.id || (typeof v.id === "string" ? v.id : "");
|
|
271
272
|
const title = String(v.title ?? s.title).trim();
|
|
272
273
|
// The description, per record mode. A queue replay boots a FRESH worker and says so with
|
|
273
274
|
// `descriptionEdited`: this bundle's editor items add the document as `descriptionJson`; the
|
|
@@ -299,7 +300,7 @@ const svc = defineService<EventFormState, {
|
|
|
299
300
|
}
|
|
300
301
|
const description = doc ? postBodyText(doc as never) : s.description; // the plain-text mirror
|
|
301
302
|
if (!title) return shape({ ...s, status: "error", error: copyParam("ownerEventForm.titleRequired", "Title is required"), savedMessage: "" });
|
|
302
|
-
if (!
|
|
303
|
+
if (!targetId) return shape({ ...s, status: "error", error: copyParam("ownerEventForm.errorNoEvent", "No event to edit."), savedMessage: "" });
|
|
303
304
|
|
|
304
305
|
// updateEvent(id, event) wraps the body as { event } internally, so pass the event fields
|
|
305
306
|
// directly. Only what the owner edited is written, the description always as a Ricos document
|
|
@@ -315,22 +316,31 @@ const svc = defineService<EventFormState, {
|
|
|
315
316
|
// Plain only when KNOWN plain: a plain row, or a loaded event with no description. Before load
|
|
316
317
|
// lands nothing is known, so the row stays protected (fail closed).
|
|
317
318
|
const knownPlain = s.descriptionMode === "plain" || (s.descriptionMode === "editor" && !s.descriptionPending && s.descriptionJson === "");
|
|
318
|
-
|
|
319
|
+
const cached = replay && !s.id ? await cacheGet(targetId) : null;
|
|
320
|
+
// A queued metadata edit omitted the event body and read-only details. Keep their cached
|
|
321
|
+
// values rather than replacing them with a fresh worker's empty/default state.
|
|
322
|
+
await cachePut({
|
|
323
|
+
...(cached ?? {}), id: targetId, name: title, title,
|
|
324
|
+
description: doc ? description : String(cached?.description ?? description),
|
|
325
|
+
descriptionProtected: doc ? cachedRichVerdict(heldDoc as never, knownPlain) : String(cached?.descriptionProtected ?? cachedRichVerdict(heldDoc as never, knownPlain)),
|
|
326
|
+
...(heldJson ? { descriptionJson: heldJson } : {}),
|
|
327
|
+
when: String(cached?.when ?? s.when), location: String(cached?.location ?? s.location),
|
|
328
|
+
});
|
|
319
329
|
const savedState = (savedMessage: string) => {
|
|
320
330
|
// An edit typed while this save was in flight stays unsaved work ([rico] #3644).
|
|
321
331
|
const after = editorAfterSave("description", s as never, liveState(svc), !!doc);
|
|
322
332
|
return shape({
|
|
323
|
-
...s, mode: "edit", id:
|
|
333
|
+
...s, mode: "edit", id: targetId, heading: copyParam("ownerEventForm.headingEdit", "Edit event"),
|
|
324
334
|
title, description, originalDescription: doc ? description : s.originalDescription,
|
|
325
335
|
...(docRaw ? { descriptionJson: docRaw } : {}),
|
|
326
336
|
descriptionDirty: after.dirty, descriptionEdits: after.edits,
|
|
327
|
-
status: "saved", savedMessage, savedId:
|
|
337
|
+
status: "saved", savedMessage, savedId: targetId,
|
|
328
338
|
...(after.editedDuringSave ? { status: "idle" as const, savedMessage: "" } : {}),
|
|
329
339
|
error: tooLarge ? copyParam("ownerEventForm.descriptionTooLarge", "The description is too long to save, so it was left as it was. Your other changes were saved.") : "",
|
|
330
340
|
});
|
|
331
341
|
};
|
|
332
342
|
try {
|
|
333
|
-
await updateEvent(
|
|
343
|
+
await updateEvent(targetId, event);
|
|
334
344
|
return savedState(copyParam("ownerEventForm.savedMessage", "Event saved."));
|
|
335
345
|
} catch (e) {
|
|
336
346
|
if (shouldQueueOwnerWrite(e)) {
|
|
@@ -342,7 +352,7 @@ const svc = defineService<EventFormState, {
|
|
|
342
352
|
// (WriteQueue, idempotent) when connectivity returns. A document rides as `descriptionJson`
|
|
343
353
|
// with descriptionEdited "false", so a bundle rolled back past this change leaves the
|
|
344
354
|
// description rather than flattening it to text.
|
|
345
|
-
await queueWrite("tier5.himiOwnerLiteEventForm.submit", { id:
|
|
355
|
+
await queueWrite("tier5.himiOwnerLiteEventForm.submit", { id: targetId, title, description,
|
|
346
356
|
...(docRaw ? { descriptionJson: docRaw, descriptionEdited: "false" } : { descriptionEdited: String(doc !== null) }) });
|
|
347
357
|
return savedState(copyParam("ownerEventForm.savedOffline", "Saved offline — will sync when you reconnect."));
|
|
348
358
|
}
|
|
@@ -2191,6 +2191,9 @@ const SCREENS = runtimeSetting({
|
|
|
2191
2191
|
"type": "BottomSheet",
|
|
2192
2192
|
"props": {
|
|
2193
2193
|
"presentedPath": "$service:himiBrandedHome.homeModules.presented",
|
|
2194
|
+
"detents": [
|
|
2195
|
+
0.95
|
|
2196
|
+
],
|
|
2194
2197
|
"dismissible": true,
|
|
2195
2198
|
"showGrabber": true,
|
|
2196
2199
|
"onDismiss": {
|
|
@@ -2292,6 +2295,9 @@ const SCREENS = runtimeSetting({
|
|
|
2292
2295
|
}
|
|
2293
2296
|
}
|
|
2294
2297
|
}
|
|
2298
|
+
},
|
|
2299
|
+
"modifiers": {
|
|
2300
|
+
"accessibilityLabel": "$item.pinA11yLabel"
|
|
2295
2301
|
}
|
|
2296
2302
|
},
|
|
2297
2303
|
{
|
|
@@ -2309,31 +2315,63 @@ const SCREENS = runtimeSetting({
|
|
|
2309
2315
|
}
|
|
2310
2316
|
}
|
|
2311
2317
|
}
|
|
2318
|
+
},
|
|
2319
|
+
"modifiers": {
|
|
2320
|
+
"accessibilityLabel": "$item.visibilityA11yLabel"
|
|
2312
2321
|
}
|
|
2313
|
-
}
|
|
2322
|
+
}
|
|
2323
|
+
]
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
},
|
|
2327
|
+
{
|
|
2328
|
+
"id": "",
|
|
2329
|
+
"body": {
|
|
2330
|
+
"package": "himalaya",
|
|
2331
|
+
"type": "HStack",
|
|
2332
|
+
"props": {
|
|
2333
|
+
"spacing": 8,
|
|
2334
|
+
"children": [
|
|
2314
2335
|
{
|
|
2315
|
-
"id": "",
|
|
2336
|
+
"id": "btn_tier5_himibrandedhome_homemoveup",
|
|
2316
2337
|
"body": {
|
|
2317
2338
|
"package": "himalaya",
|
|
2318
|
-
"type": "
|
|
2319
|
-
"props": {
|
|
2339
|
+
"type": "Button",
|
|
2340
|
+
"props": {
|
|
2341
|
+
"title": "Move up",
|
|
2342
|
+
"style": "plain",
|
|
2343
|
+
"action": {
|
|
2344
|
+
"actionId": "tier5.himiBrandedHome.homeMoveUp",
|
|
2345
|
+
"params": {
|
|
2346
|
+
"id": "$item.id"
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
},
|
|
2351
|
+
"modifiers": {
|
|
2352
|
+
"accessibilityLabel": "$item.moveUpA11yLabel",
|
|
2353
|
+
"hiddenPath": "$item.isFirst"
|
|
2320
2354
|
}
|
|
2321
2355
|
},
|
|
2322
2356
|
{
|
|
2323
|
-
"id": "
|
|
2357
|
+
"id": "btn_tier5_himibrandedhome_homemovedown",
|
|
2324
2358
|
"body": {
|
|
2325
2359
|
"package": "himalaya",
|
|
2326
2360
|
"type": "Button",
|
|
2327
2361
|
"props": {
|
|
2328
|
-
"title": "Move
|
|
2362
|
+
"title": "Move down",
|
|
2329
2363
|
"style": "plain",
|
|
2330
2364
|
"action": {
|
|
2331
|
-
"actionId": "tier5.himiBrandedHome.
|
|
2365
|
+
"actionId": "tier5.himiBrandedHome.homeMoveDown",
|
|
2332
2366
|
"params": {
|
|
2333
2367
|
"id": "$item.id"
|
|
2334
2368
|
}
|
|
2335
2369
|
}
|
|
2336
2370
|
}
|
|
2371
|
+
},
|
|
2372
|
+
"modifiers": {
|
|
2373
|
+
"accessibilityLabel": "$item.moveDownA11yLabel",
|
|
2374
|
+
"hiddenPath": "$item.isLast"
|
|
2337
2375
|
}
|
|
2338
2376
|
}
|
|
2339
2377
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineService as register, type ServiceDefinition } from '@himalaya/state';
|
|
2
2
|
import { normalizeHome, visibleHome, moduleIsEmpty, type HomeModule, type HomePreferences } from './home-modules.js';
|
|
3
|
-
import { copyParam, stashCopy } from './himi-copy.js';
|
|
3
|
+
import { copyParam, copyTemplate, stashCopy } from './himi-copy.js';
|
|
4
4
|
import { localPreferences } from './local-preferences.js';
|
|
5
5
|
type State = Record<string, unknown>;
|
|
6
6
|
type Action = (s: State, ...args: unknown[]) => State | undefined | Promise<State | undefined>;
|
|
@@ -32,10 +32,22 @@ export function decorateHome(def: { state: State; actions?: Record<string, Actio
|
|
|
32
32
|
return { ...s, homeModules: { presented, visible: painted.map(id => ({ id })),
|
|
33
33
|
persistenceLabel: persisted.available ? copyParam('homeModules.onDevice', 'Saved on this device') : copyParam('homeModules.sessionOnly', 'Choices last for this session'),
|
|
34
34
|
slots: Object.fromEntries(modules.map((_, i) => [`slot${i}`, order[i] ?? 'empty'])),
|
|
35
|
-
choices: prefs.order.map(id =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
choices: prefs.order.map((id, index) => {
|
|
36
|
+
const module = modules.find(candidate => candidate.id === id);
|
|
37
|
+
const name = module?.label ?? id;
|
|
38
|
+
const isHidden = prefs.hidden.includes(id);
|
|
39
|
+
const isPinned = prefs.pinned.includes(id);
|
|
40
|
+
return { ...module,
|
|
41
|
+
isFirst: index === 0,
|
|
42
|
+
isLast: index === prefs.order.length - 1,
|
|
43
|
+
visibility: isHidden ? copyParam('homeModules.show', 'Show') : copyParam('homeModules.hide', 'Hide'),
|
|
44
|
+
pinLabel: isPinned ? copyParam('homeModules.unpin', 'Unpin') : copyParam('homeModules.pin', 'Pin'),
|
|
45
|
+
visibilityA11yLabel: copyTemplate(isHidden ? 'homeModules.showA11y' : 'homeModules.hideA11y', isHidden ? 'Show {module}' : 'Hide {module}', { module: name }),
|
|
46
|
+
pinA11yLabel: copyTemplate(isPinned ? 'homeModules.unpinA11y' : 'homeModules.pinA11y', isPinned ? 'Unpin {module}' : 'Pin {module}', { module: name }),
|
|
47
|
+
moveUpA11yLabel: copyTemplate('homeModules.moveUpA11y', 'Move {module} up', { module: name }),
|
|
48
|
+
moveDownA11yLabel: copyTemplate('homeModules.moveDownA11y', 'Move {module} down', { module: name }),
|
|
49
|
+
};
|
|
50
|
+
}) } };
|
|
39
51
|
};
|
|
40
52
|
const actions: Record<string, Action> = {};
|
|
41
53
|
for (const [name, action] of Object.entries(def.actions ?? {})) actions[name] = (s, ...args) => {
|
|
@@ -72,6 +84,7 @@ export function decorateHome(def: { state: State; actions?: Record<string, Actio
|
|
|
72
84
|
actions.homeToggle = change(id => { if (modules.some(m => m.id === id)) prefs.hidden = prefs.hidden.includes(id) ? prefs.hidden.filter(x => x !== id) : [...prefs.hidden, id]; });
|
|
73
85
|
actions.homePin = change(id => { if (modules.some(m => m.id === id)) { prefs.pinned = prefs.pinned.includes(id) ? prefs.pinned.filter(x => x !== id) : [...prefs.pinned, id]; prefs.hidden = prefs.hidden.filter(x => x !== id); } });
|
|
74
86
|
actions.homeMoveUp = change(id => { const index = prefs.order.indexOf(id); if (index > 0) [prefs.order[index - 1], prefs.order[index]] = [prefs.order[index], prefs.order[index - 1]]; });
|
|
87
|
+
actions.homeMoveDown = change(id => { const index = prefs.order.indexOf(id); if (index >= 0 && index < prefs.order.length - 1) [prefs.order[index], prefs.order[index + 1]] = [prefs.order[index + 1], prefs.order[index]]; });
|
|
75
88
|
return { state: derive(def.state), actions };
|
|
76
89
|
}
|
|
77
90
|
export const defineService: typeof register = ((name: string, def: ServiceDefinition<unknown>) => register(name, decorateHome(def as unknown as { state: State; actions?: Record<string, Action> }))) as typeof register;
|
|
@@ -50536,6 +50536,9 @@ const SCREENS = runtimeSetting({
|
|
|
50536
50536
|
"type": "BottomSheet",
|
|
50537
50537
|
"props": {
|
|
50538
50538
|
"presentedPath": "$service:himiOwnerLiteHome.homeModules.presented",
|
|
50539
|
+
"detents": [
|
|
50540
|
+
0.95
|
|
50541
|
+
],
|
|
50539
50542
|
"dismissible": true,
|
|
50540
50543
|
"showGrabber": true,
|
|
50541
50544
|
"onDismiss": {
|
|
@@ -50637,6 +50640,9 @@ const SCREENS = runtimeSetting({
|
|
|
50637
50640
|
}
|
|
50638
50641
|
}
|
|
50639
50642
|
}
|
|
50643
|
+
},
|
|
50644
|
+
"modifiers": {
|
|
50645
|
+
"accessibilityLabel": "$item.pinA11yLabel"
|
|
50640
50646
|
}
|
|
50641
50647
|
},
|
|
50642
50648
|
{
|
|
@@ -50654,31 +50660,63 @@ const SCREENS = runtimeSetting({
|
|
|
50654
50660
|
}
|
|
50655
50661
|
}
|
|
50656
50662
|
}
|
|
50663
|
+
},
|
|
50664
|
+
"modifiers": {
|
|
50665
|
+
"accessibilityLabel": "$item.visibilityA11yLabel"
|
|
50657
50666
|
}
|
|
50658
|
-
}
|
|
50667
|
+
}
|
|
50668
|
+
]
|
|
50669
|
+
}
|
|
50670
|
+
}
|
|
50671
|
+
},
|
|
50672
|
+
{
|
|
50673
|
+
"id": "",
|
|
50674
|
+
"body": {
|
|
50675
|
+
"package": "himalaya",
|
|
50676
|
+
"type": "HStack",
|
|
50677
|
+
"props": {
|
|
50678
|
+
"spacing": 8,
|
|
50679
|
+
"children": [
|
|
50659
50680
|
{
|
|
50660
|
-
"id": "",
|
|
50681
|
+
"id": "btn_tier5_himiownerlitehome_homemoveup",
|
|
50661
50682
|
"body": {
|
|
50662
50683
|
"package": "himalaya",
|
|
50663
|
-
"type": "
|
|
50664
|
-
"props": {
|
|
50684
|
+
"type": "Button",
|
|
50685
|
+
"props": {
|
|
50686
|
+
"title": "Move up",
|
|
50687
|
+
"style": "plain",
|
|
50688
|
+
"action": {
|
|
50689
|
+
"actionId": "tier5.himiOwnerLiteHome.homeMoveUp",
|
|
50690
|
+
"params": {
|
|
50691
|
+
"id": "$item.id"
|
|
50692
|
+
}
|
|
50693
|
+
}
|
|
50694
|
+
}
|
|
50695
|
+
},
|
|
50696
|
+
"modifiers": {
|
|
50697
|
+
"accessibilityLabel": "$item.moveUpA11yLabel",
|
|
50698
|
+
"hiddenPath": "$item.isFirst"
|
|
50665
50699
|
}
|
|
50666
50700
|
},
|
|
50667
50701
|
{
|
|
50668
|
-
"id": "
|
|
50702
|
+
"id": "btn_tier5_himiownerlitehome_homemovedown",
|
|
50669
50703
|
"body": {
|
|
50670
50704
|
"package": "himalaya",
|
|
50671
50705
|
"type": "Button",
|
|
50672
50706
|
"props": {
|
|
50673
|
-
"title": "Move
|
|
50707
|
+
"title": "Move down",
|
|
50674
50708
|
"style": "plain",
|
|
50675
50709
|
"action": {
|
|
50676
|
-
"actionId": "tier5.himiOwnerLiteHome.
|
|
50710
|
+
"actionId": "tier5.himiOwnerLiteHome.homeMoveDown",
|
|
50677
50711
|
"params": {
|
|
50678
50712
|
"id": "$item.id"
|
|
50679
50713
|
}
|
|
50680
50714
|
}
|
|
50681
50715
|
}
|
|
50716
|
+
},
|
|
50717
|
+
"modifiers": {
|
|
50718
|
+
"accessibilityLabel": "$item.moveDownA11yLabel",
|
|
50719
|
+
"hiddenPath": "$item.isLast"
|
|
50682
50720
|
}
|
|
50683
50721
|
}
|
|
50684
50722
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineService as register, type ServiceDefinition } from '@himalaya/state';
|
|
2
2
|
import { normalizeHome, visibleHome, moduleIsEmpty, type HomeModule, type HomePreferences } from './home-modules.js';
|
|
3
|
-
import { copyParam, stashCopy } from './himi-copy.js';
|
|
3
|
+
import { copyParam, copyTemplate, stashCopy } from './himi-copy.js';
|
|
4
4
|
import { localPreferences } from './local-preferences.js';
|
|
5
5
|
type State = Record<string, unknown>;
|
|
6
6
|
type Action = (s: State, ...args: unknown[]) => State | undefined | Promise<State | undefined>;
|
|
@@ -32,10 +32,22 @@ export function decorateHome(def: { state: State; actions?: Record<string, Actio
|
|
|
32
32
|
return { ...s, homeModules: { presented, visible: painted.map(id => ({ id })),
|
|
33
33
|
persistenceLabel: persisted.available ? copyParam('homeModules.onDevice', 'Saved on this device') : copyParam('homeModules.sessionOnly', 'Choices last for this session'),
|
|
34
34
|
slots: Object.fromEntries(modules.map((_, i) => [`slot${i}`, order[i] ?? 'empty'])),
|
|
35
|
-
choices: prefs.order.map(id =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
choices: prefs.order.map((id, index) => {
|
|
36
|
+
const module = modules.find(candidate => candidate.id === id);
|
|
37
|
+
const name = module?.label ?? id;
|
|
38
|
+
const isHidden = prefs.hidden.includes(id);
|
|
39
|
+
const isPinned = prefs.pinned.includes(id);
|
|
40
|
+
return { ...module,
|
|
41
|
+
isFirst: index === 0,
|
|
42
|
+
isLast: index === prefs.order.length - 1,
|
|
43
|
+
visibility: isHidden ? copyParam('homeModules.show', 'Show') : copyParam('homeModules.hide', 'Hide'),
|
|
44
|
+
pinLabel: isPinned ? copyParam('homeModules.unpin', 'Unpin') : copyParam('homeModules.pin', 'Pin'),
|
|
45
|
+
visibilityA11yLabel: copyTemplate(isHidden ? 'homeModules.showA11y' : 'homeModules.hideA11y', isHidden ? 'Show {module}' : 'Hide {module}', { module: name }),
|
|
46
|
+
pinA11yLabel: copyTemplate(isPinned ? 'homeModules.unpinA11y' : 'homeModules.pinA11y', isPinned ? 'Unpin {module}' : 'Pin {module}', { module: name }),
|
|
47
|
+
moveUpA11yLabel: copyTemplate('homeModules.moveUpA11y', 'Move {module} up', { module: name }),
|
|
48
|
+
moveDownA11yLabel: copyTemplate('homeModules.moveDownA11y', 'Move {module} down', { module: name }),
|
|
49
|
+
};
|
|
50
|
+
}) } };
|
|
39
51
|
};
|
|
40
52
|
const actions: Record<string, Action> = {};
|
|
41
53
|
for (const [name, action] of Object.entries(def.actions ?? {})) actions[name] = (s, ...args) => {
|
|
@@ -72,6 +84,7 @@ export function decorateHome(def: { state: State; actions?: Record<string, Actio
|
|
|
72
84
|
actions.homeToggle = change(id => { if (modules.some(m => m.id === id)) prefs.hidden = prefs.hidden.includes(id) ? prefs.hidden.filter(x => x !== id) : [...prefs.hidden, id]; });
|
|
73
85
|
actions.homePin = change(id => { if (modules.some(m => m.id === id)) { prefs.pinned = prefs.pinned.includes(id) ? prefs.pinned.filter(x => x !== id) : [...prefs.pinned, id]; prefs.hidden = prefs.hidden.filter(x => x !== id); } });
|
|
74
86
|
actions.homeMoveUp = change(id => { const index = prefs.order.indexOf(id); if (index > 0) [prefs.order[index - 1], prefs.order[index]] = [prefs.order[index], prefs.order[index - 1]]; });
|
|
87
|
+
actions.homeMoveDown = change(id => { const index = prefs.order.indexOf(id); if (index >= 0 && index < prefs.order.length - 1) [prefs.order[index], prefs.order[index + 1]] = [prefs.order[index + 1], prefs.order[index]]; });
|
|
75
88
|
return { state: derive(def.state), actions };
|
|
76
89
|
}
|
|
77
90
|
export const defineService: typeof register = ((name: string, def: ServiceDefinition<unknown>) => register(name, decorateHome(def as unknown as { state: State; actions?: Record<string, Action> }))) as typeof register;
|