@hanzogui/use-did-finish-ssr 8.3.0 → 8.3.2

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.
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientOnly = exports.ClientOnlyContext = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ exports.ClientOnlyContext = (0, react_1.createContext)(false);
7
+ const ClientOnly = ({ children, enabled, }) => {
8
+ const existingValue = (0, react_1.useContext)(exports.ClientOnlyContext);
9
+ return ((0, jsx_runtime_1.jsx)(exports.ClientOnlyContext.Provider, { value: enabled ?? existingValue, children: children }));
10
+ };
11
+ exports.ClientOnly = ClientOnly;
12
+ //# sourceMappingURL=ClientOnly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientOnly.js","sourceRoot":"","sources":["../../src/ClientOnly.tsx"],"names":[],"mappings":";;;;AAAA,iCAAiD;AAEpC,QAAA,iBAAiB,GAA2B,IAAA,qBAAa,EAAC,KAAK,CAAC,CAAA;AAEtE,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,OAAO,GAIR,EAAmB,EAAE;IACpB,MAAM,aAAa,GAAG,IAAA,kBAAU,EAAC,QAAA,iBAAiB,CAAC,CAAA;IACnD,OAAO,CACL,uBAAC,QAAA,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAI,aAAa,YACxD,QAAQ,GACkB,CAC9B,CAAA;AACH,CAAC,CAAA;AAbY,QAAA,UAAU,GAAV,UAAU,CAatB"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useIsClientOnly = exports.ClientOnlyContext = exports.ClientOnly = void 0;
4
+ exports.useDidFinishSSR = useDidFinishSSR;
5
+ exports.useClientValue = useClientValue;
6
+ const tslib_1 = require("tslib");
7
+ const React = tslib_1.__importStar(require("react"));
8
+ const ClientOnly_tsx_1 = require("./ClientOnly.js");
9
+ var ClientOnly_tsx_2 = require("./ClientOnly.js");
10
+ Object.defineProperty(exports, "ClientOnly", { enumerable: true, get: function () { return ClientOnly_tsx_2.ClientOnly; } });
11
+ Object.defineProperty(exports, "ClientOnlyContext", { enumerable: true, get: function () { return ClientOnly_tsx_2.ClientOnlyContext; } });
12
+ const useIsClientOnly = () => {
13
+ return React.useContext(ClientOnly_tsx_1.ClientOnlyContext);
14
+ };
15
+ exports.useIsClientOnly = useIsClientOnly;
16
+ function useDidFinishSSR() {
17
+ const clientOnly = React.useContext(ClientOnly_tsx_1.ClientOnlyContext);
18
+ if (clientOnly || "web" === 'native') {
19
+ return true;
20
+ }
21
+ return React.useSyncExternalStore(subscribe, () => true, () => false);
22
+ }
23
+ const subscribe = () => () => { };
24
+ function useClientValue(value) {
25
+ const done = useDidFinishSSR();
26
+ // @ts-expect-error this is fine but started to error in ts latest
27
+ return !done ? undefined : typeof value === 'function' ? value() : value;
28
+ }
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,MAAY,KAAK,0CAAa;AAC9B,oDAAoD;AAEpD,kDAAgE;AAAvD,4GAAA,UAAU,OAAA;AAAE,mHAAA,iBAAiB,OAAA;AAE/B,MAAM,eAAe,GAAG,GAAY,EAAE;IAC3C,OAAO,KAAK,CAAC,UAAU,CAAC,kCAAiB,CAAC,CAAA;AAC5C,CAAC,CAAA;AAFY,QAAA,eAAe,GAAf,eAAe,CAE3B;AAED;IACE,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,kCAAiB,CAAC,CAAA;IAEtD,IAAI,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QACtD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,KAAK,CAAC,oBAAoB,CAC/B,SAAS,EACT,GAAG,EAAE,CAAC,IAAI,EACV,GAAG,EAAE,CAAC,KAAK,CACZ,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAAA;AAIhC,wBAAsC,KAAa;IACjD,MAAM,IAAI,GAAG,eAAe,EAAE,CAAA;IAC9B,kEAAkE;IAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;AAC1E,CAAC"}
@@ -0,0 +1 @@
1
+ { "type": "commonjs" }
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from 'react';
3
+ export const ClientOnlyContext = createContext(false);
4
+ export const ClientOnly = ({ children, enabled, }) => {
5
+ const existingValue = useContext(ClientOnlyContext);
6
+ return (_jsx(ClientOnlyContext.Provider, { value: enabled ?? existingValue, children: children }));
7
+ };
8
+ //# sourceMappingURL=ClientOnly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClientOnly.js","sourceRoot":"","sources":["../../src/ClientOnly.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAA2B,aAAa,CAAC,KAAK,CAAC,CAAA;AAE7E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,OAAO,GAIR,EAAmB,EAAE;IACpB,MAAM,aAAa,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IACnD,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IAAI,aAAa,YACxD,QAAQ,GACkB,CAC9B,CAAA;AACH,CAAC,CAAA"}
package/dist/esm/index.js CHANGED
@@ -1,15 +1,20 @@
1
- import * as React from "react";
2
- import { ClientOnly, ClientOnlyContext, ClientOnlyContext as ClientOnlyContext2 } from "./ClientOnly.mjs";
3
- const useIsClientOnly = () => {
4
- return React.useContext(ClientOnlyContext);
1
+ import * as React from 'react';
2
+ import { ClientOnlyContext } from './ClientOnly.js';
3
+ export { ClientOnly, ClientOnlyContext } from './ClientOnly.js';
4
+ export const useIsClientOnly = () => {
5
+ return React.useContext(ClientOnlyContext);
5
6
  };
6
- function useDidFinishSSR() {
7
- if (React.useContext(ClientOnlyContext) || false) return true;
8
- return React.useSyncExternalStore(subscribe, () => true, () => false);
7
+ export function useDidFinishSSR() {
8
+ const clientOnly = React.useContext(ClientOnlyContext);
9
+ if (clientOnly || "web" === 'native') {
10
+ return true;
11
+ }
12
+ return React.useSyncExternalStore(subscribe, () => true, () => false);
9
13
  }
10
- const subscribe = () => () => {};
11
- function useClientValue(value) {
12
- return !useDidFinishSSR() ? void 0 : typeof value === "function" ? value() : value;
14
+ const subscribe = () => () => { };
15
+ export function useClientValue(value) {
16
+ const done = useDidFinishSSR();
17
+ // @ts-expect-error this is fine but started to error in ts latest
18
+ return !done ? undefined : typeof value === 'function' ? value() : value;
13
19
  }
14
- export { ClientOnly, ClientOnlyContext2 as ClientOnlyContext, useClientValue, useDidFinishSSR, useIsClientOnly };
15
- //# sourceMappingURL=index.js.map
20
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","ClientOnly","ClientOnlyContext","ClientOnlyContext2","useIsClientOnly","useContext","useDidFinishSSR","useSyncExternalStore","subscribe","useClientValue","value"],"sources":["index.mjs"],"sourcesContent":["import * as React from \"react\";\nimport { ClientOnly, ClientOnlyContext, ClientOnlyContext as ClientOnlyContext2 } from \"./ClientOnly\";\n\nconst useIsClientOnly = () => {\n\treturn React.useContext(ClientOnlyContext);\n};\nfunction useDidFinishSSR() {\n\tif (React.useContext(ClientOnlyContext) || false) return true;\n\treturn React.useSyncExternalStore(subscribe, () => true, () => false);\n}\nconst subscribe = () => () => {};\nfunction useClientValue(value) {\n\treturn !useDidFinishSSR() ? void 0 : typeof value === \"function\" ? value() : value;\n}\n\nexport { ClientOnly, ClientOnlyContext2 as ClientOnlyContext, useClientValue, useDidFinishSSR, useIsClientOnly };"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,iBAAiB,EAAEA,iBAAiB,IAAIC,kBAAkB,QAAQ,kBAAc;AAErG,MAAMC,eAAe,GAAGA,CAAA,KAAM;EAC7B,OAAOJ,KAAK,CAACK,UAAU,CAACH,iBAAiB,CAAC;AAC3C,CAAC;AACD,SAASI,eAAeA,CAAA,EAAG;EAC1B,IAAIN,KAAK,CAACK,UAAU,CAACH,iBAAiB,CAAC,IAAI,KAAK,EAAE,OAAO,IAAI;EAC7D,OAAOF,KAAK,CAACO,oBAAoB,CAACC,SAAS,EAAE,MAAM,IAAI,EAAE,MAAM,KAAK,CAAC;AACtE;AACA,MAAMA,SAAS,GAAGA,CAAA,KAAM,MAAM,CAAC,CAAC;AAChC,SAASC,cAAcA,CAACC,KAAK,EAAE;EAC9B,OAAO,CAACJ,eAAe,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,OAAOI,KAAK,KAAK,UAAU,GAAGA,KAAK,CAAC,CAAC,GAAGA,KAAK;AACnF;AAEA,SAAST,UAAU,EAAEE,kBAAkB,IAAID,iBAAiB,EAAEO,cAAc,EAAEH,eAAe,EAAEF,eAAe","ignoreList":[]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAkB,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAkB,CAAA;AAEhE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAY,EAAE;IAC3C,OAAO,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAA;AAC5C,CAAC,CAAA;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAEtD,IAAI,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QACtD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,KAAK,CAAC,oBAAoB,CAC/B,SAAS,EACT,GAAG,EAAE,CAAC,IAAI,EACV,GAAG,EAAE,CAAC,KAAK,CACZ,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAAA;AAIhC,MAAM,UAAU,cAAc,CAAQ,KAAa;IACjD,MAAM,IAAI,GAAG,eAAe,EAAE,CAAA;IAC9B,kEAAkE;IAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;AAC1E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzogui/use-did-finish-ssr",
3
- "version": "8.3.0",
3
+ "version": "8.3.2",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "files": [
6
6
  "src",
@@ -9,36 +9,36 @@
9
9
  ],
10
10
  "type": "module",
11
11
  "sideEffects": false,
12
- "main": "dist/cjs",
13
- "module": "dist/esm",
12
+ "main": "./dist/cjs/index.js",
13
+ "module": "./dist/esm/index.js",
14
14
  "types": "./types/index.d.ts",
15
15
  "exports": {
16
16
  "./package.json": "./package.json",
17
17
  ".": {
18
18
  "types": "./types/index.d.ts",
19
- "react-native": "./dist/esm/index.native.js",
20
- "browser": "./dist/esm/index.mjs",
21
- "module": "./dist/esm/index.mjs",
22
- "import": "./dist/esm/index.mjs",
23
- "require": "./dist/cjs/index.cjs",
24
- "default": "./dist/esm/index.mjs"
19
+ "react-native": "./dist/esm/index.js",
20
+ "browser": "./dist/esm/index.js",
21
+ "module": "./dist/esm/index.js",
22
+ "import": "./dist/esm/index.js",
23
+ "require": "./dist/cjs/index.js",
24
+ "default": "./dist/esm/index.js"
25
25
  }
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
30
  "scripts": {
31
- "build": "hanzogui-build",
31
+ "build": "hanzogui-build --skip-native",
32
32
  "watch": "hanzogui-build --watch",
33
33
  "clean": "hanzogui-build clean",
34
34
  "clean:build": "hanzogui-build clean:build"
35
35
  },
36
36
  "devDependencies": {
37
- "@hanzogui/build": "8.3.0",
38
- "react": ">=19"
37
+ "@hanzogui/build": "8.3.2",
38
+ "react": "19.2.8"
39
39
  },
40
40
  "peerDependencies": {
41
- "react": ">=19"
41
+ "react": ">=19.2.8"
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react'
2
- import { ClientOnlyContext } from './ClientOnly'
2
+ import { ClientOnlyContext } from './ClientOnly.tsx'
3
3
 
4
- export { ClientOnly, ClientOnlyContext } from './ClientOnly'
4
+ export { ClientOnly, ClientOnlyContext } from './ClientOnly.tsx'
5
5
 
6
6
  export const useIsClientOnly = (): boolean => {
7
7
  return React.useContext(ClientOnlyContext)
@@ -1,7 +1,6 @@
1
1
  export declare const ClientOnlyContext: React.Context<boolean>;
2
- export declare const ClientOnly: ({ children, enabled }: {
3
- children: any;
4
- enabled?: boolean;
2
+ export declare const ClientOnly: ({ children, enabled, }: {
3
+ children: any;
4
+ enabled?: boolean;
5
5
  }) => React.ReactNode;
6
-
7
6
  //# sourceMappingURL=ClientOnly.d.ts.map
@@ -1,11 +1 @@
1
- {
2
- "mappings": "AAEA,OAAO,cAAM,mBAAmB,MAAM;AAEtC,OAAO,cAAM,aAAc,EACzB,UACA,WACC;CACD;CACA;MACE,MAAM",
3
- "names": [],
4
- "sources": [
5
- "src/ClientOnly.tsx"
6
- ],
7
- "version": 3,
8
- "sourcesContent": [
9
- "import { createContext, useContext } from 'react'\n\nexport const ClientOnlyContext: React.Context<boolean> = createContext(false)\n\nexport const ClientOnly = ({\n children,\n enabled,\n}: {\n children: any\n enabled?: boolean\n}): React.ReactNode => {\n const existingValue = useContext(ClientOnlyContext)\n return (\n <ClientOnlyContext.Provider value={enabled ?? existingValue}>\n {children}\n </ClientOnlyContext.Provider>\n )\n}\n"
10
- ]
11
- }
1
+ {"version":3,"file":"ClientOnly.d.ts","sourceRoot":"","sources":["../src/ClientOnly.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAwB,CAAA;AAE7E,eAAO,MAAM,UAAU,2BAGpB;IACD,QAAQ,EAAE,GAAG,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,KAAG,KAAK,CAAC,SAOT,CAAA"}
package/types/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- export { ClientOnly, ClientOnlyContext } from "./ClientOnly";
1
+ export { ClientOnly, ClientOnlyContext } from './ClientOnly.tsx';
2
2
  export declare const useIsClientOnly: () => boolean;
3
3
  export declare function useDidFinishSSR(): boolean;
4
4
  type FunctionOrValue<Value> = Value extends () => infer X ? X : Value;
5
5
  export declare function useClientValue<Value>(value?: Value): FunctionOrValue<Value> | undefined;
6
-
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,11 +1 @@
1
- {
2
- "mappings": "AAGA,SAAS,YAAY,yBAAyB;AAE9C,OAAO,cAAM;AAIb,OAAO,iBAAS;KAgBX,gBAAgB,SAAS,0BAA0B,IAAI,IAAI;AAEhE,OAAO,iBAAS,eAAe,OAAO,QAAQ,QAAQ,gBAAgB",
3
- "names": [],
4
- "sources": [
5
- "src/index.ts"
6
- ],
7
- "version": 3,
8
- "sourcesContent": [
9
- "import * as React from 'react'\nimport { ClientOnlyContext } from './ClientOnly'\n\nexport { ClientOnly, ClientOnlyContext } from './ClientOnly'\n\nexport const useIsClientOnly = (): boolean => {\n return React.useContext(ClientOnlyContext)\n}\n\nexport function useDidFinishSSR(): boolean {\n const clientOnly = React.useContext(ClientOnlyContext)\n\n if (clientOnly || process.env.GUI_TARGET === 'native') {\n return true\n }\n\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false\n )\n}\n\nconst subscribe = () => () => {}\n\ntype FunctionOrValue<Value> = Value extends () => infer X ? X : Value\n\nexport function useClientValue<Value>(value?: Value): FunctionOrValue<Value> | undefined {\n const done = useDidFinishSSR()\n // @ts-expect-error this is fine but started to error in ts latest\n return !done ? undefined : typeof value === 'function' ? value() : value\n}\n"
10
- ]
11
- }
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEhE,eAAO,MAAM,eAAe,QAAO,OAElC,CAAA;AAED,wBAAgB,eAAe,IAAI,OAAO,CAYzC;AAID,KAAK,eAAe,CAAC,KAAK,IAAI,KAAK,SAAS,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAErE,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CAIvF"}
@@ -1,41 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
- value: true
22
- }), mod);
23
- var ClientOnly_exports = {};
24
- __export(ClientOnly_exports, {
25
- ClientOnly: () => ClientOnly,
26
- ClientOnlyContext: () => ClientOnlyContext
27
- });
28
- module.exports = __toCommonJS(ClientOnly_exports);
29
- var import_react = require("react");
30
- var import_jsx_runtime = require("react/jsx-runtime");
31
- const ClientOnlyContext = (0, import_react.createContext)(false);
32
- const ClientOnly = ({
33
- children,
34
- enabled
35
- }) => {
36
- const existingValue = (0, import_react.useContext)(ClientOnlyContext);
37
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ClientOnlyContext.Provider, {
38
- value: enabled ?? existingValue,
39
- children
40
- });
41
- };
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
21
- };
22
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
- value: true
24
- }), mod);
25
- var ClientOnly_exports = {};
26
- __export(ClientOnly_exports, {
27
- ClientOnly: () => ClientOnly,
28
- ClientOnlyContext: () => ClientOnlyContext
29
- });
30
- module.exports = __toCommonJS(ClientOnly_exports);
31
- var import_jsx_runtime = require("react/jsx-runtime");
32
- var import_react = require("react");
33
- var ClientOnlyContext = /* @__PURE__ */(0, import_react.createContext)(false);
34
- var ClientOnly = function (param) {
35
- var {
36
- children,
37
- enabled
38
- } = param;
39
- var existingValue = (0, import_react.useContext)(ClientOnlyContext);
40
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(ClientOnlyContext.Provider, {
41
- value: enabled !== null && enabled !== void 0 ? enabled : existingValue,
42
- children
43
- });
44
- };
45
- //# sourceMappingURL=ClientOnly.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","ClientOnly_exports","__export","ClientOnly","ClientOnlyContext","module","exports","import_jsx_runtime","require","import_react","createContext","param","children","enabled","existingValue","useContext","jsx","Provider"],"sources":["../../src/ClientOnly.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,kBAAA;AAAAC,QAAA,CAAAD,kBAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA,UAAA;EAAAC,iBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAA0C,CAAAK,kBAAA;AAatC,IAAAM,kBAAA,GAAAC,OAAA;AAXG,IAAAC,YAAM,GAAAD,OAAA,QAA4C;AAElD,IAAAJ,iBAAoB,sBAAAK,YAAA,CAAAC,aAAA;AAAA,IACzBP,UAAA,YAAAA,CAAAQ,KAAA;EACA;IAAAC,QAAA;IAAAC;EAAA,IAAAF,KAAA;EACF,IAGuBG,aAAA,OAAAL,YAAA,CAAAM,UAAA,EAAAX,iBAAA;EACrB,OAAM,mBAAgBG,kBAAA,CAAAS,GAAA,EAAWZ,iBAAiB,CAAAa,QAAA;IAClDjB,KACE,EAAAa,OAAA,aAAAA,OAAA,cAAAA,OAAC,GAAAC,aAAkB;IAIvBF","ignoreList":[]}
@@ -1,56 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
30
- }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
34
- var index_exports = {};
35
- __export(index_exports, {
36
- ClientOnly: () => import_ClientOnly2.ClientOnly,
37
- ClientOnlyContext: () => import_ClientOnly2.ClientOnlyContext,
38
- useClientValue: () => useClientValue,
39
- useDidFinishSSR: () => useDidFinishSSR,
40
- useIsClientOnly: () => useIsClientOnly
41
- });
42
- module.exports = __toCommonJS(index_exports);
43
- var React = __toESM(require("react"), 1);
44
- var import_ClientOnly = require("./ClientOnly.cjs");
45
- var import_ClientOnly2 = require("./ClientOnly.cjs");
46
- const useIsClientOnly = () => {
47
- return React.useContext(import_ClientOnly.ClientOnlyContext);
48
- };
49
- function useDidFinishSSR() {
50
- if (React.useContext(import_ClientOnly.ClientOnlyContext) || false) return true;
51
- return React.useSyncExternalStore(subscribe, () => true, () => false);
52
- }
53
- const subscribe = () => () => {};
54
- function useClientValue(value) {
55
- return !useDidFinishSSR() ? void 0 : typeof value === "function" ? value() : value;
56
- }
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
32
- }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
36
- var index_exports = {};
37
- __export(index_exports, {
38
- ClientOnly: () => import_ClientOnly2.ClientOnly,
39
- ClientOnlyContext: () => import_ClientOnly2.ClientOnlyContext,
40
- useClientValue: () => useClientValue,
41
- useDidFinishSSR: () => useDidFinishSSR,
42
- useIsClientOnly: () => useIsClientOnly
43
- });
44
- module.exports = __toCommonJS(index_exports);
45
- var React = __toESM(require("react"), 1);
46
- var import_ClientOnly = require("./ClientOnly.native.js");
47
- var import_ClientOnly2 = require("./ClientOnly.native.js");
48
- var useIsClientOnly = function () {
49
- return React.useContext(import_ClientOnly.ClientOnlyContext);
50
- };
51
- function useDidFinishSSR() {
52
- React.useContext(import_ClientOnly.ClientOnlyContext);
53
- return true;
54
- }
55
- function useClientValue(value) {
56
- return !useDidFinishSSR() ? void 0 : typeof value === "function" ? value() : value;
57
- }
58
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["isNodeMode","mod","__esModule","__defProp","target","value","enumerable","__toCommonJS","__copyProps","index_exports","__export","ClientOnly","import_ClientOnly2","ClientOnlyContext","useClientValue","import_ClientOnly","useDidFinishSSR","useIsClientOnly","module","exports","React","__toESM","require","useContext"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,UAAA,KAAAC,GAAA,KAAAA,GAAA,CAAAC,UAAA,GAAAC,SAAA,CAAAC,MAAA;EAAAC,KAAA,EAAAJ,GAAA;EAAAK,UAAA;AAAA,KAAAF,MAAA,EAAAH,GAAA;AAAA,IAAAM,YAAA,GAAAN,GAAA,IAAAO,WAAA,CAAAL,SAAA;EAAAE,KAAA;AAAA,IAAAJ,GAAA;AAAA,IAAAQ,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,UAAA,EAAuBA,CAAA,KAAAC,kBAAA,CAAAD,UAAA;EACvBE,iBAAA,EAAAA,CAAA,KAAkCD,kBAAA,CAAAC,iBAAA;EAElCC,cAAA,EAAAC,CAAA,KAAAD,cAA8C;EAEvCE,eAAM,EAAAA,CAAA,KAAkBA,eAAe;EAC5CC,eAAa,EAAAA,CAAA,KAAAA;AACf;AAEOC,MAAA,CAAAC,OAAS,GAAAZ,YAA2B,CAAAE,aAAA;AACzC,IAAAW,KAAM,GAAAC,OAAA,CAAAC,OAAmB,WAAW;AAEpC,IAAAP,iBAAkB,GAAAO,OAAQ,CAAI,yBAAe;AAC3C,IAAAV,kBAAO,GAAAU,OAAA;AAAA,IACTL,eAAA,YAAAA,CAAA;EAEA,OAAAG,KAAO,CAAAG,UAAM,CAAAR,iBAAA,CAAAF,iBAAA;AAAA;AACX,SACAG,eAAMA,CAAA;EAAAI,KACN,CAAAG,UAAM,CAAAR,iBAAA,CAAAF,iBAAA;EAAA,OACR;AACF;AAEA,SAAMC,cAAYA,CAAMT,KAAA,EAAM;EAAC,QAAAW,eAAA,qBAAAX,KAAA,kBAAAA,KAAA,KAAAA,KAAA;AAIxB","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- import { createContext, useContext } from "react";
2
- import { jsx } from "react/jsx-runtime";
3
- const ClientOnlyContext = createContext(false);
4
- const ClientOnly = ({
5
- children,
6
- enabled
7
- }) => {
8
- const existingValue = useContext(ClientOnlyContext);
9
- return /* @__PURE__ */jsx(ClientOnlyContext.Provider, {
10
- value: enabled ?? existingValue,
11
- children
12
- });
13
- };
14
- export { ClientOnly, ClientOnlyContext };
15
- //# sourceMappingURL=ClientOnly.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createContext","useContext","jsx","ClientOnlyContext","ClientOnly","children","enabled","existingValue","Provider","value"],"sources":["../../src/ClientOnly.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,aAAA,EAAeC,UAAA,QAAkB;AAatC,SAAAC,GAAA;AAXG,MAAMC,iBAAA,GAA4CH,aAAA,CAAc,KAAK;AAErE,MAAMI,UAAA,GAAaA,CAAC;EACzBC,QAAA;EACAC;AACF,MAGuB;EACrB,MAAMC,aAAA,GAAgBN,UAAA,CAAWE,iBAAiB;EAClD,OACE,eAAAD,GAAA,CAACC,iBAAA,CAAkBK,QAAA,EAAlB;IAA2BC,KAAA,EAAOH,OAAA,IAAWC,aAAA;IAC3CF;EAAA,CACH;AAEJ","ignoreList":[]}
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from "react";
3
- var ClientOnlyContext = /* @__PURE__ */createContext(false);
4
- var ClientOnly = function (param) {
5
- var {
6
- children,
7
- enabled
8
- } = param;
9
- var existingValue = useContext(ClientOnlyContext);
10
- return /* @__PURE__ */_jsx(ClientOnlyContext.Provider, {
11
- value: enabled !== null && enabled !== void 0 ? enabled : existingValue,
12
- children
13
- });
14
- };
15
- export { ClientOnly, ClientOnlyContext };
16
- //# sourceMappingURL=ClientOnly.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["jsx","_jsx","createContext","useContext","ClientOnlyContext","ClientOnly","param","children","enabled","existingValue","Provider","value"],"sources":["../../src/ClientOnly.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,QAAe,mBAAkB;AAatC,SAAAC,aAAA,EAAAC,UAAA;AAXG,IAAAC,iBAAM,kBAA0DF,aAAK;AAErE,IAAAG,UAAM,YAAAA,CAAcC,KAAA;EACzB;IAAAC,QAAA;IAAAC;EAAA,IAAAF,KAAA;EACA,IAAAG,aAAA,GAAAN,UAAA,CAAAC,iBAAA;EACF,OAGuB,eAAAH,IAAA,CAAAG,iBAAA,CAAAM,QAAA;IACrBC,KAAM,EAAAH,OAAA,SAAgB,IAAAA,OAAW,cAAiBA,OAAA,GAAAC,aAAA;IAClDF;EAKF","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- import * as React from "react";
2
- import { ClientOnly, ClientOnlyContext, ClientOnlyContext as ClientOnlyContext2 } from "./ClientOnly.mjs";
3
- const useIsClientOnly = () => {
4
- return React.useContext(ClientOnlyContext);
5
- };
6
- function useDidFinishSSR() {
7
- if (React.useContext(ClientOnlyContext) || false) return true;
8
- return React.useSyncExternalStore(subscribe, () => true, () => false);
9
- }
10
- const subscribe = () => () => {};
11
- function useClientValue(value) {
12
- return !useDidFinishSSR() ? void 0 : typeof value === "function" ? value() : value;
13
- }
14
- export { ClientOnly, ClientOnlyContext2 as ClientOnlyContext, useClientValue, useDidFinishSSR, useIsClientOnly };
15
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","ClientOnly","ClientOnlyContext","ClientOnlyContext2","useIsClientOnly","useContext","useDidFinishSSR","useSyncExternalStore","subscribe","useClientValue","value"],"sources":["index.mjs"],"sourcesContent":["import * as React from \"react\";\nimport { ClientOnly, ClientOnlyContext, ClientOnlyContext as ClientOnlyContext2 } from \"./ClientOnly\";\n\nconst useIsClientOnly = () => {\n\treturn React.useContext(ClientOnlyContext);\n};\nfunction useDidFinishSSR() {\n\tif (React.useContext(ClientOnlyContext) || false) return true;\n\treturn React.useSyncExternalStore(subscribe, () => true, () => false);\n}\nconst subscribe = () => () => {};\nfunction useClientValue(value) {\n\treturn !useDidFinishSSR() ? void 0 : typeof value === \"function\" ? value() : value;\n}\n\nexport { ClientOnly, ClientOnlyContext2 as ClientOnlyContext, useClientValue, useDidFinishSSR, useIsClientOnly };"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,iBAAiB,EAAEA,iBAAiB,IAAIC,kBAAkB,QAAQ,kBAAc;AAErG,MAAMC,eAAe,GAAGA,CAAA,KAAM;EAC7B,OAAOJ,KAAK,CAACK,UAAU,CAACH,iBAAiB,CAAC;AAC3C,CAAC;AACD,SAASI,eAAeA,CAAA,EAAG;EAC1B,IAAIN,KAAK,CAACK,UAAU,CAACH,iBAAiB,CAAC,IAAI,KAAK,EAAE,OAAO,IAAI;EAC7D,OAAOF,KAAK,CAACO,oBAAoB,CAACC,SAAS,EAAE,MAAM,IAAI,EAAE,MAAM,KAAK,CAAC;AACtE;AACA,MAAMA,SAAS,GAAGA,CAAA,KAAM,MAAM,CAAC,CAAC;AAChC,SAASC,cAAcA,CAACC,KAAK,EAAE;EAC9B,OAAO,CAACJ,eAAe,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,OAAOI,KAAK,KAAK,UAAU,GAAGA,KAAK,CAAC,CAAC,GAAGA,KAAK;AACnF;AAEA,SAAST,UAAU,EAAEE,kBAAkB,IAAID,iBAAiB,EAAEO,cAAc,EAAEH,eAAe,EAAEF,eAAe","ignoreList":[]}
@@ -1,14 +0,0 @@
1
- import * as React from "react";
2
- import { ClientOnly, ClientOnlyContext, ClientOnlyContext as ClientOnlyContext2 } from "./ClientOnly.native.js";
3
- var useIsClientOnly = function () {
4
- return React.useContext(ClientOnlyContext);
5
- };
6
- function useDidFinishSSR() {
7
- React.useContext(ClientOnlyContext);
8
- return true;
9
- }
10
- function useClientValue(value) {
11
- return !useDidFinishSSR() ? void 0 : typeof value === "function" ? value() : value;
12
- }
13
- export { ClientOnly, ClientOnlyContext2 as ClientOnlyContext, useClientValue, useDidFinishSSR, useIsClientOnly };
14
- //# sourceMappingURL=index.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","ClientOnly","ClientOnlyContext","ClientOnlyContext2","useIsClientOnly","useContext","useDidFinishSSR","useClientValue","value"],"sources":["index.native.js"],"sourcesContent":["import * as React from \"react\";\nimport { ClientOnly, ClientOnlyContext, ClientOnlyContext as ClientOnlyContext2 } from \"./ClientOnly\";\n\nvar useIsClientOnly = function() {\n\treturn React.useContext(ClientOnlyContext);\n};\nfunction useDidFinishSSR() {\n\tReact.useContext(ClientOnlyContext);\n\treturn true;\n}\nfunction useClientValue(value) {\n\treturn !useDidFinishSSR() ? void 0 : typeof value === \"function\" ? value() : value;\n}\n\nexport { ClientOnly, ClientOnlyContext2 as ClientOnlyContext, useClientValue, useDidFinishSSR, useIsClientOnly };"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,UAAU,EAAEC,iBAAiB,EAAEA,iBAAiB,IAAIC,kBAAkB,QAAQ,wBAAc;AAErG,IAAIC,eAAe,GAAG,SAAAA,CAAA,EAAW;EAChC,OAAOJ,KAAK,CAACK,UAAU,CAACH,iBAAiB,CAAC;AAC3C,CAAC;AACD,SAASI,eAAeA,CAAA,EAAG;EAC1BN,KAAK,CAACK,UAAU,CAACH,iBAAiB,CAAC;EACnC,OAAO,IAAI;AACZ;AACA,SAASK,cAAcA,CAACC,KAAK,EAAE;EAC9B,OAAO,CAACF,eAAe,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,OAAOE,KAAK,KAAK,UAAU,GAAGA,KAAK,CAAC,CAAC,GAAGA,KAAK;AACnF;AAEA,SAASP,UAAU,EAAEE,kBAAkB,IAAID,iBAAiB,EAAEK,cAAc,EAAED,eAAe,EAAEF,eAAe","ignoreList":[]}