@teambit/preview.ui.component-preview
Advanced tools
Comparing version 1.0.19 to 1.0.20
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.computePreviewScale = void 0; | ||
exports.computePreviewScale = computePreviewScale; | ||
function computePreviewScale(width, containerWidth) { | ||
@@ -10,3 +10,2 @@ const scale = (containerWidth * 0.95) / width; | ||
} | ||
exports.computePreviewScale = computePreviewScale; | ||
//# sourceMappingURL=compute-preview-scale.js.map |
export { ComponentPreview } from './preview'; | ||
export type { ComponentPreviewProps } from './preview'; | ||
export { toPreviewUrl, toPreviewServer, toPreviewHash } from './urls'; | ||
export { SandboxManager, SandboxPermissionExecutor, SandboxPermissionsAggregator } from './sandbox-manager'; | ||
export type { UseSandboxPermission } from './sandbox-manager'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toPreviewHash = exports.toPreviewServer = exports.toPreviewUrl = exports.ComponentPreview = void 0; | ||
exports.SandboxPermissionsAggregator = exports.SandboxPermissionExecutor = exports.SandboxManager = exports.toPreviewHash = exports.toPreviewServer = exports.toPreviewUrl = exports.ComponentPreview = void 0; | ||
var preview_1 = require("./preview"); | ||
@@ -10,2 +10,6 @@ Object.defineProperty(exports, "ComponentPreview", { enumerable: true, get: function () { return preview_1.ComponentPreview; } }); | ||
Object.defineProperty(exports, "toPreviewHash", { enumerable: true, get: function () { return urls_1.toPreviewHash; } }); | ||
var sandbox_manager_1 = require("./sandbox-manager"); | ||
Object.defineProperty(exports, "SandboxManager", { enumerable: true, get: function () { return sandbox_manager_1.SandboxManager; } }); | ||
Object.defineProperty(exports, "SandboxPermissionExecutor", { enumerable: true, get: function () { return sandbox_manager_1.SandboxPermissionExecutor; } }); | ||
Object.defineProperty(exports, "SandboxPermissionsAggregator", { enumerable: true, get: function () { return sandbox_manager_1.SandboxPermissionsAggregator; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -61,2 +61,2 @@ import React, { IframeHTMLAttributes } from 'react'; | ||
*/ | ||
export declare function ComponentPreview({ component, previewName, className, forceHeight, includeEnv, queryParams, disableScroll, pubsub, innerBottomPadding, viewport, fullContentHeight, onLoad, style, ...rest }: ComponentPreviewProps): React.JSX.Element; | ||
export declare function ComponentPreview({ component, previewName, className, forceHeight, includeEnv, queryParams, disableScroll, pubsub, innerBottomPadding, viewport, fullContentHeight, onLoad, style, sandbox, ...rest }: ComponentPreviewProps): React.JSX.Element; |
@@ -40,3 +40,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ComponentPreview = void 0; | ||
exports.ComponentPreview = ComponentPreview; | ||
/* eslint-disable complexity */ | ||
@@ -60,5 +60,3 @@ const react_1 = __importStar(require("react")); | ||
// fitView = 1280, | ||
viewport = 1280, fullContentHeight = false, onLoad, style } = _a, rest = __rest(_a, ["component", "previewName", "className", "forceHeight", "includeEnv", "queryParams", "disableScroll", "pubsub", "innerBottomPadding", "viewport", "fullContentHeight", "onLoad", "style"]); | ||
const host = component.host; | ||
const sandbox = host === 'teambit.scope/scope' ? 'allow-scripts allow-same-origin' : undefined; | ||
viewport = 1280, fullContentHeight = false, onLoad, style, sandbox } = _a, rest = __rest(_a, ["component", "previewName", "className", "forceHeight", "includeEnv", "queryParams", "disableScroll", "pubsub", "innerBottomPadding", "viewport", "fullContentHeight", "onLoad", "style", "sandbox"]); | ||
const [heightIframeRef, iframeHeight] = (0, use_iframe_content_height_1.useIframeContentHeight)({ skip: false, viewport }); | ||
@@ -122,5 +120,4 @@ const iframeRef = (0, react_1.useRef)(null); | ||
return (react_1.default.createElement("div", { ref: containerRef, className: (0, classnames_1.default)(preview_module_scss_1.default.preview, className), style: { height: forceHeight } }, | ||
react_1.default.createElement("iframe", Object.assign({}, rest, { sandbox: sandbox, ref: currentRef, style: Object.assign(Object.assign({}, style), { height: forceHeight || (isScaling ? finalHeight + innerBottomPadding : legacyIframeHeight), width: isScaling ? targetWidth : legacyCurrentWidth, visibility: width === 0 && isScaling && !fullContentHeight ? 'hidden' : undefined, transform: fullContentHeight ? '' : (0, compute_preview_scale_1.computePreviewScale)(width, containerWidth), border: 0, transformOrigin: 'top left' }), src: url, scrolling: disableScroll ? 'no' : undefined })))); | ||
react_1.default.createElement("iframe", Object.assign({}, rest, { sandbox: sandbox || undefined, ref: currentRef, style: Object.assign(Object.assign({}, style), { height: forceHeight || (isScaling ? finalHeight + innerBottomPadding : legacyIframeHeight), width: isScaling ? targetWidth : legacyCurrentWidth, visibility: width === 0 && isScaling && !fullContentHeight ? 'hidden' : undefined, transform: fullContentHeight ? '' : (0, compute_preview_scale_1.computePreviewScale)(width, containerWidth), border: 0, transformOrigin: 'top left' }), src: url, scrolling: disableScroll ? 'no' : undefined })))); | ||
} | ||
exports.ComponentPreview = ComponentPreview; | ||
//# sourceMappingURL=preview.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toPreviewHash = exports.toPreviewServer = exports.toPreviewUrl = void 0; | ||
exports.toPreviewUrl = toPreviewUrl; | ||
exports.toPreviewServer = toPreviewServer; | ||
exports.toPreviewHash = toPreviewHash; | ||
const base_ui_utils_string_affix_1 = require("@teambit/base-ui.utils.string.affix"); | ||
@@ -14,3 +16,2 @@ /** | ||
} | ||
exports.toPreviewUrl = toPreviewUrl; | ||
/** | ||
@@ -37,3 +38,2 @@ * generates preview server path from component data | ||
} | ||
exports.toPreviewServer = toPreviewServer; | ||
function getEnvIdQueryParam(component, includeEnvId = true) { | ||
@@ -118,3 +118,2 @@ var _a, _b, _c, _d; | ||
} | ||
exports.toPreviewHash = toPreviewHash; | ||
//# sourceMappingURL=urls.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.useInterval = exports.useIframeContentHeight = void 0; | ||
exports.useIframeContentHeight = useIframeContentHeight; | ||
exports.useInterval = useInterval; | ||
const react_1 = require("react"); | ||
@@ -35,3 +36,2 @@ function useIframeContentHeight({ interval = 250, skip, viewport, }) { | ||
} | ||
exports.useIframeContentHeight = useIframeContentHeight; | ||
function useInterval(callback, interval) { | ||
@@ -55,3 +55,2 @@ const savedCallback = (0, react_1.useRef)(() => callback); | ||
} | ||
exports.useInterval = useInterval; | ||
//# sourceMappingURL=use-iframe-content-height.js.map |
export { ComponentPreview } from './preview'; | ||
export type { ComponentPreviewProps } from './preview'; | ||
export { toPreviewUrl, toPreviewServer, toPreviewHash } from './urls'; | ||
export { SandboxManager, SandboxPermissionExecutor, SandboxPermissionsAggregator } from './sandbox-manager'; | ||
export type { UseSandboxPermission } from './sandbox-manager'; |
{ | ||
"name": "@teambit/preview.ui.component-preview", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"homepage": "https://bit.cloud/teambit/preview/ui/component-preview", | ||
@@ -9,3 +9,3 @@ "main": "dist/index.js", | ||
"name": "ui/component-preview", | ||
"version": "1.0.19" | ||
"version": "1.0.20" | ||
}, | ||
@@ -12,0 +12,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
69563
34
1203
0