marko 5.25.15 → 5.25.16

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.
@@ -1,6 +1,5 @@
1
1
  "use strict";var runtime = require(".");
2
2
  var queueMicrotask = require("../queueMicrotask");
3
- var util = require("@internal/components-util");
4
3
  var registry = require("@internal/components-registry");
5
4
  var updateManager = require("../components/update-manager");
6
5
 
@@ -17,7 +16,7 @@ runtime.t = function (typeName) {
17
16
 
18
17
  var renderFn;
19
18
  var template = registered[typeName] = createTemplate(typeName);
20
- var instances = instancesByType[typeName] = [];
19
+ var instances = instancesByType[typeName] = new Set();
21
20
  Object.defineProperty(template, "_", {
22
21
  get: function () {
23
22
  return renderFn && proxyRenderer;
@@ -25,7 +24,7 @@ runtime.t = function (typeName) {
25
24
  set: function (v) {
26
25
  renderFn = v;
27
26
 
28
- if (instances.length) {
27
+ if (instances.size) {
29
28
  if (!queue) {
30
29
  queue = [];
31
30
  queueMicrotask(batchUpdate);
@@ -35,27 +34,24 @@ runtime.t = function (typeName) {
35
34
  var newProto = registry._p_(typeName).prototype;
36
35
  instances.forEach(function (instance) {
37
36
  if (hasLifecycleChanged(instance.__proto__, newProto)) {
38
- var startNode = instance._m_.startNode;
39
- var endNode = instance._m_.endNode;
40
- var parentNode = startNode.parentNode;
41
- var curNode;
37
+ var renderer = instance.af_;
38
+ instance.af_ = (input, out) => {
39
+ instance.ao_(input, out);
40
+ if (instance.onInput) {
41
+ input = instance.onInput(input, out) || input;
42
+ }
43
+ instance.af_ = renderer;
44
+ instance.af_(input, out);
45
+ };
42
46
 
43
47
  instance.bU_ = true;
44
48
  instance._U_();
45
- instance._d_();
49
+ instance._f_ = false;
46
50
 
47
51
  if (instance._N_) {
48
52
  instance._N_.removeAllListeners();
49
53
  instance._N_ = null;
50
54
  }
51
-
52
- while ((curNode = startNode.nextSibling) !== endNode) {
53
- util._A_(curNode);
54
- parentNode.removeChild(curNode);
55
- }
56
-
57
- instance.bU_ = false;
58
- instance._f_ = false;
59
55
  }
60
56
 
61
57
  instance.__proto__ = newProto;
@@ -80,10 +76,10 @@ registry._o_ = function (typeName, id) {
80
76
  var instance = createComponent(typeName, id);
81
77
 
82
78
  if (instances) {
83
- instances.push(instance);
79
+ instances.add(instance);
84
80
  instance.once("destroy", function () {
85
81
  if (!instance.bU_) {
86
- instances.splice(1, instances.indexOf(instance));
82
+ instances.delete(instance);
87
83
  }
88
84
  });
89
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "5.25.15",
3
+ "version": "5.25.16",
4
4
  "license": "MIT",
5
5
  "description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
6
6
  "dependencies": {
@@ -1,6 +1,5 @@
1
1
  var runtime = require(".");
2
2
  var queueMicrotask = require("../queueMicrotask");
3
- var util = require("@internal/components-util");
4
3
  var registry = require("@internal/components-registry");
5
4
  var updateManager = require("../components/update-manager");
6
5
 
@@ -17,7 +16,7 @@ runtime.t = function (typeName) {
17
16
 
18
17
  var renderFn;
19
18
  var template = (registered[typeName] = createTemplate(typeName));
20
- var instances = (instancesByType[typeName] = []);
19
+ var instances = (instancesByType[typeName] = new Set());
21
20
  Object.defineProperty(template, "_", {
22
21
  get: function () {
23
22
  return renderFn && proxyRenderer;
@@ -25,7 +24,7 @@ runtime.t = function (typeName) {
25
24
  set: function (v) {
26
25
  renderFn = v;
27
26
 
28
- if (instances.length) {
27
+ if (instances.size) {
29
28
  if (!queue) {
30
29
  queue = [];
31
30
  queueMicrotask(batchUpdate);
@@ -35,27 +34,24 @@ runtime.t = function (typeName) {
35
34
  var newProto = registry.___getComponentClass(typeName).prototype;
36
35
  instances.forEach(function (instance) {
37
36
  if (hasLifecycleChanged(instance.__proto__, newProto)) {
38
- var startNode = instance.___rootNode.startNode;
39
- var endNode = instance.___rootNode.endNode;
40
- var parentNode = startNode.parentNode;
41
- var curNode;
37
+ var renderer = instance.___renderer;
38
+ instance.___renderer = (input, out) => {
39
+ instance.___emitCreate(input, out);
40
+ if (instance.onInput) {
41
+ input = instance.onInput(input, out) || input;
42
+ }
43
+ instance.___renderer = renderer;
44
+ instance.___renderer(input, out);
45
+ };
42
46
 
43
47
  instance.___hmrDestroyed = true;
44
48
  instance.___emitDestroy();
45
- instance.___removeDOMEventListeners();
49
+ instance.___mounted = false;
46
50
 
47
51
  if (instance.___subscriptions) {
48
52
  instance.___subscriptions.removeAllListeners();
49
53
  instance.___subscriptions = null;
50
54
  }
51
-
52
- while ((curNode = startNode.nextSibling) !== endNode) {
53
- util.___destroyNodeRecursive(curNode);
54
- parentNode.removeChild(curNode);
55
- }
56
-
57
- instance.___hmrDestroyed = false;
58
- instance.___mounted = false;
59
55
  }
60
56
 
61
57
  instance.__proto__ = newProto;
@@ -80,10 +76,10 @@ registry.___createComponent = function (typeName, id) {
80
76
  var instance = createComponent(typeName, id);
81
77
 
82
78
  if (instances) {
83
- instances.push(instance);
79
+ instances.add(instance);
84
80
  instance.once("destroy", function () {
85
81
  if (!instance.___hmrDestroyed) {
86
- instances.splice(1, instances.indexOf(instance));
82
+ instances.delete(instance);
87
83
  }
88
84
  });
89
85
  }