Portable widgets: <slot-view>

The blog post below is on . The price in its second sentence, the basket in its header and the product card its text wraps round are live pieces of a page on , embedded with <slot-view>. None of them has an iframe's box. Each piece has its own size, sits on the text baseline or floats with its own outline, and you can use it. The shop decides what may leave its page, and it asks you first.

Pour-over notes, week 12

Your basket at Kettle & Bean:

This week's bag is the washed Ethiopian from Kettle & Bean, currently and worth every penny. That price isn't a screenshot and not my number: it's their element, updating as their page updates, laid out in my sentence like a word.

The card beside this paragraph is theirs too. I can float it, wrap text round its round edge, give it a shadow that follows its outline, and ask it to use my accent colour. What I can't do is read it, press its buttons behind your back, or see it at all before you tell the shop that's fine.

Brew it at 1:16, 94°C, three pours. Add a couple of bags with the card, watch the basket in the header follow, then press Buy now: the shop takes that one back and asks you itself.

Permission
Host asks (theme contract)
Host styles (like an image) With either on, press Forget: the shop's prompt notices it is filtered or faded and switches Allow off.
Show the code a piece of another site in your text
  1. The host page: <slot-view> elements in the flow of the text. name says which piece of the other site. inline sits in a sentence, shape lets text wrap round its outline.
  2. The host page: load the element, point it at the other site, ask for a theme. The script sets src on each one to SRC. A theme is a request; the other site decides.
  3. The other site: mark what it offers. Its own page, its own DOM, wrapped in <live-region slot-name>.
  4. The other site: one call to offer the slots. It asks the user before a pixel leaves, and lists the only style properties a host may set.
  5. Inside <slot-view>: load the other site in a hidden frame and open a channel to it. Pictures come back over the port, input goes out.
  6. Inside the other site: how its element becomes a picture.
  7. The whole element. The other side is /lib/slot-provider.js, and the messages are in PROTOCOL.md.

The markup



  

The conversation (live)

    Every message between this page and the product card's frame, newest last. Grey lines are this page speaking. Pictures and pointer moves are left out. The full protocol is in PROTOCOL.md.

    What holds (live)

    ResultExperimentDetail

    The three checks that press buttons and restyle the card run on a hidden second copy of this page once you have allowed the card, so the one you are using is left alone.

    Findings