From c52862e04c33c04f70cc82691834f5a14f8e354b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 6 Oct 2022 08:05:10 -0400 Subject: [PATCH] [ci] release (next) (#181) Co-authored-by: github-actions[bot] --- .changeset/pre.json | 4 ++- CHANGELOG.md | 62 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index c523cf1..6fc73c8 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -4,5 +4,7 @@ "initialVersions": { "corset": "2.4.0" }, - "changesets": [] + "changesets": [ + "stupid-beds-draw" + ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bf357f..7830993 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,67 @@ # corset +## 2.5.0-next.0 + +### Minor Changes + +- 38ff738: Allow specifying an alternative event target with event-target + + This now allows specifying an alternative event target via the new `event-target` property. You can use it like this: + + ```js + import sheet, { mount } from "https://cdn.corset.dev/v2"; + + mount( + document, + class { + onpopstate(ev) { + console.log( + `location: ${document.location}, state: ${JSON.stringify( + event.state + )}` + ); + } + bind() { + return sheet` + #app { + event: popstate ${this.onpopstate}; + event-target: popstate ${window}; + } + `; + } + } + ); + ``` + + In the above we are able to use a selector to listen to the [popstate](https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event) event that is on the window object. + + This can also be used with any object that follows the [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) interface: + + ```js + import sheet, { mount } from "https://cdn.corset.dev/v2"; + + let target = new EventTarget(); + // Now this can be shared around + + mount( + document, + class { + bind() { + return sheet` + #app { + event: foo ${() => console.log("foo event occurred!")}; + event-target: foo ${target}; + } + + some-custom-element { + prop: events ${target}; + } + `; + } + } + ); + ``` + ## 2.4.0 ### Minor Changes diff --git a/package.json b/package.json index e6b3ac8..9ffe42e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "corset", - "version": "2.4.0", + "version": "2.5.0-next.0", "description": "Declarative DOM binding, without the complexity of JSX/templates.", "type": "module", "main": "./lib/main.js",