marko 5.39.50 → 5.39.51
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/runtime/helpers/dynamic-tag.js +11 -4
- package/dist/runtime/helpers/load-tag.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/dom.js +1 -1
- package/dist/runtime/helpers/tags-compat/dom.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/html-debug.js +3 -1
- package/dist/runtime/helpers/tags-compat/html-debug.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/html.js +3 -1
- package/dist/runtime/helpers/tags-compat/html.mjs +1 -1
- package/dist/runtime/helpers/tags-compat/runtime-dom.js +50 -51
- package/dist/runtime/helpers/tags-compat/runtime-html.js +18 -20
- package/dist/runtime/html/AsyncStream.js +10 -10
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/renderable.js +1 -1
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +65 -65
- package/dist/runtime/vdom/VComment.js +7 -7
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +6 -6
- package/dist/runtime/vdom/VElement.js +30 -30
- package/dist/runtime/vdom/VFragment.js +5 -5
- package/dist/runtime/vdom/VNode.js +29 -29
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/const-element.js +3 -3
- package/dist/runtime/vdom/hot-reload.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +3 -3
- package/dist/runtime/vdom/morphdom/helpers.js +1 -1
- package/dist/runtime/vdom/morphdom/index.js +34 -34
- package/dist/runtime/vdom/vdom.js +15 -15
- package/dist/translator/index.js +2 -6
- package/dist/translator/tag/custom-tag.js +1 -2
- package/dist/translator/tag/util.js +5 -2
- package/dist/translator/util/get-component-files.js +1 -1
- package/index.d.ts +3 -8
- package/package.json +4 -4
- package/src/runtime/helpers/dynamic-tag.js +10 -3
- package/src/runtime/helpers/tags-compat/dom-debug.js +1 -1
- package/src/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
- package/src/runtime/helpers/tags-compat/dom.js +1 -1
- package/src/runtime/helpers/tags-compat/dom.mjs +1 -1
- package/src/runtime/helpers/tags-compat/html-debug.js +3 -1
- package/src/runtime/helpers/tags-compat/html-debug.mjs +1 -1
- package/src/runtime/helpers/tags-compat/html.js +3 -1
- package/src/runtime/helpers/tags-compat/html.mjs +1 -1
- package/src/runtime/helpers/tags-compat/runtime-dom.js +40 -41
- package/src/runtime/helpers/tags-compat/runtime-html.js +14 -16
- package/src/translator/index.js +2 -6
- package/src/translator/tag/custom-tag.js +1 -2
- package/src/translator/tag/util.js +5 -2
|
@@ -69,9 +69,7 @@ customEvents)
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
var renderer =
|
|
73
|
-
tag._ || (
|
|
74
|
-
tag.renderer ? tag.renderer.renderer || tag.renderer : tag.render);
|
|
72
|
+
var renderer = getRenderer(tag);
|
|
75
73
|
var render = tag && tag.renderBody || tag;
|
|
76
74
|
|
|
77
75
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -244,4 +242,13 @@ function addEvents(componentDef, customEvents, props) {
|
|
|
244
242
|
return result;
|
|
245
243
|
}
|
|
246
244
|
|
|
247
|
-
|
|
245
|
+
// A template's Class renderer, from any of the shapes a template or component takes.
|
|
246
|
+
function getRenderer(tag) {
|
|
247
|
+
var renderer =
|
|
248
|
+
tag._ || (
|
|
249
|
+
tag.renderer ? tag.renderer.renderer || tag.renderer : tag.render);
|
|
250
|
+
return typeof renderer === "function" ? renderer : undefined;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
module.exports.br_ = getRenderer;
|
|
254
|
+
module.exports.bs_ = CLASS_EVENT_MARKER;
|
|
@@ -99,7 +99,7 @@ triggers)
|
|
|
99
99
|
// Within Tags content the Tags writer places it apart from what a `@catch` drops,
|
|
100
100
|
// and leaves the page's own entry to the page.
|
|
101
101
|
function writeLoadAsset(out, typeId, assetFlush, triggers) {
|
|
102
|
-
var tagsCompat = exports.
|
|
102
|
+
var tagsCompat = exports.bt_;
|
|
103
103
|
if (tagsCompat && tagsCompat.getChunk()) {
|
|
104
104
|
tagsCompat.writeLoadAsset(typeId, assetFlush, triggers);
|
|
105
105
|
} else {
|
|
@@ -28,7 +28,7 @@ exports.f = (id, factory) => {
|
|
|
28
28
|
return factory(
|
|
29
29
|
_n_[scope.m5h] ||
|
|
30
30
|
_n_[scope.m5c] ||
|
|
31
|
-
scope.
|
|
31
|
+
scope.bu_
|
|
32
32
|
).apply(this, arguments);
|
|
33
33
|
}
|
|
34
34
|
);
|
|
@@ -59,13 +59,13 @@ exports.p = function (domCompat) {
|
|
|
59
59
|
// Revive a serialized class-method event reference into a live handler, looked
|
|
60
60
|
// up lazily since a split parent may not be hydrated yet when the child resumes.
|
|
61
61
|
domCompat.setClassEventResolver(function (value, scope) {
|
|
62
|
-
if (Array.isArray(value) && value[0] === dynamicTag.
|
|
62
|
+
if (Array.isArray(value) && value[0] === dynamicTag.bs_) {
|
|
63
63
|
const componentId = value[1];
|
|
64
64
|
const method = value[2];
|
|
65
65
|
const extraArgs = value[3];
|
|
66
66
|
return function () {
|
|
67
67
|
const component =
|
|
68
|
-
_n_[componentId] || scope.
|
|
68
|
+
_n_[componentId] || scope.bu_;
|
|
69
69
|
const args = extraArgs ? extraArgs.slice() : [];
|
|
70
70
|
for (let i = 0; i < arguments.length; i++) {
|
|
71
71
|
args.push(arguments[i]);
|
|
@@ -76,7 +76,7 @@ exports.p = function (domCompat) {
|
|
|
76
76
|
return value;
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
Component.prototype.
|
|
79
|
+
Component.prototype.bv_ =
|
|
80
80
|
Component.prototype.aG_;
|
|
81
81
|
Component.prototype.aG_ = function (customEvents, scopeId) {
|
|
82
82
|
for (const customEvent of customEvents) {
|
|
@@ -86,7 +86,7 @@ exports.p = function (domCompat) {
|
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
this.
|
|
89
|
+
this.bv_(customEvents, scopeId);
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
const defDeserialize = ComponentDef._F_;
|
|
@@ -108,7 +108,7 @@ exports.p = function (domCompat) {
|
|
|
108
108
|
|
|
109
109
|
out.bf("1", component, !newNode);
|
|
110
110
|
if (newNode) {
|
|
111
|
-
out.node({
|
|
111
|
+
out.node({ bw_: () => newNode });
|
|
112
112
|
}
|
|
113
113
|
out.ef();
|
|
114
114
|
},
|
|
@@ -137,55 +137,52 @@ exports.p = function (domCompat) {
|
|
|
137
137
|
}));
|
|
138
138
|
|
|
139
139
|
const rendererCache = new WeakMap();
|
|
140
|
+
const createFragment = () => _m_();
|
|
141
|
+
const createTemplate = domCompat.createTemplate(
|
|
142
|
+
(scope, renderer, input) =>
|
|
143
|
+
renderAndMorph(scope, renderer, undefined, input),
|
|
144
|
+
createFragment
|
|
145
|
+
);
|
|
146
|
+
const createContent = domCompat.createContent(
|
|
147
|
+
(scope, renderBody, args) =>
|
|
148
|
+
renderAndMorph(scope, undefined, renderBody, args),
|
|
149
|
+
createFragment
|
|
150
|
+
);
|
|
140
151
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
renderer._ ||
|
|
157
|
-
renderer.render ||
|
|
158
|
-
renderer.renderer && renderer.renderer.renderer ||
|
|
159
|
-
renderer.renderer;
|
|
160
|
-
|
|
161
|
-
if (!domCompat.isRenderer(rendererFromAnywhere || renderer)) {
|
|
162
|
-
newRenderer = rendererCache.get(renderer);
|
|
163
|
-
if (!newRenderer) {
|
|
164
|
-
newRenderer = domCompat.createRenderer(
|
|
165
|
-
(scope, input) =>
|
|
166
|
-
renderAndMorph(scope, rendererFromAnywhere, renderer, input),
|
|
167
|
-
() => _m_()
|
|
168
|
-
);
|
|
169
|
-
domCompat.setRendererId(newRenderer, renderer);
|
|
170
|
-
rendererCache.set(renderer, newRenderer);
|
|
171
|
-
}
|
|
152
|
+
// The Tags runtime hands over what no Tags renderer matches: a Class template becomes a
|
|
153
|
+
// Tags template, and Class content becomes Tags content that morphs in its Class output.
|
|
154
|
+
domCompat.setClassAPIRenderer((value) => {
|
|
155
|
+
if (domCompat.isRenderer(value)) return value;
|
|
156
|
+
let renderer = rendererCache.get(value);
|
|
157
|
+
if (!renderer) {
|
|
158
|
+
const classRenderer = dynamicTag.br_(value);
|
|
159
|
+
const renderBody = value.renderBody || value;
|
|
160
|
+
if (classRenderer) {
|
|
161
|
+
renderer = createTemplate(value, classRenderer);
|
|
162
|
+
} else if (renderBody === noopRenderer) {
|
|
163
|
+
// Content only the server can render resumes as noop; its markup stays.
|
|
164
|
+
renderer = domCompat.createRenderer(renderBody, createFragment);
|
|
165
|
+
} else if (typeof renderBody === "function") {
|
|
166
|
+
renderer = createContent(renderBody);
|
|
172
167
|
}
|
|
168
|
+
rendererCache.set(value, renderer);
|
|
173
169
|
}
|
|
174
|
-
return
|
|
175
|
-
}
|
|
170
|
+
return renderer;
|
|
171
|
+
});
|
|
176
172
|
|
|
177
173
|
domCompat.init(noopRenderer);
|
|
178
174
|
|
|
179
175
|
function renderAndMorph(scope, renderer, renderBody, input) {
|
|
180
|
-
const
|
|
176
|
+
const $global = domCompat.getGlobal(scope);
|
|
177
|
+
const out = defaultCreateOut($global);
|
|
181
178
|
let host = domCompat.getStartNode(scope);
|
|
182
179
|
let rootNode = host.fragment;
|
|
183
180
|
if (!rootNode) {
|
|
184
181
|
// An inert/server only class child has no client instance in
|
|
185
182
|
// ___componentLookup; once it has been re-rendered once it is tracked on
|
|
186
183
|
// the scope instead.
|
|
187
|
-
const component = scope.
|
|
188
|
-
_n_[scope.m5c] || scope.
|
|
184
|
+
const component = scope.bu_ =
|
|
185
|
+
_n_[scope.m5c] || scope.bu_;
|
|
189
186
|
if (component) {
|
|
190
187
|
rootNode = component._G_;
|
|
191
188
|
} else {
|
|
@@ -202,19 +199,20 @@ exports.p = function (domCompat) {
|
|
|
202
199
|
host = rootNode.startNode;
|
|
203
200
|
domCompat.setScopeNodes(scope, rootNode.startNode, rootNode.endNode);
|
|
204
201
|
}
|
|
205
|
-
const existingComponent = scope.
|
|
206
|
-
const componentsContext = T_(out);
|
|
207
|
-
const globalComponentsContext = componentsContext.p_;
|
|
202
|
+
const existingComponent = scope.bu_;
|
|
208
203
|
let customEvents;
|
|
209
204
|
let normalizedInput;
|
|
210
|
-
|
|
205
|
+
// Cleared so this render gets a context of its own: sharing a Class parent's
|
|
206
|
+
// mid-render context would reset its rerender state for later siblings.
|
|
207
|
+
$global.b_ = undefined;
|
|
208
|
+
const componentsContext = T_(out);
|
|
209
|
+
componentsContext.p_.aC_ = existingComponent;
|
|
211
210
|
out.sync();
|
|
212
211
|
if (renderer) {
|
|
213
|
-
const [rawInput] = input;
|
|
214
212
|
normalizedInput = {};
|
|
215
213
|
|
|
216
|
-
for (const key in
|
|
217
|
-
const value =
|
|
214
|
+
for (const key in input) {
|
|
215
|
+
const value = input[key];
|
|
218
216
|
if (/^on[-A-Z]/.test(key) && typeof value === "function") {
|
|
219
217
|
(customEvents || (customEvents = {}))[toCustomEventName(key)] = [
|
|
220
218
|
value];
|
|
@@ -226,7 +224,8 @@ exports.p = function (domCompat) {
|
|
|
226
224
|
|
|
227
225
|
renderer(normalizedInput, out);
|
|
228
226
|
} else {
|
|
229
|
-
|
|
227
|
+
// Content a native tag renders has no arguments.
|
|
228
|
+
normalizedInput = input && input[0];
|
|
230
229
|
RenderBodyComponent({ renderBody, args: input }, out);
|
|
231
230
|
}
|
|
232
231
|
|
|
@@ -240,7 +239,7 @@ exports.p = function (domCompat) {
|
|
|
240
239
|
component._G_ = rootNode;
|
|
241
240
|
component.P_ = normalizedInput;
|
|
242
241
|
component.X_ = customEvents;
|
|
243
|
-
scope.
|
|
242
|
+
scope.bu_ = component;
|
|
244
243
|
});
|
|
245
244
|
}
|
|
246
245
|
|
|
@@ -17,12 +17,10 @@ registerClassFunction(out.global, id, fn, component.id);
|
|
|
17
17
|
|
|
18
18
|
exports.p = function (htmlCompat) {
|
|
19
19
|
registerClassFunction = htmlCompat.registerClassFunction;
|
|
20
|
-
require("../load-tag").
|
|
20
|
+
require("../load-tag").bt_ = htmlCompat;
|
|
21
21
|
const writersByGlobal = new WeakMap();
|
|
22
22
|
const boundaryModeByRenderer = new WeakMap();
|
|
23
|
-
const
|
|
24
|
-
const isMarko5 = (fn) =>
|
|
25
|
-
typeof fn !== "function" || !htmlCompat.isTagsAPI(fn);
|
|
23
|
+
const isMarko5 = (fn) => !htmlCompat.isRenderer(fn);
|
|
26
24
|
const writeClassAPIResultToTagsAPI = ({ out }) => {
|
|
27
25
|
const { writer } = out._state;
|
|
28
26
|
htmlCompat.write(writer._content);
|
|
@@ -166,7 +164,7 @@ exports.p = function (htmlCompat) {
|
|
|
166
164
|
!willRerender && (
|
|
167
165
|
hasBridgedClassEvent(input) ||
|
|
168
166
|
htmlCompat.hasPendingClassFunctions(out.global)),
|
|
169
|
-
out._state.
|
|
167
|
+
out._state.bx_
|
|
170
168
|
);
|
|
171
169
|
out.ef();
|
|
172
170
|
},
|
|
@@ -184,28 +182,24 @@ exports.p = function (htmlCompat) {
|
|
|
184
182
|
{}
|
|
185
183
|
);
|
|
186
184
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const renderer5 =
|
|
193
|
-
tag._ ||
|
|
194
|
-
tag.render ||
|
|
195
|
-
tag.renderer && tag.renderer.renderer ||
|
|
196
|
-
tag.renderer;
|
|
185
|
+
// The Tags runtime hands over what no Tags renderer matches: a Class template or
|
|
186
|
+
// Class content becomes a Tags renderer that writes its Class output in place.
|
|
187
|
+
htmlCompat.setClassAPIRenderer((tag) => {
|
|
188
|
+
if (htmlCompat.isRenderer(tag)) return tag;
|
|
189
|
+
const renderer5 = dynamicTag5.br_(tag);
|
|
197
190
|
const renderBody5 = tag.renderBody || tag;
|
|
198
191
|
|
|
199
|
-
if (!renderer5
|
|
192
|
+
if (!renderer5) {
|
|
193
|
+
if (typeof renderBody5 !== "function") return;
|
|
200
194
|
htmlCompat.registerRenderBody(renderBody5);
|
|
201
195
|
}
|
|
202
|
-
|
|
196
|
+
const render = (input, ...args) => {
|
|
203
197
|
// tags to class
|
|
204
198
|
const $global = htmlCompat.$global();
|
|
205
199
|
htmlCompat.ensureState($global);
|
|
206
200
|
const out = defaultCreateOut($global);
|
|
207
201
|
// Class content settling later still renders within this tags content.
|
|
208
|
-
out._state.
|
|
202
|
+
out._state.bx_ = htmlCompat.getChunk();
|
|
209
203
|
const branchId = htmlCompat.nextScopeId();
|
|
210
204
|
let forceBoundary = boundaryModeByRenderer.get(tag);
|
|
211
205
|
|
|
@@ -260,9 +254,13 @@ exports.p = function (htmlCompat) {
|
|
|
260
254
|
|
|
261
255
|
if (async !== false) {
|
|
262
256
|
async = true;
|
|
263
|
-
htmlCompat.fork(
|
|
257
|
+
htmlCompat.fork(branchId, out, writeClassAPIResultToTagsAPI);
|
|
264
258
|
}
|
|
265
259
|
};
|
|
260
|
+
// Keyed by the value, which resumes as itself for a template and as a noop for
|
|
261
|
+
// content, so live content's first client render replaces the server's markup.
|
|
262
|
+
htmlCompat.setRendererId(render, tag);
|
|
263
|
+
return render;
|
|
266
264
|
});
|
|
267
265
|
|
|
268
266
|
return function register(id, renderer, boundaryMode) {
|
|
@@ -290,7 +288,7 @@ function hasBridgedClassEvent(input) {
|
|
|
290
288
|
const value = input[key];
|
|
291
289
|
if (
|
|
292
290
|
Array.isArray(value) &&
|
|
293
|
-
value[0] === dynamicTag5.
|
|
291
|
+
value[0] === dynamicTag5.bs_)
|
|
294
292
|
{
|
|
295
293
|
return true;
|
|
296
294
|
}
|
|
@@ -8,7 +8,7 @@ var markoAttr = require("./helpers/data-marko");
|
|
|
8
8
|
var escapeXmlHelper = require("./helpers/escape-xml");
|
|
9
9
|
var StringWriter = require("./StringWriter");
|
|
10
10
|
var escapeXmlOrNullish = escapeXmlHelper.x;
|
|
11
|
-
var escapeXmlString = escapeXmlHelper.
|
|
11
|
+
var escapeXmlString = escapeXmlHelper.by_;
|
|
12
12
|
var missingSetTimeout = typeof setTimeout !== "function";
|
|
13
13
|
|
|
14
14
|
function noop() {}
|
|
@@ -104,7 +104,7 @@ function AsyncStream(global, writer, parentOut) {
|
|
|
104
104
|
this.ac_ = null;
|
|
105
105
|
this.ad_ = null;
|
|
106
106
|
this.bf_ = null;
|
|
107
|
-
this.
|
|
107
|
+
this.bz_ = false;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
AsyncStream.DEFAULT_TIMEOUT = 10000;
|
|
@@ -124,11 +124,11 @@ AsyncStream.enableAsyncStackTrace = function () {
|
|
|
124
124
|
|
|
125
125
|
var proto = AsyncStream.prototype = {
|
|
126
126
|
constructor: AsyncStream,
|
|
127
|
-
|
|
127
|
+
bA_: true,
|
|
128
128
|
|
|
129
129
|
[Symbol.asyncIterator]() {
|
|
130
|
-
if (this.
|
|
131
|
-
return this.
|
|
130
|
+
if (this.bB_) {
|
|
131
|
+
return this.bB_;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
const originalWriter = this._state.writer;
|
|
@@ -235,7 +235,7 @@ var proto = AsyncStream.prototype = {
|
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
return this.
|
|
238
|
+
return this.bB_ = {
|
|
239
239
|
next: iteratorNextFn,
|
|
240
240
|
return: iteratorReturnFn,
|
|
241
241
|
throw: iteratorReturnFn,
|
|
@@ -247,7 +247,7 @@ var proto = AsyncStream.prototype = {
|
|
|
247
247
|
|
|
248
248
|
toReadable() {
|
|
249
249
|
let cancelled = false;
|
|
250
|
-
this.
|
|
250
|
+
this.bC_ = (this.bC_ || 0) + 1;
|
|
251
251
|
return new ReadableStream({
|
|
252
252
|
start: async (ctrl) => {
|
|
253
253
|
const encoder = new TextEncoder();
|
|
@@ -277,7 +277,7 @@ var proto = AsyncStream.prototype = {
|
|
|
277
277
|
|
|
278
278
|
// Every consumer shares one iterator, so only the last one out may end
|
|
279
279
|
// it; the others are still reading.
|
|
280
|
-
if (! --this.
|
|
280
|
+
if (! --this.bC_) {
|
|
281
281
|
this[Symbol.asyncIterator]().return();
|
|
282
282
|
}
|
|
283
283
|
}
|
|
@@ -372,7 +372,7 @@ var proto = AsyncStream.prototype = {
|
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
this._lastCount++;
|
|
375
|
-
newStream.
|
|
375
|
+
newStream.bz_ = true;
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
name = options.name;
|
|
@@ -492,7 +492,7 @@ var proto = AsyncStream.prototype = {
|
|
|
492
492
|
parentOut._handleChildDone(this);
|
|
493
493
|
}
|
|
494
494
|
} else {
|
|
495
|
-
if (childOut.
|
|
495
|
+
if (childOut.bz_) {
|
|
496
496
|
this._lastCount--;
|
|
497
497
|
}
|
|
498
498
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var attrHelper = require("./attr");
|
|
3
|
-
var notEmptyAttr = attrHelper.
|
|
4
|
-
var isEmptyAttrValue = attrHelper.
|
|
3
|
+
var notEmptyAttr = attrHelper.bD_;
|
|
4
|
+
var isEmptyAttrValue = attrHelper.bE_;
|
|
5
5
|
var classHelper = require("./class-attr");
|
|
6
6
|
var styleHelper = require("./style-attr");
|
|
7
7
|
// Characters that end or break an attribute name in the HTML parser.
|