marko 5.16.1 → 5.17.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/dist/runtime/RenderResult.js +13 -11
  2. package/dist/runtime/RenderResult.js.map +1 -1
  3. package/dist/runtime/components/Component.js +2 -2
  4. package/dist/runtime/components/Component.js.map +1 -1
  5. package/dist/runtime/components/ComponentsContext.js +2 -2
  6. package/dist/runtime/components/ComponentsContext.js.map +1 -1
  7. package/dist/runtime/components/event-delegation.js +8 -8
  8. package/dist/runtime/components/event-delegation.js.map +1 -1
  9. package/dist/runtime/components/init-components/index-browser.js +22 -24
  10. package/dist/runtime/components/init-components/index-browser.js.map +1 -1
  11. package/dist/runtime/components/registry/index-browser.js +2 -2
  12. package/dist/runtime/components/registry/index-browser.js.map +1 -1
  13. package/dist/runtime/components/util/index-browser.js +4 -3
  14. package/dist/runtime/components/util/index-browser.js.map +1 -1
  15. package/dist/runtime/html/AsyncStream.js +8 -10
  16. package/dist/runtime/html/AsyncStream.js.map +1 -1
  17. package/dist/runtime/vdom/AsyncVDOMBuilder.js +65 -70
  18. package/dist/runtime/vdom/AsyncVDOMBuilder.js.map +1 -1
  19. package/dist/runtime/vdom/VComponent.js +3 -3
  20. package/dist/runtime/vdom/VDocumentFragment.js +7 -7
  21. package/dist/runtime/vdom/VDocumentFragment.js.map +1 -1
  22. package/dist/runtime/vdom/VElement.js +42 -39
  23. package/dist/runtime/vdom/VElement.js.map +1 -1
  24. package/dist/runtime/vdom/VFragment.js +5 -5
  25. package/dist/runtime/vdom/VNode.js +31 -31
  26. package/dist/runtime/vdom/VText.js +8 -8
  27. package/dist/runtime/vdom/VText.js.map +1 -1
  28. package/dist/runtime/vdom/hot-reload.js +5 -5
  29. package/dist/runtime/vdom/hot-reload.js.map +1 -1
  30. package/dist/runtime/vdom/morphdom/fragment.js +3 -3
  31. package/dist/runtime/vdom/morphdom/helpers.js +1 -1
  32. package/dist/runtime/vdom/morphdom/index.js +30 -30
  33. package/dist/runtime/vdom/morphdom/index.js.map +1 -1
  34. package/dist/runtime/vdom/morphdom/specialElHandlers.js +6 -6
  35. package/dist/runtime/vdom/preserve-attrs.js +1 -1
  36. package/dist/runtime/vdom/vdom.js +10 -12
  37. package/dist/runtime/vdom/vdom.js.map +1 -1
  38. package/package.json +4 -4
  39. package/src/runtime/RenderResult.js +13 -11
  40. package/src/runtime/components/Component.js +5 -5
  41. package/src/runtime/components/ComponentsContext.js +2 -2
  42. package/src/runtime/components/event-delegation.js +6 -6
  43. package/src/runtime/components/init-components/index-browser.js +23 -25
  44. package/src/runtime/components/registry/index-browser.js +3 -3
  45. package/src/runtime/components/util/index-browser.js +8 -7
  46. package/src/runtime/html/AsyncStream.js +8 -10
  47. package/src/runtime/vdom/AsyncVDOMBuilder.js +9 -14
  48. package/src/runtime/vdom/VDocumentFragment.js +2 -2
  49. package/src/runtime/vdom/VElement.js +5 -2
  50. package/src/runtime/vdom/VText.js +2 -2
  51. package/src/runtime/vdom/hot-reload.js +1 -1
  52. package/src/runtime/vdom/morphdom/index.js +4 -4
  53. package/src/runtime/vdom/vdom.js +2 -4
@@ -7,7 +7,6 @@ var VComponent = vdom.bc_;
7
7
  var VFragment = vdom.bd_;
8
8
  var virtualizeHTML = vdom.be_;
9
9
  var RenderResult = require("../RenderResult");
10
- var defaultDocument = vdom.bf_;
11
10
  var morphdom = require("./morphdom");
12
11
  var attrsHelper = require("./helpers/attrs");
13
12
 
@@ -15,9 +14,9 @@ var EVENT_UPDATE = "update";
15
14
  var EVENT_FINISH = "finish";
16
15
 
17
16
  function State(tree) {
18
- this.bg_ = new EventEmitter();
19
- this.bh_ = tree;
20
- this.bi_ = false;
17
+ this.bf_ = new EventEmitter();
18
+ this.bg_ = tree;
19
+ this.bh_ = false;
21
20
  }
22
21
 
23
22
  function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
@@ -33,18 +32,18 @@ function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
33
32
  state = new State(parentNode);
34
33
  }
35
34
 
36
- this.bj_ = 1;
37
- this.bk_ = 0;
38
- this.bl_ = null;
39
- this.bm_ = parentOut;
35
+ this.bi_ = 1;
36
+ this.bj_ = 0;
37
+ this.bk_ = null;
38
+ this.bl_ = parentOut;
40
39
 
41
40
  this.data = {};
42
41
  this.J_ = state;
43
42
  this.l_ = parentNode;
44
43
  this.global = globalData || {};
45
- this.bn_ = [parentNode];
46
- this.bo_ = false;
47
- this.bp_ = undefined;
44
+ this.bm_ = [parentNode];
45
+ this.bn_ = false;
46
+ this.bo_ = undefined;
48
47
  this.b_ = null;
49
48
 
50
49
  this.g_ = null;
@@ -54,22 +53,22 @@ function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
54
53
 
55
54
  var proto = AsyncVDOMBuilder.prototype = {
56
55
  aP_: true,
57
- X_: defaultDocument,
56
+ X_: typeof window === "object" && document,
58
57
 
59
58
  bc: function (component, key, ownerComponent) {
60
59
  var vComponent = new VComponent(component, key, ownerComponent);
61
- return this.bq_(vComponent, 0, true);
60
+ return this.bp_(vComponent, 0, true);
62
61
  },
63
62
 
64
63
  ay_: function (component, key, ownerComponent) {
65
64
  var vComponent = new VComponent(component, key, ownerComponent, true);
66
- this.bq_(vComponent, 0);
65
+ this.bp_(vComponent, 0);
67
66
  },
68
67
 
69
- bq_: function (child, childCount, pushToStack) {
70
- this.l_.br_(child);
68
+ bp_: function (child, childCount, pushToStack) {
69
+ this.l_.bq_(child);
71
70
  if (pushToStack === true) {
72
- this.bn_.push(child);
71
+ this.bm_.push(child);
73
72
  this.l_ = child;
74
73
  }
75
74
  return childCount === 0 ? this : child;
@@ -85,7 +84,7 @@ var proto = AsyncVDOMBuilder.prototype = {
85
84
  flags,
86
85
  props);
87
86
 
88
- return this.bq_(element, childCount);
87
+ return this.bp_(element, childCount);
89
88
  },
90
89
 
91
90
  aM_: function (tagName, attrs, key, componentDef, props) {
@@ -103,7 +102,7 @@ var proto = AsyncVDOMBuilder.prototype = {
103
102
  n: function (node, component) {
104
103
  // NOTE: We do a shallow clone since we assume the node is being reused
105
104
  // and a node can only have one parent node.
106
- var clone = node.bs_();
105
+ var clone = node.br_();
107
106
  this.node(clone);
108
107
  clone.aA_ = component;
109
108
 
@@ -111,7 +110,7 @@ var proto = AsyncVDOMBuilder.prototype = {
111
110
  },
112
111
 
113
112
  node: function (node) {
114
- this.l_.br_(node);
113
+ this.l_.bq_(node);
115
114
  return this;
116
115
  },
117
116
 
@@ -130,17 +129,13 @@ var proto = AsyncVDOMBuilder.prototype = {
130
129
  text = text.toString();
131
130
  }
132
131
 
133
- this.l_.br_(new VText(text, ownerComponent));
132
+ this.l_.bq_(new VText(text, ownerComponent));
134
133
  return this;
135
134
  },
136
135
 
137
136
  html: function (html, ownerComponent) {
138
137
  if (html != null) {
139
- var vdomNode = virtualizeHTML(
140
- html,
141
- this.X_ || document,
142
- ownerComponent);
143
-
138
+ var vdomNode = virtualizeHTML(html, ownerComponent);
144
139
  this.node(vdomNode);
145
140
  }
146
141
 
@@ -165,7 +160,7 @@ var proto = AsyncVDOMBuilder.prototype = {
165
160
  flags,
166
161
  props);
167
162
 
168
- this.bq_(element, childCount, true);
163
+ this.bp_(element, childCount, true);
169
164
  return this;
170
165
  },
171
166
 
@@ -183,7 +178,7 @@ var proto = AsyncVDOMBuilder.prototype = {
183
178
 
184
179
  bf: function (key, component, preserve) {
185
180
  var fragment = new VFragment(key, component, preserve);
186
- this.bq_(fragment, null, true);
181
+ this.bp_(fragment, null, true);
187
182
  return this;
188
183
  },
189
184
 
@@ -192,7 +187,7 @@ var proto = AsyncVDOMBuilder.prototype = {
192
187
  },
193
188
 
194
189
  endElement: function () {
195
- var stack = this.bn_;
190
+ var stack = this.bm_;
196
191
  stack.pop();
197
192
  this.l_ = stack[stack.length - 1];
198
193
  },
@@ -200,44 +195,44 @@ var proto = AsyncVDOMBuilder.prototype = {
200
195
  end: function () {
201
196
  this.l_ = undefined;
202
197
 
203
- var remaining = --this.bj_;
204
- var parentOut = this.bm_;
198
+ var remaining = --this.bi_;
199
+ var parentOut = this.bl_;
205
200
 
206
201
  if (remaining === 0) {
207
202
  if (parentOut) {
208
- parentOut.bt_();
203
+ parentOut.bs_();
209
204
  } else {
210
- this.bu_();
205
+ this.bt_();
211
206
  }
212
- } else if (remaining - this.bk_ === 0) {
213
- this.bv_();
207
+ } else if (remaining - this.bj_ === 0) {
208
+ this.bu_();
214
209
  }
215
210
 
216
211
  return this;
217
212
  },
218
213
 
219
- bt_: function () {
220
- var remaining = --this.bj_;
214
+ bs_: function () {
215
+ var remaining = --this.bi_;
221
216
 
222
217
  if (remaining === 0) {
223
- var parentOut = this.bm_;
218
+ var parentOut = this.bl_;
224
219
  if (parentOut) {
225
- parentOut.bt_();
220
+ parentOut.bs_();
226
221
  } else {
227
- this.bu_();
222
+ this.bt_();
228
223
  }
229
- } else if (remaining - this.bk_ === 0) {
230
- this.bv_();
224
+ } else if (remaining - this.bj_ === 0) {
225
+ this.bu_();
231
226
  }
232
227
  },
233
228
 
234
- bu_: function () {
229
+ bt_: function () {
235
230
  var state = this.J_;
236
- state.bi_ = true;
237
- state.bg_.emit(EVENT_FINISH, this.aQ_());
231
+ state.bh_ = true;
232
+ state.bf_.emit(EVENT_FINISH, this.aQ_());
238
233
  },
239
234
 
240
- bv_: function () {
235
+ bu_: function () {
241
236
  var lastArray = this._last;
242
237
 
243
238
  var i = 0;
@@ -272,7 +267,7 @@ var proto = AsyncVDOMBuilder.prototype = {
272
267
  },
273
268
 
274
269
  beginAsync: function (options) {
275
- if (this.bo_) {
270
+ if (this.bn_) {
276
271
  throw Error(
277
272
  "Tried to render async while in sync mode. Note: Client side await is not currently supported in re-renders (Issue: #942).");
278
273
 
@@ -282,16 +277,16 @@ var proto = AsyncVDOMBuilder.prototype = {
282
277
 
283
278
  if (options) {
284
279
  if (options.last) {
285
- this.bk_++;
280
+ this.bj_++;
286
281
  }
287
282
  }
288
283
 
289
- this.bj_++;
284
+ this.bi_++;
290
285
 
291
- var documentFragment = this.l_.bw_();
286
+ var documentFragment = this.l_.bv_();
292
287
  var asyncOut = new AsyncVDOMBuilder(this.global, documentFragment, this);
293
288
 
294
- state.bg_.emit("beginAsync", {
289
+ state.bf_.emit("beginAsync", {
295
290
  out: asyncOut,
296
291
  parentOut: this });
297
292
 
@@ -304,7 +299,7 @@ var proto = AsyncVDOMBuilder.prototype = {
304
299
  },
305
300
 
306
301
  flush: function () {
307
- var events = this.J_.bg_;
302
+ var events = this.J_.bf_;
308
303
 
309
304
  if (events.listenerCount(EVENT_UPDATE)) {
310
305
  events.emit(EVENT_UPDATE, new RenderResult(this));
@@ -312,22 +307,22 @@ var proto = AsyncVDOMBuilder.prototype = {
312
307
  },
313
308
 
314
309
  B_: function () {
315
- return this.J_.bh_;
310
+ return this.J_.bg_;
316
311
  },
317
312
 
318
313
  aQ_: function () {
319
- return this.bx_ || (this.bx_ = new RenderResult(this));
314
+ return this.bw_ || (this.bw_ = new RenderResult(this));
320
315
  },
321
316
 
322
317
  on: function (event, callback) {
323
318
  var state = this.J_;
324
319
 
325
- if (event === EVENT_FINISH && state.bi_) {
320
+ if (event === EVENT_FINISH && state.bh_) {
326
321
  callback(this.aQ_());
327
322
  } else if (event === "last") {
328
323
  this.onLast(callback);
329
324
  } else {
330
- state.bg_.on(event, callback);
325
+ state.bf_.on(event, callback);
331
326
  }
332
327
 
333
328
  return this;
@@ -336,19 +331,19 @@ var proto = AsyncVDOMBuilder.prototype = {
336
331
  once: function (event, callback) {
337
332
  var state = this.J_;
338
333
 
339
- if (event === EVENT_FINISH && state.bi_) {
334
+ if (event === EVENT_FINISH && state.bh_) {
340
335
  callback(this.aQ_());
341
336
  } else if (event === "last") {
342
337
  this.onLast(callback);
343
338
  } else {
344
- state.bg_.once(event, callback);
339
+ state.bf_.once(event, callback);
345
340
  }
346
341
 
347
342
  return this;
348
343
  },
349
344
 
350
345
  emit: function (type, arg) {
351
- var events = this.J_.bg_;
346
+ var events = this.J_.bf_;
352
347
  switch (arguments.length) {
353
348
  case 1:
354
349
  events.emit(type);
@@ -364,17 +359,17 @@ var proto = AsyncVDOMBuilder.prototype = {
364
359
  },
365
360
 
366
361
  removeListener: function () {
367
- var events = this.J_.bg_;
362
+ var events = this.J_.bf_;
368
363
  events.removeListener.apply(events, arguments);
369
364
  return this;
370
365
  },
371
366
 
372
367
  sync: function () {
373
- this.bo_ = true;
368
+ this.bn_ = true;
374
369
  },
375
370
 
376
371
  isSync: function () {
377
- return this.bo_;
372
+ return this.bn_;
378
373
  },
379
374
 
380
375
  onLast: function (callback) {
@@ -389,20 +384,20 @@ var proto = AsyncVDOMBuilder.prototype = {
389
384
  return this;
390
385
  },
391
386
 
392
- A_: function (doc) {
393
- var node = this.bp_;
387
+ A_: function (host) {
388
+ var node = this.bo_;
394
389
  if (!node) {
395
390
  var vdomTree = this.B_();
396
- // Create the root document fragment node
397
- doc = doc || this.X_ || document;
398
- this.bp_ = node = vdomTree.by_(doc, null);
399
- morphdom(node, vdomTree, doc, this.b_);
391
+
392
+ if (!host) host = this.X_;
393
+ this.bo_ = node = vdomTree.bx_(host, null);
394
+ morphdom(node, vdomTree, host, this.b_);
400
395
  }
401
396
  return node;
402
397
  },
403
398
 
404
- toString: function (doc) {
405
- var docFragment = this.A_(doc);
399
+ toString: function (host) {
400
+ var docFragment = this.A_(host);
406
401
  var html = "";
407
402
 
408
403
  var child = docFragment.firstChild;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtime/vdom/AsyncVDOMBuilder.js"],"names":["EventEmitter","require","vdom","VElement","VDocumentFragment","VText","VComponent","VFragment","virtualizeHTML","RenderResult","defaultDocument","morphdom","attrsHelper","EVENT_UPDATE","EVENT_FINISH","State","tree","AsyncVDOMBuilder","globalData","parentNode","parentOut","state","data","global","undefined","proto","prototype","bc","component","key","ownerComponent","vComponent","child","childCount","pushToStack","push","element","tagName","attrs","flags","props","componentDef","n","node","clone","text","type","toHTML","h","toString","html","vdomNode","document","beginElement","bf","preserve","fragment","ef","endElement","stack","pop","length","end","remaining","emit","lastArray","_last","i","next","lastCallback","error","e","beginAsync","options","Error","last","documentFragment","asyncOut","out","createOut","flush","events","listenerCount","on","event","callback","onLast","once","arg","arguments","apply","removeListener","sync","isSync","doc","vdomTree","docFragment","firstChild","nextSibling","nodeType","container","ownerDocument","createElement","appendChild","cloneNode","innerHTML","outerHTML","then","fn","fnErr","promise","Promise","resolve","reject","result","catch","isVDOM","c","customEvents","be","ee","t","w","write","module","exports"],"mappings":"aAAA,IAAIA,YAAY,GAAGC,OAAO,CAAC,cAAD,CAA1B;AACA,IAAIC,IAAI,GAAGD,OAAO,CAAC,QAAD,CAAlB;AACA,IAAIE,QAAQ,GAAGD,IAAI,IAAnB;AACA,IAAIE,iBAAiB,GAAGF,IAAI,IAA5B;AACA,IAAIG,KAAK,GAAGH,IAAI,IAAhB;AACA,IAAII,UAAU,GAAGJ,IAAI,IAArB;AACA,IAAIK,SAAS,GAAGL,IAAI,IAApB;AACA,IAAIM,cAAc,GAAGN,IAAI,IAAzB;AACA,IAAIO,YAAY,GAAGR,OAAO,CAAC,iBAAD,CAA1B;AACA,IAAIS,eAAe,GAAGR,IAAI,IAA1B;AACA,IAAIS,QAAQ,GAAGV,OAAO,CAAC,YAAD,CAAtB;AACA,IAAIW,WAAW,GAAGX,OAAO,CAAC,iBAAD,CAAzB;;AAEA,IAAIY,YAAY,GAAG,QAAnB;AACA,IAAIC,YAAY,GAAG,QAAnB;;AAEA,SAASC,KAAT,CAAeC,IAAf,EAAqB;AACnB,aAAiB,IAAIhB,YAAJ,EAAjB;AACA,aAAegB,IAAf;AACA,aAAmB,KAAnB;AACD;;AAED,SAASC,gBAAT,CAA0BC,UAA1B,EAAsCC,UAAtC,EAAkDC,SAAlD,EAA6D;AAC3D,MAAI,CAACD,UAAL,EAAiB;AACfA,IAAAA,UAAU,GAAG,IAAIf,iBAAJ,EAAb;AACD;;AAED,MAAIiB,KAAJ;;AAEA,MAAID,SAAJ,EAAe;AACbC,IAAAA,KAAK,GAAGD,SAAS,GAAjB;AACD,GAFD,MAEO;AACLC,I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AV,EAAmBC,MAAnB,EAA2B;AACnDnC,MAAAA,GAAG,CAACK,EAAJ,CAAO,OAAP,EAAgB8B,MAAhB,EAAwB9B,EAAxB,CAA2BrE,YAA3B,EAAyC,UAAUoG,MAAV,EAAkB;AACzDF,QAAAA,OAAO,CAACE,MAAD,CAAP;AACD,OAFD;AAGD,KAJa,CAAd;;AAMA,WAAOH,OAAO,CAACC,OAAR,CAAgBF,OAAhB,EAAyBH,IAAzB,CAA8BC,EAA9B,EAAkCC,KAAlC,CAAP;AACD,GA3XuC;;AA6XxCM,EAAAA,KAAK,EAAE,UAAUN,KAAV,EAAiB;AACtB,WAAO,KAAKF,IAAL,CAAUnF,SAAV,EAAqBqF,KAArB,CAAP;AACD,GA/XuC;;AAiYxCO,EAAAA,MAAM,EAAE,IAjYgC;;AAmYxCC,EAAAA,CAAC,EAAE,UAAU5E,YAAV,EAAwBZ,GAAxB,EAA6ByF,YAA7B,EAA2C;AAC5C,cAA+B7E,YAA/B;AACA,cAAsBZ,GAAtB;AACA,eAA+ByF,YAA/B;AACD,GAvYuC,EAA1C;;;AA0YA7F,KAAK,CAAC8C,CAAN,GAAU9C,KAAK,CAACW,OAAhB;AACAX,KAAK,CAAC8F,EAAN,GAAW9F,KAAK,CAAC4B,YAAjB;AACA5B,KAAK,CAAC+F,EAAN,GAAW/F,KAAK,IAAL,GAAsBA,KAAK,CAACiC,UAAvC;AACAjC,KAAK,CAACgG,CAAN,GAAUhG,KAAK,CAACoB,IAAhB;AACApB,KAAK,CAACuB,CAAN,GAAUvB,KAAK,CAACiG,CAAN,GAAUjG,KAAK,CAACkG,KAAN,GAAclG,KAAK,CAACyB,IAAxC;;AAEA0E,MAAM,CAACC,OAAP,GAAiB5G,gBAAjB","sourcesContent":["var EventEmitter = require(\"events-light\");\nvar vdom = require(\"./vdom\");\nvar VElement = vdom.___VElement;\nvar VDocumentFragment = vdom.___VDocumentFragment;\nvar VText = vdom.___VText;\nvar VComponent = vdom.___VComponent;\nvar VFragment = vdom.___VFragment;\nvar virtualizeHTML = vdom.___virtualizeHTML;\nvar RenderResult = require(\"../RenderResult\");\nvar defaultDocument = vdom.___defaultDocument;\nvar morphdom = require(\"./morphdom\");\nvar attrsHelper = require(\"./helpers/attrs\");\n\nvar EVENT_UPDATE = \"update\";\nvar EVENT_FINISH = \"finish\";\n\nfunction State(tree) {\n this.___events = new EventEmitter();\n this.___tree = tree;\n this.___finished = false;\n}\n\nfunction AsyncVDOMBuilder(globalData, parentNode, parentOut) {\n if (!parentNode) {\n parentNode = new VDocumentFragment();\n }\n\n var state;\n\n if (parentOut) {\n state = parentOut.___state;\n } else {\n state = new State(parentNode);\n }\n\n this.___remaining = 1;\n this.___lastCount = 0;\n this.___last = null;\n this.___parentOut = parentOut;\n\n this.data = {};\n this.___state = state;\n this.___parent = parentNode;\n this.global = globalData || {};\n this.___stack = [parentNode];\n this.___sync = false;\n this.___vnode = undefined;\n this.___components = null;\n\n this.___assignedComponentDef = null;\n this.___assignedKey = null;\n this.___assignedCustomEvents = null;\n}\n\nvar proto = (AsyncVDOMBuilder.prototype = {\n ___isOut: true,\n ___document: defaultDocument,\n\n bc: function (component, key, ownerComponent) {\n var vComponent = new VComponent(component, key, ownerComponent);\n return this.___beginNode(vComponent, 0, true);\n },\n\n ___preserveComponent: function (component, key, ownerComponent) {\n var vComponent = new VComponent(component, key, ownerComponent, true);\n this.___beginNode(vComponent, 0);\n },\n\n ___beginNode: function (child, childCount, pushToStack) {\n this.___parent.___appendChild(child);\n if (pushToStack === true) {\n this.___stack.push(child);\n this.___parent = child;\n }\n return childCount === 0 ? this : child;\n },\n\n element: function (tagName, attrs, key, component, childCount, flags, props) {\n var element = new VElement(\n tagName,\n attrs,\n key,\n component,\n childCount,\n flags,\n props\n );\n return this.___beginNode(element, childCount);\n },\n\n ___elementDynamic: function (tagName, attrs, key, componentDef, props) {\n return this.element(\n tagName,\n attrsHelper(attrs),\n key,\n componentDef.___component,\n 0,\n 0,\n props\n );\n },\n\n n: function (node, component) {\n // NOTE: We do a shallow clone since we assume the node is being reused\n // and a node can only have one parent node.\n var clone = node.___cloneNode();\n this.node(clone);\n clone.___ownerComponent = component;\n\n return this;\n },\n\n node: function (node) {\n this.___parent.___appendChild(node);\n return this;\n },\n\n text: function (text, ownerComponent) {\n var type = typeof text;\n\n if (type != \"string\") {\n if (text == null) {\n return;\n } else if (type === \"object\") {\n if (text.toHTML) {\n return this.h(text.toHTML(), ownerComponent);\n }\n }\n\n text = text.toString();\n }\n\n this.___parent.___appendChild(new VText(text, ownerComponent));\n return this;\n },\n\n html: function (html, ownerComponent) {\n if (html != null) {\n var vdomNode = virtualizeHTML(\n html,\n this.___document || document,\n ownerComponent\n );\n this.node(vdomNode);\n }\n\n return this;\n },\n\n beginElement: function (\n tagName,\n attrs,\n key,\n component,\n childCount,\n flags,\n props\n ) {\n var element = new VElement(\n tagName,\n attrs,\n key,\n component,\n childCount,\n flags,\n props\n );\n this.___beginNode(element, childCount, true);\n return this;\n },\n\n ___beginElementDynamic: function (tagName, attrs, key, componentDef, props) {\n return this.beginElement(\n tagName,\n attrsHelper(attrs),\n key,\n componentDef.___component,\n 0,\n 0,\n props\n );\n },\n\n bf: function (key, component, preserve) {\n var fragment = new VFragment(key, component, preserve);\n this.___beginNode(fragment, null, true);\n return this;\n },\n\n ef: function () {\n this.endElement();\n },\n\n endElement: function () {\n var stack = this.___stack;\n stack.pop();\n this.___parent = stack[stack.length - 1];\n },\n\n end: function () {\n this.___parent = undefined;\n\n var remaining = --this.___remaining;\n var parentOut = this.___parentOut;\n\n if (remaining === 0) {\n if (parentOut) {\n parentOut.___handleChildDone();\n } else {\n this.___doFinish();\n }\n } else if (remaining - this.___lastCount === 0) {\n this.___emitLast();\n }\n\n return this;\n },\n\n ___handleChildDone: function () {\n var remaining = --this.___remaining;\n\n if (remaining === 0) {\n var parentOut = this.___parentOut;\n if (parentOut) {\n parentOut.___handleChildDone();\n } else {\n this.___doFinish();\n }\n } else if (remaining - this.___lastCount === 0) {\n this.___emitLast();\n }\n },\n\n ___doFinish: function () {\n var state = this.___state;\n state.___finished = true;\n state.___events.emit(EVENT_FINISH, this.___getResult());\n },\n\n ___emitLast: function () {\n var lastArray = this._last;\n\n var i = 0;\n\n function next() {\n if (i === lastArray.length) {\n return;\n }\n var lastCallback = lastArray[i++];\n lastCallback(next);\n\n if (!lastCallback.length) {\n next();\n }\n }\n\n next();\n },\n\n error: function (e) {\n try {\n this.emit(\"error\", e);\n } finally {\n // If there is no listener for the error event then it will\n // throw a new Error here. In order to ensure that the async fragment\n // is still properly ended we need to put the end() in a `finally`\n // block\n this.end();\n }\n\n return this;\n },\n\n beginAsync: function (options) {\n if (this.___sync) {\n throw Error(\n \"Tried to render async while in sync mode. Note: Client side await is not currently supported in re-renders (Issue: #942).\"\n );\n }\n\n var state = this.___state;\n\n if (options) {\n if (options.last) {\n this.___lastCount++;\n }\n }\n\n this.___remaining++;\n\n var documentFragment = this.___parent.___appendDocumentFragment();\n var asyncOut = new AsyncVDOMBuilder(this.global, documentFragment, this);\n\n state.___events.emit(\"beginAsync\", {\n out: asyncOut,\n parentOut: this\n });\n\n return asyncOut;\n },\n\n createOut: function () {\n return new AsyncVDOMBuilder(this.global);\n },\n\n flush: function () {\n var events = this.___state.___events;\n\n if (events.listenerCount(EVENT_UPDATE)) {\n events.emit(EVENT_UPDATE, new RenderResult(this));\n }\n },\n\n ___getOutput: function () {\n return this.___state.___tree;\n },\n\n ___getResult: function () {\n return this.___result || (this.___result = new RenderResult(this));\n },\n\n on: function (event, callback) {\n var state = this.___state;\n\n if (event === EVENT_FINISH && state.___finished) {\n callback(this.___getResult());\n } else if (event === \"last\") {\n this.onLast(callback);\n } else {\n state.___events.on(event, callback);\n }\n\n return this;\n },\n\n once: function (event, callback) {\n var state = this.___state;\n\n if (event === EVENT_FINISH && state.___finished) {\n callback(this.___getResult());\n } else if (event === \"last\") {\n this.onLast(callback);\n } else {\n state.___events.once(event, callback);\n }\n\n return this;\n },\n\n emit: function (type, arg) {\n var events = this.___state.___events;\n switch (arguments.length) {\n case 1:\n events.emit(type);\n break;\n case 2:\n events.emit(type, arg);\n break;\n default:\n events.emit.apply(events, arguments);\n break;\n }\n return this;\n },\n\n removeListener: function () {\n var events = this.___state.___events;\n events.removeListener.apply(events, arguments);\n return this;\n },\n\n sync: function () {\n this.___sync = true;\n },\n\n isSync: function () {\n return this.___sync;\n },\n\n onLast: function (callback) {\n var lastArray = this._last;\n\n if (lastArray === undefined) {\n this._last = [callback];\n } else {\n lastArray.push(callback);\n }\n\n return this;\n },\n\n ___getNode: function (doc) {\n var node = this.___vnode;\n if (!node) {\n var vdomTree = this.___getOutput();\n // Create the root document fragment node\n doc = doc || this.___document || document;\n this.___vnode = node = vdomTree.___actualize(doc, null);\n morphdom(node, vdomTree, doc, this.___components);\n }\n return node;\n },\n\n toString: function (doc) {\n var docFragment = this.___getNode(doc);\n var html = \"\";\n\n var child = docFragment.firstChild;\n while (child) {\n var nextSibling = child.nextSibling;\n if (child.nodeType != 1) {\n var container = docFragment.ownerDocument.createElement(\"div\");\n container.appendChild(child.cloneNode());\n html += container.innerHTML;\n } else {\n html += child.outerHTML;\n }\n\n child = nextSibling;\n }\n\n return html;\n },\n\n then: function (fn, fnErr) {\n var out = this;\n var promise = new Promise(function (resolve, reject) {\n out.on(\"error\", reject).on(EVENT_FINISH, function (result) {\n resolve(result);\n });\n });\n\n return Promise.resolve(promise).then(fn, fnErr);\n },\n\n catch: function (fnErr) {\n return this.then(undefined, fnErr);\n },\n\n isVDOM: true,\n\n c: function (componentDef, key, customEvents) {\n this.___assignedComponentDef = componentDef;\n this.___assignedKey = key;\n this.___assignedCustomEvents = customEvents;\n }\n});\n\nproto.e = proto.element;\nproto.be = proto.beginElement;\nproto.ee = proto.___endElement = proto.endElement;\nproto.t = proto.text;\nproto.h = proto.w = proto.write = proto.html;\n\nmodule.exports = AsyncVDOMBuilder;\n"],"file":"AsyncVDOMBuilder.js"}
1
+ {"version":3,"sources":["../../../src/runtime/vdom/AsyncVDOMBuilder.js"],"names":["EventEmitter","require","vdom","VElement","VDocumentFragment","VText","VComponent","VFragment","virtualizeHTML","RenderResult","morphdom","attrsHelper","EVENT_UPDATE","EVENT_FINISH","State","tree","AsyncVDOMBuilder","globalData","parentNode","parentOut","state","data","global","undefined","proto","prototype","window","document","bc","component","key","ownerComponent","vComponent","child","childCount","pushToStack","push","element","tagName","attrs","flags","props","componentDef","n","node","clone","text","type","toHTML","h","toString","html","vdomNode","beginElement","bf","preserve","fragment","ef","endElement","stack","pop","length","end","remaining","emit","lastArray","_last","i","next","lastCallback","error","e","beginAsync","options","Error","last","documentFragment","asyncOut","out","createOut","flush","events","listenerCount","on","event","callback","onLast","once","arg","arguments","apply","removeListener","sync","isSync","host","vdomTree","docFragment","firstChild","nextSibling","nodeType","container","ownerDocument","createElement","appendChild","cloneNode","innerHTML","outerHTML","then","fn","fnErr","promise","Promise","resolve","reject","result","catch","isVDOM","c","customEvents","be","ee","t","w","write","module","exports"],"mappings":"aAAA,IAAIA,YAAY,GAAGC,OAAO,CAAC,cAAD,CAA1B;AACA,IAAIC,IAAI,GAAGD,OAAO,CAAC,QAAD,CAAlB;AACA,IAAIE,QAAQ,GAAGD,IAAI,IAAnB;AACA,IAAIE,iBAAiB,GAAGF,IAAI,IAA5B;AACA,IAAIG,KAAK,GAAGH,IAAI,IAAhB;AACA,IAAII,UAAU,GAAGJ,IAAI,IAArB;AACA,IAAIK,SAAS,GAAGL,IAAI,IAApB;AACA,IAAIM,cAAc,GAAGN,IAAI,IAAzB;AACA,IAAIO,YAAY,GAAGR,OAAO,CAAC,iBAAD,CAA1B;AACA,IAAIS,QAAQ,GAAGT,OAAO,CAAC,YAAD,CAAtB;AACA,IAAIU,WAAW,GAAGV,OAAO,CAAC,iBAAD,CAAzB;;AAEA,IAAIW,YAAY,GAAG,QAAnB;AACA,IAAIC,YAAY,GAAG,QAAnB;;AAEA,SAASC,KAAT,CAAeC,IAAf,EAAqB;AACnB,aAAiB,IAAIf,YAA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yB,CAAN,GAAUzB,KAAK,CAACkG,CAAN,GAAUlG,KAAK,CAACmG,KAAN,GAAcnG,KAAK,CAAC2B,IAAxC;;AAEAyE,MAAM,CAACC,OAAP,GAAiB7G,gBAAjB","sourcesContent":["var EventEmitter = require(\"events-light\");\nvar vdom = require(\"./vdom\");\nvar VElement = vdom.___VElement;\nvar VDocumentFragment = vdom.___VDocumentFragment;\nvar VText = vdom.___VText;\nvar VComponent = vdom.___VComponent;\nvar VFragment = vdom.___VFragment;\nvar virtualizeHTML = vdom.___virtualizeHTML;\nvar RenderResult = require(\"../RenderResult\");\nvar morphdom = require(\"./morphdom\");\nvar attrsHelper = require(\"./helpers/attrs\");\n\nvar EVENT_UPDATE = \"update\";\nvar EVENT_FINISH = \"finish\";\n\nfunction State(tree) {\n this.___events = new EventEmitter();\n this.___tree = tree;\n this.___finished = false;\n}\n\nfunction AsyncVDOMBuilder(globalData, parentNode, parentOut) {\n if (!parentNode) {\n parentNode = new VDocumentFragment();\n }\n\n var state;\n\n if (parentOut) {\n state = parentOut.___state;\n } else {\n state = new State(parentNode);\n }\n\n this.___remaining = 1;\n this.___lastCount = 0;\n this.___last = null;\n this.___parentOut = parentOut;\n\n this.data = {};\n this.___state = state;\n this.___parent = parentNode;\n this.global = globalData || {};\n this.___stack = [parentNode];\n this.___sync = false;\n this.___vnode = undefined;\n this.___components = null;\n\n this.___assignedComponentDef = null;\n this.___assignedKey = null;\n this.___assignedCustomEvents = null;\n}\n\nvar proto = (AsyncVDOMBuilder.prototype = {\n ___isOut: true,\n ___host: typeof window === \"object\" && document,\n\n bc: function (component, key, ownerComponent) {\n var vComponent = new VComponent(component, key, ownerComponent);\n return this.___beginNode(vComponent, 0, true);\n },\n\n ___preserveComponent: function (component, key, ownerComponent) {\n var vComponent = new VComponent(component, key, ownerComponent, true);\n this.___beginNode(vComponent, 0);\n },\n\n ___beginNode: function (child, childCount, pushToStack) {\n this.___parent.___appendChild(child);\n if (pushToStack === true) {\n this.___stack.push(child);\n this.___parent = child;\n }\n return childCount === 0 ? this : child;\n },\n\n element: function (tagName, attrs, key, component, childCount, flags, props) {\n var element = new VElement(\n tagName,\n attrs,\n key,\n component,\n childCount,\n flags,\n props\n );\n return this.___beginNode(element, childCount);\n },\n\n ___elementDynamic: function (tagName, attrs, key, componentDef, props) {\n return this.element(\n tagName,\n attrsHelper(attrs),\n key,\n componentDef.___component,\n 0,\n 0,\n props\n );\n },\n\n n: function (node, component) {\n // NOTE: We do a shallow clone since we assume the node is being reused\n // and a node can only have one parent node.\n var clone = node.___cloneNode();\n this.node(clone);\n clone.___ownerComponent = component;\n\n return this;\n },\n\n node: function (node) {\n this.___parent.___appendChild(node);\n return this;\n },\n\n text: function (text, ownerComponent) {\n var type = typeof text;\n\n if (type != \"string\") {\n if (text == null) {\n return;\n } else if (type === \"object\") {\n if (text.toHTML) {\n return this.h(text.toHTML(), ownerComponent);\n }\n }\n\n text = text.toString();\n }\n\n this.___parent.___appendChild(new VText(text, ownerComponent));\n return this;\n },\n\n html: function (html, ownerComponent) {\n if (html != null) {\n var vdomNode = virtualizeHTML(html, ownerComponent);\n this.node(vdomNode);\n }\n\n return this;\n },\n\n beginElement: function (\n tagName,\n attrs,\n key,\n component,\n childCount,\n flags,\n props\n ) {\n var element = new VElement(\n tagName,\n attrs,\n key,\n component,\n childCount,\n flags,\n props\n );\n this.___beginNode(element, childCount, true);\n return this;\n },\n\n ___beginElementDynamic: function (tagName, attrs, key, componentDef, props) {\n return this.beginElement(\n tagName,\n attrsHelper(attrs),\n key,\n componentDef.___component,\n 0,\n 0,\n props\n );\n },\n\n bf: function (key, component, preserve) {\n var fragment = new VFragment(key, component, preserve);\n this.___beginNode(fragment, null, true);\n return this;\n },\n\n ef: function () {\n this.endElement();\n },\n\n endElement: function () {\n var stack = this.___stack;\n stack.pop();\n this.___parent = stack[stack.length - 1];\n },\n\n end: function () {\n this.___parent = undefined;\n\n var remaining = --this.___remaining;\n var parentOut = this.___parentOut;\n\n if (remaining === 0) {\n if (parentOut) {\n parentOut.___handleChildDone();\n } else {\n this.___doFinish();\n }\n } else if (remaining - this.___lastCount === 0) {\n this.___emitLast();\n }\n\n return this;\n },\n\n ___handleChildDone: function () {\n var remaining = --this.___remaining;\n\n if (remaining === 0) {\n var parentOut = this.___parentOut;\n if (parentOut) {\n parentOut.___handleChildDone();\n } else {\n this.___doFinish();\n }\n } else if (remaining - this.___lastCount === 0) {\n this.___emitLast();\n }\n },\n\n ___doFinish: function () {\n var state = this.___state;\n state.___finished = true;\n state.___events.emit(EVENT_FINISH, this.___getResult());\n },\n\n ___emitLast: function () {\n var lastArray = this._last;\n\n var i = 0;\n\n function next() {\n if (i === lastArray.length) {\n return;\n }\n var lastCallback = lastArray[i++];\n lastCallback(next);\n\n if (!lastCallback.length) {\n next();\n }\n }\n\n next();\n },\n\n error: function (e) {\n try {\n this.emit(\"error\", e);\n } finally {\n // If there is no listener for the error event then it will\n // throw a new Error here. In order to ensure that the async fragment\n // is still properly ended we need to put the end() in a `finally`\n // block\n this.end();\n }\n\n return this;\n },\n\n beginAsync: function (options) {\n if (this.___sync) {\n throw Error(\n \"Tried to render async while in sync mode. Note: Client side await is not currently supported in re-renders (Issue: #942).\"\n );\n }\n\n var state = this.___state;\n\n if (options) {\n if (options.last) {\n this.___lastCount++;\n }\n }\n\n this.___remaining++;\n\n var documentFragment = this.___parent.___appendDocumentFragment();\n var asyncOut = new AsyncVDOMBuilder(this.global, documentFragment, this);\n\n state.___events.emit(\"beginAsync\", {\n out: asyncOut,\n parentOut: this\n });\n\n return asyncOut;\n },\n\n createOut: function () {\n return new AsyncVDOMBuilder(this.global);\n },\n\n flush: function () {\n var events = this.___state.___events;\n\n if (events.listenerCount(EVENT_UPDATE)) {\n events.emit(EVENT_UPDATE, new RenderResult(this));\n }\n },\n\n ___getOutput: function () {\n return this.___state.___tree;\n },\n\n ___getResult: function () {\n return this.___result || (this.___result = new RenderResult(this));\n },\n\n on: function (event, callback) {\n var state = this.___state;\n\n if (event === EVENT_FINISH && state.___finished) {\n callback(this.___getResult());\n } else if (event === \"last\") {\n this.onLast(callback);\n } else {\n state.___events.on(event, callback);\n }\n\n return this;\n },\n\n once: function (event, callback) {\n var state = this.___state;\n\n if (event === EVENT_FINISH && state.___finished) {\n callback(this.___getResult());\n } else if (event === \"last\") {\n this.onLast(callback);\n } else {\n state.___events.once(event, callback);\n }\n\n return this;\n },\n\n emit: function (type, arg) {\n var events = this.___state.___events;\n switch (arguments.length) {\n case 1:\n events.emit(type);\n break;\n case 2:\n events.emit(type, arg);\n break;\n default:\n events.emit.apply(events, arguments);\n break;\n }\n return this;\n },\n\n removeListener: function () {\n var events = this.___state.___events;\n events.removeListener.apply(events, arguments);\n return this;\n },\n\n sync: function () {\n this.___sync = true;\n },\n\n isSync: function () {\n return this.___sync;\n },\n\n onLast: function (callback) {\n var lastArray = this._last;\n\n if (lastArray === undefined) {\n this._last = [callback];\n } else {\n lastArray.push(callback);\n }\n\n return this;\n },\n\n ___getNode: function (host) {\n var node = this.___vnode;\n if (!node) {\n var vdomTree = this.___getOutput();\n\n if (!host) host = this.___host;\n this.___vnode = node = vdomTree.___actualize(host, null);\n morphdom(node, vdomTree, host, this.___components);\n }\n return node;\n },\n\n toString: function (host) {\n var docFragment = this.___getNode(host);\n var html = \"\";\n\n var child = docFragment.firstChild;\n while (child) {\n var nextSibling = child.nextSibling;\n if (child.nodeType != 1) {\n var container = docFragment.ownerDocument.createElement(\"div\");\n container.appendChild(child.cloneNode());\n html += container.innerHTML;\n } else {\n html += child.outerHTML;\n }\n\n child = nextSibling;\n }\n\n return html;\n },\n\n then: function (fn, fnErr) {\n var out = this;\n var promise = new Promise(function (resolve, reject) {\n out.on(\"error\", reject).on(EVENT_FINISH, function (result) {\n resolve(result);\n });\n });\n\n return Promise.resolve(promise).then(fn, fnErr);\n },\n\n catch: function (fnErr) {\n return this.then(undefined, fnErr);\n },\n\n isVDOM: true,\n\n c: function (componentDef, key, customEvents) {\n this.___assignedComponentDef = componentDef;\n this.___assignedKey = key;\n this.___assignedCustomEvents = customEvents;\n }\n});\n\nproto.e = proto.element;\nproto.be = proto.beginElement;\nproto.ee = proto.___endElement = proto.endElement;\nproto.t = proto.text;\nproto.h = proto.w = proto.write = proto.html;\n\nmodule.exports = AsyncVDOMBuilder;\n"],"file":"AsyncVDOMBuilder.js"}
@@ -2,14 +2,14 @@
2
2
  var inherit = require("raptor-util/inherit");
3
3
 
4
4
  function VComponent(component, key, ownerComponent, preserve) {
5
- this.bz_(null /* childCount */, ownerComponent);
6
- this.bA_ = key;
5
+ this.by_(null /* childCount */, ownerComponent);
6
+ this.bz_ = key;
7
7
  this.h_ = component;
8
8
  this.n_ = preserve;
9
9
  }
10
10
 
11
11
  VComponent.prototype = {
12
- bB_: 2 };
12
+ bA_: 2 };
13
13
 
14
14
 
15
15
  inherit(VComponent, VNode);
@@ -4,26 +4,26 @@ var extend = require("raptor-util/extend");
4
4
 
5
5
  function VDocumentFragmentClone(other) {
6
6
  extend(this, other);
7
+ this.bB_ = null;
7
8
  this.bC_ = null;
8
- this.bD_ = null;
9
9
  }
10
10
 
11
11
  function VDocumentFragment(out) {
12
- this.bz_(null /* childCount */);
12
+ this.by_(null /* childCount */);
13
13
  this.y_ = out;
14
14
  }
15
15
 
16
16
  VDocumentFragment.prototype = {
17
- bB_: 11,
17
+ bA_: 11,
18
18
 
19
- bE_: true,
19
+ bD_: true,
20
20
 
21
- bs_: function () {
21
+ br_: function () {
22
22
  return new VDocumentFragmentClone(this);
23
23
  },
24
24
 
25
- by_: function (doc) {
26
- return doc.createDocumentFragment();
25
+ bx_: function (host) {
26
+ return (host.ownerDocument || host).createDocumentFragment();
27
27
  } };
28
28
 
29
29
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/runtime/vdom/VDocumentFragment.js"],"names":["VNode","require","inherit","extend","VDocumentFragmentClone","other","VDocumentFragment","out","prototype","doc","createDocumentFragment","module","exports"],"mappings":"aAAA,IAAIA,KAAK,GAAGC,OAAO,CAAC,SAAD,CAAnB;AACA,IAAIC,OAAO,GAAGD,OAAO,CAAC,qBAAD,CAArB;AACA,IAAIE,MAAM,GAAGF,OAAO,CAAC,oBAAD,CAApB;;AAEA,SAASG,sBAAT,CAAgCC,KAAhC,EAAuC;AACrCF,EAAAA,MAAM,CAAC,IAAD,EAAOE,KAAP,CAAN;AACA,aAAqB,IAArB;AACA,aAA8B,IAA9B;AACD;;AAED,SAASC,iBAAT,CAA2BC,GAA3B,EAAgC;AAC9B,WAAc,IAAd,CAAmB,gBAAnB;AACA,YAAcA,GAAd;AACD;;AAEDD,iBAAiB,CAACE,SAAlB,GAA8B;AAC5B,OAAa,EADe;;AAG5B,OAAqB,IAHO;;AAK5B,OAAc,YAAY;AACxB,WAAO,IAAIJ,sBAAJ,CAA2B,IAA3B,CAAP;AACD,GAP2B;;AAS5B,OAAc,UAAUK,GAAV,EAAe;AAC3B,WAAOA,GAAG,CAACC,sBAAJ,EAAP;AACD,GAX2B,EAA9B;;;AAcAR,OAAO,CAACI,iBAAD,EAAoBN,KAApB,CAAP;;AAEAI,sBAAsB,CAACI,SAAvB,GAAmCF,iBAAiB,CAACE,SAArD;;AAEAG,MAAM,CAACC,OAAP,GAAiBN,iBAAjB","sourcesContent":["var VNode = require(\"./VNode\");\nvar inherit = require(\"raptor-util/inherit\");\nvar extend = require(\"raptor-util/extend\");\n\nfunction VDocumentFragmentClone(other) {\n extend(this, other);\n this.___parentNode = null;\n this.___nextSiblingInternal = null;\n}\n\nfunction VDocumentFragment(out) {\n this.___VNode(null /* childCount */);\n this.___out = out;\n}\n\nVDocumentFragment.prototype = {\n ___nodeType: 11,\n\n ___DocumentFragment: true,\n\n ___cloneNode: function () {\n return new VDocumentFragmentClone(this);\n },\n\n ___actualize: function (doc) {\n return doc.createDocumentFragment();\n }\n};\n\ninherit(VDocumentFragment, VNode);\n\nVDocumentFragmentClone.prototype = VDocumentFragment.prototype;\n\nmodule.exports = VDocumentFragment;\n"],"file":"VDocumentFragment.js"}
1
+ {"version":3,"sources":["../../../src/runtime/vdom/VDocumentFragment.js"],"names":["VNode","require","inherit","extend","VDocumentFragmentClone","other","VDocumentFragment","out","prototype","host","ownerDocument","createDocumentFragment","module","exports"],"mappings":"aAAA,IAAIA,KAAK,GAAGC,OAAO,CAAC,SAAD,CAAnB;AACA,IAAIC,OAAO,GAAGD,OAAO,CAAC,qBAAD,CAArB;AACA,IAAIE,MAAM,GAAGF,OAAO,CAAC,oBAAD,CAApB;;AAEA,SAASG,sBAAT,CAAgCC,KAAhC,EAAuC;AACrCF,EAAAA,MAAM,CAAC,IAAD,EAAOE,KAAP,CAAN;AACA,aAAqB,IAArB;AACA,aAA8B,IAA9B;AACD;;AAED,SAASC,iBAAT,CAA2BC,GAA3B,EAAgC;AAC9B,WAAc,IAAd,CAAmB,gBAAnB;AACA,YAAcA,GAAd;AACD;;AAEDD,iBAAiB,CAACE,SAAlB,GAA8B;AAC5B,OAAa,EADe;;AAG5B,OAAqB,IAHO;;AAK5B,OAAc,YAAY;AACxB,WAAO,IAAIJ,sBAAJ,CAA2B,IAA3B,CAAP;AACD,GAP2B;;AAS5B,OAAc,UAAUK,IAAV,EAAgB;AAC5B,WAAO,CAACA,IAAI,CAACC,aAAL,IAAsBD,IAAvB,EAA6BE,sBAA7B,EAAP;AACD,GAX2B,EAA9B;;;AAcAT,OAAO,CAACI,iBAAD,EAAoBN,KAApB,CAAP;;AAEAI,sBAAsB,CAACI,SAAvB,GAAmCF,iBAAiB,CAACE,SAArD;;AAEAI,MAAM,CAACC,OAAP,GAAiBP,iBAAjB","sourcesContent":["var VNode = require(\"./VNode\");\nvar inherit = require(\"raptor-util/inherit\");\nvar extend = require(\"raptor-util/extend\");\n\nfunction VDocumentFragmentClone(other) {\n extend(this, other);\n this.___parentNode = null;\n this.___nextSiblingInternal = null;\n}\n\nfunction VDocumentFragment(out) {\n this.___VNode(null /* childCount */);\n this.___out = out;\n}\n\nVDocumentFragment.prototype = {\n ___nodeType: 11,\n\n ___DocumentFragment: true,\n\n ___cloneNode: function () {\n return new VDocumentFragmentClone(this);\n },\n\n ___actualize: function (host) {\n return (host.ownerDocument || host).createDocumentFragment();\n }\n};\n\ninherit(VDocumentFragment, VNode);\n\nVDocumentFragmentClone.prototype = VDocumentFragment.prototype;\n\nmodule.exports = VDocumentFragment;\n"],"file":"VDocumentFragment.js"}