lwc 2.14.1 → 2.16.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 +598 -541
- package/dist/engine-dom/iife/es2017/engine-dom.js +600 -540
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +537 -485
- package/dist/engine-dom/iife/es5/engine-dom.js +768 -679
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +692 -621
- package/dist/engine-dom/umd/es2017/engine-dom.js +600 -540
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +537 -485
- package/dist/engine-dom/umd/es5/engine-dom.js +768 -679
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +692 -621
- package/dist/engine-server/commonjs/es2017/engine-server.js +455 -460
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +453 -461
- 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.16.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);
|
|
2665
|
+
}
|
|
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);
|
|
2802
2679
|
}
|
|
2803
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
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,34 +2721,36 @@ 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
2748
|
switch (type) {
|
|
2870
2749
|
case 2 /* Element */: {
|
|
2871
2750
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
2872
2751
|
// Only required for synthetic shadow.
|
|
2873
|
-
const
|
|
2874
|
-
unmountVNodes(vnode.children, elm,
|
|
2752
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
2753
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
2875
2754
|
break;
|
|
2876
2755
|
}
|
|
2877
2756
|
case 3 /* CustomElement */: {
|
|
@@ -2884,11 +2763,11 @@ var LWC = (function (exports) {
|
|
|
2884
2763
|
}
|
|
2885
2764
|
}
|
|
2886
2765
|
}
|
|
2887
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
2766
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
2888
2767
|
for (; start < end; ++start) {
|
|
2889
2768
|
const ch = vnodes[start];
|
|
2890
2769
|
if (isVNode(ch)) {
|
|
2891
|
-
unmount(ch, parent, doRemove);
|
|
2770
|
+
unmount(ch, parent, renderer, doRemove);
|
|
2892
2771
|
}
|
|
2893
2772
|
}
|
|
2894
2773
|
}
|
|
@@ -2902,48 +2781,53 @@ var LWC = (function (exports) {
|
|
|
2902
2781
|
elm.$shadowToken$ = token;
|
|
2903
2782
|
}
|
|
2904
2783
|
// Set the scope token class for *.scoped.css styles
|
|
2905
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
2784
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
2906
2785
|
const { cmpTemplate, context } = owner;
|
|
2786
|
+
const { getClassList } = renderer;
|
|
2907
2787
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
2908
2788
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
2909
|
-
|
|
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);
|
|
2910
2792
|
}
|
|
2911
2793
|
}
|
|
2912
|
-
function linkNodeToShadow(elm, owner) {
|
|
2794
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
2913
2795
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
2796
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
2914
2797
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
2915
|
-
if (isSyntheticShadowDefined
|
|
2798
|
+
if (isSyntheticShadowDefined) {
|
|
2916
2799
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
2917
2800
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
2918
2801
|
}
|
|
2919
2802
|
}
|
|
2920
2803
|
}
|
|
2921
|
-
function updateTextContent(vnode) {
|
|
2804
|
+
function updateTextContent(vnode, renderer) {
|
|
2922
2805
|
const { elm, text } = vnode;
|
|
2923
|
-
setText
|
|
2806
|
+
const { setText } = renderer;
|
|
2807
|
+
setText(elm, text);
|
|
2924
2808
|
}
|
|
2925
|
-
function insertNode(node, parent, anchor) {
|
|
2926
|
-
insert
|
|
2809
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
2810
|
+
renderer.insert(node, parent, anchor);
|
|
2927
2811
|
}
|
|
2928
|
-
function removeNode(node, parent) {
|
|
2929
|
-
remove
|
|
2812
|
+
function removeNode(node, parent, renderer) {
|
|
2813
|
+
renderer.remove(node, parent);
|
|
2930
2814
|
}
|
|
2931
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
2815
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
2932
2816
|
if (isNull(oldVnode)) {
|
|
2933
|
-
applyEventListeners(vnode);
|
|
2934
|
-
applyStaticClassAttribute(vnode);
|
|
2935
|
-
applyStaticStyleAttribute(vnode);
|
|
2817
|
+
applyEventListeners(vnode, renderer);
|
|
2818
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
2819
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
2936
2820
|
}
|
|
2937
2821
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
2938
2822
|
// value is set before type=radio.
|
|
2939
|
-
patchClassAttribute(oldVnode, vnode);
|
|
2940
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
2941
|
-
patchAttributes(oldVnode, vnode);
|
|
2942
|
-
patchProps(oldVnode, vnode);
|
|
2823
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
2824
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
2825
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
2826
|
+
patchProps(oldVnode, vnode, renderer);
|
|
2943
2827
|
}
|
|
2944
|
-
function fallbackElmHook(elm, vnode) {
|
|
2828
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
2945
2829
|
const { owner } = vnode;
|
|
2946
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
2830
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
2947
2831
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
2948
2832
|
const { data: { context }, } = vnode;
|
|
2949
2833
|
const { stylesheetToken } = owner.context;
|
|
@@ -2983,7 +2867,7 @@ var LWC = (function (exports) {
|
|
|
2983
2867
|
vnode.children = EmptyArray;
|
|
2984
2868
|
}
|
|
2985
2869
|
}
|
|
2986
|
-
function createViewModelHook(elm, vnode) {
|
|
2870
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
2987
2871
|
let vm = getAssociatedVMIfPresent(elm);
|
|
2988
2872
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
2989
2873
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -2992,7 +2876,7 @@ var LWC = (function (exports) {
|
|
|
2992
2876
|
return vm;
|
|
2993
2877
|
}
|
|
2994
2878
|
const { sel, mode, ctor, owner } = vnode;
|
|
2995
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
2879
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
2996
2880
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
2997
2881
|
const { stylesheetToken } = owner.context;
|
|
2998
2882
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -3001,7 +2885,7 @@ var LWC = (function (exports) {
|
|
|
3001
2885
|
setElementShadowToken(elm, stylesheetToken);
|
|
3002
2886
|
}
|
|
3003
2887
|
}
|
|
3004
|
-
vm = createVM(elm, ctor, {
|
|
2888
|
+
vm = createVM(elm, ctor, renderer, {
|
|
3005
2889
|
mode,
|
|
3006
2890
|
owner,
|
|
3007
2891
|
tagName: sel,
|
|
@@ -3073,7 +2957,7 @@ var LWC = (function (exports) {
|
|
|
3073
2957
|
}
|
|
3074
2958
|
return map;
|
|
3075
2959
|
}
|
|
3076
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
2960
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
3077
2961
|
let oldStartIdx = 0;
|
|
3078
2962
|
let newStartIdx = 0;
|
|
3079
2963
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -3102,26 +2986,26 @@ var LWC = (function (exports) {
|
|
|
3102
2986
|
newEndVnode = newCh[--newEndIdx];
|
|
3103
2987
|
}
|
|
3104
2988
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
3105
|
-
patch(oldStartVnode, newStartVnode);
|
|
2989
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
3106
2990
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3107
2991
|
newStartVnode = newCh[++newStartIdx];
|
|
3108
2992
|
}
|
|
3109
2993
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
3110
|
-
patch(oldEndVnode, newEndVnode);
|
|
2994
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
3111
2995
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3112
2996
|
newEndVnode = newCh[--newEndIdx];
|
|
3113
2997
|
}
|
|
3114
2998
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
3115
2999
|
// Vnode moved right
|
|
3116
|
-
patch(oldStartVnode, newEndVnode);
|
|
3117
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
3000
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
3001
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
3118
3002
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3119
3003
|
newEndVnode = newCh[--newEndIdx];
|
|
3120
3004
|
}
|
|
3121
3005
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
3122
3006
|
// Vnode moved left
|
|
3123
|
-
patch(oldEndVnode, newStartVnode);
|
|
3124
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
3007
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
3008
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
3125
3009
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3126
3010
|
newStartVnode = newCh[++newStartIdx];
|
|
3127
3011
|
}
|
|
@@ -3132,7 +3016,7 @@ var LWC = (function (exports) {
|
|
|
3132
3016
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
3133
3017
|
if (isUndefined$1(idxInOld)) {
|
|
3134
3018
|
// New element
|
|
3135
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
3019
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
3136
3020
|
newStartVnode = newCh[++newStartIdx];
|
|
3137
3021
|
}
|
|
3138
3022
|
else {
|
|
@@ -3140,10 +3024,10 @@ var LWC = (function (exports) {
|
|
|
3140
3024
|
if (isVNode(elmToMove)) {
|
|
3141
3025
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
3142
3026
|
// New element
|
|
3143
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
3027
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
3144
3028
|
}
|
|
3145
3029
|
else {
|
|
3146
|
-
patch(elmToMove, newStartVnode);
|
|
3030
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
3147
3031
|
// Delete the old child, but copy the array since it is read-only.
|
|
3148
3032
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
3149
3033
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -3155,7 +3039,7 @@ var LWC = (function (exports) {
|
|
|
3155
3039
|
}
|
|
3156
3040
|
// We've already cloned at least once, so it's no longer read-only
|
|
3157
3041
|
oldCh[idxInOld] = undefined;
|
|
3158
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
3042
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
3159
3043
|
}
|
|
3160
3044
|
}
|
|
3161
3045
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -3172,25 +3056,25 @@ var LWC = (function (exports) {
|
|
|
3172
3056
|
n = newCh[++i];
|
|
3173
3057
|
} while (!isVNode(n) && i < newChEnd);
|
|
3174
3058
|
before = isVNode(n) ? n.elm : null;
|
|
3175
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
3059
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
3176
3060
|
}
|
|
3177
3061
|
else {
|
|
3178
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
3062
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
3179
3063
|
}
|
|
3180
3064
|
}
|
|
3181
3065
|
}
|
|
3182
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
3066
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
3183
3067
|
const c1Length = c1.length;
|
|
3184
3068
|
const c2Length = c2.length;
|
|
3185
3069
|
if (c1Length === 0) {
|
|
3186
3070
|
// the old list is empty, we can directly insert anything new
|
|
3187
|
-
mountVNodes(c2, parent, null);
|
|
3071
|
+
mountVNodes(c2, parent, renderer, null);
|
|
3188
3072
|
return;
|
|
3189
3073
|
}
|
|
3190
3074
|
if (c2Length === 0) {
|
|
3191
3075
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
3192
3076
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
3193
|
-
unmountVNodes(c1, parent, true);
|
|
3077
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
3194
3078
|
return;
|
|
3195
3079
|
}
|
|
3196
3080
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -3203,16 +3087,16 @@ var LWC = (function (exports) {
|
|
|
3203
3087
|
if (isVNode(n1)) {
|
|
3204
3088
|
if (isVNode(n2)) {
|
|
3205
3089
|
// both vnodes are equivalent, and we just need to patch them
|
|
3206
|
-
patch(n1, n2);
|
|
3090
|
+
patch(n1, n2, renderer);
|
|
3207
3091
|
anchor = n2.elm;
|
|
3208
3092
|
}
|
|
3209
3093
|
else {
|
|
3210
3094
|
// removing the old vnode since the new one is null
|
|
3211
|
-
unmount(n1, parent, true);
|
|
3095
|
+
unmount(n1, parent, renderer, true);
|
|
3212
3096
|
}
|
|
3213
3097
|
}
|
|
3214
3098
|
else if (isVNode(n2)) {
|
|
3215
|
-
mount(n2, parent, anchor);
|
|
3099
|
+
mount(n2, parent, renderer, anchor);
|
|
3216
3100
|
anchor = n2.elm;
|
|
3217
3101
|
}
|
|
3218
3102
|
}
|
|
@@ -3229,6 +3113,17 @@ var LWC = (function (exports) {
|
|
|
3229
3113
|
function addVNodeToChildLWC(vnode) {
|
|
3230
3114
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
3231
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
|
+
}
|
|
3232
3127
|
// [h]tml node
|
|
3233
3128
|
function h(sel, data, children = EmptyArray) {
|
|
3234
3129
|
const vmBeingRendered = getVMBeingRendered();
|
|
@@ -3505,6 +3400,7 @@ var LWC = (function (exports) {
|
|
|
3505
3400
|
co,
|
|
3506
3401
|
dc,
|
|
3507
3402
|
ti,
|
|
3403
|
+
st,
|
|
3508
3404
|
gid,
|
|
3509
3405
|
fid,
|
|
3510
3406
|
shc,
|
|
@@ -3528,7 +3424,7 @@ var LWC = (function (exports) {
|
|
|
3528
3424
|
}, [api.t(content)]);
|
|
3529
3425
|
}
|
|
3530
3426
|
function updateStylesheetToken(vm, template) {
|
|
3531
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
3427
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
3532
3428
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
3533
3429
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
3534
3430
|
const { hasScopedStyles } = context;
|
|
@@ -3539,10 +3435,10 @@ var LWC = (function (exports) {
|
|
|
3539
3435
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
3540
3436
|
if (!isUndefined$1(oldToken)) {
|
|
3541
3437
|
if (oldHasTokenInClass) {
|
|
3542
|
-
getClassList
|
|
3438
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
3543
3439
|
}
|
|
3544
3440
|
if (oldHasTokenInAttribute) {
|
|
3545
|
-
removeAttribute
|
|
3441
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
3546
3442
|
}
|
|
3547
3443
|
}
|
|
3548
3444
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -3553,11 +3449,11 @@ var LWC = (function (exports) {
|
|
|
3553
3449
|
// Set the new styling token on the host element
|
|
3554
3450
|
if (!isUndefined$1(newToken)) {
|
|
3555
3451
|
if (hasScopedStyles) {
|
|
3556
|
-
getClassList
|
|
3452
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
3557
3453
|
newHasTokenInClass = true;
|
|
3558
3454
|
}
|
|
3559
3455
|
if (isSyntheticShadow) {
|
|
3560
|
-
setAttribute
|
|
3456
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
3561
3457
|
newHasTokenInAttribute = true;
|
|
3562
3458
|
}
|
|
3563
3459
|
}
|
|
@@ -3637,19 +3533,18 @@ var LWC = (function (exports) {
|
|
|
3637
3533
|
return owner;
|
|
3638
3534
|
}
|
|
3639
3535
|
function createStylesheet(vm, stylesheets) {
|
|
3640
|
-
const { renderMode, shadowMode } = vm;
|
|
3536
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
3641
3537
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
3642
3538
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
3643
|
-
insertStylesheet
|
|
3539
|
+
insertStylesheet(stylesheets[i]);
|
|
3644
3540
|
}
|
|
3645
3541
|
}
|
|
3646
|
-
else if (ssr
|
|
3542
|
+
else if (ssr || vm.hydrated) {
|
|
3647
3543
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3648
3544
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3649
3545
|
// the first time the VM renders.
|
|
3650
3546
|
// native shadow or light DOM, SSR
|
|
3651
|
-
|
|
3652
|
-
return createInlineStyleVNode(combinedStylesheetContent);
|
|
3547
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3653
3548
|
}
|
|
3654
3549
|
else {
|
|
3655
3550
|
// native shadow or light DOM, DOM renderer
|
|
@@ -3657,7 +3552,7 @@ var LWC = (function (exports) {
|
|
|
3657
3552
|
// null root means a global style
|
|
3658
3553
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
3659
3554
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
3660
|
-
insertStylesheet
|
|
3555
|
+
insertStylesheet(stylesheets[i], target);
|
|
3661
3556
|
}
|
|
3662
3557
|
}
|
|
3663
3558
|
return null;
|
|
@@ -3735,6 +3630,59 @@ var LWC = (function (exports) {
|
|
|
3735
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"`);
|
|
3736
3631
|
}
|
|
3737
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
|
+
});
|
|
3738
3686
|
function evaluateTemplate(vm, html) {
|
|
3739
3687
|
const isUpdatingTemplateInception = isUpdatingTemplate;
|
|
3740
3688
|
const vmOfTemplateBeingUpdatedInception = vmBeingRendered;
|
|
@@ -3772,7 +3720,7 @@ var LWC = (function (exports) {
|
|
|
3772
3720
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
3773
3721
|
// re-rendering.
|
|
3774
3722
|
const stylesheetsContent = getStylesheetsContent(vm, html);
|
|
3775
|
-
context.
|
|
3723
|
+
context.styleVNodes =
|
|
3776
3724
|
stylesheetsContent.length === 0
|
|
3777
3725
|
? null
|
|
3778
3726
|
: createStylesheet(vm, stylesheetsContent);
|
|
@@ -3784,9 +3732,9 @@ var LWC = (function (exports) {
|
|
|
3784
3732
|
// Set the global flag that template is being updated
|
|
3785
3733
|
isUpdatingTemplate = true;
|
|
3786
3734
|
vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
|
|
3787
|
-
const {
|
|
3788
|
-
if (!isNull(
|
|
3789
|
-
ArrayUnshift.
|
|
3735
|
+
const { styleVNodes } = context;
|
|
3736
|
+
if (!isNull(styleVNodes)) {
|
|
3737
|
+
ArrayUnshift.apply(vnodes, styleVNodes);
|
|
3790
3738
|
}
|
|
3791
3739
|
});
|
|
3792
3740
|
}, () => {
|
|
@@ -4069,7 +4017,7 @@ var LWC = (function (exports) {
|
|
|
4069
4017
|
return ancestor;
|
|
4070
4018
|
}
|
|
4071
4019
|
|
|
4072
|
-
function createVM(elm, ctor, options) {
|
|
4020
|
+
function createVM(elm, ctor, renderer, options) {
|
|
4073
4021
|
const {
|
|
4074
4022
|
mode,
|
|
4075
4023
|
owner,
|
|
@@ -4104,7 +4052,7 @@ var LWC = (function (exports) {
|
|
|
4104
4052
|
hasTokenInClass: undefined,
|
|
4105
4053
|
hasTokenInAttribute: undefined,
|
|
4106
4054
|
hasScopedStyles: undefined,
|
|
4107
|
-
|
|
4055
|
+
styleVNodes: null,
|
|
4108
4056
|
tplCache: EmptyObject,
|
|
4109
4057
|
wiredConnecting: EmptyArray,
|
|
4110
4058
|
wiredDisconnecting: EmptyArray
|
|
@@ -4118,9 +4066,10 @@ var LWC = (function (exports) {
|
|
|
4118
4066
|
renderRoot: null,
|
|
4119
4067
|
callHook,
|
|
4120
4068
|
setHook,
|
|
4121
|
-
getHook
|
|
4069
|
+
getHook,
|
|
4070
|
+
renderer
|
|
4122
4071
|
};
|
|
4123
|
-
vm.shadowMode = computeShadowMode(vm);
|
|
4072
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
4124
4073
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
4125
4074
|
|
|
4126
4075
|
|
|
@@ -4133,13 +4082,17 @@ var LWC = (function (exports) {
|
|
|
4133
4082
|
return vm;
|
|
4134
4083
|
}
|
|
4135
4084
|
|
|
4136
|
-
function computeShadowMode(vm) {
|
|
4085
|
+
function computeShadowMode(vm, renderer) {
|
|
4137
4086
|
const {
|
|
4138
4087
|
def
|
|
4139
4088
|
} = vm;
|
|
4089
|
+
const {
|
|
4090
|
+
isSyntheticShadowDefined,
|
|
4091
|
+
isNativeShadowDefined
|
|
4092
|
+
} = renderer;
|
|
4140
4093
|
let shadowMode;
|
|
4141
4094
|
|
|
4142
|
-
if (isSyntheticShadowDefined
|
|
4095
|
+
if (isSyntheticShadowDefined) {
|
|
4143
4096
|
if (def.renderMode === 0
|
|
4144
4097
|
/* Light */
|
|
4145
4098
|
) {
|
|
@@ -4148,7 +4101,7 @@ var LWC = (function (exports) {
|
|
|
4148
4101
|
shadowMode = 0
|
|
4149
4102
|
/* Native */
|
|
4150
4103
|
;
|
|
4151
|
-
} else if (isNativeShadowDefined
|
|
4104
|
+
} else if (isNativeShadowDefined) {
|
|
4152
4105
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
4153
4106
|
// the if-condition.
|
|
4154
4107
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -4222,7 +4175,8 @@ var LWC = (function (exports) {
|
|
|
4222
4175
|
function patchShadowRoot(vm, newCh) {
|
|
4223
4176
|
const {
|
|
4224
4177
|
renderRoot,
|
|
4225
|
-
children: oldCh
|
|
4178
|
+
children: oldCh,
|
|
4179
|
+
renderer
|
|
4226
4180
|
} = vm; // caching the new children collection
|
|
4227
4181
|
|
|
4228
4182
|
vm.children = newCh;
|
|
@@ -4238,7 +4192,7 @@ var LWC = (function (exports) {
|
|
|
4238
4192
|
, vm);
|
|
4239
4193
|
}, () => {
|
|
4240
4194
|
// job
|
|
4241
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
4195
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
4242
4196
|
}, () => {
|
|
4243
4197
|
// post
|
|
4244
4198
|
logOperationEnd(2
|
|
@@ -4263,10 +4217,13 @@ var LWC = (function (exports) {
|
|
|
4263
4217
|
const {
|
|
4264
4218
|
def: {
|
|
4265
4219
|
renderedCallback
|
|
4220
|
+
},
|
|
4221
|
+
renderer: {
|
|
4222
|
+
ssr
|
|
4266
4223
|
}
|
|
4267
4224
|
} = vm;
|
|
4268
4225
|
|
|
4269
|
-
if (isTrue(ssr
|
|
4226
|
+
if (isTrue(ssr)) {
|
|
4270
4227
|
return;
|
|
4271
4228
|
}
|
|
4272
4229
|
|
|
@@ -4491,14 +4448,17 @@ var LWC = (function (exports) {
|
|
|
4491
4448
|
function resetComponentRoot(vm) {
|
|
4492
4449
|
const {
|
|
4493
4450
|
children,
|
|
4494
|
-
renderRoot
|
|
4451
|
+
renderRoot,
|
|
4452
|
+
renderer: {
|
|
4453
|
+
remove
|
|
4454
|
+
}
|
|
4495
4455
|
} = vm;
|
|
4496
4456
|
|
|
4497
4457
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
4498
4458
|
const child = children[i];
|
|
4499
4459
|
|
|
4500
4460
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
4501
|
-
remove
|
|
4461
|
+
remove(child.elm, renderRoot);
|
|
4502
4462
|
}
|
|
4503
4463
|
}
|
|
4504
4464
|
|
|
@@ -4507,7 +4467,13 @@ var LWC = (function (exports) {
|
|
|
4507
4467
|
vm.velements = EmptyArray;
|
|
4508
4468
|
}
|
|
4509
4469
|
function scheduleRehydration(vm) {
|
|
4510
|
-
|
|
4470
|
+
const {
|
|
4471
|
+
renderer: {
|
|
4472
|
+
ssr
|
|
4473
|
+
}
|
|
4474
|
+
} = vm;
|
|
4475
|
+
|
|
4476
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
4511
4477
|
return;
|
|
4512
4478
|
}
|
|
4513
4479
|
|
|
@@ -4666,6 +4632,9 @@ var LWC = (function (exports) {
|
|
|
4666
4632
|
context: {
|
|
4667
4633
|
wiredConnecting,
|
|
4668
4634
|
wiredDisconnecting
|
|
4635
|
+
},
|
|
4636
|
+
renderer: {
|
|
4637
|
+
dispatchEvent
|
|
4669
4638
|
}
|
|
4670
4639
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
4671
4640
|
|
|
@@ -4689,7 +4658,7 @@ var LWC = (function (exports) {
|
|
|
4689
4658
|
}
|
|
4690
4659
|
|
|
4691
4660
|
});
|
|
4692
|
-
dispatchEvent
|
|
4661
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
4693
4662
|
});
|
|
4694
4663
|
}
|
|
4695
4664
|
|
|
@@ -4927,78 +4896,97 @@ var LWC = (function (exports) {
|
|
|
4927
4896
|
function hydrateVM(vm) {
|
|
4928
4897
|
const children = renderComponent(vm);
|
|
4929
4898
|
vm.children = children;
|
|
4930
|
-
const parentNode = vm
|
|
4931
|
-
hydrateChildren(getFirstChild
|
|
4899
|
+
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
4900
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
4932
4901
|
runRenderedCallback(vm);
|
|
4933
4902
|
}
|
|
4934
|
-
function hydrateNode(node, vnode) {
|
|
4903
|
+
function hydrateNode(node, vnode, renderer) {
|
|
4904
|
+
var _a, _b;
|
|
4935
4905
|
let hydratedNode;
|
|
4936
4906
|
switch (vnode.type) {
|
|
4937
4907
|
case 0 /* Text */:
|
|
4938
|
-
|
|
4908
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
4909
|
+
hydratedNode = hydrateText(node, vnode, renderer);
|
|
4939
4910
|
break;
|
|
4940
4911
|
case 1 /* Comment */:
|
|
4941
|
-
|
|
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);
|
|
4942
4918
|
break;
|
|
4943
4919
|
case 2 /* Element */:
|
|
4944
|
-
hydratedNode = hydrateElement(node, vnode);
|
|
4920
|
+
hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
4945
4921
|
break;
|
|
4946
4922
|
case 3 /* CustomElement */:
|
|
4947
|
-
hydratedNode = hydrateCustomElement(node, vnode);
|
|
4923
|
+
hydratedNode = hydrateCustomElement(node, vnode, (_b = vnode.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
4948
4924
|
break;
|
|
4949
4925
|
}
|
|
4950
|
-
return nextSibling
|
|
4926
|
+
return renderer.nextSibling(hydratedNode);
|
|
4951
4927
|
}
|
|
4952
|
-
function hydrateText(node, vnode) {
|
|
4928
|
+
function hydrateText(node, vnode, renderer) {
|
|
4953
4929
|
var _a;
|
|
4954
|
-
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT
|
|
4955
|
-
return handleMismatch(node, vnode);
|
|
4930
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */, renderer)) {
|
|
4931
|
+
return handleMismatch(node, vnode, renderer);
|
|
4956
4932
|
}
|
|
4957
|
-
setText
|
|
4933
|
+
const { setText } = renderer;
|
|
4934
|
+
setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
4958
4935
|
vnode.elm = node;
|
|
4959
4936
|
return node;
|
|
4960
4937
|
}
|
|
4961
|
-
function hydrateComment(node, vnode) {
|
|
4938
|
+
function hydrateComment(node, vnode, renderer) {
|
|
4962
4939
|
var _a;
|
|
4963
|
-
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT
|
|
4964
|
-
return handleMismatch(node, vnode);
|
|
4940
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */, renderer)) {
|
|
4941
|
+
return handleMismatch(node, vnode, renderer);
|
|
4965
4942
|
}
|
|
4966
|
-
setProperty
|
|
4943
|
+
const { setProperty } = renderer;
|
|
4944
|
+
setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
4967
4945
|
vnode.elm = node;
|
|
4968
4946
|
return node;
|
|
4969
4947
|
}
|
|
4970
|
-
function
|
|
4971
|
-
if (!
|
|
4972
|
-
|
|
4973
|
-
|
|
4948
|
+
function hydrateStaticElement(elm, vnode, renderer) {
|
|
4949
|
+
if (!areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
|
|
4950
|
+
return handleMismatch(elm, vnode, renderer);
|
|
4951
|
+
}
|
|
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);
|
|
4974
4959
|
}
|
|
4975
4960
|
vnode.elm = elm;
|
|
4961
|
+
const { owner } = vnode;
|
|
4976
4962
|
const { context } = vnode.data;
|
|
4977
4963
|
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
4978
4964
|
if (isDomManual) {
|
|
4979
4965
|
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
4980
4966
|
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
4981
|
-
const { props } = vnode
|
|
4967
|
+
const { data: { props }, } = vnode;
|
|
4968
|
+
const { getProperty } = renderer;
|
|
4982
4969
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
4983
|
-
if (getProperty
|
|
4970
|
+
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
|
4984
4971
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
4985
4972
|
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
4986
4973
|
}
|
|
4987
4974
|
}
|
|
4988
4975
|
}
|
|
4989
|
-
patchElementPropsAndAttrs(vnode);
|
|
4976
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
4990
4977
|
if (!isDomManual) {
|
|
4991
|
-
|
|
4978
|
+
const { getFirstChild } = renderer;
|
|
4979
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
4992
4980
|
}
|
|
4993
4981
|
return elm;
|
|
4994
4982
|
}
|
|
4995
|
-
function hydrateCustomElement(elm, vnode) {
|
|
4996
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
4997
|
-
!isMatchingElement(vnode, elm)) {
|
|
4998
|
-
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);
|
|
4999
4987
|
}
|
|
5000
4988
|
const { sel, mode, ctor, owner } = vnode;
|
|
5001
|
-
const vm = createVM(elm, ctor, {
|
|
4989
|
+
const vm = createVM(elm, ctor, renderer, {
|
|
5002
4990
|
mode,
|
|
5003
4991
|
owner,
|
|
5004
4992
|
tagName: sel,
|
|
@@ -5007,12 +4995,13 @@ var LWC = (function (exports) {
|
|
|
5007
4995
|
vnode.elm = elm;
|
|
5008
4996
|
vnode.vm = vm;
|
|
5009
4997
|
allocateChildren(vnode, vm);
|
|
5010
|
-
patchElementPropsAndAttrs(vnode);
|
|
4998
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
5011
4999
|
runConnectedCallback(vm);
|
|
5012
5000
|
if (vm.renderMode !== 0 /* Light */) {
|
|
5001
|
+
const { getFirstChild } = renderer;
|
|
5013
5002
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5014
5003
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5015
|
-
hydrateChildren(getFirstChild
|
|
5004
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
5016
5005
|
}
|
|
5017
5006
|
hydrateVM(vm);
|
|
5018
5007
|
return elm;
|
|
@@ -5020,78 +5009,89 @@ var LWC = (function (exports) {
|
|
|
5020
5009
|
function hydrateChildren(node, children, parentNode, owner) {
|
|
5021
5010
|
let nextNode = node;
|
|
5022
5011
|
let anchor = null;
|
|
5012
|
+
const { renderer } = owner;
|
|
5023
5013
|
for (let i = 0; i < children.length; i++) {
|
|
5024
5014
|
const childVnode = children[i];
|
|
5025
5015
|
if (!isNull(childVnode)) {
|
|
5026
5016
|
if (nextNode) {
|
|
5027
|
-
nextNode = hydrateNode(nextNode, childVnode);
|
|
5017
|
+
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
5028
5018
|
anchor = childVnode.elm;
|
|
5029
5019
|
}
|
|
5030
5020
|
else {
|
|
5031
5021
|
hasMismatch = true;
|
|
5032
|
-
mount(childVnode, parentNode, anchor);
|
|
5022
|
+
mount(childVnode, parentNode, renderer, anchor);
|
|
5033
5023
|
anchor = childVnode.elm;
|
|
5034
5024
|
}
|
|
5035
5025
|
}
|
|
5036
5026
|
}
|
|
5037
5027
|
if (nextNode) {
|
|
5038
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;
|
|
5039
5034
|
do {
|
|
5040
5035
|
const current = nextNode;
|
|
5041
|
-
nextNode = nextSibling
|
|
5042
|
-
removeNode(current, parentNode);
|
|
5036
|
+
nextNode = nextSibling(nextNode);
|
|
5037
|
+
removeNode(current, parentNode, renderer);
|
|
5043
5038
|
} while (nextNode);
|
|
5044
5039
|
}
|
|
5045
5040
|
}
|
|
5046
|
-
function handleMismatch(node, vnode,
|
|
5041
|
+
function handleMismatch(node, vnode, renderer) {
|
|
5047
5042
|
hasMismatch = true;
|
|
5048
|
-
const
|
|
5049
|
-
|
|
5050
|
-
|
|
5043
|
+
const { getProperty } = renderer;
|
|
5044
|
+
const parentNode = getProperty(node, 'parentNode');
|
|
5045
|
+
mount(vnode, parentNode, renderer, node);
|
|
5046
|
+
removeNode(node, parentNode, renderer);
|
|
5051
5047
|
return vnode.elm;
|
|
5052
5048
|
}
|
|
5053
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
5054
|
-
applyEventListeners(vnode);
|
|
5055
|
-
patchProps(null, vnode);
|
|
5049
|
+
function patchElementPropsAndAttrs(vnode, renderer) {
|
|
5050
|
+
applyEventListeners(vnode, renderer);
|
|
5051
|
+
patchProps(null, vnode, renderer);
|
|
5056
5052
|
}
|
|
5057
|
-
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
5058
|
-
|
|
5053
|
+
function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
5054
|
+
const { getProperty } = renderer;
|
|
5055
|
+
if (getProperty(node, 'nodeType') !== nodeType) {
|
|
5059
5056
|
return false;
|
|
5060
5057
|
}
|
|
5061
5058
|
return true;
|
|
5062
5059
|
}
|
|
5063
|
-
function isMatchingElement(vnode, elm) {
|
|
5064
|
-
|
|
5060
|
+
function isMatchingElement(vnode, elm, renderer) {
|
|
5061
|
+
const { getProperty } = renderer;
|
|
5062
|
+
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
5065
5063
|
return false;
|
|
5066
5064
|
}
|
|
5067
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
5068
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
5069
|
-
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);
|
|
5070
5068
|
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
5071
5069
|
}
|
|
5072
|
-
function validateAttrs(vnode, elm) {
|
|
5070
|
+
function validateAttrs(vnode, elm, renderer) {
|
|
5073
5071
|
const { data: { attrs = {} }, } = vnode;
|
|
5074
5072
|
let nodesAreCompatible = true;
|
|
5075
5073
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5076
5074
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5077
5075
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
5078
|
-
const
|
|
5076
|
+
const { getAttribute } = renderer;
|
|
5077
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
5079
5078
|
if (String(attrValue) !== elmAttrValue) {
|
|
5080
5079
|
nodesAreCompatible = false;
|
|
5081
5080
|
}
|
|
5082
5081
|
}
|
|
5083
5082
|
return nodesAreCompatible;
|
|
5084
5083
|
}
|
|
5085
|
-
function validateClassAttr(vnode, elm) {
|
|
5084
|
+
function validateClassAttr(vnode, elm, renderer) {
|
|
5086
5085
|
const { data: { className, classMap }, } = vnode;
|
|
5086
|
+
const { getProperty, getClassList } = renderer;
|
|
5087
5087
|
let nodesAreCompatible = true;
|
|
5088
|
-
if (!isUndefined$1(className) && String(className) !== getProperty
|
|
5088
|
+
if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
|
|
5089
5089
|
// className is used when class is bound to an expr.
|
|
5090
5090
|
nodesAreCompatible = false;
|
|
5091
5091
|
}
|
|
5092
5092
|
else if (!isUndefined$1(classMap)) {
|
|
5093
5093
|
// classMap is used when class is set to static value.
|
|
5094
|
-
const classList = getClassList
|
|
5094
|
+
const classList = getClassList(elm);
|
|
5095
5095
|
let computedClassName = '';
|
|
5096
5096
|
// all classes from the vnode should be in the element.classList
|
|
5097
5097
|
for (const name in classMap) {
|
|
@@ -5107,9 +5107,10 @@ var LWC = (function (exports) {
|
|
|
5107
5107
|
}
|
|
5108
5108
|
return nodesAreCompatible;
|
|
5109
5109
|
}
|
|
5110
|
-
function validateStyleAttr(vnode, elm) {
|
|
5110
|
+
function validateStyleAttr(vnode, elm, renderer) {
|
|
5111
5111
|
const { data: { style, styleDecls }, } = vnode;
|
|
5112
|
-
const
|
|
5112
|
+
const { getAttribute } = renderer;
|
|
5113
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
5113
5114
|
let nodesAreCompatible = true;
|
|
5114
5115
|
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
5115
5116
|
nodesAreCompatible = false;
|
|
@@ -5139,6 +5140,36 @@ var LWC = (function (exports) {
|
|
|
5139
5140
|
}
|
|
5140
5141
|
return nodesAreCompatible;
|
|
5141
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
|
+
}
|
|
5142
5173
|
|
|
5143
5174
|
/*
|
|
5144
5175
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5179,7 +5210,7 @@ var LWC = (function (exports) {
|
|
|
5179
5210
|
}
|
|
5180
5211
|
return ctor;
|
|
5181
5212
|
}
|
|
5182
|
-
/* version: 2.
|
|
5213
|
+
/* version: 2.16.0 */
|
|
5183
5214
|
|
|
5184
5215
|
/*
|
|
5185
5216
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5329,7 +5360,7 @@ var LWC = (function (exports) {
|
|
|
5329
5360
|
try {
|
|
5330
5361
|
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
5331
5362
|
// _wrapNativeSuper()
|
|
5332
|
-
// This is a problem because LWCUpgradableElement extends renderer.
|
|
5363
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
5333
5364
|
// get wrapped by babel.
|
|
5334
5365
|
const HTMLElementAlias = HTMLElement;
|
|
5335
5366
|
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
@@ -5383,8 +5414,17 @@ var LWC = (function (exports) {
|
|
|
5383
5414
|
hydrating = value;
|
|
5384
5415
|
}
|
|
5385
5416
|
const ssr = false;
|
|
5417
|
+
function isHydrating() {
|
|
5418
|
+
return hydrating;
|
|
5419
|
+
}
|
|
5386
5420
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
5387
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
|
+
}
|
|
5388
5428
|
function createElement$1(tagName, namespace) {
|
|
5389
5429
|
return isUndefined$1(namespace)
|
|
5390
5430
|
? document.createElement(tagName)
|
|
@@ -5491,44 +5531,53 @@ var LWC = (function (exports) {
|
|
|
5491
5531
|
function isConnected(node) {
|
|
5492
5532
|
return node.isConnected;
|
|
5493
5533
|
}
|
|
5534
|
+
function assertInstanceOfHTMLElement(elm, msg) {
|
|
5535
|
+
assert.invariant(elm instanceof HTMLElement, msg);
|
|
5536
|
+
}
|
|
5494
5537
|
const HTMLElementExported = HTMLElementConstructor;
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
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
|
+
};
|
|
5532
5581
|
|
|
5533
5582
|
/*
|
|
5534
5583
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5550,7 +5599,7 @@ var LWC = (function (exports) {
|
|
|
5550
5599
|
}
|
|
5551
5600
|
}
|
|
5552
5601
|
function createVMWithProps(element, Ctor, props) {
|
|
5553
|
-
const vm = createVM(element, Ctor, {
|
|
5602
|
+
const vm = createVM(element, Ctor, renderer, {
|
|
5554
5603
|
mode: 'open',
|
|
5555
5604
|
owner: null,
|
|
5556
5605
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -5641,7 +5690,7 @@ var LWC = (function (exports) {
|
|
|
5641
5690
|
hydratedCustomElements.add(this);
|
|
5642
5691
|
}
|
|
5643
5692
|
else {
|
|
5644
|
-
createVM(this, Ctor, {
|
|
5693
|
+
createVM(this, Ctor, renderer, {
|
|
5645
5694
|
mode: 'open',
|
|
5646
5695
|
owner: null,
|
|
5647
5696
|
tagName: this.tagName,
|
|
@@ -5723,7 +5772,7 @@ var LWC = (function (exports) {
|
|
|
5723
5772
|
if (!isFunction$1(Ctor)) {
|
|
5724
5773
|
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
5725
5774
|
}
|
|
5726
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
5775
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
5727
5776
|
let wasComponentUpgraded = false;
|
|
5728
5777
|
// the custom element from the registry is expecting an upgrade callback
|
|
5729
5778
|
/**
|
|
@@ -5733,7 +5782,7 @@ var LWC = (function (exports) {
|
|
|
5733
5782
|
* an upgradable custom element.
|
|
5734
5783
|
*/
|
|
5735
5784
|
const element = new UpgradableConstructor((elm) => {
|
|
5736
|
-
createVM(elm, Ctor, {
|
|
5785
|
+
createVM(elm, Ctor, renderer, {
|
|
5737
5786
|
tagName: sel,
|
|
5738
5787
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
5739
5788
|
owner: null,
|
|
@@ -5817,7 +5866,7 @@ var LWC = (function (exports) {
|
|
|
5817
5866
|
});
|
|
5818
5867
|
freeze(LightningElement);
|
|
5819
5868
|
seal(LightningElement.prototype);
|
|
5820
|
-
/* version: 2.
|
|
5869
|
+
/* version: 2.16.0 */
|
|
5821
5870
|
|
|
5822
5871
|
exports.LightningElement = LightningElement;
|
|
5823
5872
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -5831,11 +5880,14 @@ var LWC = (function (exports) {
|
|
|
5831
5880
|
exports.hydrateComponent = hydrateComponent;
|
|
5832
5881
|
exports.isComponentConstructor = isComponentConstructor;
|
|
5833
5882
|
exports.isNodeFromTemplate = isNodeShadowed;
|
|
5883
|
+
exports.parseFragment = parseFragment;
|
|
5884
|
+
exports.parseSVGFragment = parseSVGFragment;
|
|
5834
5885
|
exports.readonly = readonly;
|
|
5835
5886
|
exports.register = register;
|
|
5836
5887
|
exports.registerComponent = registerComponent;
|
|
5837
5888
|
exports.registerDecorators = registerDecorators;
|
|
5838
5889
|
exports.registerTemplate = registerTemplate;
|
|
5890
|
+
exports.renderer = renderer;
|
|
5839
5891
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
5840
5892
|
exports.setFeatureFlag = setFeatureFlag;
|
|
5841
5893
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|