@betterstore/react 0.3.66 → 0.3.68
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/CHANGELOG.md +12 -0
- package/dist/index.cjs.js +17 -0
- package/dist/index.mjs +17 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -521,6 +521,7 @@ var css_248z = "/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com *
|
|
|
521
521
|
const IframeWrapper = React.memo(({ children, iframeRef, wrapperRef }) => {
|
|
522
522
|
const [iframeBody, setIframeBody] = React.useState(null);
|
|
523
523
|
const styleRef = React.useRef(null);
|
|
524
|
+
const motionRef = React.useRef(null);
|
|
524
525
|
const resizeObserver = React.useRef();
|
|
525
526
|
const injectStyles = React.useCallback((doc) => {
|
|
526
527
|
var _a;
|
|
@@ -533,6 +534,21 @@ const IframeWrapper = React.memo(({ children, iframeRef, wrapperRef }) => {
|
|
|
533
534
|
doc.head.appendChild(styleEl);
|
|
534
535
|
styleRef.current = styleEl;
|
|
535
536
|
}, []);
|
|
537
|
+
const injectMotion = React.useCallback((doc) => {
|
|
538
|
+
var _a;
|
|
539
|
+
// Clean up previous style
|
|
540
|
+
if ((_a = motionRef.current) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
541
|
+
motionRef.current.parentNode.removeChild(motionRef.current);
|
|
542
|
+
}
|
|
543
|
+
const script = doc.createElement("script");
|
|
544
|
+
script.type = "module";
|
|
545
|
+
script.textContent = `
|
|
546
|
+
import { motion } from 'https://esm.sh/motion';
|
|
547
|
+
window.Motion = motion;
|
|
548
|
+
`;
|
|
549
|
+
doc.head.appendChild(script);
|
|
550
|
+
motionRef.current = script;
|
|
551
|
+
}, []);
|
|
536
552
|
const updateHeight = React.useCallback(() => {
|
|
537
553
|
const iframe = iframeRef.current;
|
|
538
554
|
const doc = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument;
|
|
@@ -546,6 +562,7 @@ const IframeWrapper = React.memo(({ children, iframeRef, wrapperRef }) => {
|
|
|
546
562
|
if (!iframe)
|
|
547
563
|
return;
|
|
548
564
|
const doc = iframe.contentDocument;
|
|
565
|
+
injectMotion(doc);
|
|
549
566
|
injectStyles(doc);
|
|
550
567
|
setIframeBody(doc.body);
|
|
551
568
|
updateHeight();
|
package/dist/index.mjs
CHANGED
|
@@ -498,6 +498,7 @@ var css_248z = "/*! tailwindcss v4.1.8 | MIT License | https://tailwindcss.com *
|
|
|
498
498
|
const IframeWrapper = React__default.memo(({ children, iframeRef, wrapperRef }) => {
|
|
499
499
|
const [iframeBody, setIframeBody] = useState(null);
|
|
500
500
|
const styleRef = useRef(null);
|
|
501
|
+
const motionRef = useRef(null);
|
|
501
502
|
const resizeObserver = useRef();
|
|
502
503
|
const injectStyles = useCallback((doc) => {
|
|
503
504
|
var _a;
|
|
@@ -510,6 +511,21 @@ const IframeWrapper = React__default.memo(({ children, iframeRef, wrapperRef })
|
|
|
510
511
|
doc.head.appendChild(styleEl);
|
|
511
512
|
styleRef.current = styleEl;
|
|
512
513
|
}, []);
|
|
514
|
+
const injectMotion = useCallback((doc) => {
|
|
515
|
+
var _a;
|
|
516
|
+
// Clean up previous style
|
|
517
|
+
if ((_a = motionRef.current) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
518
|
+
motionRef.current.parentNode.removeChild(motionRef.current);
|
|
519
|
+
}
|
|
520
|
+
const script = doc.createElement("script");
|
|
521
|
+
script.type = "module";
|
|
522
|
+
script.textContent = `
|
|
523
|
+
import { motion } from 'https://esm.sh/motion';
|
|
524
|
+
window.Motion = motion;
|
|
525
|
+
`;
|
|
526
|
+
doc.head.appendChild(script);
|
|
527
|
+
motionRef.current = script;
|
|
528
|
+
}, []);
|
|
513
529
|
const updateHeight = useCallback(() => {
|
|
514
530
|
const iframe = iframeRef.current;
|
|
515
531
|
const doc = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument;
|
|
@@ -523,6 +539,7 @@ const IframeWrapper = React__default.memo(({ children, iframeRef, wrapperRef })
|
|
|
523
539
|
if (!iframe)
|
|
524
540
|
return;
|
|
525
541
|
const doc = iframe.contentDocument;
|
|
542
|
+
injectMotion(doc);
|
|
526
543
|
injectStyles(doc);
|
|
527
544
|
setIframeBody(doc.body);
|
|
528
545
|
updateHeight();
|