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
|
@@ -5,10 +5,10 @@ var complain;
|
|
|
5
5
|
|
|
6
6
|
var domInsert = require("../dom-insert");
|
|
7
7
|
var defaultCreateOut = require("../createOut");
|
|
8
|
-
var getComponentsContext = require("./ComponentsContext").
|
|
9
|
-
var componentsUtil = require("
|
|
10
|
-
var componentLookup = componentsUtil.
|
|
11
|
-
var destroyNodeRecursive = componentsUtil.
|
|
8
|
+
var getComponentsContext = require("./ComponentsContext").U_;
|
|
9
|
+
var componentsUtil = require("@internal/components-util");
|
|
10
|
+
var componentLookup = componentsUtil._n_;
|
|
11
|
+
var destroyNodeRecursive = componentsUtil._S_;
|
|
12
12
|
var EventEmitter = require("events-light");
|
|
13
13
|
var RenderResult = require("../RenderResult");
|
|
14
14
|
var SubscriptionTracker = require("listener-tracker");
|
|
@@ -17,10 +17,11 @@ var updateManager = require("./update-manager");
|
|
|
17
17
|
var morphdom = require("../vdom/morphdom");
|
|
18
18
|
var eventDelegation = require("./event-delegation");
|
|
19
19
|
var domData = require("./dom-data");
|
|
20
|
-
var componentsByDOMNode = domData.
|
|
21
|
-
var keyedElementsByComponentId = domData.
|
|
20
|
+
var componentsByDOMNode = domData._q_;
|
|
21
|
+
var keyedElementsByComponentId = domData._p_;
|
|
22
22
|
var CONTEXT_KEY = "__subtree_context__";
|
|
23
23
|
|
|
24
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
24
25
|
var slice = Array.prototype.slice;
|
|
25
26
|
|
|
26
27
|
var COMPONENT_SUBSCRIBE_TO_OPTIONS;
|
|
@@ -59,7 +60,7 @@ function handleCustomEventWithMethodListener(component, targetMethodName, args,
|
|
|
59
60
|
args = extraArgs.concat(args);
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
var targetComponent = componentLookup[component.
|
|
63
|
+
var targetComponent = componentLookup[component.Y_];
|
|
63
64
|
var targetMethod = typeof targetMethodName === "function" ? targetMethodName : targetComponent[targetMethodName];
|
|
64
65
|
if (!targetMethod) {
|
|
65
66
|
throw Error("Method not found: " + targetMethodName);
|
|
@@ -88,7 +89,7 @@ function processUpdateHandlers(component, stateChanges, oldState) {
|
|
|
88
89
|
var handlers;
|
|
89
90
|
|
|
90
91
|
for (var propName in stateChanges) {
|
|
91
|
-
if (
|
|
92
|
+
if (hasOwnProperty.call(stateChanges, propName)) {
|
|
92
93
|
var handlerMethodName = "update_" + propName;
|
|
93
94
|
|
|
94
95
|
handlerMethod = component[handlerMethodName];
|
|
@@ -118,8 +119,8 @@ function processUpdateHandlers(component, stateChanges, oldState) {
|
|
|
118
119
|
handlerMethod.call(component, newValue, oldValue);
|
|
119
120
|
});
|
|
120
121
|
|
|
121
|
-
component.
|
|
122
|
-
component.
|
|
122
|
+
component._y_();
|
|
123
|
+
component._t_();
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
return true;
|
|
@@ -159,50 +160,50 @@ var componentProto;
|
|
|
159
160
|
function Component(id) {
|
|
160
161
|
EventEmitter.call(this);
|
|
161
162
|
this.id = id;
|
|
162
|
-
this.
|
|
163
|
-
this.
|
|
164
|
-
this.
|
|
165
|
-
this.
|
|
166
|
-
this.
|
|
167
|
-
this.
|
|
168
|
-
this.
|
|
169
|
-
this.
|
|
170
|
-
this.
|
|
171
|
-
this.
|
|
172
|
-
this.
|
|
173
|
-
this.
|
|
174
|
-
this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
163
|
+
this.C_ = null;
|
|
164
|
+
this._E_ = null;
|
|
165
|
+
this.ak_ = null;
|
|
166
|
+
this._w_ = null;
|
|
167
|
+
this.Z_ = null; // Used to keep track of bubbling DOM events for components rendered on the server
|
|
168
|
+
this.X_ = null;
|
|
169
|
+
this.Y_ = null;
|
|
170
|
+
this.al_ = null;
|
|
171
|
+
this.R_ = undefined;
|
|
172
|
+
this._x_ = false;
|
|
173
|
+
this.am_ = undefined;
|
|
174
|
+
this.L_ = false;
|
|
175
|
+
this._c_ = false;
|
|
176
|
+
this.an_ = false;
|
|
177
|
+
this.ao_ = false;
|
|
178
|
+
this.E_ = undefined;
|
|
178
179
|
|
|
179
180
|
var ssrKeyedElements = keyedElementsByComponentId[id];
|
|
180
181
|
|
|
181
182
|
if (ssrKeyedElements) {
|
|
182
|
-
this.
|
|
183
|
+
this.N_ = ssrKeyedElements;
|
|
183
184
|
delete keyedElementsByComponentId[id];
|
|
184
185
|
} else {
|
|
185
|
-
this.
|
|
186
|
+
this.N_ = {};
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
Component.prototype = componentProto = {
|
|
190
|
-
|
|
191
|
+
A_: true,
|
|
191
192
|
|
|
192
193
|
subscribeTo: function (target) {
|
|
193
194
|
if (!target) {
|
|
194
195
|
throw TypeError();
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
var subscriptions = this.
|
|
198
|
+
var subscriptions = this.ak_ || (this.ak_ = new SubscriptionTracker());
|
|
198
199
|
|
|
199
|
-
var subscribeToOptions = target.
|
|
200
|
+
var subscribeToOptions = target.A_ ? COMPONENT_SUBSCRIBE_TO_OPTIONS : NON_COMPONENT_SUBSCRIBE_TO_OPTIONS;
|
|
200
201
|
|
|
201
202
|
return subscriptions.subscribeTo(target, subscribeToOptions);
|
|
202
203
|
},
|
|
203
204
|
|
|
204
205
|
emit: function (eventType) {
|
|
205
|
-
var customEvents = this.
|
|
206
|
+
var customEvents = this.X_;
|
|
206
207
|
var target;
|
|
207
208
|
|
|
208
209
|
if (customEvents && (target = customEvents[eventType])) {
|
|
@@ -229,10 +230,10 @@ Component.prototype = componentProto = {
|
|
|
229
230
|
getEl: function (key, index) {
|
|
230
231
|
if (key) {
|
|
231
232
|
var resolvedKey = resolveKeyHelper(key, index);
|
|
232
|
-
var keyedElement = this.
|
|
233
|
+
var keyedElement = this.N_["@" + resolvedKey];
|
|
233
234
|
|
|
234
235
|
if (!keyedElement) {
|
|
235
|
-
var keyedComponentRoot = this.
|
|
236
|
+
var keyedComponentRoot = this.N_[resolvedKey];
|
|
236
237
|
|
|
237
238
|
if (keyedComponentRoot) {
|
|
238
239
|
|
|
@@ -260,7 +261,7 @@ Component.prototype = componentProto = {
|
|
|
260
261
|
return els;
|
|
261
262
|
},
|
|
262
263
|
getComponent: function (key, index) {
|
|
263
|
-
var rootNode = this.
|
|
264
|
+
var rootNode = this.N_[resolveKeyHelper(key, index)];
|
|
264
265
|
if (/\[\]$/.test(key)) {
|
|
265
266
|
rootNode = rootNode && rootNode[Object.keys(rootNode)[0]];
|
|
266
267
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -268,26 +269,26 @@ Component.prototype = componentProto = {
|
|
|
268
269
|
return rootNode && componentsByDOMNode.get(rootNode);
|
|
269
270
|
},
|
|
270
271
|
getComponents: function (key) {
|
|
271
|
-
var lookup = this.
|
|
272
|
+
var lookup = this.N_[key + "[]"];
|
|
272
273
|
return lookup ? Object.keys(lookup).map(function (key) {
|
|
273
274
|
return componentsByDOMNode.get(lookup[key]);
|
|
274
275
|
}).filter(Boolean) : [];
|
|
275
276
|
},
|
|
276
277
|
destroy: function () {
|
|
277
|
-
if (this.
|
|
278
|
+
if (this.L_) {
|
|
278
279
|
return;
|
|
279
280
|
}
|
|
280
281
|
|
|
281
|
-
var root = this.
|
|
282
|
+
var root = this._E_;
|
|
282
283
|
|
|
283
|
-
this.
|
|
284
|
+
this._O_();
|
|
284
285
|
|
|
285
286
|
var nodes = root.nodes;
|
|
286
287
|
|
|
287
288
|
nodes.forEach(function (node) {
|
|
288
289
|
destroyNodeRecursive(node);
|
|
289
290
|
|
|
290
|
-
if (eventDelegation.
|
|
291
|
+
if (eventDelegation.ap_(node) !== false) {
|
|
291
292
|
node.parentNode.removeChild(node);
|
|
292
293
|
}
|
|
293
294
|
});
|
|
@@ -295,129 +296,129 @@ Component.prototype = componentProto = {
|
|
|
295
296
|
root.detached = true;
|
|
296
297
|
|
|
297
298
|
delete componentLookup[this.id];
|
|
298
|
-
this.
|
|
299
|
+
this.N_ = {};
|
|
299
300
|
},
|
|
300
301
|
|
|
301
|
-
|
|
302
|
-
if (this.
|
|
302
|
+
_O_: function () {
|
|
303
|
+
if (this.L_) {
|
|
303
304
|
return;
|
|
304
305
|
}
|
|
305
306
|
|
|
306
|
-
this.
|
|
307
|
-
this.
|
|
307
|
+
this.aq_();
|
|
308
|
+
this.L_ = true;
|
|
308
309
|
|
|
309
|
-
componentsByDOMNode.set(this.
|
|
310
|
+
componentsByDOMNode.set(this._E_, undefined);
|
|
310
311
|
|
|
311
|
-
this.
|
|
312
|
+
this._E_ = null;
|
|
312
313
|
|
|
313
314
|
// Unsubscribe from all DOM events
|
|
314
|
-
this.
|
|
315
|
+
this._v_();
|
|
315
316
|
|
|
316
|
-
var subscriptions = this.
|
|
317
|
+
var subscriptions = this.ak_;
|
|
317
318
|
if (subscriptions) {
|
|
318
319
|
subscriptions.removeAllListeners();
|
|
319
|
-
this.
|
|
320
|
+
this.ak_ = null;
|
|
320
321
|
}
|
|
321
322
|
},
|
|
322
323
|
|
|
323
324
|
isDestroyed: function () {
|
|
324
|
-
return this.
|
|
325
|
+
return this.L_;
|
|
325
326
|
},
|
|
326
327
|
get state() {
|
|
327
|
-
return this.
|
|
328
|
+
return this.C_;
|
|
328
329
|
},
|
|
329
330
|
set state(newState) {
|
|
330
|
-
var state = this.
|
|
331
|
+
var state = this.C_;
|
|
331
332
|
if (!state && !newState) {
|
|
332
333
|
return;
|
|
333
334
|
}
|
|
334
335
|
|
|
335
336
|
if (!state) {
|
|
336
|
-
state = this.
|
|
337
|
+
state = this.C_ = new this.S_(this);
|
|
337
338
|
}
|
|
338
339
|
|
|
339
|
-
state.
|
|
340
|
+
state.ar_(newState || {});
|
|
340
341
|
|
|
341
|
-
if (state.
|
|
342
|
-
this.
|
|
342
|
+
if (state.an_) {
|
|
343
|
+
this.as_();
|
|
343
344
|
}
|
|
344
345
|
|
|
345
346
|
if (!newState) {
|
|
346
|
-
this.
|
|
347
|
+
this.C_ = null;
|
|
347
348
|
}
|
|
348
349
|
},
|
|
349
350
|
setState: function (name, value) {
|
|
350
|
-
var state = this.
|
|
351
|
+
var state = this.C_;
|
|
351
352
|
|
|
352
353
|
if (!state) {
|
|
353
|
-
state = this.
|
|
354
|
+
state = this.C_ = new this.S_(this);
|
|
354
355
|
}
|
|
355
356
|
if (typeof name == "object") {
|
|
356
357
|
// Merge in the new state with the old state
|
|
357
358
|
var newState = name;
|
|
358
359
|
for (var k in newState) {
|
|
359
|
-
if (
|
|
360
|
-
state.
|
|
360
|
+
if (hasOwnProperty.call(newState, k)) {
|
|
361
|
+
state.at_(k, newState[k], true /* ensure:true */);
|
|
361
362
|
}
|
|
362
363
|
}
|
|
363
364
|
} else {
|
|
364
|
-
state.
|
|
365
|
+
state.at_(name, value, true /* ensure:true */);
|
|
365
366
|
}
|
|
366
367
|
},
|
|
367
368
|
|
|
368
369
|
setStateDirty: function (name, value) {
|
|
369
|
-
var state = this.
|
|
370
|
+
var state = this.C_;
|
|
370
371
|
|
|
371
372
|
if (arguments.length == 1) {
|
|
372
373
|
value = state[name];
|
|
373
374
|
}
|
|
374
375
|
|
|
375
|
-
state.
|
|
376
|
+
state.at_(name, value, true /* ensure:true */
|
|
376
377
|
, true /* forceDirty:true */
|
|
377
378
|
);
|
|
378
379
|
},
|
|
379
380
|
|
|
380
381
|
replaceState: function (newState) {
|
|
381
|
-
this.
|
|
382
|
+
this.C_.ar_(newState);
|
|
382
383
|
},
|
|
383
384
|
|
|
384
385
|
get input() {
|
|
385
|
-
return this.
|
|
386
|
+
return this.R_;
|
|
386
387
|
},
|
|
387
388
|
set input(newInput) {
|
|
388
|
-
if (this.
|
|
389
|
-
this.
|
|
389
|
+
if (this.ao_) {
|
|
390
|
+
this.R_ = newInput;
|
|
390
391
|
} else {
|
|
391
|
-
this.
|
|
392
|
+
this._l_(newInput);
|
|
392
393
|
}
|
|
393
394
|
},
|
|
394
395
|
|
|
395
|
-
|
|
396
|
+
_l_: function (newInput, onInput, out) {
|
|
396
397
|
onInput = onInput || this.onInput;
|
|
397
398
|
var updatedInput;
|
|
398
399
|
|
|
399
|
-
var oldInput = this.
|
|
400
|
-
this.
|
|
401
|
-
this.
|
|
400
|
+
var oldInput = this.R_;
|
|
401
|
+
this.R_ = undefined;
|
|
402
|
+
this.au_ = out && out[CONTEXT_KEY] || this.au_;
|
|
402
403
|
|
|
403
404
|
if (onInput) {
|
|
404
405
|
// We need to set a flag to preview `this.input = foo` inside
|
|
405
406
|
// onInput causing infinite recursion
|
|
406
|
-
this.
|
|
407
|
+
this.ao_ = true;
|
|
407
408
|
updatedInput = onInput.call(this, newInput || {}, out);
|
|
408
|
-
this.
|
|
409
|
+
this.ao_ = false;
|
|
409
410
|
}
|
|
410
411
|
|
|
411
|
-
newInput = this.
|
|
412
|
+
newInput = this.al_ = updatedInput || newInput;
|
|
412
413
|
|
|
413
|
-
if (this.
|
|
414
|
-
this.
|
|
414
|
+
if (this.an_ = checkInputChanged(this, oldInput, newInput)) {
|
|
415
|
+
this.as_();
|
|
415
416
|
}
|
|
416
417
|
|
|
417
|
-
if (this.
|
|
418
|
-
this.
|
|
418
|
+
if (this.R_ === undefined) {
|
|
419
|
+
this.R_ = newInput;
|
|
419
420
|
if (newInput && newInput.$global) {
|
|
420
|
-
this.
|
|
421
|
+
this.am_ = newInput.$global;
|
|
421
422
|
}
|
|
422
423
|
}
|
|
423
424
|
|
|
@@ -425,54 +426,54 @@ Component.prototype = componentProto = {
|
|
|
425
426
|
},
|
|
426
427
|
|
|
427
428
|
forceUpdate: function () {
|
|
428
|
-
this.
|
|
429
|
-
this.
|
|
429
|
+
this.an_ = true;
|
|
430
|
+
this.as_();
|
|
430
431
|
},
|
|
431
432
|
|
|
432
|
-
|
|
433
|
-
if (!this.
|
|
434
|
-
this.
|
|
435
|
-
updateManager.
|
|
433
|
+
as_: function () {
|
|
434
|
+
if (!this._c_) {
|
|
435
|
+
this._c_ = true;
|
|
436
|
+
updateManager.av_(this);
|
|
436
437
|
}
|
|
437
438
|
},
|
|
438
439
|
|
|
439
440
|
update: function () {
|
|
440
|
-
if (this.
|
|
441
|
+
if (this.L_ === true || this.aw_ === false) {
|
|
441
442
|
return;
|
|
442
443
|
}
|
|
443
444
|
|
|
444
|
-
var input = this.
|
|
445
|
-
var state = this.
|
|
445
|
+
var input = this.R_;
|
|
446
|
+
var state = this.C_;
|
|
446
447
|
|
|
447
|
-
if (this.
|
|
448
|
-
if (processUpdateHandlers(this, state.
|
|
449
|
-
state.
|
|
448
|
+
if (this.an_ === false && state !== null && state.an_ === true) {
|
|
449
|
+
if (processUpdateHandlers(this, state.ax_, state.ay_, state)) {
|
|
450
|
+
state.an_ = false;
|
|
450
451
|
}
|
|
451
452
|
}
|
|
452
453
|
|
|
453
|
-
if (this.
|
|
454
|
+
if (this.aw_ === true) {
|
|
454
455
|
// The UI component is still dirty after process state handlers
|
|
455
456
|
// then we should rerender
|
|
456
457
|
|
|
457
458
|
if (this.shouldUpdate(input, state) !== false) {
|
|
458
|
-
this.
|
|
459
|
+
this.az_();
|
|
459
460
|
}
|
|
460
461
|
}
|
|
461
462
|
|
|
462
|
-
this.
|
|
463
|
+
this._t_();
|
|
463
464
|
},
|
|
464
465
|
|
|
465
|
-
get
|
|
466
|
-
return this.
|
|
466
|
+
get aw_() {
|
|
467
|
+
return this.an_ === true || this.C_ !== null && this.C_.an_ === true;
|
|
467
468
|
},
|
|
468
469
|
|
|
469
|
-
|
|
470
|
-
this.
|
|
471
|
-
this.
|
|
472
|
-
this.
|
|
473
|
-
var state = this.
|
|
470
|
+
_t_: function () {
|
|
471
|
+
this.an_ = false;
|
|
472
|
+
this._c_ = false;
|
|
473
|
+
this.al_ = null;
|
|
474
|
+
var state = this.C_;
|
|
474
475
|
if (state) {
|
|
475
|
-
state.
|
|
476
|
+
state._t_();
|
|
476
477
|
}
|
|
477
478
|
},
|
|
478
479
|
|
|
@@ -480,72 +481,72 @@ Component.prototype = componentProto = {
|
|
|
480
481
|
return true;
|
|
481
482
|
},
|
|
482
483
|
|
|
483
|
-
|
|
484
|
+
az_: function () {
|
|
484
485
|
var self = this;
|
|
485
|
-
var renderer = self.
|
|
486
|
+
var renderer = self.T_;
|
|
486
487
|
|
|
487
488
|
if (!renderer) {
|
|
488
489
|
throw TypeError();
|
|
489
490
|
}
|
|
490
491
|
|
|
491
|
-
var input = this.
|
|
492
|
+
var input = this.al_ || this.R_;
|
|
492
493
|
|
|
493
|
-
updateManager.
|
|
494
|
-
self.
|
|
494
|
+
updateManager.aA_(function () {
|
|
495
|
+
self._F_(input, false).afterInsert(self.E_);
|
|
495
496
|
});
|
|
496
497
|
|
|
497
|
-
this.
|
|
498
|
+
this._t_();
|
|
498
499
|
},
|
|
499
500
|
|
|
500
|
-
|
|
501
|
-
var
|
|
502
|
-
var globalData = this.
|
|
503
|
-
var rootNode = this.
|
|
504
|
-
var renderer = this.
|
|
501
|
+
_F_: function (input, isHydrate) {
|
|
502
|
+
var host = this.E_;
|
|
503
|
+
var globalData = this.am_;
|
|
504
|
+
var rootNode = this._E_;
|
|
505
|
+
var renderer = this.T_;
|
|
505
506
|
var createOut = renderer.createOut || defaultCreateOut;
|
|
506
507
|
var out = createOut(globalData);
|
|
507
508
|
out.sync();
|
|
508
|
-
out.
|
|
509
|
-
out[CONTEXT_KEY] = this.
|
|
509
|
+
out.E_ = this.E_;
|
|
510
|
+
out[CONTEXT_KEY] = this.au_;
|
|
510
511
|
|
|
511
512
|
var componentsContext = getComponentsContext(out);
|
|
512
|
-
var globalComponentsContext = componentsContext.
|
|
513
|
-
globalComponentsContext.
|
|
514
|
-
globalComponentsContext.
|
|
513
|
+
var globalComponentsContext = componentsContext.r_;
|
|
514
|
+
globalComponentsContext.aB_ = this;
|
|
515
|
+
globalComponentsContext.a__ = isHydrate;
|
|
515
516
|
|
|
516
517
|
renderer(input, out);
|
|
517
518
|
|
|
518
519
|
var result = new RenderResult(out);
|
|
519
520
|
|
|
520
|
-
var targetNode = out.
|
|
521
|
+
var targetNode = out.aj_().a_;
|
|
521
522
|
|
|
522
|
-
morphdom(rootNode, targetNode,
|
|
523
|
+
morphdom(rootNode, targetNode, host, componentsContext);
|
|
523
524
|
|
|
524
525
|
return result;
|
|
525
526
|
},
|
|
526
527
|
|
|
527
|
-
|
|
528
|
-
var root = this.
|
|
528
|
+
aC_: function () {
|
|
529
|
+
var root = this._E_;
|
|
529
530
|
root.remove();
|
|
530
531
|
return root;
|
|
531
532
|
},
|
|
532
533
|
|
|
533
|
-
|
|
534
|
-
var eventListenerHandles = this.
|
|
534
|
+
_v_: function () {
|
|
535
|
+
var eventListenerHandles = this._w_;
|
|
535
536
|
if (eventListenerHandles) {
|
|
536
537
|
eventListenerHandles.forEach(removeListener);
|
|
537
|
-
this.
|
|
538
|
+
this._w_ = null;
|
|
538
539
|
}
|
|
539
540
|
},
|
|
540
541
|
|
|
541
|
-
get
|
|
542
|
-
var state = this.
|
|
543
|
-
return state && state.
|
|
542
|
+
get aD_() {
|
|
543
|
+
var state = this.C_;
|
|
544
|
+
return state && state.D_;
|
|
544
545
|
},
|
|
545
546
|
|
|
546
|
-
|
|
547
|
-
var finalCustomEvents = this.
|
|
548
|
-
this.
|
|
547
|
+
aE_: function (customEvents, scope) {
|
|
548
|
+
var finalCustomEvents = this.X_ = {};
|
|
549
|
+
this.Y_ = scope;
|
|
549
550
|
|
|
550
551
|
customEvents.forEach(function (customEvent) {
|
|
551
552
|
var eventType = customEvent[0];
|
|
@@ -553,51 +554,53 @@ Component.prototype = componentProto = {
|
|
|
553
554
|
var isOnce = customEvent[2];
|
|
554
555
|
var extraArgs = customEvent[3];
|
|
555
556
|
|
|
556
|
-
|
|
557
|
+
if (targetMethodName) {
|
|
558
|
+
finalCustomEvents[eventType] = [targetMethodName, isOnce, extraArgs];
|
|
559
|
+
}
|
|
557
560
|
});
|
|
558
561
|
},
|
|
559
562
|
|
|
560
563
|
get el() {
|
|
561
|
-
return walkFragments(this.
|
|
564
|
+
return walkFragments(this._E_);
|
|
562
565
|
},
|
|
563
566
|
|
|
564
567
|
get els() {
|
|
565
|
-
return (this.
|
|
568
|
+
return (this._E_ ? this._E_.nodes : []).filter(function (el) {
|
|
566
569
|
return el.nodeType === ELEMENT_NODE;
|
|
567
570
|
});
|
|
568
571
|
// eslint-disable-next-line no-constant-condition
|
|
569
572
|
},
|
|
570
573
|
|
|
571
|
-
|
|
572
|
-
|
|
574
|
+
aF_: emit,
|
|
575
|
+
aG_(input, out) {
|
|
573
576
|
this.onCreate && this.onCreate(input, out);
|
|
574
|
-
this.
|
|
577
|
+
this.aF_("create", input, out);
|
|
575
578
|
},
|
|
576
579
|
|
|
577
|
-
|
|
580
|
+
aH_(out) {
|
|
578
581
|
this.onRender && this.onRender(out);
|
|
579
|
-
this.
|
|
582
|
+
this.aF_("render", out);
|
|
580
583
|
},
|
|
581
584
|
|
|
582
|
-
|
|
585
|
+
_y_() {
|
|
583
586
|
this.onUpdate && this.onUpdate();
|
|
584
|
-
this.
|
|
587
|
+
this.aF_("update");
|
|
585
588
|
},
|
|
586
589
|
|
|
587
|
-
|
|
590
|
+
_z_() {
|
|
588
591
|
this.onMount && this.onMount();
|
|
589
|
-
this.
|
|
592
|
+
this.aF_("mount");
|
|
590
593
|
},
|
|
591
594
|
|
|
592
|
-
|
|
595
|
+
aq_() {
|
|
593
596
|
this.onDestroy && this.onDestroy();
|
|
594
|
-
this.
|
|
597
|
+
this.aF_("destroy");
|
|
595
598
|
}
|
|
596
599
|
};
|
|
597
600
|
|
|
598
601
|
componentProto.elId = componentProto.getElId;
|
|
599
|
-
componentProto.
|
|
600
|
-
componentProto.
|
|
602
|
+
componentProto.aI_ = componentProto.update;
|
|
603
|
+
componentProto.aJ_ = componentProto.destroy;
|
|
601
604
|
|
|
602
605
|
// Add all of the following DOM methods to Component.prototype:
|
|
603
606
|
// - appendTo(referenceEl)
|
|
@@ -607,7 +610,7 @@ componentProto._G_ = componentProto.destroy;
|
|
|
607
610
|
// - insertAfter(referenceEl)
|
|
608
611
|
// - prependTo(referenceEl)
|
|
609
612
|
domInsert(componentProto, function getEl(component) {
|
|
610
|
-
return component.
|
|
613
|
+
return component.aC_();
|
|
611
614
|
}, function afterInsert(component) {
|
|
612
615
|
return component;
|
|
613
616
|
});
|