marko 5.16.1 → 5.17.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/runtime/RenderResult.js +13 -11
- package/dist/runtime/RenderResult.js.map +1 -1
- package/dist/runtime/components/Component.js +2 -2
- package/dist/runtime/components/Component.js.map +1 -1
- package/dist/runtime/components/ComponentsContext.js +2 -2
- package/dist/runtime/components/ComponentsContext.js.map +1 -1
- package/dist/runtime/components/event-delegation.js +8 -8
- package/dist/runtime/components/event-delegation.js.map +1 -1
- package/dist/runtime/components/init-components/index-browser.js +22 -24
- package/dist/runtime/components/init-components/index-browser.js.map +1 -1
- package/dist/runtime/components/registry/index-browser.js +2 -2
- package/dist/runtime/components/registry/index-browser.js.map +1 -1
- package/dist/runtime/components/util/index-browser.js +4 -3
- package/dist/runtime/components/util/index-browser.js.map +1 -1
- package/dist/runtime/html/AsyncStream.js +8 -10
- package/dist/runtime/html/AsyncStream.js.map +1 -1
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +65 -70
- package/dist/runtime/vdom/AsyncVDOMBuilder.js.map +1 -1
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +7 -7
- package/dist/runtime/vdom/VDocumentFragment.js.map +1 -1
- package/dist/runtime/vdom/VElement.js +42 -39
- package/dist/runtime/vdom/VElement.js.map +1 -1
- package/dist/runtime/vdom/VFragment.js +5 -5
- package/dist/runtime/vdom/VNode.js +31 -31
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/VText.js.map +1 -1
- package/dist/runtime/vdom/hot-reload.js +5 -5
- package/dist/runtime/vdom/hot-reload.js.map +1 -1
- package/dist/runtime/vdom/morphdom/fragment.js +3 -3
- package/dist/runtime/vdom/morphdom/helpers.js +1 -1
- package/dist/runtime/vdom/morphdom/index.js +30 -30
- package/dist/runtime/vdom/morphdom/index.js.map +1 -1
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +6 -6
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +10 -12
- package/dist/runtime/vdom/vdom.js.map +1 -1
- package/package.json +4 -4
- package/src/runtime/RenderResult.js +13 -11
- package/src/runtime/components/Component.js +5 -5
- package/src/runtime/components/ComponentsContext.js +2 -2
- package/src/runtime/components/event-delegation.js +6 -6
- package/src/runtime/components/init-components/index-browser.js +23 -25
- package/src/runtime/components/registry/index-browser.js +3 -3
- package/src/runtime/components/util/index-browser.js +8 -7
- package/src/runtime/html/AsyncStream.js +8 -10
- package/src/runtime/vdom/AsyncVDOMBuilder.js +9 -14
- package/src/runtime/vdom/VDocumentFragment.js +2 -2
- package/src/runtime/vdom/VElement.js +5 -2
- package/src/runtime/vdom/VText.js +2 -2
- package/src/runtime/vdom/hot-reload.js +1 -1
- package/src/runtime/vdom/morphdom/index.js +4 -4
- package/src/runtime/vdom/vdom.js +2 -4
@@ -63,17 +63,17 @@ function removeAttribute(el, namespaceURI, name) {
|
|
63
63
|
}
|
64
64
|
|
65
65
|
function VElementClone(other) {
|
66
|
-
this.
|
66
|
+
this.bE_ = other.bE_;
|
67
|
+
this.bB_ = null;
|
67
68
|
this.bC_ = null;
|
68
|
-
this.bD_ = null;
|
69
69
|
|
70
|
-
this.
|
71
|
-
this.
|
70
|
+
this.bz_ = other.bz_;
|
71
|
+
this.bF_ = other.bF_;
|
72
72
|
this.aB_ = other.aB_;
|
73
|
-
this.
|
73
|
+
this.bG_ = other.bG_;
|
74
74
|
this._I_ = other._I_;
|
75
|
+
this.bH_ = other.bH_;
|
75
76
|
this.bI_ = other.bI_;
|
76
|
-
this.bJ_ = other.bJ_;
|
77
77
|
}
|
78
78
|
|
79
79
|
function VElement(
|
@@ -85,7 +85,7 @@ childCount,
|
|
85
85
|
flags,
|
86
86
|
props)
|
87
87
|
{
|
88
|
-
this.
|
88
|
+
this.by_(childCount, ownerComponent);
|
89
89
|
|
90
90
|
var constId;
|
91
91
|
|
@@ -93,21 +93,21 @@ props)
|
|
93
93
|
constId = props.i;
|
94
94
|
}
|
95
95
|
|
96
|
-
this.
|
96
|
+
this.bz_ = key;
|
97
97
|
this._I_ = flags || 0;
|
98
|
-
this.
|
98
|
+
this.bF_ = attrs || EMPTY_OBJECT;
|
99
99
|
this.aB_ = props || EMPTY_OBJECT;
|
100
|
-
this.
|
101
|
-
this.
|
102
|
-
this.
|
100
|
+
this.bG_ = tagName;
|
101
|
+
this.bH_ = null;
|
102
|
+
this.bI_ = constId;
|
103
103
|
this.n_ = false;
|
104
104
|
this.m_ = false;
|
105
105
|
}
|
106
106
|
|
107
107
|
VElement.prototype = {
|
108
|
-
|
108
|
+
bA_: 1,
|
109
109
|
|
110
|
-
|
110
|
+
br_: function () {
|
111
111
|
return new VElementClone(this);
|
112
112
|
},
|
113
113
|
|
@@ -119,7 +119,7 @@ VElement.prototype = {
|
|
119
119
|
* @param {int|null} childCount The number of child nodes (or `null` if not known)
|
120
120
|
*/
|
121
121
|
e: function (tagName, attrs, key, ownerComponent, childCount, flags, props) {
|
122
|
-
var child = this.
|
122
|
+
var child = this.bq_(
|
123
123
|
new VElement(
|
124
124
|
tagName,
|
125
125
|
attrs,
|
@@ -132,7 +132,7 @@ VElement.prototype = {
|
|
132
132
|
|
133
133
|
|
134
134
|
if (childCount === 0) {
|
135
|
-
return this.
|
135
|
+
return this.bJ_();
|
136
136
|
} else {
|
137
137
|
return child;
|
138
138
|
}
|
@@ -145,19 +145,22 @@ VElement.prototype = {
|
|
145
145
|
* @param {String} value The value for the new Comment node
|
146
146
|
*/
|
147
147
|
n: function (node, ownerComponent) {
|
148
|
-
node = node.
|
148
|
+
node = node.br_();
|
149
149
|
node.aA_ = ownerComponent;
|
150
|
-
this.
|
151
|
-
return this.
|
150
|
+
this.bq_(node);
|
151
|
+
return this.bJ_();
|
152
152
|
},
|
153
153
|
|
154
|
-
|
155
|
-
var tagName = this.
|
156
|
-
var attributes = this.
|
154
|
+
bx_: function (host, parentNamespaceURI) {
|
155
|
+
var tagName = this.bG_;
|
156
|
+
var attributes = this.bF_;
|
157
157
|
var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;
|
158
158
|
|
159
159
|
var flags = this._I_;
|
160
|
-
var el =
|
160
|
+
var el = (host.ownerDocument || host).createElementNS(
|
161
|
+
namespaceURI,
|
162
|
+
tagName);
|
163
|
+
|
161
164
|
|
162
165
|
if (flags & FLAG_CUSTOM_ELEMENT) {
|
163
166
|
assign(el, attributes);
|
@@ -192,11 +195,11 @@ VElement.prototype = {
|
|
192
195
|
return el;
|
193
196
|
},
|
194
197
|
|
195
|
-
|
198
|
+
bK_: function (name) {
|
196
199
|
// We don't care about the namespaces since the there
|
197
200
|
// is no chance that attributes with the same name will have
|
198
201
|
// different namespaces
|
199
|
-
var value = this.
|
202
|
+
var value = this.bF_[name];
|
200
203
|
return value != null && value !== false;
|
201
204
|
} };
|
202
205
|
|
@@ -208,7 +211,7 @@ var proto = VElementClone.prototype = VElement.prototype;
|
|
208
211
|
["checked", "selected", "disabled"].forEach(function (name) {
|
209
212
|
defineProperty(proto, name, {
|
210
213
|
get: function () {
|
211
|
-
var value = this.
|
214
|
+
var value = this.bF_[name];
|
212
215
|
return value !== false && value != null;
|
213
216
|
} });
|
214
217
|
|
@@ -216,20 +219,20 @@ var proto = VElementClone.prototype = VElement.prototype;
|
|
216
219
|
|
217
220
|
defineProperty(proto, "q_", {
|
218
221
|
get: function () {
|
219
|
-
var value = this.
|
222
|
+
var value = this.bH_;
|
220
223
|
if (value == null) {
|
221
|
-
value = this.
|
224
|
+
value = this.bF_.value;
|
222
225
|
}
|
223
226
|
return value != null && value !== false ?
|
224
227
|
value + "" :
|
225
|
-
this.
|
226
|
-
this.
|
228
|
+
this.bF_.type === "checkbox" ||
|
229
|
+
this.bF_.type === "radio" ?
|
227
230
|
"on" :
|
228
231
|
"";
|
229
232
|
} });
|
230
233
|
|
231
234
|
|
232
|
-
VElement.
|
235
|
+
VElement.bL_ = function (attrs) {
|
233
236
|
// By default this static method is a no-op, but if there are any
|
234
237
|
// compiled components that have "no-update" attributes then
|
235
238
|
// `preserve-attrs.js` will be imported and this method will be replaced
|
@@ -277,8 +280,8 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
277
280
|
props);
|
278
281
|
|
279
282
|
|
280
|
-
if (vdomEl.
|
281
|
-
vdomEl.
|
283
|
+
if (vdomEl.bG_ === "textarea") {
|
284
|
+
vdomEl.bH_ = node.value;
|
282
285
|
} else if (virtualizeChildNodes) {
|
283
286
|
virtualizeChildNodes(node, vdomEl, ownerComponent);
|
284
287
|
}
|
@@ -286,17 +289,17 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
286
289
|
return vdomEl;
|
287
290
|
}
|
288
291
|
|
289
|
-
VElement.
|
292
|
+
VElement.bM_ = virtualizeElement;
|
290
293
|
|
291
|
-
VElement.
|
292
|
-
var removePreservedAttributes = VElement.
|
294
|
+
VElement.bN_ = function (fromEl, vFromEl, toEl) {
|
295
|
+
var removePreservedAttributes = VElement.bL_;
|
293
296
|
|
294
297
|
var fromFlags = vFromEl._I_;
|
295
298
|
var toFlags = toEl._I_;
|
296
299
|
|
297
300
|
vElementByDOMNode.set(fromEl, toEl);
|
298
301
|
|
299
|
-
var attrs = toEl.
|
302
|
+
var attrs = toEl.bF_;
|
300
303
|
var props = toEl.aB_;
|
301
304
|
|
302
305
|
if (toFlags & FLAG_CUSTOM_ELEMENT) {
|
@@ -313,7 +316,7 @@ VElement.bO_ = function (fromEl, vFromEl, toEl) {
|
|
313
316
|
// real VElement node will not have the expando property
|
314
317
|
// so we build the attribute map from the expando property
|
315
318
|
|
316
|
-
var oldAttrs = vFromEl.
|
319
|
+
var oldAttrs = vFromEl.bF_;
|
317
320
|
|
318
321
|
if (oldAttrs) {
|
319
322
|
if (oldAttrs === attrs) {
|
@@ -385,7 +388,7 @@ VElement.bO_ = function (fromEl, vFromEl, toEl) {
|
|
385
388
|
// was not a virtualized node (i.e., a node that was not rendered by a
|
386
389
|
// Marko template, but rather a node that was created from an HTML
|
387
390
|
// string or a real DOM node).
|
388
|
-
if (toEl.
|
391
|
+
if (toEl.bz_ === null || fromFlags & FLAG_SPREAD_ATTRS) {
|
389
392
|
for (attrName in oldAttrs) {
|
390
393
|
if (!(attrName in attrs)) {
|
391
394
|
if (attrName === ATTR_XLINK_HREF) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtime/vdom/VElement.js"],"names":["domData","require","componentsUtil","vElementByDOMNode","VNode","inherit","ATTR_XLINK_HREF","xmlnsRegExp","hasOwnProperty","Object","prototype","NS_XLINK","NS_HTML","NS_MATH","NS_SVG","DEFAULT_NS","svg","math","FLAG_SIMPLE_ATTRS","FLAG_CUSTOM_ELEMENT","FLAG_SPREAD_ATTRS","defineProperty","ATTR_HREF","EMPTY_OBJECT","freeze","convertAttrValue","type","value","RegExp","source","assign","a","b","key","call","setAttribute","el","namespaceURI","name","setAttributeNS","removeAttribute","removeAttributeNS","VElementClone","other","VElement","tagName","attrs","ownerComponent","childCount","flags","props","constId","i","e","child","n","node","doc","parentNamespaceURI","attributes","createElementNS","attrName","attrValue","defaultValue","set","proto","forEach","get","virtualizeElement","virtualizeChildNodes","attrCount","length","attr","test","nodeName","toLowerCase","vdomEl","fromEl","vFromEl","toEl","removePreservedAttributes","fromFlags","toFlags","oldAttrs","className","id","style","cssText","module","exports"],"mappings":"cAAA;;AAEA,IAAIA,OAAO,GAAGC,OAAO,CAAC,wBAAD,CAArB;AACA,IAAIC,cAAc,GAAGD,OAAO,CAAC,oBAAD,CAA5B;AACA,IAAIE,iBAAiB,GAAGH,OAAO,IAA/B;AACA,IAAII,KAAK,GAAGH,OAAO,CAAC,SAAD,CAAnB;AACA,IAAII,OAAO,GAAGJ,OAAO,CAAC,qBAAD,CAArB;AACA,IAAIK,eAAe,GAAG,YAAtB;AACA,IAAIC,WAAW,GAAG,aAAlB;AACA,IAAIC,cAAc,GAAGC,MAAM,CAACC,SAAP,CAAiBF,cAAtC;AACA,IAAIG,QAAQ,GAAG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AAS,GAAGhB,KAAK,CAACe,QAAD,CAAjB;AACAxB,IAAAA,YAAY,GAAG,IAAf;;AAEA,QAAIwB,QAAQ,KAAKvD,eAAjB,EAAkC;AAChC+B,MAAAA,YAAY,GAAG1B,QAAf;AACAkD,MAAAA,QAAQ,GAAGvC,SAAX;AACD;;AAED,QAAIwC,SAAS,IAAI,IAAb,IAAqBA,SAAS,KAAK,KAAvC,EAA8C;AAC5CtB,MAAAA,eAAe,CAACqC,MAAD,EAASxC,YAAT,EAAuBwB,QAAvB,CAAf;AACD,KAFD,MAEO,IAAIsB,QAAQ,CAACtB,QAAD,CAAR,KAAuBC,SAA3B,EAAsC;AAC3C,UAAIpC,IAAI,GAAG,OAAOoC,SAAlB;;AAEA,UAAIpC,IAAI,KAAK,QAAb,EAAuB;AACrBoC,QAAAA,SAAS,GAAGrC,gBAAgB,CAACC,IAAD,EAAOoC,SAAP,CAA5B;AACD;;AAED3B,MAAAA,YAAY,CAAC0C,MAAD,EAASxC,YAAT,EAAuBwB,QAAvB,EAAiCC,SAAjC,CAAZ;AACD;AACF;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAIiB,IAAI,IAAJ,KAAgB,IAAhB,IAAwBE,SAAS,GAAG7D,iBAAxC,EAA2D;AACzD,SAAKyC,QAAL,IAAiBsB,QAAjB,EAA2B;AACzB,UAAI,EAAEtB,QAAQ,IAAIf,KAAd,CAAJ,EAA0B;AACxB,YAAIe,QAAQ,KAAKvD,eAAjB,EAAkC;AAChCuE,UAAAA,MAAM,CAACpC,iBAAP,CAAyBnC,eAAzB,EAA0CgB,SAA1C;AACD,SAFD,MAEO;AACLuD,UAAAA,MAAM,CAACrC,eAAP,CAAuBqB,QAAvB;AACD;AACF;AACF;AACF;AACF,CA5GD;;AA8GA2B,MAAM,CAACC,OAAP,GAAiB7C,QAAjB","sourcesContent":["/* jshint newcap:false */\n\nvar domData = require(\"../components/dom-data\");\nvar componentsUtil = require(\"../components/util\");\nvar vElementByDOMNode = domData.___vElementByDOMNode;\nvar VNode = require(\"./VNode\");\nvar inherit = require(\"raptor-util/inherit\");\nvar ATTR_XLINK_HREF = \"xlink:href\";\nvar xmlnsRegExp = /^xmlns(:|$)/;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar NS_XLINK = \"http://www.w3.org/1999/xlink\";\nvar NS_HTML = \"http://www.w3.org/1999/xhtml\";\nvar NS_MATH = \"http://www.w3.org/1998/Math/MathML\";\nvar NS_SVG = \"http://www.w3.org/2000/svg\";\nvar DEFAULT_NS = {\n svg: NS_SVG,\n math: NS_MATH\n};\n\nvar FLAG_SIMPLE_ATTRS = 1;\nvar FLAG_CUSTOM_ELEMENT = 2;\nvar FLAG_SPREAD_ATTRS = 4;\n\nvar defineProperty = Object.defineProperty;\n\nvar ATTR_HREF = \"href\";\nvar EMPTY_OBJECT = Object.freeze({});\n\nfunction convertAttrValue(type, value) {\n if (value === true) {\n return \"\";\n } else if (type == \"object\") {\n if (value instanceof RegExp) {\n return value.source;\n }\n }\n\n return value + \"\";\n}\n\nfunction assign(a, b) {\n for (var key in b) {\n if (hasOwnProperty.call(b, key)) {\n a[key] = b[key];\n }\n }\n}\n\nfunction setAttribute(el, namespaceURI, name, value) {\n if (namespaceURI === null) {\n el.setAttribute(name, value);\n } else {\n el.setAttributeNS(namespaceURI, name, value);\n }\n}\n\nfunction removeAttribute(el, namespaceURI, name) {\n if (namespaceURI === null) {\n el.removeAttribute(name);\n } else {\n el.removeAttributeNS(namespaceURI, name);\n }\n}\n\nfunction VElementClone(other) {\n this.___firstChildInternal = other.___firstChildInternal;\n this.___parentNode = null;\n this.___nextSiblingInternal = null;\n\n this.___key = other.___key;\n this.___attributes = other.___attributes;\n this.___properties = other.___properties;\n this.___nodeName = other.___nodeName;\n this.___flags = other.___flags;\n this.___valueInternal = other.___valueInternal;\n this.___constId = other.___constId;\n}\n\nfunction VElement(\n tagName,\n attrs,\n key,\n ownerComponent,\n childCount,\n flags,\n props\n) {\n this.___VNode(childCount, ownerComponent);\n\n var constId;\n\n if (props) {\n constId = props.i;\n }\n\n this.___key = key;\n this.___flags = flags || 0;\n this.___attributes = attrs || EMPTY_OBJECT;\n this.___properties = props || EMPTY_OBJECT;\n this.___nodeName = tagName;\n this.___valueInternal = null;\n this.___constId = constId;\n this.___preserve = false;\n this.___preserveBody = false;\n}\n\nVElement.prototype = {\n ___nodeType: 1,\n\n ___cloneNode: function () {\n return new VElementClone(this);\n },\n\n /**\n * Shorthand method for creating and appending an HTML element\n *\n * @param {String} tagName The tag name (e.g. \"div\")\n * @param {int|null} attrCount The number of attributes (or `null` if not known)\n * @param {int|null} childCount The number of child nodes (or `null` if not known)\n */\n e: function (tagName, attrs, key, ownerComponent, childCount, flags, props) {\n var child = this.___appendChild(\n new VElement(\n tagName,\n attrs,\n key,\n ownerComponent,\n childCount,\n flags,\n props\n )\n );\n\n if (childCount === 0) {\n return this.___finishChild();\n } else {\n return child;\n }\n },\n\n /**\n * Shorthand method for creating and appending a static node. The provided node is automatically cloned\n * using a shallow clone since it will be mutated as a result of setting `nextSibling` and `parentNode`.\n *\n * @param {String} value The value for the new Comment node\n */\n n: function (node, ownerComponent) {\n node = node.___cloneNode();\n node.___ownerComponent = ownerComponent;\n this.___appendChild(node);\n return this.___finishChild();\n },\n\n ___actualize: function (doc, parentNamespaceURI) {\n var tagName = this.___nodeName;\n var attributes = this.___attributes;\n var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;\n\n var flags = this.___flags;\n var el = doc.createElementNS(namespaceURI, tagName);\n\n if (flags & FLAG_CUSTOM_ELEMENT) {\n assign(el, attributes);\n } else {\n for (var attrName in attributes) {\n var attrValue = attributes[attrName];\n\n if (attrValue !== false && attrValue != null) {\n var type = typeof attrValue;\n\n if (type !== \"string\") {\n // Special attributes aren't copied to the real DOM. They are only\n // kept in the virtual attributes map\n attrValue = convertAttrValue(type, attrValue);\n }\n\n if (attrName == ATTR_XLINK_HREF) {\n setAttribute(el, NS_XLINK, ATTR_HREF, attrValue);\n } else {\n el.setAttribute(attrName, attrValue);\n }\n }\n }\n\n if (tagName === \"textarea\") {\n el.defaultValue = el.value = this.___value;\n }\n }\n\n vElementByDOMNode.set(el, this);\n\n return el;\n },\n\n ___hasAttribute: function (name) {\n // We don't care about the namespaces since the there\n // is no chance that attributes with the same name will have\n // different namespaces\n var value = this.___attributes[name];\n return value != null && value !== false;\n }\n};\n\ninherit(VElement, VNode);\n\nvar proto = (VElementClone.prototype = VElement.prototype);\n\n[\"checked\", \"selected\", \"disabled\"].forEach(function (name) {\n defineProperty(proto, name, {\n get: function () {\n var value = this.___attributes[name];\n return value !== false && value != null;\n }\n });\n});\n\ndefineProperty(proto, \"___value\", {\n get: function () {\n var value = this.___valueInternal;\n if (value == null) {\n value = this.___attributes.value;\n }\n return value != null && value !== false\n ? value + \"\"\n : this.___attributes.type === \"checkbox\" ||\n this.___attributes.type === \"radio\"\n ? \"on\"\n : \"\";\n }\n});\n\nVElement.___removePreservedAttributes = function (attrs) {\n // By default this static method is a no-op, but if there are any\n // compiled components that have \"no-update\" attributes then\n // `preserve-attrs.js` will be imported and this method will be replaced\n // with a method that actually does something\n return attrs;\n};\n\nfunction virtualizeElement(node, virtualizeChildNodes, ownerComponent) {\n var attributes = node.attributes;\n var attrCount = attributes.length;\n\n var attrs = null;\n var props = null;\n\n if (attrCount) {\n attrs = {};\n for (var i = 0; i < attrCount; i++) {\n var attr = attributes[i];\n var attrName = attr.name;\n if (!xmlnsRegExp.test(attrName)) {\n if (attrName === \"data-marko\") {\n props = componentsUtil.___getMarkoPropsFromEl(node);\n } else if (attr.namespaceURI === NS_XLINK) {\n attrs[ATTR_XLINK_HREF] = attr.value;\n } else {\n attrs[attrName] = attr.value;\n }\n }\n }\n }\n\n var tagName = node.nodeName;\n\n if (node.namespaceURI === NS_HTML) {\n tagName = tagName.toLowerCase();\n }\n\n var vdomEl = new VElement(\n tagName,\n attrs,\n null /*key*/,\n ownerComponent,\n 0 /*child count*/,\n 0 /*flags*/,\n props\n );\n\n if (vdomEl.___nodeName === \"textarea\") {\n vdomEl.___valueInternal = node.value;\n } else if (virtualizeChildNodes) {\n virtualizeChildNodes(node, vdomEl, ownerComponent);\n }\n\n return vdomEl;\n}\n\nVElement.___virtualize = virtualizeElement;\n\nVElement.___morphAttrs = function (fromEl, vFromEl, toEl) {\n var removePreservedAttributes = VElement.___removePreservedAttributes;\n\n var fromFlags = vFromEl.___flags;\n var toFlags = toEl.___flags;\n\n vElementByDOMNode.set(fromEl, toEl);\n\n var attrs = toEl.___attributes;\n var props = toEl.___properties;\n\n if (toFlags & FLAG_CUSTOM_ELEMENT) {\n return assign(fromEl, attrs);\n }\n\n var attrName;\n\n // We use expando properties to associate the previous HTML\n // attributes provided as part of the VDOM node with the\n // real VElement DOM node. When diffing attributes,\n // we only use our internal representation of the attributes.\n // When diffing for the first time it's possible that the\n // real VElement node will not have the expando property\n // so we build the attribute map from the expando property\n\n var oldAttrs = vFromEl.___attributes;\n\n if (oldAttrs) {\n if (oldAttrs === attrs) {\n // For constant attributes the same object will be provided\n // every render and we can use that to our advantage to\n // not waste time diffing a constant, immutable attribute\n // map.\n return;\n } else {\n oldAttrs = removePreservedAttributes(oldAttrs, props);\n }\n }\n\n var attrValue;\n\n if (toFlags & FLAG_SIMPLE_ATTRS && fromFlags & FLAG_SIMPLE_ATTRS) {\n if (oldAttrs[\"class\"] !== (attrValue = attrs[\"class\"])) {\n fromEl.className = attrValue;\n }\n if (oldAttrs.id !== (attrValue = attrs.id)) {\n fromEl.id = attrValue;\n }\n if (oldAttrs.style !== (attrValue = attrs.style)) {\n fromEl.style.cssText = attrValue;\n }\n return;\n }\n\n // In some cases we only want to set an attribute value for the first\n // render or we don't want certain attributes to be touched. To support\n // that use case we delete out all of the preserved attributes\n // so it's as if they never existed.\n attrs = removePreservedAttributes(attrs, props, true);\n\n var namespaceURI;\n\n // Loop over all of the attributes in the attribute map and compare\n // them to the value in the old map. However, if the value is\n // null/undefined/false then we want to remove the attribute\n for (attrName in attrs) {\n attrValue = attrs[attrName];\n namespaceURI = null;\n\n if (attrName === ATTR_XLINK_HREF) {\n namespaceURI = NS_XLINK;\n attrName = ATTR_HREF;\n }\n\n if (attrValue == null || attrValue === false) {\n removeAttribute(fromEl, namespaceURI, attrName);\n } else if (oldAttrs[attrName] !== attrValue) {\n var type = typeof attrValue;\n\n if (type !== \"string\") {\n attrValue = convertAttrValue(type, attrValue);\n }\n\n setAttribute(fromEl, namespaceURI, attrName, attrValue);\n }\n }\n\n // If there are any old attributes that are not in the new set of attributes\n // then we need to remove those attributes from the target node\n //\n // NOTE: We can skip this if the the element is keyed and didn't have spread attributes\n // because we know we already processed all of the attributes for\n // both the target and original element since target VElement nodes will\n // have all attributes declared. However, we can only skip if the node\n // was not a virtualized node (i.e., a node that was not rendered by a\n // Marko template, but rather a node that was created from an HTML\n // string or a real DOM node).\n if (toEl.___key === null || fromFlags & FLAG_SPREAD_ATTRS) {\n for (attrName in oldAttrs) {\n if (!(attrName in attrs)) {\n if (attrName === ATTR_XLINK_HREF) {\n fromEl.removeAttributeNS(ATTR_XLINK_HREF, ATTR_HREF);\n } else {\n fromEl.removeAttribute(attrName);\n }\n }\n }\n }\n};\n\nmodule.exports = VElement;\n"],"file":"VElement.js"}
|
1
|
+
{"version":3,"sources":["../../../src/runtime/vdom/VElement.js"],"names":["domData","require","componentsUtil","vElementByDOMNode","VNode","inherit","ATTR_XLINK_HREF","xmlnsRegExp","hasOwnProperty","Object","prototype","NS_XLINK","NS_HTML","NS_MATH","NS_SVG","DEFAULT_NS","svg","math","FLAG_SIMPLE_ATTRS","FLAG_CUSTOM_ELEMENT","FLAG_SPREAD_ATTRS","defineProperty","ATTR_HREF","EMPTY_OBJECT","freeze","convertAttrValue","type","value","RegExp","source","assign","a","b","key","call","setAttribute","el","namespaceURI","name","setAttributeNS","removeAttribute","removeAttributeNS","VElementClone","other","VElement","tagName","attrs","ownerComponent","childCount","flags","props","constId","i","e","child","n","node","host","parentNamespaceURI","attributes","ownerDocument","createElementNS","attrName","attrValue","defaultValue","set","proto","forEach","get","virtualizeElement","virtualizeChildNodes","attrCount","length","attr","test","nodeName","toLowerCase","vdomEl","fromEl","vFromEl","toEl","removePreservedAttributes","fromFlags","toFlags","oldAttrs","className","id","style","cssText","module","exports"],"mappings":"cAAA;;AAEA,IAAIA,OAAO,GAAGC,OAAO,CAAC,wBAAD,CAArB;AACA,IAAIC,cAAc,GAAGD,OAAO,CAAC,oBAAD,CAA5B;AACA,IAAIE,iBAAiB,GAAGH,OAAO,IAA/B;AACA,IAAII,KAAK,GAAGH,OAAO,CAAC,SAAD,CAAnB;AACA,IAAII,OAAO,GAAGJ,OAAO,CAAC,qBAAD,CAArB;AACA,IAAIK,eAAe,GAAG,YAAtB;AACA,IAAIC,WAAW,GAAG,aAAlB;AACA,IAAIC,cAAc,GAAGC,MAAM,CAACC,SAAP,CAAiBF,cAAtC;AACA,IAAIG,QAAQ,GAAG,8BAAf;AACA,IAAIC,OAAO,GAAG,8BAAd;AACA,IAAIC,OAAO,GAAG,oCAAd;AACA,IAAIC,MAAM,GAAG,4BAAb;AACA,IAAIC,UAAU,GAAG;AACfC,EAAAA,GAAG,EAAEF,MADU;AAEfG,EAAAA,IAAI,EAAEJ,OAFS,EAAjB;;;AAKA,IAAIK,iBAAiB,GAAG,CAAxB;AACA,IAAIC,mBAAmB,GAAG,CAA1B;AACA,IAAIC,iBAAiB,GAAG,CAAxB;;AAEA,IAAIC,cAAc,GAAGZ,MAAM,CAACY,cAA5B;;AAEA,IAAIC,SAAS,GAAG,MAAhB;AACA,IAAIC,YAAY,GAAGd,MAAM,CAACe,MAAP,CAAc,EAAd,CAAnB;;AAEA,SAASC,gBAAT,CAA0BC,IAA1B,EAAgCC,KAAhC,EAAuC;AACrC,MAAIA,KAAK,KAAK,IAAd,EAAoB;AAClB,WAAO,EAAP;AACD,GAFD,MAEO,IAAID,IAAI,IAAI,QAAZ,EAAsB;AAC3B,QAAIC,KAAK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AAY,CAAC2C,MAAD,EAASzC,YAAT,EAAuByB,QAAvB,EAAiCC,SAAjC,CAAZ;AACD;AACF;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAIiB,IAAI,IAAJ,KAAgB,IAAhB,IAAwBE,SAAS,GAAG9D,iBAAxC,EAA2D;AACzD,SAAK0C,QAAL,IAAiBsB,QAAjB,EAA2B;AACzB,UAAI,EAAEtB,QAAQ,IAAIhB,KAAd,CAAJ,EAA0B;AACxB,YAAIgB,QAAQ,KAAKxD,eAAjB,EAAkC;AAChCwE,UAAAA,MAAM,CAACrC,iBAAP,CAAyBnC,eAAzB,EAA0CgB,SAA1C;AACD,SAFD,MAEO;AACLwD,UAAAA,MAAM,CAACtC,eAAP,CAAuBsB,QAAvB;AACD;AACF;AACF;AACF;AACF,CA5GD;;AA8GA2B,MAAM,CAACC,OAAP,GAAiB9C,QAAjB","sourcesContent":["/* jshint newcap:false */\n\nvar domData = require(\"../components/dom-data\");\nvar componentsUtil = require(\"../components/util\");\nvar vElementByDOMNode = domData.___vElementByDOMNode;\nvar VNode = require(\"./VNode\");\nvar inherit = require(\"raptor-util/inherit\");\nvar ATTR_XLINK_HREF = \"xlink:href\";\nvar xmlnsRegExp = /^xmlns(:|$)/;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar NS_XLINK = \"http://www.w3.org/1999/xlink\";\nvar NS_HTML = \"http://www.w3.org/1999/xhtml\";\nvar NS_MATH = \"http://www.w3.org/1998/Math/MathML\";\nvar NS_SVG = \"http://www.w3.org/2000/svg\";\nvar DEFAULT_NS = {\n svg: NS_SVG,\n math: NS_MATH\n};\n\nvar FLAG_SIMPLE_ATTRS = 1;\nvar FLAG_CUSTOM_ELEMENT = 2;\nvar FLAG_SPREAD_ATTRS = 4;\n\nvar defineProperty = Object.defineProperty;\n\nvar ATTR_HREF = \"href\";\nvar EMPTY_OBJECT = Object.freeze({});\n\nfunction convertAttrValue(type, value) {\n if (value === true) {\n return \"\";\n } else if (type == \"object\") {\n if (value instanceof RegExp) {\n return value.source;\n }\n }\n\n return value + \"\";\n}\n\nfunction assign(a, b) {\n for (var key in b) {\n if (hasOwnProperty.call(b, key)) {\n a[key] = b[key];\n }\n }\n}\n\nfunction setAttribute(el, namespaceURI, name, value) {\n if (namespaceURI === null) {\n el.setAttribute(name, value);\n } else {\n el.setAttributeNS(namespaceURI, name, value);\n }\n}\n\nfunction removeAttribute(el, namespaceURI, name) {\n if (namespaceURI === null) {\n el.removeAttribute(name);\n } else {\n el.removeAttributeNS(namespaceURI, name);\n }\n}\n\nfunction VElementClone(other) {\n this.___firstChildInternal = other.___firstChildInternal;\n this.___parentNode = null;\n this.___nextSiblingInternal = null;\n\n this.___key = other.___key;\n this.___attributes = other.___attributes;\n this.___properties = other.___properties;\n this.___nodeName = other.___nodeName;\n this.___flags = other.___flags;\n this.___valueInternal = other.___valueInternal;\n this.___constId = other.___constId;\n}\n\nfunction VElement(\n tagName,\n attrs,\n key,\n ownerComponent,\n childCount,\n flags,\n props\n) {\n this.___VNode(childCount, ownerComponent);\n\n var constId;\n\n if (props) {\n constId = props.i;\n }\n\n this.___key = key;\n this.___flags = flags || 0;\n this.___attributes = attrs || EMPTY_OBJECT;\n this.___properties = props || EMPTY_OBJECT;\n this.___nodeName = tagName;\n this.___valueInternal = null;\n this.___constId = constId;\n this.___preserve = false;\n this.___preserveBody = false;\n}\n\nVElement.prototype = {\n ___nodeType: 1,\n\n ___cloneNode: function () {\n return new VElementClone(this);\n },\n\n /**\n * Shorthand method for creating and appending an HTML element\n *\n * @param {String} tagName The tag name (e.g. \"div\")\n * @param {int|null} attrCount The number of attributes (or `null` if not known)\n * @param {int|null} childCount The number of child nodes (or `null` if not known)\n */\n e: function (tagName, attrs, key, ownerComponent, childCount, flags, props) {\n var child = this.___appendChild(\n new VElement(\n tagName,\n attrs,\n key,\n ownerComponent,\n childCount,\n flags,\n props\n )\n );\n\n if (childCount === 0) {\n return this.___finishChild();\n } else {\n return child;\n }\n },\n\n /**\n * Shorthand method for creating and appending a static node. The provided node is automatically cloned\n * using a shallow clone since it will be mutated as a result of setting `nextSibling` and `parentNode`.\n *\n * @param {String} value The value for the new Comment node\n */\n n: function (node, ownerComponent) {\n node = node.___cloneNode();\n node.___ownerComponent = ownerComponent;\n this.___appendChild(node);\n return this.___finishChild();\n },\n\n ___actualize: function (host, parentNamespaceURI) {\n var tagName = this.___nodeName;\n var attributes = this.___attributes;\n var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;\n\n var flags = this.___flags;\n var el = (host.ownerDocument || host).createElementNS(\n namespaceURI,\n tagName\n );\n\n if (flags & FLAG_CUSTOM_ELEMENT) {\n assign(el, attributes);\n } else {\n for (var attrName in attributes) {\n var attrValue = attributes[attrName];\n\n if (attrValue !== false && attrValue != null) {\n var type = typeof attrValue;\n\n if (type !== \"string\") {\n // Special attributes aren't copied to the real DOM. They are only\n // kept in the virtual attributes map\n attrValue = convertAttrValue(type, attrValue);\n }\n\n if (attrName == ATTR_XLINK_HREF) {\n setAttribute(el, NS_XLINK, ATTR_HREF, attrValue);\n } else {\n el.setAttribute(attrName, attrValue);\n }\n }\n }\n\n if (tagName === \"textarea\") {\n el.defaultValue = el.value = this.___value;\n }\n }\n\n vElementByDOMNode.set(el, this);\n\n return el;\n },\n\n ___hasAttribute: function (name) {\n // We don't care about the namespaces since the there\n // is no chance that attributes with the same name will have\n // different namespaces\n var value = this.___attributes[name];\n return value != null && value !== false;\n }\n};\n\ninherit(VElement, VNode);\n\nvar proto = (VElementClone.prototype = VElement.prototype);\n\n[\"checked\", \"selected\", \"disabled\"].forEach(function (name) {\n defineProperty(proto, name, {\n get: function () {\n var value = this.___attributes[name];\n return value !== false && value != null;\n }\n });\n});\n\ndefineProperty(proto, \"___value\", {\n get: function () {\n var value = this.___valueInternal;\n if (value == null) {\n value = this.___attributes.value;\n }\n return value != null && value !== false\n ? value + \"\"\n : this.___attributes.type === \"checkbox\" ||\n this.___attributes.type === \"radio\"\n ? \"on\"\n : \"\";\n }\n});\n\nVElement.___removePreservedAttributes = function (attrs) {\n // By default this static method is a no-op, but if there are any\n // compiled components that have \"no-update\" attributes then\n // `preserve-attrs.js` will be imported and this method will be replaced\n // with a method that actually does something\n return attrs;\n};\n\nfunction virtualizeElement(node, virtualizeChildNodes, ownerComponent) {\n var attributes = node.attributes;\n var attrCount = attributes.length;\n\n var attrs = null;\n var props = null;\n\n if (attrCount) {\n attrs = {};\n for (var i = 0; i < attrCount; i++) {\n var attr = attributes[i];\n var attrName = attr.name;\n if (!xmlnsRegExp.test(attrName)) {\n if (attrName === \"data-marko\") {\n props = componentsUtil.___getMarkoPropsFromEl(node);\n } else if (attr.namespaceURI === NS_XLINK) {\n attrs[ATTR_XLINK_HREF] = attr.value;\n } else {\n attrs[attrName] = attr.value;\n }\n }\n }\n }\n\n var tagName = node.nodeName;\n\n if (node.namespaceURI === NS_HTML) {\n tagName = tagName.toLowerCase();\n }\n\n var vdomEl = new VElement(\n tagName,\n attrs,\n null /*key*/,\n ownerComponent,\n 0 /*child count*/,\n 0 /*flags*/,\n props\n );\n\n if (vdomEl.___nodeName === \"textarea\") {\n vdomEl.___valueInternal = node.value;\n } else if (virtualizeChildNodes) {\n virtualizeChildNodes(node, vdomEl, ownerComponent);\n }\n\n return vdomEl;\n}\n\nVElement.___virtualize = virtualizeElement;\n\nVElement.___morphAttrs = function (fromEl, vFromEl, toEl) {\n var removePreservedAttributes = VElement.___removePreservedAttributes;\n\n var fromFlags = vFromEl.___flags;\n var toFlags = toEl.___flags;\n\n vElementByDOMNode.set(fromEl, toEl);\n\n var attrs = toEl.___attributes;\n var props = toEl.___properties;\n\n if (toFlags & FLAG_CUSTOM_ELEMENT) {\n return assign(fromEl, attrs);\n }\n\n var attrName;\n\n // We use expando properties to associate the previous HTML\n // attributes provided as part of the VDOM node with the\n // real VElement DOM node. When diffing attributes,\n // we only use our internal representation of the attributes.\n // When diffing for the first time it's possible that the\n // real VElement node will not have the expando property\n // so we build the attribute map from the expando property\n\n var oldAttrs = vFromEl.___attributes;\n\n if (oldAttrs) {\n if (oldAttrs === attrs) {\n // For constant attributes the same object will be provided\n // every render and we can use that to our advantage to\n // not waste time diffing a constant, immutable attribute\n // map.\n return;\n } else {\n oldAttrs = removePreservedAttributes(oldAttrs, props);\n }\n }\n\n var attrValue;\n\n if (toFlags & FLAG_SIMPLE_ATTRS && fromFlags & FLAG_SIMPLE_ATTRS) {\n if (oldAttrs[\"class\"] !== (attrValue = attrs[\"class\"])) {\n fromEl.className = attrValue;\n }\n if (oldAttrs.id !== (attrValue = attrs.id)) {\n fromEl.id = attrValue;\n }\n if (oldAttrs.style !== (attrValue = attrs.style)) {\n fromEl.style.cssText = attrValue;\n }\n return;\n }\n\n // In some cases we only want to set an attribute value for the first\n // render or we don't want certain attributes to be touched. To support\n // that use case we delete out all of the preserved attributes\n // so it's as if they never existed.\n attrs = removePreservedAttributes(attrs, props, true);\n\n var namespaceURI;\n\n // Loop over all of the attributes in the attribute map and compare\n // them to the value in the old map. However, if the value is\n // null/undefined/false then we want to remove the attribute\n for (attrName in attrs) {\n attrValue = attrs[attrName];\n namespaceURI = null;\n\n if (attrName === ATTR_XLINK_HREF) {\n namespaceURI = NS_XLINK;\n attrName = ATTR_HREF;\n }\n\n if (attrValue == null || attrValue === false) {\n removeAttribute(fromEl, namespaceURI, attrName);\n } else if (oldAttrs[attrName] !== attrValue) {\n var type = typeof attrValue;\n\n if (type !== \"string\") {\n attrValue = convertAttrValue(type, attrValue);\n }\n\n setAttribute(fromEl, namespaceURI, attrName, attrValue);\n }\n }\n\n // If there are any old attributes that are not in the new set of attributes\n // then we need to remove those attributes from the target node\n //\n // NOTE: We can skip this if the the element is keyed and didn't have spread attributes\n // because we know we already processed all of the attributes for\n // both the target and original element since target VElement nodes will\n // have all attributes declared. However, we can only skip if the node\n // was not a virtualized node (i.e., a node that was not rendered by a\n // Marko template, but rather a node that was created from an HTML\n // string or a real DOM node).\n if (toEl.___key === null || fromFlags & FLAG_SPREAD_ATTRS) {\n for (attrName in oldAttrs) {\n if (!(attrName in attrs)) {\n if (attrName === ATTR_XLINK_HREF) {\n fromEl.removeAttributeNS(ATTR_XLINK_HREF, ATTR_HREF);\n } else {\n fromEl.removeAttribute(attrName);\n }\n }\n }\n }\n};\n\nmodule.exports = VElement;\n"],"file":"VElement.js"}
|
@@ -6,16 +6,16 @@ var inherit = require("raptor-util/inherit");
|
|
6
6
|
var createFragmentNode = require("./morphdom/fragment").ao_;
|
7
7
|
|
8
8
|
function VFragment(key, ownerComponent, preserve) {
|
9
|
-
this.
|
10
|
-
this.
|
9
|
+
this.by_(null /* childCount */, ownerComponent);
|
10
|
+
this.bz_ = key;
|
11
11
|
this.n_ = preserve;
|
12
12
|
}
|
13
13
|
|
14
14
|
VFragment.prototype = {
|
15
|
-
|
16
|
-
|
15
|
+
bA_: 12,
|
16
|
+
bx_: function () {
|
17
17
|
var fragment = createFragmentNode();
|
18
|
-
keysByDOMNode.set(fragment, this.
|
18
|
+
keysByDOMNode.set(fragment, this.bz_);
|
19
19
|
vElementByDOMNode.set(fragment, this);
|
20
20
|
return fragment;
|
21
21
|
} };
|
@@ -2,81 +2,81 @@
|
|
2
2
|
function VNode() {}
|
3
3
|
|
4
4
|
VNode.prototype = {
|
5
|
-
|
6
|
-
this.
|
7
|
-
this.
|
8
|
-
this.
|
9
|
-
this.
|
5
|
+
by_: function (finalChildCount, ownerComponent) {
|
6
|
+
this.bO_ = finalChildCount;
|
7
|
+
this.bP_ = 0;
|
8
|
+
this.bE_ = null;
|
9
|
+
this.bQ_ = null;
|
10
|
+
this.bB_ = null;
|
10
11
|
this.bC_ = null;
|
11
|
-
this.bD_ = null;
|
12
12
|
this.aA_ = ownerComponent;
|
13
13
|
},
|
14
14
|
|
15
15
|
get _r_() {
|
16
|
-
var firstChild = this.
|
16
|
+
var firstChild = this.bE_;
|
17
17
|
|
18
|
-
if (firstChild && firstChild.
|
18
|
+
if (firstChild && firstChild.bD_) {
|
19
19
|
var nestedFirstChild = firstChild._r_;
|
20
20
|
// The first child is a DocumentFragment node.
|
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.
|
24
|
+
return nestedFirstChild || firstChild.bR_;
|
25
25
|
}
|
26
26
|
|
27
27
|
return firstChild;
|
28
28
|
},
|
29
29
|
|
30
|
-
get
|
31
|
-
var nextSibling = this.
|
30
|
+
get bR_() {
|
31
|
+
var nextSibling = this.bC_;
|
32
32
|
|
33
33
|
if (nextSibling) {
|
34
|
-
if (nextSibling.
|
34
|
+
if (nextSibling.bD_) {
|
35
35
|
var firstChild = nextSibling._r_;
|
36
|
-
return firstChild || nextSibling.
|
36
|
+
return firstChild || nextSibling.bR_;
|
37
37
|
}
|
38
38
|
} else {
|
39
|
-
var parentNode = this.
|
40
|
-
if (parentNode && parentNode.
|
41
|
-
return parentNode.
|
39
|
+
var parentNode = this.bB_;
|
40
|
+
if (parentNode && parentNode.bD_) {
|
41
|
+
return parentNode.bR_;
|
42
42
|
}
|
43
43
|
}
|
44
44
|
|
45
45
|
return nextSibling;
|
46
46
|
},
|
47
47
|
|
48
|
-
|
49
|
-
this.
|
48
|
+
bq_: function (child) {
|
49
|
+
this.bP_++;
|
50
50
|
|
51
|
-
if (this.
|
52
|
-
if (child.
|
53
|
-
var childValue = child.
|
54
|
-
this.
|
51
|
+
if (this.bG_ === "textarea") {
|
52
|
+
if (child.bS_) {
|
53
|
+
var childValue = child.bT_;
|
54
|
+
this.bH_ = (this.bH_ || "") + childValue;
|
55
55
|
} else if (child.n_ || child.m_) {
|
56
|
-
this.
|
56
|
+
this.bU_ = true;
|
57
57
|
} else {
|
58
58
|
throw TypeError();
|
59
59
|
}
|
60
60
|
} else {
|
61
|
-
var lastChild = this.
|
61
|
+
var lastChild = this.bQ_;
|
62
62
|
|
63
|
-
child.
|
63
|
+
child.bB_ = this;
|
64
64
|
|
65
65
|
if (lastChild) {
|
66
|
-
lastChild.
|
66
|
+
lastChild.bC_ = child;
|
67
67
|
} else {
|
68
|
-
this.
|
68
|
+
this.bE_ = child;
|
69
69
|
}
|
70
70
|
|
71
|
-
this.
|
71
|
+
this.bQ_ = child;
|
72
72
|
}
|
73
73
|
|
74
74
|
return child;
|
75
75
|
},
|
76
76
|
|
77
|
-
|
78
|
-
if (this.
|
79
|
-
return this.
|
77
|
+
bJ_: function finishChild() {
|
78
|
+
if (this.bP_ === this.bO_ && this.bB_) {
|
79
|
+
return this.bB_.bJ_();
|
80
80
|
} else {
|
81
81
|
return this;
|
82
82
|
}
|
@@ -2,21 +2,21 @@
|
|
2
2
|
var inherit = require("raptor-util/inherit");
|
3
3
|
|
4
4
|
function VText(value, ownerComponent) {
|
5
|
-
this.
|
6
|
-
this.
|
5
|
+
this.by_(-1 /* no children */, ownerComponent);
|
6
|
+
this.bT_ = value;
|
7
7
|
}
|
8
8
|
|
9
9
|
VText.prototype = {
|
10
|
-
|
10
|
+
bS_: true,
|
11
11
|
|
12
|
-
|
12
|
+
bA_: 3,
|
13
13
|
|
14
|
-
|
15
|
-
return
|
14
|
+
bx_: function (host) {
|
15
|
+
return (host.ownerDocument || host).createTextNode(this.bT_);
|
16
16
|
},
|
17
17
|
|
18
|
-
|
19
|
-
return new VText(this.
|
18
|
+
br_: function () {
|
19
|
+
return new VText(this.bT_);
|
20
20
|
} };
|
21
21
|
|
22
22
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtime/vdom/VText.js"],"names":["VNode","require","inherit","VText","value","ownerComponent","prototype","
|
1
|
+
{"version":3,"sources":["../../../src/runtime/vdom/VText.js"],"names":["VNode","require","inherit","VText","value","ownerComponent","prototype","host","ownerDocument","createTextNode","module","exports"],"mappings":"aAAA,IAAIA,KAAK,GAAGC,OAAO,CAAC,SAAD,CAAnB;AACA,IAAIC,OAAO,GAAGD,OAAO,CAAC,qBAAD,CAArB;;AAEA,SAASE,KAAT,CAAeC,KAAf,EAAsBC,cAAtB,EAAsC;AACpC,WAAc,CAAC,CAAf,CAAiB,iBAAjB,EAAoCA,cAApC;AACA,aAAoBD,KAApB;AACD;;AAEDD,KAAK,CAACG,SAAN,GAAkB;AAChB,OAAS,IADO;;AAGhB,OAAa,CAHG;;AAKhB,OAAc,UAAUC,IAAV,EAAgB;AAC5B,WAAO,CAACA,IAAI,CAACC,aAAL,IAAsBD,IAAvB,EAA6BE,cAA7B,CAA4C,QAA5C,CAAP;AACD,GAPe;;AAShB,OAAc,YAAY;AACxB,WAAO,IAAIN,KAAJ,CAAU,QAAV,CAAP;AACD,GAXe,EAAlB;;;AAcAD,OAAO,CAACC,KAAD,EAAQH,KAAR,CAAP;;AAEAU,MAAM,CAACC,OAAP,GAAiBR,KAAjB","sourcesContent":["var VNode = require(\"./VNode\");\nvar inherit = require(\"raptor-util/inherit\");\n\nfunction VText(value, ownerComponent) {\n this.___VNode(-1 /* no children */, ownerComponent);\n this.___nodeValue = value;\n}\n\nVText.prototype = {\n ___Text: true,\n\n ___nodeType: 3,\n\n ___actualize: function (host) {\n return (host.ownerDocument || host).createTextNode(this.___nodeValue);\n },\n\n ___cloneNode: function () {\n return new VText(this.___nodeValue);\n }\n};\n\ninherit(VText, VNode);\n\nmodule.exports = VText;\n"],"file":"VText.js"}
|
@@ -16,7 +16,7 @@ runtime.t = function (typeName) {
|
|
16
16
|
|
17
17
|
var renderFn;
|
18
18
|
var template = registered[typeName] = createTemplate(typeName);
|
19
|
-
var instances = template.
|
19
|
+
var instances = template.bV_ = [];
|
20
20
|
Object.defineProperty(template, "_", {
|
21
21
|
get: function () {
|
22
22
|
return renderFn && proxyRenderer;
|
@@ -39,7 +39,7 @@ runtime.t = function (typeName) {
|
|
39
39
|
var parentNode = startNode.parentNode;
|
40
40
|
var curNode;
|
41
41
|
|
42
|
-
instance.
|
42
|
+
instance.bW_ = true;
|
43
43
|
instance._a_();
|
44
44
|
instance._b_();
|
45
45
|
|
@@ -53,7 +53,7 @@ runtime.t = function (typeName) {
|
|
53
53
|
parentNode.removeChild(curNode);
|
54
54
|
}
|
55
55
|
|
56
|
-
instance.
|
56
|
+
instance.bW_ = false;
|
57
57
|
instance.R_ = false;
|
58
58
|
}
|
59
59
|
|
@@ -79,10 +79,10 @@ registry._P_ = function (typeName, id) {
|
|
79
79
|
var instance = createComponent(typeName, id);
|
80
80
|
|
81
81
|
if (template) {
|
82
|
-
var instances = template.
|
82
|
+
var instances = template.bV_;
|
83
83
|
instances.push(instance);
|
84
84
|
instance.once("destroy", function () {
|
85
|
-
if (!instance.
|
85
|
+
if (!instance.bW_) {
|
86
86
|
instances.splice(1, instances.indexOf(instance));
|
87
87
|
}
|
88
88
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/runtime/vdom/hot-reload.js"],"names":["runtime","require","queueMicrotask","util","registry","updateManager","createTemplate","t","createComponent","registered","queue","typeName","renderFn","template","instances","Object","defineProperty","get","proxyRenderer","set","v","length","batchUpdate","push","newProto","prototype","forEach","instance","hasLifecycleChanged","__proto__","startNode","endNode","parentNode","curNode","removeAllListeners","nextSibling","removeChild","afterInsert","apply","arguments","id","once","splice","indexOf","oldProto","hasMethodChanged","method","toString","pending","undefined","i","module","exports"],"mappings":"aAAA,IAAIA,OAAO,GAAGC,OAAO,CAAC,GAAD,CAArB;AACA,IAAIC,cAAc,GAAGD,OAAO,CAAC,mBAAD,CAA5B;AACA,IAAIE,IAAI,GAAGF,OAAO,CAAC,oBAAD,CAAlB;AACA,IAAIG,QAAQ,GAAGH,OAAO,CAAC,wBAAD,CAAtB;AACA,IAAII,aAAa,GAAGJ,OAAO,CAAC,8BAAD,CAA3B;;AAEA,IAAIK,cAAc,GAAGN,OAAO,CAACO,CAA7B;AACA,IAAIC,eAAe,GAAGJ,QAAQ,IAA9B;AACA,IAAIK,UAAU,GAAG,EAAjB;AACA,IAAIC,KAAJ;;AAEAV,OAAO,CAACO,CAA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ACD,CAfD;;AAiBA,SAASC,mBAAT,CAA6BgB,QAA7B,EAAuCpB,QAAvC,EAAiD;AAC/C;AACEqB,IAAAA,gBAAgB,CAAC,UAAD,CAAhB;AACAA,IAAAA,gBAAgB,CAAC,SAAD,CADhB;AAEAA,IAAAA,gBAAgB,CAAC,UAAD,CAFhB;AAGAA,IAAAA,gBAAgB,CAAC,SAAD,CAJlB;;;AAOA,WAASA,gBAAT,CAA0BC,MAA1B,EAAkC;AAChC;AACE,OAACF,QAAQ,CAACE,MAAD,CAAR,IAAoBF,QAAQ,CAACE,MAAD,CAAR,CAAiBC,QAAjB,EAArB;AACCvB,MAAAA,QAAQ,CAACsB,MAAD,CAAR,IAAoBtB,QAAQ,CAACsB,MAAD,CAAR,CAAiBC,QAAjB,EADrB,CADF;;AAID;AACF;;AAED,SAASzB,WAAT,GAAuB;AACrBjB,EAAAA,aAAa,IAAb,CAA6B,YAAY;AACvC,QAAI2C,OAAO,GAAGtC,KAAd;AACAA,IAAAA,KAAK,GAAGuC,SAAR;;AAEA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,OAAO,CAAC3B,MAA5B,EAAoC6B,CAAC,EAArC,EAAyC;AACvCF,MAAAA,OAAO,CAACE,CAAD,CAAP;AACD;AACF,GAPD;AAQD;;AAEDC,MAAM,CAACC,OAAP,GAAiBpD,OAAjB","sourcesContent":["var runtime = require(\".\");\nvar queueMicrotask = require(\"../queueMicrotask\");\nvar util = require(\"../components/util\");\nvar registry = require(\"../components/registry\");\nvar updateManager = require(\"../components/update-manager\");\n\nvar createTemplate = runtime.t;\nvar createComponent = registry.___createComponent;\nvar registered = {};\nvar queue;\n\nruntime.t = function (typeName) {\n if (registered[typeName]) {\n return registered[typeName];\n }\n\n var renderFn;\n var template = (registered[typeName] = createTemplate(typeName));\n var instances = (template.___instances = []);\n Object.defineProperty(template, \"_\", {\n get: function () {\n return renderFn && proxyRenderer;\n },\n set: function (v) {\n renderFn = v;\n\n if (instances.length) {\n if (!queue) {\n queue = [];\n queueMicrotask(batchUpdate);\n }\n\n queue.push(function () {\n var newProto = registry.___getComponentClass(typeName).prototype;\n instances.forEach(function (instance) {\n if (hasLifecycleChanged(instance.__proto__, newProto)) {\n var startNode = instance.___rootNode.startNode;\n var endNode = instance.___rootNode.endNode;\n var parentNode = startNode.parentNode;\n var curNode;\n\n instance.___hmrDestroyed = true;\n instance.___emitDestroy();\n instance.___removeDOMEventListeners();\n\n if (instance.___subscriptions) {\n instance.___subscriptions.removeAllListeners();\n instance.___subscriptions = null;\n }\n\n while ((curNode = startNode.nextSibling) !== endNode) {\n util.___destroyNodeRecursive(curNode);\n parentNode.removeChild(curNode);\n }\n\n instance.___hmrDestroyed = false;\n instance.___mounted = false;\n }\n\n instance.__proto__ = newProto;\n instance\n .___rerender(instance.___input, false)\n .afterInsert(instance.
|
1
|
+
{"version":3,"sources":["../../../src/runtime/vdom/hot-reload.js"],"names":["runtime","require","queueMicrotask","util","registry","updateManager","createTemplate","t","createComponent","registered","queue","typeName","renderFn","template","instances","Object","defineProperty","get","proxyRenderer","set","v","length","batchUpdate","push","newProto","prototype","forEach","instance","hasLifecycleChanged","__proto__","startNode","endNode","parentNode","curNode","removeAllListeners","nextSibling","removeChild","afterInsert","apply","arguments","id","once","splice","indexOf","oldProto","hasMethodChanged","method","toString","pending","undefined","i","module","exports"],"mappings":"aAAA,IAAIA,OAAO,GAAGC,OAAO,CAAC,GAAD,CAArB;AACA,IAAIC,cAAc,GAAGD,OAAO,CAAC,mBAAD,CAA5B;AACA,IAAIE,IAAI,GAAGF,OAAO,CAAC,oBAAD,CAAlB;AACA,IAAIG,QAAQ,GAAGH,OAAO,CAAC,wBAAD,CAAtB;AACA,IAAII,aAAa,GAAGJ,OAAO,CAAC,8BAAD,CAA3B;;AAEA,IAAIK,cAAc,GAAGN,OAAO,CAACO,CAA7B;AACA,IAAIC,eAAe,GAAGJ,QAAQ,IAA9B;AACA,IAAIK,UAAU,GAAG,EAAjB;AAC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ACD;AACF,KAJD;AAKD;;AAED,SAAOA,QAAP;AACD,CAfD;;AAiBA,SAASC,mBAAT,CAA6BgB,QAA7B,EAAuCpB,QAAvC,EAAiD;AAC/C;AACEqB,IAAAA,gBAAgB,CAAC,UAAD,CAAhB;AACAA,IAAAA,gBAAgB,CAAC,SAAD,CADhB;AAEAA,IAAAA,gBAAgB,CAAC,UAAD,CAFhB;AAGAA,IAAAA,gBAAgB,CAAC,SAAD,CAJlB;;;AAOA,WAASA,gBAAT,CAA0BC,MAA1B,EAAkC;AAChC;AACE,OAACF,QAAQ,CAACE,MAAD,CAAR,IAAoBF,QAAQ,CAACE,MAAD,CAAR,CAAiBC,QAAjB,EAArB;AACCvB,MAAAA,QAAQ,CAACsB,MAAD,CAAR,IAAoBtB,QAAQ,CAACsB,MAAD,CAAR,CAAiBC,QAAjB,EADrB,CADF;;AAID;AACF;;AAED,SAASzB,WAAT,GAAuB;AACrBjB,EAAAA,aAAa,IAAb,CAA6B,YAAY;AACvC,QAAI2C,OAAO,GAAGtC,KAAd;AACAA,IAAAA,KAAK,GAAGuC,SAAR;;AAEA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,OAAO,CAAC3B,MAA5B,EAAoC6B,CAAC,EAArC,EAAyC;AACvCF,MAAAA,OAAO,CAACE,CAAD,CAAP;AACD;AACF,GAPD;AAQD;;AAEDC,MAAM,CAACC,OAAP,GAAiBpD,OAAjB","sourcesContent":["var runtime = require(\".\");\nvar queueMicrotask = require(\"../queueMicrotask\");\nvar util = require(\"../components/util\");\nvar registry = require(\"../components/registry\");\nvar updateManager = require(\"../components/update-manager\");\n\nvar createTemplate = runtime.t;\nvar createComponent = registry.___createComponent;\nvar registered = {};\nvar queue;\n\nruntime.t = function (typeName) {\n if (registered[typeName]) {\n return registered[typeName];\n }\n\n var renderFn;\n var template = (registered[typeName] = createTemplate(typeName));\n var instances = (template.___instances = []);\n Object.defineProperty(template, \"_\", {\n get: function () {\n return renderFn && proxyRenderer;\n },\n set: function (v) {\n renderFn = v;\n\n if (instances.length) {\n if (!queue) {\n queue = [];\n queueMicrotask(batchUpdate);\n }\n\n queue.push(function () {\n var newProto = registry.___getComponentClass(typeName).prototype;\n instances.forEach(function (instance) {\n if (hasLifecycleChanged(instance.__proto__, newProto)) {\n var startNode = instance.___rootNode.startNode;\n var endNode = instance.___rootNode.endNode;\n var parentNode = startNode.parentNode;\n var curNode;\n\n instance.___hmrDestroyed = true;\n instance.___emitDestroy();\n instance.___removeDOMEventListeners();\n\n if (instance.___subscriptions) {\n instance.___subscriptions.removeAllListeners();\n instance.___subscriptions = null;\n }\n\n while ((curNode = startNode.nextSibling) !== endNode) {\n util.___destroyNodeRecursive(curNode);\n parentNode.removeChild(curNode);\n }\n\n instance.___hmrDestroyed = false;\n instance.___mounted = false;\n }\n\n instance.__proto__ = newProto;\n instance\n .___rerender(instance.___input, false)\n .afterInsert(instance.___host);\n });\n });\n }\n }\n });\n\n return template;\n\n function proxyRenderer() {\n return renderFn.apply(this, arguments);\n }\n};\n\nregistry.___createComponent = function (typeName, id) {\n var template = registered[typeName];\n var instance = createComponent(typeName, id);\n\n if (template) {\n var instances = template.___instances;\n instances.push(instance);\n instance.once(\"destroy\", function () {\n if (!instance.___hmrDestroyed) {\n instances.splice(1, instances.indexOf(instance));\n }\n });\n }\n\n return instance;\n};\n\nfunction hasLifecycleChanged(oldProto, newProto) {\n return (\n hasMethodChanged(\"onCreate\") ||\n hasMethodChanged(\"onInput\") ||\n hasMethodChanged(\"onRender\") ||\n hasMethodChanged(\"onMount\")\n );\n\n function hasMethodChanged(method) {\n return (\n (oldProto[method] && oldProto[method].toString()) !==\n (newProto[method] && newProto[method].toString())\n );\n }\n}\n\nfunction batchUpdate() {\n updateManager.___batchUpdate(function () {\n var pending = queue;\n queue = undefined;\n\n for (var i = 0; i < pending.length; i++) {\n pending[i]();\n }\n });\n}\n\nmodule.exports = runtime;\n"],"file":"hot-reload.js"}
|
@@ -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.
|
84
|
-
fragment.
|
83
|
+
fragment.bX_ = function (nextNode) {
|
84
|
+
fragment.bX_ = null;
|
85
85
|
insertBefore(
|
86
86
|
fragment.endNode,
|
87
87
|
nextNode,
|
@@ -92,5 +92,5 @@ function beginFragmentNode(startNode, parentNode) {
|
|
92
92
|
}
|
93
93
|
|
94
94
|
exports.ao_ = createFragmentNode;
|
95
|
-
exports.
|
95
|
+
exports.bY_ = beginFragmentNode;
|
96
96
|
//# sourceMappingURL=fragment.js.map
|