marko 4.25.0 → 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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} +14 -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} +2 -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
|
@@ -4,10 +4,10 @@ function ensure(state, propertyName) {
|
|
|
4
4
|
var proto = state.constructor.prototype;
|
|
5
5
|
if (!(propertyName in proto)) {
|
|
6
6
|
Object.defineProperty(proto, propertyName, {
|
|
7
|
-
get: function() {
|
|
7
|
+
get: function () {
|
|
8
8
|
return this.___raw[propertyName];
|
|
9
9
|
},
|
|
10
|
-
set: function(value) {
|
|
10
|
+
set: function (value) {
|
|
11
11
|
this.___set(propertyName, value, false /* ensure:false */);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
@@ -27,7 +27,7 @@ function State(component) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
State.prototype = {
|
|
30
|
-
___reset: function() {
|
|
30
|
+
___reset: function () {
|
|
31
31
|
var self = this;
|
|
32
32
|
|
|
33
33
|
self.___dirty = false;
|
|
@@ -36,7 +36,7 @@ State.prototype = {
|
|
|
36
36
|
self.___forced = null;
|
|
37
37
|
},
|
|
38
38
|
|
|
39
|
-
___replace: function(newState) {
|
|
39
|
+
___replace: function (newState) {
|
|
40
40
|
var state = this;
|
|
41
41
|
var key;
|
|
42
42
|
|
|
@@ -62,7 +62,7 @@ State.prototype = {
|
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
___set: function(name, value, shouldEnsure, forceDirty) {
|
|
65
|
+
___set: function (name, value, shouldEnsure, forceDirty) {
|
|
66
66
|
var rawState = this.___raw;
|
|
67
67
|
|
|
68
68
|
if (shouldEnsure) {
|
|
@@ -97,7 +97,7 @@ State.prototype = {
|
|
|
97
97
|
rawState[name] = value;
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
toJSON: function() {
|
|
100
|
+
toJSON: function () {
|
|
101
101
|
return this.___raw;
|
|
102
102
|
}
|
|
103
103
|
};
|
|
@@ -2,7 +2,7 @@ var eventDelegation = require("./event-delegation");
|
|
|
2
2
|
var delegateEvent = eventDelegation.___delegateEvent;
|
|
3
3
|
var getEventFromEl = eventDelegation.___getEventFromEl;
|
|
4
4
|
|
|
5
|
-
// var componentsUtil = require('
|
|
5
|
+
// var componentsUtil = require('@internal/components-util');
|
|
6
6
|
// var destroyNodeRecursive = componentsUtil.___destroyNodeRecursive;
|
|
7
7
|
// var destroyComponentForNode = componentsUtil.___destroyComponentForNode;
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ function handleNodeAttach(node, componentsContext) {
|
|
|
17
17
|
var attachTargets = data.___attachTargets;
|
|
18
18
|
if (!attachTargets) {
|
|
19
19
|
attachTargets = data.___attachTargets = [];
|
|
20
|
-
out.on("___componentsInitialized", function() {
|
|
20
|
+
out.on("___componentsInitialized", function () {
|
|
21
21
|
for (var i = 0; i < attachTargets.length; i += 2) {
|
|
22
22
|
var node = attachTargets[i];
|
|
23
23
|
var target = attachTargets[i + 1];
|
|
@@ -40,10 +40,10 @@ function handleNodeDetach(node) {
|
|
|
40
40
|
var allowDetach;
|
|
41
41
|
|
|
42
42
|
delegateEvent(node, eventName, target, {
|
|
43
|
-
preventDefault: function() {
|
|
43
|
+
preventDefault: function () {
|
|
44
44
|
allowDetach = false;
|
|
45
45
|
},
|
|
46
|
-
detach: function() {
|
|
46
|
+
detach: function () {
|
|
47
47
|
var parentNode = node.parentNode;
|
|
48
48
|
if (parentNode) {
|
|
49
49
|
parentNode.removeChild(node);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var componentsUtil = require("
|
|
1
|
+
var componentsUtil = require("@internal/components-util");
|
|
2
2
|
var runtimeId = componentsUtil.___runtimeId;
|
|
3
3
|
var componentLookup = componentsUtil.___componentLookup;
|
|
4
4
|
var getMarkoPropsFromEl = componentsUtil.___getMarkoPropsFromEl;
|
|
@@ -72,13 +72,13 @@ function addDelegatedEventHandler(eventType) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
function
|
|
76
|
-
var
|
|
77
|
-
|
|
75
|
+
function addDelegatedEventHandlerToHost(eventType, host) {
|
|
76
|
+
var listeners = (host[listenersAttachedKey] =
|
|
77
|
+
host[listenersAttachedKey] || {});
|
|
78
78
|
if (!listeners[eventType]) {
|
|
79
|
-
body.addEventListener(
|
|
79
|
+
(host.body || host).addEventListener(
|
|
80
80
|
eventType,
|
|
81
|
-
(listeners[eventType] = function(event) {
|
|
81
|
+
(listeners[eventType] = function (event) {
|
|
82
82
|
var curNode = event.target;
|
|
83
83
|
if (!curNode) {
|
|
84
84
|
return;
|
|
@@ -107,7 +107,7 @@ function addDelegatedEventHandlerToDoc(eventType, doc) {
|
|
|
107
107
|
// Monkey-patch to fix #97
|
|
108
108
|
var oldStopPropagation = event.stopPropagation;
|
|
109
109
|
|
|
110
|
-
event.stopPropagation = function() {
|
|
110
|
+
event.stopPropagation = function () {
|
|
111
111
|
oldStopPropagation.call(event);
|
|
112
112
|
propagationStopped = true;
|
|
113
113
|
};
|
|
@@ -137,8 +137,8 @@ exports.___handleNodeDetach = noop;
|
|
|
137
137
|
exports.___delegateEvent = delegateEvent;
|
|
138
138
|
exports.___getEventFromEl = getEventFromEl;
|
|
139
139
|
exports.___addDelegatedEventHandler = addDelegatedEventHandler;
|
|
140
|
-
exports.___init = function(
|
|
141
|
-
Object.keys(delegatedEvents).forEach(function(eventType) {
|
|
142
|
-
|
|
140
|
+
exports.___init = function (host) {
|
|
141
|
+
Object.keys(delegatedEvents).forEach(function (eventType) {
|
|
142
|
+
addDelegatedEventHandlerToHost(eventType, host);
|
|
143
143
|
});
|
|
144
144
|
};
|
|
@@ -1,301 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var warp10 = require("warp10");
|
|
4
|
-
var safeJSONRegExp = /<\/|\u2028|\u2029/g;
|
|
5
|
-
var IGNORE_GLOBAL_TYPES = new Set(["undefined", "function", "symbol"]);
|
|
6
|
-
var DEFAULT_RUNTIME_ID = "M";
|
|
7
|
-
|
|
8
|
-
var FLAG_WILL_RERENDER_IN_BROWSER = 1;
|
|
9
|
-
var FLAG_HAS_RENDER_BODY = 2;
|
|
10
|
-
var FLAG_IS_LEGACY = 4;
|
|
11
|
-
var FLAG_OLD_HYDRATE_NO_CREATE = 8;
|
|
12
|
-
|
|
13
|
-
function safeJSONReplacer(match) {
|
|
14
|
-
if (match === "</") {
|
|
15
|
-
return "\\u003C/";
|
|
16
|
-
} else {
|
|
17
|
-
return "\\u" + match.charCodeAt(0).toString(16);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function isNotEmpty(obj) {
|
|
22
|
-
var keys = Object.keys(obj);
|
|
23
|
-
for (var i = keys.length; i--; ) {
|
|
24
|
-
if (obj[keys[i]] !== undefined) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
function safeStringify(data) {
|
|
32
|
-
return JSON.stringify(warp10.stringifyPrepare(data)).replace(
|
|
33
|
-
safeJSONRegExp,
|
|
34
|
-
safeJSONReplacer
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function getSerializedGlobals($global) {
|
|
39
|
-
let serializedGlobalsLookup = $global.serializedGlobals;
|
|
40
|
-
if (serializedGlobalsLookup) {
|
|
41
|
-
let serializedGlobals;
|
|
42
|
-
let keys = Object.keys(serializedGlobalsLookup);
|
|
43
|
-
for (let i = keys.length; i--; ) {
|
|
44
|
-
let key = keys[i];
|
|
45
|
-
if (serializedGlobalsLookup[key]) {
|
|
46
|
-
let value = $global[key];
|
|
47
|
-
if (!IGNORE_GLOBAL_TYPES.has(typeof value)) {
|
|
48
|
-
if (serializedGlobals === undefined) {
|
|
49
|
-
serializedGlobals = {};
|
|
50
|
-
}
|
|
51
|
-
serializedGlobals[key] = value;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return serializedGlobals;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function addComponentsFromContext(componentsContext, componentsToHydrate) {
|
|
61
|
-
var components = componentsContext.___components;
|
|
62
|
-
|
|
63
|
-
var len = components.length;
|
|
64
|
-
|
|
65
|
-
for (var i = 0; i < len; i++) {
|
|
66
|
-
var componentDef = components[i];
|
|
67
|
-
var id = componentDef.id;
|
|
68
|
-
var component = componentDef.___component;
|
|
69
|
-
var flags = componentDef.___flags;
|
|
70
|
-
var isLegacy = componentDef.___isLegacy;
|
|
71
|
-
|
|
72
|
-
var state = component.state;
|
|
73
|
-
var input = component.input || 0;
|
|
74
|
-
var typeName = component.typeName;
|
|
75
|
-
var customEvents = component.___customEvents;
|
|
76
|
-
var scope = component.___scope;
|
|
77
|
-
var bubblingDomEvents = component.___bubblingDomEvents;
|
|
78
|
-
|
|
79
|
-
var needsState;
|
|
80
|
-
var serializedProps;
|
|
81
|
-
var renderBody;
|
|
82
|
-
|
|
83
|
-
if (isLegacy) {
|
|
84
|
-
flags |= FLAG_IS_LEGACY;
|
|
85
|
-
renderBody = component.___widgetBody;
|
|
86
|
-
|
|
87
|
-
if (component.widgetConfig && isNotEmpty(component.widgetConfig)) {
|
|
88
|
-
serializedProps = component.widgetConfig;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
needsState = true;
|
|
92
|
-
} else {
|
|
93
|
-
if (input && input.renderBody) {
|
|
94
|
-
renderBody = input.renderBody;
|
|
95
|
-
input.renderBody = undefined;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
!(flags & FLAG_WILL_RERENDER_IN_BROWSER) ||
|
|
100
|
-
flags & FLAG_OLD_HYDRATE_NO_CREATE
|
|
101
|
-
) {
|
|
102
|
-
component.___state = undefined; // We don't use `delete` to avoid V8 deoptimization
|
|
103
|
-
component.___input = undefined; // We don't use `delete` to avoid V8 deoptimization
|
|
104
|
-
component.typeName = undefined;
|
|
105
|
-
component.id = undefined;
|
|
106
|
-
component.___customEvents = undefined;
|
|
107
|
-
component.___scope = undefined;
|
|
108
|
-
component.___bubblingDomEvents = undefined;
|
|
109
|
-
component.___bubblingDomEventsExtraArgsCount = undefined;
|
|
110
|
-
component.___updatedInput = undefined;
|
|
111
|
-
component.___updateQueued = undefined;
|
|
112
|
-
|
|
113
|
-
needsState = true;
|
|
114
|
-
|
|
115
|
-
if (isNotEmpty(component)) {
|
|
116
|
-
serializedProps = component;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
var undefinedPropNames = undefined;
|
|
122
|
-
|
|
123
|
-
if (needsState && state) {
|
|
124
|
-
// Update state properties with an `undefined` value to have a `null`
|
|
125
|
-
// value so that the property name will be serialized down to the browser.
|
|
126
|
-
// This ensures that we add the proper getter/setter for the state property.
|
|
127
|
-
const stateKeys = Object.keys(state);
|
|
128
|
-
for (let i = stateKeys.length; i--; ) {
|
|
129
|
-
const stateKey = stateKeys[i];
|
|
130
|
-
|
|
131
|
-
if (state[stateKey] === undefined) {
|
|
132
|
-
if (undefinedPropNames) {
|
|
133
|
-
undefinedPropNames.push(stateKey);
|
|
134
|
-
} else {
|
|
135
|
-
undefinedPropNames = [stateKey];
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (typeof renderBody === "function") {
|
|
142
|
-
flags |= FLAG_HAS_RENDER_BODY;
|
|
143
|
-
renderBody = undefined;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
var extra = {
|
|
147
|
-
b: bubblingDomEvents,
|
|
148
|
-
d: componentDef.___domEvents,
|
|
149
|
-
e: customEvents,
|
|
150
|
-
f: flags || undefined,
|
|
151
|
-
p: customEvents && scope, // Only serialize scope if we need to attach custom events
|
|
152
|
-
s: needsState && state,
|
|
153
|
-
u: undefinedPropNames,
|
|
154
|
-
w: serializedProps,
|
|
155
|
-
r: renderBody
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
var parts = [id, typeName];
|
|
159
|
-
var hasExtra = isNotEmpty(extra);
|
|
160
|
-
|
|
161
|
-
if (input) {
|
|
162
|
-
parts.push(input);
|
|
163
|
-
|
|
164
|
-
if (hasExtra) {
|
|
165
|
-
parts.push(extra);
|
|
166
|
-
}
|
|
167
|
-
} else if (hasExtra) {
|
|
168
|
-
parts.push(0, extra); // empty input;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
componentsToHydrate.push(parts);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
components.length = 0;
|
|
175
|
-
|
|
176
|
-
// Also add any components from nested contexts
|
|
177
|
-
var nestedContexts = componentsContext.___nestedContexts;
|
|
178
|
-
if (nestedContexts !== undefined) {
|
|
179
|
-
nestedContexts.forEach(function(nestedContext) {
|
|
180
|
-
addComponentsFromContext(nestedContext, componentsToHydrate);
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function getInitComponentsData(out, componentDefs) {
|
|
186
|
-
const len = componentDefs.length;
|
|
187
|
-
const $global = out.global;
|
|
188
|
-
const isLast = $global.___isLastFlush;
|
|
189
|
-
const didSerializeComponents = $global.___didSerializeComponents;
|
|
190
|
-
const prefix = $global.componentIdPrefix || $global.widgetIdPrefix;
|
|
191
|
-
|
|
192
|
-
if (len === 0) {
|
|
193
|
-
if (isLast && didSerializeComponents) {
|
|
194
|
-
return { p: prefix, l: 1 };
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const TYPE_INDEX = 1;
|
|
201
|
-
const typesLookup =
|
|
202
|
-
$global.___typesLookup || ($global.___typesLookup = new Map());
|
|
203
|
-
let newTypes;
|
|
204
|
-
|
|
205
|
-
for (let i = 0; i < len; i++) {
|
|
206
|
-
const componentDef = componentDefs[i];
|
|
207
|
-
const typeName = componentDef[TYPE_INDEX];
|
|
208
|
-
let typeIndex = typesLookup.get(typeName);
|
|
209
|
-
|
|
210
|
-
if (typeIndex === undefined) {
|
|
211
|
-
typeIndex = typesLookup.size;
|
|
212
|
-
typesLookup.set(typeName, typeIndex);
|
|
213
|
-
|
|
214
|
-
if (newTypes) {
|
|
215
|
-
newTypes.push(typeName);
|
|
216
|
-
} else {
|
|
217
|
-
newTypes = [typeName];
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
componentDef[TYPE_INDEX] = typeIndex;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
let serializedGlobals;
|
|
225
|
-
|
|
226
|
-
if (!didSerializeComponents) {
|
|
227
|
-
$global.___didSerializeComponents = true;
|
|
228
|
-
serializedGlobals = getSerializedGlobals($global);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return {
|
|
232
|
-
p: prefix,
|
|
233
|
-
l: isLast && 1,
|
|
234
|
-
g: serializedGlobals,
|
|
235
|
-
w: componentDefs,
|
|
236
|
-
t: newTypes
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function getInitComponentsDataFromOut(out) {
|
|
241
|
-
const componentsContext = out.___components;
|
|
242
|
-
|
|
243
|
-
if (componentsContext === null) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const $global = out.global;
|
|
248
|
-
const runtimeId = $global.runtimeId;
|
|
249
|
-
const componentsToHydrate = [];
|
|
250
|
-
addComponentsFromContext(componentsContext, componentsToHydrate);
|
|
251
|
-
|
|
252
|
-
$global.___isLastFlush = true;
|
|
253
|
-
const data = getInitComponentsData(out, componentsToHydrate);
|
|
254
|
-
$global.___isLastFlush = undefined;
|
|
255
|
-
|
|
256
|
-
if (runtimeId !== DEFAULT_RUNTIME_ID && data) {
|
|
257
|
-
data.r = runtimeId;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return data;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function writeInitComponentsCode(out) {
|
|
264
|
-
out.script(exports.___getInitComponentsCode(out));
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
exports.___getInitComponentsCode = function getInitComponentsCode(
|
|
268
|
-
out,
|
|
269
|
-
componentDefs
|
|
270
|
-
) {
|
|
271
|
-
const initComponentsData =
|
|
272
|
-
arguments.length === 2
|
|
273
|
-
? getInitComponentsData(out, componentDefs)
|
|
274
|
-
: getInitComponentsDataFromOut(out);
|
|
275
|
-
|
|
276
|
-
if (initComponentsData === undefined) {
|
|
277
|
-
return "";
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const runtimeId = out.global.runtimeId;
|
|
281
|
-
const componentGlobalKey =
|
|
282
|
-
runtimeId === DEFAULT_RUNTIME_ID ? "MC" : runtimeId + "_C";
|
|
283
|
-
|
|
284
|
-
return `$${componentGlobalKey}=(window.$${componentGlobalKey}||[]).concat(${safeStringify(
|
|
285
|
-
initComponentsData
|
|
286
|
-
)})`;
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
exports.___addComponentsFromContext = addComponentsFromContext;
|
|
290
|
-
exports.writeInitComponentsCode = writeInitComponentsCode;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Returns an object that can be sent to the browser using JSON.stringify. The parsed object should be
|
|
294
|
-
* passed to require('marko-components').initComponents(...);
|
|
295
|
-
*
|
|
296
|
-
* @param {ComponentsContext|AsyncWriter} componentsContext A ComponentsContext or an AsyncWriter
|
|
297
|
-
* @return {Object} An object with information about the rendered components that can be serialized to JSON. The object should be treated as opaque
|
|
298
|
-
*/
|
|
299
|
-
exports.getRenderedComponents = function(out) {
|
|
300
|
-
return warp10.stringifyPrepare(getInitComponentsDataFromOut(out));
|
|
301
|
-
};
|
|
1
|
+
module.exports = require("@internal/components-entry");
|
|
@@ -2,7 +2,7 @@ var ready = require("./ready");
|
|
|
2
2
|
|
|
3
3
|
var idRegExp = /^#(\S+)( .*)?/;
|
|
4
4
|
|
|
5
|
-
exports.patchComponent = function(jQuery, proto, delayThrow) {
|
|
5
|
+
exports.patchComponent = function (jQuery, proto, delayThrow) {
|
|
6
6
|
/* globals window */
|
|
7
7
|
|
|
8
8
|
if (!(jQuery || (jQuery = window.$)) && !delayThrow) {
|
|
@@ -20,7 +20,7 @@ exports.patchComponent = function(jQuery, proto, delayThrow) {
|
|
|
20
20
|
if (args.length === 1) {
|
|
21
21
|
//Handle an "ondomready" callback function
|
|
22
22
|
if (typeof arg === "function") {
|
|
23
|
-
return ready(function() {
|
|
23
|
+
return ready(function () {
|
|
24
24
|
arg.call(self);
|
|
25
25
|
});
|
|
26
26
|
} else if (typeof arg === "string") {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
var complain = "MARKO_DEBUG" && require("complain");
|
|
2
|
-
var marko = require("../../../");
|
|
3
2
|
var makeRenderable = require("../../renderable");
|
|
4
|
-
var getComponentsContext =
|
|
5
|
-
.___getComponentsContext;
|
|
6
|
-
var
|
|
7
|
-
var componentLookup = componentsUtil.___componentLookup;
|
|
3
|
+
var getComponentsContext =
|
|
4
|
+
require("../ComponentsContext").___getComponentsContext;
|
|
5
|
+
var componentLookup = require("@internal/components-util").___componentLookup;
|
|
8
6
|
var modernRenderer = require("../renderer");
|
|
7
|
+
var loader = require("@internal/loader");
|
|
9
8
|
var resolveComponentKey = modernRenderer.___resolveComponentKey;
|
|
10
9
|
|
|
11
10
|
module.exports = function defineRenderer(renderingLogic) {
|
|
@@ -23,7 +22,7 @@ module.exports = function defineRenderer(renderingLogic) {
|
|
|
23
22
|
var template = renderingLogic.template;
|
|
24
23
|
|
|
25
24
|
if (typeof template === "string") {
|
|
26
|
-
template =
|
|
25
|
+
template = loader(template);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
if (!renderer) {
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
module.exports =
|
|
2
|
-
if (def.___isComponent) {
|
|
3
|
-
return def;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
if (renderer) {
|
|
7
|
-
return {
|
|
8
|
-
___isComponent: true,
|
|
9
|
-
_isWidget: true,
|
|
10
|
-
renderer: renderer,
|
|
11
|
-
render: renderer.render,
|
|
12
|
-
renderSync: renderer.renderSync,
|
|
13
|
-
template: renderer.template
|
|
14
|
-
};
|
|
15
|
-
} else {
|
|
16
|
-
return { ___isComponent: true, _isWidget: true };
|
|
17
|
-
}
|
|
18
|
-
};
|
|
1
|
+
module.exports = require("@internal/components-define-widget-legacy");
|
|
@@ -24,7 +24,7 @@ function getRootDeps(template, context) {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
// these dependencies should be last
|
|
27
|
-
deps.concat = function() {
|
|
27
|
+
deps.concat = function () {
|
|
28
28
|
var result = [];
|
|
29
29
|
result = result.concat.apply(result, arguments);
|
|
30
30
|
result.push.apply(result, this);
|
|
@@ -121,7 +121,7 @@ function getInitModule(path, components) {
|
|
|
121
121
|
run: true,
|
|
122
122
|
virtualModule: {
|
|
123
123
|
path: virtualPath,
|
|
124
|
-
read: function(_, callback) {
|
|
124
|
+
read: function (_, callback) {
|
|
125
125
|
// TODO: Check if read can just return string in lasso 2
|
|
126
126
|
if (callback) {
|
|
127
127
|
callback(null, code);
|
|
@@ -172,7 +172,7 @@ function parseDependencyString(string) {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
function patch(Template) {
|
|
175
|
-
Template.prototype.getDependencies = function(context) {
|
|
175
|
+
Template.prototype.getDependencies = function (context) {
|
|
176
176
|
context = context || {};
|
|
177
177
|
|
|
178
178
|
return getRootDeps(this, context);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var getComponentsContext =
|
|
2
|
-
.___getComponentsContext;
|
|
1
|
+
var getComponentsContext =
|
|
2
|
+
require("../ComponentsContext").___getComponentsContext;
|
|
3
3
|
|
|
4
|
-
module.exports = function(out) {
|
|
4
|
+
module.exports = function (out) {
|
|
5
5
|
var componentsContext = getComponentsContext(out);
|
|
6
6
|
var componentDef =
|
|
7
7
|
(componentsContext && componentsContext.___legacyComponentDef) || {};
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// legacy api
|
|
4
|
-
exports.defineComponent = require("./defineComponent-legacy");
|
|
5
|
-
exports.defineWidget = require("./defineWidget-legacy");
|
|
6
|
-
exports.defineRenderer = require("./defineRenderer-legacy");
|
|
7
|
-
exports.makeRenderable = exports.renderable = require("../../renderable");
|
|
8
|
-
|
|
9
|
-
// server only
|
|
10
|
-
exports.writeInitWidgetsCode = modernMarko.writeInitComponentsCode;
|
|
11
|
-
exports.getRenderedWidgets = exports.getRenderedWidgetIds =
|
|
12
|
-
modernMarko.getRenderedComponents;
|
|
13
|
-
exports.getInitWidgetsCode = function(out) {
|
|
14
|
-
return modernMarko.___getInitComponentsCode(out);
|
|
15
|
-
};
|
|
1
|
+
module.exports = require("@internal/components-entry-legacy");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var getComponentsContext =
|
|
2
|
-
.___getComponentsContext;
|
|
3
|
-
var componentsUtil = require("
|
|
1
|
+
var getComponentsContext =
|
|
2
|
+
require("../ComponentsContext").___getComponentsContext;
|
|
3
|
+
var componentsUtil = require("@internal/components-util");
|
|
4
4
|
var componentLookup = componentsUtil.___componentLookup;
|
|
5
|
-
var registry = require("
|
|
5
|
+
var registry = require("@internal/components-registry");
|
|
6
6
|
var modernRenderer = require("../renderer");
|
|
7
7
|
var resolveComponentKey = modernRenderer.___resolveComponentKey;
|
|
8
8
|
var trackAsyncComponents = modernRenderer.___trackAsyncComponents;
|
|
9
|
-
var beginComponent = require("
|
|
10
|
-
var endComponent = require("
|
|
9
|
+
var beginComponent = require("@internal/components-beginComponent");
|
|
10
|
+
var endComponent = require("@internal/components-endComponent");
|
|
11
11
|
var complain = "MARKO_DEBUG" && require("complain");
|
|
12
12
|
|
|
13
13
|
function createRendererFunc(templateRenderFunc, componentProps) {
|
|
@@ -134,7 +134,7 @@ function createRendererFunc(templateRenderFunc, componentProps) {
|
|
|
134
134
|
componentDef.___isExisting = isExisting;
|
|
135
135
|
componentDef.___isLegacy = true;
|
|
136
136
|
|
|
137
|
-
componentDef.t = function(typeName) {
|
|
137
|
+
componentDef.t = function (typeName) {
|
|
138
138
|
if (typeName) {
|
|
139
139
|
if (registry.___isServer) {
|
|
140
140
|
var oldComponent = component;
|
|
@@ -141,13 +141,13 @@ function ready(callback, thisObj, doc) {
|
|
|
141
141
|
|
|
142
142
|
module.exports = ready;
|
|
143
143
|
|
|
144
|
-
module.exports.patchComponent = function(proto) {
|
|
144
|
+
module.exports.patchComponent = function (proto) {
|
|
145
145
|
if (proto && proto.ready) {
|
|
146
146
|
// Don't patch if the component has overwritten the ready method.
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
(proto || require("./Component").prototype).ready = function(callback) {
|
|
150
|
+
(proto || require("./Component").prototype).ready = function (callback) {
|
|
151
151
|
var document = this.el.ownerDocument;
|
|
152
152
|
ready(callback, this, document);
|
|
153
153
|
};
|
|
@@ -1,44 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const copyProps = require("raptor-util/copyProps");
|
|
3
|
-
const constructorCache = new Map();
|
|
4
|
-
const BaseServerComponent = require("./ServerComponent");
|
|
5
|
-
|
|
6
|
-
function createServerComponentClass(renderingLogic) {
|
|
7
|
-
var renderingLogicProps =
|
|
8
|
-
typeof renderingLogic === "function"
|
|
9
|
-
? renderingLogic.prototype
|
|
10
|
-
: renderingLogic;
|
|
11
|
-
|
|
12
|
-
class ServerComponent extends BaseServerComponent {}
|
|
13
|
-
|
|
14
|
-
copyProps(renderingLogicProps, ServerComponent.prototype);
|
|
15
|
-
|
|
16
|
-
return ServerComponent;
|
|
17
|
-
}
|
|
18
|
-
function createComponent(
|
|
19
|
-
renderingLogic,
|
|
20
|
-
id,
|
|
21
|
-
input,
|
|
22
|
-
out,
|
|
23
|
-
typeName,
|
|
24
|
-
customEvents,
|
|
25
|
-
scope
|
|
26
|
-
) {
|
|
27
|
-
let ServerComponent;
|
|
28
|
-
|
|
29
|
-
if (renderingLogic) {
|
|
30
|
-
ServerComponent = constructorCache.get(renderingLogic);
|
|
31
|
-
|
|
32
|
-
if (!ServerComponent) {
|
|
33
|
-
ServerComponent = createServerComponentClass(renderingLogic);
|
|
34
|
-
constructorCache.set(renderingLogic, ServerComponent);
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
ServerComponent = BaseServerComponent;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return new ServerComponent(id, input, out, typeName, customEvents, scope);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
exports.___isServer = true;
|
|
44
|
-
exports.___createComponent = createComponent;
|
|
1
|
+
module.exports = require("@internal/components-registry");
|