Skip to content

Commit

Permalink
Merge pull request #541 from studiometa/release/3.0.0-beta.1
Browse files Browse the repository at this point in the history
[Release] 3.0.0-beta.1
  • Loading branch information
titouanmathis authored Nov 18, 2024
2 parents e9ebe6c + 8ab4e31 commit 6f7a8c4
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format

## [Unreleased]

## [v3.0.0-beta.1](https://github.com/studiometa/js-toolkit/compare/3.0.0-beta.0..3.0.0-beta.1) (2024-11-18)

### Fixed

- Fix importing the services in SSR context ([#540](https://github.com/studiometa/js-toolkit/pull/540), [69c8d2b9](https://github.com/studiometa/js-toolkit/commit/69c8d2b9))

## [v3.0.0-beta.0](https://github.com/studiometa/js-toolkit/compare/3.0.0-alpha.12..3.0.0-beta.0) (2024-11-16)

### Changed
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-workspace",
"version": "3.0.0-beta.0",
"version": "3.0.0-beta.1",
"private": true,
"type": "module",
"workspaces": [
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-demo",
"version": "3.0.0-beta.0",
"version": "3.0.0-beta.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-docs",
"version": "3.0.0-beta.0",
"version": "3.0.0-beta.1",
"type": "module",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/js-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit",
"version": "3.0.0-beta.0",
"version": "3.0.0-beta.1",
"description": "A set of useful little bits of JavaScript to boost your project! 🚀",
"publishConfig": {
"access": "public"
Expand Down
6 changes: 2 additions & 4 deletions packages/js-toolkit/services/AbstractService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { isFunction } from '../utils/index.js';

export interface ServiceInterface<T> {
/**
* Remove a function from the resize service by its key.
Expand All @@ -23,7 +21,7 @@ export interface ServiceInterface<T> {
* Service configuration of events to be attached to targets.
*/
export type ServiceConfig = [
EventTarget | ((instance: AbstractService) => EventTarget),
((instance: AbstractService) => EventTarget),
[string, AddEventListenerOptions?][],
][];

Expand Down Expand Up @@ -147,7 +145,7 @@ export class AbstractService<PropsType = any> {
*/
__manageEvents(mode: 'add' | 'remove') {
for (const [target, events] of this.constructor.config) {
const resolvedTarget = isFunction(target) ? target(this) : target;
const resolvedTarget = target(this);
for (const [type, options] of events) {
resolvedTarget[`${mode}EventListener`](type, this, options);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/js-toolkit/services/DragService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class DragService extends AbstractService<DragServiceProps> {
],
],
[
window,
() => window,
[
['pointerup', PASSIVE_EVENT_OPTIONS],
['touchend', PASSIVE_EVENT_OPTIONS],
Expand Down
2 changes: 1 addition & 1 deletion packages/js-toolkit/services/KeyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface KeyServiceProps {
export type KeyServiceInterface = ServiceInterface<KeyServiceProps>;

export class KeyService extends AbstractService<KeyServiceProps> {
static config: ServiceConfig = [[document, [['keydown'], ['keyup']]]];
static config: ServiceConfig = [[() => document, [['keydown'], ['keyup']]]];

previousEvent: Event | null = null;

Expand Down
2 changes: 1 addition & 1 deletion packages/js-toolkit/services/LoadService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface LoadServiceProps {
export type LoadServiceInterface = ServiceInterface<LoadServiceProps>;

export class LoadService extends AbstractService<LoadServiceProps> {
static config: ServiceConfig = [[window, [['load']]]];
static config: ServiceConfig = [[() => window, [['load']]]];

props: LoadServiceProps = {
time: performance.now(),
Expand Down
2 changes: 1 addition & 1 deletion packages/js-toolkit/services/PointerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type PointerServiceInterface = ServiceInterface<PointerServiceProps>;
export class PointerService extends AbstractService<PointerServiceProps> {
static config: ServiceConfig = [
[
document,
() => document,
[
['mouseenter', ONCE_CAPTURE_EVENT_OPTIONS],
['mousemove', PASSIVE_CAPTURE_EVENT_OPTIONS],
Expand Down
2 changes: 1 addition & 1 deletion packages/js-toolkit/services/ResizeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type ResizeServiceInterface<U extends Features['breakpoints'] = Features[
export class ResizeService<
T extends Features['breakpoints'] = Features['breakpoints'],
> extends AbstractService<ResizeServiceProps> {
static config: ServiceConfig = [[window, [['resize']]]];
static config: ServiceConfig = [[() => window, [['resize']]]];

breakpoints: T;

Expand Down
2 changes: 1 addition & 1 deletion packages/js-toolkit/services/ScrollService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface ScrollServiceProps {
export type ScrollServiceInterface = ServiceInterface<ScrollServiceProps>;

export class ScrollService extends AbstractService<ScrollServiceProps> {
static config: ServiceConfig = [[document, [['scroll', PASSIVE_CAPTURE_EVENT_OPTIONS]]]];
static config: ServiceConfig = [[() => document, [['scroll', PASSIVE_CAPTURE_EVENT_OPTIONS]]]];

props: ScrollServiceProps = {
x: window.scrollX,
Expand Down
2 changes: 1 addition & 1 deletion packages/tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-tests",
"version": "3.0.0-beta.0",
"version": "3.0.0-beta.1",
"private": true,
"type": "module",
"scripts": {
Expand Down

0 comments on commit 6f7a8c4

Please sign in to comment.