@uniai-fe/util-functions 0.2.8 → 0.2.9
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 +27 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/style/size/index.d.cts +34 -7
- package/dist/style/size/index.d.ts +34 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
# util
|
|
1
|
+
# @uniai-fe/util-functions
|
|
2
2
|
|
|
3
|
-
의존성을 최소화한 범용 도구
|
|
3
|
+
의존성을 최소화한 범용 도구 세트입니다. API 연동, 날짜/포맷, validation, 스타일 스케일까지 FE 공통 시나리오를 작은 단일 함수로 쪼개어 제공합니다.
|
|
4
|
+
|
|
5
|
+
## 설치
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @uniai-fe/util-functions
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 사용 예시
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { dateFormat } from "@uniai-fe/util-functions/format";
|
|
15
|
+
import { generateBackendQueryUrl_GET } from "@uniai-fe/util-functions/api";
|
|
16
|
+
|
|
17
|
+
const servedAt = dateFormat(new Date(), { isKorean: true });
|
|
18
|
+
const queryUrl = generateBackendQueryUrl_GET({
|
|
19
|
+
domain: process.env.NEXT_PUBLIC_AI_DOMAIN!,
|
|
20
|
+
routeUrl: "/api/example",
|
|
21
|
+
queryUrl: "/ai/example",
|
|
22
|
+
searchParams: { keyword: "smart" },
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Codex 안내용 인덱스
|
|
27
|
+
|
|
28
|
+
패키지 엔트리, export 목록, 시나리오별 레시피는 [`catalog.md`](./catalog.md)에 정리되어 있습니다. Codex/AI 에이전트 작업 시 catalog를 먼저 열어 필요한 함수·타입을 찾아 사용하세요.
|
package/dist/index.d.cts
CHANGED
|
@@ -10,4 +10,4 @@ export { BuildingNoListString, NullableNumericIdentifier, NumericIdentifier, Tim
|
|
|
10
10
|
export { ApiLogger, BackendApiConfig, CommonPostResponseType, DomainResolver, EnvDomainMap, FetchBackendQueryOptions, FetchWithBodyParams, GenerateBackendQueryUrlOptions, GenerateGetQueryUrlParams, InfraKey, UtilQueryBaseParams, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog } from './api/index.cjs';
|
|
11
11
|
export { BreakPointType, DeviceCategoryType, DisplayMode, PwaRuntimeInfo, ResponsiveDeviceStateType, ViewportOrientationStateType, checkAppleDevice, checkResponsiveDevice, checkStandaloneApp, getPwaRuntimeInfo, userAgentCollection } from './runtime-env/index.cjs';
|
|
12
12
|
export { CheckboxStateMap, syncAllToEach, syncEachToAll } from './form/checkbox/index.cjs';
|
|
13
|
-
export { StyleSpacingArray, StyleSpacingPrimitive, StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize } from './style/size/index.cjs';
|
|
13
|
+
export { FixedLengthArray, StyleSpacingArray, StyleSpacingPrimitive, StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize } from './style/size/index.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export { BuildingNoListString, NullableNumericIdentifier, NumericIdentifier, Tim
|
|
|
10
10
|
export { ApiLogger, BackendApiConfig, CommonPostResponseType, DomainResolver, EnvDomainMap, FetchBackendQueryOptions, FetchWithBodyParams, GenerateBackendQueryUrlOptions, GenerateGetQueryUrlParams, InfraKey, UtilQueryBaseParams, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog } from './api/index.js';
|
|
11
11
|
export { BreakPointType, DeviceCategoryType, DisplayMode, PwaRuntimeInfo, ResponsiveDeviceStateType, ViewportOrientationStateType, checkAppleDevice, checkResponsiveDevice, checkStandaloneApp, getPwaRuntimeInfo, userAgentCollection } from './runtime-env/index.js';
|
|
12
12
|
export { CheckboxStateMap, syncAllToEach, syncEachToAll } from './form/checkbox/index.js';
|
|
13
|
-
export { StyleSpacingArray, StyleSpacingPrimitive, StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize } from './style/size/index.js';
|
|
13
|
+
export { FixedLengthArray, StyleSpacingArray, StyleSpacingPrimitive, StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize } from './style/size/index.js';
|
|
@@ -1,10 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 스타일 옵션 타입; 스타일 속성 값
|
|
3
|
+
* - number | string
|
|
4
|
+
*/
|
|
1
5
|
type StyleSpacingPrimitive = number | string;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* 개수가 지정된 배열 정의
|
|
8
|
+
* @example
|
|
9
|
+
* type DataArray = FixedLengthArray<number | string, 3>;
|
|
10
|
+
*/
|
|
11
|
+
type FixedLengthArray<ItemType, Length extends number> = [
|
|
12
|
+
ItemType,
|
|
13
|
+
...ItemType[]
|
|
14
|
+
] & {
|
|
15
|
+
length: Length;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 스타일 옵션 타입; margin, padding을 배열로 받는 경우
|
|
19
|
+
* @desc
|
|
20
|
+
* - [상하좌우]: 일괄적용 처리
|
|
21
|
+
* - [상하, 좌우]: [top-bottom, left-right]
|
|
22
|
+
* - [상, 좌우, 하]: [top, left-right, bottom]
|
|
23
|
+
* - [상, 우, 하, 좌]: [top, right, bottom, left]
|
|
24
|
+
*/
|
|
25
|
+
type StyleSpacingArray = FixedLengthArray<number | string, 1 | 2 | 3 | 4>;
|
|
26
|
+
/**
|
|
27
|
+
* 스타일 옵션 타입; margin, padding
|
|
28
|
+
* @desc
|
|
29
|
+
* - number | string: 단일 값
|
|
30
|
+
* - [상하좌우]: 일괄적용 처리
|
|
31
|
+
* - [상하, 좌우]
|
|
32
|
+
* - [상, 좌우, 하]
|
|
33
|
+
* - [상, 우, 하, 좌]
|
|
34
|
+
*/
|
|
8
35
|
type StyleSpacingType = StyleSpacingPrimitive | StyleSpacingArray;
|
|
9
36
|
|
|
10
37
|
/**
|
|
@@ -84,4 +111,4 @@ declare const stylePaddingSize: (unit: "px" | "rem", spacing: StyleSpacingType |
|
|
|
84
111
|
*/
|
|
85
112
|
declare const styleMarginSize: (unit: "px" | "rem", spacing: StyleSpacingType | undefined, alt?: StyleSpacingType) => string;
|
|
86
113
|
|
|
87
|
-
export { type StyleSpacingArray, type StyleSpacingPrimitive, type StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize };
|
|
114
|
+
export { type FixedLengthArray, type StyleSpacingArray, type StyleSpacingPrimitive, type StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize };
|
|
@@ -1,10 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 스타일 옵션 타입; 스타일 속성 값
|
|
3
|
+
* - number | string
|
|
4
|
+
*/
|
|
1
5
|
type StyleSpacingPrimitive = number | string;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* 개수가 지정된 배열 정의
|
|
8
|
+
* @example
|
|
9
|
+
* type DataArray = FixedLengthArray<number | string, 3>;
|
|
10
|
+
*/
|
|
11
|
+
type FixedLengthArray<ItemType, Length extends number> = [
|
|
12
|
+
ItemType,
|
|
13
|
+
...ItemType[]
|
|
14
|
+
] & {
|
|
15
|
+
length: Length;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 스타일 옵션 타입; margin, padding을 배열로 받는 경우
|
|
19
|
+
* @desc
|
|
20
|
+
* - [상하좌우]: 일괄적용 처리
|
|
21
|
+
* - [상하, 좌우]: [top-bottom, left-right]
|
|
22
|
+
* - [상, 좌우, 하]: [top, left-right, bottom]
|
|
23
|
+
* - [상, 우, 하, 좌]: [top, right, bottom, left]
|
|
24
|
+
*/
|
|
25
|
+
type StyleSpacingArray = FixedLengthArray<number | string, 1 | 2 | 3 | 4>;
|
|
26
|
+
/**
|
|
27
|
+
* 스타일 옵션 타입; margin, padding
|
|
28
|
+
* @desc
|
|
29
|
+
* - number | string: 단일 값
|
|
30
|
+
* - [상하좌우]: 일괄적용 처리
|
|
31
|
+
* - [상하, 좌우]
|
|
32
|
+
* - [상, 좌우, 하]
|
|
33
|
+
* - [상, 우, 하, 좌]
|
|
34
|
+
*/
|
|
8
35
|
type StyleSpacingType = StyleSpacingPrimitive | StyleSpacingArray;
|
|
9
36
|
|
|
10
37
|
/**
|
|
@@ -84,4 +111,4 @@ declare const stylePaddingSize: (unit: "px" | "rem", spacing: StyleSpacingType |
|
|
|
84
111
|
*/
|
|
85
112
|
declare const styleMarginSize: (unit: "px" | "rem", spacing: StyleSpacingType | undefined, alt?: StyleSpacingType) => string;
|
|
86
113
|
|
|
87
|
-
export { type StyleSpacingArray, type StyleSpacingPrimitive, type StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize };
|
|
114
|
+
export { type FixedLengthArray, type StyleSpacingArray, type StyleSpacingPrimitive, type StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize };
|