# Migrating to Newer SMUI Versions This doc contains information that will help you migrate your code from an older version of SMUI to a newer one. Things that you will need to change in your existing code will be written here. # SMUI 8 -> SMUI 9 SMUI 9 has migrated away from MDC-Web, since MDC-Web has been abandoned. ## Breaking Changes - All "@material" packages you're using should be migrated to "@smui" packages. Many have been moved inside the "@smui/common" package. - Particularly, the following SCSS imports have changed: - @material/animation is now @smui/common/animation - @material/density is now @smui/common/density - @material/dom is now @smui/common/dom - @material/elevation is now @smui/common/elevation - @material/feature-targeting is now @smui/common/feature-targeting - @material/focus is now @smui/common/focus - @material/focus-ring is now @smui/common/focus-ring - @material/rtl is now @smui/common/rtl - @material/shape is now @smui/common/shape - @material/theme is now @smui/common/theme - @material/tokens is now @smui/common/tokens - @material/typography is now @smui/common/typography - And the following JS imports have changed: - @material/animation is now @smui/common/animation - @material/base is now @smui/common/base - @material/dom is now @smui/common/dom - @material/progress-indicator is now @smui/common/progress-indicator - Plain Tooltips now require a Label component (can be imported from `@smui/tooltip` or `@smui/common`) wrapping their text. (Rich tooltips still use the Content component.) - IconButton should now always contain at least one Icon child. - Kitchen now includes a `dismissIcon$` prefix. If you used `dismiss$class`, you should probably now change it to `dismissIcon$class`. - In Slider, the input now appears inside the "thumb" element. - Fullscreen and Sheet Dialogs should now have a new CloseTooltipWrapper component surrounding the close button. - The close button in a Sheet Dialog should be a child of the Dialog, not the Content. ## Changes - IconButton now has a `focusRing` property to control whether the focus ring is shown. - Dialog now has a `scrimRemoved` property to remove the Scrim behind the dialog. - Form Field now has a `justify` property to justify the label and input. - Tooltip timing has been changed to 250ms to show and 100ms to hide (previously 500ms and 600ms respectively). - Plain Tooltips now do not respond to mouse events. - Plain Tooltips now actually look like the Material Spec. - New premade theme, "Muted". ### Components - Flyout Panel - A new component! # SMUI 7 -> SMUI 8 SMUI 8 has migrated to Svelte 5's new Runes mode. As such, it expects things like snippets and only some props are bindable. Note to Devs: update `indexOf()` with `$state` arrays or items to `findIndex()` to avoid bugs. Note to Devs: remove `x = x;` statements after `push()` and the like. They aren't needed anymore with Svelte 5's new $state rune. ## Breaking Changes - Svelte 5 is required! Svelte 4 will not work. - Events have been renamed, removing colons and adopting CamelCase. (ex: SMUISwitch:change to SMUISwitchChange) - Event modifiers are now wrapper functions, exported from `@smui/common/events`. - Slots must be migrated to snippets. - The deprecated "MDC" events have been removed. All event names should be migrated to the corresponding "SMUI" event names. - The "Fixation" theme now uses Tahoma as its large header font. - Select no longer defaults the value to an empty string, meaning you must either set the value given to it to an empty string or provide a key function that returns an empty string for an undefined value. - TabBar now expects a `tab` snippet instead of using `let:tab`. - Chips' Set now expects a `chip` snippet instead of using `let:chip`. - Chips' Set key function is now required to return `string`, not `string | number`. - SegmentedButton now expects a `segment` snippet instead of using `let:segment`. - `classAdderBuilder` is no longer available. Instead, the `ClassAdder` component is exported. - Svelte 5 doesn't seem to provide a way to reuse components the way classAdderBuilder needs. The version in beta.2 and before works only on the first render, but props were not reactive. ## Changes - Event listeners for DOM events no longer need to use the CustomEvent type. They can use the correct type, like MouseEvent and KeyboardEvent. - New premade theme, "Bubblegum". ### Components - Chip Input - A new component! # SMUI 6 -> SMUI 7 SMUI 7 migrated to upstream MDC 14.0 from 13.0: https://github.com/material-components/material-components-web/blob/master/CHANGELOG.md#1400-2022-04-27 ## Themes I spent a day [flexing every graphic design muscle in my body](https://i.kym-cdn.com/entries/icons/original/000/018/929/graphic_design_is_my_passion.png), and made some THEMES! SMUI 7 can now be styled with a custom theme, the default theme, or [brand spanking new premade themes](https://sveltematerialui.com/INSTALL.md#a-premade-theme). This makes it much easier to get started with SMUI. ## Breaking Changes - Tooling now **must** be Svelte-aware. This means adding conditional export names to Rollup and Webpack config. See installation docs. - SMUI 7 (after v7.0.0-beta.9) is no longer compatible with Svelte 3. It now requires Svelte 4. - If you had started using `component={Svg}`, you need to use `tag="svg"` after v7.0.0-beta.12. - The `@smui/common/elements` components are gone. Just set the `tag` prop on components now (like `