marko 5.33.4 → 5.33.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. package/dist/runtime/helpers/tags-compat/dom-debug.js +1 -1
  2. package/dist/runtime/helpers/tags-compat/dom-debug.mjs +2 -2
  3. package/dist/runtime/helpers/tags-compat/dom.js +1 -1
  4. package/dist/runtime/helpers/tags-compat/dom.mjs +2 -2
  5. package/dist/runtime/helpers/tags-compat/html-debug.mjs +1 -1
  6. package/dist/runtime/helpers/tags-compat/html.mjs +1 -1
  7. package/dist/runtime/helpers/tags-compat/runtime-dom.js +38 -85
  8. package/dist/runtime/helpers/tags-compat/runtime-html.js +3 -3
  9. package/dist/runtime/html/AsyncStream.js +12 -12
  10. package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
  11. package/dist/runtime/html/helpers/attr.js +3 -3
  12. package/dist/runtime/html/helpers/data-marko.js +1 -1
  13. package/dist/runtime/html/helpers/escape-quotes.js +1 -1
  14. package/dist/runtime/html/helpers/escape-xml.js +1 -1
  15. package/dist/runtime/renderable.js +3 -3
  16. package/dist/runtime/vdom/AsyncVDOMBuilder.js +67 -67
  17. package/dist/runtime/vdom/VComponent.js +3 -3
  18. package/dist/runtime/vdom/VDocumentFragment.js +7 -7
  19. package/dist/runtime/vdom/VElement.js +35 -35
  20. package/dist/runtime/vdom/VFragment.js +5 -5
  21. package/dist/runtime/vdom/VNode.js +30 -30
  22. package/dist/runtime/vdom/VText.js +8 -8
  23. package/dist/runtime/vdom/helpers/const-element.js +3 -3
  24. package/dist/runtime/vdom/hot-reload.js +2 -2
  25. package/dist/runtime/vdom/morphdom/fragment.js +3 -3
  26. package/dist/runtime/vdom/morphdom/helpers.js +1 -1
  27. package/dist/runtime/vdom/morphdom/index.js +31 -31
  28. package/dist/runtime/vdom/vdom.js +14 -14
  29. package/package.json +1 -1
  30. package/src/runtime/helpers/tags-compat/dom-debug.js +1 -1
  31. package/src/runtime/helpers/tags-compat/dom-debug.mjs +2 -2
  32. package/src/runtime/helpers/tags-compat/dom.js +1 -1
  33. package/src/runtime/helpers/tags-compat/dom.mjs +2 -2
  34. package/src/runtime/helpers/tags-compat/html-debug.mjs +1 -1
  35. package/src/runtime/helpers/tags-compat/html.mjs +1 -1
  36. package/src/runtime/helpers/tags-compat/runtime-dom.js +37 -84
@@ -1 +1 @@
1
- "use strict";require("./runtime-dom.js").p(require("@marko/runtime-tags/debug/dom"));
1
+ "use strict";require("./runtime-dom.js").p(require("@marko/runtime-tags/debug/dom").compat);
@@ -1,3 +1,3 @@
1
- import api from "@marko/runtime-tags/debug/dom";
1
+ import { compat } from "@marko/runtime-tags/debug/dom";
2
2
  import { p } from "./runtime-dom.js";
3
- p(api);
3
+ p(compat);
@@ -1 +1 @@
1
- "use strict";require("./runtime-dom.js").p(require("@marko/runtime-tags/dom"));
1
+ "use strict";require("./runtime-dom.js").p(require("@marko/runtime-tags/dom").compat);
@@ -1,3 +1,3 @@
1
- import api from "@marko/runtime-tags/dom";
1
+ import { compat } from "@marko/runtime-tags/dom";
2
2
  import { p } from "./runtime-dom.js";
3
- p(api);
3
+ p(compat);
@@ -1,3 +1,3 @@
1
- import api from "@marko/runtime-tags/debug/html";
1
+ import * as api from "@marko/runtime-tags/debug/html";
2
2
  import { p } from "./runtime-html.js";
3
3
  export const s = p(api);
@@ -1,3 +1,3 @@
1
- import api from "@marko/runtime-tags/html";
1
+ import * as api from "@marko/runtime-tags/html";
2
2
  import { p } from "./runtime-html.js";
3
3
  export const s = p(api);
@@ -10,71 +10,40 @@ const morphdom = require("../../vdom/morphdom");
10
10
  const { _h_ } = require("../../vdom/morphdom/fragment");
11
11
  const dynamicTag = require("../dynamic-tag");
12
12
 
13
- exports.p = function ({
14
- prepare,
15
- runEffects,
16
- patchConditionals,
17
- createScopeWithRenderer,
18
- queueEffect,
19
- scopeLookup,
20
- getRegisteredWithScope,
21
- register
22
- }) {
13
+ exports.p = function (domCompat) {
23
14
  dynamicTag.bk_ = function tagsToVdom(
24
- tagsRenderer,
15
+ renderer,
25
16
  renderBody,
26
17
  args)
27
18
  {
28
- if (
29
- tagsRenderer ?
30
- tagsRenderer.bl_ === undefined :
31
- !Array.isArray(renderBody) && renderBody?.bl_ === undefined)
32
-
33
- return tagsRenderer;
34
-
35
- return (input, out) =>
36
- TagsCompat(
37
- { i: args ? args : input, r: tagsRenderer || renderBody },
38
- out
39
- );
19
+ const tagsRenderer = domCompat.resolveRenderer(renderer || renderBody);
20
+
21
+ if (tagsRenderer) {
22
+ return (input, out) =>
23
+ TagsCompat({ i: args ? args : input, r: tagsRenderer }, out);
24
+ }
25
+
26
+ return renderer;
40
27
  };
41
28
 
42
29
  const TagsCompatId = "tags-compat";
43
30
  const TagsCompat = createRenderer(
44
31
  function (_, out, componentDef, component) {
45
- let existing = false;
46
32
  const isHydrate =
47
33
  R_(out).o_._W_;
48
34
  const input = Array.isArray(_.i) ? _.i : [_.i];
49
- const tagsRenderer = resolveRegistered(_.r);
50
- const args = tagsRenderer.bm_;
35
+ const tagsRenderer = domCompat.resolveRenderer(_.r);
36
+ const newNode = domCompat.render(
37
+ isHydrate,
38
+ out,
39
+ component,
40
+ tagsRenderer,
41
+ input
42
+ );
51
43
 
52
- component.effects = prepare(() => {
53
- if (isHydrate) {
54
- const scopeId = out.global.componentIdToScopeId[component.id];
55
- component.scope = scopeLookup[scopeId];
56
- }
57
- if (!component.scope) {
58
- component.scope = createScopeWithRenderer(
59
- tagsRenderer /* out.global as context */
60
- );
61
- for (const signal of tagsRenderer.bn_) {
62
- signal(component.scope, true);
63
- }
64
- } else {
65
- args && args(component.scope, input, 1);
66
- existing = true;
67
- }
68
- args && args(component.scope, input);
69
- });
70
- out.bf(out._Y_, component, existing);
71
- if (!existing) {
72
- out.node({
73
- bo_: () =>
74
- component.scope.bp_ === component.scope.bq_ ?
75
- component.scope.bp_ :
76
- component.scope.bp_.parentNode
77
- });
44
+ out.bf(out._Y_, component, !newNode);
45
+ if (newNode) {
46
+ out.node({ bl_: () => newNode });
78
47
  }
79
48
  out.ef();
80
49
  },
@@ -94,12 +63,8 @@ exports.p = function ({
94
63
  _: TagsCompat,
95
64
  Component: defineComponent(
96
65
  {
97
- onMount() {
98
- runEffects(this.effects);
99
- },
100
- onUpdate() {
101
- runEffects(this.effects);
102
- }
66
+ onMount: domCompat.runComponentEffects,
67
+ onUpdate: domCompat.runComponentEffects
103
68
  },
104
69
  TagsCompat
105
70
  )
@@ -114,7 +79,7 @@ exports.p = function ({
114
79
 
115
80
  const rendererCache = new WeakMap();
116
81
 
117
- patchConditionals((conditional) => (...args) => {
82
+ domCompat.patchConditionals((conditional) => (...args) => {
118
83
  const signal = conditional(...args);
119
84
  const hasAttrs = args.length > 1;
120
85
  return (scope, renderer, clean) => {
@@ -124,17 +89,14 @@ exports.p = function ({
124
89
 
125
90
  function create5to6Renderer(renderer, hasAttrs) {
126
91
  let newRenderer = renderer;
127
- if (renderer) {
92
+ if (renderer && typeof renderer !== "string") {
128
93
  const rendererFromAnywhere =
129
94
  renderer._ ||
130
95
  renderer.render ||
131
96
  renderer.renderer && renderer.renderer.renderer ||
132
97
  renderer.renderer;
133
- const isMarko6 = rendererFromAnywhere ?
134
- rendererFromAnywhere.bl_ :
135
- renderer.bl_;
136
98
 
137
- if (typeof renderer !== "string" && !isMarko6) {
99
+ if (!domCompat.isRenderer(rendererFromAnywhere || renderer)) {
138
100
  newRenderer = rendererCache.get(renderer);
139
101
  if (!newRenderer) {
140
102
  const { Component } = renderer;
@@ -145,29 +107,28 @@ exports.p = function ({
145
107
  scopeId)
146
108
  {
147
109
  for (const customEvent of customEvents) {
148
- customEvent[1] = resolveRegistered(customEvent[1]);
110
+ customEvent[1] = domCompat.resolveRenderer(customEvent[1]);
149
111
  }
150
112
 
151
113
  setCustomEvents.call(this, customEvents, scopeId);
152
114
  };
153
115
  }
154
- newRenderer = {
155
- br_(scope) {
116
+ newRenderer = domCompat.createRenderer(
117
+ (scope) => {
156
118
  if (!hasAttrs) {
157
119
  renderAndMorph(scope, rendererFromAnywhere, renderer, {});
158
120
  }
159
121
  },
160
- bl_() {
122
+ () => {
161
123
  const realFragment = document.createDocumentFragment();
162
124
  _h_(null, null, realFragment);
163
125
  return realFragment;
164
126
  },
165
- bs_: 1,
166
- bm_(scope, input, clean) {
127
+ (scope, input, clean) => {
167
128
  if (clean) return;
168
129
  renderAndMorph(scope, rendererFromAnywhere, renderer, input);
169
130
  }
170
- };
131
+ );
171
132
  rendererCache.set(renderer, newRenderer);
172
133
  }
173
134
  }
@@ -175,18 +136,18 @@ exports.p = function ({
175
136
  return newRenderer;
176
137
  }
177
138
 
178
- register("@marko/tags-compat-5-to-6", create5to6Renderer);
139
+ domCompat.register("@marko/tags-compat-5-to-6", create5to6Renderer);
179
140
 
180
141
  function renderAndMorph(scope, renderer, renderBody, input) {
181
142
  const out = defaultCreateOut();
182
- let rootNode = scope.bp_.fragment;
143
+ let host = domCompat.getStartNode(scope);
144
+ let rootNode = host.fragment;
183
145
  if (!rootNode) {
184
146
  const component = scope.marko5Component = _i_[scope.m5c];
185
147
  rootNode = component._A_;
186
- scope.bp_ = rootNode.startNode;
187
- scope.bq_ = rootNode.endNode;
148
+ host = rootNode.startNode;
149
+ domCompat.setScopeNodes(host, rootNode.endNode);
188
150
  }
189
- const host = scope.bp_;
190
151
  const existingComponent = scope.marko5Component;
191
152
  const componentsContext = R_(out);
192
153
  const globalComponentsContext = componentsContext.o_;
@@ -215,7 +176,7 @@ exports.p = function ({
215
176
  RenderBodyComponent({ renderBody, args: input }, out);
216
177
  }
217
178
 
218
- queueEffect(scope, () => {
179
+ domCompat.queueEffect(scope, () => {
219
180
  const targetNode = out.af_().ay_;
220
181
  morphdom(rootNode, targetNode, host, componentsContext);
221
182
  const componentDefs = componentsContext.ad_(
@@ -267,12 +228,4 @@ exports.p = function ({
267
228
  _: RenderBodyComponent,
268
229
  Component: defineComponent({}, RenderBodyComponent)
269
230
  }));
270
-
271
- function resolveRegistered(renderer) {
272
- if (!Array.isArray(renderer)) return renderer;
273
-
274
- const [registerId, scopeId] = renderer;
275
- const scope = scopeLookup[scopeId];
276
- return getRegisteredWithScope(registerId, scope);
277
- }
278
231
  };
@@ -25,8 +25,8 @@ exports.p = function (tagsAPI) {
25
25
  return getRegistryInfo(this);
26
26
  };
27
27
 
28
- const isMarko6 = (fn) => !!fn.bt_;
29
- const isMarko5 = (fn) => !fn.bt_;
28
+ const isMarko6 = (fn) => !!fn.bm_;
29
+ const isMarko5 = (fn) => !fn.bm_;
30
30
 
31
31
  dynamicTag5.bk_ = function tagsToVdom(
32
32
  tagsRenderer,
@@ -148,7 +148,7 @@ exports.p = function (tagsAPI) {
148
148
  };
149
149
  },
150
150
  function createRenderer(renderFn) {
151
- renderFn.bt_ = true;
151
+ renderFn.bm_ = true;
152
152
  return renderFn;
153
153
  }
154
154
  );
@@ -9,7 +9,7 @@ var markoAttr = require("./helpers/data-marko");
9
9
  var escapeXmlHelper = require("./helpers/escape-xml");
10
10
  var StringWriter = require("./StringWriter");
11
11
  var escapeXmlOrNullish = escapeXmlHelper.x;
12
- var escapeXmlString = escapeXmlHelper.bu_;
12
+ var escapeXmlString = escapeXmlHelper.bn_;
13
13
 
14
14
  function noop() {}
15
15
 
@@ -104,7 +104,7 @@ function AsyncStream(global, writer, parentOut) {
104
104
  this._X_ = null;
105
105
  this._Y_ = null;
106
106
  this.b__ = null;
107
- this.bv_ = false;
107
+ this.bo_ = false;
108
108
  }
109
109
 
110
110
  AsyncStream.DEFAULT_TIMEOUT = 10000;
@@ -125,11 +125,11 @@ AsyncStream.enableAsyncStackTrace = function () {
125
125
  var proto = AsyncStream.prototype = {
126
126
  constructor: AsyncStream,
127
127
  A_: typeof document === "object" && document,
128
- bw_: true,
128
+ bp_: true,
129
129
 
130
130
  [Symbol.asyncIterator]() {
131
- if (this.bx_) {
132
- return this.bx_;
131
+ if (this.bq_) {
132
+ return this.bq_;
133
133
  }
134
134
 
135
135
  const originalWriter = this._state.writer;
@@ -190,7 +190,7 @@ var proto = AsyncStream.prototype = {
190
190
  };
191
191
  }
192
192
 
193
- return this.bx_ = {
193
+ return this.bq_ = {
194
194
  next: iteratorNextFn,
195
195
  [Symbol.asyncIterator]() {
196
196
  return this;
@@ -235,7 +235,7 @@ var proto = AsyncStream.prototype = {
235
235
  return this._state.writer.toString();
236
236
  },
237
237
 
238
- by_: function () {
238
+ br_: function () {
239
239
  this._result = this._result || new RenderResult(this);
240
240
  return this._result;
241
241
  },
@@ -286,7 +286,7 @@ var proto = AsyncStream.prototype = {
286
286
  }
287
287
 
288
288
  this._lastCount++;
289
- newStream.bv_ = true;
289
+ newStream.bo_ = true;
290
290
  }
291
291
 
292
292
  name = options.name;
@@ -332,7 +332,7 @@ var proto = AsyncStream.prototype = {
332
332
  }
333
333
 
334
334
  if (state.events !== state.stream) {
335
- state.events.emit("finish", this.by_());
335
+ state.events.emit("finish", this.br_());
336
336
  }
337
337
  },
338
338
 
@@ -404,7 +404,7 @@ var proto = AsyncStream.prototype = {
404
404
  parentOut._handleChildDone(this);
405
405
  }
406
406
  } else {
407
- if (childOut.bv_) {
407
+ if (childOut.bo_) {
408
408
  this._lastCount--;
409
409
  }
410
410
 
@@ -445,7 +445,7 @@ var proto = AsyncStream.prototype = {
445
445
  var state = this._state;
446
446
 
447
447
  if (event === "finish" && state.finished === true) {
448
- callback(this.by_());
448
+ callback(this.br_());
449
449
  } else if (event === "last") {
450
450
  this.onLast(callback);
451
451
  } else {
@@ -459,7 +459,7 @@ var proto = AsyncStream.prototype = {
459
459
  var state = this._state;
460
460
 
461
461
  if (event === "finish" && state.finished === true) {
462
- callback(this.by_());
462
+ callback(this.br_());
463
463
  } else if (event === "last") {
464
464
  this.onLast(callback);
465
465
  } else {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var attrHelper = require("./attr");
3
- var notEmptyAttr = attrHelper.bz_;
4
- var isEmptyAttrValue = attrHelper.bA_;
3
+ var notEmptyAttr = attrHelper.bs_;
4
+ var isEmptyAttrValue = attrHelper.bt_;
5
5
  var classHelper = require("./class-attr");
6
6
  var styleHelper = require("./style-attr");
7
7
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  var escapeQuoteHelpers = require("./escape-quotes");
4
4
  var escapeDoubleQuotes = escapeQuoteHelpers.m_;
5
- var escapeSingleQuotes = escapeQuoteHelpers.bB_;
5
+ var escapeSingleQuotes = escapeQuoteHelpers.bu_;
6
6
 
7
7
 
8
8
  module.exports = maybeEmptyAttr;
9
9
 
10
- maybeEmptyAttr.bz_ = notEmptyAttr;
11
- maybeEmptyAttr.bA_ = isEmpty;
10
+ maybeEmptyAttr.bs_ = notEmptyAttr;
11
+ maybeEmptyAttr.bt_ = isEmpty;
12
12
 
13
13
  function maybeEmptyAttr(name, value) {
14
14
  if (isEmpty(value)) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var escapeQuoteHelpers = require("./escape-quotes");
4
- var escapeSingleQuotes = escapeQuoteHelpers.bB_;
4
+ var escapeSingleQuotes = escapeQuoteHelpers.bu_;
5
5
  var escapeDoubleQuotes = escapeQuoteHelpers.m_;
6
6
  var FLAG_WILL_RERENDER_IN_BROWSER = 1;
7
7
  // var FLAG_HAS_RENDER_BODY = 2;
@@ -6,7 +6,7 @@ exports.d = function (value) {
6
6
 
7
7
  exports.m_ = escapeDoubleQuotes;
8
8
 
9
- exports.bB_ = escapeSingleQuotes;
9
+ exports.bu_ = escapeSingleQuotes;
10
10
 
11
11
  function escapeSingleQuotes(value, startPos) {
12
12
  return escapeQuote(value, startPos, "'", "'");
@@ -12,7 +12,7 @@ module.exports.x = function (value) {
12
12
  return escapeXML(value + "");
13
13
  };
14
14
 
15
- exports.bu_ = escapeXML;
15
+ exports.bn_ = escapeXML;
16
16
 
17
17
  function escapeXML(str) {
18
18
  var len = str.length;
@@ -73,7 +73,7 @@ module.exports = function (target, renderer) {
73
73
  }
74
74
 
75
75
  render(localData, out);
76
- return out.by_();
76
+ return out.br_();
77
77
  },
78
78
 
79
79
  /**
@@ -160,7 +160,7 @@ module.exports = function (target, renderer) {
160
160
  finalData = {};
161
161
  }
162
162
 
163
- if (out && out.bw_) {
163
+ if (out && out.bp_) {
164
164
  finalOut = out;
165
165
  shouldEnd = false;
166
166
  extend(out.global, globalData);
@@ -179,7 +179,7 @@ module.exports = function (target, renderer) {
179
179
  if (callback) {
180
180
  finalOut.
181
181
  on("finish", function () {
182
- callback(null, finalOut.by_(), finalOut);
182
+ callback(null, finalOut.br_(), finalOut);
183
183
  }).
184
184
  once("error", callback);
185
185
  }