tutuca 0.9.62 → 0.9.63

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.
@@ -4674,7 +4674,12 @@ class ValParser {
4674
4674
  const newS = px.frame.macroVars?.[name];
4675
4675
  if (newS !== undefined) {
4676
4676
  const tokens = tokenizeValue(newS.trim());
4677
- return tokens.length === 1 ? this.parseToken(tokens[0], px) : null;
4677
+ if (tokens.length !== 1)
4678
+ return null;
4679
+ const val = this.parseToken(tokens[0], px);
4680
+ if (val instanceof ConstVal)
4681
+ val.fromMacroVar = true;
4682
+ return val;
4678
4683
  }
4679
4684
  px.onParseIssue("bad-value", { role: "macro-var", name, value: s });
4680
4685
  return null;
@@ -4924,7 +4929,7 @@ var init_value = __esm(() => {
4924
4929
  toLiteralSource() {
4925
4930
  let out = "";
4926
4931
  for (const v of this.vals) {
4927
- if (!(v instanceof ConstVal))
4932
+ if (!(v instanceof ConstVal) || v.fromMacroVar)
4928
4933
  return null;
4929
4934
  out += v.val;
4930
4935
  }
@@ -4940,9 +4945,10 @@ var init_value = __esm(() => {
4940
4945
  }
4941
4946
  let lo = 0;
4942
4947
  let hi = vals.length;
4943
- while (lo < hi && vals[lo] instanceof ConstVal && vals[lo].val === "")
4948
+ const isTrimmable = (v) => v instanceof ConstVal && v.val === "" && !v.fromMacroVar;
4949
+ while (lo < hi && isTrimmable(vals[lo]))
4944
4950
  lo++;
4945
- while (hi > lo && vals[hi - 1] instanceof ConstVal && vals[hi - 1].val === "")
4951
+ while (hi > lo && isTrimmable(vals[hi - 1]))
4946
4952
  hi--;
4947
4953
  return new StrTplVal(lo === 0 && hi === vals.length ? vals : vals.slice(lo, hi));
4948
4954
  }
@@ -13896,7 +13902,7 @@ class App {
13896
13902
  const txnPath = path.compact().toTransactionPath();
13897
13903
  const value = txnPath.lookup(rootValue);
13898
13904
  const dragType = e.target.dataset.dragtype ?? "?";
13899
- const stack = txnPath.buildStack(this.makeStack(rootValue));
13905
+ const stack = path.toTransactionPath().buildStack(this.makeStack(rootValue));
13900
13906
  this.dragInfo = new DragInfo(txnPath, stack, e, value, dragType, e.target);
13901
13907
  } else if (type3 === "drop") {
13902
13908
  e.preventDefault();
@@ -8155,7 +8155,12 @@ class ValParser {
8155
8155
  const newS = px.frame.macroVars?.[name];
8156
8156
  if (newS !== undefined) {
8157
8157
  const tokens = tokenizeValue(newS.trim());
8158
- return tokens.length === 1 ? this.parseToken(tokens[0], px) : null;
8158
+ if (tokens.length !== 1)
8159
+ return null;
8160
+ const val = this.parseToken(tokens[0], px);
8161
+ if (val instanceof ConstVal)
8162
+ val.fromMacroVar = true;
8163
+ return val;
8159
8164
  }
8160
8165
  px.onParseIssue("bad-value", { role: "macro-var", name, value: s });
8161
8166
  return null;
@@ -8379,7 +8384,7 @@ class StrTplVal extends VarVal {
8379
8384
  toLiteralSource() {
8380
8385
  let out = "";
8381
8386
  for (const v of this.vals) {
8382
- if (!(v instanceof ConstVal))
8387
+ if (!(v instanceof ConstVal) || v.fromMacroVar)
8383
8388
  return null;
8384
8389
  out += v.val;
8385
8390
  }
@@ -8395,9 +8400,10 @@ class StrTplVal extends VarVal {
8395
8400
  }
8396
8401
  let lo = 0;
8397
8402
  let hi = vals.length;
8398
- while (lo < hi && vals[lo] instanceof ConstVal && vals[lo].val === "")
8403
+ const isTrimmable = (v) => v instanceof ConstVal && v.val === "" && !v.fromMacroVar;
8404
+ while (lo < hi && isTrimmable(vals[lo]))
8399
8405
  lo++;
8400
- while (hi > lo && vals[hi - 1] instanceof ConstVal && vals[hi - 1].val === "")
8406
+ while (hi > lo && isTrimmable(vals[hi - 1]))
8401
8407
  hi--;
8402
8408
  return new StrTplVal(lo === 0 && hi === vals.length ? vals : vals.slice(lo, hi));
8403
8409
  }
@@ -14256,7 +14262,7 @@ class App {
14256
14262
  const txnPath = path.compact().toTransactionPath();
14257
14263
  const value = txnPath.lookup(rootValue);
14258
14264
  const dragType = e.target.dataset.dragtype ?? "?";
14259
- const stack = txnPath.buildStack(this.makeStack(rootValue));
14265
+ const stack = path.toTransactionPath().buildStack(this.makeStack(rootValue));
14260
14266
  this.dragInfo = new DragInfo(txnPath, stack, e, value, dragType, e.target);
14261
14267
  } else if (type3 === "drop") {
14262
14268
  e.preventDefault();