Tags: JohnSundell/Plot
Tags
Fix compiler error and warning introduced in Swift 5.6 (#80) - Replace `HTMLAnchorTarget.self` with `.current` (while still maintaining backward compatibility with `.self` using a deprecated computed property). - Use per-`init` generic type constraints for optional `EnvironmentKey.Value` types rather than applying an extension-wide constraint using `ExpressibleByNilLiteral`.
Boolean attributes (#68) * Change `required` and `autofocus` to be boolean attributes. * Added `readonly`, `disabled`, and `multiple` boolean attributes to `input` elements. * Added `readonly ` and `disabled ` attributes to the `textarea` element. * Added a `placeholder` attribute to the `textarea` element. * Changed the `allowfullscreen` attribute on the `iframe` element to be a boolean attribute. * Added an `open` boolean attribute to the `details` element. * Added the `hidden` boolean attribute as a global attribute. * Added `checked` boolean attribute to the `input` element. * Added a `name` to the `file` input element in the form test.
Fix text rendering regression for indented documents (#65) Plot 0.9.0 introduced a minor regression for documents that are rendered with indentation, in that plain text nodes would always be rendered on a new line. This patch fixes that by differentiating between plain text output and element-based output, and only the latter causes a new line to be inserted, preserving the previous rendering behavior. Components that are made up of just plain text also get this behavior, and the unit test that verifies indented documents has been expanded to also cover these cases.
Make it possible to add attributes to wrapper components (#63) When an attribute is added to a component that acts as a wrapper for an element-based component, that attribute is now added directly to the wrapped, underlying element. That makes it possible to append things like class names to existing, custom components.
Add a new Component-based API and a much more flexible rendering syst… …em (#61) - Refactor Plot's rendering system to become much more flexible, by replacing the previous `ElementRenderer` class with a new, general-purpose `Renderer` struct, and by refactoring the `Node` enum into a struct that carries a free-form `rendering` closure. All of these changes are pure refactors - they don't affect the public API at all. - Add a new `Component` API that enables HTML `<body>` components to be defined in a very SwiftUI-like way. The new API ships with lots of built-in implementations that map to commonly used elements (such as `div`, `a`, `ul`, and so on), and enables the API user to easily define their own components as well. It also features an environment API (similar to the one that SwiftUI offers), the ability to apply modifiers to components, and complete interoperability with the existing `Node`-based API. - All of these changes are completely additive and fully backward compatible with the old API. The only potential situation that could cause these changes to be breaking for an API user is if a `Node` value was being switched on. Since it's now no longer an enum, that will no longer work, but it's highly unlikely that Plot's API has been used this way by any API user. - Update the documentation for the new `Component` API.
HTML: Constrain <form>-specific elements to BodyContext (#44) This change moves the APIs for creating what can be seen as “form-specific” HTML elements (such as `<input>` and `<fieldset>`) from an extension constrained to `HTML.FormContext` to the main `HTML.BodyContext` instead. This enables such elements to be mixed and matched with other body elements, such as `<div>`. While such elements might most often appear within forms, there’s nothing within the HTML spec that enforces that, so neither should Plot.
PreviousNext