@wix/himalaya-cli 0.822.0 → 0.824.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 (2) hide show
  1. package/dist/cli.mjs +124 -84
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -24116,6 +24116,85 @@ var init_FakeServiceProvider = __esm({
24116
24116
  }
24117
24117
  });
24118
24118
 
24119
+ // ../../core/web-renderer/src/env.ts
24120
+ function isEnvExpr(raw) {
24121
+ return typeof raw === "string" && raw.startsWith(ENV_SENTINEL);
24122
+ }
24123
+ function sizeClassFromWidth(width) {
24124
+ if (width >= 840) return "expanded";
24125
+ if (width >= 600) return "medium";
24126
+ return "compact";
24127
+ }
24128
+ function browserSizeClass() {
24129
+ if (typeof window !== "undefined" && typeof window.innerWidth === "number") {
24130
+ return sizeClassFromWidth(window.innerWidth);
24131
+ }
24132
+ return "compact";
24133
+ }
24134
+ function browserIsRTL() {
24135
+ if (typeof document !== "undefined" && document.documentElement) {
24136
+ const d = (document.documentElement.getAttribute("dir") || "").toLowerCase();
24137
+ if (d === "rtl") return true;
24138
+ if (d === "ltr") return false;
24139
+ if (typeof getComputedStyle === "function") {
24140
+ return getComputedStyle(document.documentElement).direction === "rtl";
24141
+ }
24142
+ }
24143
+ return false;
24144
+ }
24145
+ function ctxEnv(ctx) {
24146
+ return {
24147
+ scheme: ctx.scheme,
24148
+ reduceMotion: ctx.reduceMotion(),
24149
+ sizeClass: ctx.sizeClass ?? browserSizeClass(),
24150
+ isRTL: ctx.isRTL ?? browserIsRTL()
24151
+ };
24152
+ }
24153
+ function envValue(key2, env) {
24154
+ switch (key2) {
24155
+ case "reduceMotion":
24156
+ return env.reduceMotion ? "true" : "false";
24157
+ case "colorScheme":
24158
+ return env.scheme;
24159
+ case "sizeClass":
24160
+ return env.sizeClass;
24161
+ case "isRTL":
24162
+ return env.isRTL ? "true" : "false";
24163
+ default:
24164
+ return void 0;
24165
+ }
24166
+ }
24167
+ function parseEnvExpr(raw) {
24168
+ if (!isEnvExpr(raw)) return null;
24169
+ const rest = raw.slice(ENV_SENTINEL.length);
24170
+ for (const op of ["==", "!="]) {
24171
+ const i = rest.indexOf(op);
24172
+ if (i >= 0) return { key: rest.slice(0, i).trim(), op, operand: rest.slice(i + op.length).trim() };
24173
+ }
24174
+ return { key: rest.trim() };
24175
+ }
24176
+ function evalEnvExpr(raw, env) {
24177
+ const parsed = parseEnvExpr(raw);
24178
+ if (!parsed) return void 0;
24179
+ const value = envValue(parsed.key, env);
24180
+ if (value === void 0) return void 0;
24181
+ if (!parsed.op) return value;
24182
+ const equal = value.toLowerCase() === (parsed.operand ?? "").toLowerCase();
24183
+ return (parsed.op === "==" ? equal : !equal) ? "true" : "false";
24184
+ }
24185
+ function envHidden(raw, env) {
24186
+ const resolved = evalEnvExpr(raw, env);
24187
+ if (resolved === void 0) return void 0;
24188
+ const l = resolved.trim().toLowerCase();
24189
+ return l === "true" || l === "1";
24190
+ }
24191
+ var ENV_SENTINEL;
24192
+ var init_env = __esm({
24193
+ "../../core/web-renderer/src/env.ts"() {
24194
+ ENV_SENTINEL = "$env:";
24195
+ }
24196
+ });
24197
+
24119
24198
  // ../../core/web-renderer/src/tokens.ts
24120
24199
  function isSerifFamily(family) {
24121
24200
  return !!family && SERIF_FAMILY_RE.test(family);
@@ -25217,85 +25296,6 @@ var init_form_bag = __esm({
25217
25296
  }
25218
25297
  });
25219
25298
 
25220
- // ../../core/web-renderer/src/env.ts
25221
- function isEnvExpr(raw) {
25222
- return typeof raw === "string" && raw.startsWith(ENV_SENTINEL);
25223
- }
25224
- function sizeClassFromWidth(width) {
25225
- if (width >= 840) return "expanded";
25226
- if (width >= 600) return "medium";
25227
- return "compact";
25228
- }
25229
- function browserSizeClass() {
25230
- if (typeof window !== "undefined" && typeof window.innerWidth === "number") {
25231
- return sizeClassFromWidth(window.innerWidth);
25232
- }
25233
- return "compact";
25234
- }
25235
- function browserIsRTL() {
25236
- if (typeof document !== "undefined" && document.documentElement) {
25237
- const d = (document.documentElement.getAttribute("dir") || "").toLowerCase();
25238
- if (d === "rtl") return true;
25239
- if (d === "ltr") return false;
25240
- if (typeof getComputedStyle === "function") {
25241
- return getComputedStyle(document.documentElement).direction === "rtl";
25242
- }
25243
- }
25244
- return false;
25245
- }
25246
- function ctxEnv(ctx) {
25247
- return {
25248
- scheme: ctx.scheme,
25249
- reduceMotion: ctx.reduceMotion(),
25250
- sizeClass: ctx.sizeClass ?? browserSizeClass(),
25251
- isRTL: ctx.isRTL ?? browserIsRTL()
25252
- };
25253
- }
25254
- function envValue(key2, env) {
25255
- switch (key2) {
25256
- case "reduceMotion":
25257
- return env.reduceMotion ? "true" : "false";
25258
- case "colorScheme":
25259
- return env.scheme;
25260
- case "sizeClass":
25261
- return env.sizeClass;
25262
- case "isRTL":
25263
- return env.isRTL ? "true" : "false";
25264
- default:
25265
- return void 0;
25266
- }
25267
- }
25268
- function parseEnvExpr(raw) {
25269
- if (!isEnvExpr(raw)) return null;
25270
- const rest = raw.slice(ENV_SENTINEL.length);
25271
- for (const op of ["==", "!="]) {
25272
- const i = rest.indexOf(op);
25273
- if (i >= 0) return { key: rest.slice(0, i).trim(), op, operand: rest.slice(i + op.length).trim() };
25274
- }
25275
- return { key: rest.trim() };
25276
- }
25277
- function evalEnvExpr(raw, env) {
25278
- const parsed = parseEnvExpr(raw);
25279
- if (!parsed) return void 0;
25280
- const value = envValue(parsed.key, env);
25281
- if (value === void 0) return void 0;
25282
- if (!parsed.op) return value;
25283
- const equal = value.toLowerCase() === (parsed.operand ?? "").toLowerCase();
25284
- return (parsed.op === "==" ? equal : !equal) ? "true" : "false";
25285
- }
25286
- function envHidden(raw, env) {
25287
- const resolved = evalEnvExpr(raw, env);
25288
- if (resolved === void 0) return void 0;
25289
- const l = resolved.trim().toLowerCase();
25290
- return l === "true" || l === "1";
25291
- }
25292
- var ENV_SENTINEL;
25293
- var init_env = __esm({
25294
- "../../core/web-renderer/src/env.ts"() {
25295
- ENV_SENTINEL = "$env:";
25296
- }
25297
- });
25298
-
25299
25299
  // ../../core/web-renderer/src/actionParams.ts
25300
25300
  function readService(ref, provider) {
25301
25301
  if (!provider) return void 0;
@@ -33720,6 +33720,7 @@ var init_src3 = __esm({
33720
33720
  var render_descriptor_exports = {};
33721
33721
  __export(render_descriptor_exports, {
33722
33722
  buildRenderTree: () => buildRenderTree,
33723
+ clientEnvFor: () => clientEnvFor,
33723
33724
  collectNativeOnly: () => collectNativeOnly,
33724
33725
  isMissingPlaywrightExecutable: () => isMissingPlaywrightExecutable,
33725
33726
  pngAvailable: () => pngAvailable,
@@ -33728,6 +33729,36 @@ __export(render_descriptor_exports, {
33728
33729
  stabilizePngPage: () => stabilizePngPage,
33729
33730
  withRetry: () => withRetry2
33730
33731
  });
33732
+ function hiddenBool2(v) {
33733
+ if (typeof v === "boolean") return v;
33734
+ if (typeof v === "number") return v !== 0;
33735
+ if (typeof v === "string") {
33736
+ const l = v.trim().toLowerCase();
33737
+ return l === "true" || l === "1";
33738
+ }
33739
+ return false;
33740
+ }
33741
+ function clientEnvFor(scheme, width, isRTL) {
33742
+ return {
33743
+ scheme,
33744
+ reduceMotion: false,
33745
+ sizeClass: width === void 0 ? "compact" : sizeClassFromWidth(width),
33746
+ isRTL: isRTL === true
33747
+ };
33748
+ }
33749
+ function nodeHidden(modifiers, provider, itemScope, env) {
33750
+ if (modifiers.hidden === true) return true;
33751
+ const hp = modifiers.hiddenPath ?? modifiers.hidden_path;
33752
+ if (typeof hp !== "string" || !hp) return false;
33753
+ const low = hp.trim().toLowerCase();
33754
+ if (low === "true" || low === "1") return true;
33755
+ if (low === "false" || low === "0") return false;
33756
+ if (isEnvExpr(hp)) return env ? envHidden(hp, env) === true : false;
33757
+ if (hp.startsWith("$item") || hp.startsWith("$service:")) {
33758
+ return hiddenBool2(resolveTreeScalar(hp, provider, itemScope));
33759
+ }
33760
+ return false;
33761
+ }
33731
33762
  function resolveTreeScalar(v, provider, itemScope) {
33732
33763
  if (typeof v !== "string") return v;
33733
33764
  if (v.startsWith("$item")) {
@@ -33778,7 +33809,7 @@ function collectNativeOnly(node) {
33778
33809
  walk2(node);
33779
33810
  return [...found].sort();
33780
33811
  }
33781
- function buildRenderTree(node, path = "$", provider = null, itemScope = void 0, includeRawProps = false) {
33812
+ function buildRenderTree(node, path = "$", provider = null, itemScope = void 0, includeRawProps = false, env = null) {
33782
33813
  if (!node || typeof node !== "object") return null;
33783
33814
  const obj = node;
33784
33815
  const body = obj.body ?? {};
@@ -33818,6 +33849,7 @@ function buildRenderTree(node, path = "$", provider = null, itemScope = void 0,
33818
33849
  insideMediaProperty: false
33819
33850
  });
33820
33851
  if (Object.keys(values).length) out.values = values;
33852
+ if (nodeHidden(modifiers, provider, itemScope, env)) out.hidden = true;
33821
33853
  const itemsPath = props.itemsPath ?? props.items_path;
33822
33854
  if ((type === "LazyList" || type === "Grid") && typeof itemsPath === "string") {
33823
33855
  const local = itemsPath.startsWith("$item.");
@@ -33828,7 +33860,7 @@ function buildRenderTree(node, path = "$", provider = null, itemScope = void 0,
33828
33860
  (el, i) => buildRenderTree(template, `${id}/${type}[${i}]`, provider, {
33829
33861
  ...el && typeof el === "object" ? el : { value: el },
33830
33862
  __index: i
33831
- }, includeRawProps)
33863
+ }, includeRawProps, env)
33832
33864
  ).filter((c) => c != null);
33833
33865
  if (kids2.length) out.children = kids2;
33834
33866
  return out;
@@ -33844,7 +33876,7 @@ function buildRenderTree(node, path = "$", provider = null, itemScope = void 0,
33844
33876
  if (v && typeof v === "object") {
33845
33877
  const o = v;
33846
33878
  if (o.body && typeof o.body === "object") {
33847
- const c = buildRenderTree(o, `${id}/${type}`, provider, itemScope, includeRawProps);
33879
+ const c = buildRenderTree(o, `${id}/${type}`, provider, itemScope, includeRawProps, env);
33848
33880
  if (c) children.push(c);
33849
33881
  } else {
33850
33882
  for (const [k, val] of Object.entries(o)) visit(val, `${p}.${k}`);
@@ -33879,7 +33911,8 @@ async function renderDescriptorWeb(descriptor, tokens, scheme, wantPng, services
33879
33911
  const provider = services ? new FakeServiceProvider(services) : null;
33880
33912
  const stickyHeader = isSduiNode(desc.stickyHeader) ? desc.stickyHeader : void 0;
33881
33913
  const stickyFooter = isSduiNode(desc.stickyFooter) ? desc.stickyFooter : void 0;
33882
- const treeOf = (node, path, prov) => buildRenderTree(node, path, prov, void 0, true);
33914
+ const clientEnv = clientEnvFor(scheme, width, isRTL);
33915
+ const treeOf = (node, path, prov) => buildRenderTree(node, path, prov, void 0, true, clientEnv);
33883
33916
  const renderTree = composeStickyTree(
33884
33917
  treeOf(payload, "$", null) ?? void 0,
33885
33918
  stickyHeader ? treeOf(stickyHeader, "$.stickyHeader", null) : null,
@@ -34019,6 +34052,7 @@ var TREE_TEXT_VALUE_PROPS, MEDIA_PLAYER_QUEUE_PROPERTIES, NATIVE_ONLY_TYPES;
34019
34052
  var init_render_descriptor = __esm({
34020
34053
  "../../core/dev-server/src/render-descriptor.ts"() {
34021
34054
  init_FakeServiceProvider();
34055
+ init_env();
34022
34056
  init_media_value();
34023
34057
  TREE_TEXT_VALUE_PROPS = /* @__PURE__ */ new Set(["text", "title", "label", "value", "placeholder", "message"]);
34024
34058
  MEDIA_PLAYER_QUEUE_PROPERTIES = /* @__PURE__ */ new Set(["items", "itemsPath", "items_path"]);
@@ -36899,7 +36933,12 @@ async function handleWebWix(req, res, state) {
36899
36933
  const target = new URL(requestedPath, "https://www.wixapis.com");
36900
36934
  const query = Object.fromEntries(target.searchParams.entries());
36901
36935
  const started = Date.now();
36902
- const match = state.wix.mode === "mock" ? matchRuleEx(state.wix.rules, method, target.pathname, { host: target.host, query, body }) : void 0;
36936
+ const matchCtx = { host: target.host, query, headers: forwardedHeaders, body };
36937
+ let match = state.wix.mode === "mock" ? matchRuleEx(state.wix.rules, method, target.pathname, matchCtx) : void 0;
36938
+ if (match && (match.rule.kind ?? "mock") !== "mock") {
36939
+ console.error(`[himalaya-dev] net-mocks: rule "${match.rule.id}" is kind:"${match.rule.kind}", which the web bridge cannot apply \u2014 ignoring it for ${method} ${target.pathname}`);
36940
+ match = matchRuleEx(state.wix.rules.filter((r) => (r.kind ?? "mock") === "mock"), method, target.pathname, matchCtx);
36941
+ }
36903
36942
  if (match && (match.rule.kind ?? "mock") === "mock") {
36904
36943
  const mocked = match.rule.response;
36905
36944
  if (mocked.delayMs) await new Promise((resolve41) => setTimeout(resolve41, mocked.delayMs));
@@ -40390,6 +40429,7 @@ function collectObservations(descriptorOrPayload, state) {
40390
40429
  const out = [];
40391
40430
  const walk2 = (node) => {
40392
40431
  if (!node) return;
40432
+ if (node.hidden) return;
40393
40433
  for (const [field, value] of Object.entries(node.values ?? {})) {
40394
40434
  const enc = value !== null && typeof value === "object" ? JSON.stringify(value) : String(value);
40395
40435
  out.push(`${node.id}.${field}=${enc}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.822.0",
3
+ "version": "0.824.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": [
@@ -63,5 +63,5 @@
63
63
  "artifactId": "himalaya-cli"
64
64
  }
65
65
  },
66
- "falconPackageHash": "7c2d068c0d6e24b5c57701a69b820866c5307d58348ea185ca243d74"
66
+ "falconPackageHash": "bf51a9ad9fb88aab7c822b53c24fb64c672c743e513cfb163b2bebd4"
67
67
  }