@wordpress/react-inert-value 2.0.0 → 2.1.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.cjs CHANGED
@@ -1,38 +1,32 @@
1
1
  "use strict";
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
-
20
- // packages/react-inert-value/src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- inertValue: () => inertValue
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
24
5
  });
25
- module.exports = __toCommonJS(index_exports);
26
- var import_react = require("react");
27
- var majorVersion = parseInt(import_react.version, 10);
6
+ let react = require("react");
7
+ // packages/react-inert-value/src/index.ts
8
+ const majorVersion = parseInt(react.version, 10);
9
+ /**
10
+ * Returns a value for the `inert` prop that the running version of React
11
+ * renders as the `inert` HTML attribute.
12
+ *
13
+ * React 19 handles `inert` as a boolean attribute, while React 18 knows nothing
14
+ * about `inert` and ignores `inert={ true }`, so it has to be given the string
15
+ * `'true'` instead.
16
+ *
17
+ * The return type describes what React 19 types accept. React 18 doesn't support
18
+ * `inert` HTML attribute at all, so a TypeScript call site still
19
+ * needs a `@ts-expect-error` annotation.
20
+ *
21
+ * Inspired by the helper of the same name in the Base UI library.
22
+ *
23
+ * @param value Boolean value for the `inert` prop.
24
+ * @return The actual value to pass to the `inert` prop.
25
+ */
28
26
  function inertValue(value) {
29
- if (majorVersion >= 19) {
30
- return value;
31
- }
32
- return value ? "true" : void 0;
27
+ if (majorVersion >= 19) return value;
28
+ return value ? "true" : void 0;
33
29
  }
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- inertValue
37
- });
38
- //# sourceMappingURL=index.cjs.map
30
+ exports.inertValue = inertValue;
31
+
32
+ //# sourceMappingURL=index.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts"],
4
- "sourcesContent": ["// eslint-disable-next-line @typescript-eslint/no-restricted-imports\nimport { version } from 'react';\n\nconst majorVersion = parseInt( version, 10 );\n\n/**\n * Returns a value for the `inert` prop that the running version of React\n * renders as the `inert` HTML attribute.\n *\n * React 19 handles `inert` as a boolean attribute, while React 18 knows nothing\n * about `inert` and ignores `inert={ true }`, so it has to be given the string\n * `'true'` instead.\n *\n * The return type describes what React 19 types accept. React 18 doesn't support\n * `inert` HTML attribute at all, so a TypeScript call site still\n * needs a `@ts-expect-error` annotation.\n *\n * Inspired by the helper of the same name in the Base UI library.\n *\n * @param value Boolean value for the `inert` prop.\n * @return The actual value to pass to the `inert` prop.\n */\nexport function inertValue( value?: boolean ): boolean | undefined {\n\tif ( majorVersion >= 19 ) {\n\t\treturn value;\n\t}\n\n\treturn ( value ? 'true' : undefined ) as unknown as boolean | undefined;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAwB;AAExB,IAAM,eAAe,SAAU,sBAAS,EAAG;AAmBpC,SAAS,WAAY,OAAuC;AAClE,MAAK,gBAAgB,IAAK;AACzB,WAAO;AAAA,EACR;AAEA,SAAS,QAAQ,SAAS;AAC3B;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"index.cjs","names":["version"],"sources":["../src/index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-restricted-imports\nimport { version } from 'react';\n\nconst majorVersion = parseInt( version, 10 );\n\n/**\n * Returns a value for the `inert` prop that the running version of React\n * renders as the `inert` HTML attribute.\n *\n * React 19 handles `inert` as a boolean attribute, while React 18 knows nothing\n * about `inert` and ignores `inert={ true }`, so it has to be given the string\n * `'true'` instead.\n *\n * The return type describes what React 19 types accept. React 18 doesn't support\n * `inert` HTML attribute at all, so a TypeScript call site still\n * needs a `@ts-expect-error` annotation.\n *\n * Inspired by the helper of the same name in the Base UI library.\n *\n * @param value Boolean value for the `inert` prop.\n * @return The actual value to pass to the `inert` prop.\n */\nexport function inertValue( value?: boolean ): boolean | undefined {\n\tif ( majorVersion >= 19 ) {\n\t\treturn value;\n\t}\n\n\treturn ( value ? 'true' : undefined ) as unknown as boolean | undefined;\n}\n"],"mappings":";;;;;;;AAGA,MAAM,eAAe,SAAUA,MAAAA,SAAS,EAAG;;;;;;;;;;;;;;;;;;AAmB3C,SAAgB,WAAY,OAAuC;CAClE,IAAK,gBAAgB,IACpB,OAAO;CAGR,OAAS,QAAQ,SAAS,KAAA;AAC3B"}
@@ -1,13 +1,27 @@
1
- // packages/react-inert-value/src/index.ts
2
1
  import { version } from "react";
3
- var majorVersion = parseInt(version, 10);
2
+ // packages/react-inert-value/src/index.ts
3
+ const majorVersion = parseInt(version, 10);
4
+ /**
5
+ * Returns a value for the `inert` prop that the running version of React
6
+ * renders as the `inert` HTML attribute.
7
+ *
8
+ * React 19 handles `inert` as a boolean attribute, while React 18 knows nothing
9
+ * about `inert` and ignores `inert={ true }`, so it has to be given the string
10
+ * `'true'` instead.
11
+ *
12
+ * The return type describes what React 19 types accept. React 18 doesn't support
13
+ * `inert` HTML attribute at all, so a TypeScript call site still
14
+ * needs a `@ts-expect-error` annotation.
15
+ *
16
+ * Inspired by the helper of the same name in the Base UI library.
17
+ *
18
+ * @param value Boolean value for the `inert` prop.
19
+ * @return The actual value to pass to the `inert` prop.
20
+ */
4
21
  function inertValue(value) {
5
- if (majorVersion >= 19) {
6
- return value;
7
- }
8
- return value ? "true" : void 0;
22
+ if (majorVersion >= 19) return value;
23
+ return value ? "true" : void 0;
9
24
  }
10
- export {
11
- inertValue
12
- };
13
- //# sourceMappingURL=index.mjs.map
25
+ export { inertValue };
26
+
27
+ //# sourceMappingURL=index.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts"],
4
- "sourcesContent": ["// eslint-disable-next-line @typescript-eslint/no-restricted-imports\nimport { version } from 'react';\n\nconst majorVersion = parseInt( version, 10 );\n\n/**\n * Returns a value for the `inert` prop that the running version of React\n * renders as the `inert` HTML attribute.\n *\n * React 19 handles `inert` as a boolean attribute, while React 18 knows nothing\n * about `inert` and ignores `inert={ true }`, so it has to be given the string\n * `'true'` instead.\n *\n * The return type describes what React 19 types accept. React 18 doesn't support\n * `inert` HTML attribute at all, so a TypeScript call site still\n * needs a `@ts-expect-error` annotation.\n *\n * Inspired by the helper of the same name in the Base UI library.\n *\n * @param value Boolean value for the `inert` prop.\n * @return The actual value to pass to the `inert` prop.\n */\nexport function inertValue( value?: boolean ): boolean | undefined {\n\tif ( majorVersion >= 19 ) {\n\t\treturn value;\n\t}\n\n\treturn ( value ? 'true' : undefined ) as unknown as boolean | undefined;\n}\n"],
5
- "mappings": ";AACA,SAAS,eAAe;AAExB,IAAM,eAAe,SAAU,SAAS,EAAG;AAmBpC,SAAS,WAAY,OAAuC;AAClE,MAAK,gBAAgB,IAAK;AACzB,WAAO;AAAA,EACR;AAEA,SAAS,QAAQ,SAAS;AAC3B;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-restricted-imports\nimport { version } from 'react';\n\nconst majorVersion = parseInt( version, 10 );\n\n/**\n * Returns a value for the `inert` prop that the running version of React\n * renders as the `inert` HTML attribute.\n *\n * React 19 handles `inert` as a boolean attribute, while React 18 knows nothing\n * about `inert` and ignores `inert={ true }`, so it has to be given the string\n * `'true'` instead.\n *\n * The return type describes what React 19 types accept. React 18 doesn't support\n * `inert` HTML attribute at all, so a TypeScript call site still\n * needs a `@ts-expect-error` annotation.\n *\n * Inspired by the helper of the same name in the Base UI library.\n *\n * @param value Boolean value for the `inert` prop.\n * @return The actual value to pass to the `inert` prop.\n */\nexport function inertValue( value?: boolean ): boolean | undefined {\n\tif ( majorVersion >= 19 ) {\n\t\treturn value;\n\t}\n\n\treturn ( value ? 'true' : undefined ) as unknown as boolean | undefined;\n}\n"],"mappings":";;AAGA,MAAM,eAAe,SAAU,SAAS,EAAG;;;;;;;;;;;;;;;;;;AAmB3C,SAAgB,WAAY,OAAuC;CAClE,IAAK,gBAAgB,IACpB,OAAO;CAGR,OAAS,QAAQ,SAAS,KAAA;AAC3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/react-inert-value",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Return a React `inert` prop value that works under both React 18 and React 19.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -42,7 +42,7 @@
42
42
  "types": "build-types",
43
43
  "sideEffects": false,
44
44
  "devDependencies": {
45
- "vitest": "^5.0.3"
45
+ "vitest": "^5.0.5"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@types/react": "^18 || ^19",
@@ -56,5 +56,5 @@
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  },
59
- "gitHead": "8d30f92cbbde3ddf781c8799443c649befbbcb88"
59
+ "gitHead": "9b70363b9f93cff0583a1f3153738d383cf5a49e"
60
60
  }