@toriistudio/v0-playground 0.2.2 → 0.2.4
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -1
- package/dist/index.mjs +7 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -585,7 +585,7 @@ var ControlPanel = () => {
|
|
|
585
585
|
overflowY: "auto"
|
|
586
586
|
} : {}
|
|
587
587
|
},
|
|
588
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-4 p-2 md:p-4 border border-stone-700 rounded-md", children: [
|
|
588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "mb-4 space-y-4 p-2 md:p-4 border border-stone-700 rounded-md", children: [
|
|
589
589
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { className: "text-lg text-stone-100 font-bold", children: "Controls" }) }),
|
|
590
590
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-4 pt-2", children: [
|
|
591
591
|
normalControls.map(([key, control]) => {
|
|
@@ -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 {
|
|
@@ -559,7 +559,7 @@ var ControlPanel = () => {
|
|
|
559
559
|
overflowY: "auto"
|
|
560
560
|
} : {}
|
|
561
561
|
},
|
|
562
|
-
children: /* @__PURE__ */ jsxs4("div", { className: "space-y-4 p-2 md:p-4 border border-stone-700 rounded-md", children: [
|
|
562
|
+
children: /* @__PURE__ */ jsxs4("div", { className: "mb-4 space-y-4 p-2 md:p-4 border border-stone-700 rounded-md", children: [
|
|
563
563
|
/* @__PURE__ */ jsx10("div", { className: "space-y-1", children: /* @__PURE__ */ jsx10("h1", { className: "text-lg text-stone-100 font-bold", children: "Controls" }) }),
|
|
564
564
|
/* @__PURE__ */ jsxs4("div", { className: "space-y-4 pt-2", children: [
|
|
565
565
|
normalControls.map(([key, control]) => {
|
|
@@ -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, {})
|