@betterstore/react 0.3.68 → 0.3.69
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 +6 -0
- package/dist/index.cjs.js +21 -17
- package/dist/index.mjs +21 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -521,7 +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
|
-
|
|
524
|
+
React.useRef(null);
|
|
525
525
|
const resizeObserver = React.useRef();
|
|
526
526
|
const injectStyles = React.useCallback((doc) => {
|
|
527
527
|
var _a;
|
|
@@ -534,21 +534,25 @@ const IframeWrapper = React.memo(({ children, iframeRef, wrapperRef }) => {
|
|
|
534
534
|
doc.head.appendChild(styleEl);
|
|
535
535
|
styleRef.current = styleEl;
|
|
536
536
|
}, []);
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
//
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
537
|
+
const cloneGlobals = (iframeWin) => {
|
|
538
|
+
const parentWin = window;
|
|
539
|
+
// Grab all own props of the parent window...
|
|
540
|
+
Object.getOwnPropertyNames(parentWin).forEach((key) => {
|
|
541
|
+
// Skip non–configurable or already-present props
|
|
542
|
+
if (key in iframeWin)
|
|
543
|
+
return;
|
|
544
|
+
const desc = Object.getOwnPropertyDescriptor(parentWin, key);
|
|
545
|
+
// Only clone functions or configurable props
|
|
546
|
+
if (typeof desc.value === "function" ||
|
|
547
|
+
(desc.configurable && (desc.writable || desc.get))) {
|
|
548
|
+
Object.defineProperty(iframeWin, key, Object.assign(Object.assign({}, desc), {
|
|
549
|
+
// if it's a function, bind it back to parent window
|
|
550
|
+
value: typeof desc.value === "function"
|
|
551
|
+
? desc.value.bind(parentWin)
|
|
552
|
+
: desc.value }));
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
};
|
|
552
556
|
const updateHeight = React.useCallback(() => {
|
|
553
557
|
const iframe = iframeRef.current;
|
|
554
558
|
const doc = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument;
|
|
@@ -562,7 +566,7 @@ const IframeWrapper = React.memo(({ children, iframeRef, wrapperRef }) => {
|
|
|
562
566
|
if (!iframe)
|
|
563
567
|
return;
|
|
564
568
|
const doc = iframe.contentDocument;
|
|
565
|
-
|
|
569
|
+
cloneGlobals(iframe.contentWindow);
|
|
566
570
|
injectStyles(doc);
|
|
567
571
|
setIframeBody(doc.body);
|
|
568
572
|
updateHeight();
|
package/dist/index.mjs
CHANGED
|
@@ -498,7 +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
|
-
|
|
501
|
+
useRef(null);
|
|
502
502
|
const resizeObserver = useRef();
|
|
503
503
|
const injectStyles = useCallback((doc) => {
|
|
504
504
|
var _a;
|
|
@@ -511,21 +511,25 @@ const IframeWrapper = React__default.memo(({ children, iframeRef, wrapperRef })
|
|
|
511
511
|
doc.head.appendChild(styleEl);
|
|
512
512
|
styleRef.current = styleEl;
|
|
513
513
|
}, []);
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
//
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
514
|
+
const cloneGlobals = (iframeWin) => {
|
|
515
|
+
const parentWin = window;
|
|
516
|
+
// Grab all own props of the parent window...
|
|
517
|
+
Object.getOwnPropertyNames(parentWin).forEach((key) => {
|
|
518
|
+
// Skip non–configurable or already-present props
|
|
519
|
+
if (key in iframeWin)
|
|
520
|
+
return;
|
|
521
|
+
const desc = Object.getOwnPropertyDescriptor(parentWin, key);
|
|
522
|
+
// Only clone functions or configurable props
|
|
523
|
+
if (typeof desc.value === "function" ||
|
|
524
|
+
(desc.configurable && (desc.writable || desc.get))) {
|
|
525
|
+
Object.defineProperty(iframeWin, key, Object.assign(Object.assign({}, desc), {
|
|
526
|
+
// if it's a function, bind it back to parent window
|
|
527
|
+
value: typeof desc.value === "function"
|
|
528
|
+
? desc.value.bind(parentWin)
|
|
529
|
+
: desc.value }));
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
};
|
|
529
533
|
const updateHeight = useCallback(() => {
|
|
530
534
|
const iframe = iframeRef.current;
|
|
531
535
|
const doc = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument;
|
|
@@ -539,7 +543,7 @@ const IframeWrapper = React__default.memo(({ children, iframeRef, wrapperRef })
|
|
|
539
543
|
if (!iframe)
|
|
540
544
|
return;
|
|
541
545
|
const doc = iframe.contentDocument;
|
|
542
|
-
|
|
546
|
+
cloneGlobals(iframe.contentWindow);
|
|
543
547
|
injectStyles(doc);
|
|
544
548
|
setIframeBody(doc.body);
|
|
545
549
|
updateHeight();
|