marko 5.33.7 → 5.33.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
  module.exports = function classHelper(arg) {
4
4
  switch (typeof arg) {
5
5
  case "string":
6
- return arg || null;
6
+ return arg || undefined;
7
7
  case "object":
8
8
  var result = "";
9
9
  var sep = "";
@@ -25,9 +25,6 @@ module.exports = function classHelper(arg) {
25
25
  }
26
26
  }
27
27
 
28
- return result || null;
29
-
30
- default:
31
- return null;
28
+ return result || undefined;
32
29
  }
33
30
  };
@@ -7,7 +7,7 @@ var changeCase = require("./_change-case");
7
7
  */
8
8
  module.exports = function styleHelper(style) {
9
9
  if (!style) {
10
- return null;
10
+ return;
11
11
  }
12
12
 
13
13
  var type = typeof style;
@@ -38,7 +38,7 @@ module.exports = function styleHelper(style) {
38
38
  }
39
39
  }
40
40
 
41
- return styles || null;
41
+ return styles || undefined;
42
42
  }
43
43
 
44
44
  return style;
@@ -55,14 +55,17 @@ exports.p = function (tagsAPI) {
55
55
  const input = _.i;
56
56
  const tagsRenderer = _.r;
57
57
  const renderFn = createRenderFn(tagsRenderer);
58
+ const willRerender = componentDef._wrr;
58
59
  const $global = out.global;
59
60
  const streamData = $global.streamData = $global.streamData || {};
60
61
 
61
- $global.serializedGlobals = $global.serializedGlobals || {};
62
- $global.serializedGlobals.componentIdToScopeId = true;
63
- $global.componentIdToScopeId = $global.componentIdToScopeId || {};
64
- $global.componentIdToScopeId[component.id] = streamData.scopeId || 0;
65
- out.bf(out._Y_, component, true);
62
+ if (willRerender) {
63
+ $global.serializedGlobals = $global.serializedGlobals || {};
64
+ $global.serializedGlobals.componentIdToScopeId = true;
65
+ $global.componentIdToScopeId = $global.componentIdToScopeId || {};
66
+ $global.componentIdToScopeId[component.id] = streamData.scopeId || 0;
67
+ }
68
+ out.bf(out._Y_, component, willRerender);
66
69
  renderFn(out.beginAsync(), input, {}, streamData);
67
70
  out.ef();
68
71
  },
@@ -72,8 +75,10 @@ exports.p = function (tagsAPI) {
72
75
 
73
76
 
74
77
 
78
+
75
79
  {
76
- t: TagsCompatId
80
+ t: TagsCompatId,
81
+ i: true
77
82
  },
78
83
  {}
79
84
  );
@@ -203,14 +203,6 @@ VElement.prototype = {
203
203
  vElementByDOMNode.set(el, this);
204
204
 
205
205
  return el;
206
- },
207
-
208
- ce_: function (name) {
209
- // We don't care about the namespaces since the there
210
- // is no chance that attributes with the same name will have
211
- // different namespaces
212
- var value = this.c__[name];
213
- return value != null && value !== false;
214
206
  }
215
207
  };
216
208
 
@@ -267,9 +259,9 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
267
259
  return vdomEl;
268
260
  }
269
261
 
270
- VElement.cf_ = virtualizeElement;
262
+ VElement.ce_ = virtualizeElement;
271
263
 
272
- VElement.cg_ = function (fromEl, vFromEl, toEl) {
264
+ VElement.cf_ = function (fromEl, vFromEl, toEl) {
273
265
  var fromFlags = vFromEl.t_;
274
266
  var toFlags = toEl.t_;
275
267
  var attrs = toEl.c__;
@@ -303,13 +295,25 @@ VElement.cg_ = function (fromEl, vFromEl, toEl) {
303
295
 
304
296
  if (toFlags & FLAG_SIMPLE_ATTRS && fromFlags & FLAG_SIMPLE_ATTRS) {
305
297
  if (oldAttrs["class"] !== (attrValue = attrs["class"])) {
306
- fromEl.className = attrValue;
298
+ if (attrValue) {
299
+ fromEl.className = attrValue;
300
+ } else {
301
+ fromEl.removeAttribute("class");
302
+ }
307
303
  }
308
304
  if (oldAttrs.id !== (attrValue = attrs.id)) {
309
- fromEl.id = attrValue;
305
+ if (attrValue) {
306
+ fromEl.id = attrValue;
307
+ } else {
308
+ fromEl.removeAttribute("id");
309
+ }
310
310
  }
311
311
  if (oldAttrs.style !== (attrValue = attrs.style)) {
312
- fromEl.style.cssText = attrValue;
312
+ if (attrValue) {
313
+ fromEl.style.cssText = attrValue;
314
+ } else {
315
+ fromEl.removeAttribute("style");
316
+ }
313
317
  }
314
318
  return;
315
319
  }
@@ -3,10 +3,10 @@ function VNode() {}
3
3
 
4
4
  VNode.prototype = {
5
5
  bT_: function (finalChildCount, ownerComponent) {
6
- this.ch_ = finalChildCount;
7
- this.ci_ = 0;
6
+ this.cg_ = finalChildCount;
7
+ this.ch_ = 0;
8
8
  this.bZ_ = null;
9
- this.cj_ = null;
9
+ this.ci_ = null;
10
10
  this.bW_ = null;
11
11
  this.bX_ = null;
12
12
  this._J_ = ownerComponent;
@@ -21,24 +21,24 @@ VNode.prototype = {
21
21
  // If the DocumentFragment node has a first child then we will return that.
22
22
  // Otherwise, the DocumentFragment node is not *really* the first child and
23
23
  // we need to skip to its next sibling
24
- return nestedFirstChild || firstChild.ck_;
24
+ return nestedFirstChild || firstChild.cj_;
25
25
  }
26
26
 
27
27
  return firstChild;
28
28
  },
29
29
 
30
- get ck_() {
30
+ get cj_() {
31
31
  var nextSibling = this.bX_;
32
32
 
33
33
  if (nextSibling) {
34
34
  if (nextSibling.bY_) {
35
35
  var firstChild = nextSibling.ay_;
36
- return firstChild || nextSibling.ck_;
36
+ return firstChild || nextSibling.cj_;
37
37
  }
38
38
  } else {
39
39
  var parentNode = this.bW_;
40
40
  if (parentNode && parentNode.bY_) {
41
- return parentNode.ck_;
41
+ return parentNode.cj_;
42
42
  }
43
43
  }
44
44
 
@@ -46,16 +46,16 @@ VNode.prototype = {
46
46
  },
47
47
 
48
48
  bM_: function (child) {
49
- this.ci_++;
49
+ this.ch_++;
50
50
 
51
51
  if (this.ca_ === "textarea") {
52
- if (child.cl_) {
53
- this.cb_ += child.cm_;
52
+ if (child.ck_) {
53
+ this.cb_ += child.cl_;
54
54
  } else {
55
55
  throw TypeError();
56
56
  }
57
57
  } else {
58
- var lastChild = this.cj_;
58
+ var lastChild = this.ci_;
59
59
 
60
60
  child.bW_ = this;
61
61
 
@@ -65,14 +65,14 @@ VNode.prototype = {
65
65
  this.bZ_ = child;
66
66
  }
67
67
 
68
- this.cj_ = child;
68
+ this.ci_ = child;
69
69
  }
70
70
 
71
71
  return child;
72
72
  },
73
73
 
74
74
  cd_: function finishChild() {
75
- if (this.ci_ === this.ch_ && this.bW_) {
75
+ if (this.ch_ === this.cg_ && this.bW_) {
76
76
  return this.bW_.cd_();
77
77
  } else {
78
78
  return this;
@@ -3,20 +3,20 @@ var VNode = require("./VNode");
3
3
 
4
4
  function VText(value, ownerComponent) {
5
5
  this.bT_(-1 /* no children */, ownerComponent);
6
- this.cm_ = value;
6
+ this.cl_ = value;
7
7
  }
8
8
 
9
9
  VText.prototype = {
10
- cl_: true,
10
+ ck_: true,
11
11
 
12
12
  bV_: 3,
13
13
 
14
14
  bl_: function (host) {
15
- return (host.ownerDocument || host).createTextNode(this.cm_);
15
+ return (host.ownerDocument || host).createTextNode(this.cl_);
16
16
  },
17
17
 
18
18
  bN_: function () {
19
- return new VText(this.cm_);
19
+ return new VText(this.cl_);
20
20
  }
21
21
  };
22
22
 
@@ -44,7 +44,7 @@ exports.t = runtime.t = function (typeName) {
44
44
  instance.P_(input, out);
45
45
  };
46
46
 
47
- instance.cn_ = true;
47
+ instance.cm_ = true;
48
48
  instance.am_();
49
49
  instance._t_ = false;
50
50
 
@@ -78,7 +78,7 @@ registry._C_ = function (typeName, id) {
78
78
  if (instances) {
79
79
  instances.add(instance);
80
80
  instance.once("destroy", function () {
81
- if (!instance.cn_) {
81
+ if (!instance.cm_) {
82
82
  instances.delete(instance);
83
83
  }
84
84
  });
@@ -80,8 +80,8 @@ function createFragmentNode(startNode, nextNode, parentNode) {
80
80
 
81
81
  function beginFragmentNode(startNode, parentNode) {
82
82
  var fragment = createFragmentNode(startNode, null, parentNode);
83
- fragment.co_ = function (nextNode) {
84
- fragment.co_ = null;
83
+ fragment.cn_ = function (nextNode) {
84
+ fragment.cn_ = null;
85
85
  insertBefore(
86
86
  fragment.endNode,
87
87
  nextNode,
@@ -92,4 +92,4 @@ function beginFragmentNode(startNode, parentNode) {
92
92
  }
93
93
 
94
94
  exports._h_ = createFragmentNode;
95
- exports.cp_ = beginFragmentNode;
95
+ exports.co_ = beginFragmentNode;
@@ -37,6 +37,6 @@ function removeChild(node) {
37
37
 
38
38
  exports.bc_ = insertBefore;
39
39
  exports.bd_ = insertAfter;
40
- exports.ck_ = nextSibling;
40
+ exports.cj_ = nextSibling;
41
41
  exports.ay_ = firstChild;
42
42
  exports.be_ = removeChild;
@@ -11,8 +11,8 @@ var KeySequence = require("../../components/KeySequence");
11
11
  var VElement = require("../vdom").bv_;
12
12
  var fragment = require("./fragment");
13
13
  var helpers = require("./helpers");
14
- var virtualizeElement = VElement.cf_;
15
- var morphAttrs = VElement.cg_;
14
+ var virtualizeElement = VElement.ce_;
15
+ var morphAttrs = VElement.cf_;
16
16
  var keysByDOMNode = domData._G_;
17
17
  var componentByDOMNode = domData._l_;
18
18
  var vElementByDOMNode = domData._H_;
@@ -20,11 +20,11 @@ var detachedByDOMNode = domData.aT_;
20
20
 
21
21
  var insertBefore = helpers.bc_;
22
22
  var insertAfter = helpers.bd_;
23
- var nextSibling = helpers.ck_;
23
+ var nextSibling = helpers.cj_;
24
24
  var firstChild = helpers.ay_;
25
25
  var removeChild = helpers.be_;
26
26
  var createFragmentNode = fragment._h_;
27
- var beginFragmentNode = fragment.cp_;
27
+ var beginFragmentNode = fragment.co_;
28
28
 
29
29
  var ELEMENT_NODE = 1;
30
30
  var TEXT_NODE = 3;
@@ -161,7 +161,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
161
161
  var fromComponent;
162
162
 
163
163
  outer: while (curToNodeChild) {
164
- toNextSibling = curToNodeChild.ck_;
164
+ toNextSibling = curToNodeChild.cj_;
165
165
  curToNodeType = curToNodeChild.bV_;
166
166
  curToNodeKey = curToNodeChild.bU_;
167
167
 
@@ -587,7 +587,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
587
587
  {
588
588
  // Both nodes being compared are Text or Comment nodes
589
589
  isCompatible = true;
590
- var curToNodeValue = curToNodeChild.cm_;
590
+ var curToNodeValue = curToNodeChild.cl_;
591
591
  var curFromNodeValue = curFromNodeChild.nodeValue;
592
592
  if (curFromNodeValue !== curToNodeValue) {
593
593
  if (
@@ -638,10 +638,10 @@ function morphdom(fromNode, toNode, host, componentsContext) {
638
638
  }
639
639
 
640
640
  // We have processed all of the "to nodes".
641
- if (fromNode.co_) {
641
+ if (fromNode.cn_) {
642
642
  // If we are in an unfinished fragment, we have reached the end of the nodes
643
643
  // we were matching up and need to end the fragment
644
- fromNode.co_(curFromNodeChild);
644
+ fromNode.cn_(curFromNodeChild);
645
645
  } else {
646
646
  // If curFromNodeChild is non-null then we still have some from nodes
647
647
  // left over that need to be removed
@@ -19,7 +19,7 @@ function virtualizeChildNodes(node, vdomParent, ownerComponent) {
19
19
  function virtualize(node, ownerComponent) {
20
20
  switch (node.nodeType) {
21
21
  case 1:
22
- return VElement.cf_(node, virtualizeChildNodes, ownerComponent);
22
+ return VElement.ce_(node, virtualizeChildNodes, ownerComponent);
23
23
  case 3:
24
24
  return new VText(node.nodeValue, ownerComponent);
25
25
  case 11:
@@ -78,5 +78,5 @@ exports.bv_ = VElement;
78
78
  exports.bx_ = VText;
79
79
  exports.by_ = VComponent;
80
80
  exports.bz_ = VFragment;
81
- exports.cf_ = virtualize;
81
+ exports.ce_ = virtualize;
82
82
  exports.bA_ = virtualizeHTML;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.33.7",
3
+ "version": "5.33.9",
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 --extensions .js --copy-files --config-file ../../babel.config.js --env-name=production"
65
65
  },
66
66
  "dependencies": {
67
- "@marko/compiler": "^5.35.6",
68
- "@marko/translator-default": "^5.32.7",
67
+ "@marko/compiler": "^5.35.7",
68
+ "@marko/translator-default": "^5.32.8",
69
69
  "app-module-path": "^2.2.0",
70
70
  "argly": "^1.2.0",
71
71
  "browser-refresh-client": "1.1.4",
@@ -3,7 +3,7 @@
3
3
  module.exports = function classHelper(arg) {
4
4
  switch (typeof arg) {
5
5
  case "string":
6
- return arg || null;
6
+ return arg || undefined;
7
7
  case "object":
8
8
  var result = "";
9
9
  var sep = "";
@@ -25,9 +25,6 @@ module.exports = function classHelper(arg) {
25
25
  }
26
26
  }
27
27
 
28
- return result || null;
29
-
30
- default:
31
- return null;
28
+ return result || undefined;
32
29
  }
33
30
  };
@@ -7,7 +7,7 @@ var changeCase = require("./_change-case");
7
7
  */
8
8
  module.exports = function styleHelper(style) {
9
9
  if (!style) {
10
- return null;
10
+ return;
11
11
  }
12
12
 
13
13
  var type = typeof style;
@@ -38,7 +38,7 @@ module.exports = function styleHelper(style) {
38
38
  }
39
39
  }
40
40
 
41
- return styles || null;
41
+ return styles || undefined;
42
42
  }
43
43
 
44
44
  return style;
@@ -55,14 +55,17 @@ exports.p = function (tagsAPI) {
55
55
  const input = _.i;
56
56
  const tagsRenderer = _.r;
57
57
  const renderFn = createRenderFn(tagsRenderer);
58
+ const willRerender = componentDef._wrr;
58
59
  const $global = out.global;
59
60
  const streamData = ($global.streamData = $global.streamData || {});
60
61
 
61
- $global.serializedGlobals = $global.serializedGlobals || {};
62
- $global.serializedGlobals.componentIdToScopeId = true;
63
- $global.componentIdToScopeId = $global.componentIdToScopeId || {};
64
- $global.componentIdToScopeId[component.id] = streamData.scopeId || 0;
65
- out.bf(out.___assignedKey, component, true);
62
+ if (willRerender) {
63
+ $global.serializedGlobals = $global.serializedGlobals || {};
64
+ $global.serializedGlobals.componentIdToScopeId = true;
65
+ $global.componentIdToScopeId = $global.componentIdToScopeId || {};
66
+ $global.componentIdToScopeId[component.id] = streamData.scopeId || 0;
67
+ }
68
+ out.bf(out.___assignedKey, component, willRerender);
66
69
  renderFn(out.beginAsync(), input, {}, streamData);
67
70
  out.ef();
68
71
  },
@@ -70,10 +73,12 @@ exports.p = function (tagsAPI) {
70
73
  "MARKO_DEBUG"
71
74
  ? {
72
75
  t: TagsCompatId,
76
+ i: true,
73
77
  d: true,
74
78
  }
75
79
  : {
76
80
  t: TagsCompatId,
81
+ i: true,
77
82
  },
78
83
  {},
79
84
  );
@@ -204,14 +204,6 @@ VElement.prototype = {
204
204
 
205
205
  return el;
206
206
  },
207
-
208
- ___hasAttribute: function (name) {
209
- // We don't care about the namespaces since the there
210
- // is no chance that attributes with the same name will have
211
- // different namespaces
212
- var value = this.___attributes[name];
213
- return value != null && value !== false;
214
- },
215
207
  };
216
208
 
217
209
  inherit(VElement, VNode);
@@ -303,13 +295,25 @@ VElement.___morphAttrs = function (fromEl, vFromEl, toEl) {
303
295
 
304
296
  if (toFlags & FLAG_SIMPLE_ATTRS && fromFlags & FLAG_SIMPLE_ATTRS) {
305
297
  if (oldAttrs["class"] !== (attrValue = attrs["class"])) {
306
- fromEl.className = attrValue;
298
+ if (attrValue) {
299
+ fromEl.className = attrValue;
300
+ } else {
301
+ fromEl.removeAttribute("class");
302
+ }
307
303
  }
308
304
  if (oldAttrs.id !== (attrValue = attrs.id)) {
309
- fromEl.id = attrValue;
305
+ if (attrValue) {
306
+ fromEl.id = attrValue;
307
+ } else {
308
+ fromEl.removeAttribute("id");
309
+ }
310
310
  }
311
311
  if (oldAttrs.style !== (attrValue = attrs.style)) {
312
- fromEl.style.cssText = attrValue;
312
+ if (attrValue) {
313
+ fromEl.style.cssText = attrValue;
314
+ } else {
315
+ fromEl.removeAttribute("style");
316
+ }
313
317
  }
314
318
  return;
315
319
  }