amp-react-prototype
amp-react-prototype copied to clipboard
A scratch pad to experiment with React rendered AMP Components
Context: https://github.com/ampproject/amp-react-prototype/pull/29#discussion_r341651128 The goal is to find a clear way to separate DOM mutations from external script and components. Usually we can separate user DOM updates from component updates using...
For some elements their layout size is important. For instance `amp-fit-text` picks the right font size given its content and available layout space. In AMP layout size is provided by...
Most of composite elements would want to know their children, which can be easily monitored using mutation observer: ``` mutationObserver.observe(this.element, {childList: true}); ``` This works well when the component does...
When an area of DOM (or component subtree) becomes unrendered or uninteractive, we need to pause relevant components. Otherwise the playback will continue and use will have no way of...
[AmpContext](https://github.com/ampproject/amp-react-prototype/blob/104861c3777d5341377092620f123b9013c0050d/src/amp-context.js#L28) allows control of rendering/loading via context properties. By default, loading can be enabled and applications can exercise a more fine-grained control using `AmpContext.Provider`. Additionally, we could standardize on a...
This is similar to property and contexts (see #48). We could place services as a map in the `AmpContext` or we could break them down a service-per-context. We could also...
We can use [AmpContext](https://github.com/ampproject/amp-react-prototype/blob/104861c3777d5341377092620f123b9013c0050d/src/amp-context.js#L28) for all state properties such as `renderable` and `playable`. The main question is whether we breakdown the context per property or keep all the properties together....
Use case: ``. The `currentSlide` is currently a "state" value and this is preferable. We could consider making it a controlled property coupled with `onSlideChange` callback, but that'd expand the...
Context: https://github.com/ampproject/amp-react-prototype/pull/8/files#diff-c554b9bd31408e663cff269f69a1c567R51 Issues: 1. Some component libraries take a stand that “back button” support has to be arranged by the caller outside the lightbox (controlled). But that causes numerous issues,...
AMP's lightboxes are components with completely separate "roots" and lifecycle. They only supply imperative APIs such as: ``` lightbox.open().then(result => { // Lightbox has closed with a possible return value....