@lwc/engine-core 2.13.2 → 2.13.3

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.
@@ -2321,6 +2321,12 @@ function checkVersionMismatch(func, type) {
2321
2321
  }
2322
2322
  }
2323
2323
 
2324
+ /*
2325
+ * Copyright (c) 2018, salesforce.com, inc.
2326
+ * All rights reserved.
2327
+ * SPDX-License-Identifier: MIT
2328
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2329
+ */
2324
2330
  const signedTemplateSet = new Set();
2325
2331
  function defaultEmptyTemplate() {
2326
2332
  return [];
@@ -2338,6 +2344,30 @@ function registerTemplate(tpl) {
2338
2344
  checkVersionMismatch(tpl, 'template');
2339
2345
  }
2340
2346
  signedTemplateSet.add(tpl);
2347
+ // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2348
+ // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2349
+ // on top of stylesheetToken for anyone who is accessing the old internal API.
2350
+ // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2351
+ shared.defineProperty(tpl, 'stylesheetTokens', {
2352
+ get() {
2353
+ const { stylesheetToken } = this;
2354
+ if (shared.isUndefined(stylesheetToken)) {
2355
+ return stylesheetToken;
2356
+ }
2357
+ // Shim for the old `stylesheetTokens` property
2358
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
2359
+ return {
2360
+ hostAttribute: `${stylesheetToken}-host`,
2361
+ shadowAttribute: stylesheetToken,
2362
+ };
2363
+ },
2364
+ set(value) {
2365
+ // If the value is null or some other exotic object, you would be broken anyway in the past
2366
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
2367
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
2368
+ this.stylesheetToken = shared.isUndefined(value) ? undefined : value.shadowAttribute;
2369
+ },
2370
+ });
2341
2371
  // chaining this method as a way to wrap existing
2342
2372
  // assignment of templates easily, without too much transformation
2343
2373
  return tpl;
@@ -6187,4 +6217,4 @@ exports.swapTemplate = swapTemplate;
6187
6217
  exports.track = track;
6188
6218
  exports.unwrap = unwrap;
6189
6219
  exports.wire = wire;
6190
- /* version: 2.13.2 */
6220
+ /* version: 2.13.3 */
@@ -2318,6 +2318,12 @@ function checkVersionMismatch(func, type) {
2318
2318
  }
2319
2319
  }
2320
2320
 
2321
+ /*
2322
+ * Copyright (c) 2018, salesforce.com, inc.
2323
+ * All rights reserved.
2324
+ * SPDX-License-Identifier: MIT
2325
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2326
+ */
2321
2327
  const signedTemplateSet = new Set();
2322
2328
  function defaultEmptyTemplate() {
2323
2329
  return [];
@@ -2335,6 +2341,30 @@ function registerTemplate(tpl) {
2335
2341
  checkVersionMismatch(tpl, 'template');
2336
2342
  }
2337
2343
  signedTemplateSet.add(tpl);
2344
+ // FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
2345
+ // the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
2346
+ // on top of stylesheetToken for anyone who is accessing the old internal API.
2347
+ // Details: https://salesforce.quip.com/v1rmAFu2cKAr
2348
+ defineProperty(tpl, 'stylesheetTokens', {
2349
+ get() {
2350
+ const { stylesheetToken } = this;
2351
+ if (isUndefined$1(stylesheetToken)) {
2352
+ return stylesheetToken;
2353
+ }
2354
+ // Shim for the old `stylesheetTokens` property
2355
+ // See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
2356
+ return {
2357
+ hostAttribute: `${stylesheetToken}-host`,
2358
+ shadowAttribute: stylesheetToken,
2359
+ };
2360
+ },
2361
+ set(value) {
2362
+ // If the value is null or some other exotic object, you would be broken anyway in the past
2363
+ // because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
2364
+ // However it may be undefined in newer versions of LWC, so we need to guard against that case.
2365
+ this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
2366
+ },
2367
+ });
2338
2368
  // chaining this method as a way to wrap existing
2339
2369
  // assignment of templates easily, without too much transformation
2340
2370
  return tpl;
@@ -6110,4 +6140,4 @@ function getComponentConstructor(elm) {
6110
6140
  }
6111
6141
 
6112
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, setInsertGlobalStylesheet, setInsertStylesheet, setIsConnected, setIsHydrating, setIsNativeShadowDefined, setIsSyntheticShadowDefined, setNextSibling, setQuerySelector, setQuerySelectorAll, setRemove, setRemoveAttribute, setRemoveEventListener, setSetAttribute, setSetCSSStyleProperty, setSetProperty, setSetText, setSsr, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6113
- /* version: 2.13.2 */
6143
+ /* version: 2.13.3 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.13.2",
3
+ "version": "2.13.3",
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.13.2",
29
- "@lwc/shared": "2.13.2"
28
+ "@lwc/features": "2.13.3",
29
+ "@lwc/shared": "2.13.3"
30
30
  },
31
31
  "devDependencies": {
32
32
  "observable-membrane": "2.0.0"