@lwc/engine-core 6.6.2 → 7.0.0-alpha.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/LICENSE.md +21 -1
- package/dist/framework/api.d.ts +11 -0
- package/dist/framework/base-lightning-element.d.ts +1 -1
- package/dist/framework/decorators/api.d.ts +2 -5
- package/dist/framework/decorators/track.d.ts +2 -5
- package/dist/framework/decorators/wire.d.ts +10 -6
- package/dist/framework/renderer.d.ts +1 -0
- package/dist/index.cjs.js +73 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +74 -12
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
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, ArrayPop, 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, 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, ArraySplice, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, isNumber, StringReplace, htmlEscape, StringCharAt, ArrayUnshift, 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, ArrayShift } from '@lwc/shared';
|
|
4
|
+
import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArrayPop, 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, 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, ArraySplice, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, isNumber, StringReplace, StringTrim, htmlEscape, StringCharAt, ArrayUnshift, 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, ArrayShift } from '@lwc/shared';
|
|
5
5
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
6
6
|
|
|
7
7
|
/*
|
|
@@ -1906,6 +1906,19 @@ LightningElement.prototype = {
|
|
|
1906
1906
|
const { elm, renderer } = getAssociatedVM(this);
|
|
1907
1907
|
return renderer.getTagName(elm);
|
|
1908
1908
|
},
|
|
1909
|
+
get style() {
|
|
1910
|
+
const { elm, renderer, def } = getAssociatedVM(this);
|
|
1911
|
+
const apiVersion = getComponentAPIVersion(def.ctor);
|
|
1912
|
+
if (!isAPIFeatureEnabled(10 /* APIFeature.ENABLE_THIS_DOT_STYLE */, apiVersion)) {
|
|
1913
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1914
|
+
logWarnOnce('The `this.style` API within LightningElement returning the CSSStyleDeclaration is ' +
|
|
1915
|
+
'only supported in API version 62 and above. Increase the API version to use it.');
|
|
1916
|
+
}
|
|
1917
|
+
// Simulate the old behavior for `this.style` to avoid a breaking change
|
|
1918
|
+
return undefined;
|
|
1919
|
+
}
|
|
1920
|
+
return renderer.getStyle(elm);
|
|
1921
|
+
},
|
|
1909
1922
|
render() {
|
|
1910
1923
|
const vm = getAssociatedVM(this);
|
|
1911
1924
|
return vm.def.template;
|
|
@@ -2258,12 +2271,21 @@ function disconnectWireAdapters(vm) {
|
|
|
2258
2271
|
}
|
|
2259
2272
|
|
|
2260
2273
|
/*
|
|
2261
|
-
* Copyright (c)
|
|
2274
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
2262
2275
|
* All rights reserved.
|
|
2263
2276
|
* SPDX-License-Identifier: MIT
|
|
2264
2277
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2265
2278
|
*/
|
|
2266
|
-
|
|
2279
|
+
/**
|
|
2280
|
+
* The `@api` decorator marks public fields and public methods in
|
|
2281
|
+
* LWC Components. This function implements the internals of this
|
|
2282
|
+
* decorator.
|
|
2283
|
+
*/
|
|
2284
|
+
function api$1(
|
|
2285
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2286
|
+
value,
|
|
2287
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2288
|
+
context) {
|
|
2267
2289
|
if (process.env.NODE_ENV !== 'production') {
|
|
2268
2290
|
assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
2269
2291
|
}
|
|
@@ -2336,7 +2358,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2336
2358
|
}
|
|
2337
2359
|
|
|
2338
2360
|
/*
|
|
2339
|
-
* Copyright (c)
|
|
2361
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
2340
2362
|
* All rights reserved.
|
|
2341
2363
|
* SPDX-License-Identifier: MIT
|
|
2342
2364
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
@@ -2378,19 +2400,27 @@ function internalTrackDecorator(key) {
|
|
|
2378
2400
|
}
|
|
2379
2401
|
|
|
2380
2402
|
/*
|
|
2381
|
-
* Copyright (c)
|
|
2403
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
2382
2404
|
* All rights reserved.
|
|
2383
2405
|
* SPDX-License-Identifier: MIT
|
|
2384
2406
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2385
2407
|
*/
|
|
2386
2408
|
/**
|
|
2387
|
-
*
|
|
2388
|
-
*
|
|
2389
|
-
*
|
|
2390
|
-
* @
|
|
2391
|
-
* @
|
|
2409
|
+
* Decorator factory to wire a property or method to a wire adapter data source.
|
|
2410
|
+
* @param adapter the adapter used to provision data
|
|
2411
|
+
* @param config configuration object for the adapter
|
|
2412
|
+
* @returns A decorator function
|
|
2413
|
+
* @example
|
|
2414
|
+
* export default class WireExample extends LightningElement {
|
|
2415
|
+
* \@api bookId;
|
|
2416
|
+
* \@wire(getBook, { id: '$bookId'}) book;
|
|
2417
|
+
* }
|
|
2392
2418
|
*/
|
|
2393
|
-
function wire(
|
|
2419
|
+
function wire(
|
|
2420
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2421
|
+
adapter,
|
|
2422
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2423
|
+
config) {
|
|
2394
2424
|
if (process.env.NODE_ENV !== 'production') {
|
|
2395
2425
|
assert.fail('@wire(adapter, config?) may only be used as a decorator.');
|
|
2396
2426
|
}
|
|
@@ -5554,6 +5584,37 @@ function setSanitizeHtmlContentHook(newHookImpl) {
|
|
|
5554
5584
|
function shc(content) {
|
|
5555
5585
|
return sanitizeHtmlContentHook(content);
|
|
5556
5586
|
}
|
|
5587
|
+
/**
|
|
5588
|
+
* [ncls] - Normalize class name attribute.
|
|
5589
|
+
*
|
|
5590
|
+
* Transforms the provided class property value from an object/string into a string the diffing algo
|
|
5591
|
+
* can operate on.
|
|
5592
|
+
*
|
|
5593
|
+
* This implementation is borrowed from Vue:
|
|
5594
|
+
* https://github.com/vuejs/core/blob/e790e1bdd7df7be39e14780529db86e4da47a3db/packages/shared/src/normalizeProp.ts#L63-L82
|
|
5595
|
+
*/
|
|
5596
|
+
function ncls(value) {
|
|
5597
|
+
let res = '';
|
|
5598
|
+
if (isString(value)) {
|
|
5599
|
+
res = value;
|
|
5600
|
+
}
|
|
5601
|
+
else if (isArray$1(value)) {
|
|
5602
|
+
for (let i = 0; i < value.length; i++) {
|
|
5603
|
+
const normalized = ncls(value[i]);
|
|
5604
|
+
if (normalized) {
|
|
5605
|
+
res += normalized + ' ';
|
|
5606
|
+
}
|
|
5607
|
+
}
|
|
5608
|
+
}
|
|
5609
|
+
else if (isObject(value)) {
|
|
5610
|
+
for (const key in value) {
|
|
5611
|
+
if (value[key]) {
|
|
5612
|
+
res += key + ' ';
|
|
5613
|
+
}
|
|
5614
|
+
}
|
|
5615
|
+
}
|
|
5616
|
+
return StringTrim.call(res);
|
|
5617
|
+
}
|
|
5557
5618
|
const api = freeze({
|
|
5558
5619
|
s,
|
|
5559
5620
|
h,
|
|
@@ -5575,6 +5636,7 @@ const api = freeze({
|
|
|
5575
5636
|
ssf,
|
|
5576
5637
|
ddc,
|
|
5577
5638
|
sp,
|
|
5639
|
+
ncls,
|
|
5578
5640
|
});
|
|
5579
5641
|
|
|
5580
5642
|
/*
|
|
@@ -7918,5 +7980,5 @@ function readonly(obj) {
|
|
|
7918
7980
|
}
|
|
7919
7981
|
|
|
7920
7982
|
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, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7921
|
-
/** version:
|
|
7983
|
+
/** version: 7.0.0-alpha.0 */
|
|
7922
7984
|
//# sourceMappingURL=index.js.map
|