Skip to content

Commit

Permalink
Prepare for 2.x interface.
Browse files Browse the repository at this point in the history
Changes:
* Adding `??attr` binding syntax.
* Changing `ifDefined` to delete attr on `null` as well as `undefined`.
* Deprecating `ifDefined` / `nullish` in favor of `??attr` binding.
* Deprecating `repeat` in favor of `map`.
* Updating documentation.

Closes #204.
  • Loading branch information
theengineear committed Nov 15, 2024
1 parent e975ecc commit e2c06fb
Show file tree
Hide file tree
Showing 5 changed files with 1,359 additions and 500 deletions.
38 changes: 31 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- You can now bind attributes with `??foo="${bar}"` syntax. This is functionally
equivalent to the `nullish` updater and will replace that functionality later.
- A new `unsafe` updater was added to replace `unsafeHTML` and `unsafeSVG`. You
use it like `unsafe(value, 'html')` and `unsafe(value, 'svg')`.

### Changed

- Template errors now include approximate line numbers from the offending
template. They also print the registered custom element tag name (#201).
- The `ifDefined` updater now deletes the attribute on `null` in addition to
`undefined`. This makes it behave identically to `nullish`. However, both
updaters are deprecated and the `??attr` binding should be used instead.

### Deprecated

- The `ifDefined` and `nullish` updaters are deprecated, update templates to use
syntax like `??foo="${bar}"`.
- The `repeat` updater is deprecated, use `map` instead.
- The `unsafeHTML` and `unsafeSVG` updaters are deprecated, use `unsafe`.

### Fixed

- Transitions from different content values should all now work. For example,
you previously could not change from a text value to an array. Additionally,
state is properly cleared when going from one value type to another — e.g.,
when going from `unsafe` back to `null`.

## [1.1.1] - 2024-11-09

Expand All @@ -27,20 +51,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New support for static `styles` getter for `adoptedStyleSheets` ergonomics
(#52).

### Fixed

- The `map` function now works with properties / attributes bound across
template contexts (#179).
- The `x-element.d.ts` file now reflects the actual interface. Previously, it
has some issues (e.g., improper module export).

### Changed

- The `x-element.js` file is now “typed” via JSDoc. The validity of the JSDoc
comments are linted alongside the rest of the code and the annotations there
are exported into a generated `x-element.d.ts` file. Previously, that file was
hand-curated.

### Fixed

- The `map` function now works with properties / attributes bound across
template contexts (#179).
- The `x-element.d.ts` file now reflects the actual interface. Previously, it
has some issues (e.g., improper module export).

## [1.0.0] - 2024-02-29

### Added
Expand Down
Loading

0 comments on commit e2c06fb

Please sign in to comment.