ja-input-mask 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,11 @@
1
+ # 利用例 / Examples
2
+
3
+ | 環境 | ソース |
4
+ | --- | --- |
5
+ | Vanilla JS | [vanilla.html](vanilla.html) と [vanilla.js](vanilla.js) |
6
+ | React | [PostalField.tsx](PostalField.tsx) |
7
+ | Vue 3 | [PostalField.vue](PostalField.vue) |
8
+
9
+ 各例は、`ja-input-mask` をインストールしたプロジェクトに配置して使えます。Vanilla JSのHTMLはViteなど、npmのモジュール名を解決する開発サーバーで開いてください。バンドラーなしで動作する構成は、リポジトリで `npm run demo` を実行すると確認できます。ReactとVueではDOMアダプターが入力欄を更新し、フレームワーク側は `onChange` の結果を他の表示に利用します。
10
+
11
+ Copy the relevant files into a project that has `ja-input-mask` installed. Open the Vanilla example with a server such as Vite that resolves npm imports. The repository's `npm run demo` serves a browser-native module example. In the React and Vue examples, the adapter owns edits to the field and framework state reflects the callback result.
@@ -0,0 +1,9 @@
1
+ <!doctype html>
2
+ <html lang="ja">
3
+ <meta charset="utf-8">
4
+ <title>郵便番号の入力例</title>
5
+ <label for="postal">郵便番号</label>
6
+ <input id="postal" type="text" inputmode="numeric" autocomplete="postal-code">
7
+ <output id="raw" for="postal"></output>
8
+ <script type="module" src="./vanilla.js"></script>
9
+ </html>
@@ -0,0 +1,11 @@
1
+ import { attachInputMask } from 'ja-input-mask/dom'
2
+
3
+ const input = document.querySelector('#postal')
4
+ const output = document.querySelector('#raw')
5
+
6
+ export const controller = attachInputMask(input, {
7
+ mask: { preset: 'postalCode' },
8
+ onChange({ rawValue }) { output.textContent = rawValue },
9
+ })
10
+ controller.sync()
11
+ // Call controller.detach() if you remove or reuse this field.
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
1
  {
2
2
  "name": "ja-input-mask",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "IME-aware input masks for Japanese web forms",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "license": "MIT",
8
+ "author": "Fusai Hanabi",
9
+ "repository": { "type": "git", "url": "git+https://github.com/fusaihanabi/ja-input-mask.git" },
10
+ "keywords": ["japanese", "input-mask", "ime", "forms", "typescript"],
11
+ "exports": {
12
+ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
13
+ "./core": { "types": "./dist/core.d.ts", "import": "./dist/core.js" },
14
+ "./dom": { "types": "./dist/dom.d.ts", "import": "./dist/dom.js" }
15
+ },
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "files": ["dist", "README.en.md", "CHANGELOG.md", "NOTICE", "docs", "examples"],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "build:demo": "npm run build && node scripts/build-demo.mjs",
22
+ "demo": "npm run build:demo && node scripts/serve-demo.mjs",
23
+ "typecheck": "tsc --noEmit",
24
+ "test": "npm run build && node --test test/unit/core.test.mjs",
25
+ "test:browser": "npm run build:demo && playwright test",
26
+ "check:package": "npm run build && node scripts/check-package.mjs",
27
+ "prepack": "npm run build",
28
+ "prepublishOnly": "npm test && npm run check:package"
29
+ },
30
+ "devDependencies": {
31
+ "@playwright/test": "1.65.1",
32
+ "typescript": "5.9.3"
33
+ }
34
+ }