@wordpress/html-entities 4.32.0 → 4.32.1-next.47f435fc9.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/build/index.js CHANGED
@@ -1,62 +1,45 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
+ decodeEntities: () => decodeEntities
5
22
  });
6
- exports.decodeEntities = decodeEntities;
23
+ module.exports = __toCommonJS(index_exports);
7
24
  let _decodeTextArea;
8
-
9
- /**
10
- * Decodes the HTML entities from a given string.
11
- *
12
- * @param html String that contain HTML entities.
13
- *
14
- * @example
15
- * ```js
16
- * import { decodeEntities } from '@wordpress/html-entities';
17
- *
18
- * const result = decodeEntities( 'á' );
19
- * console.log( result ); // result will be "á"
20
- * ```
21
- *
22
- * @return The decoded string.
23
- */
24
25
  function decodeEntities(html) {
25
- var _decodeTextArea$textC;
26
- // Not a string, or no entities to decode.
27
- if ('string' !== typeof html || -1 === html.indexOf('&')) {
26
+ if ("string" !== typeof html || -1 === html.indexOf("&")) {
28
27
  return html;
29
28
  }
30
-
31
- // Create a textarea for decoding entities, that we can reuse.
32
- if (undefined === _decodeTextArea) {
29
+ if (void 0 === _decodeTextArea) {
33
30
  if (document.implementation && document.implementation.createHTMLDocument) {
34
- _decodeTextArea = document.implementation.createHTMLDocument('').createElement('textarea');
31
+ _decodeTextArea = document.implementation.createHTMLDocument("").createElement("textarea");
35
32
  } else {
36
- _decodeTextArea = document.createElement('textarea');
33
+ _decodeTextArea = document.createElement("textarea");
37
34
  }
38
35
  }
39
36
  _decodeTextArea.innerHTML = html;
40
- const decoded = (_decodeTextArea$textC = _decodeTextArea.textContent) !== null && _decodeTextArea$textC !== void 0 ? _decodeTextArea$textC : '';
41
- _decodeTextArea.innerHTML = '';
42
-
43
- /**
44
- * Cast to string, HTMLTextAreaElement should always have `string` textContent.
45
- *
46
- * > The `textContent` property of the `Node` interface represents the text content of the
47
- * > node and its descendants.
48
- * >
49
- * > Value: A string or `null`
50
- * >
51
- * > * If the node is a `document` or a Doctype, `textContent` returns `null`.
52
- * > * If the node is a CDATA section, comment, processing instruction, or text node,
53
- * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.
54
- * > * For other node types, `textContent returns the concatenation of the textContent of
55
- * > every child node, excluding comments and processing instructions. (This is an empty
56
- * > string if the node has no children.)
57
- *
58
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent
59
- */
37
+ const decoded = _decodeTextArea.textContent ?? "";
38
+ _decodeTextArea.innerHTML = "";
60
39
  return decoded;
61
40
  }
62
- //# sourceMappingURL=index.js.map
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ decodeEntities
44
+ });
45
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_decodeTextArea","decodeEntities","html","_decodeTextArea$textC","indexOf","undefined","document","implementation","createHTMLDocument","createElement","innerHTML","decoded","textContent"],"sources":["@wordpress/html-entities/src/index.ts"],"sourcesContent":["let _decodeTextArea: HTMLTextAreaElement | undefined;\n\n/**\n * Decodes the HTML entities from a given string.\n *\n * @param html String that contain HTML entities.\n *\n * @example\n * ```js\n * import { decodeEntities } from '@wordpress/html-entities';\n *\n * const result = decodeEntities( 'á' );\n * console.log( result ); // result will be \"á\"\n * ```\n *\n * @return The decoded string.\n */\nexport function decodeEntities( html: string ): string {\n\t// Not a string, or no entities to decode.\n\tif ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {\n\t\treturn html;\n\t}\n\n\t// Create a textarea for decoding entities, that we can reuse.\n\tif ( undefined === _decodeTextArea ) {\n\t\tif (\n\t\t\tdocument.implementation &&\n\t\t\tdocument.implementation.createHTMLDocument\n\t\t) {\n\t\t\t_decodeTextArea = document.implementation\n\t\t\t\t.createHTMLDocument( '' )\n\t\t\t\t.createElement( 'textarea' );\n\t\t} else {\n\t\t\t_decodeTextArea = document.createElement( 'textarea' );\n\t\t}\n\t}\n\n\t_decodeTextArea.innerHTML = html;\n\tconst decoded = _decodeTextArea.textContent ?? '';\n\t_decodeTextArea.innerHTML = '';\n\n\t/**\n\t * Cast to string, HTMLTextAreaElement should always have `string` textContent.\n\t *\n\t * > The `textContent` property of the `Node` interface represents the text content of the\n\t * > node and its descendants.\n\t * >\n\t * > Value: A string or `null`\n\t * >\n\t * > * If the node is a `document` or a Doctype, `textContent` returns `null`.\n\t * > * If the node is a CDATA section, comment, processing instruction, or text node,\n\t * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.\n\t * > * For other node types, `textContent returns the concatenation of the textContent of\n\t * > every child node, excluding comments and processing instructions. (This is an empty\n\t * > string if the node has no children.)\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n\t */\n\treturn decoded;\n}\n"],"mappings":";;;;;;AAAA,IAAIA,eAAgD;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAAEC,IAAY,EAAW;EAAA,IAAAC,qBAAA;EACtD;EACA,IAAK,QAAQ,KAAK,OAAOD,IAAI,IAAI,CAAC,CAAC,KAAKA,IAAI,CAACE,OAAO,CAAE,GAAI,CAAC,EAAG;IAC7D,OAAOF,IAAI;EACZ;;EAEA;EACA,IAAKG,SAAS,KAAKL,eAAe,EAAG;IACpC,IACCM,QAAQ,CAACC,cAAc,IACvBD,QAAQ,CAACC,cAAc,CAACC,kBAAkB,EACzC;MACDR,eAAe,GAAGM,QAAQ,CAACC,cAAc,CACvCC,kBAAkB,CAAE,EAAG,CAAC,CACxBC,aAAa,CAAE,UAAW,CAAC;IAC9B,CAAC,MAAM;MACNT,eAAe,GAAGM,QAAQ,CAACG,aAAa,CAAE,UAAW,CAAC;IACvD;EACD;EAEAT,eAAe,CAACU,SAAS,GAAGR,IAAI;EAChC,MAAMS,OAAO,IAAAR,qBAAA,GAAGH,eAAe,CAACY,WAAW,cAAAT,qBAAA,cAAAA,qBAAA,GAAI,EAAE;EACjDH,eAAe,CAACU,SAAS,GAAG,EAAE;;EAE9B;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,OAAOC,OAAO;AACf","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["let _decodeTextArea: HTMLTextAreaElement | undefined;\n\n/**\n * Decodes the HTML entities from a given string.\n *\n * @param html String that contain HTML entities.\n *\n * @example\n * ```js\n * import { decodeEntities } from '@wordpress/html-entities';\n *\n * const result = decodeEntities( 'á' );\n * console.log( result ); // result will be \"\u00E1\"\n * ```\n *\n * @return The decoded string.\n */\nexport function decodeEntities( html: string ): string {\n\t// Not a string, or no entities to decode.\n\tif ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {\n\t\treturn html;\n\t}\n\n\t// Create a textarea for decoding entities, that we can reuse.\n\tif ( undefined === _decodeTextArea ) {\n\t\tif (\n\t\t\tdocument.implementation &&\n\t\t\tdocument.implementation.createHTMLDocument\n\t\t) {\n\t\t\t_decodeTextArea = document.implementation\n\t\t\t\t.createHTMLDocument( '' )\n\t\t\t\t.createElement( 'textarea' );\n\t\t} else {\n\t\t\t_decodeTextArea = document.createElement( 'textarea' );\n\t\t}\n\t}\n\n\t_decodeTextArea.innerHTML = html;\n\tconst decoded = _decodeTextArea.textContent ?? '';\n\t_decodeTextArea.innerHTML = '';\n\n\t/**\n\t * Cast to string, HTMLTextAreaElement should always have `string` textContent.\n\t *\n\t * > The `textContent` property of the `Node` interface represents the text content of the\n\t * > node and its descendants.\n\t * >\n\t * > Value: A string or `null`\n\t * >\n\t * > * If the node is a `document` or a Doctype, `textContent` returns `null`.\n\t * > * If the node is a CDATA section, comment, processing instruction, or text node,\n\t * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.\n\t * > * For other node types, `textContent returns the concatenation of the textContent of\n\t * > every child node, excluding comments and processing instructions. (This is an empty\n\t * > string if the node has no children.)\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n\t */\n\treturn decoded;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAI;AAiBG,SAAS,eAAgB,MAAuB;AAEtD,MAAK,aAAa,OAAO,QAAQ,OAAO,KAAK,QAAS,GAAI,GAAI;AAC7D,WAAO;AAAA,EACR;AAGA,MAAK,WAAc,iBAAkB;AACpC,QACC,SAAS,kBACT,SAAS,eAAe,oBACvB;AACD,wBAAkB,SAAS,eACzB,mBAAoB,EAAG,EACvB,cAAe,UAAW;AAAA,IAC7B,OAAO;AACN,wBAAkB,SAAS,cAAe,UAAW;AAAA,IACtD;AAAA,EACD;AAEA,kBAAgB,YAAY;AAC5B,QAAM,UAAU,gBAAgB,eAAe;AAC/C,kBAAgB,YAAY;AAmB5B,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,56 +1,21 @@
1
1
  let _decodeTextArea;
2
-
3
- /**
4
- * Decodes the HTML entities from a given string.
5
- *
6
- * @param html String that contain HTML entities.
7
- *
8
- * @example
9
- * ```js
10
- * import { decodeEntities } from '@wordpress/html-entities';
11
- *
12
- * const result = decodeEntities( 'á' );
13
- * console.log( result ); // result will be "á"
14
- * ```
15
- *
16
- * @return The decoded string.
17
- */
18
- export function decodeEntities(html) {
19
- var _decodeTextArea$textC;
20
- // Not a string, or no entities to decode.
21
- if ('string' !== typeof html || -1 === html.indexOf('&')) {
2
+ function decodeEntities(html) {
3
+ if ("string" !== typeof html || -1 === html.indexOf("&")) {
22
4
  return html;
23
5
  }
24
-
25
- // Create a textarea for decoding entities, that we can reuse.
26
- if (undefined === _decodeTextArea) {
6
+ if (void 0 === _decodeTextArea) {
27
7
  if (document.implementation && document.implementation.createHTMLDocument) {
28
- _decodeTextArea = document.implementation.createHTMLDocument('').createElement('textarea');
8
+ _decodeTextArea = document.implementation.createHTMLDocument("").createElement("textarea");
29
9
  } else {
30
- _decodeTextArea = document.createElement('textarea');
10
+ _decodeTextArea = document.createElement("textarea");
31
11
  }
32
12
  }
33
13
  _decodeTextArea.innerHTML = html;
34
- const decoded = (_decodeTextArea$textC = _decodeTextArea.textContent) !== null && _decodeTextArea$textC !== void 0 ? _decodeTextArea$textC : '';
35
- _decodeTextArea.innerHTML = '';
36
-
37
- /**
38
- * Cast to string, HTMLTextAreaElement should always have `string` textContent.
39
- *
40
- * > The `textContent` property of the `Node` interface represents the text content of the
41
- * > node and its descendants.
42
- * >
43
- * > Value: A string or `null`
44
- * >
45
- * > * If the node is a `document` or a Doctype, `textContent` returns `null`.
46
- * > * If the node is a CDATA section, comment, processing instruction, or text node,
47
- * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.
48
- * > * For other node types, `textContent returns the concatenation of the textContent of
49
- * > every child node, excluding comments and processing instructions. (This is an empty
50
- * > string if the node has no children.)
51
- *
52
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent
53
- */
14
+ const decoded = _decodeTextArea.textContent ?? "";
15
+ _decodeTextArea.innerHTML = "";
54
16
  return decoded;
55
17
  }
56
- //# sourceMappingURL=index.js.map
18
+ export {
19
+ decodeEntities
20
+ };
21
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_decodeTextArea","decodeEntities","html","_decodeTextArea$textC","indexOf","undefined","document","implementation","createHTMLDocument","createElement","innerHTML","decoded","textContent"],"sources":["@wordpress/html-entities/src/index.ts"],"sourcesContent":["let _decodeTextArea: HTMLTextAreaElement | undefined;\n\n/**\n * Decodes the HTML entities from a given string.\n *\n * @param html String that contain HTML entities.\n *\n * @example\n * ```js\n * import { decodeEntities } from '@wordpress/html-entities';\n *\n * const result = decodeEntities( 'á' );\n * console.log( result ); // result will be \"á\"\n * ```\n *\n * @return The decoded string.\n */\nexport function decodeEntities( html: string ): string {\n\t// Not a string, or no entities to decode.\n\tif ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {\n\t\treturn html;\n\t}\n\n\t// Create a textarea for decoding entities, that we can reuse.\n\tif ( undefined === _decodeTextArea ) {\n\t\tif (\n\t\t\tdocument.implementation &&\n\t\t\tdocument.implementation.createHTMLDocument\n\t\t) {\n\t\t\t_decodeTextArea = document.implementation\n\t\t\t\t.createHTMLDocument( '' )\n\t\t\t\t.createElement( 'textarea' );\n\t\t} else {\n\t\t\t_decodeTextArea = document.createElement( 'textarea' );\n\t\t}\n\t}\n\n\t_decodeTextArea.innerHTML = html;\n\tconst decoded = _decodeTextArea.textContent ?? '';\n\t_decodeTextArea.innerHTML = '';\n\n\t/**\n\t * Cast to string, HTMLTextAreaElement should always have `string` textContent.\n\t *\n\t * > The `textContent` property of the `Node` interface represents the text content of the\n\t * > node and its descendants.\n\t * >\n\t * > Value: A string or `null`\n\t * >\n\t * > * If the node is a `document` or a Doctype, `textContent` returns `null`.\n\t * > * If the node is a CDATA section, comment, processing instruction, or text node,\n\t * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.\n\t * > * For other node types, `textContent returns the concatenation of the textContent of\n\t * > every child node, excluding comments and processing instructions. (This is an empty\n\t * > string if the node has no children.)\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n\t */\n\treturn decoded;\n}\n"],"mappings":"AAAA,IAAIA,eAAgD;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAEC,IAAY,EAAW;EAAA,IAAAC,qBAAA;EACtD;EACA,IAAK,QAAQ,KAAK,OAAOD,IAAI,IAAI,CAAC,CAAC,KAAKA,IAAI,CAACE,OAAO,CAAE,GAAI,CAAC,EAAG;IAC7D,OAAOF,IAAI;EACZ;;EAEA;EACA,IAAKG,SAAS,KAAKL,eAAe,EAAG;IACpC,IACCM,QAAQ,CAACC,cAAc,IACvBD,QAAQ,CAACC,cAAc,CAACC,kBAAkB,EACzC;MACDR,eAAe,GAAGM,QAAQ,CAACC,cAAc,CACvCC,kBAAkB,CAAE,EAAG,CAAC,CACxBC,aAAa,CAAE,UAAW,CAAC;IAC9B,CAAC,MAAM;MACNT,eAAe,GAAGM,QAAQ,CAACG,aAAa,CAAE,UAAW,CAAC;IACvD;EACD;EAEAT,eAAe,CAACU,SAAS,GAAGR,IAAI;EAChC,MAAMS,OAAO,IAAAR,qBAAA,GAAGH,eAAe,CAACY,WAAW,cAAAT,qBAAA,cAAAA,qBAAA,GAAI,EAAE;EACjDH,eAAe,CAACU,SAAS,GAAG,EAAE;;EAE9B;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,OAAOC,OAAO;AACf","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["let _decodeTextArea: HTMLTextAreaElement | undefined;\n\n/**\n * Decodes the HTML entities from a given string.\n *\n * @param html String that contain HTML entities.\n *\n * @example\n * ```js\n * import { decodeEntities } from '@wordpress/html-entities';\n *\n * const result = decodeEntities( 'á' );\n * console.log( result ); // result will be \"\u00E1\"\n * ```\n *\n * @return The decoded string.\n */\nexport function decodeEntities( html: string ): string {\n\t// Not a string, or no entities to decode.\n\tif ( 'string' !== typeof html || -1 === html.indexOf( '&' ) ) {\n\t\treturn html;\n\t}\n\n\t// Create a textarea for decoding entities, that we can reuse.\n\tif ( undefined === _decodeTextArea ) {\n\t\tif (\n\t\t\tdocument.implementation &&\n\t\t\tdocument.implementation.createHTMLDocument\n\t\t) {\n\t\t\t_decodeTextArea = document.implementation\n\t\t\t\t.createHTMLDocument( '' )\n\t\t\t\t.createElement( 'textarea' );\n\t\t} else {\n\t\t\t_decodeTextArea = document.createElement( 'textarea' );\n\t\t}\n\t}\n\n\t_decodeTextArea.innerHTML = html;\n\tconst decoded = _decodeTextArea.textContent ?? '';\n\t_decodeTextArea.innerHTML = '';\n\n\t/**\n\t * Cast to string, HTMLTextAreaElement should always have `string` textContent.\n\t *\n\t * > The `textContent` property of the `Node` interface represents the text content of the\n\t * > node and its descendants.\n\t * >\n\t * > Value: A string or `null`\n\t * >\n\t * > * If the node is a `document` or a Doctype, `textContent` returns `null`.\n\t * > * If the node is a CDATA section, comment, processing instruction, or text node,\n\t * > textContent returns the text inside the node, i.e., the `Node.nodeValue`.\n\t * > * For other node types, `textContent returns the concatenation of the textContent of\n\t * > every child node, excluding comments and processing instructions. (This is an empty\n\t * > string if the node has no children.)\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent\n\t */\n\treturn decoded;\n}\n"],
5
+ "mappings": "AAAA,IAAI;AAiBG,SAAS,eAAgB,MAAuB;AAEtD,MAAK,aAAa,OAAO,QAAQ,OAAO,KAAK,QAAS,GAAI,GAAI;AAC7D,WAAO;AAAA,EACR;AAGA,MAAK,WAAc,iBAAkB;AACpC,QACC,SAAS,kBACT,SAAS,eAAe,oBACvB;AACD,wBAAkB,SAAS,eACzB,mBAAoB,EAAG,EACvB,cAAe,UAAW;AAAA,IAC7B,OAAO;AACN,wBAAkB,SAAS,cAAe,UAAW;AAAA,IACtD;AAAA,EACD;AAEA,kBAAgB,YAAY;AAC5B,QAAM,UAAU,gBAAgB,eAAe;AAC/C,kBAAgB,YAAY;AAmB5B,SAAO;AACR;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/html-entities",
3
- "version": "4.32.0",
3
+ "version": "4.32.1-next.47f435fc9.0",
4
4
  "description": "HTML entity utilities for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -25,14 +25,19 @@
25
25
  },
26
26
  "main": "build/index.js",
27
27
  "module": "build-module/index.js",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./build-types/index.d.ts",
31
+ "import": "./build-module/index.js",
32
+ "require": "./build/index.js"
33
+ },
34
+ "./package.json": "./package.json"
35
+ },
28
36
  "react-native": "src/index",
29
37
  "wpScript": true,
30
38
  "types": "build-types",
31
- "dependencies": {
32
- "@babel/runtime": "7.25.7"
33
- },
34
39
  "publishConfig": {
35
40
  "access": "public"
36
41
  },
37
- "gitHead": "a030b4c0e0695239b942c7dc18511782b64f10ed"
42
+ "gitHead": "9720f22c138771d2ed1a0522725c3cdf1c242953"
38
43
  }