@wix/himalaya-cli 0.1287.0 → 0.1289.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 -29
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/cms-collections.md +2 -2
- package/guides/creating-wix-sites.md +10 -5
- package/guides/getting-started.md +7 -3
- package/guides/headless-business-to-himi-app.md +1 -1
- package/guides/headless-loop.md +21 -4
- package/guides/himi-mcp.md +4 -1
- package/guides/himi-skill.md +7 -3
- package/guides/push-cli-onboarding.md +11 -2
- package/guides/qa-builds.md +1 -0
- package/guides/wix-business-context.md +1 -1
- package/guides/wix-site-http-functions.md +2 -2
- package/guides/wix-site-to-himi-app.md +4 -3
- package/package.json +2 -2
- package/templates/beauty-salon/README.md +1 -0
- package/templates/beauty-salon/dev/index.ts +83 -478
- package/templates/beauty-salon/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/beauty-salon/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/beauty-salon-owner/README.md +1 -0
- package/templates/branded-lite/README.md +1 -0
- package/templates/branded-lite/dev/index.ts +83 -479
- package/templates/branded-lite/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/branded-lite/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/community-club/README.md +1 -0
- package/templates/community-club/dev/index.ts +83 -479
- package/templates/community-club/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/community-club/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/community-club-owner/README.md +1 -0
- package/templates/events-meetups/README.md +1 -0
- package/templates/events-meetups/dev/index.ts +83 -479
- package/templates/events-meetups/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/events-meetups/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/events-meetups-owner/README.md +1 -0
- package/templates/gym-fitness/README.md +1 -0
- package/templates/gym-fitness/dev/index.ts +83 -478
- package/templates/gym-fitness/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/gym-fitness/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/gym-fitness-owner/README.md +1 -0
- package/templates/himi-chat/README.md +1 -0
- package/templates/nonprofit-cause/README.md +1 -0
- package/templates/nonprofit-cause/dev/index.ts +83 -479
- package/templates/nonprofit-cause/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/nonprofit-cause-owner/README.md +1 -0
- package/templates/owner-lite/README.md +1 -0
- package/templates/podcast-creator/README.md +1 -0
- package/templates/podcast-creator/dev/index.ts +83 -479
- package/templates/podcast-creator/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/podcast-creator/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/podcast-creator-owner/README.md +1 -0
- package/templates/portfolio-creative/README.md +1 -0
- package/templates/portfolio-creative/dev/index.ts +83 -478
- package/templates/portfolio-creative/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/portfolio-creative-owner/README.md +1 -0
- package/templates/restaurant/README.md +1 -0
- package/templates/restaurant/dev/index.ts +83 -478
- package/templates/restaurant/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/restaurant/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/restaurant-owner/README.md +1 -0
- package/templates/retail-store/README.md +1 -0
- package/templates/retail-store/dev/index.ts +83 -478
- package/templates/retail-store/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/retail-store/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/retail-store-owner/README.md +1 -0
- package/templates/surface-showcase/README.md +1 -0
- package/templates/yoga-studio/README.md +1 -0
- package/templates/yoga-studio/dev/index.ts +83 -478
- package/templates/yoga-studio/tier5-src/_shared/himi-layouts.ts +13 -34
- package/templates/yoga-studio/tier5-src/himi-branded-lite-appearance/index.ts +58 -77
- package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +1 -17
- package/templates/yoga-studio-owner/README.md +1 -0
|
@@ -104,44 +104,23 @@ export function resolveLayout(input: {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
// ---------------------------------------------------------------------------
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
// while the brand token stays the fallback. Not a full token-system swap.
|
|
107
|
+
// App color theme. The Appearance screen lets the member pin the app to light or
|
|
108
|
+
// dark, or follow the device ("system"). The worker hands the choice to the host
|
|
109
|
+
// through the `theme.set` action, and the host applies it to the whole app (native
|
|
110
|
+
// chrome and SDUI tokens alike) — a worker cannot rebind tokens itself.
|
|
112
111
|
// ---------------------------------------------------------------------------
|
|
113
|
-
export type
|
|
112
|
+
export type ThemeId = "system" | "light" | "dark";
|
|
114
113
|
|
|
115
|
-
/**
|
|
116
|
-
export const
|
|
117
|
-
export const
|
|
114
|
+
/** Radio order on the Appearance screen. */
|
|
115
|
+
export const THEME_IDS: readonly ThemeId[] = ["system", "light", "dark"];
|
|
116
|
+
export const DEFAULT_THEME: ThemeId = "system";
|
|
118
117
|
|
|
119
|
-
/**
|
|
120
|
-
|
|
118
|
+
/** Worker-side mirror of the choice, so the radios show it even where no host
|
|
119
|
+
* answers `theme.get` (an older binary). */
|
|
120
|
+
export const THEME_KEY = "himi.brandedLite.colorTheme";
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
export const ACCENT_META: Record<AccentId, { label: string; hex: string }> = {
|
|
125
|
-
brand: { label: "Brand", hex: "" },
|
|
126
|
-
amber: { label: "Amber", hex: "#C6872E" },
|
|
127
|
-
terracotta: { label: "Terracotta", hex: "#C1552F" },
|
|
128
|
-
sage: { label: "Sage", hex: "#6E8B5E" },
|
|
129
|
-
plum: { label: "Plum", hex: "#8A5476" },
|
|
130
|
-
ocean: { label: "Ocean", hex: "#3B6E8C" },
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export function isAccentId(x: unknown): x is AccentId {
|
|
134
|
-
return typeof x === "string" && (ACCENT_IDS as readonly string[]).includes(x);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/** Resolve an accent id to its curated hex, or "" for `brand` and any unknown value.
|
|
138
|
-
* "" is deliberate: a bound `backgroundColorPath` that resolves empty keeps the surface's
|
|
139
|
-
* own `accentPrimary` token on every renderer, and that token IS the brand — after a
|
|
140
|
-
* `site analyze --apply` and after a hand edit of tokens.json alike. A brand colour copied
|
|
141
|
-
* into the descriptor instead (the old `brandAccent` param) went stale on the second path:
|
|
142
|
-
* the Home pill kept the template's blue after a rebrand. */
|
|
143
|
-
export function accentColor(id: string): string {
|
|
144
|
-
return isAccentId(id) ? ACCENT_META[id].hex : "";
|
|
122
|
+
export function isThemeId(x: unknown): x is ThemeId {
|
|
123
|
+
return typeof x === "string" && (THEME_IDS as readonly string[]).includes(x);
|
|
145
124
|
}
|
|
146
125
|
|
|
147
126
|
/** Content-derived default: booking intent > deep catalog > editorial (blog-forward) > balanced.
|
|
@@ -1,51 +1,44 @@
|
|
|
1
1
|
import { defineService } from "@himalaya/state";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
ACCENT_KEY,
|
|
5
|
-
ACCENT_META,
|
|
6
|
-
DEFAULT_ACCENT,
|
|
7
|
-
isAccentId,
|
|
8
|
-
} from "../_shared/himi-layouts.js";
|
|
2
|
+
import { dispatch } from "@himalaya/dispatch";
|
|
3
|
+
import { DEFAULT_THEME, THEME_IDS, THEME_KEY, isThemeId, type ThemeId } from "../_shared/himi-layouts.js";
|
|
9
4
|
|
|
10
|
-
// The in-app Appearance
|
|
11
|
-
//
|
|
12
|
-
// the
|
|
13
|
-
//
|
|
5
|
+
// The in-app Appearance worker: the app color theme (System default / Light / Dark).
|
|
6
|
+
// A tap applies the choice at once. The worker cannot repaint the app itself — tokens
|
|
7
|
+
// and native chrome belong to the host — so it hands the choice to the host through the
|
|
8
|
+
// `theme.set` host action (iOS, Android and the web host register it), the same seam
|
|
9
|
+
// App language uses for `locale.set`. No declared capability: a host action is not one.
|
|
14
10
|
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
11
|
+
// The choice is also mirrored in worker storage, so the radios show it on a host that
|
|
12
|
+
// does not answer `theme.get` (an older binary). On such a host the selection is kept,
|
|
13
|
+
// but the app does not change colour until the binary is updated.
|
|
14
|
+
//
|
|
15
|
+
// It replaced an accent-colour picker (six swatches that tinted a few brand surfaces),
|
|
16
|
+
// which did not suit every brand. The home worker no longer reads an accent.
|
|
18
17
|
|
|
19
18
|
interface State {
|
|
20
|
-
/** The
|
|
21
|
-
|
|
22
|
-
// Per-
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
// which is the brand (see accentColor in _shared/himi-layouts.ts).
|
|
26
|
-
accentHex_brand: string;
|
|
27
|
-
accentHex_amber: string;
|
|
28
|
-
accentHex_terracotta: string;
|
|
29
|
-
accentHex_sage: string;
|
|
30
|
-
accentHex_plum: string;
|
|
31
|
-
accentHex_ocean: string;
|
|
32
|
-
// Per-accent selection flags for the radio group (`selected_<id>`) and the
|
|
33
|
-
// check mark on the swatch (`notSelected_<id>`, hiddenWhen hides on TRUE). Flat
|
|
34
|
-
// fields for the same reason as the hex ones: the swatches are static nodes.
|
|
35
|
-
[flag: `selected_${string}` | `notSelected_${string}`]: boolean | string;
|
|
19
|
+
/** The applied theme id. */
|
|
20
|
+
theme: string;
|
|
21
|
+
// Per-option flags for the radio group. Flat fields: the three rows are static nodes,
|
|
22
|
+
// and a `$service:` path cannot index a map by `$item.`.
|
|
23
|
+
[flag: `selected_${string}`]: boolean | string;
|
|
36
24
|
}
|
|
37
25
|
|
|
38
26
|
interface StorageLike {
|
|
39
27
|
getItem(k: string): string | null;
|
|
40
28
|
setItem(k: string, v: string): void;
|
|
41
|
-
removeItem?(k: string): void;
|
|
42
29
|
}
|
|
43
30
|
function storage(): StorageLike | undefined {
|
|
44
31
|
const host = globalThis as { himalaya?: { storage?: StorageLike }; localStorage?: StorageLike };
|
|
45
32
|
return host.himalaya?.storage ?? host.localStorage;
|
|
46
33
|
}
|
|
47
|
-
function
|
|
48
|
-
try {
|
|
34
|
+
function storedTheme(): ThemeId {
|
|
35
|
+
try {
|
|
36
|
+
const s = storage()?.getItem(THEME_KEY) ?? null;
|
|
37
|
+
return isThemeId(s) ? s : DEFAULT_THEME;
|
|
38
|
+
} catch { return DEFAULT_THEME; }
|
|
39
|
+
}
|
|
40
|
+
function remember(theme: ThemeId): void {
|
|
41
|
+
try { storage()?.setItem(THEME_KEY, theme); } catch { /* best-effort: the host holds the real choice */ }
|
|
49
42
|
}
|
|
50
43
|
function paramValue(arg: unknown, key: string): string {
|
|
51
44
|
if (typeof arg === "string") return arg;
|
|
@@ -53,59 +46,47 @@ function paramValue(arg: unknown, key: string): string {
|
|
|
53
46
|
return typeof result === "string" ? result : "";
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
function build(
|
|
49
|
+
function build(theme: ThemeId): State {
|
|
57
50
|
const flags: Record<string, boolean> = {};
|
|
58
|
-
for (const id of
|
|
59
|
-
|
|
60
|
-
flags[`notSelected_${id}`] = id !== pendingAccent;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
...flags,
|
|
64
|
-
pendingAccent,
|
|
65
|
-
accentHex_brand: "",
|
|
66
|
-
accentHex_amber: ACCENT_META.amber.hex,
|
|
67
|
-
accentHex_terracotta: ACCENT_META.terracotta.hex,
|
|
68
|
-
accentHex_sage: ACCENT_META.sage.hex,
|
|
69
|
-
accentHex_plum: ACCENT_META.plum.hex,
|
|
70
|
-
accentHex_ocean: ACCENT_META.ocean.hex,
|
|
71
|
-
};
|
|
51
|
+
for (const id of THEME_IDS) flags[`selected_${id}`] = id === theme;
|
|
52
|
+
return { ...flags, theme };
|
|
72
53
|
}
|
|
73
54
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return isAccentId(s) ? s : DEFAULT_ACCENT;
|
|
77
|
-
}
|
|
55
|
+
// Invalidates async host reads/writes as soon as a newer member choice is made.
|
|
56
|
+
let choiceRevision = 0;
|
|
78
57
|
|
|
79
58
|
const svc = defineService<State, {
|
|
80
|
-
sync: (state: State, arg?: unknown) => State
|
|
81
|
-
|
|
82
|
-
apply: (state: State) => State;
|
|
83
|
-
reset: (state: State) => State;
|
|
59
|
+
sync: (state: State, arg?: unknown) => Promise<State>;
|
|
60
|
+
selectTheme: (state: State, arg?: unknown) => Promise<State>;
|
|
84
61
|
}>("himiBrandedAppearance", {
|
|
85
|
-
state: build(
|
|
62
|
+
state: build(storedTheme()),
|
|
86
63
|
actions: {
|
|
87
|
-
// onAppear:
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
64
|
+
// onAppear: the host is the source of truth (the member may have changed the theme
|
|
65
|
+
// on another screen instance, or the host restored it at launch). Fall back to the
|
|
66
|
+
// mirrored value where the host has no `theme.get`.
|
|
67
|
+
sync: async () => {
|
|
68
|
+
// A delayed onAppear read must not undo a choice made while it was in flight.
|
|
69
|
+
const choiceAtStart = choiceRevision;
|
|
70
|
+
try {
|
|
71
|
+
const payload = (await dispatch("theme.get")) as { scheme?: unknown } | null;
|
|
72
|
+
if (choiceAtStart !== choiceRevision) return build(storedTheme());
|
|
73
|
+
if (isThemeId(payload?.scheme)) {
|
|
74
|
+
remember(payload.scheme);
|
|
75
|
+
return build(payload.scheme);
|
|
76
|
+
}
|
|
77
|
+
} catch { /* no host handler (older binary): keep the mirrored choice */ }
|
|
78
|
+
return build(storedTheme());
|
|
100
79
|
},
|
|
101
|
-
//
|
|
102
|
-
|
|
80
|
+
// A tap on a radio applies that theme to the whole app at once.
|
|
81
|
+
selectTheme: async (state, arg) => {
|
|
82
|
+
const id = paramValue(arg, "id");
|
|
83
|
+
if (!isThemeId(id)) return state;
|
|
84
|
+
const revision = ++choiceRevision;
|
|
85
|
+
remember(id);
|
|
103
86
|
try {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
} catch { /* best-effort */ }
|
|
108
|
-
return build(DEFAULT_ACCENT);
|
|
87
|
+
await dispatch("theme.set", { scheme: id });
|
|
88
|
+
} catch { /* no host handler (older binary): the selection is kept, the app keeps its colours */ }
|
|
89
|
+
return revision === choiceRevision ? build(id) : build(storedTheme());
|
|
109
90
|
},
|
|
110
91
|
},
|
|
111
92
|
});
|
|
@@ -12,7 +12,7 @@ import { imageFirstDish, menuCategories as shapeMenuCategories, visibleDishCards
|
|
|
12
12
|
import { productImage, productPrice, queryStoreProducts, type StoreProduct } from "../_shared/himi-store.js";
|
|
13
13
|
import { formatServicePrice } from "../_shared/wix-service-price.js";
|
|
14
14
|
import { cleanTitle, initials } from "../_shared/himi-text.js";
|
|
15
|
-
import {
|
|
15
|
+
import { LAYOUT_KEY, type LayoutId, recommendLayout, resolveLayout } from "../_shared/himi-layouts.js";
|
|
16
16
|
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
17
17
|
import { parseWeeklyGoal, weeklyGoalProgress, weeklySessionsFromPages } from "../_shared/weekly-goal.js";
|
|
18
18
|
import { isBridgeUnavailable } from "../_shared/owner-load-error.js";
|
|
@@ -235,9 +235,6 @@ interface State {
|
|
|
235
235
|
* Plain string, never a proto enum — a `$service:` casePath decodes it as a
|
|
236
236
|
* JSON string and unknown values fall through to the shipped defaultCase. */
|
|
237
237
|
effectiveLayout: string;
|
|
238
|
-
/** Resolved accent color (hex) for the bindable accent surfaces
|
|
239
|
-
* (backgroundColorPath). User accent (storage) → brand color fallback. */
|
|
240
|
-
accentColor: string;
|
|
241
238
|
/** First-run onboarding card — hidden forever once dismissed (storage-flag).
|
|
242
239
|
* hiddenWhen binds this, so the name reads in the HIDE direction. */
|
|
243
240
|
onboardingHidden: boolean;
|
|
@@ -336,15 +333,6 @@ function onboardingSeen(): boolean {
|
|
|
336
333
|
function storedLayout(): string | null {
|
|
337
334
|
try { return storage()?.getItem(LAYOUT_KEY) ?? null; } catch { return null; }
|
|
338
335
|
}
|
|
339
|
-
function storedAccent(): string {
|
|
340
|
-
try { return storage()?.getItem(ACCENT_KEY) ?? ""; } catch { return ""; }
|
|
341
|
-
}
|
|
342
|
-
// The member's chosen accent (storage), else "" — the surface keeps its accentPrimary token,
|
|
343
|
-
// which is the brand. An older descriptor's `brandAccent` param is ignored: it was a copy of
|
|
344
|
-
// the brand that a hand edit of tokens.json left behind.
|
|
345
|
-
function resolveAccent(_arg?: unknown): string {
|
|
346
|
-
return resolveAccentColor(storedAccent());
|
|
347
|
-
}
|
|
348
336
|
|
|
349
337
|
// onAppear param reader (the himi-branded-lite-cms pattern): the descriptor
|
|
350
338
|
// injects `verticals` (+ `ownerDefaultLayout` in Phase 2) as onAppear params.
|
|
@@ -894,7 +882,6 @@ function baseState(): State {
|
|
|
894
882
|
welcome: neutralWelcome(),
|
|
895
883
|
refreshedAt: "",
|
|
896
884
|
effectiveLayout: resolveEffectiveLayout(undefined, 0),
|
|
897
|
-
accentColor: resolveAccent(undefined),
|
|
898
885
|
onboardingHidden: onboardingSeen(),
|
|
899
886
|
// derive() recomputes this from onboardingHidden, but State requires it and this
|
|
900
887
|
// literal is a full State by contract — every other derived flag above is passed
|
|
@@ -992,7 +979,6 @@ async function refreshPublic(state: State, arg?: unknown): Promise<State | undef
|
|
|
992
979
|
...saved,
|
|
993
980
|
onboardingHidden,
|
|
994
981
|
effectiveLayout: resolveEffectiveLayout(arg, 0),
|
|
995
|
-
accentColor: resolveAccent(arg),
|
|
996
982
|
});
|
|
997
983
|
}
|
|
998
984
|
try {
|
|
@@ -1017,7 +1003,6 @@ async function refreshPublic(state: State, arg?: unknown): Promise<State | undef
|
|
|
1017
1003
|
...saved,
|
|
1018
1004
|
onboardingHidden,
|
|
1019
1005
|
effectiveLayout: resolveEffectiveLayout(arg, products.length),
|
|
1020
|
-
accentColor: resolveAccent(arg),
|
|
1021
1006
|
});
|
|
1022
1007
|
} catch (e) {
|
|
1023
1008
|
if (gen !== refreshGen) return undefined;
|
|
@@ -1044,7 +1029,6 @@ async function refreshPublic(state: State, arg?: unknown): Promise<State | undef
|
|
|
1044
1029
|
...saved,
|
|
1045
1030
|
onboardingHidden,
|
|
1046
1031
|
effectiveLayout: resolveEffectiveLayout(arg, keptProducts.length),
|
|
1047
|
-
accentColor: resolveAccent(arg),
|
|
1048
1032
|
});
|
|
1049
1033
|
}
|
|
1050
1034
|
}
|
|
@@ -14,6 +14,7 @@ identity and navigation in `config.ts`, look and feel in `tokens.json`.
|
|
|
14
14
|
himi render <screenId> --tree # render a screen right here, no device needed
|
|
15
15
|
himi test # exercise every action your screens declare
|
|
16
16
|
himi login --browser --target wix # sign in with your Wix account (once)
|
|
17
|
+
# no browser? export WIX_API_KEY, then himi login --wix --target wix
|
|
17
18
|
himi push --draft # publish a DRAFT release + get preview links
|
|
18
19
|
|
|
19
20
|
Build, validate, render and test run entirely on your machine. Only `login` and
|