@fictjs/hooks 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +22 -68
  2. package/package.json +9 -1
package/README.md CHANGED
@@ -8,20 +8,25 @@ Official hooks package for Fict.
8
8
 
9
9
  `@fictjs/hooks` provides official, production-ready hooks built for Fict signal/lifecycle semantics.
10
10
 
11
+ ## Highlights
12
+
13
+ - 39 official hooks across lifecycle, event, timing, state, browser, storage, observer, async and clipboard
14
+ - SSR-safe browser hooks with injectable globals (`window`, `document`, `navigator`) for non-browser/test environments
15
+ - Root-only public entry (`@fictjs/hooks`) with ESM tree shaking support
16
+ - Strong type coverage and CI quality gates (`lint`, `typecheck`, `test:types`, `test`, `build`)
17
+
11
18
  ## Install
12
19
 
13
20
  For application usage:
14
21
 
15
22
  ```bash
23
+ npm add @fictjs/hooks @fictjs/runtime
24
+ # or
25
+ yarn add @fictjs/hooks @fictjs/runtime
26
+ # or
16
27
  pnpm add @fictjs/hooks @fictjs/runtime
17
28
  ```
18
29
 
19
- For repository development:
20
-
21
- ```bash
22
- pnpm install
23
- ```
24
-
25
30
  ## Requirements
26
31
 
27
32
  - Node.js >= 18
@@ -59,54 +64,17 @@ In plain TypeScript/JavaScript usage (without Fict compile transforms), read rea
59
64
 
60
65
  ## Hook Docs
61
66
 
62
- - Lifecycle
63
- - `useMount` -> `docs/hooks/useMount.md`
64
- - `useUnmount` -> `docs/hooks/useUnmount.md`
65
- - Event
66
- - `useEventListener` -> `docs/hooks/useEventListener.md`
67
- - `useClickOutside` -> `docs/hooks/useClickOutside.md`
68
- - `useHover` -> `docs/hooks/useHover.md`
69
- - `useFocusWithin` -> `docs/hooks/useFocusWithin.md`
70
- - `useKeyPress` -> `docs/hooks/useKeyPress.md`
71
- - Timing
72
- - `useDebounceFn` -> `docs/hooks/useDebounceFn.md`
73
- - `useThrottleFn` -> `docs/hooks/useThrottleFn.md`
74
- - `useTimeoutFn` -> `docs/hooks/useTimeoutFn.md`
75
- - `useIntervalFn` -> `docs/hooks/useIntervalFn.md`
76
- - `useRafFn` -> `docs/hooks/useRafFn.md`
77
- - State
78
- - `useToggle` -> `docs/hooks/useToggle.md`
79
- - `useCounter` -> `docs/hooks/useCounter.md`
80
- - `usePrevious` -> `docs/hooks/usePrevious.md`
81
- - `useVirtualList` -> `docs/hooks/useVirtualList.md`
82
- - Browser
83
- - `useScroll` -> `docs/hooks/useScroll.md`
84
- - `useWindowScroll` -> `docs/hooks/useWindowScroll.md`
85
- - `useWindowSize` -> `docs/hooks/useWindowSize.md`
86
- - `useTitle` -> `docs/hooks/useTitle.md`
87
- - `useFullscreen` -> `docs/hooks/useFullscreen.md`
88
- - `usePermission` -> `docs/hooks/usePermission.md`
89
- - `useGeolocation` -> `docs/hooks/useGeolocation.md`
90
- - `useIdle` -> `docs/hooks/useIdle.md`
91
- - `useSize` -> `docs/hooks/useSize.md`
92
- - `useWebSocket` -> `docs/hooks/useWebSocket.md`
93
- - `useMediaQuery` -> `docs/hooks/useMediaQuery.md`
94
- - `useDocumentVisibility` -> `docs/hooks/useDocumentVisibility.md`
95
- - `useNetwork` -> `docs/hooks/useNetwork.md`
96
- - Storage
97
- - `useStorage` -> `docs/hooks/useStorage.md`
98
- - `useLocalStorage` -> `docs/hooks/useLocalStorage.md`
99
- - `useSessionStorage` -> `docs/hooks/useSessionStorage.md`
100
- - Observer
101
- - `useIntersectionObserver` -> `docs/hooks/useIntersectionObserver.md`
102
- - `useResizeObserver` -> `docs/hooks/useResizeObserver.md`
103
- - `useMutationObserver` -> `docs/hooks/useMutationObserver.md`
104
- - Async
105
- - `useAsyncState` -> `docs/hooks/useAsyncState.md`
106
- - `useFetch` -> `docs/hooks/useFetch.md`
107
- - `useRequest` -> `docs/hooks/useRequest.md`
108
- - Clipboard
109
- - `useClipboard` -> `docs/hooks/useClipboard.md`
67
+ All hook docs live in [`docs/hooks`](docs/hooks).
68
+
69
+ - Lifecycle: [`useMount`](docs/hooks/useMount.md), [`useUnmount`](docs/hooks/useUnmount.md)
70
+ - Event: [`useEventListener`](docs/hooks/useEventListener.md), [`useClickOutside`](docs/hooks/useClickOutside.md), [`useHover`](docs/hooks/useHover.md), [`useFocusWithin`](docs/hooks/useFocusWithin.md), [`useKeyPress`](docs/hooks/useKeyPress.md)
71
+ - Timing: [`useDebounceFn`](docs/hooks/useDebounceFn.md), [`useThrottleFn`](docs/hooks/useThrottleFn.md), [`useTimeoutFn`](docs/hooks/useTimeoutFn.md), [`useIntervalFn`](docs/hooks/useIntervalFn.md), [`useRafFn`](docs/hooks/useRafFn.md)
72
+ - State: [`useToggle`](docs/hooks/useToggle.md), [`useCounter`](docs/hooks/useCounter.md), [`usePrevious`](docs/hooks/usePrevious.md), [`useVirtualList`](docs/hooks/useVirtualList.md)
73
+ - Browser: [`useScroll`](docs/hooks/useScroll.md), [`useWindowScroll`](docs/hooks/useWindowScroll.md), [`useWindowSize`](docs/hooks/useWindowSize.md), [`useTitle`](docs/hooks/useTitle.md), [`useFullscreen`](docs/hooks/useFullscreen.md), [`usePermission`](docs/hooks/usePermission.md), [`useGeolocation`](docs/hooks/useGeolocation.md), [`useIdle`](docs/hooks/useIdle.md), [`useSize`](docs/hooks/useSize.md), [`useWebSocket`](docs/hooks/useWebSocket.md), [`useMediaQuery`](docs/hooks/useMediaQuery.md), [`useDocumentVisibility`](docs/hooks/useDocumentVisibility.md), [`useNetwork`](docs/hooks/useNetwork.md)
74
+ - Storage: [`useStorage`](docs/hooks/useStorage.md), [`useLocalStorage`](docs/hooks/useLocalStorage.md), [`useSessionStorage`](docs/hooks/useSessionStorage.md)
75
+ - Observer: [`useIntersectionObserver`](docs/hooks/useIntersectionObserver.md), [`useResizeObserver`](docs/hooks/useResizeObserver.md), [`useMutationObserver`](docs/hooks/useMutationObserver.md)
76
+ - Async: [`useAsyncState`](docs/hooks/useAsyncState.md), [`useFetch`](docs/hooks/useFetch.md), [`useRequest`](docs/hooks/useRequest.md)
77
+ - Clipboard: [`useClipboard`](docs/hooks/useClipboard.md)
110
78
 
111
79
  ## Demo Website
112
80
 
@@ -134,20 +102,6 @@ Before publish, these checks must pass:
134
102
 
135
103
  `prepublishOnly` already enforces this pipeline.
136
104
 
137
- ## Scripts
138
-
139
- - `pnpm dev`: watch mode build with tsup
140
- - `pnpm build`: build ESM + CJS + d.ts to `dist`
141
- - `pnpm demo:dev`: run Vite demo website (`playground/`)
142
- - `pnpm demo:build`: build Vite demo website
143
- - `pnpm demo:preview`: preview built demo website
144
- - `pnpm typecheck`: TypeScript type checking
145
- - `pnpm test:types`: API type assertion tests
146
- - `pnpm lint`: ESLint check
147
- - `pnpm test`: run unit tests with Vitest
148
- - `pnpm test:coverage`: run tests with coverage threshold checks
149
- - `pnpm format`: format files with Prettier
150
-
151
105
  ## Package Entry
152
106
 
153
107
  Package entry is `src/index.ts`.
package/package.json CHANGED
@@ -1,7 +1,15 @@
1
1
  {
2
2
  "name": "@fictjs/hooks",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Official hooks package for Fict",
5
+ "keywords": [
6
+ "fict",
7
+ "fictjs",
8
+ "hooks",
9
+ "signals",
10
+ "reactive",
11
+ "typescript"
12
+ ],
5
13
  "license": "MIT",
6
14
  "type": "module",
7
15
  "packageManager": "pnpm@9.1.1",