@lwc/engine-core 2.7.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 +321 -206
- package/dist/engine-core.js +282 -207
- package/package.json +4 -4
- package/types/framework/html-element.d.ts +2 -0
- package/types/framework/main.d.ts +1 -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.cjs.js
CHANGED
|
@@ -73,6 +73,170 @@ function parseStyleText(cssText) {
|
|
|
73
73
|
return styleMap;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
//
|
|
77
|
+
// Primitives
|
|
78
|
+
//
|
|
79
|
+
let ssr;
|
|
80
|
+
function setSsr(ssrImpl) {
|
|
81
|
+
ssr = ssrImpl;
|
|
82
|
+
}
|
|
83
|
+
let isNativeShadowDefined;
|
|
84
|
+
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
85
|
+
isNativeShadowDefined = isNativeShadowDefinedImpl;
|
|
86
|
+
}
|
|
87
|
+
let isSyntheticShadowDefined;
|
|
88
|
+
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
89
|
+
isSyntheticShadowDefined = isSyntheticShadowDefinedImpl;
|
|
90
|
+
}
|
|
91
|
+
let HTMLElementExported;
|
|
92
|
+
function setHTMLElement(HTMLElementImpl) {
|
|
93
|
+
HTMLElementExported = HTMLElementImpl;
|
|
94
|
+
}
|
|
95
|
+
let isHydrating;
|
|
96
|
+
function setIsHydrating(isHydratingImpl) {
|
|
97
|
+
isHydrating = isHydratingImpl;
|
|
98
|
+
}
|
|
99
|
+
let insert;
|
|
100
|
+
function setInsert(insertImpl) {
|
|
101
|
+
insert = insertImpl;
|
|
102
|
+
}
|
|
103
|
+
let remove;
|
|
104
|
+
function setRemove(removeImpl) {
|
|
105
|
+
remove = removeImpl;
|
|
106
|
+
}
|
|
107
|
+
let createElement;
|
|
108
|
+
function setCreateElement(createElementImpl) {
|
|
109
|
+
createElement = createElementImpl;
|
|
110
|
+
}
|
|
111
|
+
let createText;
|
|
112
|
+
function setCreateText(createTextImpl) {
|
|
113
|
+
createText = createTextImpl;
|
|
114
|
+
}
|
|
115
|
+
let createComment;
|
|
116
|
+
function setCreateComment(createCommentImpl) {
|
|
117
|
+
createComment = createCommentImpl;
|
|
118
|
+
}
|
|
119
|
+
let nextSibling;
|
|
120
|
+
function setNextSibling(nextSiblingImpl) {
|
|
121
|
+
nextSibling = nextSiblingImpl;
|
|
122
|
+
}
|
|
123
|
+
let attachShadow;
|
|
124
|
+
function setAttachShadow(attachShadowImpl) {
|
|
125
|
+
attachShadow = attachShadowImpl;
|
|
126
|
+
}
|
|
127
|
+
let getProperty;
|
|
128
|
+
function setGetProperty(getPropertyImpl) {
|
|
129
|
+
getProperty = getPropertyImpl;
|
|
130
|
+
}
|
|
131
|
+
let setProperty;
|
|
132
|
+
function setSetProperty(setPropertyImpl) {
|
|
133
|
+
setProperty = setPropertyImpl;
|
|
134
|
+
}
|
|
135
|
+
let setText;
|
|
136
|
+
function setSetText(setTextImpl) {
|
|
137
|
+
setText = setTextImpl;
|
|
138
|
+
}
|
|
139
|
+
let getAttribute;
|
|
140
|
+
function setGetAttribute(getAttributeImpl) {
|
|
141
|
+
getAttribute = getAttributeImpl;
|
|
142
|
+
}
|
|
143
|
+
let setAttribute;
|
|
144
|
+
function setSetAttribute(setAttributeImpl) {
|
|
145
|
+
setAttribute = setAttributeImpl;
|
|
146
|
+
}
|
|
147
|
+
let removeAttribute;
|
|
148
|
+
function setRemoveAttribute(removeAttributeImpl) {
|
|
149
|
+
removeAttribute = removeAttributeImpl;
|
|
150
|
+
}
|
|
151
|
+
let addEventListener;
|
|
152
|
+
function setAddEventListener(addEventListenerImpl) {
|
|
153
|
+
addEventListener = addEventListenerImpl;
|
|
154
|
+
}
|
|
155
|
+
let removeEventListener;
|
|
156
|
+
function setRemoveEventListener(removeEventListenerImpl) {
|
|
157
|
+
removeEventListener = removeEventListenerImpl;
|
|
158
|
+
}
|
|
159
|
+
let dispatchEvent;
|
|
160
|
+
function setDispatchEvent(dispatchEventImpl) {
|
|
161
|
+
dispatchEvent = dispatchEventImpl;
|
|
162
|
+
}
|
|
163
|
+
let getClassList;
|
|
164
|
+
function setGetClassList(getClassListImpl) {
|
|
165
|
+
getClassList = getClassListImpl;
|
|
166
|
+
}
|
|
167
|
+
let setCSSStyleProperty;
|
|
168
|
+
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
169
|
+
setCSSStyleProperty = setCSSStylePropertyImpl;
|
|
170
|
+
}
|
|
171
|
+
let getBoundingClientRect;
|
|
172
|
+
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
173
|
+
getBoundingClientRect = getBoundingClientRectImpl;
|
|
174
|
+
}
|
|
175
|
+
let querySelector;
|
|
176
|
+
function setQuerySelector(querySelectorImpl) {
|
|
177
|
+
querySelector = querySelectorImpl;
|
|
178
|
+
}
|
|
179
|
+
let querySelectorAll;
|
|
180
|
+
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
181
|
+
querySelectorAll = querySelectorAllImpl;
|
|
182
|
+
}
|
|
183
|
+
let getElementsByTagName;
|
|
184
|
+
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
185
|
+
getElementsByTagName = getElementsByTagNameImpl;
|
|
186
|
+
}
|
|
187
|
+
let getElementsByClassName;
|
|
188
|
+
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
189
|
+
getElementsByClassName = getElementsByClassNameImpl;
|
|
190
|
+
}
|
|
191
|
+
let getChildren;
|
|
192
|
+
function setGetChildren(getChildrenImpl) {
|
|
193
|
+
getChildren = getChildrenImpl;
|
|
194
|
+
}
|
|
195
|
+
let getChildNodes;
|
|
196
|
+
function setGetChildNodes(getChildNodesImpl) {
|
|
197
|
+
getChildNodes = getChildNodesImpl;
|
|
198
|
+
}
|
|
199
|
+
let getFirstChild;
|
|
200
|
+
function setGetFirstChild(getFirstChildImpl) {
|
|
201
|
+
getFirstChild = getFirstChildImpl;
|
|
202
|
+
}
|
|
203
|
+
let getFirstElementChild;
|
|
204
|
+
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
205
|
+
getFirstElementChild = getFirstElementChildImpl;
|
|
206
|
+
}
|
|
207
|
+
let getLastChild;
|
|
208
|
+
function setGetLastChild(getLastChildImpl) {
|
|
209
|
+
getLastChild = getLastChildImpl;
|
|
210
|
+
}
|
|
211
|
+
let getLastElementChild;
|
|
212
|
+
function setGetLastElementChild(getLastElementChildImpl) {
|
|
213
|
+
getLastElementChild = getLastElementChildImpl;
|
|
214
|
+
}
|
|
215
|
+
let isConnected;
|
|
216
|
+
function setIsConnected(isConnectedImpl) {
|
|
217
|
+
isConnected = isConnectedImpl;
|
|
218
|
+
}
|
|
219
|
+
let insertGlobalStylesheet;
|
|
220
|
+
function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
|
|
221
|
+
insertGlobalStylesheet = insertGlobalStylesheetImpl;
|
|
222
|
+
}
|
|
223
|
+
let insertStylesheet;
|
|
224
|
+
function setInsertStylesheet(insertStylesheetImpl) {
|
|
225
|
+
insertStylesheet = insertStylesheetImpl;
|
|
226
|
+
}
|
|
227
|
+
let assertInstanceOfHTMLElement;
|
|
228
|
+
function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
|
|
229
|
+
assertInstanceOfHTMLElement = assertInstanceOfHTMLElementImpl;
|
|
230
|
+
}
|
|
231
|
+
let defineCustomElement;
|
|
232
|
+
function setDefineCustomElement(defineCustomElementImpl) {
|
|
233
|
+
defineCustomElement = defineCustomElementImpl;
|
|
234
|
+
}
|
|
235
|
+
let getCustomElement;
|
|
236
|
+
function setGetCustomElement(getCustomElementImpl) {
|
|
237
|
+
getCustomElement = getCustomElementImpl;
|
|
238
|
+
}
|
|
239
|
+
|
|
76
240
|
/*
|
|
77
241
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
78
242
|
* All rights reserved.
|
|
@@ -314,9 +478,6 @@ function createAllEventListeners(vnode) {
|
|
|
314
478
|
elm,
|
|
315
479
|
data: {
|
|
316
480
|
on
|
|
317
|
-
},
|
|
318
|
-
owner: {
|
|
319
|
-
renderer
|
|
320
481
|
}
|
|
321
482
|
} = vnode;
|
|
322
483
|
|
|
@@ -329,7 +490,7 @@ function createAllEventListeners(vnode) {
|
|
|
329
490
|
let name;
|
|
330
491
|
|
|
331
492
|
for (name in on) {
|
|
332
|
-
|
|
493
|
+
addEventListener(elm, name, listener);
|
|
333
494
|
}
|
|
334
495
|
}
|
|
335
496
|
|
|
@@ -468,9 +629,6 @@ function updateAttrs(oldVnode, vnode) {
|
|
|
468
629
|
const {
|
|
469
630
|
data: {
|
|
470
631
|
attrs
|
|
471
|
-
},
|
|
472
|
-
owner: {
|
|
473
|
-
renderer
|
|
474
632
|
}
|
|
475
633
|
} = vnode;
|
|
476
634
|
|
|
@@ -493,10 +651,6 @@ function updateAttrs(oldVnode, vnode) {
|
|
|
493
651
|
}
|
|
494
652
|
|
|
495
653
|
const elm = vnode.elm;
|
|
496
|
-
const {
|
|
497
|
-
setAttribute,
|
|
498
|
-
removeAttribute
|
|
499
|
-
} = renderer;
|
|
500
654
|
let key;
|
|
501
655
|
oldAttrs = shared.isUndefined(oldAttrs) ? EmptyObject : oldAttrs; // update modified attributes, add new attributes
|
|
502
656
|
// this routine is only useful for data-* attributes in all kind of elements
|
|
@@ -515,7 +669,7 @@ function updateAttrs(oldVnode, vnode) {
|
|
|
515
669
|
} else if (shared.StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
516
670
|
// Assume xlink namespace
|
|
517
671
|
setAttribute(elm, key, cur, xlinkNS);
|
|
518
|
-
} else if (shared.isNull(cur)) {
|
|
672
|
+
} else if (shared.isNull(cur) || shared.isUndefined(cur)) {
|
|
519
673
|
removeAttribute(elm, key);
|
|
520
674
|
} else {
|
|
521
675
|
setAttribute(elm, key, cur);
|
|
@@ -567,17 +721,14 @@ function update(oldVnode, vnode) {
|
|
|
567
721
|
const isFirstPatch = shared.isUndefined(oldProps);
|
|
568
722
|
const {
|
|
569
723
|
elm,
|
|
570
|
-
sel
|
|
571
|
-
owner: {
|
|
572
|
-
renderer
|
|
573
|
-
}
|
|
724
|
+
sel
|
|
574
725
|
} = vnode;
|
|
575
726
|
|
|
576
727
|
for (const key in props) {
|
|
577
728
|
const cur = props[key]; // if it is the first time this element is patched, or the current value is different to the previous value...
|
|
578
729
|
|
|
579
|
-
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ?
|
|
580
|
-
|
|
730
|
+
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
731
|
+
setProperty(elm, key, cur);
|
|
581
732
|
}
|
|
582
733
|
}
|
|
583
734
|
}
|
|
@@ -646,9 +797,6 @@ function updateClassAttribute(oldVnode, vnode) {
|
|
|
646
797
|
elm,
|
|
647
798
|
data: {
|
|
648
799
|
className: newClass
|
|
649
|
-
},
|
|
650
|
-
owner: {
|
|
651
|
-
renderer
|
|
652
800
|
}
|
|
653
801
|
} = vnode;
|
|
654
802
|
const {
|
|
@@ -661,7 +809,7 @@ function updateClassAttribute(oldVnode, vnode) {
|
|
|
661
809
|
return;
|
|
662
810
|
}
|
|
663
811
|
|
|
664
|
-
const classList =
|
|
812
|
+
const classList = getClassList(elm);
|
|
665
813
|
const newClassMap = getMapFromClassName(newClass);
|
|
666
814
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
667
815
|
let name;
|
|
@@ -700,15 +848,8 @@ function updateStyleAttribute(oldVnode, vnode) {
|
|
|
700
848
|
elm,
|
|
701
849
|
data: {
|
|
702
850
|
style: newStyle
|
|
703
|
-
},
|
|
704
|
-
owner: {
|
|
705
|
-
renderer
|
|
706
851
|
}
|
|
707
852
|
} = vnode;
|
|
708
|
-
const {
|
|
709
|
-
setAttribute,
|
|
710
|
-
removeAttribute
|
|
711
|
-
} = renderer;
|
|
712
853
|
|
|
713
854
|
if (oldVnode.data.style === newStyle) {
|
|
714
855
|
return;
|
|
@@ -743,9 +884,6 @@ function createClassAttribute(vnode) {
|
|
|
743
884
|
elm,
|
|
744
885
|
data: {
|
|
745
886
|
classMap
|
|
746
|
-
},
|
|
747
|
-
owner: {
|
|
748
|
-
renderer
|
|
749
887
|
}
|
|
750
888
|
} = vnode;
|
|
751
889
|
|
|
@@ -753,7 +891,7 @@ function createClassAttribute(vnode) {
|
|
|
753
891
|
return;
|
|
754
892
|
}
|
|
755
893
|
|
|
756
|
-
const classList =
|
|
894
|
+
const classList = getClassList(elm);
|
|
757
895
|
|
|
758
896
|
for (const name in classMap) {
|
|
759
897
|
classList.add(name);
|
|
@@ -778,9 +916,6 @@ function createStyleAttribute(vnode) {
|
|
|
778
916
|
elm,
|
|
779
917
|
data: {
|
|
780
918
|
styleDecls
|
|
781
|
-
},
|
|
782
|
-
owner: {
|
|
783
|
-
renderer
|
|
784
919
|
}
|
|
785
920
|
} = vnode;
|
|
786
921
|
|
|
@@ -790,7 +925,7 @@ function createStyleAttribute(vnode) {
|
|
|
790
925
|
|
|
791
926
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
792
927
|
const [prop, value, important] = styleDecls[i];
|
|
793
|
-
|
|
928
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
794
929
|
}
|
|
795
930
|
}
|
|
796
931
|
|
|
@@ -805,14 +940,6 @@ var modStaticStyle = {
|
|
|
805
940
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
806
941
|
*/
|
|
807
942
|
|
|
808
|
-
/**
|
|
809
|
-
@license
|
|
810
|
-
Copyright (c) 2015 Simon Friis Vindum.
|
|
811
|
-
This code may only be used under the MIT License found at
|
|
812
|
-
https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
813
|
-
Code distributed by Snabbdom as part of the Snabbdom project at
|
|
814
|
-
https://github.com/snabbdom/snabbdom/
|
|
815
|
-
*/
|
|
816
943
|
function isUndef(s) {
|
|
817
944
|
return s === undefined;
|
|
818
945
|
}
|
|
@@ -900,7 +1027,7 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
|
900
1027
|
} else if (sameVnode(oldStartVnode, newEndVnode)) {
|
|
901
1028
|
// Vnode moved right
|
|
902
1029
|
patchVnode(oldStartVnode, newEndVnode);
|
|
903
|
-
newEndVnode.hook.move(oldStartVnode, parentElm,
|
|
1030
|
+
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling(oldEndVnode.elm));
|
|
904
1031
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
905
1032
|
newEndVnode = newCh[--newEndIdx];
|
|
906
1033
|
} else if (sameVnode(oldEndVnode, newStartVnode)) {
|
|
@@ -1377,7 +1504,7 @@ function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
|
1377
1504
|
}
|
|
1378
1505
|
|
|
1379
1506
|
/*
|
|
1380
|
-
* Copyright (c)
|
|
1507
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
1381
1508
|
* All rights reserved.
|
|
1382
1509
|
* SPDX-License-Identifier: MIT
|
|
1383
1510
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
@@ -2292,9 +2419,7 @@ function createBridgeToElementDescriptor(propName, descriptor) {
|
|
|
2292
2419
|
|
|
2293
2420
|
|
|
2294
2421
|
const LightningElement = function () {
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2422
|
+
// This should be as performant as possible, while any initialization should be done lazily
|
|
2298
2423
|
if (shared.isNull(vmBeingConstructed)) {
|
|
2299
2424
|
throw new ReferenceError('Illegal constructor');
|
|
2300
2425
|
}
|
|
@@ -2302,15 +2427,14 @@ const LightningElement = function () {
|
|
|
2302
2427
|
const vm = vmBeingConstructed;
|
|
2303
2428
|
const {
|
|
2304
2429
|
def,
|
|
2305
|
-
elm
|
|
2306
|
-
renderer
|
|
2430
|
+
elm
|
|
2307
2431
|
} = vm;
|
|
2308
2432
|
const {
|
|
2309
2433
|
bridge
|
|
2310
2434
|
} = def;
|
|
2311
2435
|
|
|
2312
2436
|
if (process.env.NODE_ENV !== 'production') {
|
|
2313
|
-
|
|
2437
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2314
2438
|
}
|
|
2315
2439
|
|
|
2316
2440
|
const component = this;
|
|
@@ -2340,7 +2464,7 @@ const LightningElement = function () {
|
|
|
2340
2464
|
if (vm.renderMode === 1
|
|
2341
2465
|
/* Shadow */
|
|
2342
2466
|
) {
|
|
2343
|
-
|
|
2467
|
+
doAttachShadow(vm);
|
|
2344
2468
|
} // Adding extra guard rails in DEV mode.
|
|
2345
2469
|
|
|
2346
2470
|
|
|
@@ -2352,17 +2476,16 @@ const LightningElement = function () {
|
|
|
2352
2476
|
return this;
|
|
2353
2477
|
};
|
|
2354
2478
|
|
|
2355
|
-
function
|
|
2479
|
+
function doAttachShadow(vm) {
|
|
2356
2480
|
const {
|
|
2357
2481
|
elm,
|
|
2358
2482
|
mode,
|
|
2359
|
-
renderer,
|
|
2360
2483
|
shadowMode,
|
|
2361
2484
|
def: {
|
|
2362
2485
|
ctor
|
|
2363
2486
|
}
|
|
2364
2487
|
} = vm;
|
|
2365
|
-
const cmpRoot =
|
|
2488
|
+
const cmpRoot = attachShadow(elm, {
|
|
2366
2489
|
[shared.KEY__SYNTHETIC_MODE]: shadowMode === 1
|
|
2367
2490
|
/* Synthetic */
|
|
2368
2491
|
,
|
|
@@ -2389,10 +2512,7 @@ LightningElement.prototype = {
|
|
|
2389
2512
|
|
|
2390
2513
|
dispatchEvent(event) {
|
|
2391
2514
|
const {
|
|
2392
|
-
elm
|
|
2393
|
-
renderer: {
|
|
2394
|
-
dispatchEvent
|
|
2395
|
-
}
|
|
2515
|
+
elm
|
|
2396
2516
|
} = getAssociatedVM(this);
|
|
2397
2517
|
return dispatchEvent(elm, event);
|
|
2398
2518
|
},
|
|
@@ -2400,10 +2520,7 @@ LightningElement.prototype = {
|
|
|
2400
2520
|
addEventListener(type, listener, options) {
|
|
2401
2521
|
const vm = getAssociatedVM(this);
|
|
2402
2522
|
const {
|
|
2403
|
-
elm
|
|
2404
|
-
renderer: {
|
|
2405
|
-
addEventListener
|
|
2406
|
-
}
|
|
2523
|
+
elm
|
|
2407
2524
|
} = vm;
|
|
2408
2525
|
|
|
2409
2526
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2420,10 +2537,7 @@ LightningElement.prototype = {
|
|
|
2420
2537
|
removeEventListener(type, listener, options) {
|
|
2421
2538
|
const vm = getAssociatedVM(this);
|
|
2422
2539
|
const {
|
|
2423
|
-
elm
|
|
2424
|
-
renderer: {
|
|
2425
|
-
removeEventListener
|
|
2426
|
-
}
|
|
2540
|
+
elm
|
|
2427
2541
|
} = vm;
|
|
2428
2542
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2429
2543
|
removeEventListener(elm, type, wrappedListener, options);
|
|
@@ -2431,30 +2545,21 @@ LightningElement.prototype = {
|
|
|
2431
2545
|
|
|
2432
2546
|
hasAttribute(name) {
|
|
2433
2547
|
const {
|
|
2434
|
-
elm
|
|
2435
|
-
renderer: {
|
|
2436
|
-
getAttribute
|
|
2437
|
-
}
|
|
2548
|
+
elm
|
|
2438
2549
|
} = getAssociatedVM(this);
|
|
2439
2550
|
return !shared.isNull(getAttribute(elm, name));
|
|
2440
2551
|
},
|
|
2441
2552
|
|
|
2442
2553
|
hasAttributeNS(namespace, name) {
|
|
2443
2554
|
const {
|
|
2444
|
-
elm
|
|
2445
|
-
renderer: {
|
|
2446
|
-
getAttribute
|
|
2447
|
-
}
|
|
2555
|
+
elm
|
|
2448
2556
|
} = getAssociatedVM(this);
|
|
2449
2557
|
return !shared.isNull(getAttribute(elm, name, namespace));
|
|
2450
2558
|
},
|
|
2451
2559
|
|
|
2452
2560
|
removeAttribute(name) {
|
|
2453
2561
|
const {
|
|
2454
|
-
elm
|
|
2455
|
-
renderer: {
|
|
2456
|
-
removeAttribute
|
|
2457
|
-
}
|
|
2562
|
+
elm
|
|
2458
2563
|
} = getAssociatedVM(this);
|
|
2459
2564
|
unlockAttribute(elm, name);
|
|
2460
2565
|
removeAttribute(elm, name);
|
|
@@ -2463,10 +2568,7 @@ LightningElement.prototype = {
|
|
|
2463
2568
|
|
|
2464
2569
|
removeAttributeNS(namespace, name) {
|
|
2465
2570
|
const {
|
|
2466
|
-
elm
|
|
2467
|
-
renderer: {
|
|
2468
|
-
removeAttribute
|
|
2469
|
-
}
|
|
2571
|
+
elm
|
|
2470
2572
|
} = getAssociatedVM(this);
|
|
2471
2573
|
unlockAttribute(elm, name);
|
|
2472
2574
|
removeAttribute(elm, name, namespace);
|
|
@@ -2475,20 +2577,14 @@ LightningElement.prototype = {
|
|
|
2475
2577
|
|
|
2476
2578
|
getAttribute(name) {
|
|
2477
2579
|
const {
|
|
2478
|
-
elm
|
|
2479
|
-
renderer: {
|
|
2480
|
-
getAttribute
|
|
2481
|
-
}
|
|
2580
|
+
elm
|
|
2482
2581
|
} = getAssociatedVM(this);
|
|
2483
2582
|
return getAttribute(elm, name);
|
|
2484
2583
|
},
|
|
2485
2584
|
|
|
2486
2585
|
getAttributeNS(namespace, name) {
|
|
2487
2586
|
const {
|
|
2488
|
-
elm
|
|
2489
|
-
renderer: {
|
|
2490
|
-
getAttribute
|
|
2491
|
-
}
|
|
2587
|
+
elm
|
|
2492
2588
|
} = getAssociatedVM(this);
|
|
2493
2589
|
return getAttribute(elm, name, namespace);
|
|
2494
2590
|
},
|
|
@@ -2496,10 +2592,7 @@ LightningElement.prototype = {
|
|
|
2496
2592
|
setAttribute(name, value) {
|
|
2497
2593
|
const vm = getAssociatedVM(this);
|
|
2498
2594
|
const {
|
|
2499
|
-
elm
|
|
2500
|
-
renderer: {
|
|
2501
|
-
setAttribute
|
|
2502
|
-
}
|
|
2595
|
+
elm
|
|
2503
2596
|
} = vm;
|
|
2504
2597
|
|
|
2505
2598
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2514,10 +2607,7 @@ LightningElement.prototype = {
|
|
|
2514
2607
|
setAttributeNS(namespace, name, value) {
|
|
2515
2608
|
const vm = getAssociatedVM(this);
|
|
2516
2609
|
const {
|
|
2517
|
-
elm
|
|
2518
|
-
renderer: {
|
|
2519
|
-
setAttribute
|
|
2520
|
-
}
|
|
2610
|
+
elm
|
|
2521
2611
|
} = vm;
|
|
2522
2612
|
|
|
2523
2613
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2532,10 +2622,7 @@ LightningElement.prototype = {
|
|
|
2532
2622
|
getBoundingClientRect() {
|
|
2533
2623
|
const vm = getAssociatedVM(this);
|
|
2534
2624
|
const {
|
|
2535
|
-
elm
|
|
2536
|
-
renderer: {
|
|
2537
|
-
getBoundingClientRect
|
|
2538
|
-
}
|
|
2625
|
+
elm
|
|
2539
2626
|
} = vm;
|
|
2540
2627
|
|
|
2541
2628
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2547,10 +2634,7 @@ LightningElement.prototype = {
|
|
|
2547
2634
|
|
|
2548
2635
|
get isConnected() {
|
|
2549
2636
|
const {
|
|
2550
|
-
elm
|
|
2551
|
-
renderer: {
|
|
2552
|
-
isConnected
|
|
2553
|
-
}
|
|
2637
|
+
elm
|
|
2554
2638
|
} = getAssociatedVM(this);
|
|
2555
2639
|
return isConnected(elm);
|
|
2556
2640
|
},
|
|
@@ -2558,10 +2642,7 @@ LightningElement.prototype = {
|
|
|
2558
2642
|
get classList() {
|
|
2559
2643
|
const vm = getAssociatedVM(this);
|
|
2560
2644
|
const {
|
|
2561
|
-
elm
|
|
2562
|
-
renderer: {
|
|
2563
|
-
getClassList
|
|
2564
|
-
}
|
|
2645
|
+
elm
|
|
2565
2646
|
} = vm;
|
|
2566
2647
|
|
|
2567
2648
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2604,23 +2685,48 @@ LightningElement.prototype = {
|
|
|
2604
2685
|
}
|
|
2605
2686
|
|
|
2606
2687
|
};
|
|
2607
|
-
const queryAndChildGetterDescriptors = shared.create(null);
|
|
2608
|
-
|
|
2688
|
+
const queryAndChildGetterDescriptors = shared.create(null); // The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
2689
|
+
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
2690
|
+
// object representing the renderer, with a lot of methods we don't actually need.
|
|
2691
|
+
|
|
2692
|
+
const childGetters = ['children', 'childNodes', 'firstChild', 'firstElementChild', 'lastChild', 'lastElementChild'];
|
|
2693
|
+
|
|
2694
|
+
function getChildGetter(methodName) {
|
|
2695
|
+
switch (methodName) {
|
|
2696
|
+
case 'children':
|
|
2697
|
+
return getChildren;
|
|
2698
|
+
|
|
2699
|
+
case 'childNodes':
|
|
2700
|
+
return getChildNodes;
|
|
2701
|
+
|
|
2702
|
+
case 'firstChild':
|
|
2703
|
+
return getFirstChild;
|
|
2609
2704
|
|
|
2610
|
-
|
|
2611
|
-
|
|
2705
|
+
case 'firstElementChild':
|
|
2706
|
+
return getFirstElementChild;
|
|
2707
|
+
|
|
2708
|
+
case 'lastChild':
|
|
2709
|
+
return getLastChild;
|
|
2710
|
+
|
|
2711
|
+
case 'lastElementChild':
|
|
2712
|
+
return getLastElementChild;
|
|
2713
|
+
}
|
|
2714
|
+
} // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2715
|
+
|
|
2716
|
+
|
|
2717
|
+
for (const childGetter of childGetters) {
|
|
2718
|
+
queryAndChildGetterDescriptors[childGetter] = {
|
|
2612
2719
|
get() {
|
|
2613
2720
|
const vm = getAssociatedVM(this);
|
|
2614
2721
|
const {
|
|
2615
|
-
elm
|
|
2616
|
-
renderer
|
|
2722
|
+
elm
|
|
2617
2723
|
} = vm;
|
|
2618
2724
|
|
|
2619
2725
|
if (process.env.NODE_ENV !== 'production') {
|
|
2620
|
-
warnIfInvokedDuringConstruction(vm,
|
|
2726
|
+
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
2621
2727
|
}
|
|
2622
2728
|
|
|
2623
|
-
return
|
|
2729
|
+
return getChildGetter(childGetter)(elm);
|
|
2624
2730
|
},
|
|
2625
2731
|
|
|
2626
2732
|
configurable: true,
|
|
@@ -2628,22 +2734,38 @@ for (const [elementProp, rendererMethod] of childGetters) {
|
|
|
2628
2734
|
};
|
|
2629
2735
|
}
|
|
2630
2736
|
|
|
2631
|
-
const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
2737
|
+
const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
2738
|
+
|
|
2739
|
+
function getQueryMethod(methodName) {
|
|
2740
|
+
switch (methodName) {
|
|
2741
|
+
case 'getElementsByClassName':
|
|
2742
|
+
return getElementsByClassName;
|
|
2743
|
+
|
|
2744
|
+
case 'getElementsByTagName':
|
|
2745
|
+
return getElementsByTagName;
|
|
2746
|
+
|
|
2747
|
+
case 'querySelector':
|
|
2748
|
+
return querySelector;
|
|
2749
|
+
|
|
2750
|
+
case 'querySelectorAll':
|
|
2751
|
+
return querySelectorAll;
|
|
2752
|
+
}
|
|
2753
|
+
} // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2754
|
+
|
|
2632
2755
|
|
|
2633
2756
|
for (const queryMethod of queryMethods) {
|
|
2634
2757
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2635
2758
|
value(arg) {
|
|
2636
2759
|
const vm = getAssociatedVM(this);
|
|
2637
2760
|
const {
|
|
2638
|
-
elm
|
|
2639
|
-
renderer
|
|
2761
|
+
elm
|
|
2640
2762
|
} = vm;
|
|
2641
2763
|
|
|
2642
2764
|
if (process.env.NODE_ENV !== 'production') {
|
|
2643
2765
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2644
2766
|
}
|
|
2645
2767
|
|
|
2646
|
-
return
|
|
2768
|
+
return getQueryMethod(queryMethod)(elm, arg);
|
|
2647
2769
|
},
|
|
2648
2770
|
|
|
2649
2771
|
configurable: true,
|
|
@@ -4014,17 +4136,14 @@ function setScopeTokenClassIfNecessary(elm, owner) {
|
|
|
4014
4136
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4015
4137
|
|
|
4016
4138
|
if (!shared.isUndefined(token) && context.hasScopedStyles) {
|
|
4017
|
-
|
|
4139
|
+
getClassList(elm).add(token);
|
|
4018
4140
|
}
|
|
4019
4141
|
}
|
|
4020
4142
|
|
|
4021
4143
|
function updateNodeHook(oldVnode, vnode) {
|
|
4022
4144
|
const {
|
|
4023
4145
|
elm,
|
|
4024
|
-
text
|
|
4025
|
-
owner: {
|
|
4026
|
-
renderer
|
|
4027
|
-
}
|
|
4146
|
+
text
|
|
4028
4147
|
} = vnode;
|
|
4029
4148
|
|
|
4030
4149
|
if (oldVnode.text !== text) {
|
|
@@ -4032,7 +4151,7 @@ function updateNodeHook(oldVnode, vnode) {
|
|
|
4032
4151
|
unlockDomMutation();
|
|
4033
4152
|
}
|
|
4034
4153
|
|
|
4035
|
-
|
|
4154
|
+
setText(elm, text);
|
|
4036
4155
|
|
|
4037
4156
|
if (process.env.NODE_ENV !== 'production') {
|
|
4038
4157
|
lockDomMutation();
|
|
@@ -4040,30 +4159,22 @@ function updateNodeHook(oldVnode, vnode) {
|
|
|
4040
4159
|
}
|
|
4041
4160
|
}
|
|
4042
4161
|
function insertNodeHook(vnode, parentNode, referenceNode) {
|
|
4043
|
-
const {
|
|
4044
|
-
renderer
|
|
4045
|
-
} = vnode.owner;
|
|
4046
|
-
|
|
4047
4162
|
if (process.env.NODE_ENV !== 'production') {
|
|
4048
4163
|
unlockDomMutation();
|
|
4049
4164
|
}
|
|
4050
4165
|
|
|
4051
|
-
|
|
4166
|
+
insert(vnode.elm, parentNode, referenceNode);
|
|
4052
4167
|
|
|
4053
4168
|
if (process.env.NODE_ENV !== 'production') {
|
|
4054
4169
|
lockDomMutation();
|
|
4055
4170
|
}
|
|
4056
4171
|
}
|
|
4057
4172
|
function removeNodeHook(vnode, parentNode) {
|
|
4058
|
-
const {
|
|
4059
|
-
renderer
|
|
4060
|
-
} = vnode.owner;
|
|
4061
|
-
|
|
4062
4173
|
if (process.env.NODE_ENV !== 'production') {
|
|
4063
4174
|
unlockDomMutation();
|
|
4064
4175
|
}
|
|
4065
4176
|
|
|
4066
|
-
|
|
4177
|
+
remove(vnode.elm, parentNode);
|
|
4067
4178
|
|
|
4068
4179
|
if (process.env.NODE_ENV !== 'production') {
|
|
4069
4180
|
lockDomMutation();
|
|
@@ -4222,8 +4333,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
4222
4333
|
createVM(elm, def, {
|
|
4223
4334
|
mode,
|
|
4224
4335
|
owner,
|
|
4225
|
-
tagName: sel
|
|
4226
|
-
renderer: owner.renderer
|
|
4336
|
+
tagName: sel
|
|
4227
4337
|
});
|
|
4228
4338
|
|
|
4229
4339
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4267,16 +4377,13 @@ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
|
4267
4377
|
const {
|
|
4268
4378
|
data: {
|
|
4269
4379
|
attrs = {}
|
|
4270
|
-
},
|
|
4271
|
-
owner: {
|
|
4272
|
-
renderer
|
|
4273
4380
|
}
|
|
4274
4381
|
} = vnode;
|
|
4275
4382
|
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4276
4383
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4277
4384
|
|
|
4278
4385
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4279
|
-
const elmAttrValue =
|
|
4386
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
4280
4387
|
|
|
4281
4388
|
if (String(attrValue) !== elmAttrValue) {
|
|
4282
4389
|
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
@@ -4292,9 +4399,6 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
|
4292
4399
|
data: {
|
|
4293
4400
|
className,
|
|
4294
4401
|
classMap
|
|
4295
|
-
},
|
|
4296
|
-
owner: {
|
|
4297
|
-
renderer
|
|
4298
4402
|
}
|
|
4299
4403
|
} = vnode;
|
|
4300
4404
|
let nodesAreCompatible = true;
|
|
@@ -4306,7 +4410,7 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
|
4306
4410
|
vnodeClassName = className;
|
|
4307
4411
|
} else if (!shared.isUndefined(classMap)) {
|
|
4308
4412
|
// classMap is used when class is set to static value.
|
|
4309
|
-
const classList =
|
|
4413
|
+
const classList = getClassList(elm);
|
|
4310
4414
|
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4311
4415
|
|
|
4312
4416
|
for (const name in classMap) {
|
|
@@ -4336,12 +4440,9 @@ function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
|
4336
4440
|
data: {
|
|
4337
4441
|
style,
|
|
4338
4442
|
styleDecls
|
|
4339
|
-
},
|
|
4340
|
-
owner: {
|
|
4341
|
-
renderer
|
|
4342
4443
|
}
|
|
4343
4444
|
} = vnode;
|
|
4344
|
-
const elmStyle =
|
|
4445
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
4345
4446
|
let vnodeStyle;
|
|
4346
4447
|
let nodesAreCompatible = true;
|
|
4347
4448
|
|
|
@@ -4473,12 +4574,12 @@ function hasDynamicChildren(children) {
|
|
|
4473
4574
|
* SPDX-License-Identifier: MIT
|
|
4474
4575
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4475
4576
|
*/
|
|
4476
|
-
function getUpgradableConstructor(tagName
|
|
4577
|
+
function getUpgradableConstructor(tagName) {
|
|
4477
4578
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
4478
4579
|
// produce only tags with lowercase letters
|
|
4479
4580
|
// But, for backwards compatibility, we will lower case the tagName
|
|
4480
4581
|
tagName = tagName.toLowerCase();
|
|
4481
|
-
let CE =
|
|
4582
|
+
let CE = getCustomElement(tagName);
|
|
4482
4583
|
|
|
4483
4584
|
if (!shared.isUndefined(CE)) {
|
|
4484
4585
|
return CE;
|
|
@@ -4489,7 +4590,7 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4489
4590
|
*/
|
|
4490
4591
|
|
|
4491
4592
|
|
|
4492
|
-
CE = class LWCUpgradableElement extends
|
|
4593
|
+
CE = class LWCUpgradableElement extends HTMLElementExported {
|
|
4493
4594
|
constructor(upgradeCallback) {
|
|
4494
4595
|
super();
|
|
4495
4596
|
|
|
@@ -4499,7 +4600,7 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4499
4600
|
}
|
|
4500
4601
|
|
|
4501
4602
|
};
|
|
4502
|
-
|
|
4603
|
+
defineCustomElement(tagName, CE);
|
|
4503
4604
|
return CE;
|
|
4504
4605
|
}
|
|
4505
4606
|
|
|
@@ -4516,10 +4617,7 @@ const TextHook = {
|
|
|
4516
4617
|
const {
|
|
4517
4618
|
owner
|
|
4518
4619
|
} = vnode;
|
|
4519
|
-
const
|
|
4520
|
-
renderer
|
|
4521
|
-
} = owner;
|
|
4522
|
-
const elm = renderer.createText(vnode.text);
|
|
4620
|
+
const elm = createText(vnode.text);
|
|
4523
4621
|
linkNodeToShadow(elm, owner);
|
|
4524
4622
|
vnode.elm = elm;
|
|
4525
4623
|
},
|
|
@@ -4553,10 +4651,7 @@ const CommentHook = {
|
|
|
4553
4651
|
owner,
|
|
4554
4652
|
text
|
|
4555
4653
|
} = vnode;
|
|
4556
|
-
const
|
|
4557
|
-
renderer
|
|
4558
|
-
} = owner;
|
|
4559
|
-
const elm = renderer.createComment(text);
|
|
4654
|
+
const elm = createComment(text);
|
|
4560
4655
|
linkNodeToShadow(elm, owner);
|
|
4561
4656
|
vnode.elm = elm;
|
|
4562
4657
|
},
|
|
@@ -4598,11 +4693,8 @@ const ElementHook = {
|
|
|
4598
4693
|
svg
|
|
4599
4694
|
}
|
|
4600
4695
|
} = vnode;
|
|
4601
|
-
const {
|
|
4602
|
-
renderer
|
|
4603
|
-
} = owner;
|
|
4604
4696
|
const namespace = shared.isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4605
|
-
const elm =
|
|
4697
|
+
const elm = createElement(sel, namespace);
|
|
4606
4698
|
linkNodeToShadow(elm, owner);
|
|
4607
4699
|
fallbackElmHook(elm, vnode);
|
|
4608
4700
|
vnode.elm = elm;
|
|
@@ -4662,10 +4754,7 @@ const CustomElementHook = {
|
|
|
4662
4754
|
sel,
|
|
4663
4755
|
owner
|
|
4664
4756
|
} = vnode;
|
|
4665
|
-
const
|
|
4666
|
-
renderer
|
|
4667
|
-
} = owner;
|
|
4668
|
-
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
4757
|
+
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4669
4758
|
/**
|
|
4670
4759
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4671
4760
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -4758,8 +4847,7 @@ const CustomElementHook = {
|
|
|
4758
4847
|
createVM(elm, def, {
|
|
4759
4848
|
mode,
|
|
4760
4849
|
owner,
|
|
4761
|
-
tagName: sel
|
|
4762
|
-
renderer: owner.renderer
|
|
4850
|
+
tagName: sel
|
|
4763
4851
|
});
|
|
4764
4852
|
vnode.elm = elm;
|
|
4765
4853
|
const vm = getAssociatedVM(elm);
|
|
@@ -4788,12 +4876,11 @@ const CustomElementHook = {
|
|
|
4788
4876
|
|
|
4789
4877
|
function linkNodeToShadow(elm, owner) {
|
|
4790
4878
|
const {
|
|
4791
|
-
renderer,
|
|
4792
4879
|
renderMode,
|
|
4793
4880
|
shadowMode
|
|
4794
4881
|
} = owner; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4795
4882
|
|
|
4796
|
-
if (
|
|
4883
|
+
if (isSyntheticShadowDefined) {
|
|
4797
4884
|
if (shadowMode === 1
|
|
4798
4885
|
/* Synthetic */
|
|
4799
4886
|
|| renderMode === 0
|
|
@@ -5325,7 +5412,6 @@ function updateStylesheetToken(vm, template) {
|
|
|
5325
5412
|
const {
|
|
5326
5413
|
elm,
|
|
5327
5414
|
context,
|
|
5328
|
-
renderer,
|
|
5329
5415
|
renderMode,
|
|
5330
5416
|
shadowMode
|
|
5331
5417
|
} = vm;
|
|
@@ -5352,11 +5438,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
5352
5438
|
} = context;
|
|
5353
5439
|
|
|
5354
5440
|
if (oldHasTokenInClass) {
|
|
5355
|
-
|
|
5441
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
5356
5442
|
}
|
|
5357
5443
|
|
|
5358
5444
|
if (oldHasTokenInAttribute) {
|
|
5359
|
-
|
|
5445
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
5360
5446
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5361
5447
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5362
5448
|
|
|
@@ -5368,12 +5454,12 @@ function updateStylesheetToken(vm, template) {
|
|
|
5368
5454
|
|
|
5369
5455
|
if (!shared.isUndefined(newToken)) {
|
|
5370
5456
|
if (hasScopedStyles) {
|
|
5371
|
-
|
|
5457
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
5372
5458
|
newHasTokenInClass = true;
|
|
5373
5459
|
}
|
|
5374
5460
|
|
|
5375
5461
|
if (isSyntheticShadow) {
|
|
5376
|
-
|
|
5462
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
5377
5463
|
newHasTokenInAttribute = true;
|
|
5378
5464
|
}
|
|
5379
5465
|
} // Update the styling tokens present on the context object.
|
|
@@ -5493,7 +5579,6 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
5493
5579
|
|
|
5494
5580
|
function createStylesheet(vm, stylesheets) {
|
|
5495
5581
|
const {
|
|
5496
|
-
renderer,
|
|
5497
5582
|
renderMode,
|
|
5498
5583
|
shadowMode
|
|
5499
5584
|
} = vm;
|
|
@@ -5504,9 +5589,9 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5504
5589
|
/* Synthetic */
|
|
5505
5590
|
) {
|
|
5506
5591
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5507
|
-
|
|
5592
|
+
insertGlobalStylesheet(stylesheets[i]);
|
|
5508
5593
|
}
|
|
5509
|
-
} else if (
|
|
5594
|
+
} else if (ssr || isHydrating()) {
|
|
5510
5595
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5511
5596
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5512
5597
|
// the first time the VM renders.
|
|
@@ -5520,10 +5605,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5520
5605
|
|
|
5521
5606
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5522
5607
|
if (isGlobal) {
|
|
5523
|
-
|
|
5608
|
+
insertGlobalStylesheet(stylesheets[i]);
|
|
5524
5609
|
} else {
|
|
5525
5610
|
// local level
|
|
5526
|
-
|
|
5611
|
+
insertStylesheet(stylesheets[i], root.cmpRoot);
|
|
5527
5612
|
}
|
|
5528
5613
|
}
|
|
5529
5614
|
}
|
|
@@ -6184,7 +6269,6 @@ function createVM(elm, def, options) {
|
|
|
6184
6269
|
const {
|
|
6185
6270
|
mode,
|
|
6186
6271
|
owner,
|
|
6187
|
-
renderer,
|
|
6188
6272
|
tagName
|
|
6189
6273
|
} = options;
|
|
6190
6274
|
const vm = {
|
|
@@ -6199,7 +6283,6 @@ function createVM(elm, def, options) {
|
|
|
6199
6283
|
tagName,
|
|
6200
6284
|
mode,
|
|
6201
6285
|
owner,
|
|
6202
|
-
renderer,
|
|
6203
6286
|
children: EmptyArray,
|
|
6204
6287
|
aChildren: EmptyArray,
|
|
6205
6288
|
velements: EmptyArray,
|
|
@@ -6254,13 +6337,8 @@ function createVM(elm, def, options) {
|
|
|
6254
6337
|
|
|
6255
6338
|
function computeShadowMode(vm) {
|
|
6256
6339
|
const {
|
|
6257
|
-
def
|
|
6258
|
-
renderer
|
|
6340
|
+
def
|
|
6259
6341
|
} = vm;
|
|
6260
|
-
const {
|
|
6261
|
-
isNativeShadowDefined,
|
|
6262
|
-
isSyntheticShadowDefined
|
|
6263
|
-
} = renderer;
|
|
6264
6342
|
let shadowMode;
|
|
6265
6343
|
|
|
6266
6344
|
if (isSyntheticShadowDefined) {
|
|
@@ -6410,13 +6488,12 @@ function patchShadowRoot(vm, newCh) {
|
|
|
6410
6488
|
|
|
6411
6489
|
function runRenderedCallback(vm) {
|
|
6412
6490
|
const {
|
|
6413
|
-
renderer,
|
|
6414
6491
|
def: {
|
|
6415
6492
|
renderedCallback
|
|
6416
6493
|
}
|
|
6417
6494
|
} = vm;
|
|
6418
6495
|
|
|
6419
|
-
if (shared.isTrue(
|
|
6496
|
+
if (shared.isTrue(ssr)) {
|
|
6420
6497
|
return;
|
|
6421
6498
|
}
|
|
6422
6499
|
|
|
@@ -6642,8 +6719,7 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
6642
6719
|
|
|
6643
6720
|
function resetComponentRoot(vm) {
|
|
6644
6721
|
const {
|
|
6645
|
-
children
|
|
6646
|
-
renderer
|
|
6722
|
+
children
|
|
6647
6723
|
} = vm;
|
|
6648
6724
|
const rootNode = getRenderRoot(vm);
|
|
6649
6725
|
|
|
@@ -6651,7 +6727,7 @@ function resetComponentRoot(vm) {
|
|
|
6651
6727
|
const child = children[i];
|
|
6652
6728
|
|
|
6653
6729
|
if (!shared.isNull(child) && !shared.isUndefined(child.elm)) {
|
|
6654
|
-
|
|
6730
|
+
remove(child.elm, rootNode);
|
|
6655
6731
|
}
|
|
6656
6732
|
}
|
|
6657
6733
|
|
|
@@ -6660,7 +6736,7 @@ function resetComponentRoot(vm) {
|
|
|
6660
6736
|
vm.velements = EmptyArray;
|
|
6661
6737
|
}
|
|
6662
6738
|
function scheduleRehydration(vm) {
|
|
6663
|
-
if (shared.isTrue(
|
|
6739
|
+
if (shared.isTrue(ssr) || shared.isTrue(vm.isScheduled)) {
|
|
6664
6740
|
return;
|
|
6665
6741
|
}
|
|
6666
6742
|
|
|
@@ -6900,7 +6976,6 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
6900
6976
|
|
|
6901
6977
|
const {
|
|
6902
6978
|
elm,
|
|
6903
|
-
renderer,
|
|
6904
6979
|
context: {
|
|
6905
6980
|
wiredConnecting,
|
|
6906
6981
|
wiredDisconnecting
|
|
@@ -6927,7 +7002,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
6927
7002
|
}
|
|
6928
7003
|
|
|
6929
7004
|
});
|
|
6930
|
-
|
|
7005
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
6931
7006
|
});
|
|
6932
7007
|
}
|
|
6933
7008
|
|
|
@@ -7210,11 +7285,51 @@ exports.registerComponent = registerComponent;
|
|
|
7210
7285
|
exports.registerDecorators = registerDecorators;
|
|
7211
7286
|
exports.registerTemplate = registerTemplate;
|
|
7212
7287
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
7288
|
+
exports.setAddEventListener = setAddEventListener;
|
|
7289
|
+
exports.setAssertInstanceOfHTMLElement = setAssertInstanceOfHTMLElement;
|
|
7290
|
+
exports.setAttachShadow = setAttachShadow;
|
|
7291
|
+
exports.setCreateComment = setCreateComment;
|
|
7292
|
+
exports.setCreateElement = setCreateElement;
|
|
7293
|
+
exports.setCreateText = setCreateText;
|
|
7294
|
+
exports.setDefineCustomElement = setDefineCustomElement;
|
|
7295
|
+
exports.setDispatchEvent = setDispatchEvent;
|
|
7296
|
+
exports.setGetAttribute = setGetAttribute;
|
|
7297
|
+
exports.setGetBoundingClientRect = setGetBoundingClientRect;
|
|
7298
|
+
exports.setGetChildNodes = setGetChildNodes;
|
|
7299
|
+
exports.setGetChildren = setGetChildren;
|
|
7300
|
+
exports.setGetClassList = setGetClassList;
|
|
7301
|
+
exports.setGetCustomElement = setGetCustomElement;
|
|
7302
|
+
exports.setGetElementsByClassName = setGetElementsByClassName;
|
|
7303
|
+
exports.setGetElementsByTagName = setGetElementsByTagName;
|
|
7304
|
+
exports.setGetFirstChild = setGetFirstChild;
|
|
7305
|
+
exports.setGetFirstElementChild = setGetFirstElementChild;
|
|
7306
|
+
exports.setGetLastChild = setGetLastChild;
|
|
7307
|
+
exports.setGetLastElementChild = setGetLastElementChild;
|
|
7308
|
+
exports.setGetProperty = setGetProperty;
|
|
7309
|
+
exports.setHTMLElement = setHTMLElement;
|
|
7213
7310
|
exports.setHooks = setHooks;
|
|
7311
|
+
exports.setInsert = setInsert;
|
|
7312
|
+
exports.setInsertGlobalStylesheet = setInsertGlobalStylesheet;
|
|
7313
|
+
exports.setInsertStylesheet = setInsertStylesheet;
|
|
7314
|
+
exports.setIsConnected = setIsConnected;
|
|
7315
|
+
exports.setIsHydrating = setIsHydrating;
|
|
7316
|
+
exports.setIsNativeShadowDefined = setIsNativeShadowDefined;
|
|
7317
|
+
exports.setIsSyntheticShadowDefined = setIsSyntheticShadowDefined;
|
|
7318
|
+
exports.setNextSibling = setNextSibling;
|
|
7319
|
+
exports.setQuerySelector = setQuerySelector;
|
|
7320
|
+
exports.setQuerySelectorAll = setQuerySelectorAll;
|
|
7321
|
+
exports.setRemove = setRemove;
|
|
7322
|
+
exports.setRemoveAttribute = setRemoveAttribute;
|
|
7323
|
+
exports.setRemoveEventListener = setRemoveEventListener;
|
|
7324
|
+
exports.setSetAttribute = setSetAttribute;
|
|
7325
|
+
exports.setSetCSSStyleProperty = setSetCSSStyleProperty;
|
|
7326
|
+
exports.setSetProperty = setSetProperty;
|
|
7327
|
+
exports.setSetText = setSetText;
|
|
7328
|
+
exports.setSsr = setSsr;
|
|
7214
7329
|
exports.swapComponent = swapComponent;
|
|
7215
7330
|
exports.swapStyle = swapStyle;
|
|
7216
7331
|
exports.swapTemplate = swapTemplate;
|
|
7217
7332
|
exports.track = track;
|
|
7218
7333
|
exports.unwrap = unwrap;
|
|
7219
7334
|
exports.wire = wire;
|
|
7220
|
-
/* version: 2.7.
|
|
7335
|
+
/* version: 2.7.2 */
|