From 3a40c1af8965a1ea65de35a948bc0e30f7136b78 Mon Sep 17 00:00:00 2001 From: Sin-Kang Date: Sun, 5 Jul 2026 22:23:37 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20v0.2.0=20=E2=80=94=20DOM=20?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=96=B4=20+=20=EB=B8=8C=EB=9D=BC=EC=9A=B0?= =?UTF-8?q?=EC=A0=80=20=EC=A0=84=EC=97=AD=20=EB=B9=8C=EB=93=9C=20+=20?= =?UTF-8?q?=ED=99=88=ED=8E=98=EC=9D=B4=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - bind/observe: 입력 모드 강제 (IME 조합 중 미개입, compositionend 후 변환, prefix 변환으로 커서 보존) - ko 모드는 enToKo(koToEn(v)) 정규화로 점진 타이핑이 실제 IME처럼 조합됨 - IIFE 빌드 dist/kokey.global.js (5KB min) + unpkg/jsdelivr 필드 - site/ 라이브 데모 + pages.yml (공식 Pages actions, main 푸시마다 배포) - jsdom 테스트 9개 추가 (24 total) --- .github/workflows/pages.yml | 50 ++++ CHANGELOG.md | 17 ++ README.ko.md | 32 ++- README.md | 34 ++- package-lock.json | 510 +++++++++++++++++++++++++++++++++++- package.json | 5 +- site/index.html | 124 +++++++++ src/browser.ts | 2 + src/dom.test.ts | 128 +++++++++ src/dom.ts | 133 ++++++++++ src/index.ts | 2 + tsconfig.json | 2 +- tsup.config.ts | 27 +- 13 files changed, 1049 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/pages.yml create mode 100644 site/index.html create mode 100644 src/browser.ts create mode 100644 src/dom.test.ts create mode 100644 src/dom.ts diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..71b8794 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,50 @@ +name: Deploy site + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + deploy: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/checkout@v5 + + - uses: actions/setup-node@v5 + with: + node-version: 22 + cache: npm + + - run: npm ci + - run: npm run build + + - name: Assemble site + run: | + mkdir -p _site + cp -r site/. _site/ + cp dist/kokey.global.js _site/ + cp dist/kokey.global.js.map _site/ + + - uses: actions/configure-pages@v5 + with: + enablement: true + + - uses: actions/upload-pages-artifact@v3 + with: + path: _site + + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index fef6a95..7095eb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 0.2.0 (2026-07-05) + +### Added + +- **DOM layer** — `bind(el, mode?)` and `observe(root?)` enforce an input + mode on `` regardless of IME state. + Composition-safe (never touches the value mid-IME-composition), cursor + preserved via prefix conversion. + **DOM 레이어** — IME 상태와 무관하게 인풋 모드 강제. 조합 중 미개입, + 커서 보존. +- **Browser global build** — `dist/kokey.global.js` (IIFE, minified) with + `unpkg`/`jsdelivr` fields, usable via + ` + +``` + ## 사용법 ```ts @@ -44,20 +54,38 @@ enToKo('ekfrl') // '달기' (겹받침 분해 — 실제 IME와 동일 - **통과 처리**: 숫자·문장부호·미매핑 문자는 그대로 유지 - 한글 텍스트 왕복 보장: `enToKo(koToEn(s)) === s` +### DOM 레이어 — 입력 모드 강제 + +사용자 IME 상태와 무관하게 ``/` +
+
+ + + +

Install

+
# npm
+npm install kokey
+
+# CDN — no build step
+<script src="https://cdn.jsdelivr.net/npm/kokey/dist/kokey.global.js"></script>
+ +

Usage

+
import { koToEn, enToKo, observe } from 'kokey'
+
+koToEn('안녕')   // 'dkssud'
+enToKo('dkssud') // '안녕' — 겹모음·겹받침·받침 넘김까지 실제 IME 그대로
+
+// DOM: data-hangul 인풋을 전부 자동 바인딩
+observe() // <input data-hangul="ko|en">
+ + + + + + + diff --git a/src/browser.ts b/src/browser.ts new file mode 100644 index 0000000..08c0bcc --- /dev/null +++ b/src/browser.ts @@ -0,0 +1,2 @@ +/** IIFE entry — everything under a single `kokey` global for