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,8 +4,8 @@
|
|
|
4
4
|
var BaseState;
|
|
5
5
|
var BaseComponent;
|
|
6
6
|
var inherit;
|
|
7
|
-
var jQuery = require("
|
|
8
|
-
var ready = require("
|
|
7
|
+
var jQuery = require("../../../runtime/components/jquery");
|
|
8
|
+
var ready = require("../../../runtime/components/ready");
|
|
9
9
|
|
|
10
10
|
var complain;
|
|
11
11
|
var stateToJSONDef = {
|
|
@@ -19,7 +19,7 @@ function noop() {}
|
|
|
19
19
|
module.exports = function defineWidget(def, renderer) {
|
|
20
20
|
def = def.Widget || def;
|
|
21
21
|
|
|
22
|
-
if (def.
|
|
22
|
+
if (def.A_) {
|
|
23
23
|
return def;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -49,7 +49,7 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
49
49
|
BaseComponent.call(this, id, doc);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
if (!proto.
|
|
52
|
+
if (!proto.A_) {
|
|
53
53
|
// Inherit from Component if they didn't already
|
|
54
54
|
ComponentClass.prototype = Object.create(BaseComponent.prototype);
|
|
55
55
|
for (var propName in proto) {
|
|
@@ -62,16 +62,16 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
62
62
|
// The same prototype will be used by our constructor after
|
|
63
63
|
// we he have set up the prototype chain using the inherit function
|
|
64
64
|
proto = Component.prototype = ComponentClass.prototype;
|
|
65
|
-
proto.
|
|
65
|
+
proto.B_ = true;
|
|
66
66
|
|
|
67
67
|
proto.constructor = def.constructor = Component;
|
|
68
68
|
|
|
69
69
|
Object.defineProperty(proto, "state", {
|
|
70
70
|
get: function () {
|
|
71
|
-
var raw = this.
|
|
71
|
+
var raw = this.C_ && this.C_.D_;
|
|
72
72
|
|
|
73
73
|
if (raw && !raw.toJSON) {
|
|
74
|
-
Object.defineProperty(this.
|
|
74
|
+
Object.defineProperty(this.C_.D_, "toJSON", stateToJSONDef);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
return raw;
|
|
@@ -87,7 +87,7 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
87
87
|
|
|
88
88
|
Object.defineProperty(proto, "__document", {
|
|
89
89
|
get: function () {
|
|
90
|
-
return this.
|
|
90
|
+
return this.E_;
|
|
91
91
|
// eslint-disable-next-line no-constant-condition
|
|
92
92
|
}
|
|
93
93
|
});
|
|
@@ -95,38 +95,38 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
95
95
|
Object.defineProperty(proto, "el", {
|
|
96
96
|
get: function () {
|
|
97
97
|
|
|
98
|
-
return this.
|
|
98
|
+
return this.F_;
|
|
99
99
|
// eslint-disable-next-line no-constant-condition
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
// get legacy methods
|
|
104
104
|
|
|
105
|
-
proto.
|
|
105
|
+
proto.G_ = proto.onRender;
|
|
106
106
|
Object.defineProperty(proto, "onRender", {
|
|
107
107
|
get: noop,
|
|
108
108
|
set: function (v) {
|
|
109
|
-
proto.
|
|
109
|
+
proto.G_ = v;
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
proto.
|
|
113
|
+
proto.H_ = proto.onUpdate;
|
|
114
114
|
Object.defineProperty(proto, "onUpdate", {
|
|
115
115
|
get: function () {
|
|
116
116
|
return modernMountOrUpdate;
|
|
117
117
|
},
|
|
118
118
|
set: function (v) {
|
|
119
|
-
proto.
|
|
119
|
+
proto.H_ = v;
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
|
|
123
|
-
proto.
|
|
123
|
+
proto.I_ = proto.onDestroy;
|
|
124
124
|
Object.defineProperty(proto, "onDestroy", {
|
|
125
125
|
get: function () {
|
|
126
126
|
return modernOnDestory;
|
|
127
127
|
},
|
|
128
128
|
set: function (v) {
|
|
129
|
-
proto.
|
|
129
|
+
proto.I_ = v;
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
|
|
@@ -135,91 +135,91 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
135
135
|
proto.onMount = modernMountOrUpdate;
|
|
136
136
|
|
|
137
137
|
if (legacyInit) {
|
|
138
|
-
proto.
|
|
138
|
+
proto.J_ = legacyInit;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// convert legacy to modern
|
|
142
|
-
proto.
|
|
142
|
+
proto.K_ = proto.update;
|
|
143
143
|
proto.update = function () {
|
|
144
|
-
if (this.
|
|
144
|
+
if (this.L_) {
|
|
145
145
|
|
|
146
146
|
this.destroy = modernOnDestory;
|
|
147
147
|
// eslint-disable-next-line no-constant-condition
|
|
148
148
|
|
|
149
|
-
this.
|
|
149
|
+
this.L_ = false;
|
|
150
150
|
}
|
|
151
|
-
this.
|
|
152
|
-
if (this.
|
|
151
|
+
this.M_ = true;
|
|
152
|
+
if (this.F_) {
|
|
153
153
|
this.onBeforeUpdate && this.onBeforeUpdate();
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
156
|
+
this.K_();
|
|
157
|
+
this.M_ = false;
|
|
158
158
|
};
|
|
159
159
|
|
|
160
160
|
function modernMountOrUpdate() {
|
|
161
161
|
var self = this;
|
|
162
|
-
var el = this.
|
|
163
|
-
var prevEl = this.
|
|
162
|
+
var el = this.N_["@_wbind"];
|
|
163
|
+
var prevEl = this.F_;
|
|
164
164
|
|
|
165
165
|
if (prevEl !== el) {
|
|
166
|
-
this.
|
|
166
|
+
this.F_ = el;
|
|
167
167
|
|
|
168
168
|
if (prevEl) {
|
|
169
169
|
this.onBeforeDestroy && this.onBeforeDestroy();
|
|
170
|
-
this.
|
|
171
|
-
this.
|
|
170
|
+
this.I_ && this.I_();
|
|
171
|
+
this.O_ = undefined;
|
|
172
172
|
this.removeAllListeners();
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
if (el) {
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
176
|
+
this.J_ && this.J_(this.widgetConfig || {});
|
|
177
|
+
this.G_ && this.G_({ firstRender: true });
|
|
178
|
+
this.O_ = legacyRender;
|
|
179
179
|
|
|
180
180
|
// eslint-disable-next-line no-constant-condition
|
|
181
181
|
el.__widget = this;
|
|
182
182
|
}
|
|
183
183
|
} else if (el) {
|
|
184
184
|
if (prevEl) {
|
|
185
|
-
this.
|
|
185
|
+
this.H_ && this.H_();
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
if (this.
|
|
189
|
-
this.
|
|
188
|
+
if (this.P_) {
|
|
189
|
+
this.G_ && this.G_({ firstRender: false });
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
this.
|
|
194
|
-
this.
|
|
195
|
-
this.
|
|
193
|
+
this.Q_ = this.R_;
|
|
194
|
+
this.R_ = null;
|
|
195
|
+
this.P_ = false;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
function legacyRender() {
|
|
199
|
-
if (!this.
|
|
199
|
+
if (!this.M_) {
|
|
200
200
|
this.onBeforeUpdate && this.onBeforeUpdate();
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
this.
|
|
203
|
+
this.P_ = true;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
function modernOnDestory() {
|
|
207
|
-
if (this.
|
|
207
|
+
if (this.F_) {
|
|
208
208
|
this.onBeforeDestroy && this.onBeforeDestroy();
|
|
209
|
-
this.
|
|
210
|
-
this.
|
|
209
|
+
this.I_ && this.I_();
|
|
210
|
+
this.F_ = null;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
// Set a flag on the constructor function to make it clear this is
|
|
215
215
|
// a component so that we can short-circuit this work later
|
|
216
|
-
Component.
|
|
216
|
+
Component.A_ = true;
|
|
217
217
|
|
|
218
218
|
function State() {
|
|
219
219
|
BaseState.apply(this, arguments);
|
|
220
220
|
}
|
|
221
221
|
inherit(State, BaseState);
|
|
222
|
-
proto.
|
|
222
|
+
proto.S_ = State;
|
|
223
223
|
|
|
224
224
|
jQuery.patchComponent(window.$, proto, true /* don't throw error until used if `$` is missing*/
|
|
225
225
|
);
|
|
@@ -251,7 +251,7 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
251
251
|
if (renderer) {
|
|
252
252
|
// Add the rendering related methods as statics on the
|
|
253
253
|
// new component constructor function
|
|
254
|
-
Component.renderer = proto.
|
|
254
|
+
Component.renderer = proto.T_ = renderer;
|
|
255
255
|
Component.render = renderer.render;
|
|
256
256
|
Component.renderSync = renderer.renderSync;
|
|
257
257
|
}
|
|
@@ -263,6 +263,6 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
263
263
|
return Component;
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
-
BaseState = require("
|
|
267
|
-
BaseComponent = require("
|
|
266
|
+
BaseState = require("../../../runtime/components/State");
|
|
267
|
+
BaseComponent = require("../../../runtime/components/Component");
|
|
268
268
|
inherit = require("raptor-util/inherit");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = function defineWidget(def, renderer) {
|
|
2
|
+
if (def.A_) {
|
|
3
|
+
return def;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
if (renderer) {
|
|
7
|
+
return {
|
|
8
|
+
A_: true,
|
|
9
|
+
_isWidget: true,
|
|
10
|
+
renderer: renderer,
|
|
11
|
+
render: renderer.render,
|
|
12
|
+
renderSync: renderer.renderSync,
|
|
13
|
+
template: renderer.template
|
|
14
|
+
};
|
|
15
|
+
} else {
|
|
16
|
+
return { A_: true, _isWidget: true };
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var ComponentsContext = require("../../../runtime/components/ComponentsContext");
|
|
4
|
+
var getComponentsContext = ComponentsContext.U_;
|
|
5
|
+
|
|
6
|
+
module.exports = function endComponent(out, componentDef) {
|
|
7
|
+
if (componentDef.w_) {
|
|
8
|
+
out.w("<!--" + out.global.runtimeId + "/-->");
|
|
9
|
+
getComponentsContext(out).y_ = componentDef.z_;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var registry = require("@internal/components-registry");
|
|
2
|
+
|
|
3
|
+
exports.getComponentForEl = require("@internal/components-util").V_;
|
|
4
|
+
exports.init = registry.W_;
|
|
5
|
+
exports.register = function (id, component) {
|
|
6
|
+
registry.r(id, function () {
|
|
7
|
+
return component;
|
|
8
|
+
});
|
|
9
|
+
};
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
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(safeJSONRegExp, safeJSONReplacer);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getSerializedGlobals($global) {
|
|
36
|
+
let serializedGlobalsLookup = $global.serializedGlobals;
|
|
37
|
+
if (serializedGlobalsLookup) {
|
|
38
|
+
let serializedGlobals;
|
|
39
|
+
let keys = Object.keys(serializedGlobalsLookup);
|
|
40
|
+
for (let i = keys.length; i--;) {
|
|
41
|
+
let key = keys[i];
|
|
42
|
+
if (serializedGlobalsLookup[key]) {
|
|
43
|
+
let value = $global[key];
|
|
44
|
+
if (!IGNORE_GLOBAL_TYPES.has(typeof value)) {
|
|
45
|
+
if (serializedGlobals === undefined) {
|
|
46
|
+
serializedGlobals = {};
|
|
47
|
+
}
|
|
48
|
+
serializedGlobals[key] = value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return serializedGlobals;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function addComponentsFromContext(componentsContext, componentsToHydrate) {
|
|
58
|
+
var components = componentsContext.t_;
|
|
59
|
+
|
|
60
|
+
var len = components.length;
|
|
61
|
+
|
|
62
|
+
for (var i = 0; i < len; i++) {
|
|
63
|
+
var componentDef = components[i];
|
|
64
|
+
var id = componentDef.id;
|
|
65
|
+
var component = componentDef.v_;
|
|
66
|
+
var flags = componentDef.x_;
|
|
67
|
+
var isLegacy = componentDef.B_;
|
|
68
|
+
|
|
69
|
+
var state = component.state;
|
|
70
|
+
var input = component.input || 0;
|
|
71
|
+
var typeName = component.typeName;
|
|
72
|
+
var customEvents = component.X_;
|
|
73
|
+
var scope = component.Y_;
|
|
74
|
+
var bubblingDomEvents = component.Z_;
|
|
75
|
+
|
|
76
|
+
var needsState;
|
|
77
|
+
var serializedProps;
|
|
78
|
+
var renderBody;
|
|
79
|
+
|
|
80
|
+
if (isLegacy) {
|
|
81
|
+
flags |= FLAG_IS_LEGACY;
|
|
82
|
+
renderBody = component.___;
|
|
83
|
+
|
|
84
|
+
if (component.widgetConfig && isNotEmpty(component.widgetConfig)) {
|
|
85
|
+
serializedProps = component.widgetConfig;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
needsState = true;
|
|
89
|
+
} else {
|
|
90
|
+
if (input && input.renderBody) {
|
|
91
|
+
renderBody = input.renderBody;
|
|
92
|
+
input.renderBody = undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (!(flags & FLAG_WILL_RERENDER_IN_BROWSER) || flags & FLAG_OLD_HYDRATE_NO_CREATE) {
|
|
96
|
+
component.C_ = undefined; // We don't use `delete` to avoid V8 deoptimization
|
|
97
|
+
component.R_ = undefined; // We don't use `delete` to avoid V8 deoptimization
|
|
98
|
+
component.typeName = undefined;
|
|
99
|
+
component.id = undefined;
|
|
100
|
+
component.X_ = undefined;
|
|
101
|
+
component.Y_ = undefined;
|
|
102
|
+
component.Z_ = undefined;
|
|
103
|
+
component._a_ = undefined;
|
|
104
|
+
component._b_ = undefined;
|
|
105
|
+
component._c_ = undefined;
|
|
106
|
+
|
|
107
|
+
needsState = true;
|
|
108
|
+
|
|
109
|
+
if (isNotEmpty(component)) {
|
|
110
|
+
serializedProps = component;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
var undefinedPropNames = undefined;
|
|
116
|
+
|
|
117
|
+
if (needsState && state) {
|
|
118
|
+
// Update state properties with an `undefined` value to have a `null`
|
|
119
|
+
// value so that the property name will be serialized down to the browser.
|
|
120
|
+
// This ensures that we add the proper getter/setter for the state property.
|
|
121
|
+
const stateKeys = Object.keys(state);
|
|
122
|
+
for (let i = stateKeys.length; i--;) {
|
|
123
|
+
const stateKey = stateKeys[i];
|
|
124
|
+
|
|
125
|
+
if (state[stateKey] === undefined) {
|
|
126
|
+
if (undefinedPropNames) {
|
|
127
|
+
undefinedPropNames.push(stateKey);
|
|
128
|
+
} else {
|
|
129
|
+
undefinedPropNames = [stateKey];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (typeof renderBody === "function") {
|
|
136
|
+
flags |= FLAG_HAS_RENDER_BODY;
|
|
137
|
+
renderBody = undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var extra = {
|
|
141
|
+
b: bubblingDomEvents,
|
|
142
|
+
d: componentDef._d_,
|
|
143
|
+
e: customEvents,
|
|
144
|
+
f: flags || undefined,
|
|
145
|
+
p: customEvents && scope, // Only serialize scope if we need to attach custom events
|
|
146
|
+
s: needsState && state,
|
|
147
|
+
u: undefinedPropNames,
|
|
148
|
+
w: serializedProps,
|
|
149
|
+
r: renderBody
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
var parts = [id, typeName];
|
|
153
|
+
var hasExtra = isNotEmpty(extra);
|
|
154
|
+
|
|
155
|
+
if (input) {
|
|
156
|
+
parts.push(input);
|
|
157
|
+
|
|
158
|
+
if (hasExtra) {
|
|
159
|
+
parts.push(extra);
|
|
160
|
+
}
|
|
161
|
+
} else if (hasExtra) {
|
|
162
|
+
parts.push(0, extra); // empty input;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
componentsToHydrate.push(parts);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
components.length = 0;
|
|
169
|
+
|
|
170
|
+
// Also add any components from nested contexts
|
|
171
|
+
var nestedContexts = componentsContext._e_;
|
|
172
|
+
if (nestedContexts !== undefined) {
|
|
173
|
+
nestedContexts.forEach(function (nestedContext) {
|
|
174
|
+
addComponentsFromContext(nestedContext, componentsToHydrate);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function getInitComponentsData(out, componentDefs) {
|
|
180
|
+
const len = componentDefs.length;
|
|
181
|
+
const $global = out.global;
|
|
182
|
+
const isLast = $global.f_;
|
|
183
|
+
const didSerializeComponents = $global._f_;
|
|
184
|
+
const prefix = $global.componentIdPrefix || $global.widgetIdPrefix;
|
|
185
|
+
|
|
186
|
+
if (len === 0) {
|
|
187
|
+
if (isLast && didSerializeComponents) {
|
|
188
|
+
return { p: prefix, l: 1 };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const TYPE_INDEX = 1;
|
|
195
|
+
const typesLookup = $global._g_ || ($global._g_ = new Map());
|
|
196
|
+
let newTypes;
|
|
197
|
+
|
|
198
|
+
for (let i = 0; i < len; i++) {
|
|
199
|
+
const componentDef = componentDefs[i];
|
|
200
|
+
const typeName = componentDef[TYPE_INDEX];
|
|
201
|
+
let typeIndex = typesLookup.get(typeName);
|
|
202
|
+
|
|
203
|
+
if (typeIndex === undefined) {
|
|
204
|
+
typeIndex = typesLookup.size;
|
|
205
|
+
typesLookup.set(typeName, typeIndex);
|
|
206
|
+
|
|
207
|
+
if (newTypes) {
|
|
208
|
+
newTypes.push(typeName);
|
|
209
|
+
} else {
|
|
210
|
+
newTypes = [typeName];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
componentDef[TYPE_INDEX] = typeIndex;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
let serializedGlobals;
|
|
218
|
+
|
|
219
|
+
if (!didSerializeComponents) {
|
|
220
|
+
$global._f_ = true;
|
|
221
|
+
serializedGlobals = getSerializedGlobals($global);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
p: prefix,
|
|
226
|
+
l: isLast && 1,
|
|
227
|
+
g: serializedGlobals,
|
|
228
|
+
w: componentDefs,
|
|
229
|
+
t: newTypes
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function getInitComponentsDataFromOut(out) {
|
|
234
|
+
const componentsContext = out.t_;
|
|
235
|
+
|
|
236
|
+
if (componentsContext === null) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const $global = out.global;
|
|
241
|
+
const runtimeId = $global.runtimeId;
|
|
242
|
+
const componentsToHydrate = [];
|
|
243
|
+
addComponentsFromContext(componentsContext, componentsToHydrate);
|
|
244
|
+
|
|
245
|
+
$global.f_ = true;
|
|
246
|
+
const data = getInitComponentsData(out, componentsToHydrate);
|
|
247
|
+
$global.f_ = undefined;
|
|
248
|
+
|
|
249
|
+
if (runtimeId !== DEFAULT_RUNTIME_ID && data) {
|
|
250
|
+
data.r = runtimeId;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return data;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function writeInitComponentsCode(out) {
|
|
257
|
+
out.script(exports._h_(out));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
exports._h_ = function getInitComponentsCode(out, componentDefs) {
|
|
261
|
+
const initComponentsData = arguments.length === 2 ? getInitComponentsData(out, componentDefs) : getInitComponentsDataFromOut(out);
|
|
262
|
+
|
|
263
|
+
if (initComponentsData === undefined) {
|
|
264
|
+
return "";
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const runtimeId = out.global.runtimeId;
|
|
268
|
+
const componentGlobalKey = runtimeId === DEFAULT_RUNTIME_ID ? "MC" : runtimeId + "_C";
|
|
269
|
+
|
|
270
|
+
return `$${componentGlobalKey}=(window.$${componentGlobalKey}||[]).concat(${safeStringify(initComponentsData)})`;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
exports._i_ = addComponentsFromContext;
|
|
274
|
+
exports.writeInitComponentsCode = writeInitComponentsCode;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Returns an object that can be sent to the browser using JSON.stringify. The parsed object should be
|
|
278
|
+
* passed to require('marko-components').initComponents(...);
|
|
279
|
+
*
|
|
280
|
+
* @param {ComponentsContext|AsyncWriter} componentsContext A ComponentsContext or an AsyncWriter
|
|
281
|
+
* @return {Object} An object with information about the rendered components that can be serialized to JSON. The object should be treated as opaque
|
|
282
|
+
*/
|
|
283
|
+
exports.getRenderedComponents = function (out) {
|
|
284
|
+
return warp10.stringifyPrepare(getInitComponentsDataFromOut(out));
|
|
285
|
+
};
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var Component = require("../../../runtime/components/Component");
|
|
2
|
+
var loader = require("@internal/loader");
|
|
3
|
+
var getComponentForEl = require("@internal/components-util").V_;
|
|
4
4
|
|
|
5
5
|
var complain;
|
|
6
6
|
|
|
7
7
|
// expose legacy
|
|
8
|
-
require("
|
|
8
|
+
require("@internal/components-registry")._j_ = exports;
|
|
9
9
|
exports.load = function (typeName) {
|
|
10
10
|
return exports.defineWidget(loader(typeName));
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// legacy api
|
|
14
|
-
exports.defineComponent = require("
|
|
15
|
-
exports.defineWidget = require("
|
|
16
|
-
exports.defineRenderer = require("
|
|
17
|
-
exports.makeRenderable = exports.renderable = require("
|
|
14
|
+
exports.defineComponent = require("../../../runtime/components/legacy/defineComponent-legacy");
|
|
15
|
+
exports.defineWidget = require("@internal/components-define-widget-legacy");
|
|
16
|
+
exports.defineRenderer = require("../../../runtime/components/legacy/defineRenderer-legacy");
|
|
17
|
+
exports.makeRenderable = exports.renderable = require("../../../runtime/renderable");
|
|
18
18
|
|
|
19
19
|
// browser only
|
|
20
20
|
var Widget = exports.Widget = Component;
|
|
21
|
-
exports.onInitWidget = modernMarko.onInitComponent;
|
|
22
21
|
exports.getWidgetForEl = exports.get = function (elOrId) {
|
|
23
22
|
var el = elOrId;
|
|
24
23
|
|
|
@@ -30,16 +29,16 @@ exports.getWidgetForEl = exports.get = function (elOrId) {
|
|
|
30
29
|
return el.__widget;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
return
|
|
32
|
+
return getComponentForEl(el);
|
|
34
33
|
};
|
|
35
|
-
exports.initWidgets =
|
|
34
|
+
exports.initWidgets = require("@internal/components-registry").W_;
|
|
36
35
|
|
|
37
36
|
// monkey patch Widget
|
|
38
37
|
if (Widget) {
|
|
39
38
|
var WidgetProto = Widget.prototype;
|
|
40
39
|
WidgetProto.setProps = function (newInput) {
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
40
|
+
this._k_ = true;
|
|
41
|
+
this._l_(newInput);
|
|
43
42
|
};
|
|
44
43
|
WidgetProto.rerender = function (newInput) {
|
|
45
44
|
if (newInput) {
|
|
@@ -51,7 +50,7 @@ if (Widget) {
|
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
var RenderResult = require("
|
|
53
|
+
var RenderResult = require("../../../runtime/RenderResult");
|
|
55
54
|
|
|
56
55
|
RenderResult.prototype.getWidget = function () {
|
|
57
56
|
return this.getWidgets()[0];
|
|
@@ -59,7 +58,7 @@ RenderResult.prototype.getWidget = function () {
|
|
|
59
58
|
};
|
|
60
59
|
RenderResult.prototype.getWidgets = function () {
|
|
61
60
|
return RenderResult.prototype.getComponents.apply(this, arguments).filter(function (component) {
|
|
62
|
-
return component.
|
|
61
|
+
return component.B_;
|
|
63
62
|
});
|
|
64
63
|
// eslint-disable-next-line no-constant-condition
|
|
65
64
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var modernMarko = require("@internal/components-entry");
|
|
2
|
+
|
|
3
|
+
// legacy api
|
|
4
|
+
exports.defineComponent = require("../../../runtime/components/legacy/defineComponent-legacy");
|
|
5
|
+
exports.defineWidget = require("@internal/components-define-widget-legacy");
|
|
6
|
+
exports.defineRenderer = require("../../../runtime/components/legacy/defineRenderer-legacy");
|
|
7
|
+
exports.makeRenderable = exports.renderable = require("../../../runtime/renderable");
|
|
8
|
+
|
|
9
|
+
// server only
|
|
10
|
+
exports.writeInitWidgetsCode = modernMarko.writeInitComponentsCode;
|
|
11
|
+
exports.getRenderedWidgets = exports.getRenderedWidgetIds = modernMarko.getRenderedComponents;
|
|
12
|
+
exports.getInitWidgetsCode = function (out) {
|
|
13
|
+
return modernMarko._h_(out);
|
|
14
|
+
};
|