@lwc/engine-core 2.37.3 → 2.38.1
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 +125 -122
- package/dist/engine-core.cjs.js.map +1 -0
- package/dist/engine-core.js +125 -122
- package/dist/engine-core.js.map +1 -0
- package/package.json +4 -4
- package/types/framework/base-lightning-element.d.ts +1 -1
- package/types/framework/main.d.ts +9 -9
- package/types/framework/renderer.d.ts +3 -0
- package/types/framework/wiring/context.d.ts +4 -0
- package/types/framework/wiring/index.d.ts +3 -0
- package/types/framework/wiring/types.d.ts +49 -0
- package/types/framework/wiring/wiring.d.ts +7 -0
- package/types/framework/context-provider.d.ts +0 -10
- package/types/framework/wiring.d.ts +0 -34
package/dist/engine-core.js
CHANGED
|
@@ -1799,6 +1799,14 @@ LightningElement.prototype = {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
return renderer.getLastElementChild(vm.elm);
|
|
1801
1801
|
},
|
|
1802
|
+
get ownerDocument() {
|
|
1803
|
+
const vm = getAssociatedVM(this);
|
|
1804
|
+
const renderer = vm.renderer;
|
|
1805
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1806
|
+
warnIfInvokedDuringConstruction(vm, 'ownerDocument');
|
|
1807
|
+
}
|
|
1808
|
+
return renderer.ownerDocument(vm.elm);
|
|
1809
|
+
},
|
|
1802
1810
|
render() {
|
|
1803
1811
|
const vm = getAssociatedVM(this);
|
|
1804
1812
|
return vm.def.template;
|
|
@@ -1874,31 +1882,84 @@ function createObservedFieldPropertyDescriptor(key) {
|
|
|
1874
1882
|
}
|
|
1875
1883
|
|
|
1876
1884
|
/*
|
|
1877
|
-
* Copyright (c)
|
|
1885
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
1878
1886
|
* All rights reserved.
|
|
1879
1887
|
* SPDX-License-Identifier: MIT
|
|
1880
1888
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1881
1889
|
*/
|
|
1882
|
-
const
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1890
|
+
const AdapterToTokenMap = new Map();
|
|
1891
|
+
function createContextProviderWithRegister(adapter, registerContextProvider) {
|
|
1892
|
+
let adapterContextToken = AdapterToTokenMap.get(adapter);
|
|
1893
|
+
if (!isUndefined$1(adapterContextToken)) {
|
|
1894
|
+
throw new Error(`Adapter already has a context provider.`);
|
|
1895
|
+
}
|
|
1896
|
+
adapterContextToken = guid();
|
|
1897
|
+
AdapterToTokenMap.set(adapter, adapterContextToken);
|
|
1898
|
+
const providers = new WeakSet();
|
|
1899
|
+
return (elmOrComponent, options) => {
|
|
1900
|
+
if (providers.has(elmOrComponent)) {
|
|
1901
|
+
throw new Error(`Adapter was already installed on ${elmOrComponent}.`);
|
|
1902
|
+
}
|
|
1903
|
+
providers.add(elmOrComponent);
|
|
1904
|
+
const { consumerConnectedCallback, consumerDisconnectedCallback } = options;
|
|
1905
|
+
registerContextProvider(elmOrComponent, adapterContextToken, (subscriptionPayload) => {
|
|
1906
|
+
const { setNewContext, setDisconnectedCallback } = subscriptionPayload;
|
|
1907
|
+
const consumer = {
|
|
1908
|
+
provide(newContext) {
|
|
1909
|
+
setNewContext(newContext);
|
|
1910
|
+
},
|
|
1911
|
+
};
|
|
1912
|
+
const disconnectCallback = () => {
|
|
1913
|
+
if (!isUndefined$1(consumerDisconnectedCallback)) {
|
|
1914
|
+
consumerDisconnectedCallback(consumer);
|
|
1915
|
+
}
|
|
1916
|
+
};
|
|
1917
|
+
setDisconnectedCallback(disconnectCallback);
|
|
1918
|
+
consumerConnectedCallback(consumer);
|
|
1891
1919
|
});
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
1923
|
+
const { adapter } = wireDef;
|
|
1924
|
+
const adapterContextToken = AdapterToTokenMap.get(adapter);
|
|
1925
|
+
if (isUndefined$1(adapterContextToken)) {
|
|
1926
|
+
return; // no provider found, nothing to be done
|
|
1927
|
+
}
|
|
1928
|
+
const { elm, context: { wiredConnecting, wiredDisconnecting }, renderer: { registerContextConsumer }, } = vm;
|
|
1929
|
+
// waiting for the component to be connected to formally request the context via the token
|
|
1930
|
+
ArrayPush$1.call(wiredConnecting, () => {
|
|
1931
|
+
// This will attempt to connect the current element with one of its anscestors
|
|
1932
|
+
// that can provide context for the given wire adapter. This relationship is
|
|
1933
|
+
// keyed on the secret & internal value of `adapterContextToken`, which is unique
|
|
1934
|
+
// to a given wire adapter.
|
|
1935
|
+
//
|
|
1936
|
+
// Depending on the runtime environment, this connection is made using either DOM
|
|
1937
|
+
// events (in the browser) or a custom traversal (on the server).
|
|
1938
|
+
registerContextConsumer(elm, adapterContextToken, {
|
|
1939
|
+
setNewContext(newContext) {
|
|
1940
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
1941
|
+
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
1942
|
+
callbackWhenContextIsReady(newContext);
|
|
1895
1943
|
},
|
|
1896
|
-
setDisconnectedCallback
|
|
1897
|
-
|
|
1944
|
+
setDisconnectedCallback(disconnectCallback) {
|
|
1945
|
+
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
1946
|
+
// the the element hosting the wire is disconnected
|
|
1947
|
+
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
1898
1948
|
},
|
|
1899
1949
|
});
|
|
1900
|
-
}
|
|
1950
|
+
});
|
|
1901
1951
|
}
|
|
1952
|
+
|
|
1953
|
+
/*
|
|
1954
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
1955
|
+
* All rights reserved.
|
|
1956
|
+
* SPDX-License-Identifier: MIT
|
|
1957
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1958
|
+
*/
|
|
1959
|
+
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
1960
|
+
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
1961
|
+
const WIRE_DEBUG_ENTRY = '@wire';
|
|
1962
|
+
const WireMetaMap = new Map();
|
|
1902
1963
|
function createFieldDataCallback(vm, name) {
|
|
1903
1964
|
return (value) => {
|
|
1904
1965
|
updateComponentValue(vm, name, value);
|
|
@@ -1942,35 +2003,6 @@ function createConfigWatcher(component, configCallback, callbackWhenConfigIsRead
|
|
|
1942
2003
|
ro,
|
|
1943
2004
|
};
|
|
1944
2005
|
}
|
|
1945
|
-
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
1946
|
-
const { adapter } = wireDef;
|
|
1947
|
-
const adapterContextToken = getAdapterToken(adapter);
|
|
1948
|
-
if (isUndefined$1(adapterContextToken)) {
|
|
1949
|
-
return; // no provider found, nothing to be done
|
|
1950
|
-
}
|
|
1951
|
-
const { elm, context: { wiredConnecting, wiredDisconnecting }, renderer: { dispatchEvent }, } = vm;
|
|
1952
|
-
// waiting for the component to be connected to formally request the context via the token
|
|
1953
|
-
ArrayPush$1.call(wiredConnecting, () => {
|
|
1954
|
-
// This event is responsible for connecting the host element with another
|
|
1955
|
-
// element in the composed path that is providing contextual data. The provider
|
|
1956
|
-
// must be listening for a special dom event with the name corresponding to the value of
|
|
1957
|
-
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
1958
|
-
// guarantee that the linkage can be forged.
|
|
1959
|
-
const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
1960
|
-
setNewContext(newContext) {
|
|
1961
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
1962
|
-
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
1963
|
-
callbackWhenContextIsReady(newContext);
|
|
1964
|
-
},
|
|
1965
|
-
setDisconnectedCallback(disconnectCallback) {
|
|
1966
|
-
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
1967
|
-
// the the element hosting the wire is disconnected
|
|
1968
|
-
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
1969
|
-
},
|
|
1970
|
-
});
|
|
1971
|
-
dispatchEvent(elm, contextRegistrationEvent);
|
|
1972
|
-
});
|
|
1973
|
-
}
|
|
1974
2006
|
function createConnector(vm, name, wireDef) {
|
|
1975
2007
|
const { method, adapter, configCallback, dynamic } = wireDef;
|
|
1976
2008
|
let debugInfo;
|
|
@@ -2045,13 +2077,6 @@ function createConnector(vm, name, wireDef) {
|
|
|
2045
2077
|
resetConfigWatcher: () => ro.reset(),
|
|
2046
2078
|
};
|
|
2047
2079
|
}
|
|
2048
|
-
const AdapterToTokenMap = new Map();
|
|
2049
|
-
function getAdapterToken(adapter) {
|
|
2050
|
-
return AdapterToTokenMap.get(adapter);
|
|
2051
|
-
}
|
|
2052
|
-
function setAdapterToken(adapter, token) {
|
|
2053
|
-
AdapterToTokenMap.set(adapter, token);
|
|
2054
|
-
}
|
|
2055
2080
|
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2056
2081
|
// support for callable adapters
|
|
2057
2082
|
if (adapter.adapter) {
|
|
@@ -5780,17 +5805,30 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
5780
5805
|
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
5781
5806
|
// children VNodes might not be representing the current state of the DOM.
|
|
5782
5807
|
function resetComponentRoot(vm) {
|
|
5783
|
-
|
|
5784
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
5785
|
-
const child = children[i];
|
|
5786
|
-
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5787
|
-
remove(child.elm, renderRoot);
|
|
5788
|
-
}
|
|
5789
|
-
}
|
|
5808
|
+
recursivelyRemoveChildren(vm.children, vm);
|
|
5790
5809
|
vm.children = EmptyArray;
|
|
5791
5810
|
runChildNodesDisconnectedCallback(vm);
|
|
5792
5811
|
vm.velements = EmptyArray;
|
|
5793
5812
|
}
|
|
5813
|
+
// Helper function to remove all children of the root node.
|
|
5814
|
+
// If the set of children includes VFragment nodes, we need to remove the children of those nodes too.
|
|
5815
|
+
// Since VFragments can contain other VFragments, we need to traverse the entire of tree of VFragments.
|
|
5816
|
+
// If the set contains no VFragment nodes, no traversal is needed.
|
|
5817
|
+
function recursivelyRemoveChildren(vnodes, vm) {
|
|
5818
|
+
const { renderRoot, renderer: { remove }, } = vm;
|
|
5819
|
+
for (let i = 0, len = vnodes.length; i < len; i += 1) {
|
|
5820
|
+
const vnode = vnodes[i];
|
|
5821
|
+
if (!isNull(vnode)) {
|
|
5822
|
+
// VFragments are special; their .elm property does not point to the root element since they have no single root.
|
|
5823
|
+
if (isVFragment(vnode)) {
|
|
5824
|
+
recursivelyRemoveChildren(vnode.children, vm);
|
|
5825
|
+
}
|
|
5826
|
+
else if (!isUndefined$1(vnode.elm)) {
|
|
5827
|
+
remove(vnode.elm, renderRoot);
|
|
5828
|
+
}
|
|
5829
|
+
}
|
|
5830
|
+
}
|
|
5831
|
+
}
|
|
5794
5832
|
function scheduleRehydration(vm) {
|
|
5795
5833
|
if (!process.env.IS_BROWSER || isTrue(vm.isScheduled)) {
|
|
5796
5834
|
return;
|
|
@@ -5868,6 +5906,10 @@ function forceRehydration(vm) {
|
|
|
5868
5906
|
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
5869
5907
|
const getElementById = globalThis$1[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
5870
5908
|
const querySelectorAll = globalThis$1[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
5909
|
+
// This is a "handoff" from synthetic-shadow to engine-core – we want to clean up after ourselves
|
|
5910
|
+
// so nobody else can misuse these global APIs.
|
|
5911
|
+
delete globalThis$1[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
5912
|
+
delete globalThis$1[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
5871
5913
|
function isSyntheticShadowRootInstance(rootNode) {
|
|
5872
5914
|
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
5873
5915
|
}
|
|
@@ -6115,67 +6157,6 @@ if (process.env.IS_BROWSER) {
|
|
|
6115
6157
|
}
|
|
6116
6158
|
}
|
|
6117
6159
|
|
|
6118
|
-
/*
|
|
6119
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6120
|
-
* All rights reserved.
|
|
6121
|
-
* SPDX-License-Identifier: MIT
|
|
6122
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6123
|
-
*/
|
|
6124
|
-
// this is lwc internal implementation
|
|
6125
|
-
function createContextProvider(adapter) {
|
|
6126
|
-
let adapterContextToken = getAdapterToken(adapter);
|
|
6127
|
-
if (!isUndefined$1(adapterContextToken)) {
|
|
6128
|
-
throw new Error(`Adapter already has a context provider.`);
|
|
6129
|
-
}
|
|
6130
|
-
adapterContextToken = guid();
|
|
6131
|
-
setAdapterToken(adapter, adapterContextToken);
|
|
6132
|
-
const providers = new WeakSet();
|
|
6133
|
-
return (elm, options) => {
|
|
6134
|
-
if (providers.has(elm)) {
|
|
6135
|
-
throw new Error(`Adapter was already installed on ${elm}.`);
|
|
6136
|
-
}
|
|
6137
|
-
providers.add(elm);
|
|
6138
|
-
const { consumerConnectedCallback, consumerDisconnectedCallback } = options;
|
|
6139
|
-
elm.addEventListener(adapterContextToken, ((evt) => {
|
|
6140
|
-
const { setNewContext, setDisconnectedCallback } = evt;
|
|
6141
|
-
const consumer = {
|
|
6142
|
-
provide(newContext) {
|
|
6143
|
-
setNewContext(newContext);
|
|
6144
|
-
},
|
|
6145
|
-
};
|
|
6146
|
-
const disconnectCallback = () => {
|
|
6147
|
-
if (!isUndefined$1(consumerDisconnectedCallback)) {
|
|
6148
|
-
consumerDisconnectedCallback(consumer);
|
|
6149
|
-
}
|
|
6150
|
-
};
|
|
6151
|
-
setDisconnectedCallback(disconnectCallback);
|
|
6152
|
-
consumerConnectedCallback(consumer);
|
|
6153
|
-
evt.stopImmediatePropagation();
|
|
6154
|
-
}));
|
|
6155
|
-
};
|
|
6156
|
-
}
|
|
6157
|
-
|
|
6158
|
-
/*
|
|
6159
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6160
|
-
* All rights reserved.
|
|
6161
|
-
* SPDX-License-Identifier: MIT
|
|
6162
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6163
|
-
*/
|
|
6164
|
-
/**
|
|
6165
|
-
* EXPERIMENTAL: This function allows you to create a reactive readonly
|
|
6166
|
-
* membrane around any object value. This API is subject to change or
|
|
6167
|
-
* being removed.
|
|
6168
|
-
*/
|
|
6169
|
-
function readonly(obj) {
|
|
6170
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6171
|
-
// TODO [#1292]: Remove the readonly decorator
|
|
6172
|
-
if (arguments.length !== 1) {
|
|
6173
|
-
assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
|
|
6174
|
-
}
|
|
6175
|
-
}
|
|
6176
|
-
return getReadOnlyProxy(obj);
|
|
6177
|
-
}
|
|
6178
|
-
|
|
6179
6160
|
/*
|
|
6180
6161
|
* Copyright (c) 2022, salesforce.com, inc.
|
|
6181
6162
|
* All rights reserved.
|
|
@@ -6866,5 +6847,27 @@ function getComponentConstructor(elm) {
|
|
|
6866
6847
|
return ctor;
|
|
6867
6848
|
}
|
|
6868
6849
|
|
|
6869
|
-
|
|
6870
|
-
|
|
6850
|
+
/*
|
|
6851
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6852
|
+
* All rights reserved.
|
|
6853
|
+
* SPDX-License-Identifier: MIT
|
|
6854
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6855
|
+
*/
|
|
6856
|
+
/**
|
|
6857
|
+
* EXPERIMENTAL: This function allows you to create a reactive readonly
|
|
6858
|
+
* membrane around any object value. This API is subject to change or
|
|
6859
|
+
* being removed.
|
|
6860
|
+
*/
|
|
6861
|
+
function readonly(obj) {
|
|
6862
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6863
|
+
// TODO [#1292]: Remove the readonly decorator
|
|
6864
|
+
if (arguments.length !== 1) {
|
|
6865
|
+
assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');
|
|
6866
|
+
}
|
|
6867
|
+
}
|
|
6868
|
+
return getReadOnlyProxy(obj);
|
|
6869
|
+
}
|
|
6870
|
+
|
|
6871
|
+
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
6872
|
+
/* version: 2.38.1 */
|
|
6873
|
+
//# sourceMappingURL=engine-core.js.map
|