@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.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,
|
|
@@ -3773,10 +3895,6 @@ function createComponentDef(Ctor) {
|
|
|
3773
3895
|
|
|
3774
3896
|
shared.assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
|
|
3775
3897
|
|
|
3776
|
-
if (!features.runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
3777
|
-
shared.assert.isFalse('shadowSupportMode' in Ctor, `${ctorName || 'Anonymous class'} is an invalid LWC component. The shadowSupportMode static property is not available in this environment.`);
|
|
3778
|
-
}
|
|
3779
|
-
|
|
3780
3898
|
if (!shared.isUndefined(ctorShadowSupportMode)) {
|
|
3781
3899
|
shared.assert.invariant(ctorShadowSupportMode === "any"
|
|
3782
3900
|
/* Any */
|
|
@@ -4018,17 +4136,14 @@ function setScopeTokenClassIfNecessary(elm, owner) {
|
|
|
4018
4136
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4019
4137
|
|
|
4020
4138
|
if (!shared.isUndefined(token) && context.hasScopedStyles) {
|
|
4021
|
-
|
|
4139
|
+
getClassList(elm).add(token);
|
|
4022
4140
|
}
|
|
4023
4141
|
}
|
|
4024
4142
|
|
|
4025
4143
|
function updateNodeHook(oldVnode, vnode) {
|
|
4026
4144
|
const {
|
|
4027
4145
|
elm,
|
|
4028
|
-
text
|
|
4029
|
-
owner: {
|
|
4030
|
-
renderer
|
|
4031
|
-
}
|
|
4146
|
+
text
|
|
4032
4147
|
} = vnode;
|
|
4033
4148
|
|
|
4034
4149
|
if (oldVnode.text !== text) {
|
|
@@ -4036,7 +4151,7 @@ function updateNodeHook(oldVnode, vnode) {
|
|
|
4036
4151
|
unlockDomMutation();
|
|
4037
4152
|
}
|
|
4038
4153
|
|
|
4039
|
-
|
|
4154
|
+
setText(elm, text);
|
|
4040
4155
|
|
|
4041
4156
|
if (process.env.NODE_ENV !== 'production') {
|
|
4042
4157
|
lockDomMutation();
|
|
@@ -4044,30 +4159,22 @@ function updateNodeHook(oldVnode, vnode) {
|
|
|
4044
4159
|
}
|
|
4045
4160
|
}
|
|
4046
4161
|
function insertNodeHook(vnode, parentNode, referenceNode) {
|
|
4047
|
-
const {
|
|
4048
|
-
renderer
|
|
4049
|
-
} = vnode.owner;
|
|
4050
|
-
|
|
4051
4162
|
if (process.env.NODE_ENV !== 'production') {
|
|
4052
4163
|
unlockDomMutation();
|
|
4053
4164
|
}
|
|
4054
4165
|
|
|
4055
|
-
|
|
4166
|
+
insert(vnode.elm, parentNode, referenceNode);
|
|
4056
4167
|
|
|
4057
4168
|
if (process.env.NODE_ENV !== 'production') {
|
|
4058
4169
|
lockDomMutation();
|
|
4059
4170
|
}
|
|
4060
4171
|
}
|
|
4061
4172
|
function removeNodeHook(vnode, parentNode) {
|
|
4062
|
-
const {
|
|
4063
|
-
renderer
|
|
4064
|
-
} = vnode.owner;
|
|
4065
|
-
|
|
4066
4173
|
if (process.env.NODE_ENV !== 'production') {
|
|
4067
4174
|
unlockDomMutation();
|
|
4068
4175
|
}
|
|
4069
4176
|
|
|
4070
|
-
|
|
4177
|
+
remove(vnode.elm, parentNode);
|
|
4071
4178
|
|
|
4072
4179
|
if (process.env.NODE_ENV !== 'production') {
|
|
4073
4180
|
lockDomMutation();
|
|
@@ -4154,13 +4261,15 @@ function updateElmHook(oldVnode, vnode) {
|
|
|
4154
4261
|
}
|
|
4155
4262
|
function updateChildrenHook(oldVnode, vnode) {
|
|
4156
4263
|
const {
|
|
4157
|
-
|
|
4158
|
-
|
|
4264
|
+
elm,
|
|
4265
|
+
children
|
|
4159
4266
|
} = vnode;
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
}
|
|
4267
|
+
|
|
4268
|
+
if (hasDynamicChildren(children)) {
|
|
4269
|
+
updateDynamicChildren(elm, oldVnode.children, children);
|
|
4270
|
+
} else {
|
|
4271
|
+
updateStaticChildren(elm, oldVnode.children, children);
|
|
4272
|
+
}
|
|
4164
4273
|
}
|
|
4165
4274
|
function allocateChildrenHook(vnode, vm) {
|
|
4166
4275
|
// A component with slots will re-render because:
|
|
@@ -4224,8 +4333,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
4224
4333
|
createVM(elm, def, {
|
|
4225
4334
|
mode,
|
|
4226
4335
|
owner,
|
|
4227
|
-
tagName: sel
|
|
4228
|
-
renderer: owner.renderer
|
|
4336
|
+
tagName: sel
|
|
4229
4337
|
});
|
|
4230
4338
|
|
|
4231
4339
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4269,16 +4377,13 @@ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
|
4269
4377
|
const {
|
|
4270
4378
|
data: {
|
|
4271
4379
|
attrs = {}
|
|
4272
|
-
},
|
|
4273
|
-
owner: {
|
|
4274
|
-
renderer
|
|
4275
4380
|
}
|
|
4276
4381
|
} = vnode;
|
|
4277
4382
|
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4278
4383
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4279
4384
|
|
|
4280
4385
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4281
|
-
const elmAttrValue =
|
|
4386
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
4282
4387
|
|
|
4283
4388
|
if (String(attrValue) !== elmAttrValue) {
|
|
4284
4389
|
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
@@ -4294,9 +4399,6 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
|
4294
4399
|
data: {
|
|
4295
4400
|
className,
|
|
4296
4401
|
classMap
|
|
4297
|
-
},
|
|
4298
|
-
owner: {
|
|
4299
|
-
renderer
|
|
4300
4402
|
}
|
|
4301
4403
|
} = vnode;
|
|
4302
4404
|
let nodesAreCompatible = true;
|
|
@@ -4308,7 +4410,7 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
|
4308
4410
|
vnodeClassName = className;
|
|
4309
4411
|
} else if (!shared.isUndefined(classMap)) {
|
|
4310
4412
|
// classMap is used when class is set to static value.
|
|
4311
|
-
const classList =
|
|
4413
|
+
const classList = getClassList(elm);
|
|
4312
4414
|
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4313
4415
|
|
|
4314
4416
|
for (const name in classMap) {
|
|
@@ -4338,12 +4440,9 @@ function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
|
4338
4440
|
data: {
|
|
4339
4441
|
style,
|
|
4340
4442
|
styleDecls
|
|
4341
|
-
},
|
|
4342
|
-
owner: {
|
|
4343
|
-
renderer
|
|
4344
4443
|
}
|
|
4345
4444
|
} = vnode;
|
|
4346
|
-
const elmStyle =
|
|
4445
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
4347
4446
|
let vnodeStyle;
|
|
4348
4447
|
let nodesAreCompatible = true;
|
|
4349
4448
|
|
|
@@ -4475,12 +4574,12 @@ function hasDynamicChildren(children) {
|
|
|
4475
4574
|
* SPDX-License-Identifier: MIT
|
|
4476
4575
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4477
4576
|
*/
|
|
4478
|
-
function getUpgradableConstructor(tagName
|
|
4577
|
+
function getUpgradableConstructor(tagName) {
|
|
4479
4578
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
4480
4579
|
// produce only tags with lowercase letters
|
|
4481
4580
|
// But, for backwards compatibility, we will lower case the tagName
|
|
4482
4581
|
tagName = tagName.toLowerCase();
|
|
4483
|
-
let CE =
|
|
4582
|
+
let CE = getCustomElement(tagName);
|
|
4484
4583
|
|
|
4485
4584
|
if (!shared.isUndefined(CE)) {
|
|
4486
4585
|
return CE;
|
|
@@ -4491,7 +4590,7 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4491
4590
|
*/
|
|
4492
4591
|
|
|
4493
4592
|
|
|
4494
|
-
CE = class LWCUpgradableElement extends
|
|
4593
|
+
CE = class LWCUpgradableElement extends HTMLElementExported {
|
|
4495
4594
|
constructor(upgradeCallback) {
|
|
4496
4595
|
super();
|
|
4497
4596
|
|
|
@@ -4501,7 +4600,7 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4501
4600
|
}
|
|
4502
4601
|
|
|
4503
4602
|
};
|
|
4504
|
-
|
|
4603
|
+
defineCustomElement(tagName, CE);
|
|
4505
4604
|
return CE;
|
|
4506
4605
|
}
|
|
4507
4606
|
|
|
@@ -4518,10 +4617,7 @@ const TextHook = {
|
|
|
4518
4617
|
const {
|
|
4519
4618
|
owner
|
|
4520
4619
|
} = vnode;
|
|
4521
|
-
const
|
|
4522
|
-
renderer
|
|
4523
|
-
} = owner;
|
|
4524
|
-
const elm = renderer.createText(vnode.text);
|
|
4620
|
+
const elm = createText(vnode.text);
|
|
4525
4621
|
linkNodeToShadow(elm, owner);
|
|
4526
4622
|
vnode.elm = elm;
|
|
4527
4623
|
},
|
|
@@ -4555,10 +4651,7 @@ const CommentHook = {
|
|
|
4555
4651
|
owner,
|
|
4556
4652
|
text
|
|
4557
4653
|
} = vnode;
|
|
4558
|
-
const
|
|
4559
|
-
renderer
|
|
4560
|
-
} = owner;
|
|
4561
|
-
const elm = renderer.createComment(text);
|
|
4654
|
+
const elm = createComment(text);
|
|
4562
4655
|
linkNodeToShadow(elm, owner);
|
|
4563
4656
|
vnode.elm = elm;
|
|
4564
4657
|
},
|
|
@@ -4600,11 +4693,8 @@ const ElementHook = {
|
|
|
4600
4693
|
svg
|
|
4601
4694
|
}
|
|
4602
4695
|
} = vnode;
|
|
4603
|
-
const {
|
|
4604
|
-
renderer
|
|
4605
|
-
} = owner;
|
|
4606
4696
|
const namespace = shared.isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4607
|
-
const elm =
|
|
4697
|
+
const elm = createElement(sel, namespace);
|
|
4608
4698
|
linkNodeToShadow(elm, owner);
|
|
4609
4699
|
fallbackElmHook(elm, vnode);
|
|
4610
4700
|
vnode.elm = elm;
|
|
@@ -4664,10 +4754,7 @@ const CustomElementHook = {
|
|
|
4664
4754
|
sel,
|
|
4665
4755
|
owner
|
|
4666
4756
|
} = vnode;
|
|
4667
|
-
const
|
|
4668
|
-
renderer
|
|
4669
|
-
} = owner;
|
|
4670
|
-
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
4757
|
+
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4671
4758
|
/**
|
|
4672
4759
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4673
4760
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -4760,8 +4847,7 @@ const CustomElementHook = {
|
|
|
4760
4847
|
createVM(elm, def, {
|
|
4761
4848
|
mode,
|
|
4762
4849
|
owner,
|
|
4763
|
-
tagName: sel
|
|
4764
|
-
renderer: owner.renderer
|
|
4850
|
+
tagName: sel
|
|
4765
4851
|
});
|
|
4766
4852
|
vnode.elm = elm;
|
|
4767
4853
|
const vm = getAssociatedVM(elm);
|
|
@@ -4790,12 +4876,11 @@ const CustomElementHook = {
|
|
|
4790
4876
|
|
|
4791
4877
|
function linkNodeToShadow(elm, owner) {
|
|
4792
4878
|
const {
|
|
4793
|
-
renderer,
|
|
4794
4879
|
renderMode,
|
|
4795
4880
|
shadowMode
|
|
4796
4881
|
} = owner; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4797
4882
|
|
|
4798
|
-
if (
|
|
4883
|
+
if (isSyntheticShadowDefined) {
|
|
4799
4884
|
if (shadowMode === 1
|
|
4800
4885
|
/* Synthetic */
|
|
4801
4886
|
|| renderMode === 0
|
|
@@ -5327,7 +5412,6 @@ function updateStylesheetToken(vm, template) {
|
|
|
5327
5412
|
const {
|
|
5328
5413
|
elm,
|
|
5329
5414
|
context,
|
|
5330
|
-
renderer,
|
|
5331
5415
|
renderMode,
|
|
5332
5416
|
shadowMode
|
|
5333
5417
|
} = vm;
|
|
@@ -5354,11 +5438,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
5354
5438
|
} = context;
|
|
5355
5439
|
|
|
5356
5440
|
if (oldHasTokenInClass) {
|
|
5357
|
-
|
|
5441
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
5358
5442
|
}
|
|
5359
5443
|
|
|
5360
5444
|
if (oldHasTokenInAttribute) {
|
|
5361
|
-
|
|
5445
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
5362
5446
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5363
5447
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5364
5448
|
|
|
@@ -5370,12 +5454,12 @@ function updateStylesheetToken(vm, template) {
|
|
|
5370
5454
|
|
|
5371
5455
|
if (!shared.isUndefined(newToken)) {
|
|
5372
5456
|
if (hasScopedStyles) {
|
|
5373
|
-
|
|
5457
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
5374
5458
|
newHasTokenInClass = true;
|
|
5375
5459
|
}
|
|
5376
5460
|
|
|
5377
5461
|
if (isSyntheticShadow) {
|
|
5378
|
-
|
|
5462
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
5379
5463
|
newHasTokenInAttribute = true;
|
|
5380
5464
|
}
|
|
5381
5465
|
} // Update the styling tokens present on the context object.
|
|
@@ -5495,7 +5579,6 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
5495
5579
|
|
|
5496
5580
|
function createStylesheet(vm, stylesheets) {
|
|
5497
5581
|
const {
|
|
5498
|
-
renderer,
|
|
5499
5582
|
renderMode,
|
|
5500
5583
|
shadowMode
|
|
5501
5584
|
} = vm;
|
|
@@ -5506,9 +5589,9 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5506
5589
|
/* Synthetic */
|
|
5507
5590
|
) {
|
|
5508
5591
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5509
|
-
|
|
5592
|
+
insertGlobalStylesheet(stylesheets[i]);
|
|
5510
5593
|
}
|
|
5511
|
-
} else if (
|
|
5594
|
+
} else if (ssr || isHydrating()) {
|
|
5512
5595
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5513
5596
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5514
5597
|
// the first time the VM renders.
|
|
@@ -5522,10 +5605,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5522
5605
|
|
|
5523
5606
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5524
5607
|
if (isGlobal) {
|
|
5525
|
-
|
|
5608
|
+
insertGlobalStylesheet(stylesheets[i]);
|
|
5526
5609
|
} else {
|
|
5527
5610
|
// local level
|
|
5528
|
-
|
|
5611
|
+
insertStylesheet(stylesheets[i], root.cmpRoot);
|
|
5529
5612
|
}
|
|
5530
5613
|
}
|
|
5531
5614
|
}
|
|
@@ -5608,7 +5691,7 @@ function logOperationStart(opId, vm) {
|
|
|
5608
5691
|
if (isProfilerEnabled) {
|
|
5609
5692
|
currentDispatcher(opId, 0
|
|
5610
5693
|
/* Start */
|
|
5611
|
-
, vm.tagName, vm.idx);
|
|
5694
|
+
, vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
|
|
5612
5695
|
}
|
|
5613
5696
|
}
|
|
5614
5697
|
function logOperationEnd(opId, vm) {
|
|
@@ -5621,7 +5704,7 @@ function logOperationEnd(opId, vm) {
|
|
|
5621
5704
|
if (isProfilerEnabled) {
|
|
5622
5705
|
currentDispatcher(opId, 1
|
|
5623
5706
|
/* Stop */
|
|
5624
|
-
, vm.tagName, vm.idx);
|
|
5707
|
+
, vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);
|
|
5625
5708
|
}
|
|
5626
5709
|
}
|
|
5627
5710
|
function logGlobalOperationStart(opId, vm) {
|
|
@@ -5634,7 +5717,7 @@ function logGlobalOperationStart(opId, vm) {
|
|
|
5634
5717
|
if (isProfilerEnabled) {
|
|
5635
5718
|
currentDispatcher(opId, 0
|
|
5636
5719
|
/* Start */
|
|
5637
|
-
, vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
|
|
5720
|
+
, 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);
|
|
5638
5721
|
}
|
|
5639
5722
|
}
|
|
5640
5723
|
function logGlobalOperationEnd(opId, vm) {
|
|
@@ -5647,7 +5730,7 @@ function logGlobalOperationEnd(opId, vm) {
|
|
|
5647
5730
|
if (isProfilerEnabled) {
|
|
5648
5731
|
currentDispatcher(opId, 1
|
|
5649
5732
|
/* Stop */
|
|
5650
|
-
, vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx);
|
|
5733
|
+
, 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);
|
|
5651
5734
|
}
|
|
5652
5735
|
}
|
|
5653
5736
|
|
|
@@ -5800,6 +5883,7 @@ function evaluateTemplate(vm, html) {
|
|
|
5800
5883
|
|
|
5801
5884
|
return vnodes;
|
|
5802
5885
|
}
|
|
5886
|
+
|
|
5803
5887
|
function computeHasScopedStyles(template) {
|
|
5804
5888
|
const {
|
|
5805
5889
|
stylesheets
|
|
@@ -6185,7 +6269,6 @@ function createVM(elm, def, options) {
|
|
|
6185
6269
|
const {
|
|
6186
6270
|
mode,
|
|
6187
6271
|
owner,
|
|
6188
|
-
renderer,
|
|
6189
6272
|
tagName
|
|
6190
6273
|
} = options;
|
|
6191
6274
|
const vm = {
|
|
@@ -6200,7 +6283,6 @@ function createVM(elm, def, options) {
|
|
|
6200
6283
|
tagName,
|
|
6201
6284
|
mode,
|
|
6202
6285
|
owner,
|
|
6203
|
-
renderer,
|
|
6204
6286
|
children: EmptyArray,
|
|
6205
6287
|
aChildren: EmptyArray,
|
|
6206
6288
|
velements: EmptyArray,
|
|
@@ -6255,13 +6337,8 @@ function createVM(elm, def, options) {
|
|
|
6255
6337
|
|
|
6256
6338
|
function computeShadowMode(vm) {
|
|
6257
6339
|
const {
|
|
6258
|
-
def
|
|
6259
|
-
renderer
|
|
6340
|
+
def
|
|
6260
6341
|
} = vm;
|
|
6261
|
-
const {
|
|
6262
|
-
isNativeShadowDefined,
|
|
6263
|
-
isSyntheticShadowDefined
|
|
6264
|
-
} = renderer;
|
|
6265
6342
|
let shadowMode;
|
|
6266
6343
|
|
|
6267
6344
|
if (isSyntheticShadowDefined) {
|
|
@@ -6411,13 +6488,12 @@ function patchShadowRoot(vm, newCh) {
|
|
|
6411
6488
|
|
|
6412
6489
|
function runRenderedCallback(vm) {
|
|
6413
6490
|
const {
|
|
6414
|
-
renderer,
|
|
6415
6491
|
def: {
|
|
6416
6492
|
renderedCallback
|
|
6417
6493
|
}
|
|
6418
6494
|
} = vm;
|
|
6419
6495
|
|
|
6420
|
-
if (shared.isTrue(
|
|
6496
|
+
if (shared.isTrue(ssr)) {
|
|
6421
6497
|
return;
|
|
6422
6498
|
}
|
|
6423
6499
|
|
|
@@ -6643,8 +6719,7 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
6643
6719
|
|
|
6644
6720
|
function resetComponentRoot(vm) {
|
|
6645
6721
|
const {
|
|
6646
|
-
children
|
|
6647
|
-
renderer
|
|
6722
|
+
children
|
|
6648
6723
|
} = vm;
|
|
6649
6724
|
const rootNode = getRenderRoot(vm);
|
|
6650
6725
|
|
|
@@ -6652,7 +6727,7 @@ function resetComponentRoot(vm) {
|
|
|
6652
6727
|
const child = children[i];
|
|
6653
6728
|
|
|
6654
6729
|
if (!shared.isNull(child) && !shared.isUndefined(child.elm)) {
|
|
6655
|
-
|
|
6730
|
+
remove(child.elm, rootNode);
|
|
6656
6731
|
}
|
|
6657
6732
|
}
|
|
6658
6733
|
|
|
@@ -6661,7 +6736,7 @@ function resetComponentRoot(vm) {
|
|
|
6661
6736
|
vm.velements = EmptyArray;
|
|
6662
6737
|
}
|
|
6663
6738
|
function scheduleRehydration(vm) {
|
|
6664
|
-
if (shared.isTrue(
|
|
6739
|
+
if (shared.isTrue(ssr) || shared.isTrue(vm.isScheduled)) {
|
|
6665
6740
|
return;
|
|
6666
6741
|
}
|
|
6667
6742
|
|
|
@@ -6901,7 +6976,6 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
6901
6976
|
|
|
6902
6977
|
const {
|
|
6903
6978
|
elm,
|
|
6904
|
-
renderer,
|
|
6905
6979
|
context: {
|
|
6906
6980
|
wiredConnecting,
|
|
6907
6981
|
wiredDisconnecting
|
|
@@ -6928,7 +7002,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
6928
7002
|
}
|
|
6929
7003
|
|
|
6930
7004
|
});
|
|
6931
|
-
|
|
7005
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
6932
7006
|
});
|
|
6933
7007
|
}
|
|
6934
7008
|
|
|
@@ -7211,11 +7285,51 @@ exports.registerComponent = registerComponent;
|
|
|
7211
7285
|
exports.registerDecorators = registerDecorators;
|
|
7212
7286
|
exports.registerTemplate = registerTemplate;
|
|
7213
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;
|
|
7214
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;
|
|
7215
7329
|
exports.swapComponent = swapComponent;
|
|
7216
7330
|
exports.swapStyle = swapStyle;
|
|
7217
7331
|
exports.swapTemplate = swapTemplate;
|
|
7218
7332
|
exports.track = track;
|
|
7219
7333
|
exports.unwrap = unwrap;
|
|
7220
7334
|
exports.wire = wire;
|
|
7221
|
-
/* version: 2.
|
|
7335
|
+
/* version: 2.7.2 */
|