marko 5.24.0 → 5.25.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/runtime/components/entry/index-browser.js +2 -6
- package/dist/runtime/components/registry/index-browser.js +444 -20
- package/dist/runtime/components/registry/index.js +1 -1
- package/dist/runtime/components/renderer.js +4 -4
- package/dist/runtime/components/update-manager.js +7 -7
- package/dist/runtime/components/util/index-browser.js +4 -4
- package/dist/runtime/components/util/index.js +2 -2
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +4 -4
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/dynamic-tag.js +4 -4
- package/dist/runtime/helpers/repeatable.js +12 -0
- package/dist/runtime/helpers/self-iterator.js +3 -0
- package/dist/runtime/helpers/style-value.js +1 -1
- package/dist/runtime/html/AsyncStream.js +15 -15
- package/dist/runtime/html/BufferedWriter.js +2 -2
- package/dist/runtime/html/create-readable/index-browser.js +1 -1
- package/dist/runtime/html/create-readable/index.js +9 -9
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +3 -3
- package/dist/runtime/html/helpers/data-marko.js +1 -1
- package/dist/runtime/html/helpers/escape-quotes.js +1 -1
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/index.js +2 -2
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/setImmediate/index-browser.js +1 -1
- package/dist/runtime/setImmediate/index-worker.js +2 -2
- package/dist/runtime/setImmediate/index.js +2 -2
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +74 -74
- package/dist/runtime/vdom/VComponent.js +3 -3
- package/dist/runtime/vdom/VDocumentFragment.js +7 -7
- package/dist/runtime/vdom/VElement.js +44 -44
- package/dist/runtime/vdom/VFragment.js +5 -5
- package/dist/runtime/vdom/VNode.js +32 -32
- package/dist/runtime/vdom/VText.js +8 -8
- package/dist/runtime/vdom/helpers/v-element.js +1 -1
- package/dist/runtime/vdom/helpers/v-text.js +1 -1
- package/dist/runtime/vdom/hot-reload.js +4 -4
- package/dist/runtime/vdom/index.js +2 -2
- package/dist/runtime/vdom/morphdom/fragment.js +4 -4
- package/dist/runtime/vdom/morphdom/helpers.js +4 -4
- package/dist/runtime/vdom/morphdom/index.js +36 -36
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +6 -6
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +14 -14
- package/docs/body-content.md +37 -18
- package/docs/typescript.md +12 -12
- package/index.d.ts +4 -2
- package/package.json +3 -3
- package/src/runtime/components/entry/index-browser.js +2 -6
- package/src/runtime/components/registry/index-browser.js +451 -27
- package/src/runtime/helpers/repeatable.js +12 -0
- package/src/runtime/helpers/self-iterator.js +3 -0
- package/src/runtime/html/AsyncStream.js +1 -1
- package/dist/runtime/components/init-components/index-browser.js +0 -453
- package/dist/runtime/components/init-components/index.js +0 -2
- package/dist/runtime/components/init-components/package.json +0 -11
- package/src/runtime/components/init-components/index-browser.js +0 -453
- package/src/runtime/components/init-components/index.js +0 -1
- package/src/runtime/components/init-components/package.json +0 -11
@@ -1,11 +1,7 @@
|
|
1
|
-
"use strict";var
|
2
|
-
require("../ComponentsContext")._S_ =
|
3
|
-
initComponents._S_;
|
1
|
+
"use strict";var registry = require("../registry");
|
4
2
|
|
5
3
|
exports.getComponentForEl = require("../util").ai_;
|
6
|
-
exports.init =
|
7
|
-
|
8
|
-
var registry = require("../registry");
|
4
|
+
exports.init = registry.aj_;
|
9
5
|
exports.register = function (id, component) {
|
10
6
|
registry.r(id, function () {
|
11
7
|
return component;
|
@@ -1,12 +1,30 @@
|
|
1
1
|
"use strict";
|
2
|
+
var warp10Finalize = require("warp10/finalize");
|
2
3
|
var queueMicrotask = require("../../queueMicrotask");
|
3
4
|
var defineComponent = require("../defineComponent");
|
4
|
-
var
|
5
|
-
|
5
|
+
var eventDelegation = require("../event-delegation");
|
6
|
+
var createFragmentNode =
|
7
|
+
require("../../vdom/morphdom/fragment").ap_;
|
8
|
+
var ComponentDef = require("../ComponentDef");
|
9
|
+
var domData = require("../dom-data");
|
10
|
+
var componentsUtil = require("../util");
|
11
|
+
var componentLookup = componentsUtil.D_;
|
12
|
+
var addComponentRootToKeyedElements =
|
13
|
+
componentsUtil.aq_;
|
14
|
+
var keyedElementsByComponentId = domData.G_;
|
15
|
+
var componentsByDOMNode = domData.F_;
|
16
|
+
var serverComponentRootNodes = {};
|
17
|
+
var serverRenderedMeta = {};
|
18
|
+
var win = window;
|
19
|
+
|
20
|
+
var DEFAULT_RUNTIME_ID = "M";
|
21
|
+
var FLAG_WILL_RERENDER_IN_BROWSER = 1;
|
22
|
+
// var FLAG_HAS_RENDER_BODY = 2;
|
6
23
|
|
7
24
|
var registered = {};
|
8
25
|
var loaded = {};
|
9
26
|
var componentTypes = {};
|
27
|
+
var deferredDefs;
|
10
28
|
var pendingDefs;
|
11
29
|
|
12
30
|
function register(type, def) {
|
@@ -22,12 +40,7 @@ function register(type, def) {
|
|
22
40
|
delete pendingDefs[type];
|
23
41
|
queueMicrotask(function () {
|
24
42
|
pendingForType.forEach(function (args) {
|
25
|
-
|
26
|
-
args[0],
|
27
|
-
args[1],
|
28
|
-
args[2],
|
29
|
-
args[3])();
|
30
|
-
|
43
|
+
tryHydrateComponent(args[0], args[1], args[2], args[3])();
|
31
44
|
});
|
32
45
|
});
|
33
46
|
}
|
@@ -59,10 +72,6 @@ function addPendingDef(def, type, meta, host, runtimeId) {
|
|
59
72
|
|
60
73
|
}
|
61
74
|
|
62
|
-
function isRegistered(type) {
|
63
|
-
return Boolean(registered[type]);
|
64
|
-
}
|
65
|
-
|
66
75
|
function load(typeName) {
|
67
76
|
var target = loaded[typeName];
|
68
77
|
if (!target) {
|
@@ -118,11 +127,6 @@ function getComponentClass(typeName) {
|
|
118
127
|
|
119
128
|
|
120
129
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
130
|
|
127
131
|
|
128
132
|
|
@@ -139,8 +143,428 @@ function createComponent(typeName, id) {
|
|
139
143
|
return new ComponentClass(id);
|
140
144
|
}
|
141
145
|
|
146
|
+
function indexServerComponentBoundaries(node, runtimeId, stack) {
|
147
|
+
var componentId;
|
148
|
+
var ownerId;
|
149
|
+
var ownerComponent;
|
150
|
+
var keyedElements;
|
151
|
+
var nextSibling;
|
152
|
+
var runtimeLength = runtimeId.length;
|
153
|
+
stack = stack || [];
|
154
|
+
|
155
|
+
node = node.firstChild;
|
156
|
+
while (node) {
|
157
|
+
nextSibling = node.nextSibling;
|
158
|
+
if (node.nodeType === 8) {
|
159
|
+
// Comment node
|
160
|
+
var commentValue = node.nodeValue;
|
161
|
+
if (commentValue.slice(0, runtimeLength) === runtimeId) {
|
162
|
+
var firstChar = commentValue[runtimeLength];
|
163
|
+
|
164
|
+
if (firstChar === "^" || firstChar === "#") {
|
165
|
+
stack.push(node);
|
166
|
+
} else if (firstChar === "/") {
|
167
|
+
var endNode = node;
|
168
|
+
var startNode = stack.pop();
|
169
|
+
var rootNode;
|
170
|
+
|
171
|
+
if (startNode.parentNode === endNode.parentNode) {
|
172
|
+
rootNode = createFragmentNode(startNode.nextSibling, endNode);
|
173
|
+
} else {
|
174
|
+
rootNode = createFragmentNode(
|
175
|
+
endNode.parentNode.firstChild,
|
176
|
+
endNode);
|
177
|
+
|
178
|
+
}
|
179
|
+
|
180
|
+
componentId = startNode.nodeValue.substring(runtimeLength + 1);
|
181
|
+
firstChar = startNode.nodeValue[runtimeLength];
|
182
|
+
|
183
|
+
if (firstChar === "^") {
|
184
|
+
var parts = componentId.split(/ /g);
|
185
|
+
var key = parts[2];
|
186
|
+
ownerId = parts[1];
|
187
|
+
componentId = parts[0];
|
188
|
+
if (ownerComponent = componentLookup[ownerId]) {
|
189
|
+
keyedElements = ownerComponent.k_;
|
190
|
+
} else {
|
191
|
+
keyedElements =
|
192
|
+
keyedElementsByComponentId[ownerId] || (
|
193
|
+
keyedElementsByComponentId[ownerId] = {});
|
194
|
+
}
|
195
|
+
addComponentRootToKeyedElements(
|
196
|
+
keyedElements,
|
197
|
+
key,
|
198
|
+
rootNode,
|
199
|
+
componentId);
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
serverComponentRootNodes[componentId] = rootNode;
|
204
|
+
|
205
|
+
startNode.parentNode.removeChild(startNode);
|
206
|
+
endNode.parentNode.removeChild(endNode);
|
207
|
+
}
|
208
|
+
}
|
209
|
+
} else if (node.nodeType === 1) {
|
210
|
+
// HTML element node
|
211
|
+
var markoKey = node.getAttribute("data-marko-key");
|
212
|
+
var markoProps = componentsUtil.an_(node);
|
213
|
+
if (markoKey) {
|
214
|
+
var separatorIndex = markoKey.indexOf(" ");
|
215
|
+
ownerId = markoKey.substring(separatorIndex + 1);
|
216
|
+
markoKey = markoKey.substring(0, separatorIndex);
|
217
|
+
if (ownerComponent = componentLookup[ownerId]) {
|
218
|
+
keyedElements = ownerComponent.k_;
|
219
|
+
} else {
|
220
|
+
keyedElements =
|
221
|
+
keyedElementsByComponentId[ownerId] || (
|
222
|
+
keyedElementsByComponentId[ownerId] = {});
|
223
|
+
}
|
224
|
+
keyedElements[markoKey] = node;
|
225
|
+
}
|
226
|
+
if (markoProps) {
|
227
|
+
Object.keys(markoProps).forEach(function (key) {
|
228
|
+
if (key.slice(0, 2) === "on") {
|
229
|
+
eventDelegation._E_(key.slice(2));
|
230
|
+
}
|
231
|
+
});
|
232
|
+
}
|
233
|
+
indexServerComponentBoundaries(node, runtimeId, stack);
|
234
|
+
}
|
235
|
+
|
236
|
+
node = nextSibling;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
function invokeComponentEventHandler(component, targetMethodName, args) {
|
241
|
+
var method = component[targetMethodName];
|
242
|
+
if (!method) {
|
243
|
+
throw Error("Method not found: " + targetMethodName);
|
244
|
+
}
|
245
|
+
|
246
|
+
method.apply(component, args);
|
247
|
+
}
|
248
|
+
|
249
|
+
function addEventListenerHelper(el, eventType, isOnce, listener) {
|
250
|
+
var eventListener = listener;
|
251
|
+
if (isOnce) {
|
252
|
+
eventListener = function (event) {
|
253
|
+
listener(event);
|
254
|
+
el.removeEventListener(eventType, eventListener);
|
255
|
+
};
|
256
|
+
}
|
257
|
+
|
258
|
+
el.addEventListener(eventType, eventListener, false);
|
259
|
+
|
260
|
+
return function remove() {
|
261
|
+
el.removeEventListener(eventType, eventListener);
|
262
|
+
};
|
263
|
+
}
|
264
|
+
|
265
|
+
function addDOMEventListeners(
|
266
|
+
component,
|
267
|
+
el,
|
268
|
+
eventType,
|
269
|
+
targetMethodName,
|
270
|
+
isOnce,
|
271
|
+
extraArgs,
|
272
|
+
handles)
|
273
|
+
{
|
274
|
+
var removeListener = addEventListenerHelper(
|
275
|
+
el,
|
276
|
+
eventType,
|
277
|
+
isOnce,
|
278
|
+
function (event) {
|
279
|
+
var args = [event, el];
|
280
|
+
if (extraArgs) {
|
281
|
+
args = extraArgs.concat(args);
|
282
|
+
}
|
283
|
+
|
284
|
+
invokeComponentEventHandler(component, targetMethodName, args);
|
285
|
+
});
|
286
|
+
|
287
|
+
handles.push(removeListener);
|
288
|
+
}
|
289
|
+
|
290
|
+
function initComponent(componentDef, host) {
|
291
|
+
var component = componentDef.h_;
|
292
|
+
|
293
|
+
component.J_();
|
294
|
+
component.Y_ = host;
|
295
|
+
|
296
|
+
var isExisting = componentDef._H_;
|
297
|
+
|
298
|
+
if (isExisting) {
|
299
|
+
component._c_();
|
300
|
+
}
|
301
|
+
|
302
|
+
var domEvents = componentDef._G_;
|
303
|
+
if (domEvents) {
|
304
|
+
var eventListenerHandles = [];
|
305
|
+
|
306
|
+
domEvents.forEach(function (domEventArgs) {
|
307
|
+
// The event mapping is for a direct DOM event (not a custom event and not for bubblign dom events)
|
308
|
+
|
309
|
+
var eventType = domEventArgs[0];
|
310
|
+
var targetMethodName = domEventArgs[1];
|
311
|
+
var eventEl = component.k_[domEventArgs[2]];
|
312
|
+
var isOnce = domEventArgs[3];
|
313
|
+
var extraArgs = domEventArgs[4];
|
314
|
+
|
315
|
+
addDOMEventListeners(
|
316
|
+
component,
|
317
|
+
eventEl,
|
318
|
+
eventType,
|
319
|
+
targetMethodName,
|
320
|
+
isOnce,
|
321
|
+
extraArgs,
|
322
|
+
eventListenerHandles);
|
323
|
+
|
324
|
+
});
|
325
|
+
|
326
|
+
if (eventListenerHandles.length) {
|
327
|
+
component.N_ = eventListenerHandles;
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
if (component.S_) {
|
332
|
+
component.I_();
|
333
|
+
} else {
|
334
|
+
component.S_ = true;
|
335
|
+
component._A_();
|
336
|
+
}
|
337
|
+
}
|
338
|
+
|
339
|
+
/**
|
340
|
+
* This method is used to initialized components associated with UI components
|
341
|
+
* rendered in the browser. While rendering UI components a "components context"
|
342
|
+
* is added to the rendering context to keep up with which components are rendered.
|
343
|
+
* When ready, the components can then be initialized by walking the component tree
|
344
|
+
* in the components context (nested components are initialized before ancestor components).
|
345
|
+
* @param {Array<marko-components/lib/ComponentDef>} componentDefs An array of ComponentDef instances
|
346
|
+
*/
|
347
|
+
function initClientRendered(componentDefs, host) {
|
348
|
+
if (!host) host = document;
|
349
|
+
// Ensure that event handlers to handle delegating events are
|
350
|
+
// always attached before initializing any components
|
351
|
+
eventDelegation.ao_(host);
|
352
|
+
var len = componentDefs.length;
|
353
|
+
var componentDef;
|
354
|
+
var i;
|
355
|
+
|
356
|
+
for (i = len; i--;) {
|
357
|
+
componentDef = componentDefs[i];
|
358
|
+
trackComponent(componentDef);
|
359
|
+
}
|
360
|
+
|
361
|
+
for (i = len; i--;) {
|
362
|
+
componentDef = componentDefs[i];
|
363
|
+
initComponent(componentDef, host);
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
/**
|
368
|
+
* This method initializes all components that were rendered on the server by iterating over all
|
369
|
+
* of the component IDs.
|
370
|
+
*/
|
371
|
+
function initServerRendered(renderedComponents, host) {
|
372
|
+
var type = typeof renderedComponents;
|
373
|
+
var globalKey = "$";
|
374
|
+
var runtimeId;
|
375
|
+
|
376
|
+
if (type !== "object") {
|
377
|
+
if (type === "string") {
|
378
|
+
runtimeId = renderedComponents;
|
379
|
+
globalKey += runtimeId + "_C";
|
380
|
+
} else {
|
381
|
+
globalKey += (runtimeId = DEFAULT_RUNTIME_ID) + "C";
|
382
|
+
}
|
383
|
+
|
384
|
+
renderedComponents = win[globalKey];
|
385
|
+
|
386
|
+
// eslint-disable-next-line no-constant-condition
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
var fakeArray = win[globalKey] = {
|
400
|
+
r: runtimeId,
|
401
|
+
concat: initServerRendered
|
402
|
+
};
|
403
|
+
|
404
|
+
// eslint-disable-next-line no-constant-condition
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
if (renderedComponents && renderedComponents.forEach) {
|
410
|
+
renderedComponents.forEach(function (renderedComponent) {
|
411
|
+
fakeArray.concat(renderedComponent);
|
412
|
+
});
|
413
|
+
}
|
414
|
+
|
415
|
+
return fakeArray;
|
416
|
+
}
|
417
|
+
|
418
|
+
var isFromSerializedGlobals = this.concat === initServerRendered;
|
419
|
+
renderedComponents = warp10Finalize(renderedComponents);
|
420
|
+
|
421
|
+
if (isFromSerializedGlobals) {
|
422
|
+
runtimeId = this.r;
|
423
|
+
host = document;
|
424
|
+
} else {
|
425
|
+
runtimeId = renderedComponents.r || DEFAULT_RUNTIME_ID;
|
426
|
+
if (!host) host = document;
|
427
|
+
|
428
|
+
// eslint-disable-next-line no-constant-condition
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
}
|
435
|
+
|
436
|
+
// eslint-disable-next-line no-constant-condition
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
var prefix = renderedComponents.p || "";
|
446
|
+
var meta = serverRenderedMeta[prefix];
|
447
|
+
var isLast = renderedComponents.l;
|
448
|
+
|
449
|
+
if (meta) {
|
450
|
+
if (isLast) {
|
451
|
+
delete serverRenderedMeta[prefix];
|
452
|
+
}
|
453
|
+
} else {
|
454
|
+
meta = {};
|
455
|
+
|
456
|
+
if (!isLast) {
|
457
|
+
serverRenderedMeta[prefix] = meta;
|
458
|
+
}
|
459
|
+
}
|
460
|
+
|
461
|
+
// Ensure that event handlers to handle delegating events are
|
462
|
+
// always attached before initializing any components
|
463
|
+
indexServerComponentBoundaries(host, runtimeId);
|
464
|
+
eventDelegation.ao_(host);
|
465
|
+
|
466
|
+
if (renderedComponents.g) {
|
467
|
+
meta.ar_ = renderedComponents.g;
|
468
|
+
}
|
469
|
+
|
470
|
+
if (renderedComponents.t) {
|
471
|
+
meta.as_ = meta.as_ ?
|
472
|
+
meta.as_.concat(renderedComponents.t) :
|
473
|
+
renderedComponents.t;
|
474
|
+
}
|
475
|
+
|
476
|
+
// hydrate components top down (leaf nodes last)
|
477
|
+
// and return an array of functions to mount these components
|
478
|
+
(renderedComponents.w || []).
|
479
|
+
map(function (componentDef) {
|
480
|
+
var typeName = meta.as_[componentDef[1]];
|
481
|
+
|
482
|
+
return registered[typeName] ?
|
483
|
+
tryHydrateComponent(componentDef, meta, host, runtimeId) :
|
484
|
+
addPendingDef(componentDef, typeName, meta, host, runtimeId);
|
485
|
+
}).
|
486
|
+
reverse().
|
487
|
+
forEach(tryInvoke);
|
488
|
+
|
489
|
+
return this;
|
490
|
+
}
|
491
|
+
|
492
|
+
function tryHydrateComponent(rawDef, meta, host, runtimeId) {
|
493
|
+
var componentDef = ComponentDef._P_(
|
494
|
+
rawDef,
|
495
|
+
meta.as_,
|
496
|
+
meta.ar_,
|
497
|
+
exports);
|
498
|
+
|
499
|
+
var mount = hydrateComponentAndGetMount(componentDef, host);
|
500
|
+
|
501
|
+
if (!mount) {
|
502
|
+
// hydrateComponentAndGetMount will return false if there is not rootNode
|
503
|
+
// for the component. If this is the case, we'll wait until the
|
504
|
+
// DOM has fully loaded to attempt to init the component again.
|
505
|
+
if (deferredDefs) {
|
506
|
+
deferredDefs.push(componentDef);
|
507
|
+
} else {
|
508
|
+
deferredDefs = [componentDef];
|
509
|
+
document.addEventListener("DOMContentLoaded", function () {
|
510
|
+
indexServerComponentBoundaries(host, runtimeId);
|
511
|
+
deferredDefs.
|
512
|
+
map(function (componentDef) {
|
513
|
+
return hydrateComponentAndGetMount(componentDef, host);
|
514
|
+
}).
|
515
|
+
reverse().
|
516
|
+
forEach(tryInvoke);
|
517
|
+
deferredDefs = undefined;
|
518
|
+
});
|
519
|
+
}
|
520
|
+
}
|
521
|
+
|
522
|
+
return mount;
|
523
|
+
}
|
524
|
+
|
525
|
+
function hydrateComponentAndGetMount(componentDef, host) {
|
526
|
+
var componentId = componentDef.id;
|
527
|
+
var component = componentDef.h_;
|
528
|
+
var rootNode = serverComponentRootNodes[componentId];
|
529
|
+
var renderResult;
|
530
|
+
|
531
|
+
if (rootNode) {
|
532
|
+
delete serverComponentRootNodes[componentId];
|
533
|
+
|
534
|
+
component.L_ = rootNode;
|
535
|
+
componentsByDOMNode.set(rootNode, component);
|
536
|
+
|
537
|
+
if (componentDef._J_ & FLAG_WILL_RERENDER_IN_BROWSER) {
|
538
|
+
component.Y_ = host;
|
539
|
+
renderResult = component._q_(component.R_, true);
|
540
|
+
trackComponent(componentDef);
|
541
|
+
return function mount() {
|
542
|
+
renderResult.afterInsert(host);
|
543
|
+
};
|
544
|
+
} else {
|
545
|
+
trackComponent(componentDef);
|
546
|
+
}
|
547
|
+
|
548
|
+
return function mount() {
|
549
|
+
initComponent(componentDef, host);
|
550
|
+
};
|
551
|
+
}
|
552
|
+
}
|
553
|
+
|
554
|
+
function trackComponent(componentDef) {
|
555
|
+
var component = componentDef.h_;
|
556
|
+
if (component) {
|
557
|
+
componentLookup[component.id] = component;
|
558
|
+
}
|
559
|
+
}
|
560
|
+
|
561
|
+
function tryInvoke(fn) {
|
562
|
+
if (fn) fn();
|
563
|
+
}
|
564
|
+
|
142
565
|
exports.r = register;
|
143
|
-
exports.aw_ = getComponentClass;
|
144
566
|
exports._Q_ = createComponent;
|
145
|
-
exports.at_ =
|
146
|
-
exports.
|
567
|
+
exports.at_ = getComponentClass;
|
568
|
+
exports.aj_ = win.$initComponents = initServerRendered;
|
569
|
+
|
570
|
+
require("../ComponentsContext")._S_ = initClientRendered;
|
@@ -5,7 +5,7 @@ var ComponentsContext = require("./ComponentsContext");
|
|
5
5
|
var getComponentsContext = ComponentsContext.o_;
|
6
6
|
var registry = require("./registry");
|
7
7
|
var copyProps = require("raptor-util/copyProps");
|
8
|
-
var isServer = componentsUtil.
|
8
|
+
var isServer = componentsUtil.au_ === true;
|
9
9
|
var beginComponent = require("./beginComponent");
|
10
10
|
var endComponent = require("./endComponent");
|
11
11
|
|
@@ -42,7 +42,7 @@ function handleBeginAsync(event) {
|
|
42
42
|
asyncOut.c(
|
43
43
|
parentOut.g_,
|
44
44
|
parentOut.i_,
|
45
|
-
parentOut.
|
45
|
+
parentOut.av_);
|
46
46
|
|
47
47
|
}
|
48
48
|
|
@@ -106,7 +106,7 @@ renderingLogic)
|
|
106
106
|
// that were provided.
|
107
107
|
if (parentComponentDef) {
|
108
108
|
// console.log('componentArgs:', componentArgs);
|
109
|
-
customEvents = out.
|
109
|
+
customEvents = out.av_;
|
110
110
|
|
111
111
|
if (key != null) {
|
112
112
|
id = resolveComponentKey(key.toString(), parentComponentDef);
|
@@ -190,7 +190,7 @@ renderingLogic)
|
|
190
190
|
// We put a placeholder element in the output stream to ensure that the existing
|
191
191
|
// DOM node is matched up correctly when using morphdom. We flag the VElement
|
192
192
|
// node to track that it is a preserve marker
|
193
|
-
out.
|
193
|
+
out.aw_(component);
|
194
194
|
globalComponentsContext._V_[id] = true;
|
195
195
|
component.J_(); // The component is no longer dirty so reset internal flags
|
196
196
|
return;
|
@@ -4,7 +4,7 @@ var updatesScheduled = false;
|
|
4
4
|
var batchStack = []; // A stack of batched updates
|
5
5
|
var unbatchedQueue = []; // Used for scheduled batched updates
|
6
6
|
|
7
|
-
var setImmediate = require("../setImmediate").
|
7
|
+
var setImmediate = require("../setImmediate").ax_;
|
8
8
|
|
9
9
|
/**
|
10
10
|
* This function is called when we schedule the update of "unbatched"
|
@@ -54,7 +54,7 @@ function batchUpdate(func) {
|
|
54
54
|
// batched update completes we invoke the "afterUpdate"
|
55
55
|
// event listeners.
|
56
56
|
var batch = {
|
57
|
-
|
57
|
+
ay_: null
|
58
58
|
};
|
59
59
|
|
60
60
|
batchStack.push(batch);
|
@@ -65,8 +65,8 @@ function batchUpdate(func) {
|
|
65
65
|
try {
|
66
66
|
// Update all of the components that where queued up
|
67
67
|
// in this batch (if any)
|
68
|
-
if (batch.
|
69
|
-
updateComponents(batch.
|
68
|
+
if (batch.ay_) {
|
69
|
+
updateComponents(batch.ay_);
|
70
70
|
}
|
71
71
|
} finally {
|
72
72
|
// Now that we have completed the update of all the components
|
@@ -89,10 +89,10 @@ function queueComponentUpdate(component) {
|
|
89
89
|
// We default the batch queue to null to avoid creating an Array instance
|
90
90
|
// unnecessarily. If it is null then we create a new Array, otherwise
|
91
91
|
// we push it onto the existing Array queue
|
92
|
-
if (batch.
|
93
|
-
batch.
|
92
|
+
if (batch.ay_) {
|
93
|
+
batch.ay_.push(component);
|
94
94
|
} else {
|
95
|
-
batch.
|
95
|
+
batch.ay_ = [component];
|
96
96
|
}
|
97
97
|
} else {
|
98
98
|
// We are not within a batched update. We need to schedule a batch update
|
@@ -27,7 +27,7 @@ function getComponentForEl(el, host) {
|
|
27
27
|
component = componentsByDOMNode.get(node);
|
28
28
|
}
|
29
29
|
} else if (vElement = vElementsByDOMNode.get(node)) {
|
30
|
-
component = vElement.
|
30
|
+
component = vElement.az_;
|
31
31
|
}
|
32
32
|
|
33
33
|
if (component) {
|
@@ -103,7 +103,7 @@ function getMarkoPropsFromEl(el) {
|
|
103
103
|
var virtualProps;
|
104
104
|
|
105
105
|
if (vElement) {
|
106
|
-
virtualProps = vElement.
|
106
|
+
virtualProps = vElement.aA_;
|
107
107
|
} else {
|
108
108
|
virtualProps = vPropsByDOMNode.get(el);
|
109
109
|
if (!virtualProps) {
|
@@ -170,10 +170,10 @@ componentId)
|
|
170
170
|
exports.am_ = runtimeId;
|
171
171
|
exports.D_ = componentLookup;
|
172
172
|
exports.ai_ = getComponentForEl;
|
173
|
-
exports.
|
173
|
+
exports.aB_ = destroyComponentForNode;
|
174
174
|
exports.E_ = destroyNodeRecursive;
|
175
175
|
exports._U_ = nextComponentIdProvider;
|
176
176
|
exports._D_ = attachBubblingEvent;
|
177
177
|
exports.an_ = getMarkoPropsFromEl;
|
178
178
|
exports.aq_ = addComponentRootToKeyedElements;
|
179
|
-
exports.
|
179
|
+
exports.aC_ = normalizeComponentKey;
|
@@ -53,9 +53,9 @@ extraArgs)
|
|
53
53
|
}
|
54
54
|
|
55
55
|
exports._U_ = nextComponentIdProvider;
|
56
|
-
exports.
|
56
|
+
exports.au_ = true;
|
57
57
|
exports._D_ = attachBubblingEvent;
|
58
|
-
exports.
|
58
|
+
exports.aB_ = function noop() {};
|
59
59
|
exports.E_ = function noop() {};
|
60
60
|
|
61
61
|
// eslint-disable-next-line no-constant-condition
|
@@ -1,12 +1,12 @@
|
|
1
1
|
"use strict";var extend = require("raptor-util/extend");
|
2
2
|
var componentsUtil = require("./components/util");
|
3
|
-
var destroyComponentForNode = componentsUtil.
|
3
|
+
var destroyComponentForNode = componentsUtil.aB_;
|
4
4
|
var destroyNodeRecursive = componentsUtil.E_;
|
5
5
|
var helpers = require("./vdom/morphdom/helpers");
|
6
6
|
|
7
|
-
var insertBefore = helpers.
|
8
|
-
var insertAfter = helpers.
|
9
|
-
var removeChild = helpers.
|
7
|
+
var insertBefore = helpers.aE_;
|
8
|
+
var insertAfter = helpers.aF_;
|
9
|
+
var removeChild = helpers.aG_;
|
10
10
|
|
11
11
|
function resolveEl(el) {
|
12
12
|
if (typeof el == "string") {
|
@@ -6,7 +6,7 @@ var dashToCamelLookup = Object.create(null);
|
|
6
6
|
/**
|
7
7
|
* Helper for converting camelCase to dash-case.
|
8
8
|
*/
|
9
|
-
exports.
|
9
|
+
exports.aH_ = function camelToDashCase(name) {
|
10
10
|
var nameDashed = camelToDashLookup[name];
|
11
11
|
if (!nameDashed) {
|
12
12
|
nameDashed = camelToDashLookup[name] = name.
|
@@ -24,7 +24,7 @@ exports.aK_ = function camelToDashCase(name) {
|
|
24
24
|
/**
|
25
25
|
* Helper for converting dash-case to camelCase.
|
26
26
|
*/
|
27
|
-
exports.
|
27
|
+
exports.aI_ = function dashToCamelCase(name) {
|
28
28
|
var nameCamel = dashToCamelLookup[name];
|
29
29
|
if (!nameCamel) {
|
30
30
|
nameCamel = dashToCamelLookup[name] = name.replace(
|