@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/LICENSE.md
CHANGED
|
@@ -15,7 +15,27 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
15
15
|
|
|
16
16
|
## @parse5/tools
|
|
17
17
|
|
|
18
|
-
MIT
|
|
18
|
+
The MIT License (MIT)
|
|
19
|
+
|
|
20
|
+
Copyright © 2024 James Garbutt
|
|
21
|
+
|
|
22
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
23
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
24
|
+
in the Software without restriction, including without limitation the rights
|
|
25
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
26
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
27
|
+
furnished to do so, subject to the following conditions:
|
|
28
|
+
|
|
29
|
+
The above copyright notice and this permission notice shall be included in
|
|
30
|
+
all copies or substantial portions of the Software.
|
|
31
|
+
|
|
32
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
33
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
34
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
35
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
36
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
37
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
38
|
+
THE SOFTWARE.
|
|
19
39
|
|
|
20
40
|
## entities
|
|
21
41
|
|
package/dist/framework/api.d.ts
CHANGED
|
@@ -46,6 +46,16 @@ export type SanitizeHtmlContentHook = (content: unknown) => string;
|
|
|
46
46
|
*/
|
|
47
47
|
export declare function setSanitizeHtmlContentHook(newHookImpl: SanitizeHtmlContentHook): void;
|
|
48
48
|
declare function shc(content: unknown): string;
|
|
49
|
+
/**
|
|
50
|
+
* [ncls] - Normalize class name attribute.
|
|
51
|
+
*
|
|
52
|
+
* Transforms the provided class property value from an object/string into a string the diffing algo
|
|
53
|
+
* can operate on.
|
|
54
|
+
*
|
|
55
|
+
* This implementation is borrowed from Vue:
|
|
56
|
+
* https://github.com/vuejs/core/blob/e790e1bdd7df7be39e14780529db86e4da47a3db/packages/shared/src/normalizeProp.ts#L63-L82
|
|
57
|
+
*/
|
|
58
|
+
declare function ncls(value: unknown): string;
|
|
49
59
|
declare const api: Readonly<{
|
|
50
60
|
s: typeof s;
|
|
51
61
|
h: typeof h;
|
|
@@ -67,6 +77,7 @@ declare const api: Readonly<{
|
|
|
67
77
|
ssf: typeof ssf;
|
|
68
78
|
ddc: typeof ddc;
|
|
69
79
|
sp: typeof sp;
|
|
80
|
+
ncls: typeof ncls;
|
|
70
81
|
}>;
|
|
71
82
|
export default api;
|
|
72
83
|
export type RenderAPI = typeof api;
|
|
@@ -23,7 +23,7 @@ export interface LightningElementConstructor {
|
|
|
23
23
|
}
|
|
24
24
|
type HTMLElementTheGoodParts = {
|
|
25
25
|
toString: () => string;
|
|
26
|
-
} & Pick<HTMLElement, 'accessKey' | 'addEventListener' | 'attachInternals' | 'children' | 'childNodes' | 'classList' | 'dir' | 'dispatchEvent' | 'draggable' | 'firstChild' | 'firstElementChild' | 'getAttribute' | 'getAttributeNS' | 'getBoundingClientRect' | 'getElementsByClassName' | 'getElementsByTagName' | 'hasAttribute' | 'hasAttributeNS' | 'hidden' | 'id' | 'isConnected' | 'lang' | 'lastChild' | 'lastElementChild' | 'ownerDocument' | 'querySelector' | 'querySelectorAll' | 'removeAttribute' | 'removeAttributeNS' | 'removeEventListener' | 'setAttribute' | 'setAttributeNS' | 'shadowRoot' | 'spellcheck' | 'tabIndex' | 'tagName' | 'title'>;
|
|
26
|
+
} & Pick<HTMLElement, 'accessKey' | 'addEventListener' | 'attachInternals' | 'children' | 'childNodes' | 'classList' | 'dir' | 'dispatchEvent' | 'draggable' | 'firstChild' | 'firstElementChild' | 'getAttribute' | 'getAttributeNS' | 'getBoundingClientRect' | 'getElementsByClassName' | 'getElementsByTagName' | 'hasAttribute' | 'hasAttributeNS' | 'hidden' | 'id' | 'isConnected' | 'lang' | 'lastChild' | 'lastElementChild' | 'ownerDocument' | 'querySelector' | 'querySelectorAll' | 'removeAttribute' | 'removeAttributeNS' | 'removeEventListener' | 'setAttribute' | 'setAttributeNS' | 'shadowRoot' | 'spellcheck' | 'tabIndex' | 'tagName' | 'title' | 'style'>;
|
|
27
27
|
type RefNodes = {
|
|
28
28
|
[name: string]: Element;
|
|
29
29
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The `@api` decorator marks public fields and public methods in
|
|
3
3
|
* LWC Components. This function implements the internals of this
|
|
4
4
|
* decorator.
|
|
5
|
-
* @param target
|
|
6
|
-
* @param propertyKey
|
|
7
|
-
* @param descriptor
|
|
8
5
|
*/
|
|
9
|
-
export default function api(
|
|
6
|
+
export default function api(value: unknown, context: ClassMemberDecoratorContext | string | symbol): void;
|
|
10
7
|
export declare function createPublicPropertyDescriptor(key: string): PropertyDescriptor;
|
|
11
8
|
export declare function createPublicAccessorDescriptor(key: PropertyKey, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The `@track` decorator function marks field values as reactive in
|
|
3
3
|
* LWC Components. This function can also be invoked directly
|
|
4
4
|
* with any value to obtain the trackable version of the value.
|
|
5
|
-
* @param target
|
|
6
|
-
* @param propertyKey
|
|
7
|
-
* @param descriptor
|
|
8
5
|
*/
|
|
9
|
-
export default function track(
|
|
6
|
+
export default function track(value: unknown, context: ClassMemberDecoratorContext | string | symbol): void;
|
|
10
7
|
export declare function internalTrackDecorator(key: string): PropertyDescriptor;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { WireAdapterConstructor } from '../wiring';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
3
|
+
* Decorator factory to wire a property or method to a wire adapter data source.
|
|
4
|
+
* @param adapter the adapter used to provision data
|
|
5
|
+
* @param config configuration object for the adapter
|
|
6
|
+
* @returns A decorator function
|
|
7
|
+
* @example
|
|
8
|
+
* export default class WireExample extends LightningElement {
|
|
9
|
+
* \@api bookId;
|
|
10
|
+
* \@wire(getBook, { id: '$bookId'}) book;
|
|
11
|
+
* }
|
|
8
12
|
*/
|
|
9
|
-
export default function wire(
|
|
13
|
+
export default function wire(adapter: WireAdapterConstructor, config?: Record<string, any>): (value: unknown, context: ClassMemberDecoratorContext | string | symbol) => void;
|
|
10
14
|
export declare function internalWireFieldDecorator(key: string): PropertyDescriptor;
|
|
@@ -40,6 +40,7 @@ export interface RendererAPI {
|
|
|
40
40
|
getLastChild: (element: E) => N | null;
|
|
41
41
|
getLastElementChild: (element: E) => E | null;
|
|
42
42
|
getTagName: (element: E) => string;
|
|
43
|
+
getStyle: (elm: E) => CSSStyleDeclaration;
|
|
43
44
|
isConnected: (node: N) => boolean;
|
|
44
45
|
insertStylesheet: (content: string, target: ShadowRoot | undefined, signal: AbortSignal | undefined) => void;
|
|
45
46
|
assertInstanceOfHTMLElement: (elm: any, msg: string) => void;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1910,6 +1910,19 @@ LightningElement.prototype = {
|
|
|
1910
1910
|
const { elm, renderer } = getAssociatedVM(this);
|
|
1911
1911
|
return renderer.getTagName(elm);
|
|
1912
1912
|
},
|
|
1913
|
+
get style() {
|
|
1914
|
+
const { elm, renderer, def } = getAssociatedVM(this);
|
|
1915
|
+
const apiVersion = getComponentAPIVersion(def.ctor);
|
|
1916
|
+
if (!shared.isAPIFeatureEnabled(10 /* APIFeature.ENABLE_THIS_DOT_STYLE */, apiVersion)) {
|
|
1917
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1918
|
+
logWarnOnce('The `this.style` API within LightningElement returning the CSSStyleDeclaration is ' +
|
|
1919
|
+
'only supported in API version 62 and above. Increase the API version to use it.');
|
|
1920
|
+
}
|
|
1921
|
+
// Simulate the old behavior for `this.style` to avoid a breaking change
|
|
1922
|
+
return undefined;
|
|
1923
|
+
}
|
|
1924
|
+
return renderer.getStyle(elm);
|
|
1925
|
+
},
|
|
1913
1926
|
render() {
|
|
1914
1927
|
const vm = getAssociatedVM(this);
|
|
1915
1928
|
return vm.def.template;
|
|
@@ -2262,12 +2275,21 @@ function disconnectWireAdapters(vm) {
|
|
|
2262
2275
|
}
|
|
2263
2276
|
|
|
2264
2277
|
/*
|
|
2265
|
-
* Copyright (c)
|
|
2278
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
2266
2279
|
* All rights reserved.
|
|
2267
2280
|
* SPDX-License-Identifier: MIT
|
|
2268
2281
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2269
2282
|
*/
|
|
2270
|
-
|
|
2283
|
+
/**
|
|
2284
|
+
* The `@api` decorator marks public fields and public methods in
|
|
2285
|
+
* LWC Components. This function implements the internals of this
|
|
2286
|
+
* decorator.
|
|
2287
|
+
*/
|
|
2288
|
+
function api$1(
|
|
2289
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2290
|
+
value,
|
|
2291
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2292
|
+
context) {
|
|
2271
2293
|
if (process.env.NODE_ENV !== 'production') {
|
|
2272
2294
|
shared.assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
2273
2295
|
}
|
|
@@ -2340,7 +2362,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2340
2362
|
}
|
|
2341
2363
|
|
|
2342
2364
|
/*
|
|
2343
|
-
* Copyright (c)
|
|
2365
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
2344
2366
|
* All rights reserved.
|
|
2345
2367
|
* SPDX-License-Identifier: MIT
|
|
2346
2368
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
@@ -2382,19 +2404,27 @@ function internalTrackDecorator(key) {
|
|
|
2382
2404
|
}
|
|
2383
2405
|
|
|
2384
2406
|
/*
|
|
2385
|
-
* Copyright (c)
|
|
2407
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
2386
2408
|
* All rights reserved.
|
|
2387
2409
|
* SPDX-License-Identifier: MIT
|
|
2388
2410
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2389
2411
|
*/
|
|
2390
2412
|
/**
|
|
2391
|
-
*
|
|
2392
|
-
*
|
|
2393
|
-
*
|
|
2394
|
-
* @
|
|
2395
|
-
* @
|
|
2413
|
+
* Decorator factory to wire a property or method to a wire adapter data source.
|
|
2414
|
+
* @param adapter the adapter used to provision data
|
|
2415
|
+
* @param config configuration object for the adapter
|
|
2416
|
+
* @returns A decorator function
|
|
2417
|
+
* @example
|
|
2418
|
+
* export default class WireExample extends LightningElement {
|
|
2419
|
+
* \@api bookId;
|
|
2420
|
+
* \@wire(getBook, { id: '$bookId'}) book;
|
|
2421
|
+
* }
|
|
2396
2422
|
*/
|
|
2397
|
-
function wire(
|
|
2423
|
+
function wire(
|
|
2424
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2425
|
+
adapter,
|
|
2426
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2427
|
+
config) {
|
|
2398
2428
|
if (process.env.NODE_ENV !== 'production') {
|
|
2399
2429
|
shared.assert.fail('@wire(adapter, config?) may only be used as a decorator.');
|
|
2400
2430
|
}
|
|
@@ -5558,6 +5588,37 @@ function setSanitizeHtmlContentHook(newHookImpl) {
|
|
|
5558
5588
|
function shc(content) {
|
|
5559
5589
|
return sanitizeHtmlContentHook(content);
|
|
5560
5590
|
}
|
|
5591
|
+
/**
|
|
5592
|
+
* [ncls] - Normalize class name attribute.
|
|
5593
|
+
*
|
|
5594
|
+
* Transforms the provided class property value from an object/string into a string the diffing algo
|
|
5595
|
+
* can operate on.
|
|
5596
|
+
*
|
|
5597
|
+
* This implementation is borrowed from Vue:
|
|
5598
|
+
* https://github.com/vuejs/core/blob/e790e1bdd7df7be39e14780529db86e4da47a3db/packages/shared/src/normalizeProp.ts#L63-L82
|
|
5599
|
+
*/
|
|
5600
|
+
function ncls(value) {
|
|
5601
|
+
let res = '';
|
|
5602
|
+
if (shared.isString(value)) {
|
|
5603
|
+
res = value;
|
|
5604
|
+
}
|
|
5605
|
+
else if (shared.isArray(value)) {
|
|
5606
|
+
for (let i = 0; i < value.length; i++) {
|
|
5607
|
+
const normalized = ncls(value[i]);
|
|
5608
|
+
if (normalized) {
|
|
5609
|
+
res += normalized + ' ';
|
|
5610
|
+
}
|
|
5611
|
+
}
|
|
5612
|
+
}
|
|
5613
|
+
else if (shared.isObject(value)) {
|
|
5614
|
+
for (const key in value) {
|
|
5615
|
+
if (value[key]) {
|
|
5616
|
+
res += key + ' ';
|
|
5617
|
+
}
|
|
5618
|
+
}
|
|
5619
|
+
}
|
|
5620
|
+
return shared.StringTrim.call(res);
|
|
5621
|
+
}
|
|
5561
5622
|
const api = shared.freeze({
|
|
5562
5623
|
s,
|
|
5563
5624
|
h,
|
|
@@ -5579,6 +5640,7 @@ const api = shared.freeze({
|
|
|
5579
5640
|
ssf,
|
|
5580
5641
|
ddc,
|
|
5581
5642
|
sp,
|
|
5643
|
+
ncls,
|
|
5582
5644
|
});
|
|
5583
5645
|
|
|
5584
5646
|
/*
|
|
@@ -7965,5 +8027,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
7965
8027
|
exports.track = track;
|
|
7966
8028
|
exports.unwrap = unwrap;
|
|
7967
8029
|
exports.wire = wire;
|
|
7968
|
-
/** version:
|
|
8030
|
+
/** version: 7.0.0-alpha.0 */
|
|
7969
8031
|
//# sourceMappingURL=index.cjs.js.map
|