@sushichan044/kg-core 0.9.4 → 0.9.5
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/dist/index.mjs +2 -2
- package/dist/lint.mjs +1 -1
- package/dist/{novel-composer-DRgsEA2s.mjs → novel-composer-BC8W63vw.mjs} +7 -4
- package/dist/plugin.mjs +2 -2
- package/dist/{question-or-exclamation-spacing-B5o23ZLf.mjs → question-or-exclamation-spacing-1tnZ4CLb.mjs} +10 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { c as ManuscriptOffsets, d as FontSizePt, f as FontPresetId, i as PaperSize, l as ManuscriptAppearanceSettings, n as novelComposer, o as NovelCompositionSettings, p as ParsedManuscript, r as ManuscriptGeometry, s as NovelFlowSettings, u as PaperSizeId } from "./novel-composer-
|
|
1
|
+
import { c as ValidationIssue, f as NamespacedId, g as readonlyObject, l as ManuscriptResult, p as ManuscriptRange, s as graphemeSegmenter, u as ManuscriptDiagnostic } from "./question-or-exclamation-spacing-1tnZ4CLb.mjs";
|
|
2
|
+
import { c as ManuscriptOffsets, d as FontSizePt, f as FontPresetId, i as PaperSize, l as ManuscriptAppearanceSettings, n as novelComposer, o as NovelCompositionSettings, p as ParsedManuscript, r as ManuscriptGeometry, s as NovelFlowSettings, u as PaperSizeId } from "./novel-composer-BC8W63vw.mjs";
|
|
3
3
|
import { n as assertNever, t as describeCause } from "./describe-cause-BV8mZ3Um.mjs";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
const Rejection = { schema: readonlyObject({ reason: v.string() }) };
|
package/dist/lint.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as OPENING_BRACKETS, c as ValidationIssue, d as DiagnosticSeverity, f as NamespacedId, g as readonlyObject, h as readonlyArray, i as CLOSING_BRACKETS, l as ManuscriptResult, n as leadingSpaces, o as characterClass, p as ManuscriptRange, s as graphemeSegmenter, t as questionOrExclamationSpacings, u as ManuscriptDiagnostic } from "./question-or-exclamation-spacing-1tnZ4CLb.mjs";
|
|
2
2
|
import { n as assertNever, t as describeCause } from "./describe-cause-BV8mZ3Um.mjs";
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
//#region src/proofreading/invalid-rule-options.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as OPENING_BRACKETS, f as NamespacedId, g as readonlyObject, h as readonlyArray, i as CLOSING_BRACKETS, l as ManuscriptResult, m as nonNegativeInteger, p as ManuscriptRange, r as DIVIDING_PUNCTUATION, s as graphemeSegmenter, t as questionOrExclamationSpacings } from "./question-or-exclamation-spacing-1tnZ4CLb.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
import { eastAsianWidth } from "get-east-asian-width";
|
|
4
4
|
const BoldAnnotation = { schema: readonlyObject({
|
|
@@ -237,7 +237,10 @@ function graphemeWidth(grapheme) {
|
|
|
237
237
|
let width = 1;
|
|
238
238
|
for (const character of grapheme) {
|
|
239
239
|
const codePoint = character.codePointAt(0);
|
|
240
|
-
if (codePoint !== void 0)
|
|
240
|
+
if (codePoint !== void 0) {
|
|
241
|
+
const characterWidth = "!?‼⁇⁈⁉".includes(character) ? 2 : eastAsianWidth(codePoint, { ambiguousAsWide: true });
|
|
242
|
+
width = Math.max(width, characterWidth);
|
|
243
|
+
}
|
|
241
244
|
}
|
|
242
245
|
return width / 2;
|
|
243
246
|
}
|
|
@@ -293,7 +296,7 @@ const japaneseCharacterClasses = [
|
|
|
293
296
|
const OPENING = /* @__PURE__ */ new Set(`${OPENING_BRACKETS}【〘〝⦅«`);
|
|
294
297
|
const CLOSING = /* @__PURE__ */ new Set(`${CLOSING_BRACKETS}】〙〟⦆»`);
|
|
295
298
|
const HYPHENS = /* @__PURE__ */ new Set("‐‑⁃–");
|
|
296
|
-
const
|
|
299
|
+
const DIVIDING_MARKS = new Set(DIVIDING_PUNCTUATION);
|
|
297
300
|
const MIDDLE_DOTS = /* @__PURE__ */ new Set("・:;");
|
|
298
301
|
const SMALL_KANA = /* @__PURE__ */ new Set("ァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖ");
|
|
299
302
|
const ITERATION_MARKS = /* @__PURE__ */ new Set("ヽヾゝゞ々〻");
|
|
@@ -322,7 +325,7 @@ function classify({ value, presentation }) {
|
|
|
322
325
|
if (OPENING.has(value)) return "cl-01";
|
|
323
326
|
if (CLOSING.has(value)) return "cl-02";
|
|
324
327
|
if (HYPHENS.has(value)) return "cl-03";
|
|
325
|
-
if (
|
|
328
|
+
if (DIVIDING_MARKS.has(value)) return "cl-04";
|
|
326
329
|
if (MIDDLE_DOTS.has(value)) return "cl-05";
|
|
327
330
|
if (value === "。" || value === ".") return "cl-06";
|
|
328
331
|
if (value === "、" || value === ",") return "cl-07";
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { a as logicalInlineMeasurer, p as ParsedManuscript, t as createNovelComposer } from "./novel-composer-
|
|
1
|
+
import { c as ValidationIssue, f as NamespacedId, l as ManuscriptResult } from "./question-or-exclamation-spacing-1tnZ4CLb.mjs";
|
|
2
|
+
import { a as logicalInlineMeasurer, p as ParsedManuscript, t as createNovelComposer } from "./novel-composer-BC8W63vw.mjs";
|
|
3
3
|
export { ManuscriptResult, NamespacedId, ParsedManuscript, ValidationIssue, createNovelComposer, logicalInlineMeasurer };
|
|
@@ -189,6 +189,13 @@ function characterClass(characters) {
|
|
|
189
189
|
return characters.replaceAll(/[\\\]^-]/gu, "\\$&");
|
|
190
190
|
}
|
|
191
191
|
//#endregion
|
|
192
|
+
//#region src/internal/japanese-punctuation.ts
|
|
193
|
+
/**
|
|
194
|
+
* JLReq cl-04 occupies a full em, including compound marks whose Unicode East Asian Width is
|
|
195
|
+
* neutral.
|
|
196
|
+
*/
|
|
197
|
+
const DIVIDING_PUNCTUATION = "!?‼⁇⁈⁉";
|
|
198
|
+
//#endregion
|
|
192
199
|
//#region src/internal/japanese-spaces.ts
|
|
193
200
|
const LEADING_SPACES = /^[ \t]+/u;
|
|
194
201
|
/**
|
|
@@ -203,7 +210,7 @@ function leadingSpaces(text) {
|
|
|
203
210
|
/**
|
|
204
211
|
* Runs, not single marks: `!?` is one mark and takes one gap, so the gap belongs after the run.
|
|
205
212
|
*/
|
|
206
|
-
const MARKS =
|
|
213
|
+
const MARKS = new RegExp(`[${characterClass(DIVIDING_PUNCTUATION)}]+`, "gu");
|
|
207
214
|
function analyzeMatch(line, marks) {
|
|
208
215
|
const start = marks.index;
|
|
209
216
|
if (start === void 0) return void 0;
|
|
@@ -240,7 +247,7 @@ function analyzeMatch(line, marks) {
|
|
|
240
247
|
};
|
|
241
248
|
}
|
|
242
249
|
/**
|
|
243
|
-
* Classifies the spacing after each run of
|
|
250
|
+
* Classifies the spacing after each run of Japanese question or exclamation marks in one display
|
|
244
251
|
* line. Runs at the end of the line or immediately before a closing bracket need no gap and are
|
|
245
252
|
* omitted from the result.
|
|
246
253
|
*/
|
|
@@ -248,4 +255,4 @@ function questionOrExclamationSpacings(line) {
|
|
|
248
255
|
return [...line.matchAll(MARKS)].map((marks) => analyzeMatch(line, marks)).filter((spacing) => spacing !== void 0);
|
|
249
256
|
}
|
|
250
257
|
//#endregion
|
|
251
|
-
export {
|
|
258
|
+
export { OPENING_BRACKETS as a, ValidationIssue as c, DiagnosticSeverity as d, NamespacedId as f, readonlyObject as g, readonlyArray as h, CLOSING_BRACKETS as i, ManuscriptResult as l, nonNegativeInteger as m, leadingSpaces as n, characterClass as o, ManuscriptRange as p, DIVIDING_PUNCTUATION as r, graphemeSegmenter as s, questionOrExclamationSpacings as t, ManuscriptDiagnostic as u };
|