slick-address-kr 1.0.0

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/HOW-TO-USE.md ADDED
@@ -0,0 +1,416 @@
1
+ # 실제 적용 가이드
2
+
3
+ Korean Address Finder를 실제 웹사이트에 적용하는 방법입니다.
4
+
5
+ ---
6
+
7
+ ## 📦 필요한 파일 (3개만!)
8
+
9
+ ### 1. korean-address-finder.js ⭐
10
+ - 주소 검색 라이브러리 (모든 기능 포함)
11
+ - 프로젝트 루트에 있음
12
+
13
+ ### 2. config.js ⭐
14
+ - API 키 설정 파일
15
+ - **여기에 API 키를 입력합니다!**
16
+ - Git에 올리지 말 것 (.gitignore에 추가됨)
17
+
18
+ ### 3. index.html (또는 본인의 HTML 파일)
19
+ - 주소 검색 기능을 사용할 페이지
20
+
21
+ ---
22
+
23
+ ## 🚀 적용 방법
24
+
25
+ ### 1단계: 파일 복사
26
+
27
+ 프로젝트 폴더에 다음 파일들을 복사:
28
+
29
+ ```
30
+ your-project/
31
+ ├── korean-address-finder.js ← 복사
32
+ ├── config.js ← 복사
33
+ └── index.html ← 본인의 HTML 파일
34
+ ```
35
+
36
+ ### 2단계: HTML에 스크립트 추가
37
+
38
+ ```html
39
+ <!DOCTYPE html>
40
+ <html lang="ko">
41
+ <head>
42
+ <meta charset="UTF-8">
43
+ <title>내 웹사이트</title>
44
+ </head>
45
+ <body>
46
+
47
+ <!-- 주소 검색이 표시될 위치 -->
48
+ <div id="address-finder"></div>
49
+
50
+ <!-- 1. config.js 로드 (API 키) -->
51
+ <script src="config.js"></script>
52
+
53
+ <!-- 2. 라이브러리 로드 -->
54
+ <script src="korean-address-finder.js"></script>
55
+
56
+ <!-- 3. 초기화 -->
57
+ <script>
58
+ const finder = new KoreanAddressFinder({
59
+ containerId: 'address-finder',
60
+ apiKey: window.CONFIG.jusoApiKey,
61
+ onSelect: function(address) {
62
+ console.log('선택된 주소:', address);
63
+ // 주소 선택 시 처리
64
+ }
65
+ });
66
+
67
+ finder.init();
68
+ </script>
69
+ </body>
70
+ </html>
71
+ ```
72
+
73
+ ### 3단계: API 키 입력 ⭐ 중요!
74
+
75
+ **config.js 파일 열기:**
76
+
77
+ ```javascript
78
+ window.CONFIG = {
79
+ jusoApiKey: 'YOUR_API_KEY_HERE' // ← 여기에 발급받은 키 입력!
80
+ };
81
+ ```
82
+
83
+ **API 키 발급 방법:**
84
+
85
+ 1. https://business.juso.go.kr/ 접속
86
+ 2. 회원가입 후 로그인
87
+ 3. "승인키 신청" 클릭
88
+ 4. **"검색 API"** 선택 (⚠️ 팝업 API 아님!)
89
+ 5. 도메인: 본인의 도메인 입력 (또는 공란)
90
+ 6. 즉시 발급됨!
91
+
92
+ 발급받은 키 예시:
93
+ ```
94
+ devU01TX0FVVEgyMDI1MDExMDEwMTk1MzExNjQyMzI=
95
+ ```
96
+
97
+ **config.js에 입력:**
98
+ ```javascript
99
+ window.CONFIG = {
100
+ jusoApiKey: 'devU01TX0FVVEgyMDI1MDExMDEwMTk1MzExNjQyMzI='
101
+ };
102
+ ```
103
+
104
+ ### 4단계: 테스트
105
+
106
+ 로컬 서버 실행:
107
+ ```bash
108
+ python -m http.server 8000
109
+ ```
110
+
111
+ 브라우저에서 열기:
112
+ ```
113
+ http://localhost:8000/index.html
114
+ ```
115
+
116
+ ---
117
+
118
+ ## 💡 폼과 연동 예제
119
+
120
+ ### 배송지 입력 폼
121
+
122
+ ```html
123
+ <form id="delivery-form">
124
+ <div>
125
+ <label>우편번호</label>
126
+ <input type="text" id="zipcode" readonly>
127
+ </div>
128
+
129
+ <div>
130
+ <label>주소</label>
131
+ <input type="text" id="address1" readonly>
132
+ </div>
133
+
134
+ <div>
135
+ <label>상세주소</label>
136
+ <input type="text" id="address2">
137
+ </div>
138
+
139
+ <!-- 주소 검색 -->
140
+ <div id="address-finder"></div>
141
+
142
+ <button type="submit">주문하기</button>
143
+ </form>
144
+
145
+ <script src="config.js"></script>
146
+ <script src="korean-address-finder.js"></script>
147
+ <script>
148
+ const finder = new KoreanAddressFinder({
149
+ containerId: 'address-finder',
150
+ apiKey: window.CONFIG.jusoApiKey,
151
+ onSelect: function(address) {
152
+ // 폼 필드에 자동 입력
153
+ document.getElementById('zipcode').value = address.zipCode;
154
+ document.getElementById('address1').value = address.roadAddress;
155
+ document.getElementById('address2').focus(); // 상세주소로 포커스
156
+ }
157
+ });
158
+
159
+ finder.init();
160
+
161
+ // 폼 제출
162
+ document.getElementById('delivery-form').addEventListener('submit', function(e) {
163
+ e.preventDefault();
164
+
165
+ const data = {
166
+ zipcode: document.getElementById('zipcode').value,
167
+ address1: document.getElementById('address1').value,
168
+ address2: document.getElementById('address2').value
169
+ };
170
+
171
+ console.log('배송 정보:', data);
172
+ // 서버로 전송
173
+ });
174
+ </script>
175
+ ```
176
+
177
+ ---
178
+
179
+ ## 📁 실제 프로젝트 구조
180
+
181
+ ### 간단한 프로젝트
182
+
183
+ ```
184
+ my-website/
185
+ ├── index.html
186
+ ├── korean-address-finder.js
187
+ ├── config.js # Git에 올리지 말 것!
188
+ └── config.example.js # 템플릿 (Git에 포함)
189
+ ```
190
+
191
+ ### 복잡한 프로젝트
192
+
193
+ ```
194
+ my-website/
195
+ ├── assets/
196
+ │ ├── js/
197
+ │ │ ├── korean-address-finder.js
198
+ │ │ └── config.js # Git에 올리지 말 것!
199
+ │ └── css/
200
+ ├── index.html
201
+ └── order.html
202
+ ```
203
+
204
+ HTML에서:
205
+ ```html
206
+ <script src="assets/js/config.js"></script>
207
+ <script src="assets/js/korean-address-finder.js"></script>
208
+ ```
209
+
210
+ ---
211
+
212
+ ## 🔧 옵션 설정
213
+
214
+ ```javascript
215
+ const finder = new KoreanAddressFinder({
216
+ // 필수: 컨테이너 ID
217
+ containerId: 'address-finder',
218
+
219
+ // 필수: API 키
220
+ apiKey: window.CONFIG.jusoApiKey,
221
+
222
+ // 선택: 주소 선택 시 콜백
223
+ onSelect: function(address) {
224
+ console.log(address);
225
+ },
226
+
227
+ // 선택: 페이지당 결과 수 (기본: 10)
228
+ countPerPage: 10
229
+ });
230
+
231
+ finder.init();
232
+ ```
233
+
234
+ ### 콜백 함수에서 받는 데이터
235
+
236
+ ```javascript
237
+ {
238
+ zipCode: "13494",
239
+ roadAddress: "경기도 성남시 분당구 판교역로 235",
240
+ jibunAddress: "경기도 성남시 분당구 삼평동 681"
241
+ }
242
+ ```
243
+
244
+ ---
245
+
246
+ ## 🎨 스타일 커스터마이징
247
+
248
+ ### CSS 클래스
249
+
250
+ 라이브러리는 다음 CSS 클래스를 사용합니다:
251
+
252
+ - `.kaf-wrapper` - 전체 래퍼
253
+ - `.kaf-search-box` - 검색 박스
254
+ - `.kaf-search-input` - 검색 입력창
255
+ - `.kaf-search-btn` - 검색 버튼
256
+ - `.kaf-results` - 결과 목록
257
+ - `.kaf-result-item` - 결과 항목
258
+ - `.kaf-selected-address` - 선택된 주소
259
+
260
+ ### 커스텀 스타일 적용
261
+
262
+ HTML에 추가:
263
+ ```html
264
+ <style>
265
+ /* 검색 버튼 색상 변경 */
266
+ .kaf-search-btn {
267
+ background-color: #ff6b6b !important;
268
+ }
269
+
270
+ /* 결과 항목 호버 색상 */
271
+ .kaf-result-item:hover {
272
+ background-color: #e3f2fd !important;
273
+ }
274
+
275
+ /* 선택된 주소 배경색 */
276
+ .kaf-selected-address {
277
+ background-color: #fff3cd !important;
278
+ border-color: #ffc107 !important;
279
+ }
280
+ </style>
281
+ ```
282
+
283
+ ---
284
+
285
+ ## ⚠️ 주의사항
286
+
287
+ ### 1. config.js는 Git에 올리지 마세요!
288
+
289
+ **.gitignore에 추가:**
290
+ ```
291
+ config.js
292
+ ```
293
+
294
+ ### 2. config.example.js는 Git에 포함
295
+
296
+ 템플릿 파일은 공유하세요:
297
+ ```javascript
298
+ // config.example.js
299
+ window.CONFIG = {
300
+ jusoApiKey: 'YOUR_API_KEY_HERE' // 설명용
301
+ };
302
+ ```
303
+
304
+ ### 3. 로컬 서버 필요
305
+
306
+ 파일을 직접 더블클릭하면 안 됩니다!
307
+ ```bash
308
+ # 로컬 서버 실행
309
+ python -m http.server 8000
310
+ ```
311
+
312
+ ### 4. API 키 종류 확인
313
+
314
+ - ✅ **검색 API** 키 사용
315
+ - ❌ 팝업 API 키는 사용 불가
316
+
317
+ ---
318
+
319
+ ## 🚀 배포 시
320
+
321
+ ### 1. config.js 서버에 생성
322
+
323
+ ```bash
324
+ # 서버에 직접 config.js 생성
325
+ nano config.js
326
+ ```
327
+
328
+ ### 2. 환경 변수 사용 (권장)
329
+
330
+ 서버 환경 변수에 API 키 저장:
331
+ ```bash
332
+ export JUSO_API_KEY=your_key_here
333
+ ```
334
+
335
+ PHP 예제:
336
+ ```php
337
+ <script>
338
+ window.CONFIG = {
339
+ jusoApiKey: '<?php echo getenv('JUSO_API_KEY'); ?>'
340
+ };
341
+ </script>
342
+ ```
343
+
344
+ ### 3. 파일 권한 설정
345
+
346
+ ```bash
347
+ chmod 600 config.js # 읽기/쓰기만 허용
348
+ ```
349
+
350
+ ---
351
+
352
+ ## 🐛 문제 해결
353
+
354
+ ### "승인되지 않은 KEY" 에러
355
+
356
+ **원인:** 팝업 API 키를 사용했거나 잘못된 키
357
+
358
+ **해결:**
359
+ 1. 검색 API 키인지 확인
360
+ 2. 새로 발급받기
361
+ 3. config.js에 정확히 입력
362
+
363
+ ### 검색 기능이 안 보임
364
+
365
+ **원인:** 스크립트 로딩 순서 문제
366
+
367
+ **해결:**
368
+ ```html
369
+ <!-- 순서 중요! -->
370
+ <script src="config.js"></script> <!-- 1 -->
371
+ <script src="korean-address-finder.js"></script> <!-- 2 -->
372
+ <script>
373
+ // 3. 초기화
374
+ const finder = new KoreanAddressFinder({...});
375
+ finder.init();
376
+ </script>
377
+ ```
378
+
379
+ ### 콘솔 에러 확인
380
+
381
+ F12 → Console 탭:
382
+ ```
383
+ ✅ Korean Address Finder 초기화 완료
384
+ ```
385
+
386
+ ---
387
+
388
+ ## 📝 체크리스트
389
+
390
+ 배포 전 확인:
391
+
392
+ - [ ] `korean-address-finder.js` 파일 포함
393
+ - [ ] `config.js` 파일 생성
394
+ - [ ] API 키 정확히 입력
395
+ - [ ] `.gitignore`에 `config.js` 추가
396
+ - [ ] 로컬 서버에서 테스트 완료
397
+ - [ ] 주소 검색 정상 작동 확인
398
+ - [ ] 폼 연동 테스트 완료
399
+
400
+ ---
401
+
402
+ ## 📚 추가 문서
403
+
404
+ - [API 키 관리 가이드](./API-KEY-GUIDE.md)
405
+ - [백엔드 프록시 서버](./examples/backend-proxy/README.md)
406
+ - [전체 문서](./README.md)
407
+
408
+ ---
409
+
410
+ **3개 파일만 있으면 됩니다!**
411
+
412
+ 1. `korean-address-finder.js` - 라이브러리
413
+ 2. `config.js` - API 키 설정
414
+ 3. `index.html` - 사용할 페이지
415
+
416
+ **끝!** 🎉
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.ko.md ADDED
@@ -0,0 +1,88 @@
1
+ # Korean Address Finder
2
+
3
+ [English](./README.md) | **한국어**
4
+
5
+ 팝업 없는 한국 주소 검색 라이브러리
6
+
7
+ ## 왜 만들었나요?
8
+
9
+ 다음 주소 API는 훌륭하지만, 몇 가지 불편한 점이 있습니다:
10
+
11
+ 1. **팝업 창이 열림** - 사용자 경험이 끊김
12
+ 2. **다음에 의존** - 서비스 중단 시 문제 발생 가능
13
+ 3. **커스터마이징 제한** - UI를 자유롭게 변경하기 어려움
14
+
15
+ 이 라이브러리는 이러한 문제를 해결합니다!
16
+
17
+ ## 주요 기능
18
+
19
+ ### 1. 팝업 없는 인라인 UI
20
+
21
+ ```
22
+ 기존 (다음 주소 API):
23
+ 페이지 → 버튼 클릭 → 새 창 열림 → 주소 선택 → 창 닫힘 → 값 전달
24
+
25
+ Korean Address Finder:
26
+ 페이지 → 입력 → 결과 표시 → 선택 → 완료 (같은 페이지에서!)
27
+ ```
28
+
29
+ ### 2. 자동완성 지원
30
+
31
+ 타이핑하는 즉시 결과가 표시됩니다. 검색 버튼을 누를 필요가 없습니다!
32
+
33
+ ### 3. 완전한 커스터마이징
34
+
35
+ 모든 스타일을 CSS로 변경할 수 있습니다. 브랜드 컬러에 맞춰 자유롭게 꾸미세요.
36
+
37
+ ## 설치 및 사용
38
+
39
+ 자세한 내용은 [README.md](./README.md)를 참조하세요.
40
+
41
+ ## 데이터 소스
42
+
43
+ 이 라이브러리는 **행정안전부 주소기반산업지원서비스 API**를 사용합니다.
44
+
45
+ - 정부 공식 데이터
46
+ - 무료로 사용 가능
47
+ - 실시간 업데이트
48
+
49
+ ## 독립적인 데이터베이스 구축
50
+
51
+ 완전히 독립적으로 운영하고 싶다면:
52
+
53
+ ### 방법 1: 공공 데이터 직접 다운로드
54
+
55
+ ```
56
+ 1. 공공데이터포털 접속
57
+ 2. "도로명주소 건물DB" 다운로드
58
+ 3. 자체 서버에 DB 구축
59
+ 4. API 서버 개발
60
+ ```
61
+
62
+ ### 방법 2: Postcodify 사용
63
+
64
+ ```bash
65
+ # Postcodify 설치
66
+ git clone https://github.com/poesis/postcodify.git
67
+
68
+ # 데이터 다운로드 및 DB 구축
69
+ # 자세한 내용은 Postcodify 문서 참조
70
+ ```
71
+
72
+ ## 로드맵
73
+
74
+ - [ ] 주소 유효성 검증 기능
75
+ - [ ] 지도 연동 (카카오맵, 네이버맵)
76
+ - [ ] 최근 검색 주소 저장
77
+ - [ ] 즐겨찾기 주소 관리
78
+ - [ ] 영문 주소 변환
79
+ - [ ] 좌표 정보 제공 (위도, 경도)
80
+ - [ ] 자체 DB 버전 (완전 독립)
81
+
82
+ ## 기여자
83
+
84
+ 여러분의 기여를 기다립니다!
85
+
86
+ ## 라이선스
87
+
88
+ MIT - 자유롭게 사용하세요!