marko 4.25.0 → 4.26.1
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/markoc.js +18 -18
- package/dist/compiler/CompileContext.js +3 -8
- package/dist/core-tags/components/init-components-tag.js +1 -52
- package/dist/core-tags/components/package.json +1 -3
- package/dist/core-tags/components/preferred-script-location-tag.js +2 -2
- package/dist/core-tags/components/preserve-tag.js +1 -27
- package/dist/core-tags/core/await/AsyncValue.js +20 -20
- package/dist/core-tags/core/await/renderer.js +11 -12
- package/dist/core-tags/core/await/reorderer-renderer.js +11 -6
- package/dist/index.js +1 -39
- package/dist/node-require/index.js +11 -0
- package/dist/node_modules/@internal/components-beginComponent/index-browser.js +12 -0
- package/dist/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +15 -14
- package/dist/node_modules/@internal/components-beginComponent/package.json +11 -0
- package/dist/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +47 -47
- 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-endComponent/index.js +11 -0
- package/dist/node_modules/@internal/components-endComponent/package.json +11 -0
- package/dist/node_modules/@internal/components-entry/index-browser.js +9 -0
- package/dist/node_modules/@internal/components-entry/index.js +285 -0
- package/dist/node_modules/@internal/components-entry/package.json +11 -0
- package/dist/{runtime/components/legacy → node_modules/@internal/components-entry-legacy}/index-browser.js +14 -15
- package/dist/node_modules/@internal/components-entry-legacy/index.js +14 -0
- package/dist/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/dist/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +180 -79
- package/dist/node_modules/@internal/components-registry/index.js +34 -0
- package/dist/node_modules/@internal/components-registry/package.json +11 -0
- package/dist/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +23 -24
- package/dist/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +10 -12
- package/dist/node_modules/@internal/components-util/package.json +11 -0
- package/dist/node_modules/@internal/create-readable/index-browser.js +25 -0
- package/dist/node_modules/@internal/create-readable/index.js +52 -0
- package/dist/node_modules/@internal/create-readable/package.json +11 -0
- package/dist/node_modules/@internal/init-components-tag/index.js +52 -0
- package/dist/node_modules/@internal/init-components-tag/package.json +11 -0
- package/dist/{loader/index-default.js → node_modules/@internal/loader/index.js} +1 -1
- package/dist/node_modules/@internal/loader/package.json +11 -0
- package/dist/{core-tags/components/preserve-tag-browser.js → node_modules/@internal/preserve-tag/index-browser.js} +8 -8
- package/dist/node_modules/@internal/preserve-tag/index.js +27 -0
- package/dist/node_modules/@internal/preserve-tag/package.json +11 -0
- package/dist/node_modules/@internal/set-immediate/index-browser.js +17 -0
- package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -0
- package/dist/node_modules/@internal/set-immediate/index.js +2 -0
- package/dist/node_modules/@internal/set-immediate/package.json +11 -0
- package/dist/runtime/RenderResult.js +24 -19
- package/dist/runtime/components/Component.js +154 -151
- package/dist/runtime/components/ComponentDef.js +28 -28
- package/dist/runtime/components/ComponentsContext.js +19 -19
- package/dist/runtime/components/GlobalComponentsContext.js +4 -4
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +13 -13
- package/dist/runtime/components/State.js +28 -28
- package/dist/runtime/components/attach-detach.js +9 -9
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +6 -6
- package/dist/runtime/components/event-delegation.js +15 -16
- package/dist/runtime/components/index.js +1 -285
- package/dist/runtime/components/legacy/browser.json +1 -1
- package/dist/runtime/components/legacy/defineComponent-legacy.js +1 -1
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +18 -19
- package/dist/runtime/components/legacy/defineWidget-legacy.js +1 -18
- package/dist/runtime/components/legacy/dependencies/html.js +1 -1
- package/dist/runtime/components/legacy/dependencies/index.js +9 -9
- package/dist/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
- package/dist/runtime/components/legacy/index.js +1 -14
- package/dist/runtime/components/legacy/renderer-legacy.js +43 -43
- package/dist/runtime/components/registry.js +1 -34
- package/dist/runtime/components/renderer.js +38 -38
- package/dist/runtime/components/update-manager.js +10 -10
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +6 -6
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/assign.js +3 -2
- package/dist/runtime/helpers/dynamic-tag.js +14 -16
- package/dist/runtime/helpers/load-template.js +1 -1
- package/dist/runtime/helpers/merge.js +3 -1
- package/dist/runtime/helpers/style-value.js +2 -2
- package/dist/runtime/html/AsyncStream.js +61 -52
- package/dist/runtime/html/BufferedWriter.js +5 -1
- package/dist/runtime/html/StringWriter.js +7 -3
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +4 -4
- package/dist/runtime/html/helpers/attrs.js +3 -3
- package/dist/runtime/html/helpers/data-marko.js +4 -6
- package/dist/runtime/html/helpers/escape-quotes.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/helpers/props-script.js +1 -1
- package/dist/runtime/html/index.js +15 -12
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +102 -103
- package/dist/runtime/vdom/VComment.js +7 -7
- package/dist/runtime/vdom/VComponent.js +5 -5
- package/dist/runtime/vdom/VDocumentFragment.js +8 -8
- package/dist/runtime/vdom/VElement.js +55 -54
- package/dist/runtime/vdom/VFragment.js +9 -9
- package/dist/runtime/vdom/VNode.js +30 -30
- package/dist/runtime/vdom/VText.js +7 -7
- package/dist/runtime/vdom/helpers/v-element.js +1 -1
- package/dist/runtime/vdom/helpers/v-text.js +1 -1
- package/dist/runtime/vdom/index.js +12 -22
- package/dist/runtime/vdom/morphdom/fragment.js +5 -5
- package/dist/runtime/vdom/morphdom/helpers.js +3 -3
- package/dist/runtime/vdom/morphdom/index.js +72 -68
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +8 -8
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +19 -21
- package/docs/body-content.md +2 -2
- package/docs/class-components.md +3 -3
- package/docs/express.md +1 -1
- package/docs/lasso.md +3 -6
- package/docs/marko-v4.md +5 -5
- package/docs/redux.md +1 -1
- package/docs/server-side-rendering.md +2 -2
- package/docs/why-is-marko-fast.md +2 -10
- package/package.json +1 -1
- package/src/browser-refresh.js +2 -2
- package/src/compiler/CodeWriter.js +1 -3
- package/src/compiler/CompileContext.js +3 -8
- package/src/compiler/Compiler.js +4 -4
- package/src/compiler/HtmlJsParser.js +1 -1
- package/src/compiler/Migrator.js +1 -1
- package/src/compiler/Parser.js +3 -3
- package/src/compiler/ast/CustomTag.js +9 -11
- package/src/compiler/ast/HtmlAttribute/html/generateCode.js +2 -2
- package/src/compiler/ast/HtmlAttribute/index.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/generateCode.js +1 -1
- package/src/compiler/ast/TemplateRoot.js +1 -1
- package/src/compiler/ast/Text/html/generateCode.js +3 -3
- package/src/compiler/ast/Text/vdom/generateCode.js +1 -1
- package/src/compiler/index.js +4 -4
- package/src/compiler/modules.js +4 -4
- package/src/compiler/util/finger-print.js +1 -1
- package/src/compiler/util/parseExpression.js +1 -1
- package/src/compiler/util/parseStatement.js +1 -1
- package/src/compiler/util/removeDashes.js +1 -1
- package/src/compiler/util/safeVarName.js +1 -1
- package/src/compiler/util/tokenizer.js +1 -1
- package/src/core-tags/cache/cached-fragment-tag-transformer.js +1 -1
- package/src/core-tags/cache/cached-fragment-tag.js +4 -4
- package/src/core-tags/cache/default-cache-manager.js +3 -3
- package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +1 -1
- package/src/core-tags/components/TransformHelper/convertToComponent.js +1 -1
- package/src/core-tags/components/TransformHelper/handleComponentPreserveAttrs.js +1 -1
- package/src/core-tags/components/init-components-tag.js +1 -54
- package/src/core-tags/components/package.json +1 -3
- package/src/core-tags/components/preferred-script-location-tag.js +1 -1
- package/src/core-tags/components/preserve-tag.js +1 -27
- package/src/core-tags/components/util/getTransformHelper.js +1 -1
- package/src/core-tags/core/await/AsyncValue.js +3 -3
- package/src/core-tags/core/await/noop-render.js +1 -1
- package/src/core-tags/core/await/renderer.js +8 -7
- package/src/core-tags/core/await/reorderer-renderer.js +35 -14
- package/src/core-tags/core/await/transformer.js +1 -1
- package/src/core-tags/core/core-transformer.js +2 -2
- package/src/core-tags/migrate/all-tags/index.js +1 -1
- package/src/core-tags/migrate/all-templates/index.js +1 -1
- package/src/core-tags/migrate/include-tag.js +3 -2
- package/src/core-tags/migrate/util/parseFor.js +3 -2
- package/src/core-tags/migrate/util/printJS.js +1 -1
- package/src/defineRenderer.js +1 -1
- package/src/express.js +1 -1
- package/src/hot-reload.js +5 -5
- package/src/index.js +1 -41
- package/src/legacy-helpers/notEmpty.js +1 -1
- package/src/node-require/index.js +12 -1
- package/src/{runtime/components/beginComponent-browser.js → node_modules/@internal/components-beginComponent/index-browser.js} +1 -1
- package/src/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +3 -2
- package/src/node_modules/@internal/components-beginComponent/package.json +11 -0
- package/src/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +21 -23
- 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/{runtime/components/endComponent.js → node_modules/@internal/components-endComponent/index.js} +1 -1
- package/src/node_modules/@internal/components-endComponent/package.json +11 -0
- package/src/node_modules/@internal/components-entry/index-browser.js +9 -0
- package/src/node_modules/@internal/components-entry/index.js +301 -0
- package/src/node_modules/@internal/components-entry/package.json +11 -0
- 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/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +240 -75
- package/src/node_modules/@internal/components-registry/index.js +44 -0
- package/src/node_modules/@internal/components-registry/package.json +11 -0
- package/src/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +11 -10
- package/src/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +0 -2
- package/src/node_modules/@internal/components-util/package.json +11 -0
- package/src/node_modules/@internal/create-readable/index-browser.js +30 -0
- package/src/node_modules/@internal/create-readable/index.js +57 -0
- package/src/node_modules/@internal/create-readable/package.json +11 -0
- package/src/node_modules/@internal/init-components-tag/index.js +54 -0
- package/src/node_modules/@internal/init-components-tag/package.json +11 -0
- package/src/{loader/index-default.js → node_modules/@internal/loader/index.js} +2 -2
- package/src/node_modules/@internal/loader/package.json +11 -0
- package/src/node_modules/@internal/preserve-tag/index.js +27 -0
- package/src/node_modules/@internal/preserve-tag/package.json +11 -0
- package/src/node_modules/@internal/set-immediate/index-browser.js +17 -0
- package/src/node_modules/@internal/set-immediate/index-worker.js +2 -0
- package/src/node_modules/@internal/set-immediate/index.js +2 -0
- package/src/node_modules/@internal/set-immediate/package.json +11 -0
- package/src/runtime/RenderResult.js +20 -18
- package/src/runtime/components/Component.js +44 -41
- package/src/runtime/components/ComponentDef.js +9 -9
- package/src/runtime/components/ComponentsContext.js +4 -5
- package/src/runtime/components/GlobalComponentsContext.js +2 -1
- package/src/runtime/components/KeySequence.js +1 -1
- package/src/runtime/components/State.js +6 -6
- package/src/runtime/components/attach-detach.js +4 -4
- package/src/runtime/components/defineComponent.js +1 -1
- package/src/runtime/components/event-delegation.js +10 -10
- package/src/runtime/components/index.js +1 -301
- package/src/runtime/components/jquery.js +2 -2
- package/src/runtime/components/legacy/browser.json +1 -1
- package/src/runtime/components/legacy/defineRenderer-legacy.js +5 -6
- package/src/runtime/components/legacy/defineWidget-legacy.js +1 -18
- package/src/runtime/components/legacy/dependencies/html.js +1 -1
- package/src/runtime/components/legacy/dependencies/index.js +3 -3
- package/src/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
- package/src/runtime/components/legacy/index.js +1 -15
- package/src/runtime/components/legacy/renderer-legacy.js +7 -7
- package/src/runtime/components/ready.js +2 -2
- package/src/runtime/components/registry.js +1 -44
- package/src/runtime/components/renderer.js +4 -4
- package/src/runtime/components/update-manager.js +1 -1
- package/src/runtime/dom-insert.js +8 -8
- package/src/runtime/helpers/_weak-map.js +2 -2
- package/src/runtime/helpers/assign.js +3 -1
- package/src/runtime/helpers/bind-component.js +2 -2
- package/src/runtime/helpers/dynamic-tag.js +2 -4
- package/src/runtime/helpers/for-in.js +1 -1
- package/src/runtime/helpers/load-nested-tag.js +1 -1
- package/src/runtime/helpers/load-template.js +1 -1
- package/src/runtime/helpers/merge.js +3 -1
- package/src/runtime/helpers/noop.js +1 -1
- package/src/runtime/helpers/style-value.js +1 -1
- package/src/runtime/helpers/to-string.js +1 -1
- package/src/runtime/html/AsyncStream.js +90 -76
- package/src/runtime/html/BufferedWriter.js +6 -2
- package/src/runtime/html/StringWriter.js +15 -9
- package/src/runtime/html/helpers/attrs.js +3 -3
- package/src/runtime/html/helpers/data-marko.js +0 -2
- package/src/runtime/html/helpers/escape-quotes.js +1 -1
- package/src/runtime/html/helpers/escape-xml.js +1 -1
- package/src/runtime/html/index.js +23 -13
- package/src/runtime/queueMicrotask.js +2 -2
- package/src/runtime/renderable.js +9 -9
- package/src/runtime/vdom/AsyncVDOMBuilder.js +46 -51
- package/src/runtime/vdom/VComment.js +3 -3
- package/src/runtime/vdom/VDocumentFragment.js +3 -3
- package/src/runtime/vdom/VElement.js +17 -13
- package/src/runtime/vdom/VFragment.js +1 -1
- package/src/runtime/vdom/VNode.js +2 -2
- package/src/runtime/vdom/VText.js +3 -3
- package/src/runtime/vdom/helpers/attrs.js +1 -1
- package/src/runtime/vdom/helpers/const.js +2 -2
- package/src/runtime/vdom/helpers/v-element.js +1 -1
- package/src/runtime/vdom/helpers/v-text.js +1 -1
- package/src/runtime/vdom/index.js +21 -23
- package/src/runtime/vdom/morphdom/fragment.js +8 -7
- package/src/runtime/vdom/morphdom/index.js +19 -9
- package/src/runtime/vdom/morphdom/specialElHandlers.js +6 -6
- package/src/runtime/vdom/parse-html.js +4 -4
- package/src/runtime/vdom/preserve-attrs.js +1 -1
- package/src/runtime/vdom/vdom.js +5 -7
- package/src/taglib/taglib-finder/index.js +1 -1
- package/src/taglib/taglib-loader/Tag.js +5 -5
- package/src/taglib/taglib-loader/Taglib.js +2 -2
- package/src/taglib/taglib-loader/json-file-reader.js +1 -1
- package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
- package/src/taglib/taglib-loader/loadTagFromProps.js +5 -6
- package/src/taglib/taglib-loader/tag-def-from-code.js +2 -1
- package/src/taglib/taglib-lookup/TaglibLookup.js +2 -2
- package/src/taglib/taglib-lookup/index.js +1 -1
- package/dist/core-tags/core/await/client-reorder-browser.js +0 -1
- package/dist/core-tags/core/await/client-reorder-runtime.min.js +0 -5
- package/dist/core-tags/core/await/client-reorder.js +0 -11
- package/dist/core-tags/core/await/package.json +0 -6
- package/dist/index-browser.js +0 -4
- package/dist/loader/index.js +0 -7
- package/dist/loader/package.json +0 -5
- package/dist/node-require/index-browser.js +0 -1
- package/dist/package.json +0 -5
- package/dist/runtime/components/beginComponent-browser.js +0 -12
- package/dist/runtime/components/endComponent.js +0 -11
- package/dist/runtime/components/index-browser.js +0 -14
- package/dist/runtime/components/init-components.js +0 -1
- package/dist/runtime/components/legacy/package.json +0 -6
- package/dist/runtime/components/package.json +0 -12
- package/dist/runtime/components/registry-browser.js +0 -73
- package/dist/runtime/html/Template.js +0 -63
- package/dist/runtime/package.json +0 -5
- package/dist/runtime/setImmediate.js +0 -19
- package/src/core-tags/core/await/client-reorder-browser.js +0 -1
- package/src/core-tags/core/await/client-reorder-runtime.min.js +0 -1
- package/src/core-tags/core/await/client-reorder.js +0 -14
- package/src/core-tags/core/await/package.json +0 -6
- package/src/index-browser.js +0 -3
- package/src/loader/index.js +0 -7
- package/src/loader/package.json +0 -5
- package/src/node-require/index-browser.js +0 -1
- package/src/package.json +0 -5
- package/src/runtime/components/index-browser.js +0 -15
- package/src/runtime/components/init-components.js +0 -1
- package/src/runtime/components/legacy/index-browser.js +0 -73
- package/src/runtime/components/legacy/package.json +0 -6
- package/src/runtime/components/package.json +0 -12
- package/src/runtime/components/registry-browser.js +0 -103
- package/src/runtime/html/Template.js +0 -62
- package/src/runtime/package.json +0 -5
- package/src/runtime/setImmediate.js +0 -21
- /package/dist/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
- /package/dist/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
- /package/dist/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
- /package/src/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
- /package/src/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
- /package/src/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
- /package/src/{core-tags/components/preserve-tag-browser.js → node_modules/@internal/preserve-tag/index-browser.js} +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var escapeDoubleQuotes =
|
4
|
-
.___escapeDoubleQuotes;
|
3
|
+
var escapeDoubleQuotes =
|
4
|
+
require("./helpers/escape-quotes").___escapeDoubleQuotes;
|
5
5
|
|
6
6
|
function StringWriter() {
|
7
7
|
this._content = "";
|
@@ -10,24 +10,30 @@ function StringWriter() {
|
|
10
10
|
}
|
11
11
|
|
12
12
|
StringWriter.prototype = {
|
13
|
-
write: function(str) {
|
13
|
+
write: function (str) {
|
14
14
|
this._content += str;
|
15
15
|
},
|
16
16
|
|
17
|
-
script: function(str) {
|
17
|
+
script: function (str) {
|
18
18
|
if (str) {
|
19
19
|
this._scripts += (this._scripts ? ";" : "") + str;
|
20
20
|
}
|
21
21
|
},
|
22
22
|
|
23
|
-
get: function(key) {
|
23
|
+
get: function (key) {
|
24
24
|
const extra = (this._data = this._data || {});
|
25
25
|
return (extra[key] = extra[key] || []);
|
26
26
|
},
|
27
27
|
|
28
|
-
merge: function(otherWriter) {
|
28
|
+
merge: function (otherWriter) {
|
29
29
|
this._content += otherWriter._content;
|
30
|
-
|
30
|
+
|
31
|
+
if (otherWriter._scripts) {
|
32
|
+
this._scripts = this._scripts
|
33
|
+
? this._scripts + ";" + otherWriter._scripts
|
34
|
+
: otherWriter._scripts;
|
35
|
+
}
|
36
|
+
|
31
37
|
if (otherWriter._data) {
|
32
38
|
if (this._data) {
|
33
39
|
for (const key in otherWriter._data) {
|
@@ -43,13 +49,13 @@ StringWriter.prototype = {
|
|
43
49
|
}
|
44
50
|
},
|
45
51
|
|
46
|
-
clear: function() {
|
52
|
+
clear: function () {
|
47
53
|
this._content = "";
|
48
54
|
this._scripts = "";
|
49
55
|
this._data = null;
|
50
56
|
},
|
51
57
|
|
52
|
-
toString: function() {
|
58
|
+
toString: function () {
|
53
59
|
this.state.events.emit("___toString", this);
|
54
60
|
let str = this._content;
|
55
61
|
if (this._scripts) {
|
@@ -6,11 +6,11 @@ var dynamicAttrHelper = require("./_dynamic-attr");
|
|
6
6
|
module.exports = function attrs(arg) {
|
7
7
|
switch (typeof arg) {
|
8
8
|
case "object":
|
9
|
-
var
|
9
|
+
var result = "";
|
10
10
|
for (var attrName in arg) {
|
11
|
-
|
11
|
+
result += dynamicAttrHelper(attrName, arg[attrName]);
|
12
12
|
}
|
13
|
-
return
|
13
|
+
return result;
|
14
14
|
case "string":
|
15
15
|
// eslint-disable-next-line no-constant-condition
|
16
16
|
if ("MARKO_DEBUG") {
|
@@ -5,8 +5,6 @@ var escapeSingleQuotes = escapeQuoteHelpers.___escapeSingleQuotes;
|
|
5
5
|
var escapeDoubleQuotes = escapeQuoteHelpers.___escapeDoubleQuotes;
|
6
6
|
var FLAG_WILL_RERENDER_IN_BROWSER = 1;
|
7
7
|
// var FLAG_HAS_RENDER_BODY = 2;
|
8
|
-
// var FLAG_IS_LEGACY = 4;
|
9
|
-
// var FLAG_OLD_HYDRATE_NO_CREATE = 8;
|
10
8
|
|
11
9
|
module.exports = function dataMarko(out, componentDef, props, key) {
|
12
10
|
var result = "";
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
|
3
|
+
globalThis.Marko = {
|
4
|
+
Component: function () {}
|
5
|
+
};
|
4
6
|
|
5
7
|
/**
|
6
8
|
* Method is for internal usage only. This method
|
@@ -8,26 +10,34 @@ var Template;
|
|
8
10
|
* it is used to create a new Template instance.
|
9
11
|
* @private
|
10
12
|
*/
|
11
|
-
exports.t = function createTemplate(
|
12
|
-
return new Template(
|
13
|
+
exports.t = function createTemplate(typeName) {
|
14
|
+
return new Template(typeName);
|
13
15
|
};
|
14
16
|
|
15
|
-
|
17
|
+
function Template(typeName) {
|
18
|
+
this.path = this.___typeName = typeName;
|
19
|
+
}
|
16
20
|
|
17
|
-
|
18
|
-
Template = require("./Template");
|
21
|
+
Template.prototype.stream = require("@internal/create-readable");
|
19
22
|
|
20
|
-
|
21
|
-
return new AsyncStream(globalData, parent, state, buffer);
|
22
|
-
}
|
23
|
+
var AsyncStream = require("./AsyncStream");
|
23
24
|
|
24
|
-
exports.createWriter = function(writer) {
|
25
|
+
exports.createWriter = function (writer) {
|
25
26
|
return new AsyncStream(null, writer);
|
26
27
|
};
|
27
|
-
|
28
28
|
exports.Template = Template;
|
29
|
-
exports.___createOut = createOut;
|
30
29
|
exports.AsyncStream = AsyncStream;
|
31
30
|
exports.enableAsyncStackTrace = AsyncStream.enableAsyncStackTrace;
|
32
31
|
|
33
|
-
require("../createOut").___setCreateOut(
|
32
|
+
require("../createOut").___setCreateOut(
|
33
|
+
(Template.prototype.createOut = function createOut(
|
34
|
+
globalData,
|
35
|
+
writer,
|
36
|
+
parentOut,
|
37
|
+
buffer
|
38
|
+
) {
|
39
|
+
return new AsyncStream(globalData, writer, parentOut, buffer);
|
40
|
+
})
|
41
|
+
);
|
42
|
+
|
43
|
+
require("../renderable")(Template.prototype);
|
@@ -3,12 +3,12 @@ module.exports =
|
|
3
3
|
typeof queueMicrotask === "function"
|
4
4
|
? queueMicrotask
|
5
5
|
: typeof Promise === "function" && (promise = Promise.resolve())
|
6
|
-
? function(cb) {
|
6
|
+
? function (cb) {
|
7
7
|
promise.then(cb).catch(rethrow);
|
8
8
|
}
|
9
9
|
: setTimeout;
|
10
10
|
function rethrow(err) {
|
11
|
-
setTimeout(function() {
|
11
|
+
setTimeout(function () {
|
12
12
|
throw err;
|
13
13
|
});
|
14
14
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var defaultCreateOut = require("./createOut");
|
2
|
-
var setImmediate = require("
|
2
|
+
var setImmediate = require("@internal/set-immediate").___setImmediate;
|
3
3
|
var extend = require("raptor-util/extend");
|
4
4
|
|
5
5
|
function safeRender(renderFunc, finalData, finalOut, shouldEnd) {
|
@@ -11,9 +11,9 @@ function safeRender(renderFunc, finalData, finalOut, shouldEnd) {
|
|
11
11
|
}
|
12
12
|
} catch (err) {
|
13
13
|
var actualEnd = finalOut.end;
|
14
|
-
finalOut.end = function() {};
|
14
|
+
finalOut.end = function () {};
|
15
15
|
|
16
|
-
setImmediate(function() {
|
16
|
+
setImmediate(function () {
|
17
17
|
finalOut.end = actualEnd;
|
18
18
|
finalOut.error(err);
|
19
19
|
});
|
@@ -21,7 +21,7 @@ function safeRender(renderFunc, finalData, finalOut, shouldEnd) {
|
|
21
21
|
return finalOut;
|
22
22
|
}
|
23
23
|
|
24
|
-
module.exports = function(target, renderer) {
|
24
|
+
module.exports = function (target, renderer) {
|
25
25
|
var renderFunc =
|
26
26
|
renderer && (renderer.renderer || renderer.render || renderer);
|
27
27
|
var createOut = target.createOut || renderer.createOut || defaultCreateOut;
|
@@ -29,7 +29,7 @@ module.exports = function(target, renderer) {
|
|
29
29
|
return extend(target, {
|
30
30
|
createOut: createOut,
|
31
31
|
|
32
|
-
renderToString: function(data, callback) {
|
32
|
+
renderToString: function (data, callback) {
|
33
33
|
var localData = data || {};
|
34
34
|
var render = renderFunc || this._;
|
35
35
|
var globalData = localData.$global;
|
@@ -43,7 +43,7 @@ module.exports = function(target, renderer) {
|
|
43
43
|
|
44
44
|
if (callback) {
|
45
45
|
out
|
46
|
-
.on("finish", function() {
|
46
|
+
.on("finish", function () {
|
47
47
|
callback(null, out.toString(), out);
|
48
48
|
})
|
49
49
|
.once("error", callback);
|
@@ -56,7 +56,7 @@ module.exports = function(target, renderer) {
|
|
56
56
|
}
|
57
57
|
},
|
58
58
|
|
59
|
-
renderSync: function(data) {
|
59
|
+
renderSync: function (data) {
|
60
60
|
var localData = data || {};
|
61
61
|
var render = renderFunc || this._;
|
62
62
|
var globalData = localData.$global;
|
@@ -90,7 +90,7 @@ module.exports = function(target, renderer) {
|
|
90
90
|
* @param {AsyncStream/AsyncVDOMBuilder} out A Stream, an AsyncStream/AsyncVDOMBuilder instance, or a callback function
|
91
91
|
* @return {AsyncStream/AsyncVDOMBuilder} Returns the AsyncStream/AsyncVDOMBuilder instance that the template is rendered to
|
92
92
|
*/
|
93
|
-
render: function(data, out) {
|
93
|
+
render: function (data, out) {
|
94
94
|
var callback;
|
95
95
|
var finalOut;
|
96
96
|
var finalData;
|
@@ -126,7 +126,7 @@ module.exports = function(target, renderer) {
|
|
126
126
|
|
127
127
|
if (callback) {
|
128
128
|
finalOut
|
129
|
-
.on("finish", function() {
|
129
|
+
.on("finish", function () {
|
130
130
|
callback(null, finalOut.___getResult(), finalOut);
|
131
131
|
})
|
132
132
|
.once("error", callback);
|
@@ -8,7 +8,6 @@ var VComponent = vdom.___VComponent;
|
|
8
8
|
var VFragment = vdom.___VFragment;
|
9
9
|
var virtualizeHTML = vdom.___virtualizeHTML;
|
10
10
|
var RenderResult = require("../RenderResult");
|
11
|
-
var defaultDocument = vdom.___defaultDocument;
|
12
11
|
var morphdom = require("./morphdom");
|
13
12
|
var attrsHelper = require("./helpers/attrs");
|
14
13
|
|
@@ -55,19 +54,19 @@ function AsyncVDOMBuilder(globalData, parentNode, parentOut) {
|
|
55
54
|
|
56
55
|
var proto = (AsyncVDOMBuilder.prototype = {
|
57
56
|
___isOut: true,
|
58
|
-
|
57
|
+
___host: typeof document === "object" && document,
|
59
58
|
|
60
|
-
bc: function(component, key, ownerComponent) {
|
59
|
+
bc: function (component, key, ownerComponent) {
|
61
60
|
var vComponent = new VComponent(component, key, ownerComponent);
|
62
61
|
return this.___beginNode(vComponent, 0, true);
|
63
62
|
},
|
64
63
|
|
65
|
-
___preserveComponent: function(component, key, ownerComponent) {
|
64
|
+
___preserveComponent: function (component, key, ownerComponent) {
|
66
65
|
var vComponent = new VComponent(component, key, ownerComponent, true);
|
67
66
|
this.___beginNode(vComponent, 0);
|
68
67
|
},
|
69
68
|
|
70
|
-
___beginNode: function(child, childCount, pushToStack) {
|
69
|
+
___beginNode: function (child, childCount, pushToStack) {
|
71
70
|
this.___parent.___appendChild(child);
|
72
71
|
if (pushToStack === true) {
|
73
72
|
this.___stack.push(child);
|
@@ -76,7 +75,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
76
75
|
return childCount === 0 ? this : child;
|
77
76
|
},
|
78
77
|
|
79
|
-
element: function(tagName, attrs, key, component, childCount, flags, props) {
|
78
|
+
element: function (tagName, attrs, key, component, childCount, flags, props) {
|
80
79
|
var element = new VElement(
|
81
80
|
tagName,
|
82
81
|
attrs,
|
@@ -89,7 +88,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
89
88
|
return this.___beginNode(element, childCount);
|
90
89
|
},
|
91
90
|
|
92
|
-
___elementDynamic: function(tagName, attrs, key, componentDef, props) {
|
91
|
+
___elementDynamic: function (tagName, attrs, key, componentDef, props) {
|
93
92
|
return this.element(
|
94
93
|
tagName,
|
95
94
|
attrsHelper(attrs),
|
@@ -101,7 +100,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
101
100
|
);
|
102
101
|
},
|
103
102
|
|
104
|
-
n: function(node, component) {
|
103
|
+
n: function (node, component) {
|
105
104
|
// NOTE: We do a shallow clone since we assume the node is being reused
|
106
105
|
// and a node can only have one parent node.
|
107
106
|
var clone = node.___cloneNode();
|
@@ -111,12 +110,12 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
111
110
|
return this;
|
112
111
|
},
|
113
112
|
|
114
|
-
node: function(node) {
|
113
|
+
node: function (node) {
|
115
114
|
this.___parent.___appendChild(node);
|
116
115
|
return this;
|
117
116
|
},
|
118
117
|
|
119
|
-
text: function(text, ownerComponent) {
|
118
|
+
text: function (text, ownerComponent) {
|
120
119
|
var type = typeof text;
|
121
120
|
|
122
121
|
if (type != "string") {
|
@@ -135,24 +134,20 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
135
134
|
return this;
|
136
135
|
},
|
137
136
|
|
138
|
-
comment: function(comment, ownerComponent) {
|
137
|
+
comment: function (comment, ownerComponent) {
|
139
138
|
return this.node(new VComment(comment, ownerComponent));
|
140
139
|
},
|
141
140
|
|
142
|
-
html: function(html, ownerComponent) {
|
141
|
+
html: function (html, ownerComponent) {
|
143
142
|
if (html != null) {
|
144
|
-
var vdomNode = virtualizeHTML(
|
145
|
-
html,
|
146
|
-
this.___document || document,
|
147
|
-
ownerComponent
|
148
|
-
);
|
143
|
+
var vdomNode = virtualizeHTML(html, ownerComponent);
|
149
144
|
this.node(vdomNode);
|
150
145
|
}
|
151
146
|
|
152
147
|
return this;
|
153
148
|
},
|
154
149
|
|
155
|
-
beginElement: function(
|
150
|
+
beginElement: function (
|
156
151
|
tagName,
|
157
152
|
attrs,
|
158
153
|
key,
|
@@ -174,7 +169,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
174
169
|
return this;
|
175
170
|
},
|
176
171
|
|
177
|
-
___beginElementDynamic: function(tagName, attrs, key, componentDef, props) {
|
172
|
+
___beginElementDynamic: function (tagName, attrs, key, componentDef, props) {
|
178
173
|
return this.beginElement(
|
179
174
|
tagName,
|
180
175
|
attrsHelper(attrs),
|
@@ -186,23 +181,23 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
186
181
|
);
|
187
182
|
},
|
188
183
|
|
189
|
-
bf: function(key, component, preserve) {
|
184
|
+
bf: function (key, component, preserve) {
|
190
185
|
var fragment = new VFragment(key, component, preserve);
|
191
186
|
this.___beginNode(fragment, null, true);
|
192
187
|
return this;
|
193
188
|
},
|
194
189
|
|
195
|
-
ef: function() {
|
190
|
+
ef: function () {
|
196
191
|
this.endElement();
|
197
192
|
},
|
198
193
|
|
199
|
-
endElement: function() {
|
194
|
+
endElement: function () {
|
200
195
|
var stack = this.___stack;
|
201
196
|
stack.pop();
|
202
197
|
this.___parent = stack[stack.length - 1];
|
203
198
|
},
|
204
199
|
|
205
|
-
end: function() {
|
200
|
+
end: function () {
|
206
201
|
this.___parent = undefined;
|
207
202
|
|
208
203
|
var remaining = --this.___remaining;
|
@@ -221,7 +216,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
221
216
|
return this;
|
222
217
|
},
|
223
218
|
|
224
|
-
___handleChildDone: function() {
|
219
|
+
___handleChildDone: function () {
|
225
220
|
var remaining = --this.___remaining;
|
226
221
|
|
227
222
|
if (remaining === 0) {
|
@@ -236,13 +231,13 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
236
231
|
}
|
237
232
|
},
|
238
233
|
|
239
|
-
___doFinish: function() {
|
234
|
+
___doFinish: function () {
|
240
235
|
var state = this.___state;
|
241
236
|
state.___finished = true;
|
242
237
|
state.___events.emit(EVENT_FINISH, this.___getResult());
|
243
238
|
},
|
244
239
|
|
245
|
-
___emitLast: function() {
|
240
|
+
___emitLast: function () {
|
246
241
|
var lastArray = this._last;
|
247
242
|
|
248
243
|
var i = 0;
|
@@ -262,7 +257,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
262
257
|
next();
|
263
258
|
},
|
264
259
|
|
265
|
-
error: function(e) {
|
260
|
+
error: function (e) {
|
266
261
|
try {
|
267
262
|
this.emit("error", e);
|
268
263
|
} finally {
|
@@ -276,7 +271,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
276
271
|
return this;
|
277
272
|
},
|
278
273
|
|
279
|
-
beginAsync: function(options) {
|
274
|
+
beginAsync: function (options) {
|
280
275
|
if (this.___sync) {
|
281
276
|
throw Error(
|
282
277
|
"Tried to render async while in sync mode. Note: Client side await is not currently supported in re-renders (Issue: #942)."
|
@@ -304,11 +299,11 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
304
299
|
return asyncOut;
|
305
300
|
},
|
306
301
|
|
307
|
-
createOut: function() {
|
302
|
+
createOut: function () {
|
308
303
|
return new AsyncVDOMBuilder(this.global);
|
309
304
|
},
|
310
305
|
|
311
|
-
flush: function() {
|
306
|
+
flush: function () {
|
312
307
|
var events = this.___state.___events;
|
313
308
|
|
314
309
|
if (events.listenerCount(EVENT_UPDATE)) {
|
@@ -316,15 +311,15 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
316
311
|
}
|
317
312
|
},
|
318
313
|
|
319
|
-
___getOutput: function() {
|
314
|
+
___getOutput: function () {
|
320
315
|
return this.___state.___tree;
|
321
316
|
},
|
322
317
|
|
323
|
-
___getResult: function() {
|
318
|
+
___getResult: function () {
|
324
319
|
return this.___result || (this.___result = new RenderResult(this));
|
325
320
|
},
|
326
321
|
|
327
|
-
on: function(event, callback) {
|
322
|
+
on: function (event, callback) {
|
328
323
|
var state = this.___state;
|
329
324
|
|
330
325
|
if (event === EVENT_FINISH && state.___finished) {
|
@@ -338,7 +333,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
338
333
|
return this;
|
339
334
|
},
|
340
335
|
|
341
|
-
once: function(event, callback) {
|
336
|
+
once: function (event, callback) {
|
342
337
|
var state = this.___state;
|
343
338
|
|
344
339
|
if (event === EVENT_FINISH && state.___finished) {
|
@@ -352,7 +347,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
352
347
|
return this;
|
353
348
|
},
|
354
349
|
|
355
|
-
emit: function(type, arg) {
|
350
|
+
emit: function (type, arg) {
|
356
351
|
var events = this.___state.___events;
|
357
352
|
switch (arguments.length) {
|
358
353
|
case 1:
|
@@ -368,21 +363,21 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
368
363
|
return this;
|
369
364
|
},
|
370
365
|
|
371
|
-
removeListener: function() {
|
366
|
+
removeListener: function () {
|
372
367
|
var events = this.___state.___events;
|
373
368
|
events.removeListener.apply(events, arguments);
|
374
369
|
return this;
|
375
370
|
},
|
376
371
|
|
377
|
-
sync: function() {
|
372
|
+
sync: function () {
|
378
373
|
this.___sync = true;
|
379
374
|
},
|
380
375
|
|
381
|
-
isSync: function() {
|
376
|
+
isSync: function () {
|
382
377
|
return this.___sync;
|
383
378
|
},
|
384
379
|
|
385
|
-
onLast: function(callback) {
|
380
|
+
onLast: function (callback) {
|
386
381
|
var lastArray = this._last;
|
387
382
|
|
388
383
|
if (lastArray === undefined) {
|
@@ -394,20 +389,20 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
394
389
|
return this;
|
395
390
|
},
|
396
391
|
|
397
|
-
___getNode: function(
|
392
|
+
___getNode: function (host) {
|
398
393
|
var node = this.___vnode;
|
399
394
|
if (!node) {
|
400
395
|
var vdomTree = this.___getOutput();
|
401
|
-
|
402
|
-
|
403
|
-
this.___vnode = node = vdomTree.___actualize(
|
404
|
-
morphdom(node, vdomTree,
|
396
|
+
|
397
|
+
if (!host) host = this.___host;
|
398
|
+
this.___vnode = node = vdomTree.___actualize(host, null);
|
399
|
+
morphdom(node, vdomTree, host, this.___components);
|
405
400
|
}
|
406
401
|
return node;
|
407
402
|
},
|
408
403
|
|
409
|
-
toString: function(
|
410
|
-
var docFragment = this.___getNode(
|
404
|
+
toString: function (host) {
|
405
|
+
var docFragment = this.___getNode(host);
|
411
406
|
var html = "";
|
412
407
|
|
413
408
|
var child = docFragment.firstChild;
|
@@ -427,10 +422,10 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
427
422
|
return html;
|
428
423
|
},
|
429
424
|
|
430
|
-
then: function(fn, fnErr) {
|
425
|
+
then: function (fn, fnErr) {
|
431
426
|
var out = this;
|
432
|
-
var promise = new Promise(function(resolve, reject) {
|
433
|
-
out.on("error", reject).on(EVENT_FINISH, function(result) {
|
427
|
+
var promise = new Promise(function (resolve, reject) {
|
428
|
+
out.on("error", reject).on(EVENT_FINISH, function (result) {
|
434
429
|
resolve(result);
|
435
430
|
});
|
436
431
|
});
|
@@ -438,13 +433,13 @@ var proto = (AsyncVDOMBuilder.prototype = {
|
|
438
433
|
return Promise.resolve(promise).then(fn, fnErr);
|
439
434
|
},
|
440
435
|
|
441
|
-
catch: function(fnErr) {
|
436
|
+
catch: function (fnErr) {
|
442
437
|
return this.then(undefined, fnErr);
|
443
438
|
},
|
444
439
|
|
445
440
|
isVDOM: true,
|
446
441
|
|
447
|
-
c: function(componentDef, key, customEvents) {
|
442
|
+
c: function (componentDef, key, customEvents) {
|
448
443
|
this.___assignedComponentDef = componentDef;
|
449
444
|
this.___assignedKey = key;
|
450
445
|
this.___assignedCustomEvents = customEvents;
|
@@ -9,12 +9,12 @@ function VComment(value, ownerComponent) {
|
|
9
9
|
VComment.prototype = {
|
10
10
|
___nodeType: 8,
|
11
11
|
|
12
|
-
___actualize: function(
|
12
|
+
___actualize: function (host) {
|
13
13
|
var nodeValue = this.___nodeValue;
|
14
|
-
return
|
14
|
+
return (host.ownerDocument || host).createComment(nodeValue);
|
15
15
|
},
|
16
16
|
|
17
|
-
___cloneNode: function() {
|
17
|
+
___cloneNode: function () {
|
18
18
|
return new VComment(this.___nodeValue);
|
19
19
|
}
|
20
20
|
};
|
@@ -18,12 +18,12 @@ VDocumentFragment.prototype = {
|
|
18
18
|
|
19
19
|
___DocumentFragment: true,
|
20
20
|
|
21
|
-
___cloneNode: function() {
|
21
|
+
___cloneNode: function () {
|
22
22
|
return new VDocumentFragmentClone(this);
|
23
23
|
},
|
24
24
|
|
25
|
-
___actualize: function(
|
26
|
-
return
|
25
|
+
___actualize: function (host) {
|
26
|
+
return (host.ownerDocument || host).createDocumentFragment();
|
27
27
|
}
|
28
28
|
};
|
29
29
|
|