@toriistudio/v0-playground 0.2.2 → 0.2.3

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.d.mts CHANGED
@@ -3,7 +3,7 @@ import React, { ReactNode } from 'react';
3
3
 
4
4
  declare function Playground({ children }: {
5
5
  children: ReactNode;
6
- }): react_jsx_runtime.JSX.Element;
6
+ }): react_jsx_runtime.JSX.Element | null;
7
7
 
8
8
  type ControlType = {
9
9
  type: "boolean";
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import React, { ReactNode } from 'react';
3
3
 
4
4
  declare function Playground({ children }: {
5
5
  children: ReactNode;
6
- }): react_jsx_runtime.JSX.Element;
6
+ }): react_jsx_runtime.JSX.Element | null;
7
7
 
8
8
  type ControlType = {
9
9
  type: "boolean";
package/dist/index.js CHANGED
@@ -744,10 +744,15 @@ var ControlPanel_default = ControlPanel;
744
744
  var import_jsx_runtime11 = require("react/jsx-runtime");
745
745
  var NO_CONTROLS_PARAM = "nocontrols";
746
746
  function Playground({ children }) {
747
+ const [isHydrated, setIsHydrated] = (0, import_react6.useState)(false);
748
+ (0, import_react6.useEffect)(() => {
749
+ setIsHydrated(true);
750
+ }, []);
747
751
  const hideControls = (0, import_react6.useMemo)(() => {
748
752
  if (typeof window === "undefined") return false;
749
753
  return new URLSearchParams(window.location.search).get(NO_CONTROLS_PARAM) === "true";
750
754
  }, []);
755
+ if (!isHydrated) return null;
751
756
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ResizableLayout, { hideControls, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(ControlsProvider, { children: [
752
757
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PreviewContainer_default, { hideControls, children }),
753
758
  !hideControls && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ControlPanel_default, {})
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/components/Playground/Playground.tsx
2
- import { useMemo as useMemo3 } from "react";
2
+ import { useEffect as useEffect4, useMemo as useMemo3, useState as useState5 } from "react";
3
3
 
4
4
  // src/context/ResizableLayout.tsx
5
5
  import {
@@ -718,10 +718,15 @@ var ControlPanel_default = ControlPanel;
718
718
  import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
719
719
  var NO_CONTROLS_PARAM = "nocontrols";
720
720
  function Playground({ children }) {
721
+ const [isHydrated, setIsHydrated] = useState5(false);
722
+ useEffect4(() => {
723
+ setIsHydrated(true);
724
+ }, []);
721
725
  const hideControls = useMemo3(() => {
722
726
  if (typeof window === "undefined") return false;
723
727
  return new URLSearchParams(window.location.search).get(NO_CONTROLS_PARAM) === "true";
724
728
  }, []);
729
+ if (!isHydrated) return null;
725
730
  return /* @__PURE__ */ jsx11(ResizableLayout, { hideControls, children: /* @__PURE__ */ jsxs5(ControlsProvider, { children: [
726
731
  /* @__PURE__ */ jsx11(PreviewContainer_default, { hideControls, children }),
727
732
  !hideControls && /* @__PURE__ */ jsx11(ControlPanel_default, {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toriistudio/v0-playground",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "V0 Playground",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",