marko 5.29.2 → 5.30.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/bin/markoc.js +18 -18
- package/dist/core-tags/core/await/renderer.js +5 -1
- package/dist/node_modules/@internal/components-beginComponent/index.js +13 -3
- package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +331 -0
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/dist/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/dist/node_modules/@internal/components-entry/index-browser.js +2 -2
- package/dist/node_modules/@internal/components-entry/index.js +73 -45
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
- package/dist/node_modules/@internal/components-entry-legacy/index.js +15 -0
- package/dist/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/dist/node_modules/@internal/components-registry/index-browser.js +70 -43
- package/dist/node_modules/@internal/components-registry/index.js +2 -2
- package/dist/node_modules/@internal/components-util/index-browser.js +17 -17
- package/dist/node_modules/@internal/components-util/index.js +18 -8
- package/dist/node_modules/@internal/create-readable/index-browser.js +1 -1
- package/dist/node_modules/@internal/create-readable/index.js +9 -9
- package/dist/node_modules/@internal/set-immediate/index-browser.js +1 -1
- package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -2
- package/dist/node_modules/@internal/set-immediate/index.js +2 -2
- package/dist/runtime/RenderResult.js +3 -3
- package/dist/runtime/components/Component.js +146 -148
- package/dist/runtime/components/ComponentDef.js +41 -27
- package/dist/runtime/components/ComponentsContext.js +6 -6
- package/dist/runtime/components/GlobalComponentsContext.js +3 -3
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +13 -13
- package/dist/runtime/components/State.js +27 -27
- package/dist/runtime/components/attach-detach.js +7 -7
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +6 -6
- package/dist/runtime/components/event-delegation.js +10 -10
- package/dist/runtime/components/legacy/browser.json +9 -0
- package/dist/runtime/components/legacy/defineComponent-legacy.js +32 -0
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +171 -0
- package/dist/runtime/components/legacy/defineWidget-legacy.js +1 -0
- package/dist/runtime/components/legacy/dependencies/html.js +3 -0
- package/dist/runtime/components/legacy/dependencies/index.js +178 -0
- package/dist/runtime/components/legacy/dependencies/vdom.js +3 -0
- package/dist/runtime/components/legacy/index.js +1 -0
- package/dist/runtime/components/legacy/jquery.js +51 -0
- package/dist/runtime/components/legacy/ready.js +152 -0
- package/dist/runtime/components/legacy/renderer-legacy.js +230 -0
- package/dist/runtime/components/renderer.js +30 -26
- package/dist/runtime/components/update-manager.js +10 -10
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +5 -5
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/dynamic-tag.js +7 -9
- package/dist/runtime/helpers/style-value.js +7 -2
- package/dist/runtime/html/AsyncStream.js +20 -20
- package/dist/runtime/html/BufferedWriter.js +2 -2
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +19 -6
- package/dist/runtime/html/helpers/attrs.js +7 -0
- package/dist/runtime/html/helpers/data-marko.js +2 -2
- package/dist/runtime/html/helpers/escape-quotes.js +1 -1
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/helpers/merge-attrs.js +38 -7
- package/dist/runtime/html/index.js +2 -2
- package/dist/runtime/renderable.js +9 -6
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +86 -86
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +7 -7
- package/dist/runtime/vdom/VElement.js +61 -50
- package/dist/runtime/vdom/VFragment.js +8 -8
- package/dist/runtime/vdom/VNode.js +36 -36
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/attrs.js +24 -4
- package/dist/runtime/vdom/helpers/merge-attrs.js +16 -0
- package/dist/runtime/vdom/helpers/v-element.js +1 -1
- package/dist/runtime/vdom/helpers/v-text.js +1 -1
- package/dist/runtime/vdom/hot-reload.js +19 -19
- package/dist/runtime/vdom/index.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +5 -5
- package/dist/runtime/vdom/morphdom/helpers.js +5 -5
- package/dist/runtime/vdom/morphdom/index.js +56 -56
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +7 -7
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +14 -14
- package/docs/10-awesome-marko-features.md +1 -1
- package/docs/body-content.md +3 -3
- package/docs/class-components.md +6 -6
- package/docs/cloudflare-workers.md +3 -3
- package/docs/compiler.md +5 -5
- package/docs/express.md +2 -2
- package/docs/http.md +1 -1
- package/docs/koa.md +1 -1
- package/docs/lasso.md +1 -1
- package/docs/marko-vs-react.md +2 -2
- package/docs/rendering.md +6 -6
- package/docs/rollup.md +30 -30
- package/docs/troubleshooting-streaming.md +1 -1
- package/docs/typescript.md +1 -1
- package/docs/vite.md +3 -3
- package/docs/webpack.md +25 -25
- package/docs/why-is-marko-fast.md +2 -2
- package/index.d.ts +1 -0
- package/legacy-components-browser.marko +15 -0
- package/legacy-components.js +7 -0
- package/package.json +51 -45
- package/src/compiler/config.js +1 -1
- package/src/compiler/index.js +5 -5
- package/src/core-tags/core/__flush_here_and_after__.js +1 -1
- package/src/core-tags/core/await/AsyncValue.js +1 -1
- package/src/core-tags/core/await/renderer.js +8 -4
- package/src/core-tags/core/await/reorderer-renderer.js +1 -1
- package/src/node-require/browser-refresh.js +2 -2
- package/src/node-require/index.js +2 -2
- package/src/node_modules/@internal/components-beginComponent/index.js +16 -6
- package/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +331 -0
- package/src/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/src/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/src/node_modules/@internal/components-entry/index.js +65 -37
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
- package/src/node_modules/@internal/components-entry-legacy/index.js +15 -0
- package/src/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/src/node_modules/@internal/components-registry/index-browser.js +33 -6
- package/src/node_modules/@internal/components-util/index.js +10 -0
- package/src/runtime/RenderResult.js +3 -3
- package/src/runtime/components/Component.js +16 -18
- package/src/runtime/components/ComponentDef.js +22 -8
- package/src/runtime/components/ComponentsContext.js +1 -1
- package/src/runtime/components/State.js +2 -2
- package/src/runtime/components/attach-detach.js +1 -1
- package/src/runtime/components/dom-data.js +1 -1
- package/src/runtime/components/legacy/browser.json +9 -0
- package/src/runtime/components/legacy/defineComponent-legacy.js +32 -0
- package/src/runtime/components/legacy/defineRenderer-legacy.js +171 -0
- package/src/runtime/components/legacy/defineWidget-legacy.js +1 -0
- package/src/runtime/components/legacy/dependencies/html.js +3 -0
- package/src/runtime/components/legacy/dependencies/index.js +178 -0
- package/src/runtime/components/legacy/dependencies/vdom.js +3 -0
- package/src/runtime/components/legacy/index.js +1 -0
- package/src/runtime/components/legacy/jquery.js +51 -0
- package/src/runtime/components/legacy/ready.js +152 -0
- package/src/runtime/components/legacy/renderer-legacy.js +230 -0
- package/src/runtime/components/renderer.js +4 -0
- package/src/runtime/components/update-manager.js +1 -1
- package/src/runtime/dom-insert.js +1 -1
- package/src/runtime/helpers/dynamic-tag.js +2 -4
- package/src/runtime/helpers/style-value.js +7 -2
- package/src/runtime/html/AsyncStream.js +5 -5
- package/src/runtime/html/BufferedWriter.js +1 -1
- package/src/runtime/html/StringWriter.js +1 -1
- package/src/runtime/html/helpers/attr.js +15 -2
- package/src/runtime/html/helpers/attrs.js +7 -0
- package/src/runtime/html/helpers/merge-attrs.js +38 -7
- package/src/runtime/html/hot-reload.js +1 -1
- package/src/runtime/html/index.js +2 -2
- package/src/runtime/renderable.js +5 -2
- package/src/runtime/vdom/AsyncVDOMBuilder.js +2 -2
- package/src/runtime/vdom/VComponent.js +1 -1
- package/src/runtime/vdom/VDocumentFragment.js +1 -1
- package/src/runtime/vdom/VElement.js +17 -6
- package/src/runtime/vdom/VFragment.js +1 -1
- package/src/runtime/vdom/VNode.js +1 -1
- package/src/runtime/vdom/VText.js +1 -1
- package/src/runtime/vdom/helpers/attrs.js +26 -6
- package/src/runtime/vdom/helpers/merge-attrs.js +16 -0
- package/src/runtime/vdom/hot-reload.js +1 -1
- package/src/runtime/vdom/index.js +2 -2
- package/src/runtime/vdom/morphdom/fragment.js +1 -1
- package/src/runtime/vdom/morphdom/specialElHandlers.js +1 -1
- package/src/taglib/index.js +1 -1
- package/tags-html.d.ts +9 -0
@@ -2,30 +2,30 @@
|
|
2
2
|
var specialElHandlers = require("./specialElHandlers");
|
3
3
|
var KeySequence = require("../../components/KeySequence");
|
4
4
|
var componentsUtil = require("@internal/components-util");
|
5
|
-
var existingComponentLookup = componentsUtil.
|
6
|
-
var destroyNodeRecursive = componentsUtil.
|
5
|
+
var existingComponentLookup = componentsUtil._o_;
|
6
|
+
var destroyNodeRecursive = componentsUtil._U_;
|
7
7
|
var addComponentRootToKeyedElements =
|
8
|
-
componentsUtil.
|
9
|
-
var normalizeComponentKey = componentsUtil.
|
10
|
-
var VElement = require("../vdom").
|
11
|
-
var virtualizeElement = VElement.
|
12
|
-
var morphAttrs = VElement.
|
8
|
+
componentsUtil._p_;
|
9
|
+
var normalizeComponentKey = componentsUtil._X_;
|
10
|
+
var VElement = require("../vdom").bs_;
|
11
|
+
var virtualizeElement = VElement.ce_;
|
12
|
+
var morphAttrs = VElement.cf_;
|
13
13
|
var eventDelegation = require("../../components/event-delegation");
|
14
14
|
var fragment = require("./fragment");
|
15
15
|
var helpers = require("./helpers");
|
16
16
|
var domData = require("../../components/dom-data");
|
17
|
-
var keysByDOMNode = domData.
|
18
|
-
var componentByDOMNode = domData.
|
19
|
-
var vElementByDOMNode = domData.
|
20
|
-
var detachedByDOMNode = domData.
|
21
|
-
|
22
|
-
var insertBefore = helpers.
|
23
|
-
var insertAfter = helpers.
|
24
|
-
var nextSibling = helpers.
|
25
|
-
var firstChild = helpers.
|
26
|
-
var removeChild = helpers.
|
27
|
-
var createFragmentNode = fragment.
|
28
|
-
var beginFragmentNode = fragment.
|
17
|
+
var keysByDOMNode = domData._M_;
|
18
|
+
var componentByDOMNode = domData._r_;
|
19
|
+
var vElementByDOMNode = domData._N_;
|
20
|
+
var detachedByDOMNode = domData.aT_;
|
21
|
+
|
22
|
+
var insertBefore = helpers.bd_;
|
23
|
+
var insertAfter = helpers.be_;
|
24
|
+
var nextSibling = helpers.cj_;
|
25
|
+
var firstChild = helpers.ay_;
|
26
|
+
var removeChild = helpers.bf_;
|
27
|
+
var createFragmentNode = fragment._n_;
|
28
|
+
var beginFragmentNode = fragment.cp_;
|
29
29
|
|
30
30
|
var ELEMENT_NODE = 1;
|
31
31
|
var TEXT_NODE = 3;
|
@@ -43,7 +43,7 @@ function isAutoKey(key) {
|
|
43
43
|
}
|
44
44
|
|
45
45
|
function compareNodeNames(fromEl, toEl) {
|
46
|
-
return fromEl.
|
46
|
+
return fromEl.bZ_ === toEl.bZ_;
|
47
47
|
}
|
48
48
|
|
49
49
|
function caseInsensitiveCompare(a, b) {
|
@@ -52,7 +52,7 @@ function caseInsensitiveCompare(a, b) {
|
|
52
52
|
|
53
53
|
function onNodeAdded(node, componentsContext) {
|
54
54
|
if (node.nodeType === ELEMENT_NODE) {
|
55
|
-
eventDelegation.
|
55
|
+
eventDelegation.aS_(node, componentsContext);
|
56
56
|
}
|
57
57
|
}
|
58
58
|
|
@@ -74,12 +74,12 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
74
74
|
ownerComponent,
|
75
75
|
parentComponent)
|
76
76
|
{
|
77
|
-
var realNode = vNode.
|
77
|
+
var realNode = vNode.bQ_(host, parentEl.namespaceURI);
|
78
78
|
insertBefore(realNode, referenceEl, parentEl);
|
79
79
|
|
80
80
|
if (
|
81
|
-
vNode.
|
82
|
-
vNode.
|
81
|
+
vNode.bT_ === ELEMENT_NODE ||
|
82
|
+
vNode.bT_ === FRAGMENT_NODE)
|
83
83
|
{
|
84
84
|
if (key) {
|
85
85
|
keysByDOMNode.set(realNode, key);
|
@@ -88,7 +88,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
88
88
|
realNode;
|
89
89
|
}
|
90
90
|
|
91
|
-
if (vNode.
|
91
|
+
if (vNode.bZ_ !== "textarea") {
|
92
92
|
morphChildren(realNode, vNode, parentComponent);
|
93
93
|
}
|
94
94
|
|
@@ -105,7 +105,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
105
105
|
ownerComponent,
|
106
106
|
parentComponent)
|
107
107
|
{
|
108
|
-
var rootNode = component.
|
108
|
+
var rootNode = component._G_ = insertBefore(
|
109
109
|
createFragmentNode(),
|
110
110
|
referenceNode,
|
111
111
|
referenceNodeParentEl);
|
@@ -127,7 +127,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
127
127
|
}
|
128
128
|
|
129
129
|
function morphComponent(component, vComponent) {
|
130
|
-
morphChildren(component.
|
130
|
+
morphChildren(component._G_, vComponent, component);
|
131
131
|
}
|
132
132
|
|
133
133
|
var detachedNodes = [];
|
@@ -148,7 +148,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
148
148
|
|
149
149
|
function morphChildren(fromNode, toNode, parentComponent) {
|
150
150
|
var curFromNodeChild = firstChild(fromNode);
|
151
|
-
var curToNodeChild = toNode.
|
151
|
+
var curToNodeChild = toNode.ay_;
|
152
152
|
|
153
153
|
var curToNodeKey;
|
154
154
|
var curFromNodeKey;
|
@@ -162,16 +162,16 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
162
162
|
var fromComponent;
|
163
163
|
|
164
164
|
outer: while (curToNodeChild) {
|
165
|
-
toNextSibling = curToNodeChild.
|
166
|
-
curToNodeType = curToNodeChild.
|
167
|
-
curToNodeKey = curToNodeChild.
|
165
|
+
toNextSibling = curToNodeChild.cj_;
|
166
|
+
curToNodeType = curToNodeChild.bT_;
|
167
|
+
curToNodeKey = curToNodeChild.bS_;
|
168
168
|
|
169
169
|
// Skip <!doctype>
|
170
170
|
if (curFromNodeChild && curFromNodeChild.nodeType === DOCTYPE_NODE) {
|
171
171
|
curFromNodeChild = nextSibling(curFromNodeChild);
|
172
172
|
}
|
173
173
|
|
174
|
-
var ownerComponent = curToNodeChild.
|
174
|
+
var ownerComponent = curToNodeChild._P_ || parentComponent;
|
175
175
|
var referenceComponent;
|
176
176
|
|
177
177
|
if (curToNodeType === COMPONENT_NODE) {
|
@@ -182,7 +182,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
182
182
|
{
|
183
183
|
if (isHydrate === true) {
|
184
184
|
var rootNode = beginFragmentNode(curFromNodeChild, fromNode);
|
185
|
-
component.
|
185
|
+
component._G_ = rootNode;
|
186
186
|
componentByDOMNode.set(rootNode, component);
|
187
187
|
|
188
188
|
if (ownerComponent && curToNodeKey) {
|
@@ -215,7 +215,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
215
215
|
|
216
216
|
}
|
217
217
|
} else {
|
218
|
-
if (matchingFromComponent.
|
218
|
+
if (matchingFromComponent._G_ !== curFromNodeChild) {
|
219
219
|
if (
|
220
220
|
curFromNodeChild && (
|
221
221
|
fromComponent = componentByDOMNode.get(curFromNodeChild)) &&
|
@@ -225,7 +225,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
225
225
|
{
|
226
226
|
// The component associated with the current real DOM node was not rendered
|
227
227
|
// so we should just remove it out of the real DOM by destroying it
|
228
|
-
curFromNodeChild = nextSibling(fromComponent.
|
228
|
+
curFromNodeChild = nextSibling(fromComponent._G_);
|
229
229
|
destroyComponent(fromComponent);
|
230
230
|
continue;
|
231
231
|
}
|
@@ -233,7 +233,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
233
233
|
// We need to move the existing component into
|
234
234
|
// the correct location
|
235
235
|
insertBefore(
|
236
|
-
matchingFromComponent.
|
236
|
+
matchingFromComponent._G_,
|
237
237
|
curFromNodeChild,
|
238
238
|
fromNode);
|
239
239
|
|
@@ -267,7 +267,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
267
267
|
// up elements
|
268
268
|
curToNodeKey = (
|
269
269
|
keySequences[referenceComponent.id] || (
|
270
|
-
keySequences[referenceComponent.id] = new KeySequence())).
|
270
|
+
keySequences[referenceComponent.id] = new KeySequence())).aK_(
|
271
271
|
curToNodeKey);
|
272
272
|
|
273
273
|
if (curFromNodeChild) {
|
@@ -315,11 +315,11 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
315
315
|
curToNodeChild.o_ ||
|
316
316
|
caseInsensitiveCompare(
|
317
317
|
curFromNodeChild.nodeName,
|
318
|
-
curToNodeChild.
|
318
|
+
curToNodeChild.bZ_ || "")))
|
319
319
|
|
320
320
|
{
|
321
321
|
curVFromNodeChild = virtualizeElement(curFromNodeChild);
|
322
|
-
curVFromNodeChild.
|
322
|
+
curVFromNodeChild.bZ_ = curToNodeChild.bZ_;
|
323
323
|
keysByDOMNode.set(curFromNodeChild, curToNodeKey);
|
324
324
|
referenceComponent.l_[curToNodeKey] =
|
325
325
|
curFromNodeChild;
|
@@ -339,7 +339,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
339
339
|
curFromNodeChild = fromNextSibling;
|
340
340
|
continue;
|
341
341
|
} else if (
|
342
|
-
curToNodeChild.
|
342
|
+
curToNodeChild.bT_ === FRAGMENT_NODE &&
|
343
343
|
curFromNodeChild.nodeType === COMMENT_NODE)
|
344
344
|
{
|
345
345
|
var content = curFromNodeChild.nodeValue;
|
@@ -419,7 +419,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
419
419
|
|
420
420
|
if (
|
421
421
|
toNextSibling &&
|
422
|
-
toNextSibling.
|
422
|
+
toNextSibling.bS_ === curFromNodeKey)
|
423
423
|
{
|
424
424
|
// Single element swap
|
425
425
|
|
@@ -524,18 +524,18 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
524
524
|
|
525
525
|
if (
|
526
526
|
caseInsensitiveCompare(
|
527
|
-
curVFromNodeChild.
|
528
|
-
curToNodeChild.
|
527
|
+
curVFromNodeChild.bZ_,
|
528
|
+
curToNodeChild.bZ_))
|
529
529
|
|
530
530
|
{
|
531
|
-
curVFromNodeChild.
|
531
|
+
curVFromNodeChild.bZ_ = curToNodeChild.bZ_;
|
532
532
|
}
|
533
533
|
} else {
|
534
534
|
// Skip over nodes that don't look like ours...
|
535
535
|
curFromNodeChild = fromNextSibling;
|
536
536
|
continue;
|
537
537
|
}
|
538
|
-
} else if (curFromNodeKey = curVFromNodeChild.
|
538
|
+
} else if (curFromNodeKey = curVFromNodeChild.bS_) {
|
539
539
|
// We have a keyed element here but our target VDOM node
|
540
540
|
// is not keyed so this not doesn't belong
|
541
541
|
isCompatible = false;
|
@@ -569,14 +569,14 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
569
569
|
isHydrate === true &&
|
570
570
|
toNextSibling &&
|
571
571
|
curFromNodeType === TEXT_NODE &&
|
572
|
-
toNextSibling.
|
572
|
+
toNextSibling.bT_ === TEXT_NODE)
|
573
573
|
{
|
574
574
|
fromNextSibling = curFromNodeChild.splitText(
|
575
|
-
curToNodeChild.
|
575
|
+
curToNodeChild.cl_.length);
|
576
576
|
|
577
577
|
}
|
578
|
-
if (curFromNodeChild.nodeValue !== curToNodeChild.
|
579
|
-
curFromNodeChild.nodeValue = curToNodeChild.
|
578
|
+
if (curFromNodeChild.nodeValue !== curToNodeChild.cl_) {
|
579
|
+
curFromNodeChild.nodeValue = curToNodeChild.cl_;
|
580
580
|
}
|
581
581
|
}
|
582
582
|
}
|
@@ -610,10 +610,10 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
610
610
|
}
|
611
611
|
|
612
612
|
// We have processed all of the "to nodes".
|
613
|
-
if (fromNode.
|
613
|
+
if (fromNode.co_) {
|
614
614
|
// If we are in an unfinished fragment, we have reached the end of the nodes
|
615
615
|
// we were matching up and need to end the fragment
|
616
|
-
fromNode.
|
616
|
+
fromNode.co_(curFromNodeChild);
|
617
617
|
} else {
|
618
618
|
// If curFromNodeChild is non-null then we still have some from nodes
|
619
619
|
// left over that need to be removed
|
@@ -642,7 +642,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
642
642
|
referenceComponent = parentComponent;
|
643
643
|
} else {
|
644
644
|
referenceComponent =
|
645
|
-
curVFromNodeChild && curVFromNodeChild.
|
645
|
+
curVFromNodeChild && curVFromNodeChild._P_;
|
646
646
|
}
|
647
647
|
|
648
648
|
detachNode(curFromNodeChild, fromNode, referenceComponent);
|
@@ -653,10 +653,10 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
653
653
|
}
|
654
654
|
|
655
655
|
function morphEl(fromEl, vFromEl, toEl, parentComponent) {
|
656
|
-
var nodeName = toEl.
|
656
|
+
var nodeName = toEl.bZ_;
|
657
657
|
|
658
|
-
var constId = toEl.
|
659
|
-
if (constId !== undefined && vFromEl.
|
658
|
+
var constId = toEl.ca_;
|
659
|
+
if (constId !== undefined && vFromEl.ca_ === constId) {
|
660
660
|
return;
|
661
661
|
}
|
662
662
|
|
@@ -698,7 +698,7 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
|
698
698
|
detachedFromComponent !== true && detachedFromComponent);
|
699
699
|
|
700
700
|
|
701
|
-
if (eventDelegation.
|
701
|
+
if (eventDelegation.al_(node) != false) {
|
702
702
|
removeChild(node);
|
703
703
|
}
|
704
704
|
}
|
@@ -10,16 +10,16 @@
|
|
10
10
|
}
|
11
11
|
|
12
12
|
function forEachOption(el, fn, i) {
|
13
|
-
var curChild = el.
|
13
|
+
var curChild = el.ay_;
|
14
14
|
|
15
15
|
while (curChild) {
|
16
|
-
if (curChild.
|
16
|
+
if (curChild.bZ_ === "option") {
|
17
17
|
fn(curChild, ++i);
|
18
18
|
} else {
|
19
19
|
i = forEachOption(curChild, fn, i);
|
20
20
|
}
|
21
21
|
|
22
|
-
curChild = curChild.
|
22
|
+
curChild = curChild.cj_;
|
23
23
|
}
|
24
24
|
|
25
25
|
return i;
|
@@ -52,13 +52,13 @@ SpecialElHandlers.prototype = {
|
|
52
52
|
fromEl.value = toEl.q_;
|
53
53
|
}
|
54
54
|
|
55
|
-
if (fromEl.hasAttribute("value") && !toEl.
|
55
|
+
if (fromEl.hasAttribute("value") && !toEl.cc_("value")) {
|
56
56
|
fromEl.removeAttribute("value");
|
57
57
|
}
|
58
58
|
},
|
59
59
|
|
60
60
|
textarea: function (fromEl, toEl) {
|
61
|
-
if (toEl.
|
61
|
+
if (toEl.cm_) {
|
62
62
|
return;
|
63
63
|
}
|
64
64
|
|
@@ -84,12 +84,12 @@ SpecialElHandlers.prototype = {
|
|
84
84
|
}
|
85
85
|
},
|
86
86
|
select: function (fromEl, toEl) {
|
87
|
-
if (!toEl.
|
87
|
+
if (!toEl.cc_("multiple")) {
|
88
88
|
var selected = 0;
|
89
89
|
forEachOption(
|
90
90
|
toEl,
|
91
91
|
function (option, i) {
|
92
|
-
if (option.
|
92
|
+
if (option.cc_("selected")) {
|
93
93
|
selected = i;
|
94
94
|
}
|
95
95
|
},
|
@@ -11,7 +11,7 @@ var specialHtmlRegexp = /[&<]/;
|
|
11
11
|
function virtualizeChildNodes(node, vdomParent, ownerComponent) {
|
12
12
|
var curChild = node.firstChild;
|
13
13
|
while (curChild) {
|
14
|
-
vdomParent.
|
14
|
+
vdomParent.bJ_(virtualize(curChild, ownerComponent));
|
15
15
|
curChild = curChild.nextSibling;
|
16
16
|
}
|
17
17
|
}
|
@@ -19,7 +19,7 @@ function virtualizeChildNodes(node, vdomParent, ownerComponent) {
|
|
19
19
|
function virtualize(node, ownerComponent) {
|
20
20
|
switch (node.nodeType) {
|
21
21
|
case 1:
|
22
|
-
return VElement.
|
22
|
+
return VElement.ce_(node, virtualizeChildNodes, ownerComponent);
|
23
23
|
case 3:
|
24
24
|
return new VText(node.nodeValue, ownerComponent);
|
25
25
|
case 11:
|
@@ -38,7 +38,7 @@ function virtualizeHTML(html, ownerComponent) {
|
|
38
38
|
var curChild = parseHTML(html);
|
39
39
|
|
40
40
|
while (curChild) {
|
41
|
-
vdomFragment.
|
41
|
+
vdomFragment.bJ_(virtualize(curChild, ownerComponent));
|
42
42
|
curChild = curChild.nextSibling;
|
43
43
|
}
|
44
44
|
|
@@ -65,18 +65,18 @@ Node_prototype.t = function (value) {
|
|
65
65
|
}
|
66
66
|
}
|
67
67
|
|
68
|
-
this.
|
69
|
-
return this.
|
68
|
+
this.bJ_(vdomNode || new VText(value.toString()));
|
69
|
+
return this.cb_();
|
70
70
|
};
|
71
71
|
|
72
|
-
Node_prototype.
|
73
|
-
return this.
|
72
|
+
Node_prototype.bO_ = function () {
|
73
|
+
return this.bJ_(new VDocumentFragment());
|
74
74
|
};
|
75
75
|
|
76
|
-
exports.
|
77
|
-
exports.
|
78
|
-
exports.
|
79
|
-
exports.
|
80
|
-
exports.
|
81
|
-
exports.
|
82
|
-
exports.
|
76
|
+
exports.bt_ = VDocumentFragment;
|
77
|
+
exports.bs_ = VElement;
|
78
|
+
exports.bu_ = VText;
|
79
|
+
exports.bv_ = VComponent;
|
80
|
+
exports.bw_ = VFragment;
|
81
|
+
exports.ce_ = virtualize;
|
82
|
+
exports.bx_ = virtualizeHTML;
|
package/docs/body-content.md
CHANGED
package/docs/class-components.md
CHANGED
@@ -110,7 +110,7 @@ In your `component.js` file, export the component’s class:
|
|
110
110
|
export default class {
|
111
111
|
onCreate() {
|
112
112
|
this.state = {
|
113
|
-
count: 0
|
113
|
+
count: 0,
|
114
114
|
};
|
115
115
|
}
|
116
116
|
increment() {
|
@@ -144,12 +144,12 @@ If you target browsers that does not support classes, a plain object of methods
|
|
144
144
|
export default {
|
145
145
|
onCreate: function () {
|
146
146
|
this.state = {
|
147
|
-
count: 0
|
147
|
+
count: 0,
|
148
148
|
};
|
149
149
|
},
|
150
150
|
increment: function () {
|
151
151
|
this.state.count++;
|
152
|
-
}
|
152
|
+
},
|
153
153
|
};
|
154
154
|
```
|
155
155
|
|
@@ -217,7 +217,7 @@ class {
|
|
217
217
|
export default {
|
218
218
|
shout() {
|
219
219
|
alert(`My favorite number is ${this.number}!`);
|
220
|
-
}
|
220
|
+
},
|
221
221
|
};
|
222
222
|
```
|
223
223
|
|
@@ -616,7 +616,7 @@ Destroys the component by unsubscribing from all listeners made using the `subsc
|
|
616
616
|
```js
|
617
617
|
component.destroy({
|
618
618
|
removeNode: false, // true by default
|
619
|
-
recursive: false // true by default
|
619
|
+
recursive: false, // true by default
|
620
620
|
});
|
621
621
|
```
|
622
622
|
|
@@ -738,7 +738,7 @@ Changes the value of multiple state properties:
|
|
738
738
|
```js
|
739
739
|
this.setState({
|
740
740
|
disabled: true,
|
741
|
-
size: "large"
|
741
|
+
size: "large",
|
742
742
|
});
|
743
743
|
```
|
744
744
|
|
@@ -12,7 +12,7 @@ After that point, imported `.marko` files will export a `.stream` method that re
|
|
12
12
|
```js
|
13
13
|
import Template from "./index.marko";
|
14
14
|
|
15
|
-
addEventListener("fetch", event => {
|
15
|
+
addEventListener("fetch", (event) => {
|
16
16
|
event.respondWith(handleRequest(event.request));
|
17
17
|
});
|
18
18
|
|
@@ -20,8 +20,8 @@ async function handleRequest(request) {
|
|
20
20
|
return new Response(Template.stream(), {
|
21
21
|
headers: {
|
22
22
|
status: 200,
|
23
|
-
headers: { "content-type": "text/html;charset=UTF-8" }
|
24
|
-
}
|
23
|
+
headers: { "content-type": "text/html;charset=UTF-8" },
|
24
|
+
},
|
25
25
|
});
|
26
26
|
}
|
27
27
|
```
|
package/docs/compiler.md
CHANGED
@@ -46,10 +46,10 @@ compiler.compileFileSync(filename: string, options?: CompileOptions): CompileRes
|
|
46
46
|
import * as compiler from "@marko/compiler";
|
47
47
|
|
48
48
|
const asyncResult = await compiler.compileFile("./src/index.marko", {
|
49
|
-
modules: "cjs"
|
49
|
+
modules: "cjs",
|
50
50
|
});
|
51
51
|
const syncResult = compiler.compileFileSync("./src/index.marko", {
|
52
|
-
modules: "cjs"
|
52
|
+
modules: "cjs",
|
53
53
|
});
|
54
54
|
```
|
55
55
|
|
@@ -73,7 +73,7 @@ const asyncResult = await compiler.compile(
|
|
73
73
|
{ modules: "cjs" }
|
74
74
|
);
|
75
75
|
const syncResult = compiler.compileSync("<h1>Hello!</>", "./src/index.marko", {
|
76
|
-
modules: "cjs"
|
76
|
+
modules: "cjs",
|
77
77
|
});
|
78
78
|
```
|
79
79
|
|
@@ -92,10 +92,10 @@ Or you can pass options objects when calling compile functions. Each property wi
|
|
92
92
|
import * as compiler from "@marko/compiler";
|
93
93
|
compiler.configure({
|
94
94
|
output: "dom",
|
95
|
-
sourceMaps: true
|
95
|
+
sourceMaps: true,
|
96
96
|
});
|
97
97
|
const result = compiler.compileFileSync("./example.marko", {
|
98
|
-
output: "html"
|
98
|
+
output: "html",
|
99
99
|
});
|
100
100
|
```
|
101
101
|
|
package/docs/express.md
CHANGED
@@ -43,7 +43,7 @@ app.get("/", function (req, res) {
|
|
43
43
|
res.marko(template, {
|
44
44
|
name: "Frank",
|
45
45
|
count: 30,
|
46
|
-
colors: ["red", "green", "blue"]
|
46
|
+
colors: ["red", "green", "blue"],
|
47
47
|
});
|
48
48
|
});
|
49
49
|
|
@@ -56,7 +56,7 @@ app.listen(8080);
|
|
56
56
|
> app.get("/", function (req, res) {
|
57
57
|
> res.marko(template, {
|
58
58
|
> params: req.params,
|
59
|
-
> submitted: req.method === "POST" && req.body
|
59
|
+
> submitted: req.method === "POST" && req.body,
|
60
60
|
> });
|
61
61
|
> });
|
62
62
|
> ```
|
package/docs/http.md
CHANGED
package/docs/koa.md
CHANGED
package/docs/lasso.md
CHANGED
package/docs/marko-vs-react.md
CHANGED
@@ -454,11 +454,11 @@ template:
|
|
454
454
|
function renderColors(colors) {
|
455
455
|
return (
|
456
456
|
<ul>
|
457
|
-
{colors.map(color => (
|
457
|
+
{colors.map((color) => (
|
458
458
|
<li
|
459
459
|
className="color"
|
460
460
|
style={{
|
461
|
-
backgroundColor: color
|
461
|
+
backgroundColor: color,
|
462
462
|
}}
|
463
463
|
>
|
464
464
|
{color}
|
package/docs/rendering.md
CHANGED
@@ -70,7 +70,7 @@ The `render` method returns an async `out` which is used to generate HTML on the
|
|
70
70
|
import View from "./view.marko";
|
71
71
|
var resultPromise = View.render({});
|
72
72
|
|
73
|
-
resultPromise.then(result => {
|
73
|
+
resultPromise.then((result) => {
|
74
74
|
result.appendTo(document.body);
|
75
75
|
});
|
76
76
|
```
|
@@ -216,8 +216,8 @@ Global values persist across renders.
|
|
216
216
|
```js
|
217
217
|
View.render({
|
218
218
|
$global: {
|
219
|
-
flags: ["mobile"]
|
220
|
-
}
|
219
|
+
flags: ["mobile"],
|
220
|
+
},
|
221
221
|
});
|
222
222
|
```
|
223
223
|
|
@@ -254,9 +254,9 @@ app.get("/", (req, res) => {
|
|
254
254
|
|
255
255
|
serializedGlobals: {
|
256
256
|
isIos: true, // Tell Marko to serialize `isIos`
|
257
|
-
isAndroid: true // Tell Marko to serialize `isAndroid`
|
258
|
-
}
|
259
|
-
}
|
257
|
+
isAndroid: true, // Tell Marko to serialize `isAndroid`
|
258
|
+
},
|
259
|
+
},
|
260
260
|
},
|
261
261
|
res
|
262
262
|
);
|