@basiln/utils 0.1.7 → 0.1.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 +25 -0
- package/dist/DomainFormat.js +123 -0
- package/dist/DomainFormat.js.map +1 -0
- package/dist/DomainFormat.mjs +7 -0
- package/dist/DomainFormat.mjs.map +1 -0
- package/dist/Flex.js.map +1 -1
- package/dist/Flex.mjs +2 -2
- package/dist/SafeArea.js.map +1 -1
- package/dist/SafeArea.mjs +4 -4
- package/dist/Spacing.js.map +1 -1
- package/dist/Spacing.mjs +2 -2
- package/dist/{chunk-Z4QPISK7.mjs → chunk-3BSCIHE2.mjs} +1 -1
- package/dist/{chunk-Z4QPISK7.mjs.map → chunk-3BSCIHE2.mjs.map} +1 -1
- package/dist/{chunk-FUGA35PJ.mjs → chunk-ANMBV2U3.mjs} +2 -2
- package/dist/{chunk-FUGA35PJ.mjs.map → chunk-ANMBV2U3.mjs.map} +1 -1
- package/dist/{chunk-SJJHTYZC.mjs → chunk-EB5LTJRH.mjs} +2 -2
- package/dist/{chunk-SJJHTYZC.mjs.map → chunk-EB5LTJRH.mjs.map} +1 -1
- package/dist/{chunk-XBGZ3YNL.mjs → chunk-FTMJVXXH.mjs} +2 -2
- package/dist/{chunk-XBGZ3YNL.mjs.map → chunk-FTMJVXXH.mjs.map} +1 -1
- package/dist/{chunk-OIJ4AVT7.mjs → chunk-KIUJWSBE.mjs} +1 -1
- package/dist/{chunk-OIJ4AVT7.mjs.map → chunk-KIUJWSBE.mjs.map} +1 -1
- package/dist/{chunk-C7VOPXT2.mjs → chunk-KMMS4XJ6.mjs} +2 -3
- package/dist/{chunk-C7VOPXT2.mjs.map → chunk-KMMS4XJ6.mjs.map} +1 -1
- package/dist/{chunk-T7K7QYTL.mjs → chunk-OQ3L65JI.mjs} +1 -1
- package/dist/{chunk-T7K7QYTL.mjs.map → chunk-OQ3L65JI.mjs.map} +1 -1
- package/dist/{chunk-HLTXXENG.mjs → chunk-RASCHI5T.mjs} +3 -3
- package/dist/{chunk-Q3B6WSD7.mjs → chunk-UCZMT7TP.mjs} +2 -2
- package/dist/{chunk-Q3B6WSD7.mjs.map → chunk-UCZMT7TP.mjs.map} +1 -1
- package/dist/{chunk-DD3KGUQX.mjs → chunk-VIGWO4EN.mjs} +2 -2
- package/dist/{chunk-DD3KGUQX.mjs.map → chunk-VIGWO4EN.mjs.map} +1 -1
- package/dist/chunk-WWR7M6ID.mjs +99 -0
- package/dist/chunk-WWR7M6ID.mjs.map +1 -0
- package/dist/{chunk-WHYNBO2G.mjs → chunk-Z4UXDD2C.mjs} +1 -1
- package/dist/{chunk-WHYNBO2G.mjs.map → chunk-Z4UXDD2C.mjs.map} +1 -1
- package/dist/{chunk-U4T3KW7L.mjs → chunk-Z7YV6A56.mjs} +1 -1
- package/dist/{chunk-U4T3KW7L.mjs.map → chunk-Z7YV6A56.mjs.map} +1 -1
- package/dist/coerceCssPixelValue.js.map +1 -1
- package/dist/coerceCssPixelValue.mjs +1 -1
- package/dist/createContext.js.map +1 -1
- package/dist/createContext.mjs +1 -1
- package/dist/ellipsis.js +1 -1
- package/dist/ellipsis.js.map +1 -1
- package/dist/ellipsis.mjs +1 -1
- package/dist/getVar.js.map +1 -1
- package/dist/getVar.mjs +1 -1
- package/dist/hasBatchim.js +1 -2
- package/dist/hasBatchim.js.map +1 -1
- package/dist/hasBatchim.mjs +1 -1
- package/dist/hexToRgba.js.map +1 -1
- package/dist/hexToRgba.mjs +1 -1
- package/dist/index.d.mts +250 -0
- package/dist/index.d.ts +23 -1
- package/dist/index.js +99 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -12
- package/dist/josa.js +1 -2
- package/dist/josa.js.map +1 -1
- package/dist/josa.mjs +2 -2
- package/dist/queryString.js.map +1 -1
- package/dist/queryString.mjs +1 -1
- package/dist/useSafeArea.js.map +1 -1
- package/dist/useSafeArea.mjs +2 -2
- package/package.json +6 -17
- /package/dist/{chunk-HLTXXENG.mjs.map → chunk-RASCHI5T.mjs.map} +0 -0
package/README.md
CHANGED
@@ -23,6 +23,7 @@ yarn add @basiln/utils
|
|
23
23
|
- [composeEventHandlers](#composeeventhandlers)
|
24
24
|
- [getVar](#getvar)
|
25
25
|
- [Format](#format)
|
26
|
+
- [DomainFormat](#domainformat)
|
26
27
|
|
27
28
|
### `If`
|
28
29
|
|
@@ -322,3 +323,27 @@ Format.phone('01012345678'); // '010-1234-5678'
|
|
322
323
|
Format.commaize('123456'); // '123,456'
|
323
324
|
Format.padTime(1); // '01'
|
324
325
|
```
|
326
|
+
|
327
|
+
---
|
328
|
+
|
329
|
+
### `DomainFormat`
|
330
|
+
|
331
|
+
도메인 관련 데이터를 원하는 형식으로 변환하는 포맷팅 유틸입니다.
|
332
|
+
|
333
|
+
#### 사용법
|
334
|
+
|
335
|
+
```tsx
|
336
|
+
// 기본
|
337
|
+
DomainFormat.modeName('H'); // 난방
|
338
|
+
DomainFormat.modeColor('H'); // #e77676
|
339
|
+
DomainFormat.wind(3) // 강풍
|
340
|
+
DomainFormat.airLevelName(4) // 좋음
|
341
|
+
DomainFormat.airLevelColor(1) // #ff5d47
|
342
|
+
DomainFormat.userLevel({level: '1'}) // 마스터
|
343
|
+
DomainFormat.userLevel({level: '1', language: 'en'}) // MASTER
|
344
|
+
|
345
|
+
// Mode 추가가 필요한 경우
|
346
|
+
DomainFormat.modeName('R', {R: '실외기 잠금'}); // 실외기 잠금
|
347
|
+
DomainFormat.modeColor('R', {N: 'gray'}); // 'gray'
|
348
|
+
|
349
|
+
```
|
@@ -0,0 +1,123 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/DomainFormat.ts
|
21
|
+
var DomainFormat_exports = {};
|
22
|
+
__export(DomainFormat_exports, {
|
23
|
+
DomainFormat: () => DomainFormat
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(DomainFormat_exports);
|
26
|
+
function formatModeName(mode, customMapping = {}) {
|
27
|
+
const defaultModeMapping = {
|
28
|
+
H: "\uB09C\uBC29",
|
29
|
+
C: "\uB0C9\uBC29",
|
30
|
+
W: "\uC1A1\uD48D"
|
31
|
+
};
|
32
|
+
const combinedMapping = { ...defaultModeMapping, ...customMapping };
|
33
|
+
if (!(mode in combinedMapping)) {
|
34
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uBAA8\uB4DC\uC785\uB2C8\uB2E4. mode: ${mode}`);
|
35
|
+
}
|
36
|
+
return combinedMapping[mode];
|
37
|
+
}
|
38
|
+
function formatModeColor(mode, customMapping = {}) {
|
39
|
+
const defaultColorMapping = {
|
40
|
+
H: "#e77676",
|
41
|
+
C: "#9fc6ff",
|
42
|
+
W: "#a8e379"
|
43
|
+
};
|
44
|
+
const combinedMapping = { ...defaultColorMapping, ...customMapping };
|
45
|
+
if (!(mode in combinedMapping)) {
|
46
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uBAA8\uB4DC\uC785\uB2C8\uB2E4. mode: ${mode}`);
|
47
|
+
}
|
48
|
+
return combinedMapping[mode];
|
49
|
+
}
|
50
|
+
function formatWind(wind, customMapping = {}) {
|
51
|
+
const defaultWindMapping = {
|
52
|
+
1: "\uBBF8\uD48D",
|
53
|
+
2: "\uC57D\uD48D",
|
54
|
+
3: "\uAC15\uD48D"
|
55
|
+
};
|
56
|
+
const combinedMapping = { ...defaultWindMapping, ...customMapping };
|
57
|
+
if (!(wind in combinedMapping)) {
|
58
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD48D\uB7C9\uC785\uB2C8\uB2E4. wind: ${wind}`);
|
59
|
+
}
|
60
|
+
return combinedMapping[wind];
|
61
|
+
}
|
62
|
+
function formatAirLevelName(level) {
|
63
|
+
const airLevelMapping = {
|
64
|
+
1: "\uB9E4\uC6B0 \uB098\uC068",
|
65
|
+
2: "\uB098\uC068",
|
66
|
+
3: "\uBCF4\uD1B5",
|
67
|
+
4: "\uC88B\uC74C",
|
68
|
+
5: "\uB9E4\uC6B0 \uC88B\uC74C"
|
69
|
+
};
|
70
|
+
if (!(level in airLevelMapping)) {
|
71
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uB808\uBCA8\uC785\uB2C8\uB2E4. level: ${level}`);
|
72
|
+
}
|
73
|
+
return airLevelMapping[level];
|
74
|
+
}
|
75
|
+
function formatAirLevelColor(level) {
|
76
|
+
const colorMapping = {
|
77
|
+
1: "#ff5d47",
|
78
|
+
2: "#ff961c",
|
79
|
+
3: "#ffca42",
|
80
|
+
4: "#63ff60",
|
81
|
+
5: "#49ffe9"
|
82
|
+
};
|
83
|
+
if (!(level in colorMapping)) {
|
84
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uB808\uBCA8\uC785\uB2C8\uB2E4. level: ${level}`);
|
85
|
+
}
|
86
|
+
return colorMapping[level];
|
87
|
+
}
|
88
|
+
var formatUserLevel = ({ level, language = "ko" }) => {
|
89
|
+
const userLevelMapping = {
|
90
|
+
en: {
|
91
|
+
"1": "MASTER",
|
92
|
+
"2": "MASTER KID",
|
93
|
+
"3": "SENIOR",
|
94
|
+
"4": "JUNIOR"
|
95
|
+
},
|
96
|
+
ko: {
|
97
|
+
"1": "\uB9C8\uC2A4\uD130",
|
98
|
+
"2": "\uB9C8\uC2A4\uD130\uD0A4\uC988",
|
99
|
+
"3": "\uC2DC\uB2C8\uC5B4",
|
100
|
+
"4": "\uC8FC\uB2C8\uC5B4"
|
101
|
+
}
|
102
|
+
};
|
103
|
+
if (!(language in userLevelMapping)) {
|
104
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC5B8\uC5B4\uC785\uB2C8\uB2E4. language: ${language}`);
|
105
|
+
}
|
106
|
+
if (!(level in userLevelMapping[language])) {
|
107
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uB808\uBCA8\uC785\uB2C8\uB2E4. level: ${level}`);
|
108
|
+
}
|
109
|
+
return userLevelMapping[language][level];
|
110
|
+
};
|
111
|
+
var DomainFormat = {
|
112
|
+
modeName: formatModeName,
|
113
|
+
modeColor: formatModeColor,
|
114
|
+
wind: formatWind,
|
115
|
+
airLevelName: formatAirLevelName,
|
116
|
+
airLevelColor: formatAirLevelColor,
|
117
|
+
userLevel: formatUserLevel
|
118
|
+
};
|
119
|
+
// Annotate the CommonJS export names for ESM import in node:
|
120
|
+
0 && (module.exports = {
|
121
|
+
DomainFormat
|
122
|
+
});
|
123
|
+
//# sourceMappingURL=DomainFormat.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/DomainFormat.ts"],"sourcesContent":["export type Mode = 'H' | 'C' | 'W';\nexport type Wind = 1 | 2 | 3;\nexport type AirLevel = 1 | 2 | 3 | 4 | 5;\nexport type UserLevel = '1' | '2' | '3' | '4';\nexport type Language = 'en' | 'ko';\n\nfunction formatModeName(mode: Mode, customMapping: Record<string, string> = {}): string {\n const defaultModeMapping: Record<Mode, string> = {\n H: '난방',\n C: '냉방',\n W: '송풍',\n };\n\n const combinedMapping = { ...defaultModeMapping, ...customMapping };\n\n if (!(mode in combinedMapping)) {\n throw new Error(`지원하지 않는 모드입니다. mode: ${mode}`);\n }\n\n return combinedMapping[mode];\n}\n\nfunction formatModeColor(mode: Mode, customMapping: Record<string, string> = {}) {\n const defaultColorMapping: Record<Mode, string> = {\n H: '#e77676',\n C: '#9fc6ff',\n W: '#a8e379',\n };\n\n const combinedMapping = { ...defaultColorMapping, ...customMapping };\n\n if (!(mode in combinedMapping)) {\n throw new Error(`지원하지 않는 모드입니다. mode: ${mode}`);\n }\n\n return combinedMapping[mode];\n}\n\nfunction formatWind(wind: Wind, customMapping: Record<string, string> = {}) {\n const defaultWindMapping: Record<Wind, string> = {\n 1: '미풍',\n 2: '약풍',\n 3: '강풍',\n };\n\n const combinedMapping = { ...defaultWindMapping, ...customMapping };\n\n if (!(wind in combinedMapping)) {\n throw new Error(`지원하지 않는 풍량입니다. wind: ${wind}`);\n }\n\n return combinedMapping[wind];\n}\n\nfunction formatAirLevelName(level: AirLevel) {\n const airLevelMapping: Record<AirLevel, string> = {\n 1: '매우 나쁨',\n 2: '나쁨',\n 3: '보통',\n 4: '좋음',\n 5: '매우 좋음',\n };\n\n if (!(level in airLevelMapping)) {\n throw new Error(`지원하지 않는 레벨입니다. level: ${level}`);\n }\n\n return airLevelMapping[level];\n}\n\nfunction formatAirLevelColor(level: AirLevel) {\n const colorMapping: Record<AirLevel, string> = {\n 1: '#ff5d47',\n 2: '#ff961c',\n 3: '#ffca42',\n 4: '#63ff60',\n 5: '#49ffe9',\n };\n\n if (!(level in colorMapping)) {\n throw new Error(`지원하지 않는 레벨입니다. level: ${level}`);\n }\n\n return colorMapping[level];\n}\n\nconst formatUserLevel = ({ level, language = 'ko' }: { level: UserLevel; language?: Language }) => {\n const userLevelMapping: Record<Language, Record<UserLevel, string>> = {\n en: {\n '1': 'MASTER',\n '2': 'MASTER KID',\n '3': 'SENIOR',\n '4': 'JUNIOR',\n },\n ko: {\n '1': '마스터',\n '2': '마스터키즈',\n '3': '시니어',\n '4': '주니어',\n },\n };\n\n if (!(language in userLevelMapping)) {\n throw new Error(`지원하지 않는 언어입니다. language: ${language}`);\n }\n\n if (!(level in userLevelMapping[language])) {\n throw new Error(`지원하지 않는 레벨입니다. level: ${level}`);\n }\n\n return userLevelMapping[language][level];\n};\n\nexport const DomainFormat = {\n modeName: formatModeName,\n modeColor: formatModeColor,\n wind: formatWind,\n airLevelName: formatAirLevelName,\n airLevelColor: formatAirLevelColor,\n userLevel: formatUserLevel,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,eAAe,MAAY,gBAAwC,CAAC,GAAW;AACtF,QAAM,qBAA2C;AAAA,IAC/C,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,QAAM,kBAAkB,EAAE,GAAG,oBAAoB,GAAG,cAAc;AAElE,MAAI,EAAE,QAAQ,kBAAkB;AAC9B,UAAM,IAAI,MAAM,+EAAwB,IAAI,EAAE;AAAA,EAChD;AAEA,SAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAS,gBAAgB,MAAY,gBAAwC,CAAC,GAAG;AAC/E,QAAM,sBAA4C;AAAA,IAChD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,QAAM,kBAAkB,EAAE,GAAG,qBAAqB,GAAG,cAAc;AAEnE,MAAI,EAAE,QAAQ,kBAAkB;AAC9B,UAAM,IAAI,MAAM,+EAAwB,IAAI,EAAE;AAAA,EAChD;AAEA,SAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAS,WAAW,MAAY,gBAAwC,CAAC,GAAG;AAC1E,QAAM,qBAA2C;AAAA,IAC/C,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,QAAM,kBAAkB,EAAE,GAAG,oBAAoB,GAAG,cAAc;AAElE,MAAI,EAAE,QAAQ,kBAAkB;AAC9B,UAAM,IAAI,MAAM,+EAAwB,IAAI,EAAE;AAAA,EAChD;AAEA,SAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAS,mBAAmB,OAAiB;AAC3C,QAAM,kBAA4C;AAAA,IAChD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,MAAI,EAAE,SAAS,kBAAkB;AAC/B,UAAM,IAAI,MAAM,gFAAyB,KAAK,EAAE;AAAA,EAClD;AAEA,SAAO,gBAAgB,KAAK;AAC9B;AAEA,SAAS,oBAAoB,OAAiB;AAC5C,QAAM,eAAyC;AAAA,IAC7C,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,MAAI,EAAE,SAAS,eAAe;AAC5B,UAAM,IAAI,MAAM,gFAAyB,KAAK,EAAE;AAAA,EAClD;AAEA,SAAO,aAAa,KAAK;AAC3B;AAEA,IAAM,kBAAkB,CAAC,EAAE,OAAO,WAAW,KAAK,MAAiD;AACjG,QAAM,mBAAgE;AAAA,IACpE,IAAI;AAAA,MACF,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,IACA,IAAI;AAAA,MACF,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF;AAEA,MAAI,EAAE,YAAY,mBAAmB;AACnC,UAAM,IAAI,MAAM,mFAA4B,QAAQ,EAAE;AAAA,EACxD;AAEA,MAAI,EAAE,SAAS,iBAAiB,QAAQ,IAAI;AAC1C,UAAM,IAAI,MAAM,gFAAyB,KAAK,EAAE;AAAA,EAClD;AAEA,SAAO,iBAAiB,QAAQ,EAAE,KAAK;AACzC;AAEO,IAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,cAAc;AAAA,EACd,eAAe;AAAA,EACf,WAAW;AACb;","names":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/Flex.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/Flex.tsx","../src/coerceCssPixelValue.ts"],"sourcesContent":["import { memo, type CSSProperties, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype Justify = CSSProperties['justifyContent'];\ntype Align = CSSProperties['alignItems'];\ntype Direction = CSSProperties['flexDirection'];\n\nexport type FlexProps = HTMLAttributes<HTMLDivElement> & {\n gap?: CSSPixelValue;\n justify?: Justify;\n align?: Align;\n direction?: Direction;\n};\n\nexport const Flex = memo(function Flex(props: FlexProps) {\n const {\n gap = 0,\n justify = 'center',\n align = 'center',\n direction = 'row',\n children,\n ...restProps\n } = props;\n\n return (\n <Container\n $gap={gap}\n $justify={justify}\n $align={align}\n $direction={direction}\n {...restProps}\n >\n {children}\n </Container>\n );\n});\n\nexport const Container = styled.div<{\n $gap: CSSPixelValue;\n $justify: Justify;\n $align: Align;\n $direction: Direction;\n}>`\n display: flex;\n flex-direction: ${({ $direction }) => $direction};\n gap: ${({ $gap }) => coerceCssPixelValue($gap)};\n align-items: ${({ $align }) => $align};\n justify-content: ${({ $justify }) => $justify};\n`;\n","export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8D;AAC9D,+BAAuB;;;ACChB,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG;
|
1
|
+
{"version":3,"sources":["../src/Flex.tsx","../src/coerceCssPixelValue.ts"],"sourcesContent":["import { memo, type CSSProperties, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype Justify = CSSProperties['justifyContent'];\ntype Align = CSSProperties['alignItems'];\ntype Direction = CSSProperties['flexDirection'];\n\nexport type FlexProps = HTMLAttributes<HTMLDivElement> & {\n gap?: CSSPixelValue;\n justify?: Justify;\n align?: Align;\n direction?: Direction;\n};\n\nexport const Flex = memo(function Flex(props: FlexProps) {\n const {\n gap = 0,\n justify = 'center',\n align = 'center',\n direction = 'row',\n children,\n ...restProps\n } = props;\n\n return (\n <Container\n $gap={gap}\n $justify={justify}\n $align={align}\n $direction={direction}\n {...restProps}\n >\n {children}\n </Container>\n );\n});\n\nexport const Container = styled.div<{\n $gap: CSSPixelValue;\n $justify: Justify;\n $align: Align;\n $direction: Direction;\n}>`\n display: flex;\n flex-direction: ${({ $direction }) => $direction};\n gap: ${({ $gap }) => coerceCssPixelValue($gap)};\n align-items: ${({ $align }) => $align};\n justify-content: ${({ $justify }) => $justify};\n`;\n","export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8D;AAC9D,+BAAuB;;;ACChB,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG,KAAK;AACrD;;;ADuBI;AAXG,IAAM,WAAO,mBAAK,SAASA,MAAK,OAAkB;AACvD,QAAM;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,YAAY;AAAA,MACX,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ,CAAC;AAEM,IAAM,YAAY,gCAAO;AAAA;AAAA,oBAOZ,CAAC,EAAE,WAAW,MAAM,UAAU;AAAA,SACzC,CAAC,EAAE,KAAK,MAAM,oBAAoB,IAAI,CAAC;AAAA,iBAC/B,CAAC,EAAE,OAAO,MAAM,MAAM;AAAA,qBAClB,CAAC,EAAE,SAAS,MAAM,QAAQ;AAAA;","names":["Flex"]}
|
package/dist/Flex.mjs
CHANGED
package/dist/SafeArea.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/SafeArea.tsx","../src/Spacing.tsx","../src/coerceCssPixelValue.ts","../src/useSafeArea.ts"],"sourcesContent":["import React, {\n memo,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\n\nimport { Spacing } from './Spacing';\nimport { useSafeArea } from './useSafeArea';\n\nexport type SafeAreaProps<T extends React.ElementType = 'div'> = {\n as?: T;\n children: ReactNode;\n} & ComponentPropsWithoutRef<T>;\n\nexport const SafeArea = <T extends React.ElementType = 'div'>({\n as,\n children,\n ...props\n}: SafeAreaProps<T>) => {\n const Component = as || 'div';\n\n return (\n <Component {...props}>\n <SafeAreaTop />\n {children}\n <SafeAreaBottom />\n </Component>\n );\n};\n\nconst SafeAreaTop = memo(function SafeAreaTop(\n props: Omit<ComponentPropsWithoutRef<typeof Spacing>, 'size'>\n) {\n const { top } = useSafeArea();\n return <Spacing {...props} size={top} />;\n});\n\nconst SafeAreaBottom = memo(function SafeAreaBottom(\n props: Omit<ComponentPropsWithoutRef<typeof Spacing>, 'size'>\n) {\n const { bottom } = useSafeArea();\n return <Spacing {...props} size={bottom} />;\n});\n\nSafeArea.Top = SafeAreaTop;\nSafeArea.Bottom = SafeAreaBottom;\n","import { memo, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype AxisDirection = 'vertical' | 'horizontal';\n\nexport type SpacingProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n direction?: AxisDirection;\n size: CSSPixelValue;\n};\n\nexport const Spacing = memo(function Spacing(props: SpacingProps) {\n const { direction = 'vertical', size, ...restProps } = props;\n\n return (\n <SpacingContainer $direction={direction} $size={size} {...restProps} />\n );\n});\n\nconst SpacingContainer = styled.div<{\n $direction: SpacingProps['direction'];\n $size: SpacingProps['size'];\n}>`\n flex: none;\n width: ${({ $direction, $size }) =>\n $direction === 'horizontal' ? coerceCssPixelValue($size) : undefined};\n height: ${({ $direction, $size }) =>\n $direction === 'vertical' ? coerceCssPixelValue($size) : undefined};\n`;\n","export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n","import { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\nexport type SafeAreaCssValueProps = {\n top?: CSSPixelValue;\n bottom?: CSSPixelValue;\n left?: CSSPixelValue;\n right?: CSSPixelValue;\n};\n\nconst useSafeArea = ({\n top: T = 0,\n bottom: B = 0,\n left: L = 0,\n right: R = 0,\n}: SafeAreaCssValueProps = {}) => {\n const top = `max(${coerceCssPixelValue(T)}, env(safe-area-inset-top))`;\n const bottom = `max(${coerceCssPixelValue(B)}, env(safe-area-inset-bottom))`;\n const left = `max(${coerceCssPixelValue(L)}, env(safe-area-inset-left))`;\n const right = `max(${coerceCssPixelValue(R)}, env(safe-area-inset-right))`;\n\n return { top, bottom, left, right };\n};\n\nexport { useSafeArea };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAIO;;;ACJP,mBAA0C;AAC1C,+BAAuB;;;ACChB,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG;
|
1
|
+
{"version":3,"sources":["../src/SafeArea.tsx","../src/Spacing.tsx","../src/coerceCssPixelValue.ts","../src/useSafeArea.ts"],"sourcesContent":["import React, {\n memo,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\n\nimport { Spacing } from './Spacing';\nimport { useSafeArea } from './useSafeArea';\n\nexport type SafeAreaProps<T extends React.ElementType = 'div'> = {\n as?: T;\n children: ReactNode;\n} & ComponentPropsWithoutRef<T>;\n\nexport const SafeArea = <T extends React.ElementType = 'div'>({\n as,\n children,\n ...props\n}: SafeAreaProps<T>) => {\n const Component = as || 'div';\n\n return (\n <Component {...props}>\n <SafeAreaTop />\n {children}\n <SafeAreaBottom />\n </Component>\n );\n};\n\nconst SafeAreaTop = memo(function SafeAreaTop(\n props: Omit<ComponentPropsWithoutRef<typeof Spacing>, 'size'>\n) {\n const { top } = useSafeArea();\n return <Spacing {...props} size={top} />;\n});\n\nconst SafeAreaBottom = memo(function SafeAreaBottom(\n props: Omit<ComponentPropsWithoutRef<typeof Spacing>, 'size'>\n) {\n const { bottom } = useSafeArea();\n return <Spacing {...props} size={bottom} />;\n});\n\nSafeArea.Top = SafeAreaTop;\nSafeArea.Bottom = SafeAreaBottom;\n","import { memo, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype AxisDirection = 'vertical' | 'horizontal';\n\nexport type SpacingProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n direction?: AxisDirection;\n size: CSSPixelValue;\n};\n\nexport const Spacing = memo(function Spacing(props: SpacingProps) {\n const { direction = 'vertical', size, ...restProps } = props;\n\n return (\n <SpacingContainer $direction={direction} $size={size} {...restProps} />\n );\n});\n\nconst SpacingContainer = styled.div<{\n $direction: SpacingProps['direction'];\n $size: SpacingProps['size'];\n}>`\n flex: none;\n width: ${({ $direction, $size }) =>\n $direction === 'horizontal' ? coerceCssPixelValue($size) : undefined};\n height: ${({ $direction, $size }) =>\n $direction === 'vertical' ? coerceCssPixelValue($size) : undefined};\n`;\n","export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n","import { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\nexport type SafeAreaCssValueProps = {\n top?: CSSPixelValue;\n bottom?: CSSPixelValue;\n left?: CSSPixelValue;\n right?: CSSPixelValue;\n};\n\nconst useSafeArea = ({\n top: T = 0,\n bottom: B = 0,\n left: L = 0,\n right: R = 0,\n}: SafeAreaCssValueProps = {}) => {\n const top = `max(${coerceCssPixelValue(T)}, env(safe-area-inset-top))`;\n const bottom = `max(${coerceCssPixelValue(B)}, env(safe-area-inset-bottom))`;\n const left = `max(${coerceCssPixelValue(L)}, env(safe-area-inset-left))`;\n const right = `max(${coerceCssPixelValue(R)}, env(safe-area-inset-right))`;\n\n return { top, bottom, left, right };\n};\n\nexport { useSafeArea };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAIO;;;ACJP,mBAA0C;AAC1C,+BAAuB;;;ACChB,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG,KAAK;AACrD;;;ADYI;AAJG,IAAM,cAAU,mBAAK,SAASC,SAAQ,OAAqB;AAChE,QAAM,EAAE,YAAY,YAAY,MAAM,GAAG,UAAU,IAAI;AAEvD,SACE,4CAAC,oBAAiB,YAAY,WAAW,OAAO,MAAO,GAAG,WAAW;AAEzE,CAAC;AAED,IAAM,mBAAmB,gCAAO;AAAA;AAAA,WAKrB,CAAC,EAAE,YAAY,MAAM,MAC5B,eAAe,eAAe,oBAAoB,KAAK,IAAI,MAAS;AAAA,YAC5D,CAAC,EAAE,YAAY,MAAM,MAC7B,eAAe,aAAa,oBAAoB,KAAK,IAAI,MAAS;AAAA;;;AEnBtE,IAAM,cAAc,CAAC;AAAA,EACnB,KAAK,IAAI;AAAA,EACT,QAAQ,IAAI;AAAA,EACZ,MAAM,IAAI;AAAA,EACV,OAAO,IAAI;AACb,IAA2B,CAAC,MAAM;AAChC,QAAM,MAAM,OAAO,oBAAoB,CAAC,CAAC;AACzC,QAAM,SAAS,OAAO,oBAAoB,CAAC,CAAC;AAC5C,QAAM,OAAO,OAAO,oBAAoB,CAAC,CAAC;AAC1C,QAAM,QAAQ,OAAO,oBAAoB,CAAC,CAAC;AAE3C,SAAO,EAAE,KAAK,QAAQ,MAAM,MAAM;AACpC;;;AHCI,IAAAC,sBAAA;AARG,IAAM,WAAW,CAAsC;AAAA,EAC5D;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAwB;AACtB,QAAM,YAAY,MAAM;AAExB,SACE,8CAAC,aAAW,GAAG,OACb;AAAA,iDAAC,eAAY;AAAA,IACZ;AAAA,IACD,6CAAC,kBAAe;AAAA,KAClB;AAEJ;AAEA,IAAM,kBAAc,oBAAK,SAASC,aAChC,OACA;AACA,QAAM,EAAE,IAAI,IAAI,YAAY;AAC5B,SAAO,6CAAC,WAAS,GAAG,OAAO,MAAM,KAAK;AACxC,CAAC;AAED,IAAM,qBAAiB,oBAAK,SAASC,gBACnC,OACA;AACA,QAAM,EAAE,OAAO,IAAI,YAAY;AAC/B,SAAO,6CAAC,WAAS,GAAG,OAAO,MAAM,QAAQ;AAC3C,CAAC;AAED,SAAS,MAAM;AACf,SAAS,SAAS;","names":["import_react","Spacing","import_jsx_runtime","SafeAreaTop","SafeAreaBottom"]}
|
package/dist/SafeArea.mjs
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import {
|
2
2
|
SafeArea
|
3
|
-
} from "./chunk-
|
4
|
-
import "./chunk-
|
5
|
-
import "./chunk-
|
6
|
-
import "./chunk-
|
3
|
+
} from "./chunk-RASCHI5T.mjs";
|
4
|
+
import "./chunk-ANMBV2U3.mjs";
|
5
|
+
import "./chunk-VIGWO4EN.mjs";
|
6
|
+
import "./chunk-OQ3L65JI.mjs";
|
7
7
|
export {
|
8
8
|
SafeArea
|
9
9
|
};
|
package/dist/Spacing.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/Spacing.tsx","../src/coerceCssPixelValue.ts"],"sourcesContent":["import { memo, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype AxisDirection = 'vertical' | 'horizontal';\n\nexport type SpacingProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n direction?: AxisDirection;\n size: CSSPixelValue;\n};\n\nexport const Spacing = memo(function Spacing(props: SpacingProps) {\n const { direction = 'vertical', size, ...restProps } = props;\n\n return (\n <SpacingContainer $direction={direction} $size={size} {...restProps} />\n );\n});\n\nconst SpacingContainer = styled.div<{\n $direction: SpacingProps['direction'];\n $size: SpacingProps['size'];\n}>`\n flex: none;\n width: ${({ $direction, $size }) =>\n $direction === 'horizontal' ? coerceCssPixelValue($size) : undefined};\n height: ${({ $direction, $size }) =>\n $direction === 'vertical' ? coerceCssPixelValue($size) : undefined};\n`;\n","export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0C;AAC1C,+BAAuB;;;ACChB,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG;
|
1
|
+
{"version":3,"sources":["../src/Spacing.tsx","../src/coerceCssPixelValue.ts"],"sourcesContent":["import { memo, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype AxisDirection = 'vertical' | 'horizontal';\n\nexport type SpacingProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n direction?: AxisDirection;\n size: CSSPixelValue;\n};\n\nexport const Spacing = memo(function Spacing(props: SpacingProps) {\n const { direction = 'vertical', size, ...restProps } = props;\n\n return (\n <SpacingContainer $direction={direction} $size={size} {...restProps} />\n );\n});\n\nconst SpacingContainer = styled.div<{\n $direction: SpacingProps['direction'];\n $size: SpacingProps['size'];\n}>`\n flex: none;\n width: ${({ $direction, $size }) =>\n $direction === 'horizontal' ? coerceCssPixelValue($size) : undefined};\n height: ${({ $direction, $size }) =>\n $direction === 'vertical' ? coerceCssPixelValue($size) : undefined};\n`;\n","export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0C;AAC1C,+BAAuB;;;ACChB,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG,KAAK;AACrD;;;ADYI;AAJG,IAAM,cAAU,mBAAK,SAASA,SAAQ,OAAqB;AAChE,QAAM,EAAE,YAAY,YAAY,MAAM,GAAG,UAAU,IAAI;AAEvD,SACE,4CAAC,oBAAiB,YAAY,WAAW,OAAO,MAAO,GAAG,WAAW;AAEzE,CAAC;AAED,IAAM,mBAAmB,gCAAO;AAAA;AAAA,WAKrB,CAAC,EAAE,YAAY,MAAM,MAC5B,eAAe,eAAe,oBAAoB,KAAK,IAAI,MAAS;AAAA,YAC5D,CAAC,EAAE,YAAY,MAAM,MAC7B,eAAe,aAAa,oBAAoB,KAAK,IAAI,MAAS;AAAA;","names":["Spacing"]}
|
package/dist/Spacing.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/createContext.tsx"],"sourcesContent":["import {\n useMemo,\n createContext as createContextRaw,\n useContext as useContextRaw,\n type PropsWithChildren,\n} from 'react';\n\nexport function createContext<ContextValueType extends object | null>(\n rootComponentName: string,\n defaultContext?: ContextValueType\n) {\n const Context = createContextRaw<ContextValueType | undefined>(\n defaultContext\n );\n\n function Provider(props: PropsWithChildren<ContextValueType>) {\n const { children, ...contextValues } = props;\n\n const value = useMemo(\n () => contextValues,\n [contextValues]\n ) as ContextValueType;\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n function useContext(consumerName: string) {\n const context = useContextRaw(Context);\n if (context == null) {\n throw new Error(\n `${consumerName}은 ${rootComponentName}하위에서 사용해야 합니다.`\n );\n }\n\n return context;\n }\n\n Provider.displayName = `${rootComponentName}Provider`;\n return [Provider, useContext] as const;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA,iBAAiB;AAAA,EACjB,cAAc;AAAA,OAET;AAkBI;AAhBJ,SAAS,cACd,mBACA,gBACA;AACA,QAAM,UAAU;AAAA,IACd;AAAA,EACF;AAEA,WAAS,SAAS,OAA4C;AAC5D,UAAM,EAAE,UAAU,GAAG,cAAc,IAAI;AAEvC,UAAM,QAAQ;AAAA,MACZ,MAAM;AAAA,MACN,CAAC,aAAa;AAAA,IAChB;AAEA,WAAO,oBAAC,QAAQ,UAAR,EAAiB,OAAe,UAAS;AAAA,EACnD;AAEA,WAAS,WAAW,cAAsB;AACxC,UAAM,UAAU,cAAc,OAAO;AACrC,QAAI,WAAW,MAAM;AACnB,YAAM,IAAI;AAAA,QACR,GAAG,
|
1
|
+
{"version":3,"sources":["../src/createContext.tsx"],"sourcesContent":["import {\n useMemo,\n createContext as createContextRaw,\n useContext as useContextRaw,\n type PropsWithChildren,\n} from 'react';\n\nexport function createContext<ContextValueType extends object | null>(\n rootComponentName: string,\n defaultContext?: ContextValueType\n) {\n const Context = createContextRaw<ContextValueType | undefined>(\n defaultContext\n );\n\n function Provider(props: PropsWithChildren<ContextValueType>) {\n const { children, ...contextValues } = props;\n\n const value = useMemo(\n () => contextValues,\n [contextValues]\n ) as ContextValueType;\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n function useContext(consumerName: string) {\n const context = useContextRaw(Context);\n if (context == null) {\n throw new Error(\n `${consumerName}은 ${rootComponentName}하위에서 사용해야 합니다.`\n );\n }\n\n return context;\n }\n\n Provider.displayName = `${rootComponentName}Provider`;\n return [Provider, useContext] as const;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA,iBAAiB;AAAA,EACjB,cAAc;AAAA,OAET;AAkBI;AAhBJ,SAAS,cACd,mBACA,gBACA;AACA,QAAM,UAAU;AAAA,IACd;AAAA,EACF;AAEA,WAAS,SAAS,OAA4C;AAC5D,UAAM,EAAE,UAAU,GAAG,cAAc,IAAI;AAEvC,UAAM,QAAQ;AAAA,MACZ,MAAM;AAAA,MACN,CAAC,aAAa;AAAA,IAChB;AAEA,WAAO,oBAAC,QAAQ,UAAR,EAAiB,OAAe,UAAS;AAAA,EACnD;AAEA,WAAS,WAAW,cAAsB;AACxC,UAAM,UAAU,cAAc,OAAO;AACrC,QAAI,WAAW,MAAM;AACnB,YAAM,IAAI;AAAA,QACR,GAAG,YAAY,UAAK,iBAAiB;AAAA,MACvC;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,WAAS,cAAc,GAAG,iBAAiB;AAC3C,SAAO,CAAC,UAAU,UAAU;AAC9B;","names":[]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
coerceCssPixelValue
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-OQ3L65JI.mjs";
|
4
4
|
|
5
5
|
// src/useSafeArea.ts
|
6
6
|
var useSafeArea = ({
|
@@ -19,4 +19,4 @@ var useSafeArea = ({
|
|
19
19
|
export {
|
20
20
|
useSafeArea
|
21
21
|
};
|
22
|
-
//# sourceMappingURL=chunk-
|
22
|
+
//# sourceMappingURL=chunk-ANMBV2U3.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/useSafeArea.ts"],"sourcesContent":["import { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\nexport type SafeAreaCssValueProps = {\n top?: CSSPixelValue;\n bottom?: CSSPixelValue;\n left?: CSSPixelValue;\n right?: CSSPixelValue;\n};\n\nconst useSafeArea = ({\n top: T = 0,\n bottom: B = 0,\n left: L = 0,\n right: R = 0,\n}: SafeAreaCssValueProps = {}) => {\n const top = `max(${coerceCssPixelValue(T)}, env(safe-area-inset-top))`;\n const bottom = `max(${coerceCssPixelValue(B)}, env(safe-area-inset-bottom))`;\n const left = `max(${coerceCssPixelValue(L)}, env(safe-area-inset-left))`;\n const right = `max(${coerceCssPixelValue(R)}, env(safe-area-inset-right))`;\n\n return { top, bottom, left, right };\n};\n\nexport { useSafeArea };\n"],"mappings":";;;;;AASA,IAAM,cAAc,CAAC;AAAA,EACnB,KAAK,IAAI;AAAA,EACT,QAAQ,IAAI;AAAA,EACZ,MAAM,IAAI;AAAA,EACV,OAAO,IAAI;AACb,IAA2B,CAAC,MAAM;AAChC,QAAM,MAAM,OAAO,oBAAoB,CAAC;
|
1
|
+
{"version":3,"sources":["../src/useSafeArea.ts"],"sourcesContent":["import { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\nexport type SafeAreaCssValueProps = {\n top?: CSSPixelValue;\n bottom?: CSSPixelValue;\n left?: CSSPixelValue;\n right?: CSSPixelValue;\n};\n\nconst useSafeArea = ({\n top: T = 0,\n bottom: B = 0,\n left: L = 0,\n right: R = 0,\n}: SafeAreaCssValueProps = {}) => {\n const top = `max(${coerceCssPixelValue(T)}, env(safe-area-inset-top))`;\n const bottom = `max(${coerceCssPixelValue(B)}, env(safe-area-inset-bottom))`;\n const left = `max(${coerceCssPixelValue(L)}, env(safe-area-inset-left))`;\n const right = `max(${coerceCssPixelValue(R)}, env(safe-area-inset-right))`;\n\n return { top, bottom, left, right };\n};\n\nexport { useSafeArea };\n"],"mappings":";;;;;AASA,IAAM,cAAc,CAAC;AAAA,EACnB,KAAK,IAAI;AAAA,EACT,QAAQ,IAAI;AAAA,EACZ,MAAM,IAAI;AAAA,EACV,OAAO,IAAI;AACb,IAA2B,CAAC,MAAM;AAChC,QAAM,MAAM,OAAO,oBAAoB,CAAC,CAAC;AACzC,QAAM,SAAS,OAAO,oBAAoB,CAAC,CAAC;AAC5C,QAAM,OAAO,OAAO,oBAAoB,CAAC,CAAC;AAC1C,QAAM,QAAQ,OAAO,oBAAoB,CAAC,CAAC;AAE3C,SAAO,EAAE,KAAK,QAAQ,MAAM,MAAM;AACpC;","names":[]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
hasBatchim
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-KMMS4XJ6.mjs";
|
4
4
|
|
5
5
|
// src/josa.ts
|
6
6
|
function josa(props) {
|
@@ -27,4 +27,4 @@ josa.pick = josaPicker;
|
|
27
27
|
export {
|
28
28
|
josa
|
29
29
|
};
|
30
|
-
//# sourceMappingURL=chunk-
|
30
|
+
//# sourceMappingURL=chunk-EB5LTJRH.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/josa.ts"],"sourcesContent":["import { hasBatchim } from './hasBatchim';\n\ntype JosaOption = '이/가' | '을/를' | '은/는';\n\ntype ExtractJosaOption<T> = T extends `${infer A}/${infer B}` ? A | B : never;\n\nexport type JosaProps<U extends JosaOption> = {\n word: string;\n josa: U;\n};\n\n/**\n * 주어진 단어와 조사 옵션을 기반으로 올바른 조사를 반환합니다.\n * @returns 단어와 올바른 조사가 결합된 문자열\n */\nexport function josa<U extends JosaOption>(\n props: JosaProps<U>\n): `${JosaProps<U>['word']}${ExtractJosaOption<U>}` {\n const { word, josa } = props;\n\n if (!word) {\n return word as `${JosaProps<U>['word']}${ExtractJosaOption<U>}`;\n }\n\n return `${word}${josaPicker({\n word,\n josa,\n })}` as `${JosaProps<U>['word']}${ExtractJosaOption<U>}`;\n}\n\n/**\n * 주어진 단어와 조사 옵션을 기반으로 올바른 조사를 선택합니다.\n * @returns 올바른 조사\n */\nfunction josaPicker<U extends JosaOption>(\n props: JosaProps<U>\n): ExtractJosaOption<U> {\n const { word, josa } = props;\n\n if (!word) {\n return josa.split('/')[0] as ExtractJosaOption<U>;\n }\n\n const has받침 = hasBatchim(word);\n const index = has받침 ? 0 : 1;\n\n return josa.split('/')[index] as ExtractJosaOption<U>;\n}\n\njosa.pick = josaPicker;\n"],"mappings":";;;;;AAeO,SAAS,KACd,OACkD;AAClD,QAAM,EAAE,MAAM,MAAAA,MAAK,IAAI;AAEvB,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAEA,SAAO,GAAG,
|
1
|
+
{"version":3,"sources":["../src/josa.ts"],"sourcesContent":["import { hasBatchim } from './hasBatchim';\n\ntype JosaOption = '이/가' | '을/를' | '은/는';\n\ntype ExtractJosaOption<T> = T extends `${infer A}/${infer B}` ? A | B : never;\n\nexport type JosaProps<U extends JosaOption> = {\n word: string;\n josa: U;\n};\n\n/**\n * 주어진 단어와 조사 옵션을 기반으로 올바른 조사를 반환합니다.\n * @returns 단어와 올바른 조사가 결합된 문자열\n */\nexport function josa<U extends JosaOption>(\n props: JosaProps<U>\n): `${JosaProps<U>['word']}${ExtractJosaOption<U>}` {\n const { word, josa } = props;\n\n if (!word) {\n return word as `${JosaProps<U>['word']}${ExtractJosaOption<U>}`;\n }\n\n return `${word}${josaPicker({\n word,\n josa,\n })}` as `${JosaProps<U>['word']}${ExtractJosaOption<U>}`;\n}\n\n/**\n * 주어진 단어와 조사 옵션을 기반으로 올바른 조사를 선택합니다.\n * @returns 올바른 조사\n */\nfunction josaPicker<U extends JosaOption>(\n props: JosaProps<U>\n): ExtractJosaOption<U> {\n const { word, josa } = props;\n\n if (!word) {\n return josa.split('/')[0] as ExtractJosaOption<U>;\n }\n\n const has받침 = hasBatchim(word);\n const index = has받침 ? 0 : 1;\n\n return josa.split('/')[index] as ExtractJosaOption<U>;\n}\n\njosa.pick = josaPicker;\n"],"mappings":";;;;;AAeO,SAAS,KACd,OACkD;AAClD,QAAM,EAAE,MAAM,MAAAA,MAAK,IAAI;AAEvB,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AAEA,SAAO,GAAG,IAAI,GAAG,WAAW;AAAA,IAC1B;AAAA,IACA,MAAAA;AAAA,EACF,CAAC,CAAC;AACJ;AAMA,SAAS,WACP,OACsB;AACtB,QAAM,EAAE,MAAM,MAAAA,MAAK,IAAI;AAEvB,MAAI,CAAC,MAAM;AACT,WAAOA,MAAK,MAAM,GAAG,EAAE,CAAC;AAAA,EAC1B;AAEA,QAAM,kBAAQ,WAAW,IAAI;AAC7B,QAAM,QAAQ,kBAAQ,IAAI;AAE1B,SAAOA,MAAK,MAAM,GAAG,EAAE,KAAK;AAC9B;AAEA,KAAK,OAAO;","names":["josa"]}
|
@@ -2,8 +2,8 @@
|
|
2
2
|
import { css } from "styled-components";
|
3
3
|
var ellipsis = css`
|
4
4
|
overflow: hidden;
|
5
|
-
white-space: nowrap;
|
6
5
|
text-overflow: ellipsis;
|
6
|
+
white-space: nowrap;
|
7
7
|
`;
|
8
8
|
var multiLineEllipsis = ({ line }) => css`
|
9
9
|
display: -webkit-box;
|
@@ -17,4 +17,4 @@ export {
|
|
17
17
|
ellipsis,
|
18
18
|
multiLineEllipsis
|
19
19
|
};
|
20
|
-
//# sourceMappingURL=chunk-
|
20
|
+
//# sourceMappingURL=chunk-FTMJVXXH.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/ellipsis.ts"],"sourcesContent":["import { css } from 'styled-components';\n\nexport type MultiLineEllipsisProps = {\n line: number;\n};\n\nexport const ellipsis = css`\n overflow: hidden;\n
|
1
|
+
{"version":3,"sources":["../src/ellipsis.ts"],"sourcesContent":["import { css } from 'styled-components';\n\nexport type MultiLineEllipsisProps = {\n line: number;\n};\n\nexport const ellipsis = css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nexport const multiLineEllipsis = ({ line }: MultiLineEllipsisProps) => css`\n display: -webkit-box;\n overflow: hidden;\n text-overflow: ellipsis;\n -webkit-line-clamp: ${line};\n -webkit-box-orient: vertical;\n`;\n"],"mappings":";AAAA,SAAS,WAAW;AAMb,IAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAMjB,IAAM,oBAAoB,CAAC,EAAE,KAAK,MAA8B;AAAA;AAAA;AAAA;AAAA,wBAI/C,IAAI;AAAA;AAAA;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/hexToRgba.ts"],"sourcesContent":["export type HexToRgbaProps = { hex: string; alpha?: number };\n\nfunction parseHexToDecimal(hex: string): number {\n return parseInt(hex, 16);\n}\n\nfunction validateHex(hex: string): string {\n const match = /^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.exec(hex);\n if (!match) {\n throw new Error(\n `Invalid hex value: \"${hex}\". Expected formats: \"#RGB\", \"RGB\", \"#RRGGBB\", or \"RRGGBB\".`\n );\n }\n return match[1];\n}\n\nfunction expandHex(hex: string): string {\n return hex.length === 3\n ? hex\n .split('')\n .map((char) => char + char)\n .join('')\n : hex;\n}\n\nfunction isValidAlpha(alpha: number): boolean {\n return alpha >= 0 && alpha <= 1;\n}\n\nexport function hexToRgba({ hex, alpha = 1 }: HexToRgbaProps): string {\n if (!isValidAlpha(alpha)) {\n throw new Error(\n `Invalid alpha value. Must be between 0 and 1, received: ${alpha}`\n );\n }\n\n const validatedHex = validateHex(hex);\n const expandedHex = expandHex(validatedHex);\n\n const r = parseHexToDecimal(expandedHex.slice(0, 2));\n const g = parseHexToDecimal(expandedHex.slice(2, 4));\n const b = parseHexToDecimal(expandedHex.slice(4, 6));\n\n return `rgba(${r},${g},${b},${alpha})`;\n}\n"],"mappings":";AAEA,SAAS,kBAAkB,KAAqB;AAC9C,SAAO,SAAS,KAAK,EAAE;AACzB;AAEA,SAAS,YAAY,KAAqB;AACxC,QAAM,QAAQ,sCAAsC,KAAK,GAAG;AAC5D,MAAI,CAAC,OAAO;AACV,UAAM,IAAI;AAAA,MACR,uBAAuB;AAAA,
|
1
|
+
{"version":3,"sources":["../src/hexToRgba.ts"],"sourcesContent":["export type HexToRgbaProps = { hex: string; alpha?: number };\n\nfunction parseHexToDecimal(hex: string): number {\n return parseInt(hex, 16);\n}\n\nfunction validateHex(hex: string): string {\n const match = /^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.exec(hex);\n if (!match) {\n throw new Error(\n `Invalid hex value: \"${hex}\". Expected formats: \"#RGB\", \"RGB\", \"#RRGGBB\", or \"RRGGBB\".`\n );\n }\n return match[1];\n}\n\nfunction expandHex(hex: string): string {\n return hex.length === 3\n ? hex\n .split('')\n .map((char) => char + char)\n .join('')\n : hex;\n}\n\nfunction isValidAlpha(alpha: number): boolean {\n return alpha >= 0 && alpha <= 1;\n}\n\nexport function hexToRgba({ hex, alpha = 1 }: HexToRgbaProps): string {\n if (!isValidAlpha(alpha)) {\n throw new Error(\n `Invalid alpha value. Must be between 0 and 1, received: ${alpha}`\n );\n }\n\n const validatedHex = validateHex(hex);\n const expandedHex = expandHex(validatedHex);\n\n const r = parseHexToDecimal(expandedHex.slice(0, 2));\n const g = parseHexToDecimal(expandedHex.slice(2, 4));\n const b = parseHexToDecimal(expandedHex.slice(4, 6));\n\n return `rgba(${r},${g},${b},${alpha})`;\n}\n"],"mappings":";AAEA,SAAS,kBAAkB,KAAqB;AAC9C,SAAO,SAAS,KAAK,EAAE;AACzB;AAEA,SAAS,YAAY,KAAqB;AACxC,QAAM,QAAQ,sCAAsC,KAAK,GAAG;AAC5D,MAAI,CAAC,OAAO;AACV,UAAM,IAAI;AAAA,MACR,uBAAuB,GAAG;AAAA,IAC5B;AAAA,EACF;AACA,SAAO,MAAM,CAAC;AAChB;AAEA,SAAS,UAAU,KAAqB;AACtC,SAAO,IAAI,WAAW,IAClB,IACG,MAAM,EAAE,EACR,IAAI,CAAC,SAAS,OAAO,IAAI,EACzB,KAAK,EAAE,IACV;AACN;AAEA,SAAS,aAAa,OAAwB;AAC5C,SAAO,SAAS,KAAK,SAAS;AAChC;AAEO,SAAS,UAAU,EAAE,KAAK,QAAQ,EAAE,GAA2B;AACpE,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,2DAA2D,KAAK;AAAA,IAClE;AAAA,EACF;AAEA,QAAM,eAAe,YAAY,GAAG;AACpC,QAAM,cAAc,UAAU,YAAY;AAE1C,QAAM,IAAI,kBAAkB,YAAY,MAAM,GAAG,CAAC,CAAC;AACnD,QAAM,IAAI,kBAAkB,YAAY,MAAM,GAAG,CAAC,CAAC;AACnD,QAAM,IAAI,kBAAkB,YAAY,MAAM,GAAG,CAAC,CAAC;AAEnD,SAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK;AACrC;","names":[]}
|
@@ -7,8 +7,7 @@ import {
|
|
7
7
|
// src/hasBatchim.ts
|
8
8
|
function hasBatchim(str) {
|
9
9
|
const lastChar = str[str.length - 1];
|
10
|
-
if (!lastChar)
|
11
|
-
return false;
|
10
|
+
if (!lastChar) return false;
|
12
11
|
const charCode = lastChar.charCodeAt(0);
|
13
12
|
if (charCode < COMPLETE_HANGUL_START_CHARCODE || charCode > COMPLETE_HANGUL_END_CHARCODE) {
|
14
13
|
return false;
|
@@ -20,4 +19,4 @@ function hasBatchim(str) {
|
|
20
19
|
export {
|
21
20
|
hasBatchim
|
22
21
|
};
|
23
|
-
//# sourceMappingURL=chunk-
|
22
|
+
//# sourceMappingURL=chunk-KMMS4XJ6.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/hasBatchim.ts"],"sourcesContent":["import {\n COMPLETE_HANGUL_END_CHARCODE,\n COMPLETE_HANGUL_START_CHARCODE,\n NUMBER_OF_JONGSEONG,\n} from './constants/josa';\n\n/**\n * 한글 음절의 받침 유무를 확인합니다.\n * @param str - 검사할 문자열\n * @returns 받침이 있으면 true, 없으면 false\n */\nexport function hasBatchim(str: string): boolean {\n const lastChar = str[str.length - 1];\n if (!lastChar) return false;\n\n const charCode = lastChar.charCodeAt(0);\n\n // 한글 완성형 문자인지 확인\n if (\n charCode < COMPLETE_HANGUL_START_CHARCODE ||\n charCode > COMPLETE_HANGUL_END_CHARCODE\n ) {\n return false;\n }\n\n // 받침 코드 계산\n const batchimCode =\n (charCode - COMPLETE_HANGUL_START_CHARCODE) % NUMBER_OF_JONGSEONG;\n\n return batchimCode > 0; // 받침이 있으면 true\n}\n"],"mappings":";;;;;;;AAWO,SAAS,WAAW,KAAsB;AAC/C,QAAM,WAAW,IAAI,IAAI,SAAS,CAAC;AACnC,MAAI,CAAC
|
1
|
+
{"version":3,"sources":["../src/hasBatchim.ts"],"sourcesContent":["import {\n COMPLETE_HANGUL_END_CHARCODE,\n COMPLETE_HANGUL_START_CHARCODE,\n NUMBER_OF_JONGSEONG,\n} from './constants/josa';\n\n/**\n * 한글 음절의 받침 유무를 확인합니다.\n * @param str - 검사할 문자열\n * @returns 받침이 있으면 true, 없으면 false\n */\nexport function hasBatchim(str: string): boolean {\n const lastChar = str[str.length - 1];\n if (!lastChar) return false;\n\n const charCode = lastChar.charCodeAt(0);\n\n // 한글 완성형 문자인지 확인\n if (\n charCode < COMPLETE_HANGUL_START_CHARCODE ||\n charCode > COMPLETE_HANGUL_END_CHARCODE\n ) {\n return false;\n }\n\n // 받침 코드 계산\n const batchimCode =\n (charCode - COMPLETE_HANGUL_START_CHARCODE) % NUMBER_OF_JONGSEONG;\n\n return batchimCode > 0; // 받침이 있으면 true\n}\n"],"mappings":";;;;;;;AAWO,SAAS,WAAW,KAAsB;AAC/C,QAAM,WAAW,IAAI,IAAI,SAAS,CAAC;AACnC,MAAI,CAAC,SAAU,QAAO;AAEtB,QAAM,WAAW,SAAS,WAAW,CAAC;AAGtC,MACE,WAAW,kCACX,WAAW,8BACX;AACA,WAAO;AAAA,EACT;AAGA,QAAM,eACH,WAAW,kCAAkC;AAEhD,SAAO,cAAc;AACvB;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/coerceCssPixelValue.ts"],"sourcesContent":["export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n"],"mappings":";AAEO,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG;
|
1
|
+
{"version":3,"sources":["../src/coerceCssPixelValue.ts"],"sourcesContent":["export type CSSPixelValue = string | number;\n\nexport function coerceCssPixelValue(value: CSSPixelValue): string {\n return typeof value === 'string' ? value : `${value}px`;\n}\n"],"mappings":";AAEO,SAAS,oBAAoB,OAA8B;AAChE,SAAO,OAAO,UAAU,WAAW,QAAQ,GAAG,KAAK;AACrD;","names":[]}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import {
|
2
2
|
useSafeArea
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-ANMBV2U3.mjs";
|
4
4
|
import {
|
5
5
|
Spacing
|
6
|
-
} from "./chunk-
|
6
|
+
} from "./chunk-VIGWO4EN.mjs";
|
7
7
|
|
8
8
|
// src/SafeArea.tsx
|
9
9
|
import {
|
@@ -36,4 +36,4 @@ SafeArea.Bottom = SafeAreaBottom;
|
|
36
36
|
export {
|
37
37
|
SafeArea
|
38
38
|
};
|
39
|
-
//# sourceMappingURL=chunk-
|
39
|
+
//# sourceMappingURL=chunk-RASCHI5T.mjs.map
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
coerceCssPixelValue
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-OQ3L65JI.mjs";
|
4
4
|
|
5
5
|
// src/Flex.tsx
|
6
6
|
import { memo } from "react";
|
@@ -39,4 +39,4 @@ export {
|
|
39
39
|
Flex,
|
40
40
|
Container
|
41
41
|
};
|
42
|
-
//# sourceMappingURL=chunk-
|
42
|
+
//# sourceMappingURL=chunk-UCZMT7TP.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/Flex.tsx"],"sourcesContent":["import { memo, type CSSProperties, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype Justify = CSSProperties['justifyContent'];\ntype Align = CSSProperties['alignItems'];\ntype Direction = CSSProperties['flexDirection'];\n\nexport type FlexProps = HTMLAttributes<HTMLDivElement> & {\n gap?: CSSPixelValue;\n justify?: Justify;\n align?: Align;\n direction?: Direction;\n};\n\nexport const Flex = memo(function Flex(props: FlexProps) {\n const {\n gap = 0,\n justify = 'center',\n align = 'center',\n direction = 'row',\n children,\n ...restProps\n } = props;\n\n return (\n <Container\n $gap={gap}\n $justify={justify}\n $align={align}\n $direction={direction}\n {...restProps}\n >\n {children}\n </Container>\n );\n});\n\nexport const Container = styled.div<{\n $gap: CSSPixelValue;\n $justify: Justify;\n $align: Align;\n $direction: Direction;\n}>`\n display: flex;\n flex-direction: ${({ $direction }) => $direction};\n gap: ${({ $gap }) => coerceCssPixelValue($gap)};\n align-items: ${({ $align }) => $align};\n justify-content: ${({ $justify }) => $justify};\n`;\n"],"mappings":";;;;;AAAA,SAAS,YAAqD;AAC9D,SAAS,cAAc;AA0BnB;AAXG,IAAM,OAAO,KAAK,SAASA,MAAK,OAAkB;AACvD,QAAM;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,YAAY;AAAA,MACX,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ,CAAC;AAEM,IAAM,YAAY,OAAO;AAAA;AAAA,oBAOZ,CAAC,EAAE,WAAW,MAAM;AAAA,
|
1
|
+
{"version":3,"sources":["../src/Flex.tsx"],"sourcesContent":["import { memo, type CSSProperties, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype Justify = CSSProperties['justifyContent'];\ntype Align = CSSProperties['alignItems'];\ntype Direction = CSSProperties['flexDirection'];\n\nexport type FlexProps = HTMLAttributes<HTMLDivElement> & {\n gap?: CSSPixelValue;\n justify?: Justify;\n align?: Align;\n direction?: Direction;\n};\n\nexport const Flex = memo(function Flex(props: FlexProps) {\n const {\n gap = 0,\n justify = 'center',\n align = 'center',\n direction = 'row',\n children,\n ...restProps\n } = props;\n\n return (\n <Container\n $gap={gap}\n $justify={justify}\n $align={align}\n $direction={direction}\n {...restProps}\n >\n {children}\n </Container>\n );\n});\n\nexport const Container = styled.div<{\n $gap: CSSPixelValue;\n $justify: Justify;\n $align: Align;\n $direction: Direction;\n}>`\n display: flex;\n flex-direction: ${({ $direction }) => $direction};\n gap: ${({ $gap }) => coerceCssPixelValue($gap)};\n align-items: ${({ $align }) => $align};\n justify-content: ${({ $justify }) => $justify};\n`;\n"],"mappings":";;;;;AAAA,SAAS,YAAqD;AAC9D,SAAS,cAAc;AA0BnB;AAXG,IAAM,OAAO,KAAK,SAASA,MAAK,OAAkB;AACvD,QAAM;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,YAAY;AAAA,MACX,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ,CAAC;AAEM,IAAM,YAAY,OAAO;AAAA;AAAA,oBAOZ,CAAC,EAAE,WAAW,MAAM,UAAU;AAAA,SACzC,CAAC,EAAE,KAAK,MAAM,oBAAoB,IAAI,CAAC;AAAA,iBAC/B,CAAC,EAAE,OAAO,MAAM,MAAM;AAAA,qBAClB,CAAC,EAAE,SAAS,MAAM,QAAQ;AAAA;","names":["Flex"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
coerceCssPixelValue
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-OQ3L65JI.mjs";
|
4
4
|
|
5
5
|
// src/Spacing.tsx
|
6
6
|
import { memo } from "react";
|
@@ -19,4 +19,4 @@ var SpacingContainer = styled.div`
|
|
19
19
|
export {
|
20
20
|
Spacing
|
21
21
|
};
|
22
|
-
//# sourceMappingURL=chunk-
|
22
|
+
//# sourceMappingURL=chunk-VIGWO4EN.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/Spacing.tsx"],"sourcesContent":["import { memo, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype AxisDirection = 'vertical' | 'horizontal';\n\nexport type SpacingProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n direction?: AxisDirection;\n size: CSSPixelValue;\n};\n\nexport const Spacing = memo(function Spacing(props: SpacingProps) {\n const { direction = 'vertical', size, ...restProps } = props;\n\n return (\n <SpacingContainer $direction={direction} $size={size} {...restProps} />\n );\n});\n\nconst SpacingContainer = styled.div<{\n $direction: SpacingProps['direction'];\n $size: SpacingProps['size'];\n}>`\n flex: none;\n width: ${({ $direction, $size }) =>\n $direction === 'horizontal' ? coerceCssPixelValue($size) : undefined};\n height: ${({ $direction, $size }) =>\n $direction === 'vertical' ? coerceCssPixelValue($size) : undefined};\n`;\n"],"mappings":";;;;;AAAA,SAAS,YAAiC;AAC1C,SAAS,cAAc;AAenB;AAJG,IAAM,UAAU,KAAK,SAASA,SAAQ,OAAqB;AAChE,QAAM,EAAE,YAAY,YAAY,MAAM,GAAG,UAAU,IAAI;AAEvD,SACE,oBAAC,oBAAiB,YAAY,WAAW,OAAO,MAAO,GAAG,WAAW;AAEzE,CAAC;AAED,IAAM,mBAAmB,OAAO;AAAA;AAAA,WAKrB,CAAC,EAAE,YAAY,MAAM,MAC5B,eAAe,eAAe,oBAAoB,KAAK,IAAI;AAAA,
|
1
|
+
{"version":3,"sources":["../src/Spacing.tsx"],"sourcesContent":["import { memo, type HTMLAttributes } from 'react';\nimport { styled } from 'styled-components';\n\nimport { coerceCssPixelValue, type CSSPixelValue } from './coerceCssPixelValue';\n\ntype AxisDirection = 'vertical' | 'horizontal';\n\nexport type SpacingProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n direction?: AxisDirection;\n size: CSSPixelValue;\n};\n\nexport const Spacing = memo(function Spacing(props: SpacingProps) {\n const { direction = 'vertical', size, ...restProps } = props;\n\n return (\n <SpacingContainer $direction={direction} $size={size} {...restProps} />\n );\n});\n\nconst SpacingContainer = styled.div<{\n $direction: SpacingProps['direction'];\n $size: SpacingProps['size'];\n}>`\n flex: none;\n width: ${({ $direction, $size }) =>\n $direction === 'horizontal' ? coerceCssPixelValue($size) : undefined};\n height: ${({ $direction, $size }) =>\n $direction === 'vertical' ? coerceCssPixelValue($size) : undefined};\n`;\n"],"mappings":";;;;;AAAA,SAAS,YAAiC;AAC1C,SAAS,cAAc;AAenB;AAJG,IAAM,UAAU,KAAK,SAASA,SAAQ,OAAqB;AAChE,QAAM,EAAE,YAAY,YAAY,MAAM,GAAG,UAAU,IAAI;AAEvD,SACE,oBAAC,oBAAiB,YAAY,WAAW,OAAO,MAAO,GAAG,WAAW;AAEzE,CAAC;AAED,IAAM,mBAAmB,OAAO;AAAA;AAAA,WAKrB,CAAC,EAAE,YAAY,MAAM,MAC5B,eAAe,eAAe,oBAAoB,KAAK,IAAI,MAAS;AAAA,YAC5D,CAAC,EAAE,YAAY,MAAM,MAC7B,eAAe,aAAa,oBAAoB,KAAK,IAAI,MAAS;AAAA;","names":["Spacing"]}
|
@@ -0,0 +1,99 @@
|
|
1
|
+
// src/DomainFormat.ts
|
2
|
+
function formatModeName(mode, customMapping = {}) {
|
3
|
+
const defaultModeMapping = {
|
4
|
+
H: "\uB09C\uBC29",
|
5
|
+
C: "\uB0C9\uBC29",
|
6
|
+
W: "\uC1A1\uD48D"
|
7
|
+
};
|
8
|
+
const combinedMapping = { ...defaultModeMapping, ...customMapping };
|
9
|
+
if (!(mode in combinedMapping)) {
|
10
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uBAA8\uB4DC\uC785\uB2C8\uB2E4. mode: ${mode}`);
|
11
|
+
}
|
12
|
+
return combinedMapping[mode];
|
13
|
+
}
|
14
|
+
function formatModeColor(mode, customMapping = {}) {
|
15
|
+
const defaultColorMapping = {
|
16
|
+
H: "#e77676",
|
17
|
+
C: "#9fc6ff",
|
18
|
+
W: "#a8e379"
|
19
|
+
};
|
20
|
+
const combinedMapping = { ...defaultColorMapping, ...customMapping };
|
21
|
+
if (!(mode in combinedMapping)) {
|
22
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uBAA8\uB4DC\uC785\uB2C8\uB2E4. mode: ${mode}`);
|
23
|
+
}
|
24
|
+
return combinedMapping[mode];
|
25
|
+
}
|
26
|
+
function formatWind(wind, customMapping = {}) {
|
27
|
+
const defaultWindMapping = {
|
28
|
+
1: "\uBBF8\uD48D",
|
29
|
+
2: "\uC57D\uD48D",
|
30
|
+
3: "\uAC15\uD48D"
|
31
|
+
};
|
32
|
+
const combinedMapping = { ...defaultWindMapping, ...customMapping };
|
33
|
+
if (!(wind in combinedMapping)) {
|
34
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD48D\uB7C9\uC785\uB2C8\uB2E4. wind: ${wind}`);
|
35
|
+
}
|
36
|
+
return combinedMapping[wind];
|
37
|
+
}
|
38
|
+
function formatAirLevelName(level) {
|
39
|
+
const airLevelMapping = {
|
40
|
+
1: "\uB9E4\uC6B0 \uB098\uC068",
|
41
|
+
2: "\uB098\uC068",
|
42
|
+
3: "\uBCF4\uD1B5",
|
43
|
+
4: "\uC88B\uC74C",
|
44
|
+
5: "\uB9E4\uC6B0 \uC88B\uC74C"
|
45
|
+
};
|
46
|
+
if (!(level in airLevelMapping)) {
|
47
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uB808\uBCA8\uC785\uB2C8\uB2E4. level: ${level}`);
|
48
|
+
}
|
49
|
+
return airLevelMapping[level];
|
50
|
+
}
|
51
|
+
function formatAirLevelColor(level) {
|
52
|
+
const colorMapping = {
|
53
|
+
1: "#ff5d47",
|
54
|
+
2: "#ff961c",
|
55
|
+
3: "#ffca42",
|
56
|
+
4: "#63ff60",
|
57
|
+
5: "#49ffe9"
|
58
|
+
};
|
59
|
+
if (!(level in colorMapping)) {
|
60
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uB808\uBCA8\uC785\uB2C8\uB2E4. level: ${level}`);
|
61
|
+
}
|
62
|
+
return colorMapping[level];
|
63
|
+
}
|
64
|
+
var formatUserLevel = ({ level, language = "ko" }) => {
|
65
|
+
const userLevelMapping = {
|
66
|
+
en: {
|
67
|
+
"1": "MASTER",
|
68
|
+
"2": "MASTER KID",
|
69
|
+
"3": "SENIOR",
|
70
|
+
"4": "JUNIOR"
|
71
|
+
},
|
72
|
+
ko: {
|
73
|
+
"1": "\uB9C8\uC2A4\uD130",
|
74
|
+
"2": "\uB9C8\uC2A4\uD130\uD0A4\uC988",
|
75
|
+
"3": "\uC2DC\uB2C8\uC5B4",
|
76
|
+
"4": "\uC8FC\uB2C8\uC5B4"
|
77
|
+
}
|
78
|
+
};
|
79
|
+
if (!(language in userLevelMapping)) {
|
80
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC5B8\uC5B4\uC785\uB2C8\uB2E4. language: ${language}`);
|
81
|
+
}
|
82
|
+
if (!(level in userLevelMapping[language])) {
|
83
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uB808\uBCA8\uC785\uB2C8\uB2E4. level: ${level}`);
|
84
|
+
}
|
85
|
+
return userLevelMapping[language][level];
|
86
|
+
};
|
87
|
+
var DomainFormat = {
|
88
|
+
modeName: formatModeName,
|
89
|
+
modeColor: formatModeColor,
|
90
|
+
wind: formatWind,
|
91
|
+
airLevelName: formatAirLevelName,
|
92
|
+
airLevelColor: formatAirLevelColor,
|
93
|
+
userLevel: formatUserLevel
|
94
|
+
};
|
95
|
+
|
96
|
+
export {
|
97
|
+
DomainFormat
|
98
|
+
};
|
99
|
+
//# sourceMappingURL=chunk-WWR7M6ID.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/DomainFormat.ts"],"sourcesContent":["export type Mode = 'H' | 'C' | 'W';\nexport type Wind = 1 | 2 | 3;\nexport type AirLevel = 1 | 2 | 3 | 4 | 5;\nexport type UserLevel = '1' | '2' | '3' | '4';\nexport type Language = 'en' | 'ko';\n\nfunction formatModeName(mode: Mode, customMapping: Record<string, string> = {}): string {\n const defaultModeMapping: Record<Mode, string> = {\n H: '난방',\n C: '냉방',\n W: '송풍',\n };\n\n const combinedMapping = { ...defaultModeMapping, ...customMapping };\n\n if (!(mode in combinedMapping)) {\n throw new Error(`지원하지 않는 모드입니다. mode: ${mode}`);\n }\n\n return combinedMapping[mode];\n}\n\nfunction formatModeColor(mode: Mode, customMapping: Record<string, string> = {}) {\n const defaultColorMapping: Record<Mode, string> = {\n H: '#e77676',\n C: '#9fc6ff',\n W: '#a8e379',\n };\n\n const combinedMapping = { ...defaultColorMapping, ...customMapping };\n\n if (!(mode in combinedMapping)) {\n throw new Error(`지원하지 않는 모드입니다. mode: ${mode}`);\n }\n\n return combinedMapping[mode];\n}\n\nfunction formatWind(wind: Wind, customMapping: Record<string, string> = {}) {\n const defaultWindMapping: Record<Wind, string> = {\n 1: '미풍',\n 2: '약풍',\n 3: '강풍',\n };\n\n const combinedMapping = { ...defaultWindMapping, ...customMapping };\n\n if (!(wind in combinedMapping)) {\n throw new Error(`지원하지 않는 풍량입니다. wind: ${wind}`);\n }\n\n return combinedMapping[wind];\n}\n\nfunction formatAirLevelName(level: AirLevel) {\n const airLevelMapping: Record<AirLevel, string> = {\n 1: '매우 나쁨',\n 2: '나쁨',\n 3: '보통',\n 4: '좋음',\n 5: '매우 좋음',\n };\n\n if (!(level in airLevelMapping)) {\n throw new Error(`지원하지 않는 레벨입니다. level: ${level}`);\n }\n\n return airLevelMapping[level];\n}\n\nfunction formatAirLevelColor(level: AirLevel) {\n const colorMapping: Record<AirLevel, string> = {\n 1: '#ff5d47',\n 2: '#ff961c',\n 3: '#ffca42',\n 4: '#63ff60',\n 5: '#49ffe9',\n };\n\n if (!(level in colorMapping)) {\n throw new Error(`지원하지 않는 레벨입니다. level: ${level}`);\n }\n\n return colorMapping[level];\n}\n\nconst formatUserLevel = ({ level, language = 'ko' }: { level: UserLevel; language?: Language }) => {\n const userLevelMapping: Record<Language, Record<UserLevel, string>> = {\n en: {\n '1': 'MASTER',\n '2': 'MASTER KID',\n '3': 'SENIOR',\n '4': 'JUNIOR',\n },\n ko: {\n '1': '마스터',\n '2': '마스터키즈',\n '3': '시니어',\n '4': '주니어',\n },\n };\n\n if (!(language in userLevelMapping)) {\n throw new Error(`지원하지 않는 언어입니다. language: ${language}`);\n }\n\n if (!(level in userLevelMapping[language])) {\n throw new Error(`지원하지 않는 레벨입니다. level: ${level}`);\n }\n\n return userLevelMapping[language][level];\n};\n\nexport const DomainFormat = {\n modeName: formatModeName,\n modeColor: formatModeColor,\n wind: formatWind,\n airLevelName: formatAirLevelName,\n airLevelColor: formatAirLevelColor,\n userLevel: formatUserLevel,\n};\n"],"mappings":";AAMA,SAAS,eAAe,MAAY,gBAAwC,CAAC,GAAW;AACtF,QAAM,qBAA2C;AAAA,IAC/C,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,QAAM,kBAAkB,EAAE,GAAG,oBAAoB,GAAG,cAAc;AAElE,MAAI,EAAE,QAAQ,kBAAkB;AAC9B,UAAM,IAAI,MAAM,+EAAwB,IAAI,EAAE;AAAA,EAChD;AAEA,SAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAS,gBAAgB,MAAY,gBAAwC,CAAC,GAAG;AAC/E,QAAM,sBAA4C;AAAA,IAChD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,QAAM,kBAAkB,EAAE,GAAG,qBAAqB,GAAG,cAAc;AAEnE,MAAI,EAAE,QAAQ,kBAAkB;AAC9B,UAAM,IAAI,MAAM,+EAAwB,IAAI,EAAE;AAAA,EAChD;AAEA,SAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAS,WAAW,MAAY,gBAAwC,CAAC,GAAG;AAC1E,QAAM,qBAA2C;AAAA,IAC/C,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,QAAM,kBAAkB,EAAE,GAAG,oBAAoB,GAAG,cAAc;AAElE,MAAI,EAAE,QAAQ,kBAAkB;AAC9B,UAAM,IAAI,MAAM,+EAAwB,IAAI,EAAE;AAAA,EAChD;AAEA,SAAO,gBAAgB,IAAI;AAC7B;AAEA,SAAS,mBAAmB,OAAiB;AAC3C,QAAM,kBAA4C;AAAA,IAChD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,MAAI,EAAE,SAAS,kBAAkB;AAC/B,UAAM,IAAI,MAAM,gFAAyB,KAAK,EAAE;AAAA,EAClD;AAEA,SAAO,gBAAgB,KAAK;AAC9B;AAEA,SAAS,oBAAoB,OAAiB;AAC5C,QAAM,eAAyC;AAAA,IAC7C,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,MAAI,EAAE,SAAS,eAAe;AAC5B,UAAM,IAAI,MAAM,gFAAyB,KAAK,EAAE;AAAA,EAClD;AAEA,SAAO,aAAa,KAAK;AAC3B;AAEA,IAAM,kBAAkB,CAAC,EAAE,OAAO,WAAW,KAAK,MAAiD;AACjG,QAAM,mBAAgE;AAAA,IACpE,IAAI;AAAA,MACF,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,IACA,IAAI;AAAA,MACF,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF;AAEA,MAAI,EAAE,YAAY,mBAAmB;AACnC,UAAM,IAAI,MAAM,mFAA4B,QAAQ,EAAE;AAAA,EACxD;AAEA,MAAI,EAAE,SAAS,iBAAiB,QAAQ,IAAI;AAC1C,UAAM,IAAI,MAAM,gFAAyB,KAAK,EAAE;AAAA,EAClD;AAEA,SAAO,iBAAiB,QAAQ,EAAE,KAAK;AACzC;AAEO,IAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,cAAc;AAAA,EACd,eAAe;AAAA,EACf,WAAW;AACb;","names":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/getVar.ts"],"sourcesContent":["export type VariableType = `--${string}`;\n\nexport function getVar(variable: VariableType, defaultValue?: string) {\n if (defaultValue) {\n return `var(${variable}, ${defaultValue})`;\n }\n\n return `var(${variable})`;\n}\n"],"mappings":";AAEO,SAAS,OAAO,UAAwB,cAAuB;AACpE,MAAI,cAAc;AAChB,WAAO,OAAO,
|
1
|
+
{"version":3,"sources":["../src/getVar.ts"],"sourcesContent":["export type VariableType = `--${string}`;\n\nexport function getVar(variable: VariableType, defaultValue?: string) {\n if (defaultValue) {\n return `var(${variable}, ${defaultValue})`;\n }\n\n return `var(${variable})`;\n}\n"],"mappings":";AAEO,SAAS,OAAO,UAAwB,cAAuB;AACpE,MAAI,cAAc;AAChB,WAAO,OAAO,QAAQ,KAAK,YAAY;AAAA,EACzC;AAEA,SAAO,OAAO,QAAQ;AACxB;","names":[]}
|