@lwc/engine-core 6.1.1 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/framework/base-lightning-element.d.ts +3 -1
- package/dist/framework/component.d.ts +1 -0
- package/dist/framework/modules/static-parts.d.ts +8 -1
- package/dist/framework/mutation-tracker.d.ts +2 -1
- package/dist/framework/reporting.d.ts +7 -2
- package/dist/index.cjs.js +220 -67
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +221 -68
- package/dist/index.js.map +1 -1
- package/dist/libs/mutation-tracker/index.d.ts +1 -0
- package/dist/libs/signal-tracker/index.d.ts +5 -0
- package/dist/shared/circular-module-dependencies.d.ts +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2024 Salesforce, Inc.
|
|
3
3
|
*/
|
|
4
|
-
import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create,
|
|
4
|
+
import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, isFalse, isFunction as isFunction$1, isObject, seal, isAPIFeatureEnabled, isArray as isArray$1, keys, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, forEach, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, freeze, KEY__SYNTHETIC_MODE, isString, assert, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, ArrayShift, ArrayUnshift, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, LOWEST_API_VERSION, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, ArrayFilter, StringSplit, arrayEvery, ArrayIncludes, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse } from '@lwc/shared';
|
|
5
5
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
6
6
|
|
|
7
7
|
/*
|
|
@@ -232,6 +232,7 @@ class ReactiveObserver {
|
|
|
232
232
|
}
|
|
233
233
|
observe(job) {
|
|
234
234
|
const inceptionReactiveRecord = currentReactiveObserver;
|
|
235
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
235
236
|
currentReactiveObserver = this;
|
|
236
237
|
let error;
|
|
237
238
|
try {
|
|
@@ -281,6 +282,80 @@ class ReactiveObserver {
|
|
|
281
282
|
// we keep track of observing records where the observing record was added to so we can do some clean up later on
|
|
282
283
|
ArrayPush$1.call(this.listeners, reactiveObservers);
|
|
283
284
|
}
|
|
285
|
+
isObserving() {
|
|
286
|
+
return currentReactiveObserver === this;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/*
|
|
291
|
+
* Copyright (c) 2024, salesforce.com, inc.
|
|
292
|
+
* All rights reserved.
|
|
293
|
+
* SPDX-License-Identifier: MIT
|
|
294
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
295
|
+
*/
|
|
296
|
+
/**
|
|
297
|
+
* This map keeps track of objects to signals. There is an assumption that the signal is strongly referenced
|
|
298
|
+
* on the object which allows the SignalTracker to be garbage collected along with the object.
|
|
299
|
+
*/
|
|
300
|
+
const TargetToSignalTrackerMap = new WeakMap();
|
|
301
|
+
function getSignalTracker(target) {
|
|
302
|
+
let signalTracker = TargetToSignalTrackerMap.get(target);
|
|
303
|
+
if (isUndefined$1(signalTracker)) {
|
|
304
|
+
signalTracker = new SignalTracker();
|
|
305
|
+
TargetToSignalTrackerMap.set(target, signalTracker);
|
|
306
|
+
}
|
|
307
|
+
return signalTracker;
|
|
308
|
+
}
|
|
309
|
+
function subscribeToSignal(target, signal, update) {
|
|
310
|
+
const signalTracker = getSignalTracker(target);
|
|
311
|
+
if (isFalse(signalTracker.seen(signal))) {
|
|
312
|
+
signalTracker.subscribeToSignal(signal, update);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function unsubscribeFromSignals(target) {
|
|
316
|
+
if (TargetToSignalTrackerMap.has(target)) {
|
|
317
|
+
const signalTracker = getSignalTracker(target);
|
|
318
|
+
signalTracker.unsubscribeFromSignals();
|
|
319
|
+
signalTracker.reset();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* This class is used to keep track of the signals associated to a given object.
|
|
324
|
+
* It is used to prevent the LWC engine from subscribing duplicate callbacks multiple times
|
|
325
|
+
* to the same signal. Additionally, it keeps track of all signal unsubscribe callbacks, handles invoking
|
|
326
|
+
* them when necessary and discarding them.
|
|
327
|
+
*/
|
|
328
|
+
class SignalTracker {
|
|
329
|
+
constructor() {
|
|
330
|
+
this.signalToUnsubscribeMap = new Map();
|
|
331
|
+
}
|
|
332
|
+
seen(signal) {
|
|
333
|
+
return this.signalToUnsubscribeMap.has(signal);
|
|
334
|
+
}
|
|
335
|
+
subscribeToSignal(signal, update) {
|
|
336
|
+
try {
|
|
337
|
+
const unsubscribe = signal.subscribe(update);
|
|
338
|
+
if (isFunction$1(unsubscribe)) {
|
|
339
|
+
// TODO [#3978]: Evaluate how we should handle the case when unsubscribe is not a function.
|
|
340
|
+
// Long term we should throw an error or log a warning.
|
|
341
|
+
this.signalToUnsubscribeMap.set(signal, unsubscribe);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
catch (err) {
|
|
345
|
+
logWarnOnce(`Attempted to subscribe to an object that has the shape of a signal but received the following error: ${err?.stack ?? err}`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
unsubscribeFromSignals() {
|
|
349
|
+
try {
|
|
350
|
+
this.signalToUnsubscribeMap.forEach((unsubscribe) => unsubscribe());
|
|
351
|
+
}
|
|
352
|
+
catch (err) {
|
|
353
|
+
logWarnOnce(`Attempted to call a signal's unsubscribe callback but received the following error: ${err?.stack ?? err}`);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
reset() {
|
|
357
|
+
this.signalToUnsubscribeMap.clear();
|
|
358
|
+
}
|
|
284
359
|
}
|
|
285
360
|
|
|
286
361
|
/*
|
|
@@ -302,10 +377,26 @@ function componentValueMutated(vm, key) {
|
|
|
302
377
|
valueMutated(vm.component, key);
|
|
303
378
|
}
|
|
304
379
|
}
|
|
305
|
-
function componentValueObserved(vm, key) {
|
|
380
|
+
function componentValueObserved(vm, key, target = {}) {
|
|
381
|
+
const { component, tro } = vm;
|
|
306
382
|
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
307
383
|
if (process.env.IS_BROWSER) {
|
|
308
|
-
valueObserved(
|
|
384
|
+
valueObserved(component, key);
|
|
385
|
+
}
|
|
386
|
+
// The portion of reactivity that's exposed to signals is to subscribe a callback to re-render the VM (templates).
|
|
387
|
+
// We check check the following to ensure re-render is subscribed at the correct time.
|
|
388
|
+
// 1. The template is currently being rendered (there is a template reactive observer)
|
|
389
|
+
// 2. There was a call to a getter to access the signal (happens during vnode generation)
|
|
390
|
+
if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS &&
|
|
391
|
+
isObject(target) &&
|
|
392
|
+
!isNull(target) &&
|
|
393
|
+
'value' in target &&
|
|
394
|
+
'subscribe' in target &&
|
|
395
|
+
isFunction$1(target.subscribe) &&
|
|
396
|
+
// Only subscribe if a template is being rendered by the engine
|
|
397
|
+
tro.isObserving()) {
|
|
398
|
+
// Subscribe the template reactive observer's notify method, which will mark the vm as dirty and schedule hydration.
|
|
399
|
+
subscribeToSignal(component, target, tro.notify.bind(tro));
|
|
309
400
|
}
|
|
310
401
|
}
|
|
311
402
|
function createReactiveObserver(callback) {
|
|
@@ -342,6 +433,7 @@ function addCallbackToNextTick(callback) {
|
|
|
342
433
|
}
|
|
343
434
|
}
|
|
344
435
|
if (nextTickCallbackQueue.length === 0) {
|
|
436
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
345
437
|
Promise.resolve().then(flushCallbackQueue);
|
|
346
438
|
}
|
|
347
439
|
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
@@ -423,7 +515,11 @@ function applyTemporaryCompilerV5SlotFix(data) {
|
|
|
423
515
|
if (!isUndefined$1(attrs)) {
|
|
424
516
|
const { slot } = attrs;
|
|
425
517
|
if (!isUndefined$1(slot) && !isNull(slot)) {
|
|
426
|
-
return
|
|
518
|
+
return {
|
|
519
|
+
...data,
|
|
520
|
+
attrs: cloneAndOmitKey(attrs, 'slot'),
|
|
521
|
+
slotAssignment: String(slot),
|
|
522
|
+
};
|
|
427
523
|
}
|
|
428
524
|
}
|
|
429
525
|
return data;
|
|
@@ -437,15 +533,20 @@ function applyTemporaryCompilerV5SlotFix(data) {
|
|
|
437
533
|
*/
|
|
438
534
|
function resolveCircularModuleDependency(fn) {
|
|
439
535
|
const module = fn();
|
|
440
|
-
return
|
|
536
|
+
return module?.__esModule ? module.default : module;
|
|
441
537
|
}
|
|
442
538
|
function isCircularModuleDependency(obj) {
|
|
443
539
|
return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
|
|
444
540
|
}
|
|
445
541
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
542
|
+
/*
|
|
543
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
544
|
+
* All rights reserved.
|
|
545
|
+
* SPDX-License-Identifier: MIT
|
|
546
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
547
|
+
*/
|
|
548
|
+
const instrumentDef = globalThis.__lwc_instrument_cmp_def ?? noop;
|
|
549
|
+
const instrumentInstance = globalThis.__lwc_instrument_cmp_instance ?? noop;
|
|
449
550
|
|
|
450
551
|
/*
|
|
451
552
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1397,6 +1498,7 @@ function initGlobalStylesheet() {
|
|
|
1397
1498
|
}
|
|
1398
1499
|
return promise;
|
|
1399
1500
|
});
|
|
1501
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
1400
1502
|
Promise.all(promises).then((stylesheetTexts) => {
|
|
1401
1503
|
// When replaceSync() is called, the entire contents of the constructable stylesheet are replaced
|
|
1402
1504
|
// with the copied+concatenated styles. This means that any shadow root's adoptedStyleSheets that
|
|
@@ -1508,7 +1610,6 @@ const LightningElement = function () {
|
|
|
1508
1610
|
const { assertInstanceOfHTMLElement } = vm.renderer;
|
|
1509
1611
|
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
1510
1612
|
}
|
|
1511
|
-
const component = this;
|
|
1512
1613
|
setPrototypeOf(elm, bridge.prototype);
|
|
1513
1614
|
vm.component = this;
|
|
1514
1615
|
// Locker hooks assignment. When the LWC engine run with Locker, Locker intercepts all the new
|
|
@@ -1523,7 +1624,7 @@ const LightningElement = function () {
|
|
|
1523
1624
|
}
|
|
1524
1625
|
markLockerLiveObject(this);
|
|
1525
1626
|
// Linking elm, shadow root and component with the VM.
|
|
1526
|
-
associateVM(
|
|
1627
|
+
associateVM(this, vm);
|
|
1527
1628
|
associateVM(elm, vm);
|
|
1528
1629
|
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
|
1529
1630
|
vm.renderRoot = doAttachShadow(vm);
|
|
@@ -1947,8 +2048,9 @@ function createObservedFieldPropertyDescriptor(key) {
|
|
|
1947
2048
|
return {
|
|
1948
2049
|
get() {
|
|
1949
2050
|
const vm = getAssociatedVM(this);
|
|
1950
|
-
|
|
1951
|
-
|
|
2051
|
+
const val = vm.cmpFields[key];
|
|
2052
|
+
componentValueObserved(vm, key, val);
|
|
2053
|
+
return val;
|
|
1952
2054
|
},
|
|
1953
2055
|
set(newValue) {
|
|
1954
2056
|
const vm = getAssociatedVM(this);
|
|
@@ -2059,6 +2161,7 @@ function createConfigWatcher(component, configCallback, callbackWhenConfigIsRead
|
|
|
2059
2161
|
if (hasPendingConfig === false) {
|
|
2060
2162
|
hasPendingConfig = true;
|
|
2061
2163
|
// collect new config in the micro-task
|
|
2164
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
2062
2165
|
Promise.resolve().then(() => {
|
|
2063
2166
|
hasPendingConfig = false;
|
|
2064
2167
|
// resetting current reactive params
|
|
@@ -2201,6 +2304,7 @@ function installWireAdapters(vm) {
|
|
|
2201
2304
|
connector.connect();
|
|
2202
2305
|
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
2203
2306
|
if (hasDynamicParams) {
|
|
2307
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
2204
2308
|
Promise.resolve().then(computeConfigAndUpdate);
|
|
2205
2309
|
return;
|
|
2206
2310
|
}
|
|
@@ -2252,8 +2356,9 @@ function createPublicPropertyDescriptor(key) {
|
|
|
2252
2356
|
}
|
|
2253
2357
|
return;
|
|
2254
2358
|
}
|
|
2255
|
-
|
|
2256
|
-
|
|
2359
|
+
const val = vm.cmpProps[key];
|
|
2360
|
+
componentValueObserved(vm, key, val);
|
|
2361
|
+
return val;
|
|
2257
2362
|
},
|
|
2258
2363
|
set(newValue) {
|
|
2259
2364
|
const vm = getAssociatedVM(this);
|
|
@@ -2326,8 +2431,9 @@ function internalTrackDecorator(key) {
|
|
|
2326
2431
|
return {
|
|
2327
2432
|
get() {
|
|
2328
2433
|
const vm = getAssociatedVM(this);
|
|
2329
|
-
|
|
2330
|
-
|
|
2434
|
+
const val = vm.cmpFields[key];
|
|
2435
|
+
componentValueObserved(vm, key, val);
|
|
2436
|
+
return val;
|
|
2331
2437
|
},
|
|
2332
2438
|
set(newValue) {
|
|
2333
2439
|
const vm = getAssociatedVM(this);
|
|
@@ -3201,6 +3307,14 @@ function createComponentDef(Ctor) {
|
|
|
3201
3307
|
let shadowSupportMode = superDef.shadowSupportMode;
|
|
3202
3308
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
3203
3309
|
shadowSupportMode = ctorShadowSupportMode;
|
|
3310
|
+
if (isReportingEnabled() &&
|
|
3311
|
+
(shadowSupportMode === "any" /* ShadowSupportMode.Any */ ||
|
|
3312
|
+
shadowSupportMode === "native" /* ShadowSupportMode.Native */)) {
|
|
3313
|
+
report("ShadowSupportModeUsage" /* ReportingEventId.ShadowSupportModeUsage */, {
|
|
3314
|
+
tagName: Ctor.name,
|
|
3315
|
+
mode: shadowSupportMode,
|
|
3316
|
+
});
|
|
3317
|
+
}
|
|
3204
3318
|
}
|
|
3205
3319
|
let renderMode = superDef.renderMode;
|
|
3206
3320
|
if (!isUndefined$1(ctorRenderMode)) {
|
|
@@ -3520,7 +3634,7 @@ function getNearestShadowComponent(vm) {
|
|
|
3520
3634
|
function getScopeTokenClass(owner, legacy) {
|
|
3521
3635
|
const { cmpTemplate, context } = owner;
|
|
3522
3636
|
return ((context.hasScopedStyles &&
|
|
3523
|
-
(legacy ? cmpTemplate
|
|
3637
|
+
(legacy ? cmpTemplate?.legacyStylesheetToken : cmpTemplate?.stylesheetToken)) ||
|
|
3524
3638
|
null);
|
|
3525
3639
|
}
|
|
3526
3640
|
/**
|
|
@@ -3647,7 +3761,7 @@ function patchAttributes(oldVnode, vnode, renderer) {
|
|
|
3647
3761
|
}
|
|
3648
3762
|
function patchSlotAssignment(oldVnode, vnode, renderer) {
|
|
3649
3763
|
const { slotAssignment } = vnode;
|
|
3650
|
-
if (
|
|
3764
|
+
if (oldVnode?.slotAssignment === slotAssignment) {
|
|
3651
3765
|
return;
|
|
3652
3766
|
}
|
|
3653
3767
|
const { elm } = vnode;
|
|
@@ -3724,6 +3838,8 @@ function getMapFromClassName(className) {
|
|
|
3724
3838
|
return EmptyObject;
|
|
3725
3839
|
}
|
|
3726
3840
|
// computed class names must be string
|
|
3841
|
+
// This will throw if className is a symbol or null-prototype object
|
|
3842
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
3727
3843
|
className = isString(className) ? className : className + '';
|
|
3728
3844
|
let map = classNameToClassMap[className];
|
|
3729
3845
|
if (map) {
|
|
@@ -3804,9 +3920,8 @@ function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
|
3804
3920
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3805
3921
|
*/
|
|
3806
3922
|
function applyEventListeners(vnode, renderer) {
|
|
3807
|
-
var _a;
|
|
3808
3923
|
const { elm } = vnode;
|
|
3809
|
-
const on =
|
|
3924
|
+
const on = vnode.data?.on;
|
|
3810
3925
|
if (isUndefined$1(on)) {
|
|
3811
3926
|
return;
|
|
3812
3927
|
}
|
|
@@ -3941,7 +4056,7 @@ function traverseAndSetElements(root, parts, renderer) {
|
|
|
3941
4056
|
* @param renderer - the renderer to use
|
|
3942
4057
|
* @param mount - true this is a first (mount) render as opposed to a subsequent (patch) render
|
|
3943
4058
|
*/
|
|
3944
|
-
function
|
|
4059
|
+
function mountStaticParts(root, vnode, renderer) {
|
|
3945
4060
|
// On the server, we don't support ref (because it relies on renderedCallback), nor do we
|
|
3946
4061
|
// support event listeners (no interactivity), so traversing parts makes no sense
|
|
3947
4062
|
if (!process.env.IS_BROWSER) {
|
|
@@ -3951,20 +4066,46 @@ function applyStaticParts(root, vnode, renderer, mount) {
|
|
|
3951
4066
|
if (isUndefined$1(parts)) {
|
|
3952
4067
|
return;
|
|
3953
4068
|
}
|
|
3954
|
-
// This adds `part.elm` to each `part`. We have to do this on every mount
|
|
4069
|
+
// This adds `part.elm` to each `part`. We have to do this on every mount because the `parts`
|
|
3955
4070
|
// array is recreated from scratch every time, so each `part.elm` is now undefined.
|
|
3956
|
-
// TODO [#3800]: avoid calling traverseAndSetElements on every re-render
|
|
3957
4071
|
traverseAndSetElements(root, parts, renderer);
|
|
3958
4072
|
// Currently only event listeners and refs are supported for static vnodes
|
|
3959
4073
|
for (const part of parts) {
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
applyEventListeners(part, renderer);
|
|
3963
|
-
}
|
|
4074
|
+
// Event listeners only need to be applied once when mounting
|
|
4075
|
+
applyEventListeners(part, renderer);
|
|
3964
4076
|
// Refs must be updated after every render due to refVNodes getting reset before every render
|
|
3965
4077
|
applyRefs(part, owner);
|
|
3966
4078
|
}
|
|
3967
4079
|
}
|
|
4080
|
+
/**
|
|
4081
|
+
* Mounts elements to the newly generated VStatic node
|
|
4082
|
+
*
|
|
4083
|
+
* @param n1 - the previous VStatic vnode
|
|
4084
|
+
* @param n2 - the current VStatic vnode
|
|
4085
|
+
*/
|
|
4086
|
+
function patchStaticParts(n1, n2) {
|
|
4087
|
+
// On the server, we don't support ref (because it relies on renderedCallback), nor do we
|
|
4088
|
+
// support event listeners (no interactivity), so traversing parts makes no sense
|
|
4089
|
+
if (!process.env.IS_BROWSER) {
|
|
4090
|
+
return;
|
|
4091
|
+
}
|
|
4092
|
+
const { parts: currParts, owner: currPartsOwner } = n2;
|
|
4093
|
+
if (isUndefined$1(currParts)) {
|
|
4094
|
+
return;
|
|
4095
|
+
}
|
|
4096
|
+
const { parts: prevParts } = n1;
|
|
4097
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4098
|
+
assert.isTrue(currParts.length === prevParts?.length, 'Expected static parts to be the same for the same element. This is an error with the LWC framework itself.');
|
|
4099
|
+
}
|
|
4100
|
+
for (let i = 0; i < currParts.length; i++) {
|
|
4101
|
+
const part = currParts[i];
|
|
4102
|
+
// Patch only occurs if the vnode is newly generated, which means the part.elm is always undefined
|
|
4103
|
+
// Since the vnode and elements are the same we can safely assume that prevParts[i].elm is defined.
|
|
4104
|
+
part.elm = prevParts[i].elm;
|
|
4105
|
+
// Refs must be updated after every render due to refVNodes getting reset before every render
|
|
4106
|
+
applyRefs(part, currPartsOwner);
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
3968
4109
|
|
|
3969
4110
|
/*
|
|
3970
4111
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3981,7 +4122,6 @@ function patchChildren(c1, c2, parent, renderer) {
|
|
|
3981
4122
|
}
|
|
3982
4123
|
}
|
|
3983
4124
|
function patch(n1, n2, parent, renderer) {
|
|
3984
|
-
var _a, _b;
|
|
3985
4125
|
if (n1 === n2) {
|
|
3986
4126
|
return;
|
|
3987
4127
|
}
|
|
@@ -4014,15 +4154,14 @@ function patch(n1, n2, parent, renderer) {
|
|
|
4014
4154
|
patchFragment(n1, n2, parent, renderer);
|
|
4015
4155
|
break;
|
|
4016
4156
|
case 2 /* VNodeType.Element */:
|
|
4017
|
-
patchElement(n1, n2,
|
|
4157
|
+
patchElement(n1, n2, n2.data.renderer ?? renderer);
|
|
4018
4158
|
break;
|
|
4019
4159
|
case 3 /* VNodeType.CustomElement */:
|
|
4020
|
-
patchCustomElement(n1, n2, parent,
|
|
4160
|
+
patchCustomElement(n1, n2, parent, n2.data.renderer ?? renderer);
|
|
4021
4161
|
break;
|
|
4022
4162
|
}
|
|
4023
4163
|
}
|
|
4024
4164
|
function mount(node, parent, renderer, anchor) {
|
|
4025
|
-
var _a, _b;
|
|
4026
4165
|
switch (node.type) {
|
|
4027
4166
|
case 0 /* VNodeType.Text */:
|
|
4028
4167
|
// VText has no special capability, fallback to the owner's renderer
|
|
@@ -4041,11 +4180,11 @@ function mount(node, parent, renderer, anchor) {
|
|
|
4041
4180
|
break;
|
|
4042
4181
|
case 2 /* VNodeType.Element */:
|
|
4043
4182
|
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
4044
|
-
mountElement(node, parent, anchor,
|
|
4183
|
+
mountElement(node, parent, anchor, node.data.renderer ?? renderer);
|
|
4045
4184
|
break;
|
|
4046
4185
|
case 3 /* VNodeType.CustomElement */:
|
|
4047
4186
|
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
4048
|
-
mountCustomElement(node, parent, anchor,
|
|
4187
|
+
mountCustomElement(node, parent, anchor, node.data.renderer ?? renderer);
|
|
4049
4188
|
break;
|
|
4050
4189
|
}
|
|
4051
4190
|
}
|
|
@@ -4107,11 +4246,11 @@ function mountElement(vnode, parent, anchor, renderer) {
|
|
|
4107
4246
|
mountVNodes(vnode.children, elm, renderer, null);
|
|
4108
4247
|
}
|
|
4109
4248
|
function patchStatic(n1, n2, renderer) {
|
|
4110
|
-
|
|
4249
|
+
n2.elm = n1.elm;
|
|
4111
4250
|
// slotAssignments can only apply to the top level element, never to a static part.
|
|
4112
4251
|
patchSlotAssignment(n1, n2, renderer);
|
|
4113
4252
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
|
4114
|
-
|
|
4253
|
+
patchStaticParts(n1, n2);
|
|
4115
4254
|
}
|
|
4116
4255
|
function patchElement(n1, n2, renderer) {
|
|
4117
4256
|
const elm = (n2.elm = n1.elm);
|
|
@@ -4134,7 +4273,7 @@ function mountStatic(vnode, parent, anchor, renderer) {
|
|
|
4134
4273
|
// slotAssignments can only apply to the top level element, never to a static part.
|
|
4135
4274
|
patchSlotAssignment(null, vnode, renderer);
|
|
4136
4275
|
insertNode(elm, parent, anchor, renderer);
|
|
4137
|
-
|
|
4276
|
+
mountStaticParts(elm, vnode, renderer);
|
|
4138
4277
|
}
|
|
4139
4278
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
4140
4279
|
const { sel, owner, ctor } = vnode;
|
|
@@ -4396,17 +4535,15 @@ function applyStyleScoping(elm, owner, renderer) {
|
|
|
4396
4535
|
}
|
|
4397
4536
|
}
|
|
4398
4537
|
function applyDomManual(elm, vnode) {
|
|
4399
|
-
var _a;
|
|
4400
4538
|
const { owner, data: { context }, } = vnode;
|
|
4401
|
-
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ &&
|
|
4539
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && context?.lwc?.dom === "manual" /* LwcDomMode.Manual */) {
|
|
4402
4540
|
elm.$domManual$ = true;
|
|
4403
4541
|
}
|
|
4404
4542
|
}
|
|
4405
4543
|
function applyElementRestrictions(elm, vnode) {
|
|
4406
|
-
var _a, _b;
|
|
4407
4544
|
if (process.env.NODE_ENV !== 'production') {
|
|
4408
4545
|
const isSynthetic = vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
4409
|
-
const isPortal = vnode.type === 2 /* VNodeType.Element */ &&
|
|
4546
|
+
const isPortal = vnode.type === 2 /* VNodeType.Element */ && vnode.data.context?.lwc?.dom === "manual" /* LwcDomMode.Manual */;
|
|
4410
4547
|
const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
|
|
4411
4548
|
patchElementWithRestrictions(elm, {
|
|
4412
4549
|
isPortal,
|
|
@@ -4513,7 +4650,6 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4513
4650
|
return vm;
|
|
4514
4651
|
}
|
|
4515
4652
|
function allocateInSlot(vm, children, owner) {
|
|
4516
|
-
var _a;
|
|
4517
4653
|
const { cmpSlots: { slotAssignments: oldSlotsMapping }, } = vm;
|
|
4518
4654
|
const cmpSlotsMapping = create(null);
|
|
4519
4655
|
// Collect all slots into cmpSlotsMapping
|
|
@@ -4524,7 +4660,7 @@ function allocateInSlot(vm, children, owner) {
|
|
|
4524
4660
|
}
|
|
4525
4661
|
let slotName = '';
|
|
4526
4662
|
if (isVBaseElement(vnode) || isVStatic(vnode)) {
|
|
4527
|
-
slotName =
|
|
4663
|
+
slotName = vnode.slotAssignment ?? '';
|
|
4528
4664
|
}
|
|
4529
4665
|
else if (isVScopedSlotFragment(vnode)) {
|
|
4530
4666
|
slotName = vnode.slotName;
|
|
@@ -4533,6 +4669,7 @@ function allocateInSlot(vm, children, owner) {
|
|
|
4533
4669
|
// but elm.setAttribute('slot', Symbol(1)) is an error.
|
|
4534
4670
|
// the following line also throws same error for symbols
|
|
4535
4671
|
// Similar for Object.create(null)
|
|
4672
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
4536
4673
|
const normalizedSlotName = '' + slotName;
|
|
4537
4674
|
const vnodes = (cmpSlotsMapping[normalizedSlotName] =
|
|
4538
4675
|
cmpSlotsMapping[normalizedSlotName] || []);
|
|
@@ -4930,11 +5067,11 @@ function s(slotName, data, children, slotset) {
|
|
|
4930
5067
|
// to the vnode because the current way the diffing algo works, it will replace the original reference
|
|
4931
5068
|
// to the host element with a new one. This means the new element will be mounted and immediately unmounted.
|
|
4932
5069
|
// Creating a copy of the vnode to preserve a reference to the previous host element.
|
|
4933
|
-
clonedVNode =
|
|
5070
|
+
clonedVNode = { ...vnode, slotAssignment: data.slotAssignment };
|
|
4934
5071
|
}
|
|
4935
5072
|
// If the slot content is standard type, the content is static, no additional
|
|
4936
5073
|
// processing needed on the vnode
|
|
4937
|
-
ArrayPush$1.call(newChildren, clonedVNode
|
|
5074
|
+
ArrayPush$1.call(newChildren, clonedVNode ?? vnode);
|
|
4938
5075
|
}
|
|
4939
5076
|
}
|
|
4940
5077
|
}
|
|
@@ -5393,7 +5530,7 @@ function logGlobalOperationStart(opId, vm) {
|
|
|
5393
5530
|
start(markName);
|
|
5394
5531
|
}
|
|
5395
5532
|
if (isProfilerEnabled) {
|
|
5396
|
-
currentDispatcher(opId, 0 /* Phase.Start */, vm
|
|
5533
|
+
currentDispatcher(opId, 0 /* Phase.Start */, vm?.tagName, vm?.idx, vm?.renderMode, vm?.shadowMode);
|
|
5397
5534
|
}
|
|
5398
5535
|
}
|
|
5399
5536
|
function logGlobalOperationEnd(opId, vm) {
|
|
@@ -5403,7 +5540,7 @@ function logGlobalOperationEnd(opId, vm) {
|
|
|
5403
5540
|
end(opName, markName);
|
|
5404
5541
|
}
|
|
5405
5542
|
if (isProfilerEnabled) {
|
|
5406
|
-
currentDispatcher(opId, 1 /* Phase.Stop */, vm
|
|
5543
|
+
currentDispatcher(opId, 1 /* Phase.Stop */, vm?.tagName, vm?.idx, vm?.renderMode, vm?.shadowMode);
|
|
5407
5544
|
}
|
|
5408
5545
|
}
|
|
5409
5546
|
|
|
@@ -5425,7 +5562,6 @@ function validateSlots(vm) {
|
|
|
5425
5562
|
assertNotProd(); // this method should never leak to prod
|
|
5426
5563
|
const { cmpSlots } = vm;
|
|
5427
5564
|
for (const slotName in cmpSlots.slotAssignments) {
|
|
5428
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
5429
5565
|
assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
5430
5566
|
}
|
|
5431
5567
|
}
|
|
@@ -5723,16 +5859,14 @@ Ctor, metadata) {
|
|
|
5723
5859
|
return Ctor;
|
|
5724
5860
|
}
|
|
5725
5861
|
function getComponentRegisteredTemplate(Ctor) {
|
|
5726
|
-
|
|
5727
|
-
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.tmpl;
|
|
5862
|
+
return registeredComponentMap.get(Ctor)?.tmpl;
|
|
5728
5863
|
}
|
|
5729
5864
|
function getComponentRegisteredName(Ctor) {
|
|
5730
|
-
|
|
5731
|
-
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
|
|
5865
|
+
return registeredComponentMap.get(Ctor)?.sel;
|
|
5732
5866
|
}
|
|
5733
5867
|
function getComponentAPIVersion(Ctor) {
|
|
5734
5868
|
const metadata = registeredComponentMap.get(Ctor);
|
|
5735
|
-
const apiVersion = metadata
|
|
5869
|
+
const apiVersion = metadata?.apiVersion;
|
|
5736
5870
|
if (isUndefined$1(apiVersion)) {
|
|
5737
5871
|
// This should only occur in our Karma tests; in practice every component
|
|
5738
5872
|
// is registered, and so this code path should not get hit. But to be safe,
|
|
@@ -5750,11 +5884,27 @@ function getTemplateReactiveObserver(vm) {
|
|
|
5750
5884
|
}
|
|
5751
5885
|
});
|
|
5752
5886
|
}
|
|
5887
|
+
function resetTemplateObserverAndUnsubscribe(vm) {
|
|
5888
|
+
const { tro, component } = vm;
|
|
5889
|
+
tro.reset();
|
|
5890
|
+
// Unsubscribe every time the template reactive observer is reset.
|
|
5891
|
+
if (lwcRuntimeFlags.ENABLE_EXPERIMENTAL_SIGNALS) {
|
|
5892
|
+
unsubscribeFromSignals(component);
|
|
5893
|
+
}
|
|
5894
|
+
}
|
|
5753
5895
|
function renderComponent(vm) {
|
|
5754
5896
|
if (process.env.NODE_ENV !== 'production') {
|
|
5755
5897
|
assert.invariant(vm.isDirty, `${vm} is not dirty.`);
|
|
5756
5898
|
}
|
|
5757
|
-
|
|
5899
|
+
// The engine should only hold a subscription to a signal if it is rendered in the template.
|
|
5900
|
+
// Because of the potential presence of conditional rendering logic, we unsubscribe on each render
|
|
5901
|
+
// in the scenario where it is present in one condition but not the other.
|
|
5902
|
+
// For example:
|
|
5903
|
+
// 1. There is an lwc:if=true conditional where the signal is present on the template.
|
|
5904
|
+
// 2. The lwc:if changes to false and the signal is no longer present on the template.
|
|
5905
|
+
// If the signal is still subscribed to, the template will re-render when it receives a notification
|
|
5906
|
+
// from the signal, even though we won't be using the new value.
|
|
5907
|
+
resetTemplateObserverAndUnsubscribe(vm);
|
|
5758
5908
|
const vnodes = invokeComponentRenderMethod(vm);
|
|
5759
5909
|
vm.isDirty = false;
|
|
5760
5910
|
vm.isScheduled = false;
|
|
@@ -5829,9 +5979,8 @@ function appendVM(vm) {
|
|
|
5829
5979
|
function resetComponentStateWhenRemoved(vm) {
|
|
5830
5980
|
const { state } = vm;
|
|
5831
5981
|
if (state !== 2 /* VMState.disconnected */) {
|
|
5832
|
-
const { tro } = vm;
|
|
5833
5982
|
// Making sure that any observing record will not trigger the rehydrated on this vm
|
|
5834
|
-
|
|
5983
|
+
resetTemplateObserverAndUnsubscribe(vm);
|
|
5835
5984
|
runDisconnectedCallback(vm);
|
|
5836
5985
|
// Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
|
|
5837
5986
|
runChildNodesDisconnectedCallback(vm);
|
|
@@ -6144,7 +6293,7 @@ function flushRehydrationQueue() {
|
|
|
6144
6293
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
6145
6294
|
// re-throwing the original error will break the current tick, but since the next tick is
|
|
6146
6295
|
// already scheduled, it should continue patching the rest.
|
|
6147
|
-
throw error;
|
|
6296
|
+
throw error;
|
|
6148
6297
|
}
|
|
6149
6298
|
}
|
|
6150
6299
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
@@ -6617,7 +6766,7 @@ function checkAndReportViolation(elm, prop, isSetter, setValue) {
|
|
|
6617
6766
|
setValueType = isNull(setValue) ? 'null' : typeof setValue;
|
|
6618
6767
|
}
|
|
6619
6768
|
report("NonStandardAriaReflection" /* ReportingEventId.NonStandardAriaReflection */, {
|
|
6620
|
-
tagName: vm
|
|
6769
|
+
tagName: vm?.tagName,
|
|
6621
6770
|
propertyName: prop,
|
|
6622
6771
|
isSetter,
|
|
6623
6772
|
setValueType,
|
|
@@ -6695,7 +6844,6 @@ function hydrateVM(vm) {
|
|
|
6695
6844
|
runRenderedCallback(vm);
|
|
6696
6845
|
}
|
|
6697
6846
|
function hydrateNode(node, vnode, renderer) {
|
|
6698
|
-
var _a, _b;
|
|
6699
6847
|
let hydratedNode;
|
|
6700
6848
|
switch (vnode.type) {
|
|
6701
6849
|
case 0 /* VNodeType.Text */:
|
|
@@ -6715,10 +6863,10 @@ function hydrateNode(node, vnode, renderer) {
|
|
|
6715
6863
|
hydratedNode = hydrateFragment(node, vnode, renderer);
|
|
6716
6864
|
break;
|
|
6717
6865
|
case 2 /* VNodeType.Element */:
|
|
6718
|
-
hydratedNode = hydrateElement(node, vnode,
|
|
6866
|
+
hydratedNode = hydrateElement(node, vnode, vnode.data.renderer ?? renderer);
|
|
6719
6867
|
break;
|
|
6720
6868
|
case 3 /* VNodeType.CustomElement */:
|
|
6721
|
-
hydratedNode = hydrateCustomElement(node, vnode,
|
|
6869
|
+
hydratedNode = hydrateCustomElement(node, vnode, vnode.data.renderer ?? renderer);
|
|
6722
6870
|
break;
|
|
6723
6871
|
}
|
|
6724
6872
|
return renderer.nextSibling(hydratedNode);
|
|
@@ -6761,7 +6909,6 @@ function getValidationPredicate(optOutStaticProp) {
|
|
|
6761
6909
|
return (_attrName) => true;
|
|
6762
6910
|
}
|
|
6763
6911
|
function hydrateText(node, vnode, renderer) {
|
|
6764
|
-
var _a;
|
|
6765
6912
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
6766
6913
|
return handleMismatch(node, vnode, renderer);
|
|
6767
6914
|
}
|
|
@@ -6771,12 +6918,11 @@ function hydrateText(node, vnode, renderer) {
|
|
|
6771
6918
|
}
|
|
6772
6919
|
}
|
|
6773
6920
|
const { setText } = renderer;
|
|
6774
|
-
setText(node,
|
|
6921
|
+
setText(node, vnode.text ?? null);
|
|
6775
6922
|
vnode.elm = node;
|
|
6776
6923
|
return node;
|
|
6777
6924
|
}
|
|
6778
6925
|
function hydrateComment(node, vnode, renderer) {
|
|
6779
|
-
var _a;
|
|
6780
6926
|
if (!hasCorrectNodeType(vnode, node, 8 /* EnvNodeTypes.COMMENT */, renderer)) {
|
|
6781
6927
|
return handleMismatch(node, vnode, renderer);
|
|
6782
6928
|
}
|
|
@@ -6788,7 +6934,7 @@ function hydrateComment(node, vnode, renderer) {
|
|
|
6788
6934
|
}
|
|
6789
6935
|
}
|
|
6790
6936
|
const { setProperty } = renderer;
|
|
6791
|
-
setProperty(node, NODE_VALUE_PROP,
|
|
6937
|
+
setProperty(node, NODE_VALUE_PROP, vnode.text ?? null);
|
|
6792
6938
|
vnode.elm = node;
|
|
6793
6939
|
return node;
|
|
6794
6940
|
}
|
|
@@ -6798,7 +6944,7 @@ function hydrateStaticElement(elm, vnode, renderer) {
|
|
|
6798
6944
|
return handleMismatch(elm, vnode, renderer);
|
|
6799
6945
|
}
|
|
6800
6946
|
vnode.elm = elm;
|
|
6801
|
-
|
|
6947
|
+
mountStaticParts(elm, vnode, renderer);
|
|
6802
6948
|
return elm;
|
|
6803
6949
|
}
|
|
6804
6950
|
function hydrateFragment(elm, vnode, renderer) {
|
|
@@ -6823,7 +6969,10 @@ function hydrateElement(elm, vnode, renderer) {
|
|
|
6823
6969
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6824
6970
|
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
|
6825
6971
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6826
|
-
vnode.data =
|
|
6972
|
+
vnode.data = {
|
|
6973
|
+
...vnode.data,
|
|
6974
|
+
props: cloneAndOmitKey(props, 'innerHTML'),
|
|
6975
|
+
};
|
|
6827
6976
|
}
|
|
6828
6977
|
else {
|
|
6829
6978
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -7035,7 +7184,11 @@ function validateClassAttr(vnode, elm, renderer) {
|
|
|
7035
7184
|
className = ArrayJoin.call(classNames, ' ');
|
|
7036
7185
|
}
|
|
7037
7186
|
else if (!isUndefined$1(classMap)) {
|
|
7038
|
-
classMap =
|
|
7187
|
+
classMap = {
|
|
7188
|
+
...classMap,
|
|
7189
|
+
...(!isNull(scopedToken) ? { [scopedToken]: true } : {}),
|
|
7190
|
+
...(!isNull(stylesheetTokenHost) ? { [stylesheetTokenHost]: true } : {}),
|
|
7191
|
+
};
|
|
7039
7192
|
}
|
|
7040
7193
|
else {
|
|
7041
7194
|
// The order of the className should be scopedToken stylesheetTokenHost
|
|
@@ -7429,5 +7582,5 @@ function readonly(obj) {
|
|
|
7429
7582
|
}
|
|
7430
7583
|
|
|
7431
7584
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7432
|
-
/** version: 6.
|
|
7585
|
+
/** version: 6.2.0 */
|
|
7433
7586
|
//# sourceMappingURL=index.js.map
|