lwc 2.14.0 → 2.15.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 +637 -554
- package/dist/engine-dom/iife/es2017/engine-dom.js +639 -553
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +574 -497
- package/dist/engine-dom/iife/es5/engine-dom.js +807 -694
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +729 -634
- package/dist/engine-dom/umd/es2017/engine-dom.js +639 -553
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +574 -497
- package/dist/engine-dom/umd/es5/engine-dom.js +807 -694
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +729 -634
- package/dist/engine-server/commonjs/es2017/engine-server.js +494 -473
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +492 -474
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +24 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +29 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +29 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +24 -4
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +29 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +29 -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 +7 -7
|
@@ -230,6 +230,7 @@ var LWC = (function (exports) {
|
|
|
230
230
|
*/
|
|
231
231
|
const KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';
|
|
232
232
|
const KEY__SHADOW_RESOLVER = '$shadowResolver$';
|
|
233
|
+
const KEY__SHADOW_STATIC = '$shadowStaticNode$';
|
|
233
234
|
const KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
234
235
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
235
236
|
const KEY__SCOPED_CSS = '$scoped$';
|
|
@@ -290,7 +291,7 @@ var LWC = (function (exports) {
|
|
|
290
291
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
291
292
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
292
293
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
293
|
-
/** version: 2.
|
|
294
|
+
/** version: 2.15.0 */
|
|
294
295
|
|
|
295
296
|
/*
|
|
296
297
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -494,158 +495,6 @@ var LWC = (function (exports) {
|
|
|
494
495
|
return result;
|
|
495
496
|
}
|
|
496
497
|
|
|
497
|
-
//
|
|
498
|
-
// Primitives
|
|
499
|
-
//
|
|
500
|
-
let ssr$1;
|
|
501
|
-
function setSsr(ssrImpl) {
|
|
502
|
-
ssr$1 = ssrImpl;
|
|
503
|
-
}
|
|
504
|
-
let isNativeShadowDefined$1;
|
|
505
|
-
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
506
|
-
isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
|
|
507
|
-
}
|
|
508
|
-
let isSyntheticShadowDefined$1;
|
|
509
|
-
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
510
|
-
isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
|
|
511
|
-
}
|
|
512
|
-
let HTMLElementExported$1;
|
|
513
|
-
function setHTMLElement(HTMLElementImpl) {
|
|
514
|
-
HTMLElementExported$1 = HTMLElementImpl;
|
|
515
|
-
}
|
|
516
|
-
let insert$1;
|
|
517
|
-
function setInsert(insertImpl) {
|
|
518
|
-
insert$1 = insertImpl;
|
|
519
|
-
}
|
|
520
|
-
let remove$1;
|
|
521
|
-
function setRemove(removeImpl) {
|
|
522
|
-
remove$1 = removeImpl;
|
|
523
|
-
}
|
|
524
|
-
let createElement$2;
|
|
525
|
-
function setCreateElement(createElementImpl) {
|
|
526
|
-
createElement$2 = createElementImpl;
|
|
527
|
-
}
|
|
528
|
-
let createText$1;
|
|
529
|
-
function setCreateText(createTextImpl) {
|
|
530
|
-
createText$1 = createTextImpl;
|
|
531
|
-
}
|
|
532
|
-
let createComment$1;
|
|
533
|
-
function setCreateComment(createCommentImpl) {
|
|
534
|
-
createComment$1 = createCommentImpl;
|
|
535
|
-
}
|
|
536
|
-
let nextSibling$1;
|
|
537
|
-
function setNextSibling(nextSiblingImpl) {
|
|
538
|
-
nextSibling$1 = nextSiblingImpl;
|
|
539
|
-
}
|
|
540
|
-
let attachShadow$1;
|
|
541
|
-
function setAttachShadow(attachShadowImpl) {
|
|
542
|
-
attachShadow$1 = attachShadowImpl;
|
|
543
|
-
}
|
|
544
|
-
let getProperty$1;
|
|
545
|
-
function setGetProperty(getPropertyImpl) {
|
|
546
|
-
getProperty$1 = getPropertyImpl;
|
|
547
|
-
}
|
|
548
|
-
let setProperty$1;
|
|
549
|
-
function setSetProperty(setPropertyImpl) {
|
|
550
|
-
setProperty$1 = setPropertyImpl;
|
|
551
|
-
}
|
|
552
|
-
let setText$1;
|
|
553
|
-
function setSetText(setTextImpl) {
|
|
554
|
-
setText$1 = setTextImpl;
|
|
555
|
-
}
|
|
556
|
-
let getAttribute$1;
|
|
557
|
-
function setGetAttribute(getAttributeImpl) {
|
|
558
|
-
getAttribute$1 = getAttributeImpl;
|
|
559
|
-
}
|
|
560
|
-
let setAttribute$1;
|
|
561
|
-
function setSetAttribute(setAttributeImpl) {
|
|
562
|
-
setAttribute$1 = setAttributeImpl;
|
|
563
|
-
}
|
|
564
|
-
let removeAttribute$1;
|
|
565
|
-
function setRemoveAttribute(removeAttributeImpl) {
|
|
566
|
-
removeAttribute$1 = removeAttributeImpl;
|
|
567
|
-
}
|
|
568
|
-
let addEventListener$1;
|
|
569
|
-
function setAddEventListener(addEventListenerImpl) {
|
|
570
|
-
addEventListener$1 = addEventListenerImpl;
|
|
571
|
-
}
|
|
572
|
-
let removeEventListener$1;
|
|
573
|
-
function setRemoveEventListener(removeEventListenerImpl) {
|
|
574
|
-
removeEventListener$1 = removeEventListenerImpl;
|
|
575
|
-
}
|
|
576
|
-
let dispatchEvent$1;
|
|
577
|
-
function setDispatchEvent(dispatchEventImpl) {
|
|
578
|
-
dispatchEvent$1 = dispatchEventImpl;
|
|
579
|
-
}
|
|
580
|
-
let getClassList$1;
|
|
581
|
-
function setGetClassList(getClassListImpl) {
|
|
582
|
-
getClassList$1 = getClassListImpl;
|
|
583
|
-
}
|
|
584
|
-
let setCSSStyleProperty$1;
|
|
585
|
-
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
586
|
-
setCSSStyleProperty$1 = setCSSStylePropertyImpl;
|
|
587
|
-
}
|
|
588
|
-
let getBoundingClientRect$1;
|
|
589
|
-
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
590
|
-
getBoundingClientRect$1 = getBoundingClientRectImpl;
|
|
591
|
-
}
|
|
592
|
-
let querySelector$1;
|
|
593
|
-
function setQuerySelector(querySelectorImpl) {
|
|
594
|
-
querySelector$1 = querySelectorImpl;
|
|
595
|
-
}
|
|
596
|
-
let querySelectorAll$1;
|
|
597
|
-
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
598
|
-
querySelectorAll$1 = querySelectorAllImpl;
|
|
599
|
-
}
|
|
600
|
-
let getElementsByTagName$1;
|
|
601
|
-
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
602
|
-
getElementsByTagName$1 = getElementsByTagNameImpl;
|
|
603
|
-
}
|
|
604
|
-
let getElementsByClassName$1;
|
|
605
|
-
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
606
|
-
getElementsByClassName$1 = getElementsByClassNameImpl;
|
|
607
|
-
}
|
|
608
|
-
let getChildren$1;
|
|
609
|
-
function setGetChildren(getChildrenImpl) {
|
|
610
|
-
getChildren$1 = getChildrenImpl;
|
|
611
|
-
}
|
|
612
|
-
let getChildNodes$1;
|
|
613
|
-
function setGetChildNodes(getChildNodesImpl) {
|
|
614
|
-
getChildNodes$1 = getChildNodesImpl;
|
|
615
|
-
}
|
|
616
|
-
let getFirstChild$1;
|
|
617
|
-
function setGetFirstChild(getFirstChildImpl) {
|
|
618
|
-
getFirstChild$1 = getFirstChildImpl;
|
|
619
|
-
}
|
|
620
|
-
let getFirstElementChild$1;
|
|
621
|
-
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
622
|
-
getFirstElementChild$1 = getFirstElementChildImpl;
|
|
623
|
-
}
|
|
624
|
-
let getLastChild$1;
|
|
625
|
-
function setGetLastChild(getLastChildImpl) {
|
|
626
|
-
getLastChild$1 = getLastChildImpl;
|
|
627
|
-
}
|
|
628
|
-
let getLastElementChild$1;
|
|
629
|
-
function setGetLastElementChild(getLastElementChildImpl) {
|
|
630
|
-
getLastElementChild$1 = getLastElementChildImpl;
|
|
631
|
-
}
|
|
632
|
-
let isConnected$1;
|
|
633
|
-
function setIsConnected(isConnectedImpl) {
|
|
634
|
-
isConnected$1 = isConnectedImpl;
|
|
635
|
-
}
|
|
636
|
-
let insertStylesheet$1;
|
|
637
|
-
function setInsertStylesheet(insertStylesheetImpl) {
|
|
638
|
-
insertStylesheet$1 = insertStylesheetImpl;
|
|
639
|
-
}
|
|
640
|
-
let defineCustomElement$1;
|
|
641
|
-
function setDefineCustomElement(defineCustomElementImpl) {
|
|
642
|
-
defineCustomElement$1 = defineCustomElementImpl;
|
|
643
|
-
}
|
|
644
|
-
let getCustomElement$1;
|
|
645
|
-
function setGetCustomElement(getCustomElementImpl) {
|
|
646
|
-
getCustomElement$1 = getCustomElementImpl;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
498
|
/*
|
|
650
499
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
651
500
|
* All rights reserved.
|
|
@@ -1521,8 +1370,8 @@ var LWC = (function (exports) {
|
|
|
1521
1370
|
return this;
|
|
1522
1371
|
};
|
|
1523
1372
|
function doAttachShadow(vm) {
|
|
1524
|
-
const { elm, mode, shadowMode, def: { ctor }, } = vm;
|
|
1525
|
-
const shadowRoot = attachShadow
|
|
1373
|
+
const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
|
|
1374
|
+
const shadowRoot = attachShadow(elm, {
|
|
1526
1375
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
|
|
1527
1376
|
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
1528
1377
|
mode,
|
|
@@ -1535,76 +1384,85 @@ var LWC = (function (exports) {
|
|
|
1535
1384
|
LightningElement.prototype = {
|
|
1536
1385
|
constructor: LightningElement,
|
|
1537
1386
|
dispatchEvent(event) {
|
|
1538
|
-
const
|
|
1539
|
-
|
|
1387
|
+
const vm = getAssociatedVM(this);
|
|
1388
|
+
const { elm, renderer: { dispatchEvent }, } = vm;
|
|
1389
|
+
return dispatchEvent(elm, event);
|
|
1540
1390
|
},
|
|
1541
1391
|
addEventListener(type, listener, options) {
|
|
1542
1392
|
const vm = getAssociatedVM(this);
|
|
1543
|
-
const { elm } = vm;
|
|
1393
|
+
const { elm, renderer: { addEventListener }, } = vm;
|
|
1544
1394
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
1545
|
-
addEventListener
|
|
1395
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
1546
1396
|
},
|
|
1547
1397
|
removeEventListener(type, listener, options) {
|
|
1548
1398
|
const vm = getAssociatedVM(this);
|
|
1549
|
-
const { elm } = vm;
|
|
1399
|
+
const { elm, renderer: { removeEventListener }, } = vm;
|
|
1550
1400
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
1551
|
-
removeEventListener
|
|
1401
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
1552
1402
|
},
|
|
1553
1403
|
hasAttribute(name) {
|
|
1554
|
-
const
|
|
1555
|
-
|
|
1404
|
+
const vm = getAssociatedVM(this);
|
|
1405
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
1406
|
+
return !isNull(getAttribute(elm, name));
|
|
1556
1407
|
},
|
|
1557
1408
|
hasAttributeNS(namespace, name) {
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1409
|
+
const vm = getAssociatedVM(this);
|
|
1410
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
1411
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
1560
1412
|
},
|
|
1561
1413
|
removeAttribute(name) {
|
|
1562
|
-
const
|
|
1414
|
+
const vm = getAssociatedVM(this);
|
|
1415
|
+
const { elm, renderer: { removeAttribute }, } = vm;
|
|
1563
1416
|
unlockAttribute(elm, name);
|
|
1564
|
-
removeAttribute
|
|
1417
|
+
removeAttribute(elm, name);
|
|
1565
1418
|
lockAttribute();
|
|
1566
1419
|
},
|
|
1567
1420
|
removeAttributeNS(namespace, name) {
|
|
1568
|
-
const { elm } = getAssociatedVM(this);
|
|
1421
|
+
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
1569
1422
|
unlockAttribute(elm, name);
|
|
1570
|
-
removeAttribute
|
|
1423
|
+
removeAttribute(elm, name, namespace);
|
|
1571
1424
|
lockAttribute();
|
|
1572
1425
|
},
|
|
1573
1426
|
getAttribute(name) {
|
|
1574
|
-
const
|
|
1575
|
-
|
|
1427
|
+
const vm = getAssociatedVM(this);
|
|
1428
|
+
const { elm } = vm;
|
|
1429
|
+
const { getAttribute } = vm.renderer;
|
|
1430
|
+
return getAttribute(elm, name);
|
|
1576
1431
|
},
|
|
1577
1432
|
getAttributeNS(namespace, name) {
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1433
|
+
const vm = getAssociatedVM(this);
|
|
1434
|
+
const { elm } = vm;
|
|
1435
|
+
const { getAttribute } = vm.renderer;
|
|
1436
|
+
return getAttribute(elm, name, namespace);
|
|
1580
1437
|
},
|
|
1581
1438
|
setAttribute(name, value) {
|
|
1582
1439
|
const vm = getAssociatedVM(this);
|
|
1583
|
-
const { elm } = vm;
|
|
1440
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
1584
1441
|
unlockAttribute(elm, name);
|
|
1585
|
-
setAttribute
|
|
1442
|
+
setAttribute(elm, name, value);
|
|
1586
1443
|
lockAttribute();
|
|
1587
1444
|
},
|
|
1588
1445
|
setAttributeNS(namespace, name, value) {
|
|
1589
1446
|
const vm = getAssociatedVM(this);
|
|
1590
|
-
const { elm } = vm;
|
|
1447
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
1591
1448
|
unlockAttribute(elm, name);
|
|
1592
|
-
setAttribute
|
|
1449
|
+
setAttribute(elm, name, value, namespace);
|
|
1593
1450
|
lockAttribute();
|
|
1594
1451
|
},
|
|
1595
1452
|
getBoundingClientRect() {
|
|
1596
1453
|
const vm = getAssociatedVM(this);
|
|
1597
|
-
const { elm } = vm;
|
|
1598
|
-
return getBoundingClientRect
|
|
1454
|
+
const { elm, renderer: { getBoundingClientRect }, } = vm;
|
|
1455
|
+
return getBoundingClientRect(elm);
|
|
1599
1456
|
},
|
|
1600
1457
|
get isConnected() {
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1458
|
+
const vm = getAssociatedVM(this);
|
|
1459
|
+
const { elm, renderer: { isConnected }, } = vm;
|
|
1460
|
+
return isConnected(elm);
|
|
1603
1461
|
},
|
|
1604
1462
|
get classList() {
|
|
1605
1463
|
const vm = getAssociatedVM(this);
|
|
1606
|
-
const { elm } = vm;
|
|
1607
|
-
return getClassList
|
|
1464
|
+
const { elm, renderer: { getClassList }, } = vm;
|
|
1465
|
+
return getClassList(elm);
|
|
1608
1466
|
},
|
|
1609
1467
|
get template() {
|
|
1610
1468
|
const vm = getAssociatedVM(this);
|
|
@@ -1615,6 +1473,36 @@ var LWC = (function (exports) {
|
|
|
1615
1473
|
// Authors should rely on this.template instead.
|
|
1616
1474
|
return null;
|
|
1617
1475
|
},
|
|
1476
|
+
get children() {
|
|
1477
|
+
const vm = getAssociatedVM(this);
|
|
1478
|
+
const renderer = vm.renderer;
|
|
1479
|
+
return renderer.getChildren(vm.elm);
|
|
1480
|
+
},
|
|
1481
|
+
get childNodes() {
|
|
1482
|
+
const vm = getAssociatedVM(this);
|
|
1483
|
+
const renderer = vm.renderer;
|
|
1484
|
+
return renderer.getChildNodes(vm.elm);
|
|
1485
|
+
},
|
|
1486
|
+
get firstChild() {
|
|
1487
|
+
const vm = getAssociatedVM(this);
|
|
1488
|
+
const renderer = vm.renderer;
|
|
1489
|
+
return renderer.getFirstChild(vm.elm);
|
|
1490
|
+
},
|
|
1491
|
+
get firstElementChild() {
|
|
1492
|
+
const vm = getAssociatedVM(this);
|
|
1493
|
+
const renderer = vm.renderer;
|
|
1494
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
1495
|
+
},
|
|
1496
|
+
get lastChild() {
|
|
1497
|
+
const vm = getAssociatedVM(this);
|
|
1498
|
+
const renderer = vm.renderer;
|
|
1499
|
+
return renderer.getLastChild(vm.elm);
|
|
1500
|
+
},
|
|
1501
|
+
get lastElementChild() {
|
|
1502
|
+
const vm = getAssociatedVM(this);
|
|
1503
|
+
const renderer = vm.renderer;
|
|
1504
|
+
return renderer.getLastElementChild(vm.elm);
|
|
1505
|
+
},
|
|
1618
1506
|
render() {
|
|
1619
1507
|
const vm = getAssociatedVM(this);
|
|
1620
1508
|
return vm.def.template;
|
|
@@ -1625,70 +1513,19 @@ var LWC = (function (exports) {
|
|
|
1625
1513
|
},
|
|
1626
1514
|
};
|
|
1627
1515
|
const queryAndChildGetterDescriptors = create(null);
|
|
1628
|
-
// The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
1629
|
-
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
1630
|
-
// object representing the renderer, with a lot of methods we don't actually need.
|
|
1631
|
-
const childGetters = [
|
|
1632
|
-
'children',
|
|
1633
|
-
'childNodes',
|
|
1634
|
-
'firstChild',
|
|
1635
|
-
'firstElementChild',
|
|
1636
|
-
'lastChild',
|
|
1637
|
-
'lastElementChild',
|
|
1638
|
-
];
|
|
1639
|
-
function getChildGetter(methodName) {
|
|
1640
|
-
switch (methodName) {
|
|
1641
|
-
case 'children':
|
|
1642
|
-
return getChildren$1;
|
|
1643
|
-
case 'childNodes':
|
|
1644
|
-
return getChildNodes$1;
|
|
1645
|
-
case 'firstChild':
|
|
1646
|
-
return getFirstChild$1;
|
|
1647
|
-
case 'firstElementChild':
|
|
1648
|
-
return getFirstElementChild$1;
|
|
1649
|
-
case 'lastChild':
|
|
1650
|
-
return getLastChild$1;
|
|
1651
|
-
case 'lastElementChild':
|
|
1652
|
-
return getLastElementChild$1;
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
// Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
1656
|
-
for (const childGetter of childGetters) {
|
|
1657
|
-
queryAndChildGetterDescriptors[childGetter] = {
|
|
1658
|
-
get() {
|
|
1659
|
-
const vm = getAssociatedVM(this);
|
|
1660
|
-
const { elm } = vm;
|
|
1661
|
-
return getChildGetter(childGetter)(elm);
|
|
1662
|
-
},
|
|
1663
|
-
configurable: true,
|
|
1664
|
-
enumerable: true,
|
|
1665
|
-
};
|
|
1666
|
-
}
|
|
1667
1516
|
const queryMethods = [
|
|
1668
1517
|
'getElementsByClassName',
|
|
1669
1518
|
'getElementsByTagName',
|
|
1670
1519
|
'querySelector',
|
|
1671
1520
|
'querySelectorAll',
|
|
1672
1521
|
];
|
|
1673
|
-
function getQueryMethod(methodName) {
|
|
1674
|
-
switch (methodName) {
|
|
1675
|
-
case 'getElementsByClassName':
|
|
1676
|
-
return getElementsByClassName$1;
|
|
1677
|
-
case 'getElementsByTagName':
|
|
1678
|
-
return getElementsByTagName$1;
|
|
1679
|
-
case 'querySelector':
|
|
1680
|
-
return querySelector$1;
|
|
1681
|
-
case 'querySelectorAll':
|
|
1682
|
-
return querySelectorAll$1;
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
1522
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
1686
1523
|
for (const queryMethod of queryMethods) {
|
|
1687
1524
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
1688
1525
|
value(arg) {
|
|
1689
1526
|
const vm = getAssociatedVM(this);
|
|
1690
|
-
const { elm } = vm;
|
|
1691
|
-
return
|
|
1527
|
+
const { elm, renderer } = vm;
|
|
1528
|
+
return renderer[queryMethod](elm, arg);
|
|
1692
1529
|
},
|
|
1693
1530
|
configurable: true,
|
|
1694
1531
|
enumerable: true,
|
|
@@ -2459,12 +2296,13 @@ var LWC = (function (exports) {
|
|
|
2459
2296
|
* SPDX-License-Identifier: MIT
|
|
2460
2297
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2461
2298
|
*/
|
|
2462
|
-
function getUpgradableConstructor(tagName) {
|
|
2299
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
2300
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
2463
2301
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
2464
2302
|
// produce only tags with lowercase letters
|
|
2465
2303
|
// But, for backwards compatibility, we will lower case the tagName
|
|
2466
2304
|
tagName = tagName.toLowerCase();
|
|
2467
|
-
let CE = getCustomElement
|
|
2305
|
+
let CE = getCustomElement(tagName);
|
|
2468
2306
|
if (!isUndefined$1(CE)) {
|
|
2469
2307
|
return CE;
|
|
2470
2308
|
}
|
|
@@ -2472,7 +2310,7 @@ var LWC = (function (exports) {
|
|
|
2472
2310
|
* LWC Upgradable Element reference to an element that was created
|
|
2473
2311
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
2474
2312
|
*/
|
|
2475
|
-
CE = class LWCUpgradableElement extends
|
|
2313
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
2476
2314
|
constructor(upgradeCallback) {
|
|
2477
2315
|
super();
|
|
2478
2316
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -2480,7 +2318,7 @@ var LWC = (function (exports) {
|
|
|
2480
2318
|
}
|
|
2481
2319
|
}
|
|
2482
2320
|
};
|
|
2483
|
-
defineCustomElement
|
|
2321
|
+
defineCustomElement(tagName, CE);
|
|
2484
2322
|
return CE;
|
|
2485
2323
|
}
|
|
2486
2324
|
|
|
@@ -2505,7 +2343,7 @@ var LWC = (function (exports) {
|
|
|
2505
2343
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2506
2344
|
*/
|
|
2507
2345
|
const ColonCharCode = 58;
|
|
2508
|
-
function patchAttributes(oldVnode, vnode) {
|
|
2346
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
2509
2347
|
const { attrs } = vnode.data;
|
|
2510
2348
|
if (isUndefined$1(attrs)) {
|
|
2511
2349
|
return;
|
|
@@ -2515,6 +2353,7 @@ var LWC = (function (exports) {
|
|
|
2515
2353
|
return;
|
|
2516
2354
|
}
|
|
2517
2355
|
const { elm } = vnode;
|
|
2356
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
2518
2357
|
for (const key in attrs) {
|
|
2519
2358
|
const cur = attrs[key];
|
|
2520
2359
|
const old = oldAttrs[key];
|
|
@@ -2522,17 +2361,17 @@ var LWC = (function (exports) {
|
|
|
2522
2361
|
unlockAttribute(elm, key);
|
|
2523
2362
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
2524
2363
|
// Assume xml namespace
|
|
2525
|
-
setAttribute
|
|
2364
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
2526
2365
|
}
|
|
2527
2366
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
2528
2367
|
// Assume xlink namespace
|
|
2529
|
-
setAttribute
|
|
2368
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
2530
2369
|
}
|
|
2531
2370
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
2532
|
-
removeAttribute
|
|
2371
|
+
removeAttribute(elm, key);
|
|
2533
2372
|
}
|
|
2534
2373
|
else {
|
|
2535
|
-
setAttribute
|
|
2374
|
+
setAttribute(elm, key, cur);
|
|
2536
2375
|
}
|
|
2537
2376
|
lockAttribute();
|
|
2538
2377
|
}
|
|
@@ -2550,7 +2389,7 @@ var LWC = (function (exports) {
|
|
|
2550
2389
|
// instead of relying on internally tracked values.
|
|
2551
2390
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
2552
2391
|
}
|
|
2553
|
-
function patchProps(oldVnode, vnode) {
|
|
2392
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
2554
2393
|
const { props } = vnode.data;
|
|
2555
2394
|
if (isUndefined$1(props)) {
|
|
2556
2395
|
return;
|
|
@@ -2561,13 +2400,14 @@ var LWC = (function (exports) {
|
|
|
2561
2400
|
}
|
|
2562
2401
|
const isFirstPatch = isNull(oldVnode);
|
|
2563
2402
|
const { elm, sel } = vnode;
|
|
2403
|
+
const { getProperty, setProperty } = renderer;
|
|
2564
2404
|
for (const key in props) {
|
|
2565
2405
|
const cur = props[key];
|
|
2566
2406
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
2567
2407
|
// different than the one previously set.
|
|
2568
2408
|
if (isFirstPatch ||
|
|
2569
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
2570
|
-
setProperty
|
|
2409
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
2410
|
+
setProperty(elm, key, cur);
|
|
2571
2411
|
}
|
|
2572
2412
|
}
|
|
2573
2413
|
}
|
|
@@ -2608,13 +2448,14 @@ var LWC = (function (exports) {
|
|
|
2608
2448
|
classNameToClassMap[className] = map;
|
|
2609
2449
|
return map;
|
|
2610
2450
|
}
|
|
2611
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
2451
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
2612
2452
|
const { elm, data: { className: newClass }, } = vnode;
|
|
2613
2453
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
2614
2454
|
if (oldClass === newClass) {
|
|
2615
2455
|
return;
|
|
2616
2456
|
}
|
|
2617
|
-
const
|
|
2457
|
+
const { getClassList } = renderer;
|
|
2458
|
+
const classList = getClassList(elm);
|
|
2618
2459
|
const newClassMap = getMapFromClassName(newClass);
|
|
2619
2460
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
2620
2461
|
let name;
|
|
@@ -2638,17 +2479,18 @@ var LWC = (function (exports) {
|
|
|
2638
2479
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2639
2480
|
*/
|
|
2640
2481
|
// The style property is a string when defined via an expression in the template.
|
|
2641
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
2482
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
2642
2483
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
2643
2484
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
2644
2485
|
if (oldStyle === newStyle) {
|
|
2645
2486
|
return;
|
|
2646
2487
|
}
|
|
2488
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
2647
2489
|
if (!isString(newStyle) || newStyle === '') {
|
|
2648
|
-
removeAttribute
|
|
2490
|
+
removeAttribute(elm, 'style');
|
|
2649
2491
|
}
|
|
2650
2492
|
else {
|
|
2651
|
-
setAttribute
|
|
2493
|
+
setAttribute(elm, 'style', newStyle);
|
|
2652
2494
|
}
|
|
2653
2495
|
}
|
|
2654
2496
|
|
|
@@ -2658,14 +2500,15 @@ var LWC = (function (exports) {
|
|
|
2658
2500
|
* SPDX-License-Identifier: MIT
|
|
2659
2501
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2660
2502
|
*/
|
|
2661
|
-
function applyEventListeners(vnode) {
|
|
2503
|
+
function applyEventListeners(vnode, renderer) {
|
|
2662
2504
|
const { elm, data: { on }, } = vnode;
|
|
2663
2505
|
if (isUndefined$1(on)) {
|
|
2664
2506
|
return;
|
|
2665
2507
|
}
|
|
2508
|
+
const { addEventListener } = renderer;
|
|
2666
2509
|
for (const name in on) {
|
|
2667
2510
|
const handler = on[name];
|
|
2668
|
-
addEventListener
|
|
2511
|
+
addEventListener(elm, name, handler);
|
|
2669
2512
|
}
|
|
2670
2513
|
}
|
|
2671
2514
|
|
|
@@ -2678,12 +2521,13 @@ var LWC = (function (exports) {
|
|
|
2678
2521
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
2679
2522
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
2680
2523
|
// different classnames properties individually instead of via a string.
|
|
2681
|
-
function applyStaticClassAttribute(vnode) {
|
|
2524
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
2682
2525
|
const { elm, data: { classMap }, } = vnode;
|
|
2683
2526
|
if (isUndefined$1(classMap)) {
|
|
2684
2527
|
return;
|
|
2685
2528
|
}
|
|
2686
|
-
const
|
|
2529
|
+
const { getClassList } = renderer;
|
|
2530
|
+
const classList = getClassList(elm);
|
|
2687
2531
|
for (const name in classMap) {
|
|
2688
2532
|
classList.add(name);
|
|
2689
2533
|
}
|
|
@@ -2698,14 +2542,15 @@ var LWC = (function (exports) {
|
|
|
2698
2542
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
2699
2543
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
2700
2544
|
// different style properties individually instead of via a string.
|
|
2701
|
-
function applyStaticStyleAttribute(vnode) {
|
|
2545
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
2702
2546
|
const { elm, data: { styleDecls }, } = vnode;
|
|
2703
2547
|
if (isUndefined$1(styleDecls)) {
|
|
2704
2548
|
return;
|
|
2705
2549
|
}
|
|
2550
|
+
const { setCSSStyleProperty } = renderer;
|
|
2706
2551
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
2707
2552
|
const [prop, value, important] = styleDecls[i];
|
|
2708
|
-
setCSSStyleProperty
|
|
2553
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
2709
2554
|
}
|
|
2710
2555
|
}
|
|
2711
2556
|
|
|
@@ -2715,94 +2560,126 @@ var LWC = (function (exports) {
|
|
|
2715
2560
|
* SPDX-License-Identifier: MIT
|
|
2716
2561
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2717
2562
|
*/
|
|
2718
|
-
function patchChildren(c1, c2, parent) {
|
|
2563
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
2719
2564
|
if (hasDynamicChildren(c2)) {
|
|
2720
|
-
updateDynamicChildren(c1, c2, parent);
|
|
2565
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
2721
2566
|
}
|
|
2722
2567
|
else {
|
|
2723
|
-
updateStaticChildren(c1, c2, parent);
|
|
2568
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
2724
2569
|
}
|
|
2725
2570
|
}
|
|
2726
|
-
function patch(n1, n2) {
|
|
2571
|
+
function patch(n1, n2, renderer) {
|
|
2572
|
+
var _a, _b;
|
|
2727
2573
|
if (n1 === n2) {
|
|
2728
2574
|
return;
|
|
2729
2575
|
}
|
|
2730
2576
|
switch (n2.type) {
|
|
2731
2577
|
case 0 /* Text */:
|
|
2732
|
-
|
|
2578
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
2579
|
+
patchText(n1, n2, renderer);
|
|
2733
2580
|
break;
|
|
2734
2581
|
case 1 /* Comment */:
|
|
2735
|
-
|
|
2582
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
2583
|
+
patchComment(n1, n2, renderer);
|
|
2584
|
+
break;
|
|
2585
|
+
case 4 /* Static */:
|
|
2586
|
+
n2.elm = n1.elm;
|
|
2736
2587
|
break;
|
|
2737
2588
|
case 2 /* Element */:
|
|
2738
|
-
patchElement(n1, n2);
|
|
2589
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
2739
2590
|
break;
|
|
2740
2591
|
case 3 /* CustomElement */:
|
|
2741
|
-
patchCustomElement(n1, n2);
|
|
2592
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
2742
2593
|
break;
|
|
2743
2594
|
}
|
|
2744
2595
|
}
|
|
2745
|
-
function mount(node, parent, anchor) {
|
|
2596
|
+
function mount(node, parent, renderer, anchor) {
|
|
2597
|
+
var _a, _b;
|
|
2746
2598
|
switch (node.type) {
|
|
2747
2599
|
case 0 /* Text */:
|
|
2748
|
-
|
|
2600
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
2601
|
+
mountText(node, parent, anchor, renderer);
|
|
2749
2602
|
break;
|
|
2750
2603
|
case 1 /* Comment */:
|
|
2751
|
-
|
|
2604
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
2605
|
+
mountComment(node, parent, anchor, renderer);
|
|
2606
|
+
break;
|
|
2607
|
+
case 4 /* Static */:
|
|
2608
|
+
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
2609
|
+
mountStatic(node, parent, anchor, renderer);
|
|
2752
2610
|
break;
|
|
2753
2611
|
case 2 /* Element */:
|
|
2754
|
-
|
|
2612
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
2613
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
2755
2614
|
break;
|
|
2756
2615
|
case 3 /* CustomElement */:
|
|
2757
|
-
|
|
2616
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
2617
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
2758
2618
|
break;
|
|
2759
2619
|
}
|
|
2760
2620
|
}
|
|
2761
|
-
function patchText(n1, n2) {
|
|
2621
|
+
function patchText(n1, n2, renderer) {
|
|
2762
2622
|
n2.elm = n1.elm;
|
|
2763
2623
|
if (n2.text !== n1.text) {
|
|
2764
|
-
updateTextContent(n2);
|
|
2624
|
+
updateTextContent(n2, renderer);
|
|
2765
2625
|
}
|
|
2766
2626
|
}
|
|
2767
|
-
function mountText(
|
|
2768
|
-
const { owner } =
|
|
2769
|
-
const
|
|
2770
|
-
|
|
2771
|
-
|
|
2627
|
+
function mountText(vnode, parent, anchor, renderer) {
|
|
2628
|
+
const { owner } = vnode;
|
|
2629
|
+
const { createText } = renderer;
|
|
2630
|
+
const textNode = (vnode.elm = createText(vnode.text));
|
|
2631
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
2632
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
2772
2633
|
}
|
|
2773
|
-
function patchComment(n1, n2) {
|
|
2634
|
+
function patchComment(n1, n2, renderer) {
|
|
2774
2635
|
n2.elm = n1.elm;
|
|
2775
2636
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
2776
2637
|
// it is the case today.
|
|
2777
2638
|
if (n2.text !== n1.text) {
|
|
2778
|
-
updateTextContent(n2);
|
|
2639
|
+
updateTextContent(n2, renderer);
|
|
2779
2640
|
}
|
|
2780
2641
|
}
|
|
2781
|
-
function mountComment(
|
|
2782
|
-
const { owner } =
|
|
2783
|
-
const
|
|
2784
|
-
|
|
2785
|
-
|
|
2642
|
+
function mountComment(vnode, parent, anchor, renderer) {
|
|
2643
|
+
const { owner } = vnode;
|
|
2644
|
+
const { createComment } = renderer;
|
|
2645
|
+
const commentNode = (vnode.elm = createComment(vnode.text));
|
|
2646
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
2647
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
2786
2648
|
}
|
|
2787
|
-
function mountElement(vnode, parent, anchor) {
|
|
2649
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
2788
2650
|
const { sel, owner, data: { svg }, } = vnode;
|
|
2651
|
+
const { createElement } = renderer;
|
|
2789
2652
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
2790
|
-
const elm = createElement
|
|
2791
|
-
linkNodeToShadow(elm, owner);
|
|
2792
|
-
fallbackElmHook(elm, vnode);
|
|
2653
|
+
const elm = createElement(sel, namespace);
|
|
2654
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
2655
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
2793
2656
|
vnode.elm = elm;
|
|
2794
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
2795
|
-
insertNode(elm, parent, anchor);
|
|
2796
|
-
mountVNodes(vnode.children, elm, null);
|
|
2657
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
2658
|
+
insertNode(elm, parent, anchor, renderer);
|
|
2659
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
2797
2660
|
}
|
|
2798
|
-
function patchElement(n1, n2) {
|
|
2661
|
+
function patchElement(n1, n2, renderer) {
|
|
2799
2662
|
const elm = (n2.elm = n1.elm);
|
|
2800
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
2801
|
-
patchChildren(n1.children, n2.children, elm);
|
|
2663
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
2664
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
2802
2665
|
}
|
|
2803
|
-
function
|
|
2666
|
+
function mountStatic(vnode, parent, anchor, renderer) {
|
|
2667
|
+
const { owner } = vnode;
|
|
2668
|
+
const { cloneNode, isSyntheticShadowDefined } = renderer;
|
|
2669
|
+
const elm = (vnode.elm = cloneNode(vnode.fragment, true));
|
|
2670
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
2671
|
+
// Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
2672
|
+
const { renderMode, shadowMode } = owner;
|
|
2673
|
+
if (isSyntheticShadowDefined) {
|
|
2674
|
+
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
2675
|
+
elm[KEY__SHADOW_STATIC] = true;
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
insertNode(elm, parent, anchor, renderer);
|
|
2679
|
+
}
|
|
2680
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
2804
2681
|
const { sel, owner } = vnode;
|
|
2805
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
2682
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
2806
2683
|
/**
|
|
2807
2684
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
2808
2685
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -2812,9 +2689,9 @@ var LWC = (function (exports) {
|
|
|
2812
2689
|
let vm;
|
|
2813
2690
|
const elm = new UpgradableConstructor((elm) => {
|
|
2814
2691
|
// the custom element from the registry is expecting an upgrade callback
|
|
2815
|
-
vm = createViewModelHook(elm, vnode);
|
|
2692
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
2816
2693
|
});
|
|
2817
|
-
linkNodeToShadow(elm, owner);
|
|
2694
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
2818
2695
|
vnode.elm = elm;
|
|
2819
2696
|
vnode.vm = vm;
|
|
2820
2697
|
if (vm) {
|
|
@@ -2823,20 +2700,20 @@ var LWC = (function (exports) {
|
|
|
2823
2700
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
2824
2701
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
2825
2702
|
}
|
|
2826
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
2827
|
-
insertNode(elm, parent, anchor);
|
|
2703
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
2704
|
+
insertNode(elm, parent, anchor, renderer);
|
|
2828
2705
|
if (vm) {
|
|
2829
2706
|
runConnectedCallback(vm);
|
|
2830
2707
|
}
|
|
2831
|
-
mountVNodes(vnode.children, elm, null);
|
|
2708
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
2832
2709
|
if (vm) {
|
|
2833
2710
|
appendVM(vm);
|
|
2834
2711
|
}
|
|
2835
2712
|
}
|
|
2836
|
-
function patchCustomElement(n1, n2) {
|
|
2713
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
2837
2714
|
const elm = (n2.elm = n1.elm);
|
|
2838
2715
|
const vm = (n2.vm = n1.vm);
|
|
2839
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
2716
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
2840
2717
|
if (!isUndefined$1(vm)) {
|
|
2841
2718
|
// in fallback mode, the allocation will always set children to
|
|
2842
2719
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -2844,33 +2721,38 @@ var LWC = (function (exports) {
|
|
|
2844
2721
|
}
|
|
2845
2722
|
// in fallback mode, the children will be always empty, so, nothing
|
|
2846
2723
|
// will happen, but in native, it does allocate the light dom
|
|
2847
|
-
patchChildren(n1.children, n2.children, elm);
|
|
2724
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
2848
2725
|
if (!isUndefined$1(vm)) {
|
|
2849
2726
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
2850
2727
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
2851
2728
|
rerenderVM(vm);
|
|
2852
2729
|
}
|
|
2853
2730
|
}
|
|
2854
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
2731
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
2855
2732
|
for (; start < end; ++start) {
|
|
2856
2733
|
const vnode = vnodes[start];
|
|
2857
2734
|
if (isVNode(vnode)) {
|
|
2858
|
-
mount(vnode, parent, anchor);
|
|
2735
|
+
mount(vnode, parent, renderer, anchor);
|
|
2859
2736
|
}
|
|
2860
2737
|
}
|
|
2861
2738
|
}
|
|
2862
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
2739
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
2863
2740
|
const { type, elm, sel } = vnode;
|
|
2864
2741
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
2865
2742
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
2866
2743
|
if (doRemove) {
|
|
2867
|
-
|
|
2744
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
2745
|
+
// but the removal used here is from the owner instead.
|
|
2746
|
+
removeNode(elm, parent, renderer);
|
|
2868
2747
|
}
|
|
2869
|
-
const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
|
|
2870
2748
|
switch (type) {
|
|
2871
|
-
case 2 /* Element */:
|
|
2872
|
-
|
|
2749
|
+
case 2 /* Element */: {
|
|
2750
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
2751
|
+
// Only required for synthetic shadow.
|
|
2752
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
2753
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
2873
2754
|
break;
|
|
2755
|
+
}
|
|
2874
2756
|
case 3 /* CustomElement */: {
|
|
2875
2757
|
const { vm } = vnode;
|
|
2876
2758
|
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
@@ -2881,11 +2763,11 @@ var LWC = (function (exports) {
|
|
|
2881
2763
|
}
|
|
2882
2764
|
}
|
|
2883
2765
|
}
|
|
2884
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
2766
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
2885
2767
|
for (; start < end; ++start) {
|
|
2886
2768
|
const ch = vnodes[start];
|
|
2887
2769
|
if (isVNode(ch)) {
|
|
2888
|
-
unmount(ch, parent, doRemove);
|
|
2770
|
+
unmount(ch, parent, renderer, doRemove);
|
|
2889
2771
|
}
|
|
2890
2772
|
}
|
|
2891
2773
|
}
|
|
@@ -2899,48 +2781,53 @@ var LWC = (function (exports) {
|
|
|
2899
2781
|
elm.$shadowToken$ = token;
|
|
2900
2782
|
}
|
|
2901
2783
|
// Set the scope token class for *.scoped.css styles
|
|
2902
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
2784
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
2903
2785
|
const { cmpTemplate, context } = owner;
|
|
2786
|
+
const { getClassList } = renderer;
|
|
2904
2787
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
2905
2788
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
2906
|
-
|
|
2789
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
2790
|
+
// probably we should have a renderer api for just the add operation
|
|
2791
|
+
getClassList(elm).add(token);
|
|
2907
2792
|
}
|
|
2908
2793
|
}
|
|
2909
|
-
function linkNodeToShadow(elm, owner) {
|
|
2794
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
2910
2795
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
2796
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
2911
2797
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
2912
|
-
if (isSyntheticShadowDefined
|
|
2798
|
+
if (isSyntheticShadowDefined) {
|
|
2913
2799
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
2914
2800
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
2915
2801
|
}
|
|
2916
2802
|
}
|
|
2917
2803
|
}
|
|
2918
|
-
function updateTextContent(vnode) {
|
|
2804
|
+
function updateTextContent(vnode, renderer) {
|
|
2919
2805
|
const { elm, text } = vnode;
|
|
2920
|
-
setText
|
|
2806
|
+
const { setText } = renderer;
|
|
2807
|
+
setText(elm, text);
|
|
2921
2808
|
}
|
|
2922
|
-
function insertNode(node, parent, anchor) {
|
|
2923
|
-
insert
|
|
2809
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
2810
|
+
renderer.insert(node, parent, anchor);
|
|
2924
2811
|
}
|
|
2925
|
-
function removeNode(node, parent) {
|
|
2926
|
-
remove
|
|
2812
|
+
function removeNode(node, parent, renderer) {
|
|
2813
|
+
renderer.remove(node, parent);
|
|
2927
2814
|
}
|
|
2928
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
2815
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
2929
2816
|
if (isNull(oldVnode)) {
|
|
2930
|
-
applyEventListeners(vnode);
|
|
2931
|
-
applyStaticClassAttribute(vnode);
|
|
2932
|
-
applyStaticStyleAttribute(vnode);
|
|
2817
|
+
applyEventListeners(vnode, renderer);
|
|
2818
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
2819
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
2933
2820
|
}
|
|
2934
2821
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
2935
2822
|
// value is set before type=radio.
|
|
2936
|
-
patchClassAttribute(oldVnode, vnode);
|
|
2937
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
2938
|
-
patchAttributes(oldVnode, vnode);
|
|
2939
|
-
patchProps(oldVnode, vnode);
|
|
2823
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
2824
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
2825
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
2826
|
+
patchProps(oldVnode, vnode, renderer);
|
|
2940
2827
|
}
|
|
2941
|
-
function fallbackElmHook(elm, vnode) {
|
|
2828
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
2942
2829
|
const { owner } = vnode;
|
|
2943
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
2830
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
2944
2831
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
2945
2832
|
const { data: { context }, } = vnode;
|
|
2946
2833
|
const { stylesheetToken } = owner.context;
|
|
@@ -2980,7 +2867,7 @@ var LWC = (function (exports) {
|
|
|
2980
2867
|
vnode.children = EmptyArray;
|
|
2981
2868
|
}
|
|
2982
2869
|
}
|
|
2983
|
-
function createViewModelHook(elm, vnode) {
|
|
2870
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
2984
2871
|
let vm = getAssociatedVMIfPresent(elm);
|
|
2985
2872
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
2986
2873
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -2989,7 +2876,7 @@ var LWC = (function (exports) {
|
|
|
2989
2876
|
return vm;
|
|
2990
2877
|
}
|
|
2991
2878
|
const { sel, mode, ctor, owner } = vnode;
|
|
2992
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
2879
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
2993
2880
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
2994
2881
|
const { stylesheetToken } = owner.context;
|
|
2995
2882
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -2998,7 +2885,7 @@ var LWC = (function (exports) {
|
|
|
2998
2885
|
setElementShadowToken(elm, stylesheetToken);
|
|
2999
2886
|
}
|
|
3000
2887
|
}
|
|
3001
|
-
vm = createVM(elm, ctor, {
|
|
2888
|
+
vm = createVM(elm, ctor, renderer, {
|
|
3002
2889
|
mode,
|
|
3003
2890
|
owner,
|
|
3004
2891
|
tagName: sel,
|
|
@@ -3070,7 +2957,7 @@ var LWC = (function (exports) {
|
|
|
3070
2957
|
}
|
|
3071
2958
|
return map;
|
|
3072
2959
|
}
|
|
3073
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
2960
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
3074
2961
|
let oldStartIdx = 0;
|
|
3075
2962
|
let newStartIdx = 0;
|
|
3076
2963
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -3099,26 +2986,26 @@ var LWC = (function (exports) {
|
|
|
3099
2986
|
newEndVnode = newCh[--newEndIdx];
|
|
3100
2987
|
}
|
|
3101
2988
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
3102
|
-
patch(oldStartVnode, newStartVnode);
|
|
2989
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
3103
2990
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3104
2991
|
newStartVnode = newCh[++newStartIdx];
|
|
3105
2992
|
}
|
|
3106
2993
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
3107
|
-
patch(oldEndVnode, newEndVnode);
|
|
2994
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
3108
2995
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3109
2996
|
newEndVnode = newCh[--newEndIdx];
|
|
3110
2997
|
}
|
|
3111
2998
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
3112
2999
|
// Vnode moved right
|
|
3113
|
-
patch(oldStartVnode, newEndVnode);
|
|
3114
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
3000
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
3001
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
3115
3002
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3116
3003
|
newEndVnode = newCh[--newEndIdx];
|
|
3117
3004
|
}
|
|
3118
3005
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
3119
3006
|
// Vnode moved left
|
|
3120
|
-
patch(oldEndVnode, newStartVnode);
|
|
3121
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
3007
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
3008
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
3122
3009
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3123
3010
|
newStartVnode = newCh[++newStartIdx];
|
|
3124
3011
|
}
|
|
@@ -3129,7 +3016,7 @@ var LWC = (function (exports) {
|
|
|
3129
3016
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
3130
3017
|
if (isUndefined$1(idxInOld)) {
|
|
3131
3018
|
// New element
|
|
3132
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
3019
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
3133
3020
|
newStartVnode = newCh[++newStartIdx];
|
|
3134
3021
|
}
|
|
3135
3022
|
else {
|
|
@@ -3137,10 +3024,10 @@ var LWC = (function (exports) {
|
|
|
3137
3024
|
if (isVNode(elmToMove)) {
|
|
3138
3025
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
3139
3026
|
// New element
|
|
3140
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
3027
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
3141
3028
|
}
|
|
3142
3029
|
else {
|
|
3143
|
-
patch(elmToMove, newStartVnode);
|
|
3030
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
3144
3031
|
// Delete the old child, but copy the array since it is read-only.
|
|
3145
3032
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
3146
3033
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -3152,7 +3039,7 @@ var LWC = (function (exports) {
|
|
|
3152
3039
|
}
|
|
3153
3040
|
// We've already cloned at least once, so it's no longer read-only
|
|
3154
3041
|
oldCh[idxInOld] = undefined;
|
|
3155
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
3042
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
3156
3043
|
}
|
|
3157
3044
|
}
|
|
3158
3045
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -3169,25 +3056,25 @@ var LWC = (function (exports) {
|
|
|
3169
3056
|
n = newCh[++i];
|
|
3170
3057
|
} while (!isVNode(n) && i < newChEnd);
|
|
3171
3058
|
before = isVNode(n) ? n.elm : null;
|
|
3172
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
3059
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
3173
3060
|
}
|
|
3174
3061
|
else {
|
|
3175
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
3062
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
3176
3063
|
}
|
|
3177
3064
|
}
|
|
3178
3065
|
}
|
|
3179
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
3066
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
3180
3067
|
const c1Length = c1.length;
|
|
3181
3068
|
const c2Length = c2.length;
|
|
3182
3069
|
if (c1Length === 0) {
|
|
3183
3070
|
// the old list is empty, we can directly insert anything new
|
|
3184
|
-
mountVNodes(c2, parent, null);
|
|
3071
|
+
mountVNodes(c2, parent, renderer, null);
|
|
3185
3072
|
return;
|
|
3186
3073
|
}
|
|
3187
3074
|
if (c2Length === 0) {
|
|
3188
3075
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
3189
3076
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
3190
|
-
unmountVNodes(c1, parent, true);
|
|
3077
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
3191
3078
|
return;
|
|
3192
3079
|
}
|
|
3193
3080
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -3200,16 +3087,16 @@ var LWC = (function (exports) {
|
|
|
3200
3087
|
if (isVNode(n1)) {
|
|
3201
3088
|
if (isVNode(n2)) {
|
|
3202
3089
|
// both vnodes are equivalent, and we just need to patch them
|
|
3203
|
-
patch(n1, n2);
|
|
3090
|
+
patch(n1, n2, renderer);
|
|
3204
3091
|
anchor = n2.elm;
|
|
3205
3092
|
}
|
|
3206
3093
|
else {
|
|
3207
3094
|
// removing the old vnode since the new one is null
|
|
3208
|
-
unmount(n1, parent, true);
|
|
3095
|
+
unmount(n1, parent, renderer, true);
|
|
3209
3096
|
}
|
|
3210
3097
|
}
|
|
3211
3098
|
else if (isVNode(n2)) {
|
|
3212
|
-
mount(n2, parent, anchor);
|
|
3099
|
+
mount(n2, parent, renderer, anchor);
|
|
3213
3100
|
anchor = n2.elm;
|
|
3214
3101
|
}
|
|
3215
3102
|
}
|
|
@@ -3226,6 +3113,17 @@ var LWC = (function (exports) {
|
|
|
3226
3113
|
function addVNodeToChildLWC(vnode) {
|
|
3227
3114
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
3228
3115
|
}
|
|
3116
|
+
// [st]atic node
|
|
3117
|
+
function st(fragment, key) {
|
|
3118
|
+
return {
|
|
3119
|
+
type: 4 /* Static */,
|
|
3120
|
+
sel: undefined,
|
|
3121
|
+
key,
|
|
3122
|
+
elm: undefined,
|
|
3123
|
+
fragment,
|
|
3124
|
+
owner: getVMBeingRendered(),
|
|
3125
|
+
};
|
|
3126
|
+
}
|
|
3229
3127
|
// [h]tml node
|
|
3230
3128
|
function h(sel, data, children = EmptyArray) {
|
|
3231
3129
|
const vmBeingRendered = getVMBeingRendered();
|
|
@@ -3502,6 +3400,7 @@ var LWC = (function (exports) {
|
|
|
3502
3400
|
co,
|
|
3503
3401
|
dc,
|
|
3504
3402
|
ti,
|
|
3403
|
+
st,
|
|
3505
3404
|
gid,
|
|
3506
3405
|
fid,
|
|
3507
3406
|
shc,
|
|
@@ -3525,7 +3424,7 @@ var LWC = (function (exports) {
|
|
|
3525
3424
|
}, [api.t(content)]);
|
|
3526
3425
|
}
|
|
3527
3426
|
function updateStylesheetToken(vm, template) {
|
|
3528
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
3427
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
3529
3428
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
3530
3429
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
3531
3430
|
const { hasScopedStyles } = context;
|
|
@@ -3536,10 +3435,10 @@ var LWC = (function (exports) {
|
|
|
3536
3435
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
3537
3436
|
if (!isUndefined$1(oldToken)) {
|
|
3538
3437
|
if (oldHasTokenInClass) {
|
|
3539
|
-
getClassList
|
|
3438
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
3540
3439
|
}
|
|
3541
3440
|
if (oldHasTokenInAttribute) {
|
|
3542
|
-
removeAttribute
|
|
3441
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
3543
3442
|
}
|
|
3544
3443
|
}
|
|
3545
3444
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -3550,11 +3449,11 @@ var LWC = (function (exports) {
|
|
|
3550
3449
|
// Set the new styling token on the host element
|
|
3551
3450
|
if (!isUndefined$1(newToken)) {
|
|
3552
3451
|
if (hasScopedStyles) {
|
|
3553
|
-
getClassList
|
|
3452
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
3554
3453
|
newHasTokenInClass = true;
|
|
3555
3454
|
}
|
|
3556
3455
|
if (isSyntheticShadow) {
|
|
3557
|
-
setAttribute
|
|
3456
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
3558
3457
|
newHasTokenInAttribute = true;
|
|
3559
3458
|
}
|
|
3560
3459
|
}
|
|
@@ -3634,19 +3533,18 @@ var LWC = (function (exports) {
|
|
|
3634
3533
|
return owner;
|
|
3635
3534
|
}
|
|
3636
3535
|
function createStylesheet(vm, stylesheets) {
|
|
3637
|
-
const { renderMode, shadowMode } = vm;
|
|
3536
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
3638
3537
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
3639
3538
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
3640
|
-
insertStylesheet
|
|
3539
|
+
insertStylesheet(stylesheets[i]);
|
|
3641
3540
|
}
|
|
3642
3541
|
}
|
|
3643
|
-
else if (ssr
|
|
3542
|
+
else if (ssr || vm.hydrated) {
|
|
3644
3543
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3645
3544
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3646
3545
|
// the first time the VM renders.
|
|
3647
3546
|
// native shadow or light DOM, SSR
|
|
3648
|
-
|
|
3649
|
-
return createInlineStyleVNode(combinedStylesheetContent);
|
|
3547
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3650
3548
|
}
|
|
3651
3549
|
else {
|
|
3652
3550
|
// native shadow or light DOM, DOM renderer
|
|
@@ -3654,7 +3552,7 @@ var LWC = (function (exports) {
|
|
|
3654
3552
|
// null root means a global style
|
|
3655
3553
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
3656
3554
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
3657
|
-
insertStylesheet
|
|
3555
|
+
insertStylesheet(stylesheets[i], target);
|
|
3658
3556
|
}
|
|
3659
3557
|
}
|
|
3660
3558
|
return null;
|
|
@@ -3732,6 +3630,59 @@ var LWC = (function (exports) {
|
|
|
3732
3630
|
assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
|
|
3733
3631
|
}
|
|
3734
3632
|
}
|
|
3633
|
+
function buildParseFragmentFn(createFragmentFn) {
|
|
3634
|
+
return (strings, ...keys) => {
|
|
3635
|
+
const cache = create(null);
|
|
3636
|
+
return function () {
|
|
3637
|
+
const { context: { hasScopedStyles, stylesheetToken }, shadowMode, renderer, } = getVMBeingRendered();
|
|
3638
|
+
const hasStyleToken = !isUndefined$1(stylesheetToken);
|
|
3639
|
+
const isSyntheticShadow = shadowMode === 1 /* Synthetic */;
|
|
3640
|
+
let cacheKey = 0;
|
|
3641
|
+
if (hasStyleToken && hasScopedStyles) {
|
|
3642
|
+
cacheKey |= 1 /* HAS_SCOPED_STYLE */;
|
|
3643
|
+
}
|
|
3644
|
+
if (hasStyleToken && isSyntheticShadow) {
|
|
3645
|
+
cacheKey |= 2 /* SHADOW_MODE_SYNTHETIC */;
|
|
3646
|
+
}
|
|
3647
|
+
if (!isUndefined$1(cache[cacheKey])) {
|
|
3648
|
+
return cache[cacheKey];
|
|
3649
|
+
}
|
|
3650
|
+
const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetToken : '';
|
|
3651
|
+
const classAttrToken = hasScopedStyles && hasStyleToken ? ` class="${stylesheetToken}"` : '';
|
|
3652
|
+
const attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
3653
|
+
let htmlFragment = '';
|
|
3654
|
+
for (let i = 0, n = keys.length; i < n; i++) {
|
|
3655
|
+
switch (keys[i]) {
|
|
3656
|
+
case 0: // styleToken in existing class attr
|
|
3657
|
+
htmlFragment += strings[i] + classToken;
|
|
3658
|
+
break;
|
|
3659
|
+
case 1: // styleToken for added class attr
|
|
3660
|
+
htmlFragment += strings[i] + classAttrToken;
|
|
3661
|
+
break;
|
|
3662
|
+
case 2: // styleToken as attr
|
|
3663
|
+
htmlFragment += strings[i] + attrToken;
|
|
3664
|
+
break;
|
|
3665
|
+
case 3: // ${1}${2}
|
|
3666
|
+
htmlFragment += strings[i] + classAttrToken + attrToken;
|
|
3667
|
+
break;
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
htmlFragment += strings[strings.length - 1];
|
|
3671
|
+
cache[cacheKey] = createFragmentFn(htmlFragment, renderer);
|
|
3672
|
+
return cache[cacheKey];
|
|
3673
|
+
};
|
|
3674
|
+
};
|
|
3675
|
+
}
|
|
3676
|
+
// Note: at the moment this code executes, we don't have a renderer yet.
|
|
3677
|
+
const parseFragment = buildParseFragmentFn((html, renderer) => {
|
|
3678
|
+
const { createFragment } = renderer;
|
|
3679
|
+
return createFragment(html);
|
|
3680
|
+
});
|
|
3681
|
+
const parseSVGFragment = buildParseFragmentFn((html, renderer) => {
|
|
3682
|
+
const { createFragment, getFirstChild } = renderer;
|
|
3683
|
+
const fragment = createFragment('<svg>' + html + '</svg>');
|
|
3684
|
+
return getFirstChild(fragment);
|
|
3685
|
+
});
|
|
3735
3686
|
function evaluateTemplate(vm, html) {
|
|
3736
3687
|
const isUpdatingTemplateInception = isUpdatingTemplate;
|
|
3737
3688
|
const vmOfTemplateBeingUpdatedInception = vmBeingRendered;
|
|
@@ -3769,7 +3720,7 @@ var LWC = (function (exports) {
|
|
|
3769
3720
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
3770
3721
|
// re-rendering.
|
|
3771
3722
|
const stylesheetsContent = getStylesheetsContent(vm, html);
|
|
3772
|
-
context.
|
|
3723
|
+
context.styleVNodes =
|
|
3773
3724
|
stylesheetsContent.length === 0
|
|
3774
3725
|
? null
|
|
3775
3726
|
: createStylesheet(vm, stylesheetsContent);
|
|
@@ -3781,9 +3732,9 @@ var LWC = (function (exports) {
|
|
|
3781
3732
|
// Set the global flag that template is being updated
|
|
3782
3733
|
isUpdatingTemplate = true;
|
|
3783
3734
|
vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
|
|
3784
|
-
const {
|
|
3785
|
-
if (!isNull(
|
|
3786
|
-
ArrayUnshift.
|
|
3735
|
+
const { styleVNodes } = context;
|
|
3736
|
+
if (!isNull(styleVNodes)) {
|
|
3737
|
+
ArrayUnshift.apply(vnodes, styleVNodes);
|
|
3787
3738
|
}
|
|
3788
3739
|
});
|
|
3789
3740
|
}, () => {
|
|
@@ -4053,9 +4004,20 @@ var LWC = (function (exports) {
|
|
|
4053
4004
|
|
|
4054
4005
|
resetComponentStateWhenRemoved(vm);
|
|
4055
4006
|
}
|
|
4056
|
-
function createVM(elm, ctor, options) {
|
|
4057
|
-
var _a;
|
|
4058
4007
|
|
|
4008
|
+
function getNearestShadowAncestor(vm) {
|
|
4009
|
+
let ancestor = vm.owner;
|
|
4010
|
+
|
|
4011
|
+
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
4012
|
+
/* Light */
|
|
4013
|
+
) {
|
|
4014
|
+
ancestor = ancestor.owner;
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
return ancestor;
|
|
4018
|
+
}
|
|
4019
|
+
|
|
4020
|
+
function createVM(elm, ctor, renderer, options) {
|
|
4059
4021
|
const {
|
|
4060
4022
|
mode,
|
|
4061
4023
|
owner,
|
|
@@ -4085,28 +4047,29 @@ var LWC = (function (exports) {
|
|
|
4085
4047
|
cmpTemplate: null,
|
|
4086
4048
|
hydrated: Boolean(hydrated),
|
|
4087
4049
|
renderMode: def.renderMode,
|
|
4088
|
-
shadowMode: computeShadowMode(def, owner),
|
|
4089
|
-
nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
|
|
4090
4050
|
context: {
|
|
4091
4051
|
stylesheetToken: undefined,
|
|
4092
4052
|
hasTokenInClass: undefined,
|
|
4093
4053
|
hasTokenInAttribute: undefined,
|
|
4094
4054
|
hasScopedStyles: undefined,
|
|
4095
|
-
|
|
4055
|
+
styleVNodes: null,
|
|
4096
4056
|
tplCache: EmptyObject,
|
|
4097
4057
|
wiredConnecting: EmptyArray,
|
|
4098
4058
|
wiredDisconnecting: EmptyArray
|
|
4099
4059
|
},
|
|
4100
4060
|
// Properties set right after VM creation.
|
|
4101
4061
|
tro: null,
|
|
4062
|
+
shadowMode: null,
|
|
4102
4063
|
// Properties set by the LightningElement constructor.
|
|
4103
4064
|
component: null,
|
|
4104
4065
|
shadowRoot: null,
|
|
4105
4066
|
renderRoot: null,
|
|
4106
4067
|
callHook,
|
|
4107
4068
|
setHook,
|
|
4108
|
-
getHook
|
|
4069
|
+
getHook,
|
|
4070
|
+
renderer
|
|
4109
4071
|
};
|
|
4072
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
4110
4073
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
4111
4074
|
|
|
4112
4075
|
|
|
@@ -4119,12 +4082,17 @@ var LWC = (function (exports) {
|
|
|
4119
4082
|
return vm;
|
|
4120
4083
|
}
|
|
4121
4084
|
|
|
4122
|
-
function computeShadowMode(
|
|
4123
|
-
|
|
4124
|
-
|
|
4085
|
+
function computeShadowMode(vm, renderer) {
|
|
4086
|
+
const {
|
|
4087
|
+
def
|
|
4088
|
+
} = vm;
|
|
4089
|
+
const {
|
|
4090
|
+
isSyntheticShadowDefined,
|
|
4091
|
+
isNativeShadowDefined
|
|
4092
|
+
} = renderer;
|
|
4125
4093
|
let shadowMode;
|
|
4126
4094
|
|
|
4127
|
-
if (isSyntheticShadowDefined
|
|
4095
|
+
if (isSyntheticShadowDefined) {
|
|
4128
4096
|
if (def.renderMode === 0
|
|
4129
4097
|
/* Light */
|
|
4130
4098
|
) {
|
|
@@ -4133,7 +4101,7 @@ var LWC = (function (exports) {
|
|
|
4133
4101
|
shadowMode = 0
|
|
4134
4102
|
/* Native */
|
|
4135
4103
|
;
|
|
4136
|
-
} else if (isNativeShadowDefined
|
|
4104
|
+
} else if (isNativeShadowDefined) {
|
|
4137
4105
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
4138
4106
|
// the if-condition.
|
|
4139
4107
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -4144,13 +4112,23 @@ var LWC = (function (exports) {
|
|
|
4144
4112
|
/* Native */
|
|
4145
4113
|
;
|
|
4146
4114
|
} else {
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4115
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
4116
|
+
|
|
4117
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
4118
|
+
/* Native */
|
|
4119
|
+
) {
|
|
4120
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
4121
|
+
// transitively opts all of its descendants into native.
|
|
4122
|
+
shadowMode = 0
|
|
4123
|
+
/* Native */
|
|
4124
|
+
;
|
|
4125
|
+
} else {
|
|
4126
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
4127
|
+
// to be native.
|
|
4128
|
+
shadowMode = 1
|
|
4129
|
+
/* Synthetic */
|
|
4130
|
+
;
|
|
4131
|
+
}
|
|
4154
4132
|
}
|
|
4155
4133
|
} else {
|
|
4156
4134
|
shadowMode = 1
|
|
@@ -4197,7 +4175,8 @@ var LWC = (function (exports) {
|
|
|
4197
4175
|
function patchShadowRoot(vm, newCh) {
|
|
4198
4176
|
const {
|
|
4199
4177
|
renderRoot,
|
|
4200
|
-
children: oldCh
|
|
4178
|
+
children: oldCh,
|
|
4179
|
+
renderer
|
|
4201
4180
|
} = vm; // caching the new children collection
|
|
4202
4181
|
|
|
4203
4182
|
vm.children = newCh;
|
|
@@ -4213,7 +4192,7 @@ var LWC = (function (exports) {
|
|
|
4213
4192
|
, vm);
|
|
4214
4193
|
}, () => {
|
|
4215
4194
|
// job
|
|
4216
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
4195
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
4217
4196
|
}, () => {
|
|
4218
4197
|
// post
|
|
4219
4198
|
logOperationEnd(2
|
|
@@ -4238,10 +4217,13 @@ var LWC = (function (exports) {
|
|
|
4238
4217
|
const {
|
|
4239
4218
|
def: {
|
|
4240
4219
|
renderedCallback
|
|
4220
|
+
},
|
|
4221
|
+
renderer: {
|
|
4222
|
+
ssr
|
|
4241
4223
|
}
|
|
4242
4224
|
} = vm;
|
|
4243
4225
|
|
|
4244
|
-
if (isTrue(ssr
|
|
4226
|
+
if (isTrue(ssr)) {
|
|
4245
4227
|
return;
|
|
4246
4228
|
}
|
|
4247
4229
|
|
|
@@ -4466,14 +4448,17 @@ var LWC = (function (exports) {
|
|
|
4466
4448
|
function resetComponentRoot(vm) {
|
|
4467
4449
|
const {
|
|
4468
4450
|
children,
|
|
4469
|
-
renderRoot
|
|
4451
|
+
renderRoot,
|
|
4452
|
+
renderer: {
|
|
4453
|
+
remove
|
|
4454
|
+
}
|
|
4470
4455
|
} = vm;
|
|
4471
4456
|
|
|
4472
4457
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
4473
4458
|
const child = children[i];
|
|
4474
4459
|
|
|
4475
4460
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
4476
|
-
remove
|
|
4461
|
+
remove(child.elm, renderRoot);
|
|
4477
4462
|
}
|
|
4478
4463
|
}
|
|
4479
4464
|
|
|
@@ -4482,7 +4467,13 @@ var LWC = (function (exports) {
|
|
|
4482
4467
|
vm.velements = EmptyArray;
|
|
4483
4468
|
}
|
|
4484
4469
|
function scheduleRehydration(vm) {
|
|
4485
|
-
|
|
4470
|
+
const {
|
|
4471
|
+
renderer: {
|
|
4472
|
+
ssr
|
|
4473
|
+
}
|
|
4474
|
+
} = vm;
|
|
4475
|
+
|
|
4476
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
4486
4477
|
return;
|
|
4487
4478
|
}
|
|
4488
4479
|
|
|
@@ -4641,6 +4632,9 @@ var LWC = (function (exports) {
|
|
|
4641
4632
|
context: {
|
|
4642
4633
|
wiredConnecting,
|
|
4643
4634
|
wiredDisconnecting
|
|
4635
|
+
},
|
|
4636
|
+
renderer: {
|
|
4637
|
+
dispatchEvent
|
|
4644
4638
|
}
|
|
4645
4639
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
4646
4640
|
|
|
@@ -4664,7 +4658,7 @@ var LWC = (function (exports) {
|
|
|
4664
4658
|
}
|
|
4665
4659
|
|
|
4666
4660
|
});
|
|
4667
|
-
dispatchEvent
|
|
4661
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
4668
4662
|
});
|
|
4669
4663
|
}
|
|
4670
4664
|
|
|
@@ -4902,78 +4896,97 @@ var LWC = (function (exports) {
|
|
|
4902
4896
|
function hydrateVM(vm) {
|
|
4903
4897
|
const children = renderComponent(vm);
|
|
4904
4898
|
vm.children = children;
|
|
4905
|
-
const parentNode = vm
|
|
4906
|
-
hydrateChildren(getFirstChild
|
|
4899
|
+
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
4900
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
4907
4901
|
runRenderedCallback(vm);
|
|
4908
4902
|
}
|
|
4909
|
-
function hydrateNode(node, vnode) {
|
|
4903
|
+
function hydrateNode(node, vnode, renderer) {
|
|
4904
|
+
var _a, _b;
|
|
4910
4905
|
let hydratedNode;
|
|
4911
4906
|
switch (vnode.type) {
|
|
4912
4907
|
case 0 /* Text */:
|
|
4913
|
-
|
|
4908
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
4909
|
+
hydratedNode = hydrateText(node, vnode, renderer);
|
|
4914
4910
|
break;
|
|
4915
4911
|
case 1 /* Comment */:
|
|
4916
|
-
|
|
4912
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
4913
|
+
hydratedNode = hydrateComment(node, vnode, renderer);
|
|
4914
|
+
break;
|
|
4915
|
+
case 4 /* Static */:
|
|
4916
|
+
// VStatic are cacheable and cannot have custom renderer associated to them
|
|
4917
|
+
hydratedNode = hydrateStaticElement(node, vnode, renderer);
|
|
4917
4918
|
break;
|
|
4918
4919
|
case 2 /* Element */:
|
|
4919
|
-
hydratedNode = hydrateElement(node, vnode);
|
|
4920
|
+
hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
4920
4921
|
break;
|
|
4921
4922
|
case 3 /* CustomElement */:
|
|
4922
|
-
hydratedNode = hydrateCustomElement(node, vnode);
|
|
4923
|
+
hydratedNode = hydrateCustomElement(node, vnode, (_b = vnode.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
4923
4924
|
break;
|
|
4924
4925
|
}
|
|
4925
|
-
return nextSibling
|
|
4926
|
+
return renderer.nextSibling(hydratedNode);
|
|
4926
4927
|
}
|
|
4927
|
-
function hydrateText(node, vnode) {
|
|
4928
|
+
function hydrateText(node, vnode, renderer) {
|
|
4928
4929
|
var _a;
|
|
4929
|
-
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT
|
|
4930
|
-
return handleMismatch(node, vnode);
|
|
4930
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */, renderer)) {
|
|
4931
|
+
return handleMismatch(node, vnode, renderer);
|
|
4931
4932
|
}
|
|
4932
|
-
setText
|
|
4933
|
+
const { setText } = renderer;
|
|
4934
|
+
setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
4933
4935
|
vnode.elm = node;
|
|
4934
4936
|
return node;
|
|
4935
4937
|
}
|
|
4936
|
-
function hydrateComment(node, vnode) {
|
|
4938
|
+
function hydrateComment(node, vnode, renderer) {
|
|
4937
4939
|
var _a;
|
|
4938
|
-
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT
|
|
4939
|
-
return handleMismatch(node, vnode);
|
|
4940
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */, renderer)) {
|
|
4941
|
+
return handleMismatch(node, vnode, renderer);
|
|
4940
4942
|
}
|
|
4941
|
-
setProperty
|
|
4943
|
+
const { setProperty } = renderer;
|
|
4944
|
+
setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
4942
4945
|
vnode.elm = node;
|
|
4943
4946
|
return node;
|
|
4944
4947
|
}
|
|
4945
|
-
function
|
|
4946
|
-
if (!
|
|
4947
|
-
|
|
4948
|
-
return handleMismatch(elm, vnode);
|
|
4948
|
+
function hydrateStaticElement(elm, vnode, renderer) {
|
|
4949
|
+
if (!areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
|
|
4950
|
+
return handleMismatch(elm, vnode, renderer);
|
|
4949
4951
|
}
|
|
4950
4952
|
vnode.elm = elm;
|
|
4953
|
+
return elm;
|
|
4954
|
+
}
|
|
4955
|
+
function hydrateElement(elm, vnode, renderer) {
|
|
4956
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
|
|
4957
|
+
!isMatchingElement(vnode, elm, renderer)) {
|
|
4958
|
+
return handleMismatch(elm, vnode, renderer);
|
|
4959
|
+
}
|
|
4960
|
+
vnode.elm = elm;
|
|
4961
|
+
const { owner } = vnode;
|
|
4951
4962
|
const { context } = vnode.data;
|
|
4952
4963
|
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
4953
4964
|
if (isDomManual) {
|
|
4954
4965
|
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
4955
4966
|
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
4956
|
-
const { props } = vnode
|
|
4967
|
+
const { data: { props }, } = vnode;
|
|
4968
|
+
const { getProperty } = renderer;
|
|
4957
4969
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
4958
|
-
if (getProperty
|
|
4970
|
+
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
|
4959
4971
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
4960
4972
|
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
4961
4973
|
}
|
|
4962
4974
|
}
|
|
4963
4975
|
}
|
|
4964
|
-
patchElementPropsAndAttrs(vnode);
|
|
4976
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
4965
4977
|
if (!isDomManual) {
|
|
4966
|
-
|
|
4978
|
+
const { getFirstChild } = renderer;
|
|
4979
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
4967
4980
|
}
|
|
4968
4981
|
return elm;
|
|
4969
4982
|
}
|
|
4970
|
-
function hydrateCustomElement(elm, vnode) {
|
|
4971
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
4972
|
-
!isMatchingElement(vnode, elm)) {
|
|
4973
|
-
return handleMismatch(elm, vnode);
|
|
4983
|
+
function hydrateCustomElement(elm, vnode, renderer) {
|
|
4984
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
|
|
4985
|
+
!isMatchingElement(vnode, elm, renderer)) {
|
|
4986
|
+
return handleMismatch(elm, vnode, renderer);
|
|
4974
4987
|
}
|
|
4975
4988
|
const { sel, mode, ctor, owner } = vnode;
|
|
4976
|
-
const vm = createVM(elm, ctor, {
|
|
4989
|
+
const vm = createVM(elm, ctor, renderer, {
|
|
4977
4990
|
mode,
|
|
4978
4991
|
owner,
|
|
4979
4992
|
tagName: sel,
|
|
@@ -4982,12 +4995,13 @@ var LWC = (function (exports) {
|
|
|
4982
4995
|
vnode.elm = elm;
|
|
4983
4996
|
vnode.vm = vm;
|
|
4984
4997
|
allocateChildren(vnode, vm);
|
|
4985
|
-
patchElementPropsAndAttrs(vnode);
|
|
4998
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
4986
4999
|
runConnectedCallback(vm);
|
|
4987
5000
|
if (vm.renderMode !== 0 /* Light */) {
|
|
5001
|
+
const { getFirstChild } = renderer;
|
|
4988
5002
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
4989
5003
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
4990
|
-
hydrateChildren(getFirstChild
|
|
5004
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
4991
5005
|
}
|
|
4992
5006
|
hydrateVM(vm);
|
|
4993
5007
|
return elm;
|
|
@@ -4995,78 +5009,89 @@ var LWC = (function (exports) {
|
|
|
4995
5009
|
function hydrateChildren(node, children, parentNode, owner) {
|
|
4996
5010
|
let nextNode = node;
|
|
4997
5011
|
let anchor = null;
|
|
5012
|
+
const { renderer } = owner;
|
|
4998
5013
|
for (let i = 0; i < children.length; i++) {
|
|
4999
5014
|
const childVnode = children[i];
|
|
5000
5015
|
if (!isNull(childVnode)) {
|
|
5001
5016
|
if (nextNode) {
|
|
5002
|
-
nextNode = hydrateNode(nextNode, childVnode);
|
|
5017
|
+
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
5003
5018
|
anchor = childVnode.elm;
|
|
5004
5019
|
}
|
|
5005
5020
|
else {
|
|
5006
5021
|
hasMismatch = true;
|
|
5007
|
-
mount(childVnode, parentNode, anchor);
|
|
5022
|
+
mount(childVnode, parentNode, renderer, anchor);
|
|
5008
5023
|
anchor = childVnode.elm;
|
|
5009
5024
|
}
|
|
5010
5025
|
}
|
|
5011
5026
|
}
|
|
5012
5027
|
if (nextNode) {
|
|
5013
5028
|
hasMismatch = true;
|
|
5029
|
+
// nextSibling is mostly harmless, and since we don't have
|
|
5030
|
+
// a good reference to what element to act upon, we instead
|
|
5031
|
+
// rely on the vm's associated renderer for navigating to the
|
|
5032
|
+
// next node in the list to be hydrated.
|
|
5033
|
+
const { nextSibling } = renderer;
|
|
5014
5034
|
do {
|
|
5015
5035
|
const current = nextNode;
|
|
5016
|
-
nextNode = nextSibling
|
|
5017
|
-
removeNode(current, parentNode);
|
|
5036
|
+
nextNode = nextSibling(nextNode);
|
|
5037
|
+
removeNode(current, parentNode, renderer);
|
|
5018
5038
|
} while (nextNode);
|
|
5019
5039
|
}
|
|
5020
5040
|
}
|
|
5021
|
-
function handleMismatch(node, vnode,
|
|
5041
|
+
function handleMismatch(node, vnode, renderer) {
|
|
5022
5042
|
hasMismatch = true;
|
|
5023
|
-
const
|
|
5024
|
-
|
|
5025
|
-
|
|
5043
|
+
const { getProperty } = renderer;
|
|
5044
|
+
const parentNode = getProperty(node, 'parentNode');
|
|
5045
|
+
mount(vnode, parentNode, renderer, node);
|
|
5046
|
+
removeNode(node, parentNode, renderer);
|
|
5026
5047
|
return vnode.elm;
|
|
5027
5048
|
}
|
|
5028
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
5029
|
-
applyEventListeners(vnode);
|
|
5030
|
-
patchProps(null, vnode);
|
|
5049
|
+
function patchElementPropsAndAttrs(vnode, renderer) {
|
|
5050
|
+
applyEventListeners(vnode, renderer);
|
|
5051
|
+
patchProps(null, vnode, renderer);
|
|
5031
5052
|
}
|
|
5032
|
-
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
5033
|
-
|
|
5053
|
+
function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
5054
|
+
const { getProperty } = renderer;
|
|
5055
|
+
if (getProperty(node, 'nodeType') !== nodeType) {
|
|
5034
5056
|
return false;
|
|
5035
5057
|
}
|
|
5036
5058
|
return true;
|
|
5037
5059
|
}
|
|
5038
|
-
function isMatchingElement(vnode, elm) {
|
|
5039
|
-
|
|
5060
|
+
function isMatchingElement(vnode, elm, renderer) {
|
|
5061
|
+
const { getProperty } = renderer;
|
|
5062
|
+
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
5040
5063
|
return false;
|
|
5041
5064
|
}
|
|
5042
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
5043
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
5044
|
-
const hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
5065
|
+
const hasIncompatibleAttrs = validateAttrs(vnode, elm, renderer);
|
|
5066
|
+
const hasIncompatibleClass = validateClassAttr(vnode, elm, renderer);
|
|
5067
|
+
const hasIncompatibleStyle = validateStyleAttr(vnode, elm, renderer);
|
|
5045
5068
|
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
5046
5069
|
}
|
|
5047
|
-
function validateAttrs(vnode, elm) {
|
|
5070
|
+
function validateAttrs(vnode, elm, renderer) {
|
|
5048
5071
|
const { data: { attrs = {} }, } = vnode;
|
|
5049
5072
|
let nodesAreCompatible = true;
|
|
5050
5073
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5051
5074
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5052
5075
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
5053
|
-
const
|
|
5076
|
+
const { getAttribute } = renderer;
|
|
5077
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
5054
5078
|
if (String(attrValue) !== elmAttrValue) {
|
|
5055
5079
|
nodesAreCompatible = false;
|
|
5056
5080
|
}
|
|
5057
5081
|
}
|
|
5058
5082
|
return nodesAreCompatible;
|
|
5059
5083
|
}
|
|
5060
|
-
function validateClassAttr(vnode, elm) {
|
|
5084
|
+
function validateClassAttr(vnode, elm, renderer) {
|
|
5061
5085
|
const { data: { className, classMap }, } = vnode;
|
|
5086
|
+
const { getProperty, getClassList } = renderer;
|
|
5062
5087
|
let nodesAreCompatible = true;
|
|
5063
|
-
if (!isUndefined$1(className) && String(className) !== getProperty
|
|
5088
|
+
if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
|
|
5064
5089
|
// className is used when class is bound to an expr.
|
|
5065
5090
|
nodesAreCompatible = false;
|
|
5066
5091
|
}
|
|
5067
5092
|
else if (!isUndefined$1(classMap)) {
|
|
5068
5093
|
// classMap is used when class is set to static value.
|
|
5069
|
-
const classList = getClassList
|
|
5094
|
+
const classList = getClassList(elm);
|
|
5070
5095
|
let computedClassName = '';
|
|
5071
5096
|
// all classes from the vnode should be in the element.classList
|
|
5072
5097
|
for (const name in classMap) {
|
|
@@ -5082,9 +5107,10 @@ var LWC = (function (exports) {
|
|
|
5082
5107
|
}
|
|
5083
5108
|
return nodesAreCompatible;
|
|
5084
5109
|
}
|
|
5085
|
-
function validateStyleAttr(vnode, elm) {
|
|
5110
|
+
function validateStyleAttr(vnode, elm, renderer) {
|
|
5086
5111
|
const { data: { style, styleDecls }, } = vnode;
|
|
5087
|
-
const
|
|
5112
|
+
const { getAttribute } = renderer;
|
|
5113
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
5088
5114
|
let nodesAreCompatible = true;
|
|
5089
5115
|
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
5090
5116
|
nodesAreCompatible = false;
|
|
@@ -5114,6 +5140,36 @@ var LWC = (function (exports) {
|
|
|
5114
5140
|
}
|
|
5115
5141
|
return nodesAreCompatible;
|
|
5116
5142
|
}
|
|
5143
|
+
function areCompatibleNodes(client, ssr, vnode, renderer) {
|
|
5144
|
+
const { getProperty, getAttribute } = renderer;
|
|
5145
|
+
if (getProperty(client, 'nodeType') === 3 /* TEXT */) {
|
|
5146
|
+
if (!hasCorrectNodeType(vnode, ssr, 3 /* TEXT */, renderer)) {
|
|
5147
|
+
return false;
|
|
5148
|
+
}
|
|
5149
|
+
return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
|
|
5150
|
+
}
|
|
5151
|
+
if (getProperty(client, 'nodeType') === 8 /* COMMENT */) {
|
|
5152
|
+
if (!hasCorrectNodeType(vnode, ssr, 8 /* COMMENT */, renderer)) {
|
|
5153
|
+
return false;
|
|
5154
|
+
}
|
|
5155
|
+
return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
|
|
5156
|
+
}
|
|
5157
|
+
if (!hasCorrectNodeType(vnode, ssr, 1 /* ELEMENT */, renderer)) {
|
|
5158
|
+
return false;
|
|
5159
|
+
}
|
|
5160
|
+
let isCompatibleElements = true;
|
|
5161
|
+
if (getProperty(client, 'tagName') !== getProperty(ssr, 'tagName')) {
|
|
5162
|
+
return false;
|
|
5163
|
+
}
|
|
5164
|
+
const clientAttrsNames = getProperty(client, 'getAttributeNames').call(client);
|
|
5165
|
+
clientAttrsNames.forEach((attrName) => {
|
|
5166
|
+
if (getAttribute(client, attrName) !== getAttribute(ssr, attrName)) {
|
|
5167
|
+
logError(`Mismatch hydrating element <${getProperty(client, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute(client, attrName)}" but found "${getAttribute(ssr, attrName)}"`, vnode.owner);
|
|
5168
|
+
isCompatibleElements = false;
|
|
5169
|
+
}
|
|
5170
|
+
});
|
|
5171
|
+
return isCompatibleElements;
|
|
5172
|
+
}
|
|
5117
5173
|
|
|
5118
5174
|
/*
|
|
5119
5175
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5154,7 +5210,7 @@ var LWC = (function (exports) {
|
|
|
5154
5210
|
}
|
|
5155
5211
|
return ctor;
|
|
5156
5212
|
}
|
|
5157
|
-
/* version: 2.
|
|
5213
|
+
/* version: 2.15.0 */
|
|
5158
5214
|
|
|
5159
5215
|
/*
|
|
5160
5216
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5304,7 +5360,7 @@ var LWC = (function (exports) {
|
|
|
5304
5360
|
try {
|
|
5305
5361
|
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
5306
5362
|
// _wrapNativeSuper()
|
|
5307
|
-
// This is a problem because LWCUpgradableElement extends renderer.
|
|
5363
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
5308
5364
|
// get wrapped by babel.
|
|
5309
5365
|
const HTMLElementAlias = HTMLElement;
|
|
5310
5366
|
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
@@ -5358,8 +5414,17 @@ var LWC = (function (exports) {
|
|
|
5358
5414
|
hydrating = value;
|
|
5359
5415
|
}
|
|
5360
5416
|
const ssr = false;
|
|
5417
|
+
function isHydrating() {
|
|
5418
|
+
return hydrating;
|
|
5419
|
+
}
|
|
5361
5420
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
5362
5421
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
5422
|
+
function cloneNode(node, deep) {
|
|
5423
|
+
return node.cloneNode(deep);
|
|
5424
|
+
}
|
|
5425
|
+
function createFragment(html) {
|
|
5426
|
+
return document.createRange().createContextualFragment(html).firstChild;
|
|
5427
|
+
}
|
|
5363
5428
|
function createElement$1(tagName, namespace) {
|
|
5364
5429
|
return isUndefined$1(namespace)
|
|
5365
5430
|
? document.createElement(tagName)
|
|
@@ -5466,44 +5531,53 @@ var LWC = (function (exports) {
|
|
|
5466
5531
|
function isConnected(node) {
|
|
5467
5532
|
return node.isConnected;
|
|
5468
5533
|
}
|
|
5534
|
+
function assertInstanceOfHTMLElement(elm, msg) {
|
|
5535
|
+
assert.invariant(elm instanceof HTMLElement, msg);
|
|
5536
|
+
}
|
|
5469
5537
|
const HTMLElementExported = HTMLElementConstructor;
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5538
|
+
const renderer = {
|
|
5539
|
+
ssr,
|
|
5540
|
+
isNativeShadowDefined,
|
|
5541
|
+
isSyntheticShadowDefined,
|
|
5542
|
+
HTMLElementExported,
|
|
5543
|
+
isHydrating,
|
|
5544
|
+
insert,
|
|
5545
|
+
remove,
|
|
5546
|
+
cloneNode,
|
|
5547
|
+
createFragment,
|
|
5548
|
+
createElement: createElement$1,
|
|
5549
|
+
createText,
|
|
5550
|
+
createComment,
|
|
5551
|
+
nextSibling,
|
|
5552
|
+
attachShadow,
|
|
5553
|
+
getProperty,
|
|
5554
|
+
setProperty,
|
|
5555
|
+
setText,
|
|
5556
|
+
getAttribute,
|
|
5557
|
+
setAttribute,
|
|
5558
|
+
removeAttribute,
|
|
5559
|
+
addEventListener,
|
|
5560
|
+
removeEventListener,
|
|
5561
|
+
dispatchEvent,
|
|
5562
|
+
getClassList,
|
|
5563
|
+
setCSSStyleProperty,
|
|
5564
|
+
getBoundingClientRect,
|
|
5565
|
+
querySelector,
|
|
5566
|
+
querySelectorAll,
|
|
5567
|
+
getElementsByTagName,
|
|
5568
|
+
getElementsByClassName,
|
|
5569
|
+
getChildren,
|
|
5570
|
+
getChildNodes,
|
|
5571
|
+
getFirstChild,
|
|
5572
|
+
getFirstElementChild,
|
|
5573
|
+
getLastChild,
|
|
5574
|
+
getLastElementChild,
|
|
5575
|
+
isConnected,
|
|
5576
|
+
insertStylesheet,
|
|
5577
|
+
assertInstanceOfHTMLElement,
|
|
5578
|
+
defineCustomElement,
|
|
5579
|
+
getCustomElement,
|
|
5580
|
+
};
|
|
5507
5581
|
|
|
5508
5582
|
/*
|
|
5509
5583
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5525,7 +5599,7 @@ var LWC = (function (exports) {
|
|
|
5525
5599
|
}
|
|
5526
5600
|
}
|
|
5527
5601
|
function createVMWithProps(element, Ctor, props) {
|
|
5528
|
-
const vm = createVM(element, Ctor, {
|
|
5602
|
+
const vm = createVM(element, Ctor, renderer, {
|
|
5529
5603
|
mode: 'open',
|
|
5530
5604
|
owner: null,
|
|
5531
5605
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -5616,7 +5690,7 @@ var LWC = (function (exports) {
|
|
|
5616
5690
|
hydratedCustomElements.add(this);
|
|
5617
5691
|
}
|
|
5618
5692
|
else {
|
|
5619
|
-
createVM(this, Ctor, {
|
|
5693
|
+
createVM(this, Ctor, renderer, {
|
|
5620
5694
|
mode: 'open',
|
|
5621
5695
|
owner: null,
|
|
5622
5696
|
tagName: this.tagName,
|
|
@@ -5698,7 +5772,7 @@ var LWC = (function (exports) {
|
|
|
5698
5772
|
if (!isFunction$1(Ctor)) {
|
|
5699
5773
|
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
5700
5774
|
}
|
|
5701
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
5775
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
5702
5776
|
let wasComponentUpgraded = false;
|
|
5703
5777
|
// the custom element from the registry is expecting an upgrade callback
|
|
5704
5778
|
/**
|
|
@@ -5708,7 +5782,7 @@ var LWC = (function (exports) {
|
|
|
5708
5782
|
* an upgradable custom element.
|
|
5709
5783
|
*/
|
|
5710
5784
|
const element = new UpgradableConstructor((elm) => {
|
|
5711
|
-
createVM(elm, Ctor, {
|
|
5785
|
+
createVM(elm, Ctor, renderer, {
|
|
5712
5786
|
tagName: sel,
|
|
5713
5787
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
5714
5788
|
owner: null,
|
|
@@ -5792,7 +5866,7 @@ var LWC = (function (exports) {
|
|
|
5792
5866
|
});
|
|
5793
5867
|
freeze(LightningElement);
|
|
5794
5868
|
seal(LightningElement.prototype);
|
|
5795
|
-
/* version: 2.
|
|
5869
|
+
/* version: 2.15.0 */
|
|
5796
5870
|
|
|
5797
5871
|
exports.LightningElement = LightningElement;
|
|
5798
5872
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -5806,11 +5880,14 @@ var LWC = (function (exports) {
|
|
|
5806
5880
|
exports.hydrateComponent = hydrateComponent;
|
|
5807
5881
|
exports.isComponentConstructor = isComponentConstructor;
|
|
5808
5882
|
exports.isNodeFromTemplate = isNodeShadowed;
|
|
5883
|
+
exports.parseFragment = parseFragment;
|
|
5884
|
+
exports.parseSVGFragment = parseSVGFragment;
|
|
5809
5885
|
exports.readonly = readonly;
|
|
5810
5886
|
exports.register = register;
|
|
5811
5887
|
exports.registerComponent = registerComponent;
|
|
5812
5888
|
exports.registerDecorators = registerDecorators;
|
|
5813
5889
|
exports.registerTemplate = registerTemplate;
|
|
5890
|
+
exports.renderer = renderer;
|
|
5814
5891
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
5815
5892
|
exports.setFeatureFlag = setFeatureFlag;
|
|
5816
5893
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|