diff --git a/build-system/compile/bundles.config.extensions.json b/build-system/compile/bundles.config.extensions.json index 58a8f725fdd2e..4eba64fcc453f 100644 --- a/build-system/compile/bundles.config.extensions.json +++ b/build-system/compile/bundles.config.extensions.json @@ -479,6 +479,8 @@ "version": "1.0", "latestVersion": "0.1", "options": { + "hasCss": true, + "npm": true, "wrapper": "bento" } }, diff --git a/extensions/amp-iframe/1.0/amp-iframe.css b/extensions/amp-iframe/1.0/amp-iframe.css new file mode 100644 index 0000000000000..8682e7a824bd8 --- /dev/null +++ b/extensions/amp-iframe/1.0/amp-iframe.css @@ -0,0 +1,22 @@ +/* + * Pre-upgrade: + * - display:block element + * - size-defined element + */ +amp-iframe { + display: block; + overflow: hidden; + position: relative; +} + +/* Pre-upgrade: size-defining element - hide text. */ +amp-iframe:not(.i-amphtml-built) { + color: transparent !important; +} + +/* Pre-upgrade: size-defining element - hide children. */ +amp-iframe:not(.i-amphtml-built) + > :not([placeholder]):not([slot='i-amphtml-svc']) { + display: none; + content-visibility: hidden; +} diff --git a/extensions/amp-iframe/1.0/base-element.js b/extensions/amp-iframe/1.0/base-element.js index 4d2001ed961a9..c8f57c57e4ce3 100644 --- a/extensions/amp-iframe/1.0/base-element.js +++ b/extensions/amp-iframe/1.0/base-element.js @@ -1,10 +1,10 @@ -import {Iframe} from './component'; +import {BentoIframe} from './component'; import {PreactBaseElement} from '#preact/base-element'; export class BaseElement extends PreactBaseElement {} /** @override */ -BaseElement['Component'] = Iframe; +BaseElement['Component'] = BentoIframe; /** @override */ BaseElement['props'] = { diff --git a/extensions/amp-iframe/1.0/component.js b/extensions/amp-iframe/1.0/component.js index da44d0efbd142..b5d2b003c3c02 100644 --- a/extensions/amp-iframe/1.0/component.js +++ b/extensions/amp-iframe/1.0/component.js @@ -9,10 +9,10 @@ import {useMergeRefs} from '#preact/utils'; const NOOP = () => {}; /** - * @param {!IframeDef.Props} props + * @param {!BentoIframeDef.Props} props * @return {PreactDef.Renderable} */ -export function Iframe({ +export function BentoIframe({ allowFullScreen, allowPaymentRequest, iframeStyle, diff --git a/extensions/amp-iframe/1.0/component.type.js b/extensions/amp-iframe/1.0/component.type.js index ace1954d3a29f..517694963e347 100644 --- a/extensions/amp-iframe/1.0/component.type.js +++ b/extensions/amp-iframe/1.0/component.type.js @@ -1,7 +1,7 @@ /** @externs */ /** @const */ -var IframeDef = {}; +var BentoIframeDef = {}; /** * @typedef {{ @@ -15,4 +15,4 @@ var IframeDef = {}; * srcdoc: (string), * }} */ -IframeDef.Props; +BentoIframeDef.Props; diff --git a/extensions/amp-iframe/1.0/storybook/Basic.js b/extensions/amp-iframe/1.0/storybook/Basic.js index b70cc98c6bbfa..d8adbefe40713 100644 --- a/extensions/amp-iframe/1.0/storybook/Basic.js +++ b/extensions/amp-iframe/1.0/storybook/Basic.js @@ -1,19 +1,19 @@ import * as Preact from '#preact'; -import {Iframe} from '../component'; +import {BentoIframe} from '../component'; export default { title: 'Iframe', - component: Iframe, + component: BentoIframe, }; export const _default = () => { return ( - + > ); }; @@ -27,7 +27,7 @@ export const WithIntersectingIframe = () => { backgroundColor: 'blue', }} > - +
The above iframe will not resize and should remain 100x100px
); @@ -53,7 +53,7 @@ export const WithResizableIframe = () => { backgroundColor: 'blue', }} > - +The above iframe should be 300x300px when visible
); diff --git a/extensions/amp-iframe/1.0/test/test-component.js b/extensions/amp-iframe/1.0/test/test-component.js index 7b9c02337906d..1b406c272b5f2 100644 --- a/extensions/amp-iframe/1.0/test/test-component.js +++ b/extensions/amp-iframe/1.0/test/test-component.js @@ -1,26 +1,26 @@ import * as Preact from '#preact'; -import {Iframe} from '../component'; +import {BentoIframe} from '../component'; import {mount} from 'enzyme'; -describes.sandboxed('Iframe preact component v1.0', {}, (env) => { +describes.sandboxed('BentoIframe preact component v1.0', {}, (env) => { it('should render', () => { - const wrapper = mount(); + const wrapper = mount(