@pallasoft/ps-core-components 2.20.0 → 2.21.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.
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface PsClientOnlyProps {
3
+ children: () => ReactNode;
4
+ fallback?: ReactNode;
5
+ }
6
+ export declare const PsClientOnly: ({ children, fallback }: PsClientOnlyProps) => import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsClientOnly = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const use_ps_hydrated_1 = require("../hooks/use-ps-hydrated");
6
+ const PsClientOnly = ({ children, fallback = null }) => (0, use_ps_hydrated_1.usePsHydrated)() ? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children() }) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: fallback });
7
+ exports.PsClientOnly = PsClientOnly;
@@ -0,0 +1,5 @@
1
+ export declare const PsHydrationStore: {
2
+ readonly subscribe: () => (() => void);
3
+ readonly clientSnapshot: () => boolean;
4
+ readonly serverSnapshot: () => boolean;
5
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsHydrationStore = void 0;
4
+ exports.PsHydrationStore = {
5
+ subscribe: () => () => undefined,
6
+ clientSnapshot: () => true,
7
+ serverSnapshot: () => false,
8
+ };
@@ -0,0 +1,3 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { usePsHydrated } from '../hooks/use-ps-hydrated';
3
+ export const PsClientOnly = ({ children, fallback = null }) => usePsHydrated() ? _jsx(_Fragment, { children: children() }) : _jsx(_Fragment, { children: fallback });
@@ -0,0 +1,5 @@
1
+ export const PsHydrationStore = {
2
+ subscribe: () => () => undefined,
3
+ clientSnapshot: () => true,
4
+ serverSnapshot: () => false,
5
+ };
@@ -0,0 +1,3 @@
1
+ import { useSyncExternalStore } from 'react';
2
+ import { PsHydrationStore } from '../constants/ps-hydration-store';
3
+ export const usePsHydrated = () => useSyncExternalStore(PsHydrationStore.subscribe, PsHydrationStore.clientSnapshot, PsHydrationStore.serverSnapshot);
package/dist/esm/index.js CHANGED
@@ -10,6 +10,7 @@ export * from './components/ps-pallasoft-mark';
10
10
  export * from './components/ps-pallasoft-sign-in-button';
11
11
  export * from './constants/ps-pallasoft-mark-config';
12
12
  export * from './components/ps-card';
13
+ export * from './components/ps-client-only';
13
14
  export * from './components/ps-draggable-grid';
14
15
  export * from './components/ps-empty-state';
15
16
  export * from './components/ps-fab';
@@ -48,6 +49,7 @@ export * from './contexts/ps-layer-context';
48
49
  export * from './hooks/use-ps-layer-z-index';
49
50
  export * from './hooks/use-ps-route-loader-data';
50
51
  export * from './hooks/use-ps-element-size';
52
+ export * from './hooks/use-ps-hydrated';
51
53
  export * from './hooks/use-ps-viewport';
52
54
  export * from './interfaces/ps-component-props';
53
55
  export * from './models/ps-element-size';
@@ -0,0 +1 @@
1
+ export declare const usePsHydrated: () => boolean;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePsHydrated = void 0;
4
+ const react_1 = require("react");
5
+ const ps_hydration_store_1 = require("../constants/ps-hydration-store");
6
+ const usePsHydrated = () => (0, react_1.useSyncExternalStore)(ps_hydration_store_1.PsHydrationStore.subscribe, ps_hydration_store_1.PsHydrationStore.clientSnapshot, ps_hydration_store_1.PsHydrationStore.serverSnapshot);
7
+ exports.usePsHydrated = usePsHydrated;
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './components/ps-pallasoft-mark';
10
10
  export * from './components/ps-pallasoft-sign-in-button';
11
11
  export * from './constants/ps-pallasoft-mark-config';
12
12
  export * from './components/ps-card';
13
+ export * from './components/ps-client-only';
13
14
  export * from './components/ps-draggable-grid';
14
15
  export * from './components/ps-empty-state';
15
16
  export * from './components/ps-fab';
@@ -48,6 +49,7 @@ export * from './contexts/ps-layer-context';
48
49
  export * from './hooks/use-ps-layer-z-index';
49
50
  export * from './hooks/use-ps-route-loader-data';
50
51
  export * from './hooks/use-ps-element-size';
52
+ export * from './hooks/use-ps-hydrated';
51
53
  export * from './hooks/use-ps-viewport';
52
54
  export * from './interfaces/ps-component-props';
53
55
  export * from './models/ps-element-size';
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ __exportStar(require("./components/ps-pallasoft-mark"), exports);
26
26
  __exportStar(require("./components/ps-pallasoft-sign-in-button"), exports);
27
27
  __exportStar(require("./constants/ps-pallasoft-mark-config"), exports);
28
28
  __exportStar(require("./components/ps-card"), exports);
29
+ __exportStar(require("./components/ps-client-only"), exports);
29
30
  __exportStar(require("./components/ps-draggable-grid"), exports);
30
31
  __exportStar(require("./components/ps-empty-state"), exports);
31
32
  __exportStar(require("./components/ps-fab"), exports);
@@ -64,6 +65,7 @@ __exportStar(require("./contexts/ps-layer-context"), exports);
64
65
  __exportStar(require("./hooks/use-ps-layer-z-index"), exports);
65
66
  __exportStar(require("./hooks/use-ps-route-loader-data"), exports);
66
67
  __exportStar(require("./hooks/use-ps-element-size"), exports);
68
+ __exportStar(require("./hooks/use-ps-hydrated"), exports);
67
69
  __exportStar(require("./hooks/use-ps-viewport"), exports);
68
70
  __exportStar(require("./interfaces/ps-component-props"), exports);
69
71
  __exportStar(require("./models/ps-element-size"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallasoft/ps-core-components",
3
- "version": "2.20.0",
3
+ "version": "2.21.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/esm/index.js",