marko 5.32.8 → 5.32.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -115,8 +115,14 @@ module.exports = function awaitTag(input, out) {
115
115
  nextId: 0
116
116
  });
117
117
 
118
- var id = awaitInfo.id = input.name || clientReorderContext.nextId++;
119
- var placeholderIdAttrValue = "afph" + id;
118
+ /** SHOULD MATCH THE reorder-renderer.js IMPLEMENTATION */
119
+ var reorderFunctionId =
120
+ out.global.runtimeId !== "M" ? "af" + out.global.runtimeId : "af";
121
+
122
+ var id = awaitInfo.id =
123
+ input.name ||
124
+ (out.global.componentIdPrefix || 0) + clientReorderContext.nextId++;
125
+ var placeholderIdAttrValue = reorderFunctionId + "ph" + id;
120
126
 
121
127
  if (placeholderRenderer) {
122
128
  out.write('<span id="' + placeholderIdAttrValue + '">');
@@ -24,6 +24,10 @@ module.exports = function (input, out) {
24
24
  out.flush();
25
25
  }
26
26
 
27
+ /** SHOULD MATCH THE renderer.js IMPLEMENTATION */
28
+ var reorderFunctionId =
29
+ out.global.runtimeId !== "M" ? "af" + out.global.runtimeId : "af";
30
+
27
31
  var asyncOut = out.beginAsync({
28
32
  last: true,
29
33
  timeout: -1,
@@ -52,7 +56,7 @@ module.exports = function (input, out) {
52
56
  if (!global._afRuntime) {
53
57
  // Minified version of ./client-reorder-runtime.js
54
58
  asyncOut.script(
55
- `function $af(d,a,e,l,g,h,k,b,f,c){c=$af;if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("af"+d);g=e.getElementById("afph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}`
59
+ `function $${reorderFunctionId}(d,a,e,l,g,h,k,b,f,c){c=$${reorderFunctionId};if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("${reorderFunctionId}"+d);g=e.getElementById("${reorderFunctionId}ph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}`
56
60
  );
57
61
  global._afRuntime = true;
58
62
  }
@@ -62,11 +66,11 @@ module.exports = function (input, out) {
62
66
  '<style nonce="' +
63
67
  escapeDoubleQuotes(global.cspNonce) +
64
68
  '">' +
65
- "#af" +
69
+ `#${reorderFunctionId}` +
66
70
  awaitInfo.id +
67
71
  "{display:none;}" +
68
72
  "</style>" +
69
- '<div id="af' +
73
+ `<div id="${reorderFunctionId}` +
70
74
  awaitInfo.id +
71
75
  '">' +
72
76
  result.toString() +
@@ -74,7 +78,7 @@ module.exports = function (input, out) {
74
78
  );
75
79
  } else {
76
80
  asyncOut.write(
77
- '<div id="af' +
81
+ `<div id="${reorderFunctionId}` +
78
82
  awaitInfo.id +
79
83
  '" style="display:none">' +
80
84
  result.toString() +
@@ -83,7 +87,7 @@ module.exports = function (input, out) {
83
87
  }
84
88
 
85
89
  asyncOut.script(
86
- "$af(" + (
90
+ `$${reorderFunctionId}(` + (
87
91
  typeof awaitInfo.id === "number" ?
88
92
  awaitInfo.id :
89
93
  '"' + awaitInfo.id + '"') + (
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var ownerInput;
4
+
5
+ exports.r = function repeatedAttrTag(targetProperty, attrTagInput) {
6
+ var prev = ownerInput[targetProperty];
7
+ if (prev) {
8
+ prev.push(attrTagInput);
9
+ } else {
10
+ ownerInput[targetProperty] = [attrTagInput];
11
+ }
12
+ };
13
+ exports.a = function repeatableAttrTag(targetProperty, attrTagInput) {
14
+ var prev = ownerInput[targetProperty];
15
+ if (prev) {
16
+ if (Array.isArray(prev)) {
17
+ prev.push(attrTagInput);
18
+ } else {
19
+ ownerInput[targetProperty] = [prev, attrTagInput];
20
+ }
21
+ } else {
22
+ attrTagInput[Symbol.iterator] = selfIterator;
23
+ ownerInput[targetProperty] = attrTagInput;
24
+ }
25
+ };
26
+
27
+ exports.i = function attrTagInput(render, input) {
28
+ var prevOwnerInput = ownerInput;
29
+ ownerInput = input || {};
30
+ try {
31
+ ownerInput.renderBody = render();
32
+ return ownerInput;
33
+ } finally {
34
+ ownerInput = prevOwnerInput;
35
+ }
36
+ };
37
+
38
+ function* selfIterator() {
39
+ yield this;
40
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.32.8",
3
+ "version": "5.32.10",
4
4
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
5
5
  "keywords": [
6
6
  "front-end",
@@ -64,8 +64,8 @@
64
64
  "build": "babel ./src --out-dir ./dist --delete-dir-on-start --copy-files --config-file ../../babel.config.js --env-name=production"
65
65
  },
66
66
  "dependencies": {
67
- "@marko/compiler": "^5.34.6",
68
- "@marko/translator-default": "^5.31.14",
67
+ "@marko/compiler": "^5.34.7",
68
+ "@marko/translator-default": "^5.31.15",
69
69
  "app-module-path": "^2.2.0",
70
70
  "argly": "^1.2.0",
71
71
  "browser-refresh-client": "1.1.4",
@@ -115,8 +115,14 @@ module.exports = function awaitTag(input, out) {
115
115
  nextId: 0,
116
116
  });
117
117
 
118
- var id = (awaitInfo.id = input.name || clientReorderContext.nextId++);
119
- var placeholderIdAttrValue = "afph" + id;
118
+ /** SHOULD MATCH THE reorder-renderer.js IMPLEMENTATION */
119
+ var reorderFunctionId =
120
+ out.global.runtimeId !== "M" ? "af" + out.global.runtimeId : "af";
121
+
122
+ var id = (awaitInfo.id =
123
+ input.name ||
124
+ (out.global.componentIdPrefix || 0) + clientReorderContext.nextId++);
125
+ var placeholderIdAttrValue = reorderFunctionId + "ph" + id;
120
126
 
121
127
  if (placeholderRenderer) {
122
128
  out.write('<span id="' + placeholderIdAttrValue + '">');
@@ -24,6 +24,10 @@ module.exports = function (input, out) {
24
24
  out.flush();
25
25
  }
26
26
 
27
+ /** SHOULD MATCH THE renderer.js IMPLEMENTATION */
28
+ var reorderFunctionId =
29
+ out.global.runtimeId !== "M" ? "af" + out.global.runtimeId : "af";
30
+
27
31
  var asyncOut = out.beginAsync({
28
32
  last: true,
29
33
  timeout: -1,
@@ -52,7 +56,7 @@ module.exports = function (input, out) {
52
56
  if (!global._afRuntime) {
53
57
  // Minified version of ./client-reorder-runtime.js
54
58
  asyncOut.script(
55
- `function $af(d,a,e,l,g,h,k,b,f,c){c=$af;if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("af"+d);g=e.getElementById("afph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}`,
59
+ `function $${reorderFunctionId}(d,a,e,l,g,h,k,b,f,c){c=$${reorderFunctionId};if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("${reorderFunctionId}"+d);g=e.getElementById("${reorderFunctionId}ph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}`,
56
60
  );
57
61
  global._afRuntime = true;
58
62
  }
@@ -62,11 +66,11 @@ module.exports = function (input, out) {
62
66
  '<style nonce="' +
63
67
  escapeDoubleQuotes(global.cspNonce) +
64
68
  '">' +
65
- "#af" +
69
+ `#${reorderFunctionId}` +
66
70
  awaitInfo.id +
67
71
  "{display:none;}" +
68
72
  "</style>" +
69
- '<div id="af' +
73
+ `<div id="${reorderFunctionId}` +
70
74
  awaitInfo.id +
71
75
  '">' +
72
76
  result.toString() +
@@ -74,7 +78,7 @@ module.exports = function (input, out) {
74
78
  );
75
79
  } else {
76
80
  asyncOut.write(
77
- '<div id="af' +
81
+ `<div id="${reorderFunctionId}` +
78
82
  awaitInfo.id +
79
83
  '" style="display:none">' +
80
84
  result.toString() +
@@ -83,7 +87,7 @@ module.exports = function (input, out) {
83
87
  }
84
88
 
85
89
  asyncOut.script(
86
- "$af(" +
90
+ `$${reorderFunctionId}(` +
87
91
  (typeof awaitInfo.id === "number"
88
92
  ? awaitInfo.id
89
93
  : '"' + awaitInfo.id + '"') +
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var ownerInput;
4
+
5
+ exports.r = function repeatedAttrTag(targetProperty, attrTagInput) {
6
+ var prev = ownerInput[targetProperty];
7
+ if (prev) {
8
+ prev.push(attrTagInput);
9
+ } else {
10
+ ownerInput[targetProperty] = [attrTagInput];
11
+ }
12
+ };
13
+ exports.a = function repeatableAttrTag(targetProperty, attrTagInput) {
14
+ var prev = ownerInput[targetProperty];
15
+ if (prev) {
16
+ if (Array.isArray(prev)) {
17
+ prev.push(attrTagInput);
18
+ } else {
19
+ ownerInput[targetProperty] = [prev, attrTagInput];
20
+ }
21
+ } else {
22
+ attrTagInput[Symbol.iterator] = selfIterator;
23
+ ownerInput[targetProperty] = attrTagInput;
24
+ }
25
+ };
26
+
27
+ exports.i = function attrTagInput(render, input) {
28
+ var prevOwnerInput = ownerInput;
29
+ ownerInput = input || {};
30
+ try {
31
+ ownerInput.renderBody = render();
32
+ return ownerInput;
33
+ } finally {
34
+ ownerInput = prevOwnerInput;
35
+ }
36
+ };
37
+
38
+ function* selfIterator() {
39
+ yield this;
40
+ }
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function loadNestedTagHelper(targetProperty, isRepeated) {
4
- return function (input, parent) {
5
- // If we are nested tag then we do not have a renderer
6
- if (isRepeated) {
7
- var existingArray = parent[targetProperty];
8
- if (existingArray) {
9
- existingArray.push(input);
10
- } else {
11
- parent[targetProperty] = [input];
12
- }
13
- } else {
14
- parent[targetProperty] = input;
15
- }
16
- };
17
- };
@@ -1,3 +0,0 @@
1
- "use strict";module.exports = function* selfIterator() {
2
- yield this;
3
- };
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function loadNestedTagHelper(targetProperty, isRepeated) {
4
- return function (input, parent) {
5
- // If we are nested tag then we do not have a renderer
6
- if (isRepeated) {
7
- var existingArray = parent[targetProperty];
8
- if (existingArray) {
9
- existingArray.push(input);
10
- } else {
11
- parent[targetProperty] = [input];
12
- }
13
- } else {
14
- parent[targetProperty] = input;
15
- }
16
- };
17
- };
@@ -1,3 +0,0 @@
1
- module.exports = function* selfIterator() {
2
- yield this;
3
- };