lwc 2.7.4 → 2.10.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/engine-dom/esm/es2017/engine-dom.js +663 -470
- package/dist/engine-dom/iife/es2017/engine-dom.js +663 -470
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +544 -426
- package/dist/engine-dom/iife/es5/engine-dom.js +816 -594
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +624 -497
- package/dist/engine-dom/umd/es2017/engine-dom.js +663 -470
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +544 -426
- package/dist/engine-dom/umd/es5/engine-dom.js +816 -594
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +624 -497
- package/dist/engine-server/commonjs/es2017/engine-server.js +427 -299
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +427 -299
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +8 -8
- package/LICENSE +0 -10
|
@@ -255,7 +255,7 @@ const KEY__SCOPED_CSS = '$scoped$';
|
|
|
255
255
|
// The following list contains a mix of both void elements from the HTML and the XML namespace
|
|
256
256
|
// without distinction.
|
|
257
257
|
|
|
258
|
-
const VOID_ELEMENTS = ['area', 'base', 'br', 'circle', 'col', 'ellipse', 'feBlend', 'feColorMatrix', 'feFuncR', 'feFuncG', 'feFuncB', 'feFuncA', 'feImage', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDropShadow', 'feFlood', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'feSpecularLighting', 'feTile', 'feTurbulence', 'fePointLight', 'embed', 'hr', 'img', 'input', 'keygen', 'line', 'link', 'menuitem', 'meta', 'param', 'rect', 'source', 'track', 'wbr'];
|
|
258
|
+
const VOID_ELEMENTS = ['area', 'base', 'br', 'circle', 'col', 'ellipse', 'feBlend', 'feColorMatrix', 'feFuncR', 'feFuncG', 'feFuncB', 'feFuncA', 'feImage', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDropShadow', 'feFlood', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'feSpecularLighting', 'feTile', 'feTurbulence', 'fePointLight', 'embed', 'hr', 'img', 'input', 'keygen', 'line', 'link', 'menuitem', 'meta', 'param', 'path', 'rect', 'source', 'track', 'wbr'];
|
|
259
259
|
const VOID_ELEMENTS_SET = new Set(VOID_ELEMENTS);
|
|
260
260
|
|
|
261
261
|
function isVoidElement(name) {
|
|
@@ -339,7 +339,17 @@ function htmlPropertyToAttribute(propName) {
|
|
|
339
339
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
340
340
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
341
341
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
342
|
-
|
|
342
|
+
/*
|
|
343
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
344
|
+
* All rights reserved.
|
|
345
|
+
* SPDX-License-Identifier: MIT
|
|
346
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
347
|
+
*/
|
|
348
|
+
// Increment whenever the LWC template compiler changes
|
|
349
|
+
|
|
350
|
+
const LWC_VERSION = "2.10.0";
|
|
351
|
+
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
352
|
+
/** version: 2.10.0 */
|
|
343
353
|
|
|
344
354
|
/*
|
|
345
355
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -388,14 +398,15 @@ if (typeof CustomEvent !== 'function') {
|
|
|
388
398
|
|
|
389
399
|
|
|
390
400
|
const features = {
|
|
391
|
-
|
|
392
|
-
ENABLE_HMR: null,
|
|
393
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
401
|
+
DISABLE_MIXED_SHADOW_MODE: null,
|
|
394
402
|
ENABLE_ELEMENT_PATCH: null,
|
|
395
403
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
396
|
-
|
|
404
|
+
ENABLE_HMR: null,
|
|
397
405
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
406
|
+
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
407
|
+
ENABLE_NODE_LIST_PATCH: null,
|
|
398
408
|
ENABLE_NODE_PATCH: null,
|
|
409
|
+
ENABLE_REACTIVE_SETTER: null,
|
|
399
410
|
ENABLE_WIRE_SYNC_EMIT: null
|
|
400
411
|
};
|
|
401
412
|
|
|
@@ -460,7 +471,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
460
471
|
setFeatureFlag(name, value);
|
|
461
472
|
}
|
|
462
473
|
}
|
|
463
|
-
/** version: 2.
|
|
474
|
+
/** version: 2.10.0 */
|
|
464
475
|
|
|
465
476
|
/* proxy-compat-disable */
|
|
466
477
|
|
|
@@ -513,7 +524,21 @@ function guid() {
|
|
|
513
524
|
|
|
514
525
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
515
526
|
} // Borrowed from Vue template compiler.
|
|
516
|
-
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
function flattenStylesheets(stylesheets) {
|
|
530
|
+
const list = [];
|
|
531
|
+
|
|
532
|
+
for (const stylesheet of stylesheets) {
|
|
533
|
+
if (!Array.isArray(stylesheet)) {
|
|
534
|
+
list.push(stylesheet);
|
|
535
|
+
} else {
|
|
536
|
+
list.push(...flattenStylesheets(stylesheet));
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
return list;
|
|
541
|
+
} //
|
|
517
542
|
// Primitives
|
|
518
543
|
//
|
|
519
544
|
|
|
@@ -3314,6 +3339,47 @@ function getDecoratorsMeta(Ctor) {
|
|
|
3314
3339
|
const meta = signedDecoratorToMetaMap.get(Ctor);
|
|
3315
3340
|
return isUndefined$1(meta) ? defaultMeta : meta;
|
|
3316
3341
|
}
|
|
3342
|
+
/*
|
|
3343
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3344
|
+
* All rights reserved.
|
|
3345
|
+
* SPDX-License-Identifier: MIT
|
|
3346
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3347
|
+
*/
|
|
3348
|
+
|
|
3349
|
+
|
|
3350
|
+
let warned = false;
|
|
3351
|
+
|
|
3352
|
+
if (process.env.NODE_ENV === 'development') {
|
|
3353
|
+
// @ts-ignore
|
|
3354
|
+
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
3355
|
+
warned = false;
|
|
3356
|
+
};
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
function checkVersionMismatch(func, type) {
|
|
3360
|
+
const versionMatcher = func.toString().match(LWC_VERSION_COMMENT_REGEX);
|
|
3361
|
+
|
|
3362
|
+
if (!isNull(versionMatcher) && !warned) {
|
|
3363
|
+
const version = versionMatcher[1];
|
|
3364
|
+
const [major, minor] = version.split('.');
|
|
3365
|
+
const [expectedMajor, expectedMinor] = LWC_VERSION.split('.');
|
|
3366
|
+
|
|
3367
|
+
if (major !== expectedMajor || minor !== expectedMinor) {
|
|
3368
|
+
warned = true; // only warn once to avoid flooding the console
|
|
3369
|
+
// stylesheets and templates do not have user-meaningful names, but components do
|
|
3370
|
+
|
|
3371
|
+
const friendlyName = type === 'component' ? `${type} ${func.name}` : type;
|
|
3372
|
+
logError(`LWC WARNING: current engine is v${LWC_VERSION}, but ${friendlyName} was compiled with v${version}.\nPlease update your compiled code or LWC engine so that the versions match.\nNo further warnings will appear.`);
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
/*
|
|
3377
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3378
|
+
* All rights reserved.
|
|
3379
|
+
* SPDX-License-Identifier: MIT
|
|
3380
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3381
|
+
*/
|
|
3382
|
+
|
|
3317
3383
|
|
|
3318
3384
|
const signedTemplateSet = new Set();
|
|
3319
3385
|
|
|
@@ -3326,6 +3392,16 @@ signedTemplateSet.add(defaultEmptyTemplate);
|
|
|
3326
3392
|
function isTemplateRegistered(tpl) {
|
|
3327
3393
|
return signedTemplateSet.has(tpl);
|
|
3328
3394
|
}
|
|
3395
|
+
|
|
3396
|
+
function checkTemplateVersionMismatch(template) {
|
|
3397
|
+
checkVersionMismatch(template, 'template');
|
|
3398
|
+
|
|
3399
|
+
if (!isUndefined$1(template.stylesheets)) {
|
|
3400
|
+
for (const stylesheet of flattenStylesheets(template.stylesheets)) {
|
|
3401
|
+
checkVersionMismatch(stylesheet, 'stylesheet');
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3329
3405
|
/**
|
|
3330
3406
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3331
3407
|
* will prevent this function from being imported by userland code.
|
|
@@ -3333,6 +3409,10 @@ function isTemplateRegistered(tpl) {
|
|
|
3333
3409
|
|
|
3334
3410
|
|
|
3335
3411
|
function registerTemplate(tpl) {
|
|
3412
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3413
|
+
checkTemplateVersionMismatch(tpl);
|
|
3414
|
+
}
|
|
3415
|
+
|
|
3336
3416
|
signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
|
|
3337
3417
|
// assignment of templates easily, without too much transformation
|
|
3338
3418
|
|
|
@@ -3557,20 +3637,6 @@ const activeTemplates = new WeakMap();
|
|
|
3557
3637
|
const activeComponents = new WeakMap();
|
|
3558
3638
|
const activeStyles = new WeakMap();
|
|
3559
3639
|
|
|
3560
|
-
function flattenStylesheets(stylesheets) {
|
|
3561
|
-
const list = [];
|
|
3562
|
-
|
|
3563
|
-
for (const stylesheet of stylesheets) {
|
|
3564
|
-
if (!Array.isArray(stylesheet)) {
|
|
3565
|
-
list.push(stylesheet);
|
|
3566
|
-
} else {
|
|
3567
|
-
list.push(...flattenStylesheets(stylesheet));
|
|
3568
|
-
}
|
|
3569
|
-
}
|
|
3570
|
-
|
|
3571
|
-
return list;
|
|
3572
|
-
}
|
|
3573
|
-
|
|
3574
3640
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
3575
3641
|
if (process.env.NODE_ENV === 'production') {
|
|
3576
3642
|
// this method should never leak to prod
|
|
@@ -4347,156 +4413,268 @@ function applyStaticStyleAttribute(vnode) {
|
|
|
4347
4413
|
*/
|
|
4348
4414
|
|
|
4349
4415
|
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
move: insertNode,
|
|
4362
|
-
remove: removeNode
|
|
4363
|
-
};
|
|
4364
|
-
const CommentHook = {
|
|
4365
|
-
create: vnode => {
|
|
4366
|
-
const {
|
|
4367
|
-
owner,
|
|
4368
|
-
text
|
|
4369
|
-
} = vnode;
|
|
4370
|
-
const elm = createComment$1(text);
|
|
4371
|
-
linkNodeToShadow(elm, owner);
|
|
4372
|
-
vnode.elm = elm;
|
|
4373
|
-
},
|
|
4374
|
-
update: updateNodeHook,
|
|
4375
|
-
insert: insertNode,
|
|
4376
|
-
move: insertNode,
|
|
4377
|
-
remove: removeNode
|
|
4378
|
-
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4379
|
-
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4380
|
-
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
4381
|
-
// which breaks some invariants. For that reason, we have the following for any
|
|
4382
|
-
// Custom Element that is inserted via a template.
|
|
4383
|
-
|
|
4384
|
-
const ElementHook = {
|
|
4385
|
-
create: vnode => {
|
|
4386
|
-
const {
|
|
4387
|
-
sel,
|
|
4388
|
-
owner,
|
|
4389
|
-
data: {
|
|
4390
|
-
svg
|
|
4391
|
-
}
|
|
4392
|
-
} = vnode;
|
|
4393
|
-
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4394
|
-
const elm = createElement$1(sel, namespace);
|
|
4395
|
-
linkNodeToShadow(elm, owner);
|
|
4396
|
-
fallbackElmHook(elm, vnode);
|
|
4397
|
-
vnode.elm = elm;
|
|
4398
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
4399
|
-
},
|
|
4400
|
-
update: (oldVnode, vnode) => {
|
|
4401
|
-
patchElementPropsAndAttrs$1(oldVnode, vnode);
|
|
4402
|
-
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
4403
|
-
},
|
|
4404
|
-
insert: (vnode, parentNode, referenceNode) => {
|
|
4405
|
-
insertNode(vnode, parentNode, referenceNode);
|
|
4406
|
-
createChildrenHook(vnode);
|
|
4407
|
-
},
|
|
4408
|
-
move: insertNode,
|
|
4409
|
-
remove: (vnode, parentNode) => {
|
|
4410
|
-
removeNode(vnode, parentNode);
|
|
4411
|
-
removeChildren(vnode);
|
|
4416
|
+
function patchChildren(c1, c2, parent) {
|
|
4417
|
+
if (hasDynamicChildren(c2)) {
|
|
4418
|
+
updateDynamicChildren(c1, c2, parent);
|
|
4419
|
+
} else {
|
|
4420
|
+
updateStaticChildren(c1, c2, parent);
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
|
|
4424
|
+
function patch(n1, n2) {
|
|
4425
|
+
if (n1 === n2) {
|
|
4426
|
+
return;
|
|
4412
4427
|
}
|
|
4413
|
-
};
|
|
4414
|
-
const CustomElementHook = {
|
|
4415
|
-
create: vnode => {
|
|
4416
|
-
const {
|
|
4417
|
-
sel,
|
|
4418
|
-
owner
|
|
4419
|
-
} = vnode;
|
|
4420
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4421
|
-
/**
|
|
4422
|
-
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4423
|
-
* with a callback as the first argument, we could implement a more advanced
|
|
4424
|
-
* mechanism that only passes that argument if the constructor is known to be
|
|
4425
|
-
* an upgradable custom element.
|
|
4426
|
-
*/
|
|
4427
|
-
|
|
4428
|
-
let vm;
|
|
4429
|
-
const elm = new UpgradableConstructor(elm => {
|
|
4430
|
-
// the custom element from the registry is expecting an upgrade callback
|
|
4431
|
-
vm = createViewModelHook(elm, vnode);
|
|
4432
|
-
});
|
|
4433
|
-
linkNodeToShadow(elm, owner);
|
|
4434
|
-
vnode.elm = elm;
|
|
4435
4428
|
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4429
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4430
|
+
if (!isSameVnode(n1, n2)) {
|
|
4431
|
+
throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
|
|
4432
|
+
sel: n1.sel,
|
|
4433
|
+
key: n1.key
|
|
4434
|
+
}) + ', ' + JSON.stringify({
|
|
4435
|
+
sel: n2.sel,
|
|
4436
|
+
key: n2.key
|
|
4437
|
+
}));
|
|
4440
4438
|
}
|
|
4439
|
+
}
|
|
4441
4440
|
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4441
|
+
switch (n2.type) {
|
|
4442
|
+
case 0
|
|
4443
|
+
/* Text */
|
|
4444
|
+
:
|
|
4445
|
+
patchText(n1, n2);
|
|
4446
|
+
break;
|
|
4447
4447
|
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
// will happen, but in native, it does allocate the light dom
|
|
4448
|
+
case 1
|
|
4449
|
+
/* Comment */
|
|
4450
|
+
:
|
|
4451
|
+
patchComment(n1, n2);
|
|
4452
|
+
break;
|
|
4454
4453
|
|
|
4454
|
+
case 2
|
|
4455
|
+
/* Element */
|
|
4456
|
+
:
|
|
4457
|
+
patchElement(n1, n2);
|
|
4458
|
+
break;
|
|
4455
4459
|
|
|
4456
|
-
|
|
4460
|
+
case 3
|
|
4461
|
+
/* CustomElement */
|
|
4462
|
+
:
|
|
4463
|
+
patchCustomElement(n1, n2);
|
|
4464
|
+
break;
|
|
4465
|
+
}
|
|
4466
|
+
}
|
|
4457
4467
|
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4468
|
+
function mount(node, parent, anchor) {
|
|
4469
|
+
switch (node.type) {
|
|
4470
|
+
case 0
|
|
4471
|
+
/* Text */
|
|
4472
|
+
:
|
|
4473
|
+
mountText(node, parent, anchor);
|
|
4474
|
+
break;
|
|
4475
|
+
|
|
4476
|
+
case 1
|
|
4477
|
+
/* Comment */
|
|
4478
|
+
:
|
|
4479
|
+
mountComment(node, parent, anchor);
|
|
4480
|
+
break;
|
|
4463
4481
|
|
|
4482
|
+
case 2
|
|
4483
|
+
/* Element */
|
|
4484
|
+
:
|
|
4485
|
+
mountElement(node, parent, anchor);
|
|
4486
|
+
break;
|
|
4464
4487
|
|
|
4465
|
-
|
|
4488
|
+
case 3
|
|
4489
|
+
/* CustomElement */
|
|
4490
|
+
:
|
|
4491
|
+
mountCustomElement(node, parent, anchor);
|
|
4492
|
+
break;
|
|
4493
|
+
}
|
|
4494
|
+
}
|
|
4495
|
+
|
|
4496
|
+
function patchText(n1, n2) {
|
|
4497
|
+
n2.elm = n1.elm;
|
|
4498
|
+
|
|
4499
|
+
if (n2.text !== n1.text) {
|
|
4500
|
+
updateTextContent(n2);
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
|
|
4504
|
+
function mountText(node, parent, anchor) {
|
|
4505
|
+
const {
|
|
4506
|
+
owner
|
|
4507
|
+
} = node;
|
|
4508
|
+
const textNode = node.elm = createText$1(node.text);
|
|
4509
|
+
linkNodeToShadow(textNode, owner);
|
|
4510
|
+
insertNode(textNode, parent, anchor);
|
|
4511
|
+
}
|
|
4512
|
+
|
|
4513
|
+
function patchComment(n1, n2) {
|
|
4514
|
+
n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
4515
|
+
// it is the case today.
|
|
4516
|
+
|
|
4517
|
+
if (n2.text !== n1.text) {
|
|
4518
|
+
updateTextContent(n2);
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4521
|
+
|
|
4522
|
+
function mountComment(node, parent, anchor) {
|
|
4523
|
+
const {
|
|
4524
|
+
owner
|
|
4525
|
+
} = node;
|
|
4526
|
+
const commentNode = node.elm = createComment$1(node.text);
|
|
4527
|
+
linkNodeToShadow(commentNode, owner);
|
|
4528
|
+
insertNode(commentNode, parent, anchor);
|
|
4529
|
+
}
|
|
4530
|
+
|
|
4531
|
+
function mountElement(vnode, parent, anchor) {
|
|
4532
|
+
const {
|
|
4533
|
+
sel,
|
|
4534
|
+
owner,
|
|
4535
|
+
data: {
|
|
4536
|
+
svg
|
|
4466
4537
|
}
|
|
4467
|
-
}
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4538
|
+
} = vnode;
|
|
4539
|
+
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4540
|
+
const elm = createElement$1(sel, namespace);
|
|
4541
|
+
linkNodeToShadow(elm, owner);
|
|
4542
|
+
fallbackElmHook(elm, vnode);
|
|
4543
|
+
vnode.elm = elm;
|
|
4544
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4545
|
+
insertNode(elm, parent, anchor);
|
|
4546
|
+
mountVNodes(vnode.children, elm, null);
|
|
4547
|
+
}
|
|
4471
4548
|
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
}
|
|
4549
|
+
function patchElement(n1, n2) {
|
|
4550
|
+
const elm = n2.elm = n1.elm;
|
|
4551
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
4552
|
+
patchChildren(n1.children, n2.children, elm);
|
|
4553
|
+
}
|
|
4478
4554
|
|
|
4479
|
-
|
|
4555
|
+
function mountCustomElement(vnode, parent, anchor) {
|
|
4556
|
+
const {
|
|
4557
|
+
sel,
|
|
4558
|
+
owner
|
|
4559
|
+
} = vnode;
|
|
4560
|
+
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4561
|
+
/**
|
|
4562
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4563
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
4564
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
4565
|
+
* an upgradable custom element.
|
|
4566
|
+
*/
|
|
4567
|
+
|
|
4568
|
+
let vm;
|
|
4569
|
+
const elm = new UpgradableConstructor(elm => {
|
|
4570
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
4571
|
+
vm = createViewModelHook(elm, vnode);
|
|
4572
|
+
});
|
|
4573
|
+
linkNodeToShadow(elm, owner);
|
|
4574
|
+
vnode.elm = elm;
|
|
4575
|
+
vnode.vm = vm;
|
|
4576
|
+
|
|
4577
|
+
if (vm) {
|
|
4578
|
+
allocateChildren(vnode, vm);
|
|
4579
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
4580
|
+
throw new TypeError(`Incorrect Component Constructor`);
|
|
4581
|
+
}
|
|
4582
|
+
|
|
4583
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4584
|
+
insertNode(elm, parent, anchor);
|
|
4585
|
+
|
|
4586
|
+
if (vm) {
|
|
4587
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4588
|
+
assert.isTrue(vm.state === 0
|
|
4589
|
+
/* created */
|
|
4590
|
+
, `${vm} cannot be recycled.`);
|
|
4480
4591
|
}
|
|
4481
4592
|
|
|
4482
|
-
|
|
4593
|
+
runConnectedCallback(vm);
|
|
4594
|
+
}
|
|
4595
|
+
|
|
4596
|
+
mountVNodes(vnode.children, elm, null);
|
|
4597
|
+
|
|
4598
|
+
if (vm) {
|
|
4599
|
+
appendVM(vm);
|
|
4600
|
+
}
|
|
4601
|
+
}
|
|
4602
|
+
|
|
4603
|
+
function patchCustomElement(n1, n2) {
|
|
4604
|
+
const elm = n2.elm = n1.elm;
|
|
4605
|
+
const vm = n2.vm = n1.vm;
|
|
4606
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
4607
|
+
|
|
4608
|
+
if (!isUndefined$1(vm)) {
|
|
4609
|
+
// in fallback mode, the allocation will always set children to
|
|
4610
|
+
// empty and delegate the real allocation to the slot elements
|
|
4611
|
+
allocateChildren(n2, vm);
|
|
4612
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
4613
|
+
// will happen, but in native, it does allocate the light dom
|
|
4614
|
+
|
|
4615
|
+
|
|
4616
|
+
patchChildren(n1.children, n2.children, elm);
|
|
4483
4617
|
|
|
4484
|
-
|
|
4485
|
-
|
|
4618
|
+
if (!isUndefined$1(vm)) {
|
|
4619
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
4620
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
4621
|
+
rerenderVM(vm);
|
|
4622
|
+
}
|
|
4623
|
+
}
|
|
4624
|
+
|
|
4625
|
+
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
4626
|
+
for (; start < end; ++start) {
|
|
4627
|
+
const vnode = vnodes[start];
|
|
4628
|
+
|
|
4629
|
+
if (isVNode(vnode)) {
|
|
4630
|
+
mount(vnode, parent, anchor);
|
|
4486
4631
|
}
|
|
4487
|
-
}
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4632
|
+
}
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
function unmount(vnode, parent, doRemove = false) {
|
|
4636
|
+
const {
|
|
4637
|
+
type,
|
|
4638
|
+
elm
|
|
4639
|
+
} = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
4640
|
+
// subtree root, is the only element worth unmounting from the subtree.
|
|
4641
|
+
|
|
4642
|
+
if (doRemove) {
|
|
4643
|
+
removeNode(elm, parent);
|
|
4644
|
+
}
|
|
4492
4645
|
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4646
|
+
switch (type) {
|
|
4647
|
+
case 2
|
|
4648
|
+
/* Element */
|
|
4649
|
+
:
|
|
4650
|
+
unmountVNodes(vnode.children, elm);
|
|
4651
|
+
break;
|
|
4652
|
+
|
|
4653
|
+
case 3
|
|
4654
|
+
/* CustomElement */
|
|
4655
|
+
:
|
|
4656
|
+
{
|
|
4657
|
+
const {
|
|
4658
|
+
vm
|
|
4659
|
+
} = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
|
|
4660
|
+
// children.
|
|
4661
|
+
|
|
4662
|
+
if (!isUndefined$1(vm)) {
|
|
4663
|
+
removeVM(vm);
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
|
|
4669
|
+
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
4670
|
+
for (; start < end; ++start) {
|
|
4671
|
+
const ch = vnodes[start];
|
|
4672
|
+
|
|
4673
|
+
if (isVNode(ch)) {
|
|
4674
|
+
unmount(ch, parent, doRemove);
|
|
4497
4675
|
}
|
|
4498
4676
|
}
|
|
4499
|
-
}
|
|
4677
|
+
}
|
|
4500
4678
|
|
|
4501
4679
|
function isVNode(vnode) {
|
|
4502
4680
|
return vnode != null;
|
|
@@ -4541,43 +4719,41 @@ function linkNodeToShadow(elm, owner) {
|
|
|
4541
4719
|
}
|
|
4542
4720
|
}
|
|
4543
4721
|
|
|
4544
|
-
function
|
|
4722
|
+
function updateTextContent(vnode) {
|
|
4545
4723
|
const {
|
|
4546
4724
|
elm,
|
|
4547
4725
|
text
|
|
4548
4726
|
} = vnode;
|
|
4549
4727
|
|
|
4550
|
-
if (
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
}
|
|
4728
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4729
|
+
unlockDomMutation();
|
|
4730
|
+
}
|
|
4554
4731
|
|
|
4555
|
-
|
|
4732
|
+
setText$1(elm, text);
|
|
4556
4733
|
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
}
|
|
4734
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4735
|
+
lockDomMutation();
|
|
4560
4736
|
}
|
|
4561
4737
|
}
|
|
4562
4738
|
|
|
4563
|
-
function insertNode(
|
|
4739
|
+
function insertNode(node, parent, anchor) {
|
|
4564
4740
|
if (process.env.NODE_ENV !== 'production') {
|
|
4565
4741
|
unlockDomMutation();
|
|
4566
4742
|
}
|
|
4567
4743
|
|
|
4568
|
-
insert$1(
|
|
4744
|
+
insert$1(node, parent, anchor);
|
|
4569
4745
|
|
|
4570
4746
|
if (process.env.NODE_ENV !== 'production') {
|
|
4571
4747
|
lockDomMutation();
|
|
4572
4748
|
}
|
|
4573
4749
|
}
|
|
4574
4750
|
|
|
4575
|
-
function removeNode(
|
|
4751
|
+
function removeNode(node, parent) {
|
|
4576
4752
|
if (process.env.NODE_ENV !== 'production') {
|
|
4577
4753
|
unlockDomMutation();
|
|
4578
4754
|
}
|
|
4579
4755
|
|
|
4580
|
-
remove$1(
|
|
4756
|
+
remove$1(node, parent);
|
|
4581
4757
|
|
|
4582
4758
|
if (process.env.NODE_ENV !== 'production') {
|
|
4583
4759
|
lockDomMutation();
|
|
@@ -4622,11 +4798,13 @@ function fallbackElmHook(elm, vnode) {
|
|
|
4622
4798
|
) {
|
|
4623
4799
|
// this element will now accept any manual content inserted into it
|
|
4624
4800
|
observeElementChildNodes(elm);
|
|
4625
|
-
}
|
|
4626
|
-
// into each element from the template, so they can be styled accordingly.
|
|
4627
|
-
|
|
4801
|
+
}
|
|
4628
4802
|
|
|
4629
|
-
|
|
4803
|
+
if (!isUndefined$1(stylesheetToken)) {
|
|
4804
|
+
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
4805
|
+
// into each element from the template, so they can be styled accordingly.
|
|
4806
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4807
|
+
}
|
|
4630
4808
|
}
|
|
4631
4809
|
|
|
4632
4810
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4648,14 +4826,6 @@ function fallbackElmHook(elm, vnode) {
|
|
|
4648
4826
|
}
|
|
4649
4827
|
}
|
|
4650
4828
|
|
|
4651
|
-
function patchChildren(parent, oldCh, newCh) {
|
|
4652
|
-
if (hasDynamicChildren(newCh)) {
|
|
4653
|
-
updateDynamicChildren(parent, oldCh, newCh);
|
|
4654
|
-
} else {
|
|
4655
|
-
updateStaticChildren(parent, oldCh, newCh);
|
|
4656
|
-
}
|
|
4657
|
-
}
|
|
4658
|
-
|
|
4659
4829
|
function allocateChildren(vnode, vm) {
|
|
4660
4830
|
// A component with slots will re-render because:
|
|
4661
4831
|
// 1- There is a change of the internal state.
|
|
@@ -4713,7 +4883,9 @@ function createViewModelHook(elm, vnode) {
|
|
|
4713
4883
|
} = owner.context; // when running in synthetic shadow mode, we need to set the shadowToken value
|
|
4714
4884
|
// into each element from the template, so they can be styled accordingly.
|
|
4715
4885
|
|
|
4716
|
-
|
|
4886
|
+
if (!isUndefined$1(stylesheetToken)) {
|
|
4887
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4888
|
+
}
|
|
4717
4889
|
}
|
|
4718
4890
|
|
|
4719
4891
|
vm = createVM(elm, ctor, {
|
|
@@ -4729,40 +4901,6 @@ function createViewModelHook(elm, vnode) {
|
|
|
4729
4901
|
return vm;
|
|
4730
4902
|
}
|
|
4731
4903
|
|
|
4732
|
-
function createChildrenHook(vnode) {
|
|
4733
|
-
const {
|
|
4734
|
-
elm,
|
|
4735
|
-
children
|
|
4736
|
-
} = vnode;
|
|
4737
|
-
|
|
4738
|
-
for (let j = 0; j < children.length; ++j) {
|
|
4739
|
-
const ch = children[j];
|
|
4740
|
-
|
|
4741
|
-
if (ch != null) {
|
|
4742
|
-
ch.hook.create(ch);
|
|
4743
|
-
ch.hook.insert(ch, elm, null);
|
|
4744
|
-
}
|
|
4745
|
-
}
|
|
4746
|
-
}
|
|
4747
|
-
|
|
4748
|
-
function removeChildren(vnode) {
|
|
4749
|
-
// this method only needs to search on child vnodes from template
|
|
4750
|
-
// to trigger the remove hook just in case some of those children
|
|
4751
|
-
// are custom elements.
|
|
4752
|
-
const {
|
|
4753
|
-
children,
|
|
4754
|
-
elm
|
|
4755
|
-
} = vnode;
|
|
4756
|
-
|
|
4757
|
-
for (let j = 0, len = children.length; j < len; ++j) {
|
|
4758
|
-
const ch = children[j];
|
|
4759
|
-
|
|
4760
|
-
if (!isNull(ch)) {
|
|
4761
|
-
ch.hook.remove(ch, elm);
|
|
4762
|
-
}
|
|
4763
|
-
}
|
|
4764
|
-
}
|
|
4765
|
-
|
|
4766
4904
|
function allocateInSlot(vm, children) {
|
|
4767
4905
|
var _a;
|
|
4768
4906
|
|
|
@@ -4859,28 +4997,7 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
|
4859
4997
|
return map;
|
|
4860
4998
|
}
|
|
4861
4999
|
|
|
4862
|
-
function
|
|
4863
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
4864
|
-
const ch = vnodes[startIdx];
|
|
4865
|
-
|
|
4866
|
-
if (isVNode(ch)) {
|
|
4867
|
-
ch.hook.create(ch);
|
|
4868
|
-
ch.hook.insert(ch, parentElm, before);
|
|
4869
|
-
}
|
|
4870
|
-
}
|
|
4871
|
-
}
|
|
4872
|
-
|
|
4873
|
-
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
4874
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
4875
|
-
const ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
4876
|
-
|
|
4877
|
-
if (isVNode(ch)) {
|
|
4878
|
-
ch.hook.remove(ch, parentElm);
|
|
4879
|
-
}
|
|
4880
|
-
}
|
|
4881
|
-
}
|
|
4882
|
-
|
|
4883
|
-
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
5000
|
+
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
4884
5001
|
let oldStartIdx = 0;
|
|
4885
5002
|
let newStartIdx = 0;
|
|
4886
5003
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4894,6 +5011,7 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
|
4894
5011
|
let idxInOld;
|
|
4895
5012
|
let elmToMove;
|
|
4896
5013
|
let before;
|
|
5014
|
+
let clonedOldCh = false;
|
|
4897
5015
|
|
|
4898
5016
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
4899
5017
|
if (!isVNode(oldStartVnode)) {
|
|
@@ -4905,23 +5023,23 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
|
4905
5023
|
} else if (!isVNode(newEndVnode)) {
|
|
4906
5024
|
newEndVnode = newCh[--newEndIdx];
|
|
4907
5025
|
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4908
|
-
|
|
5026
|
+
patch(oldStartVnode, newStartVnode);
|
|
4909
5027
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4910
5028
|
newStartVnode = newCh[++newStartIdx];
|
|
4911
5029
|
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4912
|
-
|
|
5030
|
+
patch(oldEndVnode, newEndVnode);
|
|
4913
5031
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4914
5032
|
newEndVnode = newCh[--newEndIdx];
|
|
4915
5033
|
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4916
5034
|
// Vnode moved right
|
|
4917
|
-
|
|
4918
|
-
|
|
5035
|
+
patch(oldStartVnode, newEndVnode);
|
|
5036
|
+
insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
|
|
4919
5037
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4920
5038
|
newEndVnode = newCh[--newEndIdx];
|
|
4921
5039
|
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4922
5040
|
// Vnode moved left
|
|
4923
|
-
|
|
4924
|
-
newStartVnode.
|
|
5041
|
+
patch(oldEndVnode, newStartVnode);
|
|
5042
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
4925
5043
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4926
5044
|
newStartVnode = newCh[++newStartIdx];
|
|
4927
5045
|
} else {
|
|
@@ -4933,8 +5051,7 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
|
4933
5051
|
|
|
4934
5052
|
if (isUndefined$1(idxInOld)) {
|
|
4935
5053
|
// New element
|
|
4936
|
-
newStartVnode.
|
|
4937
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
5054
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4938
5055
|
newStartVnode = newCh[++newStartIdx];
|
|
4939
5056
|
} else {
|
|
4940
5057
|
elmToMove = oldCh[idxInOld];
|
|
@@ -4942,12 +5059,22 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
|
4942
5059
|
if (isVNode(elmToMove)) {
|
|
4943
5060
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4944
5061
|
// New element
|
|
4945
|
-
newStartVnode.
|
|
4946
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
5062
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4947
5063
|
} else {
|
|
4948
|
-
|
|
5064
|
+
patch(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
|
|
5065
|
+
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
5066
|
+
// so we only care about the `oldCh` object inside this function.
|
|
5067
|
+
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
5068
|
+
// and only clone once.
|
|
5069
|
+
|
|
5070
|
+
if (!clonedOldCh) {
|
|
5071
|
+
clonedOldCh = true;
|
|
5072
|
+
oldCh = [...oldCh];
|
|
5073
|
+
} // We've already cloned at least once, so it's no longer read-only
|
|
5074
|
+
|
|
5075
|
+
|
|
4949
5076
|
oldCh[idxInOld] = undefined;
|
|
4950
|
-
|
|
5077
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4951
5078
|
}
|
|
4952
5079
|
}
|
|
4953
5080
|
|
|
@@ -4968,65 +5095,55 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
|
4968
5095
|
} while (!isVNode(n) && i < newChEnd);
|
|
4969
5096
|
|
|
4970
5097
|
before = isVNode(n) ? n.elm : null;
|
|
4971
|
-
|
|
5098
|
+
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4972
5099
|
} else {
|
|
4973
|
-
|
|
5100
|
+
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4974
5101
|
}
|
|
4975
5102
|
}
|
|
4976
5103
|
}
|
|
4977
5104
|
|
|
4978
|
-
function updateStaticChildren(
|
|
4979
|
-
const
|
|
4980
|
-
const
|
|
5105
|
+
function updateStaticChildren(c1, c2, parent) {
|
|
5106
|
+
const c1Length = c1.length;
|
|
5107
|
+
const c2Length = c2.length;
|
|
4981
5108
|
|
|
4982
|
-
if (
|
|
5109
|
+
if (c1Length === 0) {
|
|
4983
5110
|
// the old list is empty, we can directly insert anything new
|
|
4984
|
-
|
|
5111
|
+
mountVNodes(c2, parent, null);
|
|
4985
5112
|
return;
|
|
4986
5113
|
}
|
|
4987
5114
|
|
|
4988
|
-
if (
|
|
5115
|
+
if (c2Length === 0) {
|
|
4989
5116
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4990
5117
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4991
|
-
|
|
5118
|
+
unmountVNodes(c1, parent, true);
|
|
4992
5119
|
return;
|
|
4993
5120
|
} // if the old list is not empty, the new list MUST have the same
|
|
4994
5121
|
// amount of nodes, that's why we call this static children
|
|
4995
5122
|
|
|
4996
5123
|
|
|
4997
|
-
let
|
|
5124
|
+
let anchor = null;
|
|
4998
5125
|
|
|
4999
|
-
for (let i =
|
|
5000
|
-
const
|
|
5001
|
-
const
|
|
5126
|
+
for (let i = c2Length - 1; i >= 0; i -= 1) {
|
|
5127
|
+
const n1 = c1[i];
|
|
5128
|
+
const n2 = c2[i];
|
|
5002
5129
|
|
|
5003
|
-
if (
|
|
5004
|
-
if (isVNode(
|
|
5005
|
-
if (isVNode(
|
|
5006
|
-
// both vnodes
|
|
5007
|
-
|
|
5008
|
-
|
|
5130
|
+
if (n2 !== n1) {
|
|
5131
|
+
if (isVNode(n1)) {
|
|
5132
|
+
if (isVNode(n2)) {
|
|
5133
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
5134
|
+
patch(n1, n2);
|
|
5135
|
+
anchor = n2.elm;
|
|
5009
5136
|
} else {
|
|
5010
5137
|
// removing the old vnode since the new one is null
|
|
5011
|
-
|
|
5138
|
+
unmount(n1, parent, true);
|
|
5012
5139
|
}
|
|
5013
|
-
} else if (isVNode(
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
5018
|
-
referenceElm = vnode.elm;
|
|
5140
|
+
} else if (isVNode(n2)) {
|
|
5141
|
+
mount(n2, parent, anchor);
|
|
5142
|
+
anchor = n2.elm;
|
|
5019
5143
|
}
|
|
5020
5144
|
}
|
|
5021
5145
|
}
|
|
5022
5146
|
}
|
|
5023
|
-
|
|
5024
|
-
function patchVnode(oldVnode, vnode) {
|
|
5025
|
-
if (oldVnode !== vnode) {
|
|
5026
|
-
vnode.elm = oldVnode.elm;
|
|
5027
|
-
vnode.hook.update(oldVnode, vnode);
|
|
5028
|
-
}
|
|
5029
|
-
}
|
|
5030
5147
|
/*
|
|
5031
5148
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5032
5149
|
* All rights reserved.
|
|
@@ -5042,7 +5159,7 @@ function addVNodeToChildLWC(vnode) {
|
|
|
5042
5159
|
} // [h]tml node
|
|
5043
5160
|
|
|
5044
5161
|
|
|
5045
|
-
function h(sel, data, children) {
|
|
5162
|
+
function h(sel, data, children = EmptyArray) {
|
|
5046
5163
|
const vmBeingRendered = getVMBeingRendered();
|
|
5047
5164
|
|
|
5048
5165
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5078,7 +5195,6 @@ function h(sel, data, children) {
|
|
|
5078
5195
|
children,
|
|
5079
5196
|
elm,
|
|
5080
5197
|
key,
|
|
5081
|
-
hook: ElementHook,
|
|
5082
5198
|
owner: vmBeingRendered
|
|
5083
5199
|
};
|
|
5084
5200
|
} // [t]ab[i]ndex function
|
|
@@ -5165,7 +5281,7 @@ function c(sel, Ctor, data, children = EmptyArray) {
|
|
|
5165
5281
|
const {
|
|
5166
5282
|
key
|
|
5167
5283
|
} = data;
|
|
5168
|
-
let elm;
|
|
5284
|
+
let elm, aChildren, vm;
|
|
5169
5285
|
const vnode = {
|
|
5170
5286
|
type: 3
|
|
5171
5287
|
/* CustomElement */
|
|
@@ -5175,11 +5291,11 @@ function c(sel, Ctor, data, children = EmptyArray) {
|
|
|
5175
5291
|
children,
|
|
5176
5292
|
elm,
|
|
5177
5293
|
key,
|
|
5178
|
-
hook: CustomElementHook,
|
|
5179
5294
|
ctor: Ctor,
|
|
5180
5295
|
owner: vmBeingRendered,
|
|
5181
|
-
mode: 'open'
|
|
5182
|
-
|
|
5296
|
+
mode: 'open',
|
|
5297
|
+
aChildren,
|
|
5298
|
+
vm
|
|
5183
5299
|
};
|
|
5184
5300
|
addVNodeToChildLWC(vnode);
|
|
5185
5301
|
return vnode;
|
|
@@ -5309,7 +5425,6 @@ function t(text) {
|
|
|
5309
5425
|
text,
|
|
5310
5426
|
elm,
|
|
5311
5427
|
key,
|
|
5312
|
-
hook: TextHook,
|
|
5313
5428
|
owner: getVMBeingRendered()
|
|
5314
5429
|
};
|
|
5315
5430
|
} // [co]mment node
|
|
@@ -5325,7 +5440,6 @@ function co(text) {
|
|
|
5325
5440
|
text,
|
|
5326
5441
|
elm,
|
|
5327
5442
|
key,
|
|
5328
|
-
hook: CommentHook,
|
|
5329
5443
|
owner: getVMBeingRendered()
|
|
5330
5444
|
};
|
|
5331
5445
|
} // [d]ynamic text
|
|
@@ -5440,7 +5554,7 @@ let dynamicImportedComponentCounter = 0;
|
|
|
5440
5554
|
* create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
5441
5555
|
*/
|
|
5442
5556
|
|
|
5443
|
-
function dc(sel, Ctor, data, children) {
|
|
5557
|
+
function dc(sel, Ctor, data, children = EmptyArray) {
|
|
5444
5558
|
if (process.env.NODE_ENV !== 'production') {
|
|
5445
5559
|
assert.isTrue(isString(sel), `dc() 1st argument sel must be a string.`);
|
|
5446
5560
|
assert.isTrue(isObject(data), `dc() 3nd argument data must be an object.`);
|
|
@@ -5464,10 +5578,14 @@ function dc(sel, Ctor, data, children) {
|
|
|
5464
5578
|
} // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
|
|
5465
5579
|
// to identify different constructors as vnodes with different keys to avoid reusing the
|
|
5466
5580
|
// element used for previous constructors.
|
|
5581
|
+
// Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
|
|
5582
|
+
// hoisting optimization.
|
|
5467
5583
|
|
|
5468
5584
|
|
|
5469
|
-
|
|
5470
|
-
|
|
5585
|
+
const newData = Object.assign(Object.assign({}, data), {
|
|
5586
|
+
key: `dc:${idx}:${data.key}`
|
|
5587
|
+
});
|
|
5588
|
+
return c(sel, Ctor, newData, children);
|
|
5471
5589
|
}
|
|
5472
5590
|
/**
|
|
5473
5591
|
* slow children collection marking mechanism. this API allows the compiler to signal
|
|
@@ -5587,12 +5705,14 @@ function updateStylesheetToken(vm, template) {
|
|
|
5587
5705
|
hasTokenInAttribute: oldHasTokenInAttribute
|
|
5588
5706
|
} = context;
|
|
5589
5707
|
|
|
5590
|
-
if (
|
|
5591
|
-
|
|
5592
|
-
|
|
5708
|
+
if (!isUndefined$1(oldToken)) {
|
|
5709
|
+
if (oldHasTokenInClass) {
|
|
5710
|
+
getClassList$1(elm).remove(makeHostToken(oldToken));
|
|
5711
|
+
}
|
|
5593
5712
|
|
|
5594
|
-
|
|
5595
|
-
|
|
5713
|
+
if (oldHasTokenInAttribute) {
|
|
5714
|
+
removeAttribute$1(elm, makeHostToken(oldToken));
|
|
5715
|
+
}
|
|
5596
5716
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5597
5717
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5598
5718
|
|
|
@@ -6134,6 +6254,10 @@ const signedTemplateMap = new Map();
|
|
|
6134
6254
|
function registerComponent(Ctor, {
|
|
6135
6255
|
tmpl
|
|
6136
6256
|
}) {
|
|
6257
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6258
|
+
checkVersionMismatch(Ctor, 'component');
|
|
6259
|
+
}
|
|
6260
|
+
|
|
6137
6261
|
signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
6138
6262
|
// without too much transformation
|
|
6139
6263
|
|
|
@@ -6455,7 +6579,11 @@ function computeShadowMode(vm) {
|
|
|
6455
6579
|
/* Native */
|
|
6456
6580
|
;
|
|
6457
6581
|
} else if (isNativeShadowDefined$1) {
|
|
6458
|
-
if (
|
|
6582
|
+
if (runtimeFlags.DISABLE_MIXED_SHADOW_MODE) {
|
|
6583
|
+
shadowMode = 1
|
|
6584
|
+
/* Synthetic */
|
|
6585
|
+
;
|
|
6586
|
+
} else if (def.shadowSupportMode === "any"
|
|
6459
6587
|
/* Any */
|
|
6460
6588
|
) {
|
|
6461
6589
|
shadowMode = 0
|
|
@@ -6554,7 +6682,7 @@ function patchShadowRoot(vm, newCh) {
|
|
|
6554
6682
|
, vm);
|
|
6555
6683
|
}, () => {
|
|
6556
6684
|
// job
|
|
6557
|
-
patchChildren(
|
|
6685
|
+
patchChildren(oldCh, newCh, renderRoot);
|
|
6558
6686
|
}, () => {
|
|
6559
6687
|
// post
|
|
6560
6688
|
logOperationEnd(2
|
|
@@ -7283,7 +7411,7 @@ function setHooks(hooks) {
|
|
|
7283
7411
|
hooksAreSet = true;
|
|
7284
7412
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7285
7413
|
}
|
|
7286
|
-
/* version: 2.
|
|
7414
|
+
/* version: 2.10.0 */
|
|
7287
7415
|
|
|
7288
7416
|
/*
|
|
7289
7417
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -7823,6 +7951,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
7823
7951
|
|
|
7824
7952
|
freeze(LightningElement);
|
|
7825
7953
|
seal(LightningElement.prototype);
|
|
7826
|
-
/* version: 2.
|
|
7954
|
+
/* version: 2.10.0 */
|
|
7827
7955
|
|
|
7828
7956
|
export { LightningElement, api$1 as api, createContextProvider, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|