@wix/himalaya-cli 0.823.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 +120 -83
  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);
@@ -25112,6 +25191,7 @@ function shouldRevealError(args) {
25112
25191
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
25113
25192
  var init_validation = __esm({
25114
25193
  "../../core/ts/src/validation.ts"() {
25194
+ "use strict";
25115
25195
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
25116
25196
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
25117
25197
  INTEGER_RE = /^[+-]?[0-9]+$/;
@@ -25216,85 +25296,6 @@ var init_form_bag = __esm({
25216
25296
  }
25217
25297
  });
25218
25298
 
25219
- // ../../core/web-renderer/src/env.ts
25220
- function isEnvExpr(raw) {
25221
- return typeof raw === "string" && raw.startsWith(ENV_SENTINEL);
25222
- }
25223
- function sizeClassFromWidth(width) {
25224
- if (width >= 840) return "expanded";
25225
- if (width >= 600) return "medium";
25226
- return "compact";
25227
- }
25228
- function browserSizeClass() {
25229
- if (typeof window !== "undefined" && typeof window.innerWidth === "number") {
25230
- return sizeClassFromWidth(window.innerWidth);
25231
- }
25232
- return "compact";
25233
- }
25234
- function browserIsRTL() {
25235
- if (typeof document !== "undefined" && document.documentElement) {
25236
- const d = (document.documentElement.getAttribute("dir") || "").toLowerCase();
25237
- if (d === "rtl") return true;
25238
- if (d === "ltr") return false;
25239
- if (typeof getComputedStyle === "function") {
25240
- return getComputedStyle(document.documentElement).direction === "rtl";
25241
- }
25242
- }
25243
- return false;
25244
- }
25245
- function ctxEnv(ctx) {
25246
- return {
25247
- scheme: ctx.scheme,
25248
- reduceMotion: ctx.reduceMotion(),
25249
- sizeClass: ctx.sizeClass ?? browserSizeClass(),
25250
- isRTL: ctx.isRTL ?? browserIsRTL()
25251
- };
25252
- }
25253
- function envValue(key2, env) {
25254
- switch (key2) {
25255
- case "reduceMotion":
25256
- return env.reduceMotion ? "true" : "false";
25257
- case "colorScheme":
25258
- return env.scheme;
25259
- case "sizeClass":
25260
- return env.sizeClass;
25261
- case "isRTL":
25262
- return env.isRTL ? "true" : "false";
25263
- default:
25264
- return void 0;
25265
- }
25266
- }
25267
- function parseEnvExpr(raw) {
25268
- if (!isEnvExpr(raw)) return null;
25269
- const rest = raw.slice(ENV_SENTINEL.length);
25270
- for (const op of ["==", "!="]) {
25271
- const i = rest.indexOf(op);
25272
- if (i >= 0) return { key: rest.slice(0, i).trim(), op, operand: rest.slice(i + op.length).trim() };
25273
- }
25274
- return { key: rest.trim() };
25275
- }
25276
- function evalEnvExpr(raw, env) {
25277
- const parsed = parseEnvExpr(raw);
25278
- if (!parsed) return void 0;
25279
- const value = envValue(parsed.key, env);
25280
- if (value === void 0) return void 0;
25281
- if (!parsed.op) return value;
25282
- const equal = value.toLowerCase() === (parsed.operand ?? "").toLowerCase();
25283
- return (parsed.op === "==" ? equal : !equal) ? "true" : "false";
25284
- }
25285
- function envHidden(raw, env) {
25286
- const resolved = evalEnvExpr(raw, env);
25287
- if (resolved === void 0) return void 0;
25288
- const l = resolved.trim().toLowerCase();
25289
- return l === "true" || l === "1";
25290
- }
25291
- var ENV_SENTINEL;
25292
- var init_env = __esm({
25293
- "../../core/web-renderer/src/env.ts"() {
25294
- ENV_SENTINEL = "$env:";
25295
- }
25296
- });
25297
-
25298
25299
  // ../../core/web-renderer/src/actionParams.ts
25299
25300
  function readService(ref, provider) {
25300
25301
  if (!provider) return void 0;
@@ -28578,6 +28579,7 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
28578
28579
  var WORKER_SUBTREE_CEILINGS, ID_PART, ACTION_ID;
28579
28580
  var init_worker_subtree = __esm({
28580
28581
  "../../core/ts/src/worker-subtree.ts"() {
28582
+ "use strict";
28581
28583
  init_worker_subtree_safe_types_generated();
28582
28584
  WORKER_SUBTREE_CEILINGS = Object.freeze({
28583
28585
  maxEncodedBytes: 65536,
@@ -33718,6 +33720,7 @@ var init_src3 = __esm({
33718
33720
  var render_descriptor_exports = {};
33719
33721
  __export(render_descriptor_exports, {
33720
33722
  buildRenderTree: () => buildRenderTree,
33723
+ clientEnvFor: () => clientEnvFor,
33721
33724
  collectNativeOnly: () => collectNativeOnly,
33722
33725
  isMissingPlaywrightExecutable: () => isMissingPlaywrightExecutable,
33723
33726
  pngAvailable: () => pngAvailable,
@@ -33726,6 +33729,36 @@ __export(render_descriptor_exports, {
33726
33729
  stabilizePngPage: () => stabilizePngPage,
33727
33730
  withRetry: () => withRetry2
33728
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
+ }
33729
33762
  function resolveTreeScalar(v, provider, itemScope) {
33730
33763
  if (typeof v !== "string") return v;
33731
33764
  if (v.startsWith("$item")) {
@@ -33776,7 +33809,7 @@ function collectNativeOnly(node) {
33776
33809
  walk2(node);
33777
33810
  return [...found].sort();
33778
33811
  }
33779
- 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) {
33780
33813
  if (!node || typeof node !== "object") return null;
33781
33814
  const obj = node;
33782
33815
  const body = obj.body ?? {};
@@ -33816,6 +33849,7 @@ function buildRenderTree(node, path = "$", provider = null, itemScope = void 0,
33816
33849
  insideMediaProperty: false
33817
33850
  });
33818
33851
  if (Object.keys(values).length) out.values = values;
33852
+ if (nodeHidden(modifiers, provider, itemScope, env)) out.hidden = true;
33819
33853
  const itemsPath = props.itemsPath ?? props.items_path;
33820
33854
  if ((type === "LazyList" || type === "Grid") && typeof itemsPath === "string") {
33821
33855
  const local = itemsPath.startsWith("$item.");
@@ -33826,7 +33860,7 @@ function buildRenderTree(node, path = "$", provider = null, itemScope = void 0,
33826
33860
  (el, i) => buildRenderTree(template, `${id}/${type}[${i}]`, provider, {
33827
33861
  ...el && typeof el === "object" ? el : { value: el },
33828
33862
  __index: i
33829
- }, includeRawProps)
33863
+ }, includeRawProps, env)
33830
33864
  ).filter((c) => c != null);
33831
33865
  if (kids2.length) out.children = kids2;
33832
33866
  return out;
@@ -33842,7 +33876,7 @@ function buildRenderTree(node, path = "$", provider = null, itemScope = void 0,
33842
33876
  if (v && typeof v === "object") {
33843
33877
  const o = v;
33844
33878
  if (o.body && typeof o.body === "object") {
33845
- const c = buildRenderTree(o, `${id}/${type}`, provider, itemScope, includeRawProps);
33879
+ const c = buildRenderTree(o, `${id}/${type}`, provider, itemScope, includeRawProps, env);
33846
33880
  if (c) children.push(c);
33847
33881
  } else {
33848
33882
  for (const [k, val] of Object.entries(o)) visit(val, `${p}.${k}`);
@@ -33877,7 +33911,8 @@ async function renderDescriptorWeb(descriptor, tokens, scheme, wantPng, services
33877
33911
  const provider = services ? new FakeServiceProvider(services) : null;
33878
33912
  const stickyHeader = isSduiNode(desc.stickyHeader) ? desc.stickyHeader : void 0;
33879
33913
  const stickyFooter = isSduiNode(desc.stickyFooter) ? desc.stickyFooter : void 0;
33880
- 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);
33881
33916
  const renderTree = composeStickyTree(
33882
33917
  treeOf(payload, "$", null) ?? void 0,
33883
33918
  stickyHeader ? treeOf(stickyHeader, "$.stickyHeader", null) : null,
@@ -34017,6 +34052,7 @@ var TREE_TEXT_VALUE_PROPS, MEDIA_PLAYER_QUEUE_PROPERTIES, NATIVE_ONLY_TYPES;
34017
34052
  var init_render_descriptor = __esm({
34018
34053
  "../../core/dev-server/src/render-descriptor.ts"() {
34019
34054
  init_FakeServiceProvider();
34055
+ init_env();
34020
34056
  init_media_value();
34021
34057
  TREE_TEXT_VALUE_PROPS = /* @__PURE__ */ new Set(["text", "title", "label", "value", "placeholder", "message"]);
34022
34058
  MEDIA_PLAYER_QUEUE_PROPERTIES = /* @__PURE__ */ new Set(["items", "itemsPath", "items_path"]);
@@ -40393,6 +40429,7 @@ function collectObservations(descriptorOrPayload, state) {
40393
40429
  const out = [];
40394
40430
  const walk2 = (node) => {
40395
40431
  if (!node) return;
40432
+ if (node.hidden) return;
40396
40433
  for (const [field, value] of Object.entries(node.values ?? {})) {
40397
40434
  const enc = value !== null && typeof value === "object" ? JSON.stringify(value) : String(value);
40398
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.823.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": "8d426f4512e281bd2df75c8be16c73e28ca527e78ef39e81086b5bc1"
66
+ "falconPackageHash": "bf51a9ad9fb88aab7c822b53c24fb64c672c743e513cfb163b2bebd4"
67
67
  }