@react-foundry/client-component-helpers 0.1.9 → 0.2.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.js +1 -17
- package/dist/is-mounted.js +4 -8
- package/package.json +7 -9
- package/dist/index.mjs +0 -1
- package/dist/is-mounted.mjs +0 -10
package/dist/index.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./is-mounted"), exports);
|
|
1
|
+
export * from './is-mounted';
|
package/dist/is-mounted.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsMounted = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
5
2
|
// Inspired by:
|
|
6
3
|
// - https://tech.willhaben.at/how-to-shoot-yourself-in-the-foot-in-react-401e7dbba720
|
|
7
4
|
// - https://www.joshwcomeau.com/react/the-perils-of-rehydration/
|
|
8
|
-
const useIsMounted = () => {
|
|
9
|
-
const [isMounted, setIsMounted] =
|
|
5
|
+
export const useIsMounted = () => {
|
|
6
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
10
7
|
const markAsMounted = () => setIsMounted(true);
|
|
11
|
-
|
|
8
|
+
useEffect(markAsMounted, []);
|
|
12
9
|
return isMounted;
|
|
13
10
|
};
|
|
14
|
-
exports.useIsMounted = useIsMounted;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-foundry/client-component-helpers",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Helper functions for writing client components.",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": {
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"import": "./dist/index.
|
|
10
|
-
"
|
|
11
|
-
"default": "./dist/index.mjs"
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "Daniel A.C. Martin <npm@daniel-martin.co.uk> (http://daniel-martin.co.uk/)",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"react": "^19.2.
|
|
20
|
+
"react": "^19.2.5"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/react": "19.2.14",
|
|
@@ -25,11 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
28
|
-
"build": "
|
|
29
|
-
"build:esm": "tsc -m es2022 && find dist -name '*.js' -exec sh -c 'mv \"$0\" \"${0%.js}.mjs\"' {} \\;",
|
|
30
|
-
"build:cjs": "tsc",
|
|
28
|
+
"build": "tsc",
|
|
31
29
|
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
32
30
|
},
|
|
33
|
-
"module": "dist/index.
|
|
31
|
+
"module": "dist/index.js",
|
|
34
32
|
"typings": "dist/index.d.ts"
|
|
35
33
|
}
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './is-mounted';
|
package/dist/is-mounted.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
// Inspired by:
|
|
3
|
-
// - https://tech.willhaben.at/how-to-shoot-yourself-in-the-foot-in-react-401e7dbba720
|
|
4
|
-
// - https://www.joshwcomeau.com/react/the-perils-of-rehydration/
|
|
5
|
-
export const useIsMounted = () => {
|
|
6
|
-
const [isMounted, setIsMounted] = useState(false);
|
|
7
|
-
const markAsMounted = () => setIsMounted(true);
|
|
8
|
-
useEffect(markAsMounted, []);
|
|
9
|
-
return isMounted;
|
|
10
|
-
};
|