@sushichan044/kg-core 0.9.2 → 0.9.3
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/README.md +12 -3
- package/dist/{composed-manuscript-QgIdae8p.d.mts → composed-manuscript-C0f3mxKs.d.mts} +52 -52
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/lint.d.mts +1 -1
- package/dist/{novel-composer-CNBT4TDN.mjs → novel-composer-DRgsEA2s.mjs} +17 -6
- package/dist/{novel-composer-BCt9g172.d.mts → novel-composer-DhycV9B3.d.mts} +1 -1
- package/dist/plugin.d.mts +2 -2
- package/dist/plugin.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,8 +81,11 @@ The composer classifies the core prose classes from JLReq, resolves pair spacing
|
|
|
81
81
|
and selects line breaks over the whole source paragraph. The space between two
|
|
82
82
|
classes follows appendix 表1 of JLReq: a half em before an opening bracket and after
|
|
83
83
|
a closing bracket, comma, or full stop, a quarter em on either side of a middle dot,
|
|
84
|
-
a quarter em between Japanese and a numeral, unit symbol, or Western character
|
|
85
|
-
solid where two of those punctuation marks
|
|
84
|
+
a quarter em between Japanese and a numeral, unit symbol, or a Western character rotated
|
|
85
|
+
90 degrees or mixed into horizontal text, and solid where two of those punctuation marks
|
|
86
|
+
meet. JLReq 3.2.4 sets that quarter em's scope: a Western character set upright — one letter,
|
|
87
|
+
an all-caps or `Xxx` abbreviation, a lone digit, or a full-width letter — classes with kanji
|
|
88
|
+
instead and sits solid against the kana or kanji beside it, the same as a tate-chu-yoko run.
|
|
86
89
|
|
|
87
90
|
A western word space is not a character with a box but an アキ of its own: a third em
|
|
88
91
|
by rule rather than by measurement, nothing at all at a line head or a line end, and
|
|
@@ -100,7 +103,8 @@ added equally to the admitted pairs in 表6 that are solid at rest, including pa
|
|
|
100
103
|
the third stage. Intrinsic spaces keep their finite limits: a word space and a mixed
|
|
101
104
|
Japanese-to-Western, numeral, or unit-symbol gap stop at a half em, while punctuation and
|
|
102
105
|
explicit full-em spaces retain their own width. This keeps the unbounded stage from producing
|
|
103
|
-
|
|
106
|
+
double space or a hole disproportionate to a horizontal Western run's own length, since an
|
|
107
|
+
upright Western run classes with kanji and has no gap of its own to begin with.
|
|
104
108
|
Line-head and line-end space, inseparable pairs, and source-authored full-em gaps after
|
|
105
109
|
question or exclamation marks stay fixed. A line with no admitted gap is forced. The choice is made for the
|
|
106
110
|
paragraph rather than line by line,
|
|
@@ -145,6 +149,11 @@ words remain unbroken and render sideways, and two ASCII digits form one
|
|
|
145
149
|
tate-chu-yoko unit. The resulting `VerticalTextPresentation` is carried by every
|
|
146
150
|
glyph item, so renderers do not need to infer orientation independently.
|
|
147
151
|
|
|
152
|
+
An upright Western character sets solid against the kana or kanji beside it rather than
|
|
153
|
+
taking the quarter em 3.2.6 puts around a sideways run, following JLReq 3.2.4: it classes
|
|
154
|
+
with kanji, the same way 3.2.5 classes a tate-chu-yoko run. `QR` and `URL` set upright by
|
|
155
|
+
this rule read flush against their surrounding Japanese text, the way a kanji compound does.
|
|
156
|
+
|
|
148
157
|
The default logical measurer uses East Asian Width in a Japanese context. Upright
|
|
149
158
|
ASCII advances by one em; proportional ASCII and the members of a tate-chu-yoko unit
|
|
150
159
|
advance by half an em. Supply a synchronous measurer when the caller has more accurate
|
|
@@ -914,7 +914,7 @@ declare const ParsedManuscriptSchema: v.SchemaWithPipe<readonly [v.StrictObjectS
|
|
|
914
914
|
}>;
|
|
915
915
|
mark: string;
|
|
916
916
|
}>]>], undefined>, undefined>, v.ReadonlyAction<(Readonly<{
|
|
917
|
-
kind: "
|
|
917
|
+
kind: "italic";
|
|
918
918
|
readonly range: Readonly<{
|
|
919
919
|
source: Readonly<{
|
|
920
920
|
start: number;
|
|
@@ -929,18 +929,8 @@ declare const ParsedManuscriptSchema: v.SchemaWithPipe<readonly [v.StrictObjectS
|
|
|
929
929
|
end: number;
|
|
930
930
|
}> & v.Brand<"GraphemeRange">;
|
|
931
931
|
}>;
|
|
932
|
-
reading: Readonly<{
|
|
933
|
-
kind: "group";
|
|
934
|
-
text: string;
|
|
935
|
-
}> | Readonly<{
|
|
936
|
-
kind: "mono";
|
|
937
|
-
readonly segments: readonly string[];
|
|
938
|
-
}> | Readonly<{
|
|
939
|
-
kind: "jukugo";
|
|
940
|
-
readonly segments: readonly string[];
|
|
941
|
-
}>;
|
|
942
932
|
}> | Readonly<{
|
|
943
|
-
kind: "
|
|
933
|
+
kind: "ruby";
|
|
944
934
|
readonly range: Readonly<{
|
|
945
935
|
source: Readonly<{
|
|
946
936
|
start: number;
|
|
@@ -955,8 +945,18 @@ declare const ParsedManuscriptSchema: v.SchemaWithPipe<readonly [v.StrictObjectS
|
|
|
955
945
|
end: number;
|
|
956
946
|
}> & v.Brand<"GraphemeRange">;
|
|
957
947
|
}>;
|
|
948
|
+
reading: Readonly<{
|
|
949
|
+
kind: "group";
|
|
950
|
+
text: string;
|
|
951
|
+
}> | Readonly<{
|
|
952
|
+
kind: "mono";
|
|
953
|
+
readonly segments: readonly string[];
|
|
954
|
+
}> | Readonly<{
|
|
955
|
+
kind: "jukugo";
|
|
956
|
+
readonly segments: readonly string[];
|
|
957
|
+
}>;
|
|
958
958
|
}> | Readonly<{
|
|
959
|
-
kind: "
|
|
959
|
+
kind: "bold";
|
|
960
960
|
readonly range: Readonly<{
|
|
961
961
|
source: Readonly<{
|
|
962
962
|
start: number;
|
|
@@ -1010,7 +1010,7 @@ declare const ParsedManuscriptSchema: v.SchemaWithPipe<readonly [v.StrictObjectS
|
|
|
1010
1010
|
}>;
|
|
1011
1011
|
}>[];
|
|
1012
1012
|
readonly annotations: readonly (Readonly<{
|
|
1013
|
-
kind: "
|
|
1013
|
+
kind: "italic";
|
|
1014
1014
|
readonly range: Readonly<{
|
|
1015
1015
|
source: Readonly<{
|
|
1016
1016
|
start: number;
|
|
@@ -1025,18 +1025,8 @@ declare const ParsedManuscriptSchema: v.SchemaWithPipe<readonly [v.StrictObjectS
|
|
|
1025
1025
|
end: number;
|
|
1026
1026
|
}> & v.Brand<"GraphemeRange">;
|
|
1027
1027
|
}>;
|
|
1028
|
-
reading: Readonly<{
|
|
1029
|
-
kind: "group";
|
|
1030
|
-
text: string;
|
|
1031
|
-
}> | Readonly<{
|
|
1032
|
-
kind: "mono";
|
|
1033
|
-
readonly segments: readonly string[];
|
|
1034
|
-
}> | Readonly<{
|
|
1035
|
-
kind: "jukugo";
|
|
1036
|
-
readonly segments: readonly string[];
|
|
1037
|
-
}>;
|
|
1038
1028
|
}> | Readonly<{
|
|
1039
|
-
kind: "
|
|
1029
|
+
kind: "ruby";
|
|
1040
1030
|
readonly range: Readonly<{
|
|
1041
1031
|
source: Readonly<{
|
|
1042
1032
|
start: number;
|
|
@@ -1051,8 +1041,18 @@ declare const ParsedManuscriptSchema: v.SchemaWithPipe<readonly [v.StrictObjectS
|
|
|
1051
1041
|
end: number;
|
|
1052
1042
|
}> & v.Brand<"GraphemeRange">;
|
|
1053
1043
|
}>;
|
|
1044
|
+
reading: Readonly<{
|
|
1045
|
+
kind: "group";
|
|
1046
|
+
text: string;
|
|
1047
|
+
}> | Readonly<{
|
|
1048
|
+
kind: "mono";
|
|
1049
|
+
readonly segments: readonly string[];
|
|
1050
|
+
}> | Readonly<{
|
|
1051
|
+
kind: "jukugo";
|
|
1052
|
+
readonly segments: readonly string[];
|
|
1053
|
+
}>;
|
|
1054
1054
|
}> | Readonly<{
|
|
1055
|
-
kind: "
|
|
1055
|
+
kind: "bold";
|
|
1056
1056
|
readonly range: Readonly<{
|
|
1057
1057
|
source: Readonly<{
|
|
1058
1058
|
start: number;
|
|
@@ -1503,7 +1503,7 @@ declare const ParsedManuscript: {
|
|
|
1503
1503
|
}>;
|
|
1504
1504
|
mark: string;
|
|
1505
1505
|
}>]>], undefined>, undefined>, v.ReadonlyAction<(Readonly<{
|
|
1506
|
-
kind: "
|
|
1506
|
+
kind: "italic";
|
|
1507
1507
|
readonly range: Readonly<{
|
|
1508
1508
|
source: Readonly<{
|
|
1509
1509
|
start: number;
|
|
@@ -1518,18 +1518,8 @@ declare const ParsedManuscript: {
|
|
|
1518
1518
|
end: number;
|
|
1519
1519
|
}> & v.Brand<"GraphemeRange">;
|
|
1520
1520
|
}>;
|
|
1521
|
-
reading: Readonly<{
|
|
1522
|
-
kind: "group";
|
|
1523
|
-
text: string;
|
|
1524
|
-
}> | Readonly<{
|
|
1525
|
-
kind: "mono";
|
|
1526
|
-
readonly segments: readonly string[];
|
|
1527
|
-
}> | Readonly<{
|
|
1528
|
-
kind: "jukugo";
|
|
1529
|
-
readonly segments: readonly string[];
|
|
1530
|
-
}>;
|
|
1531
1521
|
}> | Readonly<{
|
|
1532
|
-
kind: "
|
|
1522
|
+
kind: "ruby";
|
|
1533
1523
|
readonly range: Readonly<{
|
|
1534
1524
|
source: Readonly<{
|
|
1535
1525
|
start: number;
|
|
@@ -1544,8 +1534,18 @@ declare const ParsedManuscript: {
|
|
|
1544
1534
|
end: number;
|
|
1545
1535
|
}> & v.Brand<"GraphemeRange">;
|
|
1546
1536
|
}>;
|
|
1537
|
+
reading: Readonly<{
|
|
1538
|
+
kind: "group";
|
|
1539
|
+
text: string;
|
|
1540
|
+
}> | Readonly<{
|
|
1541
|
+
kind: "mono";
|
|
1542
|
+
readonly segments: readonly string[];
|
|
1543
|
+
}> | Readonly<{
|
|
1544
|
+
kind: "jukugo";
|
|
1545
|
+
readonly segments: readonly string[];
|
|
1546
|
+
}>;
|
|
1547
1547
|
}> | Readonly<{
|
|
1548
|
-
kind: "
|
|
1548
|
+
kind: "bold";
|
|
1549
1549
|
readonly range: Readonly<{
|
|
1550
1550
|
source: Readonly<{
|
|
1551
1551
|
start: number;
|
|
@@ -1599,7 +1599,7 @@ declare const ParsedManuscript: {
|
|
|
1599
1599
|
}>;
|
|
1600
1600
|
}>[];
|
|
1601
1601
|
readonly annotations: readonly (Readonly<{
|
|
1602
|
-
kind: "
|
|
1602
|
+
kind: "italic";
|
|
1603
1603
|
readonly range: Readonly<{
|
|
1604
1604
|
source: Readonly<{
|
|
1605
1605
|
start: number;
|
|
@@ -1614,18 +1614,8 @@ declare const ParsedManuscript: {
|
|
|
1614
1614
|
end: number;
|
|
1615
1615
|
}> & v.Brand<"GraphemeRange">;
|
|
1616
1616
|
}>;
|
|
1617
|
-
reading: Readonly<{
|
|
1618
|
-
kind: "group";
|
|
1619
|
-
text: string;
|
|
1620
|
-
}> | Readonly<{
|
|
1621
|
-
kind: "mono";
|
|
1622
|
-
readonly segments: readonly string[];
|
|
1623
|
-
}> | Readonly<{
|
|
1624
|
-
kind: "jukugo";
|
|
1625
|
-
readonly segments: readonly string[];
|
|
1626
|
-
}>;
|
|
1627
1617
|
}> | Readonly<{
|
|
1628
|
-
kind: "
|
|
1618
|
+
kind: "ruby";
|
|
1629
1619
|
readonly range: Readonly<{
|
|
1630
1620
|
source: Readonly<{
|
|
1631
1621
|
start: number;
|
|
@@ -1640,8 +1630,18 @@ declare const ParsedManuscript: {
|
|
|
1640
1630
|
end: number;
|
|
1641
1631
|
}> & v.Brand<"GraphemeRange">;
|
|
1642
1632
|
}>;
|
|
1633
|
+
reading: Readonly<{
|
|
1634
|
+
kind: "group";
|
|
1635
|
+
text: string;
|
|
1636
|
+
}> | Readonly<{
|
|
1637
|
+
kind: "mono";
|
|
1638
|
+
readonly segments: readonly string[];
|
|
1639
|
+
}> | Readonly<{
|
|
1640
|
+
kind: "jukugo";
|
|
1641
|
+
readonly segments: readonly string[];
|
|
1642
|
+
}>;
|
|
1643
1643
|
}> | Readonly<{
|
|
1644
|
-
kind: "
|
|
1644
|
+
kind: "bold";
|
|
1645
1645
|
readonly range: Readonly<{
|
|
1646
1646
|
source: Readonly<{
|
|
1647
1647
|
start: number;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ManuscriptResult, c as DiagnosticSeverity, d as ManuscriptRangeInput, i as ParsedManuscript, l as DiagnosticOrigin, n as ValidationIssue, o as ManuscriptDiagnostic, r as NamespacedId, s as ManuscriptDiagnosticInput, t as ComposedManuscript, u as ManuscriptRange } from "./composed-manuscript-
|
|
2
|
-
import { d as NovelCompositionSettings, f as ManuscriptComposer, i as NovelLayout, l as VerticalTextPresentation, p as ManuscriptParser, r as novelComposer, t as NovelComposedManuscript, u as FontPresetId } from "./novel-composer-
|
|
1
|
+
import { a as ManuscriptResult, c as DiagnosticSeverity, d as ManuscriptRangeInput, i as ParsedManuscript, l as DiagnosticOrigin, n as ValidationIssue, o as ManuscriptDiagnostic, r as NamespacedId, s as ManuscriptDiagnosticInput, t as ComposedManuscript, u as ManuscriptRange } from "./composed-manuscript-C0f3mxKs.mjs";
|
|
2
|
+
import { d as NovelCompositionSettings, f as ManuscriptComposer, i as NovelLayout, l as VerticalTextPresentation, p as ManuscriptParser, r as novelComposer, t as NovelComposedManuscript, u as FontPresetId } from "./novel-composer-DhycV9B3.mjs";
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
//#region src/parser/parse-error.d.ts
|
|
5
5
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as ManuscriptResult, d as NamespacedId, f as ManuscriptRange, h as readonlyObject, l as ManuscriptDiagnostic, o as graphemeSegmenter, s as ValidationIssue } from "./question-or-exclamation-spacing-B5o23ZLf.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-
|
|
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-DRgsEA2s.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.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ManuscriptResult, i as ParsedManuscript, n as ValidationIssue, o as ManuscriptDiagnostic, r as NamespacedId, t as ComposedManuscript } from "./composed-manuscript-
|
|
1
|
+
import { a as ManuscriptResult, i as ParsedManuscript, n as ValidationIssue, o as ManuscriptDiagnostic, r as NamespacedId, t as ComposedManuscript } from "./composed-manuscript-C0f3mxKs.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/proofreading/invalid-rule-options.d.ts
|
|
4
4
|
/**
|
|
@@ -306,11 +306,19 @@ const HIRAGANA = /^\p{Script=Hiragana}$/u;
|
|
|
306
306
|
const KATAKANA = /^\p{Script=Katakana}$/u;
|
|
307
307
|
const WESTERN = /^[\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}]$/u;
|
|
308
308
|
/**
|
|
309
|
-
* Order matters: a character inside a tate-chu-yoko group is cl-30
|
|
310
|
-
*
|
|
309
|
+
* Order matters: a character inside a tate-chu-yoko group is cl-30 (3.2.5) and an upright Latin
|
|
310
|
+
* letter or Arabic numeral is cl-19 (3.2.4), whatever either would be on its own; anything left
|
|
311
|
+
* unmatched is cl-19 too, the class JLReq reserves for kanji and the like.
|
|
312
|
+
*
|
|
313
|
+
* The quarter em 3.2.6 sets between Japanese and a Western character or numeral applies only to a
|
|
314
|
+
* character rotated 90 degrees in vertical writing mode or mixed into horizontal writing mode —
|
|
315
|
+
* 3.2.6 states that scope explicitly. A character set upright keeps its own rule, 3.2.4, which
|
|
316
|
+
* reads it as a full-width monospace glyph classed with kanji and set solid against its neighbours,
|
|
317
|
+
* the same as a tate-chu-yoko run's 3.2.5.
|
|
311
318
|
*/
|
|
312
319
|
function classify({ value, presentation }) {
|
|
313
320
|
if (presentation === "tate-chu-yoko") return "cl-30";
|
|
321
|
+
if (presentation === "upright") return "cl-19";
|
|
314
322
|
if (OPENING.has(value)) return "cl-01";
|
|
315
323
|
if (CLOSING.has(value)) return "cl-02";
|
|
316
324
|
if (HYPHENS.has(value)) return "cl-03";
|
|
@@ -457,7 +465,9 @@ const FIXED_QUARTER = {
|
|
|
457
465
|
};
|
|
458
466
|
/**
|
|
459
467
|
* `1/4-1/8` in 表3 with `1/4-1/2` in 表6: the Japanese-to-western quarter em, reducible to an eighth
|
|
460
|
-
* and expandable to a half.
|
|
468
|
+
* and expandable to a half. 3.2.6 sets this only against a Western character rotated 90 degrees or
|
|
469
|
+
* mixed into horizontal text (cl-27) and a numeral or unit symbol (cl-24, cl-25); an upright
|
|
470
|
+
* Western character classifies as cl-19 instead and never reaches this constant.
|
|
461
471
|
*/
|
|
462
472
|
const MIXED_TEXT_QUARTER = {
|
|
463
473
|
kind: "glue",
|
|
@@ -568,9 +578,10 @@ const EDGE_WORD_SPACE = {
|
|
|
568
578
|
naturalWidthEm: 0
|
|
569
579
|
};
|
|
570
580
|
/**
|
|
571
|
-
* The classes that take a quarter em against a numeral, unit symbol or western character
|
|
572
|
-
*
|
|
573
|
-
* is
|
|
581
|
+
* The classes that take a quarter em against a numeral, unit symbol or western character rotated 90
|
|
582
|
+
* degrees or mixed into horizontal text (3.2.6) — an upright western character classifies as cl-19
|
|
583
|
+
* and is covered by the general kanji rows and columns instead. Dividing punctuation is on the list
|
|
584
|
+
* in that direction only, because the space before a `?` or `!` is solid (3.1.6).
|
|
574
585
|
*/
|
|
575
586
|
const JAPANESE_BEFORE_WESTERN = [
|
|
576
587
|
"cl-04",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ManuscriptResult, i as ParsedManuscript, t as ComposedManuscript } from "./composed-manuscript-
|
|
1
|
+
import { a as ManuscriptResult, i as ParsedManuscript, t as ComposedManuscript } from "./composed-manuscript-C0f3mxKs.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/result/rejection.d.ts
|
|
4
4
|
declare const RejectionSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ManuscriptResult, i as ParsedManuscript, n as ValidationIssue, r as NamespacedId } from "./composed-manuscript-
|
|
2
|
-
import { a as InlineMeasureRequest, c as logicalInlineMeasurer, f as ManuscriptComposer, m as Rejection, n as createNovelComposer, o as InlineMeasurement, p as ManuscriptParser, s as InlineMeasurer } from "./novel-composer-
|
|
1
|
+
import { a as ManuscriptResult, i as ParsedManuscript, n as ValidationIssue, r as NamespacedId } from "./composed-manuscript-C0f3mxKs.mjs";
|
|
2
|
+
import { a as InlineMeasureRequest, c as logicalInlineMeasurer, f as ManuscriptComposer, m as Rejection, n as createNovelComposer, o as InlineMeasurement, p as ManuscriptParser, s as InlineMeasurer } from "./novel-composer-DhycV9B3.mjs";
|
|
3
3
|
export { type InlineMeasureRequest, type InlineMeasurement, type InlineMeasurer, type ManuscriptComposer, type ManuscriptParser, ManuscriptResult, NamespacedId, ParsedManuscript, type Rejection, ValidationIssue, createNovelComposer, logicalInlineMeasurer };
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { c as ManuscriptResult, d as NamespacedId, s as ValidationIssue } from "./question-or-exclamation-spacing-B5o23ZLf.mjs";
|
|
2
|
-
import { a as logicalInlineMeasurer, p as ParsedManuscript, t as createNovelComposer } from "./novel-composer-
|
|
2
|
+
import { a as logicalInlineMeasurer, p as ParsedManuscript, t as createNovelComposer } from "./novel-composer-DRgsEA2s.mjs";
|
|
3
3
|
export { ManuscriptResult, NamespacedId, ParsedManuscript, ValidationIssue, createNovelComposer, logicalInlineMeasurer };
|