Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Riot 4 support #1

Open
damusix opened this issue Jun 26, 2019 · 20 comments
Open

Riot 4 support #1

damusix opened this issue Jun 26, 2019 · 20 comments

Comments

@damusix
Copy link

damusix commented Jun 26, 2019

Is your feature request related to a problem? Please describe.
storybookjs/storybook#7193
storybookjs/storybook#7101 (comment)
storybookjs/storybook#7193 (comment)

Describe the solution you'd like

storybookjs/storybook#7101 (comment)

Riot has been upgraded to version 4, and it is not compatible with Riot 3. Lot of the dependencies currently in Storybook/Riot will not work with Riot 4. If you'd like to see an example of Riot4 with webpack, I have one in my boilerplate project. Check out how the dependencies are now different.

To add to this comment:

  • Mounting components is different
  • Instantiating component javascript is also different
  • Current storybook examples use Riot 3 syntax in components, which aren't backwards-compatible
  • New riot webpack setup is much better than the previous version.

Please let me know if I can be of help.

Are you able to assist bring the feature to reality?
Yes, I can...

@libetl
Copy link
Contributor

libetl commented Jun 26, 2019

Hmm, I was pretty sure it would not be compatibe

@libetl
Copy link
Contributor

libetl commented Jun 26, 2019

Pretty busy right now, but if I think some time I can have a look.

How do we mount a component with riot 4 ? and how do we unmount ?

@damusix
Copy link
Author

damusix commented Jun 27, 2019

Webpack info

Mounting / Unmounting components

Ways to mount

From a bundled file

import * as riot from 'riot'
import App from './app.riot'

const mountApp = riot.component(App)

const app = mountApp(
  document.getElementById('root'),
  { message: 'Hello World' }
)

Using riot.mount

Riot template

<my-component>

  <!-- layout -->
  <h3>{ props.title }</h3>

  <style>
    :host { display: block }
    h3 { font-size: 120% }
    /** other component specific styles **/
  </style>

</my-component>

index.html

<div is="my-component"></div>

app.js

// import the component javascript output generated via @riotjs/compiler
import MyComponent from './my-component.js'

// register the riot component
riot.register('my-component', MyComponent)

riot.mount('my-component')

Ways to unmount

  • Within a particular tag, you can call: this.unmount()
  • Using riot global, you can call: riot.unmount('my-component')

Relevant to story book

I imagine you'd want a way to bind into any component and unmount, intercept, etc. You can do that using riot plugins

@storybook-eol storybook-eol deleted a comment from stale bot Jul 18, 2019
@damusix
Copy link
Author

damusix commented Jul 30, 2019

Any updates on this? @libetl

@libetl
Copy link
Contributor

libetl commented Jul 30, 2019

I have not worked with riot for a while.
Let's vote for the issue. If I get more than 10 👍 I can take a look

@shilman
Copy link
Contributor

shilman commented Jul 30, 2019

@libetl I downvoted to help you focus on source-loader 🤣 Teasing of course.

@damusix
Copy link
Author

damusix commented Aug 2, 2019

@shilman you troll! lol @libetl can I be of any help?

@libetl
Copy link
Contributor

libetl commented Aug 7, 2019

Aïe... more than 10 thumbs.

@libetl
Copy link
Contributor

libetl commented Aug 7, 2019

@GianlucaGuarini Hi

@stale
Copy link

stale bot commented Aug 28, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@libetl
Copy link
Contributor

libetl commented Aug 29, 2019

Really busy these days with my regular job. The situation will slightly get better after september 14th.

@libetl
Copy link
Contributor

libetl commented Oct 28, 2019

Team, I am quite ready to get started now

@libetl
Copy link
Contributor

libetl commented Oct 28, 2019

@damusix can we chat on discord or zoom when you get a chance ?

@damusix
Copy link
Author

damusix commented Oct 29, 2019

@dmtrs
Copy link

dmtrs commented Apr 10, 2020

What approach do you consider in order to add the riot 4 support without breaking existing installation with current version?

@dmtrs
Copy link

dmtrs commented Apr 12, 2020

dependbot trying to update storybookjs/storybook@a21885f

@damusix
Copy link
Author

damusix commented Apr 16, 2020

What approach do you consider in order to add the riot 4 support without breaking existing installation with current version?

Old version is completely different in almost every way. I'll assume you might need to start from scratch.

Old riot, you import tags and mount. New riot, you import tags, register, then mount.
New riot uses lifecycle methods, component state, and no observable.
New riot has less template flexibility (good thing), so old ways will break.
Some attributes and elements changed (each, virtual, template)

@dmtrs
Copy link

dmtrs commented Apr 16, 2020

Hey @damusix,
should storybook support both riot 3 and 4 or should riot 4 be a replacement to existing riot implementation?

What could be good starting points to make appropriate changes alteration? Is there any "support your framework" documentation to see how to start from scratch?

@shilman
Copy link
Contributor

shilman commented Apr 16, 2020

Start of a doc here: https://docs.google.com/document/d/1fe6uCfpr3mzSnj4jN_uoZqVnyNtjBjfOMxt_ZI7ktL8/edit

If somebody wants to add Riot 4 support and it's completely different from Riot 3, I recommend dropping Riot 3 support. If people want to use the old version of Riot, they can also use the old version of Storybook, and there are not enough existing Storybook for Riot users to justify supporting both.

@dmtrs
Copy link

dmtrs commented Apr 16, 2020

Thanks @shilman have forked storybook and will go through the document

Will come back to this ticket for updates/questions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants