@lwc/engine-core 2.13.3 → 2.14.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 +183 -38
- package/dist/engine-core.js +183 -38
- package/package.json +3 -3
- package/types/framework/freeze-template.d.ts +2 -0
- package/types/framework/main.d.ts +2 -1
- package/types/framework/vm.d.ts +4 -4
- package/types/index.d.ts +1 -0
- package/types/renderer.d.ts +1 -4
- package/types/testFeatureFlag.d.ts +1 -0
package/dist/engine-core.cjs.js
CHANGED
|
@@ -3,8 +3,33 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var shared = require('@lwc/shared');
|
|
7
6
|
var features = require('@lwc/features');
|
|
7
|
+
var shared = require('@lwc/shared');
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
11
|
+
* All rights reserved.
|
|
12
|
+
* SPDX-License-Identifier: MIT
|
|
13
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
14
|
+
*/
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
|
|
17
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
18
|
+
window.addEventListener('test-dummy-flag', () => {
|
|
19
|
+
let hasFlag = false;
|
|
20
|
+
|
|
21
|
+
if (features.runtimeFlags.DUMMY_TEST_FLAG) {
|
|
22
|
+
hasFlag = true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
26
|
+
detail: {
|
|
27
|
+
package: '@lwc/engine-core',
|
|
28
|
+
hasFlag
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
8
33
|
|
|
9
34
|
/*
|
|
10
35
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -106,9 +131,7 @@ let HTMLElementExported;
|
|
|
106
131
|
function setHTMLElement(HTMLElementImpl) {
|
|
107
132
|
HTMLElementExported = HTMLElementImpl;
|
|
108
133
|
}
|
|
109
|
-
let isHydrating;
|
|
110
134
|
function setIsHydrating(isHydratingImpl) {
|
|
111
|
-
isHydrating = isHydratingImpl;
|
|
112
135
|
}
|
|
113
136
|
let insert;
|
|
114
137
|
function setInsert(insertImpl) {
|
|
@@ -230,10 +253,6 @@ let isConnected;
|
|
|
230
253
|
function setIsConnected(isConnectedImpl) {
|
|
231
254
|
isConnected = isConnectedImpl;
|
|
232
255
|
}
|
|
233
|
-
let insertGlobalStylesheet;
|
|
234
|
-
function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
|
|
235
|
-
insertGlobalStylesheet = insertGlobalStylesheetImpl;
|
|
236
|
-
}
|
|
237
256
|
let insertStylesheet;
|
|
238
257
|
function setInsertStylesheet(insertStylesheetImpl) {
|
|
239
258
|
insertStylesheet = insertStylesheetImpl;
|
|
@@ -2300,7 +2319,8 @@ function getDecoratorsMeta(Ctor) {
|
|
|
2300
2319
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2301
2320
|
*/
|
|
2302
2321
|
let warned = false;
|
|
2303
|
-
|
|
2322
|
+
// @ts-ignore
|
|
2323
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
2304
2324
|
// @ts-ignore
|
|
2305
2325
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2306
2326
|
warned = false;
|
|
@@ -2349,6 +2369,8 @@ function registerTemplate(tpl) {
|
|
|
2349
2369
|
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2350
2370
|
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2351
2371
|
shared.defineProperty(tpl, 'stylesheetTokens', {
|
|
2372
|
+
enumerable: true,
|
|
2373
|
+
configurable: true,
|
|
2352
2374
|
get() {
|
|
2353
2375
|
const { stylesheetToken } = this;
|
|
2354
2376
|
if (shared.isUndefined(stylesheetToken)) {
|
|
@@ -3432,16 +3454,20 @@ function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
|
3432
3454
|
}
|
|
3433
3455
|
}
|
|
3434
3456
|
function unmount(vnode, parent, doRemove = false) {
|
|
3435
|
-
const { type, elm } = vnode;
|
|
3457
|
+
const { type, elm, sel } = vnode;
|
|
3436
3458
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3437
3459
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3438
3460
|
if (doRemove) {
|
|
3439
3461
|
removeNode(elm, parent);
|
|
3440
3462
|
}
|
|
3441
3463
|
switch (type) {
|
|
3442
|
-
case 2 /* Element */:
|
|
3443
|
-
|
|
3464
|
+
case 2 /* Element */: {
|
|
3465
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3466
|
+
// Only required for synthetic shadow.
|
|
3467
|
+
const removeChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3468
|
+
unmountVNodes(vnode.children, elm, removeChildren);
|
|
3444
3469
|
break;
|
|
3470
|
+
}
|
|
3445
3471
|
case 3 /* CustomElement */: {
|
|
3446
3472
|
const { vm } = vnode;
|
|
3447
3473
|
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
@@ -4358,10 +4384,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4358
4384
|
const { renderMode, shadowMode } = vm;
|
|
4359
4385
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4360
4386
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4361
|
-
|
|
4387
|
+
insertStylesheet(stylesheets[i]);
|
|
4362
4388
|
}
|
|
4363
4389
|
}
|
|
4364
|
-
else if (ssr ||
|
|
4390
|
+
else if (ssr || vm.hydrated) {
|
|
4365
4391
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4366
4392
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4367
4393
|
// the first time the VM renders.
|
|
@@ -4372,15 +4398,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4372
4398
|
else {
|
|
4373
4399
|
// native shadow or light DOM, DOM renderer
|
|
4374
4400
|
const root = getNearestNativeShadowComponent(vm);
|
|
4375
|
-
|
|
4401
|
+
// null root means a global style
|
|
4402
|
+
const target = shared.isNull(root) ? undefined : root.shadowRoot;
|
|
4376
4403
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4377
|
-
|
|
4378
|
-
insertGlobalStylesheet(stylesheets[i]);
|
|
4379
|
-
}
|
|
4380
|
-
else {
|
|
4381
|
-
// local level
|
|
4382
|
-
insertStylesheet(stylesheets[i], root.shadowRoot);
|
|
4383
|
-
}
|
|
4404
|
+
insertStylesheet(stylesheets[i], target);
|
|
4384
4405
|
}
|
|
4385
4406
|
}
|
|
4386
4407
|
return null;
|
|
@@ -4922,13 +4943,25 @@ function removeVM(vm) {
|
|
|
4922
4943
|
|
|
4923
4944
|
resetComponentStateWhenRemoved(vm);
|
|
4924
4945
|
}
|
|
4925
|
-
function createVM(elm, ctor, options) {
|
|
4926
|
-
var _a;
|
|
4927
4946
|
|
|
4947
|
+
function getNearestShadowAncestor(vm) {
|
|
4948
|
+
let ancestor = vm.owner;
|
|
4949
|
+
|
|
4950
|
+
while (!shared.isNull(ancestor) && ancestor.renderMode === 0
|
|
4951
|
+
/* Light */
|
|
4952
|
+
) {
|
|
4953
|
+
ancestor = ancestor.owner;
|
|
4954
|
+
}
|
|
4955
|
+
|
|
4956
|
+
return ancestor;
|
|
4957
|
+
}
|
|
4958
|
+
|
|
4959
|
+
function createVM(elm, ctor, options) {
|
|
4928
4960
|
const {
|
|
4929
4961
|
mode,
|
|
4930
4962
|
owner,
|
|
4931
|
-
tagName
|
|
4963
|
+
tagName,
|
|
4964
|
+
hydrated
|
|
4932
4965
|
} = options;
|
|
4933
4966
|
const def = getComponentInternalDef(ctor);
|
|
4934
4967
|
const vm = {
|
|
@@ -4951,9 +4984,8 @@ function createVM(elm, ctor, options) {
|
|
|
4951
4984
|
cmpSlots: shared.create(null),
|
|
4952
4985
|
oar: shared.create(null),
|
|
4953
4986
|
cmpTemplate: null,
|
|
4987
|
+
hydrated: Boolean(hydrated),
|
|
4954
4988
|
renderMode: def.renderMode,
|
|
4955
|
-
shadowMode: computeShadowMode(def, owner),
|
|
4956
|
-
nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
|
|
4957
4989
|
context: {
|
|
4958
4990
|
stylesheetToken: undefined,
|
|
4959
4991
|
hasTokenInClass: undefined,
|
|
@@ -4966,6 +4998,7 @@ function createVM(elm, ctor, options) {
|
|
|
4966
4998
|
},
|
|
4967
4999
|
// Properties set right after VM creation.
|
|
4968
5000
|
tro: null,
|
|
5001
|
+
shadowMode: null,
|
|
4969
5002
|
// Properties set by the LightningElement constructor.
|
|
4970
5003
|
component: null,
|
|
4971
5004
|
shadowRoot: null,
|
|
@@ -4974,6 +5007,7 @@ function createVM(elm, ctor, options) {
|
|
|
4974
5007
|
setHook,
|
|
4975
5008
|
getHook
|
|
4976
5009
|
};
|
|
5010
|
+
vm.shadowMode = computeShadowMode(vm);
|
|
4977
5011
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
4978
5012
|
|
|
4979
5013
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4998,9 +5032,10 @@ function createVM(elm, ctor, options) {
|
|
|
4998
5032
|
return vm;
|
|
4999
5033
|
}
|
|
5000
5034
|
|
|
5001
|
-
function computeShadowMode(
|
|
5002
|
-
|
|
5003
|
-
|
|
5035
|
+
function computeShadowMode(vm) {
|
|
5036
|
+
const {
|
|
5037
|
+
def
|
|
5038
|
+
} = vm;
|
|
5004
5039
|
let shadowMode;
|
|
5005
5040
|
|
|
5006
5041
|
if (isSyntheticShadowDefined) {
|
|
@@ -5023,13 +5058,23 @@ function computeShadowMode(def, owner) {
|
|
|
5023
5058
|
/* Native */
|
|
5024
5059
|
;
|
|
5025
5060
|
} else {
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5061
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
5062
|
+
|
|
5063
|
+
if (!shared.isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5064
|
+
/* Native */
|
|
5065
|
+
) {
|
|
5066
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5067
|
+
// transitively opts all of its descendants into native.
|
|
5068
|
+
shadowMode = 0
|
|
5069
|
+
/* Native */
|
|
5070
|
+
;
|
|
5071
|
+
} else {
|
|
5072
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5073
|
+
// to be native.
|
|
5074
|
+
shadowMode = 1
|
|
5075
|
+
/* Synthetic */
|
|
5076
|
+
;
|
|
5077
|
+
}
|
|
5033
5078
|
}
|
|
5034
5079
|
} else {
|
|
5035
5080
|
shadowMode = 1
|
|
@@ -5925,6 +5970,7 @@ function hydrateCustomElement(elm, vnode) {
|
|
|
5925
5970
|
mode,
|
|
5926
5971
|
owner,
|
|
5927
5972
|
tagName: sel,
|
|
5973
|
+
hydrated: true,
|
|
5928
5974
|
});
|
|
5929
5975
|
vnode.elm = elm;
|
|
5930
5976
|
vnode.vm = vm;
|
|
@@ -6119,6 +6165,105 @@ function setHooks(hooks) {
|
|
|
6119
6165
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6120
6166
|
}
|
|
6121
6167
|
|
|
6168
|
+
/*
|
|
6169
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6170
|
+
* All rights reserved.
|
|
6171
|
+
* SPDX-License-Identifier: MIT
|
|
6172
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6173
|
+
*/
|
|
6174
|
+
// See @lwc/engine-core/src/framework/template.ts
|
|
6175
|
+
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
6176
|
+
// Via https://www.npmjs.com/package/object-observer
|
|
6177
|
+
const ARRAY_MUTATION_METHODS = [
|
|
6178
|
+
'pop',
|
|
6179
|
+
'push',
|
|
6180
|
+
'shift',
|
|
6181
|
+
'unshift',
|
|
6182
|
+
'reverse',
|
|
6183
|
+
'sort',
|
|
6184
|
+
'fill',
|
|
6185
|
+
'splice',
|
|
6186
|
+
'copyWithin',
|
|
6187
|
+
];
|
|
6188
|
+
function getOriginalArrayMethod(prop) {
|
|
6189
|
+
switch (prop) {
|
|
6190
|
+
case 'pop':
|
|
6191
|
+
return shared.ArrayPop;
|
|
6192
|
+
case 'push':
|
|
6193
|
+
return shared.ArrayPush;
|
|
6194
|
+
case 'shift':
|
|
6195
|
+
return shared.ArrayShift;
|
|
6196
|
+
case 'unshift':
|
|
6197
|
+
return shared.ArrayUnshift;
|
|
6198
|
+
case 'reverse':
|
|
6199
|
+
return shared.ArrayReverse;
|
|
6200
|
+
case 'sort':
|
|
6201
|
+
return shared.ArraySort;
|
|
6202
|
+
case 'fill':
|
|
6203
|
+
return shared.ArrayFill;
|
|
6204
|
+
case 'splice':
|
|
6205
|
+
return shared.ArraySplice;
|
|
6206
|
+
case 'copyWithin':
|
|
6207
|
+
return shared.ArrayCopyWithin;
|
|
6208
|
+
}
|
|
6209
|
+
}
|
|
6210
|
+
let mutationWarningsSilenced = false;
|
|
6211
|
+
// Warn if the user tries to mutate tmpl.stylesheets, e.g.:
|
|
6212
|
+
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
6213
|
+
function warnOnArrayMutation(stylesheets) {
|
|
6214
|
+
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
6215
|
+
// we can at least warn when they use the most common mutation methods.
|
|
6216
|
+
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
6217
|
+
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
6218
|
+
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
6219
|
+
logError(`Mutating the "stylesheets" array on a template function ` +
|
|
6220
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6221
|
+
// @ts-ignore
|
|
6222
|
+
return originalArrayMethod.apply(this, arguments);
|
|
6223
|
+
};
|
|
6224
|
+
}
|
|
6225
|
+
}
|
|
6226
|
+
// TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
|
|
6227
|
+
// just warns on mutation.
|
|
6228
|
+
function freezeTemplate(tmpl) {
|
|
6229
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6230
|
+
if (!shared.isUndefined(tmpl.stylesheets)) {
|
|
6231
|
+
warnOnArrayMutation(tmpl.stylesheets);
|
|
6232
|
+
}
|
|
6233
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
6234
|
+
let value = tmpl[prop];
|
|
6235
|
+
shared.defineProperty(tmpl, prop, {
|
|
6236
|
+
enumerable: true,
|
|
6237
|
+
configurable: true,
|
|
6238
|
+
get() {
|
|
6239
|
+
return value;
|
|
6240
|
+
},
|
|
6241
|
+
set(newValue) {
|
|
6242
|
+
if (!mutationWarningsSilenced) {
|
|
6243
|
+
logError(`Dynamically setting the "${prop}" property on a template function ` +
|
|
6244
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6245
|
+
}
|
|
6246
|
+
value = newValue;
|
|
6247
|
+
},
|
|
6248
|
+
});
|
|
6249
|
+
}
|
|
6250
|
+
const originalDescriptor = shared.getOwnPropertyDescriptor(tmpl, 'stylesheetTokens');
|
|
6251
|
+
shared.defineProperty(tmpl, 'stylesheetTokens', {
|
|
6252
|
+
enumerable: true,
|
|
6253
|
+
configurable: true,
|
|
6254
|
+
get: originalDescriptor.get,
|
|
6255
|
+
set(value) {
|
|
6256
|
+
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` +
|
|
6257
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6258
|
+
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
6259
|
+
mutationWarningsSilenced = true;
|
|
6260
|
+
originalDescriptor.set.call(this, value);
|
|
6261
|
+
mutationWarningsSilenced = false;
|
|
6262
|
+
},
|
|
6263
|
+
});
|
|
6264
|
+
}
|
|
6265
|
+
}
|
|
6266
|
+
|
|
6122
6267
|
/*
|
|
6123
6268
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6124
6269
|
* All rights reserved.
|
|
@@ -6157,6 +6302,7 @@ exports.connectRootElement = connectRootElement;
|
|
|
6157
6302
|
exports.createContextProvider = createContextProvider;
|
|
6158
6303
|
exports.createVM = createVM;
|
|
6159
6304
|
exports.disconnectRootElement = disconnectRootElement;
|
|
6305
|
+
exports.freezeTemplate = freezeTemplate;
|
|
6160
6306
|
exports.getAssociatedVMIfPresent = getAssociatedVMIfPresent;
|
|
6161
6307
|
exports.getComponentConstructor = getComponentConstructor;
|
|
6162
6308
|
exports.getComponentDef = getComponentDef;
|
|
@@ -6194,7 +6340,6 @@ exports.setGetProperty = setGetProperty;
|
|
|
6194
6340
|
exports.setHTMLElement = setHTMLElement;
|
|
6195
6341
|
exports.setHooks = setHooks;
|
|
6196
6342
|
exports.setInsert = setInsert;
|
|
6197
|
-
exports.setInsertGlobalStylesheet = setInsertGlobalStylesheet;
|
|
6198
6343
|
exports.setInsertStylesheet = setInsertStylesheet;
|
|
6199
6344
|
exports.setIsConnected = setIsConnected;
|
|
6200
6345
|
exports.setIsHydrating = setIsHydrating;
|
|
@@ -6217,4 +6362,4 @@ exports.swapTemplate = swapTemplate;
|
|
|
6217
6362
|
exports.track = track;
|
|
6218
6363
|
exports.unwrap = unwrap;
|
|
6219
6364
|
exports.wire = wire;
|
|
6220
|
-
/* version: 2.
|
|
6365
|
+
/* version: 2.14.1 */
|
package/dist/engine-core.js
CHANGED
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
/* proxy-compat-disable */
|
|
2
|
-
import { seal, create, isFunction as isFunction$1, ArrayPush as ArrayPush$1, isUndefined as isUndefined$1, ArrayIndexOf, ArraySplice, StringToLowerCase, ArrayJoin, isNull, isFrozen, defineProperty, hasOwnProperty as hasOwnProperty$1, assign, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, isObject, assert, KEY__SYNTHETIC_MODE, toString as toString$1, isFalse, isTrue, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, freeze, htmlPropertyToAttribute, ArraySlice, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, SVG_NAMESPACE, KEY__SHADOW_RESOLVER, isArray as isArray$1, isNumber, StringReplace, KEY__SCOPED_CSS, noop, ArrayUnshift } from '@lwc/shared';
|
|
3
2
|
import { runtimeFlags } from '@lwc/features';
|
|
4
3
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
4
|
+
import { seal, create, isFunction as isFunction$1, ArrayPush as ArrayPush$1, isUndefined as isUndefined$1, ArrayIndexOf, ArraySplice, StringToLowerCase, ArrayJoin, isNull, isFrozen, defineProperty, hasOwnProperty as hasOwnProperty$1, assign, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, isObject, assert, KEY__SYNTHETIC_MODE, toString as toString$1, isFalse, isTrue, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, freeze, htmlPropertyToAttribute, ArraySlice, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, SVG_NAMESPACE, KEY__SHADOW_RESOLVER, isArray as isArray$1, isNumber, StringReplace, KEY__SCOPED_CSS, noop, ArrayUnshift, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift, ArrayPop } from '@lwc/shared';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8
|
+
* All rights reserved.
|
|
9
|
+
* SPDX-License-Identifier: MIT
|
|
10
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
11
|
+
*/
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
|
|
14
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
15
|
+
window.addEventListener('test-dummy-flag', () => {
|
|
16
|
+
let hasFlag = false;
|
|
17
|
+
|
|
18
|
+
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
19
|
+
hasFlag = true;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
23
|
+
detail: {
|
|
24
|
+
package: '@lwc/engine-core',
|
|
25
|
+
hasFlag
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
5
30
|
|
|
6
31
|
/*
|
|
7
32
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -103,9 +128,7 @@ let HTMLElementExported;
|
|
|
103
128
|
function setHTMLElement(HTMLElementImpl) {
|
|
104
129
|
HTMLElementExported = HTMLElementImpl;
|
|
105
130
|
}
|
|
106
|
-
let isHydrating;
|
|
107
131
|
function setIsHydrating(isHydratingImpl) {
|
|
108
|
-
isHydrating = isHydratingImpl;
|
|
109
132
|
}
|
|
110
133
|
let insert;
|
|
111
134
|
function setInsert(insertImpl) {
|
|
@@ -227,10 +250,6 @@ let isConnected;
|
|
|
227
250
|
function setIsConnected(isConnectedImpl) {
|
|
228
251
|
isConnected = isConnectedImpl;
|
|
229
252
|
}
|
|
230
|
-
let insertGlobalStylesheet;
|
|
231
|
-
function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
|
|
232
|
-
insertGlobalStylesheet = insertGlobalStylesheetImpl;
|
|
233
|
-
}
|
|
234
253
|
let insertStylesheet;
|
|
235
254
|
function setInsertStylesheet(insertStylesheetImpl) {
|
|
236
255
|
insertStylesheet = insertStylesheetImpl;
|
|
@@ -2297,7 +2316,8 @@ function getDecoratorsMeta(Ctor) {
|
|
|
2297
2316
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2298
2317
|
*/
|
|
2299
2318
|
let warned = false;
|
|
2300
|
-
|
|
2319
|
+
// @ts-ignore
|
|
2320
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
2301
2321
|
// @ts-ignore
|
|
2302
2322
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2303
2323
|
warned = false;
|
|
@@ -2346,6 +2366,8 @@ function registerTemplate(tpl) {
|
|
|
2346
2366
|
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2347
2367
|
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2348
2368
|
defineProperty(tpl, 'stylesheetTokens', {
|
|
2369
|
+
enumerable: true,
|
|
2370
|
+
configurable: true,
|
|
2349
2371
|
get() {
|
|
2350
2372
|
const { stylesheetToken } = this;
|
|
2351
2373
|
if (isUndefined$1(stylesheetToken)) {
|
|
@@ -3429,16 +3451,20 @@ function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
|
3429
3451
|
}
|
|
3430
3452
|
}
|
|
3431
3453
|
function unmount(vnode, parent, doRemove = false) {
|
|
3432
|
-
const { type, elm } = vnode;
|
|
3454
|
+
const { type, elm, sel } = vnode;
|
|
3433
3455
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3434
3456
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3435
3457
|
if (doRemove) {
|
|
3436
3458
|
removeNode(elm, parent);
|
|
3437
3459
|
}
|
|
3438
3460
|
switch (type) {
|
|
3439
|
-
case 2 /* Element */:
|
|
3440
|
-
|
|
3461
|
+
case 2 /* Element */: {
|
|
3462
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3463
|
+
// Only required for synthetic shadow.
|
|
3464
|
+
const removeChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3465
|
+
unmountVNodes(vnode.children, elm, removeChildren);
|
|
3441
3466
|
break;
|
|
3467
|
+
}
|
|
3442
3468
|
case 3 /* CustomElement */: {
|
|
3443
3469
|
const { vm } = vnode;
|
|
3444
3470
|
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
@@ -4355,10 +4381,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4355
4381
|
const { renderMode, shadowMode } = vm;
|
|
4356
4382
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4357
4383
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4358
|
-
|
|
4384
|
+
insertStylesheet(stylesheets[i]);
|
|
4359
4385
|
}
|
|
4360
4386
|
}
|
|
4361
|
-
else if (ssr ||
|
|
4387
|
+
else if (ssr || vm.hydrated) {
|
|
4362
4388
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4363
4389
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4364
4390
|
// the first time the VM renders.
|
|
@@ -4369,15 +4395,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4369
4395
|
else {
|
|
4370
4396
|
// native shadow or light DOM, DOM renderer
|
|
4371
4397
|
const root = getNearestNativeShadowComponent(vm);
|
|
4372
|
-
|
|
4398
|
+
// null root means a global style
|
|
4399
|
+
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4373
4400
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4374
|
-
|
|
4375
|
-
insertGlobalStylesheet(stylesheets[i]);
|
|
4376
|
-
}
|
|
4377
|
-
else {
|
|
4378
|
-
// local level
|
|
4379
|
-
insertStylesheet(stylesheets[i], root.shadowRoot);
|
|
4380
|
-
}
|
|
4401
|
+
insertStylesheet(stylesheets[i], target);
|
|
4381
4402
|
}
|
|
4382
4403
|
}
|
|
4383
4404
|
return null;
|
|
@@ -4919,13 +4940,25 @@ function removeVM(vm) {
|
|
|
4919
4940
|
|
|
4920
4941
|
resetComponentStateWhenRemoved(vm);
|
|
4921
4942
|
}
|
|
4922
|
-
function createVM(elm, ctor, options) {
|
|
4923
|
-
var _a;
|
|
4924
4943
|
|
|
4944
|
+
function getNearestShadowAncestor(vm) {
|
|
4945
|
+
let ancestor = vm.owner;
|
|
4946
|
+
|
|
4947
|
+
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
4948
|
+
/* Light */
|
|
4949
|
+
) {
|
|
4950
|
+
ancestor = ancestor.owner;
|
|
4951
|
+
}
|
|
4952
|
+
|
|
4953
|
+
return ancestor;
|
|
4954
|
+
}
|
|
4955
|
+
|
|
4956
|
+
function createVM(elm, ctor, options) {
|
|
4925
4957
|
const {
|
|
4926
4958
|
mode,
|
|
4927
4959
|
owner,
|
|
4928
|
-
tagName
|
|
4960
|
+
tagName,
|
|
4961
|
+
hydrated
|
|
4929
4962
|
} = options;
|
|
4930
4963
|
const def = getComponentInternalDef(ctor);
|
|
4931
4964
|
const vm = {
|
|
@@ -4948,9 +4981,8 @@ function createVM(elm, ctor, options) {
|
|
|
4948
4981
|
cmpSlots: create(null),
|
|
4949
4982
|
oar: create(null),
|
|
4950
4983
|
cmpTemplate: null,
|
|
4984
|
+
hydrated: Boolean(hydrated),
|
|
4951
4985
|
renderMode: def.renderMode,
|
|
4952
|
-
shadowMode: computeShadowMode(def, owner),
|
|
4953
|
-
nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
|
|
4954
4986
|
context: {
|
|
4955
4987
|
stylesheetToken: undefined,
|
|
4956
4988
|
hasTokenInClass: undefined,
|
|
@@ -4963,6 +4995,7 @@ function createVM(elm, ctor, options) {
|
|
|
4963
4995
|
},
|
|
4964
4996
|
// Properties set right after VM creation.
|
|
4965
4997
|
tro: null,
|
|
4998
|
+
shadowMode: null,
|
|
4966
4999
|
// Properties set by the LightningElement constructor.
|
|
4967
5000
|
component: null,
|
|
4968
5001
|
shadowRoot: null,
|
|
@@ -4971,6 +5004,7 @@ function createVM(elm, ctor, options) {
|
|
|
4971
5004
|
setHook,
|
|
4972
5005
|
getHook
|
|
4973
5006
|
};
|
|
5007
|
+
vm.shadowMode = computeShadowMode(vm);
|
|
4974
5008
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
4975
5009
|
|
|
4976
5010
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4995,9 +5029,10 @@ function createVM(elm, ctor, options) {
|
|
|
4995
5029
|
return vm;
|
|
4996
5030
|
}
|
|
4997
5031
|
|
|
4998
|
-
function computeShadowMode(
|
|
4999
|
-
|
|
5000
|
-
|
|
5032
|
+
function computeShadowMode(vm) {
|
|
5033
|
+
const {
|
|
5034
|
+
def
|
|
5035
|
+
} = vm;
|
|
5001
5036
|
let shadowMode;
|
|
5002
5037
|
|
|
5003
5038
|
if (isSyntheticShadowDefined) {
|
|
@@ -5020,13 +5055,23 @@ function computeShadowMode(def, owner) {
|
|
|
5020
5055
|
/* Native */
|
|
5021
5056
|
;
|
|
5022
5057
|
} else {
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5058
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
5059
|
+
|
|
5060
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5061
|
+
/* Native */
|
|
5062
|
+
) {
|
|
5063
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5064
|
+
// transitively opts all of its descendants into native.
|
|
5065
|
+
shadowMode = 0
|
|
5066
|
+
/* Native */
|
|
5067
|
+
;
|
|
5068
|
+
} else {
|
|
5069
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5070
|
+
// to be native.
|
|
5071
|
+
shadowMode = 1
|
|
5072
|
+
/* Synthetic */
|
|
5073
|
+
;
|
|
5074
|
+
}
|
|
5030
5075
|
}
|
|
5031
5076
|
} else {
|
|
5032
5077
|
shadowMode = 1
|
|
@@ -5922,6 +5967,7 @@ function hydrateCustomElement(elm, vnode) {
|
|
|
5922
5967
|
mode,
|
|
5923
5968
|
owner,
|
|
5924
5969
|
tagName: sel,
|
|
5970
|
+
hydrated: true,
|
|
5925
5971
|
});
|
|
5926
5972
|
vnode.elm = elm;
|
|
5927
5973
|
vnode.vm = vm;
|
|
@@ -6116,6 +6162,105 @@ function setHooks(hooks) {
|
|
|
6116
6162
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6117
6163
|
}
|
|
6118
6164
|
|
|
6165
|
+
/*
|
|
6166
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6167
|
+
* All rights reserved.
|
|
6168
|
+
* SPDX-License-Identifier: MIT
|
|
6169
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6170
|
+
*/
|
|
6171
|
+
// See @lwc/engine-core/src/framework/template.ts
|
|
6172
|
+
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
6173
|
+
// Via https://www.npmjs.com/package/object-observer
|
|
6174
|
+
const ARRAY_MUTATION_METHODS = [
|
|
6175
|
+
'pop',
|
|
6176
|
+
'push',
|
|
6177
|
+
'shift',
|
|
6178
|
+
'unshift',
|
|
6179
|
+
'reverse',
|
|
6180
|
+
'sort',
|
|
6181
|
+
'fill',
|
|
6182
|
+
'splice',
|
|
6183
|
+
'copyWithin',
|
|
6184
|
+
];
|
|
6185
|
+
function getOriginalArrayMethod(prop) {
|
|
6186
|
+
switch (prop) {
|
|
6187
|
+
case 'pop':
|
|
6188
|
+
return ArrayPop;
|
|
6189
|
+
case 'push':
|
|
6190
|
+
return ArrayPush$1;
|
|
6191
|
+
case 'shift':
|
|
6192
|
+
return ArrayShift;
|
|
6193
|
+
case 'unshift':
|
|
6194
|
+
return ArrayUnshift;
|
|
6195
|
+
case 'reverse':
|
|
6196
|
+
return ArrayReverse;
|
|
6197
|
+
case 'sort':
|
|
6198
|
+
return ArraySort;
|
|
6199
|
+
case 'fill':
|
|
6200
|
+
return ArrayFill;
|
|
6201
|
+
case 'splice':
|
|
6202
|
+
return ArraySplice;
|
|
6203
|
+
case 'copyWithin':
|
|
6204
|
+
return ArrayCopyWithin;
|
|
6205
|
+
}
|
|
6206
|
+
}
|
|
6207
|
+
let mutationWarningsSilenced = false;
|
|
6208
|
+
// Warn if the user tries to mutate tmpl.stylesheets, e.g.:
|
|
6209
|
+
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
6210
|
+
function warnOnArrayMutation(stylesheets) {
|
|
6211
|
+
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
6212
|
+
// we can at least warn when they use the most common mutation methods.
|
|
6213
|
+
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
6214
|
+
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
6215
|
+
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
6216
|
+
logError(`Mutating the "stylesheets" array on a template function ` +
|
|
6217
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6218
|
+
// @ts-ignore
|
|
6219
|
+
return originalArrayMethod.apply(this, arguments);
|
|
6220
|
+
};
|
|
6221
|
+
}
|
|
6222
|
+
}
|
|
6223
|
+
// TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
|
|
6224
|
+
// just warns on mutation.
|
|
6225
|
+
function freezeTemplate(tmpl) {
|
|
6226
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6227
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6228
|
+
warnOnArrayMutation(tmpl.stylesheets);
|
|
6229
|
+
}
|
|
6230
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
6231
|
+
let value = tmpl[prop];
|
|
6232
|
+
defineProperty(tmpl, prop, {
|
|
6233
|
+
enumerable: true,
|
|
6234
|
+
configurable: true,
|
|
6235
|
+
get() {
|
|
6236
|
+
return value;
|
|
6237
|
+
},
|
|
6238
|
+
set(newValue) {
|
|
6239
|
+
if (!mutationWarningsSilenced) {
|
|
6240
|
+
logError(`Dynamically setting the "${prop}" property on a template function ` +
|
|
6241
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6242
|
+
}
|
|
6243
|
+
value = newValue;
|
|
6244
|
+
},
|
|
6245
|
+
});
|
|
6246
|
+
}
|
|
6247
|
+
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
6248
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6249
|
+
enumerable: true,
|
|
6250
|
+
configurable: true,
|
|
6251
|
+
get: originalDescriptor.get,
|
|
6252
|
+
set(value) {
|
|
6253
|
+
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` +
|
|
6254
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6255
|
+
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
6256
|
+
mutationWarningsSilenced = true;
|
|
6257
|
+
originalDescriptor.set.call(this, value);
|
|
6258
|
+
mutationWarningsSilenced = false;
|
|
6259
|
+
},
|
|
6260
|
+
});
|
|
6261
|
+
}
|
|
6262
|
+
}
|
|
6263
|
+
|
|
6119
6264
|
/*
|
|
6120
6265
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6121
6266
|
* All rights reserved.
|
|
@@ -6139,5 +6284,5 @@ function getComponentConstructor(elm) {
|
|
|
6139
6284
|
return ctor;
|
|
6140
6285
|
}
|
|
6141
6286
|
|
|
6142
|
-
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, getUpgradableConstructor, hydrateRoot, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setAddEventListener, setAssertInstanceOfHTMLElement, setAttachShadow, setCreateComment, setCreateElement, setCreateText, setDefineCustomElement, setDispatchEvent, setGetAttribute, setGetBoundingClientRect, setGetChildNodes, setGetChildren, setGetClassList, setGetCustomElement, setGetElementsByClassName, setGetElementsByTagName, setGetFirstChild, setGetFirstElementChild, setGetLastChild, setGetLastElementChild, setGetProperty, setHTMLElement, setHooks, setInsert,
|
|
6143
|
-
/* version: 2.
|
|
6287
|
+
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, getUpgradableConstructor, hydrateRoot, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setAddEventListener, setAssertInstanceOfHTMLElement, setAttachShadow, setCreateComment, setCreateElement, setCreateText, setDefineCustomElement, setDispatchEvent, setGetAttribute, setGetBoundingClientRect, setGetChildNodes, setGetChildren, setGetClassList, setGetCustomElement, setGetElementsByClassName, setGetElementsByTagName, setGetFirstChild, setGetFirstElementChild, setGetLastChild, setGetLastElementChild, setGetProperty, setHTMLElement, setHooks, setInsert, setInsertStylesheet, setIsConnected, setIsHydrating, setIsNativeShadowDefined, setIsSyntheticShadowDefined, setNextSibling, setQuerySelector, setQuerySelectorAll, setRemove, setRemoveAttribute, setRemoveEventListener, setSetAttribute, setSetCSSStyleProperty, setSetProperty, setSetText, setSsr, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
6288
|
+
/* version: 2.14.1 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwc/engine-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.1",
|
|
4
4
|
"description": "Core LWC engine APIs.",
|
|
5
5
|
"homepage": "https://lwc.dev/",
|
|
6
6
|
"repository": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"types/"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@lwc/features": "2.
|
|
29
|
-
"@lwc/shared": "2.
|
|
28
|
+
"@lwc/features": "2.14.1",
|
|
29
|
+
"@lwc/shared": "2.14.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"observable-membrane": "2.0.0"
|
|
@@ -19,6 +19,7 @@ export { profilerControl as __unstable__ProfilerControl } from './profiler';
|
|
|
19
19
|
export { getUpgradableConstructor } from './upgradable-element';
|
|
20
20
|
export { swapTemplate, swapComponent, swapStyle } from './hot-swaps';
|
|
21
21
|
export { setHooks } from './overridable-hooks';
|
|
22
|
+
export { freezeTemplate } from './freeze-template';
|
|
22
23
|
export { getComponentConstructor } from './get-component-constructor';
|
|
23
24
|
export type { ConfigValue as WireConfigValue, ContextValue as WireContextValue, DataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, } from './wiring';
|
|
24
|
-
export { setAssertInstanceOfHTMLElement, setAttachShadow, setCreateComment, setCreateElement, setCreateText, setDefineCustomElement, setDispatchEvent, setGetAttribute, setGetBoundingClientRect, setGetChildNodes, setGetChildren, setGetClassList, setGetCustomElement, setGetElementsByClassName, setGetElementsByTagName, setGetFirstChild, setGetFirstElementChild, setGetLastChild, setGetLastElementChild, setGetProperty, setHTMLElement, setInsert,
|
|
25
|
+
export { setAssertInstanceOfHTMLElement, setAttachShadow, setCreateComment, setCreateElement, setCreateText, setDefineCustomElement, setDispatchEvent, setGetAttribute, setGetBoundingClientRect, setGetChildNodes, setGetChildren, setGetClassList, setGetCustomElement, setGetElementsByClassName, setGetElementsByTagName, setGetFirstChild, setGetFirstElementChild, setGetLastChild, setGetLastElementChild, setGetProperty, setHTMLElement, setInsert, setIsConnected, setIsHydrating, setIsNativeShadowDefined, setIsSyntheticShadowDefined, setNextSibling, setQuerySelector, setQuerySelectorAll, setRemove, setRemoveAttribute, setRemoveEventListener, setSetAttribute, setSetCSSStyleProperty, setSetProperty, setSetText, setSsr, setAddEventListener, setInsertStylesheet, } from '../renderer';
|
package/types/framework/vm.d.ts
CHANGED
|
@@ -62,12 +62,11 @@ export interface VM<N = HostNode, E = HostElement> {
|
|
|
62
62
|
readonly context: Context;
|
|
63
63
|
/** The owner VM or null for root elements. */
|
|
64
64
|
readonly owner: VM<N, E> | null;
|
|
65
|
+
/** Whether or not the VM was hydrated */
|
|
66
|
+
readonly hydrated: boolean;
|
|
65
67
|
/** Rendering operations associated with the VM */
|
|
66
|
-
|
|
68
|
+
renderMode: RenderMode;
|
|
67
69
|
shadowMode: ShadowMode;
|
|
68
|
-
/** Transitive support for native Shadow DOM. A component in native mode
|
|
69
|
-
* transitively opts all of its descendants into native. */
|
|
70
|
-
readonly nearestShadowMode: ShadowMode | null;
|
|
71
70
|
/** The component creation index. */
|
|
72
71
|
idx: number;
|
|
73
72
|
/** Component state, analogous to Element.isConnected */
|
|
@@ -133,6 +132,7 @@ export declare function createVM<HostNode, HostElement>(elm: HostElement, ctor:
|
|
|
133
132
|
mode: ShadowRootMode;
|
|
134
133
|
owner: VM<HostNode, HostElement> | null;
|
|
135
134
|
tagName: string;
|
|
135
|
+
hydrated?: boolean;
|
|
136
136
|
}): VM;
|
|
137
137
|
export declare function associateVM(obj: VMAssociable, vm: VM): void;
|
|
138
138
|
export declare function getAssociatedVM(obj: VMAssociable): VM;
|
package/types/index.d.ts
CHANGED
package/types/renderer.d.ts
CHANGED
|
@@ -105,10 +105,7 @@ export declare function setGetLastElementChild(getLastElementChildImpl: getLastE
|
|
|
105
105
|
declare type isConnectedFunc = (node: N) => boolean;
|
|
106
106
|
export declare let isConnected: isConnectedFunc;
|
|
107
107
|
export declare function setIsConnected(isConnectedImpl: isConnectedFunc): void;
|
|
108
|
-
declare type
|
|
109
|
-
export declare let insertGlobalStylesheet: insertGlobalStylesheetFunc;
|
|
110
|
-
export declare function setInsertGlobalStylesheet(insertGlobalStylesheetImpl: insertGlobalStylesheetFunc): void;
|
|
111
|
-
declare type insertStylesheetFunc = (content: string, target: ShadowRoot) => void;
|
|
108
|
+
declare type insertStylesheetFunc = (content: string, target?: ShadowRoot) => void;
|
|
112
109
|
export declare let insertStylesheet: insertStylesheetFunc;
|
|
113
110
|
export declare function setInsertStylesheet(insertStylesheetImpl: insertStylesheetFunc): void;
|
|
114
111
|
declare type assertInstanceOfHTMLElementFunc = (elm: any, msg: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|