Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Svelte Material UI (@smui) working #4

Open
jjeff opened this issue Jul 8, 2024 · 2 comments · May be fixed by #5
Open

Get Svelte Material UI (@smui) working #4

jjeff opened this issue Jul 8, 2024 · 2 comments · May be fixed by #5

Comments

@jjeff
Copy link

jjeff commented Jul 8, 2024

Svelte Material UI (SMUI) is a Svelte wrapper around Google's @material components that implement the Material Design implementation.

I'm able to write my own Svelte components and they work fine. But I have yet to successfully import any 3rd party components. The closest I've come is with SMUI.

I'm able to get SMUI to work without any of its CSS files running. However, when I add a theme, the CSS swaps the fallback HTML 5 elements with more complex Svelte-enabled DIVs and SPANs that implement the Material Design look/feel. However, the appearing elements do not function – their Javascript is not working.

Some elements like Buttons and Textfields work fine. These expose the original HTML element to the user without replacing anything. However, elements such as Switch and Slider do not function. These elements seem to place a simpler HTML 5 element on the page (checkbox and input[type="range"] respectively) and then, when CSS is enabled, the original element is hidden and a more complex interface appears. In my tests, the more complex interface is appearing… but it is not interactive.

Thoughts/notes ideas:

  1. Aside from the CSS imports, I'm implementing most of this in the preload script. Since my self-written Svelte scripts work there, I think we ought to be able to get SMUI working there.
  2. I've had trouble implementing custom web components in Electron's preload process in the past. But it doesn't appear that Google nor SMUI are actually creating custom elements. They're just using divs and similar.
  3. Nonetheless, I did a little experimenting trying to move the scripts in the renderer (index.ts) instead of preload and didn't have any better luck.
jjeff added a commit that referenced this issue Jul 8, 2024
still exhibiting bug #4
@jjeff jjeff linked a pull request Jul 8, 2024 that will close this issue
@jjeff
Copy link
Author

jjeff commented Jul 9, 2024

Things to try:

@jjeff
Copy link
Author

jjeff commented Jul 9, 2024

Examples of functioning switch and slider:

https://sveltematerialui.com/demo/switch/
https://sveltematerialui.com/demo/slider/

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

Successfully merging a pull request may close this issue.

1 participant