@sushichan044/kg-core 0.9.2 → 0.9.4
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 +28 -28
- package/dist/index.mjs +1 -1
- package/dist/lint.d.mts +30 -30
- 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 +2 -2
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,11 +1,11 @@
|
|
|
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
|
/**
|
|
6
6
|
* Everything that can go wrong while turning source text into a {@link ParsedManuscript}.
|
|
7
7
|
*/
|
|
8
|
-
type ParseError = Readonly<{
|
|
8
|
+
export type ParseError = Readonly<{
|
|
9
9
|
kind: "InvalidParserId";
|
|
10
10
|
parserId: string;
|
|
11
11
|
}> | Readonly<{
|
|
@@ -21,7 +21,7 @@ type ParseError = Readonly<{
|
|
|
21
21
|
parserId: NamespacedId;
|
|
22
22
|
cause: unknown;
|
|
23
23
|
}>;
|
|
24
|
-
declare const ParseError: {
|
|
24
|
+
export declare const ParseError: {
|
|
25
25
|
/**
|
|
26
26
|
* Human-readable rendering. Branch on `kind` instead when the caller needs to react.
|
|
27
27
|
*/
|
|
@@ -33,27 +33,27 @@ type ParseManuscriptOptions = Readonly<{
|
|
|
33
33
|
parser?: ManuscriptParser;
|
|
34
34
|
}>;
|
|
35
35
|
type ParseOutcome = ManuscriptResult<ParsedManuscript, ParseError>;
|
|
36
|
-
declare function parseManuscript(source: string, options?: ParseManuscriptOptions): ParseOutcome;
|
|
36
|
+
export declare function parseManuscript(source: string, options?: ParseManuscriptOptions): ParseOutcome;
|
|
37
37
|
//#endregion
|
|
38
38
|
//#region src/parser/kakuyomu-parser.d.ts
|
|
39
39
|
/**
|
|
40
40
|
* Understands Kakuyomu's ruby and emphasis-mark notation. Invalid notation stays literal so source
|
|
41
41
|
* ranges remain inspectable, while clear notation candidates receive a parser warning.
|
|
42
42
|
*/
|
|
43
|
-
declare const kakuyomuParser: ManuscriptParser;
|
|
43
|
+
export declare const kakuyomuParser: ManuscriptParser;
|
|
44
44
|
//#endregion
|
|
45
45
|
//#region src/parser/pixiv-parser.d.ts
|
|
46
46
|
/**
|
|
47
47
|
* Understands Pixiv's ruby, bold, italic and emphasis-mark notation. Anything bracket-shaped that
|
|
48
48
|
* does not parse is kept as literal text and reported as a warning rather than dropped.
|
|
49
49
|
*/
|
|
50
|
-
declare const pixivParser: ManuscriptParser;
|
|
50
|
+
export declare const pixivParser: ManuscriptParser;
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region src/parser/plain-text-parser.d.ts
|
|
53
53
|
/**
|
|
54
54
|
* Treats the source verbatim: no notation, no annotations, display text equals source.
|
|
55
55
|
*/
|
|
56
|
-
declare const plainTextParser: ManuscriptParser;
|
|
56
|
+
export declare const plainTextParser: ManuscriptParser;
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/parser/parsed-grapheme.d.ts
|
|
59
59
|
declare const ParsedGraphemeSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
@@ -1596,7 +1596,7 @@ declare const RubyAnnotation: {
|
|
|
1596
1596
|
/**
|
|
1597
1597
|
* Everything that can go wrong while placing a parsed manuscript onto pages.
|
|
1598
1598
|
*/
|
|
1599
|
-
type ComposeError = Readonly<{
|
|
1599
|
+
export type ComposeError = Readonly<{
|
|
1600
1600
|
kind: "InvalidComposerId";
|
|
1601
1601
|
composerId: string;
|
|
1602
1602
|
}> | Readonly<{
|
|
@@ -1619,7 +1619,7 @@ type ComposeError = Readonly<{
|
|
|
1619
1619
|
composerId: NamespacedId;
|
|
1620
1620
|
cause: unknown;
|
|
1621
1621
|
}>;
|
|
1622
|
-
declare const ComposeError: {
|
|
1622
|
+
export declare const ComposeError: {
|
|
1623
1623
|
/**
|
|
1624
1624
|
* Human-readable rendering. Branch on `kind` instead when the caller needs to react.
|
|
1625
1625
|
*/
|
|
@@ -1631,7 +1631,7 @@ type ComposeManuscriptOptions<TSettings, TLayout> = Readonly<{
|
|
|
1631
1631
|
composer: ManuscriptComposer<TSettings, TLayout>;
|
|
1632
1632
|
settings: TSettings;
|
|
1633
1633
|
}>;
|
|
1634
|
-
declare function composeManuscript<TSettings, TLayout>(parsed: ParsedManuscript, options: ComposeManuscriptOptions<TSettings, TLayout>): ManuscriptResult<ComposedManuscript<TSettings, TLayout>, ComposeError>;
|
|
1634
|
+
export declare function composeManuscript<TSettings, TLayout>(parsed: ParsedManuscript, options: ComposeManuscriptOptions<TSettings, TLayout>): ManuscriptResult<ComposedManuscript<TSettings, TLayout>, ComposeError>;
|
|
1635
1635
|
//#endregion
|
|
1636
1636
|
//#region src/composer/novel-flow-settings.d.ts
|
|
1637
1637
|
declare const NovelFlowSettingsSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
@@ -1651,8 +1651,8 @@ declare const NovelFlowSettingsSchema: v.SchemaWithPipe<readonly [v.StrictObject
|
|
|
1651
1651
|
* These are counts of em cells, not physical lengths. `ManuscriptGeometry` turns them into
|
|
1652
1652
|
* millimetres once a paper size and a font size are known.
|
|
1653
1653
|
*/
|
|
1654
|
-
type NovelFlowSettings = v.InferOutput<typeof NovelFlowSettingsSchema>;
|
|
1655
|
-
declare const NovelFlowSettings: {
|
|
1654
|
+
export type NovelFlowSettings = v.InferOutput<typeof NovelFlowSettingsSchema>;
|
|
1655
|
+
export declare const NovelFlowSettings: {
|
|
1656
1656
|
readonly schema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
1657
1657
|
readonly lineLengthEm: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
1658
1658
|
readonly linesPerStage: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
@@ -1748,8 +1748,8 @@ declare const ManuscriptOffsetsSchema: v.SchemaWithPipe<readonly [v.StrictObject
|
|
|
1748
1748
|
* novel reserves the opening pages and keeps the top and bottom of each block of text clear, in
|
|
1749
1749
|
* whole lines rather than in millimetres, so the grid stays intact.
|
|
1750
1750
|
*/
|
|
1751
|
-
type ManuscriptOffsets = v.InferOutput<typeof ManuscriptOffsetsSchema>;
|
|
1752
|
-
declare const ManuscriptOffsets: {
|
|
1751
|
+
export type ManuscriptOffsets = v.InferOutput<typeof ManuscriptOffsetsSchema>;
|
|
1752
|
+
export declare const ManuscriptOffsets: {
|
|
1753
1753
|
readonly schema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
1754
1754
|
readonly document: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
1755
1755
|
readonly leading: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
@@ -1823,8 +1823,8 @@ declare const ManuscriptAppearanceSettingsSchema: v.SchemaWithPipe<readonly [v.S
|
|
|
1823
1823
|
/**
|
|
1824
1824
|
* Everything that changes the physical dimensions of a page, but not how text fills the grid.
|
|
1825
1825
|
*/
|
|
1826
|
-
type ManuscriptAppearanceSettings = v.InferOutput<typeof ManuscriptAppearanceSettingsSchema>;
|
|
1827
|
-
declare const ManuscriptAppearanceSettings: {
|
|
1826
|
+
export type ManuscriptAppearanceSettings = v.InferOutput<typeof ManuscriptAppearanceSettingsSchema>;
|
|
1827
|
+
export declare const ManuscriptAppearanceSettings: {
|
|
1828
1828
|
readonly schema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
1829
1829
|
readonly paperSize: v.PicklistSchema<["a4", "a5", "a6", "jis-b5", "jis-b6", "shinsho"], undefined>;
|
|
1830
1830
|
readonly fontSizePt: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 6, undefined>, v.MaxValueAction<number, 24, undefined>, v.MultipleOfAction<number, 0.5, undefined>]>;
|
|
@@ -1847,8 +1847,8 @@ declare const PaperSizeIdSchema: v.PicklistSchema<["a4", "a5", "a6", "jis-b5", "
|
|
|
1847
1847
|
* ISO A sizes, the JIS B series (which is not the ISO B series), and the two trim sizes Japanese
|
|
1848
1848
|
* publishing names rather than measures: A6 is the 文庫本 and `shinsho` the 新書判.
|
|
1849
1849
|
*/
|
|
1850
|
-
type PaperSizeId = v.InferOutput<typeof PaperSizeIdSchema>;
|
|
1851
|
-
declare const PaperSizeId: {
|
|
1850
|
+
export type PaperSizeId = v.InferOutput<typeof PaperSizeIdSchema>;
|
|
1851
|
+
export declare const PaperSizeId: {
|
|
1852
1852
|
readonly schema: v.PicklistSchema<["a4", "a5", "a6", "jis-b5", "jis-b6", "shinsho"], undefined>;
|
|
1853
1853
|
readonly is: (value: unknown) => value is PaperSizeId;
|
|
1854
1854
|
};
|
|
@@ -1885,8 +1885,8 @@ declare const ManuscriptGeometrySchema: v.SchemaWithPipe<readonly [v.StrictObjec
|
|
|
1885
1885
|
* `fitsPaper` is false when the requested grid is larger than the paper. The geometry is still
|
|
1886
1886
|
* returned in full so a caller can show what overflowed instead of being handed nothing.
|
|
1887
1887
|
*/
|
|
1888
|
-
type ManuscriptGeometry = v.InferOutput<typeof ManuscriptGeometrySchema>;
|
|
1889
|
-
declare const ManuscriptGeometry: {
|
|
1888
|
+
export type ManuscriptGeometry = v.InferOutput<typeof ManuscriptGeometrySchema>;
|
|
1889
|
+
export declare const ManuscriptGeometry: {
|
|
1890
1890
|
readonly schema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
1891
1891
|
readonly paperWidthMm: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
1892
1892
|
readonly paperHeightMm: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -1918,12 +1918,12 @@ declare const ManuscriptGeometry: {
|
|
|
1918
1918
|
};
|
|
1919
1919
|
//#endregion
|
|
1920
1920
|
//#region src/appearance/font-preset.d.ts
|
|
1921
|
-
type FontPreset = Readonly<{
|
|
1921
|
+
export type FontPreset = Readonly<{
|
|
1922
1922
|
id: FontPresetId;
|
|
1923
1923
|
label: string;
|
|
1924
1924
|
family: string;
|
|
1925
1925
|
}>;
|
|
1926
|
-
declare const FontPreset: {
|
|
1926
|
+
export declare const FontPreset: {
|
|
1927
1927
|
readonly of: (id: FontPresetId) => FontPreset;
|
|
1928
1928
|
readonly all: readonly Readonly<{
|
|
1929
1929
|
id: FontPresetId;
|
|
@@ -1937,8 +1937,8 @@ declare const FontSizePtSchema: v.SchemaWithPipe<readonly [v.NumberSchema<undefi
|
|
|
1937
1937
|
/**
|
|
1938
1938
|
* A manuscript cell pitch in points, constrained to the steps the settings UI can express.
|
|
1939
1939
|
*/
|
|
1940
|
-
type FontSizePt = v.InferOutput<typeof FontSizePtSchema>;
|
|
1941
|
-
declare const FontSizePt: {
|
|
1940
|
+
export type FontSizePt = v.InferOutput<typeof FontSizePtSchema>;
|
|
1941
|
+
export declare const FontSizePt: {
|
|
1942
1942
|
readonly schema: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>, v.MinValueAction<number, 6, undefined>, v.MaxValueAction<number, 24, undefined>, v.MultipleOfAction<number, 0.5, undefined>]>;
|
|
1943
1943
|
readonly range: {
|
|
1944
1944
|
readonly min: 6;
|
|
@@ -1949,13 +1949,13 @@ declare const FontSizePt: {
|
|
|
1949
1949
|
};
|
|
1950
1950
|
//#endregion
|
|
1951
1951
|
//#region src/appearance/paper-size.d.ts
|
|
1952
|
-
type PaperSize = Readonly<{
|
|
1952
|
+
export type PaperSize = Readonly<{
|
|
1953
1953
|
id: PaperSizeId;
|
|
1954
1954
|
label: string;
|
|
1955
1955
|
widthMm: number;
|
|
1956
1956
|
heightMm: number;
|
|
1957
1957
|
}>;
|
|
1958
|
-
declare const PaperSize: {
|
|
1958
|
+
export declare const PaperSize: {
|
|
1959
1959
|
readonly of: (id: PaperSizeId) => PaperSize;
|
|
1960
1960
|
readonly all: readonly Readonly<{
|
|
1961
1961
|
id: PaperSizeId;
|
|
@@ -20985,4 +20985,4 @@ declare const TextRange: {
|
|
|
20985
20985
|
}>, "range end must not precede its start">]>;
|
|
20986
20986
|
};
|
|
20987
20987
|
//#endregion
|
|
20988
|
-
export { type BoldAnnotation,
|
|
20988
|
+
export { type BoldAnnotation, type ComposeManuscriptOptions, type ComposedAnnotationFragment, type ComposedGlue, type ComposedGlyph, type ComposedInlineItem, type ComposedKern, type ComposedManuscript, type CompositionStatistics, type DiagnosticOrigin, type DiagnosticSeverity, type DisplayRange, type EmphasisAnnotation, FontPresetId, type GraphemeRange, type InlineSpan, type ItalicAnnotation, type LineBreakResult, type LineOffset, type ManuscriptAnnotation, ManuscriptDiagnostic, type ManuscriptDiagnosticInput, ManuscriptRange, type ManuscriptRangeInput, ManuscriptResult, type NovelComposedManuscript, NovelCompositionSettings, type NovelLayout, type NovelLine, type NovelPage, type NovelStage, type ParseManuscriptOptions, type ParsedGrapheme, type ParsedManuscript, type RubyAnnotation, type RubyKind, type RubyReading, type SourcePosition, type SourceRange, type SuppressedInlineItem, type TextRange, type VerticalTextPresentation, novelComposer };
|
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,17 +1,17 @@
|
|
|
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
|
/**
|
|
5
5
|
* A built-in rule factory was given options it cannot honour. Distinct from {@link ProofreadError}
|
|
6
6
|
* because it happens while configuring rules, long before any manuscript is checked.
|
|
7
7
|
*/
|
|
8
|
-
type InvalidRuleOptions = Readonly<{
|
|
8
|
+
export type InvalidRuleOptions = Readonly<{
|
|
9
9
|
kind: "InvalidRuleOptions";
|
|
10
10
|
ruleId: string;
|
|
11
11
|
option: string;
|
|
12
12
|
issues: readonly ValidationIssue[];
|
|
13
13
|
}>;
|
|
14
|
-
declare const InvalidRuleOptions: {
|
|
14
|
+
export declare const InvalidRuleOptions: {
|
|
15
15
|
readonly describe: (error: InvalidRuleOptions) => string;
|
|
16
16
|
};
|
|
17
17
|
//#endregion
|
|
@@ -19,7 +19,7 @@ declare const InvalidRuleOptions: {
|
|
|
19
19
|
/**
|
|
20
20
|
* Everything that can go wrong while running a set of rules over a manuscript.
|
|
21
21
|
*/
|
|
22
|
-
type ProofreadError = Readonly<{
|
|
22
|
+
export type ProofreadError = Readonly<{
|
|
23
23
|
kind: "InvalidRuleId";
|
|
24
24
|
ruleId: string;
|
|
25
25
|
}> | Readonly<{
|
|
@@ -42,7 +42,7 @@ type ProofreadError = Readonly<{
|
|
|
42
42
|
ruleId: NamespacedId;
|
|
43
43
|
cause: unknown;
|
|
44
44
|
}>;
|
|
45
|
-
declare const ProofreadError: {
|
|
45
|
+
export declare const ProofreadError: {
|
|
46
46
|
/**
|
|
47
47
|
* Human-readable rendering. Branch on `kind` instead when the caller needs to react.
|
|
48
48
|
*/
|
|
@@ -253,8 +253,8 @@ declare const ProofreadingRuleMetaSchema: v.SchemaWithPipe<readonly [v.StrictObj
|
|
|
253
253
|
[x: string]: string;
|
|
254
254
|
}>;
|
|
255
255
|
}>]>;
|
|
256
|
-
type ProofreadingRuleMeta = v.InferOutput<typeof ProofreadingRuleMetaSchema>;
|
|
257
|
-
declare const ProofreadingRuleMeta: {
|
|
256
|
+
export type ProofreadingRuleMeta = v.InferOutput<typeof ProofreadingRuleMetaSchema>;
|
|
257
|
+
export declare const ProofreadingRuleMeta: {
|
|
258
258
|
readonly schema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
259
259
|
readonly id: v.StringSchema<undefined>;
|
|
260
260
|
readonly messages: v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, v.ReadonlyAction<{
|
|
@@ -300,12 +300,12 @@ type ProofreadOptions<TRule> = Readonly<{
|
|
|
300
300
|
}>;
|
|
301
301
|
type Diagnostics = readonly ManuscriptDiagnostic[];
|
|
302
302
|
type ProofreadOutcome = ManuscriptResult<Diagnostics, ProofreadError>;
|
|
303
|
-
declare function proofreadManuscript(manuscript: ParsedManuscript, options: ProofreadOptions<ParsedProofreadingRule>): ProofreadOutcome;
|
|
303
|
+
export declare function proofreadManuscript(manuscript: ParsedManuscript, options: ProofreadOptions<ParsedProofreadingRule>): ProofreadOutcome;
|
|
304
304
|
/**
|
|
305
305
|
* Rules are typed against the exact composed manuscript being checked, so a grid-specific rule
|
|
306
306
|
* cannot be handed a manuscript from a different composer.
|
|
307
307
|
*/
|
|
308
|
-
declare function proofreadManuscript<TComposed extends ComposedManuscript>(manuscript: TComposed, options: ProofreadOptions<ParsedProofreadingRule | ComposedProofreadingRule<TComposed>>): ProofreadOutcome;
|
|
308
|
+
export declare function proofreadManuscript<TComposed extends ComposedManuscript>(manuscript: TComposed, options: ProofreadOptions<ParsedProofreadingRule | ComposedProofreadingRule<TComposed>>): ProofreadOutcome;
|
|
309
309
|
//#endregion
|
|
310
310
|
//#region src/proofreading/rules/consistent-kanji-opening.d.ts
|
|
311
311
|
declare const KanjiOpeningPairSchema: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
@@ -328,8 +328,8 @@ type KanjiOpeningPair = v.InferOutput<typeof KanjiOpeningPairSchema>;
|
|
|
328
328
|
type ConsistentKanjiOpeningOptions = Readonly<{
|
|
329
329
|
pairs?: readonly KanjiOpeningPair[];
|
|
330
330
|
}>;
|
|
331
|
-
declare const consistentKanjiOpeningRule: () => ParsedProofreadingRule;
|
|
332
|
-
declare function createConsistentKanjiOpeningRule(options?: ConsistentKanjiOpeningOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
331
|
+
export declare const consistentKanjiOpeningRule: () => ParsedProofreadingRule;
|
|
332
|
+
export declare function createConsistentKanjiOpeningRule(options?: ConsistentKanjiOpeningOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
333
333
|
//#endregion
|
|
334
334
|
//#region src/proofreading/rules/consistent-latin-width.d.ts
|
|
335
335
|
/**
|
|
@@ -338,7 +338,7 @@ declare function createConsistentKanjiOpeningRule(options?: ConsistentKanjiOpeni
|
|
|
338
338
|
* run that may turn sideways — so mixing them is 表記ゆれ the reader can see. Which one a work uses is
|
|
339
339
|
* its own choice, hence a warning.
|
|
340
340
|
*/
|
|
341
|
-
declare const consistentLatinWidthRule: () => ParsedProofreadingRule;
|
|
341
|
+
export declare const consistentLatinWidthRule: () => ParsedProofreadingRule;
|
|
342
342
|
//#endregion
|
|
343
343
|
//#region src/proofreading/rules/consistent-numeral-width.d.ts
|
|
344
344
|
/**
|
|
@@ -346,7 +346,7 @@ declare const consistentLatinWidthRule: () => ParsedProofreadingRule;
|
|
|
346
346
|
* its own em; a halfwidth pair sets as 縦中横 inside one. Mixing them is 表記ゆれ, but which one a work
|
|
347
347
|
* uses is its own choice, hence a warning.
|
|
348
348
|
*/
|
|
349
|
-
declare const consistentNumeralWidthRule: () => ParsedProofreadingRule;
|
|
349
|
+
export declare const consistentNumeralWidthRule: () => ParsedProofreadingRule;
|
|
350
350
|
//#endregion
|
|
351
351
|
//#region src/proofreading/rules/dash.d.ts
|
|
352
352
|
declare const DashCharacterSchema: v.PicklistSchema<readonly ["―", "—", "─"], undefined>;
|
|
@@ -354,8 +354,8 @@ type DashCharacter = v.InferOutput<typeof DashCharacterSchema>;
|
|
|
354
354
|
type DashOptions = Readonly<{
|
|
355
355
|
preferred?: DashCharacter;
|
|
356
356
|
}>;
|
|
357
|
-
declare const dashRule: () => ParsedProofreadingRule;
|
|
358
|
-
declare function createDashRule(options?: DashOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
357
|
+
export declare const dashRule: () => ParsedProofreadingRule;
|
|
358
|
+
export declare function createDashRule(options?: DashOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
359
359
|
//#endregion
|
|
360
360
|
//#region src/proofreading/rules/default-rules.d.ts
|
|
361
361
|
/**
|
|
@@ -365,7 +365,7 @@ declare function createDashRule(options?: DashOptions): ManuscriptResult<ParsedP
|
|
|
365
365
|
* Rules whose answer depends on the work's own conventions — which width numerals take, whether a
|
|
366
366
|
* word is written in kanji or kana — are exported individually instead of included here.
|
|
367
367
|
*/
|
|
368
|
-
declare function createDefaultProofreadingRules(): readonly ParsedProofreadingRule[];
|
|
368
|
+
export declare function createDefaultProofreadingRules(): readonly ParsedProofreadingRule[];
|
|
369
369
|
//#endregion
|
|
370
370
|
//#region src/proofreading/rules/ellipsis-character.d.ts
|
|
371
371
|
/**
|
|
@@ -373,14 +373,14 @@ declare function createDefaultProofreadingRules(): readonly ParsedProofreadingRu
|
|
|
373
373
|
* into a 2倍リーダ; a run of ASCII periods is neither. Runs of `。` and `・` are left to the rules that
|
|
374
374
|
* already count them, so one substitute is never reported twice.
|
|
375
375
|
*/
|
|
376
|
-
declare const ellipsisCharacterRule: () => ParsedProofreadingRule;
|
|
376
|
+
export declare const ellipsisCharacterRule: () => ParsedProofreadingRule;
|
|
377
377
|
//#endregion
|
|
378
378
|
//#region src/proofreading/rules/even-ellipsis.d.ts
|
|
379
379
|
/**
|
|
380
380
|
* The ellipsis a novel sets is the 2倍リーダ: two copies of `…` read as one mark six dots long. An odd
|
|
381
381
|
* run leaves half of it, the same way an odd dash run does.
|
|
382
382
|
*/
|
|
383
|
-
declare const evenEllipsisRule: () => ParsedProofreadingRule;
|
|
383
|
+
export declare const evenEllipsisRule: () => ParsedProofreadingRule;
|
|
384
384
|
//#endregion
|
|
385
385
|
//#region src/proofreading/rules/fullwidth-japanese-punctuation.d.ts
|
|
386
386
|
/**
|
|
@@ -392,14 +392,14 @@ declare const evenEllipsisRule: () => ParsedProofreadingRule;
|
|
|
392
392
|
* The three checks differ in how much the surroundings decide the answer, which is why only the
|
|
393
393
|
* first is decisive on its own.
|
|
394
394
|
*/
|
|
395
|
-
declare const fullwidthJapanesePunctuationRule: () => ParsedProofreadingRule;
|
|
395
|
+
export declare const fullwidthJapanesePunctuationRule: () => ParsedProofreadingRule;
|
|
396
396
|
//#endregion
|
|
397
397
|
//#region src/proofreading/rules/max-arabic-numeral-digits.d.ts
|
|
398
398
|
type MaxArabicNumeralDigitsOptions = Readonly<{
|
|
399
399
|
maxDigits?: number;
|
|
400
400
|
}>;
|
|
401
|
-
declare const maxArabicNumeralDigitsRule: () => ParsedProofreadingRule;
|
|
402
|
-
declare function createMaxArabicNumeralDigitsRule(options?: MaxArabicNumeralDigitsOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
401
|
+
export declare const maxArabicNumeralDigitsRule: () => ParsedProofreadingRule;
|
|
402
|
+
export declare function createMaxArabicNumeralDigitsRule(options?: MaxArabicNumeralDigitsOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
403
403
|
//#endregion
|
|
404
404
|
//#region src/proofreading/rules/minus-before-number.d.ts
|
|
405
405
|
/**
|
|
@@ -407,14 +407,14 @@ declare function createMaxArabicNumeralDigitsRule(options?: MaxArabicNumeralDigi
|
|
|
407
407
|
* prolonged sound mark, which look alike but belong to different character classes and so are
|
|
408
408
|
* spaced and broken differently.
|
|
409
409
|
*/
|
|
410
|
-
declare const minusBeforeNumberRule: () => ParsedProofreadingRule;
|
|
410
|
+
export declare const minusBeforeNumberRule: () => ParsedProofreadingRule;
|
|
411
411
|
//#endregion
|
|
412
412
|
//#region src/proofreading/rules/no-consecutive-interpunct.d.ts
|
|
413
413
|
/**
|
|
414
414
|
* A repeated interpunct (中黒, JLReq 中点類 cl-05). The interpunct separates items; repeating it is
|
|
415
415
|
* almost always a stand-in for an ellipsis, which `kg/ellipsis-character` names properly.
|
|
416
416
|
*/
|
|
417
|
-
declare const noConsecutiveInterpunctRule: () => ParsedProofreadingRule;
|
|
417
|
+
export declare const noConsecutiveInterpunctRule: () => ParsedProofreadingRule;
|
|
418
418
|
//#endregion
|
|
419
419
|
//#region src/proofreading/rules/no-consecutive-punctuation.d.ts
|
|
420
420
|
/**
|
|
@@ -422,14 +422,14 @@ declare const noConsecutiveInterpunctRule: () => ParsedProofreadingRule;
|
|
|
422
422
|
* so a run of them is not punctuation at all: it is a sentence trailing off, which Japanese prose
|
|
423
423
|
* writes with `…`.
|
|
424
424
|
*/
|
|
425
|
-
declare const noConsecutivePunctuationRule: () => ParsedProofreadingRule;
|
|
425
|
+
export declare const noConsecutivePunctuationRule: () => ParsedProofreadingRule;
|
|
426
426
|
//#endregion
|
|
427
427
|
//#region src/proofreading/rules/paragraph-opening.d.ts
|
|
428
428
|
type ParagraphOpeningOptions = Readonly<{
|
|
429
429
|
openingBrackets?: string;
|
|
430
430
|
}>;
|
|
431
|
-
declare const paragraphOpeningRule: () => ParsedProofreadingRule;
|
|
432
|
-
declare function createParagraphOpeningRule(options?: ParagraphOpeningOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
431
|
+
export declare const paragraphOpeningRule: () => ParsedProofreadingRule;
|
|
432
|
+
export declare function createParagraphOpeningRule(options?: ParagraphOpeningOptions): ManuscriptResult<ParsedProofreadingRule, InvalidRuleOptions>;
|
|
433
433
|
//#endregion
|
|
434
434
|
//#region src/proofreading/rules/punctuation-before-closing-quote.d.ts
|
|
435
435
|
/**
|
|
@@ -437,7 +437,7 @@ declare function createParagraphOpeningRule(options?: ParagraphOpeningOptions):
|
|
|
437
437
|
* the quotation, and both characters are set on a half em, so the pair reads as a gap in the line
|
|
438
438
|
* rather than as punctuation. Japanese practice drops the punctuation and keeps the bracket.
|
|
439
439
|
*/
|
|
440
|
-
declare const punctuationBeforeClosingQuoteRule: () => ParsedProofreadingRule;
|
|
440
|
+
export declare const punctuationBeforeClosingQuoteRule: () => ParsedProofreadingRule;
|
|
441
441
|
//#endregion
|
|
442
442
|
//#region src/proofreading/rules/space-after-question-or-exclamation.d.ts
|
|
443
443
|
/**
|
|
@@ -446,7 +446,7 @@ declare const punctuationBeforeClosingQuoteRule: () => ParsedProofreadingRule;
|
|
|
446
446
|
* carried. A run at the end of a line or right before a closing bracket is already separated from
|
|
447
447
|
* what follows and needs no gap; anywhere else it takes exactly one ideographic space.
|
|
448
448
|
*/
|
|
449
|
-
declare const spaceAfterQuestionOrExclamationRule: () => ParsedProofreadingRule;
|
|
449
|
+
export declare const spaceAfterQuestionOrExclamationRule: () => ParsedProofreadingRule;
|
|
450
450
|
//#endregion
|
|
451
451
|
//#region src/proofreading/rules/variant-character.d.ts
|
|
452
452
|
/**
|
|
@@ -456,6 +456,6 @@ declare const spaceAfterQuestionOrExclamationRule: () => ParsedProofreadingRule;
|
|
|
456
456
|
*
|
|
457
457
|
* Scans the source rather than the display text: notation removal must not hide a variant.
|
|
458
458
|
*/
|
|
459
|
-
declare const variantCharacterRule: () => ParsedProofreadingRule;
|
|
459
|
+
export declare const variantCharacterRule: () => ParsedProofreadingRule;
|
|
460
460
|
//#endregion
|
|
461
|
-
export {
|
|
461
|
+
export type { ComposedProofreadingRule, ConsistentKanjiOpeningOptions, DashOptions, KanjiOpeningPair, MaxArabicNumeralDigitsOptions, ParagraphOpeningOptions, ParsedProofreadingRule, ProofreadOptions, ProofreadingReport, ProofreadingRule, ProofreadingRuleContext, ProofreadingRuleMessages };
|
|
@@ -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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sushichan044/kg-core",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Framework-independent parsing, composition, and proofreading for Japanese manuscripts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"japanese",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"publint": "0.3.24",
|
|
61
61
|
"typescript": "7.0.2",
|
|
62
62
|
"unplugin-unused": "0.6.0",
|
|
63
|
-
"vite-plus": "0.3.
|
|
63
|
+
"vite-plus": "0.3.1"
|
|
64
64
|
},
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=22.12.0"
|