@ilokesto/utilinent 0.0.20 → 0.0.22

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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ pnpm add @ilokesto/utilinent
23
23
  기본적으로 다음 컴포넌트들을 가져와 사용할 수 있습니다.
24
24
 
25
25
  ```tsx
26
- import { Show, For, Repeat, Observer, OptionalWrapper } from '@ilokesto/utilinent';
26
+ import { Show, For, Repeat, Observer, OptionalWrapper, useIntersectionObserver } from '@ilokesto/utilinent';
27
27
  ```
28
28
 
29
29
  #### `<Show>`
@@ -134,12 +134,35 @@ function Post({ post, withLink }) {
134
134
  }
135
135
  ```
136
136
 
137
+ ### 훅(Hooks)
138
+
139
+ #### `useIntersectionObserver`
140
+
141
+ Intersection Observer API를 React 훅으로 감싼 것입니다. 컴포넌트의 뷰포트 내 가시성을 추적하는 데 사용됩니다.
142
+
143
+ **사용 예시:**
144
+
145
+ ```tsx
146
+ import { useIntersectionObserver } from '@ilokesto/utilinent';
147
+ import { useRef } from 'react';
148
+
149
+ function MyComponent() {
150
+ const { ref, isIntersecting } = useIntersectionObserver({ threshold: 0.5 });
151
+
152
+ return (
153
+ <div ref={ref} style={{ transition: 'opacity 0.5s', opacity: isIntersecting ? 1 : 0.2 }}>
154
+ {isIntersecting ? '이제 화면에 보입니다!' : '화면 밖에 있습니다.'}
155
+ </div>
156
+ );
157
+ }
158
+ ```
159
+
137
160
  ### 실험적 기능
138
161
 
139
162
  실험적인 컴포넌트 및 훅은 `experimental` 경로에서 가져올 수 있습니다. 이 기능들은 API가 변경될 수 있습니다.
140
163
 
141
164
  ```tsx
142
- import { Mount, Slacker, createSwitcher, useIntersectionObserver, Slot, Slottable } from '@ilokesto/utilinent/experimental';
165
+ import { Mount, Slacker, createSwitcher, Slot, Slottable } from '@ilokesto/utilinent/experimental';
143
166
  ```
144
167
 
145
168
  #### `<Slot>` 및 `<Slottable>`
@@ -257,27 +280,6 @@ function Media() {
257
280
  }
258
281
  ```
259
282
 
260
- #### `useIntersectionObserver`
261
-
262
- Intersection Observer API를 React 훅으로 감싼 것입니다. 컴포넌트의 뷰포트 내 가시성을 추적하는 데 사용됩니다.
263
-
264
- **사용 예시:**
265
-
266
- ```tsx
267
- import { useIntersectionObserver } from '@ilokesto/utilinent/experimental';
268
- import { useRef } from 'react';
269
-
270
- function MyComponent() {
271
- const { ref, isIntersecting } = useIntersectionObserver({ threshold: 0.5 });
272
-
273
- return (
274
- <div ref={ref} style={{ transition: 'opacity 0.5s', opacity: isIntersecting ? 1 : 0.2 }}>
275
- {isIntersecting ? '이제 화면에 보입니다!' : '화면 밖에 있습니다.'}
276
- </div>
277
- );
278
- }
279
- ```
280
-
281
283
  ## 라이선스
282
284
 
283
285
  [MIT](./LICENSE)
@@ -2,4 +2,3 @@ export * from './experimental/Mount';
2
2
  export * from './experimental/Slacker';
3
3
  export * from './experimental/Switch';
4
4
  export * from './experimental/Slot';
5
- export * from './hooks/useIntersectionObserver';
@@ -2,4 +2,3 @@ export * from './experimental/Mount';
2
2
  export * from './experimental/Slacker';
3
3
  export * from './experimental/Switch';
4
4
  export * from './experimental/Slot';
5
- export * from './hooks/useIntersectionObserver';
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from './components/Observer';
3
3
  export * from './components/OptionalWrapper';
4
4
  export * from './components/Repeat';
5
5
  export * from './components/Show';
6
+ export * from './hooks/useIntersectionObserver';
package/dist/index.js CHANGED
@@ -3,3 +3,4 @@ export * from './components/Observer';
3
3
  export * from './components/OptionalWrapper';
4
4
  export * from './components/Repeat';
5
5
  export * from './components/Show';
6
+ export * from './hooks/useIntersectionObserver';
@@ -5,7 +5,7 @@ export interface ForProps<T extends Array<unknown>> extends Fallback {
5
5
  children: (item: T[number], index: number) => React.ReactNode;
6
6
  }
7
7
  type ForTagHelper<K extends keyof JSX.IntrinsicElements> = {
8
- <T extends Array<unknown>>(props: ForProps<T> & ComponentPropsWithRef<K>): React.ReactNode;
8
+ <T extends Array<unknown>>(props: ForProps<T> & Omit<ComponentPropsWithRef<K>, 'children'>): React.ReactNode;
9
9
  };
10
10
  export interface ForType {
11
11
  <T extends Array<unknown>>(props: ForProps<T>): React.ReactNode;
@@ -9,12 +9,12 @@ export interface ShowProps<T = unknown> extends Fallback {
9
9
  children: React.ReactNode | ((item: NonNullable<T>) => React.ReactNode);
10
10
  }
11
11
  type ShowTagHelper<K extends keyof JSX.IntrinsicElements> = {
12
- <T extends unknown>(props: ShowProps<T> & ComponentPropsWithRef<K>): React.ReactNode;
13
12
  <T extends unknown[]>(props: ShowPropsArray<T> & ComponentPropsWithRef<K>): React.ReactNode;
13
+ <T extends unknown>(props: ShowProps<T> & ComponentPropsWithRef<K>): React.ReactNode;
14
14
  };
15
15
  export interface ShowType {
16
- <T extends unknown>(props: ShowProps<T>): React.ReactNode;
17
16
  <T extends unknown[]>(props: ShowPropsArray<T>): React.ReactNode;
17
+ <T extends unknown>(props: ShowProps<T>): React.ReactNode;
18
18
  a: ShowTagHelper<"a">;
19
19
  abbr: ShowTagHelper<"abbr">;
20
20
  address: ShowTagHelper<"address">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilokesto/utilinent",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ilokesto/utilinent.git"