Skip to content

Commit

Permalink
Migrate utilities from react to react-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
deminearchiver committed Nov 3, 2024
1 parent 6cf8ed6 commit a811c26
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 162 deletions.
6 changes: 6 additions & 0 deletions packages/react-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @star4/react-utils

## 0.0.3

### Patch Changes

- Migrate utils from @star4/react to @star4/react-utils

## 0.0.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@star4/react-utils",
"version": "0.0.2",
"version": "0.0.3",
"publishConfig": {
"access": "public"
},
Expand Down
1 change: 1 addition & 0 deletions packages/react-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./is-server";
export * from "./use-isomorphic-layout-effect";
export * from "./use-media-query";
export * from "./use-presence";
File renamed without changes.
8 changes: 8 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @star4/react

## 0.0.13

### Patch Changes

- Migrate utils from @star4/react to @star4/react-utils
- Updated dependencies
- @star4/react-utils@0.0.3

## 0.0.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@star4/react",
"version": "0.0.12",
"version": "0.0.13",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/dialog/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, type FC, type ReactNode } from "react";
import { Modal } from "../modal"
import { usePresence } from "../utils";
import { usePresence } from "@star4/react-utils";
import clsx from "clsx";
import { styles } from "./dialog.css";
import { Divider } from "../divider";
Expand Down
2 changes: 2 additions & 0 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ export * from "./modal";

// Non-components
export * from "./utils";

export * from "@star4/react-utils";
2 changes: 1 addition & 1 deletion packages/react/src/ripple/ripple.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { forwardRef, useEffect, useImperativeHandle, useRef, useState, type HTMLAttributes, type RefObject } from "react";
import { styles } from "./ripple.css";
import clsx from "clsx/lite";
import { useMediaQuery } from "../utils";
import { useMediaQuery } from "@star4/react-utils";

const wait = (timeout: number) => new Promise<void>(resolve => setTimeout(resolve, timeout));

Expand Down
120 changes: 0 additions & 120 deletions packages/react/src/utils/event-listener.ts

This file was deleted.

10 changes: 0 additions & 10 deletions packages/react/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
import { useEffect, useLayoutEffect } from "react";

export * from "./presence";
export * from "./media-query";
export * from "./focus";
export * from "./event-listener";

export const IS_SERVER = typeof window === "undefined";

export const useIsomorphicLayoutEffect =
IS_SERVER ? useEffect : useLayoutEffect;
28 changes: 0 additions & 28 deletions packages/react/src/utils/media-query.ts

This file was deleted.

0 comments on commit a811c26

Please sign in to comment.