@wix/himalaya-cli 0.1318.0 → 0.1319.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.
Files changed (80) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +2 -1
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/theme/src/index.d.ts +21 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/capabilities.generated.d.ts +2 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/brand-color-math.d.ts +98 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +1 -1
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +9 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +1 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +1 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +1 -0
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +1 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core/brand-color-math.mjs +183 -0
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +1 -0
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +1 -0
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +1 -0
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +1 -0
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +1 -0
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/theme.mjs +189 -0
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +8 -0
  19. package/dist/cli.mjs +473 -372
  20. package/dist/preview-assets.generated.bin +0 -0
  21. package/guides/app-config.md +1 -1
  22. package/guides/importable-sdks.md +1 -0
  23. package/guides/sdk-reference.json +39 -2
  24. package/guides/web-page-sdk-reference.md +1 -0
  25. package/package.json +2 -2
  26. package/templates/beauty-salon-owner/config.ts +1 -1
  27. package/templates/beauty-salon-owner/dev/index.ts +125 -24
  28. package/templates/beauty-salon-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  29. package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +59 -31
  30. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  31. package/templates/community-club-owner/config.ts +1 -1
  32. package/templates/community-club-owner/dev/index.ts +125 -24
  33. package/templates/community-club-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  34. package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +59 -31
  35. package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  36. package/templates/events-meetups-owner/config.ts +1 -1
  37. package/templates/events-meetups-owner/dev/index.ts +125 -24
  38. package/templates/events-meetups-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  39. package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +59 -31
  40. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  41. package/templates/gym-fitness-owner/config.ts +1 -1
  42. package/templates/gym-fitness-owner/dev/index.ts +125 -24
  43. package/templates/gym-fitness-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  44. package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +59 -31
  45. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  46. package/templates/nonprofit-cause-owner/config.ts +1 -1
  47. package/templates/nonprofit-cause-owner/dev/index.ts +125 -24
  48. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  49. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +59 -31
  50. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  51. package/templates/owner-lite/config.ts +1 -1
  52. package/templates/owner-lite/dev/index.ts +125 -24
  53. package/templates/owner-lite/tier5-src/_shared/aria-attachments.ts +41 -2
  54. package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +59 -31
  55. package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  56. package/templates/podcast-creator-owner/config.ts +1 -1
  57. package/templates/podcast-creator-owner/dev/index.ts +125 -24
  58. package/templates/podcast-creator-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  59. package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +59 -31
  60. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  61. package/templates/portfolio-creative-owner/config.ts +1 -1
  62. package/templates/portfolio-creative-owner/dev/index.ts +125 -24
  63. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  64. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +59 -31
  65. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  66. package/templates/restaurant-owner/config.ts +1 -1
  67. package/templates/restaurant-owner/dev/index.ts +125 -24
  68. package/templates/restaurant-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  69. package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +59 -31
  70. package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  71. package/templates/retail-store-owner/config.ts +1 -1
  72. package/templates/retail-store-owner/dev/index.ts +125 -24
  73. package/templates/retail-store-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  74. package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +59 -31
  75. package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
  76. package/templates/yoga-studio-owner/config.ts +1 -1
  77. package/templates/yoga-studio-owner/dev/index.ts +125 -24
  78. package/templates/yoga-studio-owner/tier5-src/_shared/aria-attachments.ts +41 -2
  79. package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +59 -31
  80. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +154 -13
@@ -0,0 +1,189 @@
1
+ // ../../core/sdk/dispatch/src/index.ts
2
+ function dispatch(handlerId, params, _options) {
3
+ const himalaya = globalThis.himalaya;
4
+ if (!himalaya) {
5
+ return Promise.reject(
6
+ new Error("@himalaya/dispatch: called outside a Himalaya runtime. This bundle must run inside a JSWorker (Tier 5).")
7
+ );
8
+ }
9
+ const stringParams = {};
10
+ if (params) {
11
+ for (const [k, v] of Object.entries(params)) stringParams[k] = String(v);
12
+ }
13
+ return himalaya.dispatch(handlerId, stringParams);
14
+ }
15
+
16
+ // ../../core/ts/src/brand-color-math.ts
17
+ function channel(hex, offset) {
18
+ return Number.parseInt(hex.slice(offset, offset + 2), 16);
19
+ }
20
+ function toHex(r, g, b) {
21
+ return `#${[r, g, b].map((value) => Math.round(value).toString(16).padStart(2, "0")).join("")}`.toUpperCase();
22
+ }
23
+ function mix(color, background, colorWeight) {
24
+ const values = [1, 3, 5].map((offset) => channel(color, offset) * colorWeight + channel(background, offset) * (1 - colorWeight));
25
+ return toHex(values[0], values[1], values[2]);
26
+ }
27
+ function relativeLuminance(color) {
28
+ const linear = [1, 3, 5].map((offset) => {
29
+ const value = channel(color, offset) / 255;
30
+ return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
31
+ });
32
+ return 0.2126 * linear[0] + 0.7152 * linear[1] + 0.0722 * linear[2];
33
+ }
34
+ function contrastRatio(a, b) {
35
+ const la = relativeLuminance(a);
36
+ const lb = relativeLuminance(b);
37
+ return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
38
+ }
39
+ function lstar(color) {
40
+ const y = relativeLuminance(color);
41
+ return y <= 8856e-6 ? y * 903.3 : 116 * Math.cbrt(y) - 16;
42
+ }
43
+ var ACCENT_SURFACE_MIN_DELTA = 1.08;
44
+ var ACCENT_SURFACE_LIGHT_WEIGHT = 0.12;
45
+ function deriveAccentSurface(accent, surface, weight) {
46
+ const tint = mix(accent, surface, weight);
47
+ if (contrastRatio(tint, surface) >= ACCENT_SURFACE_MIN_DELTA) return tint;
48
+ const away = relativeLuminance(surface) < 0.5 ? "#FFFFFF" : "#000000";
49
+ for (let w = 0.02; w <= 0.5; w += 0.02) {
50
+ const candidate = mix(away, surface, w);
51
+ if (contrastRatio(candidate, surface) >= ACCENT_SURFACE_MIN_DELTA) return candidate;
52
+ }
53
+ return tint;
54
+ }
55
+ var SECONDARY_SHADE_WEIGHT = 0.72;
56
+ var SECONDARY_MIN_LSTAR = 22;
57
+ function deriveSecondaryAccent(primary) {
58
+ const shade = mix(primary, "#000000", SECONDARY_SHADE_WEIGHT);
59
+ if (lstar(shade) >= SECONDARY_MIN_LSTAR) return shade;
60
+ return mix(primary, "#FFFFFF", SECONDARY_SHADE_WEIGHT);
61
+ }
62
+ function textOn(color) {
63
+ const luminance = relativeLuminance(color);
64
+ const whiteContrast = 1.05 / (luminance + 0.05);
65
+ const blackContrast = (luminance + 0.05) / 0.05;
66
+ return whiteContrast >= blackContrast ? "#FFFFFF" : "#000000";
67
+ }
68
+ var DARK_ARM_MIN_LIFT = 0.08;
69
+ var DARK_ARM_TARGET_CONTRAST = 3.4;
70
+ var DARK_ARM_FLOOR_CONTRAST = 3;
71
+ var DARK_ARM_LSTAR_CAP = 80;
72
+ function tuneDarkAccent(brand, darkSurface, lightSurface) {
73
+ const kitInherentlyDark = lstar(lightSurface) < 50;
74
+ if (kitInherentlyDark && contrastRatio(brand, darkSurface) >= DARK_ARM_TARGET_CONTRAST && lstar(brand) <= DARK_ARM_LSTAR_CAP) {
75
+ return brand;
76
+ }
77
+ let lift = DARK_ARM_MIN_LIFT;
78
+ let candidate = mix(brand, "#FFFFFF", 1 - lift);
79
+ while (contrastRatio(candidate, darkSurface) < DARK_ARM_TARGET_CONTRAST && lift < 0.6) {
80
+ lift += 0.04;
81
+ candidate = mix(brand, "#FFFFFF", 1 - lift);
82
+ }
83
+ while (lstar(candidate) > DARK_ARM_LSTAR_CAP) {
84
+ const darker = mix(candidate, "#000000", 0.94);
85
+ if (contrastRatio(darker, darkSurface) < DARK_ARM_FLOOR_CONTRAST) break;
86
+ candidate = darker;
87
+ }
88
+ return candidate;
89
+ }
90
+ function textOnArm(accent) {
91
+ return contrastRatio("#FFFFFF", accent) >= 4.5 ? "#FFFFFF" : textOn(accent);
92
+ }
93
+ var HIGH_CONTRAST_TARGET = 8.5;
94
+ function tuneHighContrastAccent(brand, surface) {
95
+ const towards = relativeLuminance(surface) < 0.5 ? "#FFFFFF" : "#000000";
96
+ let candidate = brand;
97
+ for (let lift = 0; lift <= 0.9 && contrastRatio(candidate, surface) < HIGH_CONTRAST_TARGET; lift += 0.04) {
98
+ candidate = mix(brand, towards, 1 - lift);
99
+ }
100
+ return candidate;
101
+ }
102
+ var ACCENT_TEXT_MIN_CONTRAST = 4.5;
103
+ var MID_GREY_LUMINANCE = 0.179;
104
+ function deriveAccentText(accent, surfaces) {
105
+ const all = (typeof surfaces === "string" ? [surfaces] : [...surfaces]).map((s) => s.slice(0, 7));
106
+ const page = all[0];
107
+ const worst = (color) => Math.min(...all.map((s) => contrastRatio(color, s)));
108
+ const opaque = accent.length === 9 ? mix(accent.slice(0, 7), page, channel(accent, 7) / 255) : accent;
109
+ if (worst(opaque) >= ACCENT_TEXT_MIN_CONTRAST) return opaque;
110
+ const pole = worst("#FFFFFF") >= worst("#000000") ? "#FFFFFF" : "#000000";
111
+ for (let step = 1; step <= 100; step++) {
112
+ const candidate = mix(pole, opaque, step / 100);
113
+ if (worst(candidate) >= ACCENT_TEXT_MIN_CONTRAST) return candidate;
114
+ }
115
+ if (all.length > 1) {
116
+ const side = (hex) => relativeLuminance(hex) > MID_GREY_LUMINANCE;
117
+ const sameSide = all.filter((s) => side(s) === side(page));
118
+ return deriveAccentText(accent, sameSide.length < all.length ? sameSide : [page]);
119
+ }
120
+ return pole;
121
+ }
122
+ function deriveAccentFamily(primary, secondary, surfaces, textSurfaces = {}) {
123
+ const primaryDark = tuneDarkAccent(primary, surfaces.dark, surfaces.light);
124
+ const secondaryDark = tuneDarkAccent(secondary, surfaces.dark, surfaces.light);
125
+ const primaryHigh = tuneHighContrastAccent(primary, surfaces.highContrast);
126
+ const secondaryHigh = tuneHighContrastAccent(secondary, surfaces.highContrast);
127
+ return {
128
+ accentPrimary: { light: primary, dark: primaryDark, highContrast: primaryHigh },
129
+ accentSecondary: { light: secondary, dark: secondaryDark, highContrast: secondaryHigh },
130
+ accentSurface: {
131
+ light: deriveAccentSurface(primary, surfaces.light, ACCENT_SURFACE_LIGHT_WEIGHT),
132
+ dark: deriveAccentSurface(primaryDark, surfaces.dark, 0.24),
133
+ highContrast: deriveAccentSurface(primaryHigh, surfaces.highContrast, 0.24)
134
+ },
135
+ textOnAccent: {
136
+ light: textOnArm(primary),
137
+ dark: textOnArm(primaryDark),
138
+ highContrast: textOn(primaryHigh)
139
+ },
140
+ accentText: {
141
+ light: deriveAccentText(primary, [surfaces.light, ...textSurfaces.light ?? []]),
142
+ dark: deriveAccentText(primaryDark, [surfaces.dark, ...textSurfaces.dark ?? []]),
143
+ highContrast: deriveAccentText(primaryHigh, [surfaces.highContrast, ...textSurfaces.highContrast ?? []])
144
+ }
145
+ };
146
+ }
147
+
148
+ // ../../core/sdk/theme/src/index.ts
149
+ var HEX = /^#[0-9A-Fa-f]{6}$/;
150
+ function decode(v) {
151
+ if (typeof v === "string") {
152
+ try {
153
+ return JSON.parse(v);
154
+ } catch {
155
+ return null;
156
+ }
157
+ }
158
+ return v && typeof v === "object" ? v : null;
159
+ }
160
+ async function applyBrand(brand) {
161
+ const primary = brand?.primaryColor;
162
+ const secondaryIn = brand?.secondaryColor;
163
+ if (typeof primary !== "string" || !HEX.test(primary)) return { applied: false, reason: "invalid_color" };
164
+ if (secondaryIn !== void 0 && (typeof secondaryIn !== "string" || !HEX.test(secondaryIn))) {
165
+ return { applied: false, reason: "invalid_color" };
166
+ }
167
+ const s = decode(await dispatch("capability.theme.surfaces")) ?? {};
168
+ const sp = s.surfacePrimary ?? {};
169
+ const surfaces = {
170
+ light: sp.light ?? "#FFFFFF",
171
+ dark: sp.dark ?? "#0D1117",
172
+ highContrast: sp.highContrast ?? "#000000"
173
+ };
174
+ const family = deriveAccentFamily(primary, secondaryIn ?? deriveSecondaryAccent(primary), surfaces, s.textSurfaces ?? {});
175
+ const params = { colors: JSON.stringify(family) };
176
+ if (s.hasGlow) params.glow = primary;
177
+ const r = decode(await dispatch("capability.theme.applyOverlay", params));
178
+ return r && typeof r.applied === "boolean" ? r : { applied: false, reason: "no_answer" };
179
+ }
180
+ async function clearBrand() {
181
+ await dispatch("capability.theme.clearOverlay");
182
+ }
183
+ var version = 1;
184
+ export {
185
+ applyBrand,
186
+ clearBrand,
187
+ version
188
+ };
189
+ //# sourceMappingURL=theme.mjs.map
@@ -82,6 +82,10 @@
82
82
  "types": "./dist/_types/core/ts/src/index.d.ts",
83
83
  "import": "./dist/core.mjs"
84
84
  },
85
+ "./core/brand-color-math": {
86
+ "types": "./dist/_types/core/ts/src/brand-color-math.d.ts",
87
+ "import": "./dist/core/brand-color-math.mjs"
88
+ },
85
89
  "./core/validation": {
86
90
  "types": "./dist/_types/core/ts/src/validation.d.ts",
87
91
  "import": "./dist/core/validation.mjs"
@@ -234,6 +238,10 @@
234
238
  "types": "./dist/_types/stdlib/telemetry/console/src/index.d.ts",
235
239
  "import": "./dist/telemetry-console.mjs"
236
240
  },
241
+ "./theme": {
242
+ "types": "./dist/_types/core/sdk/theme/src/index.d.ts",
243
+ "import": "./dist/theme.mjs"
244
+ },
237
245
  "./time": {
238
246
  "types": "./dist/_types/core/sdk/time/src/index.d.ts",
239
247
  "import": "./dist/time.mjs"