lwc 2.37.2 → 2.38.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.
Files changed (85) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +241 -125
  2. package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -0
  3. package/dist/engine-dom/iife/es2017/engine-dom.js +241 -125
  4. package/dist/engine-dom/iife/es2017/engine-dom.js.map +1 -0
  5. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -1
  6. package/dist/engine-dom/iife/es2017/engine-dom.min.js.map +1 -0
  7. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +178 -112
  8. package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -0
  9. package/dist/engine-dom/iife/es5/engine-dom.js +274 -153
  10. package/dist/engine-dom/iife/es5/engine-dom.js.map +1 -0
  11. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -1
  12. package/dist/engine-dom/iife/es5/engine-dom.min.js.map +1 -0
  13. package/dist/engine-dom/iife/es5/engine-dom_debug.js +208 -140
  14. package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -0
  15. package/dist/engine-dom/umd/es2017/engine-dom.js +241 -125
  16. package/dist/engine-dom/umd/es2017/engine-dom.js.map +1 -0
  17. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -1
  18. package/dist/engine-dom/umd/es2017/engine-dom.min.js.map +1 -0
  19. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +178 -112
  20. package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -0
  21. package/dist/engine-dom/umd/es5/engine-dom.js +274 -153
  22. package/dist/engine-dom/umd/es5/engine-dom.js.map +1 -0
  23. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -1
  24. package/dist/engine-dom/umd/es5/engine-dom.min.js.map +1 -0
  25. package/dist/engine-dom/umd/es5/engine-dom_debug.js +208 -140
  26. package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -0
  27. package/dist/engine-server/commonjs/es2017/engine-server.js +161 -122
  28. package/dist/engine-server/commonjs/es2017/engine-server.js.map +1 -0
  29. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -1
  30. package/dist/engine-server/commonjs/es2017/engine-server.min.js.map +1 -0
  31. package/dist/engine-server/esm/es2017/engine-server.js +161 -122
  32. package/dist/engine-server/esm/es2017/engine-server.js.map +1 -0
  33. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +12 -5
  34. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +1 -0
  35. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +12 -5
  36. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js.map +1 -0
  37. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -1
  38. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js.map +1 -0
  39. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +12 -5
  40. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +1 -0
  41. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +8 -5
  42. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +1 -0
  43. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -1
  44. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js.map +1 -0
  45. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +8 -5
  46. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +1 -0
  47. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +12 -5
  48. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js.map +1 -0
  49. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +3 -2
  50. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js.map +1 -0
  51. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +12 -5
  52. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +1 -0
  53. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +8 -5
  54. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +1 -0
  55. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -1
  56. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js.map +1 -0
  57. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +8 -5
  58. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js.map +1 -0
  59. package/dist/wire-service/esm/es2017/wire-service.js +3 -2
  60. package/dist/wire-service/esm/es2017/wire-service.js.map +1 -0
  61. package/dist/wire-service/iife/es2017/wire-service.js +3 -2
  62. package/dist/wire-service/iife/es2017/wire-service.js.map +1 -0
  63. package/dist/wire-service/iife/es2017/wire-service.min.js +1 -0
  64. package/dist/wire-service/iife/es2017/wire-service.min.js.map +1 -0
  65. package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -2
  66. package/dist/wire-service/iife/es2017/wire-service_debug.js.map +1 -0
  67. package/dist/wire-service/iife/es5/wire-service.js +3 -2
  68. package/dist/wire-service/iife/es5/wire-service.js.map +1 -0
  69. package/dist/wire-service/iife/es5/wire-service.min.js +1 -0
  70. package/dist/wire-service/iife/es5/wire-service.min.js.map +1 -0
  71. package/dist/wire-service/iife/es5/wire-service_debug.js +3 -2
  72. package/dist/wire-service/iife/es5/wire-service_debug.js.map +1 -0
  73. package/dist/wire-service/umd/es2017/wire-service.js +3 -2
  74. package/dist/wire-service/umd/es2017/wire-service.js.map +1 -0
  75. package/dist/wire-service/umd/es2017/wire-service.min.js +1 -0
  76. package/dist/wire-service/umd/es2017/wire-service.min.js.map +1 -0
  77. package/dist/wire-service/umd/es2017/wire-service_debug.js +3 -2
  78. package/dist/wire-service/umd/es2017/wire-service_debug.js.map +1 -0
  79. package/dist/wire-service/umd/es5/wire-service.js +3 -2
  80. package/dist/wire-service/umd/es5/wire-service.js.map +1 -0
  81. package/dist/wire-service/umd/es5/wire-service.min.js +1 -0
  82. package/dist/wire-service/umd/es5/wire-service.min.js.map +1 -0
  83. package/dist/wire-service/umd/es5/wire-service_debug.js +3 -2
  84. package/dist/wire-service/umd/es5/wire-service_debug.js.map +1 -0
  85. package/package.json +7 -7
@@ -323,6 +323,27 @@
323
323
  return propertyName;
324
324
  }
325
325
 
326
+ /*
327
+ * Copyright (c) 2020, salesforce.com, inc.
328
+ * All rights reserved.
329
+ * SPDX-License-Identifier: MIT
330
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
331
+ */
332
+ var ESCAPED_CHARS = {
333
+ '"': '"',
334
+ "'": ''',
335
+ '<': '&lt;',
336
+ '>': '&gt;',
337
+ '&': '&amp;'
338
+ };
339
+ function htmlEscape(str) {
340
+ var attrMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
341
+ var searchValue = attrMode ? /["&]/g : /["'<>&]/g;
342
+ return str.replace(searchValue, function (char) {
343
+ return ESCAPED_CHARS[char];
344
+ });
345
+ }
346
+
326
347
  /*
327
348
  * Copyright (c) 2018, salesforce.com, inc.
328
349
  * All rights reserved.
@@ -330,9 +351,9 @@
330
351
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
331
352
  */
332
353
  // Increment whenever the LWC template compiler changes
333
- var LWC_VERSION = "2.37.2";
354
+ var LWC_VERSION = "2.38.0";
334
355
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
335
- /** version: 2.37.2 */
356
+ /** version: 2.38.0 */
336
357
 
337
358
  /**
338
359
  * Copyright (C) 2018 salesforce.com, inc.
@@ -413,7 +434,7 @@
413
434
  setFeatureFlag(name, value);
414
435
  }
415
436
  }
416
- /** version: 2.37.2 */
437
+ /** version: 2.38.0 */
417
438
 
418
439
  /**
419
440
  * Copyright (C) 2018 salesforce.com, inc.
@@ -477,7 +498,7 @@
477
498
  }
478
499
  }
479
500
  }
480
- /** version: 2.37.2 */
501
+ /** version: 2.38.0 */
481
502
 
482
503
  /*
483
504
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2442,6 +2463,14 @@
2442
2463
  }
2443
2464
  return renderer.getLastElementChild(vm.elm);
2444
2465
  },
2466
+ get ownerDocument() {
2467
+ var vm = getAssociatedVM(this);
2468
+ var renderer = vm.renderer;
2469
+ if (process.env.NODE_ENV !== 'production') {
2470
+ warnIfInvokedDuringConstruction(vm, 'ownerDocument');
2471
+ }
2472
+ return renderer.ownerDocument(vm.elm);
2473
+ },
2445
2474
  render: function render() {
2446
2475
  var vm = getAssociatedVM(this);
2447
2476
  return vm.def.template;
@@ -2516,39 +2545,91 @@
2516
2545
  }
2517
2546
 
2518
2547
  /*
2519
- * Copyright (c) 2018, salesforce.com, inc.
2548
+ * Copyright (c) 2023, salesforce.com, inc.
2520
2549
  * All rights reserved.
2521
2550
  * SPDX-License-Identifier: MIT
2522
2551
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2523
2552
  */
2524
- var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
2525
- var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
2526
- var WIRE_DEBUG_ENTRY = '@wire';
2527
- var WireMetaMap = new Map();
2528
- var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
2529
- _inherits(WireContextRegistrationEvent, _CustomEvent);
2530
- var _super3 = _createSuper(WireContextRegistrationEvent);
2531
- function WireContextRegistrationEvent(adapterToken, _ref3) {
2532
- var _this2;
2533
- var setNewContext = _ref3.setNewContext,
2534
- setDisconnectedCallback = _ref3.setDisconnectedCallback;
2535
- _classCallCheck(this, WireContextRegistrationEvent);
2536
- _this2 = _super3.call(this, adapterToken, {
2537
- bubbles: true,
2538
- composed: true
2553
+ var AdapterToTokenMap = new Map();
2554
+ function createContextProviderWithRegister(adapter, registerContextProvider) {
2555
+ var adapterContextToken = AdapterToTokenMap.get(adapter);
2556
+ if (!isUndefined$1(adapterContextToken)) {
2557
+ throw new Error("Adapter already has a context provider.");
2558
+ }
2559
+ adapterContextToken = guid();
2560
+ AdapterToTokenMap.set(adapter, adapterContextToken);
2561
+ var providers = new WeakSet();
2562
+ return function (elmOrComponent, options) {
2563
+ if (providers.has(elmOrComponent)) {
2564
+ throw new Error("Adapter was already installed on ".concat(elmOrComponent, "."));
2565
+ }
2566
+ providers.add(elmOrComponent);
2567
+ var consumerConnectedCallback = options.consumerConnectedCallback,
2568
+ consumerDisconnectedCallback = options.consumerDisconnectedCallback;
2569
+ registerContextProvider(elmOrComponent, adapterContextToken, function (subscriptionPayload) {
2570
+ var setNewContext = subscriptionPayload.setNewContext,
2571
+ setDisconnectedCallback = subscriptionPayload.setDisconnectedCallback;
2572
+ var consumer = {
2573
+ provide: function provide(newContext) {
2574
+ setNewContext(newContext);
2575
+ }
2576
+ };
2577
+ var disconnectCallback = function disconnectCallback() {
2578
+ if (!isUndefined$1(consumerDisconnectedCallback)) {
2579
+ consumerDisconnectedCallback(consumer);
2580
+ }
2581
+ };
2582
+ setDisconnectedCallback(disconnectCallback);
2583
+ consumerConnectedCallback(consumer);
2539
2584
  });
2540
- defineProperties(_assertThisInitialized(_this2), {
2541
- setNewContext: {
2542
- value: setNewContext
2585
+ };
2586
+ }
2587
+ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
2588
+ var adapter = wireDef.adapter;
2589
+ var adapterContextToken = AdapterToTokenMap.get(adapter);
2590
+ if (isUndefined$1(adapterContextToken)) {
2591
+ return; // no provider found, nothing to be done
2592
+ }
2593
+
2594
+ var elm = vm.elm,
2595
+ _vm$context = vm.context,
2596
+ wiredConnecting = _vm$context.wiredConnecting,
2597
+ wiredDisconnecting = _vm$context.wiredDisconnecting,
2598
+ registerContextConsumer = vm.renderer.registerContextConsumer;
2599
+ // waiting for the component to be connected to formally request the context via the token
2600
+ ArrayPush$1.call(wiredConnecting, function () {
2601
+ // This will attempt to connect the current element with one of its anscestors
2602
+ // that can provide context for the given wire adapter. This relationship is
2603
+ // keyed on the secret & internal value of `adapterContextToken`, which is unique
2604
+ // to a given wire adapter.
2605
+ //
2606
+ // Depending on the runtime environment, this connection is made using either DOM
2607
+ // events (in the browser) or a custom traversal (on the server).
2608
+ registerContextConsumer(elm, adapterContextToken, {
2609
+ setNewContext: function setNewContext(newContext) {
2610
+ // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
2611
+ // TODO: dev-mode validation of config based on the adapter.contextSchema
2612
+ callbackWhenContextIsReady(newContext);
2543
2613
  },
2544
- setDisconnectedCallback: {
2545
- value: setDisconnectedCallback
2614
+ setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
2615
+ // adds this callback into the disconnect bucket so it gets disconnected from parent
2616
+ // the the element hosting the wire is disconnected
2617
+ ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
2546
2618
  }
2547
2619
  });
2548
- return _this2;
2549
- }
2550
- return _createClass(WireContextRegistrationEvent);
2551
- }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
2620
+ });
2621
+ }
2622
+
2623
+ /*
2624
+ * Copyright (c) 2023, salesforce.com, inc.
2625
+ * All rights reserved.
2626
+ * SPDX-License-Identifier: MIT
2627
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2628
+ */
2629
+ var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
2630
+ var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
2631
+ var WIRE_DEBUG_ENTRY = '@wire';
2632
+ var WireMetaMap = new Map();
2552
2633
  function createFieldDataCallback(vm, name) {
2553
2634
  return function (value) {
2554
2635
  updateComponentValue(vm, name, value);
@@ -2594,40 +2675,6 @@
2594
2675
  ro: ro
2595
2676
  };
2596
2677
  }
2597
- function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
2598
- var adapter = wireDef.adapter;
2599
- var adapterContextToken = getAdapterToken(adapter);
2600
- if (isUndefined$1(adapterContextToken)) {
2601
- return; // no provider found, nothing to be done
2602
- }
2603
-
2604
- var elm = vm.elm,
2605
- _vm$context = vm.context,
2606
- wiredConnecting = _vm$context.wiredConnecting,
2607
- wiredDisconnecting = _vm$context.wiredDisconnecting,
2608
- dispatchEvent = vm.renderer.dispatchEvent;
2609
- // waiting for the component to be connected to formally request the context via the token
2610
- ArrayPush$1.call(wiredConnecting, function () {
2611
- // This event is responsible for connecting the host element with another
2612
- // element in the composed path that is providing contextual data. The provider
2613
- // must be listening for a special dom event with the name corresponding to the value of
2614
- // `adapterContextToken`, which will remain secret and internal to this file only to
2615
- // guarantee that the linkage can be forged.
2616
- var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
2617
- setNewContext: function setNewContext(newContext) {
2618
- // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
2619
- // TODO: dev-mode validation of config based on the adapter.contextSchema
2620
- callbackWhenContextIsReady(newContext);
2621
- },
2622
- setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
2623
- // adds this callback into the disconnect bucket so it gets disconnected from parent
2624
- // the the element hosting the wire is disconnected
2625
- ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
2626
- }
2627
- });
2628
- dispatchEvent(elm, contextRegistrationEvent);
2629
- });
2630
- }
2631
2678
  function createConnector(vm, name, wireDef) {
2632
2679
  var method = wireDef.method,
2633
2680
  adapter = wireDef.adapter,
@@ -2707,13 +2754,6 @@
2707
2754
  }
2708
2755
  };
2709
2756
  }
2710
- var AdapterToTokenMap = new Map();
2711
- function getAdapterToken(adapter) {
2712
- return AdapterToTokenMap.get(adapter);
2713
- }
2714
- function setAdapterToken(adapter, token) {
2715
- AdapterToTokenMap.set(adapter, token);
2716
- }
2717
2757
  function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
2718
2758
  // support for callable adapters
2719
2759
  if (adapter.adapter) {
@@ -3322,10 +3362,10 @@
3322
3362
  if (isFunction$1(SuperClass)) {
3323
3363
  HTMLBridgeElement = /*#__PURE__*/function (_SuperClass) {
3324
3364
  _inherits(HTMLBridgeElement, _SuperClass);
3325
- var _super4 = _createSuper(HTMLBridgeElement);
3365
+ var _super3 = _createSuper(HTMLBridgeElement);
3326
3366
  function HTMLBridgeElement() {
3327
3367
  _classCallCheck(this, HTMLBridgeElement);
3328
- return _super4.apply(this, arguments);
3368
+ return _super3.apply(this, arguments);
3329
3369
  }
3330
3370
  return _createClass(HTMLBridgeElement);
3331
3371
  }(SuperClass);
@@ -5941,8 +5981,8 @@
5941
5981
  */
5942
5982
  function registerComponent(
5943
5983
  // We typically expect a LightningElementConstructor, but technically you can call this with anything
5944
- Ctor, _ref4) {
5945
- var tmpl = _ref4.tmpl;
5984
+ Ctor, _ref3) {
5985
+ var tmpl = _ref3.tmpl;
5946
5986
  if (isFunction$1(Ctor)) {
5947
5987
  if (process.env.NODE_ENV !== 'production') {
5948
5988
  // There is no point in running this in production, because the version mismatch check relies
@@ -6585,6 +6625,10 @@
6585
6625
  // Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
6586
6626
  var getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
6587
6627
  var querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
6628
+ // This is a "handoff" from synthetic-shadow to engine-core – we want to clean up after ourselves
6629
+ // so nobody else can misuse these global APIs.
6630
+ delete _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
6631
+ delete _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
6588
6632
  function isSyntheticShadowRootInstance(rootNode) {
6589
6633
  return rootNode !== document && isTrue(rootNode.synthetic);
6590
6634
  }
@@ -6849,69 +6893,6 @@
6849
6893
  }
6850
6894
  }
6851
6895
 
6852
- /*
6853
- * Copyright (c) 2018, salesforce.com, inc.
6854
- * All rights reserved.
6855
- * SPDX-License-Identifier: MIT
6856
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6857
- */
6858
- // this is lwc internal implementation
6859
- function createContextProvider(adapter) {
6860
- var adapterContextToken = getAdapterToken(adapter);
6861
- if (!isUndefined$1(adapterContextToken)) {
6862
- throw new Error("Adapter already has a context provider.");
6863
- }
6864
- adapterContextToken = guid();
6865
- setAdapterToken(adapter, adapterContextToken);
6866
- var providers = new WeakSet();
6867
- return function (elm, options) {
6868
- if (providers.has(elm)) {
6869
- throw new Error("Adapter was already installed on ".concat(elm, "."));
6870
- }
6871
- providers.add(elm);
6872
- var consumerConnectedCallback = options.consumerConnectedCallback,
6873
- consumerDisconnectedCallback = options.consumerDisconnectedCallback;
6874
- elm.addEventListener(adapterContextToken, function (evt) {
6875
- var setNewContext = evt.setNewContext,
6876
- setDisconnectedCallback = evt.setDisconnectedCallback;
6877
- var consumer = {
6878
- provide: function provide(newContext) {
6879
- setNewContext(newContext);
6880
- }
6881
- };
6882
- var disconnectCallback = function disconnectCallback() {
6883
- if (!isUndefined$1(consumerDisconnectedCallback)) {
6884
- consumerDisconnectedCallback(consumer);
6885
- }
6886
- };
6887
- setDisconnectedCallback(disconnectCallback);
6888
- consumerConnectedCallback(consumer);
6889
- evt.stopImmediatePropagation();
6890
- });
6891
- };
6892
- }
6893
-
6894
- /*
6895
- * Copyright (c) 2018, salesforce.com, inc.
6896
- * All rights reserved.
6897
- * SPDX-License-Identifier: MIT
6898
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6899
- */
6900
- /**
6901
- * EXPERIMENTAL: This function allows you to create a reactive readonly
6902
- * membrane around any object value. This API is subject to change or
6903
- * being removed.
6904
- */
6905
- function readonly(obj) {
6906
- if (process.env.NODE_ENV !== 'production') {
6907
- // TODO [#1292]: Remove the readonly decorator
6908
- if (arguments.length !== 1) {
6909
- 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.');
6910
- }
6911
- }
6912
- return getReadOnlyProxy(obj);
6913
- }
6914
-
6915
6896
  /*
6916
6897
  * Copyright (c) 2022, salesforce.com, inc.
6917
6898
  * All rights reserved.
@@ -6966,15 +6947,44 @@
6966
6947
  return renderer.nextSibling(hydratedNode);
6967
6948
  }
6968
6949
  var NODE_VALUE_PROP = 'nodeValue';
6950
+ var PARENT_NODE_PROP = 'parentNode';
6951
+ var TAG_NAME_PROP = 'tagName';
6952
+ function textNodeContentsAreEqual(node, vnode, renderer) {
6953
+ var getProperty = renderer.getProperty;
6954
+ var nodeValue = getProperty(node, NODE_VALUE_PROP);
6955
+ if (nodeValue === vnode.text) {
6956
+ return true;
6957
+ }
6958
+ // Special case for empty text nodes – these are serialized differently on the server
6959
+ // See https://github.com/salesforce/lwc/pull/2656
6960
+ if (nodeValue === "\u200D" && vnode.text === '') {
6961
+ return true;
6962
+ }
6963
+ // Special case for text nodes inside `<style>` tags – these are escaped when rendered server-size,
6964
+ // but not when generated by the engine client-side.
6965
+ var parentNode = getProperty(node, PARENT_NODE_PROP);
6966
+ // Should never be null, but just to be safe, we check.
6967
+ /* istanbul ignore else */
6968
+ if (!isNull(parentNode)) {
6969
+ var tagName = getProperty(parentNode, TAG_NAME_PROP);
6970
+ // If the tagName is STYLE, then the following condition should always be true.
6971
+ // The LWC compiler blocks using `<style>`s inside of templates, so it should be impossible
6972
+ // for component authors to render different `<style>` text content on the client and server.
6973
+ // But just to be safe, we check.
6974
+ /* istanbul ignore next */
6975
+ if (tagName === 'STYLE' && htmlEscape(vnode.text) === nodeValue) {
6976
+ return true;
6977
+ }
6978
+ }
6979
+ return false;
6980
+ }
6969
6981
  function hydrateText(node, vnode, renderer) {
6970
6982
  var _a;
6971
6983
  if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
6972
6984
  return handleMismatch(node, vnode, renderer);
6973
6985
  }
6974
6986
  if (process.env.NODE_ENV !== 'production') {
6975
- var getProperty = renderer.getProperty;
6976
- var nodeValue = getProperty(node, NODE_VALUE_PROP);
6977
- if (nodeValue !== vnode.text && !(nodeValue === "\u200D" && vnode.text === '')) {
6987
+ if (!textNodeContentsAreEqual(node, vnode, renderer)) {
6978
6988
  logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
6979
6989
  }
6980
6990
  }
@@ -7156,6 +7166,19 @@
7156
7166
  var hasIncompatibleStyle = validateStyleAttr(vnode, elm, renderer);
7157
7167
  return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
7158
7168
  }
7169
+ function attributeValuesAreEqual(vnodeValue, value) {
7170
+ var vnodeValueAsString = String(vnodeValue);
7171
+ if (vnodeValueAsString === value) {
7172
+ return true;
7173
+ }
7174
+ // If the expected value is null, this means that the attribute does not exist. In that case,
7175
+ // we accept any nullish value (undefined or null).
7176
+ if (isNull(value) && (isUndefined$1(vnodeValue) || isNull(vnodeValue))) {
7177
+ return true;
7178
+ }
7179
+ // In all other cases, the two values are not considered equal
7180
+ return false;
7181
+ }
7159
7182
  function validateAttrs(vnode, elm, renderer) {
7160
7183
  var _vnode$data$attrs = vnode.data.attrs,
7161
7184
  attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs;
@@ -7169,10 +7192,10 @@
7169
7192
  var owner = vnode.owner;
7170
7193
  var getAttribute = renderer.getAttribute;
7171
7194
  var elmAttrValue = getAttribute(elm, attrName);
7172
- if (String(attrValue) !== elmAttrValue) {
7195
+ if (!attributeValuesAreEqual(attrValue, elmAttrValue)) {
7173
7196
  if (process.env.NODE_ENV !== 'production') {
7174
7197
  var getProperty = renderer.getProperty;
7175
- logError("Mismatch hydrating element <".concat(getProperty(elm, 'tagName').toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), owner);
7198
+ logError("Mismatch hydrating element <".concat(getProperty(elm, 'tagName').toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found ").concat(isNull(elmAttrValue) ? 'null' : "\"".concat(elmAttrValue, "\"")), owner);
7176
7199
  }
7177
7200
  nodesAreCompatible = false;
7178
7201
  }
@@ -7593,7 +7616,28 @@
7593
7616
  }
7594
7617
  return ctor;
7595
7618
  }
7596
- /* version: 2.37.2 */
7619
+
7620
+ /*
7621
+ * Copyright (c) 2018, salesforce.com, inc.
7622
+ * All rights reserved.
7623
+ * SPDX-License-Identifier: MIT
7624
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7625
+ */
7626
+ /**
7627
+ * EXPERIMENTAL: This function allows you to create a reactive readonly
7628
+ * membrane around any object value. This API is subject to change or
7629
+ * being removed.
7630
+ */
7631
+ function readonly(obj) {
7632
+ if (process.env.NODE_ENV !== 'production') {
7633
+ // TODO [#1292]: Remove the readonly decorator
7634
+ if (arguments.length !== 1) {
7635
+ 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.');
7636
+ }
7637
+ }
7638
+ return getReadOnlyProxy(obj);
7639
+ }
7640
+ /* version: 2.38.0 */
7597
7641
 
7598
7642
  /*
7599
7643
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7831,10 +7875,10 @@
7831
7875
  // which are not equipped to be initialized that way.
7832
7876
  var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
7833
7877
  _inherits(clazz, _HTMLElementAlias);
7834
- var _super5 = _createSuper(clazz);
7878
+ var _super4 = _createSuper(clazz);
7835
7879
  function clazz() {
7836
7880
  _classCallCheck(this, clazz);
7837
- return _super5.apply(this, arguments);
7881
+ return _super4.apply(this, arguments);
7838
7882
  }
7839
7883
  return _createClass(clazz);
7840
7884
  }(HTMLElementAlias);
@@ -7880,24 +7924,24 @@
7880
7924
  // TODO [#2972]: this class should expose observedAttributes as necessary
7881
7925
  var UpgradableConstructor = /*#__PURE__*/function (_HTMLElement) {
7882
7926
  _inherits(UpgradableConstructor, _HTMLElement);
7883
- var _super6 = _createSuper(UpgradableConstructor);
7927
+ var _super5 = _createSuper(UpgradableConstructor);
7884
7928
  function UpgradableConstructor(upgradeCallback) {
7885
- var _this3;
7929
+ var _this2;
7886
7930
  _classCallCheck(this, UpgradableConstructor);
7887
- _this3 = _super6.call(this);
7931
+ _this2 = _super5.call(this);
7888
7932
  // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
7889
7933
  // then elementBeingUpgraded will be false
7890
7934
  if (elementBeingUpgradedByLWC) {
7891
- upgradeCallback(_assertThisInitialized(_this3));
7935
+ upgradeCallback(_assertThisInitialized(_this2));
7892
7936
  } else if (hasConnectedCallback || hasDisconnectedCallback) {
7893
7937
  // If this element has connected or disconnected callbacks, then we need to keep track of
7894
7938
  // instances that were created outside LWC (i.e. not created by `lwc.createElement()`).
7895
7939
  // If the element has no connected or disconnected callbacks, then we don't need to track this.
7896
- elementsUpgradedOutsideLWC.add(_assertThisInitialized(_this3));
7940
+ elementsUpgradedOutsideLWC.add(_assertThisInitialized(_this2));
7897
7941
  // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
7898
7942
  // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
7899
7943
  }
7900
- return _this3;
7944
+ return _this2;
7901
7945
  }
7902
7946
  return _createClass(UpgradableConstructor);
7903
7947
  }( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
@@ -8019,7 +8063,46 @@
8019
8063
  function isNull(obj) {
8020
8064
  return obj === null;
8021
8065
  }
8022
- /** version: 2.37.2 */
8066
+ /** version: 2.38.0 */
8067
+
8068
+ /*
8069
+ * Copyright (c) 2023, salesforce.com, inc.
8070
+ * All rights reserved.
8071
+ * SPDX-License-Identifier: MIT
8072
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8073
+ */
8074
+ var WireContextSubscriptionEvent = /*#__PURE__*/function (_CustomEvent) {
8075
+ _inherits(WireContextSubscriptionEvent, _CustomEvent);
8076
+ var _super6 = _createSuper(WireContextSubscriptionEvent);
8077
+ function WireContextSubscriptionEvent(adapterToken, _ref6) {
8078
+ var _this3;
8079
+ var setNewContext = _ref6.setNewContext,
8080
+ setDisconnectedCallback = _ref6.setDisconnectedCallback;
8081
+ _classCallCheck(this, WireContextSubscriptionEvent);
8082
+ _this3 = _super6.call(this, adapterToken, {
8083
+ bubbles: true,
8084
+ composed: true
8085
+ });
8086
+ _this3.setNewContext = setNewContext;
8087
+ _this3.setDisconnectedCallback = setDisconnectedCallback;
8088
+ return _this3;
8089
+ }
8090
+ return _createClass(WireContextSubscriptionEvent);
8091
+ }( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
8092
+ function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
8093
+ dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
8094
+ }
8095
+ function registerContextProvider(elm, adapterContextToken, onContextSubscription) {
8096
+ addEventListener(elm, adapterContextToken, function (evt) {
8097
+ evt.stopImmediatePropagation();
8098
+ var setNewContext = evt.setNewContext,
8099
+ setDisconnectedCallback = evt.setDisconnectedCallback;
8100
+ onContextSubscription({
8101
+ setNewContext: setNewContext,
8102
+ setDisconnectedCallback: setDisconnectedCallback
8103
+ });
8104
+ });
8105
+ }
8023
8106
 
8024
8107
  /*
8025
8108
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8201,6 +8284,9 @@
8201
8284
  function assertInstanceOfHTMLElement(elm, msg) {
8202
8285
  assert.invariant(elm instanceof HTMLElement, msg);
8203
8286
  }
8287
+ function ownerDocument(element) {
8288
+ return element.ownerDocument;
8289
+ }
8204
8290
  exports.addEventListener = addEventListener;
8205
8291
  exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
8206
8292
  exports.attachShadow = attachShadow;
@@ -8224,8 +8310,11 @@
8224
8310
  exports.insert = insert;
8225
8311
  exports.isConnected = isConnected;
8226
8312
  exports.nextSibling = nextSibling;
8313
+ exports.ownerDocument = ownerDocument;
8227
8314
  exports.querySelector = querySelector;
8228
8315
  exports.querySelectorAll = querySelectorAll;
8316
+ exports.registerContextConsumer = registerContextConsumer;
8317
+ exports.registerContextProvider = registerContextProvider;
8229
8318
  exports.remove = remove;
8230
8319
  exports.removeAttribute = removeAttribute;
8231
8320
  exports.removeEventListener = removeEventListener;
@@ -8585,7 +8674,38 @@
8585
8674
  });
8586
8675
  freeze(LightningElement);
8587
8676
  seal(LightningElement.prototype);
8588
- /* version: 2.37.2 */
8677
+
8678
+ /*
8679
+ * Copyright (c) 2018, salesforce.com, inc.
8680
+ * All rights reserved.
8681
+ * SPDX-License-Identifier: MIT
8682
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8683
+ */
8684
+ function addEventListener(target, type, callback, options) {
8685
+ target.addEventListener(type, callback, options);
8686
+ }
8687
+
8688
+ /*
8689
+ * Copyright (c) 2023, salesforce.com, inc.
8690
+ * All rights reserved.
8691
+ * SPDX-License-Identifier: MIT
8692
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8693
+ */
8694
+ function createContextProvider(adapter) {
8695
+ return createContextProviderWithRegister(adapter, registerContextProvider);
8696
+ }
8697
+ function registerContextProvider(elm, adapterContextToken, onContextSubscription) {
8698
+ addEventListener(elm, adapterContextToken, function (evt) {
8699
+ evt.stopImmediatePropagation();
8700
+ var setNewContext = evt.setNewContext,
8701
+ setDisconnectedCallback = evt.setDisconnectedCallback;
8702
+ onContextSubscription({
8703
+ setNewContext: setNewContext,
8704
+ setDisconnectedCallback: setDisconnectedCallback
8705
+ });
8706
+ });
8707
+ }
8708
+ /* version: 2.38.0 */
8589
8709
 
8590
8710
  exports.LightningElement = LightningElement;
8591
8711
  exports.__unstable__ProfilerControl = profilerControl;
@@ -8621,3 +8741,4 @@
8621
8741
  exports.wire = wire;
8622
8742
 
8623
8743
  }));
8744
+ //# sourceMappingURL=engine-dom.js.map