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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const INIT_COMPONENTS_KEY = Symbol();
|
|
4
|
+
|
|
5
|
+
const addComponentsFromContext =
|
|
6
|
+
require("@internal/components-entry").___addComponentsFromContext;
|
|
7
|
+
const getInitComponentsCode =
|
|
8
|
+
require("@internal/components-entry").___getInitComponentsCode;
|
|
9
|
+
|
|
10
|
+
function addComponentsFromOut(source, target) {
|
|
11
|
+
const sourceOut = source.out || source;
|
|
12
|
+
const targetOut = target || sourceOut;
|
|
13
|
+
const componentsContext = sourceOut.___components;
|
|
14
|
+
const componentDefs = targetOut.writer.get("componentDefs");
|
|
15
|
+
addComponentsFromContext(componentsContext, componentDefs);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function addInitScript(writer) {
|
|
19
|
+
const out = writer.state.root;
|
|
20
|
+
const componentDefs = writer.get("componentDefs");
|
|
21
|
+
writer.script(getInitComponentsCode(out, componentDefs));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = function render(input, out) {
|
|
25
|
+
const $global = out.global;
|
|
26
|
+
if ($global[INIT_COMPONENTS_KEY] === undefined) {
|
|
27
|
+
$global[INIT_COMPONENTS_KEY] = true;
|
|
28
|
+
|
|
29
|
+
out.on("await:finish", addComponentsFromOut);
|
|
30
|
+
out.on("___toString", addInitScript);
|
|
31
|
+
|
|
32
|
+
if (out.isSync() === true) {
|
|
33
|
+
// Generate initialization code for any of the UI components that were
|
|
34
|
+
// rendered synchronously
|
|
35
|
+
addComponentsFromOut(out);
|
|
36
|
+
} else {
|
|
37
|
+
// Generate initialization code for any of the UI components that were
|
|
38
|
+
// rendered asynchronously, but were outside an `<await>` tag
|
|
39
|
+
// (each `<await>` tag will have its own component initialization block)
|
|
40
|
+
const asyncOut = out.beginAsync({ last: true, timeout: -1 });
|
|
41
|
+
out.onLast(function (next) {
|
|
42
|
+
// Ensure we're getting init code starting from the root
|
|
43
|
+
let rootOut = out;
|
|
44
|
+
while (rootOut._parentOut) {
|
|
45
|
+
rootOut = rootOut._parentOut;
|
|
46
|
+
}
|
|
47
|
+
// Write out all of the component init code from the main out
|
|
48
|
+
addComponentsFromOut(rootOut, asyncOut);
|
|
49
|
+
asyncOut.end();
|
|
50
|
+
next();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var nodePath = require("path");
|
|
4
4
|
var fs = require("fs");
|
|
5
5
|
var Module = require("module").Module;
|
|
6
|
-
var compilerPath = nodePath.join(__dirname, "
|
|
6
|
+
var compilerPath = nodePath.join(__dirname, "../../../compiler");
|
|
7
7
|
var markoCompiler = require(compilerPath);
|
|
8
8
|
var cwd = process.cwd();
|
|
9
9
|
var fsOptions = { encoding: "utf8" };
|
|
@@ -137,7 +137,7 @@ function getPreviousTemplate(templatePath, options) {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
function createRenderProxy(template) {
|
|
140
|
-
return function(data, out) {
|
|
140
|
+
return function (data, out) {
|
|
141
141
|
template._(data, out);
|
|
142
142
|
};
|
|
143
143
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var ComponentsContext = require("../../../runtime/components/ComponentsContext");
|
|
2
|
+
var getComponentsContext = ComponentsContext.___getComponentsContext;
|
|
3
|
+
|
|
4
|
+
module.exports = function render(input, out) {
|
|
5
|
+
var shouldPreserve = Boolean(!("i" in input) || input.i);
|
|
6
|
+
var isComponent = !input.n;
|
|
7
|
+
|
|
8
|
+
if (isComponent) {
|
|
9
|
+
out.bf(out.___assignedKey, out.___assignedComponentDef.___component, true);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (input.renderBody) {
|
|
13
|
+
if (shouldPreserve) {
|
|
14
|
+
var componentsContext = getComponentsContext(out);
|
|
15
|
+
var parentPreserved = componentsContext.___isPreserved;
|
|
16
|
+
componentsContext.___isPreserved = true;
|
|
17
|
+
input.renderBody(out);
|
|
18
|
+
componentsContext.___isPreserved = parentPreserved;
|
|
19
|
+
} else {
|
|
20
|
+
input.renderBody(out);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (isComponent) {
|
|
25
|
+
out.ef();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var queue = [];
|
|
2
|
+
var msg = "" + Math.random();
|
|
3
|
+
window.addEventListener("message", function (ev) {
|
|
4
|
+
if (ev.data === msg) {
|
|
5
|
+
var callbacks = queue;
|
|
6
|
+
queue = [];
|
|
7
|
+
for (var i = 0; i < callbacks.length; i++) {
|
|
8
|
+
callbacks[i]();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
exports.___setImmediate = function (callback) {
|
|
14
|
+
if (queue.push(callback) === 1) {
|
|
15
|
+
window.postMessage(msg, "*");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
var domInsert = require("./dom-insert");
|
|
2
2
|
var complain = "MARKO_DEBUG" && require("complain");
|
|
3
3
|
|
|
4
|
+
function getRootNode(el) {
|
|
5
|
+
var cur = el;
|
|
6
|
+
while (cur.parentNode) cur = cur.parentNode;
|
|
7
|
+
return cur;
|
|
8
|
+
}
|
|
9
|
+
|
|
4
10
|
function getComponentDefs(result) {
|
|
5
11
|
var componentDefs = result.___components;
|
|
6
12
|
|
|
@@ -18,10 +24,10 @@ function RenderResult(out) {
|
|
|
18
24
|
module.exports = RenderResult;
|
|
19
25
|
|
|
20
26
|
var proto = (RenderResult.prototype = {
|
|
21
|
-
getComponent: function() {
|
|
27
|
+
getComponent: function () {
|
|
22
28
|
return this.getComponents()[0];
|
|
23
29
|
},
|
|
24
|
-
getComponents: function(selector) {
|
|
30
|
+
getComponents: function (selector) {
|
|
25
31
|
if (this.___components === undefined) {
|
|
26
32
|
throw Error("Not added to DOM");
|
|
27
33
|
}
|
|
@@ -30,7 +36,7 @@ var proto = (RenderResult.prototype = {
|
|
|
30
36
|
|
|
31
37
|
var components = [];
|
|
32
38
|
|
|
33
|
-
componentDefs.forEach(function(componentDef) {
|
|
39
|
+
componentDefs.forEach(function (componentDef) {
|
|
34
40
|
var component = componentDef.___component;
|
|
35
41
|
if (!selector || selector(component)) {
|
|
36
42
|
components.push(component);
|
|
@@ -40,31 +46,31 @@ var proto = (RenderResult.prototype = {
|
|
|
40
46
|
return components;
|
|
41
47
|
},
|
|
42
48
|
|
|
43
|
-
afterInsert: function(
|
|
49
|
+
afterInsert: function (host) {
|
|
44
50
|
var out = this.___out;
|
|
45
51
|
var componentsContext = out.___components;
|
|
46
52
|
if (componentsContext) {
|
|
47
|
-
this.___components = componentsContext.___initComponents(
|
|
53
|
+
this.___components = componentsContext.___initComponents(host);
|
|
48
54
|
} else {
|
|
49
55
|
this.___components = null;
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
return this;
|
|
53
59
|
},
|
|
54
|
-
getNode: function(
|
|
55
|
-
return this.___out.___getNode(
|
|
60
|
+
getNode: function (host) {
|
|
61
|
+
return this.___out.___getNode(host);
|
|
56
62
|
},
|
|
57
|
-
getOutput: function() {
|
|
63
|
+
getOutput: function () {
|
|
58
64
|
return this.___out.___getOutput();
|
|
59
65
|
},
|
|
60
|
-
toString: function() {
|
|
66
|
+
toString: function () {
|
|
61
67
|
return this.___out.toString();
|
|
62
68
|
},
|
|
63
|
-
document: typeof document
|
|
69
|
+
document: typeof document === "object" && document
|
|
64
70
|
});
|
|
65
71
|
|
|
66
72
|
Object.defineProperty(proto, "html", {
|
|
67
|
-
get: function() {
|
|
73
|
+
get: function () {
|
|
68
74
|
// eslint-disable-next-line no-constant-condition
|
|
69
75
|
if ("MARKO_DEBUG") {
|
|
70
76
|
complain(
|
|
@@ -76,7 +82,7 @@ Object.defineProperty(proto, "html", {
|
|
|
76
82
|
});
|
|
77
83
|
|
|
78
84
|
Object.defineProperty(proto, "context", {
|
|
79
|
-
get: function() {
|
|
85
|
+
get: function () {
|
|
80
86
|
// eslint-disable-next-line no-constant-condition
|
|
81
87
|
if ("MARKO_DEBUG") {
|
|
82
88
|
complain(
|
|
@@ -97,13 +103,9 @@ Object.defineProperty(proto, "context", {
|
|
|
97
103
|
domInsert(
|
|
98
104
|
proto,
|
|
99
105
|
function getEl(renderResult, referenceEl) {
|
|
100
|
-
return renderResult.getNode(referenceEl
|
|
106
|
+
return renderResult.getNode(getRootNode(referenceEl));
|
|
101
107
|
},
|
|
102
108
|
function afterInsert(renderResult, referenceEl) {
|
|
103
|
-
|
|
104
|
-
typeof ShadowRoot === "function" && referenceEl instanceof ShadowRoot;
|
|
105
|
-
return renderResult.afterInsert(
|
|
106
|
-
isShadow ? referenceEl : referenceEl.ownerDocument
|
|
107
|
-
);
|
|
109
|
+
return renderResult.afterInsert(getRootNode(referenceEl));
|
|
108
110
|
}
|
|
109
111
|
);
|
|
@@ -5,9 +5,9 @@ var complain = "MARKO_DEBUG" && require("complain");
|
|
|
5
5
|
|
|
6
6
|
var domInsert = require("../dom-insert");
|
|
7
7
|
var defaultCreateOut = require("../createOut");
|
|
8
|
-
var getComponentsContext =
|
|
9
|
-
.___getComponentsContext;
|
|
10
|
-
var componentsUtil = require("
|
|
8
|
+
var getComponentsContext =
|
|
9
|
+
require("./ComponentsContext").___getComponentsContext;
|
|
10
|
+
var componentsUtil = require("@internal/components-util");
|
|
11
11
|
var componentLookup = componentsUtil.___componentLookup;
|
|
12
12
|
var destroyNodeRecursive = componentsUtil.___destroyNodeRecursive;
|
|
13
13
|
var EventEmitter = require("events-light");
|
|
@@ -22,6 +22,7 @@ var componentsByDOMNode = domData.___componentByDOMNode;
|
|
|
22
22
|
var keyedElementsByComponentId = domData.___ssrKeyedElementsByComponentId;
|
|
23
23
|
var CONTEXT_KEY = "__subtree_context__";
|
|
24
24
|
|
|
25
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
25
26
|
var slice = Array.prototype.slice;
|
|
26
27
|
|
|
27
28
|
var COMPONENT_SUBSCRIBE_TO_OPTIONS;
|
|
@@ -97,7 +98,7 @@ function processUpdateHandlers(component, stateChanges, oldState) {
|
|
|
97
98
|
var handlers;
|
|
98
99
|
|
|
99
100
|
for (var propName in stateChanges) {
|
|
100
|
-
if (
|
|
101
|
+
if (hasOwnProperty.call(stateChanges, propName)) {
|
|
101
102
|
var handlerMethodName = "update_" + propName;
|
|
102
103
|
|
|
103
104
|
handlerMethod = component[handlerMethodName];
|
|
@@ -118,7 +119,7 @@ function processUpdateHandlers(component, stateChanges, oldState) {
|
|
|
118
119
|
// Otherwise, there are handlers for all of the changed properties
|
|
119
120
|
// so apply the updates using those handlers
|
|
120
121
|
|
|
121
|
-
handlers.forEach(function(handler) {
|
|
122
|
+
handlers.forEach(function (handler) {
|
|
122
123
|
var propertyName = handler[0];
|
|
123
124
|
handlerMethod = handler[1];
|
|
124
125
|
|
|
@@ -183,7 +184,7 @@ function Component(id) {
|
|
|
183
184
|
this.___updateQueued = false;
|
|
184
185
|
this.___dirty = false;
|
|
185
186
|
this.___settingInput = false;
|
|
186
|
-
this.
|
|
187
|
+
this.___host = undefined;
|
|
187
188
|
|
|
188
189
|
var ssrKeyedElements = keyedElementsByComponentId[id];
|
|
189
190
|
|
|
@@ -198,7 +199,7 @@ function Component(id) {
|
|
|
198
199
|
Component.prototype = componentProto = {
|
|
199
200
|
___isComponent: true,
|
|
200
201
|
|
|
201
|
-
subscribeTo: function(target) {
|
|
202
|
+
subscribeTo: function (target) {
|
|
202
203
|
if (!target) {
|
|
203
204
|
throw TypeError();
|
|
204
205
|
}
|
|
@@ -214,7 +215,7 @@ Component.prototype = componentProto = {
|
|
|
214
215
|
return subscriptions.subscribeTo(target, subscribeToOptions);
|
|
215
216
|
},
|
|
216
217
|
|
|
217
|
-
emit: function(eventType) {
|
|
218
|
+
emit: function (eventType) {
|
|
218
219
|
var customEvents = this.___customEvents;
|
|
219
220
|
var target;
|
|
220
221
|
|
|
@@ -238,13 +239,13 @@ Component.prototype = componentProto = {
|
|
|
238
239
|
|
|
239
240
|
return emit.apply(this, arguments);
|
|
240
241
|
},
|
|
241
|
-
getElId: function(key, index) {
|
|
242
|
+
getElId: function (key, index) {
|
|
242
243
|
if (!key) {
|
|
243
244
|
return this.id;
|
|
244
245
|
}
|
|
245
246
|
return resolveComponentIdHelper(this, key, index);
|
|
246
247
|
},
|
|
247
|
-
getEl: function(key, index) {
|
|
248
|
+
getEl: function (key, index) {
|
|
248
249
|
if (key) {
|
|
249
250
|
var resolvedKey = resolveKeyHelper(key, index);
|
|
250
251
|
var keyedElement = this.___keyedElements["@" + resolvedKey];
|
|
@@ -271,7 +272,7 @@ Component.prototype = componentProto = {
|
|
|
271
272
|
return this.el;
|
|
272
273
|
}
|
|
273
274
|
},
|
|
274
|
-
getEls: function(key) {
|
|
275
|
+
getEls: function (key) {
|
|
275
276
|
key = key + "[]";
|
|
276
277
|
|
|
277
278
|
var els = [];
|
|
@@ -283,7 +284,7 @@ Component.prototype = componentProto = {
|
|
|
283
284
|
}
|
|
284
285
|
return els;
|
|
285
286
|
},
|
|
286
|
-
getComponent: function(key, index) {
|
|
287
|
+
getComponent: function (key, index) {
|
|
287
288
|
var rootNode = this.___keyedElements[resolveKeyHelper(key, index)];
|
|
288
289
|
if (/\[\]$/.test(key)) {
|
|
289
290
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -296,17 +297,17 @@ Component.prototype = componentProto = {
|
|
|
296
297
|
}
|
|
297
298
|
return rootNode && componentsByDOMNode.get(rootNode);
|
|
298
299
|
},
|
|
299
|
-
getComponents: function(key) {
|
|
300
|
+
getComponents: function (key) {
|
|
300
301
|
var lookup = this.___keyedElements[key + "[]"];
|
|
301
302
|
return lookup
|
|
302
303
|
? Object.keys(lookup)
|
|
303
|
-
.map(function(key) {
|
|
304
|
+
.map(function (key) {
|
|
304
305
|
return componentsByDOMNode.get(lookup[key]);
|
|
305
306
|
})
|
|
306
307
|
.filter(Boolean)
|
|
307
308
|
: [];
|
|
308
309
|
},
|
|
309
|
-
destroy: function() {
|
|
310
|
+
destroy: function () {
|
|
310
311
|
if (this.___destroyed) {
|
|
311
312
|
return;
|
|
312
313
|
}
|
|
@@ -317,7 +318,7 @@ Component.prototype = componentProto = {
|
|
|
317
318
|
|
|
318
319
|
var nodes = root.nodes;
|
|
319
320
|
|
|
320
|
-
nodes.forEach(function(node) {
|
|
321
|
+
nodes.forEach(function (node) {
|
|
321
322
|
destroyNodeRecursive(node);
|
|
322
323
|
|
|
323
324
|
if (eventDelegation.___handleNodeDetach(node) !== false) {
|
|
@@ -331,7 +332,7 @@ Component.prototype = componentProto = {
|
|
|
331
332
|
this.___keyedElements = {};
|
|
332
333
|
},
|
|
333
334
|
|
|
334
|
-
___destroyShallow: function() {
|
|
335
|
+
___destroyShallow: function () {
|
|
335
336
|
if (this.___destroyed) {
|
|
336
337
|
return;
|
|
337
338
|
}
|
|
@@ -353,7 +354,7 @@ Component.prototype = componentProto = {
|
|
|
353
354
|
}
|
|
354
355
|
},
|
|
355
356
|
|
|
356
|
-
isDestroyed: function() {
|
|
357
|
+
isDestroyed: function () {
|
|
357
358
|
return this.___destroyed;
|
|
358
359
|
},
|
|
359
360
|
get state() {
|
|
@@ -379,7 +380,7 @@ Component.prototype = componentProto = {
|
|
|
379
380
|
this.___state = null;
|
|
380
381
|
}
|
|
381
382
|
},
|
|
382
|
-
setState: function(name, value) {
|
|
383
|
+
setState: function (name, value) {
|
|
383
384
|
var state = this.___state;
|
|
384
385
|
|
|
385
386
|
if (!state) {
|
|
@@ -389,7 +390,7 @@ Component.prototype = componentProto = {
|
|
|
389
390
|
// Merge in the new state with the old state
|
|
390
391
|
var newState = name;
|
|
391
392
|
for (var k in newState) {
|
|
392
|
-
if (
|
|
393
|
+
if (hasOwnProperty.call(newState, k)) {
|
|
393
394
|
state.___set(k, newState[k], true /* ensure:true */);
|
|
394
395
|
}
|
|
395
396
|
}
|
|
@@ -398,7 +399,7 @@ Component.prototype = componentProto = {
|
|
|
398
399
|
}
|
|
399
400
|
},
|
|
400
401
|
|
|
401
|
-
setStateDirty: function(name, value) {
|
|
402
|
+
setStateDirty: function (name, value) {
|
|
402
403
|
var state = this.___state;
|
|
403
404
|
|
|
404
405
|
if (arguments.length == 1) {
|
|
@@ -413,7 +414,7 @@ Component.prototype = componentProto = {
|
|
|
413
414
|
);
|
|
414
415
|
},
|
|
415
416
|
|
|
416
|
-
replaceState: function(newState) {
|
|
417
|
+
replaceState: function (newState) {
|
|
417
418
|
this.___state.___replace(newState);
|
|
418
419
|
},
|
|
419
420
|
|
|
@@ -428,7 +429,7 @@ Component.prototype = componentProto = {
|
|
|
428
429
|
}
|
|
429
430
|
},
|
|
430
431
|
|
|
431
|
-
___setInput: function(newInput, onInput, out) {
|
|
432
|
+
___setInput: function (newInput, onInput, out) {
|
|
432
433
|
onInput = onInput || this.onInput;
|
|
433
434
|
var updatedInput;
|
|
434
435
|
|
|
@@ -460,19 +461,19 @@ Component.prototype = componentProto = {
|
|
|
460
461
|
return newInput;
|
|
461
462
|
},
|
|
462
463
|
|
|
463
|
-
forceUpdate: function() {
|
|
464
|
+
forceUpdate: function () {
|
|
464
465
|
this.___dirty = true;
|
|
465
466
|
this.___queueUpdate();
|
|
466
467
|
},
|
|
467
468
|
|
|
468
|
-
___queueUpdate: function() {
|
|
469
|
+
___queueUpdate: function () {
|
|
469
470
|
if (!this.___updateQueued) {
|
|
470
471
|
this.___updateQueued = true;
|
|
471
472
|
updateManager.___queueComponentUpdate(this);
|
|
472
473
|
}
|
|
473
474
|
},
|
|
474
475
|
|
|
475
|
-
update: function() {
|
|
476
|
+
update: function () {
|
|
476
477
|
if (this.___destroyed === true || this.___isDirty === false) {
|
|
477
478
|
return;
|
|
478
479
|
}
|
|
@@ -505,7 +506,7 @@ Component.prototype = componentProto = {
|
|
|
505
506
|
);
|
|
506
507
|
},
|
|
507
508
|
|
|
508
|
-
___reset: function() {
|
|
509
|
+
___reset: function () {
|
|
509
510
|
this.___dirty = false;
|
|
510
511
|
this.___updateQueued = false;
|
|
511
512
|
this.___renderInput = null;
|
|
@@ -515,11 +516,11 @@ Component.prototype = componentProto = {
|
|
|
515
516
|
}
|
|
516
517
|
},
|
|
517
518
|
|
|
518
|
-
shouldUpdate: function() {
|
|
519
|
+
shouldUpdate: function () {
|
|
519
520
|
return true;
|
|
520
521
|
},
|
|
521
522
|
|
|
522
|
-
___scheduleRerender: function() {
|
|
523
|
+
___scheduleRerender: function () {
|
|
523
524
|
var self = this;
|
|
524
525
|
var renderer = self.___renderer;
|
|
525
526
|
|
|
@@ -529,22 +530,22 @@ Component.prototype = componentProto = {
|
|
|
529
530
|
|
|
530
531
|
var input = this.___renderInput || this.___input;
|
|
531
532
|
|
|
532
|
-
updateManager.___batchUpdate(function() {
|
|
533
|
-
self.___rerender(input, false).afterInsert(self.
|
|
533
|
+
updateManager.___batchUpdate(function () {
|
|
534
|
+
self.___rerender(input, false).afterInsert(self.___host);
|
|
534
535
|
});
|
|
535
536
|
|
|
536
537
|
this.___reset();
|
|
537
538
|
},
|
|
538
539
|
|
|
539
|
-
___rerender: function(input, isHydrate) {
|
|
540
|
-
var
|
|
540
|
+
___rerender: function (input, isHydrate) {
|
|
541
|
+
var host = this.___host;
|
|
541
542
|
var globalData = this.___global;
|
|
542
543
|
var rootNode = this.___rootNode;
|
|
543
544
|
var renderer = this.___renderer;
|
|
544
545
|
var createOut = renderer.createOut || defaultCreateOut;
|
|
545
546
|
var out = createOut(globalData);
|
|
546
547
|
out.sync();
|
|
547
|
-
out.
|
|
548
|
+
out.___host = this.___host;
|
|
548
549
|
out[CONTEXT_KEY] = this.___context;
|
|
549
550
|
|
|
550
551
|
var componentsContext = getComponentsContext(out);
|
|
@@ -558,18 +559,18 @@ Component.prototype = componentProto = {
|
|
|
558
559
|
|
|
559
560
|
var targetNode = out.___getOutput().___firstChild;
|
|
560
561
|
|
|
561
|
-
morphdom(rootNode, targetNode,
|
|
562
|
+
morphdom(rootNode, targetNode, host, componentsContext);
|
|
562
563
|
|
|
563
564
|
return result;
|
|
564
565
|
},
|
|
565
566
|
|
|
566
|
-
___detach: function() {
|
|
567
|
+
___detach: function () {
|
|
567
568
|
var root = this.___rootNode;
|
|
568
569
|
root.remove();
|
|
569
570
|
return root;
|
|
570
571
|
},
|
|
571
572
|
|
|
572
|
-
___removeDOMEventListeners: function() {
|
|
573
|
+
___removeDOMEventListeners: function () {
|
|
573
574
|
var eventListenerHandles = this.___domEventListenerHandles;
|
|
574
575
|
if (eventListenerHandles) {
|
|
575
576
|
eventListenerHandles.forEach(removeListener);
|
|
@@ -582,17 +583,19 @@ Component.prototype = componentProto = {
|
|
|
582
583
|
return state && state.___raw;
|
|
583
584
|
},
|
|
584
585
|
|
|
585
|
-
___setCustomEvents: function(customEvents, scope) {
|
|
586
|
+
___setCustomEvents: function (customEvents, scope) {
|
|
586
587
|
var finalCustomEvents = (this.___customEvents = {});
|
|
587
588
|
this.___scope = scope;
|
|
588
589
|
|
|
589
|
-
customEvents.forEach(function(customEvent) {
|
|
590
|
+
customEvents.forEach(function (customEvent) {
|
|
590
591
|
var eventType = customEvent[0];
|
|
591
592
|
var targetMethodName = customEvent[1];
|
|
592
593
|
var isOnce = customEvent[2];
|
|
593
594
|
var extraArgs = customEvent[3];
|
|
594
595
|
|
|
595
|
-
|
|
596
|
+
if (targetMethodName) {
|
|
597
|
+
finalCustomEvents[eventType] = [targetMethodName, isOnce, extraArgs];
|
|
598
|
+
}
|
|
596
599
|
});
|
|
597
600
|
},
|
|
598
601
|
|
|
@@ -607,7 +610,7 @@ Component.prototype = componentProto = {
|
|
|
607
610
|
'The "this.els" attribute is deprecated. Please use "this.getEls(key)" instead.'
|
|
608
611
|
);
|
|
609
612
|
}
|
|
610
|
-
return (this.___rootNode ? this.___rootNode.nodes : []).filter(function(
|
|
613
|
+
return (this.___rootNode ? this.___rootNode.nodes : []).filter(function (
|
|
611
614
|
el
|
|
612
615
|
) {
|
|
613
616
|
return el.nodeType === ELEMENT_NODE;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var complain = "MARKO_DEBUG" && require("complain");
|
|
3
3
|
var w10Noop = require("warp10/constants").NOOP;
|
|
4
|
-
var componentUtil = require("
|
|
4
|
+
var componentUtil = require("@internal/components-util");
|
|
5
5
|
var attachBubblingEvent = componentUtil.___attachBubblingEvent;
|
|
6
|
-
var addDelegatedEventHandler =
|
|
7
|
-
.___addDelegatedEventHandler;
|
|
6
|
+
var addDelegatedEventHandler =
|
|
7
|
+
require("./event-delegation").___addDelegatedEventHandler;
|
|
8
8
|
var extend = require("raptor-util/extend");
|
|
9
9
|
var KeySequence = require("./KeySequence");
|
|
10
10
|
var EMPTY_OBJECT = {};
|
|
@@ -36,7 +36,7 @@ function ComponentDef(component, componentId, componentsContext) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
ComponentDef.prototype = {
|
|
39
|
-
___nextKey: function(key) {
|
|
39
|
+
___nextKey: function (key) {
|
|
40
40
|
return (
|
|
41
41
|
this.___keySequence || (this.___keySequence = new KeySequence())
|
|
42
42
|
).___nextKey(key);
|
|
@@ -46,7 +46,7 @@ ComponentDef.prototype = {
|
|
|
46
46
|
* This helper method generates a unique and fully qualified DOM element ID
|
|
47
47
|
* that is unique within the scope of the current component.
|
|
48
48
|
*/
|
|
49
|
-
elId: function(nestedId) {
|
|
49
|
+
elId: function (nestedId) {
|
|
50
50
|
var id = this.id;
|
|
51
51
|
|
|
52
52
|
if (nestedId == null) {
|
|
@@ -72,11 +72,11 @@ ComponentDef.prototype = {
|
|
|
72
72
|
/**
|
|
73
73
|
* Returns the next auto generated unique ID for a nested DOM element or nested DOM component
|
|
74
74
|
*/
|
|
75
|
-
___nextComponentId: function() {
|
|
75
|
+
___nextComponentId: function () {
|
|
76
76
|
return this.id + "-c" + this.___nextIdIndex++;
|
|
77
77
|
},
|
|
78
78
|
|
|
79
|
-
d: function(eventName, handlerMethodName, isOnce, extraArgs) {
|
|
79
|
+
d: function (eventName, handlerMethodName, isOnce, extraArgs) {
|
|
80
80
|
addDelegatedEventHandler(eventName);
|
|
81
81
|
return attachBubblingEvent(this, handlerMethodName, isOnce, extraArgs);
|
|
82
82
|
},
|
|
@@ -88,7 +88,7 @@ ComponentDef.prototype = {
|
|
|
88
88
|
|
|
89
89
|
ComponentDef.prototype.nk = ComponentDef.prototype.___nextKey;
|
|
90
90
|
|
|
91
|
-
ComponentDef.___deserialize = function(o, types, global, registry) {
|
|
91
|
+
ComponentDef.___deserialize = function (o, types, global, registry) {
|
|
92
92
|
var id = o[0];
|
|
93
93
|
var typeName = types[o[1]];
|
|
94
94
|
var input = o[2] || null;
|
|
@@ -130,7 +130,7 @@ ComponentDef.___deserialize = function(o, types, global, registry) {
|
|
|
130
130
|
if (state) {
|
|
131
131
|
var undefinedPropNames = extra.u;
|
|
132
132
|
if (undefinedPropNames) {
|
|
133
|
-
undefinedPropNames.forEach(function(undefinedPropName) {
|
|
133
|
+
undefinedPropNames.forEach(function (undefinedPropName) {
|
|
134
134
|
state[undefinedPropName] = undefined;
|
|
135
135
|
});
|
|
136
136
|
}
|
|
@@ -20,9 +20,8 @@ function ComponentsContext(out, parentComponentsContext) {
|
|
|
20
20
|
} else {
|
|
21
21
|
globalComponentsContext = out.global.___components;
|
|
22
22
|
if (globalComponentsContext === undefined) {
|
|
23
|
-
out.global.___components = globalComponentsContext =
|
|
24
|
-
out
|
|
25
|
-
);
|
|
23
|
+
out.global.___components = globalComponentsContext =
|
|
24
|
+
new GlobalComponentsContext(out);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
|
|
@@ -36,10 +35,10 @@ function ComponentsContext(out, parentComponentsContext) {
|
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
ComponentsContext.prototype = {
|
|
39
|
-
___initComponents: function(
|
|
38
|
+
___initComponents: function (host) {
|
|
40
39
|
var componentDefs = this.___components;
|
|
41
40
|
|
|
42
|
-
ComponentsContext.___initClientRendered(componentDefs,
|
|
41
|
+
ComponentsContext.___initClientRendered(componentDefs, host);
|
|
43
42
|
|
|
44
43
|
this.___out.emit("___componentsInitialized");
|
|
45
44
|
|