@lwc/shared 2.14.0 → 2.15.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.
package/dist/index.cjs.js CHANGED
@@ -237,6 +237,8 @@ const _globalThis = /*@__PURE__*/ (function () {
237
237
  const KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';
238
238
  const KEY__SHADOW_RESOLVER = '$shadowResolver$';
239
239
  const KEY__SHADOW_RESOLVER_PRIVATE = '$$ShadowResolverKey$$';
240
+ const KEY__SHADOW_STATIC = '$shadowStaticNode$';
241
+ const KEY__SHADOW_STATIC_PRIVATE = '$shadowStaticNodeKey$';
240
242
  const KEY__SHADOW_TOKEN = '$shadowToken$';
241
243
  const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
242
244
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
@@ -421,6 +423,24 @@ function htmlPropertyToAttribute(propName) {
421
423
  return attributeName;
422
424
  }
423
425
 
426
+ /*
427
+ * Copyright (c) 2020, salesforce.com, inc.
428
+ * All rights reserved.
429
+ * SPDX-License-Identifier: MIT
430
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
431
+ */
432
+ const ESCAPED_CHARS = {
433
+ '"': '"',
434
+ "'": ''',
435
+ '<': '&lt;',
436
+ '>': '&gt;',
437
+ '&': '&amp;',
438
+ };
439
+ function htmlEscape(str, attrMode = false) {
440
+ const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
441
+ return str.replace(searchValue, (char) => ESCAPED_CHARS[char]);
442
+ }
443
+
424
444
  /*
425
445
  * Copyright (c) 2018, salesforce.com, inc.
426
446
  * All rights reserved.
@@ -450,7 +470,7 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
450
470
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
451
471
  */
452
472
  // Increment whenever the LWC template compiler changes
453
- const LWC_VERSION = "2.14.0";
473
+ const LWC_VERSION = "2.15.0";
454
474
  const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`;
455
475
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
456
476
 
@@ -477,6 +497,8 @@ exports.KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = KEY__IS_NATIVE_SHADOW_ROOT_DEFINED;
477
497
  exports.KEY__SCOPED_CSS = KEY__SCOPED_CSS;
478
498
  exports.KEY__SHADOW_RESOLVER = KEY__SHADOW_RESOLVER;
479
499
  exports.KEY__SHADOW_RESOLVER_PRIVATE = KEY__SHADOW_RESOLVER_PRIVATE;
500
+ exports.KEY__SHADOW_STATIC = KEY__SHADOW_STATIC;
501
+ exports.KEY__SHADOW_STATIC_PRIVATE = KEY__SHADOW_STATIC_PRIVATE;
480
502
  exports.KEY__SHADOW_TOKEN = KEY__SHADOW_TOKEN;
481
503
  exports.KEY__SHADOW_TOKEN_PRIVATE = KEY__SHADOW_TOKEN_PRIVATE;
482
504
  exports.KEY__SYNTHETIC_MODE = KEY__SYNTHETIC_MODE;
@@ -507,6 +529,7 @@ exports.getPrototypeOf = getPrototypeOf;
507
529
  exports.globalThis = _globalThis;
508
530
  exports.hasNativeSymbolSupport = hasNativeSymbolSupport;
509
531
  exports.hasOwnProperty = hasOwnProperty;
532
+ exports.htmlEscape = htmlEscape;
510
533
  exports.htmlPropertyToAttribute = htmlPropertyToAttribute;
511
534
  exports.isAriaAttribute = isAriaAttribute;
512
535
  exports.isArray = isArray;
@@ -528,4 +551,4 @@ exports.noop = noop;
528
551
  exports.seal = seal;
529
552
  exports.setPrototypeOf = setPrototypeOf;
530
553
  exports.toString = toString;
531
- /** version: 2.14.0 */
554
+ /** version: 2.15.0 */
package/dist/index.js CHANGED
@@ -233,6 +233,8 @@ const _globalThis = /*@__PURE__*/ (function () {
233
233
  const KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';
234
234
  const KEY__SHADOW_RESOLVER = '$shadowResolver$';
235
235
  const KEY__SHADOW_RESOLVER_PRIVATE = '$$ShadowResolverKey$$';
236
+ const KEY__SHADOW_STATIC = '$shadowStaticNode$';
237
+ const KEY__SHADOW_STATIC_PRIVATE = '$shadowStaticNodeKey$';
236
238
  const KEY__SHADOW_TOKEN = '$shadowToken$';
237
239
  const KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
238
240
  const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
@@ -417,6 +419,24 @@ function htmlPropertyToAttribute(propName) {
417
419
  return attributeName;
418
420
  }
419
421
 
422
+ /*
423
+ * Copyright (c) 2020, salesforce.com, inc.
424
+ * All rights reserved.
425
+ * SPDX-License-Identifier: MIT
426
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
427
+ */
428
+ const ESCAPED_CHARS = {
429
+ '"': '&quot;',
430
+ "'": '&#x27;',
431
+ '<': '&lt;',
432
+ '>': '&gt;',
433
+ '&': '&amp;',
434
+ };
435
+ function htmlEscape(str, attrMode = false) {
436
+ const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
437
+ return str.replace(searchValue, (char) => ESCAPED_CHARS[char]);
438
+ }
439
+
420
440
  /*
421
441
  * Copyright (c) 2018, salesforce.com, inc.
422
442
  * All rights reserved.
@@ -446,9 +466,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
446
466
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
447
467
  */
448
468
  // Increment whenever the LWC template compiler changes
449
- const LWC_VERSION = "2.14.0";
469
+ const LWC_VERSION = "2.15.0";
450
470
  const LWC_VERSION_COMMENT = `LWC compiler v${LWC_VERSION}`;
451
471
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
452
472
 
453
- 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_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, htmlPropertyToAttribute, isAriaAttribute, isArray, isBoolean, isBooleanAttribute, isFalse, isFrozen, isFunction, isGlobalHtmlAttribute, isNull, isNumber, isObject, isString, isTrue, isUndefined, isVoidElement, keys, noop, seal, setPrototypeOf, toString };
454
- /** version: 2.14.0 */
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.15.0 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/shared",
3
- "version": "2.14.0",
3
+ "version": "2.15.0",
4
4
  "description": "Utilities and methods that are shared across packages",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -0,0 +1 @@
1
+ export declare function htmlEscape(str: string, attrMode?: boolean): string;
package/types/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './global-this';
5
5
  export * from './keys';
6
6
  export * from './void-elements';
7
7
  export * from './html-attributes';
8
+ export * from './html-escape';
8
9
  export * from './symbol';
9
10
  export * from './namespaces';
10
11
  export * from './meta';
package/types/keys.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export declare const KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = "$isNativeShadowRootDefined$";
2
2
  export declare const KEY__SHADOW_RESOLVER = "$shadowResolver$";
3
3
  export declare const KEY__SHADOW_RESOLVER_PRIVATE = "$$ShadowResolverKey$$";
4
+ export declare const KEY__SHADOW_STATIC = "$shadowStaticNode$";
5
+ export declare const KEY__SHADOW_STATIC_PRIVATE = "$shadowStaticNodeKey$";
4
6
  export declare const KEY__SHADOW_TOKEN = "$shadowToken$";
5
7
  export declare const KEY__SHADOW_TOKEN_PRIVATE = "$$ShadowTokenKey$$";
6
8
  export declare const KEY__SYNTHETIC_MODE = "$$lwc-synthetic-mode";