marko 4.28.7 → 4.28.9
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/core-tags/core/await/renderer.js +15 -4
- package/dist/core-tags/core/await/reorderer-renderer.js +39 -13
- 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 +43 -43
- 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 +21 -21
- package/dist/node_modules/@internal/components-entry-legacy/index-browser.js +6 -6
- package/dist/node_modules/@internal/components-entry-legacy/index.js +1 -1
- package/dist/node_modules/@internal/components-registry/index-browser.js +40 -40
- 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 +9 -9
- package/dist/node_modules/@internal/create-readable/index-browser.js +1 -1
- package/dist/node_modules/@internal/create-readable/index.js +8 -8
- package/dist/node_modules/@internal/init-components-tag/index.js +4 -4
- package/dist/node_modules/@internal/preserve-tag/index-browser.js +8 -8
- package/dist/node_modules/@internal/preserve-tag/index.js +5 -5
- package/dist/node_modules/@internal/set-immediate/index-browser.js +1 -1
- package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -2
- package/dist/node_modules/@internal/set-immediate/index.js +2 -2
- package/dist/runtime/RenderResult.js +13 -13
- package/dist/runtime/components/Component.js +144 -144
- package/dist/runtime/components/ComponentDef.js +27 -27
- 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 +26 -26
- package/dist/runtime/components/attach-detach.js +8 -8
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +4 -4
- 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 +16 -16
- 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/renderer-legacy.js +39 -39
- package/dist/runtime/components/renderer.js +34 -34
- package/dist/runtime/components/update-manager.js +10 -10
- 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 +13 -13
- package/dist/runtime/helpers/style-value.js +1 -1
- package/dist/runtime/html/AsyncStream.js +24 -24
- package/dist/runtime/html/BufferedWriter.js +2 -2
- package/dist/runtime/html/StringWriter.js +1 -1
- package/dist/runtime/html/helpers/data-marko.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/index.js +1 -1
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +43 -43
- package/dist/runtime/vdom/VComponent.js +2 -2
- package/dist/runtime/vdom/VDocumentFragment.js +1 -1
- package/dist/runtime/vdom/VElement.js +12 -12
- package/dist/runtime/vdom/VFragment.js +4 -4
- package/dist/runtime/vdom/VNode.js +2 -2
- package/dist/runtime/vdom/index.js +1 -1
- package/dist/runtime/vdom/morphdom/fragment.js +2 -2
- package/dist/runtime/vdom/morphdom/helpers.js +3 -3
- package/dist/runtime/vdom/morphdom/index.js +43 -43
- package/package.json +1 -1
- package/src/compiler/Normalizer.js +4 -1
- package/src/compiler/ast/CustomTag.js +4 -2
- package/src/core-tags/components/TransformHelper/convertToComponent.js +1 -1
- package/src/core-tags/core/await/renderer.js +18 -4
- package/src/core-tags/core/await/reorderer-renderer.js +82 -48
- package/src/core-tags/migrate/all-tags/widget-in-attrs.js +9 -7
- package/src/runtime/components/legacy/index.js +3 -1
- package/src/runtime/helpers/interop-require.js +1 -1
|
@@ -87,15 +87,20 @@ module.exports = function awaitTag(input, out) {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
if (clientReorder) {
|
|
90
|
+
awaitInfo.parent = out;
|
|
90
91
|
awaitInfo.after = input.showAfter;
|
|
91
92
|
|
|
92
93
|
clientReorderContext = out.global.n_ || (out.global.n_ = {
|
|
94
|
+
handleAwait: undefined,
|
|
93
95
|
instances: [],
|
|
94
96
|
nextId: 0
|
|
95
97
|
});
|
|
96
98
|
|
|
97
|
-
|
|
98
|
-
var
|
|
99
|
+
/** SHOULD MATCH THE reorder-renderer.js IMPLEMENTATION */
|
|
100
|
+
var reorderFunctionId = out.global.runtimeId !== "M" ? "af" + out.global.runtimeId : "af";
|
|
101
|
+
|
|
102
|
+
var id = awaitInfo.id = input.name || (out.global.componentIdPrefix || 0) + clientReorderContext.nextId++;
|
|
103
|
+
var placeholderIdAttrValue = reorderFunctionId + "ph" + id;
|
|
99
104
|
|
|
100
105
|
if (placeholderRenderer) {
|
|
101
106
|
out.write('<span id="' + placeholderIdAttrValue + '">');
|
|
@@ -129,7 +134,9 @@ module.exports = function awaitTag(input, out) {
|
|
|
129
134
|
oldEmit.apply(asyncOut, arguments);
|
|
130
135
|
};
|
|
131
136
|
|
|
132
|
-
if (clientReorderContext.
|
|
137
|
+
if (clientReorderContext.handleAwait) {
|
|
138
|
+
clientReorderContext.handleAwait(awaitInfo);
|
|
139
|
+
} else {
|
|
133
140
|
clientReorderContext.instances.push(awaitInfo);
|
|
134
141
|
}
|
|
135
142
|
|
|
@@ -199,7 +206,11 @@ function renderContents(err, data, input, out) {
|
|
|
199
206
|
if (err) {
|
|
200
207
|
if (input.catch) {
|
|
201
208
|
if (errorRenderer) {
|
|
202
|
-
|
|
209
|
+
try {
|
|
210
|
+
errorRenderer(out, err);
|
|
211
|
+
} catch (err2) {
|
|
212
|
+
out.error(err2);
|
|
213
|
+
}
|
|
203
214
|
}
|
|
204
215
|
} else {
|
|
205
216
|
out.error(err);
|
|
@@ -23,6 +23,9 @@ module.exports = function (input, out) {
|
|
|
23
23
|
out.flush();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/** SHOULD MATCH THE renderer.js IMPLEMENTATION */
|
|
27
|
+
var reorderFunctionId = out.global.runtimeId !== "M" ? "af" + out.global.runtimeId : "af";
|
|
28
|
+
|
|
26
29
|
var asyncOut = out.beginAsync({
|
|
27
30
|
last: true,
|
|
28
31
|
timeout: -1,
|
|
@@ -41,20 +44,46 @@ module.exports = function (input, out) {
|
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
function handleAwait(awaitInfo) {
|
|
44
|
-
|
|
47
|
+
let flushedScript = false;
|
|
48
|
+
let flushedContent = false;
|
|
49
|
+
let flushedPlaceholder = awaitInfo.parent._state.finished;
|
|
50
|
+
if (flushedPlaceholder) {
|
|
51
|
+
if (awaitInfo.out._state.finished) {
|
|
52
|
+
writeResult(awaitInfo.out.p_());
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
awaitInfo.parent.on("q_", () => {
|
|
57
|
+
flushedPlaceholder = true;
|
|
58
|
+
if (!flushedScript && flushedContent) {
|
|
59
|
+
flushedScript = true;
|
|
60
|
+
asyncOut.script(`$${reorderFunctionId}(` + (typeof awaitInfo.id === "number" ? awaitInfo.id : '"' + awaitInfo.id + '"') + (awaitInfo.after ? ',"' + awaitInfo.after + '"' : "") + ")");
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
awaitInfo.out.on("q_", out.emit.bind(out, "q_")).on("finish", writeResult).on("error", function (err) {
|
|
66
|
+
asyncOut.error(err);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
function writeResult(result) {
|
|
70
|
+
flushedContent = true;
|
|
45
71
|
if (!global._afRuntime) {
|
|
46
72
|
// Minified version of ./client-reorder-runtime.js
|
|
47
|
-
asyncOut.script(`function
|
|
73
|
+
asyncOut.script(`function $${reorderFunctionId}(d,a,e,l,g,h,k,b,f,c){c=$${reorderFunctionId};if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("${reorderFunctionId}"+d);g=e.getElementById("${reorderFunctionId}ph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}`);
|
|
48
74
|
global._afRuntime = true;
|
|
49
75
|
}
|
|
50
76
|
|
|
51
77
|
if (global.cspNonce) {
|
|
52
|
-
asyncOut.write('<style nonce="' + escapeDoubleQuotes(global.cspNonce) + '">' +
|
|
78
|
+
asyncOut.write('<style nonce="' + escapeDoubleQuotes(global.cspNonce) + '">' + `#${reorderFunctionId}` + awaitInfo.id + "{display:none;}" + "</style>" + `<div id="${reorderFunctionId}` + awaitInfo.id + '">' + result.toString() + "</div>");
|
|
53
79
|
} else {
|
|
54
|
-
asyncOut.write(
|
|
80
|
+
asyncOut.write(`<div id="${reorderFunctionId}` + awaitInfo.id + '" style="display:none">' + result.toString() + "</div>");
|
|
55
81
|
}
|
|
56
82
|
|
|
57
|
-
|
|
83
|
+
if (!flushedScript && flushedPlaceholder) {
|
|
84
|
+
flushedScript = true;
|
|
85
|
+
asyncOut.script(`$${reorderFunctionId}(` + (typeof awaitInfo.id === "number" ? awaitInfo.id : '"' + awaitInfo.id + '"') + (awaitInfo.after ? ',"' + awaitInfo.after + '"' : "") + ")");
|
|
86
|
+
}
|
|
58
87
|
|
|
59
88
|
awaitInfo.out.writer = asyncOut.writer;
|
|
60
89
|
|
|
@@ -66,20 +95,17 @@ module.exports = function (input, out) {
|
|
|
66
95
|
asyncOut.end();
|
|
67
96
|
next();
|
|
68
97
|
}
|
|
69
|
-
}
|
|
70
|
-
asyncOut.error(err);
|
|
71
|
-
});
|
|
98
|
+
}
|
|
72
99
|
}
|
|
73
100
|
|
|
74
101
|
awaitContext.instances.forEach(handleAwait);
|
|
75
|
-
|
|
76
|
-
out.on("await:clientReorder", function (awaitInfo) {
|
|
102
|
+
awaitContext.handleAwait = function (awaitInfo) {
|
|
77
103
|
remaining++;
|
|
78
104
|
handleAwait(awaitInfo);
|
|
79
|
-
}
|
|
105
|
+
};
|
|
80
106
|
|
|
81
107
|
// Now that we have a listener attached, we want to receive any additional
|
|
82
|
-
// out-of-sync instances via
|
|
83
|
-
|
|
108
|
+
// out-of-sync instances via the method
|
|
109
|
+
awaitContext.instances = undefined;
|
|
84
110
|
});
|
|
85
111
|
};
|
|
@@ -2,11 +2,11 @@ var ComponentDef = require("../../../runtime/components/ComponentDef");
|
|
|
2
2
|
|
|
3
3
|
module.exports = function beginComponent(componentsContext, component, key, ownerComponentDef) {
|
|
4
4
|
var componentId = component.id;
|
|
5
|
-
var componentDef = componentsContext.
|
|
6
|
-
componentsContext.
|
|
7
|
-
componentsContext.
|
|
5
|
+
var componentDef = componentsContext.r_ = new ComponentDef(component, componentId, componentsContext);
|
|
6
|
+
componentsContext.s_.t_[componentId] = true;
|
|
7
|
+
componentsContext.u_.push(componentDef);
|
|
8
8
|
|
|
9
|
-
var out = componentsContext.
|
|
10
|
-
out.bc(component, key, ownerComponentDef && ownerComponentDef.
|
|
9
|
+
var out = componentsContext.v_;
|
|
10
|
+
out.bc(component, key, ownerComponentDef && ownerComponentDef.w_);
|
|
11
11
|
return componentDef;
|
|
12
12
|
};
|
|
@@ -11,13 +11,13 @@ module.exports = function beginComponent(componentsContext, component, key, owne
|
|
|
11
11
|
|
|
12
12
|
// existingComponentDef is only here to allow binding a conditional
|
|
13
13
|
// widget. It should be removed when the legacy compat layer is removed.
|
|
14
|
-
var componentDef = existingComponentDef || (componentsContext.
|
|
14
|
+
var componentDef = existingComponentDef || (componentsContext.r_ = new ComponentDef(component, componentId, componentsContext));
|
|
15
15
|
|
|
16
|
-
var ownerIsRenderBoundary = ownerComponentDef && ownerComponentDef.
|
|
17
|
-
var ownerWillRerender = ownerComponentDef && ownerComponentDef.
|
|
16
|
+
var ownerIsRenderBoundary = ownerComponentDef && ownerComponentDef.x_;
|
|
17
|
+
var ownerWillRerender = ownerComponentDef && ownerComponentDef.y_ & FLAG_WILL_RERENDER_IN_BROWSER;
|
|
18
18
|
// On the server
|
|
19
|
-
if (!componentsContext.
|
|
20
|
-
componentDef.
|
|
19
|
+
if (!componentsContext.z_ && ownerWillRerender) {
|
|
20
|
+
componentDef.y_ |= FLAG_WILL_RERENDER_IN_BROWSER;
|
|
21
21
|
componentDef._wrr = true;
|
|
22
22
|
return componentDef;
|
|
23
23
|
}
|
|
@@ -29,22 +29,22 @@ module.exports = function beginComponent(componentsContext, component, key, owne
|
|
|
29
29
|
return componentDef;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
componentsContext.
|
|
32
|
+
componentsContext.u_.push(componentDef);
|
|
33
33
|
|
|
34
|
-
let out = componentsContext.
|
|
34
|
+
let out = componentsContext.v_;
|
|
35
35
|
let runtimeId = out.global.runtimeId;
|
|
36
36
|
|
|
37
|
-
componentDef.
|
|
38
|
-
componentDef.
|
|
37
|
+
componentDef.x_ = true;
|
|
38
|
+
componentDef.A_ = componentsContext.z_;
|
|
39
39
|
|
|
40
40
|
if (isSplitComponent === false && out.global.noBrowserRerender !== true) {
|
|
41
|
-
componentDef.
|
|
41
|
+
componentDef.y_ |= FLAG_WILL_RERENDER_IN_BROWSER;
|
|
42
42
|
componentDef._wrr = true;
|
|
43
|
-
componentsContext.
|
|
43
|
+
componentsContext.z_ = false;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (out.global.oldHydrateNoCreate === true) {
|
|
47
|
-
componentDef.
|
|
47
|
+
componentDef.y_ |= FLAG_OLD_HYDRATE_NO_CREATE;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if ((ownerIsRenderBoundary || ownerWillRerender) && key != null) {
|
|
@@ -19,7 +19,7 @@ function noop() {}
|
|
|
19
19
|
module.exports = function defineWidget(def, renderer) {
|
|
20
20
|
def = def.Widget || def;
|
|
21
21
|
|
|
22
|
-
if (def.
|
|
22
|
+
if (def.B_) {
|
|
23
23
|
return def;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -49,7 +49,7 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
49
49
|
BaseComponent.call(this, id, doc);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
if (!proto.
|
|
52
|
+
if (!proto.B_) {
|
|
53
53
|
// Inherit from Component if they didn't already
|
|
54
54
|
ComponentClass.prototype = Object.create(BaseComponent.prototype);
|
|
55
55
|
for (var propName in proto) {
|
|
@@ -62,16 +62,16 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
62
62
|
// The same prototype will be used by our constructor after
|
|
63
63
|
// we he have set up the prototype chain using the inherit function
|
|
64
64
|
proto = Component.prototype = ComponentClass.prototype;
|
|
65
|
-
proto.
|
|
65
|
+
proto.C_ = true;
|
|
66
66
|
|
|
67
67
|
proto.constructor = def.constructor = Component;
|
|
68
68
|
|
|
69
69
|
Object.defineProperty(proto, "state", {
|
|
70
70
|
get: function () {
|
|
71
|
-
var raw = this.
|
|
71
|
+
var raw = this.D_ && this.D_.E_;
|
|
72
72
|
|
|
73
73
|
if (raw && !raw.toJSON) {
|
|
74
|
-
Object.defineProperty(this.
|
|
74
|
+
Object.defineProperty(this.D_.E_, "toJSON", stateToJSONDef);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
return raw;
|
|
@@ -84,43 +84,43 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
84
84
|
|
|
85
85
|
Object.defineProperty(proto, "__document", {
|
|
86
86
|
get: function () {
|
|
87
|
-
return this.
|
|
87
|
+
return this.F_;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
Object.defineProperty(proto, "el", {
|
|
92
92
|
get: function () {
|
|
93
|
-
return this.
|
|
93
|
+
return this.G_;
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
// get legacy methods
|
|
98
98
|
|
|
99
|
-
proto.
|
|
99
|
+
proto.H_ = proto.onRender;
|
|
100
100
|
Object.defineProperty(proto, "onRender", {
|
|
101
101
|
get: noop,
|
|
102
102
|
set: function (v) {
|
|
103
|
-
proto.
|
|
103
|
+
proto.H_ = v;
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
proto.
|
|
107
|
+
proto.I_ = proto.onUpdate;
|
|
108
108
|
Object.defineProperty(proto, "onUpdate", {
|
|
109
109
|
get: function () {
|
|
110
110
|
return modernMountOrUpdate;
|
|
111
111
|
},
|
|
112
112
|
set: function (v) {
|
|
113
|
-
proto.
|
|
113
|
+
proto.I_ = v;
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
proto.
|
|
117
|
+
proto.J_ = proto.onDestroy;
|
|
118
118
|
Object.defineProperty(proto, "onDestroy", {
|
|
119
119
|
get: function () {
|
|
120
120
|
return modernOnDestory;
|
|
121
121
|
},
|
|
122
122
|
set: function (v) {
|
|
123
|
-
proto.
|
|
123
|
+
proto.J_ = v;
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
|
|
@@ -129,89 +129,89 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
129
129
|
proto.onMount = modernMountOrUpdate;
|
|
130
130
|
|
|
131
131
|
if (legacyInit) {
|
|
132
|
-
proto.
|
|
132
|
+
proto.K_ = legacyInit;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
// convert legacy to modern
|
|
136
|
-
proto.
|
|
136
|
+
proto.L_ = proto.update;
|
|
137
137
|
proto.update = function () {
|
|
138
|
-
if (this.
|
|
138
|
+
if (this.M_) {
|
|
139
139
|
|
|
140
140
|
this.destroy = modernOnDestory;
|
|
141
141
|
// eslint-disable-next-line no-constant-condition
|
|
142
142
|
|
|
143
|
-
this.
|
|
143
|
+
this.M_ = false;
|
|
144
144
|
}
|
|
145
|
-
this.
|
|
146
|
-
if (this.
|
|
145
|
+
this.N_ = true;
|
|
146
|
+
if (this.G_) {
|
|
147
147
|
this.onBeforeUpdate && this.onBeforeUpdate();
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
this.
|
|
151
|
-
this.
|
|
150
|
+
this.L_();
|
|
151
|
+
this.N_ = false;
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
function modernMountOrUpdate() {
|
|
155
155
|
var self = this;
|
|
156
|
-
var el = this.
|
|
157
|
-
var prevEl = this.
|
|
156
|
+
var el = this.O_["@_wbind"];
|
|
157
|
+
var prevEl = this.G_;
|
|
158
158
|
|
|
159
159
|
if (prevEl !== el) {
|
|
160
|
-
this.
|
|
160
|
+
this.G_ = el;
|
|
161
161
|
|
|
162
162
|
if (prevEl) {
|
|
163
163
|
this.onBeforeDestroy && this.onBeforeDestroy();
|
|
164
|
-
this.
|
|
165
|
-
this.
|
|
164
|
+
this.J_ && this.J_();
|
|
165
|
+
this.P_ = undefined;
|
|
166
166
|
this.removeAllListeners();
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
if (el) {
|
|
170
|
-
this.
|
|
171
|
-
this.
|
|
172
|
-
this.
|
|
170
|
+
this.K_ && this.K_(this.widgetConfig || {});
|
|
171
|
+
this.H_ && this.H_({ firstRender: true });
|
|
172
|
+
this.P_ = legacyRender;
|
|
173
173
|
el.__widget = this;
|
|
174
174
|
}
|
|
175
175
|
} else if (el) {
|
|
176
176
|
if (prevEl) {
|
|
177
|
-
this.
|
|
177
|
+
this.I_ && this.I_();
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
if (this.
|
|
181
|
-
this.
|
|
180
|
+
if (this.Q_) {
|
|
181
|
+
this.H_ && this.H_({ firstRender: false });
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
this.
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
185
|
+
this.R_ = this.S_;
|
|
186
|
+
this.S_ = null;
|
|
187
|
+
this.Q_ = false;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
function legacyRender() {
|
|
191
|
-
if (!this.
|
|
191
|
+
if (!this.N_) {
|
|
192
192
|
this.onBeforeUpdate && this.onBeforeUpdate();
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
this.
|
|
195
|
+
this.Q_ = true;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
function modernOnDestory() {
|
|
199
|
-
if (this.
|
|
199
|
+
if (this.G_) {
|
|
200
200
|
this.onBeforeDestroy && this.onBeforeDestroy();
|
|
201
|
-
this.
|
|
202
|
-
this.
|
|
201
|
+
this.J_ && this.J_();
|
|
202
|
+
this.G_ = null;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
// Set a flag on the constructor function to make it clear this is
|
|
207
207
|
// a component so that we can short-circuit this work later
|
|
208
|
-
Component.
|
|
208
|
+
Component.B_ = true;
|
|
209
209
|
|
|
210
210
|
function State() {
|
|
211
211
|
BaseState.apply(this, arguments);
|
|
212
212
|
}
|
|
213
213
|
inherit(State, BaseState);
|
|
214
|
-
proto.
|
|
214
|
+
proto.T_ = State;
|
|
215
215
|
|
|
216
216
|
jQuery.patchComponent(window.$, proto, true /* don't throw error until used if `$` is missing*/
|
|
217
217
|
);
|
|
@@ -243,7 +243,7 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
243
243
|
if (renderer) {
|
|
244
244
|
// Add the rendering related methods as statics on the
|
|
245
245
|
// new component constructor function
|
|
246
|
-
Component.renderer = proto.
|
|
246
|
+
Component.renderer = proto.U_ = renderer;
|
|
247
247
|
Component.render = renderer.render;
|
|
248
248
|
Component.renderSync = renderer.renderSync;
|
|
249
249
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = function defineWidget(def, renderer) {
|
|
2
|
-
if (def.
|
|
2
|
+
if (def.B_) {
|
|
3
3
|
return def;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
if (renderer) {
|
|
7
7
|
return {
|
|
8
|
-
|
|
8
|
+
B_: true,
|
|
9
9
|
_isWidget: true,
|
|
10
10
|
renderer: renderer,
|
|
11
11
|
render: renderer.render,
|
|
@@ -13,6 +13,6 @@ module.exports = function defineWidget(def, renderer) {
|
|
|
13
13
|
template: renderer.template
|
|
14
14
|
};
|
|
15
15
|
} else {
|
|
16
|
-
return {
|
|
16
|
+
return { B_: true, _isWidget: true };
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var ComponentsContext = require("../../../runtime/components/ComponentsContext");
|
|
4
|
-
var getComponentsContext = ComponentsContext.
|
|
4
|
+
var getComponentsContext = ComponentsContext.V_;
|
|
5
5
|
|
|
6
6
|
module.exports = function endComponent(out, componentDef) {
|
|
7
|
-
if (componentDef.
|
|
7
|
+
if (componentDef.x_) {
|
|
8
8
|
out.w("<!--" + out.global.runtimeId + "/-->");
|
|
9
|
-
getComponentsContext(out).
|
|
9
|
+
getComponentsContext(out).z_ = componentDef.A_;
|
|
10
10
|
}
|
|
11
11
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var registry = require("@internal/components-registry");
|
|
2
2
|
|
|
3
|
-
exports.getComponentForEl = require("@internal/components-util").
|
|
4
|
-
exports.init = registry.
|
|
3
|
+
exports.getComponentForEl = require("@internal/components-util").W_;
|
|
4
|
+
exports.init = registry.X_;
|
|
5
5
|
exports.register = function (id, component) {
|
|
6
6
|
registry.r(id, function () {
|
|
7
7
|
return component;
|
|
@@ -55,23 +55,23 @@ function getSerializedGlobals($global) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function addComponentsFromContext(componentsContext, componentsToHydrate) {
|
|
58
|
-
var components = componentsContext.
|
|
58
|
+
var components = componentsContext.u_;
|
|
59
59
|
|
|
60
60
|
var len = components.length;
|
|
61
61
|
|
|
62
62
|
for (var i = 0; i < len; i++) {
|
|
63
63
|
var componentDef = components[i];
|
|
64
64
|
var id = componentDef.id;
|
|
65
|
-
var component = componentDef.
|
|
66
|
-
var flags = componentDef.
|
|
67
|
-
var isLegacy = componentDef.
|
|
65
|
+
var component = componentDef.w_;
|
|
66
|
+
var flags = componentDef.y_;
|
|
67
|
+
var isLegacy = componentDef.C_;
|
|
68
68
|
|
|
69
69
|
var state = component.state;
|
|
70
70
|
var input = component.input || 0;
|
|
71
71
|
var typeName = component.typeName;
|
|
72
|
-
var customEvents = component.
|
|
73
|
-
var scope = component.
|
|
74
|
-
var bubblingDomEvents = component.
|
|
72
|
+
var customEvents = component.Y_;
|
|
73
|
+
var scope = component.Z_;
|
|
74
|
+
var bubblingDomEvents = component.___;
|
|
75
75
|
|
|
76
76
|
var needsState;
|
|
77
77
|
var serializedProps;
|
|
@@ -79,7 +79,7 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
|
|
|
79
79
|
|
|
80
80
|
if (isLegacy) {
|
|
81
81
|
flags |= FLAG_IS_LEGACY;
|
|
82
|
-
renderBody = component.
|
|
82
|
+
renderBody = component._a_;
|
|
83
83
|
|
|
84
84
|
if (component.widgetConfig && isNotEmpty(component.widgetConfig)) {
|
|
85
85
|
serializedProps = component.widgetConfig;
|
|
@@ -93,16 +93,16 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
if (!(flags & FLAG_WILL_RERENDER_IN_BROWSER) || flags & FLAG_OLD_HYDRATE_NO_CREATE) {
|
|
96
|
-
component.
|
|
97
|
-
component.
|
|
96
|
+
component.D_ = undefined; // We don't use `delete` to avoid V8 deoptimization
|
|
97
|
+
component.S_ = undefined; // We don't use `delete` to avoid V8 deoptimization
|
|
98
98
|
component.typeName = undefined;
|
|
99
99
|
component.id = undefined;
|
|
100
|
-
component.X_ = undefined;
|
|
101
100
|
component.Y_ = undefined;
|
|
102
101
|
component.Z_ = undefined;
|
|
103
|
-
component.
|
|
102
|
+
component.___ = undefined;
|
|
104
103
|
component._b_ = undefined;
|
|
105
104
|
component._c_ = undefined;
|
|
105
|
+
component._d_ = undefined;
|
|
106
106
|
|
|
107
107
|
needsState = true;
|
|
108
108
|
|
|
@@ -139,7 +139,7 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
|
|
|
139
139
|
|
|
140
140
|
var extra = {
|
|
141
141
|
b: bubblingDomEvents,
|
|
142
|
-
d: componentDef.
|
|
142
|
+
d: componentDef._e_,
|
|
143
143
|
e: customEvents,
|
|
144
144
|
f: flags || undefined,
|
|
145
145
|
p: customEvents && scope, // Only serialize scope if we need to attach custom events
|
|
@@ -168,7 +168,7 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
|
|
|
168
168
|
components.length = 0;
|
|
169
169
|
|
|
170
170
|
// Also add any components from nested contexts
|
|
171
|
-
var nestedContexts = componentsContext.
|
|
171
|
+
var nestedContexts = componentsContext._f_;
|
|
172
172
|
if (nestedContexts !== undefined) {
|
|
173
173
|
nestedContexts.forEach(function (nestedContext) {
|
|
174
174
|
addComponentsFromContext(nestedContext, componentsToHydrate);
|
|
@@ -180,7 +180,7 @@ function getInitComponentsData(out, componentDefs) {
|
|
|
180
180
|
const len = componentDefs.length;
|
|
181
181
|
const $global = out.global;
|
|
182
182
|
const isLast = $global.f_;
|
|
183
|
-
const didSerializeComponents = $global.
|
|
183
|
+
const didSerializeComponents = $global._g_;
|
|
184
184
|
const prefix = $global.componentIdPrefix || $global.widgetIdPrefix;
|
|
185
185
|
|
|
186
186
|
if (len === 0) {
|
|
@@ -192,7 +192,7 @@ function getInitComponentsData(out, componentDefs) {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
const TYPE_INDEX = 1;
|
|
195
|
-
const typesLookup = $global.
|
|
195
|
+
const typesLookup = $global._h_ || ($global._h_ = new Map());
|
|
196
196
|
let newTypes;
|
|
197
197
|
|
|
198
198
|
for (let i = 0; i < len; i++) {
|
|
@@ -217,7 +217,7 @@ function getInitComponentsData(out, componentDefs) {
|
|
|
217
217
|
let serializedGlobals;
|
|
218
218
|
|
|
219
219
|
if (!didSerializeComponents) {
|
|
220
|
-
$global.
|
|
220
|
+
$global._g_ = true;
|
|
221
221
|
serializedGlobals = getSerializedGlobals($global);
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -231,7 +231,7 @@ function getInitComponentsData(out, componentDefs) {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
function getInitComponentsDataFromOut(out) {
|
|
234
|
-
const componentsContext = out.
|
|
234
|
+
const componentsContext = out.u_;
|
|
235
235
|
|
|
236
236
|
if (componentsContext === null) {
|
|
237
237
|
return;
|
|
@@ -254,10 +254,10 @@ function getInitComponentsDataFromOut(out) {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
function writeInitComponentsCode(out) {
|
|
257
|
-
out.script(exports.
|
|
257
|
+
out.script(exports._i_(out));
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
exports.
|
|
260
|
+
exports._i_ = function getInitComponentsCode(out, componentDefs) {
|
|
261
261
|
const initComponentsData = arguments.length === 2 ? getInitComponentsData(out, componentDefs) : getInitComponentsDataFromOut(out);
|
|
262
262
|
|
|
263
263
|
if (initComponentsData === undefined) {
|
|
@@ -270,7 +270,7 @@ exports._h_ = function getInitComponentsCode(out, componentDefs) {
|
|
|
270
270
|
return `$${componentGlobalKey}=(window.$${componentGlobalKey}||[]).concat(${safeStringify(initComponentsData)})`;
|
|
271
271
|
};
|
|
272
272
|
|
|
273
|
-
exports.
|
|
273
|
+
exports._j_ = addComponentsFromContext;
|
|
274
274
|
exports.writeInitComponentsCode = writeInitComponentsCode;
|
|
275
275
|
|
|
276
276
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Component = require("../../../runtime/components/Component");
|
|
2
2
|
var loader = require("@internal/loader");
|
|
3
|
-
var getComponentForEl = require("@internal/components-util").
|
|
3
|
+
var getComponentForEl = require("@internal/components-util").W_;
|
|
4
4
|
|
|
5
5
|
// expose legacy
|
|
6
|
-
require("@internal/components-registry").
|
|
6
|
+
require("@internal/components-registry")._k_ = exports;
|
|
7
7
|
exports.load = function (typeName) {
|
|
8
8
|
return exports.defineWidget(loader(typeName));
|
|
9
9
|
};
|
|
@@ -29,14 +29,14 @@ exports.getWidgetForEl = exports.get = function (elOrId) {
|
|
|
29
29
|
|
|
30
30
|
return getComponentForEl(el);
|
|
31
31
|
};
|
|
32
|
-
exports.initWidgets = require("@internal/components-registry").
|
|
32
|
+
exports.initWidgets = require("@internal/components-registry").X_;
|
|
33
33
|
|
|
34
34
|
// monkey patch Widget
|
|
35
35
|
if (Widget) {
|
|
36
36
|
var WidgetProto = Widget.prototype;
|
|
37
37
|
WidgetProto.setProps = function (newInput) {
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
38
|
+
this._l_ = true;
|
|
39
|
+
this._m_(newInput);
|
|
40
40
|
};
|
|
41
41
|
WidgetProto.rerender = function (newInput) {
|
|
42
42
|
if (newInput) {
|
|
@@ -55,6 +55,6 @@ RenderResult.prototype.getWidget = function () {
|
|
|
55
55
|
};
|
|
56
56
|
RenderResult.prototype.getWidgets = function () {
|
|
57
57
|
return RenderResult.prototype.getComponents.apply(this, arguments).filter(function (component) {
|
|
58
|
-
return component.
|
|
58
|
+
return component.C_;
|
|
59
59
|
});
|
|
60
60
|
};
|
|
@@ -10,5 +10,5 @@ exports.makeRenderable = exports.renderable = require("../../../runtime/renderab
|
|
|
10
10
|
exports.writeInitWidgetsCode = modernMarko.writeInitComponentsCode;
|
|
11
11
|
exports.getRenderedWidgets = exports.getRenderedWidgetIds = modernMarko.getRenderedComponents;
|
|
12
12
|
exports.getInitWidgetsCode = function (out) {
|
|
13
|
-
return modernMarko.
|
|
13
|
+
return modernMarko._i_(out);
|
|
14
14
|
};
|