lwc 2.20.3 → 2.21.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.
Files changed (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +41 -61
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +41 -61
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +28 -49
  5. package/dist/engine-dom/iife/es5/engine-dom.js +49 -73
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +37 -58
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +41 -61
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +28 -49
  11. package/dist/engine-dom/umd/es5/engine-dom.js +49 -73
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +37 -58
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +144 -150
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +144 -150
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +7 -7
@@ -299,9 +299,9 @@ function htmlPropertyToAttribute(propName) {
299
299
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
300
300
  */
301
301
  // Increment whenever the LWC template compiler changes
302
- const LWC_VERSION = "2.20.3";
302
+ const LWC_VERSION = "2.21.1";
303
303
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
304
- /** version: 2.20.3 */
304
+ /** version: 2.21.1 */
305
305
 
306
306
  /*
307
307
  * Copyright (c) 2018, salesforce.com, inc.
@@ -455,7 +455,7 @@ function setFeatureFlagForTest(name, value) {
455
455
  setFeatureFlag(name, value);
456
456
  }
457
457
  }
458
- /** version: 2.20.3 */
458
+ /** version: 2.21.1 */
459
459
 
460
460
  /*
461
461
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3897,10 +3897,11 @@ function mountElement(vnode, parent, anchor, renderer) {
3897
3897
  const { sel, owner, data: { svg }, } = vnode;
3898
3898
  const { createElement } = renderer;
3899
3899
  const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3900
- const elm = createElement(sel, namespace);
3900
+ const elm = (vnode.elm = createElement(sel, namespace));
3901
3901
  linkNodeToShadow(elm, owner, renderer);
3902
- fallbackElmHook(elm, vnode, renderer);
3903
- vnode.elm = elm;
3902
+ applyStyleScoping(elm, owner, renderer);
3903
+ applyDomManual(elm, vnode);
3904
+ applyElementRestrictions(elm, vnode);
3904
3905
  patchElementPropsAndAttrs$1(null, vnode, renderer);
3905
3906
  insertNode(elm, parent, anchor, renderer);
3906
3907
  mountVNodes(vnode.children, elm, renderer, null);
@@ -3915,6 +3916,7 @@ function mountStatic(vnode, parent, anchor, renderer) {
3915
3916
  const { cloneNode, isSyntheticShadowDefined } = renderer;
3916
3917
  const elm = (vnode.elm = cloneNode(vnode.fragment, true));
3917
3918
  linkNodeToShadow(elm, owner, renderer);
3919
+ applyElementRestrictions(elm, vnode);
3918
3920
  // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3919
3921
  const { renderMode, shadowMode } = owner;
3920
3922
  if (isSyntheticShadowDefined) {
@@ -3922,10 +3924,6 @@ function mountStatic(vnode, parent, anchor, renderer) {
3922
3924
  elm[KEY__SHADOW_STATIC] = true;
3923
3925
  }
3924
3926
  }
3925
- if (process.env.NODE_ENV !== 'production') {
3926
- const isLight = renderMode === 0 /* RenderMode.Light */;
3927
- patchElementWithRestrictions(elm, { isPortal: false, isLight });
3928
- }
3929
3927
  insertNode(elm, parent, anchor, renderer);
3930
3928
  }
3931
3929
  function mountCustomElement(vnode, parent, anchor, renderer) {
@@ -3942,9 +3940,10 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
3942
3940
  // the custom element from the registry is expecting an upgrade callback
3943
3941
  vm = createViewModelHook(elm, vnode, renderer);
3944
3942
  });
3945
- linkNodeToShadow(elm, owner, renderer);
3946
3943
  vnode.elm = elm;
3947
3944
  vnode.vm = vm;
3945
+ linkNodeToShadow(elm, owner, renderer);
3946
+ applyStyleScoping(elm, owner, renderer);
3948
3947
  if (vm) {
3949
3948
  allocateChildren(vnode, vm);
3950
3949
  }
@@ -4028,22 +4027,6 @@ function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, en
4028
4027
  function isVNode(vnode) {
4029
4028
  return vnode != null;
4030
4029
  }
4031
- function observeElementChildNodes(elm) {
4032
- elm.$domManual$ = true;
4033
- }
4034
- function setElementShadowToken(elm, token) {
4035
- elm.$shadowToken$ = token;
4036
- }
4037
- // Set the scope token class for *.scoped.css styles
4038
- function setScopeTokenClassIfNecessary(elm, owner, renderer) {
4039
- const token = getScopeTokenClass(owner);
4040
- if (!isNull(token)) {
4041
- const { getClassList } = renderer;
4042
- // TODO [#2762]: this dot notation with add is probably problematic
4043
- // probably we should have a renderer api for just the add operation
4044
- getClassList(elm).add(token);
4045
- }
4046
- }
4047
4030
  function linkNodeToShadow(elm, owner, renderer) {
4048
4031
  const { renderRoot, renderMode, shadowMode } = owner;
4049
4032
  const { isSyntheticShadowDefined } = renderer;
@@ -4096,31 +4079,37 @@ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
4096
4079
  patchAttributes(oldVnode, vnode, renderer);
4097
4080
  patchProps(oldVnode, vnode, renderer);
4098
4081
  }
4099
- function fallbackElmHook(elm, vnode, renderer) {
4100
- const { owner } = vnode;
4101
- setScopeTokenClassIfNecessary(elm, owner, renderer);
4102
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4103
- const { data: { context }, } = vnode;
4104
- const { stylesheetToken } = owner.context;
4105
- if (!isUndefined$1(context) &&
4106
- !isUndefined$1(context.lwc) &&
4107
- context.lwc.dom === "manual" /* LwcDomMode.Manual */) {
4108
- // this element will now accept any manual content inserted into it
4109
- observeElementChildNodes(elm);
4110
- }
4111
- if (!isUndefined$1(stylesheetToken)) {
4112
- // when running in synthetic shadow mode, we need to set the shadowToken value
4113
- // into each element from the template, so they can be styled accordingly.
4114
- setElementShadowToken(elm, stylesheetToken);
4115
- }
4082
+ function applyStyleScoping(elm, owner, renderer) {
4083
+ // Set the class name for `*.scoped.css` style scoping.
4084
+ const scopeToken = getScopeTokenClass(owner);
4085
+ if (!isNull(scopeToken)) {
4086
+ const { getClassList } = renderer;
4087
+ // TODO [#2762]: this dot notation with add is probably problematic
4088
+ // probably we should have a renderer api for just the add operation
4089
+ getClassList(elm).add(scopeToken);
4116
4090
  }
4091
+ // Set property element for synthetic shadow DOM style scoping.
4092
+ const { stylesheetToken: syntheticToken } = owner.context;
4093
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
4094
+ elm.$shadowToken$ = syntheticToken;
4095
+ }
4096
+ }
4097
+ function applyDomManual(elm, vnode) {
4098
+ var _a;
4099
+ const { owner, data: { context }, } = vnode;
4100
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
4101
+ elm.$domManual$ = true;
4102
+ }
4103
+ }
4104
+ function applyElementRestrictions(elm, vnode) {
4105
+ var _a, _b;
4117
4106
  if (process.env.NODE_ENV !== 'production') {
4118
- const { data: { context }, } = vnode;
4119
- const isPortal = !isUndefined$1(context) &&
4120
- !isUndefined$1(context.lwc) &&
4121
- context.lwc.dom === "manual" /* LwcDomMode.Manual */;
4122
- const isLight = owner.renderMode === 0 /* RenderMode.Light */;
4123
- patchElementWithRestrictions(elm, { isPortal, isLight });
4107
+ const isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
4108
+ const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
4109
+ patchElementWithRestrictions(elm, {
4110
+ isPortal,
4111
+ isLight,
4112
+ });
4124
4113
  }
4125
4114
  }
4126
4115
  function allocateChildren(vnode, vm) {
@@ -4155,15 +4144,6 @@ function createViewModelHook(elm, vnode, renderer) {
4155
4144
  return vm;
4156
4145
  }
4157
4146
  const { sel, mode, ctor, owner } = vnode;
4158
- setScopeTokenClassIfNecessary(elm, owner, renderer);
4159
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4160
- const { stylesheetToken } = owner.context;
4161
- // when running in synthetic shadow mode, we need to set the shadowToken value
4162
- // into each element from the template, so they can be styled accordingly.
4163
- if (!isUndefined$1(stylesheetToken)) {
4164
- setElementShadowToken(elm, stylesheetToken);
4165
- }
4166
- }
4167
4147
  vm = createVM(elm, ctor, renderer, {
4168
4148
  mode,
4169
4149
  owner,
@@ -6835,7 +6815,7 @@ function getComponentConstructor(elm) {
6835
6815
  }
6836
6816
  return ctor;
6837
6817
  }
6838
- /* version: 2.20.3 */
6818
+ /* version: 2.21.1 */
6839
6819
 
6840
6820
  /*
6841
6821
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7523,6 +7503,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
7523
7503
  });
7524
7504
  freeze(LightningElement);
7525
7505
  seal(LightningElement.prototype);
7526
- /* version: 2.20.3 */
7506
+ /* version: 2.21.1 */
7527
7507
 
7528
7508
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
@@ -302,9 +302,9 @@ var LWC = (function (exports) {
302
302
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
303
303
  */
304
304
  // Increment whenever the LWC template compiler changes
305
- const LWC_VERSION = "2.20.3";
305
+ const LWC_VERSION = "2.21.1";
306
306
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
307
- /** version: 2.20.3 */
307
+ /** version: 2.21.1 */
308
308
 
309
309
  /*
310
310
  * Copyright (c) 2018, salesforce.com, inc.
@@ -458,7 +458,7 @@ var LWC = (function (exports) {
458
458
  setFeatureFlag(name, value);
459
459
  }
460
460
  }
461
- /** version: 2.20.3 */
461
+ /** version: 2.21.1 */
462
462
 
463
463
  /*
464
464
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3900,10 +3900,11 @@ var LWC = (function (exports) {
3900
3900
  const { sel, owner, data: { svg }, } = vnode;
3901
3901
  const { createElement } = renderer;
3902
3902
  const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3903
- const elm = createElement(sel, namespace);
3903
+ const elm = (vnode.elm = createElement(sel, namespace));
3904
3904
  linkNodeToShadow(elm, owner, renderer);
3905
- fallbackElmHook(elm, vnode, renderer);
3906
- vnode.elm = elm;
3905
+ applyStyleScoping(elm, owner, renderer);
3906
+ applyDomManual(elm, vnode);
3907
+ applyElementRestrictions(elm, vnode);
3907
3908
  patchElementPropsAndAttrs$1(null, vnode, renderer);
3908
3909
  insertNode(elm, parent, anchor, renderer);
3909
3910
  mountVNodes(vnode.children, elm, renderer, null);
@@ -3918,6 +3919,7 @@ var LWC = (function (exports) {
3918
3919
  const { cloneNode, isSyntheticShadowDefined } = renderer;
3919
3920
  const elm = (vnode.elm = cloneNode(vnode.fragment, true));
3920
3921
  linkNodeToShadow(elm, owner, renderer);
3922
+ applyElementRestrictions(elm, vnode);
3921
3923
  // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3922
3924
  const { renderMode, shadowMode } = owner;
3923
3925
  if (isSyntheticShadowDefined) {
@@ -3925,10 +3927,6 @@ var LWC = (function (exports) {
3925
3927
  elm[KEY__SHADOW_STATIC] = true;
3926
3928
  }
3927
3929
  }
3928
- if (process.env.NODE_ENV !== 'production') {
3929
- const isLight = renderMode === 0 /* RenderMode.Light */;
3930
- patchElementWithRestrictions(elm, { isPortal: false, isLight });
3931
- }
3932
3930
  insertNode(elm, parent, anchor, renderer);
3933
3931
  }
3934
3932
  function mountCustomElement(vnode, parent, anchor, renderer) {
@@ -3945,9 +3943,10 @@ var LWC = (function (exports) {
3945
3943
  // the custom element from the registry is expecting an upgrade callback
3946
3944
  vm = createViewModelHook(elm, vnode, renderer);
3947
3945
  });
3948
- linkNodeToShadow(elm, owner, renderer);
3949
3946
  vnode.elm = elm;
3950
3947
  vnode.vm = vm;
3948
+ linkNodeToShadow(elm, owner, renderer);
3949
+ applyStyleScoping(elm, owner, renderer);
3951
3950
  if (vm) {
3952
3951
  allocateChildren(vnode, vm);
3953
3952
  }
@@ -4031,22 +4030,6 @@ var LWC = (function (exports) {
4031
4030
  function isVNode(vnode) {
4032
4031
  return vnode != null;
4033
4032
  }
4034
- function observeElementChildNodes(elm) {
4035
- elm.$domManual$ = true;
4036
- }
4037
- function setElementShadowToken(elm, token) {
4038
- elm.$shadowToken$ = token;
4039
- }
4040
- // Set the scope token class for *.scoped.css styles
4041
- function setScopeTokenClassIfNecessary(elm, owner, renderer) {
4042
- const token = getScopeTokenClass(owner);
4043
- if (!isNull(token)) {
4044
- const { getClassList } = renderer;
4045
- // TODO [#2762]: this dot notation with add is probably problematic
4046
- // probably we should have a renderer api for just the add operation
4047
- getClassList(elm).add(token);
4048
- }
4049
- }
4050
4033
  function linkNodeToShadow(elm, owner, renderer) {
4051
4034
  const { renderRoot, renderMode, shadowMode } = owner;
4052
4035
  const { isSyntheticShadowDefined } = renderer;
@@ -4099,31 +4082,37 @@ var LWC = (function (exports) {
4099
4082
  patchAttributes(oldVnode, vnode, renderer);
4100
4083
  patchProps(oldVnode, vnode, renderer);
4101
4084
  }
4102
- function fallbackElmHook(elm, vnode, renderer) {
4103
- const { owner } = vnode;
4104
- setScopeTokenClassIfNecessary(elm, owner, renderer);
4105
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4106
- const { data: { context }, } = vnode;
4107
- const { stylesheetToken } = owner.context;
4108
- if (!isUndefined$1(context) &&
4109
- !isUndefined$1(context.lwc) &&
4110
- context.lwc.dom === "manual" /* LwcDomMode.Manual */) {
4111
- // this element will now accept any manual content inserted into it
4112
- observeElementChildNodes(elm);
4113
- }
4114
- if (!isUndefined$1(stylesheetToken)) {
4115
- // when running in synthetic shadow mode, we need to set the shadowToken value
4116
- // into each element from the template, so they can be styled accordingly.
4117
- setElementShadowToken(elm, stylesheetToken);
4118
- }
4085
+ function applyStyleScoping(elm, owner, renderer) {
4086
+ // Set the class name for `*.scoped.css` style scoping.
4087
+ const scopeToken = getScopeTokenClass(owner);
4088
+ if (!isNull(scopeToken)) {
4089
+ const { getClassList } = renderer;
4090
+ // TODO [#2762]: this dot notation with add is probably problematic
4091
+ // probably we should have a renderer api for just the add operation
4092
+ getClassList(elm).add(scopeToken);
4119
4093
  }
4094
+ // Set property element for synthetic shadow DOM style scoping.
4095
+ const { stylesheetToken: syntheticToken } = owner.context;
4096
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
4097
+ elm.$shadowToken$ = syntheticToken;
4098
+ }
4099
+ }
4100
+ function applyDomManual(elm, vnode) {
4101
+ var _a;
4102
+ const { owner, data: { context }, } = vnode;
4103
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
4104
+ elm.$domManual$ = true;
4105
+ }
4106
+ }
4107
+ function applyElementRestrictions(elm, vnode) {
4108
+ var _a, _b;
4120
4109
  if (process.env.NODE_ENV !== 'production') {
4121
- const { data: { context }, } = vnode;
4122
- const isPortal = !isUndefined$1(context) &&
4123
- !isUndefined$1(context.lwc) &&
4124
- context.lwc.dom === "manual" /* LwcDomMode.Manual */;
4125
- const isLight = owner.renderMode === 0 /* RenderMode.Light */;
4126
- patchElementWithRestrictions(elm, { isPortal, isLight });
4110
+ const isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
4111
+ const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
4112
+ patchElementWithRestrictions(elm, {
4113
+ isPortal,
4114
+ isLight,
4115
+ });
4127
4116
  }
4128
4117
  }
4129
4118
  function allocateChildren(vnode, vm) {
@@ -4158,15 +4147,6 @@ var LWC = (function (exports) {
4158
4147
  return vm;
4159
4148
  }
4160
4149
  const { sel, mode, ctor, owner } = vnode;
4161
- setScopeTokenClassIfNecessary(elm, owner, renderer);
4162
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4163
- const { stylesheetToken } = owner.context;
4164
- // when running in synthetic shadow mode, we need to set the shadowToken value
4165
- // into each element from the template, so they can be styled accordingly.
4166
- if (!isUndefined$1(stylesheetToken)) {
4167
- setElementShadowToken(elm, stylesheetToken);
4168
- }
4169
- }
4170
4150
  vm = createVM(elm, ctor, renderer, {
4171
4151
  mode,
4172
4152
  owner,
@@ -6838,7 +6818,7 @@ var LWC = (function (exports) {
6838
6818
  }
6839
6819
  return ctor;
6840
6820
  }
6841
- /* version: 2.20.3 */
6821
+ /* version: 2.21.1 */
6842
6822
 
6843
6823
  /*
6844
6824
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7526,7 +7506,7 @@ var LWC = (function (exports) {
7526
7506
  });
7527
7507
  freeze(LightningElement);
7528
7508
  seal(LightningElement.prototype);
7529
- /* version: 2.20.3 */
7509
+ /* version: 2.21.1 */
7530
7510
 
7531
7511
  exports.LightningElement = LightningElement;
7532
7512
  exports.__unstable__ProfilerControl = profilerControl;