Skip to content

Commit

Permalink
feat!: use react-use, instead of use
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiboss committed Jun 18, 2024
1 parent 7b779af commit 63961f0
Show file tree
Hide file tree
Showing 159 changed files with 179 additions and 178 deletions.
2 changes: 1 addition & 1 deletion examples/nextjs-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@shined/use": "workspace:*",
"@shined/react-use": "workspace:*",
"next": "14.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-ssr/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion examples/nextjs-ssr/src/app/client.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { useBrowserMemory, useCircularList, useElementSize, useTitle } from '@shined/use'
import { useBrowserMemory, useCircularList, useElementSize, useTitle } from '@shined/react-use'

export function Client() {
const { width, height } = useElementSize('#el-textarea')
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@shined/use": "workspace:*",
"@shined/react-use": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"braces": ">=3.0.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/src/parts/part-five.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useSafeState,
useScrollLock,
useStateHistory,
} from '@shined/use'
} from '@shined/react-use'

const addTen = (a: number) => {
return new Promise<number>((resolve) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/src/parts/part-four.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
useSpringValue,
useTimeAgo,
useTitle,
} from '@shined/use'
} from '@shined/react-use'

export const PartFour = () => {
const divRef = useRef<HTMLDivElement | null>(null)
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/src/parts/part-one.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
useMousePressed,
useScroll,
useWindowScroll,
} from '@shined/use'
} from '@shined/react-use'

export function PartOne() {
const hoverRef = useRef<HTMLDivElement>(null)
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/src/parts/part-six.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
useKeyUp,
useLongPress,
useUrlSearchParams,
} from '@shined/use'
} from '@shined/react-use'
import { useRef } from 'react'

export const PartSix = () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/src/parts/part-three.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useNetwork,
useSafeState,
useTextSelection,
} from '@shined/use'
} from '@shined/react-use'

export const PartThree = () => {
const fullscreenRef = useRef<HTMLDivElement>(null)
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/src/parts/part-two.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useMouse,
useStyleTag,
useTextDirection,
} from '@shined/use'
} from '@shined/react-use'

export const PartTwo = () => {
const { x, y } = useMouse({ type: 'client' })
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/src/playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
useTargetElement,
useToggle,
useUserMedia,
} from '@shined/use'
} from '@shined/react-use'

export const Playground = () => {
const [showChild, toggle] = useToggle(true)
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@shined/use",
"name": "@shined/react-use",
"type": "module",
"version": "0.0.0-alpha.0",
"packageManager": "[email protected]",
Expand All @@ -23,6 +23,7 @@
},
"keywords": [
"react",
"react-use",
"react-hooks",
"shined"
],
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @shined/use
# @shined/react-use

![Static Badge](https://img.shields.io/badge/Checked_with-Biome-60a5fa?style=flat&logo=biome)

Expand Down
2 changes: 1 addition & 1 deletion src/create-single-loading/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone, wait as mockFetch } from '@/components'
import { createSingleLoading } from '@shined/use'
import { createSingleLoading } from '@shined/react-use'

const pageLoading = createSingleLoading()

Expand Down
2 changes: 1 addition & 1 deletion src/use-active-element/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, Input, KeyValue, Zone } from '@/components'
import { useActiveElement } from '@shined/use'
import { useActiveElement } from '@shined/react-use'

export function App() {
const activeElement = useActiveElement()
Expand Down
2 changes: 1 addition & 1 deletion src/use-adaptive-textarea/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue } from '@/components'
import { useAdaptiveTextarea, useCounter, useLoremIpsum } from '@shined/use'
import { useAdaptiveTextarea, useCounter, useLoremIpsum } from '@shined/react-use'

export function App() {
const lorem = useLoremIpsum()
Expand Down
2 changes: 1 addition & 1 deletion src/use-async-effect/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useAsyncEffect, useCounter, useToggle } from '@shined/use'
import { useAsyncEffect, useCounter, useToggle } from '@shined/react-use'

import type { SetIntervalReturn } from '../utils/basic'

Expand Down
2 changes: 1 addition & 1 deletion src/use-async-fn/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone, wait as mockFetch } from '@/components'
import { useAsyncFn } from '@shined/use'
import { useAsyncFn } from '@shined/react-use'

export function App() {
const fetchFn = useAsyncFn(() => mockFetch(300))
Expand Down
2 changes: 1 addition & 1 deletion src/use-async-lock/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, OTP, Zone, wait as mockFetch } from '@/components'
import { useAsyncFn, useAsyncLock, useCounter, useSafeState } from '@shined/use'
import { useAsyncFn, useAsyncLock, useCounter, useSafeState } from '@shined/react-use'

export function App() {
const [data, setData] = useSafeState<string>('none')
Expand Down
2 changes: 1 addition & 1 deletion src/use-async-update-effect/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useAsyncUpdateEffect, useCounter, useToggle } from '@shined/use'
import { useAsyncUpdateEffect, useCounter, useToggle } from '@shined/react-use'

import type { SetIntervalReturn } from '../utils/basic'

Expand Down
2 changes: 1 addition & 1 deletion src/use-battery/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue } from '@/components'
import { useBattery } from '@shined/use'
import { useBattery } from '@shined/react-use'

export function App() {
const battery = useBattery()
Expand Down
2 changes: 1 addition & 1 deletion src/use-before-unload/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useBeforeUnload, useToggle } from '@shined/use'
import { useBeforeUnload, useToggle } from '@shined/react-use'

export function App() {
const [show, toggle] = useToggle(true)
Expand Down
2 changes: 1 addition & 1 deletion src/use-bluetooth/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, Input, KeyValue, Zone } from '@/components'
import { useBluetooth, useControlledComponent, useSetState } from '@shined/use'
import { useBluetooth, useControlledComponent, useSetState } from '@shined/react-use'
import { useEffect } from 'react'

export function App() {
Expand Down
2 changes: 1 addition & 1 deletion src/use-breakpoints/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue } from '@/components'
import { useBreakpoints, useEventListener, useMount, useSafeState } from '@shined/use'
import { useBreakpoints, useEventListener, useMount, useSafeState } from '@shined/react-use'

const breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280, xxl: 1536 }

Expand Down
2 changes: 1 addition & 1 deletion src/use-browser-memory/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue, Zone } from '@/components'
import { useBrowserMemory } from '@shined/use'
import { useBrowserMemory } from '@shined/react-use'

const size = (v: number) => `${(v / 1024 / 1024).toFixed(2)} MB`

Expand Down
2 changes: 1 addition & 1 deletion src/use-circular-list/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue } from '@/components'
import { useCircularList } from '@shined/use'
import { useCircularList } from '@shined/react-use'

const fruits = ['🍌 banner', '🍎 apple', '🍇 grape', '🍉 watermelon', '🍊 orange']

Expand Down
2 changes: 1 addition & 1 deletion src/use-clamp/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useClamp, useCounter } from '@shined/use'
import { useClamp, useCounter } from '@shined/react-use'

export function App() {
const [max, maxActions] = useCounter(10)
Expand Down
2 changes: 1 addition & 1 deletion src/use-click-outside/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue } from '@/components'
import { useClickOutside, useCounter } from '@shined/use'
import { useClickOutside, useCounter } from '@shined/react-use'
import { useRef } from 'react'

const cls =
Expand Down
2 changes: 1 addition & 1 deletion src/use-clipboard-items/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card } from '@/components'
import { useClipboardItems } from '@shined/use'
import { useClipboardItems } from '@shined/react-use'

export function App() {
const clipboard = useClipboardItems()
Expand Down
2 changes: 1 addition & 1 deletion src/use-clipboard/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, Input, KeyValue } from '@/components'
import { useClipboard, useControlledComponent } from '@shined/use'
import { useClipboard, useControlledComponent } from '@shined/react-use'

const hash = () => Math.random().toString(36).slice(2, 8).toUpperCase()

Expand Down
2 changes: 1 addition & 1 deletion src/use-cloned/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useCloned, useSafeState } from '@shined/use'
import { useCloned, useSafeState } from '@shined/react-use'

export function App() {
const [state, setState] = useSafeState({
Expand Down
2 changes: 1 addition & 1 deletion src/use-controlled-component/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, Input } from '@/components'
import { useControlledComponent, useUnmount } from '@shined/use'
import { useControlledComponent, useUnmount } from '@shined/react-use'
import { Toaster, toast } from 'react-hot-toast'

export function App() {
Expand Down
2 changes: 1 addition & 1 deletion src/use-countdown/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, Input, KeyValue, Zone } from '@/components'
import { useCountdown, useSafeState } from '@shined/use'
import { useCountdown, useSafeState } from '@shined/react-use'

export function App() {
const ms = useCountdown(() => new Date('2030-01-01T00:00:00Z'))
Expand Down
2 changes: 1 addition & 1 deletion src/use-counter/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useCounter } from '@shined/use'
import { useCounter } from '@shined/react-use'

export function App() {
const [count, action, { max, min, initialCount }] = useCounter(1, { max: 20, min: 0 })
Expand Down
2 changes: 1 addition & 1 deletion src/use-creation/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useCounter, useCreation, useUnmount } from '@shined/use'
import { useCounter, useCreation, useUnmount } from '@shined/react-use'
import { useEffect } from 'react'
import { Toaster, toast } from 'react-hot-toast'

Expand Down
2 changes: 1 addition & 1 deletion src/use-css-var/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useCssVar, useLoremIpsum } from '@shined/use'
import { useCssVar, useLoremIpsum } from '@shined/react-use'

const random256 = () => Math.floor(Math.random() * 256)
const randomColor = () => `rgb(${random256()}, ${random256()}, ${random256()})`
Expand Down
2 changes: 1 addition & 1 deletion src/use-date-format/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue, LabelInput, Zone } from '@/components'
import { useControlledComponent, useDateFormat, useNow } from '@shined/use'
import { useControlledComponent, useDateFormat, useNow } from '@shined/react-use'

export function App() {
const now = useNow()
Expand Down
2 changes: 1 addition & 1 deletion src/use-debounced-effect/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useCounter, useDebouncedEffect, useUnmount } from '@shined/use'
import { useCounter, useDebouncedEffect, useUnmount } from '@shined/react-use'
import { Toaster, toast } from 'react-hot-toast'

const wait = 300
Expand Down
2 changes: 1 addition & 1 deletion src/use-debounced-fn/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useCounter, useDebouncedFn } from '@shined/use'
import { useCounter, useDebouncedFn } from '@shined/react-use'

const wait = 300

Expand Down
2 changes: 1 addition & 1 deletion src/use-deep-compare-effect/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useDeepCompareEffect, useUnmount } from '@shined/use'
import { useDeepCompareEffect, useUnmount } from '@shined/react-use'
import { useEffect, useState } from 'react'
import { Toaster, toast } from 'react-hot-toast'

Expand Down
2 changes: 1 addition & 1 deletion src/use-deep-compare-effect/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HooksType } from '@/components'

<HooksType category="Lifecycle" lowLevel />

A React Hook like [React.useEffect](https://react.dev/reference/react/useEffect), but with [deep comparison](https://github.com/sheinsight/use/blob/main/src/utils/equal.ts#L29) of dependencies.
A React Hook like [React.useEffect](https://react.dev/reference/react/useEffect), but with [deep comparison](https://github.com/sheinsight/react-use/blob/main/src/utils/equal.ts#L29) of dependencies.

## Demo

Expand Down
2 changes: 1 addition & 1 deletion src/use-deep-compare-layout-effect/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useDeepCompareLayoutEffect, useUnmount } from '@shined/use'
import { useDeepCompareLayoutEffect, useUnmount } from '@shined/react-use'
import { useEffect, useState } from 'react'
import { Toaster, toast } from 'react-hot-toast'

Expand Down
2 changes: 1 addition & 1 deletion src/use-device-list/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useDeviceList } from '@shined/use'
import { useDeviceList } from '@shined/react-use'

export function App() {
const device = useDeviceList({ requestPermissions: true })
Expand Down
2 changes: 1 addition & 1 deletion src/use-document-leave/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue } from '@/components'
import { useDocumentLeave } from '@shined/use'
import { useDocumentLeave } from '@shined/react-use'

export function App() {
const isUserLeaveDocument = useDocumentLeave()
Expand Down
2 changes: 1 addition & 1 deletion src/use-document-visibility/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue } from '@/components'
import { useDocumentVisibility, useTitle } from '@shined/use'
import { useDocumentVisibility, useTitle } from '@shined/react-use'

export function App() {
const visibility = useDocumentVisibility()
Expand Down
2 changes: 1 addition & 1 deletion src/use-draggable/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card } from '@/components'
import { useDraggable } from '@shined/use'
import { useDraggable } from '@shined/react-use'

export function App() {
const draggable = useDraggable('#drag-me', {
Expand Down
2 changes: 1 addition & 1 deletion src/use-drop-zone/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue, Zone } from '@/components'
import { useDropZone } from '@shined/use'
import { useDropZone } from '@shined/react-use'

export function App() {
const { isOverDropZone, files } = useDropZone('#drop-zone')
Expand Down
2 changes: 1 addition & 1 deletion src/use-dynamic-list/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, Card, Input, Zone } from '@/components'
import { useAutoAnimate } from '@formkit/auto-animate/react'
import { useDynamicList } from '@shined/use'
import { useDynamicList } from '@shined/react-use'

export function App() {
const [containerRef] = useAutoAnimate()
Expand Down
2 changes: 1 addition & 1 deletion src/use-effect-once/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, KeyValue } from '@/components'
import { useCounter, useEffectOnce } from '@shined/use'
import { useCounter, useEffectOnce } from '@shined/react-use'

export function App() {
const [count, actions] = useCounter(0)
Expand Down
2 changes: 1 addition & 1 deletion src/use-element-bounding/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card } from '@/components'
import { useElementBounding } from '@shined/use'
import { useElementBounding } from '@shined/react-use'

export function App() {
const [bounding, _update] = useElementBounding('#el-bounding')
Expand Down
2 changes: 1 addition & 1 deletion src/use-element-by-point/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Card, KeyValue, Zone } from '@/components'
import { useElementBounding, useElementByPoint, useMouse, useStyleTag } from '@shined/use'
import { useElementBounding, useElementByPoint, useMouse, useStyleTag } from '@shined/react-use'

export function App() {
const { x, y, ...mouseControls } = useMouse({ type: 'client' })
Expand Down
Loading

0 comments on commit 63961f0

Please sign in to comment.