@torpor/view 0.1.1 → 0.1.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torpor/view",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Torpor's view library, for writing and mounting components",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -6,6 +6,7 @@ import { type BuildStatus } from "./BuildStatus";
6
6
  import buildAddFragment from "./buildAddFragment";
7
7
  import buildFragment from "./buildFragment";
8
8
  import buildNode from "./buildNode";
9
+ import replaceForVarNames from "./replaceForVarNames";
9
10
 
10
11
  // TODO: Are there too many branches for ifs etc?
11
12
 
@@ -55,7 +56,7 @@ function buildIfBranch(
55
56
  ) {
56
57
  status.imports.add("t_run_branch");
57
58
 
58
- b.append(`${node.statement} {`);
59
+ b.append(`${replaceForVarNames(node.statement, status)} {`);
59
60
  b.append(`t_run_branch(${rangeName}, ${index}, () => {`);
60
61
 
61
62
  buildFragment(node, status, b, parentName, "t_before");
@@ -5,6 +5,7 @@ import { type BuildStatus } from "./BuildStatus";
5
5
  import buildAddFragment from "./buildAddFragment";
6
6
  import buildFragment from "./buildFragment";
7
7
  import buildNode from "./buildNode";
8
+ import replaceForVarNames from "./replaceForVarNames";
8
9
 
9
10
  export default function buildReplaceNode(node: ControlNode, status: BuildStatus, b: Builder): void {
10
11
  const replaceAnchorName = node.varName!;
@@ -38,7 +39,7 @@ function buildReplaceBranch(
38
39
  ) {
39
40
  status.imports.add("t_run_branch");
40
41
 
41
- b.append(`${node.statement};`);
42
+ b.append(`${replaceForVarNames(node.statement, status)};`);
42
43
  b.append(`t_run_branch(${rangeName}, -1, () => {`);
43
44
 
44
45
  buildFragment(node, status, b, parentName, "t_before");
@@ -6,6 +6,7 @@ import { type BuildStatus } from "./BuildStatus";
6
6
  import buildAddFragment from "./buildAddFragment";
7
7
  import buildFragment from "./buildFragment";
8
8
  import buildNode from "./buildNode";
9
+ import replaceForVarNames from "./replaceForVarNames";
9
10
 
10
11
  export default function buildSwitchNode(node: ControlNode, status: BuildStatus, b: Builder): void {
11
12
  const switchParentName = node.parentName!;
@@ -55,7 +56,7 @@ function buildSwitchBranch(
55
56
  ) {
56
57
  status.imports.add("t_run_branch");
57
58
 
58
- b.append(`${node.statement} {`);
59
+ b.append(`${replaceForVarNames(node.statement, status)} {`);
59
60
  b.append(`t_run_branch(${rangeName}, ${index}, () => {`);
60
61
 
61
62
  buildFragment(node, status, b, parentName, "t_before");
@@ -28,7 +28,7 @@ function moveChildEffects(
28
28
  newData.propData.set(key, props);
29
29
 
30
30
  let oldPropValue = oldValue[key];
31
- let oldPropData = oldPropValue[proxyDataSymbol];
31
+ let oldPropData = oldPropValue != null ? oldPropValue[proxyDataSymbol] : undefined;
32
32
 
33
33
  // If the old value was a proxy, make the new value one too
34
34
  // TODO: Make sure we aren't accidentally creating proxies for