specqr 1.0.0-rc.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,28 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0-rc.1 - 2026-05-17
4
+
5
+ SpecQR の v1 target は、dependency-free な JavaScript QR Code Model 2 generator として、実用上安全な通常 QR generation に集中します。
6
+
7
+ ### 含まれるもの
8
+
9
+ - QR Code Model 2 versions 1 through 40。
10
+ - Error correction levels L, M, Q, H。
11
+ - Numeric、alphanumeric、UTF-8 byte、QR Kanji、binary、ECI、manual segments、automatic mixed segmentation。
12
+ - GS1 QR Code / FNC1 first position と、対応 AI に限定した human-readable parser / element-string helper。
13
+ - Matrix、SVG、SVG Data URL、PNG、PNG Data URL、browser canvas、Node PNG、browser Blob/ImageData/Object URL output。
14
+ - Version / mask selection、capacity、codeword counts、quiet zone、color contrast、scan risk、print sizing の diagnostics。
15
+ - Golden conformance fixtures、decoder validation、jsQR independent decoder validation、release-candidate smoke tests、package smoke tests。
16
+
17
+ ### 意図的な制限
18
+
19
+ - FNC1 second position は未対応。
20
+ - Full GS1 AI catalog、industry-specific GS1 validation、check-digit validation は未対応。
21
+ - Structured Append、Micro QR、rMQR、Frame QR、SQRC、logo overlay、styled modules、playground は未対応。
22
+ - Package は ESM-first。CommonJS と minified browser build は、将来 build pipeline を導入するまで保留。
23
+
24
+ ### Publish Checklist
25
+
26
+ - `npm test`, `npm run verify:decode`, `npm run verify:decode:jsqr`, `npm run verify:decode:optional`, `npm pack --dry-run` を実行する。
27
+ - publish 前に `npm publish --dry-run` を実行する。
28
+ - RC は `latest` ではなく、`next` などの npm dist tag で公開する。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SpecQR contributors
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.md ADDED
@@ -0,0 +1,254 @@
1
+ # SpecQR
2
+
3
+ SpecQR is a dependency-free JavaScript QR Code Model 2 generator. It focuses on standards-conscious QR generation with SVG, PNG, matrix, diagnostics, Kanji, ECI, and GS1/FNC1 support.
4
+
5
+ Repository: https://github.com/SpecQR/SpecQR
6
+
7
+ SpecQR は、通常の QR Code Model 2 を JavaScript だけで生成するためのライブラリです。実用上「生成はできるが読めない」「仕様端で壊れる」「環境で挙動が変わる」問題を避けるため、v1 では対応範囲を明確に絞り、テストとデコード検証を厚めに置いています。
8
+
9
+ ## インストール
10
+
11
+ ```sh
12
+ npm install specqr@1.0.0-rc.1
13
+ ```
14
+
15
+ ## v1 RC の対応範囲
16
+
17
+ - QR Code Model 2
18
+ - Version 1 から 40
19
+ - 誤り訂正レベル L, M, Q, H
20
+ - Numeric / alphanumeric / UTF-8 byte mode
21
+ - Shift_JIS ベースの QR Kanji mode
22
+ - 自動 mixed-segment optimization
23
+ - binary input と manual segment input
24
+ - GS1 QR Code / FNC1 first position
25
+ - 対応 AI に限定した GS1 human-readable parser / element string helper
26
+ - `matrix`, `svg`, Data URL, PNG, canvas output
27
+ - Node PNG helper と browser Blob/ImageData/Object URL helper
28
+ - capacity、mask/version selection、contrast、quiet zone、print warning を含む diagnostics
29
+
30
+ Micro QR、rMQR、logo overlay、styled modules、FNC1 second position、Structured Append は v1 RC の対象外です。
31
+
32
+ ## 基本的な使い方
33
+
34
+ ```js
35
+ import { QRCode } from "specqr";
36
+
37
+ const svg = QRCode.generate("https://example.com", {
38
+ errorCorrectionLevel: "M",
39
+ output: "svg"
40
+ });
41
+ ```
42
+
43
+ Data URL や PNG bytes も返せます。
44
+
45
+ ```js
46
+ const dataUrl = QRCode.generate("https://example.com", {
47
+ output: "png-data-url"
48
+ });
49
+
50
+ const pngBytes = QRCode.generate("https://example.com", {
51
+ output: "png"
52
+ });
53
+ ```
54
+
55
+ ブラウザの canvas に直接描画できます。
56
+
57
+ ```js
58
+ const canvas = document.querySelector("canvas");
59
+
60
+ QRCode.drawToCanvas(canvas, "https://example.com", {
61
+ scale: 8,
62
+ margin: 4
63
+ });
64
+ ```
65
+
66
+ matrix と diagnostics を取得する例です。
67
+
68
+ ```js
69
+ const result = QRCode.generate("hello", {
70
+ output: "matrix",
71
+ diagnostics: true
72
+ });
73
+
74
+ console.log(result.matrix);
75
+ console.log(result.diagnostics);
76
+ ```
77
+
78
+ ## セグメント最適化
79
+
80
+ `mode: "auto"` では、入力に応じて numeric、alphanumeric、kanji、byte のセグメントを自動で選びます。
81
+
82
+ ```js
83
+ QRCode.generate("ORDER-1234567890-こんにちは", {
84
+ mode: "auto",
85
+ optimizeSegments: true
86
+ });
87
+ ```
88
+
89
+ QR Kanji mode で表現できる日本語は、自動的に compact な Kanji segment になります。
90
+
91
+ ```js
92
+ const result = QRCode.generate("こんにちは漢字", {
93
+ output: "matrix",
94
+ diagnostics: true
95
+ });
96
+
97
+ console.log(result.diagnostics.mode); // "kanji"
98
+ ```
99
+
100
+ 同じ Version に収まる範囲で誤り訂正レベルを上げたい場合は `boostErrorCorrection` を使います。
101
+
102
+ ```js
103
+ QRCode.generate("HELLO", {
104
+ errorCorrectionLevel: "L",
105
+ boostErrorCorrection: true
106
+ });
107
+ ```
108
+
109
+ UTF-8 byte data であることを ECI で明示する例です。
110
+
111
+ ```js
112
+ QRCode.generate("こんにちは", {
113
+ eci: true
114
+ });
115
+ ```
116
+
117
+ ## GS1 QR Code / FNC1 first position
118
+
119
+ GS1 QR Code を生成する場合は、human-readable GS1 text を parse して raw GS1 element string に変換し、`gs1: true` を指定します。
120
+
121
+ ```js
122
+ import { QRCode, createGs1ElementString, parseGs1HumanReadable } from "specqr";
123
+
124
+ const elements = parseGs1HumanReadable("(01)04912345678904(10)ABC123(17)251231");
125
+ const data = createGs1ElementString(elements);
126
+
127
+ const svg = QRCode.generate(data, {
128
+ gs1: true,
129
+ output: "svg"
130
+ });
131
+ ```
132
+
133
+ `parseGs1HumanReadable()` は対応 AI の parentheses 表記を `{ ai, value }[]` に変換します。`createGs1ElementString()` は値を検証し、可変長 AI の後に別の AI が続く場合だけ ASCII GS separator (`"\x1D"`) を挿入します。AI values は先頭ゼロを保持するため string で渡してください。全 GS1 AI catalog、業界別 validation、check digit validation は v1 RC の対象外です。
134
+
135
+ ## バイナリ入力
136
+
137
+ byte-perfect な payload を扱う場合は `Uint8Array`、`ArrayBuffer`、`ArrayBufferView`、または byte array を渡せます。
138
+
139
+ ```js
140
+ const matrix = QRCode.generate(new Uint8Array([0x00, 0x01, 0x02, 0xFF]), {
141
+ output: "matrix"
142
+ });
143
+
144
+ QRCode.generate([0x41, 0x42, 0x43], {
145
+ output: "png"
146
+ });
147
+ ```
148
+
149
+ ## Manual segments
150
+
151
+ QR mode を利用者側で制御したい場合は `generateSegments()` を使います。
152
+
153
+ ```js
154
+ const svg = QRCode.generateSegments([
155
+ { mode: "alphanumeric", data: "ORDER-" },
156
+ { mode: "numeric", data: "1234567890" },
157
+ { mode: "kanji", data: "こんにちは" }
158
+ ], {
159
+ output: "svg"
160
+ });
161
+ ```
162
+
163
+ ## Diagnostics
164
+
165
+ `diagnostics: true` を指定すると、選ばれた Version、mask、capacity、warnings などを取得できます。
166
+
167
+ ```js
168
+ const result = QRCode.generate("HELLO", {
169
+ output: "png",
170
+ diagnostics: true,
171
+ margin: 2,
172
+ foreground: "#777777",
173
+ background: "#888888",
174
+ printDpi: 600
175
+ });
176
+
177
+ console.log(result.diagnostics.warnings);
178
+ ```
179
+
180
+ ## Node helpers
181
+
182
+ Node 専用 helper は `specqr/node` から import します。
183
+
184
+ ```js
185
+ import { writePngFile, toPngBuffer } from "specqr/node";
186
+
187
+ await writePngFile("qr.png", "https://example.com");
188
+ const buffer = toPngBuffer("https://example.com");
189
+ ```
190
+
191
+ ## Browser helpers
192
+
193
+ ブラウザ向け helper は `specqr/browser` から import します。
194
+
195
+ ```js
196
+ import { toBlob, toImageData, toObjectURL } from "specqr/browser";
197
+
198
+ const blob = toBlob("https://example.com");
199
+ const imageData = toImageData("https://example.com");
200
+ const url = toObjectURL("https://example.com");
201
+ ```
202
+
203
+ ## Errors
204
+
205
+ エラーは安定した class と `code` field を持ちます。
206
+
207
+ ```js
208
+ import { DataTooLongError, QRCode } from "specqr";
209
+
210
+ try {
211
+ QRCode.generate("x".repeat(100), { version: 1 });
212
+ } catch (error) {
213
+ if (error instanceof DataTooLongError) {
214
+ console.error(error.code);
215
+ }
216
+ }
217
+ ```
218
+
219
+ ## 開発と検証
220
+
221
+ ```sh
222
+ npm test
223
+ ```
224
+
225
+ `npm test` には、固定 Version / 誤り訂正 / mask の golden conformance fixture が含まれます。matrix rows、codewords、diagnostics、format bits、version bits、remainder bits の代表ケースを固定しています。
226
+
227
+ QR 構築ロジックの意図した変更を受け入れる場合だけ、snapshot を更新します。
228
+
229
+ ```sh
230
+ npm run fixtures:golden
231
+ npm test
232
+ ```
233
+
234
+ macOS では Vision を使った fixture decode validation も実行できます。
235
+
236
+ ```sh
237
+ npm run verify:decode
238
+ ```
239
+
240
+ ローカルに利用可能な decoder がある場合は optional multi-decoder validation も使えます。
241
+
242
+ ```sh
243
+ npm run verify:decode:optional
244
+ ```
245
+
246
+ この optional script は `jsqr`、`zbarimg`、ZXing 系 CLI を検出し、未導入の decoder は skip します。
247
+
248
+ portable な独立 decoder release gate として、jsQR-backed check も用意しています。
249
+
250
+ ```sh
251
+ npm run verify:decode:jsqr
252
+ ```
253
+
254
+ `jsqr` は devDependency のみです。SpecQR の runtime package は dependency-free のままです。
package/docs/api.md ADDED
@@ -0,0 +1,226 @@
1
+ # API
2
+
3
+ この文書は SpecQR `1.0.0-rc.1` の公開 API を説明します。API 名、option 名、型名、error class 名は JavaScript/TypeScript から利用する識別子なので英語のままです。
4
+
5
+ ## Core
6
+
7
+ ### `QRCode.generate(input, options)`
8
+
9
+ JavaScript string、byte array、`Uint8Array`、`ArrayBuffer`、`ArrayBufferView` から QR Code を生成します。
10
+
11
+ ```js
12
+ import { QRCode } from "specqr";
13
+
14
+ const svg = QRCode.generate("https://example.com", {
15
+ errorCorrectionLevel: "M",
16
+ version: "auto",
17
+ minVersion: 1,
18
+ maxVersion: 40,
19
+ maskPattern: "auto",
20
+ mode: "auto",
21
+ encoding: "utf-8",
22
+ optimizeSegments: true,
23
+ margin: 4,
24
+ scale: 8,
25
+ foreground: "#000000",
26
+ background: "#ffffff",
27
+ output: "svg",
28
+ boostErrorCorrection: false,
29
+ eci: false,
30
+ gs1: false,
31
+ diagnostics: false,
32
+ printDpi: null
33
+ });
34
+ ```
35
+
36
+ ### `QRCode.generateSegments(segments, options)`
37
+
38
+ 呼び出し側が明示した segment から QR Code を生成します。対応する segment mode は `fnc1`, `eci`, `numeric`, `alphanumeric`, `byte`, `kanji` です。
39
+
40
+ ```js
41
+ QRCode.generateSegments([
42
+ { mode: "alphanumeric", data: "ORDER-" },
43
+ { mode: "numeric", data: "1234567890" },
44
+ { mode: "kanji", data: "漢字" },
45
+ { mode: "byte", data: new Uint8Array([0x41, 0x42, 0x43]) }
46
+ ]);
47
+ ```
48
+
49
+ ### `QRCode.drawToCanvas(target, input, options)`
50
+
51
+ ブラウザの canvas element、または 2D rendering context に直接描画します。
52
+
53
+ ```js
54
+ const canvas = document.querySelector("canvas");
55
+
56
+ QRCode.drawToCanvas(canvas, "https://example.com", {
57
+ scale: 8,
58
+ margin: 4
59
+ });
60
+ ```
61
+
62
+ ## Options
63
+
64
+ - `errorCorrectionLevel`: `"L" | "M" | "Q" | "H"`。default は `"M"`。
65
+ - `version`: `1..40 | "auto"`。default は `"auto"`。
66
+ - `minVersion`: `1..40`。default は `1`。
67
+ - `maxVersion`: `1..40`。default は `40`。
68
+ - `maskPattern`: `0..7 | "auto"`。default は `"auto"`。
69
+ - `mode`: `"auto" | "numeric" | "alphanumeric" | "byte" | "kanji"`。`"auto"` は効率のよい QR segment を自動選択します。
70
+ - `encoding`: 現在は byte-mode string input 向けの `"utf-8"` のみ。
71
+ - `optimizeSegments`: `mode` が `"auto"` のとき、numeric、alphanumeric、kanji、byte を混在 segment に分割して bit length を減らします。default は `true`。
72
+ - `margin`: quiet zone の module 数。default は `4`。
73
+ - `scale`: SVG/PNG/canvas/ImageData output での 1 module の pixel size。default は `8`。
74
+ - `foreground`: dark module color。default は `"#000000"`。
75
+ - `background`: light module color。default は `"#ffffff"`。
76
+ - `output`: `"matrix" | "svg" | "svg-data-url" | "png" | "png-data-url"`。default は `"svg"`。
77
+ - `boostErrorCorrection`: `true` の場合、選択 Version を増やさずに収まる範囲で error correction level を上げます。default は `false`。
78
+ - `eci`: `false | true | number`。default は `false`。`true` は UTF-8 ECI assignment number `26` を挿入し、auto-selected non-ASCII text を byte mode に保ちます。
79
+ - `gs1`: boolean。default は `false`。`true` の場合、GS1 QR Code 用に QR FNC1 first position (`0101`) を先頭に挿入します。この実装では ECI と併用できません。
80
+ - `diagnostics`: `true` の場合、生成詳細と warnings を返します。
81
+ - `printDpi`: print-size diagnostics のための optional DPI。生成結果そのものには影響しません。
82
+
83
+ ## GS1 / FNC1 First Position
84
+
85
+ `gs1: true` は、入力が raw GS1 element string である場合に使います。QR Code の FNC1 first position mode indicator を先頭に挿入します。
86
+
87
+ ```js
88
+ import { QRCode, createGs1ElementString, parseGs1HumanReadable } from "specqr";
89
+
90
+ const elements = parseGs1HumanReadable("(01)04912345678904(10)ABC123(17)251231");
91
+ const data = createGs1ElementString(elements);
92
+
93
+ const svg = QRCode.generate(data, {
94
+ gs1: true,
95
+ output: "svg"
96
+ });
97
+ ```
98
+
99
+ manual segment でも FNC1 first position を明示できます。
100
+
101
+ ```js
102
+ QRCode.generateSegments([
103
+ { mode: "fnc1" },
104
+ { mode: "numeric", data: "0104912345678904" },
105
+ { mode: "alphanumeric", data: "10ABC123" }
106
+ ]);
107
+ ```
108
+
109
+ ### GS1 Helpers
110
+
111
+ - `parseGs1HumanReadable(input)`: `(01)04912345678904(10)ABC123(17)251231` のような parentheses-based input を `{ ai, value }[]` に変換します。
112
+ - `createGs1ElementString(elements)`: 対応 AI の `{ ai, value }` string entries を検証し、QR input として使う raw GS1 element string を返します。leading zero を保持するため、AI values は string で渡す必要があります。
113
+ - `GS1_FNC1_SEPARATOR`: 可変長 AI の後に別の element が続く場合に挿入される ASCII GS separator `"\x1D"` です。
114
+
115
+ helper が対応する代表 AI は次の範囲です。
116
+
117
+ - fixed length: `00`, `01`, `02`, `11`, `12`, `13`, `15`, `16`, `17`, `20`, `410` through `415`, `3100` through `3105`, `3200` through `3205`
118
+ - variable length: `10`, `21`, `22`, `30`, `37`, `240`, `241`, `400`, `420`, `91` through `99`
119
+
120
+ validation は、対応 AI format、fixed/max length、numeric-only AI、printable ASCII text values、raw value 内の separator/parentheses rejection を対象にします。可変長 AI の後に別の element が続く場合は `"\x1D"` を挿入し、最後の可変長 AI は separator なしで終端します。
121
+
122
+ 全 GS1 AI catalog、業界別 AI rule、check digit validation、FNC1 second position は v1 RC の対象外です。
123
+
124
+ ## Return Values
125
+
126
+ `output` が `"svg"` の場合、`generate()` は SVG string を返します。
127
+
128
+ `output` が `"matrix"` の場合、二次元 boolean matrix を返します。
129
+
130
+ `output` が `"svg-data-url"` または `"png-data-url"` の場合、Data URL string を返します。
131
+
132
+ `output` が `"png"` の場合、PNG `Uint8Array` を返します。
133
+
134
+ PNG と ImageData output は `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `"black"`, `"white"`, `"transparent"` colors に対応します。
135
+
136
+ `diagnostics` が true の場合は次の形を返します。
137
+
138
+ ```js
139
+ {
140
+ matrix,
141
+ svg,
142
+ diagnostics: {
143
+ version,
144
+ size,
145
+ errorCorrectionLevel,
146
+ requestedErrorCorrectionLevel,
147
+ boostedErrorCorrection,
148
+ versionSelection,
149
+ versionSelectionReason,
150
+ maskPattern,
151
+ maskPenalty,
152
+ maskPenalties,
153
+ maskSelectionReason,
154
+ mode,
155
+ eciAssignmentNumber,
156
+ fnc1,
157
+ gs1,
158
+ segments,
159
+ dataBitLength,
160
+ capacityBits,
161
+ remainingBits,
162
+ capacityUtilization,
163
+ inputBytes,
164
+ dataCodewords,
165
+ errorCorrectionCodewords,
166
+ totalCodewords,
167
+ quietZone,
168
+ colors,
169
+ print,
170
+ warnings
171
+ }
172
+ }
173
+ ```
174
+
175
+ ## Node Helpers
176
+
177
+ `specqr/node` subpath は Node-only の file / Buffer helper を core entrypoint から分離します。
178
+
179
+ ```js
180
+ import { toPngBuffer, writePngFile } from "specqr/node";
181
+
182
+ const buffer = toPngBuffer("https://example.com");
183
+ await writePngFile("qr.png", "https://example.com");
184
+ ```
185
+
186
+ 利用可能な helper:
187
+
188
+ - `toPngBuffer(input, options)`
189
+ - `toPngBufferFromSegments(segments, options)`
190
+ - `writePngFile(path, input, options)`
191
+ - `writePngFileFromSegments(path, segments, options)`
192
+
193
+ ## Browser Helpers
194
+
195
+ `specqr/browser` subpath は browser convenience helper を提供します。
196
+
197
+ ```js
198
+ import { toBlob, toImageData, toObjectURL } from "specqr/browser";
199
+
200
+ const blob = toBlob("https://example.com");
201
+ const imageData = toImageData("https://example.com");
202
+ const objectUrl = toObjectURL("https://example.com");
203
+ ```
204
+
205
+ 利用可能な helper:
206
+
207
+ - `toBlob(input, options)`
208
+ - `toBlobFromSegments(segments, options)`
209
+ - `toObjectURL(input, options)`
210
+ - `toObjectURLFromSegments(segments, options)`
211
+ - `toImageData(input, options)`
212
+ - `toImageDataFromSegments(segments, options)`
213
+
214
+ ## Errors
215
+
216
+ SpecQR は安定した error class と `code` field を export します。
217
+
218
+ - `DataTooLongError`
219
+ - `InvalidInputError`
220
+ - `InvalidVersionError`
221
+ - `InvalidModeError`
222
+ - `InvalidColorError`
223
+ - `InvalidEciError`
224
+ - `InvalidGs1Error`
225
+ - `InvalidOutputError`
226
+ - `InvalidCanvasTargetError`
@@ -0,0 +1,75 @@
1
+ # 仕様対応範囲
2
+
3
+ ## Target
4
+
5
+ SpecQR `1.0.0-rc.1` は、実務で使う通常の QR Code Model 2 generation を対象にします。v1 RC では「通常 QR Code を安定して生成する」ことを優先し、別系統の QR family や装飾機能は core に混ぜません。
6
+
7
+ ## 実装済み範囲
8
+
9
+ - QR Code Model 2 のみ
10
+ - Version 1 から 40
11
+ - Error correction levels L, M, Q, H
12
+ - JavaScript string input
13
+ - byte array、`Uint8Array`、`ArrayBuffer`、`ArrayBufferView` binary input
14
+ - Numeric mode
15
+ - Alphanumeric mode
16
+ - UTF-8 byte mode
17
+ - QR Kanji ranges で表現できる文字向けの Shift_JIS-based QR Kanji mode
18
+ - `fnc1`, `numeric`, `alphanumeric`, `byte`, `kanji`, `eci` の manual segment API
19
+ - Automatic mixed-segment optimization
20
+ - UTF-8 と explicit assignment number 向けの optional ECI metadata
21
+ - GS1 QR Code / FNC1 first position mode
22
+ - 代表的な fixed-length / variable-length AI 向けの GS1 element string helper と human-readable parser
23
+ - 選択 Version を増やさない optional error correction boosting
24
+ - Automatic version selection
25
+ - Automatic mask selection
26
+ - Matrix output
27
+ - SVG output
28
+ - SVG Data URL output
29
+ - PNG output
30
+ - PNG Data URL output
31
+ - Browser canvas drawing
32
+ - Node PNG buffer/file helpers
33
+ - Browser Blob/ImageData/Object URL helpers
34
+ - quiet zone、contrast、capacity、mask/version selection、scan risk、print DPI の diagnostics / warnings
35
+
36
+ ## Compatibility Notes
37
+
38
+ Kanji mode は、platform の `TextDecoder("shift_jis")` 実装を使って Unicode character を QR-compatible Shift_JIS double-byte value に対応付けます。runtime が Shift_JIS `TextDecoder` を持たない場合、explicit Kanji mode は input を reject し、auto mode は byte mode に fallback します。
39
+
40
+ `eci: true` は byte-mode text が UTF-8 であることを明示するための option です。そのため、ECI が有効な場合、auto segmentation は non-ASCII text を byte mode に保ちます。explicit manual Kanji segment は引き続き利用できます。
41
+
42
+ `gs1: true` は FNC1 first position を先頭に挿入し、input が raw GS1 element string であることを期待します。`parseGs1HumanReadable()` は対応 AI の parentheses notation を `{ ai, value }[]` に変換し、`createGs1ElementString()` は値を検証して、必要な位置に ASCII GS (`"\x1D"`) separator を挿入します。全 GS1 AI catalog validation、業界別 AI rule、check digit validation、FNC1 second position はこの phase には含めません。ECI と GS1/FNC1 first position は control-mode ordering が曖昧になるため併用を reject します。
43
+
44
+ package は ESM-first です。`specqr`, `specqr/node`, `specqr/browser` の separate export を持ちます。CommonJS と minified browser build は build pipeline を導入するまで生成しません。source package は dependency-free runtime を保ちます。
45
+
46
+ ## v1 RC で意図的に対象外とするもの
47
+
48
+ 次の機能は core Model 2 package には実装していません。
49
+
50
+ - FNC1 second position
51
+ - Full GS1 AI catalog validation
52
+ - Industry-specific GS1 AI rules
53
+ - GS1 check digit validation
54
+ - Structured Append
55
+ - Micro QR
56
+ - rMQR
57
+ - Frame QR
58
+ - SQRC
59
+ - Logo overlay
60
+ - Styled modules
61
+ - Browser playground
62
+
63
+ ## v1 後の Roadmap
64
+
65
+ 通常 QR Code Model 2 以外の symbol family や domain extension は、core に直接混ぜず、別 module として扱う方針です。
66
+
67
+ - `@specqr/gs1`: full GS1 AI validation、check-digit helpers、追加の GS1 domain helpers
68
+ - `@specqr/structured-append`: multi-symbol splitting
69
+ - `@specqr/micro`: Micro QR implementation
70
+ - `@specqr/rmqr`: rectangular QR implementation
71
+ - `@specqr/styled`: logo / module styling helpers と scan-risk diagnostics
72
+
73
+ ## Design Principle
74
+
75
+ core generator は optional platform helper から独立させます。Matrix generation、Reed-Solomon error correction、data placement、mode encoding、mask selection は、browser や Node file system API なしで test できる状態を保ちます。