lwc 2.38.1 → 2.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +203 -122
- package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom.js +203 -122
- package/dist/engine-dom/iife/es2017/engine-dom.js.map +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +154 -40
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
- package/dist/engine-dom/iife/es5/engine-dom.js +353 -207
- package/dist/engine-dom/iife/es5/engine-dom.js.map +1 -1
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +305 -153
- package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom.js +203 -122
- package/dist/engine-dom/umd/es2017/engine-dom.js.map +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +154 -40
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
- package/dist/engine-dom/umd/es5/engine-dom.js +353 -207
- package/dist/engine-dom/umd/es5/engine-dom.js.map +1 -1
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +305 -153
- package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -1
- package/dist/engine-server/commonjs/es2017/engine-server.js +168 -75
- package/dist/engine-server/commonjs/es2017/engine-server.js.map +1 -1
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +168 -75
- package/dist/engine-server/esm/es2017/engine-server.js.map +1 -1
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +1 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +1 -1
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +1 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +1 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js.map +1 -1
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/esm/es2017/wire-service.js.map +1 -1
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js.map +1 -1
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js.map +1 -1
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js.map +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js.map +1 -1
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js.map +1 -1
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js.map +1 -1
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js.map +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js.map +1 -1
- package/package.json +7 -7
|
@@ -353,9 +353,9 @@
|
|
|
353
353
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
354
354
|
*/
|
|
355
355
|
// Increment whenever the LWC template compiler changes
|
|
356
|
-
const LWC_VERSION = "2.
|
|
356
|
+
const LWC_VERSION = "2.39.0";
|
|
357
357
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
358
|
-
/** version: 2.
|
|
358
|
+
/** version: 2.39.0 */
|
|
359
359
|
|
|
360
360
|
/**
|
|
361
361
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
setFeatureFlag(name, value);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
/** version: 2.
|
|
437
|
+
/** version: 2.39.0 */
|
|
438
438
|
|
|
439
439
|
/**
|
|
440
440
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
|
-
/** version: 2.
|
|
501
|
+
/** version: 2.39.0 */
|
|
502
502
|
|
|
503
503
|
/*
|
|
504
504
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3243,6 +3243,93 @@
|
|
|
3243
3243
|
freeze(BaseBridgeElement);
|
|
3244
3244
|
seal(BaseBridgeElement.prototype);
|
|
3245
3245
|
|
|
3246
|
+
/*
|
|
3247
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
3248
|
+
* All rights reserved.
|
|
3249
|
+
* SPDX-License-Identifier: MIT
|
|
3250
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3251
|
+
*/
|
|
3252
|
+
const supportsWeakRefs = typeof WeakRef === 'function' && typeof FinalizationRegistry === 'function';
|
|
3253
|
+
// In browsers that doesn't support WeakRefs, the values will still leak, but at least the keys won't
|
|
3254
|
+
class LegacyWeakMultiMap {
|
|
3255
|
+
constructor() {
|
|
3256
|
+
this._map = new WeakMap();
|
|
3257
|
+
}
|
|
3258
|
+
_getValues(key) {
|
|
3259
|
+
let values = this._map.get(key);
|
|
3260
|
+
if (isUndefined$1(values)) {
|
|
3261
|
+
values = new Set();
|
|
3262
|
+
this._map.set(key, values);
|
|
3263
|
+
}
|
|
3264
|
+
return values;
|
|
3265
|
+
}
|
|
3266
|
+
get(key) {
|
|
3267
|
+
return this._getValues(key);
|
|
3268
|
+
}
|
|
3269
|
+
add(key, vm) {
|
|
3270
|
+
const set = this._getValues(key);
|
|
3271
|
+
set.add(vm);
|
|
3272
|
+
}
|
|
3273
|
+
delete(key) {
|
|
3274
|
+
this._map.delete(key);
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
// This implementation relies on the WeakRef/FinalizationRegistry proposal.
|
|
3278
|
+
// For some background, see: https://github.com/tc39/proposal-weakrefs
|
|
3279
|
+
class ModernWeakMultiMap {
|
|
3280
|
+
constructor() {
|
|
3281
|
+
this._map = new WeakMap();
|
|
3282
|
+
this._registry = new FinalizationRegistry((weakRefs) => {
|
|
3283
|
+
// This should be considered an optional cleanup method to remove GC'ed values from their respective arrays.
|
|
3284
|
+
// JS VMs are not obligated to call FinalizationRegistry callbacks.
|
|
3285
|
+
// Work backwards, removing stale VMs
|
|
3286
|
+
for (let i = weakRefs.length - 1; i >= 0; i--) {
|
|
3287
|
+
const vm = weakRefs[i].deref();
|
|
3288
|
+
if (isUndefined$1(vm)) {
|
|
3289
|
+
ArraySplice.call(weakRefs, i, 1); // remove
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
});
|
|
3293
|
+
}
|
|
3294
|
+
_getWeakRefs(key) {
|
|
3295
|
+
let weakRefs = this._map.get(key);
|
|
3296
|
+
if (isUndefined$1(weakRefs)) {
|
|
3297
|
+
weakRefs = [];
|
|
3298
|
+
this._map.set(key, weakRefs);
|
|
3299
|
+
}
|
|
3300
|
+
return weakRefs;
|
|
3301
|
+
}
|
|
3302
|
+
get(key) {
|
|
3303
|
+
const weakRefs = this._getWeakRefs(key);
|
|
3304
|
+
const result = new Set();
|
|
3305
|
+
for (const weakRef of weakRefs) {
|
|
3306
|
+
const vm = weakRef.deref();
|
|
3307
|
+
if (!isUndefined$1(vm)) {
|
|
3308
|
+
result.add(vm);
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
return result;
|
|
3312
|
+
}
|
|
3313
|
+
add(key, value) {
|
|
3314
|
+
const weakRefs = this._getWeakRefs(key);
|
|
3315
|
+
// We could check for duplicate values here, but it doesn't seem worth it.
|
|
3316
|
+
// We transform the output into a Set anyway
|
|
3317
|
+
ArrayPush$1.call(weakRefs, new WeakRef(value));
|
|
3318
|
+
// It's important here not to leak the second argument, which is the "held value." The FinalizationRegistry
|
|
3319
|
+
// effectively creates a strong reference between the first argument (the "target") and the held value. When
|
|
3320
|
+
// the target is GC'ed, the callback is called, and then the held value is GC'ed.
|
|
3321
|
+
// Putting the key here would mean the key is not GC'ed until the value is GC'ed, which defeats the purpose
|
|
3322
|
+
// of the WeakMap. Whereas putting the weakRefs array here is fine, because it doesn't have a strong reference
|
|
3323
|
+
// to anything. See also this example:
|
|
3324
|
+
// https://gist.github.com/nolanlawson/79a3d36e8e6cc25c5048bb17c1795aea
|
|
3325
|
+
this._registry.register(value, weakRefs);
|
|
3326
|
+
}
|
|
3327
|
+
delete(key) {
|
|
3328
|
+
this._map.delete(key);
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
const WeakMultiMap = supportsWeakRefs ? ModernWeakMultiMap : LegacyWeakMultiMap;
|
|
3332
|
+
|
|
3246
3333
|
/*
|
|
3247
3334
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
3248
3335
|
* All rights reserved.
|
|
@@ -3252,67 +3339,62 @@
|
|
|
3252
3339
|
const swappedTemplateMap = new WeakMap();
|
|
3253
3340
|
const swappedComponentMap = new WeakMap();
|
|
3254
3341
|
const swappedStyleMap = new WeakMap();
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3342
|
+
// The important thing here is the weak values – VMs are transient (one per component instance) and should be GC'ed,
|
|
3343
|
+
// so we don't want to create strong references to them.
|
|
3344
|
+
// The weak keys are kind of useless, because Templates, LightningElementConstructors, and StylesheetFactories are
|
|
3345
|
+
// never GC'ed. But maybe they will be someday, so we may as well use weak keys too.
|
|
3346
|
+
const activeTemplates = new WeakMultiMap();
|
|
3347
|
+
const activeComponents = new WeakMultiMap();
|
|
3348
|
+
const activeStyles = new WeakMultiMap();
|
|
3258
3349
|
function rehydrateHotTemplate(tpl) {
|
|
3259
3350
|
const list = activeTemplates.get(tpl);
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
}
|
|
3267
|
-
});
|
|
3268
|
-
// resetting the Set to release the memory of those vm references
|
|
3269
|
-
// since they are not longer related to this template, instead
|
|
3270
|
-
// they will get re-associated once these instances are rehydrated.
|
|
3271
|
-
list.clear();
|
|
3351
|
+
for (const vm of list) {
|
|
3352
|
+
if (isFalse(vm.isDirty)) {
|
|
3353
|
+
// forcing the vm to rehydrate in the micro-task:
|
|
3354
|
+
markComponentAsDirty(vm);
|
|
3355
|
+
scheduleRehydration(vm);
|
|
3356
|
+
}
|
|
3272
3357
|
}
|
|
3358
|
+
// Resetting the Set since these VMs are no longer related to this template, instead
|
|
3359
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3360
|
+
activeTemplates.delete(tpl);
|
|
3273
3361
|
return true;
|
|
3274
3362
|
}
|
|
3275
3363
|
function rehydrateHotStyle(style) {
|
|
3276
3364
|
const list = activeStyles.get(style);
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
// they will get re-associated once these instances are rehydrated.
|
|
3286
|
-
list.clear();
|
|
3287
|
-
}
|
|
3365
|
+
for (const vm of list) {
|
|
3366
|
+
// if a style definition is swapped, we must reset
|
|
3367
|
+
// vm's template content in the next micro-task:
|
|
3368
|
+
forceRehydration(vm);
|
|
3369
|
+
}
|
|
3370
|
+
// Resetting the Set since these VMs are no longer related to this style, instead
|
|
3371
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3372
|
+
activeStyles.delete(style);
|
|
3288
3373
|
return true;
|
|
3289
3374
|
}
|
|
3290
3375
|
function rehydrateHotComponent(Ctor) {
|
|
3291
3376
|
const list = activeComponents.get(Ctor);
|
|
3292
3377
|
let canRefreshAllInstances = true;
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
if
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
// they will get re-associated once these instances are rehydrated.
|
|
3314
|
-
list.clear();
|
|
3315
|
-
}
|
|
3378
|
+
for (const vm of list) {
|
|
3379
|
+
const { owner } = vm;
|
|
3380
|
+
if (!isNull(owner)) {
|
|
3381
|
+
// if a component class definition is swapped, we must reset
|
|
3382
|
+
// owner's template content in the next micro-task:
|
|
3383
|
+
forceRehydration(owner);
|
|
3384
|
+
}
|
|
3385
|
+
else {
|
|
3386
|
+
// the hot swapping for components only work for instances of components
|
|
3387
|
+
// created from a template, root elements can't be swapped because we
|
|
3388
|
+
// don't have a way to force the creation of the element with the same state
|
|
3389
|
+
// of the current element.
|
|
3390
|
+
// Instead, we can report the problem to the caller so it can take action,
|
|
3391
|
+
// for example: reload the entire page.
|
|
3392
|
+
canRefreshAllInstances = false;
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
// resetting the Set since these VMs are no longer related to this constructor, instead
|
|
3396
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3397
|
+
activeComponents.delete(Ctor);
|
|
3316
3398
|
return canRefreshAllInstances;
|
|
3317
3399
|
}
|
|
3318
3400
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
@@ -3346,72 +3428,27 @@
|
|
|
3346
3428
|
assertNotProd(); // this method should never leak to prod
|
|
3347
3429
|
// tracking active component
|
|
3348
3430
|
const Ctor = vm.def.ctor;
|
|
3349
|
-
let componentVMs = activeComponents.get(Ctor);
|
|
3350
|
-
if (isUndefined$1(componentVMs)) {
|
|
3351
|
-
componentVMs = new Set();
|
|
3352
|
-
activeComponents.set(Ctor, componentVMs);
|
|
3353
|
-
}
|
|
3354
3431
|
// this will allow us to keep track of the hot components
|
|
3355
|
-
|
|
3432
|
+
activeComponents.add(Ctor, vm);
|
|
3356
3433
|
// tracking active template
|
|
3357
3434
|
const tpl = vm.cmpTemplate;
|
|
3358
3435
|
if (tpl) {
|
|
3359
|
-
let templateVMs = activeTemplates.get(tpl);
|
|
3360
|
-
if (isUndefined$1(templateVMs)) {
|
|
3361
|
-
templateVMs = new Set();
|
|
3362
|
-
activeTemplates.set(tpl, templateVMs);
|
|
3363
|
-
}
|
|
3364
3436
|
// this will allow us to keep track of the templates that are
|
|
3365
3437
|
// being used by a hot component
|
|
3366
|
-
|
|
3438
|
+
activeTemplates.add(tpl, vm);
|
|
3367
3439
|
// tracking active styles associated to template
|
|
3368
3440
|
const stylesheets = tpl.stylesheets;
|
|
3369
3441
|
if (!isUndefined$1(stylesheets)) {
|
|
3370
|
-
flattenStylesheets(stylesheets)
|
|
3442
|
+
for (const stylesheet of flattenStylesheets(stylesheets)) {
|
|
3371
3443
|
// this is necessary because we don't hold the list of styles
|
|
3372
3444
|
// in the vm, we only hold the selected (already swapped template)
|
|
3373
3445
|
// but the styles attached to the template might not be the actual
|
|
3374
3446
|
// active ones, but the swapped versions of those.
|
|
3375
|
-
|
|
3376
|
-
let stylesheetVMs = activeStyles.get(stylesheet);
|
|
3377
|
-
if (isUndefined$1(stylesheetVMs)) {
|
|
3378
|
-
stylesheetVMs = new Set();
|
|
3379
|
-
activeStyles.set(stylesheet, stylesheetVMs);
|
|
3380
|
-
}
|
|
3447
|
+
const swappedStylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3381
3448
|
// this will allow us to keep track of the stylesheet that are
|
|
3382
3449
|
// being used by a hot component
|
|
3383
|
-
|
|
3384
|
-
}
|
|
3385
|
-
}
|
|
3386
|
-
}
|
|
3387
|
-
}
|
|
3388
|
-
function removeActiveVM(vm) {
|
|
3389
|
-
assertNotProd(); // this method should never leak to prod
|
|
3390
|
-
// tracking inactive component
|
|
3391
|
-
const Ctor = vm.def.ctor;
|
|
3392
|
-
let list = activeComponents.get(Ctor);
|
|
3393
|
-
if (!isUndefined$1(list)) {
|
|
3394
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3395
|
-
list.delete(vm);
|
|
3396
|
-
}
|
|
3397
|
-
// removing inactive template
|
|
3398
|
-
const tpl = vm.cmpTemplate;
|
|
3399
|
-
if (tpl) {
|
|
3400
|
-
list = activeTemplates.get(tpl);
|
|
3401
|
-
if (!isUndefined$1(list)) {
|
|
3402
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3403
|
-
list.delete(vm);
|
|
3404
|
-
}
|
|
3405
|
-
// removing active styles associated to template
|
|
3406
|
-
const styles = tpl.stylesheets;
|
|
3407
|
-
if (!isUndefined$1(styles)) {
|
|
3408
|
-
flattenStylesheets(styles).forEach((style) => {
|
|
3409
|
-
list = activeStyles.get(style);
|
|
3410
|
-
if (!isUndefined$1(list)) {
|
|
3411
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3412
|
-
list.delete(vm);
|
|
3413
|
-
}
|
|
3414
|
-
});
|
|
3450
|
+
activeStyles.add(swappedStylesheet, vm);
|
|
3451
|
+
}
|
|
3415
3452
|
}
|
|
3416
3453
|
}
|
|
3417
3454
|
}
|
|
@@ -4173,7 +4210,12 @@
|
|
|
4173
4210
|
return;
|
|
4174
4211
|
}
|
|
4175
4212
|
if (process.env.NODE_ENV !== 'production') {
|
|
4176
|
-
if (!isSameVnode(n1, n2)
|
|
4213
|
+
if (!isSameVnode(n1, n2) &&
|
|
4214
|
+
// Currently the only scenario when patch does not receive the same vnodes are for
|
|
4215
|
+
// dynamic components. When a dynamic component's constructor changes, the value of its
|
|
4216
|
+
// tag name (sel) will be different. The engine will unmount the previous element
|
|
4217
|
+
// and mount the new one using the new constructor in patchCustomElement.
|
|
4218
|
+
!(isVCustomElement(n1) && isVCustomElement(n2))) {
|
|
4177
4219
|
throw new Error('Expected these VNodes to be the same: ' +
|
|
4178
4220
|
JSON.stringify({ sel: n1.sel, key: n1.key }) +
|
|
4179
4221
|
', ' +
|
|
@@ -4366,8 +4408,9 @@
|
|
|
4366
4408
|
}
|
|
4367
4409
|
}
|
|
4368
4410
|
function patchCustomElement(n1, n2, parent, renderer) {
|
|
4411
|
+
// TODO [#3331]: This if branch should be removed in 246 with lwc:dynamic
|
|
4369
4412
|
if (n1.ctor !== n2.ctor) {
|
|
4370
|
-
// If the constructor, unmount the current component and mount a new one using the new
|
|
4413
|
+
// If the constructor differs, unmount the current component and mount a new one using the new
|
|
4371
4414
|
// constructor.
|
|
4372
4415
|
const anchor = renderer.nextSibling(n1.elm);
|
|
4373
4416
|
unmount(n1, parent, renderer, true);
|
|
@@ -4860,9 +4903,17 @@
|
|
|
4860
4903
|
if (n2 !== n1) {
|
|
4861
4904
|
if (isVNode(n1)) {
|
|
4862
4905
|
if (isVNode(n2)) {
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4906
|
+
if (isSameVnode(n1, n2)) {
|
|
4907
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
4908
|
+
patch(n1, n2, parent, renderer);
|
|
4909
|
+
anchor = n2.elm;
|
|
4910
|
+
}
|
|
4911
|
+
else {
|
|
4912
|
+
// removing the old vnode since the new one is different
|
|
4913
|
+
unmount(n1, parent, renderer, true);
|
|
4914
|
+
mount(n2, parent, renderer, anchor);
|
|
4915
|
+
anchor = n2.elm;
|
|
4916
|
+
}
|
|
4866
4917
|
}
|
|
4867
4918
|
else {
|
|
4868
4919
|
// removing the old vnode since the new one is null
|
|
@@ -5264,16 +5315,18 @@
|
|
|
5264
5315
|
return url;
|
|
5265
5316
|
}
|
|
5266
5317
|
/**
|
|
5267
|
-
* create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
5318
|
+
* [ddc] - create a (deprecated) dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
5319
|
+
*
|
|
5320
|
+
* TODO [#3331]: remove usage of lwc:dynamic in 246
|
|
5268
5321
|
*/
|
|
5269
|
-
function
|
|
5322
|
+
function ddc(sel, Ctor, data, children = EmptyArray) {
|
|
5270
5323
|
if (process.env.NODE_ENV !== 'production') {
|
|
5271
5324
|
assert.isTrue(isString(sel), `dc() 1st argument sel must be a string.`);
|
|
5272
5325
|
assert.isTrue(isObject(data), `dc() 3nd argument data must be an object.`);
|
|
5273
5326
|
assert.isTrue(arguments.length === 3 || isArray$1(children), `dc() 4nd argument data must be an array.`);
|
|
5274
5327
|
}
|
|
5275
5328
|
// null or undefined values should produce a null value in the VNodes
|
|
5276
|
-
if (Ctor
|
|
5329
|
+
if (isNull(Ctor) || isUndefined$1(Ctor)) {
|
|
5277
5330
|
return null;
|
|
5278
5331
|
}
|
|
5279
5332
|
if (!isComponentConstructor(Ctor)) {
|
|
@@ -5281,6 +5334,30 @@
|
|
|
5281
5334
|
}
|
|
5282
5335
|
return c(sel, Ctor, data, children);
|
|
5283
5336
|
}
|
|
5337
|
+
/**
|
|
5338
|
+
* [dc] - create a dynamic component via `<lwc:component lwc:is={Ctor}>`
|
|
5339
|
+
*/
|
|
5340
|
+
function dc(Ctor, data, children = EmptyArray) {
|
|
5341
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5342
|
+
assert.isTrue(isObject(data), `dc() 2nd argument data must be an object.`);
|
|
5343
|
+
assert.isTrue(arguments.length === 3 || isArray$1(children), `dc() 3rd argument data must be an array.`);
|
|
5344
|
+
}
|
|
5345
|
+
// Null or undefined values should produce a null value in the VNodes.
|
|
5346
|
+
// This is the only value at compile time as the constructor will not be known.
|
|
5347
|
+
if (isNull(Ctor) || isUndefined$1(Ctor)) {
|
|
5348
|
+
return null;
|
|
5349
|
+
}
|
|
5350
|
+
if (!isComponentConstructor(Ctor)) {
|
|
5351
|
+
throw new Error(`Invalid constructor ${toString$1(Ctor)} is not a LightningElement constructor.`);
|
|
5352
|
+
}
|
|
5353
|
+
// Look up the dynamic component's name at runtime once the constructor is available.
|
|
5354
|
+
// This information is only known at runtime and is stored as part of registerComponent.
|
|
5355
|
+
const sel = getComponentRegisteredName(Ctor);
|
|
5356
|
+
if (isUndefined$1(sel) || sel === '') {
|
|
5357
|
+
throw new Error(`Invalid LWC constructor ${toString$1(Ctor)} does not have a registered name`);
|
|
5358
|
+
}
|
|
5359
|
+
return c(sel, Ctor, data, children);
|
|
5360
|
+
}
|
|
5284
5361
|
/**
|
|
5285
5362
|
* slow children collection marking mechanism. this API allows the compiler to signal
|
|
5286
5363
|
* to the engine that a particular collection of children must be diffed using the slow
|
|
@@ -5343,6 +5420,7 @@
|
|
|
5343
5420
|
fid,
|
|
5344
5421
|
shc,
|
|
5345
5422
|
ssf,
|
|
5423
|
+
ddc,
|
|
5346
5424
|
});
|
|
5347
5425
|
|
|
5348
5426
|
/*
|
|
@@ -5742,28 +5820,34 @@
|
|
|
5742
5820
|
* SPDX-License-Identifier: MIT
|
|
5743
5821
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5744
5822
|
*/
|
|
5745
|
-
const
|
|
5823
|
+
const registeredComponentMap = new Map();
|
|
5746
5824
|
/**
|
|
5747
5825
|
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
5748
5826
|
* will prevent this function from being imported by userland code.
|
|
5749
5827
|
*/
|
|
5750
5828
|
function registerComponent(
|
|
5751
5829
|
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
5752
|
-
Ctor,
|
|
5830
|
+
Ctor, metadata) {
|
|
5753
5831
|
if (isFunction$1(Ctor)) {
|
|
5754
5832
|
if (process.env.NODE_ENV !== 'production') {
|
|
5755
5833
|
// There is no point in running this in production, because the version mismatch check relies
|
|
5756
5834
|
// on code comments which are stripped out in production by minifiers
|
|
5757
5835
|
checkVersionMismatch(Ctor, 'component');
|
|
5758
5836
|
}
|
|
5759
|
-
|
|
5837
|
+
// TODO [#3331]: add validation to check the value of metadata.sel is not an empty string.
|
|
5838
|
+
registeredComponentMap.set(Ctor, metadata);
|
|
5760
5839
|
}
|
|
5761
5840
|
// chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
5762
5841
|
// without too much transformation
|
|
5763
5842
|
return Ctor;
|
|
5764
5843
|
}
|
|
5765
5844
|
function getComponentRegisteredTemplate(Ctor) {
|
|
5766
|
-
|
|
5845
|
+
var _a;
|
|
5846
|
+
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.tmpl;
|
|
5847
|
+
}
|
|
5848
|
+
function getComponentRegisteredName(Ctor) {
|
|
5849
|
+
var _a;
|
|
5850
|
+
return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
|
|
5767
5851
|
}
|
|
5768
5852
|
function getTemplateReactiveObserver(vm) {
|
|
5769
5853
|
return createReactiveObserver(() => {
|
|
@@ -5899,9 +5983,6 @@
|
|
|
5899
5983
|
runChildNodesDisconnectedCallback(vm);
|
|
5900
5984
|
runLightChildNodesDisconnectedCallback(vm);
|
|
5901
5985
|
}
|
|
5902
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5903
|
-
removeActiveVM(vm);
|
|
5904
|
-
}
|
|
5905
5986
|
}
|
|
5906
5987
|
// this method is triggered by the diffing algo only when a vnode from the
|
|
5907
5988
|
// old vnode.children is removed from the DOM.
|
|
@@ -7356,7 +7437,7 @@
|
|
|
7356
7437
|
}
|
|
7357
7438
|
return getReadOnlyProxy(obj);
|
|
7358
7439
|
}
|
|
7359
|
-
/* version: 2.
|
|
7440
|
+
/* version: 2.39.0 */
|
|
7360
7441
|
|
|
7361
7442
|
/*
|
|
7362
7443
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7784,7 +7865,7 @@
|
|
|
7784
7865
|
function isNull(obj) {
|
|
7785
7866
|
return obj === null;
|
|
7786
7867
|
}
|
|
7787
|
-
/** version: 2.
|
|
7868
|
+
/** version: 2.39.0 */
|
|
7788
7869
|
|
|
7789
7870
|
/*
|
|
7790
7871
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
@@ -8403,7 +8484,7 @@
|
|
|
8403
8484
|
});
|
|
8404
8485
|
}));
|
|
8405
8486
|
}
|
|
8406
|
-
/* version: 2.
|
|
8487
|
+
/* version: 2.39.0 */
|
|
8407
8488
|
|
|
8408
8489
|
exports.LightningElement = LightningElement;
|
|
8409
8490
|
exports.__unstable__ProfilerControl = profilerControl;
|