@lwc/engine-core 2.6.1 → 2.7.2
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-core.cjs.js +334 -220
- package/dist/engine-core.js +296 -222
- package/package.json +4 -4
- package/types/3rdparty/snabbdom/types.d.ts +8 -20
- package/types/framework/html-element.d.ts +2 -0
- package/types/framework/main.d.ts +1 -1
- package/types/framework/profiler.d.ts +2 -2
- package/types/framework/template.d.ts +0 -1
- package/types/framework/upgradable-element.d.ts +1 -2
- package/types/framework/vm.d.ts +1 -3
- package/types/renderer.d.ts +122 -0
- package/types/framework/renderer.d.ts +0 -46
package/dist/engine-core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* proxy-compat-disable */
|
|
2
|
-
import { seal, create, isFunction as isFunction$1, ArrayPush as ArrayPush$1, isUndefined as isUndefined$1, ArrayIndexOf, ArraySplice, StringToLowerCase, ArrayJoin, isNull, assign, assert, keys, StringCharCodeAt, isString, StringSlice, freeze, defineProperties, forEach, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, getPropertyDescriptor, isObject, AriaPropNameToAttrNameMap, defineProperty, KEY__SYNTHETIC_MODE, toString as toString$1, isFalse, isTrue, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, htmlPropertyToAttribute, ArraySlice, hasOwnProperty as hasOwnProperty$1, ArrayFilter,
|
|
2
|
+
import { seal, create, isFunction as isFunction$1, ArrayPush as ArrayPush$1, isUndefined as isUndefined$1, ArrayIndexOf, ArraySplice, StringToLowerCase, ArrayJoin, isNull, assign, assert, keys, StringCharCodeAt, isString, StringSlice, freeze, defineProperties, forEach, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, getPropertyDescriptor, isObject, AriaPropNameToAttrNameMap, defineProperty, KEY__SYNTHETIC_MODE, toString as toString$1, isFalse, isTrue, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, htmlPropertyToAttribute, ArraySlice, hasOwnProperty as hasOwnProperty$1, ArrayFilter, isArray as isArray$1, isNumber, StringReplace, KEY__SHADOW_RESOLVER, KEY__SCOPED_CSS, noop, ArrayUnshift, isFrozen } from '@lwc/shared';
|
|
3
3
|
import { runtimeFlags } from '@lwc/features';
|
|
4
4
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
5
5
|
|
|
@@ -70,6 +70,170 @@ function parseStyleText(cssText) {
|
|
|
70
70
|
return styleMap;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
//
|
|
74
|
+
// Primitives
|
|
75
|
+
//
|
|
76
|
+
let ssr;
|
|
77
|
+
function setSsr(ssrImpl) {
|
|
78
|
+
ssr = ssrImpl;
|
|
79
|
+
}
|
|
80
|
+
let isNativeShadowDefined;
|
|
81
|
+
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
82
|
+
isNativeShadowDefined = isNativeShadowDefinedImpl;
|
|
83
|
+
}
|
|
84
|
+
let isSyntheticShadowDefined;
|
|
85
|
+
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
86
|
+
isSyntheticShadowDefined = isSyntheticShadowDefinedImpl;
|
|
87
|
+
}
|
|
88
|
+
let HTMLElementExported;
|
|
89
|
+
function setHTMLElement(HTMLElementImpl) {
|
|
90
|
+
HTMLElementExported = HTMLElementImpl;
|
|
91
|
+
}
|
|
92
|
+
let isHydrating;
|
|
93
|
+
function setIsHydrating(isHydratingImpl) {
|
|
94
|
+
isHydrating = isHydratingImpl;
|
|
95
|
+
}
|
|
96
|
+
let insert;
|
|
97
|
+
function setInsert(insertImpl) {
|
|
98
|
+
insert = insertImpl;
|
|
99
|
+
}
|
|
100
|
+
let remove;
|
|
101
|
+
function setRemove(removeImpl) {
|
|
102
|
+
remove = removeImpl;
|
|
103
|
+
}
|
|
104
|
+
let createElement;
|
|
105
|
+
function setCreateElement(createElementImpl) {
|
|
106
|
+
createElement = createElementImpl;
|
|
107
|
+
}
|
|
108
|
+
let createText;
|
|
109
|
+
function setCreateText(createTextImpl) {
|
|
110
|
+
createText = createTextImpl;
|
|
111
|
+
}
|
|
112
|
+
let createComment;
|
|
113
|
+
function setCreateComment(createCommentImpl) {
|
|
114
|
+
createComment = createCommentImpl;
|
|
115
|
+
}
|
|
116
|
+
let nextSibling;
|
|
117
|
+
function setNextSibling(nextSiblingImpl) {
|
|
118
|
+
nextSibling = nextSiblingImpl;
|
|
119
|
+
}
|
|
120
|
+
let attachShadow;
|
|
121
|
+
function setAttachShadow(attachShadowImpl) {
|
|
122
|
+
attachShadow = attachShadowImpl;
|
|
123
|
+
}
|
|
124
|
+
let getProperty;
|
|
125
|
+
function setGetProperty(getPropertyImpl) {
|
|
126
|
+
getProperty = getPropertyImpl;
|
|
127
|
+
}
|
|
128
|
+
let setProperty;
|
|
129
|
+
function setSetProperty(setPropertyImpl) {
|
|
130
|
+
setProperty = setPropertyImpl;
|
|
131
|
+
}
|
|
132
|
+
let setText;
|
|
133
|
+
function setSetText(setTextImpl) {
|
|
134
|
+
setText = setTextImpl;
|
|
135
|
+
}
|
|
136
|
+
let getAttribute;
|
|
137
|
+
function setGetAttribute(getAttributeImpl) {
|
|
138
|
+
getAttribute = getAttributeImpl;
|
|
139
|
+
}
|
|
140
|
+
let setAttribute;
|
|
141
|
+
function setSetAttribute(setAttributeImpl) {
|
|
142
|
+
setAttribute = setAttributeImpl;
|
|
143
|
+
}
|
|
144
|
+
let removeAttribute;
|
|
145
|
+
function setRemoveAttribute(removeAttributeImpl) {
|
|
146
|
+
removeAttribute = removeAttributeImpl;
|
|
147
|
+
}
|
|
148
|
+
let addEventListener;
|
|
149
|
+
function setAddEventListener(addEventListenerImpl) {
|
|
150
|
+
addEventListener = addEventListenerImpl;
|
|
151
|
+
}
|
|
152
|
+
let removeEventListener;
|
|
153
|
+
function setRemoveEventListener(removeEventListenerImpl) {
|
|
154
|
+
removeEventListener = removeEventListenerImpl;
|
|
155
|
+
}
|
|
156
|
+
let dispatchEvent;
|
|
157
|
+
function setDispatchEvent(dispatchEventImpl) {
|
|
158
|
+
dispatchEvent = dispatchEventImpl;
|
|
159
|
+
}
|
|
160
|
+
let getClassList;
|
|
161
|
+
function setGetClassList(getClassListImpl) {
|
|
162
|
+
getClassList = getClassListImpl;
|
|
163
|
+
}
|
|
164
|
+
let setCSSStyleProperty;
|
|
165
|
+
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
166
|
+
setCSSStyleProperty = setCSSStylePropertyImpl;
|
|
167
|
+
}
|
|
168
|
+
let getBoundingClientRect;
|
|
169
|
+
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
170
|
+
getBoundingClientRect = getBoundingClientRectImpl;
|
|
171
|
+
}
|
|
172
|
+
let querySelector;
|
|
173
|
+
function setQuerySelector(querySelectorImpl) {
|
|
174
|
+
querySelector = querySelectorImpl;
|
|
175
|
+
}
|
|
176
|
+
let querySelectorAll;
|
|
177
|
+
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
178
|
+
querySelectorAll = querySelectorAllImpl;
|
|
179
|
+
}
|
|
180
|
+
let getElementsByTagName;
|
|
181
|
+
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
182
|
+
getElementsByTagName = getElementsByTagNameImpl;
|
|
183
|
+
}
|
|
184
|
+
let getElementsByClassName;
|
|
185
|
+
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
186
|
+
getElementsByClassName = getElementsByClassNameImpl;
|
|
187
|
+
}
|
|
188
|
+
let getChildren;
|
|
189
|
+
function setGetChildren(getChildrenImpl) {
|
|
190
|
+
getChildren = getChildrenImpl;
|
|
191
|
+
}
|
|
192
|
+
let getChildNodes;
|
|
193
|
+
function setGetChildNodes(getChildNodesImpl) {
|
|
194
|
+
getChildNodes = getChildNodesImpl;
|
|
195
|
+
}
|
|
196
|
+
let getFirstChild;
|
|
197
|
+
function setGetFirstChild(getFirstChildImpl) {
|
|
198
|
+
getFirstChild = getFirstChildImpl;
|
|
199
|
+
}
|
|
200
|
+
let getFirstElementChild;
|
|
201
|
+
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
202
|
+
getFirstElementChild = getFirstElementChildImpl;
|
|
203
|
+
}
|
|
204
|
+
let getLastChild;
|
|
205
|
+
function setGetLastChild(getLastChildImpl) {
|
|
206
|
+
getLastChild = getLastChildImpl;
|
|
207
|
+
}
|
|
208
|
+
let getLastElementChild;
|
|
209
|
+
function setGetLastElementChild(getLastElementChildImpl) {
|
|
210
|
+
getLastElementChild = getLastElementChildImpl;
|
|
211
|
+
}
|
|
212
|
+
let isConnected;
|
|
213
|
+
function setIsConnected(isConnectedImpl) {
|
|
214
|
+
isConnected = isConnectedImpl;
|
|
215
|
+
}
|
|
216
|
+
let insertGlobalStylesheet;
|
|
217
|
+
function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
|
|
218
|
+
insertGlobalStylesheet = insertGlobalStylesheetImpl;
|
|
219
|
+
}
|
|
220
|
+
let insertStylesheet;
|
|
221
|
+
function setInsertStylesheet(insertStylesheetImpl) {
|
|
222
|
+
insertStylesheet = insertStylesheetImpl;
|
|
223
|
+
}
|
|
224
|
+
let assertInstanceOfHTMLElement;
|
|
225
|
+
function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
|
|
226
|
+
assertInstanceOfHTMLElement = assertInstanceOfHTMLElementImpl;
|
|
227
|
+
}
|
|
228
|
+
let defineCustomElement;
|
|
229
|
+
function setDefineCustomElement(defineCustomElementImpl) {
|
|
230
|
+
defineCustomElement = defineCustomElementImpl;
|
|
231
|
+
}
|
|
232
|
+
let getCustomElement;
|
|
233
|
+
function setGetCustomElement(getCustomElementImpl) {
|
|
234
|
+
getCustomElement = getCustomElementImpl;
|
|
235
|
+
}
|
|
236
|
+
|
|
73
237
|
/*
|
|
74
238
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
75
239
|
* All rights reserved.
|
|
@@ -311,9 +475,6 @@ function createAllEventListeners(vnode) {
|
|
|
311
475
|
elm,
|
|
312
476
|
data: {
|
|
313
477
|
on
|
|
314
|
-
},
|
|
315
|
-
owner: {
|
|
316
|
-
renderer
|
|
317
478
|
}
|
|
318
479
|
} = vnode;
|
|
319
480
|
|
|
@@ -326,7 +487,7 @@ function createAllEventListeners(vnode) {
|
|
|
326
487
|
let name;
|
|
327
488
|
|
|
328
489
|
for (name in on) {
|
|
329
|
-
|
|
490
|
+
addEventListener(elm, name, listener);
|
|
330
491
|
}
|
|
331
492
|
}
|
|
332
493
|
|
|
@@ -465,9 +626,6 @@ function updateAttrs(oldVnode, vnode) {
|
|
|
465
626
|
const {
|
|
466
627
|
data: {
|
|
467
628
|
attrs
|
|
468
|
-
},
|
|
469
|
-
owner: {
|
|
470
|
-
renderer
|
|
471
629
|
}
|
|
472
630
|
} = vnode;
|
|
473
631
|
|
|
@@ -490,10 +648,6 @@ function updateAttrs(oldVnode, vnode) {
|
|
|
490
648
|
}
|
|
491
649
|
|
|
492
650
|
const elm = vnode.elm;
|
|
493
|
-
const {
|
|
494
|
-
setAttribute,
|
|
495
|
-
removeAttribute
|
|
496
|
-
} = renderer;
|
|
497
651
|
let key;
|
|
498
652
|
oldAttrs = isUndefined$1(oldAttrs) ? EmptyObject : oldAttrs; // update modified attributes, add new attributes
|
|
499
653
|
// this routine is only useful for data-* attributes in all kind of elements
|
|
@@ -512,7 +666,7 @@ function updateAttrs(oldVnode, vnode) {
|
|
|
512
666
|
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
513
667
|
// Assume xlink namespace
|
|
514
668
|
setAttribute(elm, key, cur, xlinkNS);
|
|
515
|
-
} else if (isNull(cur)) {
|
|
669
|
+
} else if (isNull(cur) || isUndefined$1(cur)) {
|
|
516
670
|
removeAttribute(elm, key);
|
|
517
671
|
} else {
|
|
518
672
|
setAttribute(elm, key, cur);
|
|
@@ -564,17 +718,14 @@ function update(oldVnode, vnode) {
|
|
|
564
718
|
const isFirstPatch = isUndefined$1(oldProps);
|
|
565
719
|
const {
|
|
566
720
|
elm,
|
|
567
|
-
sel
|
|
568
|
-
owner: {
|
|
569
|
-
renderer
|
|
570
|
-
}
|
|
721
|
+
sel
|
|
571
722
|
} = vnode;
|
|
572
723
|
|
|
573
724
|
for (const key in props) {
|
|
574
725
|
const cur = props[key]; // if it is the first time this element is patched, or the current value is different to the previous value...
|
|
575
726
|
|
|
576
|
-
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ?
|
|
577
|
-
|
|
727
|
+
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
728
|
+
setProperty(elm, key, cur);
|
|
578
729
|
}
|
|
579
730
|
}
|
|
580
731
|
}
|
|
@@ -643,9 +794,6 @@ function updateClassAttribute(oldVnode, vnode) {
|
|
|
643
794
|
elm,
|
|
644
795
|
data: {
|
|
645
796
|
className: newClass
|
|
646
|
-
},
|
|
647
|
-
owner: {
|
|
648
|
-
renderer
|
|
649
797
|
}
|
|
650
798
|
} = vnode;
|
|
651
799
|
const {
|
|
@@ -658,7 +806,7 @@ function updateClassAttribute(oldVnode, vnode) {
|
|
|
658
806
|
return;
|
|
659
807
|
}
|
|
660
808
|
|
|
661
|
-
const classList =
|
|
809
|
+
const classList = getClassList(elm);
|
|
662
810
|
const newClassMap = getMapFromClassName(newClass);
|
|
663
811
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
664
812
|
let name;
|
|
@@ -697,15 +845,8 @@ function updateStyleAttribute(oldVnode, vnode) {
|
|
|
697
845
|
elm,
|
|
698
846
|
data: {
|
|
699
847
|
style: newStyle
|
|
700
|
-
},
|
|
701
|
-
owner: {
|
|
702
|
-
renderer
|
|
703
848
|
}
|
|
704
849
|
} = vnode;
|
|
705
|
-
const {
|
|
706
|
-
setAttribute,
|
|
707
|
-
removeAttribute
|
|
708
|
-
} = renderer;
|
|
709
850
|
|
|
710
851
|
if (oldVnode.data.style === newStyle) {
|
|
711
852
|
return;
|
|
@@ -740,9 +881,6 @@ function createClassAttribute(vnode) {
|
|
|
740
881
|
elm,
|
|
741
882
|
data: {
|
|
742
883
|
classMap
|
|
743
|
-
},
|
|
744
|
-
owner: {
|
|
745
|
-
renderer
|
|
746
884
|
}
|
|
747
885
|
} = vnode;
|
|
748
886
|
|
|
@@ -750,7 +888,7 @@ function createClassAttribute(vnode) {
|
|
|
750
888
|
return;
|
|
751
889
|
}
|
|
752
890
|
|
|
753
|
-
const classList =
|
|
891
|
+
const classList = getClassList(elm);
|
|
754
892
|
|
|
755
893
|
for (const name in classMap) {
|
|
756
894
|
classList.add(name);
|
|
@@ -775,9 +913,6 @@ function createStyleAttribute(vnode) {
|
|
|
775
913
|
elm,
|
|
776
914
|
data: {
|
|
777
915
|
styleDecls
|
|
778
|
-
},
|
|
779
|
-
owner: {
|
|
780
|
-
renderer
|
|
781
916
|
}
|
|
782
917
|
} = vnode;
|
|
783
918
|
|
|
@@ -787,7 +922,7 @@ function createStyleAttribute(vnode) {
|
|
|
787
922
|
|
|
788
923
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
789
924
|
const [prop, value, important] = styleDecls[i];
|
|
790
|
-
|
|
925
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
791
926
|
}
|
|
792
927
|
}
|
|
793
928
|
|
|
@@ -802,14 +937,6 @@ var modStaticStyle = {
|
|
|
802
937
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
803
938
|
*/
|
|
804
939
|
|
|
805
|
-
/**
|
|
806
|
-
@license
|
|
807
|
-
Copyright (c) 2015 Simon Friis Vindum.
|
|
808
|
-
This code may only be used under the MIT License found at
|
|
809
|
-
https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
810
|
-
Code distributed by Snabbdom as part of the Snabbdom project at
|
|
811
|
-
https://github.com/snabbdom/snabbdom/
|
|
812
|
-
*/
|
|
813
940
|
function isUndef(s) {
|
|
814
941
|
return s === undefined;
|
|
815
942
|
}
|
|
@@ -897,7 +1024,7 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
|
897
1024
|
} else if (sameVnode(oldStartVnode, newEndVnode)) {
|
|
898
1025
|
// Vnode moved right
|
|
899
1026
|
patchVnode(oldStartVnode, newEndVnode);
|
|
900
|
-
newEndVnode.hook.move(oldStartVnode, parentElm,
|
|
1027
|
+
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling(oldEndVnode.elm));
|
|
901
1028
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
902
1029
|
newEndVnode = newCh[--newEndIdx];
|
|
903
1030
|
} else if (sameVnode(oldEndVnode, newStartVnode)) {
|
|
@@ -1374,7 +1501,7 @@ function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
|
1374
1501
|
}
|
|
1375
1502
|
|
|
1376
1503
|
/*
|
|
1377
|
-
* Copyright (c)
|
|
1504
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
1378
1505
|
* All rights reserved.
|
|
1379
1506
|
* SPDX-License-Identifier: MIT
|
|
1380
1507
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
@@ -2289,9 +2416,7 @@ function createBridgeToElementDescriptor(propName, descriptor) {
|
|
|
2289
2416
|
|
|
2290
2417
|
|
|
2291
2418
|
const LightningElement = function () {
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2419
|
+
// This should be as performant as possible, while any initialization should be done lazily
|
|
2295
2420
|
if (isNull(vmBeingConstructed)) {
|
|
2296
2421
|
throw new ReferenceError('Illegal constructor');
|
|
2297
2422
|
}
|
|
@@ -2299,15 +2424,14 @@ const LightningElement = function () {
|
|
|
2299
2424
|
const vm = vmBeingConstructed;
|
|
2300
2425
|
const {
|
|
2301
2426
|
def,
|
|
2302
|
-
elm
|
|
2303
|
-
renderer
|
|
2427
|
+
elm
|
|
2304
2428
|
} = vm;
|
|
2305
2429
|
const {
|
|
2306
2430
|
bridge
|
|
2307
2431
|
} = def;
|
|
2308
2432
|
|
|
2309
2433
|
if (process.env.NODE_ENV !== 'production') {
|
|
2310
|
-
|
|
2434
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2311
2435
|
}
|
|
2312
2436
|
|
|
2313
2437
|
const component = this;
|
|
@@ -2337,7 +2461,7 @@ const LightningElement = function () {
|
|
|
2337
2461
|
if (vm.renderMode === 1
|
|
2338
2462
|
/* Shadow */
|
|
2339
2463
|
) {
|
|
2340
|
-
|
|
2464
|
+
doAttachShadow(vm);
|
|
2341
2465
|
} // Adding extra guard rails in DEV mode.
|
|
2342
2466
|
|
|
2343
2467
|
|
|
@@ -2349,17 +2473,16 @@ const LightningElement = function () {
|
|
|
2349
2473
|
return this;
|
|
2350
2474
|
};
|
|
2351
2475
|
|
|
2352
|
-
function
|
|
2476
|
+
function doAttachShadow(vm) {
|
|
2353
2477
|
const {
|
|
2354
2478
|
elm,
|
|
2355
2479
|
mode,
|
|
2356
|
-
renderer,
|
|
2357
2480
|
shadowMode,
|
|
2358
2481
|
def: {
|
|
2359
2482
|
ctor
|
|
2360
2483
|
}
|
|
2361
2484
|
} = vm;
|
|
2362
|
-
const cmpRoot =
|
|
2485
|
+
const cmpRoot = attachShadow(elm, {
|
|
2363
2486
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1
|
|
2364
2487
|
/* Synthetic */
|
|
2365
2488
|
,
|
|
@@ -2386,10 +2509,7 @@ LightningElement.prototype = {
|
|
|
2386
2509
|
|
|
2387
2510
|
dispatchEvent(event) {
|
|
2388
2511
|
const {
|
|
2389
|
-
elm
|
|
2390
|
-
renderer: {
|
|
2391
|
-
dispatchEvent
|
|
2392
|
-
}
|
|
2512
|
+
elm
|
|
2393
2513
|
} = getAssociatedVM(this);
|
|
2394
2514
|
return dispatchEvent(elm, event);
|
|
2395
2515
|
},
|
|
@@ -2397,10 +2517,7 @@ LightningElement.prototype = {
|
|
|
2397
2517
|
addEventListener(type, listener, options) {
|
|
2398
2518
|
const vm = getAssociatedVM(this);
|
|
2399
2519
|
const {
|
|
2400
|
-
elm
|
|
2401
|
-
renderer: {
|
|
2402
|
-
addEventListener
|
|
2403
|
-
}
|
|
2520
|
+
elm
|
|
2404
2521
|
} = vm;
|
|
2405
2522
|
|
|
2406
2523
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2417,10 +2534,7 @@ LightningElement.prototype = {
|
|
|
2417
2534
|
removeEventListener(type, listener, options) {
|
|
2418
2535
|
const vm = getAssociatedVM(this);
|
|
2419
2536
|
const {
|
|
2420
|
-
elm
|
|
2421
|
-
renderer: {
|
|
2422
|
-
removeEventListener
|
|
2423
|
-
}
|
|
2537
|
+
elm
|
|
2424
2538
|
} = vm;
|
|
2425
2539
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2426
2540
|
removeEventListener(elm, type, wrappedListener, options);
|
|
@@ -2428,30 +2542,21 @@ LightningElement.prototype = {
|
|
|
2428
2542
|
|
|
2429
2543
|
hasAttribute(name) {
|
|
2430
2544
|
const {
|
|
2431
|
-
elm
|
|
2432
|
-
renderer: {
|
|
2433
|
-
getAttribute
|
|
2434
|
-
}
|
|
2545
|
+
elm
|
|
2435
2546
|
} = getAssociatedVM(this);
|
|
2436
2547
|
return !isNull(getAttribute(elm, name));
|
|
2437
2548
|
},
|
|
2438
2549
|
|
|
2439
2550
|
hasAttributeNS(namespace, name) {
|
|
2440
2551
|
const {
|
|
2441
|
-
elm
|
|
2442
|
-
renderer: {
|
|
2443
|
-
getAttribute
|
|
2444
|
-
}
|
|
2552
|
+
elm
|
|
2445
2553
|
} = getAssociatedVM(this);
|
|
2446
2554
|
return !isNull(getAttribute(elm, name, namespace));
|
|
2447
2555
|
},
|
|
2448
2556
|
|
|
2449
2557
|
removeAttribute(name) {
|
|
2450
2558
|
const {
|
|
2451
|
-
elm
|
|
2452
|
-
renderer: {
|
|
2453
|
-
removeAttribute
|
|
2454
|
-
}
|
|
2559
|
+
elm
|
|
2455
2560
|
} = getAssociatedVM(this);
|
|
2456
2561
|
unlockAttribute(elm, name);
|
|
2457
2562
|
removeAttribute(elm, name);
|
|
@@ -2460,10 +2565,7 @@ LightningElement.prototype = {
|
|
|
2460
2565
|
|
|
2461
2566
|
removeAttributeNS(namespace, name) {
|
|
2462
2567
|
const {
|
|
2463
|
-
elm
|
|
2464
|
-
renderer: {
|
|
2465
|
-
removeAttribute
|
|
2466
|
-
}
|
|
2568
|
+
elm
|
|
2467
2569
|
} = getAssociatedVM(this);
|
|
2468
2570
|
unlockAttribute(elm, name);
|
|
2469
2571
|
removeAttribute(elm, name, namespace);
|
|
@@ -2472,20 +2574,14 @@ LightningElement.prototype = {
|
|
|
2472
2574
|
|
|
2473
2575
|
getAttribute(name) {
|
|
2474
2576
|
const {
|
|
2475
|
-
elm
|
|
2476
|
-
renderer: {
|
|
2477
|
-
getAttribute
|
|
2478
|
-
}
|
|
2577
|
+
elm
|
|
2479
2578
|
} = getAssociatedVM(this);
|
|
2480
2579
|
return getAttribute(elm, name);
|
|
2481
2580
|
},
|
|
2482
2581
|
|
|
2483
2582
|
getAttributeNS(namespace, name) {
|
|
2484
2583
|
const {
|
|
2485
|
-
elm
|
|
2486
|
-
renderer: {
|
|
2487
|
-
getAttribute
|
|
2488
|
-
}
|
|
2584
|
+
elm
|
|
2489
2585
|
} = getAssociatedVM(this);
|
|
2490
2586
|
return getAttribute(elm, name, namespace);
|
|
2491
2587
|
},
|
|
@@ -2493,10 +2589,7 @@ LightningElement.prototype = {
|
|
|
2493
2589
|
setAttribute(name, value) {
|
|
2494
2590
|
const vm = getAssociatedVM(this);
|
|
2495
2591
|
const {
|
|
2496
|
-
elm
|
|
2497
|
-
renderer: {
|
|
2498
|
-
setAttribute
|
|
2499
|
-
}
|
|
2592
|
+
elm
|
|
2500
2593
|
} = vm;
|
|
2501
2594
|
|
|
2502
2595
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2511,10 +2604,7 @@ LightningElement.prototype = {
|
|
|
2511
2604
|
setAttributeNS(namespace, name, value) {
|
|
2512
2605
|
const vm = getAssociatedVM(this);
|
|
2513
2606
|
const {
|
|
2514
|
-
elm
|
|
2515
|
-
renderer: {
|
|
2516
|
-
setAttribute
|
|
2517
|
-
}
|
|
2607
|
+
elm
|
|
2518
2608
|
} = vm;
|
|
2519
2609
|
|
|
2520
2610
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2529,10 +2619,7 @@ LightningElement.prototype = {
|
|
|
2529
2619
|
getBoundingClientRect() {
|
|
2530
2620
|
const vm = getAssociatedVM(this);
|
|
2531
2621
|
const {
|
|
2532
|
-
elm
|
|
2533
|
-
renderer: {
|
|
2534
|
-
getBoundingClientRect
|
|
2535
|
-
}
|
|
2622
|
+
elm
|
|
2536
2623
|
} = vm;
|
|
2537
2624
|
|
|
2538
2625
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2544,10 +2631,7 @@ LightningElement.prototype = {
|
|
|
2544
2631
|
|
|
2545
2632
|
get isConnected() {
|
|
2546
2633
|
const {
|
|
2547
|
-
elm
|
|
2548
|
-
renderer: {
|
|
2549
|
-
isConnected
|
|
2550
|
-
}
|
|
2634
|
+
elm
|
|
2551
2635
|
} = getAssociatedVM(this);
|
|
2552
2636
|
return isConnected(elm);
|
|
2553
2637
|
},
|
|
@@ -2555,10 +2639,7 @@ LightningElement.prototype = {
|
|
|
2555
2639
|
get classList() {
|
|
2556
2640
|
const vm = getAssociatedVM(this);
|
|
2557
2641
|
const {
|
|
2558
|
-
elm
|
|
2559
|
-
renderer: {
|
|
2560
|
-
getClassList
|
|
2561
|
-
}
|
|
2642
|
+
elm
|
|
2562
2643
|
} = vm;
|
|
2563
2644
|
|
|
2564
2645
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2601,23 +2682,48 @@ LightningElement.prototype = {
|
|
|
2601
2682
|
}
|
|
2602
2683
|
|
|
2603
2684
|
};
|
|
2604
|
-
const queryAndChildGetterDescriptors = create(null);
|
|
2605
|
-
|
|
2685
|
+
const queryAndChildGetterDescriptors = create(null); // The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
2686
|
+
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
2687
|
+
// object representing the renderer, with a lot of methods we don't actually need.
|
|
2688
|
+
|
|
2689
|
+
const childGetters = ['children', 'childNodes', 'firstChild', 'firstElementChild', 'lastChild', 'lastElementChild'];
|
|
2690
|
+
|
|
2691
|
+
function getChildGetter(methodName) {
|
|
2692
|
+
switch (methodName) {
|
|
2693
|
+
case 'children':
|
|
2694
|
+
return getChildren;
|
|
2695
|
+
|
|
2696
|
+
case 'childNodes':
|
|
2697
|
+
return getChildNodes;
|
|
2698
|
+
|
|
2699
|
+
case 'firstChild':
|
|
2700
|
+
return getFirstChild;
|
|
2606
2701
|
|
|
2607
|
-
|
|
2608
|
-
|
|
2702
|
+
case 'firstElementChild':
|
|
2703
|
+
return getFirstElementChild;
|
|
2704
|
+
|
|
2705
|
+
case 'lastChild':
|
|
2706
|
+
return getLastChild;
|
|
2707
|
+
|
|
2708
|
+
case 'lastElementChild':
|
|
2709
|
+
return getLastElementChild;
|
|
2710
|
+
}
|
|
2711
|
+
} // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2712
|
+
|
|
2713
|
+
|
|
2714
|
+
for (const childGetter of childGetters) {
|
|
2715
|
+
queryAndChildGetterDescriptors[childGetter] = {
|
|
2609
2716
|
get() {
|
|
2610
2717
|
const vm = getAssociatedVM(this);
|
|
2611
2718
|
const {
|
|
2612
|
-
elm
|
|
2613
|
-
renderer
|
|
2719
|
+
elm
|
|
2614
2720
|
} = vm;
|
|
2615
2721
|
|
|
2616
2722
|
if (process.env.NODE_ENV !== 'production') {
|
|
2617
|
-
warnIfInvokedDuringConstruction(vm,
|
|
2723
|
+
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
2618
2724
|
}
|
|
2619
2725
|
|
|
2620
|
-
return
|
|
2726
|
+
return getChildGetter(childGetter)(elm);
|
|
2621
2727
|
},
|
|
2622
2728
|
|
|
2623
2729
|
configurable: true,
|
|
@@ -2625,22 +2731,38 @@ for (const [elementProp, rendererMethod] of childGetters) {
|
|
|
2625
2731
|
};
|
|
2626
2732
|
}
|
|
2627
2733
|
|
|
2628
|
-
const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
2734
|
+
const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
2735
|
+
|
|
2736
|
+
function getQueryMethod(methodName) {
|
|
2737
|
+
switch (methodName) {
|
|
2738
|
+
case 'getElementsByClassName':
|
|
2739
|
+
return getElementsByClassName;
|
|
2740
|
+
|
|
2741
|
+
case 'getElementsByTagName':
|
|
2742
|
+
return getElementsByTagName;
|
|
2743
|
+
|
|
2744
|
+
case 'querySelector':
|
|
2745
|
+
return querySelector;
|
|
2746
|
+
|
|
2747
|
+
case 'querySelectorAll':
|
|
2748
|
+
return querySelectorAll;
|
|
2749
|
+
}
|
|
2750
|
+
} // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2751
|
+
|
|
2629
2752
|
|
|
2630
2753
|
for (const queryMethod of queryMethods) {
|
|
2631
2754
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2632
2755
|
value(arg) {
|
|
2633
2756
|
const vm = getAssociatedVM(this);
|
|
2634
2757
|
const {
|
|
2635
|
-
elm
|
|
2636
|
-
renderer
|
|
2758
|
+
elm
|
|
2637
2759
|
} = vm;
|
|
2638
2760
|
|
|
2639
2761
|
if (process.env.NODE_ENV !== 'production') {
|
|
2640
2762
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2641
2763
|
}
|
|
2642
2764
|
|
|
2643
|
-
return
|
|
2765
|
+
return getQueryMethod(queryMethod)(elm, arg);
|
|
2644
2766
|
},
|
|
2645
2767
|
|
|
2646
2768
|
configurable: true,
|
|
@@ -3770,10 +3892,6 @@ function createComponentDef(Ctor) {
|
|
|
3770
3892
|
|
|
3771
3893
|
assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
|
|
3772
3894
|
|
|
3773
|
-
if (!runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
3774
|
-
assert.isFalse('shadowSupportMode' in Ctor, `${ctorName || 'Anonymous class'} is an invalid LWC component. The shadowSupportMode static property is not available in this environment.`);
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
3895
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
3778
3896
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
3779
3897
|
/* Any */
|
|
@@ -4015,17 +4133,14 @@ function setScopeTokenClassIfNecessary(elm, owner) {
|
|
|
4015
4133
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4016
4134
|
|
|
4017
4135
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
4018
|
-
|
|
4136
|
+
getClassList(elm).add(token);
|
|
4019
4137
|
}
|
|
4020
4138
|
}
|
|
4021
4139
|
|
|
4022
4140
|
function updateNodeHook(oldVnode, vnode) {
|
|
4023
4141
|
const {
|
|
4024
4142
|
elm,
|
|
4025
|
-
text
|
|
4026
|
-
owner: {
|
|
4027
|
-
renderer
|
|
4028
|
-
}
|
|
4143
|
+
text
|
|
4029
4144
|
} = vnode;
|
|
4030
4145
|
|
|
4031
4146
|
if (oldVnode.text !== text) {
|
|
@@ -4033,7 +4148,7 @@ function updateNodeHook(oldVnode, vnode) {
|
|
|
4033
4148
|
unlockDomMutation();
|
|
4034
4149
|
}
|
|
4035
4150
|
|
|
4036
|
-
|
|
4151
|
+
setText(elm, text);
|
|
4037
4152
|
|
|
4038
4153
|
if (process.env.NODE_ENV !== 'production') {
|
|
4039
4154
|
lockDomMutation();
|
|
@@ -4041,30 +4156,22 @@ function updateNodeHook(oldVnode, vnode) {
|
|
|
4041
4156
|
}
|
|
4042
4157
|
}
|
|
4043
4158
|
function insertNodeHook(vnode, parentNode, referenceNode) {
|
|
4044
|
-
const {
|
|
4045
|
-
renderer
|
|
4046
|
-
} = vnode.owner;
|
|
4047
|
-
|
|
4048
4159
|
if (process.env.NODE_ENV !== 'production') {
|
|
4049
4160
|
unlockDomMutation();
|
|
4050
4161
|
}
|
|
4051
4162
|
|
|
4052
|
-
|
|
4163
|
+
insert(vnode.elm, parentNode, referenceNode);
|
|
4053
4164
|
|
|
4054
4165
|
if (process.env.NODE_ENV !== 'production') {
|
|
4055
4166
|
lockDomMutation();
|
|
4056
4167
|
}
|
|
4057
4168
|
}
|
|
4058
4169
|
function removeNodeHook(vnode, parentNode) {
|
|
4059
|
-
const {
|
|
4060
|
-
renderer
|
|
4061
|
-
} = vnode.owner;
|
|
4062
|
-
|
|
4063
4170
|
if (process.env.NODE_ENV !== 'production') {
|
|
4064
4171
|
unlockDomMutation();
|
|
4065
4172
|
}
|
|
4066
4173
|
|
|
4067
|
-
|
|
4174
|
+
remove(vnode.elm, parentNode);
|
|
4068
4175
|
|
|
4069
4176
|
if (process.env.NODE_ENV !== 'production') {
|
|
4070
4177
|
lockDomMutation();
|
|
@@ -4151,13 +4258,15 @@ function updateElmHook(oldVnode, vnode) {
|
|
|
4151
4258
|
}
|
|
4152
4259
|
function updateChildrenHook(oldVnode, vnode) {
|
|
4153
4260
|
const {
|
|
4154
|
-
|
|
4155
|
-
|
|
4261
|
+
elm,
|
|
4262
|
+
children
|
|
4156
4263
|
} = vnode;
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
}
|
|
4264
|
+
|
|
4265
|
+
if (hasDynamicChildren(children)) {
|
|
4266
|
+
updateDynamicChildren(elm, oldVnode.children, children);
|
|
4267
|
+
} else {
|
|
4268
|
+
updateStaticChildren(elm, oldVnode.children, children);
|
|
4269
|
+
}
|
|
4161
4270
|
}
|
|
4162
4271
|
function allocateChildrenHook(vnode, vm) {
|
|
4163
4272
|
// A component with slots will re-render because:
|
|
@@ -4221,8 +4330,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
4221
4330
|
createVM(elm, def, {
|
|
4222
4331
|
mode,
|
|
4223
4332
|
owner,
|
|
4224
|
-
tagName: sel
|
|
4225
|
-
renderer: owner.renderer
|
|
4333
|
+
tagName: sel
|
|
4226
4334
|
});
|
|
4227
4335
|
|
|
4228
4336
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4266,16 +4374,13 @@ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
|
4266
4374
|
const {
|
|
4267
4375
|
data: {
|
|
4268
4376
|
attrs = {}
|
|
4269
|
-
},
|
|
4270
|
-
owner: {
|
|
4271
|
-
renderer
|
|
4272
4377
|
}
|
|
4273
4378
|
} = vnode;
|
|
4274
4379
|
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4275
4380
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4276
4381
|
|
|
4277
4382
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4278
|
-
const elmAttrValue =
|
|
4383
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
4279
4384
|
|
|
4280
4385
|
if (String(attrValue) !== elmAttrValue) {
|
|
4281
4386
|
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
@@ -4291,9 +4396,6 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
|
4291
4396
|
data: {
|
|
4292
4397
|
className,
|
|
4293
4398
|
classMap
|
|
4294
|
-
},
|
|
4295
|
-
owner: {
|
|
4296
|
-
renderer
|
|
4297
4399
|
}
|
|
4298
4400
|
} = vnode;
|
|
4299
4401
|
let nodesAreCompatible = true;
|
|
@@ -4305,7 +4407,7 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
|
4305
4407
|
vnodeClassName = className;
|
|
4306
4408
|
} else if (!isUndefined$1(classMap)) {
|
|
4307
4409
|
// classMap is used when class is set to static value.
|
|
4308
|
-
const classList =
|
|
4410
|
+
const classList = getClassList(elm);
|
|
4309
4411
|
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4310
4412
|
|
|
4311
4413
|
for (const name in classMap) {
|
|
@@ -4335,12 +4437,9 @@ function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
|
4335
4437
|
data: {
|
|
4336
4438
|
style,
|
|
4337
4439
|
styleDecls
|
|
4338
|
-
},
|
|
4339
|
-
owner: {
|
|
4340
|
-
renderer
|
|
4341
4440
|
}
|
|
4342
4441
|
} = vnode;
|
|
4343
|
-
const elmStyle =
|
|
4442
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
4344
4443
|
let vnodeStyle;
|
|
4345
4444
|
let nodesAreCompatible = true;
|
|
4346
4445
|
|
|
@@ -4472,12 +4571,12 @@ function hasDynamicChildren(children) {
|
|
|
4472
4571
|
* SPDX-License-Identifier: MIT
|
|
4473
4572
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4474
4573
|
*/
|
|
4475
|
-
function getUpgradableConstructor(tagName
|
|
4574
|
+
function getUpgradableConstructor(tagName) {
|
|
4476
4575
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
4477
4576
|
// produce only tags with lowercase letters
|
|
4478
4577
|
// But, for backwards compatibility, we will lower case the tagName
|
|
4479
4578
|
tagName = tagName.toLowerCase();
|
|
4480
|
-
let CE =
|
|
4579
|
+
let CE = getCustomElement(tagName);
|
|
4481
4580
|
|
|
4482
4581
|
if (!isUndefined$1(CE)) {
|
|
4483
4582
|
return CE;
|
|
@@ -4488,7 +4587,7 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4488
4587
|
*/
|
|
4489
4588
|
|
|
4490
4589
|
|
|
4491
|
-
CE = class LWCUpgradableElement extends
|
|
4590
|
+
CE = class LWCUpgradableElement extends HTMLElementExported {
|
|
4492
4591
|
constructor(upgradeCallback) {
|
|
4493
4592
|
super();
|
|
4494
4593
|
|
|
@@ -4498,7 +4597,7 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4498
4597
|
}
|
|
4499
4598
|
|
|
4500
4599
|
};
|
|
4501
|
-
|
|
4600
|
+
defineCustomElement(tagName, CE);
|
|
4502
4601
|
return CE;
|
|
4503
4602
|
}
|
|
4504
4603
|
|
|
@@ -4515,10 +4614,7 @@ const TextHook = {
|
|
|
4515
4614
|
const {
|
|
4516
4615
|
owner
|
|
4517
4616
|
} = vnode;
|
|
4518
|
-
const
|
|
4519
|
-
renderer
|
|
4520
|
-
} = owner;
|
|
4521
|
-
const elm = renderer.createText(vnode.text);
|
|
4617
|
+
const elm = createText(vnode.text);
|
|
4522
4618
|
linkNodeToShadow(elm, owner);
|
|
4523
4619
|
vnode.elm = elm;
|
|
4524
4620
|
},
|
|
@@ -4552,10 +4648,7 @@ const CommentHook = {
|
|
|
4552
4648
|
owner,
|
|
4553
4649
|
text
|
|
4554
4650
|
} = vnode;
|
|
4555
|
-
const
|
|
4556
|
-
renderer
|
|
4557
|
-
} = owner;
|
|
4558
|
-
const elm = renderer.createComment(text);
|
|
4651
|
+
const elm = createComment(text);
|
|
4559
4652
|
linkNodeToShadow(elm, owner);
|
|
4560
4653
|
vnode.elm = elm;
|
|
4561
4654
|
},
|
|
@@ -4597,11 +4690,8 @@ const ElementHook = {
|
|
|
4597
4690
|
svg
|
|
4598
4691
|
}
|
|
4599
4692
|
} = vnode;
|
|
4600
|
-
const {
|
|
4601
|
-
renderer
|
|
4602
|
-
} = owner;
|
|
4603
4693
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4604
|
-
const elm =
|
|
4694
|
+
const elm = createElement(sel, namespace);
|
|
4605
4695
|
linkNodeToShadow(elm, owner);
|
|
4606
4696
|
fallbackElmHook(elm, vnode);
|
|
4607
4697
|
vnode.elm = elm;
|
|
@@ -4661,10 +4751,7 @@ const CustomElementHook = {
|
|
|
4661
4751
|
sel,
|
|
4662
4752
|
owner
|
|
4663
4753
|
} = vnode;
|
|
4664
|
-
const
|
|
4665
|
-
renderer
|
|
4666
|
-
} = owner;
|
|
4667
|
-
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
4754
|
+
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4668
4755
|
/**
|
|
4669
4756
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4670
4757
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -4757,8 +4844,7 @@ const CustomElementHook = {
|
|
|
4757
4844
|
createVM(elm, def, {
|
|
4758
4845
|
mode,
|
|
4759
4846
|
owner,
|
|
4760
|
-
tagName: sel
|
|
4761
|
-
renderer: owner.renderer
|
|
4847
|
+
tagName: sel
|
|
4762
4848
|
});
|
|
4763
4849
|
vnode.elm = elm;
|
|
4764
4850
|
const vm = getAssociatedVM(elm);
|
|
@@ -4787,12 +4873,11 @@ const CustomElementHook = {
|
|
|
4787
4873
|
|
|
4788
4874
|
function linkNodeToShadow(elm, owner) {
|
|
4789
4875
|
const {
|
|
4790
|
-
renderer,
|
|
4791
4876
|
renderMode,
|
|
4792
4877
|
shadowMode
|
|
4793
4878
|
} = owner; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4794
4879
|
|
|
4795
|
-
if (
|
|
4880
|
+
if (isSyntheticShadowDefined) {
|
|
4796
4881
|
if (shadowMode === 1
|
|
4797
4882
|
/* Synthetic */
|
|
4798
4883
|
|| renderMode === 0
|
|
@@ -5324,7 +5409,6 @@ function updateStylesheetToken(vm, template) {
|
|
|
5324
5409
|
const {
|
|
5325
5410
|
elm,
|
|
5326
5411
|
context,
|
|
5327
|
-
renderer,
|
|
5328
5412
|
renderMode,
|
|
5329
5413
|
shadowMode
|
|
5330
5414
|
} = vm;
|
|
@@ -5351,11 +5435,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
5351
5435
|
} = context;
|
|
5352
5436
|
|
|
5353
5437
|
if (oldHasTokenInClass) {
|
|
5354
|
-
|
|
5438
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
5355
5439
|
}
|
|
5356
5440
|
|
|
5357
5441
|
if (oldHasTokenInAttribute) {
|
|
5358
|
-
|
|
5442
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
5359
5443
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5360
5444
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5361
5445
|
|
|
@@ -5367,12 +5451,12 @@ function updateStylesheetToken(vm, template) {
|
|
|
5367
5451
|
|
|
5368
5452
|
if (!isUndefined$1(newToken)) {
|
|
5369
5453
|
if (hasScopedStyles) {
|
|
5370
|
-
|
|
5454
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
5371
5455
|
newHasTokenInClass = true;
|
|
5372
5456
|
}
|
|
5373
5457
|
|
|
5374
5458
|
if (isSyntheticShadow) {
|
|
5375
|
-
|
|
5459
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
5376
5460
|
newHasTokenInAttribute = true;
|
|
5377
5461
|
}
|
|
5378
5462
|
} // Update the styling tokens present on the context object.
|
|
@@ -5492,7 +5576,6 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
5492
5576
|
|
|
5493
5577
|
function createStylesheet(vm, stylesheets) {
|
|
5494
5578
|
const {
|
|
5495
|
-
renderer,
|
|
5496
5579
|
renderMode,
|
|
5497
5580
|
shadowMode
|
|
5498
5581
|
} = vm;
|
|
@@ -5503,9 +5586,9 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5503
5586
|
/* Synthetic */
|
|
5504
5587
|
) {
|
|
5505
5588
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5506
|
-
|
|
5589
|
+
insertGlobalStylesheet(stylesheets[i]);
|
|
5507
5590
|
}
|
|
5508
|
-
} else if (
|
|
5591
|
+
} else if (ssr || isHydrating()) {
|
|
5509
5592
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5510
5593
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5511
5594
|
// the first time the VM renders.
|
|
@@ -5519,10 +5602,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5519
5602
|
|
|
5520
5603
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5521
5604
|
if (isGlobal) {
|
|
5522
|
-
|
|
5605
|
+
insertGlobalStylesheet(stylesheets[i]);
|
|
5523
5606
|
} else {
|
|
5524
5607
|
// local level
|
|
5525
|
-
|
|
5608
|
+
insertStylesheet(stylesheets[i], root.cmpRoot);
|
|
5526
5609
|
}
|
|
5527
5610
|
}
|
|
5528
5611
|
}
|
|
@@ -5605,7 +5688,7 @@ function logOperationStart(opId, vm) {
|
|
|
5605
5688
|
if (isProfilerEnabled) {
|
|
5606
5689
|
currentDispatcher(opId, 0
|
|
5607
5690
|
/* Start */
|
|
5608
|
-
, vm.tagName, vm.idx);
|
|
5691
|
+
, vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
|
|
5609
5692
|
}
|
|
5610
5693
|
}
|
|
5611
5694
|
function logOperationEnd(opId, vm) {
|
|
@@ -5618,7 +5701,7 @@ function logOperationEnd(opId, vm) {
|
|
|
5618
5701
|
if (isProfilerEnabled) {
|
|
5619
5702
|
currentDispatcher(opId, 1
|
|
5620
5703
|
/* Stop */
|
|
5621
|
-
, vm.tagName, vm.idx);
|
|
5704
|
+
, vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
|
|
5622
5705
|
}
|
|
5623
5706
|
}
|
|
5624
5707
|
function logGlobalOperationStart(opId, vm) {
|
|
@@ -5631,7 +5714,7 @@ function logGlobalOperationStart(opId, vm) {
|
|
|
5631
5714
|
if (isProfilerEnabled) {
|
|
5632
5715
|
currentDispatcher(opId, 0
|
|
5633
5716
|
/* Start */
|
|
5634
|
-
, vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
|
|
5717
|
+
, vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx, vm === null || vm === void 0 ? void 0 : vm.renderMode, vm === null || vm === void 0 ? void 0 : vm.shadowMode);
|
|
5635
5718
|
}
|
|
5636
5719
|
}
|
|
5637
5720
|
function logGlobalOperationEnd(opId, vm) {
|
|
@@ -5644,7 +5727,7 @@ function logGlobalOperationEnd(opId, vm) {
|
|
|
5644
5727
|
if (isProfilerEnabled) {
|
|
5645
5728
|
currentDispatcher(opId, 1
|
|
5646
5729
|
/* Stop */
|
|
5647
|
-
, vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
|
|
5730
|
+
, vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx, vm === null || vm === void 0 ? void 0 : vm.renderMode, vm === null || vm === void 0 ? void 0 : vm.shadowMode);
|
|
5648
5731
|
}
|
|
5649
5732
|
}
|
|
5650
5733
|
|
|
@@ -5797,6 +5880,7 @@ function evaluateTemplate(vm, html) {
|
|
|
5797
5880
|
|
|
5798
5881
|
return vnodes;
|
|
5799
5882
|
}
|
|
5883
|
+
|
|
5800
5884
|
function computeHasScopedStyles(template) {
|
|
5801
5885
|
const {
|
|
5802
5886
|
stylesheets
|
|
@@ -6182,7 +6266,6 @@ function createVM(elm, def, options) {
|
|
|
6182
6266
|
const {
|
|
6183
6267
|
mode,
|
|
6184
6268
|
owner,
|
|
6185
|
-
renderer,
|
|
6186
6269
|
tagName
|
|
6187
6270
|
} = options;
|
|
6188
6271
|
const vm = {
|
|
@@ -6197,7 +6280,6 @@ function createVM(elm, def, options) {
|
|
|
6197
6280
|
tagName,
|
|
6198
6281
|
mode,
|
|
6199
6282
|
owner,
|
|
6200
|
-
renderer,
|
|
6201
6283
|
children: EmptyArray,
|
|
6202
6284
|
aChildren: EmptyArray,
|
|
6203
6285
|
velements: EmptyArray,
|
|
@@ -6252,13 +6334,8 @@ function createVM(elm, def, options) {
|
|
|
6252
6334
|
|
|
6253
6335
|
function computeShadowMode(vm) {
|
|
6254
6336
|
const {
|
|
6255
|
-
def
|
|
6256
|
-
renderer
|
|
6337
|
+
def
|
|
6257
6338
|
} = vm;
|
|
6258
|
-
const {
|
|
6259
|
-
isNativeShadowDefined,
|
|
6260
|
-
isSyntheticShadowDefined
|
|
6261
|
-
} = renderer;
|
|
6262
6339
|
let shadowMode;
|
|
6263
6340
|
|
|
6264
6341
|
if (isSyntheticShadowDefined) {
|
|
@@ -6408,13 +6485,12 @@ function patchShadowRoot(vm, newCh) {
|
|
|
6408
6485
|
|
|
6409
6486
|
function runRenderedCallback(vm) {
|
|
6410
6487
|
const {
|
|
6411
|
-
renderer,
|
|
6412
6488
|
def: {
|
|
6413
6489
|
renderedCallback
|
|
6414
6490
|
}
|
|
6415
6491
|
} = vm;
|
|
6416
6492
|
|
|
6417
|
-
if (isTrue(
|
|
6493
|
+
if (isTrue(ssr)) {
|
|
6418
6494
|
return;
|
|
6419
6495
|
}
|
|
6420
6496
|
|
|
@@ -6640,8 +6716,7 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
6640
6716
|
|
|
6641
6717
|
function resetComponentRoot(vm) {
|
|
6642
6718
|
const {
|
|
6643
|
-
children
|
|
6644
|
-
renderer
|
|
6719
|
+
children
|
|
6645
6720
|
} = vm;
|
|
6646
6721
|
const rootNode = getRenderRoot(vm);
|
|
6647
6722
|
|
|
@@ -6649,7 +6724,7 @@ function resetComponentRoot(vm) {
|
|
|
6649
6724
|
const child = children[i];
|
|
6650
6725
|
|
|
6651
6726
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6652
|
-
|
|
6727
|
+
remove(child.elm, rootNode);
|
|
6653
6728
|
}
|
|
6654
6729
|
}
|
|
6655
6730
|
|
|
@@ -6658,7 +6733,7 @@ function resetComponentRoot(vm) {
|
|
|
6658
6733
|
vm.velements = EmptyArray;
|
|
6659
6734
|
}
|
|
6660
6735
|
function scheduleRehydration(vm) {
|
|
6661
|
-
if (isTrue(
|
|
6736
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
6662
6737
|
return;
|
|
6663
6738
|
}
|
|
6664
6739
|
|
|
@@ -6898,7 +6973,6 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
6898
6973
|
|
|
6899
6974
|
const {
|
|
6900
6975
|
elm,
|
|
6901
|
-
renderer,
|
|
6902
6976
|
context: {
|
|
6903
6977
|
wiredConnecting,
|
|
6904
6978
|
wiredDisconnecting
|
|
@@ -6925,7 +6999,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
6925
6999
|
}
|
|
6926
7000
|
|
|
6927
7001
|
});
|
|
6928
|
-
|
|
7002
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
6929
7003
|
});
|
|
6930
7004
|
}
|
|
6931
7005
|
|
|
@@ -7181,5 +7255,5 @@ function setHooks(hooks) {
|
|
|
7181
7255
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7182
7256
|
}
|
|
7183
7257
|
|
|
7184
|
-
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, getAssociatedVMIfPresent, getComponentDef, getComponentInternalDef, getUpgradableConstructor, hydrateRootElement, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7185
|
-
/* version: 2.
|
|
7258
|
+
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, getAssociatedVMIfPresent, getComponentDef, getComponentInternalDef, getUpgradableConstructor, hydrateRootElement, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setAddEventListener, setAssertInstanceOfHTMLElement, setAttachShadow, setCreateComment, setCreateElement, setCreateText, setDefineCustomElement, setDispatchEvent, setGetAttribute, setGetBoundingClientRect, setGetChildNodes, setGetChildren, setGetClassList, setGetCustomElement, setGetElementsByClassName, setGetElementsByTagName, setGetFirstChild, setGetFirstElementChild, setGetLastChild, setGetLastElementChild, setGetProperty, setHTMLElement, setHooks, setInsert, setInsertGlobalStylesheet, setInsertStylesheet, setIsConnected, setIsHydrating, setIsNativeShadowDefined, setIsSyntheticShadowDefined, setNextSibling, setQuerySelector, setQuerySelectorAll, setRemove, setRemoveAttribute, setRemoveEventListener, setSetAttribute, setSetCSSStyleProperty, setSetProperty, setSetText, setSsr, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7259
|
+
/* version: 2.7.2 */
|