Skip to content

v5.0.0

Choose a tag to compare

@jamiepollock jamiepollock released this 08 Feb 14:31
· 21 commits to main since this release

This is biggest release in a while containing many breaking changes and a few new features.

High-level changes

  • Added new IElement type
  • IModal no longer inherits IComponent
  • ComponentMetaData and related functionality has been moved to the web projects
    • Rhythm.Drop.Web.Infrastructure will contains the abstracts and interfaces
    • Rhythm.Drop.Web will contain the implementation typically used by end-user
  • Modal, Component and Element now have separate Meta Data
    • A new MetaData base class was added
    • A new CollectionMetaData base class was added to support MetaData which exists within the context of a collection (e.g. Elements and Components)
  • View Path Helper now uses MetaData and supports a new replacement token {ItemType} this optionally allow developers to separate Components, Modals and Elements
  • Configuration for Components has moved from Rhythm:Drop:Components to Rhythm:Drop:Rendering as this config now is for more than just components
  • Added drop-element and drop-elements tag helpers
  • Package dependencies now supports within the current major version

In-depth Breaking Changes

IModal no longer inherits from IComponent

IModal isn’t really a IComponent. It kind of is but it kinda isn’t. A modal is special kind of component but the original reason for extending IModal from IComponent was to make rendering easier. With the inclusion of IElement it feels like now is the right time to decouple these things.

From a rendering perspective it could also lead to some weird scenarios where technically drop-component or drop-components can render a collection of IModal or a single IModal. If they exist why have drop-modal and drop-modals?

This also means that any views for IModal objects will need to use ModalMetaData instead of ComponentMetaData and the accessor property for the Modal will change from Component to Modal.

Hopefully none of your custom IModal implementations have a property called Middle otherwise you could end up with line in your razor files like this:

@Model.Modal.Middle

ComponentMetaData and MetaData now in web projects

MetaData is only used by web facing functionality. As it stood in the Models project it was fine but didn't make as much sense as putting this in the web projects.

This will mean a breaking change to the _ViewImports.cshtml file.

Replace:

@using Rhythm.Drop.Models.Components

With:

@using Rhythm.Drop.Web.MetaData

This is the namespace where the generic type versions live for;

  • ComponentMetaData
  • ElementMetaData
  • ModalMetaData

In addition the extension methods for things like IsEven(), IsRootLevel(), etc are no longer extension methods and below to the object itself. Some functions like HumanReadableIndex are now a read only property instead of a function.

ViewName has also been removed from the meta data directly.

Configuration changes

Now we have multiple types of renderable item instead of just IComponent the configuration has been updated to reflect this. The Components configuration has been moved from Rhythm:Drop:Components to Rhythm:Drop:Rendering. This still supports the DefaultTheme and ViewPathPattern.

The default ViewPathPattern has changed from:

/Views/DropComponents/{Theme}/{ViewName}.cshtml

To:

/Views/Drop/{Theme}/{ItemType}/{ViewName}.cshtml

The old behavior can still be replicated by changing your path back to the old default value. With an additional part to the default URL and separate types of renderable items it made sense to not only shorten the path but remove "components" too from the initial base folder name within Views.

To support the new {ItemType} replacement token there is a new configuration property ItemTypes. Which controls the path slug for Components, Elements and Modals. This can be configured if you need to change any of these things.

View Path Helper

View Path Helper previously took two parameters view name and theme. This has been replaced by an abstract MetaData parameter which is used to determine the theme, view name and item type.

Package Dependencies

Prior to v5 any dependencies within Rhythm.Drop which were Rhythm.Drop packages were based on the current version or higher. For example:

Rhythm.Drop.Web (>= 4.1.0)

This didn't make any sense as breaking changes would often prevent this dependency from working out. Going forward all packages will ship with a cap at the current major version. For example:

Rhythm.Drop.Web (>= 5.0.0 && < 6.0.0)

This is thanks to code from the Umbraco CMS project.