@lwc/shared 2.19.0 → 2.20.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/index.cjs.js CHANGED
@@ -244,62 +244,45 @@ const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
244
244
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
245
245
  const KEY__SCOPED_CSS = '$scoped$';
246
246
 
247
+ /*
248
+ * Copyright (c) 2022, salesforce.com, inc.
249
+ * All rights reserved.
250
+ * SPDX-License-Identifier: MIT
251
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
252
+ */
253
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
254
+ const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
255
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
256
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
257
+ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
258
+
247
259
  /*
248
260
  * Copyright (c) 2020, salesforce.com, inc.
249
261
  * All rights reserved.
250
262
  * SPDX-License-Identifier: MIT
251
263
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
252
264
  */
253
- // The following list contains a mix of both void elements from the HTML and the XML namespace
254
- // without distinction.
255
- const VOID_ELEMENTS = [
265
+ // Void elements are elements that self-close even without an explicit solidus (slash),
266
+ // e.g. `</tagName>` or `<tagName />`. For instance, `<meta>` closes on its own; no need for a slash.
267
+ // These only come from HTML; there are no void elements in the SVG or MathML namespaces.
268
+ // See: https://html.spec.whatwg.org/multipage/syntax.html#syntax-tags
269
+ const VOID_ELEMENTS_SET = new Set([
256
270
  'area',
257
271
  'base',
258
272
  'br',
259
- 'circle',
260
273
  'col',
261
- 'ellipse',
262
- 'feBlend',
263
- 'feColorMatrix',
264
- 'feFuncR',
265
- 'feFuncG',
266
- 'feFuncB',
267
- 'feFuncA',
268
- 'feImage',
269
- 'feComposite',
270
- 'feConvolveMatrix',
271
- 'feDiffuseLighting',
272
- 'feDisplacementMap',
273
- 'feDropShadow',
274
- 'feFlood',
275
- 'feGaussianBlur',
276
- 'feMerge',
277
- 'feMergeNode',
278
- 'feMorphology',
279
- 'feOffset',
280
- 'feSpecularLighting',
281
- 'feTile',
282
- 'feTurbulence',
283
- 'fePointLight',
284
274
  'embed',
285
275
  'hr',
286
276
  'img',
287
277
  'input',
288
- 'keygen',
289
- 'line',
290
278
  'link',
291
- 'menuitem',
292
279
  'meta',
293
- 'param',
294
- 'path',
295
- 'rect',
296
280
  'source',
297
281
  'track',
298
282
  'wbr',
299
- ];
300
- const VOID_ELEMENTS_SET = new Set(VOID_ELEMENTS);
301
- function isVoidElement(name) {
302
- return VOID_ELEMENTS_SET.has(name);
283
+ ]);
284
+ function isVoidElement(name, namespace) {
285
+ return namespace === HTML_NAMESPACE && VOID_ELEMENTS_SET.has(name.toLowerCase());
303
286
  }
304
287
 
305
288
  /*
@@ -451,18 +434,6 @@ function htmlEscape(str, attrMode = false) {
451
434
  // we can't use typeof since it will fail when transpiling.
452
435
  const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === 'Symbol(x)')();
453
436
 
454
- /*
455
- * Copyright (c) 2022, salesforce.com, inc.
456
- * All rights reserved.
457
- * SPDX-License-Identifier: MIT
458
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
459
- */
460
- const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
461
- const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
462
- const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
463
- const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
464
- const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
465
-
466
437
  /*
467
438
  * Copyright (c) 2018, salesforce.com, inc.
468
439
  * All rights reserved.
@@ -470,7 +441,7 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
470
441
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
471
442
  */
472
443
  // Increment whenever the LWC template compiler changes
473
- const LWC_VERSION = "2.19.0";
444
+ const LWC_VERSION = "2.20.1";
474
445
  const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`;
475
446
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
476
447
 
@@ -512,7 +483,6 @@ exports.StringFromCharCode = StringFromCharCode;
512
483
  exports.StringReplace = StringReplace;
513
484
  exports.StringSlice = StringSlice;
514
485
  exports.StringToLowerCase = StringToLowerCase;
515
- exports.VOID_ELEMENTS = VOID_ELEMENTS;
516
486
  exports.XLINK_NAMESPACE = XLINK_NAMESPACE;
517
487
  exports.XML_NAMESPACE = XML_NAMESPACE;
518
488
  exports.assert = assert;
@@ -551,4 +521,4 @@ exports.noop = noop;
551
521
  exports.seal = seal;
552
522
  exports.setPrototypeOf = setPrototypeOf;
553
523
  exports.toString = toString;
554
- /** version: 2.19.0 */
524
+ /** version: 2.20.1 */
package/dist/index.js CHANGED
@@ -240,62 +240,45 @@ const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
240
240
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
241
241
  const KEY__SCOPED_CSS = '$scoped$';
242
242
 
243
+ /*
244
+ * Copyright (c) 2022, salesforce.com, inc.
245
+ * All rights reserved.
246
+ * SPDX-License-Identifier: MIT
247
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
248
+ */
249
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
250
+ const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
251
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
252
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
253
+ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
254
+
243
255
  /*
244
256
  * Copyright (c) 2020, salesforce.com, inc.
245
257
  * All rights reserved.
246
258
  * SPDX-License-Identifier: MIT
247
259
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
248
260
  */
249
- // The following list contains a mix of both void elements from the HTML and the XML namespace
250
- // without distinction.
251
- const VOID_ELEMENTS = [
261
+ // Void elements are elements that self-close even without an explicit solidus (slash),
262
+ // e.g. `</tagName>` or `<tagName />`. For instance, `<meta>` closes on its own; no need for a slash.
263
+ // These only come from HTML; there are no void elements in the SVG or MathML namespaces.
264
+ // See: https://html.spec.whatwg.org/multipage/syntax.html#syntax-tags
265
+ const VOID_ELEMENTS_SET = new Set([
252
266
  'area',
253
267
  'base',
254
268
  'br',
255
- 'circle',
256
269
  'col',
257
- 'ellipse',
258
- 'feBlend',
259
- 'feColorMatrix',
260
- 'feFuncR',
261
- 'feFuncG',
262
- 'feFuncB',
263
- 'feFuncA',
264
- 'feImage',
265
- 'feComposite',
266
- 'feConvolveMatrix',
267
- 'feDiffuseLighting',
268
- 'feDisplacementMap',
269
- 'feDropShadow',
270
- 'feFlood',
271
- 'feGaussianBlur',
272
- 'feMerge',
273
- 'feMergeNode',
274
- 'feMorphology',
275
- 'feOffset',
276
- 'feSpecularLighting',
277
- 'feTile',
278
- 'feTurbulence',
279
- 'fePointLight',
280
270
  'embed',
281
271
  'hr',
282
272
  'img',
283
273
  'input',
284
- 'keygen',
285
- 'line',
286
274
  'link',
287
- 'menuitem',
288
275
  'meta',
289
- 'param',
290
- 'path',
291
- 'rect',
292
276
  'source',
293
277
  'track',
294
278
  'wbr',
295
- ];
296
- const VOID_ELEMENTS_SET = new Set(VOID_ELEMENTS);
297
- function isVoidElement(name) {
298
- return VOID_ELEMENTS_SET.has(name);
279
+ ]);
280
+ function isVoidElement(name, namespace) {
281
+ return namespace === HTML_NAMESPACE && VOID_ELEMENTS_SET.has(name.toLowerCase());
299
282
  }
300
283
 
301
284
  /*
@@ -447,18 +430,6 @@ function htmlEscape(str, attrMode = false) {
447
430
  // we can't use typeof since it will fail when transpiling.
448
431
  const hasNativeSymbolSupport = /*@__PURE__*/ (() => Symbol('x').toString() === 'Symbol(x)')();
449
432
 
450
- /*
451
- * Copyright (c) 2022, salesforce.com, inc.
452
- * All rights reserved.
453
- * SPDX-License-Identifier: MIT
454
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
455
- */
456
- const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
457
- const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
458
- const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
459
- const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
460
- const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
461
-
462
433
  /*
463
434
  * Copyright (c) 2018, salesforce.com, inc.
464
435
  * All rights reserved.
@@ -466,9 +437,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
466
437
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
467
438
  */
468
439
  // Increment whenever the LWC template compiler changes
469
- const LWC_VERSION = "2.19.0";
440
+ const LWC_VERSION = "2.20.1";
470
441
  const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`;
471
442
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
472
443
 
473
- export { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap, ArrayCopyWithin, ArrayFill, ArrayFilter, ArrayFind, ArrayIndexOf, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySort, ArraySplice, ArrayUnshift, HTML_NAMESPACE, KEY__IS_NATIVE_SHADOW_ROOT_DEFINED, KEY__SCOPED_CSS, KEY__SHADOW_RESOLVER, KEY__SHADOW_RESOLVER_PRIVATE, KEY__SHADOW_STATIC, KEY__SHADOW_STATIC_PRIVATE, KEY__SHADOW_TOKEN, KEY__SHADOW_TOKEN_PRIVATE, KEY__SYNTHETIC_MODE, LWC_VERSION, LWC_VERSION_COMMENT, LWC_VERSION_COMMENT_REGEX, MATHML_NAMESPACE, SVG_NAMESPACE, StringCharCodeAt, StringFromCharCode, StringReplace, StringSlice, StringToLowerCase, VOID_ELEMENTS, XLINK_NAMESPACE, XML_NAMESPACE, assert, assign, create, defineProperties, defineProperty, forEach, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPropertyDescriptor, getPrototypeOf, _globalThis as globalThis, hasNativeSymbolSupport, hasOwnProperty, htmlEscape, htmlPropertyToAttribute, isAriaAttribute, isArray, isBoolean, isBooleanAttribute, isFalse, isFrozen, isFunction, isGlobalHtmlAttribute, isNull, isNumber, isObject, isString, isTrue, isUndefined, isVoidElement, keys, noop, seal, setPrototypeOf, toString };
474
- /** version: 2.19.0 */
444
+ export { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap, ArrayCopyWithin, ArrayFill, ArrayFilter, ArrayFind, ArrayIndexOf, ArrayJoin, ArrayMap, ArrayPop, ArrayPush, ArrayReduce, ArrayReverse, ArrayShift, ArraySlice, ArraySort, ArraySplice, ArrayUnshift, HTML_NAMESPACE, KEY__IS_NATIVE_SHADOW_ROOT_DEFINED, KEY__SCOPED_CSS, KEY__SHADOW_RESOLVER, KEY__SHADOW_RESOLVER_PRIVATE, KEY__SHADOW_STATIC, KEY__SHADOW_STATIC_PRIVATE, KEY__SHADOW_TOKEN, KEY__SHADOW_TOKEN_PRIVATE, KEY__SYNTHETIC_MODE, LWC_VERSION, LWC_VERSION_COMMENT, LWC_VERSION_COMMENT_REGEX, MATHML_NAMESPACE, SVG_NAMESPACE, StringCharCodeAt, StringFromCharCode, StringReplace, StringSlice, StringToLowerCase, XLINK_NAMESPACE, XML_NAMESPACE, assert, assign, create, defineProperties, defineProperty, forEach, freeze, getOwnPropertyDescriptor, getOwnPropertyNames, getPropertyDescriptor, getPrototypeOf, _globalThis as globalThis, hasNativeSymbolSupport, hasOwnProperty, htmlEscape, htmlPropertyToAttribute, isAriaAttribute, isArray, isBoolean, isBooleanAttribute, isFalse, isFrozen, isFunction, isGlobalHtmlAttribute, isNull, isNumber, isObject, isString, isTrue, isUndefined, isVoidElement, keys, noop, seal, setPrototypeOf, toString };
445
+ /** version: 2.20.1 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/shared",
3
- "version": "2.19.0",
3
+ "version": "2.20.1",
4
4
  "description": "Utilities and methods that are shared across packages",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -1,2 +1 @@
1
- export declare const VOID_ELEMENTS: string[];
2
- export declare function isVoidElement(name: string): boolean;
1
+ export declare function isVoidElement(name: string, namespace: string): boolean;