marko 5.36.5 → 5.37.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/dist/compiler/index.js +11 -11
- package/dist/core-tags/components/init-components-tag.js +4 -4
- package/dist/core-tags/components/preferred-script-location-tag.js +2 -2
- package/dist/core-tags/core/__flush_here_and_after__.js +1 -1
- package/dist/core-tags/core/await/AsyncValue.js +21 -21
- package/dist/core-tags/core/await/renderer.js +24 -24
- package/dist/core-tags/core/await/reorderer-renderer.js +6 -6
- package/dist/node-require/browser-refresh.js +18 -1
- package/dist/node-require/index.js +7 -7
- package/dist/node_modules/@internal/components-beginComponent/index-browser.js +5 -5
- package/dist/node_modules/@internal/components-beginComponent/index.js +12 -12
- package/dist/node_modules/@internal/components-define-widget-legacy/index-browser.js +99 -99
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +3 -3
- package/dist/node_modules/@internal/components-endComponent/index.js +3 -3
- package/dist/node_modules/@internal/components-entry/index-browser.js +2 -2
- package/dist/node_modules/@internal/components-entry/index.js +29 -29
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +13 -13
- package/dist/node_modules/@internal/components-entry-legacy/index.js +1 -1
- package/dist/node_modules/@internal/components-registry/index-browser.js +102 -102
- package/dist/node_modules/@internal/components-registry/index.js +2 -2
- package/dist/node_modules/@internal/components-util/index-browser.js +20 -20
- package/dist/node_modules/@internal/components-util/index.js +24 -20
- package/dist/node_modules/@internal/create-readable/index-browser.js +1 -1
- package/dist/node_modules/@internal/create-readable/index.js +9 -9
- package/dist/node_modules/@internal/preserve-tag/index-browser.js +8 -8
- package/dist/node_modules/@internal/preserve-tag/index.js +6 -6
- package/dist/node_modules/@internal/set-immediate/index-browser.js +2 -2
- package/dist/node_modules/@internal/set-immediate/index-worker.js +3 -3
- package/dist/node_modules/@internal/set-immediate/index.js +3 -3
- package/dist/runtime/RenderResult.js +24 -24
- package/dist/runtime/components/Component.js +163 -163
- package/dist/runtime/components/ComponentDef.js +34 -34
- package/dist/runtime/components/ComponentsContext.js +20 -20
- package/dist/runtime/components/GlobalComponentsContext.js +4 -4
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +17 -17
- package/dist/runtime/components/State.js +28 -28
- package/dist/runtime/components/attach-detach.js +8 -8
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +6 -6
- package/dist/runtime/components/event-delegation.js +10 -10
- package/dist/runtime/components/legacy/defineComponent-legacy.js +1 -1
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +25 -25
- package/dist/runtime/components/legacy/dependencies/index.js +10 -10
- package/dist/runtime/components/legacy/renderer-legacy.js +56 -56
- package/dist/runtime/components/renderer.js +45 -45
- package/dist/runtime/components/update-manager.js +4 -4
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +5 -5
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/dynamic-tag.js +33 -33
- package/dist/runtime/helpers/render-tag.js +1 -1
- package/dist/runtime/helpers/serialize-noop.js +2 -2
- package/dist/runtime/helpers/style-value.js +1 -1
- package/dist/runtime/helpers/tags-compat/runtime-dom.js +35 -35
- package/dist/runtime/helpers/tags-compat/runtime-html.js +16 -16
- package/dist/runtime/html/AsyncStream.js +28 -28
- package/dist/runtime/html/BufferedWriter.js +2 -2
- package/dist/runtime/html/StringWriter.js +2 -2
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +11 -11
- package/dist/runtime/html/helpers/attrs.js +6 -6
- package/dist/runtime/html/helpers/data-marko.js +6 -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/merge-attrs.js +11 -11
- package/dist/runtime/html/helpers/props-script.js +1 -1
- package/dist/runtime/html/index.js +2 -2
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +100 -100
- 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 +52 -52
- package/dist/runtime/vdom/VFragment.js +9 -9
- package/dist/runtime/vdom/VNode.js +34 -34
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/attrs.js +6 -6
- package/dist/runtime/vdom/helpers/const-element.js +3 -3
- package/dist/runtime/vdom/hot-reload.js +20 -20
- package/dist/runtime/vdom/index.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +10 -10
- package/dist/runtime/vdom/morphdom/helpers.js +5 -5
- package/dist/runtime/vdom/morphdom/index.js +81 -81
- package/dist/runtime/vdom/vdom.js +15 -15
- package/dist/taglib/index.js +7 -7
- package/dist/translator/cdata/index.js +15 -0
- package/dist/translator/cdata/index[html].js +15 -0
- package/dist/translator/cdata/index[vdom].js +12 -0
- package/dist/translator/class.js +65 -0
- package/dist/translator/comment/index.js +15 -0
- package/dist/translator/comment/index[html].js +17 -0
- package/dist/translator/comment/index[vdom].js +3 -0
- package/dist/translator/declaration/index.js +15 -0
- package/dist/translator/declaration/index[html].js +12 -0
- package/dist/translator/declaration/index[vdom].js +3 -0
- package/dist/translator/document-type/index.js +15 -0
- package/dist/translator/document-type/index[html].js +12 -0
- package/dist/translator/document-type/index[vdom].js +3 -0
- package/dist/translator/index.js +551 -0
- package/dist/translator/placeholder/index.js +15 -0
- package/dist/translator/placeholder/index[html].js +93 -0
- package/dist/translator/placeholder/index[vdom].js +22 -0
- package/dist/translator/scriptlet.js +4 -0
- package/dist/translator/tag/attribute/directives/class.js +42 -0
- package/dist/translator/tag/attribute/directives/index.js +15 -0
- package/dist/translator/tag/attribute/directives/no-update-body-if.js +15 -0
- package/dist/translator/tag/attribute/directives/no-update-body.js +10 -0
- package/dist/translator/tag/attribute/directives/no-update-if.js +12 -0
- package/dist/translator/tag/attribute/directives/no-update.js +48 -0
- package/dist/translator/tag/attribute/directives/style.js +42 -0
- package/dist/translator/tag/attribute/index.js +150 -0
- package/dist/translator/tag/attribute/modifiers/index.js +7 -0
- package/dist/translator/tag/attribute/modifiers/no-update.js +14 -0
- package/dist/translator/tag/attribute/modifiers/scoped.js +23 -0
- package/dist/translator/tag/attribute-tag.js +149 -0
- package/dist/translator/tag/custom-tag.js +146 -0
- package/dist/translator/tag/dynamic-tag.js +74 -0
- package/dist/translator/tag/index.js +287 -0
- package/dist/translator/tag/macro-tag.js +7 -0
- package/dist/translator/tag/native-tag.js +27 -0
- package/dist/translator/tag/native-tag[html]/attributes.js +151 -0
- package/dist/translator/tag/native-tag[html]/index.js +221 -0
- package/dist/translator/tag/native-tag[vdom]/attributes.js +105 -0
- package/dist/translator/tag/native-tag[vdom]/index.js +189 -0
- package/dist/translator/tag/util.js +246 -0
- package/dist/translator/taglib/core/conditional/translate-else-if.js +20 -0
- package/dist/translator/taglib/core/conditional/translate-else.js +20 -0
- package/dist/translator/taglib/core/conditional/translate-if.js +8 -0
- package/dist/translator/taglib/core/conditional/util.js +41 -0
- package/dist/translator/taglib/core/index.js +474 -0
- package/dist/translator/taglib/core/macro/parse.js +17 -0
- package/dist/translator/taglib/core/macro/translate.js +48 -0
- package/dist/translator/taglib/core/parse-class.js +79 -0
- package/dist/translator/taglib/core/parse-export.js +14 -0
- package/dist/translator/taglib/core/parse-import.js +14 -0
- package/dist/translator/taglib/core/parse-module-code.js +18 -0
- package/dist/translator/taglib/core/parse-static.js +18 -0
- package/dist/translator/taglib/core/transform-style.js +66 -0
- package/dist/translator/taglib/core/translate-await.js +41 -0
- package/dist/translator/taglib/core/translate-body.js +17 -0
- package/dist/translator/taglib/core/translate-for.js +156 -0
- package/dist/translator/taglib/core/translate-html-comment.js +52 -0
- package/dist/translator/taglib/core/translate-include-content.js +53 -0
- package/dist/translator/taglib/core/translate-server-only.js +5 -0
- package/dist/translator/taglib/core/translate-while.js +32 -0
- package/dist/translator/taglib/index.js +6 -0
- package/dist/translator/taglib/migrate/all-templates.js +46 -0
- package/dist/translator/taglib/migrate/index.js +5 -0
- package/dist/translator/text/index.js +10 -0
- package/dist/translator/text/index[html].js +12 -0
- package/dist/translator/text/index[vdom].js +20 -0
- package/dist/translator/util/add-dependencies.js +329 -0
- package/dist/translator/util/escape-regexp.js +4 -0
- package/dist/translator/util/get-component-files.js +86 -0
- package/dist/translator/util/html-out-write.js +15 -0
- package/dist/translator/util/key-manager.js +176 -0
- package/dist/translator/util/optimize-html-writes.js +52 -0
- package/dist/translator/util/optimize-vdom-create.js +164 -0
- package/dist/translator/util/plugin-hooks.js +22 -0
- package/dist/translator/util/runtime-flags.js +3 -0
- package/dist/translator/util/vdom-out-write.js +10 -0
- package/dist/translator/util/with-previous-location.js +6 -0
- package/package.json +7 -4
- package/src/taglib/index.js +2 -2
- package/src/translator/cdata/index.js +15 -0
- package/src/translator/cdata/index[html].js +15 -0
- package/src/translator/cdata/index[vdom].js +12 -0
- package/src/translator/class.js +65 -0
- package/src/translator/comment/index.js +15 -0
- package/src/translator/comment/index[html].js +17 -0
- package/src/translator/comment/index[vdom].js +3 -0
- package/src/translator/declaration/index.js +15 -0
- package/src/translator/declaration/index[html].js +12 -0
- package/src/translator/declaration/index[vdom].js +3 -0
- package/src/translator/document-type/index.js +15 -0
- package/src/translator/document-type/index[html].js +12 -0
- package/src/translator/document-type/index[vdom].js +3 -0
- package/src/translator/index.js +551 -0
- package/src/translator/placeholder/index.js +15 -0
- package/src/translator/placeholder/index[html].js +93 -0
- package/src/translator/placeholder/index[vdom].js +22 -0
- package/src/translator/scriptlet.js +4 -0
- package/src/translator/tag/attribute/directives/class.js +42 -0
- package/src/translator/tag/attribute/directives/index.js +15 -0
- package/src/translator/tag/attribute/directives/no-update-body-if.js +15 -0
- package/src/translator/tag/attribute/directives/no-update-body.js +10 -0
- package/src/translator/tag/attribute/directives/no-update-if.js +12 -0
- package/src/translator/tag/attribute/directives/no-update.js +48 -0
- package/src/translator/tag/attribute/directives/style.js +42 -0
- package/src/translator/tag/attribute/index.js +150 -0
- package/src/translator/tag/attribute/modifiers/index.js +7 -0
- package/src/translator/tag/attribute/modifiers/no-update.js +14 -0
- package/src/translator/tag/attribute/modifiers/scoped.js +23 -0
- package/src/translator/tag/attribute-tag.js +149 -0
- package/src/translator/tag/custom-tag.js +146 -0
- package/src/translator/tag/dynamic-tag.js +74 -0
- package/src/translator/tag/index.js +287 -0
- package/src/translator/tag/macro-tag.js +7 -0
- package/src/translator/tag/native-tag.js +27 -0
- package/src/translator/tag/native-tag[html]/attributes.js +151 -0
- package/src/translator/tag/native-tag[html]/index.js +221 -0
- package/src/translator/tag/native-tag[vdom]/attributes.js +105 -0
- package/src/translator/tag/native-tag[vdom]/index.js +189 -0
- package/src/translator/tag/util.js +246 -0
- package/src/translator/taglib/core/conditional/translate-else-if.js +20 -0
- package/src/translator/taglib/core/conditional/translate-else.js +20 -0
- package/src/translator/taglib/core/conditional/translate-if.js +8 -0
- package/src/translator/taglib/core/conditional/util.js +41 -0
- package/src/translator/taglib/core/index.js +474 -0
- package/src/translator/taglib/core/macro/parse.js +17 -0
- package/src/translator/taglib/core/macro/translate.js +48 -0
- package/src/translator/taglib/core/parse-class.js +79 -0
- package/src/translator/taglib/core/parse-export.js +14 -0
- package/src/translator/taglib/core/parse-import.js +14 -0
- package/src/translator/taglib/core/parse-module-code.js +18 -0
- package/src/translator/taglib/core/parse-static.js +18 -0
- package/src/translator/taglib/core/transform-style.js +66 -0
- package/src/translator/taglib/core/translate-await.js +41 -0
- package/src/translator/taglib/core/translate-body.js +17 -0
- package/src/translator/taglib/core/translate-for.js +156 -0
- package/src/translator/taglib/core/translate-html-comment.js +52 -0
- package/src/translator/taglib/core/translate-include-content.js +53 -0
- package/src/translator/taglib/core/translate-server-only.js +5 -0
- package/src/translator/taglib/core/translate-while.js +32 -0
- package/src/translator/taglib/index.js +7 -0
- package/src/translator/taglib/migrate/all-templates.js +46 -0
- package/src/translator/taglib/migrate/index.js +5 -0
- package/src/translator/text/index.js +10 -0
- package/src/translator/text/index[html].js +12 -0
- package/src/translator/text/index[vdom].js +20 -0
- package/src/translator/util/add-dependencies.js +329 -0
- package/src/translator/util/escape-regexp.js +4 -0
- package/src/translator/util/get-component-files.js +86 -0
- package/src/translator/util/html-out-write.js +15 -0
- package/src/translator/util/key-manager.js +176 -0
- package/src/translator/util/optimize-html-writes.js +52 -0
- package/src/translator/util/optimize-vdom-create.js +164 -0
- package/src/translator/util/plugin-hooks.js +22 -0
- package/src/translator/util/runtime-flags.js +3 -0
- package/src/translator/util/vdom-out-write.js +10 -0
- package/src/translator/util/with-previous-location.js +6 -0
- package/translator/index.d.ts +7 -0
- package/translator/package.json +5 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// eslint-disable-next-line no-constant-binary-expression
|
|
3
|
-
|
|
3
|
+
var complain = "MARKO_DEBUG" && require("complain");
|
|
4
4
|
var extend = require("raptor-util/extend");
|
|
5
5
|
var componentUtil = require("@internal/components-util");
|
|
6
|
-
var w10NOOP = require("../helpers/serialize-noop").
|
|
7
|
-
var attachBubblingEvent = componentUtil.
|
|
6
|
+
var w10NOOP = require("../helpers/serialize-noop").___noop;
|
|
7
|
+
var attachBubblingEvent = componentUtil.___attachBubblingEvent;
|
|
8
8
|
var addDelegatedEventHandler =
|
|
9
|
-
require("./event-delegation").
|
|
9
|
+
require("./event-delegation").___addDelegatedEventHandler;
|
|
10
10
|
var KeySequence = require("./KeySequence");
|
|
11
11
|
var EMPTY_OBJECT = {};
|
|
12
12
|
|
|
@@ -21,26 +21,26 @@ var FLAG_OLD_HYDRATE_NO_CREATE = 8;
|
|
|
21
21
|
* later (after the rendered HTML has been added to the DOM)
|
|
22
22
|
*/
|
|
23
23
|
function ComponentDef(component, componentId, componentsContext) {
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
24
|
+
this.___componentsContext = componentsContext; // The AsyncWriter that this component is associated with
|
|
25
|
+
this.___component = component;
|
|
26
26
|
this.id = componentId;
|
|
27
27
|
|
|
28
|
-
this.
|
|
28
|
+
this.___domEvents = undefined; // An array of DOM events that need to be added (in sets of three)
|
|
29
29
|
|
|
30
|
-
this.
|
|
30
|
+
this.___isExisting = false;
|
|
31
31
|
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
32
|
+
this.___renderBoundary = false;
|
|
33
|
+
this.___flags = 0;
|
|
34
34
|
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
35
|
+
this.___nextIdIndex = 0; // The unique integer to use for the next scoped ID
|
|
36
|
+
this.___keySequence = null;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
ComponentDef.prototype = {
|
|
40
|
-
|
|
40
|
+
___nextKey: function (key) {
|
|
41
41
|
return (
|
|
42
|
-
this.
|
|
43
|
-
|
|
42
|
+
this.___keySequence || (this.___keySequence = new KeySequence())).
|
|
43
|
+
___nextKey(key);
|
|
44
44
|
},
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -55,9 +55,9 @@ ComponentDef.prototype = {
|
|
|
55
55
|
} else {
|
|
56
56
|
if (typeof nestedId !== "string") {
|
|
57
57
|
// eslint-disable-next-line no-constant-condition
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
if ("MARKO_DEBUG") {
|
|
59
|
+
complain("Using non strings as keys is deprecated.");
|
|
60
|
+
}
|
|
61
61
|
|
|
62
62
|
nestedId = String(nestedId);
|
|
63
63
|
}
|
|
@@ -73,8 +73,8 @@ ComponentDef.prototype = {
|
|
|
73
73
|
/**
|
|
74
74
|
* Returns the next auto generated unique ID for a nested DOM element or nested DOM component
|
|
75
75
|
*/
|
|
76
|
-
|
|
77
|
-
return this.id + "-c" + this.
|
|
76
|
+
___nextComponentId: function () {
|
|
77
|
+
return this.id + "-c" + this.___nextIdIndex++;
|
|
78
78
|
},
|
|
79
79
|
|
|
80
80
|
d: function (eventName, handlerMethodName, isOnce, extraArgs) {
|
|
@@ -82,14 +82,14 @@ ComponentDef.prototype = {
|
|
|
82
82
|
return attachBubblingEvent(this, handlerMethodName, isOnce, extraArgs);
|
|
83
83
|
},
|
|
84
84
|
|
|
85
|
-
get
|
|
86
|
-
return this.
|
|
85
|
+
get ___type() {
|
|
86
|
+
return this.___component.___type;
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
ComponentDef.prototype.nk = ComponentDef.prototype.
|
|
90
|
+
ComponentDef.prototype.nk = ComponentDef.prototype.___nextKey;
|
|
91
91
|
|
|
92
|
-
ComponentDef.
|
|
92
|
+
ComponentDef.___deserialize = function (o, types, global, registry) {
|
|
93
93
|
var id = o[0];
|
|
94
94
|
var typeName = types[o[1]];
|
|
95
95
|
var input = o[2] || null;
|
|
@@ -103,16 +103,16 @@ ComponentDef._E_ = function (o, types, global, registry) {
|
|
|
103
103
|
|
|
104
104
|
var component =
|
|
105
105
|
typeName /* legacy */ &&
|
|
106
|
-
registry.
|
|
106
|
+
registry.___createComponent(typeName, id, isLegacy);
|
|
107
107
|
|
|
108
108
|
// Prevent newly created component from being queued for update since we area
|
|
109
109
|
// just building it from the server info
|
|
110
|
-
component.
|
|
111
|
-
component.
|
|
110
|
+
component.___updateQueued = true;
|
|
111
|
+
component.___global = global;
|
|
112
112
|
|
|
113
113
|
if (isLegacy) {
|
|
114
114
|
component.widgetConfig = componentProps;
|
|
115
|
-
component.
|
|
115
|
+
component.___widgetBody = renderBody;
|
|
116
116
|
} else if (renderBody) {
|
|
117
117
|
(input || (input = {})).renderBody = renderBody;
|
|
118
118
|
}
|
|
@@ -146,23 +146,23 @@ ComponentDef._E_ = function (o, types, global, registry) {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
component.
|
|
149
|
+
component.___input = input;
|
|
150
150
|
|
|
151
151
|
if (extra.b) {
|
|
152
|
-
component.
|
|
152
|
+
component.___bubblingDomEvents = extra.b;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
var scope = extra.p;
|
|
156
156
|
var customEvents = extra.e;
|
|
157
157
|
if (customEvents) {
|
|
158
|
-
component.
|
|
158
|
+
component.___setCustomEvents(customEvents, scope);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
return {
|
|
162
162
|
id: id,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
___component: component,
|
|
164
|
+
___domEvents: extra.d,
|
|
165
|
+
___flags: extra.f || 0
|
|
166
166
|
};
|
|
167
167
|
};
|
|
168
168
|
|
|
@@ -6,54 +6,54 @@ function ComponentsContext(out, parentComponentsContext) {
|
|
|
6
6
|
var componentDef;
|
|
7
7
|
|
|
8
8
|
if (parentComponentsContext) {
|
|
9
|
-
globalComponentsContext = parentComponentsContext.
|
|
10
|
-
componentDef = parentComponentsContext.
|
|
9
|
+
globalComponentsContext = parentComponentsContext.___globalContext;
|
|
10
|
+
componentDef = parentComponentsContext.___componentDef;
|
|
11
11
|
|
|
12
12
|
var nestedContextsForParent;
|
|
13
13
|
if (
|
|
14
|
-
!(nestedContextsForParent = parentComponentsContext.
|
|
14
|
+
!(nestedContextsForParent = parentComponentsContext.___nestedContexts))
|
|
15
15
|
{
|
|
16
|
-
nestedContextsForParent = parentComponentsContext.
|
|
16
|
+
nestedContextsForParent = parentComponentsContext.___nestedContexts = [];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
nestedContextsForParent.push(this);
|
|
20
20
|
} else {
|
|
21
|
-
globalComponentsContext = out.global.
|
|
21
|
+
globalComponentsContext = out.global.___components;
|
|
22
22
|
if (globalComponentsContext === undefined) {
|
|
23
|
-
out.global.
|
|
23
|
+
out.global.___components = globalComponentsContext =
|
|
24
24
|
new GlobalComponentsContext(out);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
parentComponentsContext && parentComponentsContext.
|
|
28
|
+
this.___globalContext = globalComponentsContext;
|
|
29
|
+
this.___components = [];
|
|
30
|
+
this.___out = out;
|
|
31
|
+
this.___componentDef = componentDef;
|
|
32
|
+
this.___nestedContexts = undefined;
|
|
33
|
+
this.___isPreserved =
|
|
34
|
+
parentComponentsContext && parentComponentsContext.___isPreserved;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
ComponentsContext.prototype = {
|
|
38
|
-
|
|
39
|
-
var componentDefs = this.
|
|
38
|
+
___initComponents: function (host) {
|
|
39
|
+
var componentDefs = this.___components;
|
|
40
40
|
|
|
41
|
-
ComponentsContext.
|
|
41
|
+
ComponentsContext.___initClientRendered(componentDefs, host);
|
|
42
42
|
|
|
43
|
-
this.
|
|
43
|
+
this.___out.emit("___componentsInitialized");
|
|
44
44
|
|
|
45
45
|
// Reset things stored in global since global is retained for
|
|
46
46
|
// future renders
|
|
47
|
-
this.
|
|
47
|
+
this.___out.global.___components = undefined;
|
|
48
48
|
|
|
49
49
|
return componentDefs;
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
function getComponentsContext(out) {
|
|
54
|
-
return out.
|
|
54
|
+
return out.___components || (out.___components = new ComponentsContext(out));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
module.exports = exports = ComponentsContext;
|
|
58
58
|
|
|
59
|
-
exports.
|
|
59
|
+
exports.___getComponentsContext = getComponentsContext;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";var nextComponentIdProvider =
|
|
2
|
-
require("@internal/components-util").
|
|
2
|
+
require("@internal/components-util").___nextComponentIdProvider;
|
|
3
3
|
|
|
4
4
|
function GlobalComponentsContext(out) {
|
|
5
|
-
this.
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
5
|
+
this.___renderedComponentsById = {};
|
|
6
|
+
this.___rerenderComponent = undefined;
|
|
7
|
+
this.___nextComponentId = nextComponentIdProvider(out);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
module.exports = GlobalComponentsContext;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";function KeySequence() {
|
|
2
|
-
this.
|
|
2
|
+
this.___lookup = Object.create(null);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
KeySequence.prototype.
|
|
6
|
-
var lookup = this.
|
|
5
|
+
KeySequence.prototype.___nextKey = function (key) {
|
|
6
|
+
var lookup = this.___lookup;
|
|
7
7
|
|
|
8
8
|
if (lookup[key]) {
|
|
9
9
|
return key + "_" + lookup[key]++;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// eslint-disable-next-line no-constant-binary-expression
|
|
3
|
-
|
|
3
|
+
var complain = "MARKO_DEBUG" && require("complain");
|
|
4
4
|
|
|
5
5
|
class ServerComponent {
|
|
6
6
|
constructor(id, input, out, typeName, customEvents, scope) {
|
|
7
7
|
this.id = id;
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
8
|
+
this.___customEvents = customEvents;
|
|
9
|
+
this.___scope = scope;
|
|
10
10
|
this.typeName = typeName;
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
11
|
+
this.___bubblingDomEvents = undefined; // Used to keep track of bubbling DOM events for components rendered on the server
|
|
12
|
+
this.___bubblingDomEventsExtraArgsCount = 0;
|
|
13
13
|
|
|
14
14
|
this.onCreate(input, out);
|
|
15
|
-
this.
|
|
16
|
-
if (this.
|
|
17
|
-
this.
|
|
15
|
+
this.___updatedInput = this.onInput(input, out) || input;
|
|
16
|
+
if (this.___input === undefined) {
|
|
17
|
+
this.___input = this.___updatedInput;
|
|
18
18
|
}
|
|
19
19
|
this.onRender(out);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
set input(newInput) {
|
|
23
|
-
this.
|
|
23
|
+
this.___input = newInput;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
get input() {
|
|
27
|
-
return this.
|
|
27
|
+
return this.___input;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
set state(newState) {
|
|
31
|
-
this.
|
|
31
|
+
this.___state = newState;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
get state() {
|
|
35
|
-
return this.
|
|
35
|
+
return this.___state;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
get
|
|
39
|
-
return this.
|
|
38
|
+
get ___rawState() {
|
|
39
|
+
return this.___state;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
elId(nestedId) {
|
|
@@ -47,9 +47,9 @@ class ServerComponent {
|
|
|
47
47
|
} else {
|
|
48
48
|
if (typeof nestedId !== "string") {
|
|
49
49
|
// eslint-disable-next-line no-constant-condition
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
if ("MARKO_DEBUG") {
|
|
51
|
+
complain("Using non strings as keys is deprecated.");
|
|
52
|
+
}
|
|
53
53
|
|
|
54
54
|
nestedId = String(nestedId);
|
|
55
55
|
}
|
|
@@ -5,42 +5,42 @@ function ensure(state, propertyName) {
|
|
|
5
5
|
if (!(propertyName in proto)) {
|
|
6
6
|
Object.defineProperty(proto, propertyName, {
|
|
7
7
|
get: function () {
|
|
8
|
-
return this.
|
|
8
|
+
return this.___raw[propertyName];
|
|
9
9
|
},
|
|
10
10
|
set: function (value) {
|
|
11
|
-
this.
|
|
11
|
+
this.___set(propertyName, value, false /* ensure:false */);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function State(component) {
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
18
|
+
this.___component = component;
|
|
19
|
+
this.___raw = {};
|
|
20
20
|
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
21
|
+
this.___dirty = false;
|
|
22
|
+
this.___old = null;
|
|
23
|
+
this.___changes = null;
|
|
24
|
+
this.___forced = null; // An object that we use to keep tracking of state properties that were forced to be dirty
|
|
25
25
|
|
|
26
26
|
Object.seal(this);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
State.prototype = {
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
30
|
+
___reset: function () {
|
|
31
|
+
this.___dirty = false;
|
|
32
|
+
this.___old = null;
|
|
33
|
+
this.___changes = null;
|
|
34
|
+
this.___forced = null;
|
|
35
35
|
},
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
___replace: function (newState) {
|
|
38
38
|
var key;
|
|
39
|
-
var rawState = this.
|
|
39
|
+
var rawState = this.___raw;
|
|
40
40
|
|
|
41
41
|
for (key in rawState) {
|
|
42
42
|
if (!(key in newState)) {
|
|
43
|
-
this.
|
|
43
|
+
this.___set(
|
|
44
44
|
key,
|
|
45
45
|
undefined,
|
|
46
46
|
false /* ensure:false */,
|
|
@@ -50,7 +50,7 @@ State.prototype = {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
for (key in newState) {
|
|
53
|
-
this.
|
|
53
|
+
this.___set(
|
|
54
54
|
key,
|
|
55
55
|
newState[key],
|
|
56
56
|
true /* ensure:true */,
|
|
@@ -58,32 +58,32 @@ State.prototype = {
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
|
-
|
|
62
|
-
var rawState = this.
|
|
61
|
+
___set: function (name, value, shouldEnsure, forceDirty) {
|
|
62
|
+
var rawState = this.___raw;
|
|
63
63
|
|
|
64
64
|
if (shouldEnsure) {
|
|
65
65
|
ensure(this, name);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
if (forceDirty) {
|
|
69
|
-
var forcedDirtyState = this.
|
|
69
|
+
var forcedDirtyState = this.___forced || (this.___forced = {});
|
|
70
70
|
forcedDirtyState[name] = true;
|
|
71
71
|
} else if (rawState[name] === value) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
if (!this.
|
|
75
|
+
if (!this.___dirty) {
|
|
76
76
|
// This is the first time we are modifying the component state
|
|
77
77
|
// so introduce some properties to do some tracking of
|
|
78
78
|
// changes to the state
|
|
79
|
-
this.
|
|
80
|
-
this.
|
|
81
|
-
this.
|
|
82
|
-
this.
|
|
83
|
-
this.
|
|
79
|
+
this.___dirty = true; // Mark the component state as dirty (i.e. modified)
|
|
80
|
+
this.___old = rawState;
|
|
81
|
+
this.___raw = rawState = extend({}, rawState);
|
|
82
|
+
this.___changes = {};
|
|
83
|
+
this.___component.___queueUpdate();
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
this.
|
|
86
|
+
this.___changes[name] = value;
|
|
87
87
|
|
|
88
88
|
if (value === undefined) {
|
|
89
89
|
// Don't store state properties with an undefined or null value
|
|
@@ -94,7 +94,7 @@ State.prototype = {
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
toJSON: function () {
|
|
97
|
-
return this.
|
|
97
|
+
return this.___raw;
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";var eventDelegation = require("./event-delegation");
|
|
2
|
-
var delegateEvent = eventDelegation.
|
|
3
|
-
var getEventFromEl = eventDelegation.
|
|
2
|
+
var delegateEvent = eventDelegation.___delegateEvent;
|
|
3
|
+
var getEventFromEl = eventDelegation.___getEventFromEl;
|
|
4
4
|
|
|
5
5
|
// var componentsUtil = require('@internal/components-util');
|
|
6
6
|
// var destroyNodeRecursive = componentsUtil.___destroyNodeRecursive;
|
|
@@ -11,13 +11,13 @@ function handleNodeAttach(node, componentsContext) {
|
|
|
11
11
|
var eventName = "onattach";
|
|
12
12
|
var target = getEventFromEl(node, eventName);
|
|
13
13
|
if (target) {
|
|
14
|
-
var out = componentsContext.
|
|
14
|
+
var out = componentsContext.___out;
|
|
15
15
|
var data = out.data;
|
|
16
16
|
|
|
17
|
-
var attachTargets = data.
|
|
17
|
+
var attachTargets = data.___attachTargets;
|
|
18
18
|
if (!attachTargets) {
|
|
19
|
-
attachTargets = data.
|
|
20
|
-
out.on("
|
|
19
|
+
attachTargets = data.___attachTargets = [];
|
|
20
|
+
out.on("___componentsInitialized", function () {
|
|
21
21
|
for (var i = 0; i < attachTargets.length; i += 2) {
|
|
22
22
|
var node = attachTargets[i];
|
|
23
23
|
var target = attachTargets[i + 1];
|
|
@@ -56,5 +56,5 @@ function handleNodeDetach(node) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
eventDelegation.
|
|
60
|
-
eventDelegation.
|
|
59
|
+
eventDelegation.___handleNodeAttach = handleNodeAttach;
|
|
60
|
+
eventDelegation.___handleNodeDetach = handleNodeDetach;
|
|
@@ -5,7 +5,7 @@ var BaseComponent = require("./Component");
|
|
|
5
5
|
var BaseState = require("./State");
|
|
6
6
|
|
|
7
7
|
module.exports = function defineComponent(def, renderer) {
|
|
8
|
-
if (def.
|
|
8
|
+
if (def.___isComponent) {
|
|
9
9
|
return def;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -34,7 +34,7 @@ module.exports = function defineComponent(def, renderer) {
|
|
|
34
34
|
BaseComponent.call(this, id);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (!proto.
|
|
37
|
+
if (!proto.___isComponent) {
|
|
38
38
|
// Inherit from Component if they didn't already
|
|
39
39
|
inherit(ComponentClass, BaseComponent);
|
|
40
40
|
}
|
|
@@ -47,14 +47,14 @@ module.exports = function defineComponent(def, renderer) {
|
|
|
47
47
|
|
|
48
48
|
// Set a flag on the constructor function to make it clear this is
|
|
49
49
|
// a component so that we can short-circuit this work later
|
|
50
|
-
Component.
|
|
50
|
+
Component.___isComponent = true;
|
|
51
51
|
|
|
52
52
|
function State(component) {
|
|
53
53
|
BaseState.call(this, component);
|
|
54
54
|
}
|
|
55
55
|
inherit(State, BaseState);
|
|
56
|
-
proto.
|
|
57
|
-
proto.
|
|
56
|
+
proto.___State = State;
|
|
57
|
+
proto.___renderer = renderer;
|
|
58
58
|
|
|
59
59
|
return Component;
|
|
60
60
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
___vPropsByDOMNode: new WeakMap(),
|
|
3
|
+
___vElementByDOMNode: new WeakMap(),
|
|
4
|
+
___componentByDOMNode: new WeakMap(),
|
|
5
|
+
___detachedByDOMNode: new WeakMap(),
|
|
6
|
+
___keyByDOMNode: new WeakMap(),
|
|
7
|
+
___ssrKeyedElementsByComponentId: {}
|
|
8
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";var componentsUtil = require("@internal/components-util");
|
|
2
|
-
var runtimeId = componentsUtil.
|
|
3
|
-
var componentLookup = componentsUtil.
|
|
4
|
-
var getMarkoPropsFromEl = componentsUtil.
|
|
2
|
+
var runtimeId = componentsUtil.___runtimeId;
|
|
3
|
+
var componentLookup = componentsUtil.___componentLookup;
|
|
4
|
+
var getMarkoPropsFromEl = componentsUtil.___getMarkoPropsFromEl;
|
|
5
5
|
|
|
6
6
|
var TEXT_NODE = 3;
|
|
7
7
|
|
|
@@ -54,7 +54,7 @@ function delegateEvent(node, eventName, target, event) {
|
|
|
54
54
|
|
|
55
55
|
if (extraArgs != null) {
|
|
56
56
|
if (typeof extraArgs === "number") {
|
|
57
|
-
extraArgs = targetComponent.
|
|
57
|
+
extraArgs = targetComponent.___bubblingDomEvents[extraArgs];
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -132,12 +132,12 @@ function addDelegatedEventHandlerToHost(eventType, host) {
|
|
|
132
132
|
|
|
133
133
|
function noop() {}
|
|
134
134
|
|
|
135
|
-
exports.
|
|
136
|
-
exports.
|
|
137
|
-
exports.
|
|
138
|
-
exports.
|
|
139
|
-
exports.
|
|
140
|
-
exports.
|
|
135
|
+
exports.___handleNodeAttach = noop;
|
|
136
|
+
exports.___handleNodeDetach = noop;
|
|
137
|
+
exports.___delegateEvent = delegateEvent;
|
|
138
|
+
exports.___getEventFromEl = getEventFromEl;
|
|
139
|
+
exports.___addDelegatedEventHandler = addDelegatedEventHandler;
|
|
140
|
+
exports.___init = function (host) {
|
|
141
141
|
Object.keys(delegatedEvents).forEach(function (eventType) {
|
|
142
142
|
addDelegatedEventHandlerToHost(eventType, host);
|
|
143
143
|
});
|