docfy icon indicating copy to clipboard operation
docfy copied to clipboard

Need the ability to open demos in an iframe/new-route

Open NullVoxPopuli opened this issue 4 years ago • 0 comments

This request is partially for debugging/development purposes, partially for style isolation without a shadowdom (which removes all styles of the parent context).

For this change to be uniformly implemented, the inline-demos in markdown files would need to be extracted to components during build time, rather than line-by-line inlined in the hbs output. This would allow passing a dynamic-segment to some route for dynamically loading the component for the above development scenario. With embroider+vite, this would also lead to much faster rebuild times, as all the surrounding UI wouldn't need to be built/rendered.

I think at build time, an object like this would need to be generated:

import { importSync } from '@embroider/macros';

const DEMO_MAP = {
  [some-key]: importSync('some-demo-component')
  // ...
}

// ...

async model({ componentName }) {
  let demoComponent = DEMO_MAP[componentName];
  
  return { demoComponent };
}

NullVoxPopuli avatar Jun 16 '21 16:06 NullVoxPopuli