@wix/himalaya-cli 0.1579.0 → 0.1581.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 (54) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +18 -3
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/motion/src/index.d.ts +51 -5
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/network/src/index.d.ts +39 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +2 -1
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/capabilities.generated.d.ts +2 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +1 -1
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +12 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +6 -0
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/media/src/index.d.ts +1 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/media/src/rendition.d.ts +42 -0
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +1 -0
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +1 -0
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +1 -0
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +1 -0
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +1 -0
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +1 -0
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +23 -2
  19. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/network.mjs +45 -0
  20. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +1 -0
  21. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +1 -0
  22. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
  23. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +1 -0
  24. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-media.mjs +78 -0
  25. package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +4 -0
  26. package/dist/cli.mjs +9144 -7459
  27. package/dist/preview-assets.generated.bin +0 -0
  28. package/dist/quickjs-intl.js +462 -0
  29. package/dist/quickjs-web-globals.js +540 -0
  30. package/dist/quickjs-worker-entry.js +313 -0
  31. package/guides/app-config.md +1 -1
  32. package/guides/component-reference.json +5 -3
  33. package/guides/component-reference.md +10 -2
  34. package/guides/designing-himi-screens.md +24 -0
  35. package/guides/himi-json-output.md +30 -1
  36. package/guides/importable-sdks.md +1 -0
  37. package/guides/one-app-section-mappings.md +4 -5
  38. package/guides/one-app-to-himi-app.md +214 -6
  39. package/guides/one-app-viewer.md +2 -2
  40. package/guides/sdk-reference.json +74 -7
  41. package/guides/tier-5-add-a-screen.md +32 -0
  42. package/guides/web-page-sdk-reference.md +1 -0
  43. package/package.json +3 -2
  44. package/templates/beauty-salon/dev/index.ts +197 -304
  45. package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +44 -13
  46. package/templates/branded-lite/dev/index.ts +197 -304
  47. package/templates/branded-lite/l10n/en.json +2 -2
  48. package/templates/branded-lite/tier5-src/himi-store-product/index.ts +49 -17
  49. package/templates/gym-fitness/dev/index.ts +197 -304
  50. package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +44 -13
  51. package/templates/portfolio-creative/dev/index.ts +197 -304
  52. package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +44 -13
  53. package/templates/retail-store/dev/index.ts +197 -304
  54. package/templates/retail-store/tier5-src/himi-store-product/index.ts +49 -17
@@ -1,3 +1,78 @@
1
+ // ../../stdlib/wix-sdk/media/src/rendition.ts
2
+ var BUCKETS = [96, 128, 160, 192, 256, 320, 384, 512, 640, 768, 1024, 1280, 1400, 2048, 2560, 3072, 4096];
3
+ var CREDENTIAL = /(?:[?&])(?:token|expires|signature|x-amz-[^=&#]*|pvt)=/i;
4
+ var WIX = /^(https?:\/\/static\.wixstatic\.com\/media\/([^/?#]+))([^?#]*)([?#].*)?$/i;
5
+ var TRANSFORM = /^\/v1\/(fit|fill)\/([^/]+)\/([^/]+)$/i;
6
+ function imagePixelSize(width, height, scale, maxEdge = 1400) {
7
+ const cap = Number.isFinite(maxEdge) ? Math.max(1, Math.min(4096, Math.floor(maxEdge))) : 1400;
8
+ if (![width, height, scale].every((n) => Number.isFinite(n) && n > 0)) return { width: cap, height: cap };
9
+ const w = Math.ceil(width * scale), h = Math.ceil(height * scale);
10
+ if (!Number.isFinite(w + h)) return { width: cap, height: cap };
11
+ const longest = Math.max(w, h);
12
+ const bucket = Math.min(cap, BUCKETS.find((n) => n >= longest) ?? cap);
13
+ return { width: Math.max(1, Math.ceil(w * bucket / longest)), height: Math.max(1, Math.ceil(h * bucket / longest)) };
14
+ }
15
+ function resolveImageRendition(source, target) {
16
+ const pixels = imagePixelSize(target.width, target.height, target.scale, target.maxEdge);
17
+ const result = { ...pixels, url: source, family: source };
18
+ if (CREDENTIAL.test(source) || /[?&][^=&#]*%[0-9a-f]{2}[^=&#]*=/i.test(source)) return result;
19
+ const wix = WIX.exec(source);
20
+ if (!wix) return result;
21
+ const [, base, id, path, suffix = ""] = wix;
22
+ const transform = path ? TRANSFORM.exec(path) : null;
23
+ if (path && !transform) return result;
24
+ const mode = transform?.[1].toLowerCase() ?? (target.mode === "fill" ? "fill" : "fit");
25
+ const params = transform?.[2].split(",").filter(Boolean) ?? [];
26
+ const dimension = (key) => {
27
+ const param = params.find((p) => new RegExp(`^${key}_[0-9]+$`, "i").test(p));
28
+ return param ? Number(param.slice(2)) : 0;
29
+ };
30
+ const sw = dimension("w"), sh = dimension("h");
31
+ if (transform && (!sw || !sh)) return result;
32
+ const filename = transform?.[3] ?? id;
33
+ const ext = /\.([a-z0-9]+)$/i.exec(filename)?.[1].toLowerCase();
34
+ if (!ext || !["jpg", "jpeg", "png"].includes(ext)) return result;
35
+ const extras = params.filter((p) => !/^(w|h|q)_/i.test(p));
36
+ const quality = params.find((p) => /^q_[0-9]+$/i.test(p)) ?? "q_85";
37
+ let w = pixels.width, h = pixels.height;
38
+ if (transform) {
39
+ if (mode === "fill") {
40
+ const cap = Number.isFinite(target.maxEdge) ? Math.max(1, Math.min(4096, Math.floor(target.maxEdge))) : 1400;
41
+ const covers = target.mode === "fill" || target.mode === "stretch";
42
+ const less = (a, b) => a[0] * b[1] < b[0] * a[1];
43
+ const sx = [w, sw], sy = [h, sh];
44
+ let r = covers === less(sx, sy) ? sy : sx;
45
+ for (const bound of [[1, 1], [cap, Math.max(sw, sh)]]) if (less(bound, r)) r = bound;
46
+ w = Math.max(1, Math.ceil(sw * r[0] / r[1]));
47
+ h = Math.max(1, Math.ceil(sh * r[0] / r[1]));
48
+ } else {
49
+ w = Math.min(w, sw);
50
+ h = Math.min(h, sh);
51
+ }
52
+ }
53
+ const gcd = (a, b) => b ? gcd(b, a % b) : a;
54
+ const divisor = gcd(transform ? sw : w, transform ? sh : h);
55
+ const shape = mode === "fill" ? `${(transform ? sw : w) / divisor}:${(transform ? sh : h) / divisor}` : "";
56
+ result.family = `${base}|${mode}|${shape}|${extras.join(",")}${suffix}`;
57
+ if (transform && sw <= pixels.width && sh <= pixels.height) return result;
58
+ result.url = `${base}/v1/${mode}/w_${w},h_${h},${quality}${extras.length ? "," + extras.join(",") : ""}/${transform ? filename : "image." + ext}${suffix}`;
59
+ return result;
60
+ }
61
+ var FLUID_WIDTHS = [320, 640, 768, 1024, 1280, 1400, 2048];
62
+ function imageCandidates(source, box, scales = [1, 2, 3]) {
63
+ const fixed = typeof box.width === "number" && box.width > 0 && typeof box.height === "number" && box.height > 0;
64
+ const targets = fixed ? scales.map((scale) => ({ width: box.width, height: box.height, scale, mode: box.mode })) : FLUID_WIDTHS.map((width) => ({ width, height: box.ratio ? width / box.ratio : width, scale: 1, mode: box.ratio ? box.mode : "fit" }));
65
+ const seen = /* @__PURE__ */ new Set();
66
+ const out = [];
67
+ for (const target of targets) {
68
+ const r = resolveImageRendition(source, target);
69
+ if (seen.has(r.url)) continue;
70
+ seen.add(r.url);
71
+ out.push({ url: r.url, width: r.width, height: r.height });
72
+ }
73
+ return out.length > 1 || out[0]?.url !== source ? out : [{ url: source, width: 0, height: 0 }];
74
+ }
75
+
1
76
  // ../../stdlib/wix-sdk/media/src/index.ts
2
77
  var WIX_LIST_IMAGE = { width: 1e3, height: 1e3, quality: 85 };
3
78
  var WIX_DETAIL_IMAGE = { width: 1400, height: 1400, quality: 85 };
@@ -94,7 +169,10 @@ function isUnsizedWixMedia(url) {
94
169
  export {
95
170
  WIX_DETAIL_IMAGE,
96
171
  WIX_LIST_IMAGE,
172
+ imageCandidates,
173
+ imagePixelSize,
97
174
  isUnsizedWixMedia,
175
+ resolveImageRendition,
98
176
  wixMediaUrl
99
177
  };
100
178
  //# sourceMappingURL=wix-media.mjs.map
@@ -170,6 +170,10 @@
170
170
  "types": "./dist/_types/core/sdk/motion/src/index.d.ts",
171
171
  "import": "./dist/motion.mjs"
172
172
  },
173
+ "./network": {
174
+ "types": "./dist/_types/core/sdk/network/src/index.d.ts",
175
+ "import": "./dist/network.mjs"
176
+ },
173
177
  "./on-device-ai": {
174
178
  "types": "./dist/_types/core/sdk/on-device-ai/src/index.d.ts",
175
179
  "import": "./dist/on-device-ai.mjs"