@ilokesto/utilinent 0.0.11 → 0.0.13
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 +20 -20
- package/dist/components/OptionalWrapper.d.ts +4 -4
- package/dist/components/types.d.ts +12 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -62,8 +62,8 @@ React에서 조건부 렌더링을 할 때 삼항 연산자(`? :`), AND 연산
|
|
|
62
62
|
```tsx
|
|
63
63
|
interface ShowProps<T> {
|
|
64
64
|
when: T; // 조건값 (truthy/falsy 체크)
|
|
65
|
-
fallback?: ReactNode; // 조건이 false일 때 렌더링할 내용
|
|
66
|
-
children: ReactNode | ((item: NonNullable<T>) => ReactNode); // 조건이 true일 때의 내용
|
|
65
|
+
fallback?: React.ReactNode; // 조건이 false일 때 렌더링할 내용
|
|
66
|
+
children: React.ReactNode | ((item: NonNullable<T>) => React.ReactNode); // 조건이 true일 때의 내용
|
|
67
67
|
}
|
|
68
68
|
```
|
|
69
69
|
|
|
@@ -131,8 +131,8 @@ React에서 배열을 렌더링할 때 `Array.map()`을 사용하는 것은 일
|
|
|
131
131
|
```tsx
|
|
132
132
|
interface ForProps<T extends Array<unknown>> {
|
|
133
133
|
each: T | null | undefined; // 렌더링할 배열
|
|
134
|
-
fallback?: ReactNode; // 배열이 비어있거나 null일 때의 대체 내용
|
|
135
|
-
children: (item: T[number], index: number) => ReactNode; // 각 아이템을 렌더링하는 함수
|
|
134
|
+
fallback?: React.ReactNode; // 배열이 비어있거나 null일 때의 대체 내용
|
|
135
|
+
children: (item: T[number], index: number) => React.ReactNode; // 각 아이템을 렌더링하는 함수
|
|
136
136
|
}
|
|
137
137
|
```
|
|
138
138
|
|
|
@@ -230,13 +230,13 @@ function createSwitcher<T, K extends LiteralKeys<T>>(data: T): {
|
|
|
230
230
|
Switch: ({
|
|
231
231
|
when: K, // 분기할 필드명
|
|
232
232
|
children: Array<ReactElement>, // Match 컴포넌트들
|
|
233
|
-
fallback?: ReactNode // 매칭되는 case가 없을 때의 대체 내용
|
|
234
|
-
}) => ReactNode;
|
|
233
|
+
fallback?: React.ReactNode // 매칭되는 case가 없을 때의 대체 내용
|
|
234
|
+
}) => React.ReactNode;
|
|
235
235
|
|
|
236
236
|
Match: <V extends ExtractValues<T, K>>({
|
|
237
237
|
case: V, // 매칭할 값
|
|
238
|
-
children: (props: ExtractByKeyValue<T, K, V>) => ReactNode // 해당 case의 정확한 타입 제공
|
|
239
|
-
}) => ReactNode;
|
|
238
|
+
children: (props: ExtractByKeyValue<T, K, V>) => React.ReactNode // 해당 case의 정확한 타입 제공
|
|
239
|
+
}) => React.ReactNode;
|
|
240
240
|
}
|
|
241
241
|
```
|
|
242
242
|
|
|
@@ -392,8 +392,8 @@ function ComplexStatus({ state }: { state: ComplexState }) {
|
|
|
392
392
|
```tsx
|
|
393
393
|
interface OptionalWrapperProps {
|
|
394
394
|
when: boolean; // 래퍼를 적용할 조건
|
|
395
|
-
children: ReactNode; // 감싸질 내용
|
|
396
|
-
wrapper: (children: ReactNode) => ReactNode; // 조건이 true일 때 적용할 래퍼 함수
|
|
395
|
+
children: React.ReactNode; // 감싸질 내용
|
|
396
|
+
wrapper: (children: React.ReactNode) => React.ReactNode; // 조건이 true일 때 적용할 래퍼 함수
|
|
397
397
|
}
|
|
398
398
|
```
|
|
399
399
|
|
|
@@ -493,8 +493,8 @@ function ClientOnlyComponent() {
|
|
|
493
493
|
|
|
494
494
|
```tsx
|
|
495
495
|
interface MountProps {
|
|
496
|
-
fallback?: ReactNode; // 마운트 전 또는 로딩 중 표시할 내용
|
|
497
|
-
children: ReactNode | (() => ReactNode | Promise<ReactNode>); // 마운트 후 렌더링할 내용
|
|
496
|
+
fallback?: React.ReactNode; // 마운트 전 또는 로딩 중 표시할 내용
|
|
497
|
+
children: React.ReactNode | (() => React.ReactNode | Promise<ReactNode>); // 마운트 후 렌더링할 내용
|
|
498
498
|
}
|
|
499
499
|
```
|
|
500
500
|
|
|
@@ -598,8 +598,8 @@ function NewWay() {
|
|
|
598
598
|
```tsx
|
|
599
599
|
interface RepeatProps {
|
|
600
600
|
times: number; // 반복 횟수
|
|
601
|
-
fallback?: ReactNode; // times가 0 이하일 때의 대체 내용
|
|
602
|
-
children: (index: number) => ReactNode; // 각 반복에서 렌더링할 함수
|
|
601
|
+
fallback?: React.ReactNode; // times가 0 이하일 때의 대체 내용
|
|
602
|
+
children: (index: number) => React.ReactNode; // 각 반복에서 렌더링할 함수
|
|
603
603
|
}
|
|
604
604
|
```
|
|
605
605
|
|
|
@@ -784,8 +784,8 @@ function LazyImage({ src, alt }: { src: string, alt: string }) {
|
|
|
784
784
|
|
|
785
785
|
```tsx
|
|
786
786
|
interface ObserverProps {
|
|
787
|
-
children: ReactNode | ((isIntersecting: boolean) => ReactNode);
|
|
788
|
-
fallback?: ReactNode; // 뷰포트에 보이지 않을 때 표시할 내용
|
|
787
|
+
children: React.ReactNode | ((isIntersecting: boolean) => React.ReactNode);
|
|
788
|
+
fallback?: React.ReactNode; // 뷰포트에 보이지 않을 때 표시할 내용
|
|
789
789
|
threshold?: number | number[]; // 교차 임계값 (0.0 ~ 1.0)
|
|
790
790
|
rootMargin?: string; // 루트 마진
|
|
791
791
|
triggerOnce?: boolean; // 한 번만 트리거할지 여부
|
|
@@ -957,7 +957,7 @@ function ImageGallery({ images }: { images: ImageData[] }) {
|
|
|
957
957
|
// 뷰포트 진입 분석
|
|
958
958
|
function AnalyticsSection({ sectionId, children }: {
|
|
959
959
|
sectionId: string,
|
|
960
|
-
children: ReactNode
|
|
960
|
+
children: React.ReactNode
|
|
961
961
|
}) {
|
|
962
962
|
return (
|
|
963
963
|
<Observer
|
|
@@ -1003,7 +1003,7 @@ function ScrollProgressIndicator() {
|
|
|
1003
1003
|
// 조건부 로딩 - Show 컴포넌트와 함께 사용
|
|
1004
1004
|
function ConditionalContent({ shouldLoad, children }: {
|
|
1005
1005
|
shouldLoad: boolean,
|
|
1006
|
-
children: ReactNode
|
|
1006
|
+
children: React.ReactNode
|
|
1007
1007
|
}) {
|
|
1008
1008
|
return (
|
|
1009
1009
|
<Show when={shouldLoad} fallback={<div>로딩이 비활성화되었습니다</div>}>
|
|
@@ -1166,8 +1166,8 @@ function LazyChart() {
|
|
|
1166
1166
|
|
|
1167
1167
|
```tsx
|
|
1168
1168
|
interface SlackerProps {
|
|
1169
|
-
children: (loaded: any) => ReactNode; // loader의 결과를 받는 함수
|
|
1170
|
-
fallback?: ReactNode; // 로딩 중 표시할 내용
|
|
1169
|
+
children: (loaded: any) => React.ReactNode; // loader의 결과를 받는 함수
|
|
1170
|
+
fallback?: React.ReactNode; // 로딩 중 표시할 내용
|
|
1171
1171
|
threshold?: number | number[]; // 교차 임계값 (기본: 0.1)
|
|
1172
1172
|
rootMargin?: string; // 루트 마진 (기본: "50px")
|
|
1173
1173
|
loader: () => Promise<any> | any; // 동적 로딩 함수 (필수)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ReactNode } from "./types";
|
|
2
|
+
import { React.ReactNode } from "./types";
|
|
3
3
|
export declare function OptionalWrapper({ when, children, wrapper, }: {
|
|
4
4
|
when: boolean;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
wrapper: (children: ReactNode) => ReactNode;
|
|
7
|
-
}): ReactNode;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
wrapper: (children: React.ReactNode) => React.ReactNode;
|
|
7
|
+
}): React.ReactNode;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from "react";
|
|
2
|
-
export { ReactNode };
|
|
1
|
+
import type { ReactElement, React.ReactNode } from "react";
|
|
2
|
+
export { React.ReactNode };
|
|
3
3
|
type Fallback = {
|
|
4
|
-
fallback?: ReactNode;
|
|
4
|
+
fallback?: React.ReactNode;
|
|
5
5
|
};
|
|
6
6
|
export type ShowProps<T> = {
|
|
7
7
|
when: T;
|
|
8
|
-
children: ReactNode | ((item: NonNullable<T>) => ReactNode);
|
|
8
|
+
children: React.ReactNode | ((item: NonNullable<T>) => React.ReactNode);
|
|
9
9
|
} & Fallback;
|
|
10
10
|
export type ForProps<T extends Array<unknown>> = {
|
|
11
11
|
each: T | null | undefined;
|
|
12
|
-
fallback?: ReactNode;
|
|
13
|
-
children: (item: T[number], index: number) => ReactNode;
|
|
12
|
+
fallback?: React.ReactNode;
|
|
13
|
+
children: (item: T[number], index: number) => React.ReactNode;
|
|
14
14
|
};
|
|
15
15
|
export type ExtractValues<T, K extends keyof T> = T extends any ? T[K] : never;
|
|
16
16
|
type IsUnion<T, U = T> = T extends any ? [U] extends [T] ? false : true : false;
|
|
@@ -24,23 +24,23 @@ export type SwitchProps<T, K extends LiteralKeys<T>> = {
|
|
|
24
24
|
when: K;
|
|
25
25
|
} & Fallback;
|
|
26
26
|
export type MountProps = {
|
|
27
|
-
children: ReactNode | (() => ReactNode | Promise<ReactNode>);
|
|
27
|
+
children: React.ReactNode | (() => React.ReactNode | Promise<ReactNode>);
|
|
28
28
|
} & Fallback;
|
|
29
29
|
export type RepeatProps = {
|
|
30
30
|
times: number;
|
|
31
|
-
children: (index: number) => ReactNode;
|
|
31
|
+
children: (index: number) => React.ReactNode;
|
|
32
32
|
} & Fallback;
|
|
33
33
|
export type ObserverProps = {
|
|
34
|
-
children
|
|
35
|
-
fallback?: ReactNode;
|
|
34
|
+
children?: React.ReactNode | ((isIntersecting: boolean) => React.ReactNode);
|
|
35
|
+
fallback?: React.ReactNode;
|
|
36
36
|
threshold?: number | number[];
|
|
37
37
|
rootMargin?: string;
|
|
38
38
|
triggerOnce?: boolean;
|
|
39
39
|
onIntersect?: (isIntersecting: boolean, entry: IntersectionObserverEntry) => void;
|
|
40
40
|
};
|
|
41
41
|
export type SlackerProps = {
|
|
42
|
-
children: (loaded: any) => ReactNode;
|
|
43
|
-
fallback?: ReactNode;
|
|
42
|
+
children: (loaded: any) => React.ReactNode;
|
|
43
|
+
fallback?: React.ReactNode;
|
|
44
44
|
threshold?: number | number[];
|
|
45
45
|
rootMargin?: string;
|
|
46
46
|
loader: () => Promise<any> | any;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilokesto/utilinent",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"scripts": {
|
|
5
|
-
"build": "vite build && tsc --emitDeclarationOnly"
|
|
6
|
-
},
|
|
3
|
+
"version": "0.0.13",
|
|
7
4
|
"repository": {
|
|
8
5
|
"type": "git",
|
|
9
6
|
"url": "git+https://github.com/ilokesto/utilinent.git"
|
|
@@ -38,5 +35,8 @@
|
|
|
38
35
|
"eslint": "^8.57.0",
|
|
39
36
|
"eslint-plugin-react": "^7.34.1",
|
|
40
37
|
"typescript": "^5.4.5"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "vite build && tsc --emitDeclarationOnly"
|
|
41
41
|
}
|
|
42
|
-
}
|
|
42
|
+
}
|