@wix/himalaya-cli 0.993.0 → 0.994.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.
@@ -210,10 +210,25 @@ export interface SidebarStyle {
210
210
  motion?: string;
211
211
  }
212
212
  /** RFC 0020 — a motion curve. `duration` in ms; `easing` is one of
213
- * "linear" | "easeIn" | "easeOut" | "easeInOut" | "spring". */
213
+ * "linear" | "easeIn" | "easeOut" | "easeInOut" | "spring" | "emphasized". */
214
214
  export interface MotionToken {
215
215
  duration: number;
216
- easing?: "linear" | "easeIn" | "easeOut" | "easeInOut" | "spring";
216
+ /** `emphasized` (#2930) is Material 3's emphasized easing, cubic-bezier(0.2, 0, 0, 1) — the
217
+ * curve an Android idiom overlay reaches for where iOS would spring. */
218
+ easing?: "linear" | "easeIn" | "easeOut" | "easeInOut" | "spring" | "emphasized";
219
+ /** RFC 0059 / #2930 — a DECLARED spring, honoured by iOS, Android and the web when `easing` is
220
+ * `"spring"` (React Native keeps its one entrance curve). SwiftUI's two parameters: `response`
221
+ * is the period in seconds; `dampingFraction` 1 settles without overshoot, below 1 overshoots,
222
+ * above 1 settles more slowly. Every renderer holds them to `response` 0.05–10 and
223
+ * `dampingFraction` 0.1–4 — a value outside is clamped, never an error. Either may be omitted:
224
+ * `response` then defaults to `duration`, `dampingFraction` to 0.8. Absent altogether ⇒ each
225
+ * renderer's own legacy spring, unchanged — so an app that declares none animates as before. */
226
+ spring?: SpringParams;
227
+ }
228
+ /** See `MotionToken.spring`. */
229
+ export interface SpringParams {
230
+ response?: number;
231
+ dampingFraction?: number;
217
232
  }
218
233
  /** RFC 0021 — a surface material. `style` is "flat" | "glass" | "frosted"
219
234
  * (unknown ⇒ treated as flat by renderers); `tint` names a color token;
package/dist/cli.mjs CHANGED
@@ -17806,6 +17806,44 @@ function rgba(color, alpha2) {
17806
17806
  const rgb = hexToRgb2(color);
17807
17807
  return rgb ? `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${clamp2(alpha2)})` : color;
17808
17808
  }
17809
+ function normalizeSpring(spring, durationMs) {
17810
+ return {
17811
+ response: clampTo(finite(spring.response) ?? durationMs / 1e3, SPRING_MIN_RESPONSE, SPRING_MAX_RESPONSE),
17812
+ dampingFraction: clampTo(finite(spring.dampingFraction) ?? 0.8, SPRING_MIN_DAMPING, SPRING_MAX_DAMPING)
17813
+ };
17814
+ }
17815
+ function springStep(response, zeta) {
17816
+ const w0 = 2 * Math.PI / response;
17817
+ if (zeta < 1) {
17818
+ const wd = w0 * Math.sqrt(1 - zeta * zeta);
17819
+ return (t) => 1 - Math.exp(-zeta * w0 * t) * (Math.cos(wd * t) + zeta * w0 / wd * Math.sin(wd * t));
17820
+ }
17821
+ if (zeta === 1) return (t) => 1 - Math.exp(-w0 * t) * (1 + w0 * t);
17822
+ const root = Math.sqrt(zeta * zeta - 1);
17823
+ const r1 = -w0 * (zeta - root), r2 = -w0 * (zeta + root);
17824
+ return (t) => 1 - (r2 * Math.exp(r1 * t) - r1 * Math.exp(r2 * t)) / (r2 - r1);
17825
+ }
17826
+ function springCurve(spring, durationMs) {
17827
+ const { response, dampingFraction: zeta } = normalizeSpring(spring, durationMs);
17828
+ const key2 = `${response}|${zeta}`;
17829
+ const cached3 = springCurves.get(key2);
17830
+ if (cached3) return cached3;
17831
+ const x = springStep(response, zeta);
17832
+ const step = response / 64;
17833
+ let settle = 0;
17834
+ for (let t = 0; t <= SPRING_MAX_SECS; t += step) if (Math.abs(1 - x(t)) > SPRING_SETTLE_TOLERANCE) settle = t;
17835
+ const secs = Math.min(settle + step, SPRING_MAX_SECS);
17836
+ const samples = Math.min(200, Math.max(24, Math.ceil(12 * secs / response)));
17837
+ const points = [];
17838
+ for (let i = 0; i <= samples; i++) points.push(i === 0 ? 0 : i === samples ? 1 : Number(x(secs * i / samples).toFixed(3)));
17839
+ const curve = { durationMs: Math.round(secs * 1e3), easing: `linear(${points.join(", ")})` };
17840
+ springCurves.set(key2, curve);
17841
+ return curve;
17842
+ }
17843
+ function linearEasingSupported() {
17844
+ const css = globalThis.CSS;
17845
+ return typeof css?.supports === "function" && css.supports("animation-timing-function", "linear(0, 1)");
17846
+ }
17809
17847
  function easingCss(e) {
17810
17848
  switch (e) {
17811
17849
  case "linear":
@@ -17816,10 +17854,17 @@ function easingCss(e) {
17816
17854
  return "cubic-bezier(0,0,0.2,1)";
17817
17855
  case "spring":
17818
17856
  return "cubic-bezier(0.34,1.56,0.64,1)";
17857
+ // Material 3's emphasized easing (#2930).
17858
+ case "emphasized":
17859
+ return "cubic-bezier(0.2,0,0,1)";
17819
17860
  default:
17820
17861
  return "cubic-bezier(0.4,0,0.2,1)";
17821
17862
  }
17822
17863
  }
17864
+ function motionCss(m) {
17865
+ if (m.easing === "spring" && m.spring && linearEasingSupported()) return springCurve(m.spring, m.duration);
17866
+ return { durationMs: m.duration, easing: easingCss(m.easing) };
17867
+ }
17823
17868
  function hexToHsl(hex2) {
17824
17869
  const m = /^#?([\da-f]{6})$/i.exec(hex2.trim());
17825
17870
  if (!m) return null;
@@ -18022,7 +18067,7 @@ function makeTokenResolvers(source, scheme, idiom = WEB_IDIOM_CONTEXT) {
18022
18067
  if (!name) return void 0;
18023
18068
  const m = tokens.motions?.[name];
18024
18069
  if (!m) return void 0;
18025
- return { durationMs: m.duration, easing: easingCss(m.easing) };
18070
+ return motionCss(m);
18026
18071
  };
18027
18072
  const reduceMotion = () => {
18028
18073
  const policy = tokens.kit?.reduceMotion ?? "system";
@@ -18048,7 +18093,7 @@ function makeTokenResolvers(source, scheme, idiom = WEB_IDIOM_CONTEXT) {
18048
18093
  scheme
18049
18094
  };
18050
18095
  }
18051
- var REM_ROOT_PX, pxToRem, DEFAULT_FONT_STACK, SERIF_FAMILY_RE, WEB_IDIOM_CONTEXT;
18096
+ var REM_ROOT_PX, pxToRem, DEFAULT_FONT_STACK, SERIF_FAMILY_RE, SPRING_MIN_RESPONSE, SPRING_MAX_RESPONSE, SPRING_MIN_DAMPING, SPRING_MAX_DAMPING, clampTo, finite, SPRING_SETTLE_TOLERANCE, SPRING_MAX_SECS, springCurves, WEB_IDIOM_CONTEXT;
18052
18097
  var init_tokens2 = __esm({
18053
18098
  "../../core/web-renderer/src/tokens.ts"() {
18054
18099
  init_idiom();
@@ -18056,6 +18101,15 @@ var init_tokens2 = __esm({
18056
18101
  pxToRem = (px) => `${px / REM_ROOT_PX}rem`;
18057
18102
  DEFAULT_FONT_STACK = '"Wix Madefor Text", system-ui';
18058
18103
  SERIF_FAMILY_RE = /\b(georgia|times|garamond|palatino|baskerville|didot|charter|bodoni|caslon|cambria|constantia|rockwell|playfair|merriweather|lora|literata|spectral|serif)\b/i;
18104
+ SPRING_MIN_RESPONSE = 0.05;
18105
+ SPRING_MAX_RESPONSE = 10;
18106
+ SPRING_MIN_DAMPING = 0.1;
18107
+ SPRING_MAX_DAMPING = 4;
18108
+ clampTo = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
18109
+ finite = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
18110
+ SPRING_SETTLE_TOLERANCE = 1e-3;
18111
+ SPRING_MAX_SECS = 10;
18112
+ springCurves = /* @__PURE__ */ new Map();
18059
18113
  WEB_IDIOM_CONTEXT = { surface: "desktop" };
18060
18114
  }
18061
18115
  });
@@ -23686,7 +23740,8 @@ function renderInner(node, ctx) {
23686
23740
  if (wp != null) wrap.width = wp;
23687
23741
  Object.assign(wrap, boundPaddingInsets(modifiers, ctx));
23688
23742
  }
23689
- const appear = ctx.appearMotion(modifiers?.appear);
23743
+ const ap = modifiers?.appear;
23744
+ const appear = ctx.appearMotion(typeof ap === "string" ? ap : ap?.token ?? ap?.name);
23690
23745
  if (appear && !ctx.reduceMotion()) {
23691
23746
  ensureAppearKeyframes();
23692
23747
  wrap.animation = `himalaya-appear ${appear.durationMs}ms ${appear.easing} both`;
@@ -43850,19 +43905,19 @@ var init_preview_assets_generated = __esm({
43850
43905
  "../../packages/serve/src/preview-assets.generated.ts"() {
43851
43906
  init_preview_assets_format();
43852
43907
  PREVIEW_ASSET_MANIFEST = [
43853
- { key: "assets/index-DKlP06hp.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 997374, sha256: "9dd7ca28e467c7715af80eb404682bcd75804fee6941c8ae30cacdb542385854" },
43854
- { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 997382, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
43855
- { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1088306, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
43856
- { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1179290, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
43857
- { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1270270, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
43858
- { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1361142, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
43859
- { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1452122, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
43860
- { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1560758, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
43861
- { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1669842, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
43862
- { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1778890, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
43863
- { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1886590, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
43864
- { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1974698, length: 4448, sha256: "a21d7d8d7acdce79ccd442b4137814a17739998360e5b11fc74958c55b77ce30" },
43865
- { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1979146, length: 13784, sha256: "cfb9465254fab84f0e084bb4542c282758ea29774b5f172840cc0b9e4194ef89" }
43908
+ { key: "assets/index-CeKHbRna.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 998645, sha256: "4e1a78d6443c5e1ccf0a16a87b5ca4ab1a62fb5b989182a5faa3f31b43932c47" },
43909
+ { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 998653, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
43910
+ { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1089577, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
43911
+ { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1180561, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
43912
+ { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1271541, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
43913
+ { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1362413, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
43914
+ { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 1453393, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
43915
+ { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 1562029, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
43916
+ { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 1671113, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
43917
+ { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 1780161, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
43918
+ { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 1887861, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
43919
+ { key: "index.html", contentType: "text/html; charset=utf-8", offset: 1975969, length: 4448, sha256: "79979ee36bb97117452963ece8b9816095ddcec8cc95fa1798448d0c9fc6402b" },
43920
+ { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 1980417, length: 13784, sha256: "cfb9465254fab84f0e084bb4542c282758ea29774b5f172840cc0b9e4194ef89" }
43866
43921
  ];
43867
43922
  }
43868
43923
  });
Binary file
package/guides/tokens.md CHANGED
@@ -15,7 +15,7 @@ one registry, mirrored byte-for-byte by the iOS + Android decoders.
15
15
  | `radius` | name → number (px) | **required** |
16
16
  | `shadows` | name → { opacity, radius, color?, x?, y? } | optional |
17
17
  | `gradients` | name → { colors[], angle?, locations? } | optional (`colors` = token NAMES) |
18
- | `motions` | name → { duration, easing? } | optional |
18
+ | `motions` | name → { duration, easing?, spring? } | optional |
19
19
  | `materials` | name → { style, tint?, opacity?, blur? } | optional |
20
20
  | `tabBar` / `drawer` / `sidebar` | nav-chrome style blocks | optional |
21
21
  | `kit` | { material?, variant?, density?, motion? } | optional — the active design kit |
@@ -34,6 +34,15 @@ the missing field), so the bug passes web review and only breaks on device. CI g
34
34
  A color is a hex string, OR a per-scheme object `{ light, dark?, highContrast? }`. In the
35
35
  object form **`light` is required**; `dark`/`highContrast` fall back to it.
36
36
 
37
+ ## Motion
38
+
39
+ `easing` is `linear`, `easeIn`, `easeOut`, `easeInOut`, `spring` or `emphasized` (Material 3's
40
+ emphasized curve). A `spring` may declare its physics as SwiftUI's two parameters —
41
+ `"spring": { "response": 0.5, "dampingFraction": 0.6 }` (period in seconds; 1 = no overshoot) —
42
+ and iOS, Android and the web then draw that same spring until it settles (`duration` no longer
43
+ bounds it; React Native keeps its own fixed entrance curve). Values are held to `response` 0.05–10 and
44
+ `dampingFraction` 0.1–4. Declare none and each keeps its own default spring.
45
+
37
46
  ## Baseline — copy this, then extend
38
47
 
39
48
  The starter set `himi init` writes (complete, valid, minimal):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.993.0",
3
+ "version": "0.994.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": [
@@ -65,5 +65,5 @@
65
65
  "artifactId": "himalaya-cli"
66
66
  }
67
67
  },
68
- "falconPackageHash": "65760e4588c44ee36e6538fcc1bf8802e544b4045157544b3f4d0d94"
68
+ "falconPackageHash": "77c7bb038c5bbcc5a5cc5e0542d7612e8dd1b55183ade401a587e064"
69
69
  }